akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <cmath>
#include <climits>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <cassert>
#include <functional>

using namespace std;

#define LOG(...) printf(__VA_ARGS__)
//#define LOG(...)
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).rbegin(),(c).rend())
#define CLR(a) memset((a), 0 ,sizeof(a))

typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

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

struct UnionFind {
	vector<int> v;
	UnionFind(int n) : v(n)  { for (int i = 0; i < n; i++) v[i] = i; }
	int  find(int x)         { return v[x] == x ? x : v[x] = find(v[x]); }
	void unite(int x, int y) { v[find(x)] = find(y); }
};

int main() {
	string s;
	cin >> s;
	int ans=0;
	char c = s[0];
	FOR(i,1,s.length()){
		if (c != s[i]) {
			ans++;
			c = s[i];
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define outc cout
#define int long long
signed main(){
  int a,g[1000000]={};
  int b=0,c=1,d,e=0,f=1000000,l=0;
  cin>>a;
  for(int i=1;i<=(a+1)/2;i++){
    b=a-i;
    c=i;
    e=0;
    while(true){
      if(b==0) break;
      e+=b%10;
      b/=10;
    }
    while(true){
      if(c==0) break;
      e+=c%10;
      c/=10;
    }
    f=min(e,f);
  }
  outc<<f<<"\n";
  }


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

ull sum[200005] = {0};
ull n, x;

ull solve();

int main() {
  cin >> n >> x;
  for(ull i = 1; i <= n; ++i) {
    ull a;
    cin >> a;
    sum[i] = sum[i - 1] + a;
  }
  cout << solve() << endl;
  return 0;
}

ull solve() {
  ull ans = 0;
  for(ull i = 1; i <= n; ++i) {
    ull now = n, j = 1, nans = 0;
    while(1) {
      if(j == 1)
        nans += sum[now] * 5;
      else if(j >= 2)
        nans += sum[now] * (2 * j + 1);
      now -= i;
      if(now == 0 || now > n) break;
      if(j == 1)
        nans -= sum[now] * 5;
      else if(j >= 2)
        nans -= sum[now] * (2 * j + 1);
      ++j;
    }
    nans += x * (n + i);
    if(i == 1) ans = nans;
    ans = min(nans, ans);
  }
  return ans;
}

Measured memory_bytes: 1792
def calcRestNum(a, b, ret):
    if a < b:
        ret += a
        b -= a
        a = 0
    else:
        ret += b
        a -= b
        b = 0
    return [a, b, ret]

if __name__ == '__main__':
    N = int(input())
    A = [int(a) for a in input().split()]
    B = [int(b) for b in input().split()]

    ret = 0
    for n in reversed(range(N)):
        A[n + 1], B[n], ret = calcRestNum(A[n + 1], B[n], ret)
        A[n], B[n], ret = calcRestNum(A[n], B[n], ret)
    print(ret)

Measured memory_bytes: 18432
#![allow(non_snake_case)]
#![allow(dead_code)]
#![allow(unused_macros)]
#![allow(unused_imports)]

use std::str::FromStr;
use std::io::*;
use std::collections::*;
use std::cmp::*;

struct Scanner<I: Iterator<Item = char>> {
    iter: std::iter::Peekable<I>,
}

macro_rules! exit {
    () => {{
        exit!(0)
    }};
    ($code:expr) => {{
        if cfg!(local) {
            writeln!(std::io::stderr(), "===== Terminated =====")
                .expect("failed printing to stderr");
        }
        std::process::exit($code);
    }}
}

impl<I: Iterator<Item = char>> Scanner<I> {
    pub fn new(iter: I) -> Scanner<I> {
        Scanner {
            iter: iter.peekable(),
        }
    }

    pub fn safe_get_token(&mut self) -> Option<String> {
        let token = self.iter
            .by_ref()
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        if token.is_empty() {
            None
        } else {
            Some(token)
        }
    }

    pub fn token(&mut self) -> String {
        self.safe_get_token().unwrap_or_else(|| exit!())
    }

    pub fn get<T: FromStr>(&mut self) -> T {
        self.token().parse::<T>().unwrap_or_else(|_| exit!())
    }

    pub fn vec<T: FromStr>(&mut self, len: usize) -> Vec<T> {
        (0..len).map(|_| self.get()).collect()
    }

    pub fn mat<T: FromStr>(&mut self, row: usize, col: usize) -> Vec<Vec<T>> {
        (0..row).map(|_| self.vec(col)).collect()
    }

    pub fn char(&mut self) -> char {
        self.iter.next().unwrap_or_else(|| exit!())
    }

    pub fn chars(&mut self) -> Vec<char> {
        self.get::<String>().chars().collect()
    }

    pub fn mat_chars(&mut self, row: usize) -> Vec<Vec<char>> {
        (0..row).map(|_| self.chars()).collect()
    }

    pub fn line(&mut self) -> String {
        if self.peek().is_some() {
            self.iter
                .by_ref()
                .take_while(|&c| !(c == '\n' || c == '\r'))
                .collect::<String>()
        } else {
            exit!();
        }
    }

    pub fn peek(&mut self) -> Option<&char> {
        self.iter.peek()
    }
}

const MOD: usize = 2019;

fn main() {
    let cin = stdin();
    let cin = cin.lock();
    let mut sc = Scanner::new(cin.bytes().map(|c| c.unwrap() as char));
    let S: Vec<char> = sc.chars();
    let S: Vec<char> = S.into_iter().rev().collect();
    let N = S.len();
    let mut cum = vec![0; N+1];
    let mut w = 1;
    for i in 0..N {
        let d = (S[i] as u8 - b'0') as usize;
        cum[i+1] = cum[i] + d * w;
        w *= 10;
        w %= MOD;
        cum[i+1] %= MOD;
    }
    let mut cnt = vec![0; 2020];
    let mut ans = 0;
    for i in 0..N+1 {
        ans += cnt[cum[i]];
        cnt[cum[i]] += 1;
    }
    println!("{}", ans);
}


Measured memory_bytes: 4332
n, m = map(int ,input().split())
h = list(map(int, input().split()))
lis = [[] for i in range(n)]
for i in range(m):
    a,b = map(int ,input().split())
    a -= 1
    b -= 1
    lis[a].append(b)
    lis[b].append(a)
#print(lis)
ans = 0
for i in range(n):
    flg = True
    val = h[i]
    for j in range(len(lis[i])):
        if val <= h[lis[i][j]]:
            flg = False
    if flg == True:
        ans += 1
        #print(i)
print(ans)


Measured memory_bytes: 92596
import sys
input = sys.stdin.readline

def main():
    A, B, M = map(int, input().split())
    a = list(map(int, input().split()))
    b = list(map(int, input().split()))
    ans = 10**6

    for i in range(M):
        x, y, c = map(int, input().split())
        ans = min(ans, a[x - 1] + b[y - 1] - c)

    ans = min(ans, min(a) + min(b))

    print(ans)

main()

Measured memory_bytes: 18616
import java.io.*;
import java.util.*;
public class Main {
	public static void main(String[] args)throws IOException{
		String a;
		InputStreamReader isr =new InputStreamReader(System.in);
		BufferedReader br=new BufferedReader(isr);
		a=br.readLine();
		StringTokenizer st=new StringTokenizer(a," ");
		
		int x=Integer.parseInt(st.nextToken());
		int y=Integer.parseInt(st.nextToken());
		if(x>y){System.out.println("a > b");
		}else if(x<y){System.out.println("a < b");
		}else{
			System.out.println("a == b");
		}
		
}
	}

Measured memory_bytes: 17020
#include "bits/stdc++.h"
using namespace std;
#define repr(i,a,b) for(long long i=(long long)(a);i<(long long)(b);i++)
#define rep(i,n) repr(i,0,n)
#define reprrev(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define reprev(i,n) reprrev(i,0,n)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define mp make_pair
#define mt make_tuple
#define MOD 1000000007
#define PI 3.1415926535
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> Pi;
typedef pair<ll, ll> Pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<Pi> vPi;
typedef vector<Pll> vPll;
typedef vector<vector<int>> vvi;
typedef vector<vector<bool>> vvb;
typedef vector<vector<ll>> vvll;
typedef vector<vector<char>> vvc;
typedef vector<vector<string>> vvs;
typedef vector<vector<double>> vvd;
typedef vector<vector<Pi>> vvPi;
typedef priority_queue<int, vector<int>, greater<int>> pqli;
typedef priority_queue<ll, vector<ll>, greater<ll>> pqlll;
typedef priority_queue<Pi, vector<Pi>, greater<Pi>> pqlP;
string YN(bool y) { return (y?"YES":"NO"); }
string yn(bool y) { return (y?"Yes":"No"); }
string ON(bool y) { return (y?"OK":"NG"); }
int main(void)
{
	int r, g, b, n;
	ll ans=0;

	cin>>r>>g>>b>>n;

	vi bb(3001);
	rep(i, 3001) bb[i]=i*b;

	rep(i, 3001){
		rep(j, 3001){
			ll d=n-i*r-j*g;
			if(d>=0&&d%b==0) ans++;
		}
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
  int inA, inB;
  cin >> inA >> inB;
  //最小公倍数を求めることと同じ                                                                    
  int A, B;
  long answer;
  if (inA < inB){
    int temp;
    temp = inA;
    A = inB;
    B = temp;
  }else {
    A = inA; B = inB;
  }
  int r = A % B;

  while (r!=0){
    A = B;
    B = r;
    r = A % B;
  }

  answer = (long)(inA / B) * (long)(inB / B);
  answer = answer * B;
  cout << answer << "\n";

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef  long long  ll;
ll inf=1000000000000000,mod=1000000007,n;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
  
    ll n,m,k;
    cin>>n>>m>>k;
    ll arr[n][m],curr,sum1=0,coun=0,mi=inf;string s;ll flg1;
    for(ll i=0;i<n;i++){cin>>s;for(ll j=0;j<m;j++)arr[i][j]=s[j]-'0';}vector<string > ans;vector<ll> sum;
    for(ll i=0;i<(1<<(n-1));i++){flg1=0;
        coun=__builtin_popcount(i);
        curr=0;ans.clear();s="";
        for(ll j=0;j<(n-1);j++){
            s+='0'+curr;
            if(i&(1<<j)){
                ans.push_back(s);
                s="";
            }
            curr++;
        }
            s+='0'+curr;
            ans.push_back(s);
            s="";
            sum.resize(ans.size(),0);ll flg;
            // for(auto it:ans)cout<<it<<" ";cout<<endl;
        for(ll j=0;j<m;j++){
            flg=0;
            for(ll ki=0;ki<ans.size();ki++){
                sum1=0;
                for(ll kk=0;kk<ans[ki].length();kk++){
                    sum1+=arr[ans[ki][kk]-'0'][j];
                }
                sum[ki]+=sum1;
                // if(i==0&&j==0)cout<<k<<" ";
                if(sum[ki]>k){

                    flg=1;
                }
            }
            // if(i==0&&j==2)cout<<flg<<" ";
            // if(i==1&&j==4)cout<<sum[1]<<" ";
            if(flg){
                sum.clear();
                if(j)
                coun++;
                else{
                flg1=1;break;}
                for(ll ki=0;ki<ans.size();ki++){
                    sum1=0;
                    // if(i==0)cout<<j<<" ";
                    for(ll kk=0;kk<ans[ki].length();kk++){
                        sum1+=arr[ans[ki][kk]-'0'][j];
                    }
                    sum[ki]=sum1;
                }

            }
        }
        if(flg1)continue;
        for(ll ki=0;ki<ans.size();ki++)
            if(sum[ki]>k){coun++;
            break;}
        // if(i==1)cout<<ans.size()<<" ";
        mi=min(mi,coun);
    }
    cout<<mi<<endl;
}


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

using namespace std;

#define FAST() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

int main()
{
    FAST();
    char s[200005];
    int i,l,ans=0,cnt=0;
    cin >> l >> s+1;
    for(i=1;i<=l;i++)cnt+=(s[i] == 'W');
    while(cnt--)
    {
        ans+=(s[l--] == 'R');
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 3816
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> pll;
const ll mod=1e9+7;
//const ll mod=998244353;
const ll inf=1LL<<61;

vec par(2e5+10);
map<ll,ll> si;
void init(ll n) {
  for(ll i=0;i<n;i++) {
    par[i]=i;
    si[i]=1;
  }
}

ll root(ll x) {
  if(par[x]==x) {
    return x;
  }
  else {
    return par[x]=root(par[x]);
  }
}

ll size(ll x) {
  return si[root(x)];
}

bool same(ll x, ll y) {
  return root(x)==root(y);
}

void unite(ll x, ll y) {
  if(same(x,y)) return;
  ll temp=size(x);
  si[root(y)]+=temp;
  si[root(x)]=0;
  par[root(x)]=root(y);
}

int main() {
  ll n,m;
  cin >> n >> m;
  vec a(m),b(m);
  ll ans=0;
  for(ll i=0;i<m;i++) {
    cin >> a[i] >> b[i];
    a[i]--,b[i]--;
  }
  for(ll i=0;i<m;i++) {
    init(n);
    for(ll j=0;j<m;j++) {
      if(i==j) continue;
      unite(a[j],b[j]);
    }
    if(size(0)!=n) ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 1792
package main

import "fmt"

func getGCD(x, y int) int {
	if x < y {
		x, y = y, x
	}
	if y == 0 {
		return x
	} else {
		return getGCD(y, x%y)
	}
}

func main() {
	var x, y int
	fmt.Scan(&x, &y)
	fmt.Println(getGCD(x, y))
}


Measured memory_bytes: 1156
#include <iostream>

using namespace std;
int n;
int a[30];
int nn;
int q[300];
bool dp[30][3000];
bool al[30][3000];

void init1() {
    for (int i = 0; i < 30; i++) {
        for (int j = 0; j < 3000; j++) {
            al[i][j] = false;
        }
    }
}

bool solve(int i, int m) {
    if (al[i][m]) {
        return dp[i][m];
    }
    if (m == 0) {
        al[i][m] = true;
        dp[i][m] = true;
    } else if (i >= n) {
        al[i][m] = true;
        dp[i][m] = false;
    } else if (solve(i + 1, m - a[i])) {
        al[i][m] = true;
        dp[i][m] = true;
    } else if (solve(i+1,m)) {
        al[i][m] = true;
        dp[i][m] = true;
    } else {
        al[i][m] = true;
        dp[i][m] = false;
    }
    return dp[i][m];
}

int main() {
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    cin >> nn;
    for (int i = 0; i < nn; i++) {
        cin >> q[i];
    }
    for (int i = 0; i < nn; i++) {
        init1();
        bool t = solve(0, q[i]);
        if (t) {
            cout << "yes" << endl;
        } else {
            cout << "no" << endl;
        }
    }
    return 0;
}

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

int main()
{
    char letter;
    cin >> letter;
    //if (97<= int(letter) &&  int(letter)<=122){
        if (letter == 'z')
        cout <<'a' << endl;
        else
        {
        cout<<char(letter + 1) << endl;
        } 
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<functional>
#include<math.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define pf(n) printf("%d\n",n)
#define pff(a,b) printf("%d  %d\n",a,b);
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = 1001001001;
const double PI = acos(-1);

int main() {
	ll n;
	cin >> n;
	ll k;
	cin >> k;
	vector<ll> a(n);
	rep(i, n) cin >> a[i];

	for (ll i = k; i < n; i++) {
		if (a[i] > a[i - k]) {
			cout << "Yes\n";
		}
		else {
			cout << "No\n";
		}
	}
	


	return 0;
}

Measured memory_bytes: 4840
#include<bits/stdc++.h>
 
#define rep(i,n) for(ll i = 0;i < n;++i)
#define all(v) v.begin(),v.end()
using namespace std;
using ll = long long;
typedef pair<int,int> P;
 
const int INF = 1001001001;
const long double PI = (acos(-1));
const int mod = 1e9+7;
const int vx[6] = {0,1,0,-1,1,-1};
const int vy[6] = {1,0,-1,0,1,1};



int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int a;
    cin >> a;
    cout << a+a*a+a*a*a << endl;

    cout << endl;
    return 0;
}


Measured memory_bytes: 3580
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
#define ALL(c) (c).begin(), (c).end()
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v, x) (std::find(v.begin(), v.end(), x) != v.end())

using namespace std;
typedef int64_t ll;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
const int INF = 1001001001;
const long long INFL = (1LL<<60);
const double eps = (1e-9);


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

  string s;
  cin >> s;

  if (s == "zyxwvutsrqponmlkjihgfedcba") {
    puts("-1");
    return 0;
  }

  // |s| < 26 の場合，sに含まれない最小の文字を最後に付ける
  if (s.size() < 26) {
    for (int i = 0; i <= s.size(); i++) {
      if (s.find('a' + i) == string::npos) {
        s.append(1, 'a' + i);
        break;
      }
    }
    cout << s << endl;
    return 0;
  }


  // |s| == 26 の場合
  vector<char> r;
  r.push_back(s.back());
  for (int i = s.size() - 2; i >= 0; i--) {
    if (s[i] < r.back()) {
      s[i] = *lower_bound(ALL(r), s[i]);
      s.resize(i+1);
      break;
    } else {
      r.push_back(s[i]);
      sort(ALL(r));
    }
  }

  cout << s << endl;  

  return 0;
}


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


/*
Contrainst n is 2 * 10^5 for all pairs it will be
 4  * 10^10 , so if e solve in n^2 time, it will not be solved in 2 seconds.
 this is the hing that we have to solve them better than nlogn

*/
using namespace std;

int main(){
  // int n;
  // unordered_map<int, int> m;
  // int res = 0;
  // cin >> n;
  // vector<int> nums(n);
  //
  // for(int i = 0; i < n; i++){
  // 	cin >> nums[i];
  //   m[i] = nums[i];
  // }
  //
  // for(int i = 0; i < n; i++){
  // 	for(int j = i + 1; j < n; j++){
  //   	if(j - i == (m[i] + m[j]))res++;
  //   }
  // }
  //
  // cout << res << endl;

  // Above code runs in O(n^2) time.

  int n;
  cin >> n;
  vector<int> a(n);
  for(int i = 0; i < n; i++)cin >> a[i];
  unordered_map<int, int> mp;
  long long res = 0;
  for(int i = 0; i < n; i++){
    int sa = i - a[i];
    res += mp[sa];
    int wa = a[i] + i;
    mp[wa]++;
  }

  cout << res << endl;


  return 0;
}


Measured memory_bytes: 19272
n = [int(i) for i in input().split()]
s = input()
a = set([""])
ans = set()
for i in s:
    b = a.copy()
    for j in a:
        if len(j) == 2:
            ans.add(j + i)
        else:
            b.add(j + i)
    a = b
print(len(ans))


Measured memory_bytes: 3188
def s0():return input()
def s1():return input().split()
def s2(n):return [input() for x in range(n)]
def s3(n):return [input().split() for _ in range(n)]
def s4(n):return [[x for x in s] for s in s2(n)]
def n0():return int(input())
def n1():return [int(x) for x in input().split()]
def n2(n):return [int(input()) for _ in range(n)]
def n3(n):return [[int(x) for x in input().split()] for _ in range(n)]
def t3(n):return [tuple(int(x) for x in input().split()) for _ in range(n)]
def p0(b,yes="Yes",no="No"): print(yes if b else no)
# from sys import setrecursionlimit
# setrecursionlimit(1000000)
from collections import Counter,deque,defaultdict
import itertools
# import math
# import networkx as nx
# from bisect import bisect_left,bisect_right
# from heapq import heapify,heappush,heappop

h,w=n1()
s=s4(h)
def make_around(s,h):
    sss=[[-1]*(w+2)]
    for line in s:
        sss.append([-1]+[-1 if i=="#" else 0 for i in line ]+[-1])
    sss.append([-1]*(w+2))
    return sss

s=make_around(s,h)
d=[]
for i in range(1,h+1):
    for j in range(1,w+1):
        if s[i][j]==0:
            d.append((i,j))

from copy import deepcopy
ans=0
for i in range(len(d)):
    ss=deepcopy(s)
    x,y=d[i]
    q=deque([(x,y)])
    ss[x][y]=1
    while len(q)>0:
        x,y=q.popleft()
        if ss[x+1][y]==0:
            ss[x+1][y]=ss[x][y]+1
            q.append((x+1,y))
        if ss[x-1][y]==0:
            ss[x-1][y]=ss[x][y]+1
            q.append((x-1,y))
        if ss[x][y+1]==0:
            ss[x][y+1]=ss[x][y]+1
            q.append((x,y+1))
        if ss[x][y-1]==0:
            ss[x][y-1]=ss[x][y]+1
            q.append((x,y-1))
    ans=max(ans,max(list(itertools.chain.from_iterable(ss))))
print(ans-1)

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

using ll = long long;
using P = pair<ll, ll>;

const ll MOD = 1e9+7;
const ll INF = 1ll<<60;

#define FOR(i,a,b) for (ll i=(a);i<(ll)(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()

template <typename T>
struct SegTree
{
	using F = function<T(T, T)>; // T*T -> X
	long long N;
	F f;
	const T ex;
	vector<T> dat;
	SegTree(long long n_, F f_, T ex_) : N(), f(f_), ex(ex_), dat(n_*4, ex_)
	{
		long long x = 1;
		while (n_ > x) x <<= 1;
		N = x;
	}

	void set(long long i, T x) {dat[i+N-1] = x;};
	void set(vector<T> &v)
	{
		assert(N == v.size());
		for (long long i = 0; i < N; ++i)
			set(i, v[i]);
	}

	void build()
	{
		for (long long k = N-2; k >= 0; --k)
			dat[k] = f(dat[k*2+1], dat[k*2+2]);
	}

	void update(long long i, T x)
	{
		i += N-1;
		dat[i] = x;
		while (i > 0)
		{
			i = (i-1)/2;
			dat[i] = f(dat[i*2+1], dat[i*2+2]);
		}

	}

	T query(long long a, long long b) {return query_sub(a, b, 0, 0, N);}
	T query_sub(long long a, long long b, long long k, long long l, long long r)
	{
		if (r <= a || b <= l) return ex;
		if (a <= l && r <= b) return dat[k];
		T vl = query_sub(a, b, k*2+1, l, (l+r)/2);
		T vr = query_sub(a, b, k*2+2, (l+r)/2, r);
		return f(vl, vr);
	}
};

ll N, Q;

int main(int argc, char **argv)
{
	cin >> N >> Q;

	ll I = (1ll<<31)-1;
	auto f = [](ll a, ll b) {return min(a, b);};
	SegTree<ll> st(N, f, I);
	
	REP(i, Q)
	{
		ll a, b, c; cin >> a >> b >> c;
		if (a == 0)
		{
			st.update(b, c);
		}
		else
		{
			std::cout << st.query(b, c+1) << std::endl;
		}
	}
}




Measured memory_bytes: 5948
#include <cstdio>
#include <algorithm>
using namespace std;

int main(void){
  int s1,f1,s2,f2,s,f;
  scanf("%d%d%d%d",&s1,&f1,&s2,&f2);
  
  s = max(s1,s2);
  f = min(f1,f2);
  printf("%d\n", max(f-s,0));
  return 0;
}

Measured memory_bytes: 128
from math import gcd

from math import factorial as f

from math import ceil, floor, sqrt
import math

import bisect
import re
import heapq

from copy import deepcopy
import itertools
from itertools import permutations

from sys import exit

ii = lambda: int(input())
mi = lambda: map(int, input().split())
li = lambda: list(map(int, input().split()))

yes = "Yes"
no = "No"


def main():
    d, t, s = mi()

    if s * t >= d:
        print(yes)
    else:
        print(no)


main()


Measured memory_bytes: 10020
/**Bismillahir Rahmanir Rahim.**/

/**
 *    author:  nasimnoob
**/

#include<bits/stdc++.h>
#include<stdlib.h>
#include<iostream>
#include<vector>
#include<math.h>
#include<cstring>
#include<cstdio>

using namespace std;

//----------------------------------------------------------//

typedef long long int                        ll;
typedef unsigned long long int              ull;
typedef long double                          ld;

//-----------------------------------------------------------//
#define      test                       int t; cin>>t;  while(t--)

#define      cube(x)                    (x*x*x)
#define      sqr(x)                     (x*x)

#define      INPUT                      freopen("input.txt", "r", stdin)
#define      OUTPUT                     freopen("output.txt", "w", stdout)

#define      srev                       reverse(s.begin(),s.end())
#define      sortstr                    sort(s.begin(), s.end());
#define      gtl(x)                     getline(cin, (x))
#define      dot(x)                     fixed << setprecision(x)

#define      Case                       cout << "Case " << ++tt << ": " ;

#define      PI                         acos(-1) // 3.1415926535897932
#define      MIN                        9999999

#define      Faster                     ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);




//scanf("%[^\n]%*c", str);
//sort(s,s+n,greater<int>());
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);


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

int main()
{
    Faster;


    int tt = 0 ;

    string s;
    int n ;

    cin >> s ;

    int sum = 0 ;

    for (int i = 0 ; i < s.size() ; i++)
    {
        sum += s[i] - '0';
    }

    if (sum % 9 == 0)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;


    return 0 ;
}







Measured memory_bytes: 3748
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
  int N, K, C;
  cin >> N >> K;
  C = N-K+1;
  vector<int> h(N);
  vector<int> ans(C);
  for (size_t i = 0; i < N; i++) {
    cin >> h[i];
  }
  sort(h.begin(), h.end());
  for (size_t i = 0; i < C; i++) {
    ans[i] = h[i+K-1] - h[i];
  }
  sort(ans.begin(), ans.end());
  cout << ans.front() << endl;
  return 0;
}


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

int main(){
  string companies;
  cin >> companies;
  int anum = 0;
  for(int i=0; i<companies.size(); i++){
    if(companies.at(i) == 'A'){
    	anum++;
    }
  }
  if( anum == 0 || anum == 3){
    cout << "No" << endl;
  } else {
  	cout << "Yes" << endl;
  }
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std;
using ll=long long;
using ld=long double;
//#define int long long
//#define _CRT_SECURE_NO_WARNINGS
#define rep(i, n) for (int i = 0; i < n; i++)
#define _GLIBCXX_DEBUG
const int MOD = 1e9 + 7;
const int INF = 1e18 + 9;
constexpr long double pi = 3.141592653589793238462643383279;
int fact(int i) {
    if (i == 0) return 1;
    return (fact(i - 1)) * i;
}
int gcd(int a, int b) {
    if (b == 0) return a;
    return gcd(b, a % b);
}
int lcm(int a, int b) {
    return a * b / gcd(a, b);
}
int keta(int n) {
    if (n == 0) return 1;
    int count = 0;
    while (n != 0) {
        n /= 10;
        count++;
    }
    return count;
}
int ketasum(int n) {
    int sum = 0;
    while (n != 0) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

int main(){
    int r;
    cin >> r;
    if (r < 1200) cout << "ABC" << endl;
    else if (r < 2800) cout << "ARC" << endl;
    else cout << "AGC" << endl;
    return 0;
}

Measured memory_bytes: 3632
import math
def main():
    n=int(input())
    csf=[list(map(int,input().split())) for _ in range(n-1)]
    for i in range(n):
        if i == n-1:
            print(0)
        else:
            t=0
            for c,s,f in csf[i:]:
                t = max(s,t)
                t = math.ceil(t/f)*f+c
                #print("start:", i, t)
            print(t)

if __name__ == "__main__":
    main()

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

using namespace std;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, r;
    cin >> n >> r;
    if (n < 10) r += 100 * (10 - n);
    cout << r << '\n';
    return 0;
}


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

using namespace std;

int main() {
  std::ios::sync_with_stdio(false);
  cin.tie(NULL);
  int a, b;
  cin >> a >> b;
  if(a < b)
    cout << "0\n";
  else
    cout << "10\n";
  
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
int main()
{
    int i;
    char word[1000];
    while(gets(word))
    {
        int len=strlen(word);
        for(i=0;i<len;i++)
        {
            if(word[i]==',')
            {
                printf("%c",32);
            }
            else
            {
                printf("%c",word[i]);
            }
        }
        printf("\n");
    }
    return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<cstring>
using namespace std;
const int mod=998244353,sz=200010;
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)

template<class T>
class BIT {
	T bit[sz];
	int n;
 
public:
	BIT() {
		n = sz;
		memset(bit, 0, sizeof(bit));
	}
 
	T sum(int i) {
		++i;
		T s = 0;
		while (i > 0) {
			s += bit[i];
			i -= i & -i;
		}
		return s;
	}
 
	void add(int i, T x) {
		++i;
		while (i < n) {
			bit[i] += x;
			i += i & -i;
		}
	}
};
 


ll p2[sz];
int num[sz][4];

void init()
{
    p2[0]=1;
    for(int i=1;i<sz;i++)p2[i]=p2[i-1]*2%mod;
}
main()
{
    init();

    int n;
    scanf("%d",&n);
    vector<pair<int,int> >v(n);
    vector<int> xs,ys;

    rep(i,n)
    {
        int x,y;
        scanf("%d%d",&x,&y);
        v[i]=make_pair(x,y);
        xs.emplace_back(x),ys.emplace_back(y);
    }
    sort(begin(xs),end(xs));sort(begin(ys),end(ys));
    rep(i,n) 
    {
        int x=v[i].first,y=v[i].second;
        x=lower_bound(begin(xs),end(xs),x)-xs.begin();
        y=lower_bound(begin(ys),end(ys),y)-ys.begin();
        v[i]=make_pair(x,y);
    }

    sort(begin(v),end(v));

    rep(t,2)
    {
        BIT<int> T;

        rep(i,n)
        {
            int a=T.sum(v[i].second-1),b=i-T.sum(v[i].second);
            if(t==0)
            {
                num[i][0]=a;
                num[i][1]=b;
            }
            else
            {
                num[n-1-i][2]=a;
                num[n-1-i][3]=b;
            }
            T.add(v[i].second,1);
            
        }
        reverse(begin(v),end(v));
    }

    ll ans=0;
    rep(i,n)
    {
        ll a=(p2[num[i][0]]+p2[num[i][3]]-1)%mod;
        ll b=(p2[num[i][1]]+p2[num[i][2]]-1)%mod;

        ll v=(p2[n]-a*b)%mod;
        if(v<0)v+=mod;
        ans=(ans+v)%mod;
    }
    printf("%lld\n",ans);
    return 0;
}

Measured memory_bytes: 9068
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

const int MOD = 1000000007;

int main()
{
    int ABC[3], K;
    cin >> ABC[0] >> ABC[1] >> ABC[2] >> K;
    
    int i = 0;
    while(K > 0 && i < 2){
        if(ABC[i] < ABC[i + 1]){
            ++i;
        }
        else{
            ABC[i+1] *= 2;
            --K;
        }
    }

    if((ABC[0] < ABC[1]) && (ABC[1] < ABC[2])){
        cout << "Yes" << endl;
    }
    else cout << "No" << endl;
}


Measured memory_bytes: 3632
def half_and_half(a,b,c,x,y):
    z = x   if x > y else y
    can = []
    
    for n in range(z+1):
        p = x - n if x > n else 0
        q = y - n if y > n else 0
        amount = p*a + q*b + n*c*2
        #print("%d = %d x %d + %d x %d + %d x %d " %(amount,p,a,q,b,n,c))
        can.append(amount)

    return min(can)

if __name__ == '__main__':
    a,b,c,x,y = map(int,input().split())
    print(half_and_half(a,b,c,x,y))


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

int main(){
    int x;
    cin >> x;
    while(true){
        bool b = false;
        for(int i = 2; i*i <= x; i++){
            if(x%i == 0){
                b = true;
                break;
            }
        }
        if(b){
            x++;
            continue;
        }
        cout << x << endl;
        return 0;
    }
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;
int main(){
    int a,b,c;
	cin >>a>>b>>c;
	int * ptrA=&a;
	int * ptrB=&b;
	int * ptrC=&c;
	int tmp = *ptrA;
  	*ptrA=*ptrB;
  	*ptrB=tmp;
  	int tmp2 = *ptrA;
  	*ptrA=*ptrC;
  	*ptrC=tmp2;
  	cout<<a<<" "<<b<<" "<<c;
	return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
#include <cstring>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <set>
#include <vector>
#include <sstream>
#include <typeinfo>
#include <fstream>

using namespace std;

int main(void){
    int n,fg=0;
    cin>>n;
    for(int i=0;i<3;i++){
        if(n%10==7){
            fg++;
        }
        n/=10;
    }
    if(fg!=0){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
    return 0;
}


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

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

	public static void main(String[] args) {
		int[] r = new int[4];
		for (int i = 0; i < 4; i++) {
			r[i] = sc.nextInt();
		}
		Arrays.sort(r);
		System.out.println(Math.abs(r[0] + r[3] - r[1] - r[2]));
	}

}



Measured memory_bytes: 26364
import java.util.Scanner;

public class Main {
	public static void main(String... args) {
		Scanner sc = new Scanner(System.in);
		long a = sc.nextLong();
		long b = sc.nextLong();
		long x = sc.nextLong();

		if (a > x) {
			System.out.println("NO");
		} else if (a + b < x) {
			System.out.println("NO");
		} else {
			System.out.println("YES");
		}
	}
}

Measured memory_bytes: 23508
#include<bits/stdc++.h>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<algorithm>
using namespace std;

int main(){
    int mod=1000000007;
    int a[10][10];
    for (int i=0;i<10;i++) {
        for (int j=0;j<10;j++) {
            a[i][j]=0;
        }
    }
    int x,y,s;
    int ans[2]={100,0};
    while (scanf("%d,%d,%d",&x,&y,&s)!=EOF) {
        a[y][x]+=1;
        if (y>0) a[y-1][x]+=1;
        if (x>0) a[y][x-1]+=1;
        if (y<9) a[y+1][x]+=1;
        if (x<9) a[y][x+1]+=1;

        if (s>=2) {
            if (y>0 && x>0) a[y-1][x-1]+=1;
            if (y>0 && x<9) a[y-1][x+1]+=1;
            if (y<9 && x>0) a[y+1][x-1]+=1;
            if (y<9 && x<9) a[y+1][x+1]+=1;
        }

        if (s==3) {
            if (y>1) a[y-2][x]+=1;
            if (x>1) a[y][x-2]+=1;
            if (y<8) a[y+2][x]+=1;
            if (x<8) a[y][x+2]+=1;
        }
    }

    for (int i=0;i<10;i++) {
        for (int j=0;j<10;j++) {
            if (a[i][j]!=0) {
                ans[0]-=1;
                ans[1]=max(ans[1],a[i][j]);
            }
        }
    }
    printf("%d\n%d\n",ans[0],ans[1]);
    return 0;
}

Measured memory_bytes: 3160
#include <cstdio>
#include <iostream>
#include <string>
#include <algorithm>
#include <cstring>
#include <utility>
#include <vector>
#include <map>
#include <set>
#include <cmath>
#include <queue>
#include <stack>
#include <deque>
using namespace std;
typedef pair<int, int> pii;
typedef long long LL;
const int MAXN = 16010;
const int BASE = 8000;
char s[MAXN];
int dpx[MAXN], dpy[MAXN];
int tmp[MAXN];
vector<int> x, y;

int main() {
    scanf("%s", s);
    int n = strlen(s), tgx, tgy;
    s[n] = 'T';
    scanf("%d %d", &tgx, &tgy);
    int isX = 1, cnt = 0;
    for (int i = 0; i <= n; i++) {
        if (s[i] == 'F') cnt++;
        else {
           if (isX) x.push_back(cnt);
           else y.push_back(cnt);
           isX ^= 1;
           cnt = 0;
        }
    }
    dpx[x[0] + BASE] = 1;
    for (int i = 1; i < (int)x.size(); i++) {
        memset(tmp, 0, sizeof(tmp));
        int cur = x[i];
        for (int j = 0; j < MAXN; j++) {
            if (j + cur < MAXN && dpx[j + cur]) tmp[j] = 1;
            if (j - cur >= 0 && dpx[j - cur]) tmp[j] = 1;
        }
        for (int j = 0; j < MAXN; j++)
            dpx[j] = tmp[j];
    }
    dpy[BASE] = 1;
    for (int i = 0; i < (int)y.size(); i++) {
        memset(tmp, 0, sizeof(tmp));
        int cur = y[i];
        for (int j = 0; j < MAXN; j++) {
            if (j + cur < MAXN && dpy[j + cur]) tmp[j] = 1;
            if (j - cur >= 0 && dpy[j - cur]) tmp[j] = 1;
        }
        for (int j = 0; j < MAXN; j++)
            dpy[j] = tmp[j];
    }
    if (!dpx[tgx + BASE] || !dpy[tgy + BASE]) puts("No");
    else puts("Yes");
    return 0;
}


Measured memory_bytes: 512
open Printf
open Scanf

let solve n a b =
  if a > b then 0
  else
    if n = 1 then
      if a = b then 1 else 0
    else
      (n-2) * b - (n-2) * a + 1

let () =
  scanf "%d %d %d\n" (fun x y z -> solve x y z) |> printf "%d\n"


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

int main() {
  int m,v,r;
  std::queue<std::string> seiseki;
  while(1) {
    std::cin >> m >> v >> r;
    if(m == -1 && v == -1 && r == -1) {
      break;
    }else if(m + v >= 80  && m != -1 && v != -1) {
      seiseki.push("A");
    }else if(m + v >= 65 && m + v < 80 && m != -1 && v != -1) {
      seiseki.push("B");
    }else if(m + v >= 50 && m + v < 65 && m != -1 && v != -1) {
      seiseki.push("C");
    }else if(m + v >= 30 && m + v < 50 && m != -1 && v != -1) {
      if(r >= 50) {
        seiseki.push("C");
      }else if(r < 50){
        seiseki.push("D");
      }
    }else{
      seiseki.push("F");
    }
  }
  while(!seiseki.empty()) {
    std::cout << seiseki.front() << std::endl;
    seiseki.pop();
  }
}

Measured memory_bytes: 3144
#include <algorithm>
#include <cassert>
#include <climits>
#include <cstdio>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>

using namespace std;

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

const int INF = 1e9;
const long long LINF = 1e18;

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

    int ans = 0;
    for (int i = 0; i < S.size() / 2; i++) {
        if (S[i] != S[S.size() - 1 - i]) {
            ans++;
        }
    }
    cout << ans << endl;

    return 0;
}


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

vector<ll> divisor(ll n)
{
  vector<ll> res;
  for (ll i=1; i*i<=n; i++) {
    if (n%i == 0) {
      res.push_back(i);
      if (i != n/i) res.push_back(n/i);
    }
  }
  sort(res.begin(), res.end());
  return res;
}

bool f(ll n, ll k) {
  if (k == 1) return false;
  while (n%k == 0 || n > k) {
    if (n%k == 0) n /= k;
    else n %= k ;
  }
  return n == 1;
}

int main()
{
  ll n; cin >> n;
  if (n == 2) {
    cout << 1 << endl;
    return 0;
  }
  vector<ll> d = divisor(n-1);
  set<ll> st;
  for (auto v:d) st.insert(v);
  vector<ll> d2 = divisor(n);
  for (auto v:d2) {
    if (f(n, v) && st.count(v)==0) st.insert(v);
  }
  st.erase(1);
  cout << st.size() << endl;

  return 0;
}


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

using namespace std;

#define REP(i,n) for(ll (i) = (0); (i) < (n); ++i)
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define ALL(v) v.begin(),v.end()
#define INF 1100000000
#define LLINF 1000000000000000000LL
#define MOD 1000000007
#define Decimal fixed << setpresicion(20)
#define SHOWP(x) cerr<<"["<<(x).FI<<", "<<(x).SE<<"]";
#define SHOWX(x) cerr<<#x<<": "<<x<<endl;
#define SHOWVEC(v, e) REP(i, e) cerr << (v[i]) << ' '; cerr << endl;
#define SHOW2D(a, h, w) REP(i, h){REP(j, w)cerr<<setw(3)<<(a[i][j])<<' ';cerr<<endl;}

typedef long long ll;
typedef pair<ll, ll> P;


int main()
{
  int N, x;
  cin >> N >> x;
  if (x == 1 || x == 2*N - 1) cout << "No" << endl;
  else {
    cout << "Yes" << endl;
    vector<int> v(2*N - 1, -1);
    v[N - 2] = x - 1;
    v[N - 1] = x;
    v[N] = x + 1;
    int i = 0, now = 1;
    while (i < 2*N - 1) {
      if (now == x - 1 || now == x || now == x + 1) {
        now++;
        continue;
      }
      if (v[i] > 0) {
        i++;
        continue;
      }
      v[i] = now;
      i++, now++;
    }
    REP(i, 2*N - 1) cout << v[i] << endl;
  }
  return 0;
}

Measured memory_bytes: 2304
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(), a.end()
#define rrng(a) a.rbegin(), a.rend()
#define maxs(x, y) (x = max(x, y))
#define mins(x, y) (x = min(x, y))
#define limit(x, l, r) max(l, min(x, r))
#define lims(x, l, r) (x = max(l, min(x, r)))
#define isin(x, l, r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)), x.end())
#define show(x) cout << #x << " = " << x << endl;
#define PQ(T) priority_queue<T, v(T), greater<T>>
#define bn(x) ((1 << x) - 1)
#define dup(x, y) (((x) + (y)-1) / (y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;

int main() {
  int n;
  cin >> n;
  vl x(n),y(n);
  rep(i,n){
    cin >> x[i] >>y[i];
  }
  map<pair<ll,ll>,int> m;
  rep(i,n){
    rep(j,n){
      if(i==j) continue;
      pair<ll,ll> p;
      p.first = x[i]-x[j];
      p.second = y[i]-y[j];
      m[p]++;
    }
  }
  
  int c = 0;
  for (auto iter = m.begin(); iter != m.end(); iter++) {
        maxs(c,iter->second);
  }
  cout<<n-c<<endl;
  return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <queue>
#include <utility>
#include <tuple>
using namespace std;
const long long INF = 1e15;

int main(){
  long long N, M, X;
  cin >> N >> M >> X;
  vector<long long> H(N);
  for(int i = 0; i < N; ++i) cin >> H[i];
  vector<vector<pair<long long,int>>> G(N);
  for(int i = 0; i < M; ++i){
    int a, b;
    long long t;
    cin >> a >> b >> t;
    --a,--b;
    G[a].emplace_back(t,b);
    G[b].emplace_back(t,a);
  }
  vector<pair<long long,long long>> V(N,{INF,INF});
  V[0] = {0,-X};
  priority_queue<pair<int,pair<long long,long long>>> Q;
  Q.push({0,{0LL,-X}});
  while(Q.size()){
    int v;
    pair<long long,long long> p;
    tie(v,p) = Q.top();
    long long h = -p.second, c = p.first;
    Q.pop();
    if(V[v] < p) continue;
    for(auto e : G[v]){
      int v_;
      long long c_;
      tie(c_,v_) = e;
      if(c_ <= h and h - c_ > H[v_]){
        long long dh = (h - c_) - H[v_];
        if(h - dh < c_) continue;
        pair<long long, long long> p_(c+c_+dh,-(h-c_-dh));
        if(V[v_] <= p_) continue;
        V[v_] = p_;
        Q.emplace(v_,p_);
      }
      if(c_ <= h and h - c_ <= H[v_]){
        pair<long long, long long> p_(c+c_,-(h-c_));
        if(V[v_] <= p_) continue;
        V[v_] = p_;
        Q.emplace(v_,p_);
      }
      if(c_ > h and c_ <= H[v]){
        pair<long long, long long> p_(c+c_+c_-h,-(0));
        if(V[v_] <= p_) continue;
        V[v_] = p_;
        Q.emplace(v_,p_);
      }
    }
  }
  long long ans = V[N-1].first + H[N-1] + V[N-1].second;
  if(ans >= INF) ans = -1;
  cout << ans << endl;
}



Measured memory_bytes: 67716
while (t = $stdin.gets.to_i) != 0
  time = 0
  $stdin.gets.to_i.times do
    s,f = $stdin.gets.chomp.split(" ").map(&:to_i)
    time += f - s
  end
  printf "%s\n", (time >= t)? "OK" : t - time
end

Measured memory_bytes: 6100
from collections import deque

n,q=map(int,input().split())
que=deque()

for i in range(n):
    name,time=input().split()
    time=int(time)
    que.append([name,time])

sum_time=0
while len(que)>0:
    if que[0][1]-q<=0:
        sum_time+=que[0][1]
        print(que[0][0],sum_time)
        que.popleft()
    else:
        sum_time+=q
        que[0][1]-=q
        que.append(que.popleft())


Measured memory_bytes: 13276
#coding:utf-8
import math

#素数判定
def prime(n):
    if n == 2:
        return True
    elif (n < 2) or (n % 2 == 0):
        return  False
    else:
        i = 3
        while i <= math.sqrt(n):
            if n % i == 0:
                return False
            i += 2

        return True

if __name__ == "__main__":
    x = int(input())
    num = x

    while prime(num) == False:
        num += 1

    print(num)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
int main(void){
  int n,d;
  int cnt = 0;
  cin >> n >> d;
  for(int i=0;i<n;i++){
      double a,b; cin >> a >> b;
      if(sqrt(a*a+b*b) <= d)cnt++;
  }
  cout << cnt << endl;
}

Measured memory_bytes: 3836
n = gets.chomp.to_i
bldg1 = Array.new(3){Array.new(10){0}}
bldg2 = Array.new(3){Array.new(10){0}}
bldg3 = Array.new(3){Array.new(10){0}}
bldg4 = Array.new(3){Array.new(10){0}}
while line = gets
  b, f, r, v = line.chomp.split(' ').map(&:to_i)
  case b
  when 1
    bldg1[f-1][r-1] += v
  when 2
    bldg2[f-1][r-1] += v
  when 3
    bldg3[f-1][r-1] += v
  when 4
    bldg4[f-1][r-1] += v
  end
end
bldg1.each do |f|
  print ' ', f.join(' '), "\n"
end
puts '#'*20
bldg2.each do |f|
  print ' ', f.join(' '), "\n"
end
puts '#'*20
bldg3.each do |f|
  print ' ', f.join(' '), "\n"
end
puts '#'*20
bldg4.each do |f|
  print ' ', f.join(' '), "\n"
end

Measured memory_bytes: 6132
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.FilterInputStream;
import java.io.BufferedInputStream;
import java.io.InputStream;

/**
 * @author khokharnikunj8
 */

public class Main {
    public static void main(String[] args) {
        new Thread(null, new Runnable() {
            public void run() {
                new Main().solve();
            }
        }, "1", 1 << 26).start();
    }

    void solve() {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        ScanReader in = new ScanReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        DModSum solver = new DModSum();
        solver.solve(1, in, out);
        out.close();
    }

    static class DModSum {
        public void solve(int testNumber, ScanReader in, PrintWriter out) {
            long n = in.scanInt();
            out.println((n * (n + 1)) / 2 - n);
        }

    }

    static class ScanReader {
        private byte[] buf = new byte[4 * 1024];
        private int index;
        private BufferedInputStream in;
        private int total;

        public ScanReader(InputStream inputStream) {
            in = new BufferedInputStream(inputStream);
        }

        private int scan() {
            if (index >= total) {
                index = 0;
                try {
                    total = in.read(buf);
                } catch (Exception e) {
                    e.printStackTrace();
                }
                if (total <= 0) return -1;
            }
            return buf[index++];
        }

        public int scanInt() {
            int integer = 0;
            int n = scan();
            while (isWhiteSpace(n)) n = scan();
            int neg = 1;
            if (n == '-') {
                neg = -1;
                n = scan();
            }
            while (!isWhiteSpace(n)) {
                if (n >= '0' && n <= '9') {
                    integer *= 10;
                    integer += n - '0';
                    n = scan();
                }
            }
            return neg * integer;
        }

        private boolean isWhiteSpace(int n) {
            if (n == ' ' || n == '\n' || n == '\r' || n == '\t' || n == -1) return true;
            else return false;
        }

    }
}



Measured memory_bytes: 23636