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

public class Main{
	public static void main(String args[]){
		try{
			new Main();
		}catch(IOException e){
			e.printStackTrace();
		}
	}

	public Main() throws IOException{
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		List<String> Ans = new ArrayList<String>();
		String line;

		while((line = in.readLine()) != null){
			int size = Integer.parseInt(line);

			if(size == 0) break;

			List<String> teams = new ArrayList<String>();
			List<Integer> scores = new ArrayList<Integer>();
			int[] sdst = new int[size];
			for(int n=0; n<size; n++){
				line = in.readLine();
				String[] dst = line.split(" ");
				teams.add(dst[0]);
				int win = Integer.parseInt(dst[1]);
				int draw = Integer.parseInt(dst[3]);
				int score = win * 3 + draw;
				scores.add(score);
				sdst[n] = score;
			}

			Arrays.sort(sdst);
			for(int n=size-1; n>=0; n--){
				int i = scores.indexOf(sdst[n]);
				Ans.add(teams.get(i) + "," + Integer.toString(sdst[n]));
				scores.remove(i);
				teams.remove(i);
			}
			Ans.add("");
		}

		Ans.remove(Ans.size()-1);

		for(int n=0; n<Ans.size(); n++){
			System.out.println(Ans.get(n));
		}
	}
}

Measured memory_bytes: 10000
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <tuple>
#include <cstdio>
#include <bitset>
#include <sstream>
#include <iterator>
#include <numeric>
#include <map>
#include <cstring>

using namespace std;

//#define DEBUG_ //!!提出時にコメントアウト!!
#ifdef DEBUG_
	#define dump(x)  cerr << #x << " = " << (x) << endl;
#else
	#define dump(x)  ; //何もしない文
#endif

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size()) //unsignedのサイズをint型に変換
#define pb push_back

typedef long long LL; 
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;

template <typename T>
std::string printVector(const std::vector<T> &data)
{
    std::stringstream ss;
    std::ostream_iterator<T> out_it(ss, ", ");
    ss << "[";
    std::copy(data.begin(), data.end() - 1, out_it);
    ss << data.back() << "]";
    return ss.str();
}

const int MOD = 1e9+7;
const LL LINF = 1001002003004005006ll;
const int INF = 1001001001;

int main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);	
    int N; cin >> N;

    //vector<int> possibleN;
    int count = 1;
    bool possible = 0;
    while(1)
    {
        int tmp = count * (count + 1);
        if(tmp > 1e6) break;
        if(tmp == 2 * N) 
        {
            possible = 1;
            break;
        }
        count++;
    }

    if(possible)
    {
        cout << "Yes" << endl;
        cout << count+1 << endl;
        vector<vector<int>> ans(count+1, vector<int>(count, 0));
        int start = 0;
        int startnum = 1;
        dump(count)

        REP(i,count)
        {
            int tmpstartnum1 = startnum;
            int tmpstartnum2 = startnum;
            REP(j,count-i)
            {
                dump(start)
                dump(start+j)
                dump(tmpstartnum1)
                ans[start][start+j] = tmpstartnum1++;
            }
            REP(j,count-i)
            {
                dump(start+1+j)
                dump(start)
                dump(tmpstartnum2)
                ans[start+1+j][start] = tmpstartnum2++;
            }
            start++;
            startnum += count - i;
        }

        REP(i,count+1)
        {
            cout << count << " ";
            REP(j,count)
            {
                if(j != count-1)
                    cout << ans[i][j] << " ";
                else
                    cout << ans[i][j] << endl;
            }

        }

    }
    else
    {
        cout << "No" << endl;
    }


}


Measured memory_bytes: 2176
n, m = map(int, input().split())
sc_li = [list(map(int,input().split())) for _ in range(m)]
sc = []
ans = ""

for i in range(1000):
    flag = True
    ans = str(i)
    if len(ans) != n:
        continue
    for j in range(m):
        si, ci = sc_li[j]
        if int(ans[si-1]) != ci:
            flag = False
    if flag:
        print(ans)
        exit(0)

print(-1)

Measured memory_bytes: 3064
#include <stdio.h>
#include <stdlib.h>

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

Measured memory_bytes: 1728
#include <bits/stdc++.h>//Carefully Crafted by hetp111
using namespace std;
#define int long long
#define double long double
#define all(v) (v).begin(),(v).end()
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int,int>
#define vii vector<pii>
#define MOD (1000000007)
#define MOD2 (998244353)
#define MOD3 (1000000009)
#define PI acos(-1)
#define eps (1e-8)
#define INF (1e18)
#define FASTER ios_base::sync_with_stdio(0);cin.tie(0)
template<class A,class B>ostream&operator<<(ostream&out,const pair<A,B>&a){return out<<"("<<a.first<<","<<a.second<<")";}
template<class A>ostream&operator<<(ostream&out,const vector<A>&a){for(const A &it:a)out<<it<<" ";return out;}
template<class A,class B>istream&operator>>(istream&in,pair<A,B>&a){return in>>a.first>>a.second;}
template<class A>istream&operator>>(istream&in,vector<A>&a){for(A &i:a)in>>i;return in;}
ifstream cinn("input.txt");ofstream coutt("output.txt");

int a,b,n;

int f(int x){
    return (a*x)/b - a*(x/b);
}

signed main(){
    FASTER;
    cin>>a>>b>>n;
    int ans=0;
    for(int i=1;i<=n && 0;i++){
        ans=max(ans,f(i));
       // cout<<i<<" "<<f(i)<<"\n";
    }
    cout<<f(min(b-1,n));
}

Measured memory_bytes: 3656
import itertools as it
import collections as col
import heapq as hq
import sys
import copy as cp
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

N = int(input())
A = [0] + list(map(int, input().split())) + [0]
B = cp.deepcopy(A)
C = cp.deepcopy(A)
for i in range(1, len(A)):
    B[i] = B[i-1] + abs(A[i]-A[i-1])
for i in range(len(A)-2, -1, step=-1):
    C[i] = C[i+1] + abs(A[i]-A[i+1])
for i in range(1, N+1):
    print(B[i-1] + C[i+1] + abs(A[i-1]-A[i+1]))


Measured memory_bytes: 65696
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <cstdio>
#include <queue>
using namespace std;

struct UnionFind {
    vector<int> data;
    UnionFind(int size) : data(size, -1) { }
    bool unionSet(int x, int y) {
      x = root(x); y = root(y);
    if (x != y) {
        if (data[y] < data[x]) swap(x, y);
        data[x] += data[y]; data[y] = x;
    }
    return x != y;
    }
    bool findSet(int x, int y) {
    return root(x) == root(y);
    }
    int root(int x) {
    return data[x] < 0 ? x : data[x] = root(data[x]);
    }
    int size(int x) {
     return -data[root(x)];
    }
};

int main(){
    int V,E; cin >> V >> E;
    struct UnionFind uf(V);
    priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>> > s;
    vector<pair<int,int> > edge(E);
    for(int i=0;i<E;i++){
        int wi; 
        cin >> edge[i].first >> edge[i].second >> wi;
        s.push(make_pair(wi, i));
    }
    int sum = 0;

    while(!s.empty()){
        int weight = s.top().first, index = s.top().second;
        s.pop();
        if(!uf.findSet(edge[index].first, edge[index].second)){
            sum += weight; 
            uf.unionSet(edge[index].first, edge[index].second);
        }
    }
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 4708
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>

int main(){
    int x, y, z;
    std::cin>>x>>y>>z;

    std::cout<<(x - z) / (y + z)<<std::endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;  //to use policy based data structures like indexed_set  "never used yet !! "
#define vi vector<int>
#define f first
#define s second
#define file_se_input  freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#define pp long long int
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define pb push_back
#define mp make_pair
#define pi 3.141592653589793238
#define eb emplace_back
#define rep(i,a,b) for (int i = a; i <= b; i++)
#define zip(i,a,b) for(int i=a;i<b;i++)
#define ll unsigned long long int
#define test long int t;cin>>t; while(t--)
#define um unordered_map
#define en '\n'
#define us unordered_set
#define mm 1000000007

bool check_prime(long long n)
{
    int flag=0;
    for(long long i=2;i*i<=n;i++)
    {
        if(n%i==0)
        {
            flag=1;
            break;
        }
    }
    if(n==1)
	   return false;
    else if(flag==0 || n==2 ||n==3)
    {
        return true;
    }
    else
    {
        return false;
    }

}

int binaryExponentiation(int x,int n)//function to calculate x raise to power n
{
    int result=1;
    while(n>0)
    {
        if(n % 2 ==1)
            result=result * x;
        x=x*x;
        n=n/2;
    }
    return result;
}

int main()
{
   ios_base::sync_with_stdio(false);
   cin.tie(NULL);
   cout.tie(0);
   #ifndef ONLINE_JUDGE
    if(fopen("INPUT.txt","r"))
    {
    freopen ("INPUT.txt" , "r" , stdin);
    freopen ("OUTPUT.txt" , "w" , stdout);
    }
 #endif
    //_______________________________-code starts-______________________________________________________________________________

int n;
cin>>n;
ll sum=0;
rep(i,1,n)
{
	if(i%5!=0&&i%3!=0)
	{
		sum+=i;
	}
}
cout<<sum<<en;

  return 0;
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
#define REP(i,n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i,a,b) for (ll i=(a);i<(ll)b; i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define INF 1000000000
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll,ll> p;
const int MOD = 1000000007;

// vector<p> cut(M);
// cut[i].second
// cut[i].first;
// REP(i,M){
//     int a,b;cin>>a>>b;
//     cut[i] = make_pair(b,a);//last first の順番
// }
//     for(int i=0; i<N;i++){
//     }
// sort(cut.begin(),cut.end()); //sort
// char '' str ""
int main(void)
{
   str S;
    cin>>S;
    S[3] = '8';

    cout<<S<<endl;
    return 0;
}


Measured memory_bytes: 256
def main():
    N, K = map(int, input().split())
    A = list(map(int, input().split()))

    loop = {i: -1 for i in range(N)}
    loop[0] = 0
    position = 0

    for i in range(N + 1):
        position = A[position] - 1
        if loop[position] != -1:
            ini = loop[position]
            cycle = i + 1 - ini
            break
        else:
            loop[position] = i + 1

    M = (K - ini) % cycle

    answer = 0
    root = min(K, M + ini)
    for j in range(root):
        answer = A[answer] - 1

    answer += 1
    print(answer)

if __name__ == "__main__":
    main()

Measured memory_bytes: 40700
#include <stdio.h>
 
int main()
{
  int A,B,x;
  
  scanf("%d",&A);
  scanf("%d",&B);
  
  x = A - 2*B;
  
  if(x<=0)
    printf("0 \n");
  else
    printf("%d \n",x);
  
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define int long long
#define INF 1000000000000000007
using namespace std;

int n,k,a[100010],dp[100010];

signed main()
{
	ios::sync_with_stdio(false);
	cin>>n>>k;
	for(int i=1;i<=n;i++) cin>>a[i];
	dp[1]=0;
	for(int i=2;i<=n;i++){
		dp[i]=INF;
		for(int j=max(1ll,i-k);j<=i-1;j++){
			dp[i]=min(dp[i],dp[j]+abs(a[i]-a[j]));
		}
	}
	cout<<dp[n]<<endl;
	return 0;
}

Measured memory_bytes: 1792
#include <stdio.h>
#include <string.h>
#define LEN 100000

typedef struct pp{
  char name[10];
  int t;
}P;

P Q[LEN];
P R[LEN];
int head=0, tail=0,n;

void enqueue(P);

P dequeue(P);

int main(){
  int elaps=0,k=0;
  int i,q;
  P u;
  scanf("%d %d", &n, &q);

  for(i=0;i<n;i++){
    scanf("%s %d",Q[i].name ,&Q[i].t);
    enqueue(Q[i]);
  }
    

  while(1){
    u.t=Q[head].t-q;
    strcpy(u.name,Q[head].name);
      if(u.t>0){ enqueue(u);
                          elaps+=q;}
      else {strcpy(R[k].name,Q[head].name);
            elaps+=Q[head].t;
            R[k].t = elaps;
            k++;}
      dequeue(Q[head]);
      if(head==tail) break;
  }
    for(i=0;i<n;i++){
      printf("%s %d\n",R[i].name, R[i].t);
      }

  return 0;
}

void enqueue(P x){
  Q[tail]=x;
  if(tail+1==LEN) tail=0;
  else tail++;
}

P dequeue(P x){
  x=Q[head];
  if(head+1==LEN) head=0;
  else head++;
  return x;
}

Measured memory_bytes: 2960
n = int(input())
m = 0
l = 0

if n % 2 == 1:
    m = (n - 1) * (n - 2) // 2 - (n - 1) // 2 + n - 1
    l = n - 1
else:
    m = n * (n - 1) // 2 - n // 2
    l = n

print(m)
for i in range(1, l + 1):
    for j in range(i + 1, l + 1):
        if i + j != l + 1:
            print(i, j)
            
if n % 2 == 1:
    for i in range(1, l + 1):
        print(i, n)

Measured memory_bytes: 3612
#include <stdio.h>
#include <string.h>

int main()
{
    char p[101];
    memset(p, '\0', 101*sizeof(char));
    int i = 0, flag = 1, max = 0;
    scanf("%s", p);
    for (i = 0; p[i] != 0; i += 2)
    {
        if (p[i] == 'L')
        {
            flag = 0;
            break;
        }
    }
    for (i = 1; p[i] != 0; i += 2)
    {
        if (p[i] == 'R')
        {
            flag = 0;
            break;
        }
    }
    if (flag) printf("Yes");
    else printf("No");
    return 0;
}

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

using namespace std;

const int maxn = 2e5 + 10;

struct node
{
	int x, h;
	bool operator< (const node &p) const 
	{
		if(x == p.x) return h > p.h;
		return x < p.x;
	}
}a[maxn];

int boom[maxn], num[maxn], head = 0, tail = 0;

signed main()
{
	int n, d, A;
	scanf("%d%d%d", &n, &d, &A);
	for(int i = 0; i < n; i ++)
		scanf("%d%d", &a[i].x, &a[i].h);
	sort(a, a + n);
	long long res = 0, sum = 0;	
	for(int i = 0; i < n; i ++)
	{
		while(head < tail && boom[head] + d < a[i].x) 
		{
			sum -= num[head];
			head ++;
		}
		a[i].h -= A * sum;
		if(a[i].h > 0)
		{
			int now = a[i].h / A;
			if(a[i].h % A) now ++;
			boom[tail] = a[i].x + d, num[tail ++] = now;
			sum += now;
			res += now;
		}
	}
	printf("%lld\n", res);
	return 0;
}


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

int main(){	
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	ll h,w,inf = 1e10, sx,sy,ex,ey;
	string s;
	vector<string> maze;
	cin >> h >> w >> sx >> sy >> ex >> ey;
	sx--;
	sy--;
	ex--;
	ey--;	
	for(int i = 0; i < h; i++){
		cin >> s;
		maze.push_back(s);
	}
	
	deque<pair<pair<ll,ll>, ll>> q;

	vector<vector<ll>> dist(h,vector<ll>(w));

	for(int i = 0; i < h; i++){
		for(int j = 0; j < w; j++){
			//dist[{i,j}] = inf;
			dist[i][j] = inf;
		}
	}

	//dist[{sx,sy}] = 0;
	dist[sx][sy] = 0;
	q.push_front({{sx,sy}, 0});

	while(!q.empty()){
		
		pair<pair<ll,ll>,ll> entry = q.front();

		q.pop_front();
		ll cx = entry.first.first, cy = entry.first.second, ccost = entry.second;

		dist[cx][cy] = min(dist[cx][cy], ccost);
		if(cx-1 >= 0 && maze[cx-1][cy] == '.' &&  dist[cx-1][cy] > ccost){
			q.push_front({{cx-1,cy},ccost});
		}

		if(cx + 1 < h && maze[cx+1][cy] == '.' &&  dist[cx+1][cy] > ccost){
			q.push_front({{cx+1,cy},ccost});
		}

		if(cy - 1 >= 0 && maze[cx][cy-1] == '.' &&  dist[cx][cy-1] > ccost){
			q.push_front({{cx,cy-1},ccost});
		}

		if(cy + 1 < w && maze[cx][cy+1] == '.' &&  dist[cx][cy+1] > ccost){
			q.push_front({{cx,cy+1},ccost});
		}	

		for(int i = -2; i <= 2; i++){
			for(int j = -2; j <= 2; j++){
				if(i == 0 && j == 0)
					continue;
				if(cx+i >= 0 && cx + i < h && cy+j >= 0 && cy+j < w && maze[cx+i][cy+j] == '.' && dist[cx+i][cy+j] > ccost + 1){
					q.push_back({{cx+i,cy+j}, ccost+1});
				}
			}
		}	
	}

	if(dist[ex][ey] == inf){
		cout << -1 << "\n";
	}
	else{
		cout << dist[ex][ey] << "\n";
	}

}

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

int main() {
  char C;
  cin >> C;

  if(C == 'a' || C == 'i' || C == 'u' || C == 'e' || C == 'o' ){
      cout << "vowel" << endl;
  }
  else{
      cout << "consonant" << endl;
  }

}


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

#define int long long int 

int32_t main()
{
    int k;
    cin>>k;
    int x,y;
    cin>>x>>y;
    int rem=(k-x%k)+x;
    if(x%k==0 || rem<=y)
    cout<<"OK";
    else
    cout<<"NG"<<endl;

}

Measured memory_bytes: 3608
#include <stdio.h>
#include <cmath>
#include <bits/stdc++.h>



using namespace std;

typedef vector<int> VI;
typedef vector<string> VS;


//container util
#define SORT(c) sort((c).begin(),(c).end())

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



int main(void){

	int A, B; cin >> A >> B;

	int ans = 0;
	FOR(a,1,10){
		REP(b,10){
			REP(c,10){
				int x = 10000*a+1000*b+100*c+10*b+a;
				if(x >= A and x <= B) ans++;
			}
		}
	}

	cout << ans << endl;

	return 0;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int N = 20;

int s[N],per[N][N],is[N][N];

inline int cal(int x){
	int res = 0;
	while(x){
		x -= (x&(-x));
		res++;
	}
	return res;
}

int main()
{
	int n;
	scanf("%d",&n);
	for(int i = 1;i <= n;++i){
		scanf("%d",&s[i]);
		for(int j = 1;j <= s[i];++j){
			scanf("%d%d",&per[i][j],&is[i][j]);
		}
	}
	
	int ans = 0;
	for(int i = 0;i < (1<<n);++i){
		bool f = 1;
		for(int j = 1;j <= n;++j){
			if(i & (1 << (j-1))){
				for(int k = 1;k <= s[j];++k){
					if(is[j][k] && !(i & (1 << per[j][k]-1))) f = 0;
					if(!is[j][k] && (i & (1 << per[j][k]-1))) f = 0;
					if(!f) break; 
				}
			}
			if(!f) break;
		}
		if(f) ans = max(ans,cal(i));
	}
	
	printf("%d\n",ans);
	return 0;
} 

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Text;

namespace AtTest.AGC_Challenge
{
    class _003_B
    {
        static void Main(string[] args)
        {
            Method(args);
            Console.ReadLine();
        }

        static void Method(string[] args)
        {
            int n = ReadInt();
            var array = new int[n];
            for (int i = 0; i < n; i++)
            {
                array[i] = ReadInt();
            }
            long pair = 0;
            for (int i = 0; i < n; i++)
            {
                pair += array[i] / 2;
                array[i] = array[i] % 2;
                if (i < n - 1 &&
                    array[i] > 0 && array[i + 1] > 0)
                {
                    pair++;
                    array[i + 1]--;
                }
            }
            Console.WriteLine(pair);
        }

        private static string Read() { return Console.ReadLine(); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


Measured memory_bytes: 17216
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,a) for(int i=0;i<(a);i++)
const ll MOD=1000000007;

int main(){
  int N,K; cin>>N>>K;
  if(N/2+N%2>=K) cout<<"YES\n";
  else cout<<"NO\n";
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <queue>
#include <utility>
#include <map>
#include <bitset>
#include <numeric>
#define ll long long
using namespace std;
using p = pair<ll, ll>;
ll dx[8]={ 0, 1, 0,-1, 1, 1,-1,-1}; // x軸方向への変位
ll dy[8]={ 1, 0,-1, 0, 1,-1, 1,-1}; // y軸方向への変位

int main(void) {
    ll k, a, b;
    cin >> k >> a >> b;
    bool ok = false;
    for(ll i = a; i <= b; i++){
        if(i%k==0)
            ok = true;
    }
    if(ok==true)
        cout << "OK" << endl;
    else
        cout << "NG" << endl;

    return 0;
}


Measured memory_bytes: 3636
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoderMake
{
    class ABC081B
    {
        static void Main(string[] args)
        {
            var n = Console.ReadLine();
            var a = Console.ReadLine().Split().Select((x) => int.Parse(x));
            int count = 0;
            while (a.Count((x) => x % 2 == 1) == 0)
            {
                count++;
                a=a.Select((x) => x / 2);
            }
            Console.WriteLine(count);
        }
    }
}

Measured memory_bytes: 11348
#include <iostream>
#include <string>
#include <sstream>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
using namespace std;
typedef long long LL;
LL i,j,k,n,m;
LL mod=1000000007;
string s;

int main() {
  cin >>n;
  map<int, int> mp;
  for(i=0;i< n;++i) {
    int tmp;cin>> tmp;
    if(mp.find(tmp)!= mp.end()){
      mp[tmp] += 1;
    } else {
      mp[tmp] = 1;
    }
  }
  vector<pair<int, int>> v;
  for (auto const& ele: mp) v.push_back(make_pair(ele.first,ele.second));
  int max_cnt=0;
  if(v.size()==1) {
    int tmp_cnt = v[0].second;
    max_cnt = max(max_cnt,tmp_cnt);
  } else if(v.size()==2) {
    int tmp_cnt = v[0].second;
    if (v[1].first == v[0].first + 1) tmp_cnt += v[1].second;
    max_cnt = max(max_cnt,tmp_cnt);
  } else {
    for (j=0;j<v.size()-2;++j) {
      int tmp_cnt = v[j].second;
      if (v[j+1].first == v[j].first + 1) tmp_cnt += v[j+1].second;
      if (v[j+2].first == v[j].first + 2) tmp_cnt += v[j+2].second;
      max_cnt = max(max_cnt,tmp_cnt);
    }
  }
  cout << max_cnt << endl;
  return 0;
}

Measured memory_bytes: 3840
# B - Five Dishes
# sys.stdin.readline()
# import sys
import math
# input = sys.stdin.readline
each_time = [int(input()) for i in range(5)]
wait_time = [10*math.ceil(i/10)-i for i in each_time]
result = [i + k for i,k in zip(each_time, wait_time)]
result[wait_time.index(max(wait_time))] = each_time[wait_time.index(max(wait_time))]
print(sum(result))

Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <queue>
#include <functional>
#include <string>
#include <stack>
#include <set>
#include <sstream>
#include <iomanip>
#include <limits>
#include <cstring>

using namespace std;

int main() {
	int i=0, d;
	string S, T, X;
	cin >> S >> T;
	X = S + S;
	d = X.find(T);
	if (d == -1) {
		cout << "No" << endl;
	}
	else {
		cout << "Yes" << endl;
	}
}

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

int main(){
    int n,k;
    cin >> n >> k;
    int x[n];
    for(int i=0;i<n;i++){
        cin >> x[i];
    }
    int ans=1e9;
    for(int left=0;left<n-k+1;left++){

        int right=left+k-1;

        int dis1=abs(x[left])+abs(x[right]-x[left]);
        int dis2=abs(x[right])+abs(x[left]-x[right]);
        ans=min(ans,min(dis1,dis2));
    }
    cout << ans << endl;
}

Measured memory_bytes: 640
#include<math.h>
#define min(x,y)((x)<(y)?(x):(y))
n,r[12];double d[12][12],smemo[1<<12][12];double shortest(restbits,last){int i;double s,t;if(restbits==0)return r[last];if(smemo[restbits][last])return smemo[restbits][last];s=1e3;for(i=0;i<n;i++){if(restbits&(1<<i)){t=d[last][i]+shortest(restbits-(1<<i),i);s=min(s,t);}}return smemo[restbits][last]=s;}main(){int L,i,j;char c;double s,t;for(;~scanf("%d",&L);){for(n=0;scanf("%d%c",r+n++,&c),c!='\n';);for(i=0;i<n;i++)for(j=0;j<n;j++)d[i][j]=2*sqrt(r[i]*r[j]);memset(smemo,0,sizeof(smemo));s=1e3;for(i=0;i<n;i++){t=r[i]+shortest((1<<n)-1-(1<<i),i);s=min(s,t);}puts(s<=L?"OK":"NA");}}

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

int main(){
  string S, T;
  cin >> S >> T;
  
  for (int i = 0; i < S.size(); i++){
    if (S[i] != T[i]){
      cout << "No" << endl;
      break;
    }
    if (i == S.size() - 1){
      cout << "Yes" << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 3596
while True:
         m,f,r = map(int,input().split())
         if m == f == r == -1:
                  break
         if m == -1 or f == -1:
                  print("F")
         elif m+f >= 80:
                  print("A")
         elif m+f >= 65:
                  print("B")
         elif m+f >= 50:
                  print("C")
         elif m+f >= 30:
                  if r >= 50:
                           print("C")
                  else:
                           print("D")
         else:
                  print("F")



Measured memory_bytes: 5596
n,m,x,y=map(int,input().split())
xn = list(map(int, input().split()))
yn = list(map(int, input().split()))

for i in range(x+1, y+1):
    if all(x < i for x in xn) and all(y >= i for y in yn):
        print("No War")
        break
else:
    print("War")

Measured memory_bytes: 3060
#include<iostream>
using namespace std;
#include<bits/stdc++.h>
#include<string.h>
#define ll long long
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);
#include<vector>
#define INF 1e9 +5;

ll min(ll a,ll b){
	return a<=b?a:b;
}

ll dp[101][100001] = {};


int main(){
	IOS;
	int n,W;
	cin >> n >> W;

	vector<ll> weights(n+1),values(n+1);
	ll sumvalue=0;
	for(int i=1; i <= n ; ++i){
		cin >> weights[i] >>  values[i];
		sumvalue+= values[i];
	}

	//dp[i][j] = min_weight that can achieve the value  j


	for(int i = 1 ; i<=n ; ++i){
		for(int j=1; j <=sumvalue ; ++j){
			if(i==1){
				if(j<=values[i])dp[i][j] = weights[i];
				else dp[i][j] = INF;
				continue;
			}
			if(j<values[i])dp[i][j] = min(weights[i], dp[i-1][j]);
			else{
				dp[i][j] = min(dp[i-1][j], weights[i]+ dp[i-1][j-values[i]]);
			}
		}
	}
	int ans = 0;

	for(int i=1;i<=n ; ++i){
		for(int j=1;j<=sumvalue; ++j){
			if(dp[i][j]<=W)ans= max(ans,j);
		}
	}
	cout << ans << endl;
}

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

bool kaibun(string str) {
//  cout << str << endl;
  bool res = true;
  int N = str.length();
  for (int i = 0; i < N; i++) {
    if (str[i] != str[N-i-1]) {
      res = false;
      break;
    }
  }
  return res;
}

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

  int N = S.length();
  string ans = "Yes";
  if (!kaibun(S)) ans = "No";

  int rule1 = (N - 1) / 2;
  string tmp = S.substr(0, rule1);
  if (!kaibun(tmp)) ans = "No";

  int rule2 = (N + 3) / 2 - 1;
  string tmp2 = S.substr(rule2, N);
  if (!kaibun(tmp2)) ans = "No";

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


Measured memory_bytes: 256
# import numpy as np
import sys, math, heapq
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial, gcd
from bisect import bisect_left, bisect_right

sys.setrecursionlimit(10 ** 7)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline()[:-1]
pl = lambda x: print(*x, sep="\n")


N = int(input())


def num_divisors_table(n):
    table = [0] * (n + 1)

    for i in range(1, n + 1):
        for j in range(i, n + 1, i):
            table[j] += 1

    return table


table = num_divisors_table(N + 3)
chkset = set()
for i in range(int(math.sqrt(N) + 10)):
    chkset.add(i ** 2)
# print(table)
cnt = 0
for C in range(1, N):
    NC = N - C
    cnt += table[NC]
    # if NC in chkset:
    #     cnt -= 1
print(cnt)


Measured memory_bytes: 76312
import collections
N = int(input())
s = [input() for i in range(N)]
M = int(input())
t = [input() for i in range(M)]
for i in range(M):
    if t[i] in s:
        s.remove(t[i])
if s ==list():
    print(0)
else:
    print(s.count(collections.Counter(s).most_common()[0][0]))

Measured memory_bytes: 3316
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rep1(i,n) for(int i=1; i<=(n); ++i)
#define repi(i,a,b) for(int i=a; i<=(b); ++i)
#define rrep(i,n) for(int i=(n-1); i>=0; --i)
#define ALL(obj) (obj).begin(), (obj).end()
#define RALL(obj) (obj).rbegin(), (obj).rend()
#define pb push_back
#define mp make_pair
#define to_s to_string
#define sz(v) (int)v.size()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )
#define pr(x) cout<<(x)<<'\n'
#define debug(x) cout << #x << ": " << (x) << '\n'
#define yes "Yes"
#define no "No"
using namespace std;
using ll = long long;
using Edge = pair<int,long long>;
using Graph = vector<vector<Edge>>;
typedef pair<int,int> P;
struct aaa{aaa(){ cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);};}aaaaaaa;
int MOD = 1e9 + 7;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return (a*b)/gcd(a,b);}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

int main(){
    string S;
    int ct = 0;
    cin >> S;
    rep(i,sz(S)) if(S[i] == 'p') ct++;
    pr(sz(S)/2-ct);
}

Measured memory_bytes: 512
#!/usr/bin/env ruby

require 'set'

class Hash
  def push(key, value)
    self[key] = [] if self[key] == nil
    self[key].push(value)
  end
end

class Array
  def lower_bound(value)
    left = -1;
    right = self.length;
    while left + 1 < right
      mid = left + (right - left) / 2;
      if self[mid] >= value
        right = mid
      else
        left = mid
      end
    end
    right
  end

  def unique
    res = [self.first]
    each_cons(2) do |a, b|
      if a != b
        res.push(b)
      end
    end
    res
  end
end

def get_ints
  gets.chomp.split.map(&:to_i)
end

def get_ints_minus_one
  get_ints.map { |x| x - 1 }
end

def get_int
  gets.chomp.to_i
end

Q = get_int
Q.times do |i|
  a, b = get_ints

  if a == b
    puts 2 * (a-1)
    next
  end
  min = [a, b].min
  max = [a, b].max

  ab = a * b

  high = max - 1
  low = min
  while high - low > 1
    mid = low + (high - low) / 2

    if mid ** 2 >= ab
      high = mid
    else
      low = mid
    end
  end

  high, low = [high, low].max, [high, low].min
  rest = if high * high < ab
    high + high - min - 1
  elsif high * low < ab
    high + low - min - 1
  else
    low + low - min - 1
  end

  puts min - 1 + rest

  # ab = a * b
  # b_down = (ab/(a+1)).then { |x| x * (a+1) == ab ? x - 1 : x }
  # b_down_amari = b - b_down - 1
  #
  # a_down = (ab/(b+1)).then { |x| x * (b+1) == ab ? x - 1 : x }
  # a_down_amari = a - a_down - 1
  #
  # binding.pry if a == 22
  # puts b_down + a_down + [a_down_amari, b_down_amari].min
end


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

int main()
{
	string s;
	cin >> s;
	if ((s[0] == s[1]) && (s[1] == s[2])) {
		cout << "No" << endl;
	}
	else
	{
		cout << "Yes" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
	"sort"
)

func main() {
	var n, k int
	fmt.Scan(&n, &k)
	a := make([]int, n)
	for i := range a {
		fmt.Scan(&a[i])
	}
	sort.Ints(a)
	sum := 0
	for _, x := range a[len(a)-k:] {
		sum += x
	}
	fmt.Println(sum)
}


Measured memory_bytes: 512
package main

import "fmt"

func isEven(n int) bool { return n%2 == 0 }
func isOdd(n int) bool  { return n%2 != 0 }

func main() {
	var a, b, c int
	fmt.Scan(&a, &b, &c)

	if isEven(a) && a == b && b == c {
		fmt.Println(-1)
		return
	}

	ans := 0
	var nextA, nextB, nextC int
	for {
		if isOdd(a) || isOdd(b) || isOdd(c) {
			break
		}
		nextA, nextB, nextC = b/2+c/2, c/2+a/2, a/2+b/2
		a, b, c = nextA, nextB, nextC
		ans++
	}
	fmt.Println(ans)
}


Measured memory_bytes: 512
n,a=int(input()),sorted(list(map(int,input().split())))
m=a[-1]+1
s=[0]*m
for i in a:
  s[i]+=1
for i in set(a):
  if s[i]:
    for j in range(i*2,m,i):
      s[j]=0
print(s.count(1))

Measured memory_bytes: 40132
#include "bits/stdc++.h"
using namespace std;
#define fi first
#define se second
#define ll long long
#define dbg(v) cerr<<#v<<" = "<<v<<'\n'
#define vi vector<int>
#define vl vector <ll>
#define pii pair<int,int>
#define mp make_pair
#define db long double
#define pb push_back
#define all(s) s.begin(),s.end()
template < class T > T smin(T &a,T b) {if (a > b) a = b;return a;}
template < class T > T smax(T &a,T b) {if (a < b) a = b;return a;}
const int N = (int)(1e6) + 5;
int s[N];
int dp[N];
int main(void) {
    int n,k;
    cin>>n>>k;
    for (int i = 1;i <= n;++i)
    	cin>>s[i];
    int index = min_element(s + 1,s + 1 + n) - s;
    for (int i = 2;i <= 2 * n;++i) {
    	dp[i] = 1 + dp[max(0,i - (k - 1))];
    }
    int ans = 1e9;
    for (int i = 1;i <= k;++i)
    	if (i <= index && k - i <= n - index) {
 		   	int cnt = 1 + dp[index - i + 1] + dp[n - index - (k - i) + 1];
 		   	smin(ans,cnt);
    	}
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 5120
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        MyScanner in = new MyScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        B solver = new B();
        solver.solve(1, in, out);
        out.close();
    }

    static class B {
        public void solve(int testNumber, MyScanner in, PrintWriter out) {
            int N = in.nextInt();
            int K = in.nextInt();
            out.println(Integer.toString(N, K).length());
        }

    }

    static class MyScanner {
        private BufferedReader in;
        private StringTokenizer st;

        public MyScanner(InputStream stream) {
            in = new BufferedReader(new InputStreamReader(stream));
        }

        public String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    String rl = in.readLine();
                    if (rl == null) {
                        return null;
                    }
                    st = new StringTokenizer(rl);
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return st.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



Measured memory_bytes: 21332
#include <iostream>
#include <iomanip>
#include <vector>
typedef long long ll;
using namespace std;
const ll INF = 1e9;
const ll MOD = 1e9 + 7;
#define repi(i, n, init) for (ll i = init; i < (n); i++)


int main()
{
    int n, m = 0;
    cin >> n;
    int in[int(1e5)];
    repi(i, n, 0)
    {
        cin >> in[i];
        m = max(m, in[i]);
    }

    ll ans = 0, a_i = m, a_j, dist = INF;
    repi(i, n, 0)
    {
        if (in[i] == m)
            continue;
        else if (dist > abs(m / 2 - in[i]))
        {
            dist = abs(m / 2 - in[i]);
            a_j = in[i];
        }
    }
    cout << a_i << " " << a_j << endl;
    return 0;
}

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

using namespace std;

const int sz = 1e4 + 13;

typedef pair<int, int> pii;

int n, r, q;

vector<vector<pii> > g (sz);
vector<vector<pii> > t (sz);

vector<int> C (sz);

struct edge{
  int u, v, cost;
};

struct edgeCmp{
  int operator() (const edge& a, const edge& b){return a.cost > b.cost;}
};

int find(int x){return (x == C[x] ? x : C[x] = find(C[x]) );}

bool same( int x, int y){return find(x) == find(y);}

void merge(int x, int y){C[find(x)] = C[find(y)];}

int mst(){
  for(int i = 0; i < n; ++i)
    C[i] = i;
  vector<edge> T;
  priority_queue<edge, vector<edge>, edgeCmp> E;

  for(int i = 0; i < n; ++i){
    for(auto j : g[i]){
        edge e;
        e.u = i;
        e.v = j.first;
        e.cost = j.second;
        E.push(e);
    }
  }

  int weight = 0;

  while(T.size() < n - 1 && !E.empty()){
    edge cur = E.top(); E.pop();
    if(!same(cur.u, cur.v)){
      T.push_back(cur);
      weight += cur.cost;
      merge(cur.u, cur.v);
    }
  }

  for(auto e : T){
    t[e.u].push_back({e.v, e.cost});
    t[e.v].push_back({e.u, e.cost});
  }
  return weight;
}

int main(){
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  #ifdef Larra
  freopen("in","r",stdin);
  freopen("out","w",stdout);
  #endif
  cin>>n>>r;
  for(int i = 0; i < r; ++i){
    int a,b,c;
    cin>>a>>b>>c;
    g[a].push_back({b,c});
    g[b].push_back({a,c});
  }
  int weight = mst();
  cout<<weight<<endl;
}



Measured memory_bytes: 9256
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<vector>
#include<functional>
#include<algorithm>
#include<stdlib.h>
#include<string>
#include<string.h>
#define _USE_MATH_DEFINES
#include<math.h>
#include<deque>
#include<set>
#include<map>
#include<queue>
#include<list>
#include<iostream>
#include <bitset>
using namespace std;
typedef long long ll;
#define rep(i,a,b) for(auto i=a;i<b;i++)
#define all(_x) _x.begin(), _x.end()
#define r_sort(_x) sort(_x, std::greater<int>())
#define vec_cnt(_a, _n) (upper_bound(all(_a), _n) - lower_bound(all(_a), _n))
#define vec_unique(_a) _a.erase(std::unique(all(_a)), _a.end());
#define vvec vector<vector<ll>>
ll gcd(ll a, ll b) { return a % b == 0 ? b : gcd(b, a % b); }
ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; }
#define INF 1 << 30
const int mod = 1000000007;
ll power(ll x, ll p) { ll a = 1; while (p > 0) { if (p % 2 == 0) { x *= x; p /= 2; } else { a *= x; p--; } }return a; }
ll mpower(ll x, ll p) { ll a = 1; while (p > 0) { if (p % 2 == 0) { x = x * x % mod; p /= 2; } else { a = a * x % mod; p--; } }return a; }
ll ac(ll n, ll k) { ll a = 1; rep(i, 1, k) { a *= n - i + 1; a /= i; }return a; }
ll mc(ll n, ll m) { ll k = 1, l = 1; rep(i, n - m + 1, n + 1) k = k * i % mod; rep(i, 1, m + 1) l = l * i % mod; l = mpower(l, mod - 2); return k * l % mod; }
typedef struct {
	int y, x, y2, x2;
}p4;
int main()
{
	int h, w;
	ll M = 0;
	vector<p4> k;
	string ans = "";
	cin >> h >> w;
	vector<vector<int>> c(h, vector<int>(w));
	rep(i, 0, h) {
		rep(i2, 0, w) {
			cin >> c[i][i2];
		}
	}
	int x, y, px = -1, py;
	rep(i, 0, h) {
		rep(i2, 0, w) {
			y = i, x = i % 2 ? (w - i2 - 1) : i2;
			if (px != -1 && c[py][px] % 2) {
				c[py][px]--;
				c[y][x]++;
				k.push_back({py+1,px+1, y+1, x+1});
				M++;
			}
			px = x, py = y;
		}
	}
	printf("%lld\n", M);
	for (auto it : k) {
		printf("%d %d %d %d\n", it.y, it.x, it.y2, it.x2);
	}
	return 0;
}


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

int main(){
   int r;
   cin >> r;
   cout << setprecision(20) << 2 * 3.1415926 * r << endl;
}

Measured memory_bytes: 3812
#include <bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
    int N;
    while (1) {
        cin >> N;
        if (!N) break;
        vector<int> a(N);
        for (int i = 0; i < N; i++) {
            cin >> a[i];
        }
        int ans = 10000000;
        for (int i = 0; i < N; i++) {
            for (int j = i+1; j < N; j++) {
                ans = min(ans, abs(a[i] - a[j]));   
            }
        }
        cout << ans << endl;
    }
}



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

int main(void){
    int a, b, x;
    cin >> a >> b >> x;
    if (pow(a, 2)*b/2 < x) {
        double c = (pow(a, 2)*b-x)*2 / pow(a, 2);
        printf("%.16f\n", atan(c/a) * 180 / M_PI);
    }
    else if (pow(a, 2)*b/2 > x) {
        double c = 2.0*x/(a*b);
        printf("%.16f\n", 90-(atan(c/b) * 180 / M_PI));
    }
    else {
        cout << 45 << endl;
    }
}

Measured memory_bytes: 256
#line 2 "header.hpp"

//%snippet.set('header')%
//%snippet.fold()%
#ifndef HEADER_H
#define HEADER_H

// template version 2.0
using namespace std;
#include <bits/stdc++.h>

// varibable settings
const long long INF = 1e18;
template <class T> constexpr T inf = numeric_limits<T>::max() / 2.1;

#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (ll i = (ll)(a); i < (ll)(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define _rrep(i, n) rrepi(i, 0, n)
#define rrepi(i, a, b) for (ll i = (ll)((b)-1); i >= (ll)(a); --i)
#define r_rep(...) _overload3(__VA_ARGS__, rrepi, _rrep, )(__VA_ARGS__)
#define each(i, a) for (auto &&i : a)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define mt(...) make_tuple(__VA_ARGS__)
#define ub upper_bound
#define lb lower_bound
#define lpos(A, x) (lower_bound(all(A), x) - A.begin())
#define upos(A, x) (upper_bound(all(A), x) - A.begin())
template <class T, class U> inline void chmax(T &a, const U &b) { if ((a) < (b)) (a) = (b); }
template <class T, class U> inline void chmin(T &a, const U &b) { if ((a) > (b)) (a) = (b); }
template <typename X, typename T> auto make_table(X x, T a) { return vector<T>(x, a); }
template <typename X, typename Y, typename Z, typename... Zs> auto make_table(X x, Y y, Z z, Zs... zs) { auto cont = make_table(y, z, zs...); return vector<decltype(cont)>(x, cont); }

#define cdiv(a, b) (((a) + (b)-1) / (b))
#define is_in(x, a, b) ((a) <= (x) && (x) < (b))
#define uni(x) sort(all(x)); x.erase(unique(all(x)), x.end())
#define slice(l, r) substr(l, r - l)

typedef long long ll;
typedef long double ld;
using vl = vector<ll>;
using vvl = vector<vl>;
using pll = pair<ll, ll>;

template <typename T>
using PQ = priority_queue<T, vector<T>, greater<T>>;
void check_input() { assert(cin.eof() == 0); int tmp; cin >> tmp; assert(cin.eof() == 1); }

#if defined(PCM) || defined(LOCAL)
#else
#define dump(...) ;
#define dump_1d(...) ;
#define dump_2d(...) ;
#define cerrendl ;
#endif

#endif /* HEADER_H */
//%snippet.end()%
#line 2 "solve.cpp"
template<class T=ll> using vec = vector<T>;
struct Fast { Fast() { std::cin.tie(0); ios::sync_with_stdio(false); } } fast;

template<class T>
void pairsort(vector<T>& x, vector<T>& y){
    ll n = sz(x);
    vector<tuple<T, T>> t(n);
    rep(i, n){
        t[i] = make_tuple(x[i], y[i]);
    }
    sort(all(t));
    rep(i, n){
        x[i] = get<0>(t[i]);
        y[i] = get<1>(t[i]);
    }
}

int solve() {
    ll n;cin>>n;
    vl x(n), y(n);
    vl x2(n), y2(n);

    vl a,b,c,d;
    rep(i, n){
        cin>>x[i]>>y[i];
        a.pb(x[i]+y[i]);
        b.pb(x[i]-y[i]);
        c.pb(-x[i]+y[i]);
        d.pb(-x[i]-y[i]);
    }
    sort(all(a));
    sort(all(b));
    sort(all(c));
    sort(all(d));
    ll ans = 0;
    chmax(ans, a[n-1] - a[0]);
    chmax(ans, b[n-1] - b[0]);
    chmax(ans, c[n-1] - c[0]);
    chmax(ans, d[n-1] - d[0]);

    cout << ans << endl;

    return 0; 
}


int main(){/*{{{*/
    solve();
    check_input();
    return 0;
}/*}}}*/


Measured memory_bytes: 15980
/*  ex4_2 Colon
    pandacodeb  */

#include <stdio.h>
#include <math.h>

double findAng(double h, double m);
double findDist(double lenH, double lenM, double h, double m);

int main(void){
    double lenH, lenM, h, m;
    scanf("%lf %lf %lf %lf", &lenH, &lenM, &h, &m);
    printf("%.20f\n", findDist(lenH, lenM, h, m));
    return 0;
}

double findAng(double h, double m){
    double angleH = (2 * M_PI * h/12) + (M_PI/6 * m/60);
    double angleM = 2 * M_PI * m/60;
    return angleM - angleH;
}

double findDist(double lenH, double lenM, double h, double m){
    double angle = findAng(h, m);
    double dist = sqrt(lenH*lenH + lenM*lenM - 2*lenH*lenM*cos(angle));
    return dist;
}

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


#define M 1000000007
#define pb push_back
#define mp make_pair
#define s second
#define f first
#define mod 998244353
#define sz(v) (int)(v).size()

#define pii pair<int, int>
#define vi vector<int>
#define ll long long
#define fastio ios_base::sync_with_stdio(false);cin.tie(0)

ll add(ll a,ll b)
{
	a%=M;
	b%=M;
	ll p = (a+b)%M;
	return (p+M)%M;
}

ll mul(ll a,ll b)
{
	a%=M;
	b%=M;
	ll p = (a*b)%M;
	return (p+M)%M;
}

ll power(ll a,ll b)
{
	ll p=1;
	while(b)
	{
		if(b&1)
			p=mul(p,a);
		a=mul(a,a);
		b/=2;
	}
	return p;
}

vector<ll> adj[200010];
ll dp1[200010]={0},dp2[100010]={0};
ll siz[200010]={0};

void dfs1(ll i,ll par)
{
	ll j;
	siz[i]=1;
	for(j=0;j<sz(adj[i]);j++)
	{
		ll x = adj[i][j];
		if(x==par)
			continue;
		dfs1(x,i);
		siz[i] += siz[x];
	}
	return ;
}

void dfs2(ll i,ll par,ll n)
{
	if(i!=1)
		dp2[i]=mul(mul(dp2[par],siz[i]),power(n-siz[i],M-2));
	else
		dp2[i]=dp1[i];
	ll j;
	for(j=0;j<sz(adj[i]);j++)
	{
		ll x = adj[i][j];
		if(x==par)
			continue;
		dfs2(x,i,n);
	}
	return ;
}

int main()
{
	fastio;
	ll i,j,n;
	cin>>n;
	for(i=1;i<=n-1;i++)
	{
		ll u,v;
		cin>>u>>v;
		adj[u].pb(v);
		adj[v].pb(u);
	}	
	dfs1(1,0);
	ll ans=1;
	for(i=1;i<=n-1;i++)
		ans=mul(ans,i);
	for(i=2;i<=n;i++)
		ans=mul(ans,power(siz[i],M-2));
	// cout<<ans<<endl;
	dp1[1]=ans;
	dfs2(1,0,n);
	for(i=1;i<=n;i++)
		cout<<dp2[i]<<endl;

    return 0;
}





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

int main() {
    long long int n;
    cin >> n;
    long long int m = sqrt(n) + 1;
    long long int res;
    for(long long int i = m; i > 0; i--){
        if(n % i == 0){
            res = (i - 1) + (n / i - 1);
            break;
        }
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n, a, x;
  cin >> n >> a;
  
  x = n / 500;
  
  if ( n - x * 500 <= a){
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		char[] c = sc.next().toCharArray();
		for (int i=0;i<c.length;i++) {
			if (i==3) {
				System.out.print('8');
			} else {
				System.out.print(c[i]);
			}
		}

	}
}

Measured memory_bytes: 21844
"use strict";
var input=require("fs").readFileSync("/dev/stdin","utf8");
var cin=input.split(/ |\n/),cid=0;
function next(){return +cin[cid++];}
function nextstr(){return cin[cid++];}
function nextbig(){return BigInt(cin[cid++]);}
function nexts(n,a){return a?cin.slice(cid,cid+=n):cin.slice(cid,cid+=n).map(a=>+a);}
function nextm(h,w,a){var r=[],i=0;if(a)for(;i<h;i++)r.push(cin.slice(cid,cid+=w));else for(;i<h;i++)r.push(cin.slice(cid,cid+=w).map(a=>+a));return r;}
function xArray(v){var a=arguments,l=a.length,r="Array(a["+--l+"]).fill().map(x=>{return "+v+";})";while(--l)r="Array(a["+l+"]).fill().map(x=>"+r+")";return eval(r);}

var myOut = main();
if(myOut !== undefined)console.log(myOut);

function main(){
  var [a,b,h,m] = nexts(4);
  var x = h*60+m;
  x /= 720/11;
  x -= x | 0;
  x *= Math.PI * 2;
  var ry = b * Math.sin(x), rx = b * Math.cos(x);
  var dx = rx - a;
  return Math.sqrt(dx*dx + ry*ry);
}

Measured memory_bytes: 29652