akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>                
using namespace std;
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); i++)
#define rep1(i,n) for(int i = 0; i <= (n); i++) 
#define repm(i,n) for(int i = (n)-1; i >= 0; i--)
int n, answer;
void dfs(long long num, bool seven, bool five, bool three)
{
	if(num <= n){ 
		if(seven && five && three)answer++;
	}else return;
	
	dfs(num * 10 + 7, true, five, three);
	dfs(num * 10 + 5, seven, true, three);
	dfs(num * 10 + 3, seven, five, true);

}
int main(void){
	cin >> n;

	dfs(0, false, false, false);

	cout << answer << endl;
}


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

#define M (long)1e9+7

int main(){
    int n, a, ans = 1;cin >> n;
    vector<int> cnt(n,0);//cnt[i] := 人数の差の絶対値がi人といった人の数
    for(int i=0;i<n;i++){
        cin >> a;
        if(a >= n){goto err;}
        cnt[a]++;
    }

    for (int i = n-1; i >= 1; i-=2) {
        if(cnt[i] != 2) goto err;
        ans *= 2;
        ans %= M;
    }

    cout << ans  << endl;
    return 0;

    err:
        cout << 0 << endl;

}

Measured memory_bytes: 640
/**
 *   @FileName	a.cpp
 *   @Author	kanpurin
 *   @Created	2020.09.13 19:41:39
**/

#include "bits/stdc++.h" 
using namespace std; 
typedef long long ll;

#include <atcoder/all>
template< int MOD >
struct mint {
public:
    long long x;
    mint(long long x = 0) :x((x%MOD+MOD)%MOD) {}
    mint(std::string &s) {
        long long z = 0;
        for (int i = 0; i < s.size(); i++) {
            z *= 10;
            z += s[i] - '0';
            z %= MOD;
        }
        this->x = z;
    }
    mint& operator+=(const mint &a) {
        if ((x += a.x) >= MOD) x -= MOD;
        return *this;
    }
    mint& operator-=(const mint &a) {
        if ((x += MOD - a.x) >= MOD) x -= MOD;
        return *this;
    }
    mint& operator*=(const mint &a) {
        (x *= a.x) %= MOD;
        return *this;
    }
    mint& operator/=(const mint &a) {
        long long n = MOD - 2;
        mint u = 1, b = a;
        while (n > 0) {
            if (n & 1) {
                u *= b;
            }
            b *= b;
            n >>= 1;
        }
        return *this *= u;
    }
    mint operator+(const mint &a) const {
        mint res(*this);
        return res += a;
    }
    mint operator-() const {return mint() -= *this; }
    mint operator-(const mint &a) const {
        mint res(*this);
        return res -= a;
    }
    mint operator*(const mint &a) const {
        mint res(*this);
        return res *= a;
    }
    mint operator/(const mint &a) const {
        mint res(*this);
        return res /= a;
    }
    friend std::ostream& operator<<(std::ostream &os, const mint &n) {
        return os << n.x;
    }
    friend std::istream &operator>>(std::istream &is, mint &n) {
        long long x;
        is >> x;
        n = mint(x);
        return is;
    }
    bool operator==(const mint &a) const {
        return this->x == a.x;
    }
    mint pow(long long k) const {
        mint ret = 1;
        mint p = this->x;
        while (k > 0) {
            if (k & 1) {
                ret *= p;
            }
            p *= p;
            k >>= 1;
        }
        return ret;
    }
};
const int MOD = 998244353;
struct S {
    mint<MOD> a;
    int size;
    
};
struct F {
    mint<MOD> a,b;
    
};
S op(S l, S r) { return S{l.a + r.a, l.size + r.size}; }
S e() { return S{0, 0}; }
S mapping(F l, S r) { return S{r.a * l.a + l.b * r.size, r.size}; }
F composition(F l, F r) { return F{r.a * l.a, r.b * l.a + l.b}; }
F id() { return F{1, 0}; }
int main() {
    int n,q;cin >> n >> q;
    vector<S> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i].a;
        a[i].size = 1;
    }
    atcoder::lazy_segtree<S,op,e,F,mapping,composition,id> seg(a);
    while(q--) {
        int t;cin >> t;
        if (t == 0) {
            int l, r;
            int c, d;
            scanf("%d %d %d %d", &l, &r, &c, &d);
            seg.apply(l, r, F{c, d});
        }
        else {
            int l, r;
            scanf("%d %d", &l, &r);
            cout << seg.prod(l,r).a << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 35776
N,K=list(map(int, input().split()))
h=list(map(int, input().split()))
 
 
dp=[0]+[float("inf")]*(N-1)
 
 
for i in range(N-1):
    for j in range(i,i+K):
        if j+1>N-1:
            break
        dp[j+1]=min(abs(h[j+1]-h[i])+dp[i],dp[j+1])
    
 
print(dp[-1])

Measured memory_bytes: 55392
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <vector>
using namespace std;

const int kMaxn = 1e6 + 5;
const int MOD = 1e9 + 7;
int T, N, M, K;
vector<int> fac[kMaxn];
int buck[kMaxn];
int gcd(int a, int b) { return (!b) ? a : gcd(b, a % b); }

int main() {
  //
  scanf("%d", &N);
  M = 1e6;
  for (int i = 2; i <= M; i++)
    for (int j = i; j <= M; j += i) fac[j].push_back(i);
  int d;
  bool flag = true;
  for (int i = 1; i <= N; i++) {
    int x;
    scanf("%d", &x);
    if (i == 1)
      d = x;
    else
      d = gcd(d, x);
    if (flag) {
      for (int v : fac[x]) {
        buck[v]++;
        if (buck[v] > 1) flag = false;
      }
    }
  }
  if (flag)
    printf("pairwise coprime\n");
  else if (d == 1)
    printf("setwise coprime\n");
  else
    printf("not coprime");
  return 0;
}

Measured memory_bytes: 117400
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(n); ++i)
#define rrep(i,n) for(int i=1; i<=(n); ++i)
#define drep(i,n) for(int i=(n)-1; i>=0; --i)
#define srep(i,s,t) for (int i=s; i<t; ++i)
#define pb push_back
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
const int INF = 1001001001;
using P = pair<int,int>;

// From here.
int main(void) {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  if(n%10==2 || n%10==4|| n%10==5||n%10==7||n%10==9) {
    cout << "hon" << endl;
  } else if (n%10==0 || n%10==1 || n%10==6||n%10==8) {
    cout << "pon" << endl;
  } else if (n%10==3) {
    cout << "bon" <<endl;
  }
  return 0;
}
  

Measured memory_bytes: 3652
#include <iostream>

using namespace std;

int main() {
    int n, m;
    cin >> n >> m;
    int A[n][m] ,B[m];
    int sum = 0;
    int result[n];
    for(int i = 0; i < n; i++) {
        result[i] = 0;
    }

    for(int i = 0; i < n; i++) {
        for(int j = 0; j < m; j++) {
            cin >> A[i][j];
        }
    }
    for(int i = 0; i < m; i++) cin >> B[i];

    for(int i = 0; i < n; i++) {
        for(int j = 0; j < m; j++) {
            sum = A[i][j]*B[j];
            // cout << "sumの結果" << sum << endl;
            result[i] += sum;
        }
        // cout << "for文内のresult結果" << result[i] << endl;
    }

    for(int i = 0; i < n; i++) {
        cout << result[i] << endl;
    }

    // for(int i = 0; i < n; i++) {
    //     for(int j = 0; j < m; j++) {
    //         cout << A[i][j];
    //     }
    //     cout << endl;
    // }
    // for(int i = 0; i < m; i++) cout << B[i];

    return 0;
}


Measured memory_bytes: 3124
main = do
  s <- getLine
  let [m,n] = map (read::String->Int) . words $ s

  s <- getContents
  let x = (map (map (read::String->Int) . words)  . lines) s
  let y = splitAt m x
  let a = fst y
  let b = (concat . snd) y
      
  mapM_ print $ mulMat a b

mulMat :: [[Int]] -> [Int] -> [Int]
mulMat a b = 
  map (sum . (zipWith (*) b)) a

Measured memory_bytes: 7364
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <vector>
using namespace std;
typedef long long ll;
ll const INF = 1LL << 60;

int main() {
  string s;
  cin >> s;
  string target = "AKIHABARA";
  if (s.length() > target.length()) {
    cout << "NO" << endl;
    return 0;
  }
  if (s == target) {
    cout << "YES" << endl;
    return 0;
  }
  if (s.length() == target.length() && s != target) {
    cout << "NO" << endl;
    return 0;
  }
  set<string> str_set = {"KIHBR",    "AKIHBR",  "KIHABR",  "KIHBAR",
                         "KIHBRA",   "AKIHABR", "AKIHBAR", "AKIHBRA",
                         "KIHABAR",  "KIHABRA", "KIHBARA", "AKIHABAR",
                         "AKIHABRA", "KIHABARA"};
  if (str_set.find(s) != str_set.end())
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
  return 0;
}

Measured memory_bytes: 3624
//#include <tourist>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = 1e9;
const ll LINF = ll(1e18);
const int MOD = 1000000007;
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define rep(i, n) for (int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define debug(v)          \
    cout << #v << ":";    \
    for (auto x : v)      \
    {                     \
        cout << x << ' '; \
    }                     \
    cout << endl;
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;
}
//cout<<fixed<<setprecision(15);有効数字15桁
//-std=c++14
//-std=gnu++17
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
ll n;
vector<ll> a;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        ll temp;
        cin >> temp;
        temp--;
        a.push_back(temp);
    }
    int now=0;
    int count=0;
    rep(i,n){
        count++;
        now=a[now];
        if(now==1)return cout<<count<<"\n",0;;
    }
    cout<<-1<<"\n";
}


Measured memory_bytes: 1400
//15:36:00 start

#include <bits/stdc++.h>
#define For(i,a,b) for(int i=a;i<=b;i++)
#define F first
#define S second
#define all(x) x.begin(),x.end()
#define sz(x) ((int)x.size())
#define int ll
using namespace  std;
using ll=long long;
using pii=pair<int,int>;

int32_t main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	string s; cin>>s;
	int ans=0;
	for(auto i:s)
	{
		ans+=(i=='+'?1:-1);
	}
	cout<<ans<<"\n";
	return 0;
}








Measured memory_bytes: 256
#include<iostream>
#include<set>
#include<algorithm>
#include<vector>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<queue>
#include<map>

using namespace std;

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll, ll> pll;
typedef double db;
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define mp make_pair
#define case_for(n) for(int i = 1 ; i <= n ; i ++) { cout<<"Case "<<i<<": "<<endl; solve();}
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll power(ll a, ll b, ll p) { ll ans = 1; while (b) { if (b & 1) ans = ans * a % p; a = a * a % p, b /= 2; }return ans; }
//int hw_check(string a, int l, int r) { int ans = r - l + 1; for (l, r; l < r; l++, r--)if (a[l] != a[r]) return 0; return ans; }
string movesubstr(string a, int l, int r) { string s = "";	for (int i = l; i <= r; i++) s.push_back(a[i]);	return s; }

const int N = 2e5 + 15;
int a[N], b[N], c[N];
map<int, int>bs;

ll solve(int i,int j)
{
	ll ans = 1;
	for (int k = 0; k < j; k++)  ans *= i;
	return ans;
}
	
/*
3 3
3 3 3
4 1 3
4 1 3
*/
int main()
{
	std::ios::sync_with_stdio(false);
	cin.tie(nullptr),cout.tie(0);

	/*int t; cin >> t;
	while (t--) 
	{
		solve();
	}*/
	ll n; cin >> n;
	ll res = 100;
	int ans = 0;
	while (res < n)
	{
		res += res * 0.01;
		ans++;
	}
	cout << ans << endl;
	return 0;
}
/*

*/

Measured memory_bytes: 3628
Imports System

Public Class Test
	Public Shared Sub Main()
        Dim s() As String
        s = Split(Console.ReadLine())
        Dim x, y, z As Integer
        Dim n As Integer
        x = s(0)
        y = s(1)
        z = s(2)
        n = (x - z) \ (y + z)
        Console.WriteLine(n)
	End Sub
End Class

Measured memory_bytes: 13408
<?php
$line = readline();
readline_add_history($line);
$inputs = explode(" ", $line);
$a = intval($inputs[0]);
$b = intval($inputs[1]);
$c = intval($inputs[2]);
function swap(&$a, &$b) {
	$t = $a;
	$a = $b;
	$b = $t;
}
if ($a > $b) {
	swap($a, $b);
}
if ($a > $c) {
	swap($a, $c);
}
if ($b > $c) {
	swap($b, $c);
}
echo "{$a} {$b} {$c}";
?>

Measured memory_bytes: 6576
#include<iostream>
#include<set>
#include <bitset>
#include<queue>
#include<vector>
#include<map>
#include<stack>
#include <cstdio>
#include<algorithm>
#include <sstream>
#include<string>
#include<string.h>
#include <cmath>
#include <iomanip>
#include <string>
#include<list>
#include <limits>
#include <numeric>
#include <type_traits>
#define int long long
#define ll long long
#define mod  1000000007
#define inf 1e17
#define rep(i,j,n) for(int i=j;i<n;i++)
#define P pair<int,int>
#define ps push_back
double pi = 3.141592653589793;
using namespace std;
int z=0;
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}
//ここから始めよう
vector<int>v,s;
signed main(){
    int n;cin>>n;
    int a;
    int v[114514]={};//偶数の個数カウント
    int s[114514]={};//奇数の個数カウント
    rep(i,0,n){
        cin>>a;
        if(i%2==0)v[a-1]++;
        else s[a-1]++;
    }
    int same_maxi=-1;
    rep(i,0,114000){
        same_maxi=max(same_maxi,v[i]+s[i]);
    }
    sort(v,v+114500,greater<int>());
    sort(s,s+114500,greater<int>());
    //cout<<v[0]<<" "<<v[1]<<" "<<s[0]<<" "<<s[1]<<endl;
    if(same_maxi!=v[0]+s[0])cout<<n-(v[0]+s[0])<<endl;
    else {
        int rmaxi=max(v[1]+s[0],s[1]+v[0]);
        cout<<n-rmaxi<<endl;
    }
    return 0;
}

Measured memory_bytes: 2048
#include<iostream>
#include<string>
int main() {
	std::string s;
	std::cin >> s;
	int n = 0;
	if (s[0] == '1') n++;
	if (s[1] == '1') n++;
	if (s[2] == '1') n++;
	std::cout << n << std::endl;
	return 0;
}

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

int cmpfunc(const void*a, const void*b){
    return(*(int*)a-*(int*)b);}
int main(){

    int n,i,c=0,k=0,j,m[100000]={0};
    scanf("%ld",&n);
    long long int a[n];

    for(i=0;i<n;i++)
        scanf("%lld",&a[i]);

    qsort(a, n, sizeof(long long int),cmpfunc);

    for(i=0;i<n;i++){
        if(a[i]==a[i+1]){
            m[k]++;}
        else
            k++;}
    for(i=0;i<k;i++){
        if(m[i]%2==0)c++;
        else if(k==n){
        c=k;
        break;}}
    printf("%ld",c);}


Measured memory_bytes: 3360
h = {}
primes = [2, 3, 5]
position = [0, 0, 0]
numbers = [1]
n_numbers = Array.new(1_000_001, 0)
n_numbers[1] = 1
while numbers.last < 1_000_000
	primes.each_with_index{|prime, i| position[i] += 1 while h[numbers[position[i]] * prime]}
	min = [numbers[position[0]] * primes[0], numbers[position[1]] * primes[1], numbers[position[2]] * primes[2]].min
	numbers << min
	h[min] = true
	n_numbers[min] = 1
end
1.upto(1_000_000){|i| n_numbers[i] += n_numbers[i - 1]}

while true
    m, n = gets.chomp.split.map(&:to_i)
    break if m == 0
    puts n_numbers[n] - n_numbers[m - 1]
end


Measured memory_bytes: 14692
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <stack>
#include <numeric>
#include <algorithm>
#include <tuple>
#include <stdio.h>
#include <bitset>
#include <limits.h>
#include <complex>
#include <deque>
#include <iomanip>
#include <list>
using namespace std;
#define pi pair<int32,int32>
#define pl pair<int64,int64>
#define chmax(a,b) (a<b ? a=b:0)
#define chmin(a,b) (a>b ? a=b:0)
#define en cout << endl //セミコロンつけろ
//#define MM 1000000000
//#define MOD MM+7
const int MM = 1e9;
const int MOD = MM+7;
const long double PI = acos(-1);
const long long INF = 1e15;
int dx[8] = {-1,0,1,0,-1,-1,1,1};
int dy[8] = {0,-1,0,1,-1,1,1,-1};
// 'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122
template<typename T>
T GCD(T u,T v){
    return v ? GCD(v,u%v) : u;
}
template<typename T>
T LCM(T x,T y){
    T gc = GCD(x,y);
    return x*y/gc;
}


int main(){
    long long N,M; cin >> N >> M;
    vector<pair<long long,long long> > p(0);
    for(int i = 0; i < N; i++){
        long long a,b; cin >> a >> b;
        p.push_back({a,b});
    }
    sort(p.begin(),p.end());
    long long ans = 0;
    long long m = M;
    for(int i = 0; i < N; i++){
        if (m > p[i].second){
            ans += p[i].first * p[i].second;
            m -= p[i].second;
        } else {
            ans += m*p[i].first;
            m = 0;
            break;
        }
    }
    cout << ans << endl;
}

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

int main() {
  int H, W;
  cin >> H >>W;
  vector<vector<char>> v(H,vector<char>(W) );
  
  for(int i=0; i<H; i++){
    for(int j=0; j<W; j++){
      cin >> v[i][j];
    }
  }
  
  for(int i=0; i<H; i++){
    for(int j=0; j<W; j++){
      int t=0;
      if(v[i][j] == '.'){
        if(j!=0 && v[i][j-1]=='#')
          t++;
        if(j!=0 && i!=0 && v[i-1][j-1]=='#')
          t++;
        if(j!=0 && (i+1)!=H && v[i+1][j-1]=='#')
          t++;
        if(i!=0 && v[i-1][j]=='#')  t++;
        if((i+1)!=H && v[i+1][j]=='#')  t++;
        if((j+1)!=W){
          if(i!=0 &&v[i-1][j+1]=='#')  t++;
          if(v[i][j+1]=='#')  t++;
          if((i+1)!=H &&v[i+1][j+1]=='#')  t++;
        }
        v[i][j] = t+'0';
      }
      
    }
  }
  for(int i=0; i<H; i++){
    for(int j=0; j<W; j++){
      cout << v[i][j];
    }
    cout <<endl;
  }
}

Measured memory_bytes: 256
n=int(input())
l=list(map(int,input().split()))
ans=0
d=dict()
for i in range(n):
    tar=i+1-l[i]
    if tar in d:
        ans+=d[tar]
    tar1=i+1+l[i]
    if tar1 in d:
        d[tar1]+=1
    else:
        d.update({tar1:1})
print(ans)

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

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

const int INF=1e9;
const int MOD=1e9+7;

int main(){
    int N,X,T;
    cin >> N >> X >> T;
    cout << ((N+X-1)/X)*T << endl;
}

Measured memory_bytes: 3612
import sys
sys.setrecursionlimit(2 * 10**5)
mod = 10 ** 9 + 7


def rec(v, p, color, graph, memo):
    if memo[v][color] != -1:
        return memo[v][color]
    ret = 1
    for c in graph[v]:
        if c == p:
            continue
        if color == 0:
            ret *= rec(c, v, 0, graph, memo) + rec(c, v, 1, graph, memo)
        else:
            ret *= rec(c, v, 0, graph, memo)
        ret %= mod
    memo[v][color] = ret
    return ret


def main():
    N = int(input())
    graph = [[] for _ in range(N)]
    for _ in range(N-1):
        x, y = map(int, input().split())
        x, y = x-1, y-1
        graph[x].append(y)
        graph[y].append(x)
    memo = [[-1, -1] for _ in range(N)]
    print((rec(0, -1, 0, graph, memo) + rec(0, -1, 1, graph, memo)) % mod)


if __name__ == '__main__':
    main()


Measured memory_bytes: 114212
#include <iostream>
#include <string>
#include <vector>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
#define rop(i,n) for(int i=1;i<n+1;i++)

using namespace std;
using std::swap;

vector<long long int> p;
vector<long long int> q;



int main() {
	int n,ans = 0;
	int t[3];
	cin >> n;
	p.resize(n);
	rep(i, n)cin >> p[i];
	sort(p.begin(), p.end());
	rep(i, n - 2) {
		for (int j = i + 1; j < n - 1; ++j) {
			for (int k = j + 1; k < n; ++k) {
				if (p[k] >= p[i] + p[j])break;
				++ans;
			}
		}
	}
	cout << ans << "\n";
	return 0;

}

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

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

#define FOR(i, n, m) for (ll(i) = (m); (i) < (n); ++(i))
#define REP(i, n) FOR(i, n, 0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll)1e15;

int main()
{
    string S;
    cin >> S;
    bool C[3] = {false, false, false};
    REP(i, S.length())
    {
        C[S[i] - 'a'] = true;
    }
    REP(i, 3)
    {
        if (!C[i])
        {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <boost/multiprecision/cpp_int.hpp>
#include <cmath>
#include <deque>
#include <iostream>
#include <queue>
#include <string>
#include <vector>

using namespace std;
using ll = long long;
namespace mp = boost::multiprecision;
using mpint = mp::cpp_int;  // 多倍長整数（任意精度）

/*
 * 定数
 */
const long double PI = (acos(-1));
const long double EPS = 1e-10;
const long long INF = 1e18;

/*
 * データ変換 
 */
/* char -> int */
int ctoi(char c) { return (int)(c - '0'); }

/*
 * 数学的な計算
 */
/* 階乗 */
int factorial(int n) {
  int ret = 1;
  for (int i = 1; i < n + 1; ++i) {
    ret = ret * i;
  }
  return ret;
}

/* 最大公約数 */
template <typename T>
T gcd(T x, T y) { return x % y == 0 ? y : gcd(y, x % y); }

/* 最小公倍数 */
template <typename T>
T lcm(T a, T b) { return a * b / gcd(a, b); }

/* n個の整数の最小公倍数 */
template <typename T>
T lcm_n(vector<T> &numbers) {
  T l;
  l = numbers[0];
  for (int i = 1; i < numbers.size(); ++i) {
    l = lcm(l, numbers[i]);
  }
  return l;
}

/*
 * DP向け
 */
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;
}

/*
 * グラフ
 */
class Graph {
 public:
  vector<vector<int>> G;
  vector<int> Trans;
  vector<int> inDeg;
  int numV;

  Graph(int numV) {
    this->numV = numV;
    inDeg.assign(numV, 0);
    Trans.assign(numV, 0);
    G.assign(numV, vector<int>());
  }

  int topologicalSort(int v, vector<int> &dp) {
    if (dp[v] != -1) {
      return dp[v];
    }

    int res = 0;

    for (auto to : G[v]) {
      chmax(res, topologicalSort(to, dp) + 1);
    }

    return dp[v] = res;
  }
};

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

  ll ans = (N / K) * (N / K) * (N / K);

  if (K % 2 == 0) {
    ll tmp = 0;
    for (ll i = K / 2; i <= N; i += K) {
      ++tmp;
    }
    ans += tmp * tmp * tmp;
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
# div2019D - DivRem Number
def divisors(n: int) -> set:
    # Compute divisors of a number.
    divs = set()
    for i in range(1, int(n ** 0.5) + 1):
        if n % i == 0:
            divs.add(i)
            divs.add(n // i)
    return divs


def main():
    N = int(input())
    divs = divisors(N)
    ans = 0
    for m in divs:
        if m == 1:
            continue
        m -= 1
        if N // m == N % m:
            ans += m
    print(ans)


if __name__ == "__main__":
    main()

Measured memory_bytes: 3828
//#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <queue>

using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<n;++i)
#define mod (ll)(1e9+7)
#define FIX(a) ((a)%mod+mod)%mod
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define fi first
#define se second
#define pb push_back
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int ab=0;
    int a=0;
    int b=0;
    int n;
    cin >> n;
    int ans = 0;
    REP(i,n){
        string s;
        cin >> s;
        int l = s.length();
        if(s[0]=='B'){
            if(s[l-1]=='A'){
                ab++;
            }else{
                b++;
            }
        }else if(s[l-1]=='A'){
            a++;
        }
        REP(j,l-1){
            if(s[j]=='A'&&s[j+1]=='B'){
                ans++;
            }
        }
    }
    ans+=min(a,b);
    if(ab>0){
        ans+=ab-1;
        if(min(a,b)>0){
            ans+=1;
        }else if(a>0||b>0){
            ans+=1;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		try (Scanner sc = new Scanner(System.in)) {
			long coin = sc.nextLong();
			long happy = 0;
			happy += coin / 500 * 1000;
			happy += coin % 500 / 5 * 5;
			System.out.println(happy);
		}
	}
}

Measured memory_bytes: 21844
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
typedef long long ll;


int main(void){
  int h,w,i,j,k,su;
  const int di[4]={1,0,-1,0},dj[4]={0,1,0,-1};
  string s[53];
  bool pos=true;
  
  cin >> h >> w;
  
  for (i=0;i<h;i++) cin >> s[i];
  
  for (i=0;i<h;i++) for (j=0;j<w;j++){
    if (s[i][j]=='.') continue;
    su=0;
    for (k=0;k<4;k++){
      int ni,nj;
      ni=i+di[k];
      nj=j+dj[k];
      if (ni>=0 && ni<h && nj>=0 && nj<w && s[ni][nj]=='#'){
        su++;
      }
    }
    if (su==0) pos=false;
  }
  
  if (pos) cout << "Yes" << endl;
  else cout << "No" << endl;
  
  return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {

    public static void main(String args[]) {

        // 入力
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int k = Integer.parseInt(sc.next());
        int s = Integer.parseInt(sc.next());
        sc.close();

        // 主処理
        String[] nums = new String[n];
        if (k <= n) {
            for (int i = 0; i < n; i++) {
                if (i < k) {
                    nums[i] = Integer.toString(s);
                } else {
                    nums[i] = s != 1000000000 ? Integer.toString(s + 1) : "1";
                }
            }
        } else if (k <= (n - 1) * 2) {
            int diff = k - n;
            nums[0] = Integer.toString(s);
            for (int i = 1; i < n; i++) {
                if (0 < diff) {
                    nums[i] = Integer.toString(0);
                    diff--;
                } else {
                    nums[i] = Integer.toString(s);
                }
            }
        } else {
            List<Integer> list = new ArrayList<>();
            for (int i = 0; i <= n / 2; i++) {
                list.add((n - i) * (i + 1) + 1);
            }
            int index = list.indexOf(k);
            for (int i = 0; i < n; i++) {
                if (index == i) {
                    nums[i] = Integer.toString(s);
                } else {
                    nums[i] = Integer.toString(0);
                }
            }
        }

        String result = String.join(" ", nums);

        // 出力
        System.out.println(result);
    }
}


Measured memory_bytes: 38700
let n = read_int ();;
let rec play i t h = match i with
    0 -> Printf.printf "%d %d\n" t h
  | i -> ( match Scanf.scanf "%s %s\n" (fun x y -> compare x y) with
       0 -> play (i-1) (t+1) (h+1)
     | 1 -> play (i-1) (t+3) h
     | -1 -> play (i-1) t (h+3)
     | _ -> play (i-1) t h )
    in play n 0 0;;

Measured memory_bytes: 2660
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define P pair<int,int>
#define int long long
#define mod (int)(1e9+7)
#define inf (int)(3e18)
#define all(v) v.begin(),v.end()
using namespace std;

template<class T> inline void chmax(T& a, T b) { a = std::max(a, b); }
template<class T> inline void chmin(T& a, T b) { a = std::min(a, b); }

string s;
int le[26][2000005],ri[26][200005];
int cnt[26],cnt2[26];
struct BIT{
	int n;
	vector<int>bit;
	BIT(int x){
		n=x;
		bit.resize(n+1,0);
	}
	void add(int x,int y){
		while(x<=n){
			bit[x]+=y;
			x+=x&-x;
		}
	}
	int sum(int x){
		int res=0;
		while(x>0){
			res+=bit[x];
			x-=x&-x;
		}
		return res;
	}
};
int rimemo[200005];
signed main() {
	cin>>s;
	rep(i,s.size()){
		le[s[i]-'a'][cnt[s[i]-'a']]=i;
		cnt[s[i]-'a']++;
	}
	for(int i=s.size()-1;i>=0;i--){
		ri[s[i]-'a'][cnt2[s[i]-'a']]=i;
		cnt2[s[i]-'a']++;
	}
	int ki=-1;
	rep(i,26){
		if(cnt[i]%2){
			if(ki==-1)ki=i;
			else {
				cout<<-1<<endl;return 0;
			}
		}
	}
	vector<P>v;

	int ans=0;

	int center=-1;
	rep(i,26){
		rep(j,cnt[i]/2){
			v.push_back({le[i][j],1});
			v.push_back({ri[i][j],-1});
			rimemo[ri[i][j]]=le[i][j];
		}
		if(cnt[i]%2){
			center=le[i][cnt[i]/2];
		}
	}
	sort(all(v));
	int memo=0;

	BIT bit(200005);

	rep(i,v.size()){
		if(v[i].second==-1){
			memo++;
			ans+=bit.sum(rimemo[v[i].first]+1);
			bit.add(rimemo[v[i].first]+1,1);
		}
		else ans+=memo;
		if(center!=-1){
			if(v[i].second==1&&v[i].first>center)ans++;
			if(v[i].second==-1&&v[i].first<center)ans++;
		}
	}
	cout<<ans<<endl;
}


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

typedef struct{
  int id;
  int left;
  int right;
  int parent;
  int sibling;
}Node;

Node *T;

int degree(int);
int depth(int);
int height(int);

int d = 0;

int main(){
  int i, n, id;
  char s[20];

  scanf("%d", &n);

  T = malloc(sizeof(Node)*n);

  //initialize
  for(i = 0; i < n; i++){
    T[i].parent = -1;
    T[i].sibling = -1;
  }

  for(i = 0; i < n; i++){
    scanf("%d", &id);
    T[id].id = id;

    scanf("%d%d", &T[id].left, &T[id].right);
    T[T[id].left].parent = id;
    T[T[id].right].parent = id;
    T[T[id].left].sibling = T[id].right;
    T[T[id].right].sibling = T[id].left;
  }

  for(i = 0; i < n; i++){
    if(T[i].parent == -1) strcpy(s, "root");
    else if(T[i].left == -1 && T[i].right == -1) strcpy(s, "leaf");
    else strcpy(s,"internal node");
    printf("node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d, %s\n", i, T[i].parent, T[i].sibling, degree(i), depth(i), height(i), s);
    d = 0;
  }
  return 0;
}

int degree(int i){
  int deg = 0;

  if(T[i].left != -1) deg++;
  if(T[i].right != -1) deg++;
  return deg;
}

int depth(int i){
  if(T[i].parent == -1) return d;
  else{
    d++;
    return depth(T[i].parent);
  }
}

int height(int i){
  int lef = 0, rig = 0;

  if(T[i].left != -1){
    lef++;
    lef += height(T[i].left);
  }

  if(T[i].right != -1){
    rig++;
    rig += height(T[i].right);
  }

  if(rig >= lef) return rig;
  else return lef;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
#define pb push_back
typedef long long ll;
typedef long double la;
using namespace std;

int main(){
    ll n,k,s,a;
    cin >> n >> k;
    if(n>k)s = n%k;
    else{
        a = abs(n-k);
        if(a < n){
            cout << a << endl;
            return 0;
        }else{
            cout << n << endl;
            return 0;
        }
    }
    a = s;
    a = abs(a-k);
    if(a < s){
        cout << a << endl;
        return 0;
    }else{
        cout << s << endl;
        return 0;
    }
}

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

int main(){
    int ans=0;
    int n,MAX=0;
    cin >> n;
    int data;
    map <int,int> m;

    for (int i = 0; i < n; i++){
        
        cin >> data;

        if(m.find(data)!=m.end()){
            ans++;
        }else{
            int div=0;
            for (int i = 2; i <= sqrt(data); i++){
                if(data%i==0){
                    div++;
                }
            }
            if(div==0 && data!=1){
                ans++;
                m[data]=1;
            }
        }
    }
    

    //cout <<fixed<<setprecision(16)<< << endl;
    cout << ans << endl;

    //if(flag==1)cout << "Yes" <<endl;
    //else cout << "No" <<endl;
    
    return 0;
}



Measured memory_bytes: 3092
n = gets.strip.to_i
steps = gets.strip.split(' ').map(&:to_i)

costs = [0, (steps[0]-steps[1]).abs]

(2...n).each do |i|
  costs[i] = [costs[i-1] + (steps[i] - steps[i-1]).abs, 
    costs[i-2] + (steps[i] - steps[i-2]).abs].min
end

puts costs[n-1]

Measured memory_bytes: 11908
void main()
{
    long n, k;
    rdVals(n, k);
    long[] a = rdRow;

    long[] b = new long[n+1];
    foreach (i, x; a)
    {
        b[i+1] = b[i] + x;
    }

    long[] list = new long[n*(n+1)>>1];
    long idx;
    foreach (i; 0 .. n)
    {
        foreach (j; i .. n)
        {
            list[idx++] = b[j+1] - b[i];
        }
    }

    long result;
    foreach_reverse (i; 0 .. 41)
    {
        long num = 1L << i;
        long cnt;
        foreach (l; list)
        {
            if (((result | num) & l) == (result | num)) ++cnt;
        }
        if (cnt >= k) result |= num;
    }

    result.writeln;
}

enum long mod = 10^^9 + 7;
enum long inf = 1L << 60;

T rdElem(T = long)()
if (!is(T == struct))
{
    return readln.chomp.to!T;
}

alias rdStr = rdElem!string;
alias rdDchar = rdElem!(dchar[]);

T rdElem(T)()
if (is(T == struct))
{
    T result;
    string[] input = rdRow!string;
    assert(T.tupleof.length == input.length);
    foreach (i, ref x; result.tupleof)
    {
        x = input[i].to!(typeof(x));
    }
    return result;
}

T[] rdRow(T = long)()
{
    return readln.split.to!(T[]);
}

T[] rdCol(T = long)(long col)
{
    return iota(col).map!(x => rdElem!T).array;
}

T[][] rdMat(T = long)(long col)
{
    return iota(col).map!(x => rdRow!T).array;
}

void rdVals(T...)(ref T data)
{
    string[] input = rdRow!string;
    assert(data.length == input.length);
    foreach (i, ref x; data)
    {
        x = input[i].to!(typeof(x));
    }
}

void wrMat(T = long)(T[][] mat)
{
    foreach (row; mat)
    {
        foreach (j, compo; row)
        {
            compo.write;
            if (j == row.length - 1) writeln;
            else " ".write;
        }
    }
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.mathspecial;
import std.traits;
import std.container;
import std.functional;
import std.typecons;
import std.ascii;
import std.uni;
import core.bitop;

Measured memory_bytes: 4348
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
	    Scanner sc = new Scanner(System.in);
		int x,y,i=0,j=0;
		
		while(true){
			x = sc.nextInt();
			y = sc.nextInt();
			if(x == 0){
				sc.close();
				System.exit(0);
			}
			else{
				for(i=0;i<x;i++){
				    if(i%2 == 0){
				    	for(j=0;j<y;j++){
				    	    if(j%2 == 0){
				    		    System.out.print('#');
				    	    }
				    	    else{
				    	        System.out.print('.');
				    	    }
				    	}
				    }
				    else{
				    	for(j=0;j<y;j++){
				    		if(j%2 == 0){
				    			System.out.print('.');
				    		}
				    		else{
				    			System.out.print('#');
				    		}
				    	}
				    }
				    System.out.println();
				}
			}
			System.out.println();
		}
	}
}


Measured memory_bytes: 38208
# coding: utf-8


def solve(*args: str) -> str:
    t = int(args[0])
    ret = []
    for i in range(1, 3*t+1, 3):
        n = int(args[i])
        A = tuple(map(int, args[i+1].split()))
        S = tuple(map(int, tuple(args[i+2])))

        ans = False
        dp = [0]*(max(A).bit_length()+1)
        for a, s in reversed(tuple(zip(A, S))):
            m = a.bit_length()
            if s == 0:
                while 0 < a and 0 < dp[m]:
                    a ^= dp[m]
                    m = a.bit_length()
                if 0 < a:
                    dp[m] = a
            elif s == 1:
                while 0 < a:
                    if 0 < dp[m]:
                        a ^= dp[m]
                        m = a.bit_length()
                    else:
                        ans = True
                        break

        ret.append(1*ans)

    return '\n'.join(map(str, ret))


if __name__ == "__main__":
    print(solve(*(open(0).read().splitlines())))


Measured memory_bytes: 9812
#include <iostream>
#include <string>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <queue>
#include <stack>
#include <iomanip>


using namespace std;

#define REP(i, n) for(ll i = 0;i < n;i++)
#define REPR(i, n) for(ll i = n;i >= 0;i--)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define REPO(i, n) for(ll i = 1;i <= n;i++)
#define ll long long
#define INF (ll)1 << 60
#define MINF (-1 * INF)
#define ALL(n) n.begin(),n.end()
#define MOD (ll)1000000007
#define P pair<ll, ll>

double a, b, x;

double r(double a) {
	return a * 180 / acos(-1);
}
int main() {
	cin >> a >> b >> x;
	if (x >= a * a * b / 2)cout << fixed << setprecision(10) << r(atan2(2 * b - 2 * x / (a * a), a)) << endl;
	else cout << fixed << setprecision(10) << r(atan2(b, 2 * x / (a * b))) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
typedef long long ll;
#define _GLIBCXX_DEBUG
typedef vector<int> vec;
typedef vector<ll> lvec;
typedef vector<char> cvec;
typedef vector<double> dvec;
typedef pair<ll, ll> LP;
typedef tuple<ll, ll, ll> LT;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;
#define fs first
#define sc second
string f(ll n){
  if(n==0) return "";
  n--; //'a'=0として扱いやすいようにディクリメントする
  return f(n/26)+(char)('a'+n%26);
}
int main()	{
  ll n;
  cin>>n;
  cout<<f(n)<<endl;
}
  

Measured memory_bytes: 3548
#include<iostream>
#include <map>
#include <algorithm>
#include <vector>
#include <iterator>
#include <queue>
#define int long long
#define INF 1e18
using namespace std;
typedef pair<int, int> P;
signed main() {
	int n, d, ans = 0, sum[31] = {}, sum2[31] = {};
	int x[31], y[31];
	vector<P> d1, d2, v[16];
	cin >> n >> d;
	for (int i = 1; i <= n; i++) {
		cin >> x[i] >> y[i];
		sum[i] = x[i] + sum[i - 1];
	}
	v[0].push_back(make_pair(0, 0));
	for (int i = 1; i <= 15; i++) {
		for (int j = 0; j < i; j++) {
			for (vector<P>::iterator itr = v[j].begin(); itr != v[j].end(); itr++) {
				P p = *itr;
					v[i].push_back(make_pair(p.first + x[i],  p.second + y[i]));
				if (n <= 15 || p.first - x[i] + sum[15] - sum[i] > 0) {
					v[i].push_back(make_pair(p.first - x[i], p.second - y[i]));
				}
			}
		}
		if (n <= i) {
			for (int j = 0; j <= i; j++) {
				for (vector<P>::iterator itr = v[j].begin(); itr != v[j].end(); itr++) {
					P p = *itr;
					if (p.first >= -d && p.first <= d) {
						ans = max(p.second, ans);
					}
					if (-1 * p.first >= -d && -1 * p.first <= d) {
						ans = max(-1 * p.second, ans);
					}
				}
			}
			cout << ans << endl;
			return 0;
		}
	}
	for (int i = 0; i <= 15; i++) {
		for (vector<P>::iterator itr = v[i].begin(); itr != v[i].end(); itr++) {
			P p = *itr;
			d1.push_back(make_pair(p.first, p.second));
			d1.push_back(make_pair(-p.first, -p.second));
		}
		v[i].clear();
	}
	v[0].push_back(make_pair(0, 0));
	for (int i = 16; i <= n; i++) {
		for (int j = 0; j < i - 15; j++) {
			for (vector<P>::iterator itr = v[j].begin(); itr != v[j].end(); itr++) {
				v[i - 15].push_back(make_pair(itr->first + x[i] , itr->second + y[i]));
				if (itr->first - x[i] + sum[n] - sum[i] >= 0)
					v[i - 15].push_back(make_pair(itr->first - x[i], itr->second - y[i]));
			}
		}
	}
	for (int j = 0; j <= 15; j++) {
		for (vector<P>::iterator itr = v[j].begin(); itr != v[j].end(); itr++) {
			d2.push_back(make_pair(itr->first, itr->second));
			d2.push_back(make_pair(-itr->first, -itr->second));
		}
		v[j].clear();
	}

	sort(d1.begin(), d1.end());
	sort(d2.begin(), d2.end());

	int a = 0, b = 0;
	deque<int> c;
	for ( int i = d1.size() - 1; i >= 0; i--) {
		while (a < d2.size() && d1[i].first + d2[a].first <= d) {
			while (!c.empty() && d2[c.back()].second <= d2[a].second) c.pop_back();
			c.push_back(a);
			a++;
		}
		while (b < d2.size() &&  d2[b].first + d1[i].first < -d) {
			if (!c.empty() && c.front() == b) c.pop_front();
			b++;
		}
		if(!c.empty()) ans = max(ans, d1[i].second + d2[c.front()].second);
	}
	cout << ans << endl;
	return 0;
}

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

int n;
int a[10];
int ans=0;

void dfs(int x,bool flag){
  if(x==n){
    if(flag)ans++;
    return;
  }
  
  if(a[x]%2==0){
    dfs(x+1,1);
    dfs(x+1,flag);
    dfs(x+1,flag);
  }else{
    dfs(x+1,flag);
    dfs(x+1,1);
    dfs(x+1,1);
  }
}

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

  dfs(0,0);
  cout<<ans<<endl;  
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<boost/multiprecision/cpp_int.hpp>
using namespace std;
using namespace boost::multiprecision;
#define BEGIN ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define END return EXIT_SUCCESS
#define rep(I,N) for(auto I=0;I<(N);++I)
#define up(I,A,B) for(auto I=(A);I<=(B);++I)
#define dw(I,A,B) for(auto I=(A);I>=(B);--I)
#define all(C) (C).begin(),(C).end()
#define rall(C) (C).rbegin(),(C).rend()
#define ft first
#define sd second
#define mp make_pair
#define mt make_tuple
#define pf push_front
#define pb push_back
#define pt pop_front
#define pk pop_back
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define rs resize
// #define int cpp_int
template<class T>inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;}
template<class T>inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;}
template<class T>inline void                                      in(T &p){cin>>p;}
template<class T1,class T2>inline void                            in(T1 &p1,T2 &p2){cin>>p1>>p2;}
template<class T1,class T2,class T3>inline void                   in(T1 &p1,T2 &p2,T3 &p3){cin>>p1>>p2>>p3;}
template<class T1,class T2,class T3,class T4>inline void          in(T1 &p1,T2 &p2,T3 &p3,T4 &p4){cin>>p1>>p2>>p3>>p4;}
template<class T1,class T2,class T3,class T4,class T5>inline void in(T1 &p1,T2 &p2,T3 &p3,T4 &p4,T5 &p5){cin>>p1>>p2>>p3>>p4>>p5;}
template<class T>inline void                                      ins(T &p){for_each(all(p),in<decltype(p[0])>);}
template<class T>inline void                             out(T p){cout<<p<<endl;}
template<class T1,class T2>inline void                   out(T1 p1,T2 p2){cout<<p1<<" "<<p2<<endl;}
template<class T1,class T2,class T3>inline void          out(T1 p1,T2 p2,T3 p3){cout<<p1<<" "<<p2<<" "<<p3<<endl;}
template<class T1,class T2,class T3,class T4>inline void out(T1 p1,T2 p2,T3 p3,T4 p4){cout<<p1<<" "<<p2<<" "<<p3<<" "<<p4<<endl;}
inline                                              void out(double p){printf("%.10f\n",p);}
template<class T>inline                             void outs(T p){for_each(all(p),out<decltype(p[0])>);}

inline void solve(void){
  long N;
  in(N);
  vector<pair<long,long>>a,b;
  long x,y;
  rep(i,N){
    in(x,y);
    a.pb(mp(x,y));
    b.pb(mp(y,x));
  }
  sort(all(a));
  sort(all(b));
  map<pair<long,long>,long> c,d;
  rep(i,N-1){
    for(long j=i+1;j<N;j++){
      c[mp(a[j].ft-a[i].ft,a[j].sd-a[i].sd)]++;
      d[mp(b[j].ft-b[i].ft,b[j].sd-b[i].sd)]++;
    }
  }
  long cnt=0;
  for(auto&& e:c)chmax(cnt,e.sd);
  for(auto&& e:d)chmax(cnt,e.sd);
  out(N-cnt);
}
int main(int argc,char**argv){
  BEGIN;
  solve();
  END;
}


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

using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

#define REP(i, l, n) for(int i=(l), i##_len=(n); i<i##_len; ++i)
#define ALL(x) (x).begin(),(x).end()
#define pb push_back

ll gcd(ll a,ll b){return b ? gcd(b,a%b) : a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

char alpha[26] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};

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

int main(){
    vector<int> lis(3);
    cin >> lis[0] >> lis[1] >> lis[2];
    sort(ALL(lis));
    if(lis[0] + lis[1] == lis[2]){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
const ll MOD = 1e9+7;
const ll inf = (LLONG_MAX>>2);
int main(){
  ios::sync_with_stdio(0);
  cin.tie(0);
  //cout << fixed;
  //cout.precision(40);
  ll n,a,b;
  cin >> n >> a >> b;
  if((a-b)&1){
    ll ans1 = b-1-abs(b-a)/2;
    ll ans2 = n-a-abs(b-a)/2;
    cout << min(ans1,ans2);
  }
  else cout << abs(b-a)/2;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define MOD 1000000007
#define INF 1e9
#define All(x) (x).begin(), (x).end()
typedef long long ll;
using namespace std;

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


int main() {
  int n;
  cin>>n;
  vector<int> a(n);
  map<int,int> mp;
  rep(i,n){
    cin>>a[i];
    mp[a[i]]++;
  }
  sort(All(a));

  int ans=0;
  rep(i,n){
    vector<int> div=divisor(a[i]);
    bool f=true;
    rep(j,(int)div.size()){
      int m=mp[div[j]];
      if(div[j]==a[i] && m==1){
        f=true;
      }
      if(m==1 && div[j]!=a[i]){
        f=false;
        break;
      }
      if(m>1){
        f=false;
        break;
      }
    }
    if(f)ans++;
  }
  std::cout<<ans<<endl;


  return 0;
}


Measured memory_bytes: 33028
#![allow(unused, non_snake_case, dead_code, non_upper_case_globals)]
use std::cmp::*;
use std::collections::*;
use std::mem::*;

fn main() {
    let (r, w, e) = (std::io::stdin(), std::io::stdout(), std::io::stderr());
    let mut io = IO::new(r.lock(), w.lock(), e.lock());
    let (n, r): (usize, usize) = (io.read(), io.read());

    if n >= 10 {
        io.writeln(r);
    } else {
        // r:表示
        // x :内部
        // x - 100*(10-n) = r
        io.writeln(r + 100 * (10 - n));
    }
}

static MOD: i64 = 1000000007;
// IO
use std::io::*;
struct IO<R: Read, W: Write, E: Write> {
    Read: R,
    Write: BufWriter<W>,
    Error: BufWriter<E>,
}
impl<R: Read, W: Write, E: Write> IO<R, W, E> {
    fn new(r: R, w: W, e: E) -> IO<R, W, E> {
        IO {
            Read: r,
            Write: BufWriter::new(w),
            Error: BufWriter::new(e),
        }
    }
    fn read<T>(&mut self) -> T
    where
        T: std::str::FromStr,
    {
        let next: String = self
            .Read
            .by_ref()
            .bytes()
            .map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect();
        next.parse().ok().unwrap()
    }
    fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
    fn readn<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read::<T>()).collect::<Vec<_>>()
    }
    fn readmat<T: std::str::FromStr>(&mut self, n: usize, m: usize) -> Vec<Vec<T>> {
        (0..n).map(|_| self.readn(m)).collect()
    }
    fn write<S: ToString>(&mut self, val: S) {
        self.Write.write(val.to_string().as_bytes());
    }
    fn writeln<S: ToString>(&mut self, val: S) {
        self.Write.write(val.to_string().as_bytes());
        self.Write.write(b"\n");
    }
    fn debug<S: std::fmt::Debug>(&mut self, val: S) {
        writeln!(self.Error, "(debug) {:?}", &val);
    }
    fn debug2<S: std::fmt::Debug, T: std::fmt::Debug>(&mut self, val1: S, val2: T) {
        writeln!(self.Error, "(debug2) {:?} -> {:?}", val1, val2);
    }
    fn debug3<S: std::fmt::Debug, T: std::fmt::Debug, U: std::fmt::Debug>(
        &mut self,
        val1: S,
        val2: T,
        val3: U,
    ) {
        writeln!(
            self.Error,
            "(debug3) {:?} -> {:?} -> {:?}",
            val1, val2, val3
        );
    }
}


Measured memory_bytes: 4352
#include<iostream>
#include<string>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include<stdio.h>
using namespace std;

int main(){
    
    while(1){
        int n;
        double min=0, sum=0;
        cin >>n;
        if (n==0) break;
        double score[1000];
        for(int i=0;i < n;i++){
            cin >> score[i];
            min += score[i];
        }
        min = min / n;
        for(int i=0;i < n; i++){
            sum+= pow(score[i] -min, 2.0);
        }
        cout << sqrt(sum/n) << endl;



    }
    
  return 0;
}


Measured memory_bytes: 3280