akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
#include<iomanip>
#include<list>
#include<deque>
using namespace std;
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define END {}
#endif
typedef long long ll;
#define int ll
#define uset unordered_set
#define umap unordered_map
typedef std::pair<int,int> P;
struct edge{int to,cost;};
const int INF=100000000000000000;
const int INF2=9223372036854775807;
const int MOD=1000000007;
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define min(X,Y) (((int)(X)<(int)(Y))?(X):(Y))
#define max(X,Y) (((int)(X)>(int)(Y))?(X):(Y))
#define MAX(X,Y) (*max_element(X,Y))
#define MIN(X,Y) (*min_element(X,Y))
#define NP(X,Y) next_permutation(X,Y)
#define setp(X,Y) cout<<fixed<<setprecision(Y)<<X;
int ceil2(int a,int b){if(a%b==0){return a/b;}else{return a/b+1;}}
int pow2(int a,int b){int r=1;for(int i=1;i<=b;i++){r*=a;}return r;}
int Log2(int a){int t=0;while(1){if(a==0||a==1){break;}a/=2;t++;}return t;}

signed main(){
	string S;
	string T[10]={"SUN","MON","TUE","WED","THU","FRI","SAT"};
	cin>>S;
	REP(i,7){
		if(S==T[i]){
			cout<<7-i<<endl;
			return 0;
		}
	}
	return 0;
}


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

const static int M = 998244353;
const static int MAX = 300000;
std::vector<long long> kai(MAX), pkai(MAX);

// int combination(int n, int k){
//     int ans;
//     return ans;
// }

long long pow(long long a, long long b){
    long long tmp = 1;
    if(a == 0 && b == 0){
	return 1;
    }
    if(a == 0){
	return 0;
    }
    if(b == 0){
	return 1;
    }
    else if(b % 2 == 0){
	tmp = pow(a, b / 2) % M;
	tmp = (tmp * tmp) % M;
	return tmp;
    }else{
	tmp = pow(a, b / 2) % M;
	tmp = (tmp * tmp) % M;
	tmp = (tmp * a) % M;
	return tmp;
    }
}

long long combination(int n, int k){
    return ((kai[n] * pkai[k] % M) * pkai[(n-k)]) % M;
}

int main(void){
    int n, m, k;
    std::cin >> n >> m >> k;

    kai[0] = 1;
    pkai[0] = 1;
    for(int i = 1; i < MAX; i++){
	kai[i] = (i * kai[i-1]) % M;
	pkai[i] = pow(kai[i], M-2);
	// std::cout << pkai[i] << " ";
    }
    // std::cout << std::endl;
    long long ans = 0;
    long long tmp = pow((m-1), n - k - 1);
    for(int i = k; i >= 0; i--){
	ans = (ans +((combination(n-1, i) * m) % M * tmp) % M) % M;
	tmp = tmp * (m - 1) % M;
    }
    std::cout << ans << std::endl;


    return 0;
}



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

int main()
{
    while(true){
        string s;
        getline(cin, s);
        int l = s.size();
        if(l == 1 && s[0] == '.') break;
        int a[250] {0};
        int now = 0;
        bool balance = true;
        for(int i = 0; i < l - 1; i++){
            if(s[i] == '('){
                a[now] = 1;
                now++;
            }
            if(s[i] == '['){
                a[now] = 2;
                now++;
            }
            if(s[i] == ')'){
                now--;
                if(now < 0){
                    balance = false;
                    break;
                }
                else if(a[now] != 1){
                    balance = false;
                    break;
                }
            }
            if(s[i] == ']'){
                now--;
                if(now < 0){
                    balance = false;
                    break;
                }
                else if(a[now] != 2){
                    balance = false;
                    break;
                }
            }
        }
        if(now != 0) balance = false;
        if(balance) cout << "yes" << endl;
        else cout << "no" << endl;
    }
}


Measured memory_bytes: 3200
#include <iostream>
#include <iomanip>
#include <vector>
#include <deque>
#include <string>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <utility>
#include <bitset>

#define REP(i,A) for(int i=0;i<A;i++)

using namespace std;

int main() {
	int N;
	cin >> N;
	vector<int> f(N+1);
	if (N % 2 == 0) {
		cout << (N - 2)*N / 2 << endl;
		for (int i = 1; i <= N / 2; i++) {
			f[i] = i;
			f[N + 1 - i] = i;
		}
		for (int i = 1; i <= N; i++) {
			for (int j = i; j <= N; j++) {
				if (f[i] != f[j]) {
					cout << i << " " << j << endl;
				}
			}
		}
	}
	else {
		cout << N - 1 + (N - 3)*(N - 1) / 2 << endl;
		for (int i = 1; i <= (N - 1) / 2; i++) {
			f[i] = i;
			f[N - i] = i;
		}
		for (int i = 1; i <= N; i++) {
			for (int j = i; j <= N; j++) {
				if (f[i] != f[j]) {
					cout << i << " " << j << endl;
				}
			}
		}
	}

	return 0;
}

Measured memory_bytes: 256
def main():
    H, W = [int(x) for x in input().strip().split()]
    tables = []
    white_count = 0
    for i in range(H):
        rows = [str(x) for x in list(input().strip())]
        white_count += rows.count(".")
        tables.append(rows)

    next_cells = [(0, 0, 1)]
    while(next_cells):
        _next_cells = []
        for next_cell in next_cells:
            y, x, step = next_cell
            if y == H-1 and x == W-1: #Goal
                tables[y][x] = str(min(step+1, int(tables[y][x])))
                continue

            for cond, ys, xs in [(y != 0,y-1,x),(y != H-1,y+1,x),(x != 0,y,x-1),(x != W-1,y,x+1)]:
                if cond: # up OK
                    if tables[ys][xs] != "#": # move OK
                        if tables[ys][xs] != ".": # 既に通った
                            if step+1 < int(tables[ys][xs]):
                                tables[ys][xs] = str(step+1)
                                _next_cells.append((ys, xs, step+1))
                        else: # 初めて通る
                            tables[ys][xs] = str(step+1)
                            _next_cells.append((ys, xs, step+1))
            # end for
        # end for
        next_cells = list(set(_next_cells)) # 重複カット
    # end while
    if tables[H-1][W-1] == ".":
        return -1
    return white_count - int(tables[H-1][W-1])
    
if __name__ == '__main__':
    print(main())

Measured memory_bytes: 3188
#include <iostream>

using namespace std;

int main() {
    int n, x;
    cin >> n >> x;
    int ans = 1;
    int sum = 0;
    for(int i = 0; i < n; ++i){
        int l;
        cin >> l;
        sum += l;
        if(sum <= x){
            ++ans;
        }
    }

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


Measured memory_bytes: 256
package main

import "fmt"

func main() {
	n := 0
	r := make(map[string]int)
	fmt.Scan(&n)
	for i := 0; i < n; i++ {
		var s string
		fmt.Scan(&s)
		r[s]++
	}

	anss := [...]string{"AC", "WA", "TLE", "RE"}
	for _, ans := range anss {
		fmt.Println(ans, "x", r[ans])
	}
}


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

/*
int main(){
    int a,b,c,d;
    cin >> a >> b >> c >> d;

    if (d < 0) {
        if(a < 0) cout << (ll)a*(ll)c << endl;
        else cout << (ll)a*(ll)d << endl;
    }else {
        if(c < 0) {
            if(b < 0) cout << (ll)c*(ll)a << endl;
            else {
                if(a < 0) {
                    if( (ll)b*(ll)d > (ll)c*(ll)a ) cout << (ll)b*(ll)d << endl;
                    else cout << (ll)c*(ll)a << endl;
                }else cout << (ll)b*(ll)d << endl;
            }
        }else {
            if(b < 0) cout << (ll)c*(ll)b << endl;
            else cout << (ll)b*(ll)d << endl;
        }
    }
}
*/

int main(){
    ll a,b,c,d;
    cin >> a >> b >> c >> d;

    ll ans = -1e18;

    ans = max(ans, a*c);
    ans = max(ans, a*d);
    ans = max(ans, b*c);
    ans = max(ans, b*d);
    cout << ans << endl;
}



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

int main()
{
	int r,d,x[11];
	scanf("%d%d%d",&r,&d,&x[0]);
	
	for(int i=0;i<10;i++){
		x[i+1]=r*x[i]-d;
		printf("%d\n",x[i+1]);
	}
	
	return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)(n); ++i)
using P = pair<int,int>;
using ll = long long;
static const int INF = 1000000000;
static const ll MOD = 1000000007;

int n;
void dfs(string s, char mx){
  if(s.size() == n){
    cout << s << endl;
  }
  else{
    for(char c = 'a'; c <= mx; ++c){
      dfs(s + c, (mx == c) ? (char)(mx + 1) : mx);
    }
  }
}

int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cin >> n;
  dfs("", 'a');
  return 0;
}

Measured memory_bytes: 1536
#Nを取得
n = int(input())

#aをListで取得
a = list(map(int,input().split()))

#操作をできる回数を保存する変数を用意
c = 0

#実は、「a_iの値を3倍する」操作は、してもしなくても一緒。
#なので、各操作ごとに、1つのa_iについてのみ、「a_iの値を2で割る」事のみを考えればよい。

for i in range(n):  #n個のa_i全てについて調べる。
    while(a[i] % 2 == 0):   #a_iは何回2で割り切れますか？というのを繰り返す。
        c += 1
        a[i] //= 2
print(c)


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

vector<int> pre, in;
struct Node
{
    int key;
    Node* lchild, *rchild, *parent;
};


void insert(Node* &T, Node* &y, int k)
{
    if(T == NULL)
    {
        Node *t = new Node;
        t->key = k;
        t->lchild = NULL;
        t->rchild = NULL;
        if(y != NULL)
            t->parent = y;
        T = t;
        return ;
    }
    if(k > T->key) insert(T->rchild, T, k);
    else insert(T->lchild, T, k);
}

Node* find(Node* T, int k)
{
    if(T == NULL)
        return NULL;
    if(T->key == k)
        return T;
    if(k > T->key) return find(T->rchild, k);
    if(k < T->key) return find(T->lchild, k);
}
Node* treeMinimum(Node* x)
{
    while(x->lchild != NULL) x = x->lchild;
    return x;
}
Node* treeSuccessor(Node* x)
{
    if(x->rchild != NULL) return treeMinimum(x->rchild);
    Node* y = x->parent;
    while(y != NULL && x == y->rchild)
    {
        x = y;
        y = y->parent;
    }
    return y;
}

void del(Node* &T, int k)
{
    Node *y;
    Node *x;
    Node *z = find(T, k);
    if(z->lchild == NULL || z->rchild == NULL) y = z;
    else y = treeSuccessor(z);

    if(y->lchild != NULL)
        x = y->lchild;
    else
        x = y->rchild;

    if(x != NULL)
        x->parent = y->parent;
    if(y->parent == NULL)
        T = x;
    else
    {
        if(y == y -> parent->lchild)
            y->parent->lchild = x;
        else
            y->parent->rchild = x;
    }

    if(y != z)
        z->key = y->key;
    free(y);


}
void preOrder(Node* T)
{
    if(T == NULL)
        return;
    pre.push_back(T->key);
    preOrder(T->lchild);
    preOrder(T->rchild);
}

void inOrder(Node*& T)
{
    if(T == NULL)
        return;
    inOrder(T->lchild);
    in.push_back(T->key);
    inOrder(T->rchild);
}

void print(vector<int>& order)
{
    for(int i = 0; i < order.size(); i++)
    {
        cout << " ";
        cout << order[i];
    }
    cout << endl;
    order.clear();
}

int main()
{
    int n;
    cin >> n;
    Node* T = NULL;
    for(int i = 0; i < n; i++)
    {
        string com;
        cin >> com;
        if(com == "insert")
        {
            int k;
            Node* y = NULL;
            cin >> k;
            insert(T, y, k);
        }
        else if(com == "print")
        {
            preOrder(T);
            inOrder(T);
            print(in);
            print(pre);
        }
        else if(com == "find")
        {
            int k;
            cin >> k;
            if(find(T, k))
                cout << "yes" << endl;
            else
                cout << "no" << endl;
        }
        else if(com == "delete")
        {
            int k;
            cin >> k;
            del(T, k);
        }
    }
    return 0;
}



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

namespace Hitachi2020B
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            int[] abm = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int[] a = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int[] b = Console.ReadLine().Split().Select(int.Parse).ToArray();

            int min = a.Min() + b.Min();
            int[][] ms = new int[abm[2]][];

            for (int i = 0; i < abm[2]; i++)
            {
                // ms[i] = Console.ReadLine().Split().Select(int.Parse).ToArray();
                var m = Console.ReadLine().Split().Select(int.Parse).ToArray();
                ChangeMin(ref min, a[m[0]-1] + b[m[1]-1] - m[2]);
            }

            Console.WriteLine(min);
        }

        static bool ChangeMin(ref int a, int b)
        {
            if (a > b)
            {
                a = b;
                return true;
            }
            return false;
        }

    }
}


Measured memory_bytes: 36188
// be name khoda
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define pb push_back
const ll maxn=3*1e5+5;
ll a[maxn];
int main()
{
	ll n;cin >> n;
	ll s=0; ll s1=n*(n+1)/2;
	for(ll i=0;i<n;i++)
	{
		cin >> a[i];
		s+=a[i];
	}
	if (n==1)
	{
		cout << "YES";
		return 0;
	}
	if (s%s1!=0)
	{
		cout << "NO";
		return 0;
	}
	s1=s/s1;
	ll s2=s1; ll y=0;
	for(ll i=0;i<n;i++)
	{
		y=a[i]-a[(i+1)%n]+s1;
		if (y<0 || y%n)
		{
			cout << "NO";
			return 0;
		}
		s2-=y/n;
	}
	if (s2==0) cout<<"YES"; else cout<<"NO"; 
}


Measured memory_bytes: 1152
import sys
input = sys.stdin.readline
def print_ans(X):
    """Test Case
    >>> print_ans(615)
    1
    >>> print_ans(217)
    0
    """
    A, B = divmod(X, 100)
    taples = (1, 2, 3, 4, 5)
    ans = 0
    for i in taples[::-1]:
        C, B = divmod(B, i)
        ans += C
    if ans <= A:
        print("1")
    else:
        print("0")

if __name__ == '__main__':
    X = int(input().rstrip())
    print_ans(X)


Measured memory_bytes: 3064
//The best is yet to come...
 #include <iostream>
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define inf 1000000000000
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define all(v) v.begin(),v.end()
#define S second
#define F first
#define boost1 ios::sync_with_stdio(false);
#define boost2 cin.tie(0);
#define mem(a,val) memset(a,val,sizeof a)
#define endl "\n"
#define maxn 100001
ll z[maxn];
void z_algo(string str)
{
    int n = str.length();
    int L, R, k;
    L = R = 0;
    for (int i = 1; i < n; ++i)
    {
        if (i > R)
        {
            L = R = i;
            while (R<n && str[R-L] == str[R])
            R++;
            z[i] = R-L;
            R--;
        }
        else
        {
            k = i-L;
            if (z[k] < R-i+1)
            z[i] = z[k];
            else
            {
                L = i;
                while (R<n && str[R-L] == str[R])
                R++;
                z[i] = R-L;
                R--;
            }
        }
    }
}   


int main()
{
	boost1;boost2;	
	ll i,j,n,ans=0,ls,lt;
	string s,t;
	cin>>n>>s>>t;
	string temp=t+'$'+s;
	ls=s.length();
	lt=t.length();
	z_algo(temp);
	for(i=lt+1;i<=ls+lt;i++)
	{
		if(i+z[i]-1==ls+lt)
		ans=max(ans,z[i]);
	}
	cout<<2*n-ans;
	return 0;
}


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

int main()
{
	int n, num=0;
	int max=0;
	cin >> n;
	int a[n];
	for (int i=0;i<n;i++)
	{
		cin >> a[i];
		if(a[i]>=max ){num++; max=a[i];} 
		
	}
	cout << num<<endl;
	return 0;
}

Measured memory_bytes: 256
let () =
  Scanf.scanf "%s" @@ fun s ->
  let s = Array.init (String.length s) (fun i -> s.[i]) in
  Array.fold_left (fun (u, v) c ->
    match c with
    | 'A' | 'C' | 'G' | 'T' -> (max u (v+1), v+1)
    | _ -> (u, 0)) (0, 0) s
  |> fst |> Printf.printf "%d\n"
     


Measured memory_bytes: 384
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using static System.Console;
using static System.Math;


namespace AtCodeeeer
{
    class AtCOOOOOOOOOOOder
    {
        static void Main(string[] args)
        {
            string s = ReadLine();

            string aki = "AKIHABARA";
            var ls = new List<string>();
            for (int bit = 0; bit < (1 << aki.Length); ++bit)
            {
                var sb = new StringBuilder();
                for (int i = 0; i < aki.Length; ++i)
                {
                    if (((bit >> i) & 1) == 1)
                    {
                        sb.Append(aki[i].ToString());
                    }
                }
                ls.Add(sb.ToString());
            }
            var one = ls.Where(n => n.Contains("K"));
            var two = one.Where(n => n.Contains("I"));
            var three = two.Where(n => n.Contains("H"));
            var hoge = three.Where(n => n.Contains("B"));
            var piyo = hoge.Where(n => n.Contains("R"));

            bool ans = false;
            foreach (var item in piyo)
            {
                if (s == item) ans = true;
            }
            WriteLine(ans ? "YES":"NO");
        }
    }
}


Measured memory_bytes: 13396
import java.util.Scanner;

class Main{
	public static void main(String[] args) 	{
		Scanner sc = new Scanner(System.in);
		int data = sc.nextInt();
		int apart[][][];
		apart = new int[5][4][11];
		for(int i = 0 ; i < 5 ; i++) {
			for(int j = 0 ; j < 4 ; j++) {
				for(int k = 0 ; k < 11 ; k++) {
					apart[i][j][k] = 0;
				}
			}
		}
		int b,f,r,v;
		for(int i = 0 ; i < data ; i++) {
			b = sc.nextInt();
			f = sc.nextInt();
			r = sc.nextInt();
			v = sc.nextInt();
			apart[b][f][r] += v;
		}
		for(int i = 1 ; i <= 4 ; i++) {
			for(int j = 1 ; j <= 3; j++) {
				for(int k = 1; k <= 10 ; k++) {
					System.out.printf(" %d",apart[i][j][k]);
				}
				System.out.printf("\n");
			}
			if(i == 4) break;
			System.out.printf("####################\n");
		}
		sc.close();
	}
}


Measured memory_bytes: 30492
#include<iostream>
#include<set>
using namespace std;
#define int long long int
int32_t main()
{
	int h;
	cin>>h;
	int answer=0;
	int total=1;
	while(h!=0)
	{
		answer+=total;
		h/=2;
		total*=2;
	}
	cout<<answer<<endl;
}



Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<unordered_map>
using namespace std;
int main(){
int x,n;
cin>>x>>n;
unordered_map<int,int>map;
int* arr=new int[n];
for(int i=0;i<n;i++){
    cin>>arr[i];
    map[arr[i]]=1;
}
int k=1;
while(1){
    if(map.count(x)==0){
        cout<<x<<endl;
        break;
    }
    if(x-k>=0)
   if(map.count(x-k)==0){
       cout<<x-k<<endl;
       break;
   }
    if(map.count(x+k)==0){
       cout<<x+k<<endl;
       break;
   }
   k++;
  }
 
}

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

struct UnionFind {
	vector<int>data;
	UnionFind(int sz) {
		data.assign(sz, -1);
	}
	bool unite(int x, int y) {
		x = find(x), y = find(y);
		if (x == y) return false;
		if (data[x] > data[y]) swap(x, y);
		data[x] += data[y];
		data[y] = x;
		return true;
	}
	int find(int k) {
		if (data[k] < 0) return(k);
		return(data[k] = find(data[k]));
	}
	int size(int k) {
		return -data[find(k)];
	}
};

int main() {
	int n, m;
	cin >> n >> m;
	UnionFind uf(n+1);
	vector<int>p(n);
	for (int i = 0; i < n; ++i)cin >> p[i];
	for (int i = 0; i < m; ++i) {
		int x, y;
		cin >> x >> y;
		uf.unite(x, y);
	}
	int ans = 0;
	for (int i = 0; i < n; ++i) {
		if (uf.find(i + 1) == uf.find(p[i]))ans++;
	}
	cout << ans << endl;
}


Measured memory_bytes: 1024
#include<iostream>
#include<vector>
#include<cmath>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define rep(i,n) for(ll i=0;i<n;++i)
#define ocut cout
#define ouct cout
#define itn int

struct Union{
  vector<ll> par;
  Union(ll a){
  par=vector<ll>(a,-1);
  }
  ll find(ll a){
    if(par[a]<0){
      return a;
    }
    else{
      return par[a]=find(par[a]);
    }
  }
  bool same(ll a,ll b){
    return (find(a)==find(b));
  }
  ll size(ll a){
    return -par[find(a)];
  }
  void unite(ll a,ll b){
    ll c=find(a),d=find(b);
    if(c==d)
      return;
    if(size(c)<size(d)){
      swap(c,d);
    }
    par[c]+=par[d];
    par[d]=c;
  }
};
ll Nagaemon1;
void swap(ll i,ll j){
  Nagaemon1=i;
  i=j;
  j=Nagaemon1;
}
int main(){
  int r,g,b,n,a=0,t;
  cin >> r >> g >> b >> n;
  rep(i,n+1){
    rep(j,n+1){
      t=n-r*i-g*j;
      if(t%b==0&&0<=t/b&&t/b<=n)a++;
    }
  }
  cout << a;
}

Measured memory_bytes: 256
def ss(n, a):
    count = 0
    for i in range(n):
        mini = i
        for j in range(i,n):
            if a[j] < a[mini]:
                mini = j
        if i != mini:
            a[i], a[mini] = a[mini], a[i]
            count += 1
    print " ".join(map(str, a))
    print count
    
n = int(raw_input())
a = map(int, raw_input().split())
ss(n, a)

Measured memory_bytes: 4224
// Copyright 2017 Qi Wang
// Date: 2017-05-13
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
  int n;
  cin >> n;
  vector<int> skewers;
  for (int i = 0; i < (n << 1); ++i) {
    int skewer;
    cin >> skewer;
    skewers.push_back(skewer);
  }
  sort(skewers.begin(), skewers.end());
  int result = 0;
  for (int i = 0; i < (n << 1); i += 2)
    result += skewers[i];
  cout << result << endl;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <vector>

using namespace std;

typedef long long ll;

void solve() {
  int n;
  cin >> n;
  int ret = 2e9;
  while(n--) {
    int a, b;
    cin >> a >> b;
    ret = min(ret, a+b);
  }
  cout << ret << endl;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL); cout.tie(NULL);
  solve();
  /*
  int t;
  cin >> t;
  for(int i = 1; i <= t; i++) {
    cout << "Case #" << i << ": ";
    solve();
  }
  */
}


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

typedef long long int ll;
typedef long double ld;
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define MOD (ll)(1e9 + 7)
#define vi vector<int>
#define vii vector<vector<int> >
#define vl vector<ll>
#define vll vector<vector<ll> >
#define vc(T, nm) vector<T> nm
#define pb push_back
#define popb pop_back
#define si set<int>
#define sl set<ll>
#define F first
#define S second
#define pii pair<int, int>
#define mp make_pair
#define ins insert
#define ers erase
#define endl "\n"
#define mul(a, b) ((a % MOD) * (b % MOD)) % MOD
#define adr(a, b) ((a % MOD) + (b % MOD)) % MOD
#define FORA(x, s, e, inc) for(ll x = s; x != e; x += inc)
#define ROFA(x, s, e, inc) for(ll x = s; x != e; x -= inc)
#define FOR(x, s, e) FORA(x, s, e, 1)
#define ROF(x, s, e) ROFA(x, s, e, 1)
#define loop(x, n) FOR(x, 0, n)
#define rd1(t, a) 					t a; cin >> a;
#define rd2(t, a, b) 				rd1(t, a); rd1(t, b); 
#define rd3(t, a, b, c) 			rd2(t, a, b); rd1(t, c);
#define rd4(t, a, b, c, d) 			rd3(t, a, b, c); rd1(t, d);
#define rd5(t, a, b, c, d, e) 		rd4(t, a, b, c, d); rd1(t, e);
#define rd6(t, a, b, c, d, e, f) 	rd5(t, a, b, c, d, e); rd1(t, f);
#define rdA(t, nm, len)				t nm[len]; loop(i, len) {cin >> nm[i];}
#ifdef DEBUG
	#define deb(v) cout << endl << #v << ": " << v << endl
	#define db1(v) cout << endl << #v << ": " << "[ "; for(auto x: v) {cout << x << " ";}; cout << "]" << endl;
	#define db2(v) cout << endl << #v << ": " << endl; for(auto r: v) {cout << "[ "; for(auto x: r) {cout << x << " ";}; cout << "]" << endl;};
	#define dbl cout << "-------------------------------" << endl
#else
	#define deb(v)
	#define db1(v)
	#define db2(v)
	#define dbl
#endif

void solve() {
    rd1(ll, n);
    vl A(n);
    
    vl MX(n), ST(n, 0);
    
    FOR(i, 0, n) {
        cin >> A[i];
    }
    
    MX[0] = A[0];
    
    FOR(i, 1, n) {
        MX[i] = max(MX[i - 1], A[i]);
    }
    
    FOR(i, 0, n) {
        if(MX[i] > A[i]) {
            ST[i] = abs(MX[i] - A[i]);
        }
    }
    
    ll ans = 0;
    FOR(i, 0, n) {
        ans += ST[i];
    }
    
    cout << ans;
    
    
}


int main() {
	
	fastio;
	
	ll t = 1;
// 	rd1(ll, t);
    while(t--) {
        solve();
    }


	return 0;
}

Measured memory_bytes: 7920
#include<iostream>

using namespace std;

int dp[112345][3];

int N;
int main () {
    cin >> N;
    for(int i=0; i<N; i++) {
        for(int j=0; j<3; j++) cin >> dp[i][j];
    }
    for(int i=0; i<N; i++) {
        for(int j=0; j<3; j++) {
            int a = (j+1) % 3;
            int b = (j+2) % 3;
            dp[i+1][j] += max(dp[i][a], dp[i][b]);
        }
    }
    int ans = 0;
    for(int i=0; i<3; i++) ans = max(ans,dp[N-1][i]);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1408
#include<stdio.h>
#include<string.h>
#include<stdlib.h>

int main(){

	char str[21];
	int i,j;
	char output[21]={'\0'};
	int s,t;
	s=0;
	t=0;
	scanf("%s",str);
	i = strlen(str);

	for(j=0;j<i;j++){
		if(str[j]=='A'){
			s=1;
		
		}
		else if(str[j]=='Z' && s==1){
			s=0;
			output[t]='A';
			output[t+1]='Z';
			t=t+2;
		}
	}
	if(t>0)printf("%s\n",output);
	else printf("-1\n");
	return 0;
}

Measured memory_bytes: 524
import java.io.*
import java.util.*
import java.lang.*
import java.lang.Math.*

fun primeFactorize(N: Long): Map<Long, Int> {
    if (N <= 1L) return mapOf()
    val fact = mutableMapOf<Long, Int>()
    var n = N
    var i = 2L
    while (i * i <= n) {
        while (n%i == 0L) {
            fact[i] = (fact[i] ?: 0) + 1
            n /= i
        }
        i++
    }
    if (n != 1L) {
        fact[n] = (fact[n] ?: 0) + 1
    }
    return fact
}

fun solve() {
    val (N, P) = rd.readLongArray()

    if (N == 1L) {
        println(P)
        return
    }

    val pfs = primeFactorize(P)
    var gcd = 1L
    for (pf in pfs) {
        val n = pf.value / N
        if (n <= 0) continue
        else {
            for (i in 0 until n) {
                gcd *= pf.key
            }
        }
    }

    val ans = gcd
    println(ans)
}


//val rd = debug.Reader("etc", "caddi2018", "a", "sample-1")
val rd = Reader()


fun main(args: Array<String>) {
    try {
        var exception: Throwable? = null
        val sth = Thread(null, SolveThread(), "solveThread", 128 * 1024 * 1024)
        sth.setUncaughtExceptionHandler { _, e -> exception = e }
        sth.start(); sth.join()
        if (exception != null) throw exception!! }
    catch (e: Exception) { throw e }
    finally { rd.close() }
}
const val MOD = 1_000_000_007L; const val INF = Int.MAX_VALUE/2; const val LINF = Long.MAX_VALUE/2
data class IntPair(val first: Int, val second: Int)
val errPrintln: (Any) -> Unit = { msg -> System.err.println(msg) }
fun rAssert(exp: Boolean, lazyMsg: () -> String = {""}) {
    if (!exp) { val msg = lazyMsg(); errPrintln("EAssert Error: $msg"); throw Error(msg) }
}
fun tAssert(exp: Boolean, lazyMsg: () -> String = {""}) {
    if (!exp) { val msg = lazyMsg(); errPrintln("TAssert Error: $msg"); Thread.sleep(3000) }
}
class SolveThread : Runnable {
    override fun run() { solve() }
}
class Reader {
    private val br = BufferedReader(InputStreamReader(System.`in`))
    val readString: () -> String = { br.readLine() }
    val readInt: () -> Int = { br.readLine().toInt() }
    val readLong: () -> Long = { br.readLine().toLong() }
    val readIntArray: () -> IntArray = { br.readLine().split(' ').map { it.toInt() }.toIntArray() }
    val readLongArray: () -> LongArray = { br.readLine().split(' ').map { it.toLong() }.toLongArray() }
    val readListInt: () -> List<Int> = { br.readLine().split(' ').map { it.toInt() } }
    val readListLong: () -> List<Long> = { br.readLine().split(' ').map { it.toLong() } }
    val readListIntCol: (Int) -> List<Int> = { N -> (0 until N).map { readInt() } }
    val readListIntCols: (Int) -> List<List<Int>> = { N -> (0 until N).map { br.readLine().split(' ').map { it.toInt() } } }
    val readListLongCol: (Int) -> List<Long> = { N -> (0 until N).map { readLong() } }
    val readListLongCols: (Int) -> List<List<Long>> = { N -> (0 until N).map { br.readLine().split(' ').map { it.toLong() } } }
    val close: () -> Unit = { br.close() }
    protected fun finalize() { close() }
}


Measured memory_bytes: 36488
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;

int main(){
  string s[3];
  cin >> s[0] >> s[1] >> s[2];
  cout << s[0][0] << s[1][1] << s[2][2] << endl;
  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <cmath>
#include <cstring> 
#include <sstream>
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <memory.h>
#include <iomanip>
#include <bitset>
#include <list>
#include <stack>
 
using namespace std;
 
#define pai 3.14159265359
#define mod 1000000007

int main()
{
    long long int a, b;
    cin >> a >> b;
    if(a > 0) cout << "Positive" << endl;
    else if(a * b <= 0) cout << "Zero" << endl;
    else {
        if((b - a + 1) % 2 == 0) cout << "Positive" << endl;
        else cout << "Negative" << endl;
    }
    return 0;
}

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

#define min3(a,b,c)   min(a,min(b,c))
#define max3(a,b,c)   max(a,max(b,c))
#define min4(a,b,c,d) min(min(a,b),min(c,d))
#define max4(a,b,c,d) max(max(a,b),max(c,d))

#define count_one(a) __builtin_popcount(a)  // Returns the number of set bits(1) in a number(a). In long long use __builtin_popcountll(a)
#define parity(i)    __builtin_parity(i)  //even parity 0 and odd parity 1
#define blz(a)       __builtin_clz(a) //Returns the number of leading zeroes in a number(a)
#define btz(a)       __builtin_ctz(a) //Returns the number of trailing zeroes in a number(a)
#define gcd(a,b)     __gcd(a,b)
#define lcm(a,b)     (a*(b/gcd(a,b)))

#define pb   push_back
#define PI   M_PI
#define endl "\n"
#define sc   scanf
#define pf   printf

#define ll  long long
#define ull unsigned long long

#define W(t)            while(t--)
#define rep1(i,n)       for(int i = 0; i < n; i++)
#define rep2(a,b)       for(int i = a; i <= b; i++)
#define rep3(a,b,c)     for(int i = a; i <= b; i+=c)
#define irep(a,b,c)     for(int i = b; i >=a; i-=c)
#define repit(it,type)  for(it = type.begin(); it != type.end(); it++)
#define IOS ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
using namespace std;
using namespace __gnu_cxx;

int main()
{
     IOS
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    int n=6,x;
    int a[n];
    for(int i = 1; i <= 5; i++)
    {
         cin>>a[i];
         if(a[i]==0)
         {
              x=i;
         }

    }
    cout<<x<<endl;

     return 0;
}



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

int main(){
  int N, K;
  cin >> N >> K;
  if(N % K == 0){
    cout << 0 << endl;
  } else {
    cout << 1 << endl;
  }
}


Measured memory_bytes: 256
h,w = map(int,input().split())
a = [[i for i in input()] for j in range(h)]
b = [a[i] for i in range(h) if "#" in a[i]]
#print(b)
t = [i for i in zip(*b)]
c = zip(*[i for i in t if "#" in i])
for d in c:
    print("".join(d))


Measured memory_bytes: 3188
#include "bits/stdc++.h"

#define REP(i,n) for(ll i=0;i<ll(n);++i)
#define RREP(i,n) for(ll i=ll(n)-1;i>=0;--i)
#define FOR(i,m,n) for(ll i=m;i<ll(n);++i)
#define RFOR(i,m,n) for(ll i=ll(n)-1;i>=ll(m);--i)
#define ALL(v) (v).begin(),(v).end()
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());
#define INF 1000000001ll
#define MOD 1000000007ll
#define EPS 1e-9

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


using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;



int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	while (cin >> n, n) {
		vector<string> s(n);
		REP(i, n)cin >> s[i];
		vvi v(n);
		vi p(10);
		REP(i, 10)p[i] = i;

		vi c(26, -1);
		int t = 0;
		REP(i, n)REP(j, s[i].size()) {
			if (c[s[i][j] - 'A'] == -1) {
				c[s[i][j] - 'A'] = t++;
			}
		}
		REP(i, n) {
			v[i].resize(s[i].size());
			REP(j, s[i].size()) {
				v[i][j] = c[s[i][j] - 'A'];
			}
		}

		int ans = 0;
		do {
			bool ok = true;
			int sum1 = 0;
			REP(i, n)if (v[i].size() != 1 && p[v[i][0]] == 0)ok = false;
			if (!ok)continue;
			REP(i, n - 1) {
				int tmp = 0;
				REP(j, v[i].size()) {
					tmp *= 10;
					tmp += p[v[i][j]];
				}
				sum1 += tmp;
			}
			int sum2 = 0;
			REP(j, v[n - 1].size()) {
				sum2 *= 10;
				sum2 += p[v[n - 1][j]];
			}
			if (sum1 == sum2)ans++;
		} while (next_permutation(ALL(p)));
		REP(i, 10 - t)ans /= (i + 1);
		cout << ans << endl;
	}
}


Measured memory_bytes: 3140
#include <bits/stdc++.h>
using namespace std;
int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	string s,t;
	cin>>s>>t;
	bool flag = true;
	for(int i=0;i<s.size();i++)
	{
		if(s[i]!=t[i])
		{
			flag = false;
			break;
		}
	}
	if(flag)cout<<"Yes";
	else	cout<<"No";
}

Measured memory_bytes: 3636
#import pysnooper
#import numpy
#import os,re,sys,operator
#from collections import Counter,deque
#from operator import itemgetter,mul
#from itertools import accumulate#,combinations,groupby,combinations_with_replacement,permutations
from sys import stdin,setrecursionlimit
#from bisect import bisect_left,bisect_right
#from copy import deepcopy
#import heapq
#import math
#import string
#from time import time
#from functools import lru_cache,reduce
#from math import factorial
#import sys
from fractions import gcd
setrecursionlimit(10**6)
input=stdin.readline

def lcm(n,m):
    return (n*m)//gcd(n,m)
a,b=map(int,input().split())
print(lcm(a,b))

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

using namespace std;

int n, t[100001], x[100001], y[100001];

int main(){
	cin >> n;
	for(int i = 0; i < n; ++i) cin >> t[i+1] >> x[i+1] >> y[i+1];

	for(int i = 1; i <= n; ++i){
		int interval = t[i]-t[i-1];
		int distance = abs(x[i]-x[i-1])+abs(y[i]-y[i-1]);
		if( !(interval%2==distance%2 && interval>=distance) ){
			cout << "No" << endl;
			return 0;
		}
	}
	
	cout << "Yes" << endl;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
#define ll long long
#define mod 1000000007
#define pb push_back
#define fi first
#define se second
#define mp make_pair
#define pi pair<ll,ll>
using namespace std;
int main(){
	//	freopen("in.txt","r",stdin);
	int A[100100];
	int N;
	int ans= 0;
	int flag = 0;
	scanf("%d",&N);
	for (int i = 0; i < N; ++i)
	{
		scanf("%d",&A[i]);
	}
	for (int i = 0; i < N-1; ++i)
	{
		if(A[i] < A[i+1]){
			if(flag < 0) {
				flag = 0;
			}else if(flag == 0){
				ans++;
				flag = 1;
			}
		}else if(A[i]>A[i+1]){
			if(flag > 0) {
				flag = 0;
			}else if(flag == 0){
				flag = -1;
				ans++;
			}
		}
	}
	if(flag == 0) ans += 1;
	printf("%d\n",ans);
	return 0;
}

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

int main() {
	// your code goes here
	string s;
	bool x=false;
	cin >> s;
	for(int i=0;i<s.size();i++){
		for(int j=i+1;j<s.size();j++){
			if(s[i]==s[j])  x=true;
		}
	}
	if(x==true) cout<<"no"<<endl;
	else cout<<"yes"<<endl;
	return 0;
}

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

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

using namespace std;

typedef long long ll;

const ll MOD = 1000000007LL;
int N;

map<ll,int> prime_factor(ll n) {
  map<ll,int> res;
  for(ll i=2;i*i<=n;i++) {
    while(n % i == 0) {
      ++res[i];
      n /= i;
    }
  }
  if(n != 1)res[n] = 1;
  return res;
}


void compute() {
  map<ll,int> pf;
  REP(i,1,N+1) {
    map<ll,int> tmp = prime_factor(i);
    for(auto v : tmp) {
      pf[v.first] += v.second;
    }
  }
  pf[1] = 0;
  ll ans = 1;
  for(auto v : pf) {
    ans *= (ll)( (ll)v.second + 1LL );
    ans %= MOD;
  }
  cout << ans << endl;
}

int main() {
  cin >> N;
  compute();
  return 0;
}


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

using namespace std;

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a, 0, sizeof a)
#define minus(a) memset(a, -1, sizeof a)
#define watch(a) { std::cout << #a << " = " << a << "\n"; }
template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); }
template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); }
template<class T, class V> istream& operator>> (istream& ist, pair<T, V>& p) { return ist >> p.first >> p.second; }
template<class T> ostream& operator<< (ostream& ost, pair<T, T>& p) { return ost << p.first << ", " << p.second; }
template<class T> istream& operator>> (istream& ist, vector<T>& vs) { for(auto& e: vs) ist >> e; return ist; }

typedef long long ll;
int const inf = INT_MAX / 2;

int main() {
  int N; cin >> N;
  N += 2;
  vector<int> h(N);
  REP(i, 1, N - 1) {
    cin >> h[i];
  }
  int up = 0;
  int sum = 0;
  int pmin = 0;
  rep(i, N - 1) {
    if (h[i] < h[i + 1] && !up) {
      pmin = h[i];
      up = 1;
    }
    if (h[i] > h[i + 1] && up) {
      sum += h[i] - pmin;
      up = 0;
    }
  }
  cout << sum << endl;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif

#define ll long long
#define FOR(i,a) for(ll i=0;i<(ll)a.size();i++)
#define pb push_back
#define ld long double
#define mp make_pair
#define F first
#define S second
#define pii pair<ll,ll> 

using namespace :: std;

const ll maxn=1e6+100;
const ll mod=1e9+7;

ll f[maxn];
ll n;

inline ll find_dp(ll i){
	if(i>n){
		return 1;
	}
	return f[i];
}
inline ll ok(ll a){
	while(a<0)a+=mod;
	while(a>=mod)a-=mod;
	return a;
}
int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	cin>>n;
	f[n]=n;
	ll sum= n-1 ;
	for(ll i=n-1;i>=1;i--){
		// sum= i+3 i+4   ... i+n+1
		f[i]=ok((n-1)*(n-1)+sum+find_dp(i+1));
		sum+=find_dp(i+2)-find_dp(i+n+1);

		if(sum<0)sum+=mod;
		if(sum>=mod)sum-=mod;
   	}

	cout<<f[1];
}		


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

int main(void){
  int t [50][27] = {};
  int res[27] = {};
  int n;
  string st;
  cin >> n;
  for(int i = 0;i<n;i++){
    cin >> st;
    for(auto c : st) t[i][c - 'a']++;
  }
  fill(res, res+27, 51);
  // for(int i = 0;i < n;i++){
  //   cout << i << ": ";
  //   for(int j = 0;j<27;j++){
  //     cout << t[i][j] << " ";
  //   }
  //   cout << endl;
  // }
  for(int i = 0;i<27;i++){
    for(int j = 0;j < n;j++) res[i] = min(t[j][i],res[i]);
  }
  // cout << "   ";
  // for(int i = 0;i<27;i++) cout << res[i] << " ";
  // cout << endl;
  for(int i = 0;i<27;i++){
    for(int j = 0;j<res[i];j++){
      char c = 'a' + i;
      cout << c;
    }
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(X,N) for(ll X = 0; X < (N); X++)
#define PI (acos(-1.0))
#define pback push_back
#define mpair make_pair
#define divceil(A, B) ((A + (B - 1)) / B)
#define MODN 1000000007
#define ALL(V) (V).begin(),(V).end()
#define CERR if(false) cerr

typedef long long ll;

using namespace std;

int main(){

    string s;
    cin >> s;

    string ans;

    rep(i,s.size()){
        if(i % 2 == 0) ans += s[i];
    }

    cout << ans << endl;

    

    return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)   // 0-indexed昇順

int main() {
    int K; cin >> K;
    string S; cin >> S;
    if (S.size() <= K) {
        cout << S << endl;
        return 0;
    } else {
        cout << S.substr(0, K) << "..." << endl;
    }
}


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

#define ll long long
#define ull unsigned long long

using namespace std;

int main() {
	ll N;
	cin >> N;

	vector <ll> x(N);
	vector <ll> y(N);
	for (int ii = 0; ii < N; ++ii){
		cin >> x[ii] >> y[ii];
	}

	map <pair<ll, ll>, ll> m;
	ll cnt = 0;
	for (int ii = 0; ii < N; ++ii){
		for (int jj = 0; jj < N; ++jj){
			if (ii == jj){
				continue;
			}
			ll dx = x[ii] - x[jj];
			ll dy = y[ii] - y[jj];
			m[make_pair(dx, dy)]++;
			cnt = max(cnt, m[make_pair(dx, dy)]);
		}
	}

	cout << N - cnt << "\n";

	return 0;
}


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

int main() {
	int x, prime[111111]={1,1}; cin>>x;
	
	for(int i=2;i<111111;i++){
		if(prime[i]==1) continue;
		for(int j=2;i*j<111111;j++){
			if(prime[i*j]!=1) prime[i*j]=1;
		}
	}
	
	while(1){
		if(prime[x]==0) break;
		x++;
	}
	cout<<x;
	
	return 0;
}

Measured memory_bytes: 768
#左右それぞれで一番近い神社
#その神社それぞれの左右それぞれで一番近い寺
#はい２ぶたん

INF = 10**12

from bisect import bisect_right
 
A,B,Q = map(int,input().split())
s = [int(input()) for i in range(A)]
t = [int(input()) for i in range(B)]
ans =[]
for i in range(0,Q,1):
    tmpans = INF

    q = int(input())
    sr = bisect_right(s,q)
    sl = sr-1
    sr = min(sr,A-1)
    sl = max(0,sl)
    for j in (sr,sl):
        tr = bisect_right(t,s[j])
        tl = tr-1
        tr = min(tr,B-1)
        tl = max(0,tl)
        ansR=abs(s[j]-q)+abs(s[j]-t[tr])
        ansL=abs(s[j]-q)+abs(s[j]-t[tl])
        tmpans = min(tmpans,ansR,ansL)

    
    tr = bisect_right(t,q)
    tl = tr-1
    tr = min(tr,B-1)
    tl = max(0,tl)
    for j in (tr,tl):
        sr = bisect_right(s,t[j])
        sl = sr-1
        sr = min(sr,A-1)
        sl = max(0,sl)
        ansR=abs(t[j]-q)+abs(t[j]-s[sr])
        ansL=abs(t[j]-q)+abs(t[j]-s[sl])
        tmpans = min(tmpans,ansR,ansL)
    
    ans.append(tmpans)

for i in range(0,Q,1):
    print(ans[i])

Measured memory_bytes: 94736
S = list(input())
ans = 0
odd = []
even = []

i = 0
while i < len(S):
  odd.append(S[i])
  i += 2
    
j = 1
while j < len(S):
  even.append(S[j])
  j += 2
    
if ('L' not in odd) and ('R' not in even):
  print('Yes')
else:
  print('No')

Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <cmath>

#define EPS (1e-10)
#define EQ(a,b) (abs((a)-(b))<EPS)

using namespace std;

// dp[a]->aÔÌ}X©çX^[gµ½Æ«ÌúÒl
double dp[51][5001][2];
vector<int> roulette;
int x,y,z;
struct info{
    int e,a;
};

info mass[51];

double dfs(int p,int money,int eve){
    if(p==y)
        return money;
    if(!EQ(dp[p][money][eve],-1))
        return dp[p][money][eve];
    double expMoney=0.0;
    if(mass[p].e==1&&eve==0)
        expMoney=dfs(min(y,p+mass[p].a),money,1);
    else{
        int nmoney=money;
        if(mass[p].e==2&&eve==0)
            nmoney+=mass[p].a;
        else if(mass[p].e==3&&eve==0)
            nmoney-=mass[p].a;
        if(nmoney<0){
            nmoney=0;
        }
        // [bgÌÚÉ¶ÄæÌ}XÖiÞ
        for(int i = 0; i < roulette.size(); i++){
            int prog=roulette[i];
            expMoney+=dfs(min(y,p+prog),nmoney,0)*(1.0/(roulette.size()));
        }
    }
    dp[p][money][eve]=expMoney;
    return dp[p][money][eve];
}

int main(){

    while(cin>>x>>y>>z&&!(x==0&&y==0&&z==0)){
        for(int i = 0; i < 51; i++){
            for(int j = 0; j < 5001; j++)
                for(int k = 0; k < 2; k++)
                    dp[i][j][k]=-1;
            mass[i].e=0;
        }
        roulette.clear();
        for(int i = 0;i < x; i++){
            int t;
            cin>>t;
            roulette.push_back(t);
        }
        for(int i = 0; i < z; i++){
            int n,e,a;
            cin>>n>>e>>a;
            mass[n].a=a;
            mass[n].e=e;
        }
        int res=(int)(dfs(0,0,0)+EPS);
        cout<<res<<endl;
    }

    return 0;
}

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

#define lint long long
#define P pair<int, int>
#define LLP pair<long long, long long>
#define REP(i, x, n) for(int i = (x), i##_len = (int)(n) ; i < i##_len ; ++i)
#define rep(i, n) for(int i = 0, i##_len = (int)(n) ; i < i##_len ; ++i)
#define reps(i, n) for(int i = 1, i##_len = (int)(n) ; i <= i##_len ; ++i)
#define rrep(i, n) for(int i = (int)(n) - 1 ; i >= 0 ; --i)
#define rreps(i, n) for(int i = (int)(n) ; i > 0 ; --i)
#define SORT(x) sort((x).begin(), (x).end())
#define SORT_INV(x) sort((x).rbegin(), (x).rend())

const int IINF = (1 << 30) - 1;
const long long LLINF = 1LL << 61;
const long long MOD = 998244353LL;
const int dx4[] = {1, 0, -1, 0}, dy4[] = {0, 1, 0, -1};
const int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};
const double EPS = 1e-8;

lint n, sum = 0;
vector<lint> a;
lint dp1[301][90001] = {0LL}, dp2[301][90001] = {0LL};

long long power(long long _x, long long _n){
    long long res = 1;
    _x %= MOD;
    while(_n > 0LL){
        if(_n & 1LL){
            res *= _x;
            res %= MOD;
        }
        _x *= _x;
        _x %= MOD;
        _n >>= 1;
    }
    return res;
}

long long moddiff(long long _a, long long _b){
    _b %= MOD;
    return (_a - _b + MOD) % MOD;
}

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

    cin >> n;

    a.resize(n);
    rep(i, n){
        cin >> a[i];
        sum += a[i];
    }

    dp1[0][0] = 1;
    dp2[0][0] = 1;
    rep(i, n){
        rep(j, 90001){
            dp1[i + 1][j] += dp1[i][j] * 2LL % MOD;
            dp1[i + 1][j] %= MOD;
            dp2[i + 1][j] += dp2[i][j];
            dp2[i + 1][j] %= MOD;
            if(j + a[i] <= 90000){
                dp1[i + 1][j + a[i]] += dp1[i][j];
                dp1[i + 1][j + a[i]] %= MOD;
                dp2[i + 1][j + a[i]] += dp2[i][j];
                dp2[i + 1][j + a[i]] %= MOD;
            }
        }
    }

    lint ans = power(3, n);
    REP(j, (sum + 1) / 2, sum + 1){
        ans = moddiff(ans, dp1[n][j] * 3LL % MOD);
    }
    if(sum % 2LL == 0LL){
        ans += dp2[n][sum / 2] * 3LL % MOD;
        ans %= MOD;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 422912
fun main(args: Array<String>)
{
    val fee = readLine()!!.split(" ").map(String::toInt).toIntArray().sorted()
    println(fee[0] + fee[1])
}

// Read an integer
// Usage: val a = readInt()
fun readInt() = readLine()!!.toInt()

// Read N integers separated by " "
// Usage: val (a, b, c) = readNInts()
fun readNInts() = readLine()!!.split(" ").map(String::toInt)

// Read a string
// Usage: val a = readString()
fun readString() = readLine()!!


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

#define fi first
#define se second
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define INF  (1<<30)
#define INFL (1LL<<60)
#define MOD 1000000007
#define EPS ((ld)(1e-9))

#define sz(x) ((int)(x).size())
#define setz(x) memset(x, 0, sizeof(x))
#define rep(i, x)  for (int i = 0, _##i = (x); i < _##i; i++)
#define repp(i, x) for (int i = 1, _##i = (x); i <= _##i; i++)
#define repr(i, s, e) for (int i = (s), _##i = (e); i < _##i; i++)

#define L(x) ((x)*2)
#define R(x) ((x)*2+1)

using namespace std;

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

template<typename T, typename V>
ostream &operator<<(ostream &os, const pair<T, V> pai) { 
    os << pai.first << ' ' << pai.second;
	return os;
}

template<typename T>
ostream &operator<<(ostream &os, const vector<T> v) {
    rep(i, sz(v)) cout << v[i] << ' ';
    return os;
}

template<typename T, typename V>
istream &operator>>(istream &is, pair<T, V> &pai) {
	is >> pai.first >> pai.second;
	return is;
}

int A, B, C;

int main(void) {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr), cout.tie(nullptr);

    cin >> A >> B >> C;
    cout << min(C, B/A);
}   




Measured memory_bytes: 256