akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cmath>

using namespace std;

int main(void){
    long long x, d, k;
    cin >> x >> d >> k;
    x = abs(x);
    if(d > (x/k)){
        d -= x/k;
        x = x % k;
        // cout << x << ' ' << d << ' ' << k << endl;
        if(d%2==0)
            cout << x;
        else
            cout << abs(x-k);
    }
    else
        cout << x-(d*k);
    return 0;
}

Measured memory_bytes: 3668
import scala.io.StdIn

object Main extends App {
  val n = StdIn.readLine
  val ans = StdIn.readLine.split(" ").map(_.toInt)
    .sorted(Ordering[Int].reverse).toVector.par
    .zipWithIndex
    .foldLeft(0){ (acc,e) =>
      acc + ( if((e._2 & 1) == 0) e._1 else -e._1 )
    }

  println(ans)
}


Measured memory_bytes: 29484
integer :: n,l
      integer :: azi(200),piAziTrue,eat,absMin
      
      read*,n,l
      
      do i = 1,n
        azi(i) = l + i - 1
      end do
      
      piAziTrue = sum(azi(1:n))
      
      absMin = maxval( abs(azi(1:n)) )
      do i = 1,n
        if( abs(azi(i))<=absMin )then
          absMin = abs(azi(i))
          eat = azi(i)
        end if
      end do
      
      print*,piAziTrue - eat
      
      
      end


Measured memory_bytes: 2916
#include <algorithm>  
#include <iostream>  
#include <sstream>  
#include <string>  
#include <cstring>
#include <vector>  
#include <queue>  
#include <set>  
#include <map>  
#include <cstdio>  
#include <cstdlib>  
#include <cctype>  
#include <cmath>  
#include <list>  
#include <cassert>
#include <ctime>
#include <climits>
using namespace std;  

#define PB push_back  
#define MP make_pair  
#define SZ(v) ((int)(v).size())  
#define FOR(i,a,b) for(int i=(a);i<(b);++i)  
#define REP(i,n) FOR(i,0,n)  
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)  
#define REPE(i,n) FORE(i,0,n)  
#define FORSZ(i,a,v) FOR(i,a,SZ(v))  
#define REPSZ(i,v) REP(i,SZ(v))  
typedef long long ll;
typedef unsigned long long ull;
ll gcd(ll a,ll b) { return b==0?a:gcd(b,a%b); }

int n;
vector<pair<int,int>> edges;

void solve() {
	edges.clear();
	if(n%2==1) {
		FORE(i,1,n) FORE(j,1,n) if(j!=i&&j!=n-i&&i<j) edges.PB(MP(i,j));
	} else {
		FORE(i,1,n) FORE(j,1,n) if(j!=i&&j!=n-i+1&&i<j) edges.PB(MP(i,j));
	}
	//vector<int> sum(n,0); REPSZ(i,edges) sum[edges[i].first-1]+=edges[i].second,sum[edges[i].second-1]+=edges[i].first;
	//bool samesum=true; FOR(i,1,n) if(sum[i]!=sum[0]) samesum=false; if(!samesum) printf("err\n");
}

void run() {
	scanf("%d",&n);
	solve();
	printf("%d\n",SZ(edges));
	REPSZ(i,edges) printf("%d %d\n",edges[i].first,edges[i].second);

}

void research() {
	FORE(n,2,7) {
		vector<pair<int,int>> edges; REP(i,n) FOR(j,i+1,n) edges.PB(MP(i,j));
		REP(mask,1<<SZ(edges)) {
			vector<bool> reach(n,false); queue<int> q; reach[0]=true; q.push(0);
			while(!q.empty()) { int at=q.front(); q.pop(); REPSZ(i,edges) if(mask&(1<<i)) if(edges[i].first==at||edges[i].second==at) { int to=edges[i].first+edges[i].second-at; if(!reach[to]) reach[to]=true,q.push(to); } }
			bool reachall=true; REP(i,n) if(!reach[i]) reachall=false; if(!reachall) continue;
			vector<int> sum(n,0); REPSZ(i,edges) if(mask&(1<<i)) sum[edges[i].first]+=edges[i].second+1,sum[edges[i].second]+=edges[i].first+1;
			bool samesum=true; FOR(i,1,n) if(sum[i]!=sum[0]) samesum=false; if(!samesum) continue;
			printf("%d [%d]:",n,sum[0]); REPSZ(i,edges) if(mask&(1<<i)) printf(" (%d,%d)",edges[i].first+1,edges[i].second+1); puts("");
		}
	}
}

void stress() {
	FORE(n,3,100) solve();
}

int main() {
	//research();
	run();
	//stress();
	return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <string>

long long N;
std::map<int, int> alpah;
long long num_pairs;
int A;

int main() {
  std::cin >> N;
  for (int k = 0; k < N; k++) {
    std::cin >> A;
    num_pairs += alpah[k-A];
    ++alpah[k+A];
  }
  std::cout << num_pairs << std::endl;
}

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


def solve(N: int, K: int):
    ret = 0
    if K == 0:
        ret = N * N
    else:
        for k in range(K + 1, N + 1):
            tmp = N // k
            mod = N % k
            ret += tmp * (k - K)
            ret += max(0, mod - K + 1)
            #print(k, tmp, k - K, mod, ret)
    print(ret)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    solve(N, K)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <cmath>
#include <numeric>
using namespace std;
#define rep(i,a,b) for(int64_t i=(a); i<(b); ++i) // a ≦ i < b 
#define Rrep(i,a,b) for(int64_t i=(a);i>=(b);--i) // reverse repeat. a から b まで減少．
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend() //逆イテレータ
#define RANGE(a,b,c) (a).begin()+b,(a).begin()+c // [b,c) イテレータ
#define MOD 1000000007
#define INF 1000000000
typedef pair<int64_t, int64_t> PII;
typedef vector<int64_t> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<PII> VP;

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

string s; cin >> s;

int mini = INF;
rep(i, 0, 26){
    int cnt = 0;
    char c = i + 'a';
    string t = s;
    bool f = !all_of(ALL(s), [c](char i){return i == c;});
    while(f){
        f = false;
        string v;
        rep(i, 0, t.size()-1){
            if (t[i] == c || t[i+1] == c) v += c;
            else {
                v += t[i];
                f = true;
            }
        }
        ++cnt;
        t = v;
    }
    mini = min(mini, cnt);
}

cout << mini << endl;


}
// 書いて考える
// 境界，出力文字列 チェック
// 可読性優先．高速化次点．
// まずは全探索，分割統治，次にDP
// 制限を見る．境界に注意．求めたい量の変域．
// 偶奇，逆から，ソート，出現回数，出現位置，DP， 余事象，包除
// データ構造． 問題の特徴量．単調性，二分探索
// 存在判定：構成方法，入力の特徴
// gcd, lcm ,素因数分解．
// 例外を十分に含む一般化．想像力の限界
// 小さい系から例示
// 代数的処理
// 始めは過剰に例示・場合分けしてもいい．各場合を確実に対処．
// 自明な例から処理，除外．
// 小数のときは，精度の設定する．doubel 変数に数値を入力するときは 123. とする．
// テストケース作成は数表あり



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
int findLowerBound(
    vector<pair<int, int>> &arr,
    pair<int, int> &p)
{

    auto low = lower_bound(arr.begin(),
                           arr.end(), p);

    return low - arr.begin();
}
int findUpperBound(
    vector<pair<int, int>> &arr,
    pair<int, int> &p)
{
    auto up = upper_bound(arr.begin(),
                          arr.end(), p);

    return up - arr.begin();
}
bool vis[200005];
vector<int> vec[100005];
int child[100005];
void dfs(int node)
{
    vis[node] = 1;
    for (int i = 0; i < vec[node].size(); i++)
    {
        if (!vis[vec[node][i]])
        {
            dfs(vec[node][i]);
            child[node] += child[vec[node][i]];
        }
    }
}
int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    string str;
    int n;
    cin >> n;
    int k;
    cin >> k;
    vector<pair<int, int>> vec;
    for (int i = 0; i < n; i++)
    {
        int a, b;
        cin >> a >> b;
        vec.push_back({a, b});
    }
    sort(vec.begin(), vec.end());
    int ind = 0;
    for (int i = 0; i < n; i++)
    {
        ind += vec[i].second;
        if (ind >= k)
        {
            cout << vec[i].first << "\n";
            break;
        }
    }
    return 0;
}


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

using namespace std;
using ll = long long;
using ld = long double;

void solve() {
  int x;
  cin >> x;

  if (x >= 30)
    cout << "Yes\n";
  else
    cout << "No\n";
}

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);

  solve();
  return 0;
}


Measured memory_bytes: 3636
n,m=map(int,input().split())
L=[]
x=m/n
for i in range(1,min(int(x)+1,int(m**0.5)+1)):
  if m%i==0:
    if i<=x:
      L.append(i)
    if m//i<=x:
      L.append(m//i)
print(max(L))

Measured memory_bytes: 3060
#include <cstdio>
#define rep(i,l,n) for(int i = l; i < (n); i++)
using namespace std;
using ll = long long;
int main() {
  int a = 100000,b = 200000,c = 300000;
  int x,y,ans = 0;
  scanf("%d %d",&x,&y);
  if(x == 3) ans += a;
  else if(x == 2) ans += b;
  else if(x == 1) ans += c;
  if(y == 3) ans += a;
  else if(y == 2) ans += b;
  else if(y == 1) ans += c;
  if(x == 1 && y == 1) ans += 400000;
  printf("%d\n",ans);
  return 0;
}

Measured memory_bytes: 128
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solve();
    }
    public void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int N = scan.nextInt();
        int K = scan.nextInt();
        int[] m = new int[K];
        long answer = 0;
        for (int i = 1; i <= N; i++) {
            m[i % K] += 1;
        }
        for (int a = 0; a < K; a++) {
            int b = (K - a) % K;
            int c = (K - a) % K;
            if ((b + c) % K != 0) {
                continue;
            }
            answer += (long) m[a] * m[b] * m[c];
        }
        System.out.println(answer);
    }
}


Measured memory_bytes: 23764
#include<stdio.h>
 
int main(void){
	int i,temp,temp2;
	int a[4];

	for(i=0;i<4;i++){
	scanf("%d",&a[i]);
	}
 	
 	if(a[1] < a[3]) temp = a[1];
 	else temp = a[3];
	
	

 	if(a[0] < a[2]) temp2 = a[2];
 	else temp2 = a[0];


 	if(0 > temp - temp2)
 		printf("%d\n",0);
 	else
    printf("%d\n",temp - temp2);
	
	return 0;
}

Measured memory_bytes: 128
parseInt(x) = parse(Int, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)
function main()
    flg=true
    n=parseInt(readline())
    a=parseMap(split(readline()))
    for i in a
        if i%2==0 && i%3 * i%5!=0
            flg=false
            break
        end
    end
    print(ifelse(flg,"APPROVED","DENIED"))
end
main()

Measured memory_bytes: 162956
# -*- coding: utf-8 -*-
import sys
N,M,K=map(int, sys.stdin.readline().split())

par=[ i for i in range(N+1) ]
size=[ 1 for i in range(N+1) ]

def root(x):
    while par[x]!=x:
        x=par[x]
    return x

def same(x,y):
	return root(x)==root(y)

def unite(x,y):
    x=root(x)
    y=root(y)
    if x==y: return
    if size[y]<size[x]: x,y=y,x  #yの要素数を大きくする
    size[y]+=size[x]
    par[x]=y #yが親ノード

def getsize(x):
	return size[root(x)]

al_ok=[ 0 for i in range(N+1) ]	#隣接で友達関係のカウント

for _ in range(M):
    a,b=map(int, sys.stdin.readline().split())
    unite(a,b)
    al_ok[a]+=1
    al_ok[b]+=1

al_ng=[ 0 for i in range(N+1) ]	#隣接でブロックしている人のカウント
for _ in range(K):
    c,d=map(int, sys.stdin.readline().split())
    if same(c,d):
        al_ng[c]+=1
        al_ng[d]+=1

for i in range(1,N+1):
    print getsize(i)-1-al_ok[i]-al_ng[i],


Measured memory_bytes: 38428
n,m = map(int,input().split())
judge = [True for i in range(n+1)]
for i in range(m):
    judge[int(input())] = False
dp = [0]*(n+1)
dp[0] = 1
for i in range(n):
    if judge[i + 1]:dp[i+1] += dp[i]
    if i + 2 > n:continue
    if judge[i + 2]:dp[i+2] += dp[i]
print(dp[-1]%1000000007)

Measured memory_bytes: 469580
n = int(input())
p = ''.join(input().split())
q = ''.join(input().split())

from itertools import permutations

all = list(permutations(list(map(str,range(1,n+1))), n))
all = list(map(lambda x: ''.join(x), all))
all.sort()
print(abs(all.index(p) - all.index(q)))



Measured memory_bytes: 46960
#include<iostream>
using namespace std;
int main(){
  int a,t[1000000],u[1000000];
  for(int i=0;i<1000000;i++){
    t[i]=1;
  }
  t[0]=t[1]=u[0]=u[1]=0;
  for(int i=2;i<=1000000;i++){
    if(t[i]==1){
      for(int j=i+i;j<1000000;j+=i)t[j]=0;
      u[i]=u[i-1]+1;
    }else{
      u[i]=u[i-1];
    }
  }
  while(cin>>a){
    cout<<u[a]<<endl;
  }
  return 0;
}

Measured memory_bytes: 8968
void main(){
	
	auto SW = readLine!size_t();
	if( SW[0] <= SW[1] ){
		writeln("unsafe");
	} else {
		writeln("safe");
	}
}


import std.stdio, std.string, std.conv;
import std.math, std.algorithm, std.array;
import std.regex;

T[] readLine( T = size_t )( string sp = " " ){
	T[] ol;
	foreach( string elm ; readln().chomp().split(sp) ){
		ol ~= elm.to!T();
	}
	return ol;
}

Measured memory_bytes: 3212
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const ll MOD = 1000000007;
const ll INF = 1061109567;
const double EPS = 1e-10;

int main(){

    int N,X,T;
    cin>>N>>X>>T;
    int a;
    if(N%X==0){
      a=N/X;
    }else{
      a=N/X+1;
    }
    cout<<a*T<<endl;
    return 0;
}


Measured memory_bytes: 3624
#include<iostream>
#include<vector>
using namespace std;
int main(){
    int h,w;
    cin >> h >> w;
    vector<string> str(h);
    vector<string> nstr(h);
    for(int i=0; i<h; i++){
        cin >> str[i];
    }
    nstr = str;
    const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
    const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
    for(int i=0; i<h; i++){
        for(int j=0; j<w; j++){
            if(str[i][j]=='#'){
                //nstr[i][j] = str[i][j];
                continue;
            }
            int num=0;
            for(int k=0; k<8; k++){
                const int ni = i + dx[k];
                const int nj = j + dy[k];

                if(ni<0 or h <= ni ) continue;
                if(nj<0 or w <= nj ) continue;
                if(str[ni][nj] == '#' ) num++;
            }
            nstr[i][j] = char(num+'0');
        }
    }
    
    for(int i=0; i<h; i++){
        for(int j=0; j<w; j++){
            cout << nstr[i][j];
        }
        cout << endl;
    }

}



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

#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
#define MOD 1000000007

using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

int iy[]={0, 0, 1, -1};
int ix[]={1, -1, 0, 0};

int n, m;

int main(){
	cin >> n;
	int a=n;
	for(int i=0;i<10;i++){
		m += n%10;
		n /= 10;
	}
	if((m+a)%m==0){
		cout << "Yes" << endl;
	}else{	
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
n = int(input())
res_a = 0
res_b = 0
dic_len = {1:0,2:0,3:1,4:11,5:111,6:1111}
for i in range(1,n+1):
    istr = str(i)
    leni = len(istr)
    ifirst, ilast = istr[0], istr[-1]
    if ifirst == ilast:
        res_a += 1
        if i >= 10:
            res_b += 1
        if leni > 2:
            imid = istr[1:-1]
            res_b += max(int(imid),0)
    elif ifirst > ilast and ilast!='0':
        res_b += int(10**(leni-2))
    if ilast!='0':
        res_b += dic_len[leni]
print(res_a+2*res_b)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i, a) for (ll i = 0; i < (a); ++i)
#define pb push_back
#define all(v) v.begin(),v.end()
#define sort_1(v) sort(v.begin(),v.end())
#define sort_2(v) sort(v.begin(),v.end(),greater<ll>())
#define reverse(v) reverse(v.begin(),v.end())
typedef long long ll;
typedef long double la;
using namespace std;

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

int main(){
  int n;
  cin >> n;
  vector<int> ans;
  for(int i=1;i<=n-1;i++){
    ans.pb(digit(i) + digit(n-i));
  }
  sort_1(ans);
  cout << ans[0] << endl;
}

Measured memory_bytes: 892
import java.math.BigInteger;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Scanner;
import java.util.Set;

public class Main {

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		BigInteger n = sc.nextBigInteger();
		
		BigInteger base = new BigInteger("26");
		StringBuilder buf = new StringBuilder();
		while( n.compareTo(BigInteger.ZERO) > 0 ) {
			BigInteger[] divideAndRemainder = n.subtract(BigInteger.ONE).divideAndRemainder(base);
			n=divideAndRemainder[0];
			char ch = (char) ('a'+divideAndRemainder[1].intValue());
			
			buf.append(ch);
			
		}
		System.out.println(buf.reverse().toString());
	}

}



Measured memory_bytes: 35952
A, B, C, D = [int(x) for x in input()]
tmp = []

def dfs(P):
    global tmp
    if len(P)==3:
        tmp.append(P[:])
        return
    
    for op in ['+', '-']:
        P.append(op)
        dfs(P)
        P.pop()
        
dfs([])
for ops in tmp:
    ans = A
    for op, i in zip(ops, [B,C,D]):
        if op=='+':
            ans += i
        else:
            ans -= i
    if ans==7:
        print('{}{}{}{}{}{}{}=7'.format(A, ops[0], B, ops[1], C, ops[2], D))
        break

Measured memory_bytes: 3064
import Data.Bool
import Data.List
import Control.Arrow
import Data.Tuple

main = do 
  test <- getLine
  target <- getLine
  putStrLn (bool "No" "Yes" (isRotated test target))

isRotated x y = do
  let tops = elemIndices (head x) y
  let candidates = (map (flip splitAt y) >>> map (swap >>> uncurry (++))) tops
  any (== x) candidates

Measured memory_bytes: 508
#include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>

using namespace std;

using ll = long long;
using ld = long double;

const ld pi = 3.141592653589793;
char a;
int main() {
  cin >> a;
  if ('a' <= a && a <= 'z') {
    cout << "a" << endl;
  } else {
    cout << "A" << endl;
  }
}

Measured memory_bytes: 3616
// nlather (Nishant Raj Lather)
// Chrollo_Lucifer

#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define MOD 1e9+7
#define boost ios_base::sync_with_stdio(false);cin.tie(nullptr);
#define rep(i, x, n) for(ll i = x; i < n; i++)
#define rrep(i, x, n) for(ll i = x; i >= n; i--)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define endl '\n'
#define ff first
#define ss second
#define pb push_back
#define eb emplace_back
#define e emplace
#define mp make_pair
double PI=3.14159265358979323846;
typedef long long int ll;
typedef long double ld;
typedef pair< ll, ll > pii;
typedef vector< ll > vi;
typedef vector< vi > vvi;

#define maxSelf(a, b) a=max(a, b);

int main()
{
	string a, b;
	cin >> a >> b;
	vector< vector< pair< ll, pii > > > dp(a.length() + 1, vector< pair< ll, pii > > (b.length() + 1, {0, {0, 0}}));
	rep(i, 0, a.length()) rep(j, 0, b.length()) {
		if(a[i] == b[j]) maxSelf(dp[i + 1][j + 1], mp(dp[i][j].ff + 1, mp(i, j)));
		maxSelf(dp[i + 1][j], mp(dp[i][j].ff, mp(i, j)));
		maxSelf(dp[i][j + 1], mp(dp[i][j].ff, mp(i, j)));
	}
	auto ans = mp(0LL, mp(0LL, 0LL));
	rep(i, 0, a.length() + 1) rep(j, 0, b.length() + 1) maxSelf(ans, mp(dp[i][j].ff, mp(i, j)));
	pii last = ans.ss;
	string s;
	while(last.ss and last.ff) {
		ll i = last.ff, j = last.ss;
		if(dp[i][j].ss == mp(i - 1, j - 1) and a[i - 1] == b[j - 1]) s += a[i - 1];
		last = dp[i][j].ss;
	}
	reverse(all(s));
	cout << s << endl;
}



















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

def main(A, B):
    if(A<=B-1):
        print(2*B-1)
    elif(A==B):
        print(2*B)
    else:
        print(2*A-1)
            

if __name__ == '__main__':
    A, B = map(int, input().split())
    
    main(A, B)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n) ;i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
using ll=long long;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define MOD  1000000007
const ll INF=1e18;
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(int argc, char const *argv[]) {
  int n;
  cin >> n;
  vector<pll> xy(n);
  rep(i,n) cin >> xy[i].fi >>xy[i].se;
  map<pll,int> cnt;

  rep(i,n){
    rep(j,n){
    if(i==j) continue;
    cnt[{xy[i].fi-xy[j].fi , xy[i].se-xy[j].se}]++;
    }
  }
  int ans=n;
  for(auto p:cnt){
    ans=min(ans,n-p.se);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 384
#define loop(i, s, e) for(ll i = s;i < e;i++)

#include <iostream>
#include <iomanip>
#include <set>
#include <vector>
#include <queue>
#include <stack>
#include <utility>
#include <algorithm>
#include <map>
#include <cmath>

using namespace std;

typedef long long signed ll;

template <typename T>
class Vector2D {
public:
    T x;
    T y;
    Vector2D(){
        x = y = 0;
    }
    Vector2D(T x_,T y_){
        x = x_;
        y = y_;
    }
    T operator*(const Vector2D<T> *e) {
        return this->x * e->x + this->y * e->y;
    }
    Vector2D<T> operator-(const Vector2D<T> *e) {
        return Vector2D<T>(this->x - e->x ,this->y - e->y);
    }
    Vector2D<T> operator+(const Vector2D<T> *e) {
        return Vector2D<T>(this->x + e->x ,this->y + e->y);
    }
    T operator*(const Vector2D<T> e) {
        return this->x * e.x + this->y * e.y;
    }
    Vector2D<T> operator-(const Vector2D<T> e) {
        return Vector2D<T>(this->x - e.x ,this->y - e.y);
    }
    Vector2D<T> operator+(const Vector2D<T> e) {
        return Vector2D<T>(this->x + e.x ,this->y + e.y);
    }
    Vector2D<T> operator*(const T r) {
        return Vector2D<T>(this->x * r ,this->y * r);
    }
    Vector2D<T> operator/(const T r) {
        return Vector2D<T>(this->x / r ,this->y / r);
    }
    double abs(){
        return sqrt(x*x+y*y);
    }
    T abs2(){
        return x*x+y*y;
    }
};

int main() {
    int x,y,q;
    Vector2D<double> base,p,pp,t;
    cin >> x >> y;
    base = Vector2D<double>(x,y);
    cin >> x >> y >> q;
    p = Vector2D<double>(x,y) - base;
    loop(i,0,q){
        cin >> x >> y;
        pp = Vector2D<double>(x,y) - base;
        t = (p * (p * pp / p.abs2()));
        Vector2D<double> tt;
        tt = (t - pp) * 2 + pp + base;
        cout << setprecision(16) << tt.x << " " << tt.y << endl;
    }
}




Measured memory_bytes: 3272
import java.util.Scanner;

/**
 *
 * @author joeco
 */
public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        
        Scanner in = new Scanner(System.in);
        int d =  in.nextInt();
        int t =  in.nextInt();
        int s =  in.nextInt();
        System.out.println((d/(double)s<=t) ? "Yes" : "No");
        
    }
    
    
    
}


Measured memory_bytes: 35808
//atcoder clange
#include <stdio.h>

int main(void){
    int A,B,T;
      scanf("%d", &A);//数値の取得
 	 scanf("%d", &B);//数値の取得
	  scanf("%d", &T);//数値の取得
  int num = A;
  int count = 0;
    while(num < T+0.5){
      	count = count + B;
		num = num + A;
    }
    

    printf("%d",count);
    return 0;
}

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

int main() {
    int w, h, x, y, r;
    cin >> w >> h >> x >> y >> r;
    if (0 <= x - r && x + r <= w && 0 <= y - r && y + r <= h) cout << "Yes" << endl;
    else cout << "No" << endl;
}



Measured memory_bytes: 3116
#include <iostream>
#include <vector>
#include <stack>
#include <utility>

using vvb = std::vector<std::vector<bool>>;

struct TimeStamp
{
    int discovered;
    int finished;
};

std::vector<TimeStamp> dfs(const vvb& edges)
{
    using namespace std;

    int time {1};
    const int n = edges.size();
    stack<int> st;
    vector<bool> reached(n);
    vector<TimeStamp> times(n);

    //すべての辺について行う
    for (int i = 0; i < n; ++i)
    {
        if (reached[i])
            continue;

        reached[i] = true;
        times[i].discovered = time++;
        st.push(i);
        
        //点jからつながるすべての辺を調べる
        while (!st.empty())
        {
            int top = st.top();
            for(int j = i + 1; j < n; ++j)
                if (!reached[j] && edges[top][j])
                {
                    reached[j] = true;
                    times[j].discovered = time++;
                    st.push(j);
                    break;
                }

            //その点からの探索候補がなければ前の点に戻る
            if (top == st.top())
            {
                times[top].finished = time++;
                st.pop();
            }
        }
    }

    return times;
}

void solve()
{
    using namespace std;

    int n;
    cin >> n;

    vvb edges(n, vector<bool>(n));

    //読み込み
    for (int i = 0; i < n; ++i)
    {
        int u, k;
        cin >> u >> k;

        for (int j = 0; j < k; ++j)
        {
            int v;
            cin >> v;
            edges[u - 1][v - 1] = true;
        }
    }

    auto times = dfs(edges);

    for (int i = 0; i < n; ++i)
    {
        cout << i + 1 << " " << times[i].discovered << " " << times[i].finished << endl;
    }
}

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


Measured memory_bytes: 3156
#include<iostream>
#include<algorithm>
#include<vector>
#include<stdio.h>
#include<cstring>
#include<math.h>
#include<map>
#include<bitset>
#include<iomanip>
#include<queue>
using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
using P = pair<int, int>;

long long N, K;
long long h[200000];

int main() {
  cin >> N >> K;
  for(long long i = 0; i < N; i++) {
    cin >> h[i];
  }
  sort(h, h+N);
  long long ans = 0;
  for(long long i = 0; i < N-K; i++) {
    ans += h[i];
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1792
# Python program to find Excel column name from a  
# given column number 
  
MAX = 50
  
# Function to print Excel column name  
# for a given column number 
def printString(n): 
  
    # To store result (Excel column name) 
    string = [" "] * MAX
  
    # To store current index in str which is result 
    i = 0
  
    while n > 0: 
        # Find remainder 
        rem = n % 26
  
        # if remainder is 0, then a  
        # 'Z' must be there in output 
        if rem == 0: 
            string[i] = 'Z'
            i += 1
            n = (n // 26) - 1
        else: 
            string[i] = chr((rem - 1) + ord('a')) 
            i += 1
            n = n // 26
    string[i] = ' '
  
    # Reverse the string and print result 
    string = string[::-1] 
    return(string)

T = printString(int(input()))
V = [t.lower() for t in T if t != " "]
print("".join(V))

Measured memory_bytes: 61916
// -*- coding:utf-8-unix -*-

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        s: chars
    }
    let mut dp = vec![vec![0; 13]; s.len()+1];
    dp[0][0] = 1;
    let mut pow = 1;
    let m = 1000000007;
    for i in 0..s.len() {
        let c = s[s.len()-i-1];
        if c == '?' {
            for j in 0..10 {
                for k in 0..13 {
                    let a = (pow*j+k) % 13;
                    dp[i+1][a] = (dp[i+1][a] + dp[i][k]) % m;
                }
            }
        } else {
            let j = c as usize - 48;
            for k in 0..13 {
                let a = (pow*j+k) % 13;
                dp[i+1][a] = (dp[i+1][a] + dp[i][k]) % m;
            }
        }
        pow = (pow * 10) % 13;
    }
    println!("{}", dp[s.len()][5]);
}

Measured memory_bytes: 14588
import java.util.Scanner;

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

		if(S.charAt(2)==S.charAt(3) && S.charAt(4)==S.charAt(5)) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
		scan.close();
	}
}


Measured memory_bytes: 23124
n, k = map(int, input().split())
a = list(map(int, input().split()))

b = [0] * n
for i in range(n):
    b[a[i] - 1] += 1

b.sort(reverse=True)

ans = 0

for i in range(k):
    ans +=b[i] 

if n - ans <= 0:
    print(0)
else:
    print(n - ans) 

Measured memory_bytes: 76368
import sys
readline = sys.stdin.readline

N = int(readline())
graph = [[] for _ in range(N + 1)]
for i in range(N - 1):
    a, b = map(int, readline().split())
    graph[a].append(b)
    graph[b].append(a)

parent = [0] * (N + 1)
order = []
stack = [1]
while stack:
    x = stack.pop()
    order.append(x)  # 行きがけ順探索リスト
    for y in graph[x]:
        if y == parent[x]:
            continue
        parent[y] = x  # 親ノードを記録
        stack.append(y)

MOD = 10**9 + 7
half = pow(2, MOD - 2, MOD)
power_inv = [1] * (N + 1)
size = [1] * (N + 1)
for i, v in enumerate(order[::-1], 1):
    p = parent[v]
    x = size[v]  # vの子孫ノード数（自分も含む）をとる
    size[p] += x  # 親にノード数を加算
    power_inv[i] = power_inv[i - 1] * half % MOD  # [1, 1/2, 1/4, ...]

ans = sum((1 - power_inv[i] - power_inv[N - i] + power_inv[N]) % MOD for i in size[2:])  # 解法1の確率式：辺iがSに含まれるための必要十分条件
ans += (1 - power_inv[N]) - N * power_inv[1]  # + 「(空グラフでない」 - N/2 
ans %= MOD

print(ans)

Measured memory_bytes: 59304
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin >> n;
	int a[n+2];
	for(int i=1;i<=n;i++)
		cin >> a[i];
	int x[n+1],y[n+1],l[n+1],r[n+1];
	a[0]=INT_MAX;
	a[n+1]=INT_MAX;
	stack <int> s,k;
	s.push(0);
	k.push(0);
	for(int i=1;i<=n;i++){
		stack <int> t;
		while(a[s.top()]<a[i]){
			t.push(s.top());
			k.pop();
			s.pop();
			while(k.top()!=s.top())
				k.pop();
		}
		l[i]=s.top();
		k.pop();
		if(k.empty())
			k.push(0);
		while(a[k.top()]<a[i])
			k.pop();
		x[i]=k.top();
		k.push(s.top());
		while(!t.empty()){
			k.push(t.top());
			t.pop();
		}
		s.push(i);
		k.push(i);
	}
	while(!s.empty())
		s.pop();
	while(!k.empty())
		k.pop();
	s.push(n+1);
	k.push(n+1);
	for(int i=n;i>=1;i--){
		stack <int> t;
		while(a[s.top()]<a[i]){
			t.push(s.top());
			k.pop();
			s.pop();
			while(k.top()!=s.top())
				k.pop();
		}
		r[i]=s.top();
		k.pop();
		if(k.empty())
			k.push(n+1);
		while(a[k.top()]<a[i])
			k.pop();
		y[i]=k.top();
		k.push(s.top());
		while(!t.empty()){
			k.push(t.top());
			t.pop();
		}
		s.push(i);
		k.push(i);
	}
	long long sum=0;
	for(int i=1;i<=n;i++){
		sum+=a[i]*((l[i]-x[i])*(long long)(r[i]-i)+(y[i]-r[i])*(long long)(i-l[i]));
	}
	cout << sum << endl;
}

Measured memory_bytes: 2944
import collections
N, K = map(int, input().split())
A_list = list(map(str,input().split()))

ans = 0
c = collections.Counter(A_list)
if K >= len(c):
    ans = 0
else:
    foo = len(c)-K
    bar_list = list(c.values())
    bar_list.sort()
    for i in range(foo):
        ans += bar_list[i]

print(ans)

Measured memory_bytes: 35996
#include <iostream>
#include<string>
#include <cassert>
#include <algorithm>
#include <functional>
#include<stdio.h>

using namespace std;

int main() {
	int N;
	int i, j = 0;
	int A[200];
	int flag = 0;
	cin >> N;

	for (i = 1; i <= 9; ++i) {
		for (j = 1; j <=9; ++j) {
			A[i] = i * j;
			if (N == A[i]) {
				++flag;
			}
	
		}
	}


	if (flag == 0) {
		cout << "No" << endl;
	}
	else if (flag != 0) {
		cout << "Yes" << endl;
	}
	

}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
int main()
{
	int A, B,c,d,e;
	scanf("%d%d", &A, &B);
	c = A + B;
	d = c - 24;
	e = 0;
	if (c <24)
	{
		printf("%d\n", c);
	}
	else
	{
		if (c == 48)
		{
			printf("%d\n",e);
		}
		else printf("%d\n", d);
	}
	system("pause");
}

Measured memory_bytes: 504
N, M, K = map(int,input().split())
MOD = 10**9+7

def framod(n, mod, a=1):
    for i in range(1,n+1):
        a=a * i % mod
    return a

def power(n, r, mod):
    if r == 0: return 1
    if r%2 == 0:
        return power(n*n % mod, r//2, mod) % mod
    if r%2 == 1:
        return n * power(n, r-1, mod) % mod

def comb(n, k, mod):
    a=framod(n, mod)
    b=framod(k, mod)
    c=framod(n-k, mod)
    return (a * power(b, mod-2, mod) * power(c, mod-2, mod)) % mod

# 0~N*M-1までの1次元上と考える
ans = 0

def f(x):
    return x*(x+1)//2

c = comb(N*M-2,K-2,MOD)

for i in range(N*M):
    tate, yoko = i//M, i%M
    migi = f(M-1-yoko)
    hidari = f(yoko)
    sita = (hidari+migi)*(N-1-tate) + M*f(N-1-tate)
    coef = migi + sita
    ans += coef*c
    ans %= MOD
print(ans)


    
    
    

Measured memory_bytes: 41452
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int s;
    cin>>s;
    int hrs=(s/3600);
    int j=(s%3600);
    int mins=(j/60);
    int secs=(j%60);
    cout<<hrs<<":"<<mins<<":"<<secs<<endl;
}



Measured memory_bytes: 3136
while True:
  ( H, W) = [ int(i) for i in input().split()]
  if H == W == 0:
    break
 
  for h in range( H):
    for w in range( W):
      if h == 0 or h == H-1:
        print( '#', end='')
      elif w == 0 or w == W-1:
        pass
        print( '#', end='')
      else:
        print( '.', end='')
    print()
  print()

Measured memory_bytes: 6808
#include <bits/stdc++.h>
using namespace std;
struct point{
	double x,y;
	point(){;}
	point(double x,double y):x(x),y(y){;}
	point operator -(point p){
		return point(x-p.x,y-p.y);
	}
};
// ??????p3??¨p1p2????????§ 
double direction(point p1, point p2, point p3) {
	return (p2.x - p1.x)*(p3.y - p2.y) - (p3.x - p2.x)*(p2.y - p1.y);
}
bool isjiao(point p1,point p2,point p3,point p4){
	// ?????????????????????????????¨????????????????????????
	double a,b,c,d;
	a=direction(p1,p2,p3);
	b=direction(p1,p2,p4);
	c=direction(p3,p4,p1);
	d=direction(p3,p4,p2);
	if(abs(a+b)<max(abs(a),abs(b))&&abs(c+d)<max(abs(c),abs(d)))return true;
	return false; 
}
double waiji(point p1,point p2){
	return p1.x*p2.y-p1.y*p2.x;
}
double neiji(point p1,point p2){
	return p1.x*p2.x+p1.y*p2.y;
}
// ?????????????????????????§???????		
double dis(point p,point p1,point p2){
	point v1,v2,v;
	v1=p2-p1;
	v2=p1-p2;
	v=p-p1;
	if(neiji(v,v1)<0)
		return sqrt((p.x-p1.x)*(p.x-p1.x)+(p.y-p1.y)*(p.y-p1.y));
	v=p-p2;
	if(neiji(v,v2)<0)
		return sqrt((p.x-p2.x)*(p.x-p2.x)+(p.y-p2.y)*(p.y-p2.y));
	// ?????°??????????????´??????
	return abs(waiji(v,v2))/sqrt(v2.x*v2.x+v2.y*v2.y); 
}
point p1,p2,p3,p4;
double solve(){
// ??????????????????1???????????°????????????????????????2???????????°??????1??????		
	if(isjiao(p1,p2,p3,p4))return 0;
	double res=min(dis(p1,p3,p4),dis(p2,p3,p4));
	res=min(res,dis(p3,p1,p2));
	res=min(res,dis(p4,p1,p2));
	return res;
}
int main(){
//	freopen("a.txt","r",stdin);
	int T;
	cin>>T;
	while(T--){
		cin>>p1.x>>p1.y;
		cin>>p2.x>>p2.y;
		cin>>p3.x>>p3.y;
		cin>>p4.x>>p4.y;
		printf("%.10f\n",solve()); 
	}
	return 0;
}

Measured memory_bytes: 3264
K = gets.to_i
X, Y = gets.split.map(&:to_i)

def go(x, y)
  case
  when x < 0
    x, y = go(-x, y)
    [-x, y]
  when y < 0
    x, y = go(x, -y)
    [x, -y]
  when x > y
    x, y = go(y, x)
    [y, x]
  when x + y >= 2*K
    [x, y - K]
  when x + y == K
    [0, 0]
  else
    d = K - (x + y)/2
    [-d, y - K + x + d]
  end
end

if K.even? && (X + Y).odd?
  puts -1
else
  res, x, y = [], X, Y
  until [x, y] == [0, 0]
    res << [x, y]
    x, y = go(x, y)
  end
  puts res.size
  res.reverse_each{|a| puts a.join(' ')}
end

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

int main() {
    long long int H;
    int N;
    cin >> H >> N;
    vector<int> A(N);
    for(int i = 0; i < N; i++) {
        cin >> A[i];
    }
    for(int i = 0; i < N; i++) {
        H -= A[i];
    }
    string messages = "No";
    if(H <= 0) {
        messages = "Yes";
    }
    cout << messages << endl;
    return 0;
}

Measured memory_bytes: 640
import sys
input=sys.stdin.readline
n,m=map(int,input().split())
from collections import defaultdict
branch=defaultdict(set)
for i in range(m):
    u,v=map(int,input().split())
    branch[u-1]|={v-1}
s,t=map(int,input().split())
s-=1
t-=1
dist=[[float('inf')]*3 for i in range(n)]
check={(s,0)}
dist[s][0]=0
while len(check)>0:
    now,nowd=check.pop()
    for nex in branch[now]:
        if dist[nex][(nowd+1)%3]>dist[now][nowd]+1:
            dist[nex][(nowd+1)%3]=dist[now][nowd]+1
            check|={(nex,(nowd+1)%3)}
if dist[t][0]>10**18:
    print(-1)
else:
    print(dist[t][0]//3)

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



int main() {
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);  
   	int n,m;
   	cin>>n>>m;
   	map<int,int> table;
   	for(int i = 0; i < n; i++) {
   		int k;
   		cin>>k;
   		for(int j = 0; j < k; j++) {
   			int x;
   			cin>>x;
   			table[x]++;
   		}
   	}

   	int count = 0;
   	for(auto it : table) {
   		if(it.second == n) {
   			count++;
   		}
   	}
   	cout<<count;
	return 0;		
}



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

int main(){
	long long int A, B, ans;
	cin >> A >> B;
	ans = 0;

	if(B - A < 10){
		for(long long int i = A; i <= B; i++){
			ans ^= i;
		}
	} else {
		for(; A % 4 != 0; A++) ans ^= A;
		for(; B % 4 != 3; B--) ans ^= B;
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
typedef vector<int> VI;
typedef long long ll;
typedef pair<int,int> PII;
typedef double db;
bool comp(int a,int b){
return a>b;
}
mt19937 mrand(random_device{}());
const ll mod=1000000007;
int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b) {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 b?gcd(b,a%b):a;}
int main()
{
	fast;
    char a;
    cin>>a;
    if(a>='a' && a<='z')
    cout<<"a";
    else
    cout<<"A";

}



Measured memory_bytes: 3596
import Data.Array.IO
import Data.Array.Unboxed
import Control.Monad

inf = 10^9

main = do
  (n:ma:mb:_) <- getLine >>= return . map read . words :: IO [Int]
  dat <- getContents >>= return . map (map read . words) . lines :: IO [[Int]]

  arr <- newArray ((0,0,0),(n*10,n*10,n)) inf :: IO (IOArray (Int,Int,Int) Int)

  writeArray arr (0,0,0) 0
  forM_ (zip [0..] dat) $ \(k, (a:b:c:_)) -> do
    forM_ [0..n*10] $ \i -> do
      forM_ [0..n*10] $ \j -> do
        readArray arr (i,j,k) >>= \c1 -> do
          when (c1 /= inf) $ do
            readArray arr (i,j,k+1) >>= \c2 -> writeArray arr (i,j,k+1) (min c1 c2)
            readArray arr (i+a,j+b,k+1) >>= \c2 -> writeArray arr (i+a,j+b,k+1) (min (c1+c) c2)
  
  res <- forM (takeWhile (\(a,b) -> a<=n*10 && b<=n*10) $ map (\r -> (ma*r,mb*r)) [1..]) (\(a,b) -> readArray arr (a,b,n)) >>= return . filter (/=inf)

  print $ if res == [] then -1 else minimum res


Measured memory_bytes: 75644
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long
#define ld long double
 
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
 
template <typename T> using oset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
 
string to_string(char c) {
	return string(1, c);
}
string to_string(bool b) {
	return b ? "true" : "false";
}
string to_string(const char* s) {
	return string(s);
}
string to_string(string s) {
	return s;
}
string to_string(vector<bool> v) {
	string res;
	for(int i = 0; i < (int) v.size(); i++)
		res += char('0' + v[i]);
	return res;
}
 
template<size_t S> string to_string(bitset<S> b) {
	string res;
	for(int i = 0; i < S; i++)
		res += char('0' + b[i]);
	return res;
}

template<class T> string to_string(T v) {
    bool f = 1;
    string res;
    for(auto& x : v) {
		if(!f)
			res += ' ';
		f = 0;
		res += to_string(x);
	}
    return res;
}
 
void DBG() {
	cerr << "]" << endl;
}

template<class H, class... T> void DBG(H h, T... t) {
	cerr << to_string(h);
	if(sizeof...(t))
		cerr << ", ";
	DBG(t...);
}

#ifdef _DEBUG
#define dbg(...) cerr << "LINE(" << __LINE__ << ") -> [" << #__VA_ARGS__ << "]: [", DBG(__VA_ARGS__)
#else
#define dbg(...) 0
#endif

const int d4i[4] = {-1, 0, 1, 0}, d4j[4] = {0, 1, 0, -1};
const int d8i[8] = {-1, -1, 0, 1, 1, 1, 0, -1}, d8j[8] = {0, 1, 1, 1, 0, -1, -1, -1};

void solve() {
	int n;
	cin >> n;
	vector<pair<long long, long long>> s;
	for(int i = 0; i < n; i++){
		int a, b;
		cin >> a >> b;
		s.emplace_back(a, b);
	}
	sort(s.begin(), s.end());
	s.resize(distance(s.begin(), unique(s.begin(), s.end())));
	vector<long long> a, b;
	for(int i = 0; i < (int) s.size(); i++){
		a.push_back(s[i].first + s[i].second);
		b.push_back(s[i].first - s[i].second);
	}
	sort(a.begin(), a.end());
	sort(b.begin(), b.end());
	cout << max(a[a.size() - 1] - a[0], b[b.size() - 1] - b[0]);
}	
 
int main() {
	
	ios::sync_with_stdio(0);
	cin.tie(0);
 	
	int t = 1;
	//cin >> t;
	for(int i = 1; i <= t; i++) {
		//cout << "Case #" << i << ": ";
		solve();
	}
}

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

int main() {
	int N,K;
    cin >> N >> K;
    int r = 1;
    int i = 0;
    int s;
    while(true){
     	r = r*K;
      	if(r>N){
       		s = i+1;
        	break;
      	}
        i++;
    }
    cout << s << endl;
}

Measured memory_bytes: 256
//Don't have to see. start------------------------------------------
var read = require('readline').createInterface({
  input: process.stdin, output: process.stdout
});
var obj; var inLine = [];
read.on('line', function(input){inLine.push(input);});
read.on('close', function(){
  obj = init(inLine);
  console.error('\n↑入力 ↓出力');
  Main();
});
function makeClone(obj){return (obj instanceof Set) ? new Set(Array.from(obj)) : JSON.parse(JSON.stringify(obj));}
function nextInt(){return myconv(next(),1);} function nextStrArray(){return myconv(next(),2);}
function nextIntArray(){return myconv(next(),4);} function nextCharArray(){return myconv(next(),6);}
function next(){return obj.next();} function hasNext(){return obj.hasNext();}
function init(input){  
  return {
    list : input, index : 0, max : input.length,
    hasNext : function(){return (this.index < this.max);},
    next : function(){if(this.hasNext()){return this.list[this.index++];}else{throw 'ArrayIndexOutOfBoundsException ‚There is no more input';}}
  };
}
function myout(s){console.log(s);}
function myerr(s){console.error('debug:' + require('util').inspect(s,false,null));}
//param "no" is
//unknown or outlier : return i. 1: parseInt.
//2: split space. 4: split space and parseInt.
//6: split 1 character. 7: split 1 character and parseInt.
//8: join space. 9: join nextline. 0: join no character.
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(' ');case 4:return i.split(' ').map(Number);case 6:return i.split('');case 7:return i.split('').map(Number);case 8:return i.join(' ');case 9:return i.join('\n');case 0:return i.join('');default:return i;}}catch(e){return i;}}

//Don't have to see. end------------------------------------------
function Main(){
  var one = nextIntArray();
  var N = one[0];
  var R = one[1];
  if(N >= 10){
    myout(R);
  }else{
    myout(R + 100 * (10 - N));
  }
}


Measured memory_bytes: 31076
using System;
using System.Collections.Generic;
using System.Text;
using System.Numerics;
using System.IO;

namespace SolutionCS
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split(' ');
            long N = long.Parse(s[0]);
            long M = long.Parse(s[1]);

            if (2 * N < M)
            {
                long ans = N;
                M -= N * 2;
                M /= 4;

                Console.WriteLine(ans + M);
            }
            else
            {
                Console.WriteLine(M / 2);
            }
        }
    }
}


Measured memory_bytes: 13140
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define int long long
#define endl "\n"
#define pii pair<int,int> 
#define ff first
#define ss second
#define mii map<int,int>
#define si set<int>
#define sti stack<int>
#define qi queue<int>
#define vi vector<int>
#define pq priority_queue<int>
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
const int M=1e9+7;

int32_t main(){
	IOS;
	int n,m;
	cin>>n>>m;
	bool b[n];
	int a[n]={0};
	for(int i=0;i<n;i++) b[i]=false;
	for(int i=0;i<n;i++) a[i]=0;
	if(n>1) a[0]=1;
	for(int i=0;i<m;i++){
		int x,y; cin>>x>>y;
		x--;
		if(x==0&&y==0&&n>1){cout<<-1<<endl; return 0;}
		else if(b[x]==true&&a[x]!=y){cout<<-1<<endl; return 0;}
		else{
			b[x]=true;
			a[x]=y;
		}
	}
	for(int i=0;i<n;i++) cout<<a[i];
}

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

int main() {
    int n, p;
    int counter = 0;
    cin >> n;
    for (int i=1; i<=n; ++i) {
       cin >> p;
       if (p != i) ++counter;
       if (counter > 2) break;
    }

    if (counter > 2)
        cout << "NO" << endl;
    else
        cout << "YES" << endl;
}


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

typedef long long ll;
typedef long double ld;

#define MOD 1000000007
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for(int i = 0; i < (int)(n); i++)

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

int main(){

    ll A, B;

    cin >> A >> B;

    cout << (A == 2 || B == 2 ? "No" : "Yes") << endl;

    return 0;
}

Measured memory_bytes: 256
//  Copyright © 2020 Diego Garcia Rodriguez del Campo. All rights reserved.
#include<bits/stdc++.h>
#define MAX 2005
#define pii pair < ll , ll >
#define fi first
#define se second
#define optimiza_io cin.tie(0); ios_base::sync_with_stdio(0);
#define forn(i,a,b) for (ll i = a; i <= b; i ++ )
#define mod(n,k) (((n%k)+k)%k)
using namespace std;
typedef long long ll;
 
ll N, ans;
pii a[MAX];
ll memo[MAX][MAX];

bool cmp( pii a , pii b ) { return a.fi > b.fi; }

ll dp( ll l , ll r ) {
    if( memo[l][r] != -1 )
        return memo[l][r];
    ll i = l + N - r;
    if( l == r ) 
        return memo[l][r] = a[i].fi * abs( a[i].se - l );
    return memo[l][r] = max( a[i].fi * abs( a[i].se - l ) + dp( l + 1 , r ) , a[i].fi * abs( a[i].se - r ) + dp( l , r - 1 ) );
}
 
int main()
{
    optimiza_io
    cin >> N;
    for( ll i = 1; i <= N; i ++ ) {
        cin >> a[i].fi;
        a[i].se = i;
    }
    
    sort( a + 1 , a + N + 1 , cmp );
     
    memset( memo , -1 , sizeof memo );
    cout << dp( 1 , N ) << "\n";
    return 0;
}
 
// CHECAR LIMITES 

Measured memory_bytes: 35128
<?php
  
$nks = explode(' ', trim(fgets(STDIN)));
$n = $nks[0];
$k = $nks[1];
$s = $nks[2];

$ans = [];
for($i=0; $i<$n; $i++){
  if ($i < $k){
    $ans[$i] = $s;
  } else {
    if ($s == 1000000000){
      $ans[$i] = 1;
    } else {
      $ans[$i] = 1000000000;
    }
  }
}

for($i=0; $i<$n; $i++){
  if ($i !== 0){
    echo " ";
  } 
  echo $ans[$i];
}

?>

Measured memory_bytes: 10744
S=set()

q=int(input())

for _ in range(q):
    query=[int(i) for i in input().split(" ")]
    if query[0]==0:
        S.add(query[1])
        print(len(S))
    elif query[0]==1:
        if query[1] in S:
            print(1)
        else:
            print(0)
    else:
        if query[1] in S:
            S.remove(query[1])



Measured memory_bytes: 23300