akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>

using namespace std;

int memo[100001];

class Puzzle
{
public:
	int n;
	vector<int> ps;
	int min_ans;

	void input()
	{
		cin >> n;

		ps.push_back(1);

		int val = 6;
		while (val <= n) {
			ps.push_back(val);
			val *= 6;
		}
		val = 9;
		while (val <= n) {
			ps.push_back(val);
			val *= 9;
		}

		sort(ps.rbegin(), ps.rend());

		min_ans = 100000;

		for (int mi = 0; mi < 100001; mi++) {
			memo[mi] = mi;
		}

	}

	void play()
	{
		min_ans = dp();
		printf("%d", min_ans);
	}

	int dp()
	{
		for (int ni = 1; ni <= n; ni++)
		{
			for (int pi = 0; pi < ps.size(); pi++) {
				if (ni == ps[pi]) {
					memo[ni] = 1;
					break;
				}
			}
			if (memo[ni] == 1) continue;

			int cnt = memo[ni];
			for (int pi = 0; pi < ps.size(); pi++) {
				if (ps[pi] < ni) {
					cnt = min(cnt, memo[ni - ps[pi]] + 1);
				}
			}
			memo[ni] = cnt;
		}
		return memo[n];
	}

};



int main()
{
	Puzzle puz;

	puz.input();
	puz.play();


	return 0;
}



Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
constexpr long long MOD = 1000000007;
using ll = long long;
int main() {
ll n,l;
cin >> n >> l;
string s[n];
for (ll i = 0; i < n; i++) cin >> s[i];
sort(s, s + n);
string ans="";
for (ll i = 0; i < n; i++) ans += s[i];
cout << ans << endl;
}


Measured memory_bytes: 256
#a,bの最大公約数
def gcd(a,b):
    if b == 0:
        return a
    else:
        return gcd(b,a%b)

#a,bの最小公倍数
def lcm(a, b):
	return a * b // gcd (a, b)


mod = 10**9+7
n = int(input())
a = list(map(int,input().split()))

l = a[0]
for e in a:
    l = lcm(l,e)

a_sum = 0
for e in a:
    a_sum = (a_sum + pow(e,mod-2,mod))%mod

print((l%mod)*a_sum%mod)

Measured memory_bytes: 70488
#include <bits/stdc++.h>
using namespace std;
#define modulo 1000000007
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 10000000000000000



int main(){
	
	int N,A,B;
	cin>>N>>A>>B;
	
	if((A-B)%2==0){
		cout<<"Alice"<<endl;
	}
	else{
		cout<<"Borys"<<endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N=1010;
int n,m,a,b;char c[N][N];
void P1(int x,int y){c[x][y]='<';c[x][y+1]='>';a--;}
void P2(int x,int y){c[x][y]='^';c[x+1][y]='v';b--;}
int main(){
    scanf("%d%d%d%d",&n,&m,&a,&b);
    if(n&1)for(int i=1;i+1<=m&&a;i+=2)P1(n,i);
    for(int j=m&1?2:1;j+1<=m;j+=2)for(int i=1;i+1<=n;i+=2)
        if(a>1&&!c[i][j]&&!c[i][j+1]&&!c[i+1][j]&&!c[i+1][j+1])P1(i,j),P1(i+1,j);
    for(int i=1;i<=n;i++)if(a&&!c[i][m-1]&&!c[i][m])P1(i,m-1);
    if(a)puts("NO"),exit(0);
    for(int i=1;i+1<=n;i++)for(int j=1;j<=m;j++)
        if(b&&!c[i][j]&&!c[i+1][j])P2(i,j);
    if(b)puts("NO"),exit(0);
    puts("YES");
    for(int i=1;i<=n;i++,puts(""))for(int j=1;j<=m;j++)putchar(c[i][j]?c[i][j]:'.');
    return 0;
}
// 5 5 5 7

Measured memory_bytes: 2176
import java.util.Scanner;

public class Main {

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

		int A = sc.nextInt();
		int B = sc.nextInt();

		if (A <= 8 && B <= 8) {
			System.out.println("Yay!");
		} else {
			System.out.println(":(");
		}
	}

}

Measured memory_bytes: 21844
n,y = map(int,input().split())
y /= 1000
fin = False
for i in range(n+1):
    for j in range(i,n+1):
        if 10*i + 5*(j-i) + n-j == y:
            print("{} {} {}".format(i,j-i,n-j))
            fin = True
            break
    if fin:
        break
if not fin:
    print("-1 -1 -1")


Measured memory_bytes: 3060
#pragma GCC optimize("O3,inline,unroll-loops")
#include <iostream>
#include <algorithm>
#include <cstdio>
#define N 1020
using namespace std;

int a[N];

int main(void)
{
    int n, k;
    int i, o;

    cin >> n >> k;
    for(i = 0; i < n; i ++)
        cin >> a[i];
    sort(a, a + n);
    for(i = o = 0; i < k; i ++)
        o += a[i];
    cout << o << endl;

    return 0;
}


Measured memory_bytes: 3640
const stdin = require('fs').readFileSync('/dev/stdin', 'utf8').trim()
const input = stdin
	.split('\n')[0]
	.split(' ')
	.map(Number);

const a = input[0];
const b = input[1];

const ans = (a, b) => {
	const plus = a + b;
	const minus = a - b;
	const multiply = a * b;
	const max = Math.max(plus, minus, multiply);
	return max;
}

console.log(ans(a, b));



Measured memory_bytes: 7500
def solve():
    A, B = map(int, input().split())
    s1 = tuple(map(int, input().split()))
    s2 = tuple(map(int, input().split()))
    set1 = [0]*(A+1)
    set1[-1] = set()
    for i, n in enumerate(s1[::-1], start=2):
        set1[-i] = set1[-i+1] | {n}
    result = 0

    for i in range(B):
        k = 0
        cnt = 0
        for n in s2[i:]:
            if n not in set1[k]:
                break
            for m in s1[k:]:
                k += 1
                if n == m:
                    cnt += 1
                    break
        if cnt > result:
            result = cnt
        if result >= B-i:
            break
    print(result)


if __name__ == "__main__":
    solve()

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

int main(){
  string S,T;
  cin >> S >> T;
  int s[S.size()]={};
  int t[T.size()]={};
  int as[26]={};
  int at[26]={};
  int a=1;
  rep(i,S.size()){
    int k=S[i]-'a';
    if(as[k]==0){
      as[k]=a;
      a++;
    }
    s[i]=as[k];
  }
  a=1;
  rep(i,T.size()){
    int k=T[i]-'a';
    if(at[k]==0){
      at[k]=a;
      a++;
    }
    t[i]=at[k];
  }
  rep(i,S.size()){
    if(s[i]!=t[i]){
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  return 0;
}


Measured memory_bytes: 2312
#include <iostream>

using namespace std;

int main(){
    int a = 0;
    string s;
    //cout << "a =";
    cin >> a;
    //cout << "s =";
    cin >> s;
    
    if(a < 3200){
        cout << "red"<<endl;
    }else{
        cout << s <<endl;
    }
}






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

int main() {
	long n,m,i,j,ans,cur;
	cin >> n >> m;
	vector<long> a(n);
	for(i=0; i<n; i++){
		cin >> a[i];
	}
	map<long,long> p;
	
	p[0]=1;
	cur=0; ans=0;
	for(i=0; i<n; i++){
		cur=(cur+a[i])%m;
		if(p[cur]==0){
			p[cur]=1;
		}else{
			ans+=p[cur];
			p[cur]++;
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 4992
/*
Hey there stalker....

█▀▀▄░░░░░░░░░░░▄▀▀█
░█░░░▀▄░▄▄▄▄▄░▄▀░░░█
░░▀▄░░░▀░░░░░▀░░░▄▀
░░░░▌░▄▄░░░▄▄░▐▀▀
░░░▐░░█▄░░░▄█░░▌▄▄▀▀▀▀█
░░░▌▄▄▀▀░▄░▀▀▄▄▐░░░░░░█
▄▀▀▐▀▀░▄▄▄▄▄░▀▀▌▄▄▄░░░█
█░░░▀▄░█░░░█░▄▀░░░░█▀▀▀
░▀▄░░▀░░▀▀▀░░▀░░░▄█▀
░░░█░░░░░░░░░░░▄▀▄░▀▄
░░░█░░░░░░░░░▄▀█░░█░░█
░░░█░░░░░░░░░░░█▄█░░▄▀
░░░█░░░░░░░░░░░████▀
░░░▀▄▄▀▀▄▄▀▀▄▄▄█▀

Like what you see?
*/
#include <bits/stdc++.h>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
using namespace std;
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define pb push_back
#define pii         pair<ll ,ll>
#define vi          vector<ll>
#define present(container, element) (container.find(element) != container.end()) /* For set n maps */
#define cpresent(container, element) (find(all(container),element) != container.end()) /* For vectors */
#define all(a)      (a).begin(),(a).end()
#define invect(data,n,commands) for(int i = 0;i<n;i++){int tmp;cin>>tmp;data.pb(tmp);commands}
#define inset(data,n,commands) for(int i = 0;i<n;i++){int tmp;cin>>tmp;data.I(tmp);commands}
#define F           first
#define S           second
#define I           insert
#define sz(x)       (ll)x.size()
#define rep(i,a,b)    for(ll  i=a;i<b;i++)
#define repr(i,a,b) for(ll  i=a;i>b;i--)
#define trav(a, x) 	for(auto& a : x)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define lcase(a) (char)tolower(a)
#define ll long long int
#define lld long double
#define endl "\n"
#define PI 3.14159265358979323844
#define MOD 1000000007
#define max(a, b) (a < b ? b : a)
#define min(a, b) ((a > b) ? b : a)
#define mod 1e9 + 7
const int N = 1e5 + 5;
/*	For Debugging	*/
#define DEBUG 		cerr<<"\n>>>I'm Here<<<\n"<<endl;
#define display(x) trav(a,x) cout<<a<<" ";cout<<endl;
#define what_is(x)  cerr << #x << " is " << x << endl;

int32_t main()
{
   IOS

    int TESTS=1;
    //cin >> TESTS;
    while (TESTS--)
    {
        ll k,n;
        cin >> k>> n;
        vi v(n);
        rep(i,0,n)
        {
            cin >> v[i];
        }
        ll ans =v[n-1]-v[0];
        for(int i=0;i<n-1;i++)
        {
            ans=min(ans,k-(v[i+1]-v[i]));
        }
        cout<< ans << endl;

    }
    return 0;
}


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

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

int n, a;
map<int, int> cnt;

int main(int argc, char const *argv[]) {
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &a);
    ++cnt[a];
  }
  if (cnt.size() == 1) {
    puts(cnt[0] == n ? "Yes" : "No");
  } else if (cnt.size() == 2) {
    int a = cnt.begin()->second, b = cnt.rbegin()->second;
    if (a > b) swap(a, b);
    puts((2 * a == b && cnt[0] == a) ? "Yes" : "No");
  } else if (cnt.size() == 3) {
    int sum = 0, flag = 1;
    for (auto it : cnt) {
      sum ^= it.first;
      flag &= it.second == n / 3;
    }
    puts((!sum && flag) ? "Yes" : "No");
  } else {
    puts("No");
  }
}


Measured memory_bytes: 3840
#include <bits/stdc++.h>
using namespace std;
 
typedef vector<int> vi;
typedef vector<double> vd;
 
double mypow(double b ,int e){
      if(e == 0) return 1;
      if(e%2==0)
            return mypow( b*b, e/2 );
      else
            return mypow( b*b, e/2 ) * b;
}
 
int main(){
 
 
      int N,M,L; cin >> N >> M >> L ;
      if(N==1){
            cout << 1.0 << endl;
            return 0;
      }
      vector<vd> prob(N,vd(M+1,0.0));
      vector<vd> dist(N,vd(M+1,0.0));
 
      vd p(N),t(N),v(N);
      for(int i=0; i<N; i++) cin >> p[i] >> t[i] >> v[i];
 
      // PRE PROCESS
      for(int i=0; i<N; i++){
            dist[i][0] = (double)L / v[i];
            for(int j=1; j<=M; j++){
                  dist[i][j] = dist[i][j-1] + t[i];
            }
      }
      for(int i=0; i<N; i++)
            prob[i][0] = mypow((100-p[i])/100,M);
      for(int i=0; i<N; i++){
            for(int j=1; j<=M; j++){
                  if(p[i] != 100)
                        prob[i][j] = (prob[i][j-1] * (p[i]/100)) / ((100-p[i])/100);
                  else
                        prob[i][j] = 1.0;
            }
      }
      double comb = 1;
      for(int j=1; j<=M; j++){
            comb = comb * (M - j + 1) / j; 
            for(int i=0; i<N; i++){
                  prob[i][j] *= comb;
            }
      }
       
      vector<vd> sum = prob;
      for(int i=0; i<N; i++){
            for(int j=M-1; j>=0; j--){
                  sum[i][j] += sum[i][j+1];
                  if(sum[i][j] > 1) sum[i][j] = 1;
            }
      }
 
      vector<vd> ans = prob;
      for(int i=0; i<N; i++){
            for(int j=0; j<=M; j++){
                  for(int k=0; k<N; k++){
                        if(i==k) continue;
                        int id = upper_bound(dist[k].begin(),dist[k].end(), dist[i][j]) - dist[k].begin();
                        if(id > M) ans[i][j] = 0.0;
                        else       ans[i][j] *= sum[k][id];
 
                  }
            }
      }
 
      for(int i=0; i<N; i++){
            double tmp = 0.0;
            if(p[i] == 100) tmp = ans[i][M];
            else
                  for(int j=0; j<=M; j++)
                        tmp += ans[i][j];
            if(tmp > 1) tmp = 0;
            printf("%.10f\n",tmp);
      }
                         
}

Measured memory_bytes: 3400
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
typedef long long int ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<int> vi;
typedef vector<long long int> vl;
typedef vector<vector<int>> vvi;
typedef vector<vector<long long int>> vvl;
typedef pair<int, int> pii;
typedef pair<long long int, long long int> pll;
typedef vector<pair<int, int>> vii;
typedef vector<pair<long long int, long long int>> vll;
#define fast() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define test() long long int t; cin >> t; cin.ignore(); while(t--) 
#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define mp make_pair
#define MOD 1000000007
#define SMOD 998244353
#define pq priority_queue
#define all(x) x.begin(),x.end()
#define SP(x) setprecision(x)
#define sp " "
#define inp(a) ll a;cin>>a;cin.ignore()
#define inps(a,b) ll a,b;cin>>a>>b;cin.ignore()
#define out(a) cout<<SP(20)<<a<<'\n'
#define outs(a,b) cout<<SP(20)<<a<<" "<<b<<'\n'
#define ins insert
#define er erase
#define lb lower_bound
#define ub upper_bound
#define printclock cerr<<"Time : "<<1000*(ld)clock()/(ld)CLOCKS_PER_SEC<<"ms\n";
#define inpa(a,n) ll a[n]; for(int i=0; i<n; i++){cin>>a[i];}
#define inpv(a,n) vl a; for(int i=0; i<n; i++){inp(x);a.pb(x);}
#define outa(a,n) for(int i=0;i<n;i++){cout<<a[i]<<" ";}cout<<'\n';
#define outv(v) for(auto i:v){cout<<i<<" ";}cout<<'\n';
set<char> vow = {'a','e','i','o','u','A','E','I','O','U'};
ll xpow(ll n, ll m){if(m==0){return 1;}else{ll x = xpow(n, m/2);if(m&1){return x*x*n;}else{return x*x;}}}
ll xmod(ll a, ll m){return (((a%m)+m)%m);}
ll xmodpow(ll n, ll m, ll y){if(m==0){return 1;}else{ll x = xmodpow(n, m/2, y);if(m&1){return xmod((xmod((xmod(x,y)*xmod(x,y)),y)*xmod(n,y)),y);}else{return xmod((xmod(x,y)*xmod(x,y)),y);}}}
 
int main(){
    fast();
 
/* you get what you work for not what you wish for */
    
    ll n, k;
    cin >> n >> k;
    inpv(a, 3);
    string t;
    cin >> t;
    ll x[n] = {0};
    for(int i=0; i<n; i++){
        if(t[i]=='r'){
            x[i] = 2;
        }
        if(t[i]=='p'){
            x[i] = 1;
        }
    }
    for(int i=0; i<n; i++){
        if(i>=k){
            if(x[i]==x[i-k]){
                x[i] = -1;
            }
        }
    }
    ll ans = 0;
    for(int i=0; i<n; i++){
        if(x[i]>=0){
            ans += a[x[i]];
        }
    }
    out(ans);
}

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

void test() {
    const int kN = 100;
    int ans = 0;
    mt19937 rng(7122);
    uniform_int_distribution<int> dis(0, 5);
    array<int, kN + 1> c{};
    for (int i = 1; i <= kN; ++i) c[i] += dis(rng);
    for (int i = 1; i <= kN; ++i) {
        for (int j = 1; j <= kN; ++j) {
            if (__gcd(i, j) == 1) ans += i * j * c[i] * c[j];
        }
    }
    array<int, kN + 1> dp{};
    for (int i = 1; i <= kN; ++i) {
        int sum = 0;
        for (int j = i; j <= kN; j += i) sum += j * c[j];
        dp[i] = sum * sum;
    }
    for (int i = kN; i >= 1; --i) {
        for (int j = i + i; j <= kN; j += i) dp[i] -= dp[j];
    }
    printf("%d\n", ans);
    printf("%d\n", dp[1]);
}

const int maxn = 1e6 + 5;
const int mod = 998244353;
const int inv = 499122177;
int cnt[maxn], c[maxn], dp[maxn];

int main() {
    int n; scanf("%d", &n);
    for (int i = 0; i < n; ++i) {
        int a; scanf("%d", &a);
        cnt[a] += 1;
    }
    int ans = 0;
    for (int i = 1; i <= 1000000; ++i) {
        int ways = 1LL * cnt[i] * (cnt[i] - 1) / 2 % mod;
        ans += 1LL * i * ways % mod;
        ans %= mod;
    }
    for (int i = 1; i <= 1000000; ++i) {
        for (int j = i; j <= 1000000; j += i) c[j / i] = cnt[j];
        for (int j = 1; j <= 1000000 / i; ++j) {
            int sum = 0;
            for (int k = j; k <= 1000000 / i; k += j) {
                sum += 1LL * k * c[k] % mod;
                sum %= mod;
            }
            dp[j] = 1LL * sum * sum % mod;
        }
        for (int j = 1000000 / i; j >= 1; --j) {
            for (int k = j + j; k <= 1000000 / i; k += j) {
                dp[j] += mod - dp[k];
                dp[j] %= mod;
            }
        }
        if (dp[1]) {
            int sub = 1LL * c[1] * c[1] % mod;
            int add = (dp[1] + mod - sub) % mod;
            ans += 1LL * i * add % mod * inv % mod;
            ans %= mod;
        }
    }
    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 11904
# n個のスイッチ
# m個の電球

n,m = map(int,input().split())
a = [list(map(int,input().split())) for _ in range(m)]
p = list(map(int,input().split()))

#n,m = 2,2
#a = [[2,1,2],[1,2]]
#p = [0,1]

#n,m = 10,10
#a = [[4, 6, 3, 7, 5], [3, 1, 10, 5], [4, 8, 7, 1, 2], [5, 5, 10, 2, 7, 8], [6, 3, 1, 6, 8, 2, 5], [5, 6, 10, 7, 1, 3], [4, 3, 5, 7, 6], [4, 3, 9, 7, 5], [4, 3, 6, 5, 7], [4, 2, 7, 1, 8]]
#p = [0, 0, 1, 1, 1, 0, 0, 0, 0, 1]

ans = 0
for i in range(0,2**n): #スイッチの組み合わせを生成
  ck = True
  for j in range(0,m): #j番目の電球が付くかを確認
    # a[j][0]つながっているスイッチの数
    count = 0

    for k in range(0,a[j][0]):
      #print(a[j][k+1]) 番目のスイッチをチェック
      count += i>>(a[j][k+1]-1) & 1

    if count%2 != p[j]:
      ck = False
      break
  if ck:
    ans += 1
print(ans)


Measured memory_bytes: 3064
import java.util.*;
import static java.lang.Integer.*;
import static java.lang.Long.*;
import static java.lang.Math.*;
import static java.lang.System.*;

public class Main {
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(in);
		char[] n = sc.next().toCharArray();
		sc.close();
		out.println(n[0]==n[2]?"Yes":"No");
	}
}


Measured memory_bytes: 21716
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
//#include <math.h>
#include <string>
#include <numeric>
#include <queue>
#include <cstdio>
#include <cstring>
#include <cmath>
#define ll long long
#define rep(i,n) for(ll i=0;i<n;++i)
#define rep1(i,n) for(ll i=1;i<n;++i)
#define mrep(i,n) for(ll i=n;i>=0;--i)
#define all(a) (a).begin(),(a).end()
#define vl vector<ll>
#define vvl vector<vector<ll> >
#define vb vector<bool>
#define vvb vector<vector<bool> >
#define pl pair<ll,ll>
#define inf 1001001001001001000
//#define mod 1000000007
#define mod 998244353
#define pi 3.1415926535
using namespace std;
struct __INIT{
    __INIT(){
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout<<fixed<<setprecision(15);
    }
}__init;

vvl a;
vl c;
ll n,m,x,ans;

void dfs(vl ngo,ll now){
    if(now == n){
        ll cost = 0;
        vl score(m,0);
        rep(i,n){
            if(ngo[i] == 1){
                cost += c[i];
                rep(j,m){
                    score[j] += a[i][j];
                }
            }
        }
        rep(i,m) if(score[i] < x) return;
        ans = min(ans,cost);
        return;
    }
    ngo[now] = 0;
    dfs(ngo,now+1);
    ngo[now] = 1;
    dfs(ngo,now+1);
}

int main(void){
    cin>>n>>m>>x;
    a.resize(n,vl(m));
    c.resize(n);
    rep(i,n){
        cin>>c[i];
        rep(j,m) cin>>a[i][j];
    }
    ans = inf;
    vl ngo(n,0);
    dfs(ngo,0);
    if(ans == inf) cout<<-1<<endl;
    else cout<<ans<<endl;
}

Measured memory_bytes: 3668
<?php
$n = intval(trim(fgets(STDIN)));
$k = intval(trim(fgets(STDIN)));
$x = intval(trim(fgets(STDIN)));
$y = intval(trim(fgets(STDIN)));
if ($n <= $k){
    $ans = $n*$x;
} else {
    $ans = $k*$x+($n-$k)*$y;
}
print("$ans\n");
?>

Measured memory_bytes: 4728
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pii pair<int,int>
vector<pii>p;
map<pii,int>m;
int main()
{
    int n,x,y;
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
    {
        scanf("%d%d",&x,&y);
        p.push_back({x,y});
    }
    for(int i=0;i<n;i++)
        for(int j=0;j<n;j++)
    {
        if(i==j)continue;
        m[{p[i].first-p[j].first,p[i].second-p[j].second}]++;
    }
    int maxx=0;
    for(auto i : m)
    {
            maxx=max(maxx,i.second);
    }
    printf("%d\n",n-maxx);
    return 0;
}


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

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

Measured memory_bytes: 256
import java.util.*;

public class Main{
    void solve(){
        Scanner scan = new Scanner(System.in);
        long a = scan.nextInt();
        long b = scan.nextInt();
        long c = scan.nextInt();
        long d = scan.nextInt();
        long out = a * c;
        out = Math.max(out, a * d);
        out = Math.max(out, b * c);
        out = Math.max(out, b * d);
        System.out.println(out);
    }

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


Measured memory_bytes: 35824
# author:  Taichicchi
# created: 27.09.2020 23:31:22

import sys

from collections import Counter

N = int(input())

a = list(map(int, input().split()))

ls = []

for A in a:
    ls.append(A - 1)
    ls.append(A)
    ls.append(A + 1)

c = Counter(ls)

ans = max(c.values())

print(ans)


Measured memory_bytes: 31644
import math
mod=10**9+7
n=int(input())
a=list(map(int,input().split()))
m=max(a)+1
g=a[0]
d=dict()
for i in a:
    g=math.gcd(g,i)
    if i in d:
        d[i]+=1
    else:
        d[i]=1
if g>1:
    print("not coprime")
else:
    p=[0]*(m)
    ch=0
    for i in range (2,m):
        if p[i]==1:
            continue
        p[i]=1
        ans=0
        for j in range (i,m,i):
            if j in d:
                ans+=d[j]
        if ans>1:
            ch=1
            break
    if ch==1:
        print("setwise coprime")
    else:
        print("pairwise coprime")

Measured memory_bytes: 134332
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
#define PUTS(x) cout << (x) << endl;
#define rep(i, n) for (int i = 0, i##_len = (int)(n); i < i##_len; i++)
#define reps(i, n) for (int i = 1, i##_len = (int)(n); i <= i##_len; i++)
#define PB push_back
#define MP make_pair
#define MT make_tuple
#define F first
#define S second
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) ((int)(x).size())
#define LEN(x) ((int)(x).length())
#define MOD 1000000007
vector<Int> IntsIn(int n) {
    auto v = vector<Int>(0);
    for (int i = 0; i < n; i++) {
        Int a;
        cin >> a;
        v.push_back(a);
    }
    return v;
}

int main() {
    Int N, K;
    cin >> N >> K;
    auto P = IntsIn(N);
    auto C = IntsIn(N);

    auto test = [&](Int start) -> Int {
        Int i = 0;
        Int maxScore = -100000000000;
        Int currentScore = 0;
        auto counts = vector<Int>(N, -1);
        auto totalScores = vector<Int>(N, 0);

        bool flag = false;
        while (i < K) {
            i++;
            Int nextIndex = P[start] - 1;
            Int nextScore = C[nextIndex];
            if (counts[nextIndex] > 0 && !flag) {
                currentScore += nextScore;
                if (currentScore <= totalScores[nextIndex]) {
                    return maxScore;
                } else {
                    flag = true;
                    Int r = K - i; //残りホップ数
                    Int loop = i - counts[nextIndex]; // ループ長
                    Int z = currentScore - totalScores[nextIndex]; //1ループあたりの増量
                    Int q = r / loop;
                    if (q >= 1) {
                        q--;
                    }
                    currentScore += z * q;
                    maxScore = max(maxScore, currentScore);
                    //PUTS("CASE")
                    i += q * loop;
                    start = nextIndex;
                }
            } else {
                currentScore += nextScore;
                maxScore = max(maxScore, currentScore);
                totalScores[nextIndex] = currentScore;
                counts[nextIndex] = i;
                start = nextIndex;
            }
        }
        return maxScore;
    };

    Int ans = -100000000000;
    rep(i, N) {
        auto t = test(i);
        ans = max(ans, t);
    }
    PUTS(ans)
}


Measured memory_bytes: 3748
#include<bits/stdc++.h>
using namespace std;
#define ll int64_t
#define rep(i,n) for(int64_t i=0;i<n;++i)
#define P pair<ll,ll>
#define Graph vector<vector<ll>>
#define fi first
#define se second
constexpr int64_t INF=(1ll<<60);
constexpr int64_t mod=1000000007;
constexpr double pi=3.14159265358979323846;
template<typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

#define MAX 1000100
ll fac[MAX],finv[MAX],inv[MAX];
// テーブルを作る前処理
void COMinit() {
    fac[0]=fac[1]=1;
    finv[0]=finv[1]=1;
    inv[1]=1;
    for (ll i=2;i<MAX;i++){
        fac[i]=fac[i-1]*i%mod;
        inv[i]=mod-inv[mod%i]*(mod/i)%mod;
        finv[i]=finv[i-1]*inv[i]%mod;
    }
}
// 二項係数計算
ll combi(ll n,ll k){
    if(n<k) return 0;
    if(n<0 || k<0) return 0;
    return fac[n]*(finv[k]*finv[n-k]%mod)%mod;
}
//mainに   COMinit();   を入れる

int main(){
    COMinit();
    ll n,k;cin>>n>>k;
    vector<ll> a(n);
    rep(i,n){
        cin>>a[i];
    }
    sort(a.begin(),a.end());

    ll Max=0,Min=0;
    for(ll i=1;i<=n-k+1;i++){
        if(n-i<k-1) continue;
        Max+=(a[n-i]*combi(n-i,k-1)+mod)%mod;
        Max=(Max+mod)%mod;
    }

    for(ll i=1;i<=n-k+1;i++){
        if(n-i<k-1) continue;
        Min+=(a[i-1]*combi(n-i,k-1)+mod)%mod;
        Min=(Min+mod)%mod;
    }

    cout<<(Max-Min+mod)%mod<<endl;

    return 0;
}

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

using Float = double;
using Point = complex<Float>;
struct Circle{ Point center; Float r; };

const Float EPS = 1e-8;

Float distance(Point &p1,Point &p2){
    return abs(p1 - p2);
}

bool isContain(Circle &c,Point &p){
    return (distance(c.center,p) <= c.r + EPS);
}

bool isContain(Circle &c1,Circle &c2){
    return (c1.r - EPS>= c2.r + distance(c1.center,c2.center));
}

bool isIntersect(Circle &c1,Circle &c2){
    return (distance(c1.center,c2.center) <= c1.r + c2.r + EPS);
}

void calcContainable(vector<Circle> &circs,vector<int> &ret){
    sort(circs.begin(),circs.end(),[](const Circle &c1,const Circle &c2){
        return c1.r < c2.r;
    });
    ret.resize(circs.size());
    for(int i = 0;i < circs.size();i++){
        ret[i] = 1;
        for(int j = 0;j < i;j++){
            if(isContain(circs[i],circs[j])){
                ret[i] = max(ret[i],ret[j] + 1);
            }
        }
    }
}

signed main(){
    int n;
    while(cin >> n,n){
        Float xs,ys,xt,yt;
        vector<Circle> circleS,circleT;
        int ans = 0;
        cin >> xs >> ys >> xt >> yt;
        Point ps = Point(xs,ys),pt = Point(xt,yt);
        for(int i = 0;i < n;i++){
            Float x,y,r;
            cin >> x >> y >> r;
            Circle circ = {Point(x,y),r};
            if(isContain(circ,ps) ^ isContain(circ,pt)){
                (isContain(circ,ps) ? circleS : circleT).push_back(circ);
            }
        }
        vector<int> containableS,containableT;
        calcContainable(circleS,containableS);
        calcContainable(circleT,containableT);
        for(int i = 0;i < circleS.size();i++) ans = max(ans,containableS[i]);
        for(int i = 0;i < circleT.size();i++) ans = max(ans,containableT[i]);
        for(int i = 0;i < circleS.size();i++){
            for(int j = 0;j < circleT.size();j++){
                if(!isIntersect(circleS[i],circleT[j])) ans = max(ans,containableS[i] + containableT[j]);
            }
        }
        cout << ans << endl;
    }
    return 0;
}


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

typedef long long int lli;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<lli> vli;
typedef priority_queue <int, vector <int>, greater <int> > min_pq;

const int MOD	= 1e9 + 7;

#define fastio			ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define init(a)         memset(a,0,sizeof(a))    
#define pb              push_back  
#define all(a)          a.begin(),a.end()  
#define loop(i,n)       for(int i=0;i<n;i++)  
#define loops(i,s,n)    for(int i=s;i<n;i++)
#define rloop(i,n)      for(int i=n-1;i>=0;i--)
#define rloops(i,s,n)   for(int i=n-1;i>=s;i--)

template<typename T> T gcd(T a, T b){return(b?__gcd(a,b):a);}
template <typename T> T lcm(T a, T b){return (a*b)/gcd(a,b); }


double tick(){static clock_t oldt,newt=clock();double diff=1.0*(newt-oldt)/CLOCKS_PER_SEC;oldt=newt;return diff;}
//---------------------------------------------------------------------------------------------


int main(){
    fastio;

    // #ifndef ONLINE_JUDGE
	// 	freopen("in.txt", "r", stdin);
	// #endif

    
    string ans[3];
    ans[0] =   "Sunny";
    ans[1] =   "Cloudy";
    ans[2] =   "Rainy";
    string s;
    cin>>s;
    loop(i,3){
        if(s == ans[i]){
            cout<<ans[(i+1)%3]<<endl;
            break;
        }
    }
    // cout<<"Execution time : "<<tick()<<"\n";

    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		if(a<b){
			System.out.println("a < b");
		}else if(a>b){
			System.out.println("a > b");
		}else {
			System.out.println("a == b");
		}
		
	}

}

Measured memory_bytes: 26352
class Array
	def insertion_sort(n)
		copy = self
		puts copy.map(&:to_s).join(" ")
		for i in 1..n-1
			tmp = copy[i]
			if copy[i-1] > tmp
				j = i
				begin
					copy[j] = copy[j-1]
					j = j - 1
				end while j > 0 && copy[j-1] > tmp
				copy[j] = tmp;
			end
			puts copy.map(&:to_s).join(" ")
		end
	end
end


N = gets.to_i
arr = gets.split.map(&:to_i)
arr.insertion_sort(N)

Measured memory_bytes: 8736
#include <stdio.h>

int main(void){
	int N,K;
	int size[100000];
	int count;
	int i;
	scanf("%d %d",&N, &K);
	for(i=0; i<N; i++)
		scanf("%d",&size[i]);

	count=0;
	for(i=0; i<N; i++)
		if(size[i] >= K) count++;

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

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

int main(){
    string s;
    int i,a,b,c;
    cin >> s;
    a=0;
    b=0;
    c=0;
    for(i=0;i<3;i++){
        if(s.at(i)=='a'){
            a++;
        }
        else if(s.at(i)=='b'){
            b++;
        }
        else if(s.at(i)=='c'){
            c++;
        }
    }
    if((a==1)&&(b==1)&&(c==1)){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <ctype.h>
#include <algorithm>
#include <string>

using namespace std;

#define U unsigned
#define S short
#define L long
#define LL long long 
#define LLU long long unsigned

//Reading and Printing Arrays

//short int
#define rhd(arr, n) for(int aab = 0; aab < n; aab++){scanf("%hd", &arr[aab]);}
#define phd(arr, n) for(int aab = 0; aab < n; aab++){printf("%hd ", arr[aab]);}
//int
#define rd(arr, n) for(int aab = 0; aab < n; aab++){scanf("%d", &arr[aab]);}
#define pd(arr, n) for(int aab = 0; aab < n; aab++){printf("%d ", arr[aab]);}
//unsigned int
#define ru(arr, n) for(int aab = 0; aab < n; aab++){scanf("%u", &arr[aab]);}
#define pu(arr, n) for(int aab = 0; aab < n; aab++){printf("%u ", arr[aab]);}
//long int
#define rld(arr, n) for(int aab = 0; aab < n; aab++){scanf("%ld", &arr[aab]);}
#define pld(arr, n) for(int aab = 0; aab < n; aab++){printf("%ld ", arr[aab]);}
//unsigned long int
#define rlu(arr, n) for(int aab = 0; aab < n; aab++){scanf("%lu", &arr[aab]);}
#define plu(arr, n) for(int aab = 0; aab < n; aab++){printf("%lu ", arr[aab]);}
//long long int
#define rlld(arr, n) for(int aab = 0; aab < n; aab++){scanf("%lld", &arr[aab]);}
#define plld(arr, n) for(int aab = 0; aab < n; aab++){printf("%lld ", arr[aab]);}
//unsigned long long int
#define rllu(arr, n) for(int aab = 0; aab < n; aab++){scanf("%llu", &arr[aab]);}
#define pllu(arr, n) for(int aab = 0; aab < n; aab++){printf("%llu ", arr[aab]);}
//float
#define rf(arr, n) for(int aab = 0; aab < n; aab++){scanf("%f", &arr[aab]);}
#define pf(arr, n) for(int aab = 0; aab < n; aab++){printf("%f ", arr[aab]);}
//double
#define rlf(arr, n) for(int aab = 0; aab < n; aab++){scanf("%lf", &arr[aab]);}
#define plf(arr, n) for(int aab = 0; aab < n; aab++){printf("%lf ", arr[aab]);}
//char
#define rc(arr, n) for(int aab = 0; aab < n; aab++){scanf("%c", &arr[aab]);}
#define pc(arr, n) for(int aab = 0; aab < n; aab++){printf("%c", arr[aab]);}
//string
#define rs(arr) scanf("%s", arr);
#define ps(arr) puts(arr);

//swap
#define swap(a, b, tip) tip tempswap = a;a = b;b = tempswap;
//freopen
#define freopen freopen("in.txt", "r", stdin);freopen("out.txt", "w", stdout);

/*       ▄▀▄     ▄▀▄
        ▄█░░▀▀▀▀▀░░█▄
    ▄▄  █░░░░░░░░░░░█  ▄▄
   █▄▄█ █░░▀░░┬░░▀░░█ █▄▄█       */

int min(int a, int b){	return a <= b ? a : b;}
int max(int a, int b){	return a >= b ? a : b;}
int findmin(long long arr[], long long n){int min = 0;for(int i = 1; i < n;min = arr[i] < arr[min] ? i : min, i++);return min;}
int findmax(long long int arr[], long long int n){int max = 0;for(int i = 1; i < n;max = arr[i] > arr[max] ? i : max, i++);return max;}
long long int arrsum(long long arr[], long long int n){long long int sum = 0;for(int i = 0; i < n; sum += arr[i], i++);return sum;}
	
int main(){
	int k, n;
  
	scanf("%d %d", &k, &n);

	int arr[n];

	LL sum = 0, max;

	rd(arr, n);

	sum += max = arr[0] + (k - arr[n - 1]);

	for(int i = 0; i < n - 1; i++){
		sum += arr[i + 1] - arr[i];
		if(max < arr[i + 1] - arr[i]){
			max = arr[i + 1] - arr[i];
		}
	}

	printf("%lld", sum - max);
}


Measured memory_bytes: 896
fn get_input() -> String {
    let mut word = String::new();
    std::io::stdin().read_line(&mut word).ok();
    return word.trim().to_owned();
}

fn main() {
    let line = get_input();
    let mut split_line = line.split_whitespace();

    let r:u32 = split_line.next().unwrap().parse().unwrap();
    let d:u32 = split_line.next().unwrap().parse().unwrap();

    let mut x:Vec<u32> = Vec::new();
    x.push( split_line.next().unwrap().parse().unwrap() );

    for i in 0..10 {
        let ans = r * x[i] - d;
        println!("{}", ans);
        x.push(ans);
    }
}

Measured memory_bytes: 4352
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#define ll long long int
#define pb push_back
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
using namespace std;

int mx8[] = {0,0,1,-1,-1,1,-1,1};
int my8[] = {-1,1,0,0,-1,-1,1,1};
int mx4[] = {1,-1,0,0};
int my4[] = {0,0,-1,1};
const int MOD = 1000000007;

int main() {
    string s; cin >> s;
    int n = s.size();

    string ans = "";
    rep(i,n){
        if(s[i] == '0') ans += '0';
        else if(s[i] == '1') ans += '1';
        else {
            int m = ans.size();
            if(m == 0) continue;
            else ans.erase(m-1);
        }
    }
    cout << ans << endl;
}





Measured memory_bytes: 3588
#include <bits/stdc++.h>                                           
 
#define int long long
//#pragma GCC optimize("Ofast")
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4")
 
 
#define file(s) freopen(s".in","r",stdin); freopen(s".out","w",stdout);
#define forev(i, b, a) for(int i = (b); i >= (a); --i)
#define forn(i, a, b) for(int i = (a); i <= (b); ++i)
#define all(x) x.begin(), x.end()
#define sz(s) (int)s.size()
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define s second
#define f first
 
 
using namespace std;
 
 
typedef pair < long long, long long > pll;    
typedef pair < int, int > pii;
typedef unsigned long long ull;         
typedef vector < pii > vpii;
typedef vector < int > vi;
typedef long double ldb;  
typedef long long ll;  
typedef double db;                             
 
 
const int dx[] = {1, -1, 0, 0}, dy[] = {0, 0, 1, -1}, block = 555;
const pii base = mp(1171, 3307), Mod = mp(1e9 + 7, 1e9 + 9);
const int inf = 1e9, maxn = 4e5 + 148, mod = 1e9 + 7, N = 2e5 + 11;
const db eps = 1e-12, pi = 3.14159265359;
const ll INF = 1e18;


string s, t;

main () {
	cin >> s >> t;
	t.ppb();
	if (s == t)
		cout << "Yes";	
	else
		cout << "No";
	
	
}


Measured memory_bytes: 3636
#include <iostream>
#include <string>

using namespace std;

int main() {
    long long a;
    string b;
    cin >> a >> b;
    cout << a * (100 * (b[0] - '0') + 10 * (b[2] - '0') + (b[3] - '0')) / 100 << endl;
}


Measured memory_bytes: 3628
//B Ed 31
#include<bits/stdc++.h>
#define int long long
using namespace std;

signed main()
{
	string s;
	int flag=0;
	cin>>s;
	for(int i=0;i<3;i++)
	{
		if(s[i+1]==s[i])
		{
			flag=1;
			break;
		}

	}
	if(flag)
		cout<<"Bad";
	else
		cout<<"Good";
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define all(v) v.begin(), v.end()
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define Rep(n) for (ll _ = 0; _ < (ll)(n); _++)
#define P pair<ll,ll>
#define fs first
#define sc second

template<class S>S sum(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
ll min(int a,ll b){return min((ll)a,b);} ll min(ll a,int b){return min(a,(ll)b);}
template <class S> void print(vector<S> &v){for(ll i=0; i<(ll)v.size(); i++){cerr << v[i] << ' ';}cerr << endl;}
template <class S> void print(vector<vector<S>> &v) {for (ll i = 0; i < (ll)v.size(); i++) {for (ll j = 0; j < (ll)v[i].size(); j++) {cerr << v[i][j] << ' ';}cerr << endl;}}

const int mod = 998244353;
struct mint {
  ll x;  // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  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) const { return mint(*this) += a; }
  mint operator-(const mint a) const { return mint(*this) -= a; }
  mint operator*(const mint a) const { return mint(*this) *= a; }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod - 2); }
  mint& operator/=(const mint a) { return *this *= a.inv(); }
  mint operator/(const mint a) const { return mint(*this) /= a; }
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x; }
ostream& operator<<(ostream& os, const mint& a) { return os << a.x; }

int main(){
	int n,s; cin >> n >> s;
	vector<int> a(n);
	rep(i,n) cin >> a[i];
	mint inv2 = mint(2).inv();
	vector<vector<mint>> dp(n, vector<mint>(s+1,mint(0)));
	if(a[0] <= s)
	dp[0][a[0]] = mint(2).pow(n-1);
	for(int i=1; i<n; i++){
		for(int j=1; j<=s; j++){
			dp[i][j] = dp[i-1][j];
			if(j - a[i] == 0){
				dp[i][j] += mint(2).pow(n-1);
			}else if(j - a[i] > 0){
				dp[i][j] += dp[i-1][j-a[i]] * inv2;
			}
		}
	}
	cout << dp[n-1][s] << endl;
}


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

using namespace std;

typedef long long ll;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int main()
{
    ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
    string str;
    cin>>str;
    for(int i=0;i<str.size();i++)
    {
        if((i&1)&&(str[i]=='R'))
        {
            cout<<"No"<<endl;
            return 0;
        }
        if(!(i&1)&&(str[i]=='L'))
        {
            cout<<"No"<<endl;
            return 0;
        }
    }
    cout<<"Yes"<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h> //Ithea Myse Valgulious
namespace chtholly{
typedef long long ll;
#define re0 register int
#define rec register char
#define rel register ll
#define gc getchar
#define pc putchar
#define p32 pc(' ')
#define pl puts("")
/*By Citrus*/
inline int read(){
  int x=0,f=1;char c=gc();
  for (;!isdigit(c);c=gc()) f^=c=='-';
  for (;isdigit(c);c=gc()) x=(x<<3)+(x<<1)+(c^'0');
  return f?x:-x;
  }
template <typename mitsuha>
inline bool read(mitsuha &x){
  x=0;int f=1;char c=gc();
  for (;!isdigit(c)&&~c;c=gc()) f^=c=='-';
  if (!~c) return 0;
  for (;isdigit(c);c=gc()) x=(x<<3)+(x<<1)+(c^'0');
  return x=f?x:-x,1;
  }
template <typename mitsuha>
inline int write(mitsuha x){
  if (!x) return 0&pc(48);
  if (x<0) x=-x,pc('-');
  int bit[20],i,p=0;
  for (;x;x/=10) bit[++p]=x%10;
  for (i=p;i;--i) pc(bit[i]+48);
  return 0;
  }
inline char fuhao(){
  char c=gc();
  for (;isspace(c);c=gc());
  return c;
  }
}using namespace chtholly;
using namespace std;
 
int sum(ll x){return x<10?x:x%10+sum(x/10);}
 
int main(){
int k=read();
for (ll s=1,d=1;k--;s+=d) 
  for (write(s),pl;1.0*(s+d)/sum(s+d)>1.0*(s+(d<<1))/sum(s+(d<<1));) 
    d=(d<<3)+(d<<1);
}
/*
    令f(n)是对于某个n>N来说n/s(n)最小的正整数(如果碰到平局的情况,选择最小的那一个数.).
一开始令N=1,然后不断把f(N+1)赋值给N,我们就可以将所有的Snuke number按照递增的顺序罗列出来.
现在我们要做的是算出每一个N对应的f(N).
    我们可以证明f(N)总是可以通过把N的最后面(最不重要的)k个数字变成9而得到.
	令x=f(N).简单来说,我们令xi表示x的第i个数字(也就是x中10^i的系数).假设x>N并且第d个数字是 
x与N不相等的第一个(最重要的)数字.(注意N和x总是有相同数量的数字,比如说可以轻松证明999...999
永远是一个Snuke Number.)我们现在需要证明x0=x1=...=xd=9.
    如果对于某个i<d,xi<9,令y是那个可以被从xi变成9,并且xd变成xd-1而变成的数字.这样的话非常
清楚,N<=y<x并且s(y)>=s(x).这样与x/s(x)最小矛盾.所以x0=...=x[d-1]=9. 
    那么我们知道x0=...=x[d-1],xd不知道,并且x[d+1]以及之后的N的每一个位置上的数都不知道.
接下来我们定义z为当xd=0且w=xd的时候的x.那么可以得到x=z+w*10^d,s(x)=s(z)+w,且x/s(x)=(z+w*10^d)/(s(z)+w).
这是一个关于w的单调函数,最佳的w值既是最小的合法值,也是N的第d个位置上的数或者是最大的合法值(即9).
我们知道第d个位置的数,是x和N不等的地方,那么xd=9.(这种观察是不必要的-即使不观察,最终符合条件
的候选也是足够的.)
    那么我们已经把x的候选给限制了.对于每一个候选计算出x/s(x).f(N)就是使该值最小的数. 
*/

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

using namespace std;

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

    int n;
    long long k;
    cin >> n >> k;
    vector<int> a(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    vector<int> f(n);
    for (int i = 0; i < n; ++i) {
        cin >> f[i];
    }
    sort(a.rbegin(), a.rend());
    sort(f.begin(), f.end());

    auto can = [&](long long mn) {
        long long rem = k;
        for (int i = 0; i < n; ++i) {
            long long need = max(0LL, a[i] - mn / f[i]);
            rem -= need;
            if (rem < 0) {
                return false;
            }
        }
        return true;
    };

    long long left = -1, right = 1e13;
    while (left + 1 < right) {
        long long mid = (left + right) / 2;
        if (can(mid)) {
            right = mid;
        } else {
            left = mid;
        }
    }
    cout << right << '\n';
    
    return 0;
}

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

int main() {
    ll n;cin>>n;
    string str;
    while(n!=0){
        int x=(n-1)%26;
        char ch='a'+x;
        str=ch+str;
        n=(n-1)/26;
    }
    cout<<str;
}


Measured memory_bytes: 3600
#include<cstdio>
int main()
{
	int A,B,C,D;
	scanf("%d %d %d %d",&A,&B,&C,&D);
	int area1,area2;
	area1=A*B;
	area2=C*D;
	if(area1>area2) printf("%d",area1);
	else if(area1<area2) printf("%d",area2);
	else printf("%d",area1);
	return 0;
}

Measured memory_bytes: 128
list=input().split()

i=0

for j in range(len(list)):
	if list[i]=='+':
		list[i]=int(list[i-1])+int(list[i-2])
		del list[i-2]
		del list[i-2]
		i-=2
	elif list[i]=='-':
		list[i]=int(list[i-2])-int(list[i-1])
		del list[i-2]
		del list[i-2]
		i-=2
	elif list[i]=='*':
		list[i]=int(list[i-1])*int(list[i-2])
		del list[i-2]
		del list[i-2]
		i-=2
	elif list[i]=='/':
		list[i]=int(list[i-2])/float(list[i-1])
		del list[i-2]
		del list[i-2]
		i-=2
	i+=1

print(list[0])


Measured memory_bytes: 5608
#include <iostream>
#include <string>
#include <set>
int main()
{
	std::string str;
	std::cin >> str;
	std::set<char> s;
	for(int i = 0; i < str.size(); i++){
		s.insert(str[i]);
	}
	std::cout << ((s.size() == str.size()) ? "yes" : "no") << std::endl;
	return 0;
}


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

#define LL long long
#define LD long double
#define SC(t,x) static_cast<t>(x)
#define AR(t) vector < t >
#define PII pair < int, int >
#define PLL pair < LL, LL >
#define PIL pair < int, LL >
#define PLI pair < LL, int >
#define MP make_pair
#define PB push_back
#define PF push_front
#define POB pop_back
#define POF pop_front
#define PRF first
#define PRS second
#define INIT(ar,val) memset ( ar, val, sizeof ( ar ) )
#define lp(loop,start,end) for ( int loop = start; loop < end; ++loop )
#define lpd(loop,start,end) for ( int loop = start; loop > end; --loop )
#define lpi(loop,start,end) for ( int loop = start; loop <= end; ++loop )
#define lpdi(loop,start,end) for ( int loop = start; loop >= end; --loop )
#define qmax(a,b) (((a)>(b))?(a):(b))
#define qmin(a,b) (((a)<(b))?(a):(b))
#define qabs(a) (((a)>=0)?(a):(-(a)))

const int INF = 0x3fffffff;
const int SINF = 0x7fffffff;
const long long LINF = 0x3fffffffffffffff;
const long long SLINF = 0x7fffffffffffffff;
const int MAXN = 100007;
const int MOD = 1000000007;

int n;
char s[MAXN];
int dp[MAXN], ps[3];
bool hv[3];

void init ();
void input ();
void work ();

int add ( int x, int y )
{
	return ( ( x += y ) < MOD ) ? x : ( x - MOD );
}

void addv ( int &x, int y )
{
	( ( x += y ) < MOD ) ? x : ( x -= MOD );
}

int sub ( int x, int y )
{
	return ( ( x -= y ) >= 0 ) ? x : ( x + MOD );
}



int main()
{
	init();
	input();
	work();
}



void init ()
{
	// Init Everything Here
	
	ios::sync_with_stdio ( false );
}

void input ()
{
	// input method
	
	scanf ( "%s", s+1 );
}

void work ()
{
	// main work
	
	n = strlen ( s + 1 );
	int np = 0;
	dp[0] = ps[0] = 1;
	lpi ( i, 1, n ){
		( np += s[i] - 'a' + 1 ) %= 3;
		dp[i] = sub ( add ( add ( ps[0], ps[1] ), ps[2] ), ps[np] );
		if ( np && hv[0] ) addv ( dp[i], 1 );
//		cerr << i << " : " << dp[i] << endl;
		ps[np] = dp[i];
		hv[np] = true;
	}
	if ( !hv[1] || !hv[2] ) cout << 1 << endl;
	else cout << dp[n] << endl;
}

Measured memory_bytes: 768
d={}
n,k,q=map(int,input().split())
c=k-q
if c>=1:
    for i in range(q):
        a=int(input())
    for i in range(n):
        print("Yes")
else:
    for i in range(q):
        a=int(input())-1
        if a in d:
            d[a]+=1
        else:
            d[a]=c+1
    for i in range(n):
        if i in d:
            if d[i]>0:
                print("Yes")
            else:
                print("No")
        else:
            print("No")


Measured memory_bytes: 54872
#include <iostream>
#include <queue>
#define MAX_VERTICE_NUM 100001
#define INF 2147483647
using namespace std;

typedef pair<int, int> pii;

int V, E, r, si, ti, di;
int d[MAX_VERTICE_NUM];
int S[MAX_VERTICE_NUM];
vector< vector<pii> > graph;
priority_queue< pii, vector<pii>, greater<pii> > q;

void init() {
    cin >> V >> E >> r;
    graph.resize(V);

    for (int i = 0; i < V; ++i) {
        S[i] = 0;
        d[i] = i == r ? 0 : INF;
    }
    for (int i = 0; i < E; ++i) {
        cin >> si >> ti >> di;
        graph[si].push_back(make_pair(di, ti));
    }
    q.push(make_pair(d[r], r));
}

void dijkstra() {
    while (!q.empty()) {
        pii tmp = q.top(); q.pop();
        int x = tmp.second;
        if (S[x]) {continue;}
        S[x] = 1;
        for (int i = 0; i < graph[x].size(); ++i) {
            if (d[x] + graph[x][i].first < d[graph[x][i].second]) {
                d[graph[x][i].second] = d[x] + graph[x][i].first;
                q.push(make_pair(d[graph[x][i].second], graph[x][i].second));
            }
        }
    }
}

void opAns() {
    for (int i = 0; i < V; ++i) {
        if (d[i] < INF) {
            cout << d[i] << endl;
        } else {
            cout << "INF" << endl;
        }
    }
}

int main() {
    //freopen("in14.txt", "r", stdin);

    init();
    dijkstra();
    opAns();
}

Measured memory_bytes: 13300
#include<iostream>
using namespace std;
int main(){
	int a[10];
	int b[10];
	int s[2];
	int i=0;
	int j=0;
	int n=10;
	int k=0;
	
	s[1]=0;
	s[0]=0;
	for(i=0;i<10;i++){
		cin>>a[i];
	}
	for(i=0;i<10;i++){
		cin>>b[i];
	}
	for(i=0;i<3;i++){
		for(j=0;j<n;j++){
			if(a[k]<a[j]){
				k=j;
			}
		}
		s[0]=s[0]+a[k];
		n=n-1;
		for(j=k;j<n;j++){
			a[j]=a[j+1];
		}
		k=0;
	}
	n=10;
	for(i=0;i<3;i++){
		for(j=0;j<n;j++){
			if(b[k]<b[j]){
				k=j;
			}
		}
		s[1]=s[1]+b[k];
		n=n-1;
		for(j=k;j<n;j++){
			b[j]=b[j+1];
		}
		k=0;
	}
	cout<<s[0]<<" "<<s[1]<<endl;
}
		

Measured memory_bytes: 3104