akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

int main()
{
	string a, b;

	cin >> a >> b;

	const char *s = (a + b).c_str();
	int n = atoi(s);
	int r = sqrt(n);

	if( r*r == n ) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define pb push_back
#define all(v) v.begin(),v.end()
#define fi first
#define se second
#define bigger (char)toupper
#define smaller (char)tolower
using namespace std;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<string> vs;
typedef vector<char> vc;
typedef long long ll;
typedef unsigned long long ull;

int main() {
   ll N,K;
   cin>>N>>K;
   if(N==K) cout<<0<<endl;
   else if(N<K) {
       if(N*2>K) cout<<K-N<<endl;
       else cout<<N<<endl;
   }
   else {
       ll a;
       if(N%K==0) cout<<0<<endl;
       else {
           ll a=(N/K)+1;
           cout<<abs(N-K*a)<<endl;
       }
   }
}

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

int main(){
    int N,T,A;
    scanf("%d%d%d",&N,&T,&A);
    int H[N];
    for(int i = 0;i < N;i++){
        scanf("%d",&H[i]);
    }
    double dtemp[N];
    for(int i = 0;i < N;i++){
        dtemp[i] = T - H[i] * 0.006 - A;
        if(dtemp[i] < 0)dtemp[i] = - dtemp[i];
    }
    int a;
    for(int i = 0;i < N;i++){
        if(dtemp[0] > dtemp[i]){
            dtemp[0] = dtemp[i];
            a = i;
        }
    }
    printf("%d",a + 1);
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll n;
	cin>>n;
	
	ll ans = 0;
	map<pair<char,char> ,ll> pam;
	for(ll i=1;i<=n;i++)
	{
		string s = to_string(i);
		string t = s;
		reverse(t.begin(),t.end());
		ll t1 = stoi(t);
		ll m = s.length();
		if (s[m-1]!='0')
		{
			pam[{s[0],t[0]}]++;
		}
	}
	ll ans1 = 0;
	for(auto p = pam.begin();p!=pam.end();++p)
	{
		char a = (*p).first.first;
		char b = (*p).first.second;
		ll val = pam[{b,a}];
		if (a!=b)
		ans+=val*((*p).second);
		else
		ans1+=val*val;
		//cout<<(*p).first.first<<" "<<(*p).first.second<<"\n";
		//cout<<(*p).second<<"\n";
	}
	ans+=ans1;
	cout<<ans;
}

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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define reps(i,s,n) for(int (i)=(s);(i)<(n);(i)++)
#define repr(i,n) for(int (i)=(n)-1;(i)>=0;(i)--)
#define all(v) (v).begin(),(v).end()
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define pb push_back
#define mod 1000000007
#define inf 1000000000
#define llinf 1000000000000000


typedef long long ll;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef pair<int,int> pint;
typedef pair<ll,ll> pll;
typedef vector<pint> vpint;



int main(){
    vint a(3);
    rep(i,3)cin>>a[i];
    sort(all(a),greater<int>());
    cout<<a[0]*10+a[1]+a[2]<<endl;
}

Measured memory_bytes: 256
//{{{
#include<algorithm>
#include<cmath>
#include<fstream>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<random>
#include<set>
#include<sstream>
#include<sys/time.h>
#include<unordered_map>
#include<unordered_set>
#include<vector>
using ll = long long;
enum : int { M = (int)1e9 + 7 };
enum : ll { MLL = (ll)1e18L + 9 };
using namespace std;
#ifdef LOCAL
#include"rprint2.hpp"
#else
#define FUNC(name) template <ostream& out = cout, class... T> void name(T&&...){ }
FUNC(prints) FUNC(printw) FUNC(printwe) FUNC(printb) FUNC(printbe) FUNC(printd) FUNC(printde) FUNC(printdu);
#endif
template <class S, class T>
istream& operator >> (istream& in, pair<S, T>& p){ return in >> p.first >> p.second; }
template <class T>
istream& operator >> (istream& in, vector<T>& v){ for(auto& e : v){ in >> e; } return in; }
//}}}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    vector<int> v(3); cin >> v;
    sort(v.begin(), v.end());
    cout << v[0] * v[1] / 2 << '\n';
}


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

int main()
{
	int n;
	vector<long long>v(87);
	v[0] = 2;
	v[1] = 1;
	cin >> n;
	for (int i = 2; i <= n; i++)
	{
		v[i] = v[i - 1] + v[i - 2];
	}
	cout << v[n] << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef pair <int,int> pi;
int main()
{
  int n;
  cin>>n;
  vector <pi> v(n);
  for(int i=0;i<n;i++)
  {
      cin>>v[i].first;
      v[i].second = i+1;
  }
  sort(v.begin(),v.end());
  for(int i=0;i<n;i++)
    cout<<v[i].second<<" ";
  cout<<endl;
}


Measured memory_bytes: 1664
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define SZ(x) ((int)x.size())
#define FOR(i,a,b) for (int i=a;i<=b;++i)
#define FORD(i,a,b) for (int i=a;i>=b;--i)
using namespace std;
typedef long long LL;
typedef pair<int,int> pa;
typedef vector<int> vec;
void getint(int &v){
    char ch,fu=0;
    for(ch='*'; (ch<'0'||ch>'9')&&ch!='-'; ch=getchar());
    if(ch=='-') fu=1, ch=getchar();
    for(v=0; ch>='0'&&ch<='9'; ch=getchar()) v=v*10+ch-'0';
    if(fu) v=-v;
}
const int MO=1e9+7;
int n,A,B;
LL f[5555][2][2],g[5555][2],ANS,ans;
int main(){
	cin>>n>>A>>B;
	if (A>B) swap(A,B);
	FOR(i,1,B-1){
		f[i][0][0]=(i>=A);
		FOR(j,A,i-1) (f[i][0][0]+=f[i-j][0][1])%=MO;
		f[i][0][1]=0;
		FOR(j,1,i-1) (f[i][0][1]+=f[i-j][0][0])%=MO;
		f[i][1][0]=0;
		FOR(j,A,i-1) (f[i][1][0]+=f[i-j][1][1])%=MO;
		f[i][1][1]=1;
		FOR(j,1,i-1) (f[i][1][1]+=f[i-j][1][0])%=MO;
	}
	FOR(i,1,n){
		g[i][0]=(f[i][0][1]+f[i][1][1])%MO;
		FOR(j,1,min(B-1,i-1)) (g[i][0]+=g[i-j][1]*f[j][1][1])%=MO;
		g[i][1]=(i<A);
		FOR(j,1,min(A-1,i-1)) (g[i][1]+=g[i-j][0])%=MO;
	}
	ans=(f[n][0][0]+f[n][0][1]+f[n][1][0]+f[n][1][1])%MO;
	FOR(i,1,n-1) (ans+=g[i][1]*(f[n-i][1][0]+f[n-i][1][1]))%=MO;
	(ans+=g[n][1])%=MO;
	ANS=1;
	FOR(i,1,n) ANS=ANS*2%MO;
	(ANS-=ans)%=MO;
	ANS=(ANS%MO+MO)%MO;
	cout<<ANS<<endl;
	return 0;
}

Measured memory_bytes: 3800
#include <algorithm>
#include <cmath>
#include <climits>
#include <cstring>
#include <cstdio>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map> //pair is also included in this library
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

#define REP(i, s, n) for(int i = (int)(s); i < (int)(n); i++)
#define fst first
#define snd second
#define MP make_pair //incase c++11 or later is not available

using namespace std;

typedef long long int ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;

//prefer define statement
//for reason that const int ver. of INF will raise a silly warning (unused variable)
#define INF (INT_MAX/3)
#define LIM_INF (INT_MAX)
//const int INF = INT_MAX/3;
#define PI = 3.14159265358979323846
/*------------------------------------------------------------------------------*/

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

  VI a(N);

  int mx = 0;

  REP(i, 0, N){
    cin >> a[i];

    mx = max(mx, a[i]);
  }

  const int r_mx = mx/2;
  int r = 0;

  REP(i, 0, N){
    if(abs(r_mx - r) > abs(r_mx - a[i])){
      r = a[i];
    }
  }

  cout << mx << " " << r << endl;
  

  return 0;
}


Measured memory_bytes: 640
#include<stdio.h>
#include<algorithm>
#include<queue>
#include<vector>
#include<utility>
#include<stdlib.h>
#include<string.h>
using namespace std;

#define se second
#define fi first
#define mk(a,b) make_pair(a,b)

typedef long long ll;
typedef pair<ll,int> pii;

int N,M,S,T;
vector<pii> G[2][100010];
ll D1[100010],D2[100010];
ll ans = 0;
vector<ll> mem;

void daijkstra(ll s,ll *d,int k)
{
    priority_queue<pii,vector<pii>,greater<pii> > q;
    q.push(mk(0,s));
    for(int i = 0; i <= N; i++)d[i] = -1;
    while(q.size())
    {
        pii now = q.top();
        q.pop();
        if(d[now.se] != -1)continue;
        d[now.se] = now.fi;
        for(int i = 0; i < G[k][now.se].size(); i++)
            q.push(mk(now.fi + G[k][now.se][i].fi,G[k][now.se][i].se));
    }
    return;
}

int main()
{
    scanf("%d%d%d%d",&N,&M,&S,&T);

    for(int i = 0; i < M; i++)
    {
        int u,v;
        ll a,b;
        scanf("%d%d%lld%lld",&u,&v,&a,&b);
        G[0][u].push_back(mk(a,v));
        G[0][v].push_back(mk(a,u));
        G[1][u].push_back(mk(b,v));
        G[1][v].push_back(mk(b,u));
    }
    daijkstra(S,D1,0);
    daijkstra(T,D2,1);

    for(int i = N; i >= 1; i--)
    {
        ans = max(ans,1000000000000000 - D1[i] - D2[i]);
        mem.push_back(ans);
    }
    for(int i = N - 1; i >= 0; i--)printf("%lld\n",mem[i]);

    return 0;
}


Measured memory_bytes: 23344
package main

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

func main() {
	n := getInt()

	until := int(math.Ceil(math.Sqrt(float64(n))))
	ans := 10
	for i := 1; i <= until; i++ {
		if n%i == 0 {
			// ans = min(ans, f(n/i, i))
			ans = min(ans, len(strconv.Itoa(n/i)))
		}
	}

	fmt.Println(ans)
}

// func f(a, b int) int {
// 	maxLen := max(len(strconv.Itoa(a)), len(strconv.Itoa(b)))
// 	return maxLen
// }

func max(ns ...int) int {
	max := ns[0]
	for i := 1; i < len(ns); i++ {
		if max < ns[i] {
			max = ns[i]
		}
	}
	return max
}

func min(ns ...int) int {
	min := ns[0]
	for i := 1; i < len(ns); i++ {
		if min > ns[i] {
			min = ns[i]
		}
	}
	return min
}

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

var scanner = wordScanner()

func wordScanner() *bufio.Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	return sc
}

func getInt() int {
	scanner.Scan()
	i, err := strconv.Atoi(scanner.Text())
	if err != nil {
		panic(err)
	}
	return i
}

func getString() string {
	scanner.Scan()
	s := scanner.Text()
	return s
}


Measured memory_bytes: 640
from collections import deque


def main():
    n = int(input())
    trees = [None for _ in range(n)]
    for i in range(n):
        tree = list(map(int, input().split()))
        trees[tree[0]] = tree[2:]

    # 根を探す
    candidates = set()
    have_parents = set()
    children = []
    for i in range(len(trees)):
        if len(trees[i]):
            candidates.add(i)
            children.extend(trees[i])
    children = set(children)
    have_parents = {c for c in candidates if c in children}

    if n == 1:
        root_node = 0
    else:
        root_node = list(candidates - have_parents)[0]

    depth = []
    q = deque()
    seen = [0]*n
    depth = [0]*n
    parents = [0]*n

    q.append(root_node)
    seen[root_node] = 1
    parents[root_node] = -1

    while len(q):
        v = q.pop()
        d = depth[v] + 1
        for t in trees[v]:
            if seen[t]:
                continue
            seen[t] += 1
            parents[t] = v
            q.append(t)
            depth[t] = d

    for i in range(n):
        if not depth[i]:
            print(
                "node {}: parent = {}, depth = {}, root, {}"
                .format(i, parents[i], depth[i], trees[i]))
        elif depth and len(trees[i]):
            print(
                "node {}: parent = {}, depth = {}, internal node, {}"
                .format(i, parents[i], depth[i], trees[i]))
        else:
            print(
                "node {}: parent = {}, depth = {}, leaf, {}"
                .format(i, parents[i], depth[i], trees[i]))


if __name__ == '__main__':
    main()


Measured memory_bytes: 26196
# -*- coding: utf-8 -*-
my_dict = dict()
n = int(input())
for i in range(n):
    my_input = input()
    if my_input in my_dict:
        my_dict[my_input] += 1
    else:
        my_dict[my_input] = 1

max_val = max(my_dict.values())
keys_of_max_val = [key for key in my_dict if my_dict[key] == max_val]

keys_of_max_val.sort()

print("\n".join(keys_of_max_val))


Measured memory_bytes: 108248
#include <stdio.h>

int main(void){
  //int n=0;
  char n[200005]="0";
  int i=0,sum=0;
  scanf("%s", n);

  while(n[i]!='\0'){
    //scanf("%d", n);
    sum+=n[i]-'0';
    i++;
  }
  if(sum%9==0)printf("Yes\n");
  else printf("No\n");
  return 0;
}



Measured memory_bytes: 1836
Q = int(input())
lr = [tuple(map(int, input().split())) for _ in range(Q)]

is_prime = [True] * (10**5+1)
is_prime[0] = False
is_prime[1] = False

for n in range(2, 10**5+1):
    if not is_prime[n]:
        continue

    tmp = 2
    while n * tmp <= 10**5:
        is_prime[n * tmp] = False
        tmp += 1


cnt_accum_primes = [0] * (10**5 + 5)

for i in range(1, 10**5+1):
    if i % 2 == 0:
        cnt_accum_primes[i] = cnt_accum_primes[i-1]
    elif is_prime[i] and is_prime[(i+1)//2]:
        cnt_accum_primes[i] = cnt_accum_primes[i-1] + 1
    else:
        cnt_accum_primes[i] = cnt_accum_primes[i-1]


for l,r in lr:
    print(cnt_accum_primes[r] - cnt_accum_primes[l-1])

Measured memory_bytes: 18928
#include <stdio.h>

int main(){
    int a, b, c = 0, d = 0, i = 0;
    
    while(scanf("%d,%d", &a, &b) != EOF){
        c += a * b;
        d += b;
        i++;
    }
    d = (int)(((double)d / i) + 0.5);
    printf("%d\n%d\n", c, d);
    
    return 0;
}

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

int main() {
    ll N; cin >> N;
    ll nt = N-1;
    ll ans = 1;

    map<int, int> m;
    for (int i = 2; i <= sqrt(nt); i++)
    {
        while(nt%i==0){
            nt/=i;
            m[i]++;
        }
    }
    if(nt>1) m[nt]++;

    for(auto i : m){
        //cout << i.first << " " << i.second << endl;
        ans *= i.second+1;
    }
    ans--; // remove 1
    //cout << ans << endl;

    ans++; //N
    for (int i = 2; i <= sqrt(N); i++)
    {
        ll nt = N;
        if(nt%i!=0) continue;
        while(nt%i==0) nt /= i;
        if(nt%i==1) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
import math
a, b, x = map(int, input().split())

if x <= a*a*b//2:
    print(math.degrees(math.atan2(a*b*b, 2*x)))
else:
    y = a*a*b - x
    print(math.degrees(math.atan2(2*y, a*a*a)))

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep2(i, a, n) for(ll i = a; i < (ll)(n); i++)
#define memi cout << endl
#define kono(n) cout << fixed << setprecision(n)
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define hina cout << ' '
#define in(n) cin >> n
#define in2(n, m) cin >> n >> m
#define in3(n, m, l) cin >> n >> m >> l
#define out(n) cout << n
const ll mei = (ll)1e9 + 7;

int main(){
  ll a, b, n, s;
  in3(n, a, b);
  s = 0;
  vector<ll> c(n);
  rep(i, n)
    in(c[i]);
  rep(i, n - 1){
    if((c[i + 1] - c[i]) * a < b)
      s += (c[i + 1] - c[i]) * a;
    else
      s += b;
  }
  out(s);
  memi;
}

Measured memory_bytes: 4040
from heapq import heappop as pop
from heapq import heappush as push
INF = 1000000000000

def bfs(lst, used, que, w, h):
  v, y, x  = pop(que)

  if not used[y - 1][x]:
    push(que, (lst[y - 2][x - 1], y - 1, x))
    used[y - 1][x] = True

  if not used[y + 1][x]:
    push(que, (lst[y][x - 1], y + 1, x))
    used[y + 1][x] = True

  if not used[y][x - 1]:
    push(que, (lst[y - 1][x - 2], y, x - 1))
    used[y][x - 1] = True

  if not used[y][x + 1]:
    push(que, (lst[y - 1][x], y, x + 1))
    used[y][x + 1] = True

  return v

def make_dic(lst, w, h, x, y):
  que = [(1, y, x)]
  used = [[True] + [False] * w + [True] for _ in range(h)]
  used.insert(0, [True] * (w + 2))
  used.append([True] * (w + 2))
  used[y][x] = True
  dic = [[0, 0]]
  app = dic.append
  Max = 0
  acc = 0

  while que:
    v = bfs(lst, used, que, w, h)
    acc += 1
    if v > Max:
      app([v, acc])
      Max = v
    else:
      dic[-1][1] += 1
  return dic

def solve():
  while True:

    R = int(input())
    if not R:
      break

    w1, h1, x1, y1 = map(int, input().split())
    lst1 = [list(map(int, input().split())) for _ in range(h1)]
  
    w2, h2, x2, y2 = map(int, input().split())
    lst2 = [list(map(int, input().split())) for _ in range(h2)]
  
    dic1 = make_dic(lst1, w1, h1, x1, y1)
    dic2 = make_dic(lst2, w2, h2, x2, y2)
  
    end1 = len(dic1)
    end2 = len(dic2)
    ind1 = 0
    ind2 = end2 - 1
    ans = INF
  
    while ind1 < end1 and ind2 > 0:
      r1, sum1 = dic1[ind1]
      r2, sum2 = dic2[ind2]
  
      if sum1 + sum2 < R:
        ind1 += 1
        continue
  
      while ind2 > 0 and sum1 + sum2 >= R:
        ind2 -= 1
        r2, sum2 = dic2[ind2]
  
      if ind2 == 0 and sum1 + sum2 >= R:
        rs = r1 + r2
        if rs < ans:
          ans = rs
        break
  
      else:
        ind2 += 1
        r2 = dic2[ind2][0]
        rs = r1 + r2
        if rs < ans:
          ans = rs
  
      ind1 += 1
    print(ans)
 
solve()


Measured memory_bytes: 57636
import java.io.*;
import java.util.*;
import java.lang.reflect.Array;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Scanner;
import java.util.Stack;


class Main {
	public static void main(String[] a) throws IOException {
		Scanner scan = new Scanner(System.in);
		InputStreamReader isr = new InputStreamReader(System.in);
		BufferedReader br = new BufferedReader(isr);
		String brf;
		while ((brf=br.readLine()) != null){
		double max, min;
		max = min = Double.parseDouble(brf);
		while((brf = br.readLine())!=null){
			double newone = Double.parseDouble(brf);
			if(newone > max){max = newone;
			}
			if(newone < min){min = newone;}
		}
		System.out.println(max-min);
	}
		
	
	}
}

Measured memory_bytes: 26396
#include<cstdio>
#include<cstring>
#include<vector>
#include<algorithm>
using namespace std;
int n,m,l[310000],r[310000],tree[110000];
vector<int> vec[110000];
void add(int x,int y){
    for (;x<=m;x+=x&-x) tree[x]+=y;
}
int getsum(int x){
    int sum=0;
    for (;x;x-=x&(-x)) sum+=tree[x];
    return sum;
}
int main(){
    scanf("%d%d",&n,&m);
    for (int i=1;i<=n;i++){
        scanf("%d%d",&l[i],&r[i]);
        vec[r[i]-l[i]+1].push_back(i);
    }
    for (int i=1;i<=m;i++){
        int ans=0;
        for (int j=0;j<(int)vec[i].size();j++)
            add(l[vec[i][j]],1),add(r[vec[i][j]]+1,-1);
        for (int j=i;j<=m;j+=i) ans+=getsum(j);
        n-=vec[i].size();
        printf("%d\n",ans+n);
    }
    return 0;
}
//

Measured memory_bytes: 9472
import sys
input = sys.stdin.buffer.readline

#n = int(input())
#l = list(map(int, input().split()))

'''
A=[]
B=[]
for i in range():
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)'''

import math
n = int(input())
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
root = [a, b, c, d, e]
minn=min(root)
#for i in range(5):
#    if root[i]==minn:
#        cnt=i+1
#        break

#print(cnt)
#print(5+(n//minn))
#print(5+math.floor(n/minn))
print(4+math.ceil(n/minn))


Measured memory_bytes: 3064
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<cstring>
#include<string>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<map>
#include<set>
using namespace std;
const int inf=2147483647,dx[]={-1,0,1,0},dy[]={0,-1,0,1};// 上 左 下 右
const int N=100005,M=1000005,mod=1000000007;
const long long llinf=9223372036854775807ll;
int n,k,a[N],dp[N];
int main(){
	cin>>n>>k;
	for(int i=1;i<=n;i++)
		cin>>a[i],dp[i]=inf;
	dp[1]=0;
	for(int i=2;i<=min(k,n);i++)
		for(int j=1;j<i;j++)
			dp[i]=min(dp[i],abs(a[i]-a[j])+dp[j]);
	for(int i=k+1;i<=n;i++)
		for(int j=i-k;j<i;j++)
			dp[i]=min(dp[i],abs(a[i]-a[j])+dp[j]);
	cout<<dp[n];
	return 0;
}

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

typedef long long ll;

int main(void)
{
    ll a , b;

    while(cin >> a >> b){

        a = a+b;

        b = 0;

        while(a!=0){
            b++;
            a/=10;
        }

        cout << b << endl;
    }

    return 0;

}

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

int main() {
    string S, T;
    cin >> S >> T;
    int A, B;
    cin >> A >> B;
    string U;
    cin >> U;
    if(U == S) {
        A--;
    } else if(U == T) {
        B--;
    }
    cout << A << " " << B << endl;
    return 0;
}

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

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP0(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REP1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)

typedef long long LL;
typedef pair<int, int> pii;

const int INTINF = int(1e9) + 1;
const LL LLINF = LL(1e18) + 1;
#define pow10(n) int(1e##n + n)
int N;
LL K;
LL A[pow10(5)];
LL d[63];
LL opt[63];
LL ans;
LL D_MAX = 42;
// 桁DP 上位桁から
LL dp[100][2];

void solve()
{
    cin >> N >> K;
    REP0 (i, N)
    {
        cin >> A[i];

        for (LL j = D_MAX; j >= 0; j--)
        {
            if (A[i] & (1LL << j))
            {
                d[j]++;
            }
        }

        ans += A[i];
    }

    for (LL j = D_MAX; j >= 0; j--)
    {
        if (0 < N - 2 * d[j])
            opt[j] = (N - 2 * d[j]) * (1LL << j);
    }

    LL max_inc = 0;

    for (LL j = D_MAX; j >= 0; j--)
    {
        if (K & (1LL << j))
        {
            dp[j][0] = dp[j + 1][0] + opt[j];
            // j 桁目で未満を確定させること = j桁目でK=1のとき0を選ぶこと
            // そして 0~j-1桁目は最適に選べる
            dp[j][1] = dp[j + 1][0];
            REP0 (i, j)
            {
                dp[j][1] += opt[i];
            }
            max_inc = max(max_inc, dp[j][0]);
            max_inc = max(max_inc, dp[j][1]);
        }
        else
        {
            dp[j][0] = dp[j + 1][0];
        }
    }

    cout << ans + max_inc << endl;
}

int main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(10);
    solve();
    return 0;
}


Measured memory_bytes: 1024
n=int(input())
a=list(map(int,input().split()))
j2,j4=0,0
for x in a:
    if x%4==0:
        j4+=1
    elif x%2==0:
        j2+=1
if n%2==0:
    print("Yes" if j2+2*j4>=n else "No")
else:
    print("Yes" if j2+2*j4>=n-1 else "No")

Measured memory_bytes: 15020
N=int(input())
S=input()

cnt = 0
cnt_black = 0
should_change = 0

cnt_black_arr = [0] * (N+1)

for i in range(N):
    if S[i] == '#':
        cnt_black += 1
    cnt_black_arr[i+1] = cnt_black

res = cnt_black
for i in range(N):
    num_black = N-i
    right_white = N - cnt_black - (i - cnt_black_arr[i])
    res = min(res, cnt_black_arr[i] + right_white)

print(res)


Measured memory_bytes: 11144
H, W = map(int,input().split())
A = [""]*H
row = [False]*H #行
col = [False]*W #列
for i in range(H):
    A[i] = input()
for i in range(H):
    for j in range(W):
        if A[i][j] == "#":
            row[i] = True
            col[j] = True

for i in range(H):
    if row[i]:
        for j in range(W):
            if col[j]:
                print(A[i][j], end="")
        print()


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

typedef long long ll;

int main() {
    ios::sync_with_stdio(0);
    
    int n;
    cin >> n;
    vector<int> a(n+1);
    vector<int> dp(n+1);
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
        dp[a[i]] = dp[a[i] - 1] + 1;
    }
    int ans = 0;
    int ind = 0;
    for (int i = 1; i <= n; i++) {
        if (dp[i] > ans) {
            ans = dp[i];
            ind = i;
        }
    }
    //cout << ans << " " << ind << endl;
    cout << n-ans << '\n';
    int r = ind;
    int l = ind-ans+1;
    vector<int> ans1, ans2;
    for (int i = 1; i <= n; i++) {
        if (a[i] < l) {ans1.push_back(a[i]);}
        else if (a[i] > r) {ans2.push_back(a[i]);}
    }
    sort(ans1.begin(), ans1.end(), greater<int>());
    sort(ans2.begin(), ans2.end());

    
    return 0;
}

Measured memory_bytes: 3320
using System;
using System.Linq;
using System.Collections.Generic;

namespace bucon2
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int ans;

            if(n < 2){
                ans = 1;
            }else if(n < 4){
                ans = 2;
            }else if(n < 8){
                ans = 4;
            }else if(n < 16){
                ans = 8;
            }else if(n < 32){
                ans = 16;
            }else if(n < 64){
                ans = 32;
            }else{
                ans = 64;
            }
            Console.WriteLine(ans);
        }
    }
}


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

using namespace std;

typedef long long ll;

int main(){
  int A, B, C, K;
  cin >> A >> B >> C >> K;

  for(int i=0; i<K; i++){
    if (A >= B){
      B = B * 2;
    }else if (B >= C){
      C = C * 2;
    }
  }

  string ans = (A < B && B < C) ? "Yes" : "No";
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define MOD 1000000007  
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;   
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
//find_by_order(k) - k is the kth element of the multiset
//order_of_key(k) - Number of elements striclty samller than k
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n;
    cin>>n;
    ll arr[n];
    for(int i=0;i<n;i++)
    {
        cin>>arr[i];
    }
    ll temp=arr[0];
    for(int i=1;i<n;i++)
    {
        ll just=arr[i]-temp;
        temp=just;
     //   cout<<temp<<endl;
    }
    cout<<temp<<" ";
    ll ans[n];
    ans[0]=temp;
    for(int i=1;i<n;i++)
    {
        ans[i]=arr[i-1]*2-ans[i-1];
        cout<<ans[i]<<" ";
    }
    cout<<endl;
}

Measured memory_bytes: 2944
L, R = map(int, input().split())
MOD = 2019
if R - L + 1 >= MOD:
    print(0)
else:
    l_mod = L % MOD
    r_mod = R % MOD
    if r_mod < l_mod:
        print(0)
    else:
        min = (l_mod * (l_mod + 1)) % MOD
        for i in range(l_mod, r_mod):
            for j in range(i + 1, r_mod + 1):
                if ((i * j) % MOD) < min:
                    min = (i * j) % MOD
        print(min)


Measured memory_bytes: 3060
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.buffer.readline

N, M = map(int, input().split())
nextcity = [[] for _ in range(N)]
sgn = [0 for _ in range(N)]
while M:
	M -= 1
	A, B = map(int, input().split())
	A -= 1
	B -= 1
	nextcity[A].append(B)
	nextcity[B].append(A)

def bfs(cnt, lis):
	nextvisit = []
	for j in lis:
		for item in nextcity[j]:
			if sgn[item] == 0:
				nextvisit.append(item)
				sgn[item] = cnt
	if nextvisit:
		bfs(cnt, nextvisit)
		return None
	else:
		return None
cnt = 0
for k in range(N):
	if sgn[k] == 0:
		cnt += 1
		sgn[k] = cnt
		bfs(cnt, [k])
print(cnt -1)

Measured memory_bytes: 81468
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
int ctoi(char c) {return c-'0';}// char to int
int gcd(ll a,ll b){return b?gcd(b,a%b):a;}//MAX
int lcm(ll a,ll b){return a*b/gcd(a,b);}//MIN
 
int  main(){
int n;
cin >> n;
bool ans = true;
int btime ,zahyo;
for(int i=0;i<n;i++){
    int time,x,y;
    cin >> time >> x >> y;
    if(i==0){
        if(time<x+y)ans = false;
        if((time-x-y)%2!=0)ans = false;
    }
    else{
        if(time-btime<abs(x+y-zahyo))ans = false;
        if((time-btime-abs(x+y-zahyo))%2!=0)ans =false;
      
    }
    btime = time ,zahyo=x+y;
}
if(ans)cout <<"Yes"<<endl;
else cout <<"No"<<endl;
}
 


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(ll i = 0;i<((ll)(n));i++)
#define reg(i,a,b) for(ll i = ((ll)(a));i<=((ll)(b));i++)
#define irep(i,n) for(ll i = ((ll)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(ll i = ((ll)(b));i>=((ll)(a));i--)
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;

/*
*/

ll n,m;
ll a[200010];
ll sum=0,tmp=0,ans=1e18;

int main(void){
	cin>>n;
	reg(i,1,n)cin>>a[i];
	reg(i,1,n)sum+=a[i];
	reg(i,1,n){
		ans=min(ans,abs(sum-2*tmp));
		tmp+=a[i];
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define INF 1e9
#define MOD 998244353
using namespace std;
using ll = long long;
using pii = pair<int, int>;

int main(void)
{
    int N, K;
    cin >> N >> K;
    vector<pii> lr(K);
    for (int i = 0; i < K; i++)
    {
        cin >> lr[i].first >> lr[i].second;
        lr[i].second++;
    }

    vector<ll> dp(N + 1, 0);
    dp[0] = 1;
    dp[1] = -1;

    for (int i = 0; i < N; i++)
    {
        if (i > 0)
        {
            dp[i] += dp[i - 1];
            dp[i] %= MOD;
        }
        for (int j = 0; j < K; j++)
        {
            if (i + lr[j].first < N)
            {
                dp[i + lr[j].first] += dp[i];
                dp[i + lr[j].first] %= MOD;
            }
            if (i + lr[j].second < N)
            {
                dp[i + lr[j].second] += (MOD - dp[i]);
                dp[i + lr[j].second] %= MOD;
            }
        }
    }

    cout << dp[N - 1] << endl;

    return 0;
}


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

#define int long long
const double PI = 3.14159265358979323846;
typedef vector<int> vint;
typedef pair<int, int> pint;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

int A, B;
signed main() {
    cin >> A >> B;
    if (A <= 8 && B <= 8) {
        cout << "Yay!" << endl;
    } else {
        cout << ":(" << endl;
    }
}

Measured memory_bytes: 256
#include<stdio.h>
#define MAX 100
#define KEY 52

int n;
int k[KEY];
char s[MAX];
char t;

int main(){
	int i,j;
	
	while(1){

		s[0] = '\0';
		scanf("%d",&n);

		if(n == 0) break;

		for(i = 0; i < n; i++){
			scanf("%d",&k[i]);
		}

		scanf("%s",s);

		for(i = j = 0; s[i] != '\0'; i++){
			char t = s[i] - k[j];
		
			if(t < 'A' && ('A' <=s[i] && s[i] <= 'Z')) {
         t += 58;
				 if(t < 'a') t -= 6;
			}
			if(t < 'a' && ('a' <= s[i] && s[i] <= 'z')){
         t -= 6;
				 if(t < 'A') t += 58;
			}
				
			j++;
			printf("%c",t);
			if(j == n)j = 0;
 
	}
		printf("\n");
	}
	return 0;
}

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

using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define MOD 1000000007LL

#define rep(i, n) for(ll (i) = 0LL;(i) < (ll)(n);(i)++)
#define rep2(i, s, e) for(ll (i) = (ll)(s);(i) < (ll)(e);(i)++)
#define repi(i, n) for(ll (i) = 0LL;(i) <= (ll)(n);(i)++)
#define repi2(i, s, e) for(ll (i) = (ll)(s);(i) <= (ll)(e);(i)++)
#define per(i, n) for(ll (i) = (ll)(n) - 1LL;(i) >= 0LL;(i)--)
#define per2(i, s, e) for(ll (i) = (ll)(s) - 1LL;(i) >= (ll)(e);(i)--)
#define peri(i, n) for(ll (i) = (ll)(n);(i) >= 0LL;(i)--)
#define peri2(i, s, e) for(ll (i) = (ll)(s);(i) >= (ll)(e);(i)--)
#define iter(i, it) for(auto &(i): (it))

template<typename T, typename U> ostream& operator<<(ostream &s, const pair<T, U> m) {
    cout << "(" << m.first << ", " << m.second << ")";
    return s;
}
template<typename T, typename U> ostream& operator<<(ostream &s, const map<T, U> m) {
    ll c = 0;
    cout << "{ ";
    iter(i, m) cout << i << (c++ == m.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const vector<T> &v) {
    cout << "{ ";
    rep(i, v.size()) cout << v[i] << (i == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const list<T> &v) {
    ll c = 0;
    cout << "{ ";
    iter(i, v) cout << i << (c++ == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}

int main(void) {
    ll N;
    ll count = 0;
    cin >> N;
    vector<ll> A(N);
    rep(i, N) {
        cin >> A[i];
        A[i] -= i + 1;
    }
    sort(A.begin(), A.end());
    iter(i, A) count += abs(i - A[N / 2]);
    cout << count << endl;
    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <deque>
#include <numeric>
#include <utility>
#define sign(a) ((a>0)-(a<0))
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define LL long long
#define INF (LL)(1LL<<60)
#define all(a) a.begin(), a.end()
#define gr greater<LL>()

using namespace std;

void solve(std::string s, std::string t){
    vector<vector<int>> tab(26, vector<int>());
    rep(i, s.length()){
        int p = (int)(s[i]-'a');
        tab[p].emplace_back(i);
    }
    LL ans=0;
    int prev=-1;
    for(auto c:t){
        int p = (int)(c-'a');
        if(tab[p].empty()){
            cout << -1 << endl;
            return;
        }
        auto it = upper_bound(all(tab[p]), prev);
        if(it == tab[p].end()){
            ans += s.length();
            prev = tab[p][0];
        }else{
            prev = *it;
        }
    }
    cout << ans+prev+1 << endl;
}

int main(){
    std::string s;
    std::cin >> s;
    std::string t;
    std::cin >> t;
    solve(s, t);
    return 0;
}


Measured memory_bytes: 1280
from collections import deque

N, u, v  =  map(int, input().split())

ab_list = [
  tuple(map(int, input().split())) for _ in range(N - 1)
]

graph = [ [] for _ in range(N+1) ]

#双方向だから両矢印に。
for a, b in ab_list:
  graph[a].append(b)
  graph[b].append(a)
  
def dfs(v):
  dist = [-1] * (N+1)
  stack = [v]
  dist[v] = 0
  while stack:
    v = stack.pop()
    dw = dist[v] + 1
    for w in graph[v]:
      if dist[w] >= 0:
        continue
      dist[w] = dw
      stack.append(w)
  return dist

#到達できる最小回数
DU = dfs(u)
DV = dfs(v)

answer = 0
for u, v in zip(DU[1:], DV[1:]):
  if u < v:
    #　到達できちゃう天を洗い出し
    x = v - 1
    answer = max(answer, x)

print(answer)

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

int main(){

        int h,w,m;
          cin>>h>>w>>m;

         unordered_map<int,int>row,colmn;

        map<pair<int,int>,int>tp;

            int max_val_row=0,max_val_colmn=0;

         for(int i=1;i<=m;i++){

             int x,y;
               cin>>x>>y;

               pair<int,int> g = make_pair(x,y);
                tp[g]++;

              row[x]++;
              colmn[y]++;

               if(max_val_row < row[x])
                max_val_row = row[x];

               if(max_val_colmn < colmn[y])
                max_val_colmn = colmn[y];
         }

            vector<int>row_max_var,col_max_var;

        //    cout<<max_val_row<<" "<<max_val_colmn<<endl;

           for(auto i=1;i<=h;i++)
           {
              //cout<<i->first<<" "<<i->second<<endl;
               if(row[i] == max_val_row)
                row_max_var.push_back(i);
           }

           for(auto i =1;i<=w;i++)
             {
                 if(colmn[i]== max_val_colmn)
                 col_max_var.push_back(i);
             }

            int val_max = 0;
             bool flag = false;

           for(int i=0;i<row_max_var.size();i++)
            {
               for(int j=0;j<col_max_var.size();j++){

                    pair<int,int> f = make_pair(row_max_var[i],col_max_var[j]);
                     if(tp[f] > 0)
                    val_max = max(val_max , max_val_row + max_val_colmn - 1);

                    else
                   {
                    val_max = max(val_max,max_val_row + max_val_colmn);flag=true;
                    break;
                   }
               }
                  if(flag)
                  break;
            }

       /*
           int val_max = 0;
            for(auto it = tp.begin();it!=tp.end();it++){

                  int first = it->first.first;
                  int second = it->first.second;
            }*/
            cout<<val_max;
}

Measured memory_bytes: 53212
import java.io.IOException;
import java.io.InputStream;
import java.util.Collections;
import java.util.NoSuchElementException;
import java.util.PriorityQueue;
import java.util.Queue;

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

		FastScanner sc = new FastScanner();
		int n = sc.nextInt();
		int m = sc.nextInt();

		Queue<Integer> q = new PriorityQueue<Integer>(Collections.reverseOrder());
		for (int i = 0; i < n; i++) {
			q.add(sc.nextInt());
		}

		for (int i = 0; i < m; i++) {
			q.add(q.poll() / 2);
		}

		System.out.println(q.parallelStream().mapToLong(val -> Integer.toUnsignedLong(val)).sum());
	}
}

class FastScanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;

	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) {
				return false;
			}
		}
            return true;
	}

	private int readByte() {
		if (hasNextByte())
			return buffer[ptr++];
		else
			return -1;
	}

	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}

	public boolean hasNext() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr]))
			ptr++;
		return hasNextByte();
	}

	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	public long nextLong() {
		if (!hasNext())
			throw new NoSuchElementException();
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
            }
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
            }
        }

	public int nextInt() {
		long nl = nextLong();
		if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
			throw new NumberFormatException();
		return (int) nl;
        }

	public double nextDouble() {
		return Double.parseDouble(next());
	}
}

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

using namespace std;

#define int long long
#define ld long double
#define sz(a) (int) (a).size()
#define all(a) (a).begin(), (a).end()
#define x first
#define y second

mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);

    int n;
    cin >> n;
    vector<int> a(n);
    int mx = 0;
    int ans = 0;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        if (a[i] <= mx) {
            ans += mx - a[i];
        }
        mx = max(mx, a[i]);
    }
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 4776
#include <stdio.h>

int main(void) {

	int k = 0;
	int a = 0;
	int b = 0;
	int i;
	int y = 0;

	scanf("%d\n", &k);
	scanf("%d%d", &a, &b);
	
	//printf("k=%d, a=%d, b=%d \n", k, a, b);


	for(i=1; i<=1000; i++) {
		y = k * i;
		//printf("%d\n", y);
		if(y >= a && y <= b) {
			printf("OK");
			break;
		}
	}

	if(i==1001) {
		printf("NG");
	}

	return 0;
}

Measured memory_bytes: 1736
import sys
def factors(n):
  a = []
  x = 1
  while x * x <= n :
    if n % x == 0:          
      a.append(x)
      a.append(n//x)
    x += 1
  return a
n,m=map(int,input().split())
fac=factors(m)
fac.sort()
for i in range(len(fac)-1,-1,-1):
  if n*fac[i]<=m:
    print(fac[i])
    sys.exit()

Measured memory_bytes: 63128
#include <bits/stdc++.h>
#define ll long long
#define REV(v) reverse(v.begin(), v.end());
#define REP(i, n) for (ll i = 0; i < n; i++)
#define REPR(i, n) for (ll i = n; i >= 0; i--)
#define FOR(i, start, stop) for (ll i = start; i < stop; i++)
#define FORR(i, start, stop) for (ll i = start; i > stop; i--)
#define SORT(v, n) sort(v, v + n);
#define SORTR(v, n) sort(v, v + n,greater<ll>());
#define VSORT(v) sort(v.begin(), v.end());
#define VSORTR(v) sort(v.begin(), v.end(),greater<ll>());
#define REMOVE(v,n) remove(vector<ll> v,v+v.size(),ll n)
#define ERASE(v,n) v.erase(v.begin()+n);
#define ull unsigned long long
#define pb(a) push_back(a)
#define INF 999999999
#define V(v,i,j) vector(v.begin() + i, v.begin() + j)
#define INSERT(va,vb) va.insert(va.end(), vb.begin(), vb.end())
using namespace std;
typedef vector<ll> vll;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;
int dy[] = {0, 0, 1, -1};
int dx[] = {1, -1, 0, 0};
const int MOD = 1000000007;
void chmin(int &a, int b) { if (a > b) a = b; }

//vector< vector<int> > v (size1, vector<int>(size2) );



int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N;
    cin>>N;
    vector<LP> xy(N);
    ll x,y;
    FOR(i,0,N){
        cin>>x>>y;
        xy[i]={x,y};
    }

    vector<LP> diff(0);

    FOR(i,0,N){
        FOR(j,0,N){
            if(i!=j)diff.push_back({xy[i].first-xy[j].first,xy[i].second-xy[j].second});
        }
    }

    ll cnt=1;
    ll ans=0;
    
    VSORT(diff);

    if(N!=1){
        FOR(i,0,diff.size()-1){
            if(diff[i]==diff[i+1])cnt++;
            else{
                //cout<<cnt<<endl;
                ans=max(ans,cnt);
                cnt=1;
            }
        }
        ans=max(ans,cnt);
    }
    
    FOR(i,0,diff.size()){
        //cout<<diff[i].first<<' '<<diff[i].second<<endl;
    }
    
    
    
    
    //cout<<ans<<endl;;

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

Measured memory_bytes: 384
#!/usr/bin/python3
# -*- coding: utf-8 -*-
n, m, q = map(int, input().split())
dict_list = {}
key_list = []
for i in range(0, q):
    a, b, c, d =  map(int, input().split())
    key = tuple([a, b, c])
    key_list.append(key)
    dict_list[key] = d

def func(i, k, a_list):
    if k == 0:
        temp_score = 0 
        for key in key_list:
            if key[2] == a_list[key[1]-1] - a_list[key[0]-1]:
                temp_score += dict_list[key]
        return temp_score
    k = k - 1
    max_score = 0
    for j in range(i, m + 1):
        max_score = max(func(j, k, a_list + [j]), max_score)
    return max_score
score = 0
for i in range(1, m + 1):
    score = max(func(i, n - 1, [i]), score)
print(score)

Measured memory_bytes: 9256
import math

N, A, B = list(map(int, input().split()))
h = [int(input()) for i in range(N)]

left, right = 0, math.ceil(max(h)/B)
AB = A - B

while left+1 < right:
    mid = math.ceil((left + right) / 2)

    h_ = list(filter(lambda x: x > 0, [n - mid*B for n in h]))

    if sum([math.ceil(n / AB) for n in h_]) <= mid:
        right = mid
    else:
        left = mid

print(right)

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

using namespace std;
const long long INF = 1LL <<60;  

long long gcn(long long x,long long y){
  if(x%y==0){
    return y;
  }
  else{
    return gcn(y,x%y);
  }
}

int main(void){
  long long res=-1;
  long long n,m;
  long long nn,mm;
  long long g;
  char ss,tt;
  string s,t,tmp;
  long long i,j;
  
  cin>>n>>m;
  cin>>s;
  cin>>t;

  nn=max(n,m);
  mm=min(n,m);
  
  if(m==nn){
    tmp=s;
    s=t;
    t=tmp;
    //cout<<s<<" "<<t<<endl;
  }
  
  g=gcn(nn,mm);
  n=nn/g;
  m=mm/g;

  if(g==1){
    ss=s[0];
    tt=t[0];
    if(ss==tt){
      res=n*m;
    }
    else{
      res=-1;
    }
    cout<<res<<endl;
    return 0;
  }

  
  //cout<<n<<" "<<m<<" "<<g<<endl;
  for(i=0;i<g;i++){
    ss=s[i*n];
    tt=t[i*m];
    //cout<<ss<<" "<<tt<<" "<<(ss==tt)<<endl;
    if(ss!=tt){
      res=-1;
      cout<<res<<endl;
      return 0;
    }
  }
  if(i=g){
    res=n*m*g;
  }
  cout<<res<<endl;
  return 0;
}

Measured memory_bytes: 3780
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <fstream>
#include <cstdlib>
#include <ctime>
#include <string>
#include <cstring>
#include <fstream>
#include <random>
#include <tuple>
#include <climits>
using namespace std;


int main() {
    int f[200][200];
    int c[8];
    int n, m, r;
    cin>>n>>m>>r;
    for (int i=0; i<r; i++) cin>>c[i], c[i]--;
    for (int i=0; i<n; i++) for (int j=0; j<n; j++) f[i][j] = INT_MAX;
    for (int i=0; i<m; i++) {
        int a, b, d;
        cin>>a>>b>>d;
        f[a-1][b-1] = f[b-1][a-1] = d;
    }
    for (int k=0; k<n; k++) {
        for (int i=0; i<n; i++) {
            for (int j=0; j<n; j++) {
                if (f[i][k] < INT_MAX && f[k][j] < INT_MAX && f[i][k] + f[k][j] < f[i][j]) f[i][j] = f[i][k] + f[k][j];
            }
        }
    }
    vector<int> p(r);
    for (int i=0; i<r; i++) p[i] = i;
    int ans = -1;
    do {
        int t = 0;
        for (int i=1; i<r; i++) {
            int from = c[p[i-1]], to = c[p[i]];
            t += f[from][to];
        }
        if (ans == -1 || t < ans) ans = t;
    } while (next_permutation(p.begin(), p.end()));
    cout<<ans<<endl;
}


Measured memory_bytes: 384
cards = list()
pattern = ["S", "H", "C","D"]
n = int(input())
for i in range(n) :
  s, r = input().split()  #文字列として読み込み
  r = int(r)  #sは文字列、rは数値
  if(s == "S") :
    cards.append(0 + r)
  elif(s == "H") :
    cards.append(13 + r)
  elif(s == "C") :
    cards.append(26 + r)
  else :
    cards.append(39 + r)
for i in range(1, 53) :
  if not(i in cards) :
    print(pattern[(i - 1) // 13], (i - 1) % 13 + 1)
  


Measured memory_bytes: 5600
//
//  main.cpp
//  CoderProj
//
//  Created by Minoru Hayashi on 2020/03/12.
//  Copyright © 2020 Minoru Hayashi. All rights reserved.
//
//  ABC131
//
//

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

#define REP(i,n) for (int i=0; i<(n); i++)
#define REP2(i,x,n) for (int i=x; i<(n); i++)
#define ALL(n) begin(n), end(n)

using ll = long long;

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

// const ll INF = 1LL<<60;
 const int INF = 1<<29;
// const ll MOD = 1000000007;
//#define __DBG__




void solve(void){
  
  int N;
    
  cin >> N;
  
  vector<pair<ll,ll>> P(N);
  
  REP(i,N){
    cin >> P[i].second >> P[i].first;
  }
  sort(ALL(P));
  
  ll stime=0;
  bool flag=true;
  REP(i,N){
    stime += P[i].second;
//    cout << stime << " " << P[i].second << endl;
    if(stime > P[i].first){flag=false; break;}
  }
  
  puts(flag?"Yes":"No");
  
  return;
}

#define TESTCASES 1

int main(int argc, const char * argv[]) {

    cin.tie(0);
    ios::sync_with_stdio(false);

    REP(i,TESTCASES){
      solve();
    }
 
    return 0;
}



Measured memory_bytes: 3456
#include <iostream>
#include <stack>
#include <cstdio>
#include <queue>
#include <algorithm>
#include <numeric>
#include <vector>
using namespace std;
#define endl "\n"
typedef long long Int;
int main() {
    double T,X;
    cin>>T>>X;
    cout<<T/X;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rint register int
#define deb(x) cerr<<#x<<" = "<<(x)<<'\n';
using namespace std;
typedef long long ll;
typedef pair <int,int> pii;
const ll mod = 1e9 + 7;
const int maxn = 3e5 + 10;
int n, a[maxn], b[maxn];

int main() {
	scanf("%d", &n);
	for(int i=1; i<=n; i++) scanf("%d", a+i);
	int f = 1;
	ll x = 0;
	for(int i=n-1; i; i--){
		x += 2ll * f * a[i];
		f *= -1;
	}
	
	b[1] = (2ll * a[n] - x) / 2;
	for(int i=2; i<=n; i++){
		b[i] = 2ll * a[i-1] - b[i-1];
	}
	
	for(int i=1; i<=n; i++) {
		if(i==1) printf("%d", b[i]);
		else printf(" %d", b[i]);
	}
}


Measured memory_bytes: 2048
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define PI 3.14159265358979323
//void quick(int *,long long,long long);

int main(){
     
	int i,j,a,b,s,flag;

	i=0;
	j=0;
	s=0;
	while(scanf("%d,%d",&a,&b)!=EOF){
		i+=b;
		j++;
		s+=a*b;
	}
	printf("%d\n%d\n",s,(int)( (double)i/j+0.5 ));
	return 0;
}

Measured memory_bytes: 592
#include <bits/stdc++.h>
#define rep(i,N) for(int i=0;i<N;i++)
#define rep2(i,N) for(int i=1;i<=N;i++)
using namespace std;
long long  INF=1000000000000000000;
long long mod=1000000007;
using namespace std;

bool prim(long long x){

bool p=true;
    for(int i=2;i<=sqrt(x);i++){
        if(x%i==0){
        p=false;
        break;
        }
    }


return p;

}



int main(){

long long  x;
cin>>x;

for(long long  i=x;i>0;i++){

    if(prim(i)){
        cout<<i<<endl;
        return 0;
    }
}


return 0;

}
/*
20

23

2

2

99992

100003
*/


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

using namespace std;

int check(int n){
  int cnt = 0;
  while(n){
    cnt++;
    n /= 10;
  }
  return (cnt%2 ? true : false);
}

int main(){
  int n; cin >> n;
  int res = 0;
  for(int i = 1; i <= n; i++){
     if(check(i)) res++;
  }
  cout << res;
  return 0;
}

Measured memory_bytes: 256