akhauriyash/Code-Regression huggingface dataset:
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;
public final class Main{
    static ArrayList<Integer> l[];
    // static int z = 1;
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] max = new int[n];
        boolean[] visited = new boolean[n];
        Arrays.fill(visited, false);
        int m = sc.nextInt();
        l = new ArrayList[n];
        int[] dp = new int[n];
        for(int i=0; i<n; i++){
            l[i] = new ArrayList<Integer>();
        }
        for(int i=0; i<m; i++){
            l[sc.nextInt()-1].add(sc.nextInt()-1);
        }
        for(int i=0; i<n; i++){
            if(visited[i] == false){
                dfs(i,visited,l,dp);
            }
        }
        int ans = 0;
        for(int s : dp)
            ans = Math.max(ans,s);
        System.out.print(ans);
        sc.close();
    }

    static void dfs(int node, boolean[] visited,ArrayList<Integer>[] l,int[] dp){
        // System.out.println(node);
        visited[node] = true;
        for(int i=0; i<l[node].size(); i++){
            if(visited[l[node].get(i)] == false){
                dfs(l[node].get(i),visited,l,dp);
            }
            dp[node] = Math.max(dp[node], 1+dp[l[node].get(i)]);
        }
    }
}

Measured memory_bytes: 99928
#include <iostream>
#include <algorithm>
using namespace std;
int a, b, c, x, y, m, ans = 0;
int main() {
	cin >> a >> b >> c >> x >> y;

	if (c * 2 <= a + b) {
		ans += 2 * (m = min(x, y))*c;
		x -= m;
		y -= m;
	}

	ans += x * min(2 * c, a);
	ans += y * min(2 * c, b);
	
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define vi vector <int>
#define si set <int>
#define mii map <int,int>
#define pii pair <int,int>
#define endl "\n"
#define FOR(P,Q) for(int P=0;P<(Q);P++)
#define FORR(P,Q) for(int P=1;P<=(Q);P++)
#define rep(P,R,Q) for(int P=(R);P<=(Q);P++)
#define repb(P,R,Q) for(int P=(R);P>=(Q);P--)
#define pb push_back
#define eb emplace_back
#define bug(P) cerr<<P<<" "
#define NL cerr<<endl
#define D1(arr,a) rep(P,1,a) bug(arr[P]) 
#define F first
#define S second
typedef long long ll;
typedef long double ld;
using namespace std;


    
int32_t main()
{
    ios_base::sync_with_stdio(0);
    cout.tie(0);
    cin.tie(0);
    #ifndef ONLINE_JUDGE
    freopen("error.txt","w",stderr);
    #endif
    int tces=1;
    // cin>>tces;
    while(tces--){
        int x,k,d;
        cin>>x>>k>>d;
        x=abs(x);
        int a=x-k*d;
        int b=x/d;
        int ans=x-b*d;
        int c=k-b;
        if(c<0)
            cout<<x-k*d;
        else if(c%2)
            cout<<abs(ans-d);
        else
            cout<<ans;

    }
    
return 0;
}

Measured memory_bytes: 3652
import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.typecons;
import std.numeric, std.math;
import core.bitop;

string FMT_F = "%.10f";

static string[] s_rd;
T RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
string RDR()() { return readln.chomp; }
T[] ARR(T = long)(in string str, T fix = 0) { auto r = str.split.to!(T[]); r[] += fix; return r; }
size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
bool minimize(T)(ref T x, T y) { if (x > y) { x = y; return true; } else { return false; } }
bool maximize(T)(ref T x, T y) { if (x < y) { x = y; return true; } else { return false; } }

long mod = 10^^9 + 7;
void moda(ref long x, long y) { x = (x + y) % mod; }
void mods(ref long x, long y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(ref long x, long y) { x = (x * y) % mod; }

void main()
{
	auto N = RD;
	long cnt_t, cnt_a;
	foreach (i; 0..N)
	{
		auto T = RD;
		auto A = RD;
		long pt = 1, pa = 1;
		if (T < cnt_t)
			pt = cnt_t / T + (cnt_t % T != 0 ? 1 : 0);
		if (A < cnt_a)
			pa = cnt_a / A + (cnt_a % A != 0 ? 1 : 0);
		auto p  = max(pt, pa);
		cnt_t   = T * p;
		cnt_a   = A * p;
		//stderr.writeln(i, ":", cnt_t, " ", cnt_a);
	}
	writeln(cnt_t + cnt_a);
	stdout.flush();
	//readln();
}

Measured memory_bytes: 380
/*  ***  In The Name of God ... ***  */ 
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;

#define int long long
#define all(v) v.begin() , v.end()
#define pb push_back
#define endl '\n' 
template<typename T> inline bool smin(T &a, const T &b){ return b < a ? a = b,1:0;}
template<typename T> inline bool smax(T &a, const T &b){ return a < b ? a = b,1:0;}

string s; 

int32_t main()
{
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	cin >> s ;
	s [ 3 ] = '8' ;
	cout << s << endl ;return 0 ; 
}


Measured memory_bytes: 764
#!/usr/bin/env python3
import sys


def solve(A: int, B: int, C: int, D: int):
    print(max(0, min(B, D) - max(A, C)))
    return


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    C = int(next(tokens))  # type: int
    D = int(next(tokens))  # type: int
    solve(A, B, C, D)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		
		int x = sc.nextInt();
		int n = sc.nextInt();
		int[] p = new int[n];
		for(int i = 0; i < n; i++) {
			p[i] = sc.nextInt();
		}
		
		int cnt = 0;
		int y = 0;
		int ans = 0;
		solve: while(true) {
			if(cnt % 2 == 0) {
				y = x - cnt/2;
			}else {
				y = x + cnt/2;
			}
			if(n == 0) {
				ans = x;
				break;
			}
			for(int i = 0; i < n; i++) {
				if(y == p[i]) {
					break;
				}else if(i == n -1) {
					ans = y;
					break solve;
				}
			}
		cnt++;
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 27232
using System;

public class Test
{
	static public void Main( )
	{
		String[] line = Console.ReadLine().Split( ' ' );
		int a = int.Parse( line[0] );
		int b = int.Parse( line[1] );
		int c = int.Parse( line[2] );
		if( a < b && b < c ) {
			Console.WriteLine( "Yes" );	
		} else {
			Console.WriteLine( "No" );
		}
	}
}

Measured memory_bytes: 5292
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>	
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pll;
typedef unsigned long long ull;

const int MOD = 1000000007 ; //   1000000009 , 1000000023 ,998244353
const ll INF = ll(1e18);
const ld PI = 4*atan((ld)1);

using namespace __gnu_pbds;
template<typename T, class cmp = std::less<T>>
using Tree = tree<T, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;

int main() {
#ifdef AVI  
  freopen("input.txt" , "r" , stdin);
#endif
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  
  ll n;
  cin >> n;
  vector<ll>ar(n);
  map<ll,ll>mp;
  for(auto &x:ar)cin >> x , mp[x]++;
  ll c = 0;
  for(auto &x:mp)c += x.second*(x.second-1)/2;
  for(auto &x:ar){
    ll z = c;
    z -= mp[x]*(mp[x]-1)/2;
    z += (mp[x]-1)*(mp[x]-2)/2;
    cout << z << '\n'; 
  } 
}

Measured memory_bytes: 11136
package main

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

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

func main() {
	/*/TODO:!!!!!!!テスト用!!!!!!!!!
	sc = bufio.NewScanner(strings.NewReader(`

										`))
	//TODO:!!!!!!!テスト用!!!!!!!!!*/

	buf := make([]byte, 1024*1024)
	sc.Buffer(buf, bufio.MaxScanTokenSize)
	sc.Split(bufio.ScanWords)
	defer out.Flush() // !!!!caution!!!! you must use Fprint(out, ) not Print()
	/* --- code --- */
	//fmt.Fprintln(out, "[DEBUG]", time.Now())

	n := nextInt()
	m := nextInt()
	k := nextInt()
	a := nextInts(n)
	b := nextInts(m)

	atime := 0
	ai := 0

	bi := 0
	btime := 0

	for i := 0; i < n; i++ {
		if atime+a[i] <= k {
			atime += a[i]
			ai = i + 1
		} else {
			break
		}
	}

	ans := ai

	for i := ai - 1; i >= -1; i-- {
		for j := bi; j < m; j++ {
			if atime+btime+b[j] <= k {
				btime += b[j]
				bi = j + 1
			} else {
				break
			}
		}
		ans = maxInt(ans, ai+bi)
		/*
			fmt.Fprintln(out, "[DEBUG]", atime, btime)
			fmt.Fprintln(out, "[DEBUG]", ai, bi)
			fmt.Fprintln(out, "[DEBUG]", ans)
			//*/

		if i >= 0 {
			atime -= a[i]
			ai--
		}
	}

	//fmt.Fprintln(out, "[DEBUG]", a)
	fmt.Fprintln(out, ans)

}

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

// -*-*-*-*-*-*-*-*-
// * I/O utilities *
// -*-*-*-*-*-*-*-*-

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

func nextInt() int {
	a, _ := strconv.Atoi(next())
	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
}

func chars(s string) []string {
	ret := make([]string, len([]rune(s)))
	for i, v := range []rune(s) {
		ret[i] = string(v)
	}
	return ret
}

func printArray(a []int) {
	for i := 0; i < len(a); i++ {
		if i >= 1 {
			fmt.Fprint(out, " ")
		}
		fmt.Fprint(out, a[i])
	}
	fmt.Fprintln(out)
}

func absInt(x int) int {
	return int(math.Abs(float64(x)))
}
func minInt(x, y int) int {
	if x < y {
		return x
	}
	return y
}
func maxInt(x, y int) int {
	if x > y {
		return x
	}
	return y
}
func log10(x int) float64 {
	return math.Log10(float64(x))
}

// 挿入ソート配列
type slist struct {
	l []int
}

func makeSlist() slist {
	return slist{[]int{}}
}

func (s *slist) add(a int) {
	pos := sort.Search(len(s.l), func(i int) bool { return s.l[i] >= a })
	if pos < len(s.l) {
		s.l = append(s.l[:pos+1], s.l[pos:]...)
		s.l[pos] = a
	} else {
		s.l = append(s.l, a)
	}
}
func (s slist) contains(a int) bool {
	pos := sort.Search(len(s.l), func(i int) bool { return s.l[i] >= a })
	return pos < len(s.l) && s.l[pos] == a
}


Measured memory_bytes: 8856
#include <stdio.h>
int main(void){
    int a,b;
    scanf("%d %d",&a,&b);
    if(a>b){printf("a > b\n");return 0;}
    if(a<b){printf("a < b\n");return 0;}
    printf("a == b\n");
    return 0;
}



Measured memory_bytes: 2100
#include "bits/stdc++.h"
using namespace std ;
#define ll            long long
#define nl            "\n"
#define PB            push_back
#define fi            first
#define se            second
#define _SAD()        ios::sync_with_stdio(0),cin.tie(0), cout.tie(0);
#define SZ(s)         s.size()
#define SRT(x,y)      sort(x,x+y)
#define REV(a,b)      reverse(a,a+b)
#define VSRT(x)       sort(x.begin(),x.end())
#define VREV(x)       reverse(x.begin(),x.end())
int main()
{
    _SAD()
    string s;
    cin>>s;
    if(SZ(s)==1)
    {
        cout<<0<<nl;
    }
    else
    {
        int cnt=0;
        if(s[0]=='0')
        {
            for(int i=1;i<SZ(s);i++)
            {
                if(i%2!=0&&s[i]=='0')
                {
                    cnt++;
                }
                if(i%2==0&&s[i]=='1')
                {
                    cnt++;
                }
            }
        }
        else
        {
            for(int i=1;i<SZ(s);i++)
            {
                if(i%2!=0&&s[i]=='1')
                {
                    cnt++;
                }
                if(i%2==0&&s[i]=='0')
                {
                    cnt++;
                }
            }
        }
        cout<<cnt<<nl;
    }
    return 0;
}


Measured memory_bytes: 512
import numpy as np

D = int(input())
c = np.array(list(map(int, input().split())))
s = [list(map(int, input().split())) for _ in range(D)]
last_d = np.array([0] * len(c))

ans = 0
for i in range(D):
    cc = c * (last_d + i + 1)
    sum_c = sum(cc)
    most = 0
    index = 0
    for j in range(len(c)):
      tmp = s[i][j] + cc[j]
      if most < tmp:
        index = j
        most = tmp
    # max_c = max(cc)
    # index = np.argmax(cc)
    print(index + 1)
    last_d[index] = -(i + 1)
    ans += s[i][index]
    cc[index] = 0
    for j in cc:
        ans -= j

Measured memory_bytes: 27636
#include <bits/stdc++.h>
using namespace std;
const int maxN=200005;int k,n,a[maxN];
int main() {ios::sync_with_stdio(0),cin.tie(0),cin>>k>>n;
	for (int i=1;i<=n;i++) cin>>a[i];sort(a+1,a+n+1);
	int ans=0;for (int i=2;i<=n;i++) ans=max(ans,a[i]-a[i-1]);
	ans=max(ans,a[1]-a[n]+k),cout<<k-ans<<'\n';return 0;
}

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

int read();

int n, k;
int p[200005], q[200005];
int bs[200005], rt[200005];
void init(int *a) {
    for (int i = 1; i <= n; ++i) a[i] = i;
}

int tmp[200005];
void pm(int *s, int *p) {
    for (int i = 1; i <= n; ++i) tmp[i] = s[p[i]];
    memcpy(s + 1, tmp + 1, n << 2);
}
void ip(int *s, int *p) {
    for (int i = 1; i <= n; ++i) tmp[p[i]] = s[i];
    memcpy(s + 1, tmp + 1, n << 2);
}

int f[10][200005];
void fsp(int p) {
    while (p) (p & 1) ? pm(rt, bs) : void(), pm(bs, bs), p >>= 1;
}

void prt(int *p) {
    for (int i = 1; i <= n; ++i) printf("%d ", p[i]);
    puts("");
}
int main() {
    n = read(), k = read(), init(bs), init(rt);
    for (int i = 1; i <= n; ++i) p[i] = read();
    for (int i = 1; i <= n; ++i) q[i] = read();
    pm(bs, q), ip(bs, p), ip(bs, q), pm(bs, p), fsp((k - 1) / 6);

    memcpy(f[1] + 1, rt + 1, n << 2), memcpy(f[2] + 1, rt + 1, n << 2);
    int tk = (k - 1) % 6 + 1;
    pm(f[1], p), ip(f[1], rt), pm(f[2], q), ip(f[2], rt);

    if (tk <= 2) return prt(f[tk]), 0;
    for (int i = 3; i <= tk; ++i)
        memcpy(f[i] + 1, f[i - 1] + 1, n << 2), ip(f[i], f[i - 2]);
    return prt(f[tk]), 0;
}

int read() {
    int x = 0, f = 1;
    char c = getchar();
    while (c < '0' || c > '9') f = (c == '-') ? -1 : f, c = getchar();
    while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
    return x * f;
}

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

int main() {
    int N;
    cin >> N;
    vector<int64_t> contain(3);

    contain.at(0) = 2;
    contain.at(1) = 1;
    contain.at(2) = 1;
    for(int i=0; i<N-1; i++){
        contain.at(2) = contain.at(1)+contain.at(0);
        contain.at(0) = contain.at(1);
        contain.at(1) = contain.at(2);
    }

    cout << contain.at(2) << endl;
    return 0;

}


Measured memory_bytes: 3576
using System;
using System.Linq;

class Pg
{
    static void Main()
    {
        var line = int.Parse(Console.ReadLine());
        while (line-- > 0)
        {
            var n = Console.ReadLine().ToCharArray().OrderBy(x => x).ToArray();
            Console.WriteLine(Math.Abs(int.Parse(string.Join("", n)) - int.Parse(string.Join("", n.Reverse().ToArray()))));
        }
    }
}


Measured memory_bytes: 18284
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll inf = 100100100100100;
const ll mod = 1000000007;
typedef pair<int,int> P;
#define fi first
#define se second
#define pb push_back
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, k;
    cin >> n >> k;
    int mx = (n-1)*(n-2)/2;//最短経路が２となるてんの選び方の通り
    if (mx<k){
        cout << -1 << endl;
        return 0;
    }
    vector<P> ans;
    for (int i = 0; i < n-1; i++){ //スターグラフを作る
        ans.pb(P(i+1, n));
    }
    int add = mx-k;//編を増やすとそれに応じて最短経路が２となるものの数が減る
    vector<P> edge;
    for (int i = 0; i < n - 1; i++){
        for (int j = 0; j < i; j++) {
            edge.pb(P(i+1,j+1));
        }
    }
    for (int i = 0; i < add; i++) {//kになるように最短経路を減らす
        ans.pb(edge[i]);
    }
    cout << (int)ans.size()<< endl;
    for (int i = 0; i <(int)ans.size(); i++) {
        cout << ans[i].fi <<" "<< ans[i].se << endl;
    }
}

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

int main() {
  ll q, h, s, d, n;
  cin >> q >> h >> s >> d >> n;
  d = min({8*q, 4*h, 2*s, d});
  s = min({4*q, 2*h, s});
  ll c = d * (n / 2) + s * (n % 2);
  cout << c << endl;
  return 0;
}

Measured memory_bytes: 3596
#include <stdio.h>

int main()
{
    int hotel[4][3][10],i,j,k,test,b,f,r,v;
    for(i=0;i<4;i++){
        for(j=0;j<3;j++){
            for(k=0;k<10;k++){
                hotel[i][j][k]=0;
            }
        }
    }
    scanf("%d",&test);
    for(i=0;i<test;i++){
        scanf("%d %d %d %d",&b,&f,&r,&v);
        hotel[b-1][f-1][r-1]+=v;
    }
    for(j=0;j<3;j++){
            for(k=0;k<10;k++){
                printf(" %d",hotel[0][j][k]);
            }
            printf("\n");
        }
    for(i=1;i<4;i++){
        printf("####################\n");
        for(j=0;j<3;j++){
            for(k=0;k<10;k++){
                printf(" %d",hotel[i][j][k]);
            }
            printf("\n");
        }
    }
    return 0;
}



Measured memory_bytes: 2044
<?php

fscanf(STDIN, '%d', $N);
$list = [];
for ($i = 1; $i <= $N; ++$i) {
    $list[] = explode(' ', trim(fgets(STDIN)));
}

$sum = 0;

foreach ($list as $value) {
    if ($value[1] === 'BTC') {
        $sum += 380000 * (float)$value[0];
    } else {
        $sum += (int)$value[0];
    }
}

echo $sum;


Measured memory_bytes: 4728
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;

vector<int> pre, low;
Graph g;
int fst = 0;
int ans = 0;

int dfs(int now, int from) {
  pre[now] = fst;
  low[now] = pre[now];
  fst++;
  for(auto p : g[now]) {
    if(pre[p] == -1) {
      low[now] = min(low[now], dfs(p, now));
      if(low[p] == pre[p]) {
        ans++;
      }
    } else {
      if(p == from) {
        continue;
      }
      low[now] = min(low[now], low[p]);
    }
  }
  return low[now];
}

int main() {
  int n, m;
  cin >> n >> m;
  g.resize(n);
  pre.resize(n);
  low.resize(n);
  for(int i = 0; i < n; i++) {
    pre[i] = -1;
    low[i] = 1001001001;
  }
  for(int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  dfs(0, 0);

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

Measured memory_bytes: 3580
#include<bits/stdc++.h>
using namespace std;
#define FASTIO ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
#define ll long long
#define pb push_back
#define mp make_pair
#define pii pair<ll,ll>
#define F first
#define S second
#define ld long double
#define rep(i,a,n) for (ll i= (a) ; i < (n); ++i)
#define vi vector<ll>
#define all(v) (v).begin(),(v).end()
#define M_PI 3.14159265358979323846
const ll MOD = 1e9 + 7;
const ll INF = 1e18L + 5;

void solve() {
	int n;
	cin >> n;
	cout << n + n*n + n*n*n << endl;
}


int main() {

	int t = 1;

	//cin >> t;
	ll k = 1;
	while (t--) {
		//cout << "Case #" << k++ << ": ";
		solve();
	}
	return 0;
}


Measured memory_bytes: 3580
#include <stdio.h>

int main()
{
    long N, i, sum = 0;
    scanf("%ld", &N);
    for (i = 1; i <= N; i++)
    {
        if (i % 3 != 0 && i % 5 != 0)
        {
            sum = sum + i;
        }
    }
    printf("%ld\n", sum);

    return 0;
}

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

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


	if (S[0]==S[1]) {
		cout << "Bad" << endl;
    }
	else if (S[1]==S[2]) {
		cout << "Bad" << endl;
    }
  	else if (S[2]==S[3]) {
		cout << "Bad" << endl;
	} else {
		cout << "Good" << endl;
	}

	return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
    long long a, b;
    string s;
    cin >> a >> s;
    b = (s[0]-'0')*100;
    if (s.length() > 2)
        b += (s[2]-'0')*10;
    if (s.length() > 3)
        b += (s[3]-'0');
    cout << a * b / 100 << endl;

    return 0;
}

Measured memory_bytes: 3632
/* Tuan Kkura */
#include <bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
#define base 31
#define MOD 1e9+7
#define FOR(i, a, b) for(int i = a; i <= b; i++)
#define FORs(i, a, b) for(int i = a; i >= b; i--)
#define REP(i, a, b) for(int i = a; i < b; i++)
#define __FOR(i, a, b, k) for(int i = a; i <= b; i+= k)
#define __REP(i, a, b, k) for(int i = a; i < b; i+= k)
#define pb push_back
#define _io ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
using namespace std;

typedef pair <int, int> ii;
typedef vector <ii> vii;
#define fi first
#define se second
#define mp make_pair
#define PROB "text"
#define MAXN 200005

int main()
{
    _io
    int n; cin >> n;
    cout << n*n*n << '\n';
}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <iostream>
#include <deque>
#include <vector>
#include <string>
#include <utility>
#include <queue>
#include <unordered_map>
#include <unordered_set>

using namespace std;

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

	unordered_map<int, int> order;

	for (int i = 0; i < n; ++i)
	{
		int a;
		cin >> a;
		order.emplace(make_pair(a, i + 1));
	}

	string res;
	for (int i = 1; i <= n; ++i)
	{
		res += ' ' + to_string(order.at(i));
	}

	cout << res.substr(1) << endl;
}

Measured memory_bytes: 6052
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<map>
using namespace std;
const int N = 100010;
int n, a[N], b[N], aq[N], bq[N], fa[N], ans;
map<int, int> pos;

int Find(int u)
{
	if (fa[u] == u) return u;
	return fa[u] = Find(fa[u]);
}

void Merge(int x, int y)
{
	if (Find(x) == Find(y)) return;
	fa[Find(x)] = Find(y);
	ans--;
}

int main()
{
	scanf("%d", &n);
	a[n+1] = 0;
	for (int i = 1; i <= n; i++){
		scanf("%d", &a[i]);
		aq[i] = a[i];
		a[n+1] ^= a[i];
	}
	aq[n+1] = a[n+1];
	sort(aq+1, aq+n+2);
	for (int i = 1; i <= n; i++){
		scanf("%d", &b[i]);
		bq[i] = b[i];
		b[n+1] ^= b[i];
	}
	bq[n+1] = b[n+1];
	sort(bq+1, bq+n+2);
	for (int i = 1; i <= n+1; i++)
		if (aq[i] != bq[i]){
			printf("-1");
			return 0;
		}
	ans = n*2;
	for (int i = 1; i <= n+1; i++) fa[i] = i;
	for (int i = 1; i <= n+1; i++){
		if (a[i] == b[i] && i != n+1)
			ans -= 2;
		else{
			if (pos.find(a[i]) != pos.end())
				Merge(pos[a[i]], i);
			else pos[a[i]] = i;
			if (pos.find(b[i]) != pos.end())
				Merge(pos[b[i]], i);
			else pos[b[i]] = i;
		}
	}
	printf("%d", ans);
	return 0;
}

Measured memory_bytes: 8448
#include<iostream>
using namespace std;
int main(){
    int S, h, m, s;
    cin >> S;
    h = S/3600;
    m = S % 3600 / 60;
    s = S % 3600 % 60;
    cout << h << ":" << m << ":" << s << endl;
    return 0;
}


Measured memory_bytes: 3112
#include <iostream>
#include <numeric>
#include <stack>
#include <vector>
#include <algorithm>

int main() {
  char c;
  std::stack<int> s;
  std::stack<std::pair<int, int>> area;

  int i = 0;
  while (std::cin >> c) {
    ++i;
    if (c == '\\') {
      s.push(i);
    }
    if (c == '/') {
      if (s.empty())
        continue;
      int t = s.top();
      s.pop();
      int a = i - t;
      while (!area.empty() && area.top().first > t) {
        a += area.top().second;
        area.pop();
      }
      area.push({i, a});
    }
  }

  std::vector<int> res;
  while (!area.empty()) {
    res.push_back(area.top().second);
    area.pop();
  }
  std::reverse(res.begin(), res.end());
  std::cout << std::accumulate(res.begin(), res.end(), 0) << std::endl;
  std::cout << res.size();
  if (res.size())
    std::cout << " ";
  for (auto it = res.begin(); it != res.end(); ++it) {
    if (it != res.begin())
      std::cout << " ";
    std::cout << *it;
  }
  std::cout << std::endl;
}



Measured memory_bytes: 3224
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <vector>
#include <cmath>
using namespace std;

int main()
{
    double A[1000];
    double n, m, sum;
    while (cin >> n && n != 0)
    {
        m = 0;
        sum = 0;
        for (int i = 0; i != n; ++i)
        {
            cin >> A[i];
            m += A[i];
        }
        m /= n;
        for (int i = 0; i != n; ++i)
        {
            sum += (A[i] - m) *  (A[i] - m);
        }
        sum = sqrt(sum / n);
        cout << fixed << setprecision(8) << sum << endl;
    }
    return 0;
}


Measured memory_bytes: 3240
#include<cstdio>
int main(){int n,i,j,s,m,a[5000];while(scanf("%d",&n)&&n){for(i=0;i<n;i++)scanf("%d",&a[i]);m=-500000001;for(i=0;i<n;i++,s=0)for(j=i;j<n;)if((s+=a[j++])>m)m=s;printf("%d\n",m);}}

Measured memory_bytes: 0
N = int(input())
if N == 1 or N == 2:
    print(N)
else:
    for i in range(N+1):
        if i*(i+1)//2 > N:
            num = i-1
            break
    ans = []
    for i in range(num):
        ans.append(i+1)
    if num*(num+1)//2 != N:
        cnt = N-num*(num+1)//2
        ans.remove(num+1-cnt)
        ans.append(num+1)
    for x in ans:
        print(x)

Measured memory_bytes: 3572
import sys
sys.setrecursionlimit(100000)
input = sys.stdin.readlines

lines = input()

n, W = list(map(int, lines[0].split()))

items = [None] * (n+1)

T = [[0] * (W+1) for i in range(n+1)]
G = [[0] * (W+1) for i in range(n+1)]


for i in range(n):
    items[i+1] = list(map(int, lines[i+1].split()))

for i in range(1, n+1):
    for w in range(1, W+1):
        k = items[i][1]
        if k > w:
            G[i][w] = "top"
            T[i][w] = T[i-1][w]
        else:
            a = T[i-1][w - k] + items[i][0]
            b = T[i-1][w]
            if a > b:
                G[i][w] = "diagonal"
                T[i][w] = a
            else:
                G[i][w] = "top"
                T[i][w] = b

print(T[n][W])




Measured memory_bytes: 33452
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<array>
#include<map>
#include<iomanip>
#include<assert.h>
#include<bitset>
#include<stack>
#include<memory>
using namespace std;
using namespace std::chrono;
typedef long long int llint;
typedef double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
/*cout<<fixed<<setprecision(20);cin.tie(0);ios::sync_with_stdio(false);*/
const llint mod=998244353;
const llint big=2.19e15+1;
const long double pai=3.141592653589793238462643383279502884197;
const long double eps=1e-15;
template <class T,class U>bool mineq(T& a,U b){if(a>b){a=b;return true;}return false;}
template <class T,class U>bool maxeq(T& a,U b){if(a<b){a=b;return true;}return false;}
llint gcd(llint a,llint b){if(a%b==0){return b;}else return gcd(b,a%b);}
llint lcm(llint a,llint b){if(a==0){return b;}return a/gcd(a,b)*b;}
template<class T> void SO(T& ve){sort(ve.begin(),ve.end());}
template<class T> void REV(T& ve){reverse(ve.begin(),ve.end());}
template<class T>llint LBI(vector<T>&ar,T in){return lower_bound(ar.begin(),ar.end(),in)-ar.begin();}
template<class T>llint UBI(vector<T>&ar,T in){return upper_bound(ar.begin(),ar.end(),in)-ar.begin();}
int main(void){
	int rule[128]={0};
	int ban[19]={0};
	
	int bas[7][7]={
		{7,12,3,8,13,4,9},
		{12,16,8,13,17,9,14},
		{3,8,0,4,9,1,5},
		{8,13,4,9,14,5,10},
		{13,17,9,14,18,10,15},
		{4,9,1,5,10,2,6},
		{9,14,5,10,15,6,11},
	};
	while(-1){
		string s;cin>>s;
		if(s=="#"){return 0;}
		int i,j,k,bi;
		for(i=0;i<128;i++){rule[i]=s[i]-'0';}
		bool ok=true;
		for(bi=0;bi<(1<<19);bi++){
			for(i=0;i<19;i++){if(bi&(1<<i)){ban[i]=1;}else{ban[i]=0;}}
			int za[7];
			for(j=0;j<7;j++){
				int now=0;
				for(k=0;k<7;k++){
					if(ban[bas[j][k]]){now+=(1<<k);}
				}
				za[j]=rule[now];
			}
			for(j=0;j<7;j++){ban[bas[3][j]]=za[j];}
			int sai=0;
			for(k=0;k<7;k++){
				if(ban[bas[3][k]]){sai+=(1<<k);}
			}
			if(rule[sai]!=ban[9]){ok=false;break;}
		}
		cout<<(ok?"yes":"no")<<endl;
	}
	return 0;
}


Measured memory_bytes: 3036
import java.util.Scanner;

public class Main {
    public static void main(String args[]){
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int l = in.nextInt();
        if (n <= -l) {
            System.out.println((l + (l + n - 2)) * (n - 1) / 2);
        }
        else {
            if (l < 0)
                System.out.println(-l * (l - 1) / 2 + (n + l) * (n + l - 1) / 2);
            else
                System.out.println((n - 1) * (l + n + l) / 2);
        }
    }
}


Measured memory_bytes: 21844
A,B = [int(i) for i in input().split()]
S = input()
try:
    if len(S) != A + B + 1:
        int("a")
    int(S[:A] + S[A+1:])
    if S[A] != "-":
        int("b")
    print("Yes")
except:
    print("No")

Measured memory_bytes: 9096
abc = input().split(' ')
nums = []
nums.append(int(abc[0] + abc[1]) + int(abc[2]))
nums.append(int(abc[1] + abc[0]) + int(abc[2]))
nums.append(int(abc[0]) + int(abc[1] + abc[2]))
nums.append(int(abc[0]) + int(abc[2] + abc[1]))
nums.append(int(abc[0] + abc[2]) + int(abc[1]))
nums.append(int(abc[2] + abc[0]) + int(abc[1]))
print(max(nums))

Measured memory_bytes: 3064
from fractions import gcd
from functools import reduce
N = int(input())
T = [int(input()) for _ in range(N)]
ans = 0
def lcm_base(x, y):
    return (x * y) // gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

print(lcm(*T))

Measured memory_bytes: 5460
def main():
    s = int(input())

    an = s
    lst = [an]
    tmp = 10000001

    i = 1
    while True:
        i+=1
        if an%2  == 0:
            an = an/2
            tmp = an
            if tmp in lst:
                print(i)
                exit()

            lst.append(an)

        else:
            an = an*3+1
            tmp = an
            if tmp in lst:
                print(i)
                exit()

            lst.append(an)


if __name__ == "__main__":
        main()


Measured memory_bytes: 3064
#include <iostream>
#include <fstream>

using namespace std;
struct interval{int l,r;} v[100005];
int n,i,j,fr[100005],m,ok;

int main()
{
    cin>>n>>m;
    for(i=1;i<=m;i++)
    {
        cin>>v[i].l>>v[i].r;
        fr[v[i].l]++;
        fr[v[i].r]++;
    }
    ok=1;
    for(i=1;i<=n;i++) if(fr[i]%2==1) ok=0;
    if(ok) cout<<"YES\n";
    else cout<<"NO\n";
    return 0;
}


Measured memory_bytes: 1408
import sys
sys.setrecursionlimit(10000000)
MOD = 10 ** 9 + 7
INF = 10 ** 15

def main():
    N = int(input())
    A = list(map(int,input().split()))
    can_root = [0] * (N + 1)
    can_root[0] = 1
    if N > 0 and A[0] >= 1:
        print(-1)
        return 
    if N == 0 and A[0] == 1:
        print(1)
        return
    if N == 0 and A[0] >= 2:
        print(-1)
        return

    for i in range(1,N + 1):
        can_root[i] = 2*can_root[i - 1] - A[i]
        if i < N:
            if can_root[i] <= 0:
                print(-1)
                return 
        if i == N:
            if can_root[i] < 0:
                print(-1)
                return
    
    ans = A[-1]
    now = A[-1]
    for i in range(N - 1,-1,-1):
        if now <= can_root[i]:
            now += A[i]
        else:
            now = can_root[i] + A[i]
        ans += now
    print(ans)
if __name__ == '__main__':
    main()


Measured memory_bytes: 668432
a,b=map(int,input().split())

#素因数分解した結果を2次元配列にして返す
def prime_factorize(n):
    primelist=[]
    a=2
    while a*a<=n:
        if n%a!=0:
            a+=1
            continue
        ex=0
        while n%a==0:
            ex+=1
            n=n//a
        primelist.append([a,ex])
        a+=1
    if n!=1:
        primelist.append([n,1])
    return primelist

import fractions
g=fractions.gcd(a,b)

pfs=prime_factorize(g)

print(1+len(pfs))

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

using namespace std;

#define int long long
#define x first
#define y second
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define forn(i,n) for(int i=0;i<(int)n;i++)
#define pb push_back
#define sz(a) (int)(a.size())

typedef long long ll;typedef vector<int> vi;
typedef pair<int,int> ii;typedef vector<ii> vii;
typedef vector<vi> vvi;

signed main(){
	IOS
	int a;cin>>a;
	cout<<a+a*a+a*a*a;
}

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

#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define intll int long long
const int INF = 1e9;
const int MOD = 1e9 + 7;

int main() {
  string s ;
  deque <char>  data ;
  int n ;
  cin >> s >> n ;
  rep(i,s.size()) data.push_back(s.at(i)) ;
  int now = 0 ;
  
  rep(i,n){
    int T ;
    cin >> T ;
    if(T == 1) now ++ ;
    else{
      int F ;
      char c ;
      cin >> F >> c ;
      if(F == 1){ 
        if(now%2 != 0) data.push_back (c) ;
        else           data.push_front(c) ;
      }
      else {
        if(now%2 != 1) data.push_back (c) ;
        else           data.push_front(c) ;
    }
  }
    
}
 
  if(now % 2 != 1)   rep(i,data.size()) cout << data.at(i) ;
  else               rep(i,data.size()) cout << data.at(data.size() - i-1) ;
  
}


Measured memory_bytes: 4028
H,W = map(int,input().split())

D = {}

for i in range(H) :
    for s in input() :
        if s not in D :
            D[s] = 1
        else :
            D[s] += 1
cnt4 = 0
cnt2 = 0
for v in D.values() :
    d,r = divmod(v, 4)
    cnt4 += d
    cnt2 += 1 if r >= 2 else 0

cnt4 -= (W//2) * (H//2)

if cnt4 < 0 :
    ans = "No"
else :
    cnt2 += cnt4*2
    if H % 2 == 0 and W % 2 == 0 :
        ans = "Yes"
    elif H % 2 == 1 and W % 2 == 0 :
        if cnt2 >= W//2 :
            ans = "Yes"
        else :
            ans = "No"
    elif H % 2 == 0 and W % 2 == 1 :
        if cnt2 >= H//2 :
            ans = "Yes"
        else :
            ans = "No"
    else :
        if cnt2 >= H//2 + W//2 :
            ans = "Yes"
        else :
            ans = "No"
print(ans)


Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int x = sc.nextInt();

		if (a * a * b / 2 >= x) {
			double y = (double) 2 * x / (double) (a * b * b);
			double ans = Math.atan(y);
			ans = 180 * ans / Math.PI;
			ans = 90 - ans;
			System.out.println(ans);
		} else {

			double y = (double) 2 * x / (double) (a * a);
			y = 2 * (double) b - y;

			y = y / (double) a;
			double ans = Math.atan(y);
			ans = 180 * ans / Math.PI;

			System.out.println(ans);
		}
	}
}

Measured memory_bytes: 23764
import java.util.Scanner;
public class Main{
  public static void main(String args[]){
   Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b[] = new int[a];
    int c = 0;
    for(int i = 0;i < b.length;i++){
      b[i] = sc.nextInt();
    }
    for(int x = 0;x < b.length;x++){
      for(int y = x+1;y < b.length;y++){
        c += b[x]*b[y];
      }
    }
    System.out.println(c);
  }
}

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

#define _GLIBCXX_DEBUG
#define all(v) (v).begin(),(v).end()

using namespace std;

using ll=long long;
using pii=pair<int, int>;
using vi=vector<int>;
using vii=vector<vector<int>>;

const ll LINF=1LL<<60;
const int INF=1<<29;
const ll MOD=1e9+7;


int main(){
    int N; cin >> N;
    vi A(N), B(N), C(N-1);
    ll sum=0;
    for(int i=0; i<N; i++){
        cin >> A[i];
        A[i]--;
    }
    for(int i=0; i<N; i++){
        cin >> B[i];
    }
    for(int i=0; i<N-1; i++){
        cin >> C[i];
    }
    for(int i=0; i<N; i++){
        sum+=B[A[i]];
        if(i != 0 && A[i]-A[i-1] == 1){
            sum+=C[A[i-1]];
        }
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 3616
#include <stdio.h>
#include <string.h>
#define maxn 200010
char s[maxn],t[maxn];
int main(){
	int i,n,cnt=0;
	scanf("%s%s",s,t);
	n=strlen(s);
	for(i=0;i<n;i++)
		if(s[i]!=t[i])cnt++;
	printf("%d\n",cnt);
	return 0;
}

Measured memory_bytes: 3544
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#define pb push_back
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define debug(x) cerr << #x << " : " << x << '\n'

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;
typedef string str;
typedef pair<ll, ll> pll;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

const ll Mod = 1000000007LL;
const int Maxn = 2e5 + 10;
const ll Inf = 2242545357980376863LL;
const ll Log = 30;

pll s[Maxn];
ll ps[Maxn], sf[Maxn];
vector<ll> l, r;
int main(){
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	ll n;
	cin >> n;
	ll ans = 0;
	for(int i = 0; i < n; i++) cin >> s[i].F >> s[i].S;
	for(int i = 0; i < n; i++) l.pb(s[i].F), r.pb(s[i].S);
	sort(all(l));
	sort(all(r));
	sort(s, s + n);
	ll L = 1;
	ll R = 1e9;
	for(int i = 0; i < n; i++){
		R = min(R, s[i].S);
		L = max(L, s[i].F);
		ps[i] = max(0LL, R-L + 1);
	}
	L = 1;
	R = 1e9;
	for(int i = n-1; i >= 0; i--){
		R = min(R, s[i].S);
		L = max(L, s[i].F);
		sf[i] = max(0LL, R-L + 1);
	}
	for(int i = 0; i + 1 < n; i++){
		ans = max(ans, sf[i + 1] + ps[i]);
	}
	//cerr << ans << '\n';
	for(int i = 0; i < n; i++){
		ans = max(ans, (s[i].S - s[i].F + 1) + max(0LL, (s[i].S == r[0] ? r[1] : r[0]) - (s[i].F == l[n - 1] ? l[n-2] : l[n - 1]) + 1LL  )  );
	}
	
	cout << ans << '\n';
	return 0;
}



Measured memory_bytes: 7404
#include <bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a), i##_max = (b); i < i##_max; ++i)
#define RFOR(i, a, b) for (int i = (b)-1, i##_min = (a); i >= i##_min; --i)
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define RREP(i, n) for (int i = (n)-1; i >= 0; --i)
#define ALL(obj) (obj).begin(), (obj).end()

using namespace std;
using vi = vector<int>;
using vd = vector<double>;
using pi = pair<int, int>;
using pd = pair<double, double>;
using i64 = int64_t;
using u64 = uint64_t;

constexpr int INF = 1 << 30;
constexpr int MOD = 1000000007;
constexpr int NIL = -1;

template <typename T>
void print(vector<T> &v) {
  REP(i, v.size()) {
    if (i) cout << " ";
    cout << v[i];
  }
  cout << endl;
}

class Node {
 public:
  int location;
  int l, r;
  Node() : l(NIL), r(NIL) {}
};

class Point {
 public:
  int id, x, y;
  Point() {}
  Point(int id, int x, int y) : id(id), x(x), y(y) {}
  bool operator<(const Point &p) const { return id < p.id; }
  void print() { printf("%d\n", id); }
};

int make_KD_tree(vector<Point> &P, vector<Node> &T, int l, int r, int depth,
                 int &np) {
  if (!(l < r)) return NIL;
  auto mid = (l + r) / 2;
  auto t = np++;
  if (depth % 2 == 0) {
    sort(P.begin() + l, P.begin() + r,
         [](Point &p1, Point &p2) { return p1.x < p2.x; });
  } else {
    sort(P.begin() + l, P.begin() + r,
         [](Point &p1, Point &p2) { return p1.y < p2.y; });
  }
  T[t].location = mid;
  T[t].l = make_KD_tree(P, T, l, mid, depth + 1, np);
  T[t].r = make_KD_tree(P, T, mid + 1, r, depth + 1, np);
  return t;
}

void find(vector<Point> &P, vector<Node> &T, int v, int sx, int tx, int sy,
          int ty, int depth, vector<Point> &ans) {
  auto x = P[T[v].location].x;
  auto y = P[T[v].location].y;
  if (sx <= x && x <= tx && sy <= y && y <= ty) {
    ans.push_back(P[T[v].location]);
  }
  if (depth % 2 == 0) {
    if (T[v].l != NIL && sx <= x) {
      find(P, T, T[v].l, sx, tx, sy, ty, depth + 1, ans);
    }
    if (T[v].r != NIL && x <= tx) {
      find(P, T, T[v].r, sx, tx, sy, ty, depth + 1, ans);
    }
  } else {
    if (T[v].l != NIL && sy <= y) {
      find(P, T, T[v].l, sx, tx, sy, ty, depth + 1, ans);
    }
    if (T[v].r != NIL && y <= ty) {
      find(P, T, T[v].r, sx, tx, sy, ty, depth + 1, ans);
    }
  }
}

int main() {
  int n, x, y;
  scanf("%d", &n);
  vector<Node> T(n);
  vector<Point> P;
  REP(i, n) {
    scanf("%d %d", &x, &y);
    P.emplace_back(i, x, y);
  }
  auto np = 0;
  auto root = make_KD_tree(P, T, 0, n, 0, np);
  int q, sx, tx, sy, ty;
  cin >> q;
  vector<Point> ans;
  REP(i, q) {
    scanf("%d %d %d %d", &sx, &tx, &sy, &ty);
    ans.clear();
    find(P, T, root, sx, tx, sy, ty, 0, ans);
    sort(ALL(ans));
    for (auto &&a : ans) a.print();
    printf("\n");
  }
}


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

using namespace std;


#define uniq(x)  x.erase(unique(x.begin(),x.end()), x.end()) //Unique value find from vector
#define upper(arr,n,fixed) upper_bound(arr,arr+n,fixed)-arr  //Upper value search  >
#define lower(arr,n,fixed) lower_bound(arr,arr+n,fixed)-arr  //Lower value search  >=
#define FOR(i,a,n) for(int i=a; i<(int)n; i++)
#define FORI(i,a,n) for(int i=a; i>=(int)n; i--)
#define pii pair<int,int>
#define vpii vector<pii>
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define sz(a) int((a).size())
#define fastIO() ios_base::sync_with_stdio(0); cin.tie(0)
#define endl "\n"
#define all(a) a.begin(), a.end()
#define MEMSET(p,i) memset(p,i,sizeof(p))

typedef long long LL;
typedef unsigned long long ULL;

int n, W;
LL v[110];
int w[110];

LL memo[110][100010];
LL solve(int i, int W)
{
	if(i == n){
		return memo[i][W] = 0;
	}

	auto &dpm = memo[i][W];
	if(dpm != -1)
		return dpm;

	if(W-w[i] >= 0){ // Tenta colocar na mochila
		dpm = max(dpm, solve(i+1, W-w[i]) + v[i]);
	}
	dpm = max(dpm, solve(i+1, W));
	return dpm;
}




int main(void)
{
	fastIO();

	
	cin >> n >> W;

	FOR(i,0,n)
		cin >> w[i] >> v[i];

	MEMSET(memo,-1);
	solve(0, W);
	cout << memo[0][W] << endl;



	
}

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

int main() {
	int n;
	cin >> n;
	int a[n],b[n];
	int count = 0;
	for(int i=0;i<n;i++){
		cin >> a[i];
		b[i] = a[i];
	}
	sort(a,a+n);
	for(int i=0;i<n;i++){
		if(a[i]!=b[i]){
			count++;
		}
	}
	if(count<3) cout << "YES" << endl;
	else cout << "NO" << endl;
	return 0;
}

Measured memory_bytes: 256
<?php
fscanf(STDIN, "%d", $n);
for ($i = 1; $i <= $n; $i++) {
	fscanf(STDIN, "%s %d", $s, $p);
	$q[$s][$p] = $i;
}
ksort($q);
$a = [];
foreach ($q as $s => $x) {
	krsort($x);
	$a = array_merge($a, array_values($x));
}
echo implode("\n", $a);


Measured memory_bytes: 4728
N = int(input())
num = 0
for i in range(1, N+1):
  if i % 2 == 0:
    pass
  else:
    a = 0
    for j in range(1, i+1):
      if i % j == 0:
        a += 1
    if a == 8:
      num += 1
print(num)

Measured memory_bytes: 63808
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vin=vector<int>;
using vll=vector<long long>;
using vvin=vector<vector<int>>;
using vvll=vector<vector<long long>>;
using vstr=vector<string>;
using vvstr=vector<vector<string>>;
using vch=vector<char>;
using vvch=vector<vector<char>>;
using vbo=vector<bool>;
using vvbo=vector<vector<bool>>;
using vpii=vector<pair<int,int>>;
using pqsin=priority_queue<int,vector<int>,greater<int>>;
#define mp make_pair
#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 all(v) v.begin(),v.end()
#define decp(n) cout<<fixed<<setprecision((int)n)
const int inf=1e9+7;
const ll INF=1e18;

int main(){
    int n,m;cin>>n>>m;
    cout<<(1<<m)*(100*n+1800*m)<<endl;
}

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

typedef long long ll;
typedef int64_t i6;

#define rep(i, n) for (ll i = 0; i < n; ++i)
#define rep2(i, n) for (ll i = 1; i <= n; ++i)
#define ALL(v) (v).begin(), (v).end()
#define Sort(x) sort(ALL(x))
#define Sort_rev(x) Sort(x);reverse(ALL(x))

template<typename V,typename T>
T find_num(V v, T num) {
    if ( find(ALL(v), num) == v.end() ) {
        return false;
    } else {
        return true;
    }
}

// π M_PI
// deg = rad*180/M_PI

int main() {
    ll n, m, k;
    cin >> n >> m >> k;
    ll ans = 0;
    ll num = 2;
    ll nn = n;
    while (nn <= k) {
        if ( nn >= m && nn <= k ) {
            ans = 1;
            break;
        }
        nn = n*num;
        // cout << "n" << nn << endl;
        num++;
    }
    cout << ( ans ? "OK" : "NG" ) << endl;
    return 0;
}


Measured memory_bytes: 3640
#include <bits/stdc++.h>
#define int long long
#define mod (int)(1e9+7)
#define inf (int)(3e18)
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define P std::pair<int,int>
#define PiP std::pair<int,std::pair<int,int>>
#define all(v) v.begin(),v.end()
#define mkp std::make_pair
#define prique(T) std::priority_queue<T,vector<T>,greater<T>>
using namespace std;
template<class T> inline void chmax(T& a, T b) { a = std::max(a, b); }
template<class T> inline void chmin(T& a, T b) { a = std::min(a, b); }
 
bool prime(int x) {
	for (int i = 2; i * i <= x; i++) {
		if (x % i == 0)return false;
	}
	return x != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= i; res %= mod;
	}
	return res;
}
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y) * mod_pow(kai(y, y), mod - 2, mod) % mod;
}
int get_rand(int MIN, int MAX) {
	std::random_device rnd;
	std::mt19937 mt32(rnd());
	std::uniform_int_distribution<int>engine(MIN, MAX);
	return engine(mt32);
}
/*--------Library Zone!--------*/

int h,w,n;
vector<int>v[200005];
map<P,bool>mp;
int ans[200005];
signed main(){
	cin>>h>>w>>n;
	rep(i,n){
		int a,b;cin>>a>>b;
		a--;b--;
		v[b].push_back(a);
		mp[{a,b}]=true;
	}
	rep(i,w){
		sort(all(v[i]));
		v[i].push_back(h);
		ans[i]=inf;
	}
	ans[0]=0;
	int now=0;
	rep(i,h){
		if(!mp[{i+1,now+1}]){
			ans[now+1]=i+1;
			now++;
		}
	}
	int res=inf;
	rep(i,w){
		if(ans[i]==inf)continue;
		chmin(res,*lower_bound(all(v[i]),ans[i]));
	}
	cout<<res<<endl;
}


Measured memory_bytes: 36096
#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <stack>
#include <vector>
#include <math.h>
#include <queue>

using namespace std;

struct Info{
	int succeed_num;
};

int main(){

	char* buf = new char[1000001];
	char pre;
	Info J_data,O_data;
	J_data.succeed_num = O_data.succeed_num = 0;

	scanf("%s",buf);

	int index,tmp,max_level;

	for(index = 0; buf[index] != 'J' && buf[index] != '\0';index++);

	pre = buf[index];

	if(pre == '\0'){
		printf("0\n");
		return 0;
	}

	max_level = 0;
	tmp = 0;
	for(;buf[index] != '\0';){
		if(pre == buf[index]){
			tmp++;

			if(buf[index+1] == '\0'){
				if(pre == 'I' && O_data.succeed_num <= J_data.succeed_num && O_data.succeed_num <= tmp){
					max_level = max(max_level,O_data.succeed_num);
				}
			}
			index++;
		}else{
			switch(pre){
			case 'J':
				if(buf[index] == 'O'){
					J_data.succeed_num = tmp;
					O_data.succeed_num = 0;
					pre = 'O';
				}else{
					for(;buf[index] != 'J' && buf[index] != '\0';index++);
					J_data.succeed_num = 0;
					O_data.succeed_num = 0;
					pre = 'J';
				}
				break;
			case 'O':
				if(buf[index] == 'I'){
					O_data.succeed_num = tmp;
					pre = 'I';
				}else{
					O_data.succeed_num = 0;
					pre = 'J';
				}
				break;
			case 'I':

				if(O_data.succeed_num <= J_data.succeed_num && O_data.succeed_num <= tmp){
					max_level = max(max_level,O_data.succeed_num);
				}
				J_data.succeed_num = 0;
				O_data.succeed_num = 0;

				if(buf[index] == 'J'){
					pre = 'J';
				}else{
					for(;buf[index] != 'J' && buf[index] != '\0';index++);
					pre = 'J';
				}
				break;
			}
			tmp = 0;
		}
	}

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

	return 0;
}

Measured memory_bytes: 4192
package main

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

var sc = bufio.NewScanner(os.Stdin)
func scanInt() int {
	sc.Scan()
	a,_ := strconv.Atoi(sc.Text())
	return a
}

func main() {
	sc.Split(bufio.ScanWords)
	n := scanInt()
	m := scanInt()

	p,q := 1,n

	for i:=0; i<m; i++ {
		l := scanInt()
		r := scanInt()
		
		if p<l {
			p = l
		}

		if q>r {
			q = r
		}
	}

	if q-p+1 < 0 {
		fmt.Println(0)
	} else {
		fmt.Println(q-p+1)
	}
}


Measured memory_bytes: 1792