akhauriyash/Code-Regression huggingface dataset:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.lang.Integer; 

public class Main {
    public static void main(String[] args) {
 
        InputStreamReader isr = new InputStreamReader(System.in);
        BufferedReader br = new BufferedReader(isr);
 
        String str = null;
        try {
            str = br.readLine();
            br.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
        String[] curtain = str.split(" ");
        Integer nagasa = Integer.parseInt(curtain[0]);
        Integer curtainNagasa = Integer.parseInt(curtain[1]);
        int curtainLong = curtainNagasa * 2;
        if (nagasa > curtainLong) {
            nagasa = nagasa - curtainLong;
        } else {
            nagasa = 0;
        }
        System.out.println(nagasa);
    } 
}

Measured memory_bytes: 23252
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T> V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> > Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T> mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }


/*
 <url:https://onlinejudge.u-aizu.ac.jp/services/room.html#RitsCamp18Day1/problems/C>
 問題文============================================================
 長さ N の数列 ai が与えられる。 次の条件を満たす整数 K(1≤K≤N) を全て出力せよ。
 
 条件: a1,⋯,aK をうまく並び替えると aN−K+1,⋯,aN と一致する。
 
 =================================================================
 
 解説=============================================================
 
 ================================================================
 */
void solve(){
    ll N; cin >> N;
    vector<ll> a(N); for(auto& in:a) cin >> in;
    map<ll,ll> mp1,mp2;
    vector<ll> ans;
    for(int i = 1; i <= N;i++){
        mp1[a[i-1]]++;
        mp2[a[N-i]]++;
        [&]{
            for(auto it:mp1){
                if(it.second == mp2[it.first]) continue;
                return;
            }
            ans.push_back(i);
        }();
    }
    cout << ans << endl;
}
int main(void) {
    cin.tie(0); ios::sync_with_stdio(false);
    solve();
    return 0;
}



Measured memory_bytes: 10028
using System;

namespace ConsoleApp7
{
    class Program
    {
        public const int HOUR = 3600;
        public const int MIN = 60;

        static void Main(string[] args)
        {
            int NUM = int.Parse(Console.ReadLine());
            int H = NUM / 3600;
            int ret = NUM % 3600;
            int M = ret / 60;
            int S = ret % 60;
            Console.WriteLine("{0}:{1}:{2}", H, M, S);
        }
    }
}



Measured memory_bytes: 9200
#ifdef _DEBUG
#include "MyLib.h"
#else
#define main_B main
#include "bits/stdc++.h" 
#include <regex>
#define _USE_MATH_DEFINES
#include <math.h>
#define FOR(i,s,e) for (int i = int(s); i < int(e); ++i)
#define REP(i,e) FOR(i,0,e)
#define INF (INT_MAX/2)
#define EPS (1.0e-8)
#define LINF (LONG_MAX/2)
const int MGN = 8;
const int ARY_SZ_MAX = 10000000;
using namespace std;
using ll = long long; using ull = unsigned long long;
using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>;
using vb = vector<bool>; using vvb = vector<vb>; using vvvb = vector<vvb>;
using vl = vector<ll>; using vvl = vector<vl>;
using vd = vector<double>; using vs = vector<string>;
using pii = pair<int, int>; using pll = pair<ll, ll>;
// functions

#endif


int main_B() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int A, B; cin >> A >> B;
    
    int ans = (B - A - 1)*(B - A) / 2 - A;

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, s, n) for (int i = s; i < (int)(n); i++)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
int n;
int main()
{
    cin >> n;
    vector<P> v(n);
    rep(i, n)
    {
        cin >> v[i].second >> v[i].first;
    }
    sort(v.begin(), v.end());
    ll t = 0;
    rep(i, n)
    {
        if (v[i].first < t + v[i].second)
        {
            cout << "No" << endl;
            return 0;
        }
        t += v[i].second;
    }
    cout << "Yes" << endl;
}

Measured memory_bytes: 1792
#include <algorithm>
#include <iostream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <bitset>
#include <complex>
#include <unistd.h>
#include <cassert>
#include <cctype>
#include <random>
#include <time.h>
#define _USE_MATH_DEFINES
#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef pair<double, ll> pdlg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef tuple<double, double, double> tddd;
typedef complex<double> xy_t;
typedef vector<ll> vll;
typedef vector< vector<ll> > matrix;
#define REP(i, x, y) for(ll i = (ll)x; i < (ll)y; i++)
#define DREP(i, x, y, d) for(ll i = (ll)x; i < (ll)y; i += (ll)d)
#define PER(i, x, y) for(ll i = (ll)x; i > (ll)y; i--)
#define DPER(i, x, y, d) for(ll i = (ll)x; i > (ll)y; i -= (ll)d)
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
double pi = 3.141592653589793;
ll mod = 1000000007;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;
int iinf = intmax / 8;
ll inf = llmax / 8;
double eps = 1e-12;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll R, G, B, N;
    cin >> R >> G >> B >> N;
    ll ans = 0;
    REP(i, 0, N / R + 1) {
        REP(j, 0, (N - (R * i)) / G + 1) {
            ll num = N - R * i - G * j;
            if (num % B == 0) {
                ans++;
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
n = int(input())
a = [int(i) for i in input().split()]
max_a = max(a)
cnt_d = [0] * (max_a + 1)
for ai in a:
    for multi in range(ai, max_a + 1, ai):
        cnt_d[multi] += 1
print(sum(cnt_d[ai] == 1 for ai in a))

Measured memory_bytes: 117256
import bisect

# 入力
def read_data():
    N_ = int(input())
    L_ = list(map(int, input().split()))
    return N_, L_

#探索
def binarySearch(N :int, L):
    ans = 0
    L.sort()
    # a,b は固定する
    for a_index in range(N):
        for b_index in range(a_index + 1, N):
            sum_of_a_and_b = L[a_index] + L[b_index]
            # c の可動範囲の右端を求める
            c_right_index = bisect.bisect_left(L, sum_of_a_and_b)
            # c の可動範囲は[b_index + 1, c_right_index)
            ans += max(0, c_right_index - b_index - 1)
    print(ans)

N, L = read_data()
binarySearch(N, L)

Measured memory_bytes: 3188
import numpy as np
N, K = map(int, input().split())
h = np.array(list(map(int, input().split())))

dp = np.array([0] * N)
#candi = np.array([0] * N)

for i in range(1, N):
	j = max(0, i-K)
	#print()
	#candi[j:i] = dp[j:i] + np.abs(h[i] - h[j:i])
	dp[i] = (dp[j:i] + np.abs(h[i] - h[j:i])).min()
	#print('j,i=',j,i)
	#print('dp[j:i]=',dp[j:i])
	#print('np.abs(h[i] - h[j:i]) = ', np.abs(h[i] - h[j:i]) )		
	#print('candi[j:i]=',candi[j:i])
	#dp[i] = candi[j:i].min()
	#print('dp=',dp)
				
print(dp[-1])

Measured memory_bytes: 22736
import java.util.AbstractMap.SimpleEntry;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int[] size = {sc.nextInt(), sc.nextInt()};
		int d = sc.nextInt();
		Map<Integer, Entry<Integer, Integer>> map = new HashMap<>();
		for(int i = 0; i< size[0]; i++){
			for(int j = 0; j < size[1]; j++)map.put(sc.nextInt(), new SimpleEntry<>(i,j));
		}
		int q = sc.nextInt();
		int[] memoArray = new int[size[0] * size[1]];
		StringBuilder sb = new StringBuilder();
		String end = "\n";
		for(int i  = 1; i <= size[0] * size[1]; i++){
			if(i <= d){
				memoArray[i-1] = 0;
				continue;
			}

			Entry<Integer, Integer> e1 = map.get(i-d);
			Entry<Integer, Integer> e2 = map.get(i);
			memoArray[i-1] = memoArray[i-d - 1] + Math.abs(e2.getKey() -e1.getKey()) + Math.abs(e2.getValue() - e1.getValue());
		}
		for(int i = 0; i < q; i++){
			int l = sc.nextInt();
			int r = sc.nextInt();
			sb.append(String.valueOf(memoArray[r-1] - memoArray[l-1]));
			if(i < q-1) sb.append(end);
		}
		System.out.println(sb.toString());
	}
}

Measured memory_bytes: 103704
#include <iostream>

int main(void){
    using namespace std;
    static int s[2001][1001];
    int n, k;
    cin.sync_with_stdio(false);
    cout.sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    cin >> n >> k;
    for(int i=0; i<n; i++){
        int x, y;
        char c;
        cin >> x >> y >> c;
        y %= 2*k;
        if(c=='W'){
            x += k;
        }
        if(y>=k){
            y-=k;
            x+=k;
        }
        x %= 2*k;
        s[x+1][y+1]++;
    }
    for(int x=0; x<2*k; x++){
        for(int y=0; y<k; y++){
            s[x+1][y+1] += s[x][y+1] + s[x+1][y] - s[x][y];
        }
    }
    int max = 0;
    for(int x=0; x<k; x++){
        for(int y=0; y<k; y++){
            int t = s[0][0] - s[0][y]
                - s[x][0] + 2*s[x][y] - s[x][k]
                + s[x+k][0] - 2*s[x+k][y] + s[x+k][k] 
                - s[2*k][0] + s[2*k][y];
            t = t<n/2 ? n-t : t;
            max = t>max ? t : max;
        }
    }
    cout << max;
    return 0;
}


Measured memory_bytes: 8064
use std::io;
use std::cmp::max;

fn main (){
    let _ = get_line();
    let nums = get_line();
    let mut sim = nums.chars().scan(0, |acc, n| {
        // this feels totally weird. TOTALLY
        match n {
            'D' => { *acc = *acc-1; Some(*acc) }
            'I' => { *acc = *acc+1; Some(*acc) }
            _ => panic!("die")
        }
    });
    // maximum . catMaybes
    let mut ans = 0;
    while let Some(n) = sim.next(){
        ans = max(ans,n);
    }
    println!("{}",ans);
}

fn get_line() -> String {
    let mut buf = String::new();
    io::stdin().read_line(&mut buf).expect("orders");
    buf.trim().to_string()
}


Measured memory_bytes: 380
#include<iostream>
using namespace std;
int main(){
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	if(a*b>c*d)
	cout<<a*b<<endl;
	else if(a*b<c*d)
	cout<<c*d<<endl;
	else
	cout<<a*b<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<string>
#include<cstring>
#include<climits>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<deque>
#include<tuple>
#include<list>
#include<unordered_map>
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vii vector<int>
#define vll vector<ll>
#define lb lower_bound
#define pb push_back
#define mp make_pair
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define INF (1 << 30) - 1
#define LLINF (1LL << 61) - 1
// #define int ll
using namespace std;
const int MOD = 1000000007;
const int MAX = 510000;

int main(){
    string s;
    cin>>s;
    ll now=-1,n=s.size();
    rep(i,n){
        if(s[i]=='C'){
            now=i;
            break;
        }
    }
    if(now==-1){cout<<"No"<<endl;return 0;}
    rep2(i,now,n){
        if(s[i]=='F'){
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <functional>
#include <limits.h>
#include <set>
#include <map>
#include <tuple>
using namespace std;

#define ll long long
#define ull unsigned long long
#define rep(i,N) for (int i=0;i<N;i++)
#define loop(i,N,M) for(int i=N;i<M;i++)
#define MAX(v) *max_element(v.begin(),v.end())
#define MIN(v) *min_element(v.begin(),v.end())
#define SORTL2S(type,v) sort(v.begin(),v.end(),greater<type>())
#define SORTS2L(type,v) sort(v.begin(),v.end())
#define SORTMF(v,func) sort(v.begin(),v.end(),func)

//変数
ll H,W;
bool clr[400][400];
bool chk[400][400];


//解法
void solve() {
	
	ll ans = 0;

	rep(i, 400) rep(j, 400) chk[i][j] = false;

	rep(y, H) rep(x, W) {

		if (chk[x][y] == false) {

			ll white = 0;
			ll black = 0;

			queue<pair<int, int>> QU;
			QU.push(make_pair(x, y));
			chk[x][y] = true;
			if (clr[x][y] == false) white++;
			if (clr[x][y] == true) black++;

			while (QU.size() != 0) {

				pair<int, int> P = QU.front();
				QU.pop();
				int xx = P.first;
				int yy = P.second;

				if (chk[xx - 1][yy] == false && clr[xx - 1][yy] != clr[xx][yy] && xx - 1 >= 0) {
					QU.push(make_pair(xx - 1, yy));
					if (clr[xx - 1][yy] == false) white++;
					if (clr[xx - 1][yy] == true) black++;
					chk[xx - 1][yy] = true;
				}
				if (chk[xx + 1][yy] == false && clr[xx + 1][yy] != clr[xx][yy] && xx + 1 <=W-1) {
					QU.push(make_pair(xx + 1, yy));
					if (clr[xx + 1][yy] == false) white++;
					if (clr[xx + 1][yy] == true) black++;
					chk[xx + 1][yy] = true;
				}
				if (chk[xx][yy-1] == false && clr[xx][yy-1] != clr[xx][yy] && yy - 1 >= 0) {
					QU.push(make_pair(xx, yy-1));
					if (clr[xx ][yy-1] == false) white++;
					if (clr[xx ][yy-1] == true) black++;
					chk[xx][yy-1] = true;
				}
				if (chk[xx][yy + 1] == false && clr[xx][yy + 1] != clr[xx][yy] && yy + 1 <= H-1) {
					QU.push(make_pair(xx, yy + 1));
					if (clr[xx ][yy+1] == false) white++;
					if (clr[xx ][yy+1] == true) black++;
					chk[xx][yy + 1] = true;
				}

			}

			ans += white*black;
			//cout << "("<<x<<","<<y<<")"<< "white:" << white << " black:" << black << endl;
		}

	}

	cout << ans;

	return;
}

int main() {
	//入力

	cin >> H>>W;
	string input;
	rep(i, H){
		cin >> input;
		rep(j, W) {
			if (input[j] == '#') {
				clr[j][i] = true;
			}
			else {
				clr[j][i] = false;
			}
		}
	}

	solve();
	cout << endl;
	return 0;
}

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

int main() {
  int K,A,B;
  cin >> K >> A >> B;
  if(A/K<B/K||A%K==0||B%K==0) {
    cout << "OK" << endl;
  } else {
    cout << "NG" << endl;
  }
}

Measured memory_bytes: 3636
#include<stdio.h>
 
void swap(int *p1, int *p2)
{
    int tmp;
 
    tmp=*p1;
    *p1 = *p2;
    *p2 = tmp;
}
 
 
int main()
{
    int value[3];
    int i=0;
 
    scanf("%d %d %d", &value[0], &value[1], &value[2]);
 
    while(1)
    {
        if(value[i] > value[i+1])
        {
            swap(&value[i], &value[i+1]);
            i=0;
            continue;
        }
        if(sizeof(value)/sizeof(int) -1 == ++i)
            break;
 
    }
    printf("%d %d %d\n", value[0], value[1], value[2]);
    return 0;
}

Measured memory_bytes: 596
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
using namespace std;
#define rep(i, a, b) for(int i = a; i < (b); ++i)
typedef long long ll;
typedef pair<int,int> P;
int main() {
    int N,K;
    string S;
//    cin >> N;
//    vector<int>A(N);
    cin >> S;
    cout << S[0] << S[1] << S[2] << endl;
    
    
    
    return 0;
}


Measured memory_bytes: 3596
#                               #
    # author : samars_diary #
    # 16-09-2020 │ 18:28:11 #
#                               #

import sys, os.path, math

#if(os.path.exists('input.txt')):
    #sys.stdin = open('input.txt',"r")
    #sys.stdout = open('output.txt',"w")

sys.setrecursionlimit(10 ** 5)

mod =  10**9+7
def i(): return sys.stdin.readline().strip()
def ii(): return int(sys.stdin.readline())
def li(): return list(sys.stdin.readline().strip())
def mii(): return map(int, sys.stdin.readline().split())
def lii(): return list(map(int, sys.stdin.readline().strip().split()))

#print=sys.stdout.write

def solve():
    a=ii();print((pow(10,a,mod)+pow(8,a,mod)-2*pow(9,a,mod))%mod)
for _ in range(1):
    solve()

Measured memory_bytes: 9124
import java.util.*;
import java.lang.*;
import java.math.*;
import java.io.*;

import static java.lang.Math.*;
import static java.util.Arrays.*;

public class Main{

	Scanner sc;

	static final int INF=1<<28;
	static final double EPS=1e-9;

	void run(){
		sc=new Scanner(System.in);
		for(; sc.hasNext();){
			int x=sc.nextInt();
			int h=sc.nextInt();
			if(x==0&&h==0)
				break;
			double l=sqrt(h*h+x*x/4.);
			double s=x*x+2*x*l;
			println(s+"");
		}
		sc.close();
	}

	void print(String s){
		System.out.print(s);
	}

	void println(String s){
		System.out.println(s);
	}

	public static void main(String[] args){
		new Main().run();
	}
}

Measured memory_bytes: 11000
#include <bits/stdc++.h>
#include <math.h>
#include <iostream>
#include <stdlib.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define MOD (998244353)
using namespace std;

int main(void){
    int a,b;
    cin >> a >> b;
    int maxi = max(a+b,a-b);
    maxi = max(maxi, a*b);
    printf("%d\n",maxi);
    return 0;
}

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

#define REP(i,n) for(int i=0;i<n;i++)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define EPS (1e-7)

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<double,double> pdd;

int vx[]={0,1,0,-1};
int vy[]={1,0,-1,0};

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

const ll mod=1e9+7;
const int INF=INT_MAX/2;
const int MAX=1e9;

int main(){
	int m;
	cin>>m;
	cout<<48-m<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int x;
  int a,b;
  scanf("%d %d %d",&x,&a,&b);
  if(a-b>=0){
    printf("delicious\n");
  }else{
    if(a-b+x>=0){
      printf("safe\n");
    }else{
      printf("dangerous\n");
    }
  }
  return(0);
}


Measured memory_bytes: 128
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <iomanip> // setprecision
#include <complex> // complex
#include <functional>
#include <math.h> 
#define enld '\n'
using namespace std;
using ll = long long;
using P = pair<int,int>;
constexpr ll INF = 1e18;
constexpr int inf = 1e9;
constexpr ll mod = 1000000007;
constexpr ll mod2 = 998244353;
const int dx[8] = {1, 0, -1, 0,1,1,-1,-1};
const int dy[8] = {0, 1, 0, -1,1,-1,1,-1};
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; }
// ---------------------------------------------------------------------------

int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll N;
  cin >> N;
  ll A,B;
  cin >> A >> B;
  ll sum;
  cin >> sum;
  vector<ll> D(N);
  for(int i=0; i<N; i++) cin >> D[i];
  sort(D.rbegin(),D.rend());
  ll ans = sum/A;
  for(int i=0; i<N; i++){
    sum += D[i];
    chmax(ans,sum/(A+B*(i+1)));
  }
  cout << ans << "\n";
  return 0;
}


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

#define SIZE_LIMIT 100
#define NUM_LIMIT 1000

typedef struct {
	int size;
	short* x;
	short* y;
} DataSet;

short InputDataSet(DataSet* dataSet);
double Minko1(DataSet dataSet);
double Minko2(DataSet dataSet);
double Minko3(DataSet dataSet);
double MinkoInf(DataSet dataSet);

void FreeDataSet(DataSet* dataSet);

int main(void) {
	DataSet dataSet;

	while (InputDataSet(&dataSet) != 0);

	printf("%.8lf\n", Minko1(dataSet));
	printf("%.8lf\n", Minko2(dataSet));
	printf("%.8lf\n", Minko3(dataSet));
	printf("%.8lf\n", MinkoInf(dataSet));
}

short InputDataSet(DataSet* dataSet) {
	int size;
	int idx;
	short* x;
	short* y;

	scanf("%d", &size);
	if (size < 1 || size > SIZE_LIMIT) {
		return -1;
	}

	x = (short*)malloc(sizeof(short) * size);
	for (idx = 0; idx < size; idx++) {
		int tmp;
		scanf("%d", &tmp);
		if (tmp < 0 || tmp > NUM_LIMIT) {
			return -1;
		}
		*(x + idx) = tmp;
	}

	y = (short*)malloc(sizeof(short) * size);
	for (idx = 0; idx < size; idx++) {
		int tmp;
		scanf("%d", &tmp);
		if (tmp < 0 || tmp > NUM_LIMIT) {
			return -1;
		}
		*(y + idx) = tmp;
	}

	dataSet->size = size;
	dataSet->x = x;
	dataSet->y = y;

	return 0;
}

double Minko1(DataSet dataSet) {
	int idx;
	int size = dataSet.size;
	double res = 0;

	for (idx = 0; idx < size; idx++) {
		int x = *(dataSet.x + idx);
		int y = *(dataSet.y + idx);
		int sub = abs(y - x);
		res += sub;
	}
	return res;
}


double Minko2(DataSet dataSet) {
	int idx;
	int size = dataSet.size;
	double sum = 0;
	double res = 0;

	for (idx = 0; idx < size; idx++) {
		int x = *(dataSet.x + idx);
		int y = *(dataSet.y + idx);
		double sub = abs(x - y);
		sum += pow(sub, 2.0);
	}

	res = pow(sum, 1.0 / 2.0);
	return res;
}

double Minko3(DataSet dataSet) {
	int idx;
	int size = dataSet.size;
	double sum = 0;
	double res = 0;

	for (idx = 0; idx < size; idx++) {
		int x = *(dataSet.x + idx);
		int y = *(dataSet.y + idx);
		double sub = abs(x - y);
		sum += pow(sub, 3.0);
	}

	res = pow(sum, 1.0 / 3.0);
	return res;
}

double MinkoInf(DataSet dataSet) {
	int idx;
	int size = dataSet.size;
	double res = 0;

	for (idx = 0; idx < size; idx++) {
		int x = *(dataSet.x + idx);
		int y = *(dataSet.y + idx);
		double sub = abs(x - y);
		if (res < sub) {
			res = sub;
		}
	}
	return res;
}

void FreeDataSet(DataSet* dataSet) {
	free(dataSet->x);
	free(dataSet->y);
}


Measured memory_bytes: 2080
#include<cstdio>
#include<cctype>
using namespace std;
int main(){
	char ch;
	while(1){
		scanf("%c",&ch);
		if(isalpha(ch)){
			if(islower(ch)) printf("%c",toupper(ch));
			else printf("%c",tolower(ch));
			}else printf("%c",ch);
			
			if(ch=='\n') break;
			}
		return 0;
	}	
	

Measured memory_bytes: 944
def resolve():
    import math
    A, B, H, M = map(int, input().split())
    Hradian = math.radians(30*H+M/2)
    Mradian = math.radians(6*M)
    Hx, Hy = -1*A*math.sin(Hradian), A*math.cos(Hradian)
    Mx, My = -1*B*math.sin(Mradian), B*math.cos(Mradian)
    ans = ((Hx-Mx)**2 + (Hy-My)**2)**0.5
    print(ans)
resolve()

Measured memory_bytes: 9568
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pll pair<long long,long long>
#define mod 1000000007
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);

ll power(ll a,ll b){
	ll ans=1;
	while(b>0){
		if(b%2!=0){
			ans=(ans*a)%mod;
		}
		a=(a*a)%mod;
		b>>=1;
	}
	return ans;
}
ll fact[100005],modi[100005];
void pre(){
    fact[0]=1;
    modi[0]=1;
    for(int i=1;i<100005;i++){
        fact[i]=i*fact[i-1];
        fact[i]%=mod;
        modi[i]=power(fact[i],mod-2);
    }
}

ll ncr(ll n,ll r){
    if(n<r)
    return 0;
    ll ha=(((fact[n]*modi[n-r])%mod)*modi[r])%mod;
    return ha;
}

int main() {
	IOS;
	int t=1;
	//cin>>t;
	while(t--){
	    int n,k;
	    cin>>n>>k;
	    ll a[n];
	    for(int i=0;i<n;i++){
	        cin>>a[i];
	    }
	    pre();
	    ll cnt1=0,cnt2=0;
	    sort(a,a+n);
	    for(int i=0;i<n;i++){
	        cnt1+=(a[i]*ncr(n-i-1,k-1))%mod;
	        cnt1%=mod;
	        cnt2+=(a[i]*ncr(i,k-1))%mod;
	        cnt2%=mod;
	    }
	    cnt2=cnt2-cnt1+mod;
	    cout<<cnt2%mod;
	}
	return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
        using namespace std;
        typedef long long int ll;
        #define mod 1000000007
        #define all(v)  v.begin(),v.end()
        #define pb push_back
        #define size(v)  (int) v.size()
        #define fast ios_base:: sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL)
        ll power_mod(ll a,ll x){if(x==0) return 1;ll y=power_mod(a,x/2);ll ans=(y*y)%mod; if(x%2) ans=(ans*a)%mod;return ans;}
        ll inv(ll a){return power_mod(a,mod-2);}    
        ll power(ll a, ll x){ if(x==0) return 1; ll y= power(a,x/2); ll ans=(y*y); if(x%2) ans*=a; return ans;}



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

            vector<ll> a(n,0);
            

            for(ll i = 0; i < n; i++)  {
                cin >> a[i];
            }
            
            ll lo = 0, hi = 1000000000;
            ll ans = hi;

            while(lo <= hi) {
                ll mid = (lo+hi)/2;
                if(mid == 0) {
                    if(lo == hi) {
                        break;
                    }
                    mid = 1;
                }
                ll cut_req = 0;
                for(auto i : a) {
                    ll curr = i;
                    if(curr < mid) continue;
                    cut_req += ((curr-1)/mid);
                }
                // printf("%0.9lf ",mid);
                // cout << cut_req << endl;
                if(cut_req > k) {
                    lo = mid+1;
                }
                else{
                    ans = min(ans,mid);
                    hi = mid-1;
                }
            }
            ll res = ans;
            // printf("%0.9lf\n",ans);
            cout << res << endl;
            
        }   

Measured memory_bytes: 4708
#include <bits/stdc++.h>
using namespace std;
#define rep(i, c) for(int i=0; i<(int)c; i++)
string al[]={"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"};
int main() {
	vector<string>a;
	string s,c;

	cin >>s;

	string ans ="Yes";
	for (int j=0;j<26;j++){
		int cnt=0;
		for(int i=0;i<s.length();i++){
			c=s.substr(i,1);
			if (c==al[j]){
				cnt++;
			}
		}
		if (cnt%2){
			ans="No";
			break;
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
N=int(input())
L=[0]+list(map(int,input().split()))+[0]
sumL=0

for i in range(0,N+1):
  sumL+=abs(L[i+1]-L[i])
  
for i in range(1,N+1):
    print(sumL-abs(L[i+1]-L[i])-abs(L[i]-L[i-1])+abs(L[i+1]-L[i-1]))

Measured memory_bytes: 14048
let a = ref 0 and b = ref 0 in
    Scanf.sscanf (read_line ()) "%d %d" (fun x y -> a := x; b := y);
    if !b - !a >= 0 then print_string ((string_of_int !a) ^ "\n") else print_string ((string_of_int (!a - 1)) ^ "\n")

Measured memory_bytes: 384
s = gets.chomp.chars
pre_num_of_one = s.sort.join.to_i
if pre_num_of_one == 0
  num_of_one = 0
else
  num_of_one = pre_num_of_one.to_s.chars.size
end
puts s.size - ((s.size - num_of_one) - num_of_one).abs

Measured memory_bytes: 24720
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <cmath>
#include <climits>
#include <iomanip>
using namespace std;
typedef long long ll;
int main(){
  ll n,m;
  cin >> n >> m;
  ll mod = pow(10,9) + 7;
  ll res = 0;
  if(abs(n - m) <= 1){
    res = 1;
    for(int i = 1;i <= min(n,m);i++){
      res = res * i,res %= mod;
    }
    res *= res,res %= mod;
    if(abs(n - m) == 1){
      res = res * max(n,m),res %= mod;
    }
    else{
      res *= 2,res %= mod;
    }
  }
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
import java.util.SortedMap;
import java.util.TreeMap;

class Main {

	public static void main(String[] args) {
		try (Scanner sc = new Scanner(System.in)){
			int times = sc.nextInt();
			TreeMap<Long, Long> map = new TreeMap<>();
			long size = 0l;
			for (int i = 0; i<times; i++){
				int query = sc.nextInt();  //0insert 1find 2delete 3dump
				long x = sc.nextLong();
				switch (query) {
				//insert(x)
				case 0:
					if (!map.containsKey(x)) map.put(x,1l);
					else map.put(x,map.get(x)+1);
					size++;  //毎回size+1
					System.out.println(size);
					break;
				//find(x)
				case 1:
					if (map.get(x)!=null) {
						System.out.println(map.get(x));
					} else System.out.println(0);
					break;
				//delete(x)
				case 2:
					if (map.get(x) != null) {
						size -= map.get(x);  //remove時sizeを減る
						map.remove(x);
					}
					break;
				//dump(x,large)
				case 3:
					long large = sc.nextLong();
					SortedMap<Long,Long> submap = map.subMap(x,true,large,true);
					for (Long l : submap.keySet()) {
						for (int j=0; j<map.get(l); j++) System.out.println(l);   //回数があるだけ出力
					}
					break;
				}
			}
		}
	}
}


Measured memory_bytes: 180092
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long i,j,k,l,n,m;
    cin>>n>>k;
   long long  a[n],b[n];
    for(i=0;i<n;i++)
    {
        cin>>a[i]>>b[i];//weight
    }
   long long dp[n+1][k+1];
    for(i=0;i<n+1;i++)
    {
        dp[i][0]=0;
    }
    for(j=1;j<k+1;j++)
    dp[0][j]=-1;
    for(i=1;i<n+1;i++)
    {
        for(j=1;j<k+1;j++)
        {
            dp[i][j]=-1;
        }
    }
    for(i=1;i<n+1;i++)
    {
        for(j=0;j<k+1;j++)
        {
      //  cout<<dp[i-1][j]<<" ";cout<<(j+a[i-1])<<" ";
        //cout<<"\n";
            if(dp[i-1][j]!=-1&&j+a[i-1]<=k)
            {
           // cout<<dp[i-1][j+a[i-1]]<<" "<<b[i-1]<<" "<<dp[i-1][j]<<" "<<b[i-1]+dp[i-1][j]<<"\n";
                dp[i][j+a[i-1]]=max(dp[i-1][j+a[i-1]],b[i-1]+dp[i-1][j]);
             //   cout<<i<<" "<<j+a[i-1]<<" "<<dp[i][j+a[i-1]]<<"--\n";
            }
        }
        //cout<<"\n";
      for(j=0;j<k+1;j++)
        {
            dp[i][j]=max(dp[i][j],dp[i-1][j]);
        }
    }
  // cout<<"\n";
    long long ans=0;
    for(j=0;j<k+1;j++)
    {
        ans=max(ans,dp[n][j]);
    }
    cout<<ans<<"\n";
    return 0;
}

Measured memory_bytes: 79104
N, X = map(int, input().split())

Num = [1] 
for i in range(N):
    Num.append(3 + 2*Num[-1])

def B(L, X): #レベルLのバーガーの下からX層にあるパティの数
    if L == 0: return 1
    elif X == 1: return 0
    else:
        if X <= 1 + Num[L-1]:
            return B(L-1, X-1)
        elif X == 2 + Num[L-1]:
            return B(L-1, Num[L-1]) + 1
        elif X <= 2 + 2*Num[L-1]:
            return B(L-1, Num[L-1]) + 1 + B(L-1, X - 2 - Num[L-1])
        elif X == 3 + 2 * Num[L-1]:
            return 2*B(L-1, Num[L-1]) + 1

print(B(N, X))


Measured memory_bytes: 3064
#include <cstdio>
#include <climits>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <string>
#include <cstdio>
#include <climits>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <utility>
#include <queue>
#include <cstring>
#include <set>
#define rep(i, n) for (int i = 0; i < int(n); i++)
using namespace std;
long long MOD = 1000000007;
long long INF = 1000000000000000; //10^15
typedef long long ll;
typedef unsigned long long ull;

int ds(int n) {
  int r = 0;
  while (n > 0) {
    r += n % 10;
    n /= 10;
  }
  return r;
}

ll dp[1010][20020];

int main(void) {

  ll h, n;
  cin >> h >> n;
  ll a[20000], b[20000];
  rep(i, n) cin >> a[i] >> b[i];
  
  ll am = 0;
  rep(i, n) am = max(am, a[i]);

  for (ll i = 1; i <= h + am; i++) dp[0][i] = LLONG_MAX;

  for (int i = 0; i < n; i++) {
    for (ll j = 0; j <= h + am; j++) {
      if (j < a[i]) {
	dp[i + 1][j] = dp[i][j];
      } else {
	if (dp[i + 1][j - a[i]] == LLONG_MAX) dp[i + 1][j] = dp[i][j];
	else dp[i + 1][j] = min(dp[i][j], dp[i + 1][j - a[i]] + b[i]);
      }
    }
  }
  ll ans = LLONG_MAX;
  for (ll i = h; i <= h + am; i++) {
    //cout << dp[n][i] << endl;
    ans = min(ans, dp[n][i]);
  }
  cout << ans << endl;
}


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

//#define DEBUG

using namespace std;

template <class T>
void print_vect(std::vector<T> v){
    for(int i = 0 ; i < v .size(); i++) cout << v[i] << " ";
    cout << endl;
}


void solve(){
    uint32_t a;
    cin >> a;
    uint32_t ans = a * ( 1 + a + a * a );
    cout << ans << endl;
}
int main()
{
    //making data IO Fast
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(NULL);
    /****************************/

    #ifdef DEBUG
    int TEST_CASES = 2;
    while(TEST_CASES--){
    #endif // DEBBUG

    solve();

    #ifdef DEBUG
    }
    #endif // DEBUG
    
    return 0;
}


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

int main(void) {
	int input;
	cin >> input;
	int hour = input / (60*60);
	input -= hour * (60*60);

	int minute = input / 60;
	input -= minute * (60);

	cout << hour << ":" << minute << ":" << input << endl;
	return 0;

}

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

int d[5009];

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	int k, q; cin >> k >> q;
	for (int i = 0; i < k; i++)
		cin >> d[i];
	for (int i = 0; i < q; i++) {
		int n, x, m; cin >> n >> x >> m; 
		n -= 2; x = x % m;
		long long s = 0, ts = 0;
		int c = 0, tc = 0;
		for (int j = 0; j < k; j++) {
			s += d[j] % m;
			if (d[j] % m == 0) c++;
			if (j == n % k) {
				ts = s; tc = c;
			}
		}
		s = s * (n / k) + ts + x;
		c = c * (n / k) + tc;
		cout << n + 1 - (s / m + c) << '\n';
	}
	return 0;
}


Measured memory_bytes: 384
import scala.io.StdIn

object Main extends App {

  val rn = StdIn.readLine().trim.toInt
  val ra = StdIn.readLine().trim.split(' ').map(_.toInt)

  def insertionSort(a: Array[Int], n: Int): Array[Int] = {
    var v = 0
    var j = 0
    (1 until n).foreach { i =>
      println(a.toList.mkString(" "))
      v = a(i)
      j = i - 1
      while(j >= 0 && a(j) > v){
        a(j+1) = a(j)
        j -= 1
      }
      a(j+1) = v
    }
    a
  }

  val r = insertionSort(ra, rn)
  println(r.toList.mkString(" "))
  
}



Measured memory_bytes: 46744
import math

N, D = map(int, input().split())
X = [[0]*D]*N

for i in range(N):
    X[i] = list(map(int, input().split()))

ans = 0

for i in range(N-1):
    for j in range(i+1, N):
        count = 0
        for k in range(D):
            count += (X[i][k] - X[j][k]) ** 2
        if math.sqrt(count).is_integer():
            ans += 1
            
print(ans)

Measured memory_bytes: 3064
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <bitset>
#include <deque>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <iterator>
#include <string>
#include <chrono>
#include <random>
#include <tuple>
#include <utility>
#include <fstream>
#include <complex>

int main(){
	long a, b, c;
    scanf("%ld%ld%ld", &a, &b, &c);
    if(4 * a * b < (c - b - a) * (c - b - a) && c - a - b > 0){
        printf("Yes\n");
    }else{
        printf("No\n");
    }
}


Measured memory_bytes: 256
#[allow(unused_macros)]
macro_rules ! input { ( source = $ s : expr , $ ( $ r : tt ) * ) => { let mut iter = $ s . split_whitespace ( ) ; let mut next = || { iter . next ( ) . unwrap ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; ( $ ( $ r : tt ) * ) => { let stdin = std :: io :: stdin ( ) ; let mut bytes = std :: io :: Read :: bytes ( std :: io :: BufReader :: new ( stdin . lock ( ) ) ) ; let mut next = move || -> String { bytes . by_ref ( ) . map ( | r | r . unwrap ( ) as char ) . skip_while ( | c | c . is_whitespace ( ) ) . take_while ( | c |! c . is_whitespace ( ) ) . collect ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; }
#[allow(unused_macros)]
macro_rules ! input_inner { ( $ next : expr ) => { } ; ( $ next : expr , ) => { } ; ( $ next : expr , $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let $ var = read_value ! ( $ next , $ t ) ; input_inner ! { $ next $ ( $ r ) * } } ; }
#[allow(unused_macros)]
macro_rules ! read_value { ( $ next : expr , ( $ ( $ t : tt ) ,* ) ) => { ( $ ( read_value ! ( $ next , $ t ) ) ,* ) } ; ( $ next : expr , [ $ t : tt ; $ len : expr ] ) => { ( 0 ..$ len ) . map ( | _ | read_value ! ( $ next , $ t ) ) . collect ::< Vec < _ >> ( ) } ; ( $ next : expr , chars ) => { read_value ! ( $ next , String ) . chars ( ) . collect ::< Vec < char >> ( ) } ; ( $ next : expr , usize1 ) => { read_value ! ( $ next , usize ) - 1 } ; ( $ next : expr , $ t : ty ) => { $ next ( ) . parse ::<$ t > ( ) . expect ( "Parse error" ) } ; }

#[allow(dead_code)]
pub const M: u64 = 1_000_000_007;

fn main() {
    input! {
        n: u64, m: u64
    }

    let mut a = vec![n,m];
    a.sort();
    let ret = if a[1] - a[0] > 1 {
        0
    } else {
        let mut r = fact(a[0], M) * fact(a[1], M) % M;
        if a[0] == a[1] {
            r *= 2;
            r %= M;
        }
        r
    };
    println!("{}", ret);
}

fn fact(n: u64, m: u64) -> u64 {
    if n == 1 {
        1
    } else {
        n * fact(n-1, m) % m
    }
}

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

int main()
{
	int n,m;
	int ans;
	scanf("%d",&n);
    for (int i=0;i<n;i++)
    {
    	scanf("%d",&m);
    	if (m%2==0)
    	{
    		ans++;
		}	
	}
	printf("%d",int(pow(3,n)-pow(2,ans)));
 	return 0;
} 

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

#define pb push_back
#define mk make_pair
#define lob lower_bound
#define upb upper_bound
#define fst first
#define scd second

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

inline int read(){
	int f=1,x=0;char ch=getchar();
	while(!isdigit(ch)){if(ch=='-')f=-1;ch=getchar();}
	while(isdigit(ch)){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}
inline ll readll(){
	ll f=1,x=0;char ch=getchar();
	while(!isdigit(ch)){if(ch=='-')f=-1;ch=getchar();}
	while(isdigit(ch)){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}

const int MAXN=4005;
struct EDGE{int nxt,to;}edge[MAXN];
int n,m,mm,head[MAXN],tot,ans,fa[MAXN],dep[MAXN],id1[MAXN],id2[MAXN];
inline void add_edge(int u,int v){edge[++tot].nxt=head[u];edge[tot].to=v;head[u]=tot;}
void dfs1(int u){dep[u]=dep[fa[u]]+1;for(int i=head[u];i;i=edge[i].nxt)if(edge[i].to!=fa[u])fa[edge[i].to]=u,dfs1(edge[i].to);}
pii p[MAXN],tp[MAXN];
bool used[MAXN],fl[MAXN],res[MAXN];
void del(int a,int b,int c,int d){
	static int cnt[MAXN];memset(cnt,0,sizeof(int)*(n+5));
	while(a!=b){if(dep[a]<dep[b])swap(a,b);cnt[a]++;a=fa[a];}
	while(c!=d){if(dep[c]<dep[d])swap(c,d);cnt[c]++;c=fa[c];}
	for(int i=1;i<=n;++i)if(cnt[i]>=2)fl[i]=1;
}
void dfs2(int u){
	for(int i=head[u];i;i=edge[i].nxt)if(edge[i].to!=fa[u])dfs2(edge[i].to);
	if(fa[u]){
		vector<int>vec;
		for(int i=1;i<=mm;++i)if(!used[i]&&((tp[i].fst==u)^(tp[i].scd==u))){vec.pb(i);if((int)vec.size()==2)break;}
		ans+=min(max((int)vec.size(),2*fl[u]),2);
		if((int)vec.size()<2||fl[u]){
			for(int i=1;i<=mm;++i)if(!used[i]){
				if(tp[i].fst==u)tp[i].fst=fa[u];
				if(tp[i].scd==u)tp[i].scd=fa[u];
			}
			return;
		}
		int a=vec[0],b=vec[1];
		del(tp[a].fst,tp[a].scd,tp[b].fst,tp[b].scd);
		used[a]=used[b]=1;
		++mm;
		if(tp[a].fst==u)tp[mm].fst=tp[a].scd,p[mm].fst=p[a].scd;
		else tp[mm].fst=tp[a].fst,p[mm].fst=p[a].fst;
		if(tp[b].fst==u)tp[mm].scd=tp[b].scd,p[mm].scd=p[b].scd;
		else tp[mm].scd=tp[b].fst,p[mm].scd=p[b].fst;
		id1[mm]=a;id2[mm]=b;
		for(int i=1;i<=mm;++i)if(!used[i]){
			if(tp[i].fst==u)tp[i].fst=fa[u];
			if(tp[i].scd==u)tp[i].scd=fa[u];
		}
	}
}
int main() {
	n=read();m=mm=read();
	for(int i=1,u,v;i<n;++i)u=read(),v=read(),add_edge(u,v),add_edge(v,u);
	for(int i=1;i<=m;++i)p[i].fst=tp[i].fst=read(),p[i].scd=tp[i].scd=read();
	dfs1(1);dfs2(1);
	printf("%d\n",ans);
	for(int i=mm;i>=1;--i){
		if(!used[i])res[i]=1;
		if(i>m){
			res[id1[i]]=res[i]^(p[i].fst!=p[id1[i]].fst);
			res[id2[i]]=res[i]^(p[i].scd!=p[id2[i]].scd);
		}
	}
	for(int i=1;i<=m;++i)if(res[i])printf("%d %d\n",p[i].fst,p[i].scd);else printf("%d %d\n",p[i].scd,p[i].fst);
	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define LLI long long int
#define FOR(v, a, b) for(LLI v = (a); v < (b); ++v)
#define FORE(v, a, b) for(LLI v = (a); v <= (b); ++v)
#define REP(v, n) FOR(v, 0, n)
#define REPE(v, n) FORE(v, 0, n)
#define REV(v, a, b) for(LLI v = (a); v >= (b); --v)
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define ITR(it, c) for(auto it = (c).begin(); it != (c).end(); ++it)
#define RITR(it, c) for(auto it = (c).rbegin(); it != (c).rend(); ++it)
#define EXIST(c,x) ((c).find(x) != (c).end())
#define fst first
#define snd second
#define popcount __builtin_popcount
#define UNIQ(v) (v).erase(unique(ALL(v)), (v).end())
#define bit(i) (1LL<<(i))

#ifdef DEBUG
#include <misc/C++/Debug.cpp>
#else
#define dump(...) ((void)0)
#endif

#define gcd __gcd

using namespace std;
template <class T> constexpr T lcm(T m, T n){return m/gcd(m,n)*n;}

template <typename I> void join(ostream &ost, I s, I t, string d=" "){for(auto i=s; i!=t; ++i){if(i!=s)ost<<d; ost<<*i;}ost<<endl;}
template <typename T> istream& operator>>(istream &is, vector<T> &v){for(auto &a : v) is >> a; return is;}
template <typename T, typename U> istream& operator>>(istream &is, pair<T,U> &p){is >> p.first >> p.second; return is;}

template <typename T, typename U> bool chmin(T &a, const U &b){return (a>b ? a=b, true : false);}
template <typename T, typename U> bool chmax(T &a, const U &b){return (a<b ? a=b, true : false);}
template <typename T, size_t N, typename U> void fill_array(T (&a)[N], const U &v){fill((U*)a, (U*)(a+N), v);}

/**
 * @brief 最長増加部分列の長さを求める。
 * @return 最長増加部分の長さ
 */
template <typename T> int lis(vector<T> &xs, T INF){
  vector<T> dp(xs.size(), INF);
  for(auto x : xs) dp[upper_bound(ALL(dp),x)-dp.begin()] = x;
  return lower_bound(ALL(dp),INF) - dp.begin();
}


int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int n;
  while(cin >> n){
    vector<int> a(n); cin >> a;
    for(auto &x : a) x = -x;
    int ans = lis(a, INT_MAX);
    cout << ans << endl;
  }
  
  return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <unordered_map>
#include <unordered_set>

using namespace std;

typedef unsigned long long ull;
typedef unsigned int uint;
typedef unsigned char uchar;
#define umap unordered_map
const static ull INVALID_DIGIT = ~(ull)0;

int main()
{
    int times[5];
    bool used[5] = { false, false, false, false, false };

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

    int totalTime = 0;
    int nextOrderTime = 0;
    int nextArrivalTime = 0;

    for (int usedCount = 0; usedCount < 5; usedCount++) {
        int minIdx = 0;
        int nextMinWaitTime = 100;
        for (int i = 0; i < 5; i++) {
            if (used[i]) {
                continue;
            }

            int divTime = times[i] % 10;
            int waitTime = 0;
            if (divTime == 0) {
                // no wait time
                waitTime = 0;
            }
            else {
                waitTime = 10 - divTime;
            }

            if (waitTime < nextMinWaitTime) {
                minIdx = i;
                nextMinWaitTime = waitTime;
            }
        }

        used[minIdx] = true;
        nextArrivalTime = nextOrderTime + times[minIdx];
        nextOrderTime += nextMinWaitTime + times[minIdx];
    }

    cout << nextArrivalTime << endl;

    return 0;
}

Measured memory_bytes: 256
import java.io.*;
  
class Main{
    public static void main(String[] args) throws Exception{
        
        String str;
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int i = 0;
        while((str = br.readLine()) != null){
            i++;
            if (str.equals("0")) {
                return;
            }
            System.out.println("Case " + i + ": " + str);
        }
    }
}

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

int main(){
  int n,i;
  cin >> n;
  string s;
  cin >> s;
  int ans=0;
  int x=0;
  for(i=0;i<n;++i){
    if(s[i]=='I'){
      x++;
      ans=max(ans,x);
    }else{
      x--;
    }
  }
  cout << ans << endl;
  return 0;
}


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

using namespace std;

#ifdef Lin1043
    #define DEBUG(msg, ...) printf("(%s #%d) " msg, __FUNCTION__, __LINE__, __VA_ARGS__)
    #define massert(...) assert(...)
#else
    #define DEBUG(...)
    #define massert(...)
#endif

#define rep(i , l , r) for(int i = (l) , ___ = (r) ; i <= ___ ; ++i )
#define per(i , r , l) for(int i = (r) , ___ = (l) ; i >= ___ ; --i )

struct iopener
{
    iopener()
    {
#ifdef Lin1043
        freopen("./in" , "r" , stdin);
#endif
    }
} iop;

typedef long long LL;

template<typename T>inline bool chkmin(T &x , const T &y) { return x > y ? (x = y , 1) : 0; }
template<typename T>inline bool chkmax(T &x , const T &y) { return x < y ? (x = y , 1) : 0; }

template<typename T>inline T read(T &f)
{
    f = 0; int x = 1 ; char c = getchar();
    while(!isdigit(c)) x = (c == '-' ? -1 : 1) , c = getchar();
    while(isdigit(c)) (f *= 10) += c & 15 , c = getchar();
    return f = x * f;
}

int l , r;

int main()
{
    read(l) , read(r);
    if(l > 0)
        puts("Positive");
    else if(r >= 0)
        puts("Zero");
    else if(l % 2 == r % 2)
        puts("Negative");
    else
        puts("Positive");
    return 0;
}


Measured memory_bytes: 256
// リストlinesに格納
function main(lines) {
  // 多分この+で新規って意味なんかも
  const K = +lines[0];
  const S = lines[1];
 
  // lengthなのはpythonと一緒で0~kまでをslice
  // ?は三項演算子trueならS.slice(0, K) + '...'
  // falseならそのままSを出力
  let res = K < S.length ? S.slice(0, K) + '...' : S;
 
  console.log(res);
}
 
 
main( require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n") );
 
 
//  入力自体はこっちでするのかも
function splitN(s) {
  return s.split(' ').map(Number);
}

Measured memory_bytes: 29420
import copy
N, L = map(int, input().split())

taste = list(range(1, N+1))
for a in range(0, N):
    taste[a] = taste[a] + L - 1

abs_taste = copy.deepcopy(taste)

for a in range(0, N):
    abs_taste[a] = abs(abs_taste[a])

taste.pop(abs_taste.index(min(abs_taste)))


print(sum(taste))


Measured memory_bytes: 3444
import sys
from collections import deque

n = int(input())
G = [[] for _ in range(n + 1)]
G_order = []
# a<bが保証されている、aを親、bを子とする
for i in range(n - 1):
    a, b = map(lambda x: int(x) - 1, input().split())
    G[a].append(b)
    G_order.append(b)

# どこでも良いが、ここでは0をrootとする
que = deque([0])

# 各頂点と「親」を結ぶ辺の色
# 頂点0をrootとするのでC[0]=0で確定, 他を調べる
colors = [0] * n

while que:
    # prt = 親
    # 幅優先探索
    prt = que.popleft()
    color = 0

    # cld = 子
    for cld in G[prt]:
        color += 1
        # 「今考えている頂点とその親を結ぶ辺の色」と同じ色は使えない
        if color == colors[prt]:
            color += 1
        colors[cld] = color
        que.append(cld)

# それぞれの頂点とその親を結ぶ辺の色
# print(colors)

# 必要な最小の色数
print(max(colors))

# 辺の番号順に色を出力
for i in G_order:
    print(colors[i])


Measured memory_bytes: 23148
#include<iostream>
#include<cstdio>
#include<queue>
using namespace std;
string S;
bool Map[100][100],Vis[100][100];
int Pos[]={1,-1,0,0,0,0,-1,1}, H, W, Max=0;
struct Poi {
	int x,y,dis;
};
queue<Poi> Q;
void BFS(int x,int y) {
	int dx,dy;
	for(int i=1;i<=H;i++)
		for(int j=1;j<=W;j++)
			Vis[i][j]=false;
	Poi t,k;
	t.x=x, t.y=y, t.dis=0;
	Vis[x][y]=true;
	Q.push(t);
	while(Q.size()) {
		t=Q.front();
		Q.pop();
		for(int i=0;i<4;i++) {
			dx=t.x+Pos[i], dy=t.y+Pos[i+4];
			if(dx>=1 && dx<=H && dy>=1 && dy<=W && !Vis[dx][dy] && Map[dx][dy]) {
				Vis[dx][dy]=true;
				k.x=dx,k.y=dy,k.dis=t.dis+1;
				if(k.dis>Max) Max=k.dis;
				Q.push(k);
			}
		}
	}
}
int main() {
	cin>>H>>W;
	for(int i=1;i<=H;i++)
		for(int j=1;j<=W;j++)
			Map[i][j]=false;
	for(int i=1;i<=H;i++) {
		cin>>S;
		for(int j=1;j<=W;j++) {
			if(S[j-1]=='.')
				Map[i][j]=true;
		}
	}
	for(int i=1;i<=H;i++) {
		for(int j=1;j<=W;j++) {
			if(Map[i][j])
				BFS(i,j);
		}
	}
	printf("%d\n",Max);
return 0;
}

Measured memory_bytes: 256