akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<cmath>
#include<cstdio>
#include<queue>
using namespace std;
typedef pair<int,int> ii;
typedef long long ll;
typedef pair<ll,ll> pll;
const int INF=1e9;
const ll MOD=1e9+7;

ll gcd(ll x,ll y){
    if(y==0) return 0;
    return gcd(y,x%y);
}

int dis2(int x1,int y1,int x2,int y2){
    return (x1-x2)*(x1-x2)+(y1-y2)*(y1-y2);
}
ll se=0;
ll sume(vector<int> a,int n){

}
int main(){
    ll n;cin>>n;
    ll ans=0;
    ll e=1;
    for(ll p=2;p*p<=n;p++)if(n%p==0){
        e=1;
        ll tmp=0;
        while(n%p==0){
            n/=p;
            tmp++;
        }
        while(tmp-e>=0){
            tmp-=e;
            ans++;
            e++;
        }
    }
  if(n>1) ans++;
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 3184
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>

using namespace std;

const int64_t MOD = 1000000007;
const int MAXN = 100010;
int N;
bool vis[MAXN];
int64_t dp[2][MAXN];
vector<int> V[MAXN];
int son[MAXN];

void dfs(int node, int prev) {
    vis[node] = true;

    for (auto nxt: V[node]) {
        if (nxt == prev) continue;
        if (!vis[nxt]) dfs(nxt, node);
        
    }

    for (auto nxt: V[node]) {
        if (nxt == prev) continue;
        dp[1][node] = (dp[1][node] * dp[0][nxt]) % MOD ;
        dp[0][node] = (dp[0][node] * (dp[0][nxt] + dp[1][nxt])) % MOD;
    }
     
}

int main() {
    cin >> N;
    for (int i = 1; i <= N - 1; i++) {
        int from, to;
        cin >> from >> to;
        V[from].push_back(to);
        V[to].push_back(from);
    }
    for (int i = 1; i <= N; i++) {
        dp[0][i] = 1;
        dp[1][i] = 1;
    }

    dfs(1, 0);
    // for (int i = 1; i <= N; i++) {
    //     if (!vis[i]) dfs(i);
    // }


    int64_t ans = (dp[1][1] + dp[0][1]) % MOD;
    // for (int i = 0; i <= N; i++) {
    //     ans = max(ans,dp[1][i] + dp[0][i] );
    // }
    cout << ans;
    return 0;
}

Measured memory_bytes: 14336
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int k = sc.nextInt();
		
		List<Integer> aList = method1(a);
		List<Integer> bList = method1(b);
		
		List<Integer> ansList = new ArrayList<>();
		
		for (Integer d: aList) {
			for(Integer e: bList) {
				if (d.equals(e)) {
					ansList.add(e);
				}
			}
		}
		System.out.println(ansList.get(ansList.size()-k));
	}
	
	public static List<Integer> method1(int a) {
		List<Integer> list = new ArrayList<>();
		for(int i=1; i<=a; i++) {
			if (a%i==0) {
				list.add(Integer.valueOf(i));
			}
		}
		return list;
	}
}

Measured memory_bytes: 23760
#include <iostream>
#include <stack>

using namespace std;

int main() {
    stack<int> st;
    while(true) {
        string s;
        cin >> s;
        if(s[0]==EOF) break;
        if(s=="+") {
            int a = st.top(); st.pop();
            int b = st.top(); st.pop();
            st.push(a+b);
        }else if(s=="-") {
            int a = st.top(); st.pop();
            int b = st.top(); st.pop();
            st.push(b-a);
        }else if(s=="*") {
            int a = st.top(); st.pop();
            int b = st.top(); st.pop();
            st.push(a*b);
        }else{
            try {
                int ans = stoi(s);
                st.push(ans);
            } catch (invalid_argument& e){
                break;
            }
        }
    }
    cout << st.top() << endl;
    return 0;
}


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

int H,W;
int A[30][30];

int dist(int x,int y){
	int sm = 0;
	for(int i = 0; i < H; i++){
		for(int j = 0; j < W; j++){
			sm += min(abs(x-i),abs(y-j)) * A[i][j];
		}
	}
	return sm;
}

int main(){
	cin >> H >> W;
	for(int i = 0; i < H; i++){
		for(int j = 0; j < W; j++){
			cin >> A[i][j];
		}
	}

	int ans = 1000000000;
	for(int i = 0; i < H; i++){
		for(int j = 0; j < W; j++){
			ans = min(ans,dist(i,j));
		}
	}
	cout << ans << endl;

	return 0;
}



Measured memory_bytes: 3112
fn main(){
    struct Judge{
        AC:i32,
        WA:i32,
        TLE:i32,
        RE:i32
    }
    let mut data = Judge{AC:0, WA:0, TLE:0, RE:0};
    let count:usize = read();
    for i in 0..count{
        let mut get:String = read();
        if get == "AC"{
            data.AC += 1;
        }else if get == "WA"{
            data.WA += 1;
        }else if get == "TLE"{
            data.TLE += 1;
        }else{
            data.RE += 1;
        }
    }
    println!("AC x {}", data.AC);
    println!("WA x {}", data.WA);
    println!("TLE x {}", data.TLE);
    println!("RE x {}", data.RE);
}

fn read<T: std::str::FromStr>() -> T{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

Measured memory_bytes: 2116
#include <bits/stdc++.h>
using namespace std;
typedef int64_t i64;

int main() {
  int N, Y;
  cin >> N >> Y;
  for (int a = 0; a <= N; a++) {
    for (int b = 0; b <= N - a; b++) {
      int c = N - a - b;
      if (a * 10000 + b * 5000 + c * 1000 == Y) {
        cout << a << " " << b << " " << c << endl;
        return 0;
      }
    }
  }
  cout << -1 << " " << -1 << " " << -1 << endl;
}


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

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            Scanner cin = new Scanner();
            var N = cin.Long();
            var A = cin.Long();
            var B = cin.Long();

            long ans;
            if (A > B) ans = 0;
            else if (A == B) ans = 1;
            else
            {
                if (N == 1) ans = 0;
                else ans = A + (N - 1) * B - (N - 1) * A - B + 1;
            }
            Console.WriteLine(ans);
            Console.ReadLine();
        }
    }

        class Scanner //標準入力
    {
        string[] s;
        int i;

        char[] cs = new char[] { ' ' };

        public Scanner()
        {
            s = new string[0];
            i = 0;
        }

        public string next()
        {
            if (i < s.Length) return s[i++];
            string st = Console.ReadLine();
            while (st == "") st = Console.ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            if (s.Length == 0) return next();
            i = 0;
            return s[i++];
        }

        public int Int()
        {
            return int.Parse(next());
        }
        public int[] ArrayInt(int N, int add = 0)
        {
            int[] Array = new int[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = Int() + add;
            }
            return Array;
        }

        public long Long()
        {
            return long.Parse(next());
        }

        public long[] ArrayLong(int N, long add = 0)
        {
            long[] Array = new long[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = Long() + add;
            }
            return Array;
        }

        public double Double()
        {
            return double.Parse(next());
        }


        public double[] ArrayDouble(int N, double add = 0)
        {
            double[] Array = new double[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = Double() + add;
            }
            return Array;
        }
    }
}



Measured memory_bytes: 13140
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) {
        FastScanner fs = new FastScanner(System.in);
        int H = fs.nextInt(), W = fs.nextInt(), h = fs.nextInt(), w = fs.nextInt();
        System.out.println(H*W-H*w-W*h+h*w);
    }
}

class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;

    public FastScanner(InputStream in) {
        reader = new BufferedReader(new InputStreamReader(in));
        tokenizer = null;
    }

    public String next() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }
    public String nextLine() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                return reader.readLine();
            } catch (IOException e) {
                    throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken("\n");
    }

    public long nextLong() {
        return Long.parseLong(next());
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

    public double nextDouble() {
        return Double.parseDouble(next());
    }

    public int[] nextIntArray(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++) a[i] = nextInt();
        return a;
    }

    public long[] nextLongArray(int n) {
        long[] a = new long[n];
        for (int i = 0; i < n; i++) a[i] = nextLong();
        return a;
    }

}

Measured memory_bytes: 21204
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <numeric>

using namespace std;

int main(){
    string s;
    cin>>s;
    int ans=0;
    int cnt=0;
    for(int i=0;i<s.size();i++){
        if(s[i]=='A' || s[i]=='T' || s[i]=='G' || s[i]=='C'){
            cnt++;
        }
        else cnt=0;
        ans=max(ans,cnt);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string.h>
#include<algorithm>
using namespace std;
typedef long long ll;
ll ANS = 1e10, sum;
struct node
{
    int c, a[20];
} p[20];
int ans[15], v[20];
int n, m, x,ii;
void dfs(int cnt, int pre)
{
    if (cnt == ii)
    {
        sum = 0;
        fill(v, v + 20, 0);  //记录总的学习程度
        for (int j = 0; j < cnt; j++)
        {
            for (int k = 0; k < m; k++)
                v[k] += p[ans[j]].a[k];
            sum += p[ans[j]].c;
        }
        int flag = 1;
        for (int j = 0; j < m; j++)
            if (v[j] < x)
            {
                flag = 0;
                break;
            }
        if (flag)
            ANS = min(ANS, sum);
        return;
    }
    for (int j = 0; j <= n; j++)
    {
        if (j > pre)
        {
            pre = j;
            ans[cnt] = pre;
            dfs(cnt + 1, pre);
        }
    }
}
int main()
{
    cin >> n >> m >> x;
    for (int i = 1; i <= n; i++)
    {
        cin >> p[i].c;
        for (int j = 0; j < m; j++)
            cin >> p[i].a[j];
    }
    for (ii = 1; ii <= n; ii++)
    {
        dfs(0, 0);
    }
    if (ANS == 1e10)
        puts("-1");
    else
        cout << ANS;
    return 0;
}


Measured memory_bytes: 3572
N, M = map(int, input().split())
ab = []
cd = []
for i in range(N):
  tmp = list(map(int, input().split()))
  ab.append(tmp)
for j in range(M):
  tmp = list(map(int, input().split()))
  cd.append(tmp)
for i in range(N):
  tmp = 10**10
  tmp2 = 0
  for j in range(M):
    if tmp > abs(ab[i][0]-cd[j][0])+abs(ab[i][1]-cd[j][1]):
      tmp = abs(ab[i][0]-cd[j][0])+abs(ab[i][1]-cd[j][1])
      tmp2 = j
  print(tmp2+1)

Measured memory_bytes: 69660
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<cstdio>
#include<sstream>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
using namespace std;
//kaewasuretyuui
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef pair<int,pii> pip;
typedef vector<pip>vip;
const double PI=acos(-1);
const double EPS=1e-8;
const int inf=1e8;
int f[6][6]={
  {-1,3,5,2,4,-1},
  {4,-1,1,6,-1,3},
  {2,6,-1,-1,1,5},
  {5,1,-1,-1,6,2},
  {3,-1,6,1,-1,4},
  {-1,4,2,5,3,-1}
};
int main(){
  int n;
  while(cin>>n,n){
    vvp in(110,vp(110));
    rep(i,n){
      int a,b;
      cin>>a>>b;
      if(!i){
	in[55][55]=pii(a,1);
	continue;
      }
      int c=f[a-1][b-1];
      int x=55,y=55;
      while(1){
	//cout<<a<<" "<<b<<" "<<c<<endl;
	//cout<<x<<" "<<y<<endl;
	int ma=-1;
	if(in[x+1][y].second<in[x][y].second&&b>3)ma=max(ma,b);
	if(in[x][y+1].second<in[x][y].second&&c>3)ma=max(ma,c);
	if(in[x-1][y].second<in[x][y].second&&7-b>3)ma=max(ma,7-b);
	if(in[x][y-1].second<in[x][y].second&&7-c>3)ma=max(ma,7-c);
	if(ma==-1)break;
	int na,nb,nc;
	if(b==ma){
	  na=7-b,nb=a,nc=c;
	  x++;
	}else if(c==ma){
	  na=7-c,nb=b,nc=a;
	  y++;
	}else if(7-b==ma){
	  na=b,nb=7-a,nc=c;
	  x--;
	}else{
	  na=c,nb=b,nc=7-a;
	  y--;
	}
	a=na;b=nb;c=nc;
      }
      in[x][y].second++;
      in[x][y].first=a;
      
      /*      vi out(7);
      rep(k,110)rep(j,110)out[in[k][j].first]++;
      rep(k,5)cout<<out[k+1]<<" ";
      cout<<out[6]<<endl;*/
    }
    vi out(7);
    rep(i,110)rep(j,110)out[in[i][j].first]++;
    rep(i,5)cout<<out[i+1]<<" ";
    cout<<out[6]<<endl;
  }
}

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

namespace contest_Csharp
{
    class Program
    {
        static long power(long a, long b, long modulo)
        {
            long result = 1;
            long buff = a;
            for (long i = 1; i <= b; i *= 2)
            {
                result = result * ((b / i % (2) == 1) ? buff : 1) % modulo;
                buff = (buff * buff) % modulo;
            }
            return result % modulo;
        }
        static void Main(string[] args)
        {
            var vals = Console.ReadLine().Split(' ')
               .Select(x => int.Parse(x)).ToList();
            var vals2 = Console.ReadLine().Split(' ')
              .Select(x => int.Parse(x)).ToList();
            var vals3 = Console.ReadLine().Split(' ')
              .Select(x => int.Parse(x)).ToList();
            var H = vals[0];
            var W = vals2[0];
            var N = vals3[0];
            var a = Math.Max(H, W);
            Console.WriteLine((N+a-1)/a);


        }



    }
    class PriorityQueue<T> where T : IComparable<T>
    {
        private List<T> heap = new List<T>();
        private int lastindex = -1;
        private void swap(int n, int m)
        {
            T wait = heap[n];
            heap[n] = heap[m];
            heap[m] = wait;
        }
        public int Count()
        {
            return lastindex + 1;
        }
        public void Enqueue(T data)
        {
            int p;
            if (lastindex + 1 < heap.Count())
            {
                heap[lastindex + 1] = data;
            }
            else
            {
                heap.Add(data);
            }
            lastindex++;
            p = lastindex;

            while (true)
            {
                if (p > 0 && heap[p].CompareTo(heap[(p - 1) / 2]) <= -1)
                {
                    swap(p, (p - 1) / 2);
                    p = (p - 1) / 2;
                }
                else
                {
                    break;
                }
            }
        }
        public T Peek()
        {
            return heap[0];
        }
        public T Dequeue()
        {
            T result = Peek();
            heap[0] = default(T);
            swap(0, lastindex);
            lastindex--;
            int p = 0;
            while (true)
            {
                int np;
                if (2 * p + 1 > lastindex)
                {
                    break;
                }
                else
                {
                    np = ((2 * p + 1 == lastindex) || heap[2 * p + 1].CompareTo(heap[2 * p + 2]) <= -1)
                        ? (2 * p + 1) : (2 * p + 2);
                }
                if (heap[p].CompareTo(heap[np]) >= 1)
                {
                    swap(p, np);
                    p = np;
                }
                else
                {
                    break;
                }
            }

            return result;
        }





    }
}


Measured memory_bytes: 11220
#include<iostream>
#include<string>
#include<math.h>
using namespace std;

int main() {
	long long X;
	cin >> X;
	int place = 0;
	int i;
	for (i = 1; place < X; i++)place += i;
	cout << i-1 << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
//#include <boost/multiprecision/cpp_int.hpp>
//using multiInt = boost::multiprecision::cpp_int;

using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template<typename Q_temp>
using smaller_queue = priority_queue <Q_temp, vector<Q_temp>, greater<Q_temp> >;

const int INF = (int) 1e9;
const ll LINF = (ll) 4e18;
const ll MOD = (ll) (1e9 + 7);
const double PI = acos(-1.0);
const int limit = 200010;

#define REP(i,m,n) for(ll i = m; i < (ll)(n); ++i)
#define rep(i,n) REP(i, 0, n)
#define MP make_pair
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << endl
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define dbg2(x_) for(auto a_ : x_) cerr << a_ << " "; cerr << endl;
#define dbg3(x_ , sx_) rep(i, sx_) cerr << x_[i] << " "; cerr << endl;
vector<int> Dx = {0, 0, -1, 1, -1, 1, -1, 1, 0};
vector<int> Dy = {1, -1, 0, 0, -1, -1, 1, 1, 0};

//------------------------------------------------------

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

    rep(i, n - 1) {
        int a;
        cin >> a;
        g = __gcd(g, a);
    }
    cout << g << endl;
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <climits>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <cassert>

using namespace std;

#define LOG(...) printf(__VA_ARGS__)
//#define LOG(...)
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).rbegin(),(c).rend())
#define CLR(a) memset((a), 0 ,sizeof(a))

typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

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

const int MAX_N = 300000;
int main() {
	int n;

	vi ms;
	ms.push_back(6);
	for(int i = 7;i < MAX_N;i+=7){
		bool t = true;
		for(auto m:ms){
			if((i + 1)%m == 0){
				t = false;
				break;
			}
		}
		if(t) ms.push_back(i + 1);

		t = true;
		for(auto m:ms){
			if((i + 6)%m == 0){
				t = false;
				break;
			}
		}
		if(t) ms.push_back(i + 6);
	}

	while(cin >> n, n != 1){
		cout << n << ":";
		for(auto m:ms){
			if(m > n)break;
			if(n % m == 0){
				cout << " " << m;
			}
		}
		cout << endl;
	}
}

Measured memory_bytes: 1348
import numpy as np
n, m = map(int, input().split())
A = []
for _ in range(n):
  __ = input().split()
  A.append(np.array(__, dtype=int))
ans = []
for i in range(m):
  ans.append(i+1)
_ans = ans.copy()
for a in A:
  for i in range(len(ans)):
    if not ans[i] in a[1:]:
      _ans.remove(ans[i])
  ans = _ans.copy()
  
print(len(_ans))

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

using namespace std;
typedef long long ll;

int main() {
    int w, h;
    cin >> w >> h;

    vector<pair<ll, bool>> v;
    for (int i = 0; i < w; i++) {
        int p;
        cin >> p;
        v.emplace_back(p, true);
    }
    for (int i = 0; i < h; i++) {
        int q;
        cin >> q;
        v.emplace_back(q, false);
    }
    sort(v.begin(), v.end());

    ll ret = 0;
    for (auto x:v) {
        if (x.second) {
            ret += x.first * (h + 1);
            w--;
        } else {
            ret += x.first * (w + 1);
            h--;
        }
    }

    cout << ret << endl;
    return 0;
}

Measured memory_bytes: 6512
#include<stdio.h>

int main(){
  int a,b,c,max=0,sum=0;
  scanf("%d %d %d",&a,&b,&c);
  sum=a+b+c;
  if(a>b) max=a;
  else max=b;
  if(max<c) max=c;
  if((max*3-sum)%2==0) printf("%d\n",(max*3-sum)/2);
  else printf("%d\n",(max*3-sum+3)/2);
}

Measured memory_bytes: 128
class Node():
    def __init__(self,parent=-1,left=-1,right=-1,depth=0,height=-1,degree=0,sibling=-1,typ='internal node'):
        self.parent=parent
        self.left=left
        self.right=right
        self.depth=depth
        self.height=height
        self.degree=degree
        self.sibling=sibling
        self.typ=typ
        
def depth(node,i,n):
    node[i].depth=n
    if node[i].left!=-1:
        depth(node,node[i].left,n+1)
    if node[i].right!=-1:
        depth(node,node[i].right,n+1)

def height(node,i):
    hl,hr=0,0
    if node[i].left!=-1:
        height(node,node[i].left)
        hl=node[node[i].left].height+1
    if node[i].right!=-1:
        height(node,node[i].right)
        hr=node[node[i].right].height+1
    node[i].height=max(hl,hr)
    

n=int(input())
N=[Node() for i in range(n)]
for i in range(n):
    p,l,r=[int(i) for i in input().split()]
    if l!=-1:
        N[p].left=l
        N[l].parent=p
        N[p].degree+=1
        if r != -1:
            N[l].sibling=r
            N[r].sibling=l
    if r!=-1:
        N[p].right=r
        N[r].parent=p
        N[p].degree+=1
    elif l==-1 and r==-1:
        N[p].typ='leaf'
        N[p].height=0


for i in range(n):
    height(N,i)
    if N[i].parent==-1:
        N[i].typ='root'
        depth(N,i,0)

for i in range(n):
    print('node '+str(i)+': parent = '+str(N[i].parent)+', sibling = '+str(N[i].sibling)+', degree = '+str(N[i].degree)+', depth = '+str(N[i].depth)+', height = '+str(N[i].height)+', '+N[i].typ)


    
    


Measured memory_bytes: 5628
#include<stdio.h>
#define MAX 100000

int parent(int);
int left(int);
int right(int);

int main(){
  int n,i,A[MAX+1];

  scanf("%d",&n);
  for(i=1;i<=n;i++){
    scanf("%d",&A[i]);
  }
  for(i=1;i<=n;i++){
    printf("node %d: key = %d, ",i,A[i]);
    if(parent(i) >= 1)printf("parent key = %d, ",A[parent(i)]);
    if(left(i) <= n)printf("left key = %d, ",A[left(i)]);
    if(right(i) <= n)printf("right key = %d, ",A[right(i)]);
    printf("\n");
  }
  return 0;
}
int parent(int i){
  return i/2;
}
int left(int i){
return 2*i;
}
int right(int i){
  return 2*i+1;
}



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

int main() {
  int N;
  cin >> N;
  int SUM = 0;
  
  int F, L;
  for(int i=0;i<N;i++){
    cin >> F >> L;
    SUM += (L - F + 1);
  }
  cout << SUM << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define rep(i,n) for (int i=0;i<(int)(n);i++)
#define codefor int test;scanf("%d",&test);while(test--)
#define INT(...) int __VA_ARGS__;in(__VA_ARGS__)
#define LL(...) ll __VA_ARGS__;in(__VA_ARGS__)
#define yn(ans) if(ans)printf("Yes\n");else printf("No\n")
#define YN(ans) if(ans)printf("YES\n");else printf("NO\n")
#define vector1d(type,name,...) vector<type>name(__VA_ARGS__)
#define vector2d(type,name,h,...) vector<vector<type>>name(h,vector<type>(__VA_ARGS__))
#define umap unordered_map
#define uset unordered_set
using namespace std;
using ll = long long;
const int MOD=1000000007;
//入力系
void scan(int& a){scanf("%d",&a);}
void scan(long long& a){scanf("%lld",&a);}
template<class T> void scan(T& a){cin>>a;}
template<class T> void scan(vector<T>& vec){for(auto&& it:vec)scan(it);}
void in(){}
template <class Head, class... Tail> void in(Head& head, Tail&... tail){scan(head);in(tail...);}
//出力系
void print(const int& a){printf("%d",a);}
void print(const long long& a){printf("%lld",a);}
void print(const double& a){printf("%.15lf",a);}
template<class T> void print(const T& a){cout<<a;}
template<class T> void print(const vector<T>& vec){if(vec.empty())return;print(vec[0]);for(auto it=vec.begin();++it!= vec.end();){putchar(' ');print(*it);}}
void out(){putchar('\n');}
template<class T> void out(const T& t){print(t);putchar('\n');}
template <class Head, class... Tail> void out(const Head& head,const Tail&... tail){print(head);putchar(' ');out(tail...);}
//デバッグ系
template<class T> void dprint(const T& a){cerr<<a;}
template<class T> void dprint(const vector<T>& vec){if(vec.empty())return;cerr<<vec[0];for(auto it=vec.begin();++it!= vec.end();){cerr<<" "<<*it;}}
void debug(){cerr<<endl;}
template<class T> void debug(const T& t){dprint(t);cerr<<endl;}
template <class Head, class... Tail> void debug(const Head& head, const Tail&... tail){dprint(head);cerr<<" ";debug(tail...);}
ll intpow(ll a, ll b){ ll ans = 1; while(b){ if(b & 1) ans *= a; a *= a; b /= 2; } return ans; }
ll modpow(ll a, ll b, ll p){ ll ans = 1; while(b){ if(b & 1) (ans *= a) %= p; (a *= a) %= p; b /= 2; } return ans; }
ll updivide(ll a,ll b){if(a%b==0) return a/b;else return (a/b)+1;}

ll convert(vector<int> &vec){
    vector<int> con={0,3,5,7};
    ll ans=0,d=1;
    for(int i=0;i<vec.size();i++){
        ans+=con[vec[i]]*d;
        d*=10;
    }
    return ans;
}

bool hanbetu(vector<int> &vec){
    bool a=false,b=false,c=false,d=true;
    for(int i=0;i<vec.size();i++){
        if(vec[i]==3)a=true;
        if(vec[i]==2)b=true;
        if(vec[i]==1)c=true;
        if(vec[i]==0)d=false;
    }
    return (a&&b&&c&&d);
}

int main(){
    INT(n);
    int m=intpow(4,9);
    ll d,ans=0;
    for(int i=1;i<m;i++){
        vector<int> vec;
        d=1;
        while(d<=i){
            vec.push_back((i/d)%4);
            d*=4;
        }
        if(convert(vec)>n)break;
        ans+=(hanbetu(vec)==true);
    }
    out(ans);
}


Measured memory_bytes: 3760
/*alurquiza*/
//
#include <bits/stdc++.h>

using namespace std;

const int SIZE = 18,SIZE2 = 1 << SIZE;
int DP[SIZE2];
int MAX[SIZE2][4];
vector<int> V(SIZE2);

bool comp(const int &a,const int &b){
    if(a == -1)
        return false;
    if(b == -1)
        return true;

    if(V[a] >= V[b])
        return true;
    return false;
}

void join(int mask,int smask){
    MAX[mask][2] = MAX[smask][0];
    MAX[mask][3] = MAX[smask][1];

    int N = 4;
    stable_sort(MAX[mask],MAX[mask] + N);
    N = unique(MAX[mask],MAX[mask] + N) - MAX[mask];

    stable_sort(MAX[mask],MAX[mask] + N,comp);
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

//    freopen(".in","r",stdin);
//    freopen("F.out","w",stdout);

    int N;
    cin >> N;

    for(int i = 0;i < (1 << N);i++)
        cin >> V[i];

    for(int mask = 0;mask < (1 << N);mask++){
        MAX[mask][0] = mask;
        MAX[mask][1] = -1;

        for(int i = 0;(1 << i) <= mask;i++){
            if((1 << i) & mask){
                int nmask = mask ^ (1 << i);
                join(mask,nmask);
            }
        }
        if(MAX[mask][1] != -1)
            DP[mask] = V[MAX[mask][1]];
        DP[mask] += V[MAX[mask][0]];
    }

    for(int i = 1;i < (1 << N);i++){
        DP[i] = max(DP[i],DP[i - 1]);
        cout << DP[i] << '\n';
    }

    return 0;
}


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

int main() {
  ll n,mod = 1e9+7;
  cin >> n;
  vector<ll>a(n);
  vector<ll>sum(n+1);
  rep(i,0,n){
    cin >> a[i];
    sum[i+1] = a[i]+sum[i];
  }
  ll ans = 0;
  rep(i,0,n){
    ll tmp = ((a[i]%mod)*((sum[n]-sum[i+1])%mod))%mod;
    ans = (ans+tmp)%mod;
  }
  cout << ans << endl;
}

Measured memory_bytes: 6424
/****************************************************
*   Template for coding contests                    *
*   Author    :    Sanjeev Sharma                   *
*   Email     :    thedevelopersanjeev@gmail.com    *
*****************************************************/
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int a, b;
    cin >>a >>b;
    if(a >= 13)
        cout <<b;
    else if(a >= 6 && a <= 12)
        cout <<b / 2;
    else 
        cout <<0;
    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            string data = Console.ReadLine();

            int[] map = new int[data.Length + 1];
            map[0] = 0;
            int updown = 0;

            for (int i = 0; i < data.Length; i++)
            {
                if (data[i] == '\\') updown--;
                else if (data[i] == '/') updown++;

                map[i + 1] = updown;
            }

            List<int> areaList = new List<int>();
            int area = 0;

            bool isSearch = false;
            int searchNum;
            int nextPoint = 0;

            for (int i = 1; i < map.Length; i++)
            {
                if (!isSearch)
                {
                    if (map[i - 1] > map[i])
                    {
                        searchNum = i;

                        while (map[searchNum - 1] >= map[searchNum] && searchNum != map.Length - 1)
                        {
                            searchNum++;
                        }

                        int tempMax = map[searchNum];

                        while (map[i - 1] > map[searchNum] && searchNum != map.Length - 1)
                        {
                            searchNum++;
                            if (tempMax < map[searchNum]) tempMax = map[searchNum];
                        }

                        nextPoint = tempMax;
                        isSearch = true;
                    }
                }

                if (isSearch)
                {
                    if (map[i - 1] < map[i])
                    {
                        searchNum = i - 1;

                        while (map[i] != map[searchNum] && searchNum > 0)
                        {
                            searchNum--;
                        }

                        area += i - searchNum - 1;

                        if (map[i] == nextPoint)
                        {
                            areaList.Add(area);
                            area = 0;
                            isSearch = false;
                        }
                    }
                }
            }

            StringBuilder sb = new StringBuilder();
            sb.AppendLine(areaList.Sum().ToString());
            sb.Append(areaList.Count);
            foreach (var a in areaList) sb.Append(" " + a);
            Console.WriteLine(sb);
        }
    }
}

Measured memory_bytes: 9780
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) FOR(i, 0, (n))
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define LAR(a, b) ((a)=max((a),(b)))
#define SML(a, b) ((a)=min((a),(b)))
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vl = vector<ll>;
using pii = pair<int, int>;
using vpii = vector<pair<int, int>>;
template<typename T>
using pque = priority_queue<T, vector<T>, greater<T>>;
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define ALL(a) (a).begin(), (a).end()
#ifdef LOCAL_DEBUG
#define DEBUG(...) printf(__VA_ARGS__)
#else
#define DEBUG(...)
#endif

int main(){
	int n; scanf("%d", &n);
	REP(i, 20){
		int a = i*1000-n;
		if(a >= 0){
			printf("%d\n", a);
			return 0;
		}
	}
}


Measured memory_bytes: 3816
#include <iostream>
#include <list>
#include <random>

#define llong long long
#define rep(i,l,n) for(int (i)=(l);(i)<(n);(i++))

using namespace std;

int D;

int change(int,int,int*,int*,int*,list<int>*);
int swap_contest(int,int,int*,int*,int*,list<int>*);

int main(){
	cin >> D;
	int c[26],s[D*26],t[D];
	rep(i,0,26) cin >> c[i];
	rep(i,0,D) rep(j,0,26) cin >> s[i*26+j];
	rep(i,0,D) t[i] = i%26;
	
	list<int> day[26];
	rep(i,0,26) day[i].push_front(0);
	rep(i,0,D) day[t[i]].push_back(i+1);
	rep(i,0,26) day[i].push_back(D+1);
	
	random_device rd;
	mt19937 mt(rd());
	uniform_int_distribution<int> type(0,1);
	uniform_int_distribution<int> contest(0,25);
	uniform_int_distribution<int> days(1,D);
	
	int M=100000;
	rep(i,0,M){
		int k = type(mt);
		if( k==0 ){
			int d = days(mt),q = contest(mt);
			if( 0 < change(d,q,t,c,s,day) ){
				t[d-1] = q;
			}
		}else{
			int d1 = days(mt), d2 = days(mt);
			if( 0 < swap_contest(d1,d2,t,c,s,day) ){
				swap(t[d1-1],t[d2-1]);
			}
		}
	}
	
	rep(i,0,D) cout << t[i]+1 << endl;
	
	return 0;
}

// d���ڂɊJ�Â����R���e�X�g��q�ɕς���
// �Ԃ�l : �X�R�A�̍���
int change(int d,int q,int *t,int *c,int *s,list<int> *day){
	int p = t[d-1],delta=0;
	// �R���e�X�g p ���J�Â���Ȃ����Ƃɂ��e��
	for(list<int>::iterator itr=day[p].begin();itr!=day[p].end();itr++){
		if( *itr == d ){	// �K���ǂ����Ɋ܂܂��
			list<int>::iterator back=itr,next=itr; back--; next++;
			// �K��0���擪�Ɋ܂܂�Ă���̂�itr!=begin
			// �K��D+1���I�[�Ɋ܂܂�Ă���̂�next!=end
			delta -= c[p]*(d-*back)*(*next-d)+s[(d-1)*26+p];
			day[p].erase(itr);
			break;
		}
	}
	// �R���e�X�g q ���J�Â���邱�Ƃɂ��e��
	for(list<int>::iterator itr=day[q].begin();;itr++){
		if( *itr > d ){
			// �I�[��D+1�ŕK�������|���邱�Ƃ��ۏ؂����
			list<int>::iterator back=itr; back--;
			day[q].insert(itr,d);
			delta += c[q]*(d-*back)*(*itr-d)+s[(d-1)*26+q];
			break;
		}
	}
	return delta;
}

// d1���ڂ�d2���ڂ̃R���e�X�g�����ւ���
// �Ԃ�l : �X�R�A�̍���
int swap_contest(int d1,int d2,int *t,int *c,int *s,list<int> *day){
	int p = t[d1-1],q = t[d2-1];
	return change(d1,q,t,c,s,day)+change(d2,p,t,c,s,day);
}


Measured memory_bytes: 4892
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <string>
#include <cstring>
#include <queue>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <map>
#include <numeric>
#include <functional>
#include <cmath>
#include <cassert>
#include <string>
#include <iostream>

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
const int mod = 1000000007;
const ll MOD = 1000000007;
const ll INF = 1LL << 60;

int solve()
{
   ll n, m;
   cin >> n >> m;
   ll x[m];
   for (int i = 0; i < m; i++)
   {
      cin >> x[i];
   }
   if (n >= m)
   {
      cout << 0 << endl;
      return 0;
   }

   sort(x, x + m);
   vector<ll> v;
   for (int i = 0; i < m - 1; i++)
   {
      v.push_back(abs(x[i + 1] - x[i]));
   }
   sort(v.begin(), v.end(), greater<ll>());
   ll ans = 0;
   for (int i = n - 1; i < v.size(); i++)
   {
      ans += v[i];
   }
   cout << ans << endl;

   return 0;
}

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

   solve();
}

Measured memory_bytes: 2168
# include <bits/stdc++.h>
# define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
# define reps(i, n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
# define rrep(i, n) for(int i=((int)(n)-1); i>=0; --i)
# define rreps(i, n) for(int i=((int)(n)); i>0; --i)
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
# define optimize_cin() cin.tie(0); ios::sync_with_stdio(false)
using namespace std;
using lint = long long;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const long long INF = 1LL << 60;

int main()
{
    int n;
    cin >> n;
    int a[n];
    rep(i,n) cin >> a[i];

    int ans[n];

    rep(i,n){
        ans[a[i]-1] = i+1;
    }

    rep(i,n) cout << ans[i] << " ";
    return 0;
}

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

int main() {
  int a;
  cin >> a;
  int h = a / 100;
  int t = (a - h * 100) / 10;
  int o = (a - h * 100 - t * 10);
  cout << h + t + o << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
/*{{{*/  //template
#define rep(i,n) for(int i=0;i<n;i++)
constexpr int INF = numeric_limits<int>::max()/2;
constexpr long long LINF = numeric_limits<long long>::max()/3;
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define sz(x) (int)(x).size()
#define debug(x) cerr<<#x<<":"<<x<<endl
#define debug2(x,y) cerr<<#x<<","<<#y":"<<x<<","<<y<<endl
//struct fin{ fin(){ cin.tie(0); ios::sync_with_stdio(false); } } fin_;
struct Double{ double d; explicit Double(double x) : d(x){} };
ostream& operator<<(ostream& os,const Double x){ os << fixed << setprecision(20) << x.d; return os; }
template<typename T> ostream& operator<<(ostream& os,const vector<T>& vec){ os << "["; for(const auto& v : vec){ os << v << ","; } os << "]"; return os; }
template<typename T,typename U> ostream& operator<<(ostream& os,const pair<T,U>& p){ os << "(" << p.first << ","<< p.second <<")"; return os; }
template<typename T> ostream& operator<<(ostream& os,const set<T>& st){ os<<"{"; for(T v:st) os<<v<<","; os <<"}"; return os; }
template<typename T,typename U> inline void chmax(T &x,U y){ if(y>x) x = y; }
template<typename T,typename U> inline void chmin(T &x,U y){ if(y<x) x = y; }
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
ll gcd(ll a,ll b){ if(b==0) return a; else return gcd(b,a%b); }
//constexpr double eps = 1e-14; 
constexpr double eps = 1e-10; 
constexpr ll mod = 1e9+7;
const int dx[]={1,0,-1,0} ,dy[] = {0,1,0,-1};
/*}}}*/

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

    string nn = N;
    reverse(all(nn));
    if(N == nn){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}


Measured memory_bytes: 256
// May this submission get accepted!

#pragma GCC optimize ("O3")
#pragma GCC target ("tune=native")
#pragma GCC target ("avx")

#include <bits/stdc++.h>

// 汎用マクロ
#define ALL_OF(x) (x).begin(), (x).end()
#define REP(i,n) for (long long i=0, i##_len=(n); i<i##_len; i++)
#define RANGE(i,is,ie) for (long long i=(is), i##_end=(ie); i<=i##_end; i++)
#define DSRNG(i,is,ie) for (long long i=(is), i##_end=(ie); i>=i##_end; i--)
#define STEP(i, is, ie, step) for (long long i=(is), i##_end=(ie), i##_step = (step); i<=i##_end; i+=i##_step)
#define UNIQUE(v) do { sort((v).begin(), (v).end()); (v).erase(unique((v).begin(), (v).end()), (v).end()); } while (false)
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; }
#define INF 0x7FFFFFFF
#define LINF 0x7FFFFFFFFFFFFFFFLL
#define Yes(q) ((q) ? "Yes" : "No")
#define YES(q) ((q) ? "YES" : "NO")
#define Possible(q) ((q) ? "Possible" : "Impossible")
#define POSSIBLE(q) ((q) ? "POSSIBLE" : "IMPOSSIBLE")
#define DUMP(q) cerr << "[DEBUG] " #q ": " << (q) << " at " __FILE__ ":" << __LINE__ << endl
#define DUMPALL(q) do { cerr << "[DEBUG] " #q ": ["; REP(DUMPALL_ITR, (q).size()) { cerr << (q)[DUMPALL_ITR] << (DUMPALL_ITR == DUMPALL_ITR_len-1 ? "" : ", "); } cerr << "] at " __FILE__ ":" << __LINE__ << endl; } while (false)
template<class T> T gcd(T a, T b) { if (a < b) std::swap(a, b); while (b) std::swap(a %= b, b); return a; }
template<class T> T lcm(const T a, const T b) { return a / gcd(a, b) * b; }

// gcc拡張マクロ
#define popcount __builtin_popcount
#define popcountll __builtin_popcountll

// エイリアス
#define DANCE_ long
#define ROBOT_ unsigned
#define HUMAN_ signed
using  ll = DANCE_ HUMAN_ DANCE_;
using ull = DANCE_ ROBOT_ DANCE_;
using  ld = long double;
using namespace std;

// 標準入出力
struct inp {
    size_t sz;
    inp(size_t _sz = 1) : sz(_sz) {}
    template <typename T> operator T () const { T a; cin >> a; return a; }
    template <typename T> operator vector<T> () const { vector<T> a(sz); for (size_t i = 0; i < sz; i++) cin >> a[i]; return a; }
    template <typename T, typename U> operator pair<T, U> () const { T f; U s; cin >> f >> s; return pair<T, U>(f, s); }
};
inp inp1; // input one
template <typename T> void say(T &x, char end = '\n') { cout << x << end; }
template <typename T> void say(vector<T> &x, char sep = ' ', char end = '\n') { for (size_t i = 0, sz = x.size(); i < sz; i++) { cout << x[i] << (i == sz-1 ? end : sep); } }

// モジュール


// 処理内容
int main() {
    
    ios::sync_with_stdio(false); // stdioを使うときはコメントアウトすること
    cin.tie(nullptr);            // インタラクティブ問題ではコメントアウトすること
    
    ll a = inp1;
    ll b = inp1;

    cout << lcm(a, b) << endl;
    
}

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

int main() {
	int a,b,c;
	cin >> a >> b >> c;
	string k = "No";
	if(max(a,b) >= c && min(a,b) <= c)
	{
		k = "Yes";
	}
	cout << k << endl;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>

using namespace std;
int main()
{
    string s;
    cin>>s;
    int i=0;
    while(s[i]!='\0'){
        i++;
    }
    ///cout<<i<<endl;
    int sum=0;
    for(int j=0;j<=i;j+=1){
        if(j==2 || j==4){
           for(int k=j+1;k>=j+1;k-=1){
               if(s[j]==s[k]){
                 sum++;
               }
           }
        }
    }
    ///cout<<sum<<endl;
    if(sum==2){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }


    return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
	static int[][] masu = new int[10][10];
	static void doIt(int x,int y,int size){
		switch(size){
		case 1:
			small(x,y);
			break;
		case 2:
			mid(x,y);
			break;
		case 3:
			big(x,y);
			break;
		}
	}
	static void small(int x,int y){
		int sx[]={1,0,-1,0},sy[]={0,1,0,-1};
		draw(x,y);
		for(int i=0;i<4;i++){
			int nx=sx[i]+x;
			int ny=sy[i]+y;
			draw(nx,ny);
		}
	}
	static void mid(int x,int y){
		for(int s=-1;s<2;s++){
			for(int i=-1;i<2;i++){
				draw(x+i,y+s);
			}
		}
	}
	static void big(int x,int y){
		mid(x,y);
		draw(x,y-2);draw(x,y+2);draw(x+2,y);draw(x-2,y);
	}
	static void draw(int x,int y){
		if(x<0||y<0||x>9||y>9)return;
		masu[y][x]+=1;
	}
	public static void main(String[] args){
		Scanner in = new Scanner(System.in);
		for(int s=0;s<10;s++)for(int i=0;i<10;i++)masu[s][i]=0;
		while(in.hasNext()){
			String[] input = in.next().split(",");
			int x=Integer.parseInt(input[0]),y=Integer.parseInt(input[1]),size=Integer.parseInt(input[2]);
			doIt(x,y,size);
		}
		int big=0, cnt=0;
		for(int s=0;s<10;s++)for(int i=0;i<10;i++){
			big=Math.max(big, masu[s][i]);
			if(masu[s][i]==0)cnt++; 
		}
		System.out.println(cnt);
		System.out.println(big);
	}
}

Measured memory_bytes: 17172
#include <cstdio>
#include <cstring>
#include <algorithm>

using namespace std;

bool A[777][777];

int main() {
    int n, a, b;
    scanf("%d%d%d", &n, &a, &b);
    n *= 2;
    memset(A, 1, sizeof A);
    int tmpa = 0;
    while(a % (1 << (tmpa + 1)) == 0) tmpa++;
    if(tmpa % 2 == 0) {
        tmpa = 1 << tmpa / 2;
        for(int i = 0; i < n; i++)
            for(int j = 0; j < n; j++)
                if(((i / tmpa % 2) ^ (j / tmpa % 2))) A[i][j] = 0;
    } else {
        tmpa = 1 << tmpa  / 2;
        for(int i = 0; i < n; i++)
            for(int j = 0; j < n; j++)
                if((i / tmpa % 2)) A[i][j] = 0;
    }
    int tmpb = 0;
    while(b % (1 << (tmpb + 1)) == 0) tmpb++;
    if(tmpb % 2 == 0) {
        tmpb = 1 << tmpb / 2;
        for(int i = 0; i < n; i++)
            for(int j = 0; j < n; j++)
                if(((i / tmpb % 2) ^ (j / tmpb % 2))) A[j][i] = 0;
    } else {
        tmpb = 1 << tmpb / 2;
        for(int i = 0; i < n; i++)
            for(int j = 0; j < n; j++)
                if((i / tmpb % 2)) A[j][i] = 0;
    }
    int cnt = 0;
    for(int i = 0; i < n; i++)
        for(int j = 0; j < n; j++)
            if(A[i][j] && ++cnt <= n * n / 4) printf("%d %d\n", i, j);
    return 0;
}

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

using ll=long long;

int main() {
  int A,B,K; cin >>A >>B >>K;
  rep_eq(i,1,K) {
    if (i%2==1) {
      A/=2;
      B+=A;
    } else {
      B/=2;
      A+=B;
    }
  }
  cout <<A <<" " <<B <<endl;
  return 0;
}


Measured memory_bytes: 3572
#include <string>
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdlib>
#include <cmath>
using namespace std;
int main() {
	int n, a[200000],a1[200000], er;
	cin >> n;
	for (int b = 0; b < n; b++) {
		cin >> a[b];
		a1[b] = a[b];
	}
	sort(a, a + n);
	for (int i = 0; i < n; i++) {
		er = a1[i];
		if (er == a[n - 1]) {
			cout << a[n - 2] << endl;
		}
		else {
			cout << a[n - 1] << endl;
		}
	}
	return 0;
}

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

// #define int long long
#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) int(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;

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

const ll INF = 1e15;
const int MOD = 1e9+7;
const ll LINF = 1e18;



signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  ll n; cin>>n;
  cout<<n*n*n<<endl;
}

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

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

struct Range { int left; int right; };

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

    int H, W; cin >> H >> W;
    vector<Range> walls(H);
    REP(y, H) {
        int A, B; cin >> A >> B; --A; --B;
        walls[y] = { A, B };
    }

    set<pair<int, int>> end_and_starts;
    multiset<int> x_dists;

    REP(x, W) {
        end_and_starts.insert({x, x});
        x_dists.insert(0);
    }

    REP(y, H) {
        auto wall = walls[y];
        auto lo = end_and_starts.lower_bound({ wall.left, 0 });
        auto hi = end_and_starts.lower_bound({ wall.right+1, 0 });
        if (lo != hi) {
            int max_start = -1;
            for (auto it = lo; it != hi; ) {
                max_start = max(max_start, it->second);
                int x_dist = it->first - it->second;
                it = end_and_starts.erase(it);
                x_dists.erase(x_dists.find(x_dist));
            }
            if (wall.right != W-1) {
                int new_end = wall.right + 1;
                end_and_starts.insert({ new_end, max_start });
                x_dists.insert(new_end - max_start);
            }
        }
        if (x_dists.empty()) {
            cout << "-1\n";
        } else {
            int min_x_dist = *x_dists.begin();
            cout << min_x_dist + y + 1 << '\n';
        }
    }
}


Measured memory_bytes: 23504