akhauriyash/Code-Regression huggingface dataset:
nn, aa, bb = gets.chomp.split(" ").map(&:to_i)
$BIGMOD = (10**9) + 7
def nCk(n,k)
	b = (1..k).inject(1){|p, c| p * c % $BIGMOD}
	a = (0..k-1).inject(1){|p, c| p * (n - c) % $BIGMOD}
  a * Inv(b) % $BIGMOD
end

def nPk(n,k)
	return Fact(n) / Fact(n-k) % $BIGMOD
end

def Fact(n)
  (1..n).inject(1) { |r, i| (r * i) % $BIGMOD }
end

def Inv(n)
  PowPow(n, $BIGMOD - 2) % $BIGMOD
end

def PowPow(x, n)
  return 1 if n == 0
	return PowPow(x**2  % $BIGMOD, n / 2) if n.even?
  return PowPow(x, n-1) * x  % $BIGMOD 
end

ngo = PowPow(2, nn) - 1
ngo -= nCk(nn, aa)
ngo -= nCk(nn, bb)
puts ngo % $BIGMOD


Measured memory_bytes: 1788
N = int(input())
A = []
A = input().split()
A = [int(n) for n in A]

B = [int(0) for n in range(N)]

for i in range(N) :
  B[A[i]-1] = i+1
#  B[i] = A.index(i+1) + 1


#print('N', N)
#print('A', A)
#print('B', B)

B = [str(n) for n in B]

result = ' '.join(B)

print(result)


Measured memory_bytes: 17804
s = input()
x,y = map(int,input().split())
count = 0
d = []
s = s.split('T')
d = [len(x) for x in s]

if len(d) == 0:
    d.append(0)
if len(d) == 1:
    d.append(0)
dpx = [d[0]]
dpy = [d[1],-d[1]]
for i in range(2,len(d)):
    di = d[i]
    trans = set()
    if i%2==0:
        for xj in dpx:
            trans.add(xj+di)
            trans.add(xj-di)
        dpx = list(trans)
    else:
        for yj in dpy:
            trans.add(yj+di)
            trans.add(yj-di)
        dpy = list(trans)
ans = (x in dpx)&(y in dpy)

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

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

const int INF = 1001001001;

int x[110];
int y[110];

int func(int x){
  int sum=0;
  while(x!=0){
    sum+=x%10;
    x/=10;
  }
  return sum;
}
int main() {
 int N;
 cin>>N;
 int t=func(N);
 if(N%t==0){cout<<"Yes"<<endl;}
 else{cout<<"No"<<endl;}
  return 0;
}

Measured memory_bytes: 256
def FACTOR(DICT, N):
    FACT = DICT
    LIM = int(N**0.5)+2
    for i in range(2, LIM):
        if N%i == 0:
            FACT[i] = 0
        while N%i == 0:
            FACT[i] += 1
            N //= i
    if len(FACT) == len(DICT):
        if N != 1:
            FACT[N] = 1
        return FACT
    return FACTOR(FACT, N)

def comb_rep(n, r):
    N = n+r-1
    ANS = 1
    for R in range(r):
        ANS *= N-R
    for R in range(r):
        ANS //= r-R
    return int(ANS)

MOD = 10**9+7
n, m = map(int, input().split())
factor = FACTOR({}, m)
ans = 1
for i in factor:
    ans *= (comb_rep(n, factor[i])%MOD)
    ans %= MOD
print(ans)

Measured memory_bytes: 3064
import java.util.*;
import java.text.*;
/*
Main class for AOJ where there is no input.
*/
public class Main{
   public static void main(String[] args){
      Scanner sc = new Scanner(System.in);
      String str;
      String[] arr;
      
      int end;
      int sum;
      
      int count;
      
      while(true){
         str = sc.nextLine();
         arr = str.split(" ");
         
         end = Integer.parseInt(arr[0]);
         sum = Integer.parseInt(arr[1]);
         
         if(end == 0 && sum == 0){
            break;
         }
         
         count = 0;
         
         
         for(int i = 1; i <= end; i++){
            for(int j = i + 1; j <= end; j++){
               for(int k =j + 1; k <= end; k++){
                  if(i+j+k == sum){
                     count++;
                  }
               }
            }
         }
         
         System.out.println(count);
      }  
      
   }//main
}//class

Measured memory_bytes: 26344
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
// #define debug(a) cout << "["; rep(i,a.size()) cout << a[i] << ", "; cout<<"]"<< endl;

const ll mod = 1000000007;

int main() {
    int n; cin >> n;
    vector<int> As(n);
    rep(i,n) cin >> As.at(i);
    ll money = 1000;
    ll kabu = 0;
    // 次の日をみて、株価が下がっていれば全力で売る
    // 株価が上がっていれば全力で買う
    rep(i,n-1){
        if(As.at(i) > As.at(i+1)){
            money += As.at(i) * kabu;
            kabu = 0;
        } else {
            ll buy = money / As.at(i);
            money -= buy * As.at(i);
            kabu += buy;
        }
    }
    money += As.at(n-1) * kabu;
    cout << money << endl;
    return 0;
}

Measured memory_bytes: 3628
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;


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

	int n, t, c, tt, bestc = 100000, bestid = -1;
	cin >> n >> t;
	while (n--) {
		cin >> c >> tt;
		if (tt <= t) bestc = min(bestc, c);
	}

	if (bestc == 100000) cout << "TLE\n";
	else cout << bestc << "\n";


	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#define N 100000
#define NIL -1

typedef struct {
  int p;
  int left;
  int right;
}Node;

Node T[N];

void preParse(int u){
  if(u==NIL)
    return;
  printf(" %d",u);
  preParse(T[u].left);
  preParse(T[u].right);
}

void inParse(int u){
  if(u==NIL)
    return;
  inParse(T[u].left);
  printf(" %d",u);
  inParse(T[u].right);
}

void postParse(int u){
  if(u==NIL)
    return;
  postParse(T[u].left);
  postParse(T[u].right);
  printf(" %d",u);
}

int main(){
  int n,id,left,right,i,root;
  scanf("%d",&n);
  for(i=0;i<n;i++)
    T[i].p=T[i].left=T[i].right=NIL;
  
  for(i=0;i<n;i++){
    scanf("%d%d%d",&id,&left,&right);
    T[id].left=left;
    T[id].right=right;
    if(left!=NIL)T[left].p=id;
    if(right!=NIL)T[right].p=id;
  }

  for(i=0;i<n;i++)
    if(T[i].p==NIL)
      root=i;

  printf("Preorder\n");
  preParse(root);
  printf("\n");

  printf("Inorder\n");
  inParse(root);
  printf("\n");

  printf("Postorder\n");
  postParse(root);
  printf("\n");
  
  return 0;
}



Measured memory_bytes: 2132
#include <stdio.h>

int main(void)
{
	int n;
	int a[1000];
	int i;

	scanf("%d", &n);

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

	for (i = 0; i < n; i++)
	{
		if (a[i] % 2 == 0)
		{
			if (a[i] % 3 != 0 && a[i] % 5 != 0)
			{
				printf("DENIED\n");
				return 0;
			}
		}	
	}
	
	printf("APPROVED\n");

	return 0;
}

Measured memory_bytes: 128
#include <iostream> 
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<iomanip>
#include<sstream>
#include<cmath>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define req(i,n) for(int i = 1;i <=  n; i++)
typedef long long int ll;
const ll INF = 1LL << 60;
const int MOD = 1000000007;
ll n, k, ans = 0, o;
int main() {
    cin >> n;
    vector<int> h(n),dp(n+5,MOD);
    rep(i, n) {
        cin >> h[i];
    }dp[0] = 0;
    rep(i, n - 1) {
        dp[i + 1] = min(abs(h[i] - h[i + 1]) + dp[i], dp[i + 1]);
        if(i +2 < n) dp[i + 2] = min(abs(h[i + 2] - h[i])+dp[i], dp[i + 2]);
    }cout << dp[n -1] << endl;
}

Measured memory_bytes: 1024
N = int(input())
ans = 0
for i in range(N):
    ans += (i+1)*(N-i)
for i in range(N-1):
    uv = list(map(int,input().split()))
    u,v = min(uv),max(uv)
    ans -= (u)*(N-v+1)
print(ans)

Measured memory_bytes: 74220
# エラトステネスの篩
def make_prime_table(n):
    sieve = list(range(n + 1))
    sieve[0] = -1
    sieve[1] = -1
    for i in range(2, int(n ** 0.5) + 1):
        if sieve[i] != i:
            continue
        for j in range(i * i, n + 1, i):
            if sieve[j] == j:
                sieve[j] = i
    return sieve


N = int(input())

result = []
prime_table = make_prime_table(55555)
for i in range(3, 55555 + 1, 2):
    if prime_table[i] == i and i % 5 == 1:
        result.append(i)
    if len(result) == N:
        break
print(*result)


Measured memory_bytes: 11380
#include<algorithm>
#include<cmath>
#include<cctype>
#include<iomanip>
#include<iostream>
#include<map>
#include<string>
#include<vector>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define out(x) cout << x << endl;
#define each(e, v) for (auto&& e : v)
#define clamp(v,lo,hi) min(max(v,lo),hi)
#define debug(i) cout<<"point :"<< i << endl;
#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))
#define all(a) a.begin(),a.end()
typedef long long ll;
typedef vector<int> vint;
typedef vector<long> vl;
typedef vector<double> vdouble;
typedef vector<string> vstr;
typedef vector<bool> vbool;
typedef map<string, int> mapstri;
typedef map<int, int> mapii;
typedef std::pair<int, int> pairii;

int main () {
    int n,m;
    cin >> n >> m;
    vint v(n);
    for (int i = 0; i < n; ++i) cin >> v.at(i);
    sort(v.begin(), v.end(), greater<int>());
    bool j = true;
    double sum = 0;
    for (int i = 0; i < n; ++i) {
        sum += v.at(i);
    }

    for (int i = 0; i < m; ++i) {
        if(v.at(i) < (sum / (4 * m))) {
            j = false;
        }
    }
    if (j) {
        out("Yes")
    } else {
        out("No")
    }

    return 0;
}

Measured memory_bytes: 256
n = int(input())
now = n
cnt = 1
while now != 1:
  cnt += 1
  if now % 2 == 0:
    now //= 2
  else:
    now = 3 * now + 1
if n == 1:
  print(4)
elif n == 2:
  print(4)
else:
  print(cnt + 1)

Measured memory_bytes: 3060
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
using namespace std;
#define MOD 1000000007
#define INF 1<<30
#define LINF (ll)1<<62
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(ll i=(a); i<(b); i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll, ll> P;
typedef vector<pair<ll, ll>> vpl;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n; cin >> n;
    ll a;
    multiset<ll> se;
    rep(i,n){
        cin >> a; 
        a = -a;
        if(se.upper_bound(a) == se.end()){
            se.insert(a);
        }else{
            auto it = se.upper_bound(a);
            se.erase(it);
            se.insert(a);
        }
    } 
    cout << se.size() << endl;
}

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

int main(void){
  int N,red=0,blue=0;
  string s;
  cin>>N>>s;
  for(int i=0;i<N;i++){
    if(s.at(i)=='B') blue++;
    else red++;
  }
  if(red>blue) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<cstring>
#include<cmath>
#include<queue>
#include<vector>
#include<cstdlib>5
#include<string>
#include<algorithm>
#define LL long long
#define INF 1000000009
using namespace std;
int main()
{
   char s[1000];
   int vis[30];
  for(int i=0;i<29;i++)
  vis[i]=INF;
   scanf("%s",s);
   int len=strlen(s);
   int ans=len/2;
   //printf("%d\n",ans);
   for(int i=0;i<26;i++)
   {
       int a=-1;
       for(int j=0;j<len;j++)
       {
           if(s[j]-'a'==i||j==len-1)
           {
               int b=0;
               if(j==len-1&&s[j]-'a'!=i)
               b=1;
               if(vis[i]==INF)
               vis[i]=j-a-1+b;
               else
               vis[i]=max(vis[i],j-a-1+b);
               a=j;
              // printf("vis[%c]=%d\n",i+'a',vis[i]);
           }
       }
   }
   for(int i=0;i<26;i++)
   {
       ans=min(ans,vis[i]);
   }
   printf("%d\n",ans);
}

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

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

typedef long long int lli;
typedef unsigned long long ull;
typedef complex<double> point;

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

template<typename T>
ostream& operator << (ostream& os, vector<T> v)
{
  os << "(";
  each (i, v) os << i << ",";
  os << ")";
  return os;
}

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

  int n;
  while (cin >> n) {
    vector<lli> a(n);
    vector<lli> b(n);
    for (int i = 0; i < n; ++i) {
      cin >> a[i] >> b[i];
    }

    if (a == b) {
      cout << 0 << endl;
      continue;
    }
    
    lli mn = 1LL << 60;
    lli sum = accumulate(a.begin(), a.end(), 0LL);
    for (int i = 0; i < n; ++i) {
      if (a[i] > b[i]) {
        mn = min(mn, b[i]);
      }
    }
    cout << sum - mn << endl;
  }

  return 0;
}


Measured memory_bytes: 768
w , a , b = map(int,raw_input().split())

if a < b:
    if (a+w) >= b:
        print 0
    else:
        print abs(b - (a+w))
if b < a:
    if (b+w) >= a:
        print 0
    else:
        print abs(a - (b+w))
if a == b:
    print 0

Measured memory_bytes: 2568
#include "bits/stdc++.h"
#define ll long long
#define inf 1000000007 //10^9+7
#define sort(vec) sort((vec).begin(),(vec).end());
#define rever(vec) reverse((vec).begin(),(vec).end());
#define unsort(vec) sort((vec)); rever((vec));
using namespace std;

int main() {
	ll n,t;
	cin>>n>>t;
	vector<ll>vec(n);
	for(ll i=0;i<n;i++) cin>>vec[i];
	ll x=t;
	for(ll i=0;i<n-1;i++) {
		if((vec[i+1]-vec[i])>t) {
			x+=t;
		}
		else {
			x+=(vec[i+1]-vec[i]);
		}
	}
	cout<<x<<endl;
}


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

mod = 10 ** 9 + 7

if S[0] == "W" or S[-1] == "W":
    print(0)
    exit()

ans = 1
prev_s = S[0]
prev_t = True
t_sum = 1
f_sum = 0
for i in range(1, 2*N-1):
    if S[i] == prev_s:
        t = not prev_t
    else:
        t = prev_t

    if t:
        t_sum += 1
    else:
        ans *= (t_sum - f_sum)
        ans %= mod
        f_sum += 1
    prev_s = S[i]
    prev_t = t

if t_sum != N:
    ans = 0

for i in range(1, N+1):
    ans *= i
    ans %= mod

print(ans)

Measured memory_bytes: 41708
//#include <bits/stdc++.h>
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
//#include "boost/multiprecision/cpp_int.hpp"
//typedef boost::multiprecision::cpp_int LL;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2

ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
typedef pair<dd,dd> d_d;
ll inf=(ll)1E16;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define fi first
#define se second
#define endl "\n"
#define SORT(v) sort(v.begin(),v.end())
#define ERASE(v) v.erase(unique(v.begin(),v.end()),v.end())
#define POSL(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define POSU(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
//template<class T>void max(T a,T b){if(a<b)return b;else return a;}
//template<class T>void min(T a,T b){if(a>b)return b;else return a;}
//template<class T>bool Max(T&a, T b){if(a < b){a = b;return 1;}return 0;}
//template<class T>bool Min(T&a, T b){if(a > b){a = b;return 1;}return 0;}

//////////////////////////

struct item{
    ll w,s,v;
};
bool comp(item a,item b){
    return a.s+a.w<b.s+b.w;
}

#define W 30005
int main(){fastio
    ll n;cin>>n;
    item a[n];rep(i,0,n-1)cin>>a[i].w>>a[i].s>>a[i].v;
    sort(a,a+n,comp);
    //rep(i,0,n-1)cout<<a[i].w<<" "<<a[i].s<<" "<<a[i].v<<endl;
    
    ll dp[n+1][W];//memset(dp,0,sizeof(dp));
    rep(i,0,n)rep(j,0,W-1)dp[i][j]=-inf;
    dp[0][0]=0;
    rep(i,1,n){
        rep(j,0,W-1){
            dp[i][j]=dp[i-1][j];
            if(0<=j-a[i-1].w&&j-a[i-1].w<=a[i-1].s)Max(dp[i][j],dp[i-1][j-a[i-1].w]+a[i-1].v);
        }
        //rep(j,1,W-1)Max(dp[i][j],dp[i][j-1]);
    }
    /*
    rep(i,0,n){
        rep(j,0,20){
            cout<<dp[i][j]<<" ";
        }cout<<endl;
    }*/
    ll ans=0;
    rep(j,0,W-1)Max(ans,dp[n][j]);
    cout<<ans<<endl;
    
    return 0;
}



Measured memory_bytes: 234880
#include<bits/stdc++.h>
using namespace std;
int main()
{
     int a,b;
    cin>>a>>b;

    string g;

      if(a==b)
   {
     char ch=48+a;
        g.append(a,ch);
    }
   else if(a > b)
  {
       char ch=48+b;
         g.append(a,ch);
   }
  else
   {
   char ch = 48+a;
     g.append(b,ch);
     }
     cout<<g;
 }

Measured memory_bytes: 256
//***The night is the darkest just before the dawn***
 
#include<bits/stdc++.h>
using namespace std;
 
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define ll long long
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i,n) for(i=0;i<n;i++)
#define forn(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define for1(i, n) for (ll i = 1; i <= (ll)(n); ++i)
#define ford(i, n) for (ll i = (ll)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (ll i = (ll)(a); i <= (ll)(b); ++i)
#define fora(it,x) for(auto it:x)
#define PI 3.14159265
#define sync ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define endl "\n"
 
typedef pair<ll, ll> pii;
typedef vector<ll> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<i64, i64> pi64;
typedef long double ld;
 
template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }

ll a[1002];
int main(){
	ll n,m,s=0,c=0;
	cin>>n>>m;

	forn(i,n) {
		cin>>a[i];
		s+=a[i];
	}
	ll t=s;
	s=s/(4*m);
	forn(i,n){
		if(a[i]>s) c++;
		else if((a[i]==s)&&(t%(4*m)==0)) c++;
	}
	if(c<m) cout<<"No";
	else cout<<"Yes";
}

Measured memory_bytes: 256
import unittest
from io import StringIO
import sys


def input():
    return sys.stdin.readline().rstrip()


def resolve():
    N = int(input())
    d = list(map(int, input().split()))

    ans = 0
    for i in range(N):
        for j in range(i+1, N):
            ans += d[i] * d[j]
    print(ans)


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """3
3 1 2"""
        output = """11"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """7
5 0 7 8 3 3 2"""
        output = """312"""
        self.assertIO(input, output)


if __name__ == "__main__":
    resolve()


Measured memory_bytes: 51436
def solve():
    n, a, b = list(map(int, input().split()))
    MOD = 10 ** 9 + 7
    fact = [1, 1]
    factinv = [1, 1]
    inv = [0, 1]
    
    for i in range(2, max(a, b)+1):
        fact.append((fact[-1] * i) % MOD)
        inv.append((-inv[MOD % i] * (MOD // i)) % MOD)
        factinv.append((factinv[-1] * inv[-1]) % MOD)
    
    def ncr(n, r):
        ret = factinv[r]
        for i in range(n, n-r, -1):
            ret = ret * i % MOD
        return ret
        
    ans = pow(2, n, MOD)
    ans = (ans-ncr(n, a)-ncr(n, b)-1) % MOD
    return ans


print(solve())


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

// Template START
#define endl "\n"
#define async ios_base::sync_with_stdio(false); cin.tie(NULL);
#define int long long int
#define all(y) y.begin(), y.end()
#define present( x, y ) (x.find( y ) != x.end())
const int mod = (int)1e9 + 7 ;
template<class T>
auto matrix( int r, int c, T v ){
    return vector<vector<T>>( r, vector<T>( c, v ) ) ;
}
template<class T>
auto matrix( int o1, int o2, int o3, T v ){ 
    return vector<vector<vector<T>>>( o1, vector<vector<T>>( o2, vector<T>( o3, v ) ) ) ;
}
#define v vector
// Template END

int power( int x, int n ){
    if( n == 0 ) return 1 ;
    else if( n & 1 ) return ( x * power( (x*x) % mod, n / 2 ) ) % mod ;
    return power( (x*x) % mod, n / 2 ) % mod ;
}

signed main(){
    int n ; cin >> n ;
    int res = ( power( 10, n ) - power( 9, n ) * 2 + power( 8, n ) + 2 * mod ) % mod ;    
    cout << res ;
    return 0 ;   
}

Measured memory_bytes: 3628
#define LOCAL

#include <map>
#include <unordered_map>
#include <unordered_set>
#include <set>
#include <vector>
#include <numeric>
#include <algorithm>
#include <iostream>
#include <string>
#include <cstring>
#include <sstream>
#include <functional>
#include <queue>
#include <deque>
#include <stack>
#include <cmath>
#include <iomanip>

using namespace std;

// From Errichto's Youtube stream
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

using int64 = long long;

/////////////////////
// Code starts here//
/////////////////////
const int MAXN = 100111;

int64 N, X;
int64 B[MAXN], L[MAXN], R[MAXN];

int64 other;

vector<pair<int64, int64>> cand;

int64 Gain(int64 i, int64 t) {
    if (t <= B[i]) {
        return (int64)t * L[i];
    } else {
        return (int64)B[i] * L[i] + (int64)(t - B[i]) * R[i];
    }
}

bool Go(int64 T) {
    vector<bool> used(N);

    int64 cur = other;

    if (cur >= 0)
        return true;
    
    int64 rem = T % X;
    int64 full = T / X;

    int64 tot = 0;
    for (int i = 0; i < full; i++) {
        tot += cand[i].first;
        used[cand[i].second] = true;
    }

    if (full == N)
        return tot + cur >= 0;

    for (int i = 0; i < full; i++) {
        int64 tot_now = tot - cand[i].first;
        tot_now += Gain(cand[i].second, rem);
        tot_now += cand[full].first;

        if (cur + tot_now >= 0)
            return true;
    }

    for (int i = 0; i < N; i++) {
        if (!used[i]) {
            if (cur + tot + Gain(i, rem) >= 0) {
                return true;
            }
        }
    }

    return false;
}

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

    cin >> N >> X;
    for (int i = 0; i < N; i++) {
        cin >> B[i] >> L[i] >> R[i];
        other -= (int64)B[i] * L[i]; 
    }

    int64 l = 0, r = (int64)N * X, m(0), sol(0);

    for (int i = 0; i < N; i++) {
        cand.emplace_back(Gain(i, X), i);
    }

    sort(cand.begin(), cand.end());
    reverse(cand.begin(), cand.end());

    while (l <= r) {
        m = (l + r) >> 1;
        if (Go(m)) {
            sol = m;
            r = m - 1;
        } else {
            l = m + 1;
        }
    }

    cout << sol << "\n";

    return 0;
}


Measured memory_bytes: 5876
#

import sys
input=sys.stdin.readline

def main():
    N=int(input())
    A=list(map(int,input().split()))
    A.sort()
    cho=set()
    for i in range(len(A)-1):
        if A[i]==A[i+1]:
            cho.add(A[i])
    A=list(set(A))
    SUGOI=[False]*(10**6+1)
    for a in A:
        for j in range(2*a,10**6+1,a):
            SUGOI[j]=True
    cnt=0
    A=list(set(A)-cho)
    for a in A:
        if SUGOI[a]==False:
            cnt+=1
    print(cnt)
    
    
if __name__=="__main__":
    main()


Measured memory_bytes: 50784
import sys, bisect, math, itertools, heapq, collections
from operator import itemgetter
# a.sort(key=itemgetter(i)) # i番目要素でsort
from functools import lru_cache
# @lru_cache(maxsize=None)
sys.setrecursionlimit(10**8)
input = sys.stdin.readline
INF = float('inf')
mod = 10**9 + 7
eps = 10**-7


def inp():
    '''
    一つの整数
    '''
    return int(input())


def inpl():
    '''
    一行に複数の整数
    '''
    return list(map(int, input().split()))


def str_inp():
    '''
    文字列をリストとして読み込む
    '''
    return list(input()[:-1])


n = inp()
a = inpl()
data = collections.defaultdict(int)
for i in range(n):
    data[a[i]] += 1
q = inp()
ans = 0
for key, value in data.items():
    ans += key * value
for i in range(q):
    b, c = inpl()
    ans += (c - b) * data[b]
    data[c] += data[b]
    data[b] = 0
    print(ans)


Measured memory_bytes: 90384
#include <bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define len(x) (int)(x.size())
#define all(vs) vs.begin(), vs.end()
using ii = pair<int, int>;
using ll = long long;
#define int long long
const int mod = 1e9+7;

int mod_exp(int a, int b){
    if(b == 0) return 1;
    int c = mod_exp(a, b/2);
    c = (c*c)%mod;
    if(b%2 != 0) c=(c*a)%mod;
    return c;
}
int mod_inv(int a){
	return mod_exp((a%mod), mod-2);
}
#define MAXN 1000009
int fat[MAXN];
void init(){
    fat[0] = 1;
    for(int i=1; i<MAXN; ++i)
        fat[i]=(i*fat[i-1])%mod;
}
int32_t main(){
	init();
	ios::sync_with_stdio(0);	
	int n, a, b;
	cin >> n >> a >> b;
	int ans = mod_exp(2, n);
	ans -= 1;
	int res = 1, k = n;
	for(int i=0; i<a; ++i)
		res *=k, res%=mod, --k;
	res = (res*mod_inv(fat[a]))%mod;
	ans -=res;
	res = 1; k = n;
	for(int i=0; i<b; ++i)
		res *=k, res%=mod, --k;
	res = (res*mod_inv(fat[b]))%mod;
	ans -= res;
	if(ans<0)
		ans = ((mod-1)*(-ans))%mod;
	ans %=mod;
	cout << ans << endl;
}


Measured memory_bytes: 8064
#include <stdio.h>

using namespace std;

int main(){
	int cat,but,cg,count = 0;
	scanf("%d %d %d",&cat,&but,&cg);
	for(int i = cat; i <= but; i++){
		if(cg%i == 0) count++;
	}
	printf("%d\n",count);
}



Measured memory_bytes: 2760
#include <stdio.h>
int main (){
int n,d,x,i,sum,k;
  scanf ("%d%d%d",&n,&d,&x);
  for (i=0;i<n;i++){
    scanf ("%d",&k);
  sum=sum+(d-1)/k+1;
  }
  sum=sum+x;
  printf ("%d",sum);
return 0;
}

Measured memory_bytes: 128
#include<iostream>
using namespace std;
static const int MAX = 100;
static const int INFTY = (1 << 21);
static const int WHITE = 0;
static const int GRAY = 1;
static const int BLACK = 2;

int n,M[MAX][MAX];

int prim(){
  int u,minv;
  int d[MAX],p[MAX],color[MAX];

  for(int i = 0;i < n;i++){
    d[i] = INFTY;
    p[i] = -1;
    color[i] = WHITE;
  }

  d[0] = 0;

  while(1){
    minv = INFTY;
    u = -1;
    for(int i = 0;i < n;i++){
      if(minv > d[i] && color[i] != BLACK){
	u = i;
	minv = d[i];
      }
    }
    if(u == -1) break;
    color[u] = BLACK;
    for(int v = 0;v < n;v++){
      if(color[v] != BLACK && M[u][v] != INFTY){
	if(d[v] > M[u][v]){
	  d[v] = M[u][v];
	  p[v] = u;
	  color[v] = GRAY;
	}
      }
    }
  }
  int sum = 0;
  for(int i = 0;i < n;i++){
    if(p[i] != -1) sum += M[i][p[i]];
  }

  return sum;
}

int main(){
  cin >> n;

  for(int i = 0;i < n;i++){
    for(int j = 0;j < n;j++){
      int e;cin >> e;
      M[i][j] = (e == -1) ? INFTY : e;
    }
  }

  cout << prim() << endl;

  return 0;
}



Measured memory_bytes: 3132
h, w, k = gets.split.map(&:to_i)
s = h.times.map {gets}

dp = Array.new(h+1) {Array.new(w+1, 0)}
h.times do |i|
    w.times do |j|
        dp[i][j] = dp[i-1][j] + dp[i][j-1] - dp[i-1][j-1] + s[i][j].to_i
    end
end

ans = h + w + 1
(2**(h-1)).times do |i|
    i = [-1] + Array.new(h-1) {|x| i[x] == 1 ? x : nil}.compact << h - 1
    t = i.size - 2

    wp = -1
    w.times do |j|
        if i.each_cons(2).any?{|a,b| dp[b][j] - dp[a][j] - dp[b][wp] + dp[a][wp] > k}
            if wp + 1 == j
                t = h + w + 1
                break
            else
                t += 1
                wp = j - 1
                redo
            end
        end
    end

    ans = t if ans > t
end

puts ans

Measured memory_bytes: 2044
s = input()
cur = 0
deletedpairs = 0
for i in range(len(s)):
    #print(i, deletedpairs)
    if s[i] == "S":
        cur += 1
    if s[i] == "T":
        if cur > 0:
            deletedpairs += 1
            cur -= 1
        else:
            pass

#print(deletedpairs)
print(len(s) - deletedpairs*2)

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

int main() {

int k;
int c=0 , s=0;
cin>> k ;
for (int i=1;i<=k;i++)
{
    if(i%2==0){c=c+1 ;}
    else {s+=1;}
}

cout<<c*s;
return 0;
}


Measured memory_bytes: 256
s = input()

if s[0] == s[1] and s[2] == s[3] and s[0] != s[2]:
    print ('Yes')
elif s[0] == s[2] and s[1] == s[3] and s[0] != s[1]:
    print('Yes')
elif s[0] == s[3] and s[1] == s[2] and s[0] != s[1]:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3064
//vec[i]の範囲外エラー表示
#define _GLIBCXX_DEBUG
//includeとusing
#include <bits/stdc++.h>
using namespace std;
//型名省略
using ll = long long;
using st = string;
using vl = vector<long long>;
using vvl = vector<vector<long long>>;
using vc = vector<char>;
using vvc = vector<vector<char>>;
using vs = vector<string>;
using pll = pair<ll, ll>;
using pcc = pair<char, char>;
//定数
const ll INF = 1e9;
const ll MOD = 1e9+7;
const vl dx = {1,0,-1,0,1,0,-1,0};
const vl dy = {0,1,0,-1,0,1,0,-1};
//マクロ
#define rep(i,n) for(ll i = 0; i < (ll) n; i++)
#define rrep(i,n) for(ll i = (ll) n - 1; i >= 0;i--)
#define REP(i,x,n) for(ll i = (ll) x; i < (ll) n; i++)
#define RREP(i,x,n) for(ll i = (ll) n - 1; i >= x; i--)
#define each(i,A) for(ll i: (vl) A)
#define all(A) A.begin(), A.end()
#define Size(A) ll(A.size())
//入力
template<typename T> T input() {T x; cin >> x; return x;}
//正誤判定
void Yes(bool ans){cout << (ans? "Yes" : "No") << endl;}
void YES(bool ans){cout << (ans? "YES" : "NO") << endl;}
//余り切り上げ
ll ceil(ll a,ll b) {return (a + b - 1) / b;}
//最大値・最小値
template <typename T> bool chmax(T &a, const T& b) {if(a < b) {a = b; return true;} return false;}
template <typename T> bool chmin(T &a, const T& b) {if(a > b) {a = b; return true;} return false;}
//最大公約数
ll gcd(ll a,ll b){if(a<b)swap(a,b); if(a%b==0)return b; return gcd(b,a%b);}
//最小公倍数
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
//n乗の余り
ll modPow(ll x,ll n,ll mod){if(n==0)return 1; if(n%2==0)return modPow(x*x,n/2,mod)%mod; return x%mod*modPow(x,n-1,mod)%mod;}


/*--------------------------------------------------------------------------*/


//main関数
int main() {
    ll a,b,c,d; cin >> a >> b >> c >> d;

    ll ans = 0;
    if(a >= 0 && b >= 0){
        if(d >= 0) ans = b * d;
        else ans = a * d;
    }
    else if(a < 0 && b < 0){
        if(c < 0) ans = a * c;
        else ans = b * c;
    }
    else {
        if(c >= 0 && d >= 0) ans = b * d;
        else if(c < 0 && d < 0) ans = a * c;
        else ans = max(a * c, b * d);
    }
    cout << ans << endl;
}



Measured memory_bytes: 3584
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<cmath>
#define RG register
#define IL inline
#define inf 2147483640
#define LL long long
#define pi acos(-1.0)
#define db long double
using namespace std;
IL int gi()
{
	RG int res=0,w=1;
	RG char ch;
	for(ch=getchar();(ch<'0'||ch>'9')&&ch!='-';ch=getchar());
	if(ch=='-') w=-1,ch=getchar();
	for(;ch>='0'&&ch<='9';ch=getchar()) res=10*res+ch-48;
	return res*w;
}
int a,b,c,d,e,f;
db ans=0;
int p,q,ap,aq;
int main()
{
	//freopen("1.in","r",stdin);
	//freopen("1.out","w",stdout);
	a=gi(),b=gi(),c=gi(),d=gi(),e=gi(),f=gi();
	for(RG int x=0;100*a*x<=f;++x)
		{
			for(RG int y=0;100*a*x+100*b*y<=f;++y)
				{
					RG int m1=100*a*x+100*b*y;
					for(RG int z1=0;d*z1+m1<=f&&d*z1<=m1/100*e;++z1)
						{
							RG int z2=min(f-m1-d*z1,m1/100*e-d*z1);
							z2=z2/c;
							p=m1+z1*d+z2*c;
							if(!p) continue;
							if(z1<0||z2<0) continue;
							q=p-m1;
							if((db)q/(db)p>=ans) ap=p,aq=q,ans=(db)q/(db)p;
						}
				}
		}
	printf("%d %d",ap,aq);
	//fclose(stdin);fclose(stdout);
	return 0;
}

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

using namespace std;

int main()
{

    int A, B, X;
        
    cin >> A;
    cin >> B;
    cin >> X;
    
    bool isYes = (B >= (X - A) && (X >= A));
    cout << (isYes?"YES":"NO") << endl;
}

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

int main() {
  int a, b;
  string result;

  cin >> a >> b;

  if (a < b ) {
    result = "a < b";
  } else if ( a > b) {
    result = "a > b";
  } else if (a == b) {
    result = "a == b";
  }

  cout << result << endl;
  
  return 0;
}

Measured memory_bytes: 1196
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

public class Main {

    public static void main(String[] args) throws Exception {

        InputStreamReader is = new InputStreamReader(System.in);
        BufferedReader reader = new BufferedReader(is);

        List<String> mylist = new ArrayList<>();

        // 標準入力からの値を変数strinputに代入
        String strinput = reader.readLine();

        while (strinput != null) {

            mylist.add(strinput);
            strinput = reader.readLine();

        }

        String arr01[] = mylist.get(0).split(" ");

        int n = Integer.valueOf(arr01[0]);

        String arr02[] = mylist.get(1).split(" ");
        String arr03[] = mylist.get(2).split(" ");

        List<String> listA_temp = Arrays.asList(arr02);
        List<String> listB_temp = Arrays.asList(arr03);

        List<Long> listA = listA_temp.stream().map(Long::valueOf).collect(Collectors.toList());
        List<Long> listB = listB_temp.stream().map(Long::valueOf).collect(Collectors.toList());

        long mysum = 0;
        long nokori = listA.get(0);

        for (int i = 0; i < listB.size(); i++) {

            long a = listB.get(i);
            long goukei = nokori + listA.get(i + 1);
            if (goukei <= a) {

                mysum += goukei;
                nokori = 0;

            } else {

                mysum += a;
                if (a <= nokori) {
                    nokori = listA.get(i + 1);
                } else {
                    nokori = listA.get(i + 1) + nokori - a;
                }
            }
        }

        System.out.println(mysum);

    }

}


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

 int ord( int x)
 {
   int i,k,j;
   if( x%2==0)
   {
     return ord(x/2)+1;
   }
   else
   {
     return 0;
   }
 }
     
int main()
{
  int n,i,j,cou;
  cin >> n;
  cou=0;
  for(i=0;i<n;i++)
  {
    cin >> j;
    cou+= ord(j);
  }
  cout << cou <<endl;
  
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    static public void main(String[] args) {
        String word;
        String str;
        int cout = 0;
        
        Scanner sc = new Scanner(System.in);
        word = sc.next();
        while (sc.hasNext()) {
            str = sc.next();
            if (str.equals("END_OF_TEXT")) break;
            if (str.compareToIgnoreCase(word) == 0) cout++;
        }
        System.out.println(cout);
    }
}



Measured memory_bytes: 26140
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
		new Main().run();
	}
	public void run(){
		Scanner scan = new Scanner(System.in);
		int[][] dx = {{0,1,2},{0,3,6},{0,4,8},{1,4,7},{3,4,5},{6,7,8},{2,4,6},{2,5,8}};
		int fl = 0;
		int t = 0;
		while(scan.hasNext()){
			String str = scan.nextLine().replaceAll("o","1").replaceAll("s","5").replaceAll("x","9");
			fl = 0;
			for(int i = 0;i < 8;i++){
				t = 0;
				for(int j = 0;j < 3;j++){
					t += Integer.parseInt(""+str.charAt(dx[i][j]));
				}
				if(t == 3){
					fl = 1;
					break;
				}else if(t == 27){
					fl = 2;
					break;
				}
			}
			System.out.println((fl == 0)?"d":(fl == 1)?"o":"x");
		}
	}
}

Measured memory_bytes: 17232
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <map>
#include <list>
#include <set>
#include <stack>
#include <deque>
#include <queue>
#include <cmath>
#include <algorithm>
#include <utility>
#include <functional>
#include <random>
#include <fstream>
#include <time.h>
// #define int long long
#define debug(x) cerr << #x << " = " << x << endl
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,n) for(int i = 0; i < (n); i++)
#define repr(i,n) for(int i = (n); i > -1; i--)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int MOD = 1000000007;
const ll LINF = 1e18;
const double EPS = 1e-9;


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

  int n;
  cin>>n;
  string x[n], u[n];
  rep(i,n) {
    cin>>x[i]>>u[i];
  }
  double r = 380000.0;
  double ans = 0;
  rep(i,n) {
    if(u[i] == "JPY") {
      ans += (double)stoi(x[i]);
    } else {
      ans += stod(x[i]) * r;
    }
  } 
  printf("%.10f\n", ans);

  return 0;
}


Measured memory_bytes: 256
#![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, m, k) = (io.read::<usize>(), io.read::<usize>(), io.read::<i64>());
    let a = io.readn::<i64>(n);
    let b = io.readn::<i64>(m);

    let mut asum = vec![0; n + 1];
    let mut bsum = vec![0; m + 1];
    for i in 0..n {
        asum[i + 1] = a[i] + asum[i];
    }
    for i in 0..m {
        bsum[i + 1] = b[i] + bsum[i];
    }

    let mut ans = 0;
    let mut bind = m;
    for ac in 0..n + 1 {
        //a をacさつ
        let nowt = asum[ac];
        if nowt > k {
            break;
        }
        let left = k - nowt;
        let mut cnt = ac;
        while bind > 0 && left < bsum[bind] {
            bind -= 1;
        }
        cnt = ac + bind;
        ans = max(ans, cnt);
    }
    io.writeln(ans);
}

static MX: usize = 1010101;
static MOD: i64 = 1000000007;
static INF: i64 = std::i64::MAX >> 1;
// 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 chari(&mut self) -> Vec<i64> {
        self.chars()
            .iter()
            .map(|&c| (c as u8 - b'0') as i64)
            .collect::<Vec<i64>>()
    }
    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: 8396
#include <stdio.h>
#include <stdlib.h>
#include <map>
#include <utility>
#include <vector>
#include <algorithm>

#define MAX_N (50)

using namespace std;

int main(int argc, char *argv[]) {
  // read inputs
  int N, xs[MAX_N], ys[MAX_N];
  scanf("%d", &N);
  for (int i = 0; i < N; i++) {
    scanf("%d %d", &xs[i], &ys[i]);
  }

  // count diff vectors
  map<pair<int, int>, int> diff_to_cnt;
  for (int i = 0; i < N; i++) {
    for (int j = i + 1; j < N; j++) {
      const int dx = xs[j] - xs[i], dy = ys[j] - ys[i];
      pair<int, int> diff;
      if (dx > 0 || (dx == 0 && dy > 0)) {
        diff = make_pair(dx, dy);
      } else {
        diff = make_pair(-dx, -dy);
      }
      if (diff_to_cnt.find(diff) == diff_to_cnt.end()) {
        diff_to_cnt[diff] = 1;
      } else {
        diff_to_cnt[diff]++;
      }
    }
  }

  // get max
  int max_cnt = 0;
  for (auto it = diff_to_cnt.begin(); it != diff_to_cnt.end(); it++) {
    max_cnt = max(max_cnt, it->second);
  }
  printf("%d\n", N - max_cnt);

  return 0;
}


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

void solve(){
    ll n;
    cin >> n;
    Vi t(n+1),x(n+1),y(n+1);
    t[0]=0;
    x[0]=0;
    y[0]=0;
    repi(i,1,n+1) cin >> t[i] >> x[i] >> y[i];
    bool ok=true;
    repi(i,1,n+1){
        ll dist=abs(x[i]-x[i-1])+abs(y[i]-y[i-1]);
        if(dist>t[i]-t[i-1]||(t[i]-t[i-1]-dist)%2==1) ok=false;
    }
    Yes(ok);
    return;
}
int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    std::cout<<std::fixed<<std::setprecision(30);
    solve();
    return 0;
}

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

int main() {
    ll k , l , r ;
    cin >> k  ;

    ll res = 100LL ,ans = 0 ;
    while(res<k){
        res = res + (res /100) ;
        ans++ ;
    }
    cout << ans ;

    return 0 ;
}


Measured memory_bytes: 3616
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
//#include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pli pair<ll,int>
#define fi first
#define se second
#define inf (INT_MAX/2-1)
#define infl (1LL<<60)
#define vi vector<int>
#define pb push_back
#define sz(a) (int)(a).size()
#define all(a) begin(a),end(a)
#define y0 y5656
#define y1 y7878
#define aaa system("pause");
#define dbg(x) cerr<<(#x)<<": "<<(x)<<'\n',aaa
#define dbga(x,n) cerr<<(#x)<<"[]: ";for(int _=0;_<n;_++)cerr<<x[_]<<' ';cerr<<'\n',aaa
#define dbgs(x) cerr<<(#x)<<"[stl]: ";for(int _:x)cerr<<_<<' ';cerr<<'\n',aaa
#define dbgp(x) cerr<<(#x)<<": "<<x.fi<<' '<<x.se<<'\n',aaa
#define maxn 100000

using namespace std;

int v[maxn+5], d[maxn+5];
queue<int> qu;

int main () {
  ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
  int n; cin >> n;
  int i, j, z;
  for (i = 1; i <= n; i++) cin >> v[i];
  fill(all(d), inf); d[1] = 0; qu.push(1);
  while (!qu.empty()) {
    z = qu.front(); qu.pop();
    for (j = z+1; j <= min(z+2, n); j++)
      if (d[z]+abs(v[z]-v[j]) < d[j]) {
        d[j] = d[z]+abs(v[z]-v[j]);
        qu.push(j);
      }
  }
  cout << d[n];
  return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <iomanip>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
#include <queue>
#include <cmath>
#include <numeric>
#include <set>
#include <climits>

using namespace std;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v){o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}
#define debug(v) {cerr<<"\033[1;36m[debug]\033[m "<<#v<<" : "<<v<<endl;}

// using int64 = long long;
typedef long long int64;


class BIT {
    int n;
    vector<int64> d;
public:
    BIT(int _n=0) {n=_n; d=vector<int64>(n+1);}
    void add(int i, int64 x=1) { for (i++; i <= n; i += i&-i) d[i] += x; }
    int64 sum(int i) { int64 x = 0; for (i++; i; i -= i&-i) x += d[i]; return x; }
};


int main() {
    int n;
    string s;
    cin >> n >> s;
    vector<BIT> bit(26, BIT(n));
    for (int i=0; i<n; i++) {
        bit[s[i] - 'a'].add(i,1);
    }

    int q;
    cin >> q;
    for (int i=0; i<q; i++) {
        int type; cin >> type;
        switch(type) {
            case 1:
                int i;
                char c;
                cin >> i >> c;
                bit[s[i-1] - 'a'].add(i-1,-1);
                bit[c - 'a'].add(i-1,1);
                s[i-1] = c;
                break;
            case 2:
                int l,r;
                cin >> l >> r;
                int ans = 0;
                for (int i=0; i<26; i++) {
                    if (bit[i].sum(r-1) - bit[i].sum(l-2) >= 1)
                        ans++;
                }
                cout << ans << endl;
                break;
        }
    }
}


Measured memory_bytes: 106360