akhauriyash/Code-Regression huggingface dataset:
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int H = scanner.nextInt();
		int W = scanner.nextInt();
		int K = scanner.nextInt();
		int[][] grid = new int[H][W];
		// System.out.println("H: " + H);
		// System.out.println("W: " + W);
		for (int i = 0; i < H; i++) {
			char[] line = scanner.next().toCharArray();
			// System.out.println("line: " + new String(line));
			for (int j = 0; j < W; j++) {
				if (line[j] == '.') {
					grid[i][j] = 0;
				} else {
					grid[i][j] = 1;
				}
			}
		}
		int ans = solve(grid, H, W, K);
		System.out.println(ans);
	}

	public static int solve(int[][] grid, int H, int W, int K) {
		int ans = 0;
		int maxH = 1 << H;
		int maxW = 1 << W;
		for (int maskR = 0; maskR < maxH; maskR++) {
			for (int maskC = 0; maskC < maxW; maskC++) {
				int black = 0;
				for (int i = 0; i < H; i++) {
					for (int j = 0; j < W; j++) {
						if (grid[i][j] == 1 && ((maskR >> i) & 1) == 0 && ((maskC >> j) & 1) == 0) {
							black++;
						}
					}
				}
				if (black == K) {
					ans++;
				}
			}
		}
		return ans;
	}
}


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

int main(){
  string s;
  cin >> s;
  int dig=0;
  for(int i=0;i<s.size();++i){
    dig+=s[i]-'0';
  }
  if(stoi(s)%dig==0) cout << "Yes" << endl;
  else cout << "No" << endl;
}
  

Measured memory_bytes: 256
#include<iostream>
#include<cstdlib>
#include<utility>
#include<tuple>
#include<string>
#include<vector>
#include<numeric>
#include<algorithm>
#include<queue>
#include<deque>
#include<bitset>
#include<cmath>
#include<map>
#include<iomanip>
using namespace std;
using ll = long long;
const ll mod = 1e9 + 7;
#define rep(i, a, b) for(ll i = a; i < b; i++)

int main() {

	int n, m, x;
	cin >> n >> m >> x;

	vector<int> c(n);
	vector<vector<int>> a(n, vector<int>(m));

	rep(i, 0, n) {
		cin >> c[i];
		rep(j, 0, m) cin >> a[i][j];
	}

	int ans = 12000001;
	int all = 1 << n; //先頭だけ1の本の数と同じ長さのビット
	rep(mask, 0, all) {
		vector<int> level(m);//理解度
		int cost = 0;//コスト
		rep(i, 0, n) {
			if ((mask >> i) & 1) {//maskのi番目が1だったら
				cost += c[i];
				rep(j, 0, m) {
					level[j] += a[i][j];
				}
			}
		}
		bool ok = true;
		rep(j, 0, m) {
			if (level[j] < x) ok = false;//どれか1個でもx以下なら
		}
		if (ok) ans = min(ans, cost);
	}
	if (ans == 12000001) cout << -1 << endl;
	else cout << ans << endl;

	return 0;
}


Measured memory_bytes: 3628
#include <iostream>
#include <string>
#include <cmath>
#include <vector>
#include <algorithm>
#include <iterator>
#include <typeinfo>
using namespace std;


// define list


namespace  math{
    const double PI = 3.14;
    const int INF = 1000000007;
    int GCM(int a,int b); //最大公約数
    int LCM(int a,int b); //最小公倍数
    int Pemu(int n,int r); //順列
    int Comb(int n,int m); //組み合わせ
    
    int GCM(int a,int b){
        if(a<b){
            swap(a,b);
        }
        int r = a%b;
        while (r!=0)
        {
            a=b;
            b=r;
            r=a%b;
        }
        return b;
    }

    int LCM(int a,int b){
        return a*(b/GCM(a,b));
    }

    int Pemu(int n,int r){
        int ans = n;
        for(int i=1;i<r;i++){
            ans*=(ans-i);
        }
        return ans;
    }

    int Comb(int n,int m){
        int a=n,b=m;
        for(int i=1;i<m;i++){
            a *= (a-i);
        }
        for(int i=1;i<m;i++){
            b *= (b-i);
        }
        
        return a/b;
    }
}

namespace SubLib{
    #define int long long
    #define double long double
    #define incin(n) int (n); cin >> (n);
    #define incin2(a,b) int a,b; cin >> a >> b; 
    #define rap(n,i) for(int (i) = 0;i<(n);(i)++)
    #define input(n,v) (v) = SubLib::Input((n),(v))
    #define all(v) (v).begin(),(v).end()
    using intv = vector<int>;
    using strv = vector<string>;
    using charv = vector<char>;
    template <class T1>
    using pvec = vector<pair<T1,T1>>;
    template <typename T> vector<T> Input(int n,vector<T> v){
        for(int i=0;i<n;i++){
            cin >> v.at(i);
        }
        return v;
    }
}

using namespace math;
using namespace SubLib;

signed main(){
    string a,b;
    cin >> a >> b;
    if(a.size()>b.size()){
        cout<<"GREATER"<<endl;
        return 0;
    }else if(a.size()<b.size()){
        cout<<"LESS"<<endl;
        return 0;
    }else{
        rap(a.size(),i){
            if(a[i]>b[i]){
                cout<<"GREATER"<<endl;
                return 0;
                break;
            }else if(a[i]<b[i]){
                cout<<"LESS"<<endl;
                return 0;
                break;
            }
        }
    }
    cout<<"EQUAL"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef  long long ll;
using vll=vector<ll>;
using vvll=vector<vll>;
using vi=vector<int>;
using vvi=vector<vector<int>>;
using vb=vector<bool>;
using pii=pair<int,int>;
using vpii=vector<pair<int,int>>;

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

//pow(llpow,modpow)
template<class T> ll llpow(ll x,T n){ll ans=1;if(x==0)ans=0;while(n){if(n&1)ans*=x;x*=x;n>>=1;}return ans;}
long long modpow(long long a, long long n, long long mod) {long long res = 1;while (n > 0) {if (n & 1) res = res * a % mod;a = a * a % mod;n >>= 1;}return res;}
//最大公約数
template<class T> inline T gcd(T x,T y){if(y==0)return x; else {return gcd(y,x%y);}}
//最小公倍数
template<class T> inline T lcm(T x,T y){return x/gcd(x,y)*y;}
//逆元
long long modinv(long long a, long long m) {long long b = m, u = 1, v = 0;while (b) {long long t = a / b;a -= t * b; swap(a, b);u -= t * v; swap(u, v);}u %= m;if (u < 0) u += m;return u;}

#define rep(i, begin_i, end_i) for (ll i = (ll)begin_i; i < (ll)end_i; i++)
//試験導入
#define irep(i, end_i, begin_i) for (ll i = (ll)begin_i-1; i >= (ll)end_i; i--)

long long INF = 1LL<<60;
int main( ){
    int N;
    cin>>N;
    vpii rxy(N);
    vpii byx(N);
    rep(i,0,N)cin>>rxy[i].first>>rxy[i].second;
    rep(i,0,N)cin>>byx[i].second>>byx[i].first;
    sort(rxy.begin(),rxy.end());
    sort(byx.begin(),byx.end());
    ll ans=0;
    vb fixedr(N,false);
    rep(bi,0,N){
        int ci=-1;
        rep(ri,0,N){
            if(fixedr[ri])continue;
            if(rxy[ri].first<byx[bi].second&&rxy[ri].second<byx[bi].first){
                ci=ri;
            }
        }
        if(ci!=-1)fixedr[ci]=true,ans++;
    }
    cout<<ans<<endl;
    return 0;
}




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

class C
{
	static void Main()
	{
		var A = 1000000;
		Console.ReadLine();
		var a = new int[A + 1];
		foreach (var x in Console.ReadLine().Split().Select(int.Parse)) a[x]++;

		var c = new MInt[A + 1];
		for (var d = 1; d <= A; d++) c[d] = new MInt(d).Inv();
		for (var d = 1; d <= A / 2; d++)
			for (var m = 2 * d; m <= A; m += d) c[m] -= c[d];

		var h = new MInt(2).Inv();
		MInt s = 0;
		for (var d = 1; d <= A; d++)
		{
			MInt si = 0, si2 = 0;
			for (var m = d; m <= A; m += d)
			{
				if (a[m] == 0) continue;
				si += ((MInt)a[m]) * m;
				si2 += ((MInt)a[m]) * m * m;
			}
			s += (si * si - si2) * h * c[d];
		}
		Console.WriteLine(s.V);
	}
}

struct MInt
{
	const int M = 998244353;
	public long V;
	public MInt(long v) { V = (v %= M) < 0 ? v + M : v; }

	public static implicit operator MInt(long v) => new MInt(v);
	public static MInt operator +(MInt x, MInt y) => x.V + y.V;
	public static MInt operator -(MInt x, MInt y) => x.V - y.V;
	public static MInt operator *(MInt x, MInt y) => x.V * y.V;
	public static MInt operator /(MInt x, MInt y) => x * y.Inv();

	public MInt Pow(int i) => MPow(V, i);
	public MInt Inv() => MPow(V, M - 2);

	static long MPow(long b, int i)
	{
		for (var r = 1L; ; b = b * b % M)
		{
			if (i % 2 > 0) r = r * b % M;
			if ((i /= 2) < 1) return r;
		}
	}
}


Measured memory_bytes: 37136
//#pragma GCC target("avx2")
//#pragma GCC optimize("O3")
   
//#include <x86intrin.h>
#include <bits/stdc++.h>   
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace __gnu_pbds;
using namespace std;

template<typename T> using ordered_set = tree <T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
     
#define F first
#define S second           
#define lb lower_bound               
#define ub upper_bound
#define pb push_back
#define pf push_front    
#define ppb pop_back
#define mp make_pair
#define bpp __builtin_popcountll                                                                                        
#define sqr(x) ((x) * (x)) 
#define al 0x3F3F3F3F
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define in insert
#define ppf pop_front
#define endl '\n'
//#define int long long
 
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair <int, int> pii;
 
const int mod = (int)1e9 + 7;
const int N = (int)3e5 + 123;
const ll inf = (ll)1e18 + 1;

const double pi = acos (-1.0);
const double eps = 1e-7;                  
const int dx[] = {0, 0, 1, 0, -1};
const int dy[] = {0, 1, 0, -1, 0};

int n, T, dp[3001][6001];
pii a[N];

inline void boost () {                    
   ios_base :: sync_with_stdio (NULL);
   cin.tie (NULL), cout.tie (NULL);          
}                                                     

inline void Solve () {
   cin >> n >> T;
   for (int i = 1; i <= n; i ++) cin >> a[i].F >> a[i].S;
   sort (a + 1, a + n + 1);
   for (int i = 1; i <= n; i ++) {
      for (int s = 0; s <= T + 3000; s ++) {
         dp[i][s] = max (dp[i][s], dp[i - 1][s]);
         if (s < T) dp[i][s + a[i].F] = max (dp[i][s + a[i].F], dp[i - 1][s] + a[i].S);
      } 
   }
   int ans = 0;
   for (int i = 1; i <= T + 3000; i ++)
      ans = max (ans, dp[n][i]);
   cout << ans;
}

main () {                                       
// freopen (".in", "r", stdin);    
// freopen (".out", "w", stdout);              
   boost ();
   int tt = 1;
   //cin >> tt;   
   while (tt --) {
      Solve ();
   }                                               
   return 0;      
}
                          

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

int main() {
    int n; cin >> n;
    vector<int> D(n);
    for (int i = 0; i < n; i++) {
        cin >> D[i];
    }

    sort(D.begin(), D.end());
    cout << D[n/2] - D[n/2 - 1] << endl;

    return 0;
}


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

int main() {
	char T[7];
	for(int i = 1; i < 7; i++) {
		cin >> T[i];
	}
	if(T[4] == T[3] and T[5] == T[6]) {
		cout << "Yes\n";
	}
	else
		cout << "No\n";
}


Measured memory_bytes: 3632
n, x = map(int, input().split())
a = list(map(int, input().split()))

ans = 0
if a[0] > x:
    ans += a[0] - x
    a[0] = x

for i in range(1, n):
    if a[i-1] + a[i] > x:
        ans += a[i-1] + a[i] - x
        a[i] = x - a[i-1]

print(ans)

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

int main(){
  int N,n;
  cin>>N;
  vector<int> vec(N);
  for(int i=0;i<N;i++)
    cin>>vec.at(i);
  sort(vec.begin(),vec.end());
  n=N/2;
  cout<<vec.at(n)-vec.at(n-1)<<endl;
}

Measured memory_bytes: 640
package main

import (
	"fmt"
	"sort"
)

type shop struct {
	price int
	cap   int
}

type shops []shop

func (s shops) Less(i, j int) bool {
	return s[i].price < s[j].price
}
func (s shops) Len() int {
	return len(s)
}
func (s shops) Swap(i, j int) {
	s[i], s[j] = s[j], s[i]
}

func main() {
	var n, m int

	fmt.Scan(&n, &m)

	var p, c int
	var shops = shops{}
	for i := 0; i < n; i++ {
		fmt.Scan(&p, &c)

		shops = append(shops, shop{price: p, cap: c})
	}

	sort.Sort(shops)

	var sum = 0
	for i := 0; i < shops.Len(); i++ {
		if shops[i].cap < m {
			sum += shops[i].cap * shops[i].price
			m -= shops[i].cap
		} else {
			sum += m * shops[i].price
			m = 0

			break
		}
	}

	fmt.Println(sum)

}


Measured memory_bytes: 7168
#include <stdio.h>

int main() {
    int W, H, x, y, r;
    scanf("%d %d %d %d %d", &W, &H, &x, &y, &r);
    if(x<r || x+r>W || y<r || y+r>H) printf("No\n");
    else printf("Yes\n");
}


Measured memory_bytes: 2684
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  long long int N,M;
  cin>>N>>M;
  if(N==1&&M==1){cout<<1<<endl;return 0;}
  if(N==1){cout<<M-2<<endl;return 0;}
  if(M==1){cout<<N-2<<endl;return 0;}
  long long int a=(N-2)*(M-2);
  cout<<a<<endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<iostream>
#include<string>
#include <vector>
#include <map>
#include<cstdlib>
#include<iomanip>

using namespace std;

void Solution()
{
    double a[10];
    
    while(cin>>a[0])
    {
        double sum = a[0]; //to save sum
        
        for(int i = 1; i < 10; i++)
        {
            if(i % 2 == 1)
            {
                a[i] = a[i - 1] * 2;
            }
            else
            {
                a[i] = a[i - 1] / 3;
            }
            
            sum += a[i];
        }
        
        cout<<fixed<<setprecision(8)<<sum<<endl;
    }
}

int main()
{
    Solution();
    return 0;
}

Measured memory_bytes: 1280
void main(){
	long n = _scan!long();
	long[] a = _scanln!long();

	// 要素に0がある場合
	if( a.count(0) != 0 ){
		writeln(0);
		return;
	}
	// 桁あふれが起きないかチェックしならが積をとる
	long mula = 1;
	foreach(elm; a){
		if( mula <= mula*elm && mula <= 10L^^18/elm ) mula *= elm;
		else {
			writeln(-1);
			return;
		}	
	}
	mula.writeln();
}
import std.stdio, std.conv, std.algorithm, std.numeric, std.string, std.math;

// 1要素のみの入力
T _scan(T= int)(){
	return to!(T)( readln().chomp() );
}

// 1行に同一型の複数入力
T[] _scanln(T = int)(){
	T[] ln;
	foreach(string elm; readln().chomp().split()){
		ln ~= elm.to!T();
	}
	return ln;
}


Measured memory_bytes: 7572
#pragma GCC optimize("O3")
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
typedef  unsigned long long int ull;
typedef pair<ll,ll> P;
template<class T> using V=vector<T>; 
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
const ll inf=(1e18);
//const ll mod=998244353;
const ll mod=1000000007;
//ios_base::sync_with_stdio(false);
//cin.tie(NULL);
ll gcd(ll a,ll b) {return b ? gcd(b,a%b):a;}
ll lcm(ll c,ll d){return c/gcd(c,d)*d;}
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
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 (a>b) { a=b; return 1; } return 0; }
int main(){
int n;cin>>n;
V<int> a(n);
for(int i=0;i<n;i++)cin>>a[i];
if(n>24){
    cout<<0<<endl;
    return 0;
}
 if(n>13){
    V<int> cnt(n);
    cnt[0]++;
    for(int i=0;i<n;i++){
        cnt[a[i]]++;
        if(cnt[0]==2||cnt[a[i]]==3){
            cout<<0<<endl;
            return 0;
        }
    }
    cout<<1<<endl;
    return 0;
}
int ans=0;
for(int bit=0;bit<(1<<n);bit++){
    V<int> d(n+1);
    for(int i=0;i<n;i++){
        if(a[i]==0||bit&(1<<i))d[i]=a[i];
        else d[i]=24-a[i];
    }
    d[n]=0;
    int res=INT_MAX;
    for(int i=0;i<n+1;i++){
        for(int j=i+1;j<n+1;j++){
            int t=abs(d[i]-d[j]);
            if(t>12)t=24-t;//(ex)0,13の時時差は１３時間でない　(時差の最大値は12であるため) 
              chmin(res,t);
        }
    }
    chmax(ans,res);
}
cout<<ans<<endl;
}


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

int main() {
  string a, b, c;
  cin >> a >> b >> c;
  
  cout << (char)(a.at(0) - 0x20) << (char)(b.at(0) - 0x20) << (char)(c.at(0) - 0x20) << endl;
  
}

Measured memory_bytes: 256
using System;

class ITP1_5_D
{
    public static void Main()
    {
        int n = int.Parse(Console.ReadLine());

        for (int i = 1; i <= n; i++)
        {
            int num = i;

            if (num % 3 == 0)
            {
                Show(i);
            }
            else
            {
                int remainder;

                while (num != 0)
                {
                    remainder = num % 10;

                    if (remainder == 3)
                    {
                        Show(i);
                        break;
                    }
                    else
                    {
                        num -= remainder;
                        num /= 10;
                    }
                }
            }

        }
        Console.WriteLine();
    }

    static void Show(int a)
    {
        Console.Write(" " + a);
    }
}

Measured memory_bytes: 9144
#include <stdio.h>
#include <stdlib.h>//random,NULL
#include <string.h>
#include <time.h>
#include <unistd.h>//sleep()
#include <math.h>
#include <stdbool.h>

#define rep(i,n) for(int i=0; i<((int)n); i++)
#define REP(i,n) for(int i=0; i<=((int)n); i++)
#define srep(i,a,n) for(int i=a; i<((int)n); i++)
#define SREP(i,a,n) for(int i=a; i<=((int)n); i++)
#define rrep(i,n) for(int i=n-1; i>=0; i--)
#define RREP(i,n) for(int i=n; i>=0; i--)
#define INF 1000000000
const int mod = INF+7;

int min(int a, int b){
  if(a>=b){
    return b;
  }
  else{
    return a;
  }
}

int main(){
  char buf[1024];
  int L,R;

  fgets(buf,sizeof(buf),stdin);
  sscanf(buf, "%d %d", &L, &R);

  int quo1=L/2019;
  int rem1=L%2019;
  int quo2=R/2019;
  int rem2=R%2019;

  int ans;
  if(quo1==quo2){
    ans=rem1*(rem1+1)%2019;
    srep(i, rem1, rem2+1){
      srep(j, i+1, rem2+1){
        ans=min(ans, i*j%2019);
      }
    }
  }
  else{
    ans=0;
  }

  printf("%d\n", ans);

  return 0;
}


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

int main() {
    string s; cin >> s;
    if(s == "Sunny") cout << "Cloudy" << endl;
    if(s == "Cloudy") cout << "Rainy" << endl;
    if(s == "Rainy") cout << "Sunny" << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<stdint.h>
#include<malloc.h>
#include<x86intrin.h>
#include<math.h>

int my_gets(char *buf,int nBuf,FILE *fp){
    int ch;

    while(--nBuf >0){
        ch=getc(fp);
        if(ch==EOF || ch=='\n')
            break;
        *(buf++)=(char)ch;
    }
    *(buf)='\0';

    return nBuf;
}

int main(){
    int64_t W,H,x,y;
    int ans;

    scanf("%lld %lld %lld %lld%*c",&W,&H,&x,&y);

    if(2*x == W && 2*y == H){
        ans=1;
    }
    else{
        ans=0;
    }
    printf("%f %d\n",(W*H)/(2.0),ans);
    
}

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

// 型定義
typedef long long ll;
typedef pair<ll, ll> P;

// forループ
#define REP(i,n) for(ll i=0; i<(ll)(n); ++i)

// 定数宣言
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

// グラフ表現
using Graph = vector<vector<int>>;

// グラフの辺表現
using Edge = map<pair<int,int>,int>;

// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}

int main()
{
    cout << fixed << setprecision(15);
    ll N;
    cin >> N;

    vector<ll> A(N);

    REP(i, N){
        cin >> A[i];
    }
    
    vector<ll> L(N);
    vector<ll> R(N);

    L[0] = A[0];
    for(ll i=1; i<N; i++){
        L[i] = gcd(L[i-1], A[i]);
    }

    R[N-1] = A[N-1];
    for(ll i=N-2; i>0; i--){
        R[i] = gcd(R[i+1], A[i]);
    }

    ll ans = 0;
    ans = max(R[1], L[N-2]);
    for(ll i=1; i<N-1; i++){
        ans = max(ans, gcd(L[i-1], R[i+1]));
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 2560
// Reads multiple ints in a line, separate by a space.
// It works even if the actual number of ints is smaller than n.
// WARNING: This function does not work for -2^63.
// NOTE: This function does not handle error cases.
// Verified: ARC096D
fun fastReadLongs(n: Int): LongArray {
  val xs = LongArray(n)
  val s = readLine()!!
  var currentValue = 0L
  var isNegative = false
  var currentIndex = 0
  for (c in s) {
    if (c == ' ') {
      xs[currentIndex] = currentValue * if (isNegative) -1L else 1L
      currentValue = 0
      isNegative = false
      currentIndex++
    } else if (c == '-') {
      isNegative = true
    } else {
      currentValue *= 10
      currentValue += c - '0'
    }
  }
  xs[currentIndex] = currentValue * if (isNegative) -1L else 1L
  return xs
}

fun main(args: Array<String>) {
  val n = readLine()!!.toInt()
  val ws = fastReadLongs(n)
  ws.sort()
  val gaps = LongArray(n)

  var currentWeight = 0L
  for (i in 0 until n) {
    gaps[i] = Math.max(ws[i] - 2 * currentWeight, 0)
    currentWeight += ws[i]
  }

  val maxs1 = LongArray(n)
  maxs1[0] = gaps[0]
  for (i in 1 until n) {
    maxs1[i] = Math.max(maxs1[i - 1], gaps[i])
  }
  val maxs2 = LongArray(n)
  maxs2[n - 1] = gaps[n - 1]
  for (i in n - 2 downTo 0) {
    maxs2[i] = Math.max(maxs2[i + 1], gaps[i])
  }

  var count = 0
  for (i in 0 until n) {
    if (i > 0 && maxs1[i - 1] > ws[i]) continue
    if (i < n - 1 && maxs2[i + 1] > 0) continue
    count++
  }
  println(count)
}


Measured memory_bytes: 44688
def main():
    import sys
    sys.setrecursionlimit(10**9)
    input = sys.stdin.readline

    X, Y = map(int, input().split())
    crane = 0
    turtle = X * 4
    for i in range(X+1):
        if crane + turtle == Y:
            print("Yes")
            return
        crane += 2
        turtle -= 4
    
    print("No")
    return

main()

Measured memory_bytes: 9176
def inp(r, s, p, jan):
  if jan == 's':
    return r
  elif jan == 'p':
    return s
  else:
    return p

n, k = map(int, input().split(" "))
r,s,p = map(int, input().split(" "))
t = list(input())
total = 0
for i in range(n):
  if i < k:
    #print(2)
    total += inp(r,s,p,t[i])
  else:
    if t[i] != t[i-k]:
      #print("OK")
      total += inp(r,s,p,t[i])
    else:
      #print("NG")
      t[i] = 'x'
print(total)

Measured memory_bytes: 9820
#include <cstdio>
#include <vector>
#include <algorithm>

int main() {
  size_t N, M, R;
  scanf("%zu %zu %zu", &N, &M, &R);

  std::vector<size_t> r(R);
  for (size_t i=0; i<R; ++i)
    scanf("%zu", &r[i]);

  constexpr int INF=1<<29;
  std::vector<std::vector<int>> g(N, std::vector<int>(N, INF));
  for (size_t i=0; i<M; ++i) {
    size_t A, B;
    int C;
    scanf("%zu %zu %d", &A, &B, &C);
    --A;
    --B;
    g[A][B] = g[B][A] = C;
  }

  for (size_t k=0; k<N; ++k)
    for (size_t i=0; i<N; ++i)
      for (size_t j=0; j<N; ++j)
        g[i][j] = std::min(g[i][j], g[i][k]+g[k][j]);

  int res=INF;
  std::sort(r.begin(), r.end());

  do {
    int cur=0;
    for (size_t i=1; i<R; ++i)
      cur += g[r[i-1]-1][r[i]-1];

    res = std::min(res, cur);
  } while (std::next_permutation(r.begin(), r.end()));

  printf("%d\n", res);
}


Measured memory_bytes: 384
#include<iostream>
#include<algorithm>
using namespace std;
int N,A[100];
int ans=1e9;
main()
{
  cin>>N;
  for(int i=0;i<N;i++)cin>>A[i];
  for(int X=-100;X<=100;X++)
  {
    int now=0;
    for(int i=0;i<N;i++)now+=(X-A[i])*(X-A[i]);
    ans=min(ans,now);
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
arry = []
N, D = map(int, input().split())
for i in range(N):
    arry.append(list(map(int, input().split())))
cnt = 0
for i in range(N):
  for j in range(i+1, N):
    sum = 0
    for k in range(D):
      sum += (arry[i][k]-arry[j][k])**2
    for m in range(sum+1):
      if(m**2 == sum):
        cnt += 1
        break
print(cnt)

Measured memory_bytes: 3064
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		Map<Long, Long> baMap = new HashMap<>();
		for (int i = 0; i < N; i++) {
			long ai = sc.nextLong();
			long bi = sc.nextLong();
			Long tempValue = baMap.get(bi);
			if (tempValue == null) {
				baMap.put(bi, ai);
			} else {
				long updated = tempValue + ai;
				baMap.put(bi, updated);
			}
		}
		sc.close();

		Object[] keys = baMap.keySet().toArray();
		Arrays.sort(keys);
		long tempValue = 0;
		boolean ans = true;
		for (Object key : keys) {
			long tempKey = (long) key;
			tempValue = tempValue + baMap.get(tempKey);
			if (tempValue > tempKey) {
				ans = false;
				break;
			}
		}
		if (ans) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}


Measured memory_bytes: 133340
def solve():
    N = int(input())
    D = list(map(int, input().split()))
    M = int(input())
    T = list(map(int, input().split()))
    prepared_map = {}
    necessary_map = {}
    for i in D:
        if not i in prepared_map.keys():
            prepared_map[i] = 1
        else:
            prepared_map[i] = prepared_map[i] + 1
        if not i in necessary_map.keys():
            necessary_map[i] = 0
    for i in T:
        if not i in necessary_map.keys():
            necessary_map[i] = 1
        else:
            necessary_map[i] = necessary_map[i] + 1
        if not i in prepared_map.keys():
            prepared_map[i] = 0
    if all(prepared_map[k] >= necessary_map[k] for k in necessary_map.keys()):
        print("YES")
    else:
        print("NO")

solve()


Measured memory_bytes: 55776
#include<bits/stdc++.h>
using namespace std;
#define all(x) x.begin(), x.end()
typedef vector <int> vi;
typedef pair<int,int> ii;
typedef long long ll;
typedef long double ld;
const int mod = 1e9 + 7;
const ll inf = 3e18 + 5;
int add(int a, int b) { return (a += b) < mod ? a : a - mod; }
int mul(int a, int b) { return 1LL * a * b % mod; }
int sub(int a, int b) { return (a -= b) < 0 ? a + mod : a; }

int main() {
  ios_base::sync_with_stdio(false); cin.tie(0);
  #ifdef LOCAL
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
  #endif

  int a, b, c, d;
  cin >> a >> b >> c >> d;
  int k = 0;
  while(a > 0 && c > 0) {
    c -= b;
    if(c <= 0) return cout << "Yes", 0;
    a -= d;
  }
  cout << "No";
}

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

int main(){
	int R, G, B, N;
	cin >> R >> G >> B >> N;

	int ans = 0;
	int maxr = N / R;
	for (int r = 0; r <= maxr; r++)
	{
		int maxg = (N - R * r) / G;
		for (int g = 0; g <= maxg; g++)
		{
			if( (N - R * r - G * g) % B == 0 )
			{
				ans++;
			}
		}
	}
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
    int max_L = 0;
    int L;
    int N;
    int sum = 0;

    cin >> N;
    for (int i = 0; i < N; ++i) {
        cin >> L;
        if (L > max_L) max_L = L;
        sum += L;
    }
    if (max_L < sum - max_L) cout << "Yes" << endl;
    else cout << "No" << endl;
}

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

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


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

using namespace std;
string abacus[10] = {"* = ****", 
					 "* =* ***",
					 "* =** **",
					 "* =*** *",
					 "* =**** ",
					 " *= ****",
					 " *=* ***",
					 " *=** **",
					 " *=*** *",
					 " *=**** "};

void solve()
{
	bool init_flag = true;
	int num;
	while(cin >> num)
	{
		if(init_flag)
		{
			init_flag = false;
		}
		else
		{
			cout << endl;
		}
		vector<int> a(5);
		for(int i = 0; i < 5; ++i)
		{
			a[i] = num % 10;
			num /= 10;
		}
		reverse(a.begin(), a.end());
		for(int i = 0; i < 8; ++i)
		{
			for(int j = 0; j < 5; ++j)
			{
				cout << abacus[a[j]][i];
			}
			cout << endl;
		}
	}
}

int main()
{
	solve();
	return(0);
}

Measured memory_bytes: 908
#include <bits/stdc++.h>
#include<algorithm>
#include<math.h>
using namespace std;
 
template <class T> using V = vector<T>;
 
using ll = long long;
using db = double;
using st = string;
using ch = char;
using vll = V<ll>;
using vpll =V<pair<ll,ll>>;
using vst = V<st>;
using vdb = V<db>;
using vch = V<ch>;
 
 
#define FOR(i,a,b) for(ll i=(a);i<(ll)(b);i++)
#define rFOR(i,a,b) for(ll i=(a);i>(ll)(b);i--)
#define oFOR(i,a,b) for(ll i=(a);i<(ll)(b);i+=2)
#define bgn begin()
#define en end()
#define SORT(a) sort((a).bgn,(a).en)
#define REV(a) reverse((a).bgn,(a).en)
#define M(a,b) max(a,b)
#define rM(a,b) min(a,b)
#define fi first
#define se second
#define sz size()
#define gcd(a,b) __gcd(a,b)
#define co(a) cout<<a<<endl;
#define ci(a) cin>>a;
 
 
ll sum(ll n) {
  ll m=0;
  FOR(i,0,20){
    m+=n%10;
    n/=10;
    if(n==0){
      break;
    }
  }
  return m;
}
 
 
ll combi(ll n,ll m) {
  ll ans=1;
  rFOR(i,n,n-m){
    ans*=i;
  }
  FOR(i,1,m+1){
    ans/=i;
  }
  return ans;
}
 
 
ll lcm(ll a,ll b){
  ll n;
  n=a/gcd(a,b)*b;
  return n;
}



/****************************************\
| Thank you for viewing my code:)        |
| Written by RedSpica a.k.a. RanseMirage |
| Twitter:@asakaakasaka                  | 
\****************************************/
 
 
signed main() {
  FOR(i,0,3){
    st s;
    	ci(s);
    cout<<s[i];
  }
  cout<<" "<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
int N;
cin>>N;
int A[N];
for(int i=0;i<N;i++){
    cin>>A[i];
}
int cnt=0;
while(true){
    for(int i=0;i<N;i++){
        if(A[i]%2!=0){
            cout<<cnt;
            return 0;
        }
        A[i]/=2;
    }
    cnt++;
}
return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define max(a,b) (a<b?b:a)
#define abs(x) (x<0?(-x):x)
#define F(i,L,R) for (int i = L; i < R; i++)
#define FE(i,L,R) for (int i = L; i <= R; i++)
#define RF(i,L,R) for (int i = L; i > R; i--)
#define RFE(i,L,R) for (int i = L; i >= R; i--)
#define getI(a) scanf("%d", &a)
#define getII(a,b) scanf("%d%d", &a, &b)
#define getIII(a,b,c) scanf("%d%d%d", &a, &b, &c)
#define VgetI(n) int (n); scanf("%d",&(n))
#define VgetII(n,m) int (n),(m); scanf("%d %d",&(n),&(m))
#define VgetIII(n,m,k) int (n),(m),(k); scanf("%d %d %d",&(n),&(m),&(k))
#define ll long long
#define INF 1000000000000000005
#define nINF -2000000000
#define MOD 1e9+7
#define PI 3.1415926535897932384626
int main(){
	int n;
	while(~getI(n)){
		double ans=0;
		while(n--){
			double money;
			scanf("%lf",&money);
			char currency[5];
			scanf("%s",currency);
			if(!strcmp(currency,"JPY")) ans+=money;
			else ans+=(380000*money);
		}
		printf("%lf\n",ans);
	}
}


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

typedef long long ll;
using namespace std;

// a^p
// 2^3 = 2 * 2^2
// 2^2 = 2 * (2^1)
// 2^1 = 2
ll modpow(ll a, ll p, ll mod) {
  if (p == 0) return 1;

  if (p % 2 == 0) {
    ll half = modpow(a, p/2, mod) % mod;
    return half * half % mod;
  } else {
    return a * modpow(a, p - 1, mod) % mod;
  }
}

// nCa を求める
ll modCombination(ll n, ll a, ll mod) {
  if (n - a < a) {
    return modCombination(n, n - a, mod);
  }

  ll denominator = 1; // 分母
  ll numerator = 1; // 分子

  for (ll i = 0; i < a; i++) {
    denominator *= i + 1;
    numerator *= n - i;
    denominator %= mod;
    numerator %= mod;
  }

  return numerator * modpow(denominator, mod - 2, mod) % mod;
}

 vector<pair<ll, ll>> prime_factorize(ll n) {
   vector<pair<ll, ll>> res;

   for (ll i = 2; i * i <= n; i++) {
     if (n % i == 0) {
       ll num = 0;
       while (n % i == 0) {
         num++;
         n /= i;
       }
       res.push_back(make_pair(i, num));
     }
   }

   if (n != 1) {
     res.push_back(make_pair(n, 1));
   }

   return res;
 }

 ll MOD = 1000000007;

// int main() {
//   ll N, M;
//   cin >> N >> M;
//   vector<pair<ll, ll>> primeFactors = prime_factorize(M);

//   ll ans = 1;
//   for (auto e : primeFactors) {
//     ll base = e.first;
//     ll exponent = e.second;

//     ans *= modCombination(exponent + N - 1, N - 1, MOD) % MOD;
//   }

//   cout << ans % MOD << endl;

//   return 0;
// }


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

  ll remaining = M;
  ll ans = 1;
  // 素因数分解
  for (ll i = 2; i * i < M; i++) {
    if (remaining % i == 0) {
      // 指数を求める
      ll p = 0;
      while (remaining % i == 0) {
        p += 1;
        remaining /= i;
      }
      // 重複組合せ
      ans *= modCombination(N + p - 1, N - 1, MOD);
      ans %= MOD;
    }
  }
  if (remaining != 1) {
    ans *= modCombination(N + 1 - 1, N - 1, MOD);
    ans %= MOD;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
/*
Keep clam  Believe youself
*/
#include<cstdio>
#include<iostream>
#include<cstring>
#include<string>
#include<algorithm>
#include<queue>
#include<map>
#include<vector>
#include<stack>
#include<set>
#include<cmath>
#define Xiaobo main
#define DEBUG(x) cerr<<#x<<": "<<(x)<<endl
using namespace std;
const int maxn=2e5+7;
const int mod=1e9+7;
const double eps=1e-15;
const double pi=acos(-1);
const int INF=0x3f3f3f3f;
typedef long long ll;
ll read(){ll c = getchar(),Nig = 1,x = 0;while(!isdigit(c) && c!='-')c = getchar();if(c == '-')Nig = -1,c = getchar();while(isdigit(c))x = ((x<<1) + (x<<3)) + (c^'0'),c = getchar();return Nig*x;}
ll gcd(ll a,ll b){ return b==0?a:gcd(b,a%b);}
//别急 dp找状态 问题看看本身的规律 贪心找方法
vector<int>color[maxn];
typedef pair<int,int>PII;
map<PII,int>ans;
vector<PII>bc;
bool st[maxn];
int mx=0;
int cs[maxn];
vector<int>G[maxn];
void bfs(int x) {
	int rs=1;
	queue<int>q;
	q.push(x);
	st[x]=1;
	while(q.size()) {
		int t=q.front();
		q.pop();
		rs=1;
		for(auto j:G[t]) {
			if(st[j]) continue;
			while(find(color[t].begin(),color[t].end(),rs)!=color[t].end()) rs++;
			color[t].push_back(rs);
			color[j].push_back(rs);
			ans[{t,j}]=rs;
			ans[{j,t}]=rs;
			st[j]=1;
			mx=max(mx,rs);
			q.push(j);
		}
	}
}
int Xiaobo()
{
	int n;
	cin>>n;
	for(int i=1;i<n;i++) {
		int a,b;
		cin>>a>>b;
		G[a].push_back(b);
		G[b].push_back(a);
		bc.push_back({a,b});
	}
	bfs(1);
	cout<<mx<<'\n';
	for(auto item:bc) {
		cout<<ans[item]<<'\n';
	}
	return 0;
}


Measured memory_bytes: 30580
#include<bits/stdc++.h>
using namespace std;
#define For(start,end) for(int i = (int)start;i<(int)end;i++)
using Int = long long int;
using TDim = vector<vector<int>>;
//xとyの最小公倍数=>素因数分解
Int euclid(Int b,Int a){

    if(b%a==0)return a;
    return euclid(a,b%a);
}
Int start_E(Int b,Int a)
{
    Int big=max(b,a);
    Int small=min(b,a);
    return euclid(big,small);
}
int main()
{
    Int A,B,C,D;
    cin>>A>>B>>C>>D;
    if(A==B)
    {
        if(A%C==0||A%D==0)
        {
            cout<<0<<endl;
        }
        else
        {
            cout<<1<<endl;
        }
        
    }
  
    else
    {
    Int n = B-A+1;//n個
    Int Ca= A/C;
    Int Da= A/D;
    Int Cb= B/C;
    Int Db= B/D;
    Int gcm=start_E(C,D);
    Int CDa = A/(gcm*(C/gcm)*(D/gcm));
    Int CDb = B/(gcm*(C/gcm)*(D/gcm));
    Int youC=(A%C==0)?1:0;
    Int youD=(A%D==0)?1:0;
    Int youCD=(A%(gcm*(C/gcm)*(D/gcm))==0)?1:0;
    cout<<n-(Db-Da)-(Cb-Ca)-youC-youD+youCD+(CDb-CDa)<<endl;
    }    
}


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

struct UnionFind{
    vector<int> tree;

    UnionFind(int n): tree(n+1, -1) {};

    int root(int i){ return tree[i] < 0 ? i : tree[i] = root(tree[i]); }

    bool unite(int i, int j){
        i = root(i), j = root(j);
        if(i == j) return false;
        tree[i] += tree[j], tree[j] = i;
        return true;
    }

    bool same(int i, int j){ return root(i) == root(j); }

    int size(int i){ return -tree[root(i)]; }
};

int main(){

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

    int n, m;
    cin >> n >> m;

    UnionFind uf(n);

    for(int i = 0;i < m;i++){
        int com, x, y;
        cin >> com >> x >> y;
        if(com == 0){
            uf.unite(x, y);
        }else{
            cout << (uf.same(x, y) ? 1 : 0) << endl;
        }
    }

    return 0;
}





Measured memory_bytes: 3260
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <vector>

using namespace std;
using LLONG = long long;
const LLONG MOD = 1000000007;

int Cin()
{
    int n;
    cin >> n;
    return n;
}

// Union-Find木（素集合森：Disjoint-Set Forest）
// グループ分けを木構造で管理するデータ構造
class UnionFindTree
{
private:
    // 各ノードの親ノード番号リスト
    vector<int> m_parents;

public:
    // コンストラクタ
    UnionFindTree(const int N) : m_parents(N)
    {
        // 最初は全ての親が自分自身＝根であるとして初期化
        for (int i = 0; i < N; ++i) m_parents[i] = i;
    }

    // データvが属する木の根を返す
    const int Root(const int v)
    {
        if (m_parents[v] == v) return v;
        return m_parents[v] = Root(m_parents[v]);
    }

    // データv1とv2の木を統合する
    void Unite(const int v1, const int v2)
    {
        int r1 = Root(v1), r2 = Root(v2);
        if (r1 == r2) return;
        m_parents[r1] = r2;
    }

    // ２つのデータが同じ木に属するかどうか判定
    const bool AreInSameTree(const int v1, const int v2)
    {
        return Root(v1) == Root(v2);
    }
};

int main()
{
    int N = Cin(), M = Cin();
    vector<int> ps(N);
    for (auto &pi : ps)
    {
        cin >> pi;
        --pi;
    }

    // Union-Find木
    UnionFindTree tree(N);
    for (int i = 0; i < M; ++i)
    {
        int xi, yi;
        cin >> xi >> yi;
        tree.Unite(xi - 1, yi - 1); // 入れ替え可能＝同じ連結成分
    }

    // piがviと同じ連結成分に属していれば，入れ替えでpi=viとできる
    int ans = 0;
    for (int vi = 0; vi < N; ++vi)
    {
        int pi = ps[vi];
        if (tree.AreInSameTree(vi, pi)) ++ans;
    }
    cout << ans << endl;
}


Measured memory_bytes: 1024
// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

#define debug(...) fprintf(stderr, __VA_ARGS__)
#define int long long int
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
typedef pair<int, int> pii;
typedef long long ll;
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1001001001001001LL;
const ll MOD = 1000000007LL;

const int S = 43;
signed main() {
    int N, K; cin >> N >> K;
    vector<int> info(S);

    for(int i=0; i<N; i++) {
        int val; cin >> val;
        for(int k=0; k<S; k++) {
            info[k] += (val >> k & 1);
        }
    }

    vector<int> part(S+1);
    for(int k=0; k<S; k++) {
        int val = max(info[k], N - info[k]);
        part[k+1] = part[k] + (1LL << k) * val;
    }

    int cur = 0, ans = 0;
    for(int k=S-1; k>=0; k--) {
        int b = (K >> k & 1);
        if(b == 0) {
            cur += info[k]       * (1LL << k);
            ans = max(ans, cur);
        }
        if(b == 1) {
            int tmp = cur + info[k] * (1LL << k) + part[k];
            ans = max(ans, tmp);
            cur += (N - info[k]) * (1LL << k);
            ans = max(ans, cur);
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <climits>
#include <set>
#include <algorithm>
#include <unordered_map>
#include <queue>
#include <iomanip>
#include <map>
#include <utility>
#include <numeric>
#include <chrono>
#include <ctime>
#include <bitset>

#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define P pair<int, int>
#define debug(x) cerr << #x << ": " << x << ", "
#define debugln(x) cerr << #x << ": " << x << '\n'

using namespace std;
using ll = long long;
const ll mod = 1e9+7;

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

  vector<int> a(3);
  cin >> a.at(0) >> a.at(1) >> a.at(2);
  sort(a.begin(), a.end());
  cout << a.at(0) + a.at(1) << endl;
}

Measured memory_bytes: 256
def main():
    import sys
    from collections import defaultdict
    input = sys.stdin.readline
    N = int(input())
    if N == 1:
        print(1)
        exit()
    XY = [0] * N
    for i, (x, y) in enumerate([[int(x) for x in input().strip().split()] for _ in range(N)]):
        XY[i] = (x, y)
    XY.sort(key=lambda x:(x[0], x[1]))

    dic = defaultdict(int)
    for d in range(1, N):
        for i in range(N-d):
            dic[(XY[i+d][0]-XY[i][0], XY[i+d][1]-XY[i][1])] += 1
            dic[(XY[i][0]-XY[i+d][0], XY[i][1]-XY[i+d][1])] += 1

    print(N-max(dic.values()))

if __name__ == '__main__':
    main()

Measured memory_bytes: 3820
#include <iostream>
#include <sstream>
#include <vector>
#include <string>
#include <algorithm>
#include <iterator>
#include <utility>
#include <numeric>
#include <iomanip>
#include <locale>
#include <map>
#include <set>
#include <queue>
#include <cstdlib>
#include <cmath>

using namespace std;

vector<string> read();
int think(vector<string>);
void write(int);

bool isInArea(int, int, int, int);

int main(int argc, char* argv[]) {
  cin.tie(0);
  ios::sync_with_stdio(false);

  auto input = read();
  auto output = think(input);
  write(output);

  return 0;
}

vector<string> read() {
  int h, w;
  string buf;
  vector<string> board;

  cin >> h >> w;
  for (int y = 0; y < h; y++) {
    cin >> buf;
    buf = buf.substr(0, w);
    board.push_back(buf);
  }
  return board;
}

int think(vector<string> input) {
  auto black = '#';
  auto h = input.size();
  auto w = input.at(0).size();
  auto invalid = h * w + 1;

  auto operations = 0;

  auto directions = vector< vector<int> >();
  directions.push_back(vector<int> {1, 0});
  directions.push_back(vector<int> {-1, 0});
  directions.push_back(vector<int> {0, 1});
  directions.push_back(vector<int> {0, -1});

  auto visited = vector< vector<int> > (h, vector<int> (w, invalid));

  auto q = queue< vector<int> >();
  for (int y = 0; y < h; y++) {
    for (int x = 0; x < w; x++) {
      if (input.at(y).at(x) == black) {
        q.push(vector<int> {x, y, 0});
      }
    }
  }

  while (!q.empty()) {
    auto d = q.front();
    q.pop();

    auto cx = d.at(0);
    auto cy = d.at(1);
    auto steps = d.at(2);

    if (visited.at(cy).at(cx) <= steps) {
      continue;
    }
    visited.at(cy).at(cx) = steps;
    operations = max(operations, steps);

    for (auto e : directions) {
      auto nx = cx + e.at(0);
      auto ny = cy + e.at(1);

      if (!isInArea(nx, ny, w, h)) {
        continue;
      }
      if (input.at(ny).at(nx) == black) {
        continue;
      }
      q.push(vector<int> {nx, ny, steps + 1});
    }
  }
  return operations;
}

void write(int output) {
  cout << output << endl;
}

bool isInArea(int x, int y, int w, int h) {
  return (0 <= x) && (x < w) && (0 <= y) && (y < h);
}

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

int main() {
    string s; cin >> s;
    bool playable = true;
    for (size_t i = 0, sz = s.size(); i < sz; ++i) {
        size_t idx = i + 1;
        if (s[i] == 'U' || s[i] == 'D' || (idx % 2 == 0 && s[i] == 'L') || (idx % 2 == 1 && s[i] == 'R')) {
            continue;
        } else {
            playable = false;
        }
    }

    cout << (playable ? "Yes" : "No") << endl;
}

Measured memory_bytes: 3132
from operator import itemgetter

n = int(input())
data = [()]*n
for i in range(n):
    x, l = map(int, input().split())
    data[i] = (x-l,x+l)
data.sort(key = itemgetter(1))
ans = 0
prev_r = -10**18
for l, r in data:
    if prev_r >  l:
      continue
    ans += 1
    prev_r = r

print(ans)


Measured memory_bytes: 18276
n = int(input())
*A, = map(int, input().split())
A.sort(reverse=1)

ans = 0
for i in range(n):
    for j in range(i+1, n):
        p = q = 0
        while p in [i, j]:
            p += 1
        while q in [i, j, p]:
            q += 1
        ans = max(ans, (A[p]+A[q])/(A[i]-A[j]))
print("%.6f" % ans)

Measured memory_bytes: 7800
l = list(map(int,input().split()))
l.sort()
a,b,c = l[0],l[1],l[2]
ans = 0
while a < c-1:
    a += 2
    ans += 1
while b < c-1:
    b += 2
    ans += 1
if a == c and b == c:
    print(ans)
elif a == c-1 and b == c-1:
    ans += 1
    print(ans)
else:
    ans += 2
    print(ans)

Measured memory_bytes: 3064
# import itertools
# import math
# import sys
# sys.setrecursionlimit(500*500)
# import numpy as np

H = int(input())
# S = input()
# n, *a = map(int, open(0))
# N, M = map(int, input().split())
# A = list(map(int, input().split()))
# B = list(map(int, input().split()))
# tree = [[] for _ in range(N + 1)]
# B_C = [list(map(int,input().split())) for _ in range(M)]
# S = input()

# B_C = sorted(B_C, reverse=True, key=lambda x:x[1])
# all_cases = list(itertools.permutations(P))
# a = list(itertools.combinations_with_replacement(range(1, M + 1), N))
# itertools.product((0,1), repeat=n)

# A = np.array(A)
# cum_A = np.cumsum(A)
# cum_A = np.insert(cum_A, 0, 0)

# def dfs(tree, s):
#     for l in tree[s]:
#         if depth[l[0]] == -1:
#             depth[l[0]] = depth[s] + l[1]
#             dfs(tree, l[0])
# dfs(tree, 1)

# def factorization(n):
#     arr = []
#     temp = n
#     for i in range(2, int(-(-n**0.5//1))+1):
#         if temp%i==0:
#             cnt=0
#             while temp%i==0:
#                 cnt+=1
#                 temp //= i
#             arr.append([i, cnt])
#     if temp!=1:
#         arr.append([temp, 1])
#     if arr==[]:
#         arr.append([n, 1])
#     return arr

cnt = 0
times = 1
while(H):
    cnt += times
    times *= 2
    H //= 2
    
print(cnt)

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

using namespace std;
typedef long long ll;

const int N = int(1e8) + 7;

void init(){

}

void solve(){
    int n, k;
    scanf("%d %d", &n, &k);
    long double chance = 0;
    for(int i = 1; i <= n; i++){
        if(i >= k){
            chance += (long double)(n-k+1);
            break;
        }
        long double p = 1;
        int h = i;
        while(h < k){
            h = h*2;
            p *= (long double)(1)/(long double)(2);
        }
        chance += p;
    }
    printf("%.10Lf", (long double)(1)/(long double)(n)*chance);
}

const bool mtc = false;

int main(){
    int t;
    if(mtc){
        scanf("%d", &t);
        while(t--) solve();
    }
    else solve();
}


Measured memory_bytes: 256
A = [list(map(int, input().split())) for _ in range(3)]
N = int(input())
B = [int(input()) for _ in range(N)]
flag = [[False]*3 for _ in range(3)]
for i in range(3):
    for j in range(3):
        if A[i][j] in B:
            flag[i][j] = True
ans = False
# 横
for a in flag:
    if all(a):
        ans = True
# 縦
for i in range(3):
    tmp = 0
    for j in range(3):
        if flag[j][i]:
            tmp += 1
    if tmp == 3:
        ans = True

# 斜めを見る
if flag[0][0] and flag[1][1] and flag[2][2]:
    ans = True
if flag[0][2] and flag[1][1] and flag[2][0]:
    ans = True

if ans:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define fi first
#define se second
using namespace std;
int main(){
	ll n,k;
	cin>>n>>k;
	ll a[n];
	for(int i=0;i<n;i++)cin>>a[i];
    ll i=0;
	for(int l=k;l<n;l++,i++){
			if(a[i]>=a[l])cout<<"No"<<endl;
			else cout<<"Yes"<<endl;
	}
}


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

int main() {
    int n;
    cin>>n;
    int a;
    vector<int> v;
    for (int i=0;i<n;i++) {
        cin>>a;
        if (i%2==0)
            v.push_back(a);
        else
            v.insert(v.begin(),a);
    }
    if (n%2)
        reverse(v.begin(),v.end());
    for (int x:v)
        cout<<x<<' ';
    cout<<endl;
    return 0;
}

Measured memory_bytes: 3060
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.IO.Pipes;
using System.Linq;
using System.Windows.Markup;

namespace AtCoder
{
	public class ABC
	{
		static public void Main(string[] args)
		{
			Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });
			Solve(args);
			Console.Out.Flush();
		}

		private const int mod = 1000000007;  // 10^9+7

		static public void Solve(string[] args)
		{
			//int n = int.Parse(Console.ReadLine());
			//string s = Console.ReadLine();
			string[] vs = Console.ReadLine().Split();
			//long x = long.Parse(Console.ReadLine());
			//int[] a = Console.ReadLine().Split().Select(int.Parse).ToArray();
			//long[] a = Console.ReadLine().Split().Select(long.Parse).ToArray();

			long a = long.Parse(vs[0]);
			long b = long.Parse(vs[1].Remove(1, 1));

			long ans = a * b / 100;
			Console.WriteLine(ans);

		}
	}
}


Measured memory_bytes: 27372