akhauriyash/Code-Regression huggingface dataset:
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int m = sc.nextInt();
    int[][] a = new int[m][2];
    for(int i = 0; i < m; i++) {
      a[i][0] = sc.nextInt();
      a[i][1] = sc.nextInt();
    }
    Arrays.sort(a, new Comparator<int[]>() {
      @Override
      public int compare(int[] o1, int[] o2) {
        return Integer.compare(o1[1], o2[1]);
      }
    });
    int ans = 0;
    int x = 0;
    for(int i = 0; i < m; i++) {
      if(x < a[i][0]) {
        x = a[i][1] - 1;
        ans++;
      }
    }
    System.out.println(ans);
  }
}

Measured memory_bytes: 90620
import math


def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


N, M = map(int, input().split())

if N >= 2 and M >= 2:
    print(combinations_count(N, 2) + combinations_count(M, 2))
elif N >= 2:
    print(combinations_count(N, 2))
elif M >= 2:
    print(combinations_count(M, 2))
else:
    print(0)

Measured memory_bytes: 3060
#include<iostream>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<set>
#include<unordered_set>
#include<vector>
#include<array>
#include<string>
#include<stack>
#include<queue>
#include<algorithm>
#include<cassert>
#include<functional>
#include<random>
#include<complex>
//#include<boost/multiprecision/cpp_int.hpp>
#define int int64_t
#define REP(i, a, b) for (int64_t i = (int64_t)(a); i < (int64_t)(b); i++)
#define rep(i, a) REP(i, 0, a)
#define EACH(i, a) for (auto i: a)
#define ITR(x, a) for (auto x = a.begin(); x != a.end(); x++)
#define ALL(a) (a.begin()), (a.end())
#define HAS(a, x) (a.find(x) != a.end())
#define Min(x) *min_element(ALL(x))
#define Max(x) *max_element(ALL(x))
#define Unique(L) (L.erase(unique(ALL(L)), L.end()))
using namespace std;
//typedef boost::multiprecision::cpp_int bigint;
const double EPS = 1e-9;
const double PI = acos(-1.0);

int query(const string &s1, const string &s2) {
	cout << s1 << endl << s2 << endl;
	fflush(stdout);
	string r;
	cin >> r;
	if (r == "end")return -1;
	return r[0] == 'T' ? 1 : 0;
}

signed main(void) {
	cin.tie(0);
	ios::sync_with_stdio(false);

	
	int N;
	cin >> N;
	vector<pair<string, string>>unit;
	int exist[4] = { 1,1,1,1 };
	bool flag = true;
	pair<string, string>ans;
	rep(i, 4) {
		exist[i] = query(i % 2 ? "#" : ".", i / 2 ? "#" : ".");
		if (exist[i] == -1)return 0;
		if (!exist[i])continue;
		unit.push_back(make_pair(i % 2 ? "#" : ".", i / 2 ? "#" : "."));
		if (flag)ans = unit[0];
		flag = false;
	}

	if (unit.size() == 1) {
		rep(i, N)cout << unit[0].first;
		cout << endl;
		rep(i, N)cout << unit[0].second;
		cout << endl;
		return 0;
	}

	bool right = true;
	while (ans.first.size() < N) {
		if (right) {
			bool ok = false;
			for (auto x : unit) {
				int i = query(ans.first + x.first, ans.second + x.second);
				if (i == -1)return 0;
				if (i == 1) {
					ans.first += x.first;
					ans.second += x.second;
					ok = true;
					continue;
				}
			}
			if (ok)continue;
			right = false;
		}
		for (auto x : unit) {
			int i = query(x.first + ans.first, x.second + ans.second);
			if (i == -1)return 0;
			if (i == 1) {
				ans.first = x.first+ans.first;
				ans.second = x.second+ans.second;
				continue;
			}
		}
	}
	cout << ans.first << endl << ans.second << endl;
}

Measured memory_bytes: 596
#include<bits/stdc++.h>
using namespace std;
 
#define pb push_back
#define ll long long
#define maxn 500005
#define fr(i,j,k) for(int i=j;i<k;i++)
#define f(n) fr(i,0,n)
#define f1(n) fr(i,1,n+1)
#define ms(i) memset(i,0,sizeof(i));
#define ms1(i) memset(i,-1,sizeof(i));
#define F first
#define S second
#define all(x) x.begin(), x.end()
const int mod = 1e9 + 7;

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    string s;
    cin >> s;
    ll n = 0;
    ll tot = 1;
    int cnt[26] = {};
    for (auto i:s) {
        int x = i - 'a';
        tot += n - cnt[x];
        cnt[x]++;
        n++;
    }
    cout << tot << '\n';
}

Measured memory_bytes: 720
#include <bits/stdc++.h>
#define ll long long
#define re register
#define IL inline
using namespace std;
const int maxn=300+5;
template<typename T> void fread(T &x){
	T f=1;x=0;
	char s=getchar();
	while(s<'0' || s>'9'){if(s=='-') f=-1;s=getchar();}
	while(s>='0' && s<='9'){x=(x<<3)+(x<<1)+s-48;s=getchar();}
	x*=f;
}
int n,a[maxn],d[4];
double f[305][605][905];
int main(){
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	scanf("%d",&n);
	for(re int i=1;i<=n;i++){
		scanf("%d",&a[i]);
		d[a[i]]++;
	} 
	for(re int i=0;i<=d[3];i++){
		for(re int j=0;j<=d[2]+d[3];j++){
			for(re int k=0;k<=d[1]+d[2]+d[3];k++){
				double tot=i+j+k;
				if(i) f[i][j][k]+=(double) f[i-1][j+1][k]*i/tot;
				if(j) f[i][j][k]+=(double) f[i][j-1][k+1]*j/tot;
				if(k) f[i][j][k]+=(double) f[i][j][k-1]*k/tot;
				if(tot) f[i][j][k]+=(double) n/tot; 
			}
		}
	}
	cout<<fixed<<setprecision(10)<<f[d[3]][d[2]][d[1]]<<endl;
	return 0;
}


Measured memory_bytes: 578216
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define int ll
#define uptil(a, b, i) for(int i = (a), b_ = (b); i < b_; ++i)
#define upto(a, b, i) for(int i = (a), b_ = (b); i <= b_; ++i)
#define downtil(a, b, i) for(int i = (a), b_ = (b); i > b_; --i)
#define downto(a, b, i) for(int i = (a), b_ = (b); i >= b_; --i)
#define times(n, i) uptil(0, n, i)
#define rtimes(n, i) downto((n)-1, 0, i)

#define sp <<" "
#define ln <<"\n"
#define size(v) ((int)(v).size())
template<class T> using vec=vector<T>;
template<class T> using vvec=vec<vector<T>>;

constexpr int mod = 1e9 + 7;

int fact[2001], fact_inv[2001];

int mpow(int a, int x) {
  int ret = 1;
  while(x) {
    if(x & 1) ret = ret * a % mod;
    a = a * a % mod;
    x /= 2;
  }
  return ret;
}

int nck(int n, int k) {
  if(n < k || k < 0) return 0;
  // cerr << "n " << fact[n] sp << fact_inv[k] sp << fact_inv[n - k] ln;
  return fact[n] * fact_inv[k] % mod * fact_inv[n - k] % mod;
}

void solve() {
  fact[0] = 1;
  times(2000, i) fact[i + 1] = fact[i] * (i + 1) % mod;

  // cerr << fact[2000] ln;

  fact_inv[2000] = mpow(fact[2000], mod - 2);
  rtimes(2000, i) fact_inv[i] = fact_inv[i + 1] * (i + 1) % mod;
  cerr << fact_inv[0] ln;

  int N, K; cin >> N >> K;
  upto(1, K, i) {
    if(N - K == 0) {
      cout << (i == 1 ? 1 : 0) ln;
    } else {
      cerr << nck(K - 1, i - 1) sp
        << nck(N - K - 1, i - 2) sp << nck(N - K - 1, i - 1) sp << nck(N - K - 1, i) ln;
      cout << nck(K - 1, i - 1) *
        ((nck(N - K - 1, i - 2) + nck(N - K - 1, i - 1) * 2 + nck(N - K - 1, i)) % mod) % mod ln;
    }
  }
}

signed main() {
  // cin.tie(0);
  cout << fixed << setprecision(20);
  cerr << fixed << setprecision(10);
  solve();
  return 0;
}


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

namespace AtCoderBeginnerContest177
{
	class Program
	{
		static void Main(string[] args)
		{
			var number = int.Parse(Console.ReadLine());
			var inputs = Console.ReadLine().Split().Select(x => long.Parse(x)).ToList();

			var mod = (int)Math.Pow(10, 9) + 7;
			var sum = inputs.Sum();
			var result = 0L;
			for (var i = 0; i < number - 1; i++)
			{
				sum -= inputs[i];
				result += inputs[i] * (sum % mod);
				result %= mod;
			}
			Console.WriteLine(result);
		}
	}
}


Measured memory_bytes: 47736
#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 int mod=998244353;
const llint big=2.19e18+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){
	cin.tie(0);ios::sync_with_stdio(false);
	int n,i,x,y;cin>>n;
	vector<int>A(n);
	for(i=0;i<n;i++){cin>>A[i];}
	x=0;
	for(i=0;i<n-1;i++){
		if(A[i]<=A[n-1]){
			swap(A[i],A[x]);
			x++;
		}
		
	}swap(A[x],A[n-1]);
	for(i=0;i<n;i++){
		if(i==x){cout<<"["<<A[i]<<"]";}
		else{cout<<A[i];}
		if(i==n-1){cout<<endl;}
		else{cout<<" ";}
	}
	return 0;
}


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

typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
const int INF = int (1e9) + int (1e5);
const ll INFL = ll(2e18) + ll(1e10);
const ui MOD = 1E9 + 7;
const double EPS = 1e-9;
#define FOR(i,n) for (int i=0;i<(n);++i)
#define ROF(i,x) for(int i = (x) ; i >= 0 ; --i)
#define MP make_pair
#define ALL(a) (a).begin(),(a).end()
#define ODD(x) (((x)&1)==0?(0):(1))
#define sign(x) ((x > 0) - (x < 0))
std::mt19937_64  generator(std::chrono::system_clock::now().time_since_epoch().count());

inline ll powmod(ll a,ll b,ll mod) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a, ll b) { return a ? gcd(b%a, a): b; }
ll lcm(ll a, ll b) { return a / gcd(a,b) * b; }


void READ(bool _local){
    ios_base::sync_with_stdio(false); cin.tie(0);
#ifdef _DEBUG
    if (_local)
        freopen ("in.txt", "r", stdin);
#endif
}

int main() {
    READ(0);
    string s,t;
    cin>>s>>t;
    int cnt=0;
    FOR(i,3) {cnt += s[i]==t[i];}
    cout << cnt;
    return 0;
}



Measured memory_bytes: 256
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

K, A, B = mapint()
if (B-A)/2<=1:
    print(K+1)
else:
    cnt = A
    rest = K - cnt + 1
    if rest<2:
        print(K+1)
    else:
        if rest%2==0:
            print(cnt+(B-A)*rest//2)
        else:
            rest -= 1
            cnt += 1
            print(cnt+(B-A)*rest//2)

Measured memory_bytes: 61916
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N, K = MAP()

ans = 0
for k in range(K, N+2):  # k ことる
	mi = k*(k-1)//2
	x = N-k
	ma = N*(N+1)//2 - x*(x+1)//2
	ans += ma-mi+1
	ans %= mod

print(ans%mod)


Measured memory_bytes: 68788
#include<bits/stdc++.h>
using namespace std;
int main()
{string s;
cin>>s;
if(s[2]=='N' and s[0]=='S')
cout<<"7";
else if(s[1]=='O')
cout<<"6";
else if(s[2]=='E')
cout<<"5";
else if(s[2]=='D')
cout<<"4";
else if(s[1]=='H')
cout<<"3";
else if(s[0]=='F')
cout<<"2";
else if(s[2]=='T')
cout<<"1";
return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner in = new Scanner(System.in);

    int n = in.nextInt();
    int m = in.nextInt();
    int l = in.nextInt();
    int[][] a = new int[n][m];
    int[][] b = new int[m][l];
    long[][] c = new long[n][l];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        a[i][j] = in.nextInt();
      }
    }
    for (int i = 0; i < m; i++) {
      for (int j = 0; j < l; j++) {
        b[i][j] = in.nextInt();
      }
    }
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < l; j++) {
        for (int k = 0; k < m; k++) {
          c[i][j] += a[i][k] * b[k][j];
        }
      }
    }
    for (int i = 0; i < n; i++) {
      System.out.print(c[i][0]);
      for (int j = 1; j < l; j++) {
        System.out.print(" " + c[i][j]);
      }
      System.out.println();
    }
  }
}

Measured memory_bytes: 53364
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<limits>
#include<set>
#include<queue>
using namespace std;
#define int long  long int
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }
typedef pair<int, int>P;
const int INF = 1e8;

int f(int num) {
	int cnt = 0;
	while(1){
		if (num % 2 == 1)break;
		cnt++;
		num /= 2;
	}
	return cnt;
}

signed main() {
	int N;
	cin >> N;
	int mx = -INF;
	int ans;
	for (int i = 1; i <= N; i++) {
		if (mx == -INF) {
			mx = f(i);
			ans = i;
		}
		else if (mx <= f(i)) {
			mx = f(i);
			ans = i;
		}
	}
	cout << ans;
}

Measured memory_bytes: 256
#pragma region header
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <math.h>
#include <cstring>
// ===============================================================
//using系
#pragma region header
using namespace std;
using ll = long long;
using lint = long long;
using ld = long double;
using ulint = unsigned long long;
const int dx[] = { 1,0,-1,0 };
const int dy[] = { 0,1,0,-1 };
constexpr lint mod = 1000000007;
constexpr long double pi = 3.141592653589793238462643383279;
#pragma endregion
// ========================================================================
//define
#define INF (lint)10000000000000000
#define mod = (int)1000000007;
#pragma endregion
int n;
vector<int> d;
void input() {
	cin >> n;
	d.resize(n);
	for (int i = 0; i < n; i++)
		cin >> d[i];
	return;
}
lint solve() {
	int cnt = 0;
	int ans = 0;
	bool h = true;
	for (int i = 0; i < n; i++) {
		if (d[i] == i + 1) {
			if (cnt == 0) { cnt++; h = true; }
			else cnt++;
		}
		else {
			h = false;
			if (cnt == 1) ans++;
			if (cnt > 1) ans += cnt / 2 + cnt % 2;
			cnt = 0;
		}
		if (i == n - 1 && h == true) {
			if (cnt == 1) ans++;
			else ans += cnt / 2 + cnt % 2;
		}
	}
	return ans;
}


int main(void) {
	input();
	printf("%lld\n", solve());

	return 0;
}

Measured memory_bytes: 3756
N = int(input())
nums = [int(x) for x in input().split()]

diff = [n - i - 1 for i, n in enumerate(nums) if n - i - 1 != 0]
if len(diff) == 0:
  print('YES')
elif len(diff) == 2 and sum(diff) == 0:
  print('YES')
else:
  print('NO')

Measured memory_bytes: 3060
import sys
def input(): return sys.stdin.readline().rstrip()

def main():
    H, W = map(int, input().split())
    a = [input() for _ in range(H)]
    a = [w for w in a if w.count('#') > 0]

    ans = [''] * len(a)
    for i in range(W):
        isOK = False
        for s in a:
            if s[i] == '#':
                isOK = True
                break
        if isOK:
            for j, s in enumerate(a):
                ans[j] += s[i]
    print(*ans, sep='\n')

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
import numpy as np                                                                                                                                                    
if __name__ == '__main__':
    N, C = map(int, input().split(' '))
    D = []
    for i in range(C):
        D.append(list(map(int, input().split(' '))))

    field = []
    for i in range(N):
        field.append(list(map(int, input().split(' '))))
    field = np.array(field) - 1

    res0 = {}
    res1 = {}
    res2 = {}
    for i in range(N):
        for j in range(N):
            if (i + j) % 3 == 0:
                if field[i][j] in res0.keys():
                    res0[field[i][j]] += 1
                else:
                    res0[field[i][j]] = 1
            if (i + j) % 3 == 1:
                if field[i][j] in res1.keys():
                    res1[field[i][j]] += 1
                else:
                    res1[field[i][j]] = 1
            if (i + j) % 3 == 2:
                if field[i][j] in res2.keys():
                    res2[field[i][j]] += 1
                else:
                    res2[field[i][j]] = 1

    res = 1e+10
    #iはあまり0のマスの色
    for i in range(C):
        #jはあまり0のマスの色
        for j in range(C):
            if i == j:
                continue
            #kはあまり0のマスの色
            for k in range(C):
                if i == k or j == k:
                    continue
                temp = 0
                for color in res0.keys():
                    temp += D[color][i] * res0[color]
                for color in res1.keys():
                    temp += D[color][j] * res1[color]
                for color in res2.keys():
                    temp += D[color][k] * res2[color]
                if temp < res:
                    res = temp
    print(res)                    

Measured memory_bytes: 18888
import java.math.BigInteger;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        String s;
        Scanner reader = new Scanner(System.in);
        s = reader.nextLine();

        String[] str;
        str = s.split(" ");
        BigInteger a = new BigInteger(str[0]);
        BigInteger b = new BigInteger(str[1]);

        BigInteger c = a.multiply(b);

        System.out.println(c);
    }
}



Measured memory_bytes: 247380
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int h = sc.nextInt();
		int w = sc.nextInt();
		int[][] res = new int[h][w];
		for(int i = 0; i < h; i++){
			int cnt = -1;
			char[] inp = sc.next().toCharArray();
			for(int j = 0; j < w; j++){
				if(inp[j] == 'c') cnt = 0;
				else if(cnt > -1) cnt++;
				res[i][j] = cnt;
			}
		}
		for(int i = 0; i < h;i++){
			for(int j = 0; j < w; j++){
				if( j != w - 1) System.out.print(res[i][j] + " ");
				else System.out.println(res[i][j]);
			}
		}

	}

}

Measured memory_bytes: 35000
from collections import deque
n, m = map(int, input().split())
INF = 100000000

to = [[] for _ in range(n)]
for i in range(m):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    to[a].append(b)
    to[b].append(a)
print('Yes')
q = deque([])
dist = [INF] * n
pre = [-1] * n
dist[0] = 0
q.append(0)

while len(q) > 0:
    v = q.popleft()
    for i in to[v]:
        if dist[i] != INF:
            continue
        dist[i] = dist[v] + 1
        pre[i] = v
        q.append(i)

for i in range(1, n):
    ans = pre[i]
    ans += 1
    print(ans)


Measured memory_bytes: 34792
import math
n = int(input())
a = [list(map(int, input().split())) for i in range(n)]
ans=0.0
for i in range(0, n-1):
    for j in range(i, n):
        ans+=math.sqrt(pow(a[i][0]-a[j][0], 2)+pow(a[i][1]-a[j][1], 2))
print(ans*2/n)


Measured memory_bytes: 3060
n,d = map(int,input().split())
d2 = d ** 2

xy2 = list()
for i in range(n):
    x,y = map(int,input().split())
    xy2.append(x**2+y**2)

    ans = 0
for i in xy2:
    if d2 >= i:
        ans += 1
print(ans)




Measured memory_bytes: 20084
#include<iostream>
#include<cstring>

using namespace std;

#define rep(i, n) for (int i = 0; i < int(n); ++i)
#define repn(i, m, n) for (int i = m; i < int(n); ++i)

char mem[1<<24];
int a[4], x[4][6], y[4][6], r[4][6];
int over[4][6];

int f(int bit) {
  if (mem[bit] != -1) return mem[bit];
  //cout << bit << endl;
  int res = 0;
  rep (i, 4) {
    rep (j, a[i]) {
      int bit1 = 1 << (i * 6 + j);
      //cout << i << " " << j << " " << over[i][j] << endl;
      if (bit & over[i][j] || !(bit & bit1)) continue;
      repn (k, j + 1, a[i]) {
	int bit2 = 1 << (i * 6 + k);
	//cout << bit << " " << bit1 << " " << bit2 << endl;
	if (bit & over[i][k] || !(bit & bit2)) continue;
	res = max(res, f(bit ^ bit1 ^ bit2) + 2);
      }
    }
  }
  return mem[bit] = res;
}

int main() {
  int n;
  for (;;) {
    cin >> n;
    if (n == 0) break;
    memset(a, 0, sizeof(a));
    memset(mem, -1, sizeof(mem));
    memset(over, 0, sizeof(over));
    rep (i, n) {
      int xx, yy, rr, cc;
      cin >> xx >> yy >> rr >> cc;
      --cc;
      x[cc][a[cc]] = xx;
      y[cc][a[cc]] = yy;
      r[cc][a[cc]] = rr;
      rep (i, 4) rep (j, a[i]) {
	if ((x[i][j] - xx) * (x[i][j] - xx) + (y[i][j] - yy) * (y[i][j] - yy) >= (r[i][j] + rr) * (r[i][j] + rr)) continue;
	over[cc][a[cc]] |= 1 << (i * 6 + j);
      }
      //cout << cc << " " << a[cc] << " " << over[cc][a[cc]] << endl;
      ++a[cc];
    }
    int bit = (1 << a[0]) - 1;
    bit |= (1 << 6 << a[1]) - (1 << 6);
    bit |= (1 << 12 << a[2]) - (1 << 12);
    bit |= (1 << 18 << a[3]) - (1 << 18);
    cout << f(bit) << endl;
  }
}

Measured memory_bytes: 16000
#![allow(unused_imports)]
#![allow(non_snake_case)]

use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::io::*;
use std::ops::*;
use std::*;

// -----------------------------------------------
// Framework
// -----------------------------------------------

#[allow(unused)]
fn rl() -> String {
    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.trim_right().to_owned()
}

#[allow(unused)]
fn rw<T>() -> Vec<T>
where
    T: std::str::FromStr,
    T::Err: std::fmt::Debug,
{
    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.split_whitespace()
        .map(|word| T::from_str(word).unwrap())
        .collect()
}

trait IteratorExt: Iterator + Sized {
    fn vec(self) -> Vec<Self::Item> {
        self.collect()
    }
}

impl<T: Iterator> IteratorExt for T {}

#[allow(unused)]
macro_rules! debug {
    ($($arg:expr),*) => {
        #[cfg(debug_assertions)]
        {
            let entries = &[
                $((
                    &stringify!($arg).to_string() as &fmt::Debug,
                    &($arg) as &fmt::Debug,
                )),*
            ];
            eprintln!("{:?}", DebugMap(entries));
        }
    };
}

#[allow(unused)]
struct DebugMap<'a>(&'a [(&'a fmt::Debug, &'a fmt::Debug)]);

impl<'a> std::fmt::Debug for DebugMap<'a> {
    fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
        let mut m = fmt.debug_map();
        for &(key, value) in self.0.iter() {
            m.entry(key, value);
        }
        m.finish()
    }
}

// -----------------------------------------------
// Polyfill
// -----------------------------------------------

#[derive(PartialEq, Eq, Clone, Debug)]
pub struct Rev<T>(pub T);

impl<T: PartialOrd> PartialOrd for Rev<T> {
    fn partial_cmp(&self, other: &Rev<T>) -> Option<Ordering> {
        other.0.partial_cmp(&self.0)
    }
}

impl<T: Ord> Ord for Rev<T> {
    fn cmp(&self, other: &Rev<T>) -> Ordering {
        other.0.cmp(&self.0)
    }
}

#[allow(unused)]
macro_rules! eprintln {
    ($($arg:expr),*) => { _eprintln(format_args!($($arg),*)) }
}

fn _eprintln(args: fmt::Arguments) {
    let err = std::io::stderr();
    let mut err = err.lock();
    err.write_fmt(args).unwrap();
    err.write(b"\n").unwrap();
}

// -----------------------------------------------
// Solution
// -----------------------------------------------

pub fn main() {
    let S: Vec<_> = rl().chars().collect();
    let T: Vec<_> = "AKIHABARA".chars().collect();
    let ok = S.len() <= T.len() && {
        let mut ok = true;
        let mut si = 0;
        let mut ti = 0;
        while ti < T.len() {
            if si < S.len() && S[si] == T[ti] {
                si += 1;
                ti += 1;
            } else if T[ti] == 'A' {
                ti += 1;
            } else {
                ok = false;
                break;
            }
        }
        ok
    };

    println!("{}", if ok { "YES" } else { "NO" });
    return;
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn test_ok() {
        assert_eq!(7, 1 + 2 * 3);
    }
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <functional>
#pragma warning(disable:4996)
#pragma comment(linker, "/STACK:336777216")
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
#define  int long long int
typedef complex<long double> cd;
const long double pi=acos(-1);
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <db, db> pdd;
typedef vector<int> vi;
typedef vector<vector<int> > matrix;
#define m1 make_pair
#define pb push_back
#define flush fflush(stdout)
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);
#define reset(x,v) memset(x,v,sizeof(x))
#define sz(x) (int)(x.size())
#define ff first
#define ss second
#define endl "\n"
#define debug(x) (cerr << #x << ": " << x << "\n")
#define setbits(x) __builtin_popcount(x)
inline ll gcd(ll a,ll b){if(a==0) return b;return gcd(b%a,a);}
inline ll power(ll a,ll n,ll m){if(n==0)return 1;ll p=power(a,n/2,m);p=(p*p)%m;if(n%2) return (p*a)%m;else return p;}
const ll MOD =998244353;
const ll hell=1000000007;
const int INF = 1e17;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;

typedef tree<int, null_type, less<int>, rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;
int32_t main()
{
    IOS;
    int n;
    cin>>n;
    int n1=n;
    n1=n1*100;
    int x=ceil((double)n1/108);
    //cout<<x<<endl;
    int y=x*108;
    y=y/100;
    if(y!=n)
    {
        cout<<":("<<endl;
    }
    else
        cout<<x<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<string>
#include<iostream>
using namespace std;
int dp[505050][27];
int nxt[20][505050];
int main()
{
	string s;
	cin >> s;
	for (int i = 0; i < 27; i++)dp[s.size()][i] = dp[s.size() + 1][i] = s.size() + 1;
	for (int i = s.size() - 1; i >= 0; i--)
	{
		dp[i][s[i] - 'a'] = i + 1;
		for (char z = s[i] + 1; z <= 'z' + 1; z++)dp[i][z - 'a'] = dp[dp[i][z - 'a' - 1]][z - 'a' - 1];
		for (char z = 'a'; z < s[i]; z++)dp[i][z - 'a'] = dp[dp[i][26]][z - 'a'];
		nxt[0][i] = dp[i][26];
	}
	nxt[0][s.size()] = nxt[0][s.size() + 1] = s.size() + 1;
	for (int i = 1; i < 20; i++)for (int j = 0; j <= s.size() + 1; j++)nxt[i][j] = nxt[i - 1][nxt[i - 1][j]];
	int query;
	scanf("%d", &query);
	for (int p = 0; p < query; p++)
	{
		int za, zb;
		scanf("%d%d", &za, &zb);
		za--;
		for (int i = 19; i >= 0; i--)if (nxt[i][za] <= zb)za = nxt[i][za];
		printf((za == zb) ? "Yes\n" : "No\n");
	}
}

Measured memory_bytes: 93444
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;

class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] input = br.readLine().split(" ");
        int a = Integer.parseInt(input[0]);
        int b = Integer.parseInt(input[1]);
        System.out.printf("%.6f%n", a * b / 3.305785);
    }
}


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

#define ld long double
#define ll long long
#define ALL(a)  (a).begin(),(a).end()
#define spa << " " <<
#define MP make_pair
ll MOD = 1e9+7;
//ll MOD = 998244353;
ll INF = 1e18;
void chmin(ll &a, ll b) { if (a > b) a = b; }
void chmax(ll &a, ll b) { if (a < b) a = b; }
void answer1(bool x){
  if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void answer2(bool x){
  if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void answer3(bool x){
  if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
void answer(bool x, ll y, ll z){
  if(x) cout<<y<<endl;else cout<<z<<endl;}   


int main(){
  ll i, j;
  //ll n;
  //cin >> n;
  ll a, b, c,d,e;
  cin >> a >> b >> c >> d;
  //string s; cin >> s;
  ll result = 0;
  bool judge = true;
  answer1(min(abs(c-a),max(abs(b-a),abs(b-c)))<=d);

  /*
  vector<ll> a(n);
  for(i=0;i<n;i++)
    cin >> a[i];
  //for(i=0;<n;i++)
  */





  return 0;
}

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

int main() {
    int n, c;
    cin >> n >> c;
    vector<vector<int>> d(c, vector<int>(c));
    for (auto& e : d) for (auto& f : e) cin >> f;
    vector<vector<int>> color(3, vector<int>(c));
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= n; j++) {
            int cij;
            cin >> cij, cij--;
            color[(i+j) % 3][cij]++;
        }
    }

    int ans = 1e9;
    for (int i = 0; i + 2 < c; i++) {
        for (int j = i + 1; j + 1 < c; j++) {
            for (int k = j + 1; k < c; k++) {
                vector<int> c3 { i, j, k };
                do {
                    int can = 0;
                    for (int l = 0; l < 3; l++) {
                        for (int m = 0; m < c; m++) {
                            can += color[l][m] * d[m][c3[l]];
                        }
                    }
                    ans = min(ans, can);
                } while (next_permutation(begin(c3), end(c3)));
            }
        }
    }

    cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define M 1000000007
using namespace std;long long k,I,A,xy,x[2],fib[2],a,i;double D;int dp[3],h;int main(){cin>>k;a=sqrt(k)/16;xy=(long long)(2*sqrt(k-a-0.01))-1;A=(xy+2)*(xy+2)/4;I=(xy+1)*(xy+1)/4+1;D=1.0*(A+I)/2;if(k<=D){x[1]=(k-I)*2;}else{x[1]=(A-k)*2+1;}x[0]=xy-x[1];for(h=0;h<2;h++){if(x[h]<3){fib[h]=x[h]+1;}else{dp[0]=1;dp[1]=2;dp[2]=3;for(i=3;i<=x[h];i+=3){dp[0]=(dp[1]+dp[2])%M;dp[1]=(dp[2]+dp[0])%M;dp[2]=(dp[0]+dp[1])%M;}fib[h]=dp[x[h]%3];}}cout<<(fib[0]*fib[1])%M<<endl;}

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


def main():
    """Function."""
    n = int(input())
    k = int(input())

    flag = 0
    temp = 1
    for _ in range(n):
        if flag == 0:
            if temp < k:
                temp = temp * 2
            else:
                temp += k
                flag = 1

        elif flag == 1:
            temp += k
    print(temp)


if __name__ == "__main__":
    main()


Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {
    static Scanner in = new Scanner(System.in);

    public static void main(String[] args) {
        String s = in.nextLine();
        while(s.contains("B")){
            s = s.replaceAll("^B|[01]B", "");
        }
        System.out.println(s);
    }
}


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

int main() {
	ios_base::sync_with_stdio( false );

	string S;
	cin >> S;

	bool result = true;

	for( int i = 0; i < S.size(); ++i ) {
		string p = ((i+1) & 1) ? "RUD" : "LUD";

		if( S[i] != p[0] && S[i] != p[1] && S[i] != p[2] ) {
			result = false;
		}
	}

	cout << (result ? "Yes" : "No") << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for (int i=0;i<(n);i++)

using namespace std;

vector<int> G[100005];

int main(){
  int N;
  cin >> N;
  REP(i,N - 1){
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  vector<bool> used(N, false);
  queue<int> black[2], white[2];
  black[0].push(0);
  white[0].push(N - 1);
  int bct = 0, wct = 0;
  while(true){
    int index = -1;
    bool haveblack = true;
    if(black[0].size()){
      index = 0;
    }else if(black[1].size()){
      index = 1;
    }else haveblack = false;
    while(haveblack && black[index].size()){
      int now_p = black[index].front();
      black[index].pop();
      bct++;
      for(int next : G[now_p]){
        if(used[next]) continue;
        black[!index].push(next);
        used[next] = true;
      }
    }
    bool havewhite = true;
    if(white[0].size()){
      index = 0;
    }else if(white[1].size()){
      index = 1;
    } else havewhite = false;
    while(havewhite && white[index].size() ){
      int now_p = white[index].front();
      white[index].pop();
      wct++;
      for(int next : G[now_p]){
        if(used[next]) continue;
        white[!index].push(next);
        used[next] = true;
      }
    }
    if(!havewhite && !haveblack) break;
  }
  cout << (bct - wct > 0 ? "Fennec" : "Snuke") << endl;
  return 0;
}


Measured memory_bytes: 5888
#include <bits/stdc++.h>
#define rep(i,n) for(long long i=0; i<n; i++)
#define Rep(i,n) for(long long i=1; i<n; i++)
#define ll long long
#include <math.h>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <queue>
#include <set>
#include <vector>


using namespace std;
#define PI acos(-1)
using P =pair<int,int>;

int main(){
    ll n;
    cin>>n;
    set<ll>s;
    ll a;
    rep(i,n){
        cin>>a;
        s.insert(a);
    }
    if(s.size()==n){
        cout<<"YES"<<endl;
        return 0;
    }
    cout<<"NO"<<endl;
    }


Measured memory_bytes: 12844
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector> 
#include<limits>
#include<numeric>
#include<math.h>
using namespace std;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define in(x) cin >> x
#define out(str) cout << str << endl

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int N,a,b,c,A,B,C;

int main(){
    cin>>N;
    rep(i,N){
        cin>>a>>b>>c;
        A=a*a;
        B=b*b;
        C=c*c;
        if(A+B==C||B+C==A||C+A==B){
            out("YES");
        }
        else{
            out("NO");
        }
    }
}



Measured memory_bytes: 3032
#include "bits/stdc++.h"
using namespace std;
using ll = long long; using ull = unsigned long long;
//#define int ll
using vb = vector<bool>; using vvb = vector<vb>;
using vi = vector<int>; using vvi = vector<vi>;
using vl = vector<ll>; using vvl = vector<vl>;
using pii = pair<int,int>; using pll = pair<ll,ll>;
#define FOR(i,a,b) for(ll i = (a); i < (ll)(b); ++i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) for(ll i = (ll)(n)-1;i >= 0;--i)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define eb(val) emplace_back(val)
const double PI = acos(-1);
const double EPS = 1e-10;
const ll MOD = 1e9+7;
void cioacc(){//accelerate cin/cout
  cin.tie(0);
  ios::sync_with_stdio(false);
}
signed main(){
  ll a,b,k;
  cin >> a >> b >> k >> k;
  int minor = (k&1?-1:1);
  cout << (a-b)*minor << endl;
}

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

using namespace std;

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = long long;
using P = std::tuple<int,int>;
using ui = unsigned int;

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

struct SegmentTree{
    SegmentTree(int n){
        size = 1;
        while(size < n){
            size *= 2;
        }
        for(int i=1;i<2*size;++i){
            data[i] = D;
        }
    }
    void propagate(int k){
        if(delayed[k]){
            data[k] = data2[k];
            if(k < size){
                data2[k*2] = data2[k*2+1] = data2[k];
                delayed[k*2] = delayed[k*2+1] = true;
            }
            delayed[k] = false;
        }
    }
    inline void update(int l, int r, ui x){
        _update(1, 0, size, l, r, x);
    }
    void _update(int k, int a, int b, int l, int r, ui x){
        propagate(k);

        if(b <= l || r <= a){return;}
        if(l <= a && b <= r){
            data2[k] = x;
            delayed[k] = true;
            propagate(k);
        }else{
            int mid = (a + b) / 2;
            _update(k * 2, a, mid, l, r, x);
            _update(k * 2 + 1, mid, b, l, r, x);
            data[k] = min(data[k*2], data[k*2+1]);
        }
    }
    ui minimum(int l, int r){
        return _minimum(1, 0, size, l, r);
    }
    inline ui _minimum(int k, int a, int b, int l, int r){
        propagate(k);

        if(b <= l || r <= a){return D;}
        if(l <= a && b <= r){return data[k];}
        int mid = (a + b) / 2;
        ui vl = _minimum(k * 2, a, mid, l, r),
            vr = _minimum(k * 2 + 1, mid, b, l, r);
        return min(vl, vr);
    }
    
    int size;
    bool delayed[400100]; // 伝搬されていないときtrue
    ui data[400100], data2[400100];
    const ui D = (1u << 31) - 1;
};

int N, Q;
SegmentTree segtree(100000);

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

    std::cin >> N >> Q;

    for(int i=0;i<Q;++i){
        int type, s, t;

        std::cin >> type >> s >> t;

        if(type == 0){
            ui x;
            std::cin >> x;

            segtree.update(s, t + 1, x);
        }else{
            std::cout << segtree.minimum(s, t + 1) << std::endl;
        }
    }
}



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

int comM(string str){
  int res = 0,sum = 0;
  if(str[1] == '+' || str.size() == 1) res = str[0]-'0';
  for(int i=0;i<str.size();i++) {
    if(str[i] =='*' && sum == 0) sum += (str[i-1]-'0') * (str[i+1]-'0');
    else if(str[i] =='*' && sum != 0) sum *= (str[i+1] - '0');
    else if(str[i] == '+') res += sum,sum = 0;
    if(str[i] == '+' && (i+1 == str.size()-1||str[i+2] != '*')) res += str[i+1]-'0';
  }
  return res+sum;
} 

int comL(string str) {
  int res = str[0]-'0';
  for(int i=0;i<str.size();i++)
    if(str[i] == '*') res *= (str[i+1]-'0');
    else if(str[i]=='+') res += (str[i+1]-'0');
  return res;
}

int main(){
  string str;
  cin >> str;
  int n;
  cin >> n;
  int M = comM(str);
  int L = comL(str);
  if(M==n && L == n) cout << "U"<<endl;
  else if(M==n) cout << "M"<<endl;
  else if(L==n) cout <<"L"<<endl;
  else cout << "I"<<endl;
  return 0;
}

Measured memory_bytes: 1208
#include <iostream>
#include <string>

using namespace std;

int main(){
    string s;
    cin>>s;
    for(int i=0;i<4;i++){
        cout<<s[i];
    }
    cout<<" ";
    for(int i=4;i<s.size();i++){
        cout<<s[i];
    }
    cout<<endl;
}

Measured memory_bytes: 256
// #pragma GCC optimize("Ofast")
// #pragma GCC target("avx,avx2,fma")
// #pragma GCC optimization ("unroll-loops")
#include <bits/stdc++.h>
using namespace std;

/********************************************************************/
#define M1 1000000007
#define M3 1000000009
#define M2 998244353
#define ll long long
#define ld long double
#define pll pair<ll,ll>
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,a,b) for(ll i=b-1;i>=a;i--)
#define forr(i,n) for(ll i=0;i<n;i++)
#define F first
#define S second
#define pb push_back
#define DB pop_back
#define mp make_pair
#define MT make_tuple
#define V(a) vector<a>
#define vi vector<ll>
#define endl '\n'
#define ce(ele) cout<<ele<<' '
#define cs(ele) cout<<ele<<'\n'
#define yep cout<<"YES"<<'\n'
#define nope cout<<"NO"<<'\n'
#define CASE(te) ll te; cin>>te; while(te--)
#define sor(v) sort(v.begin(),v.end())
#define rev(v) reverse(v.begin(),v.end())

/********************************************************************/
const double pi = 3.1415926535;
//const int mx = 69;
//char grid[mx][mx];
// ll blocked[mx][mx];
// ll vis[mx][mx];
/********************************************************************/
//FAST IO//
void FAST() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
}

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

ll power(ll x,ll y,ll p) 
{ 
    ll res = 1; 
    x = x % p; 
    while (y > 0) 
    {  
        if (y & 1) 
         res = (res * x) % p; 
        y = y >> 1; 
        x = (x * x) % p; 
    } 
    return res; 
} 

bool isprime(ll n) 
{ 
    if (n <= 1) 
        return false; 
    if (n <= 3) 
        return true; 
    if (n % 2 == 0 || n % 3 == 0) 
        return false; 
    for (ll i = 5; i * i <= n; i = i + 6) 
        if (n % i == 0 || n % (i + 2) == 0) 
            return false; 
    return true; 
} 
  

vector<ll> digit(ll n)
{
    ll arr[10000];
    ll i=0;
    ll j,r;
    vi v;
    while(n!=0)
    {
        r = n % 10;
        arr[i] = r;
        i++;
        n = n / 10;
    }
    for(j=i-1;j>-1;j--)
    {
        v.pb(arr[j]);
    }
    return v;
}

ll sum(ll x) {
	ll ans = 0;
	while (x > 0) {
		ans += (x % 10);
		x /= 10;
	}
	return ans;
}

bool opp(int x, int y)
{
    return ((x ^ y) < 0);
}

bool bysec(const pair<int,int> &a, const pair<int,int> &b) 
{ 
    return (a.second < b.second); 
}

int main()
{
  FAST();
  ll n;
  cin>>n;
  vi x,y,v,w;
  forr(i,n)
  {
      ll a,b;
      cin>>a>>b;
      x.pb(a);
      y.pb(b);
  }
  forr(i,n)
  {
      v.pb(x[i]+y[i]);
      w.pb(x[i]-y[i]);
  }
  sor(v);sor(w);rev(v);rev(w);
  cs(max((v[0]-v[n-1]),(w[0]-w[n-1])));
}


Measured memory_bytes: 11440
#define ENABLE_DEBUG 1
// Kana's kitchen {{{
#include<bits/stdc++.h>
#define ALL(v) std::begin(v),std::end(v)
#define LOOP(k) for(i64 ngtkana_is_a_genius=0; ngtkana_is_a_genius<(i64)k; ngtkana_is_a_genius++)

using i32 = std::int_least32_t;
using i64 = std::int_least64_t;
using u32 = std::uint_least32_t;
using u64 = std::uint_least64_t;
using usize = std::size_t;

template <class T> using vec = std::vector<T>;
template <class T> using numr = std::numeric_limits<T>;

#ifdef NGTKANA
#include<debug.hpp>
#else
#define DEBUG(...)(void)0
#endif
/*}}}*/
struct permutations {
    static vec<usize> mul(vec<usize> const& a, vec<usize> const& b) {
        assert(a.size()==b.size());
        vec<usize> ans(a.size());
        for (usize i=0; i<a.size(); i++) {
            ans.at(i) = a.at(b.at(i));
        }
        return ans;
    }

    static vec<usize> inv(vec<usize> const& a) {
        vec<usize> ans(a.size());
        for (usize i=0; i<a.size(); i++) {
            ans.at(a.at(i)) = i;
        }
        return ans;
    }

    template <class T>
    static vec<usize> pow(vec<usize> a, T b) {
        vec<usize> ans(a.size());
        std::iota(ans.begin(), ans.end(), 0u);
        for (; b; b>>=1) {
            if (b&1) ans = mul(ans, a);
            a = mul(a, a);
        }
        return ans;
    }
};
int main(){
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
    std::cout << std::setprecision(15) << std::fixed;

    usize n;
    std::cin >> n;
    vec<i64> a(n);
    for (i64& x: a) std::cin >> x;

    usize m, k;
    std::cin >> m >> k;
    vec<usize> p(n-1);
    std::iota(ALL(p), 0u);
    while (m--) {
        usize x;
        std::cin >> x;
        x-=2;
        std::swap(p.at(x), p.at(x+1));
    }

    p = permutations::pow(p, k);

    vec<i64> ans(n);
    ans.at(0) = a.at(0);
    for (usize i=0; i<n-1; i++) {
        usize j = p.at(i);
        ans.at(i+1) = ans.at(i) + a.at(j+1) - a.at(j);
    }
    assert(a.back()==ans.back());

    for (i64 x: ans) {
        std::cout << x << '\n';
    }
}


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

#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define vecp(p) int aa;cin>>aa;(p).push_back(aa);
#define vecpl(p) long long aa;cin>>aa;(p).push_back(aa);
#define vecps(p) string aa;cin>>aa;(p).push_back(aa);
#define vecp2(p) cin>>aa;(p).push_back(aa);
#define vecpl2(p) long long a	b;cin>>ab;(p).push_back(ab);
#define vecps2(p) string ab;cin>>ab;(p).push_back(ab);
#define set0(k,n) for(int nn=0;nn<(n);nn++){ (k).push_back(0); }
#define sorts(c) sort((c).begin(),(c).end());
#define reverses(c) reverse((c).begin(),(c).end());
#define vec(b) vector<int> (b);
#define vecl(b) vector<long long> (b);
#define vecs(b) vector<string> (b);
#define vecsize(b,size) vector<int> (b)((size));
#define pb(b,a) (b).push_back((a));
#define doublece(a,b) cout<<(a)<<' '<<(b)<<endl;
#define pairs(s) vector<pair<int,int>> (s);
#define pairsl(s) vector<pair<ll,ll>> (s);
#define pairss(s) vector<pair<string,string>> (s);
#define pairsp(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairspl(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairsps(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairsREV(s) (s).push_back(make_pair(bb,aa));
#define pairslREV(s) (s).push_back(make_pair(bb,aa));
#define pairssREV(s) (s).push_back(make_pair(bb,aa));
#define MOD 1000000007
ll dp[110000][10][13];
int main()
{
	string S;
	cin >> S;
	
	if (S.at(0)=='?') {
		fw(10) {
			dp[1][w][w] =1;
		}
	}
	else {
		int k = S.at(0) - '0';
		dp[1][k][k] =1;
	}



	fx(S.size()) {
		if (x == 0)continue;
		if (S.at(x)=='?') {
			fz(10) {
				fy(13) {
					fw(10) {
						dp[x + 1][z][(y * 10 + z) % 13] += dp[x][w][y];
						dp[x + 1][z][(y * 10 + z) % 13] %= MOD;
					}
				}
			}
		}
		else {
			int k = S.at(x) - '0';
			fy(13) {
				fw(10) {
					
					dp[x + 1][k][(y * 10 + k) % 13] += dp[x][w][y];
					dp[x + 1][k][(y * 10 + k) % 13] %= MOD;
				}
			}
		}

	}

	ll ans = 0;
	fz(10) {
		ans += dp[S.size()][z][5];
		ans %= MOD;
	}
	ce(ans)	
    return 0;
}



Measured memory_bytes: 103040
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(ll i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(ll i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(ll i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((ll)(x).size())
#define len(x) ((ll)(x).length())

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // std::ifstream in("input.txt");
    // std::cin.rdbuf(in.rdbuf());
    string s;
    cin >> s;
    set<ll> idxs;
    ll sl = len(s);
    rep(i, sl - 1) {
        if ((s[i] == 'R') && (s[i + 1] == 'L')) {
            idxs.insert(i);
        }
    }
    vector<ll> ans(sl, 0);
    rep(i, sl) {
        auto it = idxs.lower_bound(i);
        if (s[i] == 'R') {
            ll idx = *it;
            ll dist = idx - i;
            if (dist % 2 == 0) {
                ans[idx]++;
            }
            else {
                ans[idx + 1]++;
            }
        }
        else {
            it--;
            ll idx = *it;
            ll dist = i - idx;
            if (dist % 2 == 0) {
                ans[idx]++;
            }
            else {
                ans[idx + 1]++;
            }
        }
    }
    rep(i, sl) {
        printf("%lld%s", ans[i], (i == (sl - 1)) ? "\n" : " ");
    }
    return 0;
}


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

//repetition
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)

//container util
#define all(x) (x).begin(),(x).end()

//typedef
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VLL;
typedef vector<VLL> VVLL;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;


//conversion
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}


int main(){
  double T,X;
  cin >> T >> X;
  printf("%0.10f\n",T/X);
  return 0;
}


Measured memory_bytes: 256