akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a[4];
	for(int i=0;i<4;i++)
		scanf("%d",&a[i]);
	sort(a,a+4);
	if(a[0]==1 && a[1]==4 && a[2]==7 && a[3]==9)
		cout<<"YES"<<endl;
	else
		cout<<"NO"<<endl; 
	return 0;
} 

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

using namespace std;

int main()
{
   string a, b;
    cin>>a>>b;
    if(a.size()>b.size()) printf("GREATER\n");
    else if(a.size()<b.size()) printf("LESS\n");
    else{
        if(a>b) printf("GREATER\n");
    else if(a<b) printf("LESS\n");
    else printf("EQUAL\n");
    }
    return 0;
}


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

using namespace std;

using int64 = long long;

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

  int n, x;
  cin >> n >> x;
  if (x == 1 || x == 2 * n - 1) {
    cout << "No" << endl;
    return 0;
  }
  cout << "Yes" << endl;
  if (x == n) {
    for (int i = 1; i <= 2 * n - 1; i++) {
      cout << i << endl;
    }
    return 0;
  }

  vector<int> bs(2 * n - 1, -1);
  vector<int> used(2 * n);
  if (x < n) {
    bs[n - 1] = 1;
    bs[n] = x;
    bs[n - 2] = x + 1;
    bs[n + 1] = x + 2;
    used[1] = used[x] = used[x + 1] = used[x + 2] = true;
    int current = 1;
    for (int i = 0; i < 2 * n - 1; i++) {
      if (bs[i] < 0) {
        while (used[current]) current++;
        bs[i] = current;
        used[current] = true;
      }
    }

    for (int i = 0; i < 2 * n - 1; i++) {
      cout << bs[i] << endl;
    }
  } else {
    bs[n - 1] = 2 * n - 1;
    bs[n] = x;
    bs[n - 2] = x - 1;
    bs[n + 1] = x - 2;
    used[2 * n - 1] = used[x] = used[x - 1] = used[x - 2] = true;
    int current = 1;
    for (int i = 0; i < 2 * n - 1; i++) {
      if (bs[i] < 0) {
        while (used[current]) current++;
        bs[i] = current;
        used[current] = true;
      }
    }

    for (int i = 0; i < 2 * n - 1; i++) {
      cout << bs[i] << endl;
    }
  }
}


Measured memory_bytes: 3072
#include <bits/stdc++.h>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <iostream>
#include <iomanip>
using namespace std;
typedef long long LL;
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}
 

int main(){
    int H, W, M;
    cin >> H >> W >> M;
    typedef pair<int, int> pair_items;
    set<pair_items> st;
    REP(i,M){
        int a, b;
        cin >> a >> b;
        st.insert({a, b});
    }
    map<int, int> mph, mpw;
    int hmax_value = 0;
    int wmax_value = 0;
    
    for(auto tmp: st){
        chmax(hmax_value, ++mph[tmp.first]);
        chmax(wmax_value, ++mpw[tmp.second]);
    }

    vector<int> h_maxes, w_maxes;

    for(auto h_item: mph){
        if(h_item.second == hmax_value){
            h_maxes.push_back(h_item.first);
        }
    }

    for(auto w_item: mpw){
        if(w_item.second == wmax_value){
            w_maxes.push_back(w_item.first);
        }
    }

    for(auto hval: h_maxes){
        for(auto wval : w_maxes){
            if(st.find({hval, wval})==st.end()){
                cout << hmax_value + wmax_value << endl;
                return 0;
            }
        }
    }
    cout << hmax_value + wmax_value - 1 << endl;
    return 0;

}

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

int main() {
  double T,X;
  cin >> T >> X;
  cout << std::fixed << std::setprecision(10) << T/X << endl;
}

Measured memory_bytes: 3784
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const int INF = (1<<30);
const ll INFLL = (1ll<<60);
const ll MOD = (ll)(1e9+7);

#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	a = (a<MOD)?a:(a-MOD);
	b = (b<MOD)?b:(b-MOD);
	a += b;
	a = (a<MOD)?a:(a-MOD);
}

struct data{
	ll gld, cpp;
};

vector<data> v;
priority_queue<ll, vector<ll>, greater<ll> > pq; 

bool comp(data a, data b){
	return ((a.cpp - a.gld) < (b.cpp - b.gld));
}

ll dpg[100100],dpc[100100];

int main(void){
	int i,x,y,z;
	ll a,b,c,slv=0ll,st=0ll,ans=-INFLL;
	data human;
	cin >> x >> y >> z;
	for(i=0; i<x+y+z; ++i){
		cin >> a >> b >> c;
		slv += b;
		a -= b;	c -= b;
		human.gld = a; human.cpp = c;
		v.push_back(human);
	}
	sort(v.begin(),v.end(),comp);
	for(i=0; i<x; ++i){
		st += v[i].gld;
		pq.push(v[i].gld);
	}
	for(i=0; i<=y; ++i){
		dpg[i] = st;
		st += v[x+i].gld;
		pq.push(v[x+i].gld);
		st -= pq.top();
		pq.pop();
	}
	while(!pq.empty()){
		pq.pop();
	}
	st = 0ll;
	for(i=x+y; i<x+y+z; ++i){
		st += v[i].cpp;
		pq.push(v[i].cpp);
	}
	for(i=0; i<=y; ++i){
		dpc[y-i] = st;
		st += v[x+y-i-1].cpp;
		pq.push(v[x+y-i-1].cpp);
		st -= pq.top();
		pq.pop();
	}
	for(i=0; i<=y; ++i){
		ans = max(ans,dpg[i]+dpc[i]);
	}
	ans += slv;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3696
/*input
6 727202214173249351
6 5 2 5 3 2
*/
#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;

#pragma GCC optimize("unroll-loops,no-stack-protector")
//order_of_key #of elements less than x
// find_by_order kth element
typedef long long int ll;
#define ld long double
#define pii pair<ll,ll>
typedef tree<pii, null_type, less<pii>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
#define f first
#define s second
#define pb push_back
#define REP(i,n) for(ll i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define FILL(n,x) memset(n,x,sizeof(n))
#define ALL(_a) _a.begin(),_a.end()
#define sz(x) (int)x.size()
const int maxn=2e5+5;
const int maxlg=__lg(maxn)+2;
const ll INF64=4e18;
const int INF=0x3f3f3f3f;
const ll MOD=1e9+7;
const ld PI=acos(-1);
const ld eps=1e-9;
#define lowb(x) x&(-x)
#define MNTO(x,y) x=min(x,(__typeof__(x))y)
#define MXTO(x,y) x=max(x,(__typeof__(x))y)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
ll mult(ll a,ll b){
    return (a*b)%MOD;
}
ll mypow(ll a,ll b){
    if(b<=0) return 1;
    ll res=1LL;
    while(b){
        if(b&1) res=mult(res,a);
        a=mult(a,a);
        b>>=1;
    }
    return res;
}
int g[maxn];
bool vis[maxn];
int main(){
    int n;
    ll k;
    cin>>n>>k;
    REP(i,n) cin>>g[i],--g[i];
    int cur=0;
    while(!vis[cur]){
        vis[cur]=1;
        cur=g[cur];
        --k;
        if(k==0){
            cout<<cur+1;
            return 0;
        }
    }
    REP(i,n) vis[i]=0;
    int cyc=0;
    while(!vis[cur]){
        vis[cur]=1;
        cur=g[cur];
        ++cyc;        
    }
    k%=cyc;
    if(k==0){
        cout<<cur+1;
        return 0;
    }
    REP(i,n) vis[i]=0;
    while(!vis[cur]){
        vis[cur]=1;
        cur=g[cur];
        --k;
        if(k==0){
            cout<<cur+1;
            return 0;
        }
    }    
}


Measured memory_bytes: 4616
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#include<set> 
#include<math.h>
#define pai arccos(-1);
#define keta(n) cout << fixed << setprecision((n));
#define ll long long;
int main(){
  int n;
  cin>>n;
  vector<int> d(n);
  rep(i,n)cin>>d[i];
  set<int> s;
  rep(i,n)s.insert(d[i]);
  cout<<s.size()<<endl;
  
  
 

}


Measured memory_bytes: 256
N, M = input().split()
N = int(N)
M = int(M)
X = list(map(int, input().split(" ")))

X = sorted(X)
L = []
for i in range(1,M):
    L.append(X[i]-X[i-1])

L = sorted(L)
if N >= M:
    print(0)
elif N == 1:
    print(sum(L))
else:
    print(sum(L[:-N+1]))

Measured memory_bytes: 13968
# -*- coding: utf-8 -*-
"""
Millennium
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=1179&lang=jp

"""
import sys

from itertools import accumulate

memo = [-1] * 1001
memo[1000] = 0
for y in range(999, 0, -1):
    memo[y] = (20 * 10 if y % 3 == 0 else 20 * 5 + 19 * 5) + memo[y+1]

def solve(y, m, d):
    months = [0] + [20, 19] * 5 if y % 3 else [0] + [20] * 10
    acc = list(accumulate(months))
    ans = memo[y] - acc[m-1] - (d-1)
    return ans


def main(args):
    n = int(input())
    for _ in range(n):
        y, m, d = map(int, input().split())
        ans = solve(y, m, d)
        print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])



Measured memory_bytes: 5692
//Sani buyuk Osman Pasa Plevneden cikmam diyor.
//FatihSultanMehmedHan
//Abdulhamid Han
//Bismillahirrahmanirrahim
//█▀█─█──█──█▀█─█─█
//█▄█─█──█──█▄█─█▄█
//█─█─█▄─█▄─█─█─█─█

#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>

using namespace std;

typedef long long lo;
typedef pair< lo,lo > PII;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define FOR for(int i=1;i<=n;i++)
#define mid ((start+end)/2)
#define ort ((bas+son)/2)

const lo MAX = -1000000000000000000;
const lo MIN = 1000000000000000000;
const lo inf = 1000000000;
const lo KOK = 100000;
const lo LOG = 30;
const lo li = 500005;
const lo mod = 1000000007;

int n,m,b[li],a[li],k,flag,t;
int cev;
string s;
vector<int> v;

int main(void){
	fio();
	cin>>s;
	if(s=="SUN")cout<<"7\n";
	if(s=="SAT")cout<<"1\n";
	if(s=="MON")cout<<"6\n";
	if(s=="TUE")cout<<"5\n";
	if(s=="WED")cout<<"4\n";
	if(s=="THU")cout<<"3\n";
	if(s=="FRI")cout<<"2\n";
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
int c(const void * a,const void *b)
{
	return *(int*)a-*(int*)b;
}
int N,S[100],i,r;
int main()
{
	for(;scanf("%d",&N),N;)
	{
		for(i=0;i<N;i++)
			scanf("%d",&S[i]);
		qsort(S,N,4,c);
		for(i=1,r=0;i<N-1;i++)
			r+=S[i];
		printf("%d\n",r/(N-2));
	}
	return 0;
}

Measured memory_bytes: 604
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define For(i,n,k) for(ll i=(n);i<(k);i++)
#define ALL(a)  (a).begin(),(a).end()
ll N,K,ans=0;
void Main(){
    cin>>N>>K;
    vector<ll> queue(N);
    For(i,0,N)cin>>queue.at(i);
    For(i,0,min(N,K)+1){
        For(j,0,i+1){
            vector<ll> get;
            For(k,0,j){
                get.push_back(queue.at(k));
            }
            For(k,0,i-j){
                get.push_back(queue.at(N-1-k));
            }
            sort(ALL(get));
            ll cnt=0;
            for(auto x:get) cnt+=x;
            For(k,0,min(K-i,i)){
                if(get.at(k)<0){
                    cnt-=get.at(k);
                }
            }
            ans=max(cnt,ans);
        }
    }
    cout<<ans<<endl;
}
int main(){
    Main();
    return 0;
}

Measured memory_bytes: 256
import java.util.*;
import java.lang.*;

class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
            int N = sc.nextInt();
            int K = sc.nextInt();
            String S = sc.next();
        sc.close();

        String p = S.substring(K-1,K);

        if(p.equals("A")){
            p = "a";
        }else if(p.equals("B")){
            p = "b";
        }else{
            p = "c";
        }

        System.out.println(S.substring(0, K-1)+p+S.substring(K, N));


    }
}


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

using namespace std;
bool check[1000001];

int main()
{
	string s;
	getline(cin, s);


	if (s[0] == 'Y' && s[1] == 'A'&& s[2] == 'K'&& s[3] == 'I')
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
	return  0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
#include <vector>
#include <numeric>
#include <map>
#include <cmath>
#include <iomanip>
#include <queue>
using ll =long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vs = vector<string>;

int main() {
    string S;
    cin >> S;
    int nflag = 0;
    int sflag = 0;
    int wflag = 0;
    int eflag = 0;
    for(int i=0; i<S.size(); i++){
        if(S.at(i) == 'N'){
            nflag++;
        }
        else if(S.at(i) == 'S'){
            sflag++;
        }
        else if(S.at(i) == 'W'){
            wflag++;
        }
        else if(S.at(i) == 'E'){
            eflag++;
        }
    }

    if(nflag > 0 and sflag == 0){
        cout << "No" << endl;
        return 0;
    }
    else if(sflag > 0 and nflag == 0){
        cout << "No" << endl;
        return 0;
    }
    else if (wflag > 0 and eflag == 0){
        cout << "No" << endl;
        return 0;
    }
    else if (eflag > 0 and wflag == 0){
        cout << "No" << endl;
        return 0;
    }

    cout << "Yes" << endl;

}

Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
#include<algorithm>
using namespace std;
int main()
{
	int a[3],temp1,temp2,ans;
	scanf("%d%d%d",&a[0],&a[1],&a[2]);
	sort(a,a+3);
	temp1=a[2]-a[0];temp2=a[2]-a[1];
	if(abs(temp1-temp2)%2==0)
	 {
	 	ans=a[2]-a[1]+(a[1]-a[0])/2;
     }
     else
     {
     	a[2]++;
     	a[0]++;
     	ans=1;
     	sort(a,a+3);
     	ans+=a[2]-a[1]+(a[1]-a[0])/2;
	 }
	printf("%d\n",ans);
  return 0;	
}

Measured memory_bytes: 128
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner sc= new Scanner(System.in);
        int N= sc.nextInt();
        int K= sc.nextInt();
        int[] arr= new int[N];
        for (int x=0; x<N; x++){
            arr[x]= sc.nextInt();
        }
        int[] dp= new int[N];
        dp[1]= Math.abs(arr[0]-arr[1]);
        for (int x=2; x<N; x++){
            int val= arr[x];
            int best= Integer.MAX_VALUE;
            for (int y=1; y<=K; y++){
                if (x-y<0) break;
                best= Math.min(best, dp[x-y]+ Math.abs(val- arr[x-y]));
            }
            dp[x]= best;
        }
        System.out.println(dp[N-1]);
    }
}


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

const ll INF = 1000000009;

void solve(){
  int n;
  cin >> n;
  while(n){
    if(n%10 == 7){
      cout << "Yes\n";
      return;
    }
    n/=10;
  }
  cout << "No\n";
}

int main(){
#ifndef LOCAL
  ios_base::sync_with_stdio(0), cin.tie(NULL), cout.tie(NULL);
#endif
  // int t;cin >> t;while(t--) solve();
  solve();
}


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

using namespace std;

#define int long long
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define fr(i,j,k) for(i = j; i < (k); i++)
#define all(x) x.begin(), x.end()
#define el '\n'
#define remax(a,b) a = max(a, b)
#define remin(a,b) a = min(a, b)
#define sz(x) int32_t(x.size())

typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpi;
// --------------------------------------------------------------------

const pii dxy[] = { {-1, 0}, {1, 0}, {0, 1}, {0, -1} };
const int mod = 1e9 + 7;
const int inf = 2e18;
const ld eps = 1e-9;
const int NN = 1e5 + 2;


//==========
int mu[NN];
int f[NN];
vector<int> primes;
int lo[NN+1];


void sieve(int N) {
	for (int i = 2; i <= N; ++i) {
		if (lo[i] == 0) {
			lo[i] = i;
			primes.push_back(i);
		}
		for (int j = 0, S = primes.size(); j < S and primes[j] <= lo[i] and i*primes[j] <= N; ++j)
			lo[i * primes[j]] = primes[j];
	}
}
void pre() {
	sieve(NN);
	mu[1] = 1;
	for(int i = 2; i < NN; i++) {
		if(lo[i/lo[i]] == lo[i]) {
			mu[i] = 0;
		} else {
			mu[i] = -1 * mu[i / lo[i]];
		}
	}
	for (int i = 1; i < NN; i++) {
		for (int j = i; j < NN; j += i) {
			f[j] += i * mu[j/i];
		}
	}
	// preFact();
}
//===========
const int maxn = NN;
int fact[maxn], inv[maxn], invFact[maxn];

int ncr(int n, int r){
	if(n < 0 || r < 0 || n < r) return 0;

	int v = (invFact[r] * invFact[n-r]) %mod;
	return (v*fact[n])%mod;
}
int P(int n, int r) {
	if(n < 0 || r < 0 || n < r) return 0;
	return fact[n] * invFact[n - r] % mod;
}

void preFact(){
	int i;
	fact[0] = fact[1] = 1;
	for(i = 2; i < maxn; i++) {
		fact[i] = (fact[i-1]*i)%mod;
	}

	inv[0] = 0;
	inv[1] = 1;
	for (i = 2; i < maxn; i++) {
		inv[i] = mod - ((int) (mod / i) * inv[mod % i] % mod);
	}

	invFact[0] = 1;
	for (i = 1; i < maxn; i++) {
		invFact[i] = (inv[i] * invFact[i - 1] % mod);
	}
}
//============


int pow(int a, int b, int m) {
	a %= m;
	int res = 1;
	while (b > 0) {
		if (b & 1)
			res = res * a % m;
		a = a * a % m;
		b >>= 1;
	}
	return res;
}

void solve() {
	int i = 0, j = 0, k = 0, n = 0, m = 0, ans = 0;
	cin >> n >> k;
	for(int d = 1; d <= k; d++) {
		int mult = pow(k/d, n, mod) * f[d] % mod;
		ans += mult;
		ans %= mod;
	}
	cout << ans << el;
}

int32_t main() {
	ios::sync_with_stdio(false); cin.tie(0);
	int T = 1;
	// cin >> T;
	pre();
	for(int tc = 1; tc <= T; tc++) {
		solve();
	}

	return 0;
}

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

int main(void) {
  int N;
  cin >> N;
  vector<bool> is_prime(55556, true);
  is_prime[0] = false;
  is_prime[1] = false;
  for (int i = 2; i <= 55555; i++) {
    for (int j = 2 * i; j <= 55555; j += i) {
      is_prime[j] = false;
    }
  }
  int cnt = 0;
  int i = 11;
  while (cnt < N) {
    if (is_prime[i] && i % 5 == 1) {
      cout << i;
      cnt++;
      cout << " \n"[cnt == N];
    }
    i++;
  }
  return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define F first
#define S second
using namespace std;
using ll = long long;
typedef pair<int, int> P;
ll Mod = 1000000007;
int main() {
  int L,R,d;
  cin >> L >> R >> d;
  int ans = 0;
  for (int i = L; i <= R; i++) {
    if (i % d == 0) {
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3592
#include "bits/stdc++.h"

using namespace std;

typedef long long ll;
typedef pair<int,int> P;
constexpr double EPS = 1e-12;
constexpr int INF = numeric_limits<int>::max()/2;
constexpr int MOD = 1e9+7;

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

    ll n,m;cin>>n>>m;
    vector<ll> cand;
    for(ll i=1;i*i<=m;i++){
        if(m%i) continue;
        cand.push_back(i);
        cand.push_back(m/i);
    }
    sort(cand.rbegin(),cand.rend());
    for(int i=0;i<(int)cand.size();i++){
        ll p=cand[i];
        if(p*n>m) continue;
        cout<<p<<endl;
        return 0;
    }
}


Measured memory_bytes: 764
#![allow(unused_imports)]
#![allow(dead_code)]
use datastructure::*;
use grapth::*;
use input_scanner::*;
use math::*;
use string_algorithm::*;
use util::*;

use std::cmp;
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, LinkedList, VecDeque};

fn main() {
    let mut scan = Scanner::new();
    let n: usize = scan.next();
    let m: usize = scan.next();
    let k: u64 = scan.next();
    let a: Vec<u64> = scan.next_vec(n);
    let b: Vec<u64> = scan.next_vec(m);
    let mut ans: usize = 0;

    let mut s: u64 = b.iter().fold(0, |sum, i| sum + i);
    let mut idx: usize = m;

    for i in 0..a.len() + 1 {
        while 0 < idx && s > k {
            idx -= 1;
            s -= b[idx];
        }
        if s > k {
            break;
        }
        ans = cmp::max(ans, i + idx);

        if i < a.len() {
            s += a[i];
        }
    }

    println!("{}", ans);
}

mod datastructure {}
mod grapth {}
mod math {}
mod string_algorithm {}
mod util {}
mod input_scanner {
    pub struct Scanner {
        bytes: Vec<u8>,
        begin: usize,
        end: usize,
    }

    impl Scanner {
        pub fn new() -> Self {
            use std::io::Read;
            let mut buffer: Vec<u8> = Vec::new();
            std::io::stdin().read_to_end(&mut buffer).unwrap();
            let end = (0..buffer.len())
                .find(|i| buffer[*i].is_ascii_whitespace())
                .unwrap_or(buffer.len());
            Scanner {
                bytes: buffer,
                begin: 0,
                end: end,
            }
        }
        pub fn next<T: std::str::FromStr>(&mut self) -> T {
            let s: &str =
                unsafe { std::str::from_utf8_unchecked(&self.bytes[self.begin..self.end]) };
            let ret: T = s.parse::<T>().ok().expect("Parse error.");
            self.skip();
            ret
        }
        pub fn next_vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
            (0..n).map(|_| self.next()).collect()
        }
        pub fn next_word(&mut self) -> Vec<u8> {
            let r = Vec::from(&self.bytes[self.begin..self.end]);
            self.skip();
            r
        }
        fn skip(&mut self) {
            self.begin = (self.end..self.bytes.len())
                .find(|i| !self.bytes[*i].is_ascii_whitespace())
                .unwrap_or(self.bytes.len());
            self.end = (self.begin..self.bytes.len())
                .find(|i| self.bytes[*i].is_ascii_whitespace())
                .unwrap_or(self.bytes.len());
        }
    }
}


Measured memory_bytes: 9352
import sys
from sys import exit
from collections import deque
from copy import deepcopy
from bisect import bisect_left, bisect_right, insort_left, insort_right
from heapq import heapify, heappop, heappush
from itertools import product, permutations, combinations, combinations_with_replacement
from functools import reduce
from math import gcd, sin, cos, tan, asin, acos, atan, degrees, radians

sys.setrecursionlimit(10**6)
INF = 10**20
eps = 1.0e-20
MOD = 10**9+7

def lcm(x,y):
    return x*y//gcd(x,y)
def lgcd(l):
    return reduce(gcd,l)
def llcm(l):
    return reduce(lcm,l)
def powmod(n,i,mod):
    return pow(n,mod-1+i,mod) if i<0 else pow(n,i,mod)
def div2(x):
    return x.bit_length()
def div10(x):
    return len(str(x))-(x==0)
def intput():
    return int(input())
def mint():
    return map(int,input().split())
def lint():
    return list(map(int,input().split()))
def ilint():
    return int(input()), list(map(int,input().split()))
def judge(x, l=['Yes', 'No']):
    print(l[0] if x else l[1])
def lprint(l, sep='\n'):
    for x in l:
        print(x, end=sep)
def ston(c, c0='a'):
    return ord(c)-ord(c0)
def ntos(x, c0='a'):
    return chr(x+ord(c0))
class counter(dict):
    def __init__(self, *args):
        super().__init__(args)
    def add(self,x,d=1):
        self.setdefault(x,0)
        self[x] += d
    def list(self):
        l = []
        for k in self:
            l.extend([k]*self[k])
        return l
class comb():
    def __init__(self, n, mod=None):
        self.l = [1]
        self.n = n
        self.mod = mod
    def get(self,k):
        l,n,mod = self.l, self.n, self.mod
        k = n-k if k>n//2 else k
        while len(l)<=k:
            i = len(l)
            l.append(l[i-1]*(n+1-i)//i if mod==None else (l[i-1]*(n+1-i)*powmod(i,-1,mod))%mod)
        return l[k]
def pf(x,mode='counter'):
    C = counter()
    p = 2
    while x>1:
        k = 0
        while x%p==0:
            x //= p
            k += 1
        if k>0:
            C.add(p,k)
        p = p+2-(p==2) if p*p<x else x
    if mode=='counter':
        return C
    S = set([1])
    for k in C:
        T = deepcopy(S)
        for x in T:
            for i in range(1,C[k]+1):
                S.add(x*(k**i))
    if mode=='set':
        return S
    if mode=='list':
        return sorted(list(S))

N,A,B=mint()
X=lint()
dp=[0]*N
for i in range(N-1):
    dp[i+1]=dp[i]+min(A*(X[i+1]-X[i]),B)
print(dp[N-1])

Measured memory_bytes: 90584
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <functional>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <cassert>
#include <exception>
#include <numeric>
using namespace std;
typedef long long ll;
typedef string str;
typedef pair<ll, ll> P;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<char> vc;
typedef vector<str> vs;
typedef vector<P> vp;
typedef vector<bool> vb;
#define rep(i, a, n) for (ll i = (a); i < (n); ++i)
#define rrep(i, a, n) for (ll i = (a); i > (n); --i)
#define erep(i, a, n) for (ll i = (a); i <= (n); ++i)
#define rerep(i, a, n) for (ll i = (a); i >= (n); --i)
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define mp make_pair
#define sz(x) ((int)x.size())
#define print(X) cout << (X) << "\n"
#define _ << " " <<
static const int INF = 1e+9+7;

int main(){
  vi vec(3);
  cin >> vec[0] >> vec[1] >> vec[2];
  sort(all(vec));
  cout << vec[0] << " " << vec[1] << " " << vec[2] << "\n" ;

  return 0;
}





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

typedef long long ll;

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl

const int maxn = 1e6 + 5;

int main() {
  ios_base::sync_with_stdio(false); cin.tie(0);  cout.tie(0);
  cout << fixed << setprecision(12);
  int a,b,c,d; cin>>a>>b>>c>>d;
  if (abs(a-c)<=d) out("Yes");
  if (abs(a-b)<=d && abs(b-c)<=d) out("Yes");
  
  out("No");
  

  return 0;
}


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

int judge(int x){
  int j;
  if(x<2) return 0;
  else if(2<=x && x<=3) return 1;
  else if(x%2==0) return 0;

  else{
    for(j=3;j<=sqrt(x);j+=2){
      if(x%j==0) return 0;
    }
    return 1;
  }
}


int main(){
  int n, x, i, j, cont=0;
  int a[10000];

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



Measured memory_bytes: 2036
//file_name:ABC52_A.cpp
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
const int MX = 200005;

    // int scan
    /*
    int x;
    scanf("%d",&x);
    int y;
    scanf("%d",&y);
    int z;
    scanf("%d",&z);

    // matrix scan
    /*
    ll a[n] = {};
    rep(i,n){
        scanf("%lld",&a[i]);
    }
    */

    // string scan
    /*
    string s;
    cin >> s;
    */


int main() {
    int a,b,c,d;
    cin >> a >> b >> c >> d;


    ll ans = max(a*b,c*d);

    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 256
def selection(A, N):
    count = 0
    for i in range(0, N):
        minj = i
        for j in range(i, N):
            if A[j] < A[minj]:
                minj = j
        if i != minj:
            A[i], A[minj] = A[minj], A[i]
            count += 1
    return A, count



if __name__ == "__main__":
    N = int(input())
    A = [int(i) for i in input().split()]

    A, count = selection(A, N)
    print (*A)
    print (count)

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

#define NIL NULL
#define INF 1000000001

using namespace std;

int main(){
    // ---- iput ---- //
    int n;
    float temp;
    scanf("%d",&n);
    vector<float> p(n,0);
    vector<float> q(n+1,0);
    vector<vector<float> > cost(n+1,vector<float>(n+1,INF));
    for(int i = 0;i < n;i++){
        scanf("%f",&temp);
        p[i] = temp;
    } 
    for(int i = 0;i < n+1;i++){
        scanf("%f",&temp);
        q[i] = temp;
    } 

    for(int k = 0;k < n+1;k++){
        for(int i = 0;i < n-k+1;i++){
            int j = i + k;
            float w = q[i];
            if(j == i) cost[i][j] = w;
            else{
                for(int l =i+1;l <= j;l++) w += q[l]+p[l-1];
                for(int l =i;l < j;l++){
                    cost[i][j] = min(cost[i][j],cost[i][l]+cost[l+1][j] + w);
                }
            } 
        }
    }
    printf("%.5f\n",cost[0][n]);
    return 0;   
}



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

#define REP(i, n) for(int (i)=0;(i)<(n);++(i))
#define MOD 1000000007
#define MAX 1000000

using namespace std;

typedef long long ll;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int 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;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

bool isPrime(ll p)
{
    bool res = true;
    if (p == 1)
    {
        res = false;
    }
    else
    {
        for (int i = 2; i * i <= p; ++i)
        {
            if (p % i == 0)
            {
                res = false;
                break;
            }
        }
    }

    return res;
}

map<ll, int> primeFactorization(ll n)
{
    map<ll, int> primeFacMap;
    ll q = 2;
    while(n != 1)
    {
        if (n % q == 0)
        {
            if (isPrime(q))
            {
                while(n % q == 0)
                {
                    n = n / q;
                    if (primeFacMap.find(q) == primeFacMap.end())
                    {
                        primeFacMap[q] = 1;
                    }
                    else
                    {
                        primeFacMap[q]++;
                    } 
                }
            }
        }
        q++;
    }

    return primeFacMap;
}

int main()
{
    ll N, M;
    cin >> N >> M;
    map<ll, int> primeFacMap = primeFactorization(M);
    COMinit();

    ll ans = 1;
    for (auto iter = primeFacMap.begin(); iter != primeFacMap.end(); ++iter)
    {
        ll b = iter -> second;
        ans = (ans * COM(b + N - 1, b)) % MOD;
    }

    cout << ans << endl;
}


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

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<bool> vb;
typedef pair<int, int> pii;
typedef pair<char, char> pcc;

#define ALL(a) (a).begin(),(a).end()
#define ZP(a, len) setfill('0') << setw(len) << right << a
const int INF = 1e9;
const int MOD = 1e9 + 7;
const int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0};

int D;
ll G;
vi p, c;

signed main() {
    cin >> D >> G;
    p = vi(D);
    c = vi(D);
    for (int i = 0; i < D; ++i) cin >> p[i] >> c[i];

    ll ans = 1LL << 60;
    for (int bit = 0; bit < (1 << D); ++bit) {
        ll score = 0;
        ll ac = 0;
        for (int i = 0; i < D; ++i) {
            // bit立ってる問題は完全に解く
            if (bit & (1 << i)) {
                score += c[i] + p[i] * 100 * (i + 1);
                ac += p[i];
            }
        }

        // 得点が足りないので得点の高いものからやる
        if (score < G) {
            for (int i = D - 1; i >= 0; --i) {
                // bit立ってる問題は完全に解いたので除外
                if (bit & (1 << i)) continue;

                for (int j = 0; j < p[i]; ++j) {
                    if (score >= G) break;
                    score += 100 * (i + 1);
                    ac++;
                }
            }
        }

        ans = min(ans, ac);
    }

    cout << ans << endl;
    return 0;
}

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



namespace Test1 {

    class ClassMain {
        static bool[] isPrime = Enumerable.Repeat<bool>(true,10001).ToArray();

        public static void Main(String[] args) {
            string line;
            initPrimes();
            while ((line = Console.ReadLine()) != null) {
                int n = int.Parse(line);
                if (n == 0) { break; }
                int p1 = -1, q1 = -1;
                for (int i = n; i >= 2; i--) {
                    if (isPrime[i] == false) { continue; }
                    if (isPrime[i - 2] == true) { q1 = i; p1 = i - 2; break; }
                }
                Console.WriteLine(p1 + " " + q1);
            }
        }

        public static void initPrimes() {
            isPrime[0] = false;
            isPrime[1] = false;
            for (int i = 2; i <= 10000/2; i++) {
                if (isPrime[i] == false) { continue; }
                for (int j = 2; i * j <= 10000; j++) {
                    isPrime[i * j] = false;
                }
            }
        }
    }

}

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


void solve(
    long long N,
    long long M,
    std::vector<long long> x,
    std::vector<long long> y){
    vector<ll> nballs(N, 1);
    vector<bool> red(N, false);
    red.at(0) = true;

    REP(i, M){
        if(red.at(x.at(i))){
            red.at(y.at(i)) = true;
            if(nballs.at(x.at(i)) == 1){
                red.at(x.at(i)) = false;
            }
        }
        nballs.at(x.at(i)) -= 1;
        nballs.at(y.at(i)) += 1;
    }

    cout << accumulate(red.begin(), red.end(), 0LL) << endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools
int main(){
    long long N;
    scanf("%lld",&N);
    long long M;
    scanf("%lld",&M);
    std::vector<long long> x(M);
    std::vector<long long> y(M);
    for(int i = 0 ; i < M ; i++){
        scanf("%lld",&x[i]);
        scanf("%lld",&y[i]);
        x.at(i)--;
        y.at(i)--;
    }
    solve(N, M, std::move(x), std::move(y));
    return 0;
}


Measured memory_bytes: 2560
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
    	Scanner input = new Scanner(System.in);
      	String S = input.next();
      	String[] sDate = S.split("/");
      	int[] date = new int[3];
      	int i = 0;
        for ( String textValue : sDate ) {
          date[i] = Integer.parseInt( textValue ); 
          i++; 
        } 
      	String ans = "TBD";
      	if (date[0] < 2019) {
        	ans = "Heisei";
        } else if (date[0] == 2019) {
        	if (date[1] < 4) {
            	ans = "Heisei";
            } else if (date[1] == 4 && date[2] <= 30) {
            	ans = "Heisei";
            }
        }
      
      System.out.print(ans);

    }
}


Measured memory_bytes: 23764
#include<bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#define pb push_back
#define ll long long int
#define ull unsigned long long int
#define ld long double
#define fi first
#define se second
#define endl "\n"
#define all(v) v.begin(),v.end()
#define fastio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define go_t int t;cin>>t;for(int tt=1;tt<=t;tt++)
#define set_ar(arr,v) memset(arr,v,sizeof(arr))
#define trace2(x, y)             cout <<#x<<": "<<x<<" | "<<#y<<": "<<y<< endl;
#define trace3(x, y, z)          cout <<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl;
#define trace4(a, b, c, d)       cout <<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl;
#define trace5(a, b, c, d, e)    cout <<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<<": "<<e<<endl;
typedef tree<pair<ll,ll>,null_type,less<pair<ll,ll>>,rb_tree_tag,tree_order_statistics_node_update> ordered_set; // order_of_key
typedef pair<int,int>pi;
typedef pair<ll,ll>pl;
const ll inf = 0x3f3f3f3f3f3f3f3fll;//4x10e18
const int maxx = 3000000 , mod = 1000000009;
#define PI 3.14159265
ll dp[101][100005];
int main()
{
    fastio;
    int n,w;
    cin>>n>>w;
    pl a[n+1];
    for(int i=1;i<=n;i++)
    {
        cin>>a[i].fi>>a[i].se;
    }
    for(int i=0;i<=w;i++)dp[0][i] = 0;
    ll ans = 0;
    for(int i=1;i<=n;i++)
    {
        for(int j=0;j<=w;j++)
        {
            if(j<a[i].fi)
                dp[i][j] = dp[i-1][j];
            else dp[i][j] = max(dp[i-1][j],dp[i-1][j-a[i].fi]+a[i].se);
            if(i==n)
                ans = max(ans,dp[i][j]);
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 79232
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>

using namespace std;

int main(int argc, char* argv[]) {
  int n;
  cin >> n;
  set<long long> s;
  for (int i = 0; i < n; ++i) {
    long long x;
    cin >> x;
    s.insert(x);
  }

  int q;
  cin >> q;
  vector<long long> t(q);
  for (int i = 0; i < q; ++i)
    cin >> t[i];

  int ret = 0;
  for (int i = 0; i < t.size(); ++i) {
    if (s.find(t[i]) != s.end())
      ++ret;
  }

  cout << ret << endl;

  return 0;
}


Measured memory_bytes: 7696
N = STDIN.gets.to_i
m = 0
a = 0
r = 0
c = 0
h = 0

names = []
N.times do
  names << STDIN.gets
end

names = names.uniq
names.each do |name|
  m += 1 if name[0] == 'M'
  a += 1 if name[0] == 'A'
  r += 1 if name[0] == 'R'
  c += 1 if name[0] == 'C'
  h += 1 if name[0] == 'H'
end

nums = [m, a, r, c, h].reject{|i| i == 0}

sum = 0
nums.combination(3){ |x,y,z| sum += x * y * z}
puts sum

Measured memory_bytes: 21880
def solve(n, k, a_list):

    for t in range(k):

        left_list = [0] * n
        right_list = [0] * n

        for i in range(n):
            left = i - a_list[i] - 1
            if left >= 0:
                left_list[left] += 1
            right = i + a_list[i] + 1
            if right < n:
                right_list[right] += 1

        a_list = [n] * n

        if sum(left_list) == 0 and sum(right_list) == 0:
            break

        # right
        right_erase = 0
        for i in range(n):
            right_erase += right_list[i]
            a_list[i] -= right_erase
        # left
        left_erase = 0
        for i in range(n - 1, -1, -1):
            left_erase += left_list[i]
            a_list[i] -= left_erase

    return " ".join([str(a) for a in a_list])


def main():
    n, k = map(int, input().split())
    a_list = list(map(int, input().split()))
    res = solve(n, k, a_list)
    print(res)


def test():
    assert solve(5, 1, [1, 0, 0, 1, 0]) == "1 2 2 1 2"
    assert solve(5, 2, [1, 0, 0, 1, 0]) == "3 3 4 4 3"


if __name__ == "__main__":
    test()
    main()


Measured memory_bytes: 180260
#include <iostream>
#include <iomanip> // setprecision
#include <cmath>

#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))

using namespace std;
typedef long long ll;
const double long PI = acos(-1);

void solve() {
  ll N;
  char slimes[100000];
  cin >> N;
  cin >> slimes;
  ll num;
  char currentColor = '0';
  for (ll i=0;i<N;i++) {
    if (slimes[i] != currentColor) {
      num++;
      currentColor = slimes[i];
    }
  }
  cout << num << endl;
}

int main(void) {
  cout << fixed << setprecision(10);
  solve();
  return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int main(){
	#ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
    #endif
    int a,b,c;
    cin>>a>>b>>c;
    cout<<(a+b+c)-max({a,b,c});
    return 0;
}

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

template<long long mod>
struct mint {
private:
    long long x;
public:
    mint(long long x = 0) :x((mod + x) % mod) {}
    mint(std::string &s) {
        long long z = 0;
        for (int i = 0; i < s.size(); i++) {
            z *= 10;
            z += s[i] - '0';
            z %= mod;
        }
        this->x = z;
    }
    mint& operator+=(const mint &a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint &a) {
        if ((x += mod - a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint &a) {
        (x *= a.x) %= mod;
        return *this;
    }
    mint& operator/=(const mint &a) {
        long long n = mod - 2;
        mint<mod> u = 1, b = a;
        while (n > 0) {
            if (n & 1) {
                u *= b;
            }
            b *= b;
            n >>= 1;
        }
        return *this *= u;
    }
    mint operator+(const mint &a) const {
        mint res(*this);
        return res += a;
    }
    mint operator-(const mint &a) const {
        mint res(*this);
        return res -= a;
    }
    mint operator*(const mint &a) const {
        mint res(*this);
        return res *= a;
    }
    mint operator/(const mint &a) const {
        mint res(*this);
        return res /= a;
    }
    friend std::ostream& operator<<(std::ostream &os, const mint &n) {
        return os << n.x;
    }
    bool operator==(const mint &a) const {
        return this->x == a.x;
    }
};

int main() {
    constexpr int MOD = 1e9 + 7;
    int n, k; cin >> n >> k;
    mint<MOD> ans = 0;
    for (int i = k; i <= n + 1; i++) {
        ans += mint<MOD>(i)*(n - i + 1 + n) / 2 - mint<MOD>(i)*(i - 1) / 2 + 1;
        //cout << ans << endl;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3632
#include <stdio.h>
#include <string.h>

int is_boin(int c) {
	return c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o';
}

int n;
char s[64][64];
char code[64][64];

int solve(void) {
	int left = 0, right = 63;
	int answer = -1;
	while (left <= right) {
		int mid = (left + right) / 2;
		int i, j;
		int valid = 1;
		for (i = 0; valid && i < n; i++) {
			for (j = i + 1; j < n; j++) {
				if (memcmp(code[i], code[j], mid) == 0) {
					valid = 0;
					break;
				}
			}
		}
		if (valid) {
			if (answer < 0 || mid < answer) answer = mid;
			right = mid - 1;
		} else {
			left = mid + 1;
		}
	}
	return answer;
}

int main(void) {
	while (scanf("%d", &n) == 1 && n > 0) {
		int i, j;
		for (i = 0; i < n; i++) {
			int count = 0;
			if (scanf("%s", s[i]) != 1) return 1;
			for (j = 0; s[i][j] != '\0'; j++) {
				if (j == 0 || is_boin(s[i][j - 1])) {
					code[i][count++] = s[i][j];
				}
			}
			for (j = count; j < 64; j++) code[i][j] = '\0';
		}
		printf("%d\n",  solve());
	}
	return 0;
}

Measured memory_bytes: 628
import sys

def solve():
    input = sys.stdin.readline
    X = int(input())
    now = 100
    for i in range(1, 10 ** 18):
        now = int(now * 1.01)
        if now >= X:
            print(i)
            break

    return 0

if __name__ == "__main__":
    solve()

Measured memory_bytes: 9180
import java.util.*;

public class Main{
    public static void main(String[]args){
        Scanner entrada = new Scanner(System.in);
        int p = entrada.nextInt();
        int q = entrada.nextInt();
        int r = entrada.nextInt();
        int abc = p+q;
        int cab = r+p;
        int bca = q+r;
        if(abc<=cab && abc<=bca){
            System.out.println(abc);
        }else if(cab<=abc && cab<=bca){
            System.out.println(cab);
        }else if(bca <=abc && bca <=cab){
            System.out.println(bca);
        }
    }
}

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

#define rep(i,a,b)      for(int i=a;i<=b;i++)
#define revp(i,a,b)     for(int i=b;i>=a;i--)

long long int n,sum;
int main()
{

    cin>>n;
    rep(i,1,n)
        if(i%3!=0 and i%5!=0)
            sum+=i;
    cout<<sum;
}




Measured memory_bytes: 3596
#include<bits/stdc++.h>
using namespace std;
 
#define fi first
#define se second
#define FOR(a, b, c) for(int a = b; a <= c; ++a)
#define FORW(a, b, c) for(int a = b; a >= c; --a)
#define pb push_back
#define SZ(a) ((int)a.size())
#define int long long
//#define TEST
 
const int oo = 1e9;
const int Maxn = 1e6;
const int N = 2e5 + 100;
const double PI = (-2.00) * asin(-1);
 
typedef pair<int, pair<int, int> > iii;

double dist(int x, int y, int x1, int y1) {
    return 1.00 * sqrt((x - x1) * (x - x1)* 1.00 + (y - y1) * (y - y1) * 1.00);
}

signed main()
{
    #ifdef TEST
        freopen("test.inp", "r", stdin);
    #endif // TEST  
    ios_base::sync_with_stdio(false);                                      
    cin.tie(0); cout.tie(0);

    int a, b;int v, w;
     cin >> a >> v;
     cin >> b >> w;
    int t; cin >> t;
    if(a >= b) {
        int x1 = a - t * v, x2 = b - t * w;
        if(x1 <= x2) return cout << "YES", 0;
        else return cout << "NO", 0;
    } else {
        int x1 = a + t * v, x2 = b + t * w;
        if(x1 >= x2) return cout << "YES", 0;
        else return cout << "NO", 0;
    }
}


Measured memory_bytes: 3696
import java.util.*;
public class Main{
	static Scanner s = new Scanner(System.in);
	public static void main(String[] args) {
		int n=s.nextInt(),c=s.nextInt(),k=s.nextInt();

		PriorityQueue<Integer> t = new PriorityQueue<>();

		for(int i=0;i<n;i++) t.add(s.nextInt());

		int result=0,bus,buf;
		while(!t.isEmpty()) {
			result++;
			bus=0;
			buf=t.peek()+k;
			while(!t.isEmpty()&&t.peek()<=buf) {
				t.poll();
				bus++;
				if(bus==c)
					break;
			}
		}
		System.out.println(result);
	}
}

Measured memory_bytes: 62488
n,m=map(int,input().split())
k=[[int(i) for i in input().split()] for i in range(m)]
p=list(map(int,input().split()))

ans=0

for i in range(2**n):
    switch=[None]*n
    for j in range(n):
        if ((i>>j)&1)==1:
            switch[j]=True
    cnt=0
    for x,light in enumerate(k):
        tmp=0
        for i in range(len(light)):
            if i==0:
                continue
            if switch[light[i]-1]==True:
                tmp+=1
        if tmp%2==p[x]:
            cnt+=1
    if cnt==m:
        ans+=1
print(ans)

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

using namespace std;
using ll=long long;
using ull=unsigned long long;
using pii=pair<int,int>;

#define INF LONG_MAX
#define MOD 1000000007
#define rng(a) a.begin(),a.end()
#define rrng(a) a.end(),a.begin()
#define endl "\n"
#define int ll

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

  int N;
  cin>>N;
  vector<int>ans(N+1,0);
  for(int i=1;i<=N;i++){
    for(int j=i;j<=N;j+=i)ans[j]++;
  }
  ll res=0;
  for(int i=1;i<=N;i++)res+=ans[i]*i;
  cout<<res<<endl;

  return 0;
}


Measured memory_bytes: 81340
#include<iostream>
#include<vector>
#include<queue>
#include<string>
#define rep(i,n) for (int i = 0; i < n; i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main() {
  int n,k;
  cin >> n >> k;

  vector<int> a(n);

  rep (i,k) {
    int d;
    cin >> d;
    rep (j,d) {
      int b;
      cin >> b;
      a[b-1]++;
    }
  }

  int ans = 0;
  rep(i,n) {
    if (a[i] == 0) {
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3196
#include <iostream>
#include <vector>
using namespace std;
typedef signed long long ll;
#define FOR(x, to) for (x = 0; x < (to); x++)

int N, M;
int A[50], B[50];

template<int V> class UF {
public:
	vector<int> par, rank, cnt;
	UF() {
        par = rank = vector<int>(V, 0);
        cnt = vector<int>(V, 1);
        int i; FOR(i, V) par[i] = i;
    }
	void reinit() { int i; FOR(i, V) rank[i]=0, cnt[i]=1, par[i]=i; }
	int operator[](int x) {            // find
        return (par[x] == x) ? (x) : (par[x] = operator[](par[x]));
    }
	int count(int x) { return cnt[operator[](x)]; }
	int operator()(int x, int y) {     // union
		if ((x = operator[](x)) == (y = operator[](y))) return x;
		cnt[y] = cnt[x] = cnt[x] + cnt[y];
		if (rank[x] > rank[y]) return par[x] = y;
		rank[x] += rank[x] == rank[y]; return par[y] = x;
	}
};

int main() {
	int i,j,k,l,r,x,y; string s;

	cin >> N >> M;
	FOR(i, M) cin >> A[i] >> B[i], A[i]--, B[i]--;
	int ret = 0;
	FOR(i, M) {
		UF<50> uf;
		FOR(j, M) if (i != j) uf(A[j], B[j]);
		if (uf.count(0) != N) ret++;
	}
	cout << ret << endl;

    return 0;
}

Measured memory_bytes: 256