akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
  int a,b,c,k;
  cin >> a >> b >> c >> k;
  string ans = "No";
  rep(i,k) {
    if(b >= c) c *= 2;
    else if(a >= b) b *= 2;
    if(a < b && b < c) {
      ans = "Yes";
      break;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3528
# D - Lucky PIN
N = int(input())
S = input()

cnt = 0
for i in range(10):
    for j in range(10):
        for k in range(10):
            a = S.find(str(i))
            if a == -1:
                continue
            b = S.find(str(j),a+1)
            if b == -1:
                continue
            c = S.find(str(k),b+1)
            if c == -1:
                continue
            cnt += 1
print(cnt)

Measured memory_bytes: 9276
N = int(input())
a = []
tmp = []
for i in range(N):
    tmp = [int(i) for i in input().split()]
    a.append(tmp)

res = 0
for i in a:
    if i[1] - i[0] == 0:
        res += 1
    else:
        res += i[1] - i[0] + 1

print(res)


Measured memory_bytes: 3444
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define in(j,n) for(j=0;j<n;j++)
#define inp(j,n) for(j=1;j<=n;j++)
#define lo(i,st,n) for(i=st;i<n;i++)
#define pb push_back
#define csbits(n) __builtin_popcount(n)
#define endl "\n"
#define fastio ios_base::sync_with_stdio(false)
int main()
{
	fastio;
	ll i,j,t,n;
	cin>>n;
	ll a[n][3];
	ll dp[n][3];
	in(i,n){
		in(j,3){
			cin>>a[i][j];
			dp[i][j]=0;
		}
	}
	in(j,3)
		dp[0][j]=a[0][j];
	inp(i,n-1){
		in(j,3){
			if(j==0){
				dp[i][1]=max(dp[i][1],dp[i-1][0]+a[i][1]);
				dp[i][2]=max(dp[i][2],dp[i-1][0]+a[i][2]);
			}
			else if(j==1){
				dp[i][0]=max(dp[i][0],dp[i-1][1]+a[i][0]);
				dp[i][2]=max(dp[i][2],dp[i-1][1]+a[i][2]);
			}
			else if(j==2){
				dp[i][1]=max(dp[i][1],dp[i-1][2]+a[i][1]);
				dp[i][0]=max(dp[i][0],dp[i-1][2]+a[i][0]);
			}
		}
	}
	ll ma=dp[n-1][0];
	inp(j,2)
		ma=max(ma,dp[n-1][j]);
	cout<<ma<<endl;
	return 0;
}

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

int main(){
    int holidays,homeworks;
    int Sum = 0;
    cin >> holidays >> homeworks;
    int NeedTime[homeworks];
    for(int i = 0; i < homeworks; i++) {
        cin >> NeedTime[i];
        Sum += NeedTime[i];
    }

    int PlayTimes = holidays - Sum;

    if(PlayTimes < 0) {
        cout << -1 << endl;
    } else {
        cout << PlayTimes << endl;
    }
    
    return 0;
}

Measured memory_bytes: 3200
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
	"strings"
)

var sc = bufio.NewScanner(os.Stdin)

// 一行読み出し
func nextLine() string {
	sc.Scan()
	return sc.Text()
}

// 文字列リバース関数
func strReverse(s string) string {
	rs := []rune(s)
	for i, j := 0, len(s)-1; i < j; i, j = i+1, j-1 {
		rs[i], rs[j] = rs[j], rs[i]
	}
	return string(rs)
}

// スペース区切りの文字列から int のスライスを得る
func intSlice(s string) []int {
	ss := strings.Split(s, " ")
	res := make([]int, len(ss))
	for i, v := range ss {
		iv, _ := strconv.Atoi(v)
		res[i] = iv
	}

	return res
}

func scanNums(len int) (nums []int) {
	var num int
	for i := 0; i < len; i++ {
		fmt.Scan(&num)
		nums = append(nums, num)
	}
	return
}

func main() {

	var n int
	fmt.Scan(&n)

	ns := scanNums(n)

	sort.Ints(ns)

	var ans int
	if len(ns)%2 != 0 {
		ans = 0
	} else {
		ans = ns[len(ns)/2] - ns[len(ns)/2-1]
	}

	fmt.Println(ans)
}


Measured memory_bytes: 5504
#include <iostream>
#include <algorithm>
#include <vector>
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if(a < b){ a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if(a > b){ a = b; return 1; } return 0; }
int main()
{
  int x1,y1,x2,y2; cin >> x1 >> y1 >> x2 >> y2;

  int dx = x2 - x1, dy = y2 - y1;
  int x3 = x2 - dy, y3 = y2 + dx;
  int x4 = x1 - dy, y4 = y1 + dx;
  cout << x3 << " " << y3 << " " << x4 << " " << y4 << "\n";
  
  return 0;
}


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

using namespace std;

int main() {
    string S;
    cin >> S;
    const size_t size = S.size();
    vector<int> ans(2, 0);
    for(int i = 0; i < size; i++) {
        ans[S[i] - '0']++;
    }
    cout << min(ans[0], ans[1]) * 2 << endl;
    return 0;
}

Measured memory_bytes: 512
#include<iostream>
#include<unordered_map>
#include<vector>
#include<algorithm>
#include<cmath>
#include<string>
#include<queue>
using namespace std;
 
int main(){
  int N, M;
  cin >> N >> M;
  
   int maxl = 0;
  int minr = N;
  
  int l, r;
  for (int i = 0; i < M; i++){
    cin >> l >> r;
    if( l > maxl)
      maxl = l;
    if(r < minr)
      minr = r;
  }
  cout << max((minr- maxl+1), 0) << endl;
  return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include"bits/stdc++.h"
#ifdef _DEBUG
#define DBG(n) n
#else
#define DBG(n)
#endif
#define INF         1e9
#define INFLL       1e18
#define EPS         1e-9
#define REP(i,n)    for(ll i=0,i##_len=(n);i<i##_len;++i)
#define REP1(i,n)   for(ll i=1,i##_len=(n);i<=i##_len;++i)
#define REPR(i,n)   for(ll i=(n)-1;i>=0;--i)
#define REPR1(i,n)  for(ll i=(n);i>0;--i)
#define REPC(i,obj) for(auto i:obj)
#define ALL(obj)    (obj).begin(),(obj).end()
#define SETP(n)     cout << fixed << setprecision(n)
using namespace std;
using ll = long long;
template<typename T = ll>inline T in() { T ret; cin >> ret; return ret; }

signed main()
{
	ll v = in(), e = in();
	vector<vector<ll>>adj(v, vector<ll>(v, INFLL)); REP(i, v)adj[i][i] = 0;
	REP(i, e) {
		ll s = in(), t = in(), d = in();
		adj[s][t] = d;
	}
	REP(k, v) {
		REP(i, v) {
			REP(j, v) {
				if (adj[i][k] != INFLL && adj[k][j] != INFLL) {
					adj[i][j] = min(adj[i][j], adj[i][k] + adj[k][j]);
				}
			}
		}
	}
	REP(i, v) {
		if (adj[i][i] < 0) {
			cout << "NEGATIVE CYCLE" << endl;
			return 0;
		}
	}
	REP(i, v) {
		REP(j, v) {
		    if(j != 0){
		        cout << ' ';
		    }
			if (adj[i][j] == INFLL) {
				cout << "INF";
			} else {
				cout << adj[i][j];
			}
		}
		cout << endl;
	}
}


Measured memory_bytes: 3252
#include<bits/stdc++.h>
using namespace std;
#define lint long long
#define inf 100000000000000000
#define mod 1000000007
#define MAX 100005
#define pb push_back
#define vit vector<int>::iterator
typedef pair<lint,lint> pii;
lint fact[MAX+1],ifact[MAX+1];
void nCr2_pre(void){ /// O(N) ; all ncr; N<=10^6; m must be prime and m>N;
    fact[0]=fact[1]=ifact[0]=ifact[1]=1;
    for(lint i=2;i<=MAX;i++){
        fact[i]=(fact[i-1]*i)%mod;
        ifact[i]=(mod-((mod/i)*ifact[mod%i])%mod)%mod;
    }
    for(lint i=2;i<=MAX;i++){
        ifact[i]=(ifact[i-1]*ifact[i])%mod;
    }
}
lint nCr2(lint n,lint r){
    if(n<r) return 0;
    else return ((fact[n]*ifact[r])%mod *ifact[n-r])%mod;
}

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    lint n,ans=0;
    nCr2_pre();
    cin>>n;
    for(lint k=1;k<=n;k++){
        ans=(ans+nCr2(n-2*k-1,k-1))%mod;
    }
    cout<<ans;
    return 0;
}



Measured memory_bytes: 5248
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main(void) {
    vector<int> vec;
    int ans = 0;
    for(int i=0; i<5; i++) {
        int dish;
        cin >> dish;
        if(dish%10 == 0) {
            ans += dish;
        }else {
            ans += ((dish+9) / 10) * 10;
            vec.push_back(dish%10);
        }
    }
    sort(vec.begin(), vec.end());
    if(!vec.empty()) {
        ans -= ((vec.at(0)+9) / 10) * 10;
        ans += vec.at(0);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
N, W = map(int, input().split(' '))
pair = [tuple(map(int, input().split(' '))) for _ in range(N)]
dp = [[0]*(W+1) for _ in range(N+1)]
for i in range(N):
    for sum_w in range(W+1):
        if sum_w >= pair[i][0]:
            dp[i+1][sum_w] = max(dp[i][sum_w], dp[i][sum_w-pair[i][0]] + pair[i][1])
        else:
            dp[i+1][sum_w] = dp[i][sum_w]
print(dp[-1][-1])

Measured memory_bytes: 120044
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <queue>
#include <algorithm>
#include <utility>
#include <cmath>
#include <map>
#include <set>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>
using namespace std;

#define INF_LL (ll)1e18
#define INF (int)1e9
#define REP(i, n) for(int i = 0;i < (n);i++)
#define FOR(i, a, b) for(int i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
using ll = long long;
using PII = pair<int, int>;

const double eps = 1e-10;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

#define fs first
#define sc second

int main(void){
	int K, N;
	PII p[51];
	cin >> N >> K;
	REP(i, N){
		cin >> p[i].fs >> p[i].sc;
	}
	ll res = INF_LL*4;
	REP(i, N){
		REP(j, N){
			REP(k, N){
				REP(l, N){
					if(p[i].fs > p[j].fs || p[i].fs > p[k].fs || p[i].fs > p[l].fs) continue;
					if(p[l].fs < p[i].fs || p[l].fs < p[j].fs || p[l].fs < p[k].fs) continue;
					if(p[j].sc < p[i].sc || p[j].sc < p[k].sc || p[j].sc < p[l].sc) continue;
					if(p[k].sc > p[i].sc || p[k].sc > p[j].sc || p[k].sc > p[l].sc) continue;
					int cnt = 0;
					REP(s, N){
						if(p[i].fs <= p[s].fs && p[s].fs <= p[l].fs && p[k].sc <= p[s].sc && p[s].sc <= p[j].sc)
							cnt++;
					}
					if(cnt >= K){
						res = min(res, (ll)(p[l].fs-p[i].fs)*(ll)(p[j].sc-p[k].sc));
					}
				}
			}
		}
	}
	cout << res << endl;
}


Measured memory_bytes: 384
#include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;
#define LL long long
LL gcd(LL x,LL y)
{
    return x%y==0?y:gcd(y,x%y);
}
int main()
{
    int i,j,k,n;
    LL a,b,c,d;
    scanf("%d",&n);
    for(i=0;i<n;i++)
    {
        scanf("%lld%lld%lld%lld",&a,&b,&c,&d);
        if(a<b||d<b||c<a%b||c<b-gcd(b,d))
            printf("No\n");
        else
            printf("Yes\n");
    }
    return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
    using namespace std;
    int main()
    {
      int a,b,c;
      cin>>a>>b>>c;
      if((a==5&&b==5&&c==7)||(a==5&&b==7&&c==5)||(a==7&&b==5&&c==5)) cout<<"YES";
      else cout<<"NO";
      return 0;
      
    }

Measured memory_bytes: 3580
#include <bits/stdc++.h>
using namespace std;
template<class t> inline t read(t &x){
	x=0;char c=getchar();bool f=0;
	while(!isdigit(c)) f|=c=='-',c=getchar();
	while(isdigit(c)) x=(x<<1)+(x<<3)+(c^48),c=getchar();
	if(f) x=-x;return  x;
}
template<class t> inline void write(t x){
	if(x<0){putchar('-'),write(-x);}
	else{if(x>9)write(x/10);putchar('0'+x%10);}
}

string s;

signed main(){
	cin>>s;
	if(s=="SUN") write(7);
	if(s=="MON") write(6);
	if(s=="TUE") write(5);
	if(s=="WED") write(4);
	if(s=="THU") write(3);
	if(s=="FRI") write(2);
	if(s=="SAT") write(1);
}


Measured memory_bytes: 768
#include<bits/stdc++.h>
#define U [1<<17]={}
typedef long long L;using namespace std;map<L,L> T U;L P U,E U,Z U,H U,C U,A U,O U,X U,B U,k,n,a,b,c,p,r;char s U;
L D(L a){L d;Z[a]=1;for(map<L,L>::iterator I=T[a].begin();I!=T[a].end();I++)
    d=I->first,d-P[a]?P[d]=a,E[d]=E[a]+1,C[d]=I->second,D(d),Z[a]+=Z[d],!H[a]|Z[H[a]]<Z[d]?H[a]=d:0:0;}
L G(L a){r=A[a]+A[P[a]]+C[a];return r%k?r:0;}
L M(L i){return i?B[i]+M(i-(i&-i)):0;}
L S(L x,L i){for(x=G(x)-M(i+1)+M(i++);i<1e5+7;B[i]+=x,i+=i&-i);}
L W(){for(c=0;p=X[a],n=X[b],p-n;a=P[p])E[p]<E[n]?swap(p,n),swap(a,b),0:0,c+=M(O[a])-M(O[p])+G(p);cout<<c+abs(M(O[a])-M(O[b]))<<endl;}
main(){for(cin>>n>>k;++p<n;T[a][b]=T[b][a]=c)cin>>a>>b>>c;
       for(D(c=p=0);p<n;p++)if(!p|H[P[p]]-p)for(a=p;!c|a;S(a=H[a],O[a]=c++))X[a]=p;
       for(cin>>a;cin>>s>>a>>b;*s&2?W():A[a]+=b,S(H[a],O[a]),a?S(a,O[a]-1):0);}

Measured memory_bytes: 33464
import java.util.*;
public class Main {
    public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = 0;
		String s = sc.next();
        for(int i=0;i<s.length()/2;i++){if(s.charAt(i)!=s.charAt(s.length()-1-i)){a++;}
                              }        
		System.out.println(a);
	}
}


Measured memory_bytes: 21844
#include<iostream>
#include<vector>
#include<queue>
#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() {
  ll h,w;
  cin >> h >> w;

  ll s = h * w;

  if ( h == 1 || w == 1) {
    cout << 1 << endl;
  } else {
    cout << (s+1)/2 << endl;
  }
  return 0;
}


Measured memory_bytes: 256
/*我是萌新*/
#include<iostream>
#include<cmath>
#include<cstring>
#include<string>
#include<algorithm>
#include <iomanip> 
#include<map>
typedef long long ll;
const int mod = 1e9+7;
using namespace std;
ll gcd(ll a, ll b){
    return b?gcd(b,a%b):a;
}
ll lcm(ll a, ll b){
    return a/gcd(a,b)*b;
}
ll rr[10005],gg[10005],bb[10005];
int main()
{
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);
    ll n;
    while (cin >> n)
    {
        string s;
        cin>>s;
        for (int i=n-1;~i;i--)
    {
        rr[i]+=rr[i+1];
        gg[i]+=gg[i+1];
        bb[i]+=bb[i+1];
        if (s[i]=='R') rr[i]++;
        if (s[i]=='G') gg[i]++;
        if (s[i]=='B') bb[i]++;
    }
    ll ans=0;
    for (ll i=0;i<n;i++)
    {
        for (ll j=i+1;j<n;j++)
        {
            if (s[i]=='R'&&s[j]=='G')
                if (s[j+(j-i)]=='B')
                    ans+=bb[j+1]-1;
                else ans+=bb[j+1];
            else if (s[i]=='R'&&s[j]=='B')
                if (s[j+(j-i)]=='G')
                    ans+=gg[j+1]-1;
                else ans+=gg[j+1];
            else if (s[i]=='B'&&s[j]=='G')
                if (s[j+(j-i)]=='R')
                    ans+=rr[j+1]-1;
                else ans+=rr[j+1];
            else if (s[i]=='G'&&s[j]=='R')
                if (s[j+(j-i)]=='B')
                    ans+=bb[j+1]-1;
                else ans+=bb[j+1];
            else if (s[i]=='B'&&s[j]=='R')
                if (s[j+(j-i)]=='G')
                    ans+=gg[j+1]-1;
                else ans+=gg[j+1];
            else if (s[i]=='G'&&s[j]=='B')
                if (s[j+(j-i)]=='R')
                    ans+=rr[j+1]-1;
                else ans+=rr[j+1];
        }
    }
    cout<<ans<<'\n';
    }
}



Measured memory_bytes: 3724
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <fstream>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
using ll = long long;
#define fst first
#define snd second

/* clang-format off */
template <class T, size_t D> struct _vec { using type = vector<typename _vec<T, D - 1>::type>; };
template <class T> struct _vec<T, 0> { using type = T; };
template <class T, size_t D> using vec = typename _vec<T, D>::type;
template <class T> vector<T> make_v(size_t size, const T& init) { return vector<T>(size, init); }
template <class... Ts> auto make_v(size_t size, Ts... rest) { return vector<decltype(make_v(rest...))>(size, make_v(rest...)); }
template <class T> inline void chmin(T &a, const T& b) { if (b < a) a = b; }
template <class T> inline void chmax(T &a, const T& b) { if (b > a) a = b; }
/* clang-format on */

struct Edge {
  int to, w;
};

bool check(const vec<Edge, 2>& G, int v, int p, vector<int>& color) {
  vector<int> used;
  queue<int> q;
  q.push(v);
  color[v] = p;
  used.push_back(v);
  bool res = true;
  while (!q.empty()) {
    int v = q.front();
    q.pop();
    for (auto& e : G[v]) {
      int u = e.to;
      int w = e.w;
      int want = (e.w - color[v] + 2) % 2;
      if (color[u] == -1) {
        color[u] = want;
        q.push(u);
        used.push_back(u);
      } else {
        if (color[u] != want) {
          res = false;
          goto end;
        }
      }
    }
  }
end:
  for (int v : used) color[v] = -1;
  return res;
}

void nul(const vec<Edge, 2>& G, int v, vector<int>& color) {
  queue<int> q;
  q.push(v);
  while (!q.empty()) {
    int v = q.front();
    q.pop();
    for (auto& e : G[v]) {
      int u = e.to;
      if (color[u] == -1) {
        color[u] = 2;
        q.push(v);
      }
    }
  }
}

int main() {
#ifdef DEBUG
  ifstream ifs("in.txt");
  cin.rdbuf(ifs.rdbuf());
#endif
  int N, M;
  while (cin >> N >> M) {
    vec<Edge, 2> G(N);
    for (int i = 0; i < M; i++) {
      int X, Y, Z;
      cin >> X >> Y >> Z;
      --X;
      --Y;
      Z %= 2;
      G[X].push_back({Y, Z});
      G[Y].push_back({X, Z});
    }
    int res = 0;
    vector<int> color(N, -1);
    for (int v = 0; v < N; v++) {
      if (color[v] != -1) continue;
      if (check(G, v, 0, color) && check(G, v, 1, color)) {
        ++res;
      }
      nul(G, v, color);
    }
    cout << res << endl;
  }
  return 0;
}


Measured memory_bytes: 7796
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <functional>
#include <queue>
#include <string>
#include <cstring>
#include <numeric>
#include <cstdlib>
#include <cmath>
using namespace std;

typedef long long ll;

#define INF 10e17 // 4倍しても(4回足しても)long longを溢れない
#define rep(i,n) for(int i=0; i<n; i++)
#define rep_r(i,n,m) for(int i=m; i<n; i++)
#define END cout << endl
#define MOD 1000000007
#define pb push_back
#define sorti(x) sort(x.begin(), x.end())
#define sortd(x) sort(x.begin(), x.end(), std::greater<int>())
#define debug(x) std::cerr << (x) << std::endl;
#define roll(x) for (auto itr : x) { debug(itr); }

template <class T> inline void chmax(T &ans, T t) { if (t > ans) ans = t;}
template <class T> inline void chmin(T &ans, T t) { if (t < ans) ans = t;}


int main() {
  
  ll n, m;
  cin >> n >> m;
  if (abs(n - m) >= 2) {
    cout << 0 << endl;
    return 0;
  }

  if (abs(n - m) == 1) {
    ll tmpa = 1, tmpb = 1;
    for (int i = 0; i < n; ++i) {
      tmpa *= (n - i) % MOD;
      tmpa %= MOD;
    }

    for (int i = 0; i < m; ++i) {
      tmpb *= (m - i) % MOD;
      tmpb %= MOD;
    }
    
    cout << (tmpa * tmpb) % MOD << endl;
  } else {
    ll tmpa = 1, tmpb = 1;
    for (int i = 0; i < n; ++i) {
      tmpa *= (n - i) % MOD;
      tmpa %= MOD;
    }

    for (int i = 0; i < m; ++i) {
      tmpb *= (m - i) % MOD;
      tmpb %= MOD;
    }

    cout << (tmpa * tmpb * 2) % MOD << endl;
  }
}


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

// in-short-use macros

#define ll long long int
#define ld long double
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define mod 1000000007

//container-use 

typedef vector< ll > vl;
typedef vector< vl > vvl;
typedef pair< ll,ll > pll;
typedef vector<pair<ll,ll > > vpl;
#define all(c) (c).begin(),(c).end()
#define tr(c,i) for(typeof((c).begin() i = (c).begin(); i != (c).end(); i++)
#define present(c,x) ((c).find(x) != (c).end())
#define rep(i,a,b) for (int i = a; i <= b; i++)

//main function here

ll n,k;
ll a[200000+5],f[200000+5];
bool check(ll m)
{
    ll sum=0;          // count of a[i]'s needed to be wwasted by k
    for(ll i=0;i<n;i++)
                sum+=max(0ll,a[i]-m/f[i]);
    return sum>k;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin>>n>>k;
    for(ll i=0;i<n;i++)
        cin>>a[i];
    for(ll i=0;i<n;i++)
        cin>>f[i];
    sort(a,a+n);
    sort(f,f+n,greater<ll>());
    ll l=0,r=(ll)(1e12),mid,d;
    while(l<=r)
    {
        mid=(l+r)/2;
        if(check(mid))
            l=mid+1;
        else
        {
            d=mid,r=mid-1;
        }
    }
    cout<<d<<"\n";
  return 0;
 }

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

void main(void){
  char S[1000],T[1000];
  int i,j,n,max=0;
  int lenS,lenT;
  
  scanf("%s",S);
  scanf("%s",T);
  lenS=strlen(S);
  lenT=strlen(T);
  
  for(i=0;i<=lenS-lenT;i++){
    n=0;
	for(j=0;j<lenT;j++){
      if(S[i+j]==T[j])
  		n+=1;
    }
    if(max<n)max=n;
  }
  printf("%d",(lenT-max));
}

Measured memory_bytes: 1732
#include <cstdlib>
#include <cmath>
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <cstring>
#include <string>
#include <map>
#define MOD 1000000007
#define INF 1000000000
typedef long long ll;
using namespace std;
typedef pair<int,int> P;

int main(void){
    int r,g,b;
    cin>>r>>g>>b;
    int num=r*100+g*10+b;
    if(num%4==0)printf("YES\n");
    else printf("NO\n");
    return 0;
}


Measured memory_bytes: 256
import Data.List

primes::[Int]
primes=2:3:p where 
    p=5:q 1 7 p
    q m s (p:ps)=[n|n<-[x+y|x<-[s,s+6..p*p-2],y<-[0,4]],gcd(toInteger n)m<2]++q(m*toInteger p)(p*p)ps

fs ps=unfoldr fp.(,,)0 ps where
    fp (0,_,1)=Nothing
    fp (_,[],n)=Just((n,1),(0,[],1))
    fp (c,a@(p:r),n)|n`mod`p==0=fp(c+1,a,n`div`p)|c==0=fp(0,r,n)|c/=0=Just((p,c),(0,r,n))

main=do
    [n,p]<-map read.words<$>getLine
    print $ product $ map (\(a,b)->a^(b`div`n)) $ fs (takeWhile (<=1000001) primes) p


Measured memory_bytes: 7932
#include <bits/stdc++.h>
using namespace std;
using pii=pair<int,int>;
using ll=long long;

#define fi first
#define se second
#define pb push_back
#define rep(i,n) for(int i=0; i<(int)(n); i++)

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int main() {
	int n;
	cin >> n;
	vector<int> l(n);
	rep(i,n) cin >> l[i];
	sort(l.begin(), l.end());
	ll ans=0;
	rep(i,n) for(int j = i+1; j<n; j++) {
		if(i == j) continue;
		int temp = lower_bound(l.begin(), l.end(), l[i]+l[j]) - l.begin() - (j+1);
		//cout << i << " " << j << " " << temp << endl;
		ans += temp;
	}
	cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
char ch[10];
int main()
{
	scanf("%s",ch);
	if(ch[0]=='M'&&ch[1]=='O'&&ch[2]=='N') cout<<6;
	if(ch[0]=='T'&&ch[1]=='U'&&ch[2]=='E') cout<<5;
	if(ch[0]=='W'&&ch[1]=='E'&&ch[2]=='D') cout<<4;
	if(ch[0]=='T'&&ch[1]=='H'&&ch[2]=='U') cout<<3;
	if(ch[0]=='F'&&ch[1]=='R'&&ch[2]=='I') cout<<2;
	if(ch[0]=='S'&&ch[1]=='A'&&ch[2]=='T') cout<<1;
	if(ch[0]=='S'&&ch[1]=='U'&&ch[2]=='N') cout<<7;
	return 0;
}

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

//#define int long long
#define reps(i,s,n) for(int (i)=(s);(i)<(n);++(i))
#define rep(i,n) reps(i,0,n)
#define rept(i,n) reps(i,0,((n)+1))
#define repst(i,s,n) reps(i,s,((n)+1))
#define reprt(i,n,t) for(int (i)=(n);(i)>=(t);--(i))
#define repr(i,n) reprt(i,n,0)
#define each(itr,v) for(auto &(itr):(v))
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define mp(x,y) make_pair((x),(y))
#define fi first
#define se second
#define tmax(x,y,z) max(x,max(y,z))
#define tmin(x,y,z) min(x,min(y,z))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln '\n'
#define bln(i,n) (i==n-1?'\n':' ')
#define dbg(x) cout<<#x" = "<<(x)<<ln
#define dbga(x,n) {cout<<#x" : ";for(int (i)=0;i<(n);++i){cout<<((x)[i])<<(i==((n)-1)?'\n':' ');}}

typedef long double ld;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vst;
typedef vector<bool> vb;
typedef vector<ld> vld;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vector<int> > mat;

const ll inf = (ll)1e9+10;
const ll linf = (ll)1e18+10;
const ll mod = (ll)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};
const double eps = 1e-10;

struct oreno_initializer {
	oreno_initializer() {
		cin.tie(0);
		ios::sync_with_stdio(0);
	}
} oreno_initializer;

// ━━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…
// .｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋
// ・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・

int n, a, c[100100], p;

signed main() {
	cin >> n;
	rep(i,n) {
		cin >> a;
		c[a]++;
	}
	repst(i,1,100000) p += max(0,c[i]-1);
	cout << n - (p+p%2) << ln;
}

Measured memory_bytes: 640
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            string S = Console.ReadLine();
            string alphabet = "abcdefghijklmnopqrstuvwxyz";
            List<string> result = new List<string>();
            for (int i = 0; i < alphabet.Length; i++)
            {
                string checkStr = alphabet.Substring(i, 1);
                if (S.IndexOf(checkStr) == -1)
                {
                    result.Add(checkStr);
                }
            }
            if (result.Count() == 0)
            {
                Console.WriteLine("None");
            }
            else
            {
                Console.WriteLine(result[0]);
            }
        }
    }
}
// 文字列の入力
//string s = Console.ReadLine();

// 整数の入力
//long n = long.Parse(Console.ReadLine());

// 文字列配列の入力
//string[] inputStrArray = Console.ReadLine().Split(' ');

// 整数配列の入力
//long[] inputLongArray = Console.ReadLine().Split(' ').Select(i => long.Parse(i)).ToArray();


//Console.WriteLine(ans);

Measured memory_bytes: 27316
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n, h;
	cin >> n >> h;
	vector<int> a(n), b(n);
	rep(i,n) cin >> a[i] >> b[i];
	sort(a.rbegin(), a.rend());
	sort(b.rbegin(), b.rend());
	int ans = 0, idx = 0;
	while(h > 0 && idx < n && a[0] < b[idx]){
		h -= b[idx++];
		++ans;
	}
	if(h > 0) ans += (h + a[0] - 1) / a[0];
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3948
N = int(input())
card_list_source = input().split(' ')

def BubbleSort(card_list, N):
    for i in range(N):
        for j in reversed(range(i+1, N)):
            if int(card_list[j][1]) < int(card_list[j-1][1]):
                temp = card_list[j]
                card_list[j] = card_list[j-1]
                card_list[j-1] = temp
    return card_list

def SelectionSort(card_list, N):
    for i in range(N):
        min_index = i
        for j in range(i+1, N):
            if int(card_list[j][1]) < int(card_list[min_index][1]):
                min_index = j
        if min_index != i:
            temp = card_list[i]
            card_list[i] = card_list[min_index]
            card_list[min_index] = temp
    return card_list

def isStable(card_list_A, card_list_B):
    N = len(card_list_A)
    for i in range(N):
        for j in range(i+1, N):
            for a in range(N):
                for b in range(a+1, N):
                    if int(card_list_A[i][1]) == int(card_list_A[j][1]) and card_list_A[i] == card_list_B[b] and card_list_A[j] == card_list_B[a]:
                        return 'Not stable'
    return 'Stable'

def make_out_str(card_list):
    out_str = ''
    for i, card in enumerate(card_list):
        out_str += card
        if i < len(card_list) - 1:
            out_str += ' '
    return out_str

card_list_bubble = BubbleSort(card_list_source.copy(), N)
print(make_out_str(card_list_bubble))
print(isStable(card_list_bubble, card_list_source))

card_list_selection = SelectionSort(card_list_source.copy(), N)
print(make_out_str(card_list_selection))
print(isStable(card_list_selection, card_list_source))





Measured memory_bytes: 5604
#include "bits/stdc++.h"
#define rep(i,a,n) for(int i = a;i < n;i++)
typedef unsigned long long ull;
typedef long long ll;
using namespace std;

int main(){
	string s;
	cin >> s;
	int cnt = 0,memo = 0,ans = 1000000000;
	
	rep(i,0,26){
		rep(j,0,s.size()){
			if(s[j] == (char)(i+'a')){
				cnt = max(memo,cnt);
				memo = 0;
			}
			else{
				memo++;
			}
		}
		cnt = max(memo,cnt);
		memo = 0;
		//cout <<(char)(i+'a') << " " << cnt << endl;
		ans = min(ans,cnt);
		cnt = 0;
	}
	
	
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 256
#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 a[26][26];
    rep(i, 26) rep(j, 26) a[i][j] = 0;
    rep(i, S.size()) {
        a[S[i] - 'a'][T[i] - 'a'] = 1;
    }
    string ans = "Yes\n";
    rep(i, 26) {
        int r = 0, c = 0;
        rep(j, 26) {
            r += a[i][j];
            c += a[j][i];
        }
        if (r > 1 || c > 1) ans = "No\n";
    }
    cout << ans;
}

Measured memory_bytes: 776
/**
 *    author:  FromDihPout
 *    created: 2020-09-13
**/

#include <bits/stdc++.h>
using namespace std;

const int MOD = 1e9 + 7;

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

	int total = (s + 2) / 3;
	vector<long long> dp(s+1);
	dp[0] = 1;
	for (int i = 0; i < s; i++) {
		for (int n = 3; n <= s; n++) {
			if (i + n <= s) {
				dp[i+n] += dp[i];
				dp[i+n] %= MOD;
			}
		}
	}
	cout << dp[s] << endl;
	return 0;	
}


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

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  long long a[n], h=0, w=0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  sort(a, a+n);
  for (int i = 0; i+1 < n; i+=2) {
    if (a[i] == a[i+1]) {
      h = w;
      w = a[i];
    }
    else {
      --i;
    }
  }
  cout << h * w << '\n';
}


Measured memory_bytes: 1024
import java.util.*;
import java.io.*;
public class Main
{
    public static void main(String args[])throws Exception
    {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        PrintWriter pw=new PrintWriter(System.out);
        //int t=Integer.parseInt(br.readLine());
        //while(t-->0)
        //{
            int n=Integer.parseInt(br.readLine());
            if(n>=400&&n<600)
            pw.println(8);
            else if(n>=600&&n<800)
            pw.println(7);
            else if(n>=800&&n<1000)
            pw.println(6);
            else if(n>=1000&&n<1200)
            pw.println(5);
            else if(n>=1200&&n<1400)
            pw.println(4);
            else if(n>=1400&&n<1600)
            pw.println(3);
            else if(n>=1600&&n<1800)
            pw.println(2);
            else
            pw.println(1);
        //}
        pw.flush();
        pw.close();
    }
}

Measured memory_bytes: 32812
aryL = %w|q w e r t a s d f g z x c v b|
aryR = %w|y u i o p h j k l n m|

loop do
  str = gets.chomp.chars
  if str == ["#"]
    exit
  else
    if aryL.include?(str[0])
      now = :left
    else
      now = :right
    end
    
    cnt = 0
    str.each do |c|
      if now == :left && aryR.include?(c)
        cnt += 1
        now = :right
      elsif now == :right && aryL.include?(c)
        cnt += 1
        now = :left
      end
    end

    puts cnt
  end
end



Measured memory_bytes: 6868
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define mp make_pair
#define st first
int n, p;
int dem;
int ans=  1;
int danhdau[1000001];
vector <int> vt;
int m[1000001];
signed main(){
    cin >> n >> p;
    int i = 2;
    int u = sqrt(p);
    if(n==1){
        cout << p;
        return 0;
    }
    while(i<u){
        if(p%i == 0){
            p=p/i;
            m[i]++;
            if(danhdau[i]!= 1){
                vt.pb(i);
                danhdau[i] = 1;
            }
        }
        else{
            i++;
        }
    }
    i = 0;
    while(i<vt.size()){
        if(m[vt[i]]>=n){
            ans = ans*vt[i];
            m[vt[i]] = m[vt[i]]-n;
        }
        else{
            i++;
        }
    }
    cout << ans;
}


Measured memory_bytes: 3668
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
typedef vector<ll> VI;
typedef vector<VI> VVI;
const ll MOD = 998244353;
const ll INF = 4611686018427387903;
#define REP(i, n) for (int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()

int main(){
	int n; cin >> n; n++;
	VI a(n); REP(i,n) cin >> a[i];
	VI r(n); r[n-1]=a[n-1];
	for(int i=n-2;i>=0;i--) r[i]=r[i+1]+a[i];
	ll ans=0, y=1;
	bool no=0;
	REP(i,n){
		if(y<a[i]){
			no=1;
			break;
		}
		ans+=y;
		y-=a[i];
		y*=2;
		if(r[i+1]<=y){
			for(int j=i+1;j<n;j++)
				ans+=(j-i)*a[j];
			break;
		}
	}
	if(no)
		cout << -1 << endl;
	else
		cout << ans << endl;
	return 0;
}

Measured memory_bytes: 4840
#include <bits/stdc++.h>
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;

#define ll long long
#define ldb long double
#define db double
#define str string

#define fr first
#define se second
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define mpa make_pair

#define pi pair<int,int>
#define pll pair<ll,ll>
#define pdb pair<db,db>
#define pldb pair<ldb,ldb>

#define vi vector<int>
#define vll vector<ll>
#define vdb vector<db>
#define vldb vector<ldb>
#define vpi vector< pi >
#define vpll vector< pll >

#define mi map<int,int>
#define mll map<ll,ll>
#define mdb map<db,db>
#define mldb map<ldb,ldb>


#define forr(i,a,b) for (int i = (a); i < (b); ++i)
#define rrof(i,a,b) for (int i = (b)-1; i >= (a); --i)


const int MOD = 1e9+7;
const ldb PI = 4*atan((ldb)1);

ll power(ll a,ll n){
	ll res=1;

	while(n){
		if(n%2)
		res*=a;
		a*=a;
		n/=2;
	}
	
	return res;
}

ll int h=power(10,10);

ll int fun(int x,int*a,ll int*dp,int k){
	if(x<=0)
	return 0;
	
	if(dp[x]==-1){
		ll int ans=h;
		for(int i=0;i<k;i++){
			ans=min(fun(x-i-1,a,dp,k)+abs(a[x]-a[max(0,x-i-1)]),ans);
		}
		
		dp[x]=ans;
	}
	
	return dp[x];
}

int main(){
	fast;
	
	int n,k;
	cin>>n>>k;
	
	int a[n];
	forr(i,0,n)
	cin>>a[i];
	
	ll int dp[n+1];
	for(int i=0;i<=n;i++)
	dp[i]=-1;
	
	ll int ans=fun(n-1,a,dp,k);
	cout<<ans;
	
	return 0;
}

Measured memory_bytes: 9216
N=int(input())

if N >= 0:
  n = N
  i = 0
  while 1:
    b = bin(n)[2:]
    if i >= len(b):
      break
    if i % 2 == 1 and b[-i-1]=='1':
      n += 2**(i+1)
    i += 1
  print(bin(n)[2:])
  
else:
  n = -N
  i = 0
  while 1:
    b = bin(n)[2:]
    if i >= len(b):
      break
    if i % 2 == 0 and b[-i-1]=='1':
      n += 2**(i+1)
    i += 1
  print(bin(n)[2:])

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

signed main() {
  int N;
  cin >> N;
  
  vector<int> L(2*N);
  for( int i = 0; i < 2*N; i++ ) cin >> L.at(i);
  sort( L.begin(), L.end() );
  
  int ans = 0;
  for( int i = 0; i < 2*N; i += 2 ){
    ans += min( L.at(i), L.at(i+1) );
  }
  cout << ans << endl;
    
}


Measured memory_bytes: 256
n = int(input())

xs_0 = [1]
i = 1
while True:
    if 6 ** i > n:
        break
    xs_0.append(6 ** i)
    i += 1
i = 1
while True:
    if 9 ** i > n:
        break
    xs_0.append(9 ** i)
    i += 1

xs = sorted(xs_0)

counts = [0]
for i in range(1, n+1):
    opts = [_ for _ in xs if _ <= i]
    tmps = []
    for opt in opts:
        tmp = counts[i-opt] + 1
        tmps.append(tmp)
    counts.append(min(tmps))

print(counts[-1])

Measured memory_bytes: 3860
from math import *
from copy import *
from string import *				# alpha = ascii_lowercase
from random import *
from sys import stdin,stdout
from sys import maxsize
from operator import *				# d = sorted(d.items(), key=itemgetter(1))
from itertools import *
from collections import Counter		# d = dict(Counter(l))
import math
import math
import time
from queue import Queue
# PradeepGhosh_2017076

def seive(n):
	l=[True]
	l=l*(n+1)
	for i in range(2,int(sqrt(n))+1):
		if(l[i]==True):
			val=i*i
			while(val<len(l)):
				l[val]=False
				val+=i
	prime=[]
	for i in range(2,len(l)):
		if(l[i]==True):
			prime.append(i)
	return prime

def dp(l,i,n,val,ans):
	if(i>=n or val<0):
		return 1000000
	elif(val==0):
		return 0
	else:
		if(ans[i]==1000000):
			ans[i]=min(min(1+dp(l,i+1,n,val-l[i],ans),1+dp(l,i,n,val-l[i],ans)),dp(l,i+1,n,val,ans))
		return ans[i]
from queue import Queue
def factors(n):
	l=[]
	for i in range(1,int(sqrt(n))+1):
		if(n%i==0):
			if(n//i==i):
				l.append(i)
			else:
				l.append(i)
				l.append(n//i)
	return l
if __name__ == '__main__':
	x,y=map(int,input().split(" "))
	ans=-1
	for i in range(x+1):
		for j in range(x+1):
			if(i*4+j*2==y and i+j==x):
				ans=1
				break
		if(ans==1):
			break
	if(ans==1):
		print("Yes")
	else:
		print("No")
	





Measured memory_bytes: 10596
#include<stdio.h>

#define N 100

int main(){
  int a,i,j,count = 0;
  int A[N+1];
  int flag,k;

  scanf("%d",&a);

  for(i = 1;i <= a;i++){
    scanf("%d",&A[i]);
  }
  flag = 1;
  i = 1;
  while(flag){
    flag = 0;
    for (j = a;j >= i + 1;j--){
      if(A[j] < A[j - 1]){
        k = A[j];
	A[j] = A[j - 1];
	A[j - 1] = k;
	count++;
	flag = 1;
      }
    }
    i++;
  }
  for(i = 1;i <= a;i++){
    if(i == a){
      printf("%d",A[i]);
    }
    else
    printf("%d ",A[i]);
  }
  printf("\n");
  printf("%d\n",count);
  
  return 0;
}



Measured memory_bytes: 2140
import sys
input = sys.stdin.readline

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    N=I()
    D=LI()
    M=I()
    T=LI()
    
    from collections import defaultdict
    dd = defaultdict(int)
    
    for i in range(N):
        dd[D[i]]+=1
        
    flag=1
    for i in range(M):
        dd[T[i]]-=1
        
    for k,v in dd.items():
        if v<0:
            flag=0
            
    if flag:
        print("YES")
    else:
        print("NO")
    

main()


Measured memory_bytes: 129644
#include "bits/stdc++.h"
using namespace std;

#define FAST ios_base::sync_with_stdio(false); cin.tie(0);
#define pb push_back
#define eb emplace_back
#define ins insert
#define ph push
#define f first
#define s second
#define cbr cerr << "hi\n"
#define mmst(x, v) memset((x), v, sizeof ((x)))
#define siz(x) ((ll)x.size())
#define all(x) (x).begin(), (x).end()
#define lbd(x, y) lower_bound(all(x), y)
#define ubd(x, y) upper_bound(all(x), y)
#define btinpct(x) __builtin_popcountll((x))
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());    //can be used by calling rng() or shuffle(A, A+n, rng)
inline long long rand(long long x, long long y) { return (rng() % (y+1-x)) + x; } //inclusivesss
string inline to_string(char c) {string s(1,c);return s;} template<typename T> inline T gcd(T a,T b){ return a==0?llabs(b):gcd(b%a,a); }

typedef long long ll; 
typedef long double ld;
#define FOR(ii, ss, ee) for(ll ii = (ss); ii <= (ll)(ee); ++ii)
#define DEC(ii, ss, ee) for(ll ii = (ss); ii >= (ll)(ee); --ii)
typedef pair <ll, ll> pi; typedef pair <ll, pi> spi; typedef pair <pi, pi> dpi;

#define LLINF ((long long) 1e18)//1234567890987654321
#define INF 1234567890ll
// #define cerr if(0)cout
#define MAXN (300006)
ll n;
int main()
{
	FAST
	cin>>n;
	ll x=n%100;
	n /= 100;
	ll times=0;
	DEC(i,5,1) {
		times += x/i;
		x%=i;
	}
	if(times > n) cout<<0; else cout<<1;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define enld '\n'
#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("Ofast")
constexpr ll INF = 1e18;
constexpr int inf = 1e9;
constexpr double INFD = 1e100;
constexpr ll mod = 1000000007;
constexpr ll mod2 = 998244353;
const double PI = 3.1415926535897932384626433832795028841971;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
// ios::sync_with_stdio(false);
// cin.tie(nullptr);
// ---------------------------------------------------------------------------


int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N;
    cin >> N;
    vector<int> A(N);
    for(int i=0; i<N; i++){
        cin >> A[i];
    }
    sort(A.begin(),A.end());
    double ans = A[0];
    for(int i=1; i<N; i++){
        ans += A[i];
        ans /= 2;
    }
    cout << fixed << setprecision(10) << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define L long long
#define pb push_back
#define pi pair<int,int>
#define pii pair<pair<int,int>,int>
#define aa first
#define bb second
#define xx aa.aa
#define yy aa.bb
#define zz bb
#define mp make_pair
#define mpp(a,b,c) mp(mp(a,b),c)
using namespace std;
int n;
L p,q;
inline void dfs(L x,L n,L m)
{
	//cout<<x<<" "<<n<<" "<<m<<"\n";
	if(x==0)
	  {
	   if(!n)
	     p+=m;
	   return;
	  }
	if(x==1)
	  {
	   if(!n)
	     p+=m*10;
	   return;
	  }
	int k=(10-n%10)%10;
	dfs(x/100,abs(n-k*x+k)/10,m*(10-abs(k)-(x==q)));
}
int main()
{
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	scanf("%d",&n);
	for(L k=1;k<=100000000000000000ll;k*=10)
	  q=k,dfs(k,n,1);
	printf("%lld\n",p);
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>
#include <queue>
#include <map>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
using namespace std;
int n,m;
int a[100010],b[100010];
pair<int,int> p[100010];
vector<int> v[100010];
priority_queue<int> q;
int main()
{
  cin >> n >> m;
  rep(i,n) cin >> a[i] >> b[i];
  rep(i,n) p[i] = make_pair(a[i],b[i]);
  rep(i,100001) v[i].push_back(0); 
  rep(i,n){
    v[p[i].first].push_back(p[i].second);
  }
  
  int res = 0;
  rep(i,m){
    int vs=v[i+1].size();
    rep(j,vs){
      q.push(v[i+1][j]);
    }
    
    res += q.top();
    q.pop();
  }
  cout << res << "\n";
  
  return 0;
}


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

int main(){
	int n;
	cin>>n;
	int hash[n+1];
	memset(hash,0,sizeof(hash));
	for(int i=0;i<n-1;i++) {
		int x;
		cin>>x;
		hash[x]++;
	}
	for(int i=1;i<=n;i++) cout<<hash[i]<<endl;
	return 0;
}

Measured memory_bytes: 4348
#include<stdio.h>
int main()
{
    unsigned long long int n, a, b;
    scanf("%lld %lld %lld", &n, &a, &b);
    if (a > b)
        printf("0\n");
    else if (a < b && n < 2)
        printf("0\n");
    else if (a == b)
        printf("1\n");
    else
        printf("%lld\n", (b*(n - 1) + a) - (a*(n - 1) + b) + 1);
    return 0;
}

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


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

	int64_t fbsum=0;
	for (int i=1; i<=n; i++) {
		if (!((i%3==0) || (i%5==0))) {
			fbsum += i;
		}
	}

	cout << fbsum <<endl;

}


Measured memory_bytes: 3636
n = int(input())
a = list(map(int,input().split()))
if sum(a)%(n*(n+1)//2):
  print("NO")
  exit()
dif = [a[(i+1)%n]-a[i] for i in range(n)]
x = sum(a)//(n*(n+1)//2)
for i in range(n):
  if (x-dif[i])%n or x-dif[i]<0:
    print("NO")
    exit()
print("YES")

Measured memory_bytes: 14244
// https://atcoder.jp/contests/dp/tasks/dp_d
#include <bits/stdc++.h>
#define ll long long int
#define pr pair<ll, ll>
#define infinity (ll)4e18
#define tp tuple<ll, ll, ll>
using namespace std;
long long int mod = 1e9 + 7;

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

    ll n, w;
    cin >> n >> w;
    ll weight[n + 1], value[n + 1];
    for (ll i = 1; i <= n; i++)
        cin >> weight[i] >> value[i];
    ll dp[n + 1][w + 1];
    for (ll i = 0; i <= w; i++)
        dp[0][i] = 0;
    for (ll i = 0; i <= n; i++)
        dp[i][0] = 0;
    for (ll i = 1; i <= n; i++)
        for (ll j = 1; j <= w; j++)
        {
            dp[i][j] = dp[i - 1][j];
            if (j - weight[i] >= 0)
                dp[i][j] = max(dp[i][j], dp[i - 1][j - weight[i]] + value[i]);
        }
    cout << dp[n][w] << endl;
    return 0;
}

Measured memory_bytes: 79232
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
#include <deque>
#include <iomanip>
#include <limits>
#include <fstream>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;
struct SegmentTree{
  int n_, n = 1;
  int MAX = 2147483647;
  vector<int> v;
  SegmentTree(int n_):n_(n_){
    while(n < n_) n *= 2; // 2の冪乗が扱いやすい
    v.assign(2*n, MAX);
  }
  // k番目の要素をaに変更
  void update(int k, int a){
    k += n - 1; // ノード番号にする
    v[k] = a;
    while(k > 0){
      k = (k - 1) / 2;
      v[k] = min(v[2 * k + 1], v[2 * k + 2]);
    }
  }
  // [a, b)の最小値,kはノード番号
  // query(a,b,0,0,n)を呼ぶ
  int query_(int a, int b, int k, int l, int r){
    if(b <= l || r <= a) return MAX;
    if(a <= l && r <= b) return v[k];
    int vl = query_(a, b, 2 * k + 1, l, (l + r) / 2);
    int vr = query_(a, b, 2 * k + 2, (l + r) / 2, r);
    return min(vl, vr);
  }

  int query(int a, int b){
    return query_(a, b, 0, 0, n);
  }

};
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, q;
  cin>>n>>q;
  SegmentTree seg(n);
  FOR(i,0,q){
      int com;
      int x, y;
      cin>>com>>x>>y;
      if(com == 0){
          seg.update(x, y);
      } else {
          cout<<seg.query(x, y + 1)<<endl;
      }
  }
  return 0;
}


Measured memory_bytes: 3844
N = int(input())
a = input().split()
a = list(map(int,a))
sa = sorted(a,reverse=True)
count = 0
count += sa[0]
f = 0
t = 1
for _ in range(N-2):
    if f == 2:
        t += 1
        count += sa[t]
        f = 0
    else:
        count += sa[t]
    f += 1
print(count)

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

bool isPrime(int num) {
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false;

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2) {
        if (num % i == 0) {
            return false;
        }
    }
    return true;
}

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

  for (int k = 11; k <= 55555; k += 10) {
    if (isPrime(k)) {
      cout << k;
      n--;
      if (n == 0) break;
      cout << ' ';
    }
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int INF=0x3f3f3f3f;
inline ll read(){
	ll x=0,f=1;
	char ch=getchar();
	while(ch<'0'||ch>'9'){
		if(ch=='-') f=-1;
		ch=getchar();
	}
	while(ch>='0'&&ch<='9'){
		x=(x<<1)+(x<<3)+(ch^48);
		ch=getchar();
	}
	return x*f;
}
double x,ans;
int main(){
	x=read();
	ans=2.0*x*acos(-1);
	printf("%.20lf\n",ans);
	return 0;
}


Measured memory_bytes: 3752
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations
import sys
import string
from bisect import bisect_left


INF = float('inf')
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LIM(): return list(map(lambda x:int(x) - 1, sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def LIRM(n): return [LIM() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
mod = 1000000007


s = S()
if s[0] == s[-1]:
    if len(s) % 2:
        print('Second')
    else:
        print('First')
else:
    if len(s) % 2:
        print('First')
    else:
        print('Second')

Measured memory_bytes: 41200