akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#include<stdlib.h>

struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;
#define NIL NULL

Node root;

/*
Node treeMinimum(Node x){
}

Node treeSearch(Node u, int k){
}

Node treeSuccessor(Node x){
}

void treeDelete(Node z){
  Node y; // node to be deleted
  Node x; // child of y
}
*/

void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;

  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;

  while (x != NIL) {
    y = x;
    if (z->key < x->key) {
      x = x->left;
    } else {
      x = x->right;
    }
  }
  z->parent = y;

  if (y == NIL) {
    root = z;
  } else if (z->key < y->key) {
    y->left = z;
  } else {
    y->right = z;
  }
}

void inorder(Node u){
  if (u == NIL) return;
  inorder(u->left);
  printf(" %d", u->key);
  inorder(u->right);
}

void preorder(Node u){
  if (u == NIL) return;
  printf(" %d", u->key);
  preorder(u->left);
  preorder(u->right);
}


int main(void) {
  int n, i, x;
  char com[20];
  scanf("%d", &n);

  for (i = 0; i < n; i++) {
    scanf("%s", com);
    if (com[0] == 'f') {
      /*      scanf("%d", &x);
              Node t = treeSearch(root, x);
              if (t != NIL) {
              printf("yes\n");
              } else {
              printf("no\n");
              }
      */
    } else if (com[0] == 'i') {
      scanf("%d", &x);
      insert(x);
    } else if (com[0] == 'p') {
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    } else if (com[0] == 'd') {
      /*
        scanf("%d", &x);
        treeDelete(treeSearch(root, x));
      */
    }
  }

  return 0;
}

Measured memory_bytes: 24040
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
      // 整数の入力
		int N = sc.nextInt();
		int[] a = new int[N];
      	int maxnum = 1;
        boolean flag = false;
      	for(int i=0;i<N;i++){
          a[i]=sc.nextInt();
          if(a[i]==maxnum){
          	maxnum++;
            flag = true;
          }
        }
      	if(flag){
	      	System.out.println(N-maxnum+1);
        }else{
        	System.out.println(-1);
        }

      
      	
	}
}

Measured memory_bytes: 79496
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

// input scanner
var sc = bufio.NewScanner(os.Stdin)

const (
	initialBufSize = 10e4
	maxBufSize     = 10e6
)

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	a, _ := strconv.Atoi(next())
	return a
}

func nextInt64() int64 {
	a, _ := strconv.ParseInt(next(), 10, 64)
	return a
}

func nextFloat64() float64 {
	a, _ := strconv.ParseFloat(next(), 64)
	return a
}

func nextInts(n int) []int {
	ret := make([]int, n)
	for i := 0; i < n; i++ {
		ret[i] = nextInt()
	}
	return ret
}
func nextFloats(n int) []float64 {
	ret := make([]float64, n)
	for i := 0; i < n; i++ {
		ret[i] = nextFloat64()
	}
	return ret
}
func nextStrings(n int) []string {
	ret := make([]string, n)
	for i := 0; i < n; i++ {
		ret[i] = next()
	}
	return ret
}

// util
func max(l []int) (int, int) {
	idx := 0
	ans := l[idx]
	for i, n := range l {
		if n > ans {
			idx = i
			ans = n
		}
	}
	return idx, ans
}

func min(l []int) (int, int) {
	idx := 0
	ans := l[idx]
	for i, n := range l {
		if n < ans {
			idx = i
			ans = n
		}
	}
	return idx, ans
}

// main
func main() {
	buf := make([]byte, initialBufSize)
	sc.Buffer(buf, maxBufSize)
	sc.Split(bufio.ScanWords)
	l := nextInt64()
	lll := l * l * l
	fmt.Println(float64(lll) / float64(27))
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define pi 3.14159265359
#define all(i) i.begin(),i.end()
using namespace std;
const long long INF=1e9+7;
const string alp="abcdefghijklmnopqrstuvwxyz"; //26
const string ALP="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> T;
//const ll MOD=998244353LL;
//const ll MOD=1777777777LL;


int main() {
  ll N,X,T;
  cin>>N>>X>>T;
  ll ans=(N/X)*T;
  if(N%X!=0){
    ans+=T;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3624
package main

import "fmt"

func main() {
	var mod int64 = 1000000007
	var n int64
	fmt.Scan(&n)

	a := make([]int64, n)

	for i := range a {
		fmt.Scan(&a[i])
	}

	var data int64
	var ans int64

	for i := n -2; i >= 0; i--{
		data = (data + a[i+1]) % mod
		ans = (ans + (data*a[i])%mod) % mod

	}
	fmt.Println(ans)
}


Measured memory_bytes: 6484
_n = gets
BUILDINGS = 4
FLOORS    = 3
ROOMS     = 10
SEPARATOR = "#" * 20

values = readlines.each_with_object({}) do |line, hash|
  building, floor, room, value = line.split.map(&:to_i)

  hash[building] ||= {}
  hash[building][floor] ||= {}
  hash[building][floor][room] ||= 0
  hash[building][floor][room] += value
end


puts (1..BUILDINGS).map { |building|
  (1..FLOORS).map { |floor|
    (1..ROOMS).map { |room|
      values[building] && values[building][floor] && values[building][floor][room] || 0
    }.map { |n| " #{n}" }.join
  }.join("\n")
}.join("\n#{SEPARATOR}\n")

Measured memory_bytes: 6116
#include<iostream>
#include<algorithm>
using namespace std;
using ll = long long;

int cnt_digits(ll N){
    int digits = 0;
    while(N > 0){
        N /= 10;
        digits++;
    }
    return digits;
}

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

    int ans = cnt_digits(N);

    for (ll A = 1ll;A*A <= N ; ++A){
        if (N%A != 0)continue;
        const ll B = N/A;

        const int cur = max(cnt_digits(A),cnt_digits(B));
        if (ans > cur){
            ans = cur;
        }
    }
    cout << ans << endl;
return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#define INF 1e9
using namespace std;
int data[11111];
int dp[2][5555][2];
int main()
{
    int n;
    cin>>n;
    for(int i=0;i<n-1;++i){
        cin>>data[i];
    }
    for(int i=0;i<2;++i){
        for(int j=0;j<n/2+1;++j){
            dp[i][j][0]=INF;
            dp[i][j][1]=INF;
        }
    }
    dp[1][1][1]=0;
    dp[1][0][0]=0;
    int res=INF;
    for(int i=2;i<n+1;++i){
        for(int j=0;j<n/2+1;++j){
            dp[i%2][j][0]=min(dp[(i+1)%2][j][0],dp[(i+1)%2][j][1]+data[i-2]);
            if(j!=0)dp[i%2][j][1]=min(dp[(i+1)%2][j-1][1],dp[(i+1)%2][j-1][0]+data[i-2]);
            res=min(res,dp[i%2][n/2][0]);
            res=min(res,dp[i%2][n/2][1]+data[i-1]);
        }
        for(int j=0;j<n/2+1;++j){
            dp[(i+1)%2][j][0]=INF;
            dp[(i+1)%2][j][1]=INF;
        }
    }
    cout<<res<<endl;
}

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

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

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

	int dp[n] = {0};

	for(int i=1 ; i<n ; i++){
		int mn = INT_MAX;
		for(int j=1 ; j<=k && i-j>=0; j++){
			mn = min(mn,dp[i-j] + abs(arr[i]-arr[i-j]));
		}
		dp[i] = mn;
	}
	cout << dp[n-1] << "\n";
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <math.h>
#include <cmath>

using namespace std;
using ll =long long;
using vi = vector<int>; 
using vvi = vector<vi>; 
using vl = vector<ll>; 
using vvl = vector<vl>; 
using vs = vector<string>;
using vvs = vector<vs>; 
using vc = vector<char>;
using vvc = vector<vc>; 
using vb = vector<bool>;
using vvb = vector<vb>; 

#define rep(i,n) ;for( int i =0; i < n ; i ++)
#define all(a) a.begin(),a.end()
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define f(i,a,b) for(int i=a;i<b;i++)
#define pri(a)  printf("%.14lf\n",a);
#define MOD 1000000007
bool is_int_lround(double x){
  return std::lround(x)==x;
}
ll keta(ll x){
  ll n=0;
  while(x>0){
    x /=10 ;
    n ++;
  }
  return n;
}

ll conbi(int n,int m){
  
  cin>>n>>m;
  vector<ll> a(100);
  a[0] =1;
  for(int i=0;i<14;i++){
    a[i+1]=a[i]*(i+1);
  }
  return a[n] /(a[m] *a[n-m]);
}

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;//繰り返し二乗法
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
ll kaijo(ll x){
  ll z=1;
  if(x==0){
    return 1;
  }
  while(x>0){
    z *=x;
    z %=MOD;
    x--;
  }
  return z;
}
ll yakusu_num(ll n){
  vl yakusu(n+1,1);
  for(ll i=2;i*i<=n;i++){ 
    while(n%i==0){
      n /=i;
      yakusu[i]++;
    }
  }
  if(n!=1)yakusu[n]++;
  ll num=1;
  for(ll i=0;i<=n;i++){
    num*=yakusu[i];
  }
  return num;
}

int H,W;
vs s(50);
vi dv ={-1,0,1,0};vi du={0,-1,0,1};
int cnt=1;
int dfs(int u,int v){
  s[u][v]='.';
  
  rep(i,4){
   
      int nu =u +du[i],nv=v+dv[i];
      if(nu<0||nu>=H||nv<0||nv>=W)continue;
      if(s[nu][nv]=='.')continue;
      cnt ++;
      dfs(nu,nv);
    
  }
  return cnt;

}
int keta_wa(int x){
  int tot=0;
  while(x>0){
    tot +=x%10;
    x/=10;
  }
  return tot;
}

//vc alp(26) ={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
//cout<<""<<endl;
int main(){
  string S,T;cin>>S>>T;
  bool okk=false;
  for(int i=S.size()-T.size();i>=0;i--){
    string s= S.substr(i,T.size());
    bool ok=true;
    for(int j=0;j<T.size();j++){
      if(s[j]!='?'&&s[j]!=T[j]){
        ok =false;
      }
    }
    if(ok){
      for(int k=0;k<i;k++){
        if(S[k]!='?')cout<<S[k];
        else cout<<'a';
      }
      cout<<T;
      for(int k=i+T.size();k<S.size();k++){
        if(S[k]!='?')cout<<S[k];
        else cout<<'a';
      }
      cout<<endl;
      okk=true;
      break;
    }
    
  }
  if(!okk)cout<<"UNRESTORABLE"<<endl;
    
}







Measured memory_bytes: 256
def check_bomb(S_list,h,w):
    num_of_bomb=0
    for i in range(3):
        if h-1+i<0 or h-1+i>len(S_list)-1:
            continue

        for j in range(3):
            if w-1+j<0 or w-1+j>len(S_list[0])-1:
                continue
            if S_list[h-1+i][w-1+j]=="#":
                num_of_bomb+=1
    return "{}".format(num_of_bomb)



def main():
    input_str1 = list(map(int, input().split()))
    H = input_str1[0]
    W = input_str1[1]
    S_list = []
    for i in range(H):
        S_list.append(input())

    for i in range(H):
        for j in range(W):
            if S_list[i][j]==".":
                temp_list = S_list[i]
                temp_list = temp_list[:j]+check_bomb(S_list,i,j)+temp_list[j+1:]
                S_list[i]=temp_list
                
    for i in range(H):
        print(S_list[i])




main()


Measured memory_bytes: 3064
#include <iostream>
#include <cstdio>
#include <ctime>
#include <cstdlib>
#include <algorithm>
#define F first
#define S second
using namespace std;

int Q = 1e5, h1, h2, cut = 100;
int n, s, D, l, r, up, mx, a[30], b[400][30], la[400], u[400], ans[400];
pair<int, int> c[400][30];
bool v[400][26];

int f(int p, int q1, int q2) {
	int sz = q2 - q1 + 1;
	return p * sz * (sz + 1) / 2;
}

int main()
{
	int i, j, t, x, t1, t2;
	srand(time(NULL));
	cin >> D;
	for (i = 0; i < 26; i++) {
		scanf ("%d", &a[i]);
	}
	for (i = 1; i <= D; i++) {
		for (j = 0; j < 26; j++) {
			scanf ("%d", &b[i][j]);
			c[i][j].F = b[i][j];
			c[i][j].S = j;
		}
		sort(c[i], c[i] + 26);
		ans[i] = u[i] = c[i][25].S;
	}
//	for(i = 1; i <= D; i++) {
//		printf("%d\n", ans[i]);
//	}
	for (i = 1; i <= D; i++){
//		scanf ("%d", &t);
		t = u[i] - 1;
		s += b[i][t];
		la[t] = i;
		for (j = 0; j < 26;j++) {
			s -= a[j] * (i - la[j]);
		}
		v[i][t] = 1;
	}
//	cout << s << endl;
//	cin >> Q;
	for (i =0; i < 26; i++) {
		v[0][i] = 1;
		v[D + 1][i] = 1;
	}
	mx = s;
	while (Q--) {
//		scanf ("%d %d", &t1, &t2);
		t1 = rand() % D + 1;
		t2 = rand() % 26;
		if (u[t1] == t2) t2 = (t2 + 1) % 26;
		x = u[t1];
		s -= b[t1][x];
		v[t1][x] = 0;
		v[t1][t2] = 1;
		u[t1] = t2;
		s += b[t1][t2];
		for (l = t1 - 1; l >= 0; l--) if (v[l][x]) break;
		for (r = t1 + 1; r <= D + 1; r++) if (v[r][x]) break;
		s += f(a[x], l + 1, t1 - 1);
		s += f(a[x], t1 + 1, r - 1);
		s -= f(a[x], l + 1, r - 1);
		for (l = t1 - 1; l >= 0; l--) if (v[l][t2]) break;
		for (r = t1 + 1; r <= D +1; r++) if (v[r][t2]) break;
		s += f(a[t2], l + 1, r - 1);
		s -= f(a[t2], l + 1, t1 - 1);
		s -= f(a[t2], t1 + 1, r - 1);
		if (s > mx) {
			up = 0;
			for (i = 1; i <= D; i++) {
				ans[i] = u[i];
			}
			mx = s;
		} else up++;
		if (up == cut) {
			up = 0;
			for (i = 1; i <= D; i++) {
				u[i] = ans[i];
			}
			s = mx;
		}
	}
	for (i = 1; i <= D; i++) {
		printf("%d\n", ans[i] + 1);
	}
    return 0;
}


Measured memory_bytes: 3940
#include<bits/stdc++.h>
using namespace std;
#define allv v.begin(),v.end()
typedef long long ll;
typedef pair<ll,ll> pll;
const int maxn=1e5+7;
ll a[maxn];
vector<pll> v;
int main()
{
	int n,m;cin>>n>>m;
	for(int i=1;i<=n;i++)
		scanf("%lld",&a[i]);
	sort(a+1,a+n+1);
	for(int i=1;i<=m;i++)
	{
		ll x,y;cin>>x>>y;
		v.push_back(pll(y,x));
	}
	sort(allv);reverse(allv);int id=0;ll sum=0;
	for(int i=1;i<=n;i++)
	{
		if(id<m&&v[id].first>a[i])
		{
			sum+=v[id].first;v[id].second--;
		}
		else sum+=a[i];
		
		if(id<m&&v[id].second==0) id++;
	}
	cout<<sum<<endl;
}

Measured memory_bytes: 3188
#pragma once
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <deque>
#include <numeric>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 10e8;
const int MAX_V = 201;
void ISU() {
	int x, y, z;
	cin >> x >> y >> z;
	int pad = (x - 2 * z);
	int div = pad / (y + z);
	int rem = pad % (y + z);

	cout << (div + (rem >= y)) << endl;
}

int main() {
	ISU();
	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define o(a) cout << a << endl
#define int long long
#define fi first
#define se second
using namespace std;
typedef pair<int, int> P;

int n, m;
vector<int> G[100010];
bool f[100010];

signed main(){
    cin >> n >> m;
    rep(i, 0, m){
        int a, b;
        cin >> a >> b;
        a--; b--;
        G[a]. push_back(b);
        G[b]. push_back(a);
    }
    vector<int> path;
    path. push_back(0);
    f[0] = true;
    int now = 0;
    rep(i, 0, n - 1){
        bool g = true;
        rep(j, 0, G[now].size()){
            if(f[G[now][j]] == false){
                now = G[now][j];
                path. push_back(now);
                f[now] = true;
                g = false;
                break;
            }
        }
        if(g) break;
    }
    now = 0;
    reverse(all(path));
    rep(i, 0, n - 1){
        bool g = true;
        rep(j, 0, G[now].size()){
            if(f[G[now][j]] == false){
                now = G[now][j];
                path. push_back(now);
                f[now] = true;
                g = false;
                break;
            }
        }
        if(g) break;
    }
    cout << path.size() << endl;
    rep(i, 0, path.size()){
        cout << path[i] + 1;
        if(i != path.size() - 1) cout << " ";
    }
    cout << endl;
}

Measured memory_bytes: 7284
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define COUT(x) cout<<(x)<<endl
#define dump(x)  cout << #x << " = " << (x) << endl;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>;
using M = map<int,int>;
using PQ = priority_queue<int>;
using PQG = priority_queue<int, vector<int>, greater<int>>;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

int main() {
  int n; cin >> n;
  for (int i = n; i > 0; i--) {
    double sq = sqrt(i);
    if (sq - floor(sq) == 0) { COUT(i); return 0; }
  }
  return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, m, n) for(int i=(m); i<(n); ++i)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define Cout(x) cout << (x) << endl
#define Cout2(x, y) cout << (x) << " " << (y) << endl
#define dump(x) cerr << #x << " = " << (x) << endl;
typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
const int inf = 1e9;
const double pi = acos(-1.0);

int main() {
	char a, b; cin >> a >> b;
	puts(a == b ? "H" : "D");
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
set<int> s;
int x,n;
vector<int> q;
int main()
{
	cin>>n;
	for (int i=1;i<=n;++i)
	{
		cin>>x;
		if (s.count(x))
		{
			s.erase(x);
			q.push_back(x);
		}
		else
			s.insert(x);
	}
	sort(q.rbegin(),q.rend());
	if (q.size()>=2)
		cout<<(long long)q[0]*q[1];
	else
		cout<<0;
	return 0;
}

Measured memory_bytes: 4992
a, b = gets.split.map(&:to_i)

"想定解"
# MAX = 1300
# 0.upto MAX do |i|
#   pa = (i*0.08).floor
#   pb = (i*0.1).floor
#   if pa==a and pb==b
#     puts i
#     exit
#   end
# end
# puts -1

"O(1)解法"
sa, ta = 0
sb, tb = 0

sa = (a/0.08).ceil
ta = ((a+1)/0.08).floor - 1
sb = (b/0.1).ceil
tb = ((b+1)/0.1).floor - 1

# puts "#{sa} #{ta} #{sb} #{tb}"

if sa <= sb
  if sb <= ta
    puts sb
  else
    puts -1
  end
else
  if sa <= tb
    puts sa
  else
    puts -1
  end
end



Measured memory_bytes: 3836
# https://atcoder.jp/contests/agc018/tasks/agc018_a

n, k = gets.split.map(&:to_i)
nums = gets.split.map(&:to_i)
gcd = nums[0]

nums.each { |i| gcd = gcd.gcd(i) }

max = nums.max
diff = (max - k).abs
puts diff % gcd == 0 && max >= k ? 'POSSIBLE' : 'IMPOSSIBLE'

Measured memory_bytes: 8452
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cstring>
#include <complex>
#include <stack>
#include <queue>
#include <unordered_map>
#include <map>
//sum
using namespace std;

int main() {
    string ans;
    string s;
    int i;
    int n, l;
    cin >> n >> l;
    vector <string> v;
    for (i=0;i<n;i++) {
        cin >> s;
        v.push_back(s);
    }
    sort(v.begin(), v.end());
    for (i=0;i<n;i++) {
        ans += v[i];
    }
    cout << ans << endl;
}

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

using namespace std;

typedef long long int ll;
typedef pair<int, int> P;
#define INF 10000000000000
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep1(i, n) for(int i = 1; i < (int)(n); i++)
#define repN_1(i, n) for(int i = 0; i < (int)(n - 1); i++)
#define repM(i, n) for(int i = (int)(n - 1); i >= 0; i--)
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; }

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

	if (A > 9 || B > 9)
		cout << "-1" << endl;
	else
		cout << A * B << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
typedef long long ll;
using namespace std;
const ll INF = 1e9;
const ll MOD = 1e9 + 7;
#define repi(i, n, init) for (ll i = init; i < (n); i++)
int main()
{
    int a, b, c;
    cin >> a >> b >> c;
    if (a % 2 || b % 2 || c % 2)
    {
        cout << 0 << endl;
    }
    else if (a == b && b == c)
    {
        cout << -1 << endl;
    }
    else
    {
        int ans = 0;
        repi(i, INF, 0)
        {
            int tmp = a;
            a = b / 2 + c / 2;
            b = tmp / 2 + c / 2;
            c = tmp / 2 + (2 * a - c) / 2;
            ans++;
            if (a % 2 || b % 2 || c % 2)
                break;
        }
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
  int A, B;
  char s[10] = {};
  int i, j, k;
  int count = 0;
  int buf;
  int flag;
  scanf("%d %d", &A, &B);
  for(i = A; i <= B; i++){
    //iを文字列s[]に変換
    buf = i;
    for(j = 0; j < 5; j++){
      s[j] = buf%10 + '0';
      buf /= 10;
    }
    if(s[0] == s[4] && s[1] == s[3]){
      count++;
    }
  }
  printf("%d\n", count);
  return 0;
}


Measured memory_bytes: 128
#include <cstdio>
#include <algorithm>
#include <vector>
#define NMAX 500005
#define NUL -1
using namespace std;
int n;
vector<int> result;
struct Node {
    int IOid, x, y, left, right;// id、二叉树位置、坐标、子节点
}nodes[NMAX];
bool lessByX(const Node &node1, const Node &node2){return node1.x < node2.x;}
bool lessByY(const Node &node1, const Node &node2){return node1.y < node2.y;}
 
int buildTree(int left, int right, int depth){
    if (left>=right)
        return NUL;
    int mid = (right+left)>>1;
    if (depth++ % 2)
        sort(nodes+left, nodes+right, lessByY);
    else sort(nodes+left, nodes+right, lessByX);
    nodes[mid].left = buildTree(left, mid, depth);
    nodes[mid].right = buildTree(mid+1, right, depth);
    return mid;
}
void findNodes (int nowLoc, int xMin, int xMax, int yMin, int yMax, int depth) {
    int nowX = nodes[nowLoc].x;
    int nowY = nodes[nowLoc].y;
    if(nowX >= xMin && nowX <= xMax && nowY <= yMax && nowY >= yMin){
        result.push_back(nodes[nowLoc].IOid);
    }
    if(depth++ % 2) {
        if(nodes[nowLoc].left!=NUL && nowY >= yMin)
            findNodes(nodes[nowLoc].left, xMin, xMax, yMin, yMax, depth);
        if(nodes[nowLoc].right!=NUL && nowY <= yMax)
            findNodes(nodes[nowLoc].right, xMin, xMax, yMin, yMax, depth);
    } else {
        if(nodes[nowLoc].left!=NUL && nowX >= xMin)
            findNodes(nodes[nowLoc].left, xMin, xMax, yMin, yMax, depth);
        if(nodes[nowLoc].right!=NUL && nowX <= xMax)
            findNodes(nodes[nowLoc].right, xMin, xMax, yMin, yMax, depth);
    }
}
 
int main(){
    int xMin, xMax, yMin, yMax;
    short q;
    scanf("%d", &n);
    for (int i = 0;i<n;i++){
        scanf("%d%d", &nodes[i].x, &nodes[i].y);
        nodes[i].IOid = i;
    }
    int root = buildTree(0, n, 0);
    scanf("%d", &q);
    while (q--) {
        scanf("%d%d%d%d", &xMin, &xMax, &yMin, &yMax);
        findNodes(root, xMin, xMax, yMin, yMax, 0);
        sort(result.begin(), result.end());
        int length = result.size();
        for(int i=0;i<length;i++){
            printf("%d\n", result[i]);
        }
        result.clear();
        printf("\n");
    }
    return 0;
}


Measured memory_bytes: 12152
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<queue>
#include<stack>
#include<string>
#include<map>
#include<sstream>
#include<vector>
#include<ctime>
#include<unordered_map>
using namespace std;
typedef long long ll;
#define IOS ios_base::sync_with_stdio(0); cin.tie(0);cout.tie(0);
const int inf=0x3f3f3f3f;
int main()
{
	IOS;
	ll n;
	cin>>n;
	ll x=1,sum=0;
	if(n==1)
	{
		cout<<1<<endl;
		return 0;
	}
	if(n%2!=0) n--;
	while(x<=n)
	{
		sum+=x;
		x*=2;
	}
	cout<<sum<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define pb push_back
#define ff first
#define ss second
#define all(x) (x).begin(), (x).end()
#define ll long long
#define ii pair<int,int>
#define vi vector<int>
#define vll vector<ll>
#define vii vector<ii>
 
using namespace std;

void solve(){

	return;
}
 
int32_t main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

  
	long long int qtd=1,val,cont=0;
	cin >> val;

	while(val!=0){
		cont+=qtd;
		val/=2;
		qtd*=2;
	}

	cout << cont << endl;

	return 0;
}

Measured memory_bytes: 256
from itertools import product as p

d,g=map(int,input().split())
l=[(0,0) for _ in range(d)]
for i in range(d):
  l[i]=tuple(map(int,input().split()))
f=lambda x:[i for (i,j) in enumerate(x) if j==0]
res={}

for i in p([0,1],repeat=d):
  b=f(i)
  cnt=0
  t_val=0

  for (j,k) in enumerate(i):
      if k:
        t_val+=((j+1)*100*l[j][0]+l[j][1])
        cnt+=(l[j][0])
  
  if b:
    inc=max(b)
    pl=g-t_val
    c_inc=0
    if pl>0:
      if pl%((inc+1)*100):
        c_inc=1+pl//((inc+1)*100)
      else:
        c_inc=pl//((inc+1)*100)
      if c_inc<l[inc][0]:
        t_val+=(c_inc*(inc+1)*100)
        cnt+=(c_inc)
      else:
        t_val+=((l[inc][0]-1)*(inc+1)*100)
        cnt+=(l[inc][0]-1)
  res[i]=(t_val,cnt)

o=sorted([i for i in res.values() if i[0]>=g],key=lambda x:x[1])
print(o[0][1])

Measured memory_bytes: 3416
#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;

struct point{
    int x,y;
}a[100000];

int cmp(point a,point b)
{
    if(a.y!=b.y)
        return a.y<b.y;
    return a.x<b.y;
}

int main(){
    int n,k,s,cnt=1,i;
    scanf("%d",&n);
    for(i=0;i<n;i++)
    {
        scanf("%d%d",&k,&s);
        a[i].x=k-s;
        a[i].y=k+s;
    }
    sort(a,a+n,cmp);
    int start=a[0].y;
    int r=n-1;
    while(r)
    {
        if(a[n-r].x>=start)
        {
            cnt++;
            start=a[n-r].y;
        }
        r--;
    }
    printf("%d\n",cnt);
}


Measured memory_bytes: 1024
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>

#define max 100000

//qsort(d, n, sizeof(int), up_comp);
int up_comp(const void *a, const void *b){return *(int*)a - *(int*)b;}
int down_comp(const void *a, const void *b){return *(int*)b - *(int*)a;}

int main()
{
    long int i, j, n, h[max], cnt=0, tmp=0;
    
    scanf("%ld", &n);
    for (i=0; i<n; i++) {
        scanf("%ld", &h[i]);
    }
    
    j=0;
    while (j<n) {
        for (i=j; i<n; i++) {
            
            if (h[i]<h[i+1]||i==n-1) {
                if (tmp<cnt) {
                    tmp=cnt;
                }
                cnt=0;
                break;
            } else {
                cnt++;
            }
        }
        j=i+1;
        
    }
    
    printf("%ld", tmp);

    return 0;
}




Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
int main(){
  string q;
  getline(cin, q);
  vector<string> key;
  for (char c : q){
    if (c == '.'){
      key.push_back("");
    } else {
      key.back().push_back(c);
    }
  }
  int M = key.size();
  vector<string> yaml;
  while (1){
    string S;
    getline(cin, S);
    if (S == ""){
      break;
    }
    yaml.push_back(S);
  }
  int N = yaml.size();
  vector<int> space(N, 0);
  for (int i = 0; i < N; i++){
    while (yaml[i][space[i]] == ' '){
      space[i]++;
    }
  }
  vector<int> p(N, N);
  for (int i = 0; i < N; i++){
    if (space[i] > 0){
      p[i] = i;
      while (space[p[i]] >= space[i]){
        p[i]--;
      }
    }
  }
  vector<vector<int>> c(N + 1);
  for (int i = 0; i < N; i++){
    c[p[i]].push_back(i);
  }
  int r = N;
  bool ok = true;
  for (int i = 0; i < M; i++){
    int r2 = -1;
    for (int j : c[r]){
      string S;
      for (char c : yaml[j]){
        if (c == ':'){
          break;
        }
        if (c != ' '){
          S += c;
        }
      }
      if (S == key[i]){
        r2 = j;
      }
    }
    if (r2 == -1){
      ok = false;
      break;
    } else {
      r = r2;
    }
  }
  if (!ok){
    cout << "no such property" << endl;
  } else if (yaml[r].back() == ':'){
    cout << "object" << endl;
  } else {
    int sz = yaml[r].size();
    string ans;
    for (int i = 0; i < sz; i++){
      if (yaml[r][i] == ':'){
        ans = yaml[r].substr(i + 2);
        break;
      }
    }
    cout << "string " << '"' << ans << '"' << endl;
  }
}


Measured memory_bytes: 3352
#include<iostream>
#include<string>
using namespace std;
int main(){
  string t,h;
  int n;
  int tp=0;
  int hp=0;
  cin>>n;
  for(int i=0;i<n;i++){
      cin>>t>>h;
      if(t==h){
          tp+=1;
          hp+=1;
      }else if(t>h){
          tp+=3;
      }else if(t<h){
          hp+=3;
      }
  }
  cout<<tp<<" "<<hp<<endl;
  return 0;
}


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

int main(){
	long long x,y,quo;
	int res=1;
	scanf("%lld %lld",&x,&y);
	quo=y/x;
	while(quo!=1){
		quo/=2;
		res++;
	}
	printf("%d\n",res);
} 

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define erep(i,a,n) for(int i = a;i<=n;i++)
typedef long long ll;
#define int long long
#define vint vector<int>
#define vvint vector<vector<int>>
#define vstring vector<string>
#define vdouble vector<double>
#define vll vector<ll>:
#define vbool vector<bool>
#define INF 1101010101010101010
#define MOD 1000000007
#define P = pair<int,int>;
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; }

signed main(){
  int n;
  cin >> n;
  vint A(n);
  rep(i,0,n){
    cin >> A[i];
  }
  deque<int> d;
  rep(i,0,n){
    int key = lower_bound(d.begin(),d.end(),A[i]) - d.begin();
    if(key == 0){
      d.push_front(A[i]);
    }
    else{
      d[key-1] = A[i]; 
    }
  }
  cout << d.size() << endl;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
    int n; cin >> n;
    ll x = 1;
    for (int i = 0; i < n; i++) {
        ll t; cin >> t;
        x = x * t / __gcd(x, t);
    }
    cout << x << endl;
}


Measured memory_bytes: 3092
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Scan()
	n, _ := strconv.Atoi(sc.Text())
	sc.Scan()
	m, _ := strconv.Atoi(sc.Text())

	ll := 0
	rr := n
	for i := 0; i < m; i++ {
		sc.Scan()
		l, _ := strconv.Atoi(sc.Text())
		sc.Scan()
		r, _ := strconv.Atoi(sc.Text())
		if l > ll {
			ll = l
		}
		if r < rr {
			rr = r
		}
	}

	fmt.Println(max(0, min(n-ll, rr-ll)+1))
}

func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}

func max(x, y int) int {
	if x > y {
		return x
	}
	return y
}


Measured memory_bytes: 1792
/*

        /////////     /////        ////      ////
        //           //   //      //   //  // //
        //////      //    //     //     //   //
            //     // /// //    //          //
      ////////    //      //   //          //
*/

#include<bits/stdc++.h>
#include<assert.h>
using namespace std;
typedef long long int ll;
typedef unsigned long long ull;
#define Fast ios_base::sync_with_stdio(false); cin.tie(NULL);
#define fo(i,s,n) for(int i=s;i<n;i++)
#define pb(x) push_back(x);
#define Mod 1000000007

void solve(int n,int h[],int k)
{
    int dp[n+1];
    fo(i,0,n+1)
        dp[i]=INT_MAX;
    dp[0]=0;
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=k;j++)
        {  
            if(i-j>=0)
                dp[i]=min((abs(h[i]-h[i-j])+dp[i-j]),dp[i]);
        }
    }
   // fo(i,0,n)
     //   cout<<dp[i]<<" ";
    cout<<dp[n-1];
}

int main()
{
    Fast
    int n,k;
    cin>>n>>k;
    int h[n];
    fo(i,0,n)
        cin>>h[i];
    solve(n,h,k);
    return 0;
}

Measured memory_bytes: 1024
N, V = (int(x) for x in input().split())
A = [int(x) for x in input().split()]
B = [int(x) for x in input().split()]
C = [int(x) for x in input().split()]
D = [int(x) for x in input().split()]

AB = {}
for a in A:
    for b in B:
        AB.setdefault(a + b, 0)
        AB[a + b] += 1

CD = {}
for c in C:
    for d in D:
        CD.setdefault(c + d, 0)
        CD[c + d] += 1

ans = 0
for ab in AB.keys():
    if V - ab in CD:
        ans += AB[ab] * CD[V - ab]

print(ans)



Measured memory_bytes: 203400
#include<iostream>
#include<vector>
#define FOR(i,a,b) for(int i=(a); i<int(b); ++i)
#define RFOR(i,a,b) for(int i=(b)-1; i>=int(a); --i)
#define rep(i,n) FOR(i,0,n)
#define rep1(i,n) FOR(i,1,int(n)+1)
#define rrep(i, n) RFOR(i, 0, n)
#define rrep1(i, n) RFOR(i, 1, int(n) + 1)
#define all(c) begin(c), end(c)
#define al(d) d.begin(),d.end()
using namespace std;

template <typename T>
void putv(vector<T>& V){
	// cout << "The elements in the vector are: " << endl;
	for(auto x: V)
		cout << x << " ";
	cout << endl;
}
template <class T>
vector<T> getv(int n){
	vector<T> vec;
	rep(i,n){
		T input;
		cin >> input;
		vec.emplace_back(input);
	}
	return vec;
}

unsigned long long gcd(const unsigned long long a, const unsigned long long b);
unsigned long long lcm(const unsigned long long a, const unsigned long long b);
unsigned long long lcmv(vector<long long> vec);
int main(){
	int N;
	cin >> N;
	vector<long long> t = getv<long long>(N);
// putv(t);
	if(N==1) cout << t[0] << endl;
	else cout << lcmv(t) << endl;
}

unsigned long long gcd(const unsigned long long a, const unsigned long long b){
	return (b==0) ? a : gcd(b,a%b);
}
unsigned long long lcm(const unsigned long long a, const unsigned long long b){
	return a*(b/gcd(a,b));
}
unsigned long long lcmv(vector<long long> vec){
	int t = vec.size();
	if(t==2)
		return lcm(vec[0],vec[1]);
	long long v = vec[t-1];
	vec.pop_back();
	return lcm(lcmv(vec),v);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }
typedef long long ll;
typedef vector<int> vint;
typedef pair<int, int> pint;
typedef vector<long long> vlong;
#define _GLIBCXX_DEBUG
#define vpush(a,x) a.push_back(x);
#define rep(i, n) REP(i, 0, n)
#define all(v) v.begin(), v.end()
#define REP(i, x, n) for(int i = x; i < n; i++)
const int INF = 1 << 30;
const int dx[] = {1,0,-1,0,1,1,-1,-1};
const int dy[] = {0,-1,0,1,1,-1,-1,1};
#define stp(x)  setprecision(x)
int main(){
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int h,w;
  cin>>h>>w;
  vector<string> s(h);
  rep(i,h){
    cin>>s[i];
  }
  rep(i,w+2){
    cout<<'#';
  }
  cout<<'\n';
  rep(i,h){
    rep(j,w+2){
      if(j==0){
        cout<<'#';
      }
      else if(j==w+1){
        cout<<'#'<<'\n';
      }
      else{
        cout<<s[i][j-1];
      }
    }
  }
  rep(i,w+2){
    cout<<'#';
  }
  cout<<'\n';
  return(0);
}


Measured memory_bytes: 256
X,N=map(int,input().split())
if N==0:
  print(X)
else:
  P=list(map(int,input().split()))
  A=[]
  for i in range(N):
    A.append(abs(P[i]-X))
  if 0 not in A:
    print(X)
  else:
    for i in range(1,N+1):
      if i not in A:
        print(X-i)
        break
      else:
        A.remove(i)
        if i not in A:
          if X+i in P:
            print(X-i)
            break
          if X-i in P:
            print(X+i)
            break
        else:
          A.remove(i)

Measured memory_bytes: 9212
//problem_c.go

package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
	//"strings"
)

const (
	mod = int(1e9) + 7
)

var (
	sc = bufio.NewScanner(os.Stdin)
	wr = bufio.NewWriter(os.Stdout)
)

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

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func getIntSlice(n int) []int {
	ns := []int{}
	for i := 0; i < n; i++ {
		ns = append(ns, getInt())
	}
	return ns
}

func getString() string {
	sc.Scan()
	return sc.Text()
}

func getStringSlice(n int) []string {
	ss := []string{}
	for i := 0; i < n; i++ {
		ss = append(ss, getString())
	}
	return ss
}

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

// Sort Fanction

func sortIntSlice(ns []int) []int {
	sort.Sort(sort.IntSlice(ns))
	return ns
}

func rsortIntSlice(ns []int) []int {
	sort.Sort(sort.Reverse(sort.IntSlice(ns)))
	return ns
}

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

// Num Fanction

//numModPow(a, n, m) == a^n % m
func numModPow(a int, n int, m int) int {
	result := 1

	for n > 0 {
		if n%2 == 1 {
			result = (result * a) % m
		}

		a = (a * a) % m
		n >>= 1
	}

	return result
}

// numGcd(a, b) == gcd(a, b)
func numGcd(a int, b int) int {
	if b == 0 {
		return a
	}

	return numGcd(b, a%b)
}

// numLcm(a, b) == lcm(a, b)
func numLcm(a int, b int) int {
	return a * b / numGcd(a, b)
}

// numModInv(a, p) == a^(-1) % p
func numModInv(a int, p int) int {
	if a == 1 {
		return 1
	} else {
		return p - numModInv(p%a, p)*(p/a)%p
	}
}

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

func solve() {

	l := getInt()
	dl := float64(l)

	fmt.Fprintln(wr, (dl/3)*(dl/3)*(dl/3))
}

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

func main() {
	maxBufSize := int(1e8)
	sc.Buffer(make([]byte, 4096), maxBufSize)
	sc.Split(bufio.ScanWords)
	solve()
	wr.Flush()
}


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

using namespace std;
typedef long long ll;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vd = vector<double>;
using vvd = vector<vd>;

#define out(a) cout << a << endl
#define out1(a) cout << a
#define in(a) cin >> a
#define in2(a, b) cin >> a >> b
#define in3(a, b, c) cin >> a >> b >> c
#define rep(i, N) for (ll i = 0; i < (ll)N; i++)
#define rep1(i, N) for (ll i = 1; i <= (ll)N; i++)
#define repi(i, j, N) for (ll j = (ll)i + 1; j < (ll)N; j++)
#define all(v) v.begin(), v.end()

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

constexpr int inf = 1e9;
constexpr ll linf = 1e18;
constexpr ll mod = 1e9 + 7;

void solve();

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

void solve()
{
    string s, t;
    in2(s, t);
    out(t + s);
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-


class UnionFind(object):

    def __init__(self, number_count: int):
        self.parent_numbers = [-1 for _ in range(number_count)]

    def find_root(self, number: int) -> int:
        if self.parent_numbers[number] < 0:
            return number

        self.parent_numbers[number] = self.find_root(self.parent_numbers[number])
        return self.parent_numbers[number]

    def get_group_size(self, number: int) -> int:
        return -self.parent_numbers[self.find_root(number)]

    def is_same_group(self, number_x: int, number_y: int) -> bool:
        return self.find_root(number_x) == self.find_root(number_y)

    def merge_if_needs(self, number_x: int, number_y: int) -> bool:
        x = self.find_root(number_x)
        y = self.find_root(number_y)

        if x == y:
            return False

        if self.get_group_size(x) > self.get_group_size(y):
            self.parent_numbers[x] += self.parent_numbers[y]
            self.parent_numbers[y] = x
        else:
            # swap
            self.parent_numbers[y] += self.parent_numbers[x]
            self.parent_numbers[x] = y
        return True


def main():
    n, m = map(int, input().split())
    ab = [tuple(map(lambda x: int(x) - 1, input().split())) for _ in range(m)]
    ans = [0 for _ in range(m)]
    ans[-1] = n * (n - 1) // 2
    uf = UnionFind(n)

    for i in range(m - 1, 0, -1):
        ans[i - 1] = ans[i]
        ai = ab[i][0]
        bi = ab[i][1]

        if not uf.is_same_group(ai, bi):
            ans[i - 1] -= uf.get_group_size(ai) * uf.get_group_size(bi)
            uf.merge_if_needs(ai, bi)

    print('\n'.join(map(str, ans)))


if __name__ == '__main__':
    main()


Measured memory_bytes: 29568
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);++i)
#define ALL(v) (v).begin(),(v).end()
#define vi vector<int>
#define vvi vector<vi >
#define vvvi vector<vvi >
#define pii pair<int,int>
#define INF (int)1e9
#define MOD (int)1e9+7
typedef long long llong;
using namespace std;

int main(){
	int n;
	cin>>n;
	
	vi d(n);
	REP(i,n) cin>>d[i];
	
	sort(ALL(d));
	
	int ans=0;
	for(int i=1;i<=100000;++i){
		int num=lower_bound(ALL(d),i)-d.begin();
		if(num==n/2) ans++;
	}
	
	cout<<ans<<endl;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
#define rep(i,j,n) for(int i=(j);i<(n);i++)
#define per(i,n,j) for(int i=(n);i>=(j);i--)
using ll=long long;
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const ll INF=1LL<<60;

int n;

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


Measured memory_bytes: 3604
#include<bits/stdc++.h>
#define rep(i, n) for(int (i)=0 ;i <(n); ++(i))
#define REP(i,m,n) for(int (i) = (m); (i) <= (n); ++(i))
#define yorn(f) puts((f)?"Yes":"No")
#define YORN(f) puts((f)? "YES":"NO")
typedef long long ll;
using namespace std;

int main() {
  int a,b;
  cin >> a >> b;
  a--;
  b--;
  string s;
  cin >> s;
  bool f = true;

  if(s.size() != a + b + 3) f = false;
  if(s[a+1] != '-') f = false;

  rep(i, s.size()) {
    if(i != a+1) {
      if(!('0' <= s[i] && s[i] <= '9')) f = false;
    }
  }
  yorn(f);
  return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<list>
#include<stack>
#include<queue>
#include<cctype>
#include<iomanip>
#include<functional>
#include<numeric>
#include<map>
#include<set>
#include<complex>
#define EPS 1e-10
using namespace std;
typedef long long llong;
int main() {
	string s;
	cin >> s;

	int cnt = 0;

	for (int i = 1; i < s.length(); i++) {

		if (s[i] != s[i - 1])cnt++;

	}
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 512
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<queue>
#include<list>
#include<stack>
//#include<unordered_map>
using namespace std;
#define ll long long 
#define dd cout<<endl
#define lll __int128
const int inf=1e9+7;
const int mod=1e9+7;

//const int maxn=

int main()
{
	ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);;
	
	string str;
	
	while(cin>>str)
	{
		int flag=0;
		for(int i=0;i<str.size();i++)
		{
			if(i&1)
			{
				if(str[i]=='R')
				{
					flag=1;
					break;
				}
			}
			else
			{
				if(str[i]=='L')
				{
					flag=1;
					break;
				}
			}
		}
		
		if(flag==0)
			cout<<"Yes"<<endl;
		else
			cout<<"No"<<endl;
	}
	
	return 0;
}

Measured memory_bytes: 256
function Main(input) {
  var tmp = input.trim().split('\n')
  var N = parseInt(tmp[0])
  var Xarr = tmp[1].split(' ')

  var Xsum = 0
  for (var i = 0; i < Xarr.length; i++) {
    Xsum += parseInt(Xarr[i])
  }

  var avg = Math.floor(Xsum / N)

  var tmp = []
  for (var j = avg - 25; j <= avg + 25; j++) {
    var sum = 0
    for (var i = 0; i < Xarr.length; i++) {
      sum = sum + Math.abs(Math.pow(j - parseInt(Xarr[i]), 2))
    }
    tmp.push(sum)
  }

  var result = Math.min.apply(null, tmp)

  console.log(result)
  return result
}

Main(require('fs').readFileSync('/dev/stdin', 'utf8'))


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

int used[1000];

int count(int a[], int x, int n){
  int cnt=0;
  for(int i=0; i<n; i++)
    if(a[i] == x) cnt++;
  return cnt;
}

int main(){
  pair<int, int> a[1000], b[1000];
  
  int n; cin >> n;
  for(int i=0; i<n; i++) cin >> a[i].first >> a[i].second;
  for(int i=0; i<n; i++) cin >> b[i].first >> b[i].second;
  
  sort(a,a+n);
  sort(b,b+n);

  int l = 0, num = 0;
  for(int r=0; r<n; r++){
    while(a[l].first < b[r].first && l<n) l++;
    int max_y = -1;
    int ind = -1;
    for (int j=0; j<l; j++){
      if(max_y < a[j].second && a[j].second < b[r].second && count(used,a[j].second,num) == 0){
        ind = j;
        max_y = a[j].second;
      }
    }
    if(ind>=0) {used[num]=a[ind].second; num++;}
  }
  cout << num << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

int main(void) {
	int i;
	long long int a, b, x;
	long long int ans;
	char buf[128], *ch;

	fgets(buf, sizeof(buf), stdin);
	ch = strtok(buf, " ");
	a = atoll(ch);
	ch = strtok(NULL, " ");
	b = atoll(ch);
	ch = strtok(NULL, " ");
	x = atoll(ch);

	ans = (b / x) + 1;
	if(a != 0) {
		ans -= ((a - 1) / x) + 1;
	}

	printf("%lld\n", ans);

	return 0;
}


Measured memory_bytes: 2132
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize ("-O3")

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(NULL); cout.tie(NULL);
    int n;
    cin>>n;
    vector<int> arr(n);
    for(int i=0; i<n; i++){
        cin>>arr[i];
    }
    vector<vector<long long>> dp(n+1,vector<long long>(n+1));
    for(int i=n-1; i>=0;i--){
        for(int j=i;j<n;j++){
            if(j==i)
                dp[i][j] = arr[i];
            else
                dp[i][j] = max(arr[i] - dp[i+1][j], arr[j]-dp[i][j-1]);
        }
    }
    cout<<dp[0][n-1]<<endl;
    return 0;
}

Measured memory_bytes: 70784
from collections import defaultdict
import sys,heapq,bisect,math,itertools,string,queue
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
AtoZ = [chr(i) for i in range(65,65+26)]
atoz = [chr(i) for i in range(97,97+26)]

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

a,b = inpl_str()
s = int(a + b)

if int(math.sqrt(s))**2 == s:
	print('Yes')
else:
	print('No')

Measured memory_bytes: 4080
#include <bits/stdc++.h>
#define sanyes ios_base::sync_with_stdio(0), cout.tie(0); cin.tie(0);
#define llong long long int
#define pb push_back
#define bpc __builtin_popcount
#define f first
#define s second

const llong mxn = 1e5 + 7;
const llong mod = 1e9 + 7;
const llong inf = 1e18 + 9;

using namespace std;

llong a[mxn], p[mxn], n, k, cnt = 0;

int main(){
    cin >> n;
    for (int i = 1; i <= n; i ++){
        cin >> a[i];
    }for (int i = 1; i <= n; i ++){
        if(a[i] % 2 != 0){
            cnt ++;
        }
    }if(cnt % 2 == 0){
        cout << "YES";
    }else{
        cout << "NO";
    }
    return 0;
}


Measured memory_bytes: 1024
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    n,m=map(int,input().split())
    C=[tuple(map(int,input().split())) for i in range(n)]
    C.sort()
    honsu=m
    cost=0
    for i,c in enumerate(C):
        cost+=c[0]*min(honsu,c[1])
        honsu-=c[1]
        if honsu<=0:
            break
    print(cost)
if __name__=='__main__':
    main()

Measured memory_bytes: 56364
#include<bits/stdc++.h>
using namespace std;
int num[3];
int main()
{
    string s;
    cin>>s;
    for(char c: s)
        num[int(c-'a')]++;
    if(abs(num[0]-num[1])<=1&&abs(num[0]-num[2])<=1&&abs(num[1]-num[2])<=1)
        puts("YES");
    else
        puts("NO");
    return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
string to_string(const string& s) {
	return '"' + s + '"';
}
string to_string(const bool b) {
	return (b ? "true" : "false");
}
string to_string(const char* s) {
	return to_string((string)s);
}
string to_string(const char c) {
	string s = "'";
	s += c;
	s += "'";
	return s;
}
template<class T, class U>
string to_string(const pair<T, U>& p) {
	string s = "(";
	s += to_string(p.first);
	s += ", ";
	s += to_string(p.second);
	s += ")";
	return s;
}
template<class T>
string to_string(const T& a) {
	bool first = true;
	string s = "{";
	for (const auto& x : a) {
		if(!first){
			s += ", ";
		}
		first = false;
		s += to_string(x);
	}
	s += "}";
	return s;
}
void debug_out() {cerr << '\n';}
template<class Head, class... Tail>
void debug_out(Head head, Tail... tail) {
	cerr << ' ' << to_string(head);
	debug_out(tail...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "] = ", debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif
using ll = long long;
using ld = long double;
const int mod = 1e9 + 7;
const int inf = 1e9 + 100;
const ll inf64 = 7e18l;
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout << fixed << setprecision(20);
	int n, D, A;
	cin >> n >> D >> A;
	vector<pair<int, int>> a(n);
	for (int i = 0; i < n; ++i) {
		cin >> a[i].first >> a[i].second;
	}
	sort(a.begin(), a.end());
	ll plus = 0;	
	vector<ll> minus(n + 1);
	ll answer = 0;
	for (int i = 0; i < n; ++i) {
		plus -= minus[i];
		if (plus >= a[i].second) {
			continue;
		}
		a[i].second -= plus;
		int moves = (a[i].second + A - 1) / A;
		answer += moves;
		plus += moves * A;
		pair<int, int> p = {a[i].first + 2 * D + 1, -1};
		int ind = lower_bound(a.begin(), a.end(), p) - a.begin();
		minus[ind] += moves * A;
	}
	cout << answer << '\n';
	return 0;
}


Measured memory_bytes: 3328
import math
n, h = map(int,input().split())
am = 0
b = [0 for i in range(n)]

for i in range(n):
    ai,bi = map(int,input().split())
    if ai > am:
        am = ai
    b[i] = bi

b.sort(reverse=True)
ans = n

for i,bi in enumerate(b):
    if bi > am:
        h -= bi
        if h <= 0:
            print(i+1)
            exit()
    else:
        ans = i
        break

ans += math.ceil(h/am)
print(ans)


Measured memory_bytes: 13232