akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <string.h>
#define LEN 100005

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

P Q[LEN];
int head, tail, n;

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

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

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

int main()
{
    int elaps = 0, c;
    int i, q;
    P u;
    char str[64];

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

    while (head != tail)
    {
        u = dequeue();
        c = min(q, u.t);
        u.t -= c;
        elaps += c;
        if (u.t > 0)
            enqueue(u);
        else
        {
            printf("%s %d\n", u.name, elaps);
        }
    }
    return 0;
}


Measured memory_bytes: 11880
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <functional>
#include <cmath>
#include <math.h>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
using namespace std;
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define MOD (ll)1000000007

int main(void)
{
	int n, x, t;
	scanf("%d %d %d", &n, &x, &t);
	printf("%d", ((n - 1) / x + 1) * t);
	return 0;
}

Measured memory_bytes: 1724
package main

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

var sc = bufio.NewScanner(os.Stdin)

func scanInt() int {
	sc.Scan()
	iv, _ := strconv.Atoi(sc.Text())
	return iv
}

func init() {
	sc.Split(bufio.ScanWords)
}

var (
	par  []int
	rank []int
)

func initTree(x int) {
	par = make([]int, x+1)
	rank = make([]int, x+1)
	for i := range par {
		par[i] = i
	}
}

func find(x int) int {
	if par[x] == x {
		return x
	}
	par[x] = find(par[x])
	return par[x]
}

func union(x, y int) {
	px, py := find(x), find(y)
	if px == py {
		return
	}
	if rank[px] < rank[py] {
		par[px] = py
		return
	} else if rank[px] == rank[py] {
		rank[px]++
	}
	par[py] = px
}

func main() {
	n, m, k := scanInt(), scanInt(), scanInt()
	initTree(n)
	xm := make(map[int]map[int]bool, n)
	for i := 0; i < m; i++ {
		a, b := scanInt(), scanInt()
		union(a, b)
		if _, ok := xm[a]; !ok {
			xm[a] = make(map[int]bool)
		}
		xm[a][b] = true
		if _, ok := xm[b]; !ok {
			xm[b] = make(map[int]bool)
		}
		xm[b][a] = true
	}
	for i := 0; i < k; i++ {
		c, d := scanInt(), scanInt()
		if _, ok := xm[c]; !ok {
			xm[c] = make(map[int]bool)
		}
		xm[c][d] = true
		if _, ok := xm[d]; !ok {
			xm[d] = make(map[int]bool)
		}
		xm[d][c] = true
	}

	cm := make(map[int]int)
	ans := make([]int, n+1)
	for i := 1; i <= n; i++ {
		fi := find(i)
		cm[fi]++
		for j := range xm[i] {
			if fi == find(j) {
				ans[i]--
			}
		}
	}

	var wr = bufio.NewWriter(os.Stdout)
	for i := 1; i <= n; i++ {
		wr.WriteString(strconv.Itoa(cm[find(i)] + ans[i] - 1))
		if i != n {
			wr.WriteString(" ")
		} else {
			wr.WriteString("\n")
		}
	}
	wr.Flush()
}


Measured memory_bytes: 29696
#include <bits/stdc++.h>
#include <stdio.h>
#include <math.h>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
ll mm=1000000000;ll MM=mm+7;
#define rep(i, n) for(int i=0;i<n;i++)

int main(){
  ll n;
  cin >> n;
  ll time=1;
  rep(i,n){
    time*=i+1;
  time%=MM;
  }
  cout << time << endl;

}

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

int main(){
    cout<<fixed<<setprecision(15);
    double A, B, H, M;
    cin>>A>>B>>H>>M;
    //角度を求めよう
    double X;
    X=H*30+((M/60)*30);
    // cout<<X<<endl;
    // cout<<fixed<<setprecision(15)<<X<<endl;
    double Y;
    Y=M*6;
    // cout<<Y<<endl;
    // cout<<fixed<<setprecision(15)<<Y<<endl;
    double Z;
    Z = X-Y;
    if(Z>180){
        Z=360-Z;
    }
    // cout<<Z<<endl;
    // cout<<fixed<<setprecision(15)<<Z<<endl;
    double S;
    S = sqrt((A*A)+(B*B));
//   cos(3.14159/2);
//   cout<<cos(3.14159/2)<<endl;
   double Q;
   Q = sqrt(((A*A)+(B*B))-(2*A*B*cos(M_PI*Z/180)));
   cout<<Q<<endl;
    
}

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

int main() {
  int a, b, c;
  string s1, s2;
  s1 = "Even";
  s2 = "Odd";
  cin >> a >> b;
  c = a * b;
  if( c % 2 == 0 ) {
  	cout << s1 << endl;
  } else {
  	cout << s2 << endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,n,sum=0,i;
	cin>>a>>n;
	int b[n+1];
    for(i=1;i<=n;i++)
    {
    	cin>>b[i];
    	sum+=b[i];
    }
    if(sum>=a)
      cout<<"Yes";
    else
      cout<<"No";
	return 0;
}

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

typedef long long ll;
typedef unsigned long long ull;
typedef double dd;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;

const int mx=1e6+11;
const double PI = acos(-1);
#define MOD 1000000007

#define nl '\n'
#define pb push_back
#define F first
#define S second
#define I insert
#define mp make_pair

#define sz(x) x.size()
#define tt int t; cin>>t; while(t--)
#define be(a) (a).begin(),(a).end()
#define rbe(a) (a).rbegin(),(a).rend()
#define mem(a,b) memset(a,b,sizeof(a))
#define yes cout<<"YES"<<nl
#define no cout<<"NO"<<nl

#define su ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define file freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define frac cout.unsetf(ios::floatfield); cout.precision(10); cout.setf(ios::fixed,ios::floatfield);

template < typename F, typename S >
ostream& operator << ( ostream& os, const pair< F, S > & p )
{
    return os << "(" << p.first << ", " << p.second << ")";
}

template < typename T >
ostream &operator << ( ostream & os, const vector< T > &v )
{
    os << "{";
    for(auto it = v.begin(); it != v.end(); ++it)
    {
        if( it != v.begin() )
            os << ", ";
        os << *it;
    }
    return os << "}";
}

template < typename T >
ostream &operator << ( ostream & os, const set< T > &v )
{
    os << "[";
    for(auto it = v.begin(); it != v.end(); ++it)
    {
        if( it != v.begin() )
            os << ", ";
        os << *it;
    }
    return os << "]";
}

template < typename T >
ostream &operator << ( ostream & os, const multiset< T > &v )
{
    os << "[";
    for(auto it = v.begin(); it != v.end(); ++it)
    {
        if( it != v.begin() )
            os << ", ";
        os << *it;
    }
    return os << "]";
}

template < typename F, typename S >
ostream &operator << ( ostream & os, const map< F, S > &v )
{
    os << "[";
    for(auto it = v.begin(); it != v.end(); ++it)
    {
        if( it != v.begin() )
            os << ", ";
        os << it -> first << " = " << it -> second ;
    }
    return os << "]";
}

#define dbg(args...) do {cerr << #args << " : "; faltu(args); } while(0)

void faltu ()
{
    cerr << endl;
}

template <typename T>
void faltu( T a[], int n )
{
    for(int i = 0; i < n; ++i)
        cerr << a[i] << ' ';
    cerr << endl;
}

template <typename T, typename ... hello>
void faltu( T arg, const hello &... rest)
{
    cerr << arg << ' ';
    faltu(rest...);
}

void f()
{

    int c,t,N,T,mn=INT_MAX;
    cin>>N>>T;
    pii p[N];
    for(int i=0; i<N; i++)
    {
        cin>>c>>t;
        p[i].F=t;
        p[i].S=c;
    }
    sort(p,p+N);
    for(int i=0; i<N; i++)
    {
        if(p[i].F<=T)
        {
            mn=min(mn,p[i].S);
        }
    }
    if(mn==INT_MAX)
        cout<<"TLE\n";
    else
        cout<<mn<<nl;
}

int main()
{
    su;
    f();
    return 0;
}


Measured memory_bytes: 3664
#include<stdio.h>

int main()
{
	int n,a[500000],i;
	long long ans,mid,sum=0;
	
	scanf("%d",&n);
	for(i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
		sum+=a[i];
	}
	
	mid=ans=2*a[1]-sum;
	if(ans<0)	ans=0-ans;
	for(i=2;i<n;i++)
	{
		mid+=2*a[i];
		if(mid>=0)
		{
			if(mid<ans)	ans=mid;
		}
		else
		{
			if(ans>0-mid)	ans=0-mid;
		}
	}
	
	printf("%lld",ans);
	
	return 0;
}

Measured memory_bytes: 896
#include "bits/stdc++.h"
using namespace std;
using ll=long long;
#define rep(i,a,n) for(int i=a;i<n;i++)
#define ALL(s) s.begin(),s.end()
#define P pair<ll,ll>
#define vi vector<int>
#define vl vector<ll>
#define vvi vector<vector<int>>
#define vvl vector<vector<ll>>
#define print(n) cout<<n<<endl
const int M=100111;
const int mod=1000000007;
const int inf=1000000007;
const long long INF=1000000000000000007;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};
const int ddx[8]={1,-1,0,0,1,-1,-1,1},ddy[8]={0,0,1,-1,1,-1,1,-1};

struct edge{
	int from;
	int to;
	int cost;
};

int main(){
	ll d[2501];
	int n,m,a,b,c,p;
	cin>>n>>m>>p;
	fill(d,d+n+1,-INF);
	d[1]=0;
	vector<edge> edges;
	rep(i,0,m){
		cin>>a>>b>>c;
		edge e;
		e.from=a;
		e.to=b;
		e.cost=c-p;
		edges.push_back(e);
	}
	rep(i,0,2*n){
		rep(j,0,m){
			edge e=edges[j];
			if(d[e.from]==-INF)continue;
			if(d[e.to]<d[e.from]+e.cost){
				if(i<n)d[e.to]=d[e.from]+e.cost;
				else d[e.to]=INF;
			}
		}
	}
	if(d[n]>=INF)print(-1);
	else print(max(0ll,d[n]));

}

Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <map>
#include <functional>

using namespace std;

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

    int cnt=0;
    for (int i = 1; i <= N; i++)
    {
        if((to_string(i).length()%2)==1) cnt++;
        /* code */
    }

    cout << cnt << endl;

    return 0;
}

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


int main()
{
    ll n;
    cin >> n;
    vector<ll> a(n + 1);
    for(ll i = 1; i <= n; i++) cin >> a[i];
    vector<ll> ans(n + 1);
    for(ll i = 1; i <= n; i++){
        ans[a[i]] = i;
    }
    for(ll i = 1; i <= n; i++){
        if(i == 1) cout << ans[i];
        else cout << " " << ans[i];
    }
    cout << endl;
}

Measured memory_bytes: 2432
#include <bits/stdc++.h>
const long long INF = LLONG_MAX / 2;
const long long MOD = 1000000007;
const long double PI = 3.1415926;
#define FOR(i, r, n) for(int i=(ll)(r); i<(ll)(n); i++) 
#define REP(i, n) FOR(i, (0), n)
#define ll long long int
using namespace std;
ll ans = 0, sum = 0, n, k, counter = 0, w, h;
string s;
vector<ll> v;
vector<pair<ll, ll>> vp;
vector<vector<ll>> vv(50, vector<ll>(50, INF));

ll parent(ll num) {
  if (v[num] == num) return num;
  else {
    ll res = parent(v[num]);
    v[num] = res;
    return res;
  }
}

ll same(ll v01, ll v02) {
  if (parent(v01) == parent(v02)) return 1;
  else return 0;
}

void unionn(ll v01, ll v02) {
  v[parent(v02)] = parent(v01);
}

int main() {
  cin >> n >> k;
  v.resize(n);
  REP(i, n) v[i] = i;
  vector<tuple<ll, ll, ll>> vt;
  REP(i, k) {
    ll a, b, c;
    cin >> a >> b >> c;
    vt.emplace_back(c, a, b);
  }
  sort(vt.begin(), vt.end());
  REP(i, k) {
    ll a, b, c;
    tie(c,a,b) = vt[i];
    if (!same(a, b)) {
      ans += c;
      unionn(a, b);
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 6016
import sys
import math
import itertools


# \n
def input():
    return sys.stdin.readline().rstrip()


def main():
    N = int(input())

    A = int(math.log10(N))
    flag=0
    count =0
    for a in range(3,A+2):

        for i in itertools.product([3,5,7],repeat=a):
            digit=0
            if 3 in i and  5 in i and 7 in i:


                for s in range(a):
                    digit+=10**(a-s-1)*i[s]
                if digit <=N:
                    count+=1
                else:
                    break
    print(count)


if __name__ == "__main__":
    main()


Measured memory_bytes: 70436
package main

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

const INFINITY = math.MaxInt64/2 - 1

func exec(stdin *Stdin, stdout *Stdout) {
	s := stdin.Read()
	if s[2] == s[3] && s[4] == s[5] {
		stdout.Println("Yes")
	} else {
		stdout.Println("No")
	}
}

func main() {
	stdout := NewStdout()
	defer stdout.Flush()
	exec(NewStdin(bufio.ScanWords), stdout)
}

type Stdin struct {
	stdin *bufio.Scanner
}

func NewStdin(split bufio.SplitFunc) *Stdin {
	s := Stdin{bufio.NewScanner(os.Stdin)}
	s.stdin.Split(split)
	s.stdin.Buffer(make([]byte, bufio.MaxScanTokenSize), INFINITY)
	return &s
}

func (s *Stdin) Read() string {
	s.stdin.Scan()
	return s.stdin.Text()
}

func (s *Stdin) ReadInt() int {
	n, _ := strconv.Atoi(s.Read())
	return n
}

func (s *Stdin) ReadFloat64() float64 {
	n, _ := strconv.ParseFloat(s.Read(), 64)
	return n
}

type Stdout struct {
	stdout *bufio.Writer
}

func NewStdout() *Stdout {
	return &Stdout{bufio.NewWriter(os.Stdout)}
}

func (s *Stdout) Flush() {
	s.stdout.Flush()
}

func (s *Stdout) Println(a ...interface{}) {
	fmt.Fprintln(s.stdout, a...)
}

func Min(a int, b ...int) int {
	for _, v := range b {
		if v < a {
			a = v
		}
	}
	return a
}

func Max(a int, b ...int) int {
	for _, v := range b {
		if a < v {
			a = v
		}
	}
	return a
}

func Abs(x int) int {
	if x > 0 {
		return x
	} else {
		return x * -1
	}
}

func Pow(x, y int) int {
	z := 1
	for y > 0 {
		if y%2 == 0 {
			x *= x
			y /= 2
		} else {
			z *= x
			y -= 1
		}
	}
	return z
}


Measured memory_bytes: 640
import java.util.*;

public class Main{
    public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
	String S = sc.next();
    String T = sc.next();
      boolean flag = false;
	if(T.startsWith(S)){
      if(T.length() == (S.length() + 1))
        flag = true;
    }
  if(flag)
    System.out.println("Yes");
  else
    System.out.println("No");
    }
      
      
}

Measured memory_bytes: 35476
X,Y = map(int, input().split())

if Y%2 == 1:
    print("No")
else:
    Tsuru = 2*X -Y/2
    Kame  = -X + Y/2
    if Tsuru < 0 or Kame < 0:
        print("No")
    else:
        print("Yes")

Measured memory_bytes: 9172
//Heaplax
//别让自己后悔
#include<bits/stdc++.h>
#define N 100001
#define LL long long
#define LOG(x) cerr<<#x<<" = "<<x<<endl
#define add_edge(u,v) nxt[++cnt]=head[u],head[u]=cnt,to[cnt]=v
#define open(x) freopen(#x".in","r",stdin),freopen(#x".out","w",stdout)
char ch;bool fs;void re(int& x)
{
	while(ch=getchar(),ch<33);
	if(ch=='-')fs=1,x=0;else fs=0,x=ch-48;
	while(ch=getchar(),ch>33)x=x*10+ch-48;
	if(fs)x=-x;
}
using namespace std;
int n,c,k,ans,t[N];
int main()
{
	re(n),re(c),re(k);
	for(int i=1;i<=n;++i)re(t[i]);
	sort(t+1,t+n+1);
	int last=0,tim=0;
	for(int i=1;i<=n;++i)
	{
		if(!last || t[i]>tim)
		{
			++ans;
			last=c;
			tim=t[i]+k;
		}
		--last;
	}
	printf("%d\n",ans);
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
 
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define repl(i,s,n) for(int i=s; i<=n; ++i)
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
#if defined(_MSC_VER) || __cplusplus > 199711L
#define aut(r,v) auto r = (v)
#else
#define aut(r,v) __typeof(v) r = (v)
#endif
#define each(it,o) for(aut(it, (o).begin()); it != (o).end(); ++ it)
#define ktya(x) sort(all(x))
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define all(o) (o).begin(), (o).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset(m,v,sizeof(m))
#define INF 1e18
#define INFLL 1000000000000000007LL
#define SIZE 200105
#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define mind(a,b) (a>b?b:a)
#define maxd(a,b) (a>b?a:b)
#define PI (acos(-1))
typedef vector<int> vi; typedef pair<int, int> pii; typedef vector<pair<int, int> > vpii; typedef long long ll;
typedef pair<int,ll> pill; typedef pair<ll,int> plli; 
typedef pair<double, int> pdi;
template<typename T, typename U> inline void amin(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> inline void amax(T &x, U y) { if(x < y) x = y; }
typedef complex<double> P;
typedef pair<pill,int> PA;
ll MOD;
//ll MOD = 1000000007;
// ll MOD=998244353;
typedef ll Weight;
struct Edge {
	int src, dst;
	ll weight;
};
ll N,A,B;
int main(){
	cin>>N>>A>>B;
	if((A-B)%2==0)cout<<(B-A)/2<<endl;
	else{
		cout<<min((B+A-1)/2,(2*N-B-A+1)/2)<<endl;
	}

}

Measured memory_bytes: 256
n,k=map(int,input().split())
lists=list(map(int,input().split()))
ans=0
nums=min(n,k)
for j in range(1,nums+1):
    #スライドするときの数 j=0,1,2,3,4......numsまでとることができる
    #n<kの時max n　かつかくjに対して取り除けるのはk-j回めまでである
    #n>=kの時max k かつ　かくｊに対して取り除けるのはk-j回までである
    for m in range(j+1):
        sublist=lists[:m]+lists[n+m-j:]
        sublist=sorted(sublist)
        sublist.append(0)
        del_some=0
        while del_some<k-j and min(sublist)<0:
            del sublist[0]
            del_some+=1
        p=sum(sublist)
        ans=max(ans,p)
print(ans)

Measured memory_bytes: 3064
package main

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

var sc = bufio.NewScanner(os.Stdin)

func next() int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i

}

type node struct {
	item   int
	prev   *node
	rank   int
	weight int
}

func (n *node) root() *node {
	if n.prev == nil {
		return n
	}
	r := n.prev.root()
	n.weight += n.prev.weight
	n.prev = r
	return r
}

func diff(nodeX, nodeY *node) int {
	return nodeY.Weight() - nodeX.Weight()
}

func issame(nodeX, nodeY *node) bool {
	return nodeX.root() == nodeY.root()

}

func (n *node) Weight() int {
	n.root()
	return n.weight
}

func merge(nodeX, nodeY *node, w int) {
	w += nodeX.Weight()
	w -= nodeY.Weight()

	nodeX = nodeX.root()
	nodeY = nodeY.root()
	if nodeX.item == nodeY.item {
		return
	}

	if nodeX.rank < nodeY.rank {
		nodeX, nodeY = nodeY, nodeX
		w *= -1
	}

	if nodeX.rank == nodeY.rank {
		nodeX.rank += 1
	}

	if nodeX.prev != nil || nodeY.prev != nil {
		panic(fmt.Sprintf("%v, %v", nodeX, nodeY))
	}

	nodeY.prev = nodeX
	nodeY.weight = w

}

func main() {
	sc.Split(bufio.ScanWords)
	var n, q int
	fmt.Scanf("%d %d", &n, &q)

	groups := make([]*node, n)
	for i := 0; i < n; i++ {
		groups[i] = &node{item: i, prev: nil, rank: 0}
	}

	for i := 0; i < q; i++ {
		com, x, y := next(), next(), next()
		if com == 0 {
			z := next()
			merge(groups[x], groups[y], z)

		} else {
			if issame(groups[x], groups[y]) {
				fmt.Println(diff(groups[x], groups[y]))
			} else {
				fmt.Println("?")
			}
		}
	}

}




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

int main() {
  string num;
  long long k;
  string kekka = "";
  cin >> num >> k;
  
  for(long long i = 0; i < min(k,(long long)num.size()); i++){
    if(num.at(i) == '1'){
      continue;
    }else{
      kekka = num.at(i);
      break;
    }
  }
  
  if(kekka == "") kekka = '1';
  
  cout << kekka; 
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template <typename T> using ordered_set =  tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;*/
#define itn int
#define all(c) c.begin(),c.end()
#define make_unique(x) sort(all((x))); (x).resize(unique(all((x))) - (x).begin())
#define ll long long
#define pll pair<ll, ll>
#define pii pair<int, int>
#define mp(x, y) make_pair(x, y)
using namespace std;

const ll N = 1e6 + 5, inf = 1e18, mod = 1e9 + 7;
const double PI = 3.1415926536;
int days[13] = {0, 31, 28, 31, 30, 31,30, 31, 31, 30, 31, 30, 31};

template<typename T>
ostream& operator<< (ostream& out, const vector<T>& mas) {
    for (const auto& x : mas) {
        out << x << ' ';
    }
    out << '\n';
    return out;
}

bool is_prime(ll n) {
    for (ll i = 2; i * i <= n; ++i) {
        if (n % i == 0) {
            return false;
        }
    }
    return true;
}

inline ll getPow(ll a, ll b) {
    ll res = 1ll, tp = a;
    while (b){
        if (b&1ll) {
            res *= tp;
        }
        tp *= tp;
     //   tp %= mod; res %= mod;
        b >>= 1ll;
    }
    return res;
}

ll vec_mult(const pll & t1, const pll & t2, const pll & t3) {
    const ll & x1 = t1.first, y1 = t1.second;
    const ll & x2 = t2.first, y2 = t2.second;
    const ll & x3 = t3.first, y3 = t3.second;
    return abs((x2 - x1) * (y3 - y1) - (y2 - y1) * (x3 - x1));
}

void ok() {
    cout << "YES" << '\n';
}

void no() {
    cout << "NO" << '\n';
}

inline ll nxt() {
    ll x;
    cin >> x;
    return x;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);
    ll n = nxt(), k = nxt();
    vector<ll> a(n);
    for (int i = 0; i < n; i++) {
        a[i] = nxt();
    } 
    sort(all(a));
    vector<ll> f(n);
    for (int i = 0; i < n; i++) {
        f[i] = nxt();
    }
    sort(f.rbegin(), f.rend());
    
    auto get = [&](ll md) {
        ll tmpk = k;
        for (int i = 0; i < n; i++) {
            if (a[i] * f[i] > md) {
                ll cur = a[i] * f[i] - md;
                cur = (cur + f[i] - 1) / f[i];
                if (cur > tmpk) {
                    return false;
                }
                tmpk -= cur;
            }
        }
        return true;
    };
    
    ll l = 0, r = 1e18;
    while (r - l > 1) {
        ll md = (l + r) / 2;
        if (get(md)) {
            r = md;
        } else {
            l = md;
        }
    }
    if (get(l)) r = l;
    cout << r;
    return 0;
}


Measured memory_bytes: 3328
package main

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

type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &Scanner{sc}
}

func (s *Scanner) nextStr() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *Scanner) nextInt() int {
	i, e := strconv.Atoi(s.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) nextRuneSlice() []rune {
	return []rune(s.nextStr())
}

func (s *Scanner) nextIntSlice(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextInt()
	}
	return res
}

func max(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m < i {
			m = i
		}
	}
	return m
}

func min(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m > i {
			m = i
		}
	}
	return m
}

func abs(x int) int {
	if x > 0 {
		return x
	}
	return -x
}

func pow(x, y int) int {
	res := 1
	for i := 0; i < y; i++ {
		res *= x
	}
	return res
}

func main() {
	sc := NewScanner()
	N := sc.nextInt()
	A := sc.nextIntSlice(N)
	B := sc.nextIntSlice(N)
	C := sc.nextIntSlice(N)
	sort.Ints(A)
	sort.Ints(B)
	sort.Ints(C)
	bToC := make([]int, N)
	for i := 0; i < N; i++ {
		lowerC := sort.Search(N, func(index int) bool {
			return C[index] > B[i]
		})
		bToC[i] = N - lowerC
	}
	cumulativeSum := make([]int, N+1)
	cumulativeSum[0] = 0
	for i := 0; i < N; i++ {
		cumulativeSum[i+1] = cumulativeSum[i] + bToC[i]
	}
	count := 0
	for i := 0; i < N; i++ {
		lowerB := sort.Search(N, func(index int) bool {
			return B[index] > A[i]
		})
		count += cumulativeSum[N] - cumulativeSum[lowerB]
	}
	fmt.Println(count)
}


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

DP = [[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1] for i in range(101)]

DP[2] = [4,3,4,4,4,4,3,4,4,3,4,4,4,4,4,4]

for i in range(3,101):
    DP[i][0] = DP[i-1][0] + DP[i-1][4] + DP[i-1][8] + DP[i-1][12]
    DP[i][1] = DP[i-1][0] + DP[i-1][4] + DP[i-1][12]
    DP[i][2] = DP[i-1][0] + DP[i-1][4] + DP[i-1][8] + DP[i-1][12]
    DP[i][3] = DP[i-1][0] + DP[i-1][4] + DP[i-1][8] + DP[i-1][12]
    DP[i][4] = DP[i - 1][1] + DP[i - 1][5] + DP[i - 1][9] + DP[i - 1][13]
    DP[i][5] = DP[i - 1][1] + DP[i - 1][5] + DP[i - 1][9] + DP[i - 1][13]
    DP[i][6] = DP[i - 1][5] + DP[i - 1][9] + DP[i - 1][13]
    DP[i][7] = DP[i - 1][1] + DP[i - 1][5] + DP[i - 1][9] + DP[i - 1][13]
    DP[i][8] = DP[i - 1][2] + DP[i - 1][6] + DP[i - 1][10] + DP[i - 1][14]
    DP[i][9] = DP[i - 1][6] + DP[i - 1][10] + DP[i - 1][14] - DP[i - 2][3] - DP[i - 2][2]
    DP[i][10] = DP[i - 1][2] + DP[i - 1][6] + DP[i - 1][10] + DP[i - 1][14]
    DP[i][11] = DP[i - 1][2] + DP[i - 1][6] + DP[i - 1][10] + DP[i - 1][14]
    DP[i][12] = DP[i - 1][3] + DP[i - 1][7] + DP[i - 1][11] + DP[i - 1][15]
    DP[i][13] = DP[i - 1][3] + DP[i - 1][7] + DP[i - 1][11] + DP[i - 1][15] - DP[i-2][2]
    DP[i][14] = DP[i - 1][3] + DP[i - 1][7] + DP[i - 1][11] + DP[i - 1][15]
    DP[i][15] = DP[i - 1][3] + DP[i - 1][7] + DP[i - 1][11] + DP[i - 1][15]

print(sum(DP[N-1]) % 1000000007)

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

int main() {
	int a,b,c,d; cin>>a>>b>>c>>d;
	int x=c-a, y=d-b;
	cout << c-y << " " << d+x << " " << a-y << " " << b+x << endl;
	return 0;
}


Measured memory_bytes: 256
n,q=gets.split.map(&:to_i)
ps=[]
n.times{ps.push(gets.split)}
cnt=0
while p=ps.shift do
  if p[1].to_i<=q
    cnt+=p[1].to_i
    puts "#{p[0]} #{cnt}"
  else
    p[1]=p[1].to_i-q
    cnt+=q
    ps.push(p)
  end
end



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

int main() {
  int H, W, K;
  cin >> H >> W >> K;
  vector<vector<char>> C(H, vector<char>(W));
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      cin >> C.at(i).at(j);
    }
  }
  int ans = 0;
  for (int bit1 = 0; bit1 < 1 << H; bit1++) {
    for (int bit2 = 0; bit2 < 1 << W; bit2++) {
      int cnt = 0;
      for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
          if (bit1 >> i & 1 || bit2 >> j & 1) continue;
          if (C.at(i).at(j) == '#') cnt++;
        }
      }
      if (cnt == K) ans++;
    }
  }
  cout << ans << "\n";
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
 
using namespace std;
 
int main()
{
  int a, b, somma=0;
  char s[3];
 
  for(int c=0; c<3; c++)
    cin>>s[c];
 
  if(s[0] == s[1] && s[1]==s[2])
    cout<<"No";
  else
    cout<<"Yes";
}

Measured memory_bytes: 256
n = int(input())
d_a = input().split()

d = []
for i in range(n):
    d.append(int(d_a[i]))

ds = sorted(d)

mid = int(n/2) -1

if ds[mid] == ds[mid+1]:
    print(0)
    

else:
    num = ds[mid+1] -ds[mid]
    print(num)



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

const int mxN=1e3+1, M=1e9+7;
int h, w, dp[mxN][mxN];
bool ok[mxN][mxN];

int main() {
    cin.tie(0)->sync_with_stdio(0);
    cin >> h >> w;
    for (int i=1; i<=h; ++i)
        for (int j=1; j<=w; ++j) {
            char c; cin >> c;
            ok[i][j]=(c=='.');
        }
    if (ok[1][1])
        dp[1][1]=1;
    for (int i=1; i<=h; ++i)
        for (int j=1; j<=w; ++j)
            if (ok[i][j] && !(i==1 && j==1))
                dp[i][j]=(dp[i-1][j]+dp[i][j-1])%M;
    cout << dp[h][w] << '\n';
}


Measured memory_bytes: 8428
ops={"+": lambda a, b: b + a,
        "-": lambda a, b: b - a,
        "*": lambda a, b: b * a,
        "/": lambda a, b: flaot(b)/a}
stack = []
for s in input().split():
    if s in ops:
        stack.append(ops[s](stack.pop(),stack.pop()))
    else:
        stack.append(int(s))
print(stack[-1])

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

int main() {
  int N;
  cin >> N;
  
  for (int i=0; i<N; i++) {
    string S;
    cin >> S ;
    if (S == "Y") {
      cout << "Four" << endl;
      break;
    }
    else if (!(S == "Y")) {
      if ( i < N-1) {
        continue;
      }
      else if (i = N-1) {
        cout << "Three" << endl;
      }
    }
  }
}
    

Measured memory_bytes: 256
import java.util.*;

public class Main {


    public static void main(String args[]) {
        Scanner scan = new Scanner(System.in);

        int n = scan.nextInt();

        String s = "";

        for (int i=0; i<n; i++) {
            s = s.concat("ACL");
        }
        System.out.println(s);

    }
}

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

const int MAXN = 510;
struct node {
	int typ, vl, vr;
	friend bool operator < (node a, node b) {
		return a.vl == b.vl ? a.vr < b.vr : a.vl < b.vl;
	}
} qs[MAXN];

int n, mod, bak;
typedef long long LL;
void reduce(int & x) { x += x >> 31 & mod; }
int mul(int a, int b) { return (LL) a * b % mod; }
int reduv(int a) { return a < 0 ? 0 : a; }
const double eps = 1e-8;
int dp[MAXN][260];
int main() {
	std::ios_base::sync_with_stdio(false);
	std::cin.tie(0); std::cout.tie(0);
	std::cin >> n >> mod;
	for (int i = 0; i < n * 2; ++i) {
		int l = i < n ? ceil(sqrt(n * n - i * i) - eps) : -1;
		int r = floor(sqrt(n * n * 4 - i * i) + eps);
		r = std::min(r, n * 2 - 1);
		if (i < n) qs[bak++] = (node) {1, l - 1, r};
		else qs[bak++] = (node) {0, r, 0};
	}
	std::sort(qs, qs + bak);
	int ans = 0;
	for (int fin = 0; fin <= n; ++fin) {
		memset(dp, 0, sizeof dp);
		dp[0][0] = 1; int now = 0;
		for (int i = 0; i < n * 2; ++i) {
			for (int j = std::min(fin, i); ~j; --j)
				if (int t = dp[i][j]) {
					int used = now + j;
					reduce(dp[i + 1][j + qs[i].typ] += mul(t, reduv(qs[i].vl - used + 1)) - mod);
					if (qs[i].typ == 1) {
						int u2 = n + fin + i - now - j;
						reduce(dp[i + 1][j] += mul(t, reduv(qs[i].vr - u2 + 1)) - mod);
					}
				}
			now += qs[i].typ ^ 1;
		}
		reduce(ans += mul(dp[n * 2][fin], fin & 1 ? mod - 1 : 1) - mod); 
	}
	std::cout << ans << std::endl;
	return 0;
}


Measured memory_bytes: 768
# -*- coding: utf-8 -*-


def show(A):
    for k in range(N):
        if k == N - 1:
            print('{0}'.format(A[k]))
        else:
            print('{0}'.format(A[k]), end=' ')


N = int(input())
A = list(map(int, input().split()))
show(A)

for i in range(1, N):
    v = A[i]
    j = i - 1
    while (j >= 0) and (A[j] > v):
        A[j + 1], A[j] = A[j], v
        j -= 1

    show(A)



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

int main() {
    int n,k,d,x;
    cin >> n >> k;
    set<int>S;
    for (int i=0;i<k;i++) {
        cin >> d;
        for (int j=0;j<d;j++) {
            cin >> x;
            S.insert(x);
        }
    }
    cout << n-S.size();
}


Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll inf = 1e18;
#define rep(i, a, b) for (int i = a; i < b; i++)
#define per(i, a, b) for (int i = b - 1; i >= a; i--)
#define int ll
using pint = pair<int, int>;
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

signed main() {
    string s;
    cin >> s;
    int n = s.size();
    int cnt0 = 0, cnt1 = 0;
    rep(i, 0, n) {
        if (s[i] == '0') {
            cnt0++;
        } else {
            cnt1++;
        }
    }
    int ans = 2 * min(cnt0, cnt1);
    cout << ans << "\n";
}

Measured memory_bytes: 3732
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <time.h>
#define ll long long
#define double long double
#define itn int
#define endl '\n'
#define co(ans) cout<<ans<<endl;
#define COYE cout<<"YES"<<endl;
#define COYe cout<<"Yes"<<endl;
#define COye cout<<"yes"<<endl;
#define CONO cout<<"NO"<<endl;
#define CONo cout<<"No"<<endl;
#define COno cout<<"no"<<endl;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,1,n)
#define ALL(V) ((V).begin(),(V).end())
#define SORT(V) sort((V).begin(),(V).end())
#define REVERSE(V) reverse((V).begin(),(V).end())
#define INF ((1LaL<<62)-(1LL<<31))
#define EPS 1e-10
#define PI 3.141592653589793238
#define MOD 1000000007
#define MAX 5100000
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;}
using namespace std;

int main(){
  int N,M,Q,ans=0,cnt=0;
  cin>>N>>M>>Q;
  int A[Q],B[Q],C[Q],D[Q];
  REP(i,Q) cin>>A[i]>>B[i]>>C[i]>>D[i];
  
  FFOR(i1,1,M){
    FFOR(i2,i1,M){
      FFOR(i3,i2,M){
        FFOR(i4,i3,M){
          FFOR(i5,i4,M){
            FFOR(i6,i5,M){
              FFOR(i7,i6,M){
                FFOR(i8,i7,M){
                  FFOR(i9,i8,M){
                    FFOR(i10,i9,M){
                      cnt=0;
                      ll L[11]={0,i1,i2,i3,i4,i5,i6,i7,i8,i9,i10};
                      
                      REP(i,Q){
                        if(L[B[i]]-L[A[i]]==C[i]) cnt+=D[i];
                      }
                      
                      chmax(ans,cnt);
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
  
  co(ans);
  return 0;
}

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

#define ll long long


int main()
{
	double W, H, x, y;
	cin >> W >> H >> x >> y;
	printf("%.9f %d\n", W * H / 2.0, W * H / (x * y) == 4.0);
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
long long ans,t;
int n;
long long gcd(long long x,long long y){
	return !y?x:gcd(y,x%y);
}
int main(){
	scanf("%d",&n);
	ans=1;
	while (n--){
		cin>>t;
		ans=ans/gcd(ans,t)*t;
	}
	cout<<ans;
}

Measured memory_bytes: 256
a=[1, 6, 36, 216, 1296, 7776, 46656]
b=[1,9, 81, 729, 6561, 59049, 531441]
n=gets.to_i
c=0
t=[n]
loop{
break if t.include?(0)
for k in 0...t.size
e=t[k]
for i in 0..6
  if a[i]<=e
    t<<e-a[i]
  end
  if b[i]<=e
    t<<e-b[i]
  end
  break if n<a[i]
end
end
t.uniq!
c+=1
}
p c


Measured memory_bytes: 20216
//=====================COMPILER OPTIMIZATION STARTS=======================
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
//======================COMPILER OPTIMIZATION ENDS=======================

//compile using : g++ -D DEB file.cpp
#ifdef DEB
    //to check from out of bounds errors
    #define _GLIBCXX_DEBUG
#endif
//=============================DEBUG PART ENDS===========================

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

#define ll long long int
#define pi pair<ll,ll>

string s, target="357";   ll ans = 0;

void recur(string cur) {
    if (cur.size() > s.size())
        return;
    else if (cur.size() && stol(cur) > stol(s))
        return;

    // check if all char of 'target' is in 'cur'
    //      if yes, ans += 1
    //      else append chars
    bool possible = true;
    for (auto ch:target) {
        if (cur.find(ch) == string::npos)
            possible = false;
        recur(cur+ch);
    }

    ans += possible;
}

void solve(){
    cin >> s;

    recur("");
    cout << ans << '\n';
}

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

    int test = 1;
    // cin >> test;
    while(test--)
        solve();
    return 0;
}

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

public class MainClass
{
	public const long Giri = 1000000007;

	
	public static void Main(string[] args)
	{
		int[] p = Input().ToInt();
		int[] a = Input().ToInt();
		int n = p[0];
		int k = p[1];
		
		Dictionary<int, int> dic = new Dictionary<int, int>();
		
		for(int i = 0; i < n; i++)
		{
			if(!dic.ContainsKey(a[i]))
			{
				dic.Add(a[i], 0);
			}
			
			dic[a[i]]++;
		}
		var di = dic.OrderBy(x => x.Value);
		
		int j = 0;
		int r = 0;
		foreach(var v in di)
		{
			//Console.WriteLine(v.Value);
			if(j < dic.Count - k)
			{
				r += v.Value;
			}
			j++;
		}
		Console.WriteLine(r);
	}
	
	public static long GCD(long a, long b)
	{
		if(b == 1)
			return a;
		long p = b / a;
		return GCD(a, b - a*p);
	}
	
	public static string[] Input() { return Console.ReadLine().Split(' '); }
	public static int Clamp(int val, int max, int min = 0) { return Math.Min(max, Math.Max(min, val)); }
}

public static class Smarter
{
	public static int ToInt(this string str) { return int.Parse(str); }
	public static long ToLong(this string str) { return long.Parse(str); }
	public static int[] ToInt(this string[] str)
	{
		int[] r = new int[str.Length];
		for(int i = 0; i < str.Length; i++)
			r[i]=str[i].ToInt();
		return r;
	 }
	
}

Measured memory_bytes: 32556
use std::ops::{Index, IndexMut};
use std::cmp::{Ordering};
use std::collections::BinaryHeap;
use std::cmp::{min, max};
// use std::clone::Clone;

fn getline() -> String{
    let mut res = String::new();
    std::io::stdin().read_line(&mut res).ok();
    res
}

macro_rules! split {
    ($x: expr) => {
        ($x).trim().split(' ').collect()
    }
}

macro_rules! parse {
    ($x: expr) => {
        ($x).parse().unwrap()
    }
}

macro_rules! debug {
    ($x: expr) => {
        println!("{}: {}", stringify!($x), $x)
    }
}

fn printvec<T>(v: &Vec<T>) where T: std::fmt::Display {
    for (i,e) in v.into_iter().enumerate() {
        if i != 0 {
            print!(" ");
        }
        print!("{}", e);
    }
    println!();
}

fn main() {
    
    let s = getline();
    let iv: Vec<_> = split!(s);
    let n: i64 = parse!(iv[0]);
    let s = getline();
    let iv: Vec<_> = split!(s);
    let a: Vec<i64> = iv.into_iter().map(|x| parse!(x)).collect();
    
    let mut l: i64 = 0;
    let mut r: i64 = 1e16 as i64;
    
    let len = 2*n;
    let check = |x: i64| {
        let mut res = false;
        for i in 0..len {
            let m = x+i;
            let sum: i64 = a.clone().into_iter().map(|x| max((x-(n-1-m)+n)/(n+1),0)).sum();
            res = res || sum <= m; 
        }
        res
    };
    
    while r-l > 1 {
        let m = (l+r)/2;
        if !check(m*len) {
            l = m;
        } else {
            r = m;
        }
    }

    if check(0) {
        r = 0;
    }

    let mut ans = -100;
    for i in 0..len {
        let m = r*len+i;
        let sum: i64 = a.clone().into_iter().map(|x| max((x-(n-1-m)+n)/(n+1),0)).sum();
        if sum <= m {
            ans = m;
            break;
        }
    }
    println!("{}",ans);

}



Measured memory_bytes: 4476
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define rep1(i,n) for(int i=1;i<=(int)n;i++)
#define sp(n) cout << fixed << setprecision(n)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
typedef long long ll;
using namespace std;
int main(void){
    int w,h,n;cin>>w>>h>>n;
    vector<vector<int>> t(h,vector<int>(w,0));
    rep(i,n){
        int x,y,a;cin>>x>>y>>a;x--;y--;
        switch(a){
            case 1:
                rep(j,h)rep(k,x+1)t[j][k]++;
                break;
            case 2:
                rep(j,h)for(int k=x+1;k<w;k++)t[j][k]++;
                break;
            case 3:
                rep(j,y+1)rep(k,w)t[j][k]++;
                break;
            case 4:
                for(int j=y+1;j<h;j++)rep(k,w)t[j][k]++;
                break;
        }
    }
    int res=0;
    rep(i,h)rep(j,w)if(t[i][j]==0)res++;
    cout<<res<<endl;
}


Measured memory_bytes: 3664
#include<stdio.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<string.h>

#ifdef LOCAL
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define NDEBUG
#define eprintf(...) do {} while (0)
#endif
#include<cassert>

using namespace std;

typedef long long LL;
typedef vector<int> VI;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define EACH(i,c) for(__typeof((c).begin()) i=(c).begin(),i##_end=(c).end();i!=i##_end;++i)

template<class T> inline void amin(T &x, const T &y) { if (y<x) x=y; }
template<class T> inline void amax(T &x, const T &y) { if (x<y) x=y; }
template<class Iter> void rprintf(const char *fmt, Iter begin, Iter end) {
    for (bool sp=0; begin!=end; ++begin) { if (sp) putchar(' '); else sp = true; printf(fmt, *begin); }
    putchar('\n');
}

int N;
LL X[55], Y[55];

void MAIN() {
    scanf("%d", &N);
    REP (i, N) scanf("%lld%lld", X+i, Y+i);

    int ans = N;
    REP (s, N) REP (t, N) {
	int tmp = 0;
	REP (i, N) {
	    bool ok = false;
	    REP (j, N) if (i != j && X[i]-X[j] == X[s]-X[t] && Y[i]-Y[j] == Y[s]-Y[t]) {
		ok = true;
		break;
	    }
	    if (!ok) tmp++;
	}
	amin(ans, tmp);
    }
    printf("%d\n", ans);

}

int main() {
    int TC = 1;
//    scanf("%d", &TC);
    REP (tc, TC) MAIN();
    return 0;
}



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

using ll = long long;

// loop
#define REP(i, a, b) for(ll(i) = (a); (i) < (b); (i)++)
#define RREP(i, a, b) for(ll(i) = (a); (i) >= (b); (i)--)
#define rep(i, n) REP(i, 0, n)
#define rrep(i, n) RREP(i, n, 0)

// YesNo
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
int main(void) {
	string s;
	cin >> s;
	int ans  = 0;
	int temp = 0;
	rep(i, 3) {
		if(s[i] == 'R') {
			temp++;
		} else {
			temp = 0;
		}
		ans = max(ans, temp);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
#define int long long int
#define IOS ios_base::sync_with_stdio(false), cin.tie(NULL);
#define fr(i,a,b)  for(int i=a;i<=b;i++)
#define rf(j,b,a)  for(int j=b;j>=a;j--)
#define frr(k,a,b) for(int k=a;k<=b;k++)
#define mp make_pair
#define pb push_back
#define MOD 1000000007
#define ss second
#define ff first
 
using namespace std;
typedef pair<int,int> pii;
typedef pair<pii,int> ppii;
#define E 2000 
bool sortinrev(const pair<int,int> &a,  
               const pair<int,int> &b) 
{ 
     if(a.first==b.first)
     {
     return (a.second < b.second); 
     }
     else
     {
       return (a.first > b.first); 
     }
     
} 
bool sortin(const pair<int,int> &a,  
               const pair<int,int> &b) 
{ 
     return (a.second < b.second);   
} 
signed main()
{   
  IOS
 /* #ifndef ONLINE_JUDGE
        freopen("in.txt", "r", stdin);
        freopen("out.txt", "w", stdout);
    #endif*/
 
string s,t;
cin>>s;
cin>>t;
int s1 = s.size();
int t1 = t.size();
int dp[s1+1][t1+1];
for(int i=0;i<=s1;i++)
{
  for(int j=0;j<=t1;j++)
{
if(i==0||j==0)
{
  dp[i][j]=0;
  continue;
}
if(s[i-1]==t[j-1])
{
  dp[i][j]= 1 + dp[i-1][j-1];
}
else
{   
  dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
}
}
}
int len = dp[s1][t1];
int val =0;
int tmp1=s1;
int tmp2=t1;
string ans;
while(val!=len&&tmp2>=1&&tmp1>=1)
{
if(s[tmp1-1]==t[tmp2-1])
{
ans = s[tmp1-1] + ans;
tmp2--;
tmp1--;
val++;
}
else if(dp[tmp1][tmp2]==dp[tmp1-1][tmp2])
{
tmp1--;
}
else
{
  tmp2--;
}
}
cout<<ans<<endl;
}

Measured memory_bytes: 74084
import java.util.Scanner;

public class Main {

    void solve() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] H = new int[N];
        for (int i = 0; i < N; i++) {
            H[i] = sc.nextInt();
        }
        int max = 0;
        for (int i = 0; i < N; i++) {
            if (max >= ((N - 1) - i)) {
                break;
            }
            int moveCount = 0;
            for (int j = i; j <= N - 2; j++) {
                if (H[j] >= H[j + 1]) {
                    moveCount++;
                }
                else {
                    break;
                }
            }
            max = Math.max(max, moveCount);
        }
        System.out.print(max);
    }

    // Main
    public static void main(String[] args) {
        new Main().solve();
    }
}

Measured memory_bytes: 51148
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Scanner;

public class Main {
	long mo = 1_000_000_000 + 7;

	void run() {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		long n = s.length();
		int k = sc.nextInt();
		ArrayList<String> list = new ArrayList<>();
		for (int i = 0; i < n; ++i) {
			for (int d = 1; i + d <= n && d <= 5; ++d) {
				list.add(s.substring(i, i + d));
			}
		}
		Collections.sort(list, null);
		int p = 0;
		for (int i = 0; i < list.size(); ++i) {
			if (i + 1 < list.size() && list.get(i).equals(list.get(i + 1)))
				continue;
			++p;
			if (p == k) {
				System.out.println(list.get(i));
				return;
			}
		}
		throw new AssertionError();
	}

	public static void main(String[] args) {
		new Main().run();
	}

	void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}

}


Measured memory_bytes: 25124
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>

using namespace std;

const int INF = 1e9;
const vector<int> dx = {1, 0, -1,  0};
const vector<int> dy = {0, 1,  0, -1};

int h, w, n, sx, sy;
vector<string> board;

int walk(char goal) {
	vector<vector<int>> stat(h, vector<int>(w, INF));
	stat[sy][sx] = 0;

	queue<pair<int, int>> que;
	que.push(make_pair(sx, sy));

	while (!que.empty()) {
		auto p = que.front();
		que.pop();

		int x = p.first;
		int y = p.second;

		for (int i = 0; i < 4; i++) {
			int nx = x + dx[i];
			int ny = y + dy[i];
			if (nx < 0 || w <= nx || ny < 0 || h <= ny) {
				continue;
			} else if (stat[ny][nx] != INF || board[ny][nx] == 'X') {
				continue;
			}

			stat[ny][nx] = stat[y][x] + 1;
			if (board[ny][nx] == goal) {
				sx = nx;
				sy = ny;
				return stat[ny][nx];
			}
			que.push(make_pair(nx, ny));
		}
	}
	return -1;
}


int main() {
	cin >> h >> w >> n;
	board.assign(h, "");
	for (int i = 0; i < h; i++) {
		cin >> board[i];
	}

	sx = sy = -1;

	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			if (board[i][j] == 'S') {
				sx = j;
				sy = i;
				break;
			}
		}
		if (sx != -1) {
			break;
		}
	}

	int steps = 0;
	for (int i = 1; i <= n; i++) {
		steps += walk(i + '0');
		// cout << "step to " << i << ": " << steps << endl;
	}
	cout << steps << endl;
	return 0;
}

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

int main() {
  int n, a, b;
  string s;
  cin >> n >> a >> b >> s;

  int k = 0, l = 0;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == 'a' && k + l < a + b) {
      cout << "Yes" << endl;
      k++;
    } else if (s[i] == 'a' && k + l >= a + b)
      cout << "No" << endl;
    else if (s[i] == 'b' && k + l < a + b && l < b) {
      cout << "Yes" << endl;
      // k++;
      l++;
    } else if (s[i] == 'b' && (k + l >= a + b || l >= b))
      cout << "No" << endl;
    else if (s[i] == 'c')
      cout << "No" << endl;
  }
}

Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
///////////////////////////////////////////
const long long int INF = INT64_MAX;
const long long int Mod = 1000000007;
using ll = long long int; using ci = const int;
using vi = vector<int>;
using Vi = vector<long long int>;
typedef pair<int, int> P; typedef pair<ll, ll> PLL;
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define rep(i,N) for(ll i=0;i<N;i++)
auto max(auto x,auto y){if(x>y){return x;}else{return y;}}
auto min(auto x,auto y){if(x>y){return y;}else{return x;}}
template<class T>bool chmax(T &former, const T &b) { if (former<b) { former=b; return true; } return false; }
template<class T>bool chmin(T &former, const T &b) { if (b<former) { former=b; return true; } return false; }
template<class T>T sqar(T x){ return x*x; }//sqrt(x)は平方根;
#define Sort(v) std::sort(v.begin(), v.end(), std::greater<decltype(v[0])>()) //降順でVをソート
typedef vector<vector<ll> > matrix;
void princ(auto x){cout<<x<<" ";}; void print(auto x){cout<<x<<"\n";};
///////////////////////////////////////////////////////////////////////////////////

ll n,k;
Vi a;
ll cal(ll mask){
    ll ans = 0;
    ll max = 0;
    rep(i,n){
        if(mask&(1<<i)){
            if(max>=a[i]){
                ans += max-a[i]+1;
                max++;
            }
        }
        chmax(max,a[i]);
    }
    return ans;
}

int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    cin>>n>>k; a.resize(n);
    rep(i,n)cin>>a[i];
    ll ans = INF;
    rep(msk,1<<n){
        if(!(msk & 1))continue;
        if(__builtin_popcount(msk)<k)continue;
        chmin(ans,cal(msk));
    }
    print(ans);
    return 0;
}


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

int main(void) {
    int n;
    cin >> n;
    int x = n % 10;
    if (x == 3) {
        cout << "bon" << endl;
    } else if (x == 0 || x == 1 || x == 6 || x == 8) {
        cout << "pon" << endl;
    } else {
        cout << "hon" << endl;
    }
    return 0;
}

Measured memory_bytes: 3624
import java.util.*

const val MOD: Long = (1e9+7).toLong()
fun Double.format(digits: Int) = String.format("%.${digits}f", this)
fun <T : Comparable<T>> Iterable<T>.argmax(): Int? = withIndex().maxBy{it.value}?.index
fun <T : Comparable<T>> Iterable<T>.argmin(): Int? = withIndex().minBy{it.value}?.index

fun main(args: Array<String>) {
    val reader = System.`in`.bufferedReader()
    val (a, p) = reader.readLine()!!.split(" ").map{it.toInt()}

    println((a*3+p)/2)
}


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

int main() {
	int h, w;
	cin>>h>>w;
	char pat[h][w];
	for(int i=0; i<h; i++){
		for(int j=0; j<w; j++){
			cin>>pat[i][j];
		}
	}
	
	
	for(int i=0; i<w+2; i++){cout<<"#";}
	cout<<endl;
	for(int i=0; i<h; i++){
		cout<<"#";
		for(int j=0; j<w; j++){
			cout<<pat[i][j];
		}
		cout<<"#\n";
	}
	for(int i=0; i<w+2; i++){cout<<"#";}

    return 0;
}

Measured memory_bytes: 256