akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define REP(i,s,e) for(int i=(s); i<(e);i++)
#define rep(i,n) REP(i,0,n)
#define rep1(i,n) REP(i,1,n)
#define repe(i,n) for(auto &&i:n)
#define all(v) (v).begin(),(v).end()
#define decimal fixed<<setprecision(20)
#define fastcin() cin.tie(0);ios::sync_with_stdio(false)
using namespace std;
using LL = long long;
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; }
const int INF = 1e9;
const LL LLINF = 1e16;

int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    rep(i,n) a[i] *= -1;
    vector<int> dp(n+1, INF);
    rep(i, n){
        *upper_bound(all(dp), a[i]) = a[i];
    }
    int ans = lower_bound(all(dp), INF) - dp.begin();
    // rep(i, n) cout << dp[i] << endl;
    cout << ans << endl;
}

Measured memory_bytes: 1024
#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<algorithm>

using namespace std;

#define int long long
#define endl "\n"

const long long INF = (long long)1e18;
const long long MOD = (long long)1e9 + 7; 

string yn(bool f){return f?"Hom":"Tem";}
string YN(bool f){return f?"YES":"NO";}

#define MAX

signed main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);
	
	int A, B, C;
	int minimum;
	
	cin>>A>>B>>C;

		int con = (A%2) + (B%2) + (C%2);
		if(con >= 2){
			cout<<"Hom"<<endl;
		} else {
			cout<<"Tem"<<endl;
        }
	
	
	return 0;
}


Measured memory_bytes: 3204
#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <vector>
#include <cstdio>
#include <bits/stdc++.h>
#include <set>
#include <map>
#include <stdio.h>
#include <stack>
#include <queue>
#include <deque>
#include <numeric>
#include<bits/stdc++.h>
#include <utility>

#define ALL(obj) (obj).begin(), (obj).end()
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define RFOR(i,a,b) for(int i = (a); (b) <= i; i--)
#define REP(i,n) for(int i = 0; i < (n); i++)
#define RREP(i,n) for(int i = n; n <= i; i--)
#define ABS(a) ((a < 0) ? ((-1)*(a)) : (a))
#define elif else if
#define MOD 1000000007
#define INF (1<<29)

using namespace std;
using ll = long long;
map <int ,int> mpa,mpb;
typedef pair<ll, ll> P;
priority_queue<P, vector<P>, greater<P>> pque;

bool flag(int a){
  if(a<0) return false;
  if(a==0) return true;
  return flag(a-4)||flag(a-7);
}

int main(){
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  int N;
  cin >> N;
  if(flag(N)) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 256
package main

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

var scanner = bufio.NewScanner(os.Stdin)

func nextStr() string {
	scanner.Scan()
	return scanner.Text()
}

func nextInt() int {
	i, _ := strconv.Atoi(nextStr())
	return i
}

func max(x, y int) int {
	if x > y {
		return x
	}
	return y
}

func solve(n int, k int, P []int, C []int) int {

	ans := int(-1e10)
	for i := 0; i < n; i++ {
		v := i
		cycle_sum := 0
		cycl_cnt := 0

		for {
			cycl_cnt++
			cycle_sum += C[v]
			v = P[v]
			if v == i {
				break
			}
		}
		path := 0
		cnt := 0

		for {
			cnt++
			path += C[v]

			if cnt > k {
				break
			}

			num := (k - cnt) / cycl_cnt
			score := path + max(0, cycle_sum)*num

			ans = max(ans, score)

			v = P[v]
			if v == i {
				break
			}

		}
	}
	return ans
}

func main() {
	scanner.Split(bufio.ScanWords)

	n, k := nextInt(), nextInt()
	P := make([]int, n)
	C := make([]int, n)

	for i := range P {
		P[i] = nextInt() - 1
	}

	for i := range C {
		C[i] = nextInt()
	}

	fmt.Println(solve(n, k, P, C))
}


Measured memory_bytes: 1964
int main(void) {
  int a,b;
  
  scanf("%d %d",&a,&b);
  
  if (a+b > a-b && a+b > a*b)
    printf("%d",a+b);
  else if (a-b > a*b)
    printf("%d",a-b);
  else
    printf("%d",a*b);
}
      

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <vector>

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

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;

int main()
{
  int x1, y1, x2, y2;
  cin >> x1 >> y1 >> x2 >> y2;

  int diff_x = x2 - x1;
  int diff_y = y2 - y1;

  int x3 = x2 - (y2 - y1);
  int y3 = y2 + (x2 - x1);
  int x4 = x3 - (y3 - y2);
  int y4 = y3 + (x3 - x2);

  cout << x3 << " " << y3 << " " << x4 << " " << y4 << endl;

  return 0;
}


Measured memory_bytes: 256
//Create Time: 2018-04-24 20:55:43
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <cstdlib>
#include <sstream>
#include <fstream>
#include <functional>
#include <list>
#include <deque>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <cctype>
#include <ctime>
#include <utility>
#include <complex>
#include <cassert>
#include <climits>
#include <iterator>
#include <tuple>
using namespace std;
#define snuke(i,x) for (__typeof((x).begin()) i = (x).begin(); i != (x).end(); ++i)
#define rep(i,a,n) for (int i=(a);i<(n);i++)
#define per(i,n,a) for (int i=(n)-1;i>=(a);i--)
// #define OUT(x) std::cout<<(#x)<<":"<<(x)<<std::endl
// #define TST(x) std::cout<<(#x)<<":"<<(x)<<" "
#define OUT(args...) {string _s=#args;replace(_s.begin(),_s.end(),',',' ');stringstream _ss(_s);istream_iterator<string> _it(_ss);OUT_TST("\n",_it,args);}
#define TST(args...) {string _s=#args;replace(_s.begin(),_s.end(),',',' ');stringstream _ss(_s);istream_iterator<string> _it(_ss);OUT_TST("",_it,args);}
#define SZ(v) ((int)(v).size())
#define all(v) (v).begin(), (v).end()
#define unq(x) sort(all(x)),(x).erase(unique(all(x)),(x).end())
#define mem(f,x) memset((f), (x), sizeof(f))
#define clr(f) mem(f,0)
#define x first
#define y second
#define mp make_pair
#define pb push_back
#define mt make_tuple
#define eb emplace_back
#define DEBUG
void OUT_TST(string s,istream_iterator<string> it) {cerr<<s;}
template<typename T, typename... Args> void OUT_TST(string s,istream_iterator<string> it,T a,Args... args){cerr<<*it<<"="<<a<<" ";OUT_TST(s,++it,args...);}
template<class T> void rd(T&ret){ret=0;bool ok=0,u=0;for(;;){int c=getchar();if(c>='0'&&c<='9')ret=(ret<<3)+(ret<<1)+c-'0',ok=1;else if(c=='-')u=1;else if(ok){if(u)ret*=-1;return;}}}
long long powmod(long long p,long long n,long long mod){long long ret=1;for(;n;n>>=1){if(n&1)ret=ret*p%mod;p=p*p%mod;}return ret;}
template <class T> bool chmin(T& a, const T &b) {return b < a? a = b, 1: 0;}
template <class T> bool chmax(T& a, const T &b) {return b > a? a = b, 1: 0;}
int gcd(int a,int b){return b?gcd(b,a%b):a;}
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii > vii;
/****head****/
int main(){
    int a,b,c;cin>>a>>b>>c;
    int cnt=(a&1)+(b&1)+(c&1);
    int ans=0;
    if(cnt==2 || cnt==1){
        ++ans;
        if((a&1) == (b&1))++a,++b;
        else if((a&1) == (c&1))++a,++c;
        else ++b,++c;
    }
    int mx=max(a,max(c,b));
    ans+=(mx-a)/2;
    ans+=(mx-b)/2;
    ans+=(mx-c)/2;
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#define N 100
#define INF (1<<30)
using namespace std;

int n, M[N][N], d[N], color[N] = {0};

void Dijk(int s) {
	int min;
	for (int i = 0;i < n;i++) d[i] = INF;
	d[s] = 0;
	color[s] = 1;
	while (true) {
		int u=-1;
	    min = INF;
		for (int i = 0;i < n;i++) {
			if (color[i] != 2 && d[i] < min)
			{
				u = i;
				min = d[u];
			}
		}

		if (u==-1) break;

		color[u] = 2;

		for (int v = 0;v < n;v++) {
			if (color[v] != 2 && M[u][v] != INF)
				if (d[v] > d[u] + M[u][v]) {
					d[v] = d[u] + M[u][v];
					color[v] = 1;
				}
		}
	}

	for(int i=0;i<n;i++)
	cout<<i<<" "<<d[i]<<endl;

}

int main() {

	for (int i = 0;i < N;i++)
		for (int j = 0;j < N;j++) M[i][j] = INF;

	cin >> n;
	int u, v, k;
	for (int i = 0;i < n;i++) {
		cin >> u;
		cin >> k;
		for (int j = 0;j < k;j++) {
			cin >> v;
			cin >> M[u][v];
		}
	}

	Dijk(0);

}

Measured memory_bytes: 3108
///******* In the name of Allah *******///

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

//long int ar[10013];
//long int gcd(long int a, long int b)
//{
//    if(b==0)
//        return a;
//    return gcd(b,a%b);
//}
//long int sieve(long long int a)
//{
//    long long int i,j,k = 0;
//    memset(ar,0,sizeof(ar));
//    ar[1] = 1;
//    for(i=2; i<=713; i++)
//    {
//        if(ar[i]==0)
//        {
//            for(j=i+i; j<=713; j+=i)
//            {
//                ar[j] = 1;
//            }
//        }
//    }
//    return ar[a];
//}

void Ok()
{
    long int a,b,c,d,e,f,g,h,t,i,j,k,l,m,n,Min,Max;
    long int ans_1,ans_2,ans_3,cnt_1,cnt_2,cnt_3,flag_1,flag_2,flag_3,temp,sum;
    double aa,bb,cc,dd,ee,ff,gg;
    char aaa[313][313],bbb,ccc,ddd;
    string spc,in,store;

    cin>>a>>b>>c;
    cin>>k;
    cnt_1 = 0;
    if(a>=b)
    {
        for(i=1;i<=k;i++)
        {
            if(a>=b)
            {
                cnt_1++;
                b *= 2;
            }
            else
                break;
        }
    }
    ans_1 = k - cnt_1;
    if(b>=c)
    {
        for(i=1;i<=ans_1;i++)
        {
            if(b>=c)
            {
                c *= 2;
            }
            else
                break;
        }
    }
    if(a<b && b<c)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;

    return;
}

int main()
{
    Ok();

    return 0;
}


Measured memory_bytes: 3636
n=int(input())
a=list(map(int,input().split()))
b=max(a)
d=0
ans=0
for i in range(n):
    if d<min(b-a[i],a[i]):
        d=min(b-a[i],a[i])
        ans=a[i]
print(str(b)+" "+str(ans))

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

int main(){
  long long g,l,n,m,x;
  string s,t;
  cin>>n>>m>>s>>t;
  g=__gcd(n,m);
  if(g==1){
    if(s[0]==t[0]){
      cout<<n*m<<endl;
      return 0;
    }else{
      cout<<-1<<endl;
      return 0;
    }
  }
  for(int i=0;x<n;i++){
    if(s[i*n/g]!=t[i*m/g]){
      cout<<-1<<endl;
      return 0;
    }
    x=i*n/g;
  }
  cout<<n*m/g<<endl;
}

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

int main() {
  int64_t A,B,C,K;
  cin >> A >> B >> C >>K;
  
  if (K < A){
    cout << K << endl;
  }
  else if (K < A+B){
    cout << A << endl;
  }
  else{
    cout << 2*A + B -K << endl;
  }
  
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define inc(i, l, r) for (int i = l; i <= r; i++)

const int maxn = 1e6 + 5;

int l, r, d;

int main() {
    cin >> l >> r >> d;
    cout << r / d - (l + d - 1) / d + 1;
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mp make_pair
#define ios ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

int main()
{
	ios;
	ll m,h,w,a,b,i,ans=0;
	map<ll,ll> r;
	map<ll,ll> c;
	cin>>h>>w>>m;
	vector<map<ll,ll> > v(h+1);
	vector<map<ll,ll> > v1(w+1);
	for(i=0;i<m;i++)
	{
		cin>>a>>b;
		r[a]++;
		c[b]++;
		v[a][b]=1;
		v1[b][a]=1;
		
	}
	ll x=0;
	for(auto p:r) 
	{
	if(p.second> ans)
	{
		a=p.first;
		ans=p.second;	
	}
	}
	ll k;
	for(auto p:c)
	{ 
		if(v[a][p.first]==1)
		k=p.second-1;
		else 
		k=p.second;
		if(k>x)
		{
			x=k; b=p.first;
		}
	}
//	cout<<a<<" "<<b<<" ";
	ans+=x;
	ll ans1=0, k1=0, x1=0;
	for(auto p:c) 
	{
	if(p.second> ans1)
	{
		b=p.first;
		ans1=p.second;	
	}
	}

	for(auto p:r)
	{ 
		if(v1[b][p.first]==1)
		k1=p.second-1;
		else 
		k1=p.second;
		if(k1>x1)
		{
			x1=k1; a=p.first;
		}
	}
	ans1+=x1;
//	cout<<a<<" "<<b<<" ";
//	for(auto p: v[a])
//	{
//		if(p==b) ans--;
//	}
	cout<<max(ans1,ans);
	return 0;
}

Measured memory_bytes: 143912
#include<iostream>
#include<string.h>
#include<math.h>
#define M 256
using namespace std;

int main()
{
	int N;
	while (cin >> N && N != 0)
	{
		int L[M];
		for (int i = 0; i < N; i++)
		{
			cin >> L[i];
		}
		int ansS = 0, ansA = 0, ansC = 0;
		double minH = 1e10;
		for (int s = 0; s <= 15; s++)
		{
			for (int a = 0; a <= 15; a++)
			{
				for (int c = 0; c <= 15; c++)
				{
					int R[M];
					int count[M];
					memset(count, 0, sizeof (int) * M);

					R[0] = (a * s + c) % M;
					for (int i = 1; i < N; i++)
					{
						R[i] = (a * R[i - 1] + c) % M;
					}

					double h = 0.0;

					for (int i = 0; i < N; i++)
					{
						count[(L[i] + R[i]) % M]++;
					}

					for (int i = 0; i < M; i++)
					{
						if (count[i] <= 0)continue;
						h -= ((double)count[i] / N) * log((double) count[i] / N);
					}

					if (h + (1e-10) < minH)
					{
						ansS = s;
						ansA = a;
						ansC = c;
						minH = h;
					}
				}
			}
		}

		cout << ansS << " " << ansA << " " << ansC << endl;
	}
	return 0;
}

Measured memory_bytes: 1204
#include <stdio.h>

int main(int argc, const char * argv[]) {
    int i,x;
    i=1;
    while(1){
        scanf("%d",&x);
        if(x==0){break;}
        if((x>=0)&&(x<=10000)){
            printf("Case %d: %d\n",i,x);
        }
        i++;
    }
    return 0;
}

Measured memory_bytes: 600
def main():
    n = int(input())
    a = list(map(int,input().split()))
    m = 0
    for i in range(n):
        if a[i]<0:
            m += 1
    ans = 0
    for i in range(n):
        ans += abs(a[i])
    if m%2==0:
        print(ans)
    else:
        mi = float('inf')
        for i in range(n):
            if mi>abs(a[i]):
                mi = abs(a[i])
        print(ans-2*mi)

if __name__ == "__main__":
    main()


Measured memory_bytes: 20048
N = int(input())
A = list(map(int, input().split()))


def returnResMod2(i):
    # i+1の倍数の箱のaiの和の剰余を求める
    res = sum([ansList[(i+1)*(k+1)-1] for k in range(N//(i+1))]) % 2
    return res


ansList = [0 for i in range(N)]
for i in range(N-1, -1, -1):
    tmp = (returnResMod2(i)+A[i]) % 2
    ansList[i] = tmp
    

M = sum(ansList)
print(M)
if M == 0:
    quit()
print(' '.join([str(i+1) for i, a in enumerate(ansList) if a == 1]))

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

#define INF INT_MAX
#define ll long long
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,a,n) for(int i=0;i<n;i++)

using namespace std;

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

	int h,w,H,W;
	cin >>  H >> W >> h >> w;
	vector<vector<int>> m(H, vector<int>(W,0));

	for(int i = 0;i < h;i++){
		for(int j=0;j<W;j++)m[i][j] = 1;
	}
	
	for(int j =0;j < w;j++){
		for(int i=0;i<H;i++)m[i][j] = 1;
	}

	int ans = 0;
	for(int j=0;j < H;j++){
		for(int i=0;i < W;i++){
			if(m[j][i] == 0)ans++;
		}
	}

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


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

const int INF = 1e+8;
string s;
int ans;

// k := テ」ツつケテ」ツδ?」ツδε」ツδ療ヲツ閉ー, foot := ティツカツウテ」ツ?ョテ、ツスツ催ァツスツョ, t := 0 テ」ツ?ョテ」ツ?ィテ」ツ?催」ツ?ッテ・ツ渉ウティツカツウテ」ツつ?1テ」ツ?ョテ」ツ?ィテ」ツ?催」ツ?ッテ・ツキツヲティツカツウテ」ツつ津・ツ仰陛」ツ?凝」ツ?? cnt := ティツァツ」
void solve(int k, int foot, int t, int cnt){
    if( k == s.size() ){
        ans = min(ans, cnt);
        return;
    }
    
    if( t == 0 ){ // テ・ツ渉ウティツカツウテ」ツつ津・ツ仰陛」ツ?凝」ツ??
        int ly = ((foot - 1) % 3) + 1;
        int next = s[k] - '0';
        int ry = ((next - 1) % 3) + 1;
        
        if( ly <= ry ){ // テ・ツ仰陛」ツ?凝」ツ?崚」ツつ凝」ツ?ィテ」ツ??
            solve(k + 1, next, (t + 1) % 2, cnt);
        }else{ // テ・ツ仰陛」ツ?凝」ツ?崚」ツ?ェテ」ツ??」ツ?ィテ」ツ??
            solve(k + 1, next, t, cnt + 1);
        }
    }else{ // テ・ツキツヲティツカツウテ」ツつ津・ツ仰陛」ツ?凝」ツ??
        int ry = ((foot - 1) % 3) + 1;
        int next = s[k] - '0';
        int ly = ((next - 1) % 3) + 1; 
        
        if( ly <= ry ){ // テ・ツ仰陛」ツ?凝」ツ?崚」ツつ凝」ツ?ィテ」ツ??
            solve(k + 1, next, (t + 1) % 2, cnt);
        }else{ // テ・ツ仰陛」ツ?凝」ツ?崚」ツ?ェテ」ツ??」ツ?ィテ」ツ??
            solve(k + 1, next, t, cnt + 1);
        }
    }
}

int main(){
    while( cin >> s, s != "#" ){
        ans = INF;
        for(int i = 1 ; i <= 9 ; i++ ){
            if( i == 5 ) continue;
            solve(0, i, 0, 0);
            solve(0, i, 1, 0);
        }
        cout << ans << endl;
    }
}

Measured memory_bytes: 1316
#include<bits/stdc++.h>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
 
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long int
#define mod 1000000007
#define inf 1e18+42
#define endl "\n"

#define out1(a) cout<<#a<<" "<<a<<endl
#define out2(a,b) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<endl
#define out3(a,b,c) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<endl

#define rep(i,a,b) for(int i=a;i<b;i++)
#define repr(i,a,b) for(int i=a;i>=b;i--)
#define fori(it,A) for(auto it=A.begin();it!=A.end();it++)

#define ft first
#define sd second
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define zero(x) memset(x,0,sizeof(x));
 
using namespace std;

int binpow(int a, int b) {
    int res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}

//START OF CODE ->->->->->->->

void solve()
{
    int n,d;
    cin>>n>>d;

    cout<<ceil(n/((float)(2*d)+1))<<endl;
}

//END OF CODE ->->->->->->->->

signed main()
{
    fast;
    int t = 1;
    // cin>>t;

    while(t--)
    {
        solve();
    }
    return 0;
}



Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const long double EPS=1e-9;
const long double PI=acos(-1.0);
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
long double ABS(long double a){return max(a,-a);}

int main(){
	int a,b,c;
	scanf("%d%d%d",&a,&b,&c);
	int A=0;
	int B=0;
	int C=0;
	for(int i=0;i<a;i++){
		int p;scanf("%d",&p);
		if(p<=b)A++;
		else if(p<=c)B++;
		else C++;
	}
	printf("%d\n",min(A,min(B,C)));
}


Measured memory_bytes: 128
#include<stdio.h>
int main(void)
{
	int n,i,j,x,y;
	y=0;
	scanf("%d",&n);
	for(i=1;i<=n;i+=2){
		x=0;
		for(j=1;j<=i;j++){
			if(i%j==0){
				x=x+1;
			}
		}
		if(x==8){
			y=y+1;
		}
	}
	printf("%d\n",y);
	
	return 0;
}


Measured memory_bytes: 128
#include "bits/stdc++.h"
#include <boost/multi_array.hpp>
#include <boost/optional.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/algorithm.hpp>
#include <boost/range/adaptors.hpp>
#include <boost/dynamic_bitset.hpp>
namespace adaptor = boost::adaptors;
using index_t = std::size_t;

namespace lib
{
	using graph_t = std::vector<std::set<index_t>>;
	template<class T>using weighted_graph_t = std::vector<std::map<index_t, T>>;
	template<class T>using pair = std::pair<T, T>;

	struct max_t
	{
		template<class T>constexpr T operator()(T const& lhs, T const& rhs)const
		{
			return std::max(lhs, rhs);
		}
	};
	struct min_t
	{
		template<class T>constexpr T operator()(T const& lhs, T const& rhs)const
		{
			return std::min(lhs, rhs);
		}
	};

	constexpr max_t max;
	constexpr min_t min;

	template<class T>auto order_by(T func)
	{
		return [=](auto&& lhs, auto&& rhs)
		{
			return func(lhs) < func(rhs);
		};
	}

	template<class T>constexpr auto max_v = std::numeric_limits<T>::max();
	template<class T>constexpr auto min_v = std::numeric_limits<T>::min();

	template<class T>using p_queue = std::priority_queue<T, std::vector<T>, std::greater<>>;
	
	template<class T>constexpr T pow(T val, std::uint64_t p)
	{
		auto ret = T(1);
		auto s = 1ULL;
		for (auto i = 0; i < 63; ++i, s <<= 1)
		{
			if (p & s)
			{
				ret *= val;
			}
			val *= val;
		}
		return ret;
	}
}

template<class T>struct max_value
{
	T v;
	max_value(T u = lib::min_v<T>) :v(u)
	{

	}
	auto& operator=(T const& u)
	{
		v = std::max(v, u);
		return *this;
	}
	auto& operator=(max_value const& u)
	{
		v = std::max(v, *u);
		return *this;
	}
	T operator*()const
	{
		return v;
	}
	void reset()
	{
		v = lib::min_v<T>;
	}
};
template<class T>struct min_value
{
	T v;
	min_value(T u = lib::max_v<T>) :v(u)
	{

	}
	auto& operator=(T const& u)
	{
		v = std::min(v, u);
		return *this;
	}
	auto& operator=(min_value const& u)
	{
		v = std::min(v, *u);
		return *this;
	}
	T operator*()const
	{
		return v;
	}
	void reset()
	{
		v = lib::max_v<T>;
	}
};

void Main()
{
	std::size_t N;
	std::cin >> N;
	max_value<std::int64_t> maxx, maxy;
	min_value<std::int64_t> minx, miny;
	for (auto _ : boost::irange(N))
	{
		std::int64_t a, b;
		std::cin >> a >> b;
		maxx = a - b;
		minx = a - b;
		maxy = a + b;
		miny = a + b;
	}
	std::cout << std::max(*maxx - *minx, *maxy - *miny) << std::endl;
}

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

Measured memory_bytes: 3632
#include <bits/stdc++.h>
  
using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define repr(i, n) REPR(i, n, 0)
#define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--)
#define pb push_back
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;

int cnt[9][9];
int dist[9][9];

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

int main(){
    rep(i, 9) rep(j, 9) dist[i][j] = INF;
    rep(i, 9) dist[i][i] = 0;
    rep(y, 3) rep(x, 3) {
        int cur = y * 3 + x;
        rep(i, 4) {
            int nx = x + dx[i];
            int ny = y + dy[i];
            if(nx < 0 || nx >= 3 || ny < 0 || ny >= 3) continue;
            int nxt = ny * 3 + nx;
            dist[cur][nxt] = 1;
        }
    }
    rep(k, 9) rep(i, 9) rep(j, 9) dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);

    // rep(i, 9) {
    //     rep(j, 9) cout << dist[i][j] << " ";
    //     cout << endl;
    // }

    // cout << endl;
    // rep(i, 9) {
    //     rep(j, 9) cout << cnt[i][j] << " ";
    //     cout << endl;
    // }

    int n;
    string s;
    cin >> n >> s;
    rep(i, n-1) {
        cnt[s[i]-'1'][s[i+1]-'1']++;
    }
    // cout << n << endl << s << endl;


    // cout << endl;
    // rep(i, 9) {
    //     rep(j, 9) cout << cnt[i][j] << " ";
    //     cout << endl;
    // }

    auto calc = [&](const vector<int>& a) {
        int ret = 0;
        rep(i, 9) rep(j, 9) ret += cnt[a[i]][a[j]] * dist[i][j];
        return ret;
    };

    vi a(9);
    rep(i, 9) a[i] = i;

    vi ans;
    int ans_cnt = INF;
    do {
        int tmp = calc(a);
        if(tmp < ans_cnt) {
            ans_cnt = tmp;
            ans = a;
        }
        // for(auto&& x : a) cout << " " << x;
        //     cout << " -> " << tmp << endl;
    }while(next_permutation(all(a)));
    rep(i, 3) {
        rep(j, 3) {
            cout << ans[i*3+j]+1;
        }
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 3340
N = int(input())
As = list(map(int, input().split()))
Bs = list(map(int, input().split()))

ans = 0
tmp = 0
for a,b in zip(As,Bs[:N]):
    # 前の余力で敵を頃す
    if tmp > 0:
        if a >= tmp:
            ans += tmp
            a -= tmp
        else:
            ans += a
            a = 0
    # 町から敵を頃す
    if a >= b:
        ans += b
        tmp = 0
    else:
        ans += a
        tmp = b-a
# 最後の町
a = As[N]
if a >= tmp:
    ans += tmp
else:
    ans += a

print(ans)

Measured memory_bytes: 18476
import java.util.Scanner;
import java.util.Arrays;

public class Main
{

	public static void main(String[] args)
	{	Scanner s = new Scanner(System.in);
                
                int[] a = new int[3];
                int[] b = new int[100];
                int i=0,sum=0;
                float sum1=0;
                for(i=0;i<3;i++){
                   a[i] = s.nextInt();
                }
                Arrays.sort(a);
                System.out.println(a[2]-a[0]);
                
	}
}

Measured memory_bytes: 22736
N = int(input())

for x in range(1, 3501):
    for y in range(1, 3501):
        if 4*x*y-N*(x+y) != 0:
            if N*x*y/(4*x*y-N*(x+y)) == int(N*x*y/(4*x*y-N*(x+y))) and int(N*x*y/(4*x*y-N*(x+y))) > 0:
                print(x, y, int(N*x*y/(4*x*y-N*(x+y))))
                break
    else:
        continue
    break


Measured memory_bytes: 41324
#include <iostream>
#include <vector>
#include <limits.h>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <queue>
#include <map>
#include <set>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <random>
#include <functional>
#include <stack>
#include <iomanip>
#include <cassert>
//#include <boost/multiprecision/cpp_int.hpp>
#include <complex>
#include <cstdio>
#include <list>
#include <bitset>

//< in.txt > out.txt
using namespace std;
//std::ios::sync_with_stdio(false);
//std::cin.tie(0);
const long long MOD = 1e9 + 7;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<ld, ll> pdl;
typedef pair<ld, ld> pdd;
typedef vector<ll> VLL;
typedef vector<VLL> VVLL;
//typedef boost::multiprecision::cpp_int bigint;

int main() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	ll N;
	cin >> N;
	VLL A(N);
	for (ll n = 0; n < N; n++) {
		cin >> A[n];
	}
	ll need = 1;
	for (ll n = 0; n < N; n++) {
		if (A[n] == need) {
			need++;
		}
	}
	if (need == 1)cout << -1 << "\n";
	else cout << N - (need - 1) << "\n";
	return 0;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
#define deb(x) cout<<#x<<" is "<<x<<endl;
typedef long long ll;
using namespace std;

int main()
{
    int h,w;
    cin>>h>>w;
    bool mat[h][w];
 
    for(int i=0;i<h;i++)
        for(int j=0;j<w;j++)
        {
            char c;
            cin>>c;
            mat[i][j] = (c=='.') ? false : true;
        }

    ll dp[h][w];
    memset(dp,0,sizeof(dp));
    ll mod=1e9+7;
    dp[0][0]=1;
    for(int i=0;i<h;i++)
    {
        for(int j=0;j<w;j++)
        {
            if(mat[i][j])   continue;

            if(j>0)         dp[i][j]=dp[i][j-1];
            if(i>0)         dp[i][j]=(dp[i][j]+dp[i-1][j])%mod;

            // cout<<i<<" "<<j<<" "<<dp[i][j]<<endl;
        }
    }
    cout<<dp[h-1][w-1]<<endl;
}

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

#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;

typedef long long ll;

const int INF = 1 << 30;
const ll LLINF = 1LL << 62;

int mod = 1000000007;

int main(void){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N; cin >> N;
    if(N%1000) cout << 1000 - N%1000 << endl;
    else cout << 0 << endl;
    return 0;
}

Measured memory_bytes: 3556
#include "iostream"
#include <stdio.h>
#include <algorithm>
#include <stdlib.h>
#include <string>
#include <math.h>
#include <cctype>
#include <stack>
#include <vector>
#include <list>
#include <queue>
#include <set>
#include <map>
using namespace std;
using ll=long long;
#define mod  1000000007

int main(int argc, char const *argv[]) {
  unsigned long long x,y;
  std::cin >> x >> y;

  for(int i=0; ; i++){
    if(x>y){
      std::cout << i << '\n';
      return 0;
    }
    x*=2;
  }




  return 0;
}


Measured memory_bytes: 256
n =int(input())
s = input()
count = 0
for i in range(0,10):
    for j in range(0,10):
        for k in range(0,10):
            if str(i) in s and str(k) in s:
                start = s.index(str(i))
                goal = n -1 -list(reversed(s)).index(str(k))
                if start+1<goal:
                    if str(j) in s[start+1:goal]:
                        count += 1
print(count)

Measured memory_bytes: 3468
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <math.h>
#include <assert.h>
#include <vector>

using namespace std;
typedef long long ll;
static const double EPS = 1e-9;
static const double PI = acos(-1.0);

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, n) for (int i = (s); i < (int)(n); i++)
#define FOREQ(i, s, n) for (int i = (s); i <= (int)(n); i++)
#define FORIT(it, c) for (__typeof((c).begin())it = (c).begin(); it != (c).end(); it++)
#define MEMSET(v, h) memset((v), h, sizeof(v))

typedef vector<double> Array;
typedef vector<Array> Matrix;

Array mul(const Matrix &matrix, const Array &vect) {
  const int w = matrix[0].size();
  const int h = matrix.size();
  Array ret(h, 0);
  REP(y, h) {
    REP(x, w) {
      ret[y] += matrix[y][x] * vect[x];
    }
  }
  return ret;
}

Matrix mul(const Matrix &matrix1, const Matrix &matrix2) {
  const int in = matrix1[0].size();
  const int h = matrix1.size();
  const int w = matrix2[0].size();
  Matrix ret(h, Array(w, 0));
  REP(y, h) {
    REP(x, w) {
      REP(i, in) {
        ret[y][x] += matrix1[y][i] * matrix2[i][x];
      }
    }
  }
  return ret;
}

Array XRotate(const Array vect, const double rad) {
  Matrix matrix(3, Array(3, 0));
  matrix[0][0] = 1.0;
  matrix[1][1] = cos(rad);
  matrix[1][2] = sin(rad);
  matrix[2][1] = -sin(rad);
  matrix[2][2] = cos(rad);
  return mul(matrix, vect);
}

Array YRotate(const Array vect, const double rad) {
  Matrix matrix(3, Array(3, 0));
  matrix[1][1] = 1.0;
  matrix[0][0] = cos(rad);
  matrix[0][2] = -sin(rad);
  matrix[2][0] = sin(rad);
  matrix[2][2] = cos(rad);
  return mul(matrix, vect);
}

Array ZRotate(const Array vect, const double rad) {
  Matrix matrix(3, Array(3, 0));
  matrix[2][2] = 1.0;
  matrix[0][0] = cos(rad);
  matrix[0][1] = sin(rad);
  matrix[1][0] = -sin(rad);
  matrix[1][1] = cos(rad);
  return mul(matrix, vect);
}

Array normalize(const Array vect) {
  const int n = vect.size();
  double sum = 0;
  Array ret(n, 0);
  REP(i, n) {
    sum += vect[i] * vect[i];
  }
  sum = sqrt(sum);
  REP(i, n) {
    ret[i] = vect[i] / sum;
  }
  return ret;
}

char str[1000];

const int month[12] = { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
int main() {
int test;
scanf("%d", &test);
while (test--) {
  int m, d, h, minute;
  scanf("%d/%d %d:%d", &m, &d, &h, &minute);
  REP(i, m - 1) {
    d += month[i];
  }
  d--;
  h += d * 24;
  minute += h * 60;
  double rad = (1.0 + 1.0 / 365.24) * 360.0 * minute / 60.0 / 24.0 * 2 * PI / 360.0;
  int n;
  scanf("%d", &n);
  Array star(3);
  REP(i, n) {
    int m;
    scanf("%s %d", str, &m);
    bool see = true;
    REP(j, m) {
      double a, h;
      scanf("%lf %lf", &a, &h);
      a = (90 - a) * PI / 180.0;
      h = h * PI / 180.0;
      star[2] = sin(h);
      double d = sqrt(1 - star[2] * star[2]);
      star[0] = d * cos(a);
      star[1] = d * sin(a);
      star = XRotate(star, -(90.0 - 43.2) * PI / 180.0);
      star = ZRotate(star, rad);
      star = XRotate(star, -(43.2 - 90.0) * PI / 180.0);
      if (star[2] < 0) { see = false; }
    }
    if (see) { printf("%s\n", str); }
  }
}
}

Measured memory_bytes: 952
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int[] arr = {sc.nextInt(), sc.nextInt(), sc.nextInt(), sc.nextInt()};
        Arrays.sort(arr);
        int[] ok = {1,4,7,9};
        System.out.println(Arrays.equals(arr, ok) ? "YES" : "NO");
    }
}

Measured memory_bytes: 23252
#!/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

N, D =get_ints
X = Array.new(N) { [] }
N.times do |i|
  X[i] = get_ints
end

count = 0
X.combination(2) do |y, z|
  sum = y.zip(z).map { |a, b| (a - b) ** 2 }.sum
  kyori = Math.sqrt(sum)
  count += 1 if kyori.to_i == kyori
end

puts count


Measured memory_bytes: 14352
#include<stdio.h>
#include<algorithm>
using namespace std;

int main()
{
	long long a, b;
	char op;
	while (~scanf("%lld", &a))
	{
		getchar();
		scanf("%c", &op);
		getchar();
		scanf("%lld", &b);
		if (op == '+')
		printf("%lld\n", a + b);
		if (op == '-')
		printf("%lld\n", a - b);
	}
	return 0;
}


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

#define ll long long
#define sd(x) scanf("%d", &(x))
#define pii pair<int, int>
#define F first
#define S second
#define all(c) ((c).begin()), ((c).end())
#define sz(x) ((int)(x).size())
#define ld long double

template<class T,class U>
ostream& operator<<(ostream& os,const pair<T,U>& p){
	os<<"("<<p.first<<", "<<p.second<<")";
	return os;
}

template<class T>
ostream& operator <<(ostream& os,const vector<T>& v){
	os<<"{";
	for(int i = 0;i < (int)v.size(); i++){
		if(i)os<<", ";
		os<<v[i];
	}
	os<<"}";
	return os;
}

#ifdef LOCAL
#define cerr cout
#else
#endif

#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif
const int N = 500005;
char s[N];
int a[N];
int deg[N];
vector<int> adj[N], revadj[N];
int main(){
	// int n; sd(n);
	scanf("%s", s + 1);
	int n = strlen(s + 1) + 1;
	for(int i = 1; i < n; i++){
		if(s[i] == '>'){
			adj[i + 1].push_back(i);
			deg[i]++;
			revadj[i].push_back(i + 1);
		} else{
			deg[i + 1]++;
			adj[i].push_back(i + 1);
			revadj[i + 1].push_back(i );
		}
	}
	set<pii> st;
	ll ans = 0;
	for(int i = 1; i <= n; i++) st.insert({deg[i], i});
	while(!st.empty()){
		auto it = st.begin();
		int node = it->second;
		ans += a[node];
		// trace(node, a[node], adj[node]);
		st.erase(it);
		for(int v : adj[node]){
			a[v] = max(a[v], a[node] + 1);
			st.erase({deg[v], v});
			st.insert({deg[v] - 1, v});
		}
	}
	
	
	printf("%lld\n", ans);
}

Measured memory_bytes: 82944
#include <stdio.h>
#include <limits.h>
 
#define WHITE 1
#define BLACK 2
#define NIL -2
 
int A[101][101], pi[101], w[101][101], n;
 
prim(){
  int mincost, u, v, i;
  int color[n], d[n];
 
  for(u=0; u<n; u++){
    d[u] = INT_MAX;
    pi[u] = NIL;
    color[u] = WHITE;
  }
 
  d[0] = 0;
 
  while(1){
    mincost = INT_MAX;
    for(i=0; i<n; i++){
      if(color[i] != BLACK && d[i] < mincost){
    mincost = d[i];
    u = i;
      }
    }
     
    if(mincost == INT_MAX){
      break;
    }
 
    color[u] = BLACK;
     
    for(v=0; v<n; v++){
      if(color[v] != BLACK && w[u][v] < d[v] && w[u][v] != -1){
    pi[v] = u;
    d[v] = w[u][v];
      }
    }
 
  }
 
} 
 
   
int main(){
  int i, j, sum=0;
 
  scanf("%d", &n);
 
  for(i=0; i<n; i++){
    for(j=0; j<n; j++){
      scanf("%d", &A[i][j]);
      w[i][j] = A[i][j];
    }
  }
 
  prim();
 
  for(i=0; i<n; i++){
    if(w[i][pi[i]] != -1){
      sum += w[i][pi[i]];
    }
  }
 
  printf("%d\n", sum);
 
  return 0;
}

Measured memory_bytes: 680
import sys
input=sys.stdin.readline
n,m=map(int,input().split())
dic={}
a=[list(map(int,input().split())) for i in range(n)]
for i in range(n):
    for j in range(1,a[i][0]+1):
        if a[i][j] in dic:
            dic[a[i][j]]+=1
        else:
            dic[a[i][j]]=1

cnt=0
for i in dic.values():
    if i==n:
        cnt+=1
print(cnt)

Measured memory_bytes: 38256
inputs = [int(s) for s in input().split()]
w = inputs[0]
h = inputs[1]
x = inputs[2]
y = inputs[3]

if x == w/2 and y == h/2:
    print(str(h*w/2)+" 1")
else:
    print(str(h*w/2)+" 0")


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
long long ans[100005];
int main() {
  int n, x;
  cin >> n;
  vector<pair<int, int>> v;
  for (int i = 1; i <= n; i++) {
    cin >> x;
    v.push_back({-x, -i});
  }
  sort(v.begin(), v.end());
  v.push_back({0, 0});
  int lastid = 100003;
  long long lastx = 0;
  long long cnt = 0;
  for (auto p : v) {
    ans[lastid] += (lastx + p.first) * cnt;
    lastid = min(lastid, -p.second);
    lastx = -p.first;
    cnt++;
  }
  for (int i = 1; i <= n; i++) {
    cout << ans[i] << endl;
  }
  return 0;
}


Measured memory_bytes: 2804
#include<iostream>
#include<vector>

using namespace std;
vector<vector<bool>> card(4,vector<bool>(13,false));

int main(){
  char ch;int n,num;
  cin >> n;
  for(int i=0;i < n;i++){
    cin >> ch >> num;
    switch(ch){
      case 'S':
      card.at(0).at(num-1) = true;
      break;
      case 'H':
      card.at(1).at(num-1) = true;
      break;
      case 'C':
      card.at(2).at(num-1) = true;
      break;
      case 'D':
      card.at(3).at(num-1) = true;
    }
  }
  for(int i=0;i < 4;i++){
    for(int j=0;j < 13;j++){
      if(i == 0){
        if(!card.at(0).at(j)) cout << "S " << j+1 << endl;
      }else if(i == 1){
        if(!card.at(1).at(j)) cout << "H " << j+1 << endl;
      }else if(i == 2){
        if(!card.at(2).at(j)) cout << "C " << j+1 << endl;
      }else if(i == 3){
        if(!card.at(3).at(j)) cout << "D " << j+1 << endl;
      }
    }
  }
  return 0;
}


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

int main(){
  int n,k;
  cin >> n;
  vector<int> box(9,0);
  for(int i = 0; i < n; i++){
    cin >> k;
    if(k < 400) box.at(0)++;
    else if(k>=400 && k<800) box.at(1)++;
    else if(k>=800 && k<1200) box.at(2)++;
    else if(k>=1200 && k<1600) box.at(3)++;
    else if(k>=1600 && k<2000) box.at(4)++;
    else if(k>=2000 && k<2400) box.at(5)++;
    else if(k>=2400 && k<2800) box.at(6)++;
    else if(k>=2800 && k<3200) box.at(7)++;
    else box.at(8)++;
  }
  int min_cnt = 0, max_cnt = 0;
  for(int i = 0; i < 8; i++){
    if(box.at(i) != 0) min_cnt++;
  }
  if(min_cnt == 0){
    cout << 1 << " " << box.at(8) << endl;
    return 0;
  }
  if(box.at(8) == 0){
    max_cnt = min_cnt;
  }
  else{
    max_cnt = min_cnt + box.at(8);
  }
  cout << min_cnt << " " << max_cnt << endl;
}

Measured memory_bytes: 3616
n,m = map(int,input().split())
stu_list = [list(map(int,input().split())) for nesya in range(n)]
che_list = [list(map(int,input().split())) for mootsu in range(m)]
for stu in stu_list:
  x = stu[0]
  y = stu[1]
  poge = 10**9
  hoge = 0
  i = 0
  for che in che_list:
    hoge += 1
    a = che[0]
    b = che[1]
    l = abs(x-a)+abs(y-b)
    if poge > l:
      poge = l
      i = hoge
  print(i)

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

struct MMatrix
{
	using V = vector < int >;
	using VV = vector < V >;
	VV mat;
	int mod;

	MMatrix ( int n, int mod ) : mod(mod)
	{
		mat.assign(n, V(n, 0));
	} 

	MMatrix operator + ( const MMatrix &d ) const
	{
		int n = mat.size();
		MMatrix ret(n, mod);
		if ( n == d.mat.size() ) {
			for ( int i = 0; i < n; i++ ) {
				for ( int j = 0; j < n; j++ ) {
					ret.mat[i][j] = ((int64_t)mat[i][j] + d.mat[i][j]) % mod;
				}
			}
		}
		return ( ret );
	}

	MMatrix operator - ( const MMatrix &d ) const
	{
		int n = mat.size();
		MMatrix ret(n, mod);
		if ( n == d.mat.size() ) {
			for ( int i = 0; i < n; i++ ) {
				for ( int j = 0; j < n; j++ ) {
					ret.mat[i][j] = ((int64_t)mat[i][j] - d.mat[i][j] + mod) % mod;
				}
			}
		}
		return ( ret );
	}

	MMatrix operator * ( const MMatrix &d ) const
	{
		int n = mat.size();
		MMatrix ret(n, mod);
		if ( n == d.mat.size() ) {
			for ( int i = 0; i < n; i++ ) {
				for ( int j = 0; j < n; j++ ) {
					for ( int k = 0; k < n; k++ ) {
						ret.mat[i][j] = ((int64_t)ret.mat[i][j] + (int64_t)mat[i][k] * d.mat[k][j]) % mod;
					}
				}
			}
		}
		return ( ret );
	}

	V operator * ( const V &d ) const
	{
		int n = mat.size();
		V ret(n);
		if ( n == d.size() ) {
			for ( int i = 0; i < n; i++ ) {
				for ( int k = 0; k < n; k++ ) {
					ret[i] = ((int64_t)ret[i] + (int64_t)mat[i][k] * d[k]) % mod;
				}
			}
		}
		return ( ret );
	}

	MMatrix operator ^ ( int w ) const
	{
		MMatrix ret = I(), pad = *this;

		while ( w ) {
			if ( w & 1 ) ret = ret * pad;
			pad = pad * pad;
			w >>= 1;
		}

		return ( ret );
	}

	MMatrix I() const
	{
		int n = mat.size();
		MMatrix ret(n, mod);
		for ( int i = 0; i < n; i++ ) {
			ret.mat[i][i] = 1;
		}
		return ( ret );
	}
};


	
int main()
{
	int N, M, A, B, C, T;
	
	while ( cin >> N >> M >> A >> B >> C >> T, N ) {
	
		vector < int > ans(N);
		MMatrix data(N, M);

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

		for ( int i = 0; i < N; i++ ) {
			if ( i > 0 ) data.mat[i][i - 1] = A;
			if ( i < N - 1 ) data.mat[i][i + 1] = C;
			data.mat[i][i] = B;
		}

		data = data ^ T;
		ans = data * ans;

		cout << ans[0];
		for ( int i = 1; i < N; i++ ) {
			cout << " " << ans[i];
		}
		cout << endl;
	
	}

	return ( 0 );
}



Measured memory_bytes: 3204
#include <bits/stdc++.h>
#define ALL(v) v.begin(), v.end()
#define ALLG(v) v.begin(), v.end() ,greater<int>()
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
ll GCD(ll x, ll y) { return y ? GCD(y, x % y) : x; }
ll LCM(ll x, ll y) { return x * y / GCD(x, y); }
ll GetDigit(ll num) {
	ll digit = 0;
	while (num != 0) {
		num /= 10;
		digit++;
	}
	return digit;
}
 
using namespace std;
int main() {
	int s, w;
	cin >> s >> w;
 
	if (s <= w) cout << "unsafe" << endl;
	else cout << "safe" << endl;
	
 
 
 
 
 
 
}

Measured memory_bytes: 3624
#include <cstdio>
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <cassert>

using namespace std;
using ll = long long int;

#define rep(i, n) for(ll i = 0; i < (n); i++)

ll N, M;

void make(ll a, ll b, ll c) {
  rep(i, c) {
    cout << a << " " << b << endl;
    a++;
    b--;
  }
}

int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);
  cin >> N >> M;

  make(1, M, M / 2);
  make(M + 1, 2 * M + 1, (M + 1) / 2);

  return 0;
}

Measured memory_bytes: 3196
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		solve();
	}

	private static void solve() {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] nums = new int[n];

		for (int i = 0; i < n; i++) {
			nums[i] = sc.nextInt();
		}
		sc.close();

		int v;
		int j;
		printArray(nums);

		for (int i = 1; i < n; i++) {
			v = nums[i];
			j = i - 1;
			while (j >= 0 && nums[j] > v) {
				nums[j + 1] = nums[j];
				j--;
				nums[j + 1] = v;
			}
			printArray(nums);
		}
	}

	private static void printArray(int[] array) {
		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < array.length; i++) {
			sb.append(array[i]);
			if (i != array.length - 1) {
				sb.append(" ");
			}
		}
		System.out.println(sb.toString());
	}
}

Measured memory_bytes: 29192
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef long double ld;
 
#define REP(i,a,n) for(int (i)=(a); (i)<(int)(n); (i)++)
#define rep(i,n) REP(i,0,n)
#define vec vector

//N^aの、Mで割った余りを求める。
ll my_square(ll N, ll a, ll M){
  ll tempo;
  if(a==0){
    return 1;
  }else{
    if(a%2 == 0){
      tempo = my_square(N, a/2, M);
      return (tempo*tempo)%M;
    }else{
      tempo = my_square(N, a-1, M);
      return (tempo*N)%M;
    }
  }
}


//N_C_a の、Mで割った余りを求める。
ll my_combination(ll N, ll a, ll M){
  ll answer = 1;
  
  rep(i, a){
    answer *= (N-i);
    answer %= M;
  }
  
  rep(i, a){
    answer *= my_square(i+1, M-2, M);
    answer %= M;
  }
  
  return answer;
}



int main(){
  int n, a, b;
  cin >> n >> a >> b;
  
  ll M = 1000000000 + 7;
  
  ll answer = 0;
  
  ll sum_all_C = 1;
  ll C_a = my_combination(n, a, M);
  ll C_b = my_combination(n, b, M);
  
  //とりあえず 2^nにする。
  sum_all_C = my_square(2, n, M);
  
  sum_all_C -= 1;  //nC0を引く。
  //cout << sum_all_C << endl;
   
  answer = sum_all_C - C_a - C_b;
  while (answer <0){
    answer +=M;
  }
  
  //cout << sum_all_C << endl;
  //cout << C_a << endl;
  //cout << C_b << endl;
  answer = answer%M;
  cout << answer;
}

Measured memory_bytes: 256
//  RAKSHIT KADAM
//ALWAYS USE &IT FOR ITERATING USING AUTO ...
//USE COUNT(STARTING ADDRESS, ENDING ADRESS ,VALUE) FOR FINDING THE COUNT IN THE RESPECTIVE DATA STRUCTURE
//NOTE THAT MEMSET CANNOT ASSIGN A VALUE OF 10^18 IT WILL ASSIGN A LOWER VALUE THAN THAT!!!
//NOTE THAT MEMSET CANT FILL THE DOUBLE VALUES;
//ACCUMULATE DOES NOT WORK PROPERLY IF VALUES START SUMMING BEYOND 1E9...
 #include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// #define ordered_set tree< int ,  null_type ,  less<int> ,  rb_tree_tag ,  tree_order_statistics_node_update>
#warning !!!check the size of arrayss!!!

// NUMERIC DEFINITIONS :
    #define INF 2000000000000000005
    #define MOD  1000000007
    #define newMOD  998244353
    #define MAX 300006
    #define pi 3.1415926535897932384626433832795
#define ld long double
 #define ll long long
 #define int long long

 #define P(gg) for(auto rax:gg){cout<<rax<<" ";}cout<<endl;
 #define Need_for_speed(activated) ios_base :: sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
 #define satisfy ll t; cin>> t; while(t--)
 #define inp(n) int n;cin >> n
 #define mp make_pair
 #define pb push_back
 #define endl "\n"
 #define x first
 #define y second
 #define fore(i,a,b) for(ll i=a;i<b;i++)
 #define forci(i,n) for(ll i=0;i<n;i++)
 #define vi vector<ll>
 #define Endl endl
 #define lb lower_bound
 #define ub upper_bound
#define pii pair<ll,ll>

 #define input freopen("input.txt", "r", stdin),freopen("output.txt", "w", stdout)
 #define time        cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
using namespace std;

ll gcd(ll a, ll b){if (b == 0)return a;return gcd(b, a % b);}
int power(int x, unsigned int y, unsigned int m){ if (y == 0) return 1;int p = power(x, y/2, m) % m;  p = (p * p) % m;                                                  return (y%2 == 0)? p : (x * p) % m;}
ll modInverse(int a, int m){int g = gcd(a, m); { return power(a, m-2, m);}}
const int maxn= 500004;
ll bad;
void solve()
{
    ll a;long double b;
    cin>>a>>b;
    long double c =a*b;
    cout<<(ll)c<<endl;
        
}
signed main()
{
   Need_for_speed(activated);
    
//satisfy
//    {
//   solve();
//   }

    solve();
    return 0;
}



Measured memory_bytes: 3748
n=int(input())
A=list(map(int,input().split()))
ev=[0]*100010
od=[0]*100010

for i in range(n):
    if i%2==0:
        ev[int(A[i])]+=1
    else:
        od[int(A[i])]+=1

if ev.index(max(ev))==od.index(max(od)):
    ev.sort(reverse=True)
    od.sort(reverse=True)
    if ev[0]!=ev[1] and od[0]!=od[1]:
        if ev[1]>=od[1]:
            print(n//2-ev[1]+n//2-od[0])
            exit(0)
        else:
            print(n // 2 - ev[0] + n // 2 - od[1])
            exit(0)

ev.sort(reverse=True)
od.sort(reverse=True)
#print(ev)
#print(od)

print(n//2-ev[0]+n//2-od[0])


Measured memory_bytes: 14268