akhauriyash/Code-Regression huggingface dataset:
function Main(input){
    let Numarr = input.trim().split('\n')[0].split('');
    let answer = '';
    const DFS = (numarr, str, num) => {
        const thisNum = numarr[0];
        if(thisNum == null && num === 7) return answer = str + '=7';
        if(thisNum == null) return;
        DFS(numarr.slice(1), str + '+' + thisNum, num + Number(thisNum))
        DFS(numarr.slice(1), str + '-' + thisNum, num - Number(thisNum))
        return
    }
    const n = Number(Numarr.shift())
    DFS(Numarr ,n,n)
    console.log(answer);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 29576
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  
  if(A+B>C+D){
    cout << "Left" <<endl;
  }
  else if(A+B == C+D){
    cout << "Balanced" <<endl;
  }
  else if(A+B<C+D){
    cout << "Right" <<endl;
  }
}

Measured memory_bytes: 384
n, m = map(int, input().split())
a = list(map(int, input().split()))

cum =[0 for _ in range(n)]
cum[0] = a[0] % m
for i in range(1, n):
    cum[i] = cum[i-1] + a[i] % m
    cum[i] %= m

from collections import Counter
c = Counter(cum)

ans = sum((v*(v-1)//2) for v in c.values())
if 0 in c:
    ans += c[0]
print(ans)


Measured memory_bytes: 88988
#include<stdio.h>
#define MAX 100000
#define SENTINEL 2000000000
struct Card{
  char suit;
  int value;
};
struct Card L[MAX/2+2],R[MAX/2+2];
void merge(struct Card A[],int n,int left,int mid,int right){
  int i,j,k;
  int n1=mid-left;
  int n2=right-mid;
  for(i=0;i<n1;i++) L[i]=A[left+i];
  for(i=0;i<n2;i++) R[i]=A[mid+i];
  L[n1].value=R[n2].value=SENTINEL;
  i=j=0;
  for(k=left;k<right;k++){
    if(L[i].value<=R[j].value) A[k]=L[i++];
    else A[k]=R[j++];
  }
}
void mergeSort(struct Card A[],int n,int left,int right){
  int mid;
  if(left+1<right){
    mid=(left+right)/2;
    mergeSort(A,n,left,mid);
    mergeSort(A,n,mid,right);
    merge(A,n,left,mid,right);
  }
}
int partition(struct Card A[],int n,int p,int r){
  int i,j;
  struct Card t,x;
  x=A[r];
  i=p-1;
  for(j=p;j<r;j++){
    if(A[j].value<=x.value){
      i++;
      t=A[i];A[i]=A[j];A[j]=t;
    }
  }
  t=A[i+1];A[i+1]=A[r];A[r]=t;
  return i+1;
}
void quickSort(struct Card A[],int n,int p,int r){
  int q;
  if(p<r){
    q=partition(A,n,p,r);
    quickSort(A,n,p,q-1);
    quickSort(A,n,q+1,r);
  }
}
int main(){
  int n,i,v;
  struct Card A[MAX],B[MAX];
  char S[10];
  int stable=1;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%s %d",S,&v);
    A[i].suit=B[i].suit=S[0];
    A[i].value=B[i].value=v;
  }
  mergeSort(A,n,0,n);
  quickSort(B,n,0,n-1);
  for(i=0;i<n;i++){
    if(A[i].suit!=B[i].suit) stable=0;
  }
  if(stable==1) printf("Stable\n");
  else printf("Not stable\n");
  for(i=0;i<n;i++) printf("%c %d\n",B[i].suit,B[i].value);
  return 0;
}

Measured memory_bytes: 2952
#include<algorithm>
#include<cstdio>
#define s(A) std::sort(A,A+10);
main(){
int Z[20],p;
for(int i=0;i<20;i++)
scanf("%d",&p),Z[i]=p;
s(Z);
s(Z+10);
printf("%d %d\n",Z[7]+Z[8]+Z[9],Z[17]+Z[18]+Z[19]);
}

Measured memory_bytes: 0
#pragma region Macros
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

#define REP(i, n) for(int i=0; i<(n); i++)
#define REPS(i, n) for(int i=0; i<=(n); i++)
#define FOR(i, a, b) for(int i=a; i<(b); i++)
#define FORS(i, a, b) for(int i=a; i<=(b); i++)
// for container x
#define ALL(v) (v).begin(),(v).end()
#define RALL(v) (v).rbegin(),(v).rend()
#define SIZE(v) ((ll)(v).size())
#define MAX(v) *max_element(ALL(v))
#define MIN(v) *min_element(ALL(v))
#define UNIQUE(v) v.erase(unique(ALL(v)), v.end())

struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
#pragma endregion

int main(){
    ll n, q;
    cin >> n;
    vector<ll> a(n);

    ll sum=0;
    vector<ll> bucket(1e5, 0);

    REP(i, n) {
        cin >> a[i];
        sum += a[i];
        bucket[a[i]]++;
    }
    cin >> q;
    vector<ll> b(q), c(q);
    REP(i, q) cin >> b[i] >> c[i];

    REP(i, q){
        if (bucket[b[i]]) {
            sum += bucket[b[i]]*(c[i]-b[i]);
            bucket[c[i]]+=bucket[b[i]];
            bucket[b[i]]=0;
        }
        cout << sum << endl;
    }

    return 0;
}

Measured memory_bytes: 6288
#include <iostream>
using namespace std;
#define MAX 100
#define INFTY (1<<21)
#define WHITE 0
#define GRAY 1
#define BLACK 2

int n, M[MAX][MAX];

int prim() {
    int u, minv;
    int d[MAX], p[MAX], color[MAX];

    for(int i=0; i<n; i++) {
        d[i] = INFTY;
        p[i] = -1;
        color[i] = WHITE;
    }

    d[0] = 0;

    while(1) {
        minv = INFTY;
        u = -1;
        for(int i=0; i<n; i++) {
            if(minv >d[i] && color[i]!=BLACK) {
                u = i;
                minv = d[i];
            }
        }
        if(u==-1) {
            break;
        }
        color[u] = BLACK;
        for(int v=0; v<n; v++) {
            if(color[v]!=BLACK && M[u][v]!=INFTY) {
                if(d[v]>M[u][v]) {
                    d[v] = M[u][v];
                    p[v] = u;
                    color[v] = GRAY;
                }
            }
        }
    }
    int sum = 0;
    for(int i=0; i<n; i++) {
        if(p[i]!=-1) {
            sum += M[i][p[i]];
        }
    }

    return sum;
}

int main() {
    cin >> n;

    for(int i=0; i<n; i++) {
        for(int j=0; j<n; j++) {
            int e;
            cin >> e;
            if(e==-1) {
                M[i][j] = INFTY;
            }
            else {
                M[i][j] = e;
            }
        }
    }

    cout << prim() << endl;

    return 0;
}


Measured memory_bytes: 3088
#include <bits/stdc++.h>
#define SORT(x) sort(x.begin(),x.end())
#define ALL(x) x.begin(),x.end()
#define rep(i, n) for(int i = 0; i < n; i++)
#define reps(i, m, n) for(int i = m; i < n; i++)
#define repr(i, m, n) for(int i = m; i >= n; i--)
#define INF 1000000007 //1000000000000000003
#define PI (acos(-1))
#define MOD 1000000007
using namespace std;
typedef long long ll;

const int MAX = 100010;
ll fac[MAX], finv[MAX], inv[MAX];
void cinit() { // O(nlogn)
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  reps(i, 2, MAX){
    fac[i] = fac[i - 1] * i % MOD;
    inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
    finv[i] = finv[i - 1] * inv[i] % MOD;
  }
}
ll c(int n, int k){ // 二項係数計算
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}


void Main(){

  int N;
  cin>>N;

  int a[N+1];

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

  int bet;
  rep(i,N+1){
    int aa;
    cin>>aa;
    if(a[aa]==-1){
      a[aa]=i;
    }
    else{
      bet=i-a[aa];
      break;
    }
  }
  cinit();

  //cout<< bet<<"\n";

  reps(i,1,N+2){
    //cout<< c(N+1,i)<<" "<<c(N-bet,i-1) <<"\n";
    cout<<(c(N+1,i)-c(N-bet,i-1)+MOD)%MOD<<"\n";
  }

}

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


Measured memory_bytes: 3968
S = input()
N = len(S) + 1
a = [0] * N

for i in range(0, N-1):
    #print(a)
    if S[i] == "<":
        a[i+1] = a[i] + 1

for i in range(N-2, -1, -1):
    #print(a)
    if S[i] == ">":
        a[i] = max(a[i+1] + 1, a[i])

#print(a)
print(sum(a))

Measured memory_bytes: 46608
#include<iostream>
#include<cstdlib>
#include<string>
#include<typeinfo>
#include<cstring>
#include<iostream>
using namespace std;
#define MAX 100005
#define NIL -1
struct Node { int p, l, r;};
Node T[MAX];
int n, D[MAX];
void print(int u){
  int i,c;
  cout << "node " << u << ": ";
  cout << "parent = " << T[u].p << ", ";
  cout << "depth = " << D[u] << ", ";
  if(T[u].p == NIL) cout << "root, ";
  else if(T[u].l == NIL) cout << "leaf, ";
  else cout << "internal node, ";
  cout << "[";
  for(i=0,c=T[u].l; c!=NIL; i++, c=T[c].r){
    if(i) cout << ", ";
    cout << c;
  }
  cout << "]" << endl;
}

int rec(int u,int p){
  D[u] = p;
  if(T[u].r != NIL) rec(T[u].r,p);
  if(T[u].l != NIL) rec(T[u].l,p+1);
}

int main(){
  int i,j,d,v,c,l,r;
  cin >> n;
  for(i=0;i<n;i++) T[i].p = T[i].l= T[i].r = NIL;

  for(i=0;i<n;i++){
    cin >> v >> d;
    for(j=0;j<d;j++){
      cin >> c;
      if(j==0) T[v].l=c;
      else T[l].r=c;
      l=c;
      T[c].p=v;
    }
  }
  for(i=0;i<n;i++){
    if(T[i].p == NIL) r=i;
  }
  rec(r,0);
  for(i=0;i<n;i++) print(i);
  return 0;
}


Measured memory_bytes: 7788
N, M = map(int, input().split())
KS = [list(map(int, input().split())) for _ in range(M)]
P = list(map(int, input().split()))

def check(n):
	i = 0
	for k, *s in KS:
		c = 0
		for q in s:
			if n & (1 << (q - 1)):
				c += 1
		if P[i] != c % 2:
			return False
		i += 1
	return True

#print(check(3))
#print()

count = 0
for n in range(2 ** N):
	if check(n):
		count += 1
print(count)


Measured memory_bytes: 3064
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        try(Scanner sc =new Scanner(System.in)){
            String line =sc.nextLine();
            String answer="";
            int length =line.length();
            for(int i=0;i<length;i++){
                char ch =line.charAt(i);

                if(Character.isLowerCase(ch)){
                    ch=Character.toUpperCase(ch);
                }else{
                    ch=Character.toLowerCase(ch);
                }
                answer+=ch;
            }
            System.out.println(answer);
        }
    }
}


Measured memory_bytes: 31600
using namespace std;
#include<bits/stdc++.h>
#define BEGIN ios_base::sync_with_stdio(0);cin.tie(0);
#define END return EXIT_SUCCESS;
#define FOR(I,A,B) for((I)=(A);(I)<(B);(I)++)
#define REP(I,N) FOR((I),0,(N))
#define UP(I,A,B) for((I)=(A);(I)<=(B);(I)++)
#define DW(I,A,B) for((I)=(A);(I)>=(B);(I)--)
#define IN(P) cin>>(P)
#define IN2(P1,P2) cin>>(P1)>>(P2)
#define IN3(P1,P2,P3) cin>>(P1)>>(P2)>>(P3)
#define INS(I,N,V) REP((I),(N)) cin>>(V[I])
#define INS2(I,N,V1,V2) REP((I),(N)) cin>>(V1[I])>>(V2[I]);
#define INS3(I,N,V1,V2,V3) REP((I),(N)) cin>>(V1[I])>>(V2[I])>>(V3[I]);
#define OUT(P) cout<<(P)<<endl
#define OUT2(P1,P2) cout<<(P1)<<" "<<(P2)<<endl
#define OUT3(P1,P2,P3) cout<<(P1)<<" "<<(P2)<<" "<<(P3)<<endl
#define OUTS(I,N,V) REP((I),(N)) cout<<(V[i])<<endl
#define ALL(C) (C).begin(),(C).end()
#define RALL(C) (C).rbegin(),(C).rend()
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
template<class T>inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;}
template<class T>inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;}

int a,b,c;
inline void solve(){
  IN3(a,b,c);
  if(a+b==c||a+c==b||b+c==a)OUT("Yes");
  else OUT("No");
}

int main(int argc,char**argv){
  BEGIN
  solve();
  END
}


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

int main()
{
    int n, k; cin>>n>>k;
    vector<int> x(n), y(n);
    for(int i=0; i<n; ++i) cin>>x[i]>>y[i];

    long res=LONG_MAX;
#define rep(i, a, b) for(int i=a; i<b; ++i)
    rep(a, 0, n) rep(b, a, n) rep(c, b, n) rep(d, c, n) {
        long minx, maxx, miny, maxy;
        tie(minx, maxx)=minmax({x[a], x[b], x[c], x[d]});
        tie(miny, maxy)=minmax({y[a], y[b], y[c], y[d]});
        int cnt=0;
        rep(e, 0, n)
            cnt+=(minx<=x[e]&&x[e]<=maxx)&&(miny<=y[e]&&y[e]<=maxy);
        if (cnt>=k)
            res=min(res, (maxx-minx)*(maxy-miny));
    }
    cout<<res<<endl;
}

Measured memory_bytes: 384
#include <stdio.h>
#include <algorithm>
#include <functional>

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

int main() {
    int n, a[100];
    scanf("%d", &n);
    for(int i = 0; i < n; ++i) {
        scanf("%d", &a[i]);
    }

    std::sort(std::begin(a), std::begin(a) + n, std::greater<int>());

    printf("%d\n", solve(n, a));

    return 0;
}

Measured memory_bytes: 128
#include <algorithm>
#include <cstring>
#include <cstdio>
typedef long long ll; 
int lst[100005], to[200005], pre[200005], w[200005], tot; 
int sz[100005], mx[100005], dep[100005]; 
inline void add_edge(int u, int v, int _w)
{
	to[tot] = v; 
	pre[tot] = lst[u]; 
	w[tot] = _w; 
	lst[u] = tot++; 
}
void dfs(int u, int fa = -1)
{
	sz[u] = 1; 
	for (int i = lst[u]; ~i; i = pre[i])
	{
		if (to[i] == fa)
			continue; 
		dep[to[i]] = dep[u] + 1; 
		dfs(to[i], u); 
		sz[u] += sz[to[i]];
		mx[u] = std::max(mx[u], sz[to[i]]);
	}
}
int main()
{
	// freopen("AGC018-D.in", "r", stdin); 
	memset(lst, -1, sizeof(lst));
	int n; 
	scanf("%d", &n); 
	for (int i = 1; i < n; i++)
	{
		int u, v, _w; 
		scanf("%d%d%d", &u, &v, &_w); 
		add_edge(--u, --v, _w); 
		add_edge(v, u, _w); 
	}
	dfs(0); 
	ll ans = 0; 
	for (int i = 0; i < n - 1; i++)
	{
		int u = to[i << 1], v = to[i << 1 | 1], _w = w[i << 1]; 
		if (dep[u] > dep[v])
			std::swap(u, v); 
		int s = std::min(sz[v], n - sz[v]);
		if (s << 1 == n)
			ans -= _w;
		ans += (ll)2 * s * _w; 
	}
	for (int i = 0; i < n; i++)
	{
		mx[i] = std::max(mx[i], n - sz[i]);
		if (mx[i] << 1 < n)
		{
			int mn = 1e9; 
			for (int j = lst[i]; ~j; j = pre[j])
				mn = std::min(mn, w[j]); 
			ans -= mn; 
		}
	}
	printf("%lld\n", ans);
	return 0; 
}


Measured memory_bytes: 8064
function Main(input) {
  data = input.split('\n');
  var N = data[0].split(' ')[0];
  var K = data[0].split(' ')[1];
  var Q = data[0].split(' ')[2];
  N = parseInt(N, 10);
  K = parseInt(K, 10);
  Q = parseInt(Q, 10);

  var A = input.split('\n');
  A.shift();
  for(var i = 0; i < Q; i++) {
    A[i] = parseInt(A[i], 10);
  }


  var C = [];
  for(var i = 0; i < N; i++) {
    C[i] = 0;
  }
  for(var i = 0; i < Q; i++) {
    C[A[i] - 1] += 1;
  }
    /*
    C = C.map((x)=>{
    var a;
    a = x - Q;
    a += K;
    return a;
  });
  */
  C = C.map(function(x) {
    var a;
    a = x - Q;
    a += K;
    return a;
  });

  for(var i = 0;i < N; i++) {
    if(C[i] > 0) {
      C[i] = 'Yes';
    } else {
      C[i] = 'No';
    }
  }
  
  console.log(C.join('\n'));
}
Main(require('fs').readFileSync('/dev/stdin', 'utf-8'));


Measured memory_bytes: 29264
#include<iostream>
#include<string>
using namespace std;
int main(){
long n,p;
for(;;){
cin>>n;
if(n==-1)break;
p=1150;n-=10;
if(n>0)p+=125*n;n-=10;
if(n>0)p+=15*n;n-=10;
if(n>0)p+=20*n;
cout<<4280-p<<endl;
}
return 0;
}

Measured memory_bytes: 1160
n=int(input())
l=list(map(int,input().split()))
s=0
for i in range(1,n-1):
    if (l[i]>l[i-1] and l[i]<l[i+1]) or (l[i]<l[i-1] and l[i]>l[i+1]):
        s+=1
print(s)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define pb push_back
#define fs first
#define sc second
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x).size()
using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<double> vd;
typedef pair<int, int> pii;
typedef pair<ll, int> plli;
typedef vector<pii> vpii;
typedef tree<pii, null_type, less<pii>, rb_tree_tag,
    tree_order_statistics_node_update> ost;

const int N=110000;
const int B=2500;
const ll LIMIT=1e11;
ll es[B], p[B], np;
unordered_map<ll, ll> cnt;
unordered_map<ll, ll> dop;

int main() {
    ll i, j, k, n, r, s, t, q, ans=0;
    scanf("%lld", &n);
    for(i=2; i<B; i++) if(!es[i]) {
        p[np++]=i;
        for(j=i; j<B; j+=i) es[j]=1;
    }
    for(i=0; i<n; i++) {
        scanf("%lld", &t);
        q=r=1;
        for(j=0; j<np; j++) {
            for(k=0; t%p[j]==0; k++) t/=p[j];
            k%=3;
            if(k==1) q*=p[j]*p[j], r*=p[j];
            if(k==2) q*=p[j], r*=p[j]*p[j];
            if(q>LIMIT) q=0;
        }
        r*=t;
        s=sqrt(t);
        if(s*s==t) q*=s;
        else if(q*(double)t*t<LIMIT) q*=t*t;
        else q=0;
        cnt[r]++;
        if(!cnt.count(q)) cnt[q]=0;
        dop[r]=q;
        dop[q]=r;
    }
    for(auto z:cnt) {
        tie(t, s)=z;
        if(t==1) ans++;
        else if(t>dop[t])
            ans+=max(cnt[t], cnt[dop[t]]);
    }
    printf("%lld\n", ans);
    return 0;
}

Measured memory_bytes: 14608
#include <bits/stdc++.h>
#define repz(i, z, n) for (decltype(n) i = (z); i < (n); i++)
#define rep(i, n) for (decltype(n) i = 0; i < (n); i++)

#define REPZ(i, z, n) for (decltype(n) i = (z); i <= (n); i++)
#define REP(i, n) for (decltype(n) i = 0; i <= (n); i++)
#define ALL(v) v.begin(), v.end()
#define SIZE(v) ((ll)(v).size())
#define MAX(v) (*max_element(ALL(v)))
#define MIN(v) (*min_element(ALL(v)))
#define INF 1000000000000  // 1E+12

// 略
#define PB push_back
#define F first
#define S second
#define MP make_pair
#define READ cin >>
#define PRINT cout <<
#define PYES cout << "Yes" << endl;
#define POK cout << "OK" << endl;
#define PNO cout << "No" << endl;
#define PNG cout << "NG" << endl;

using namespace std;

// デバッグ用
void debug_out() { cout << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cout << H << " ";
  debug_out(T...);
}

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

#ifdef _DEBUG
#define debug(...) debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif

// typedef
typedef long long ll;
typedef unsigned long long ul;
typedef long double ld;
typedef pair<ll, ll> pl;

// const
// 円周率
const ld pi = acos(-1);
// mod用
// 1E+9 +7
const ll mod = (int)1e+9 + 7;
// 1s間で可能なループ回数2E+8回
// int        最大値2147483647         〜2E+9
// long long  最大値9223372036854775807〜9E+18
// 総和accumulate
// 単純リストvector<type> push_back
// 連想配列map<key,value> insert,
// 集合set<type>
// pair キーとバリューを格納 firstとsecondでアクセス
// 小数点指定 cout << fixed << setprecision(15) << endl;
// to_string<->stoi
// stoll(longlong)
// stod(double)
// deep copy v1->v2 copy(v1.begin(), v1.end(), back_inserter(v2) );
// 大文字65-90(-32)
// 小文字97-122(+32)
//  priority_queue<pair<ll, ll>, vector<pair<ll, ll>>, greater<pair<ll, ll>>>
//  ba;
signed main() {
  // faster
  // C言語流の入出力は使用できない
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  string s;
  cin >> s;
  rep(i, SIZE(s)) { cout << 'x';}
  cout << endl;
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(){
	int k,s;
	int x = 0;
	int y = 0;
/*	int z = 0;	*/
	int count = 0;

	scanf("%d %d",&k,&s);

	for(x=0; x<=k; x++){
		for(y=0; y<=k; y++){
			if( 0 <= s-x-y && s-x-y <= k ) count++;
/*
			for(z=0; z<=k; z++){
				if( x+y+z == s ) count++;
			}
*/
		}
	}

	printf("%d\n",count);

	return 0;
}

Measured memory_bytes: 128
length = int(input())
target = [int(n) for n in input().split(" ")]
splitter = target[-1]
border = 0
for i, n in enumerate(target):
    if n <= splitter:
        target[i], target[border] = target[border], target[i]
        border += 1
target[border - 1] = [splitter]
print(*target)

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

int main(){
    int n; cin >> n;
    int a[200000];
    int maxi = -1;
    for(int i = 0; i < n; i++){
        cin >> a[i];
        maxi = max(maxi,a[i]);
    }
    bool f = true;
    vector<bool> nums(maxi + 1,false);
    for(int i = 0; i < n; i++){
        if (nums.at(a[i]) == false)
        {
            nums.at(a[i]) = true;
        }
        else
        {
            f = false;
            break;
        }
        
        
    }
    if (f)
    {
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }
    
    
}

Measured memory_bytes: 123136
import scala.io.StdIn._
object Main extends App {
  case class Rectangle(maxX: Int, minX: Int, maxY: Int, minY: Int) {
    def area = ((maxX - minX) max 0) * ((maxY - minY) max 0)
  }

  def exec(r: Rectangle, x: Int, y: Int, a: Int) = {
    a match {
      case 1 => r.copy(minX = r.minX max x)
      case 2 => r.copy(maxX = r.maxX min x)
      case 3 => r.copy(minY = r.minY max y)
      case 4 => r.copy(maxY = r.maxY min y)
    }
  }

  val Array(w, h, n) = readLine.split(" ") map {_.toInt}
  val rect = (1 to n).foldLeft(Rectangle(w, 0, h, 0)){(r, i) =>
    val Array(x, y, a) = readLine.split(" ") map {_.toInt}
    exec(r, x, y, a)
  }
  println(rect.area)
}

Measured memory_bytes: 21948
N = int(input())
X = []
Y = []

for i in range(N):
  x, y = map(int, input().split())
  X.append(x)
  Y.append(y)
  
sum_all = 0
for i in range(N):
  for j in range(i+1, N):
    sum_all += float((X[j]-X[i])**2 + (Y[j]-Y[i])**2) ** (1/2)
    
div = N/2
print(sum_all/div)

Measured memory_bytes: 9360
#include<bits/stdc++.h>
#include<algorithm>
#include<vector>
#include<queue>
using namespace std;

int d,n,t[200],a[200],b[200],c[200];
int dp[201][200];

int main(){
	scanf("%d%d",&d,&n);
	for(int i=0;i<d;i++) scanf("%d",&t[i]);
	for(int i=0;i<n;i++) scanf("%d%d%d",&a[i],&b[i],&c[i]);
	for(int i=0;i<d;i++)
		for(int j=0;j<n;j++) dp[i][j]=-1;
	for(int i=0;i<n;i++) if(t[0]>=a[i]&&b[i]>=t[0]) dp[0][i]=0;
	for(int i=0;i<d-1;i++){
		for(int j=0;j<n;j++){
			if(dp[i][j]>=0) for(int k=0;k<n;k++) if(t[i+1]>=a[k]&&b[k]>=t[i+1]){
				dp[i+1][k]=max(dp[i][j]+abs(c[j]-c[k]),dp[i+1][k]);
			}
		}
	}
	int res=0;
	for(int i=0;i<n;i++) res=max(res,dp[d-1][i]);
	printf("%d\n",res);
}

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

    #define fori( tt,aa)      for(long long i= tt; i<aa; i++)
    #define forj( yy,bb)      for(long long j=yy; j<bb; j++)
    #define fork( uu,cc)      for(long long k=uu; k<cc; k++)
    #define sz(v)    v.size()
    #define all(v)   v.begin(), v.end()
    #define endl "\n";
    #define pb push_back
    #define pf push_front
    #define popb pop_back
    #define popf pop_front
    #define EPS 1e-7
    #define F first
    #define S second
    #define THINK_TWICE_CODE_ONCE; fast();

    typedef long long ll;
    typedef long double ld;
    typedef double dd;
    typedef string String;
    typedef string str;
    typedef vector<int> vecint;
    typedef vector<ll> vecll;
    typedef pair<int, int> pii;

    void fast(){
        cin.tie(0);
        cout.tie(0);
        cin.sync_with_stdio(0);
    }

    ld pow (ll a, ll b);
    ll numOfDigits(ll n);
    ll BN (ll arr[], ll j, ll val);
    ll n, d, p1, p2, p3, cnt;
    int main()
    {

        THINK_TWICE_CODE_ONCE;
        //freopen("test cases\\Points on Line.txt", "r", stdin);
        cout<<fixed<<setprecision(10);
        int n; cin>>n;
        int c = n/2.0;
        if((n%2)) c++;
        cout<<(dd)c/n;
        return 0;
    }
    ld pow (ll a, ll b){
        ld pow = 1;
        fori(0,b)
            pow *=a;
        return pow;
    }
    /*
    ll BN (ll arr[], ll j, ll val){
    int low = j;
    int up = n-1;
    ll ans = -1;
    while(low<=up){
        ll mid = ((ll)low+ up)/2;
        if(abs(arr[mid]-val)<=d){
            ans = mid;
            low = mid+1;
        }else up = mid-1;
    }
    return ans;
    }*/

    ll numOfDigits(ll n){
        if(!n) return 1;
        return (ll)(log10(n)+1);
    }


Measured memory_bytes: 256
import java.util.*;

public class Main{
  public static void main(String[]args){
    Scanner sc = new Scanner(System.in);
    String[] S = sc.nextLine().split(" ");
    int N = Integer.parseInt(S[0]);
    int P = Integer.parseInt(S[1]);
    boolean flag = false;
    for(int i = 0; i < N; i++){
      int n = Integer.parseInt(sc.next());
      if(n%2 == 1){
        flag = true;
        break;
      }
    }
    
    long ans = 0;
    if(flag){
      ans = (long)Math.pow(2, N-1);
    }else{
      if(P == 1){
        ans = 0;
      }else{
        ans = (long)Math.pow(2, N);
      }
    }
    System.out.println(ans);
  }
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define FORR(i, m, n) for (int i = (m); i >= (n); --i)
#define ifaxb(a, x, b) if (a < x && x < b)  // 比較は昇順
#define toInt(x) (x - '0')
#define vi vector<int>
#define vii vector<vi>
#define vs vector<string>
#define vss vector<vs>
#define all(x) x.begin(), x.end()
#define ff first
#define ss second
#define pq priority_queue
#define ipair pair<int, int>
#define spair pair<string, string>
#define lpair pair<LL, LL>
#define MP make_pair
#define MM multimap
#define PB push_back
#define INF 2147483647
#define _INF -2147483647
#define pi 3.1415926536
#define MAXN 100004
using namespace std;
typedef long long ll;

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

  // 100の位の値を111倍してスリーナインを求める
  int judge = n / 100 * 111;

 // nがスリーナイン以下ならスリーナイン
 // ちがうならスリーナインに111を足す
  if (n <= judge) {
    cout << judge << endl;
    return 0;
  } else {
    cout << judge + 111 << endl;
  }

  return 0;
}

Measured memory_bytes: 256
n,k=map(int,input().split())
if (n==k or k==1 or n==0):
    print(0)
    exit()
if (n<k):
    if (n <= k/2):
        print(n)
        exit()
    print(k-n)
    exit()
n=n%k
if (n <= k/2):
    print(n)
    exit()
print(k-n)

Measured memory_bytes: 3060
n, s = map(int, input().split())
a = list(map(int, input().split()))
dp = [[0]*(s+1) for _ in range(n+1)]
dp[0][0] = 1
mod = 998244353
for i in range(n):
    for j in range(s+1):
        dp[i+1][j] = dp[i][j]*2%mod
        if a[i]<=j: dp[i+1][j] = (dp[i+1][j]+dp[i][j-a[i]])%mod
        dp[i+1][j] %= mod
print(dp[n][s])

Measured memory_bytes: 132672
using System;
using System.Collections.Generic;

class Program
{
    static string InputPattern = "InputX";

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

        if (InputPattern == "Input1") {
            WillReturn.Add("4");
            //48
        }
        else if (InputPattern == "Input2") {
            WillReturn.Add("15");
            //675
        }
        else if (InputPattern == "Input3") {
            WillReturn.Add("80");
            //19200
        }
        else {
            string wkStr;
            while ((wkStr = Console.ReadLine()) != null) WillReturn.Add(wkStr);
        }
        return WillReturn;
    }

    static void Main()
    {
        List<string> InputList = GetInputList();
        int r = int.Parse(InputList[0]);

        Console.WriteLine(3 * r * r);
    }
}


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

int main(){
    int a,b,c;
    cin >> a >> b >> c;
    if((b*10+c)%4 == 0){
        cout << "YES" << endl;
    }
    else cout << "NO" << endl;
    return 0;
}

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

int main(void) {
  int N;
  cin >> N;
  for (int i = 0; i <= N / 4; ++i) {
    for (int j = 0; j <= N / 7; ++j) {
      int M = 4 * i + 7 * j;
      if (N == M) {
        cout << "Yes" << endl;
        return 0;
      }
    }
  }
  cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 3600
#include<iostream>
#include<cstdio>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
const double PI = 3.14159265358979;
const double E = 2.718281828459045;
const double root2 = sqrt(2);
typedef pair<int, int> P;
typedef unsigned int ui;
string s;
void traJ() {
	int len = s.length();
	char memo = s[len - 1];
	for (int i = len-1; i > 0; i--) {
		s[i] = s[i - 1];
	}
	s[0] = memo;
}
void traC() {
	int len = s.length();
	char memo = s[0];
	for (int i = 0; i < len-1; i++) {
		s[i] = s[i + 1];
	}
	s[len-1] = memo;
}
void traE() {
	int len = s.length();
	string sle = s.substr(0, len / 2);
	string sri = s.substr((len + 1) / 2, len - (len + 1) / 2);
	for (int i = 0; i < len - (len + 1) / 2; i++) {
		s[i] = sri[i];
	}
	for (int i = (len + 1) / 2; i < len; i++) {
		s[i] = sle[i - (len + 1) / 2];
	}
}
void traA() {
	reverse(s.begin(), s.end());
}
void traP() {
	int len = s.length();
	for (int i = 0; i < len; i++) {
		if ('1' <= s[i] && s[i] <= '9') {
			s[i]--;
		}
		else if (s[i] == '0') {
			s[i] = '9';
		}
	}
}
void traM() {
	int len = s.length();
	for (int i = 0; i < len; i++) {
		if ('0' <= s[i] && s[i] <= '8') {
			s[i]++;
		}
		else if (s[i] == '9') {
			s[i] = '0';
		}
	}
}
int main() {
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		string ord;
		cin >> ord;
		cin >> s;
		int l = ord.length();
		for (int i = l - 1; i >= 0; i--) {
			if (ord[i] == 'J')traJ();
			if (ord[i] == 'C')traC();
			if (ord[i] == 'E')traE();
			if (ord[i] == 'A')traA();
			if (ord[i] == 'P')traP();
			if (ord[i] == 'M')traM();
		}
		cout << s << endl;
	}
	return 0;
}


Measured memory_bytes: 3028
#include<bits/stdc++.h>
using namespace std;
#define vi vector<int>
#define sl set<ll>
#define vs vector<string>
#define vl vector<ll>
#define vi vector<int>
#define vpl vector<pair<ll,ll>>
#define pb push_back
#define PI 3.14159265358979323846
#define ll long long
#define ld long double
#define endl "\n"
#define rep(i,a,b) for (ll i = (a); i < (b); i++)
#define repp(i,a,b) for (ll i = (a); i >= (b); i--)
#define rop(i,a,b)  for(ll i=(a); i>(b); i--)
#define min3(a, b, c) min(c, min(a, b))
#define min4(a, b, c, d) min(d, min(c, min(a, b)))
#define tt long long t; cin>>t; while(t--)
#define IOS ios::sync_with_stdio(0);cin.tie(0);
const int maxn=1e5+100;


int main()
{
   string a,b;
  cin>>a>>b;
  int n=0;
  for(int i=0;i<a.size();i++)
    if(a[i]!=b[i]) n++;
  cout<<n;
    
    
}

Measured memory_bytes: 3840
#include <bits/stdc++.h>
#define IO(i, o) freopen(i, "r", stdin), freopen(o, "w", stdout)
using namespace std;

string s;
int cnt[26][100001];

int main(){
	//IO("input.txt", "output.txt");
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cin >> s;
	for(int i = 0; i < 26; i++){
		pair<int, int> mn = {INT_MAX, -1};
		for(int j = 1; j <= (int)s.length(); j++){
			if(s[j - 1] == 'a' + i) cnt[i][j] = cnt[i][j - 1] + 1;
			else cnt[i][j] = cnt[i][j - 1] - 1;
			if(cnt[i][j] - mn.first > 0){
				cout << mn.second << " " << j << "\n";
				return 0;
			}
			mn = min(mn, {cnt[i][j - 1], j});
		}
	}
	cout << "-1 -1\n";
	return 0;
}

Measured memory_bytes: 10604
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)
constexpr int mod=1000000007;
constexpr int mod1=998244353;
vector<int> dx={0,-1,0,1},dy={1,0,-1,0};
bool inside(int y,int x,int h,int w){
	if(y<h && y>=0 && x<w && x>=0) return true;
	return false;
}





int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;cin >> n;
	vector<string> s(n);
	rep(i,n) cin >> s.at(i);
	vector<vector<int>> cnt(n,vector<int>(26));
	rep(i,n){
		rep(j,s.at(i).size()){
			cnt.at(i).at(s.at(i).at(j) - 'a')++;
		}
	}
	rep(i,26){
		int num = 100000;
		rep(j,n){
			num = min(num, cnt.at(j).at(i));
		}
		rep(j,num){
			char c = i + 'a';
			cout << c;
		}
	}
	cout << endl;
}

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

int A, B, C, X, counter = 0;

int main() {
    cin >> A >> B >> C >> X;
    for (int i = 0; i <= A; i++){
        if (500 * i <= X){
            for (int j = 0; j <= B; j++){
                if (500 * i + 100 * j <= X){
                    for (int k = 0; k <= C; k++){
                        if(500 * i + 100 * j + 50 * k == X) {
                            counter++;
                        }
                    }
                }
            }
        }
    }
    cout << counter << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define all(v) (v).begin(),(v).end()
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define ri(x) scanf("%d",&(x))
#define ri2(x,y) scanf("%d %d",&(x),&(y))
#define ri3(x,y,z) scanf("%d %d %d",&(x),&(y),&(z))
#define rll(x) scanf("%lld",&(x))
#define rll2(x,y) scanf("%lld %lld",&(x),&(y))
#define rll3(x,y,z) scanf("%lld %lld %lld",&(x),&(y),&(z))
#define gc(x) ((x) = getchar())
using namespace::std;

const long double PI = acos(-1);
const long long MOD = 1000000000 +7;

typedef long long ll;
typedef pair<ll,ll> pll;
typedef pair<ll,pll> tll;
typedef pair<int,int> ii;
typedef pair<int,ii> iii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<ll> vll;
typedef vector<pll> vpll;
typedef vector<tll> vtll;
typedef vector<string> vs;
typedef set<int> si;
typedef set<ii> sii;
typedef set<iii> siii;

ll gcd(ll a, ll b){ return b==0?a:gcd(b,a%b);}

ll add(ll a, ll b, ll m = MOD){ return (a%m + b%m+2*m)%m;}

ll mul(ll a, ll b, ll m = MOD){ return ((a%m+m)*(b%m+m))%m;}

ll pow_mod(ll a, ll b, ll m = MOD){
	ll res = 1LL;
	a = a%m;
	while(b){
		if(b&1) res = mul(res,a,m);
		b >>= 1;
		a = mul(a,a,m);
	}
	return res;
}

ll fastexp(ll a, ll b){
	ll res = 1LL;
	while(b){
		if(b&1) res = res*a;
		b >>= 1;
		a *= a;
	}
	return res;
}

int gcdExtendido(int a, int b, int *x, int *y){
	if(a == 0){
		*x = 0;
		*y = 1;
		return b;
	}
	int x1, y1;
	int gcd = gcdExtendido(b%a,a,&x1,&y1);
	
	*x = y1-(b/a)*x1;
	*y = x1;
	return gcd;
}

int modInverso(int a, int m){
	int x, y;
	int g = gcdExtendido(a,m,&x,&y);
	if(g!=1) return -1;
	else return (x%m + m)%m;
}

/****************************************
*************P*L*A*N*T*I*L*L*A************
*****************************************/

const int N = 100000+5;

int n;
int k;
int h[N];
int memo[N];

int main(){
	ri2(n,k);
	for(int i=1; i<=n; i++){
		ri(h[i]);
	}
	memo[1] = 0;
	for(int i=2; i<=n; i++){
		memo[i] = INT_MAX;
		for(int d = 1; d <= k; d++){
			if(i-d >= 1){
				memo[i] = min(memo[i],memo[i-d]+abs(h[i]-h[i-d]));
			}
			else break;
		}
	}
	cout << memo[n] << endl;
	return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define int long long

signed main() {
    int n,k;cin>>n>>k;
    vector<int> h(n);
    for(int i = 0; i < n; i++) cin >> h[i];
    vector<int> dp(n,1234567890);
    dp[0] = 0;
    for(int i = 1; i < n; i++)
    {
        for(int j = max((int) 0,i-k); j < i; j++)
        {
            dp[i] = min(dp[i],dp[j]+abs(h[i]-h[j]));
        }
    }
    cout << dp[n-1] << endl;
    
    return 0;
}


Measured memory_bytes: 1792
N = int(input())
d = {'M':0, 'A':0, 'R':0, 'C':0, 'H':0}
for _ in range(N):
    S = input()
    if S[0] in d:
        d[S[0]] += 1
L = ['M', 'A', 'R', 'C', 'H']
ans = 0
for i in range(3):
    for j in range(i+1, 4):
        for k in range(j+1, 5):
            ans += d[L[i]] * d[L[j]] * d[L[k]]
print(ans)

Measured memory_bytes: 3064
import functools
import fractions
N,X=map(int,input().split())
x=list(map(int,input().split()))
x.append(X)
x.sort()
y=[]
for i in range(len(x)-1):
    y.append(x[i+1]-x[i])
gcd=functools.reduce(fractions.gcd,y)
print(gcd)

Measured memory_bytes: 16292
#include <bits/stdc++.h>
using namespace std;
int main(){
	string s;
  	cin >> s;
  	for(int i=0;i<s.size()-1;i++){
  		if(s[i]==s[i+1]){
  			cout << i+1 << ' ' << i+2 << endl;
  			return 0;
  		}else if(s[i]==s[i+2]){
  			cout << i+1 << ' ' << i+3 << endl;
  			return 0;
  		}
  	}
  	cout << "-1 -1" << endl;
  	return 0;
}


Measured memory_bytes: 512
n = int(input())
w = list(map(int, input().split()))

sum_w = sum(w)
result = []
x = 0
for i in range(n):
    s = 0
    y = 0
    while s <= i:
        y += w[s]
        s += 1
    x = abs(sum_w-y*2)
    result.append(x)
print(min(result))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
int main () {
	int N;
	cin >> N;
	std::vector<int> v(N);
	for (int i = 0; i < N; ++i)
	{
		cin >> v[i];
	}
	sort(v.begin(), v.end());
	int count = N;
	for (int i = 0; i < N-1; ++i)
	{
		if(v[i] == v[i+1])count--;
	}
	cout << count << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
struct ii {
    ll a, b;
    bool operator < (ii o) const {
        return tie(a, b) < tie(o.a, o.b);
    }
};
struct iii {
    ll a, b, c;
    bool operator < (iii o) const {
        return tie(a, b, c) < tie(o.a, o.b, o.c);
    }
};

const ll MOD = 1000000007;
const ll INF = 1000000000;
const ll MAXN = 1000005;

ll fact[MAXN];

int main() {
    ios::sync_with_stdio(0); cin.tie(0);
    
    for (ll i = 2; i < MAXN; i++) {
        if (fact[i] != 0) continue;
        fact[i] = i;
        for (ll j = i*i; j < MAXN; j += i) {
            if (fact[j] == 0) fact[j] = i;
        }
    }
    //~ for (int i = 2; i < 100; i++) cerr << i << " " << fact[i] << "\n";
    
    ll N;
    cin >> N;
    bool pairwise = true;
    ll setwise = 0;
    set<ll> exists;
    for (ll i = 0; i < N; i++) {
        ll A;
        cin >> A;
        
        vector<ll> curFact;
        ll now = A;
        while (now > 1) {
            ll sml = fact[now];
            if (curFact.empty() || curFact.back() != sml) curFact.push_back(sml);
            //~ cerr << now << " " << sml << "\n";
            now /= sml;
        }
        
        for (auto f: curFact) {
            if (exists.count(f)) pairwise = false;
            exists.insert(f);
        }
        
        setwise = __gcd(setwise, A);
    }
    
    if (pairwise) cout << "pairwise coprime\n";
    else if (setwise == 1) cout << "setwise coprime\n";
    else cout << "not coprime\n";
    
}


Measured memory_bytes: 15120
#include <iostream>
#include <vector>
#include <stack>
#include <ios>
using namespace std;


struct Node
{
    struct Node * parent;
    struct Node * left_child;
    struct Node * right_sibling;
    int key;
    int depth;
    Node(int key_ = -1) : parent{nullptr}, left_child{nullptr}, right_sibling{nullptr}, key{key_}, depth{-1} {};
};

int find_root(vector<Node> const & nodes){
    for (auto const & node : nodes){
        if (node.parent == nullptr) return node.key;
    }
    return -1;
}

void set_depth(int root, vector<Node> & nodes){
    nodes[root].depth = 0;
    stack<Node *> stacks;
    stacks.push(nodes[root].left_child);
    while (! stacks.empty()){
        auto pNode = stacks.top();
        stacks.pop();
        if (pNode == nullptr) continue;
        pNode->depth = pNode->parent->depth + 1;
        stacks.push(pNode->right_sibling);
        stacks.push(pNode->left_child);
    }
}

void show_node_data(Node const & node){
    cout << "node " << node.key << ": ";
    cout << "parent = " << ((node.parent == nullptr) ? -1 : node.parent->key) << ", ";
    cout << "depth = " << node.depth << ", ";
    if (node.parent == nullptr){
        cout << "root, ";
    }else if (node.left_child == nullptr){
        cout << "leaf, ";
    }else{
        cout << "internal node, ";
    }
    cout << "[";
    auto pNode = node.left_child;
    if (pNode != nullptr){
        cout << pNode->key;
        while (pNode->right_sibling != nullptr){
            pNode = pNode->right_sibling;
            cout << ", " << pNode->key;
        }
    }
    cout << "]" << endl;
}

int main()
{
    ios::sync_with_stdio(false);
    int n = 0;
    cin >> n;
    vector<Node> nodes(n);
    for (int i = 0; i != n; ++i) nodes[i].key = i;
    for (int i = 0; i != n; ++i){
        int node_id, k;
        cin >> node_id;
        cin >> k;
        int c0 = -1;
        int c1 = -1;
        for (int j = 0; j != k; ++j){
            cin >> c1;
            if (c0 == -1){
                nodes[node_id].left_child = & nodes[c1];
            }else{
                nodes[c0].right_sibling = & nodes[c1];
            }
            nodes[c1].parent = & nodes[node_id];
            c0 = c1;
        }
    }
    auto root = find_root(nodes);
    set_depth(root, nodes);
    for (auto & node : nodes) show_node_data(node);
    return 0;
}

Measured memory_bytes: 5880
#include <stdio.h>

int main(void)
{
	int a;
	int b;
	
	scanf("%d %d", &a, &b);
	
	if (a < b){
		printf("a < b\n");
	}
	else if (a > b){
		printf("a > b\n");
	}
	else if (a == b){
		printf("a == b\n");
	}
	
	return (0);
}

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

int main(){
    int k;
    cin >> k;
    int x = 7 % k;
    for(int i = 1; i <= k; i++){
        if(x == 0){
            cout << i << endl;
            return 0;
        }
        x = (x * 10 + 7) % k;
    }
    cout << -1 << endl;
    return 0; 
}

Measured memory_bytes: 3632
#include <stdio.h>
#include <string.h>

int main() {
    int i, N, c0, c1, c2, c3;
    char buf[10];
    char *AC = "AC";
    char *WA = "WA";
    char *TLE = "TLE";
    char *RE = "RE";

    c0 = c1 = c2 = c3 = 0;
    scanf("%d", &N);

    for(i=0; i < N; i++) {
        scanf("%s", buf); 
        if (strcmp(buf, AC) == 0) {
            c0++;
        } else if (strcmp(buf, WA) == 0) {
            c1++;
        } else if (strcmp(buf, TLE) == 0) {
            c2++;
        } else if (strcmp(buf, RE) == 0) {
            c3++;
        }
    }

    printf("AC x %d\n", c0);
    printf("WA x %d\n", c1);
    printf("TLE x %d\n", c2);
    printf("RE x %d\n", c3);

    return 0;
}

Measured memory_bytes: 1728
#include <iostream>
#include <cstring>
#include<vector>
#include <algorithm>
#include<cstdlib>
#include<set>
#include<math.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define rep(i,n) for(ll i=0;i<n;i++)

int main()
{
	ll k, x;
	cin >> k >> x;
	ll a, b;
	if (x - k + 1 < -1000000)
	{
		a = -1000000;
	}
	else
	{
		a = x - k + 1;
	}

	if (1000000 < x + k - 1)
	{
		b = 1000000;
	}
	else
	{
		b = x + k - 1;
	}

	for (ll i = a; i < b + 1; i++)
	{
		cout << i << " ";
	}


	return 0;
}

Measured memory_bytes: 3612
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
using namespace std;

int n, k;
string s;
char x;

int main(){

	cin >> n >> s >> k;

	x = s[k - 1];

	for (int i = 0; i < n; i++){
		if (x != s[i]) s[i] = '*';
	}

	cout << s << endl;

	return 0;
}

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

typedef long long ll;
typedef pair<ll,ll> P;

const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const ll INF = 1LL<<29;
const ll mod = 1e9+7;

#define rep(i, a, b) for(ll (i) = (a); (i) < (b);++i)

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

	ll ans = 0;
	if (B - A - 1 <= 2) {
		ans = K + 1;
		cout << ans << endl;
		return 0;
	}

	ans += A;
	K -= A - 1;
	ans += K / 2 * (B - A);
	ans += K % 2;
	cout << ans << endl;
	return 0;
}


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

int main() {
  int N;
  cin >> N;
//  cout << N << endl;

  vector<tuple<string, int, int>> p(N);
  
  for (int i=0; i<N; ++i) {
    cin >> get<0>(p.at(i)) >> get<1>(p.at(i));
    get<1>(p.at(i)) = 100 - get<1>(p.at(i));
    get<2>(p.at(i)) = i + 1;
  }
  
  sort(p.begin(), p.end());
  
  for (int i=0; i<N; ++i) {
    cout << get<2>(p.at(i))  << endl;
  }

  return 0;
}

Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
#define LL long long
#define pa pair<int,int>
const int inf=2147483647;
int read()
{
	int x=0,f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9')x=(x<<3)+(x<<1)+(ch^48),ch=getchar();
	return x*f;
}
int main()
{
	int a=read(),b=read(),k=read(),c=0;
	for(int i=min(a,b);i;i--)
	if(a%i==0&&b%i==0)
	{
		c++;
		if(c==k)return printf("%d\n",i),0;	
	}
	
}

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

int main(){
    int N;
    cin >> N;
    int count= 0;
    int x;
    for(int i=0;i<N;i++){
        cin >> x;
        if(x == count+1){
            count++;
        }
    }
    int ans = 0;
    if(count==0){
        ans = -1;
    }else{
        ans = N-count;
    }
    
    cout << ans << "\n";

    return 0;
}

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

#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define MOD 1000000007

using namespace std;

using ull = unsigned long long;

vector<ull> primes_less_than(ull n) {
    vector<ull> primes = { 2 };
    for (ull m = 3; m < n; m += 2) {
        bool is_prime = true;
        for (ull p: primes) {
            if (m % p == 0) {
                is_prime = false;
                break;
            }
        }
        if (is_prime) {
            primes.push_back(m);
        }
    }
    return primes;
}

int main() {
    int N;
    cin >> N;
    vector<ull> primes = primes_less_than(N + 1);
    unordered_map<int, int> count;
    FOR(n, 1, N + 1) {
        int m = n;
        for (ull p: primes) {
            if (p * p > m) {
                break;
            }
            while (m % p == 0) {
                m /= p;
                ++count[p];
            }
        }
        if (m > 1) {
            ++count[m];
        }
    }
    ull result = 1;
    for (auto key_value: count) {
        result = (result * (key_value.second + 1)) % MOD;
    }
    cout << result << endl;
    return 0;
}

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

using namespace std;

#define ll long long

ll dp[(int)2e5];
int main() {
    int n;
    cin >> n;
    vector<int>v(n);
    
    for(int i = 0; i < n; i++){
        cin >> v[i];
    }
    dp[0] = 0;
    for(int i = 0; i < n; i++){
        if(i > 0) dp[i] = dp[i - 1] + abs(v[i - 1] - v[i]);
        if(i > 1) dp[i] = min (dp[i], dp[i - 2] + abs(v[i - 2] - v[i]));
    }
    
    cout << dp[n - 1] << endl;
    
    
    return 0;
}

Measured memory_bytes: 1408
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <vector>
#include <stack>
#include <map>
#include <set>
#include <cmath>
#include <cctype>
#include <ctime>

using namespace std;

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define eps 1e-9
#define SZ(x) ((int)x.size())
#define x first
#define y second

typedef long long ll;
typedef pair<int, int> pii;
const int maxn = 1e3;
char s[maxn];

int main() {
#ifdef __AiR_H
    freopen("in.txt", "r", stdin);
//    freopen("out.txt", "w", stdout);
#endif // __AiR_H
    scanf("%s", s); int len = strlen(s);
    for (int i = 0; i < len - 8; ++i) { printf("%c", s[i]); }
    printf("\n");
    return 0;
}


Measured memory_bytes: 256
n,x,y=map(int,input().split())
l=[0]*n
for i in range(1,n+1):
  for j in range(i+1,n+1):
    temp=min(abs(j-i),abs(x-i)+1+abs(y-j),abs(y-i)+1+abs(j-x))
    l[temp]+=1
for i in range(1,n):
  print(l[i])



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

// template {{{  0 
// using {{{ 1
using ll = long long int;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vii = vector<pii>;
using vll = vector<pll>;
// }}} 1
// definition {{{ 1
// scaning {{{ 2
#define Scd(x) scanf("%d", &x)
#define Scd2(x,y) scanf("%d%d", &x, &y)
#define Scd3(x,y,z) scanf("%d%d%d", &x, &y, &z)
#define Scll(x) scanf("%lld", &x)
#define Scll2(x,y) scanf("%lld%lld", &x, &y)
#define Scll3(x,y,z) scanf("%lld%lld%lld", &x, &y, &z)
#define Scc(c) scanf("%c", &c);
#define Scs(s) scanf("%s", s);
#define Scstr(s) scanf("%s", &s);
// }}} 2
// constants {{{ 2
#define EPS (1e-7)
#define INF (2e9)
#define PI (acos(-1))
// }}} 2
// systems {{{ 2
#define Repe(x,y,z) for(ll x = z; x < y; x++)
#define Rep(x,y) Repe(x,y,0)
#define RRepe(x,y,z) for(ll x = y-z-1; x >= 0; x--)
#define RRep(x,y) RRepe(x,y,0)
// }}} 2
// output {{{ 2
#define YesNo(a) (a)?printf("Yes\n"):printf("No\n")
#define YESNO(a) (a)?printf("YES\n"):printf("NO\n")
// }}} 2
// }}} 1
// input {{{ 1
// }}} 1
// }}} 0
//
ll mod = 1000000007;

int main() {

    char S[103020] = {};
    Scs(S);

    int N = strlen(S);

    reverse(S,S+N);

    static ll dp[100020][13] = {};
    dp[0][0] = 1;

    int d = 1;
    Rep(i,N){
        Rep(k,13){
            if( S[i] == '?' ){
                Rep(dd,10){
                    dp[i+1][(k+dd*d)%13] += dp[i][k];
                }
            }else{
                dp[i+1][((k+(S[i]-'0')*d)%13)] += dp[i][k];
            }
        }
        d *= 10;
        d %= 13;
        Rep(k,13){
            dp[i+1][k] %= mod;
        }
    }

    printf ("%lld\n", dp[N][5]);

    return 0;
}



Measured memory_bytes: 10496
#include <stdio.h>
#include <math.h>

int main(void){
 double x,h,S;

 while(scanf("%lf",&x)!=EOF && scanf("%lf",&h)!=EOF){
  if(x==0 && h==0){break;}
  S=(x*x)+4*x*sqrt(x*x/4+h*h)/2;
 
  printf("%f\n",S);
 }
 return 0;
}

Measured memory_bytes: 644