akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef int q;
typedef double w;
typedef string s;
q main(){
     q x,y,z;
     cin>>x>>y;
     if(x>=13){cout<<y;}
     else if(x>=6&&x<=12){cout<<y/2;}
     else if(x<=5){cout<<0;}
return 0;}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define f first
#define s second
#define pb push_back
#define M (L+R)/2
#define N 500009
#define inf 99999999999
#define ll long long
using namespace std;
string s;
ll n,ans,x;
int main(){

	ios::sync_with_stdio(0);
	
	cin>>s;
	n=s.size();
	x=n/2;
	
	for(int i=1;i<=x;i++){
		if(s[i-1]!=s[n-i])ans++;
	}
	cout<<ans<<endl;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
using namespace std;
typedef long long int ll;
int main()
{
	static ll n,a[100000],i,j,ans[100000];
	cin>>n;
	for (i=1;i<=n;i++) cin>>a[i],a[i]*=2;
	ll t=0,b=-1;
	for (i=1;i<=n;i++)
	{
		t+=a[i]*(b*=-1);
	}
	ans[1]=t/2;
	for (i=2;i<=n;i++)
	{
		ans[i]=a[i-1]-ans[i-1];
	}
	for (i=1;i<=n;i++)
	{
		cout<<ans[i]<<endl;
	}
}

Measured memory_bytes: 2816
using System;
using System.Linq;

namespace ABC054C
{
    class Program
    {
        static void Main(string[] args)
        {
            new Solver().Solve();
#if DEBUG
            Console.ReadLine();
#endif
        }
    }

    class Solver
    {
        int N;
        int M;
        bool[,] Graph;
        bool[] Visited;
        bool isAllVisited
        {
            get
            {
                return Visited.All(e=>e);
            }
        }

        public void Solve()
        {
            Console.WriteLine(Dfs(0));
        }

        public Solver()
        {
            int[] nm = ReadIntArray();
            N = nm[0];
            M = nm[1];

            Graph = new bool[N, N];
            for (int i = 0; i < M; i++)
            {
                int[] ab = ReadIntArray();
                int a = ab[0] - 1;
                int b = ab[1] - 1;
                Graph[a, b] = true;
                Graph[b, a] = true;
            }

            Visited = new bool[N];
            Visited[0] = true;
        }

        int Dfs(int v)
        {
            if (isAllVisited)
            {
                return 1;
            }

            int count=0;

            // 現在の頂点vに隣接し、かつまだ訪れていないすべての頂点uについて
            foreach(int u in Enumerable.Range(1, N-1).Where(u => Graph[v, u] && v != u && !Visited[u]))
            {
                Visited[u] = true;
                count += Dfs(u);
                Visited[u] = false;
            }
            return count;
        }        

        static String ReadString() { return Console.ReadLine(); }
        static int ReadInt() { return int.Parse(Console.ReadLine()); }
        static long ReadLong() { return long.Parse(Console.ReadLine()); }
        static double ReadDouble() { return double.Parse(Console.ReadLine()); }
        static String[] ReadStringArray() { return Console.ReadLine().Split(' '); }
        static int[] ReadIntArray() { return Console.ReadLine().Split(' ').Select(e => int.Parse(e)).ToArray(); }
        static long[] ReadLongArray() { return Console.ReadLine().Split(' ').Select(e => long.Parse(e)).ToArray(); }
        static double[] ReadDoubleArray() { return Console.ReadLine().Split(' ').Select(e => double.Parse(e)).ToArray(); }
    }

}


Measured memory_bytes: 13396
#include <algorithm>
#include <iterator>
#include <iostream>
#include <sstream>
#include <bitset>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include<iomanip>
#include <list>
#include <map>
#include <set>
#include <time.h>
#include <limits>
#include <math.h>
#include <climits>
#include <numeric>
#include <utility>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <functional>
#include<unordered_map>

using namespace std;
const double pi=acos(-1.0);
//memset ( a , 0 , n * sizeof(ll) ) ;

#define 	boost  		ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); // don't use if small inpts
#define 	endl 		'\n'
#define 	sl(n) 		scanf("%lld",&n)
#define		mp 			make_pair
#define 	pb 			push_back
#define 	ppb 		pop_back
#define 	fi 			first
#define 	se 			seconchutd
#define 	ll 			long long
#define     ld 			long double
#define 	ull 		unsigned long long
#define 	pii 		pair<int, int>
#define 	f(i,a,b) 	for(ll i = (ll)(a); i < (ll)(b); i++)
#define 	rf(i,a,b) 	for(ll i = (ll)(a); i > (ll)(b); i--)
#define 	ms(a,b) 	memset((a),(b),sizeof(a))
#define 	max(a,b) 	((a>b)?(a):(b))
#define 	min(a,b) 	((a<b)?(a):(b))
#define 	vec(g1) 	int temp;cin>>temp;g1,push_back(temp);
#define 	abs(x) 		((x<0)?(-(x)):(x))
#define 	MAX 		1000005
#define 	inf 		LLONG_MAX
#define 	MIN 		INT_MIN

//typedef
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<PII> VII;
typedef vector<VI> VVI;
typedef map<int,int> MPII;
typedef set<int> SETI;
typedef multiset<int> MSETI;
typedef long int int32;
typedef unsigned long int uint32;
typedef long long int int64;
typedef unsigned long long int  uint64;


int mod = 1e9 + 7 ;
ll gcd(ll a , ll b){return b==0?a:gcd(b,a%b);}
ll powmod(ll a,ll b) {ll res=1;if(a>=mod)a%=mod;for(;b;b>>=1){if(b&1)res=res*a;if(res>=mod)res%=mod;a=a*a;if(a>=mod)a%=mod;}return res;}// ll fac[200005];
// ll inverse(ll n){return powmod(n, mod-2);}
// ll nCr(ll n, ll r){return (fac[n] * inverse(fac[r]) % mod * inverse(fac[n-r]) % mod) % mod;}

/**.................................................................................................................................*/

int main() {

  boost;
  int n;
  cin>>n;
  ld p[n+1];
  cout<<fixed<<setprecision(12);
  for(int i=1;i<=n;i++)cin>>p[i];

  ld dp[n+1][n+1];
  for(int i=0;i<=n;i++)for(int j=0;j<=n;j++)dp[i][j]=0.0000000;
   dp[1][0]=1-p[1];
   dp[1][1]=p[1];
  for(int i=2;i<=n;i++){
  	 for(int j=0;j<=n;j++){
  	    if(j>0)	dp[i][j]=dp[i-1][j-1]*p[i];
  	   dp[i][j] += dp[i-1][j] * (1-p[i]); 
  	 }
  }
   ld prob=0;
   for(int i=n/2 +1  ; i<=n;i++){
   	  prob+= dp[n][i];
   }
  cout<<prob<<endl;


     return 0;
}


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

int main(){

	int n,m;
	cin >> n >> m;
	int A[n][m]={0}, b[m]={0}, c[n]={0};

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

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

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

	return 0;
}

Measured memory_bytes: 3128
#include <set>
#include <queue>
#include <cmath>
#include <bitset>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <cstring>
#include <iostream>
#include <algorithm>
#define debug(x) cerr<<#x<<'='<<x<<endl
#define set0(x) memset(x,0,sizeof(x))
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pii;
template<typename T> void read(T &x){
	x = 0;char ch = getchar();ll f = 1;
	while(!isdigit(ch)){if(ch == '-')f*=-1;ch=getchar();}
	while(isdigit(ch)){x = x*10+ch-48;ch=getchar();}x*=f;
}

char s[200020];
int main() {
	cin>>s;
	int n = strlen(s),p = 0;
	ll ans = 0,ccu = 0;
	while(p<=n){
		if(s[p] == 'A'){
			ccu+=1;
			p+=1;
			continue;
		}
		if(s[p] == 'B' && s[p+1] == 'C'){
			ans+=ccu;
			p+=2;
			continue;
		}
		ccu = 0;
		p+=1;
	}
	cout<<ans<<endl;
	return 0;
}


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

#define ll long long

int main() {
  ll x;
  cin >> x;
  
  ll ans = (x/11) * 2;
  if (x % 11 == 0) {
  } else if (x % 11 <= 6) {
    ans += 1;
  } else {
    ans += 2;
  }
  
  cout << ans << endl;
}

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

#define _overload(_1, _2, _3, _4, name, ...) name
#define _rep1(Itr, N) _rep3(Itr, 0, N, 1)
#define _rep2(Itr, a, b) _rep3(Itr, a, b, 1)
#define _rep3(Itr, a, b, step) for (i64 (Itr) = a; (Itr) < b; (Itr) += step)
#define repeat(...) _overload(__VA_ARGS__, _rep3, _rep2, _rep1)(__VA_ARGS)

using namespace std;
using llong = long long;

int main() {
    char a, b;
    cin >> a >> b;

    if (a == b) cout << 'H' << endl;
    else cout << 'D' << endl;

    return 0;
};


Measured memory_bytes: 3388
n,k=map(int,input().split())
alist=[int(i) for i in input().split()]
blist=alist+alist
counta=0
countb=0
for i in range(n):
	for j in range(i+1,n):
		if alist[i] > alist[j]:
			counta+=1
for i in range(n):
	for j in range(n,n*2):
		if blist[i] > blist[j]:
			countb+=1
print((counta*k+(k*(k-1)//2)*countb)%(10**9+7))

Measured memory_bytes: 3188
#include <iostream>
using namespace std;
main() {

  int a, b;
  char op;
  
  while(1){

    cin >>a >>op >>b;

    
    if(op == '+'){
      cout <<a+b <<"\n";
      
    }else if(op == '-'){
      cout <<a-b <<"\n";
      
    }else if(op == '*'){
      cout <<a*b <<"\n"; 
      
    }else if(op == '/'){
      cout <<a/b <<"\n";
      
    }else{
      break;
    }

    
  }
  return 0;

}

Measured memory_bytes: 1160
//g++ -std=c++14 test.cpp -o test.out
//問題URL
//https://atcoder.jp/contests/abl/tasks/abl_d

//参考
//https://drken1215.hatenablog.com/entry/2020/09/27/080300

//ポイント：
//dpで、j~iの最大を求めたい！となったらセグ木を検討してみる
 
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <iomanip>
#include <vector>
#include <queue>
#include <stack>
#include <map> 
#include <unordered_map> 
#include <utility>
#include <limits.h>
#include <bitset>
#include <set>
using namespace std;
 
#define LL long long int
const LL INF = (1LL<<60);
const int INF_INT = 2147483647-1e6-1;
const LL mod = 1000000007ll;
const int mod_int = 1000000007;

//引用元：https://drken1215.hatenablog.com/entry/2020/09/27/080300
template<class Monoid> struct SegmentTree {
    using Func = function<Monoid(Monoid, Monoid)>;
    const Func F;
    const Monoid UNITY;
    int SIZE_R;
    vector<Monoid> dat;
    
    SegmentTree(int n, const Func f, const Monoid &unity): F(f), UNITY(unity) { init(n); }
    void init(int n) {
        SIZE_R = 1;
        while (SIZE_R < n) SIZE_R *= 2;
        dat.assign(SIZE_R * 2, UNITY);
    }
    
    /* set, a is 0-indexed */
    void set(int a, const Monoid &v) { dat[a + SIZE_R] = v; }
    void build() {
        for (int k = SIZE_R - 1; k > 0; --k)
            dat[k] = F(dat[k*2], dat[k*2+1]);
    }
    
    /* update a, a is 0-indexed */
    void update(int a, const Monoid &v) {
        //まず最下段の、元の配列に相当する箇所を更新
        int k = a + SIZE_R;
        dat[k] = v;
        //登りながら更新
        while (k >>= 1) dat[k] = F(dat[k*2], dat[k*2+1]);
    }
    
    /* query [a, b), a and b are 0-indexed */
    Monoid query(int a, int b) {
        Monoid vleft = UNITY, vright = UNITY;
        for (int left = a + SIZE_R, right = b + SIZE_R; left < right; left >>= 1, right >>= 1) {
            if (left & 1) vleft = F(vleft, dat[left++]);
            if (right & 1) vright = F(dat[--right], vright);
        }                                                                                                              
        return F(vleft, vright);
    }
    inline Monoid operator [] (int a) { return dat[a + SIZE_R]; }
    
    /* debug */
    void print() {
        for (int i = 0; i < SIZE_R; ++i) {
            cout << (*this)[i];
            if (i != SIZE_R-1) cout << ",";
        }
        cout << endl;
    }
};

LL N,K;
LL A[300000];

LL ans;

void solve(){
    //ラストがiで終わるような数列の最大の長さをdp[i]とする
    const LL MAX_A =　300000;
    auto func = [&](LL a,LL b) { return max(a,b); };
    SegmentTree<LL> st(MAX_A+1,func,0);
    for(int i=0;i<N;i++){
        LL left = max(0LL,A[i]-K);
        LL right = min(MAX_A,A[i]+K);
        LL cand = st.query(left,right+1);
        st.update(A[i],cand+1);
    }
    ans = st.query(1,MAX_A+1);
}
 
int main(){
	cin >> N >> K;
    for(int i=0;i<N;i++) cin >> A[i];
 
    solve();

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

Measured memory_bytes: 13412
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin>>n;
	int h[n+2000];
	long long cs[n+20];
	for(int i=1;i<=n;i++)
		cin>>h[i];
	cs[0]=0;
	cs[1]=0;
	cs[2]=abs(h[2]-h[1]);
	for(int i=3;i<=n;i++)
		cs[i]=min(cs[i-2]+abs(h[i]-h[i-2]),cs[i-1]+abs(h[i]-h[i-1]));
	cout<<cs[n];
	return 0;
}

Measured memory_bytes: 1408
n,k=map(int,input().split())
l=list(input())
a=[]
b=1
for i in range(len(l)-1):
    if l[i]==l[i+1]:
        b=b+1

    else:
        a.append(b)
        b=1

if l[n-2]==l[n-1]:
    a.append(b)
else:
    a.append(1)


if len(a)//2<k:
    print(n-1)

elif len(a)/2==k:
    print(sum(a)-len(a)+k*2-1)

else:
    print(sum(a)-len(a)+k*2)


Measured memory_bytes: 49392
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = a; i < b; i++)
#define Rep(i, a, b) for(int i = a; i <= b; i++)
#define repr(i, a, b) for(int i = a; i >= b; i--)
#define _GLIBCXX_DEBUG
#define Vl vector<ll>
#define Vs vector<string>
#define Vp vector<pair<ll, ll>>
#define ld long double
using ll = long long;
#define ALL(v) (v).begin(),(v).end()
#define endl "\n"
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define co(x) cout << x << endl
#define coel cout << endl
#define pb push_back
#define sz(v) ((ll)(v).size())
using namespace std;  
const double pi = acos(-1.0);
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;
#define pp pair<ll, pair<ll, ll>> 
#define fi first
#define se second

void print(Vl vec){
    rep(i, 0, sz(vec)){
        if(i) cout << " ";
        cout << vec[i];
    }
    coel;
}

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

// デバッグを消し忘れるな！！！

int main() {
    ll n; cin >> n;
    Vl cnt(n+1, 0);
    rep(i, 1, n){
        ll a; cin >> a;
        cnt[a]++;
    }
    Rep(i, 1, n) cout << cnt[i] << endl;

    return 0;
}


Measured memory_bytes: 4836
#include<bits/stdc++.h>
using namespace std;
typedef double db;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pw(x) (1ll << (x))
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define rep(i,l,r) for(int i=(l);i<(r);++i)
#define per(i,l,r) for(int i=(r)-1;i>=(l);--i)
#define dd(x) cout << #x << " = " << x << ", "
#define de(x) cout << #x << " = " << x << endl

//-----
const int N = 3e3 + 7, MOD = 1e9 + 7;
int add(int a, int b) { if ((a += b) >= MOD) a -= MOD; return a; }
int mul(int a, int b) { return ll(a) * b % MOD; }
int n, m, sum[N], l[N], r[N], dp[N][N], C[N][N];
int qry(int l, int r) { return sum[r] - sum[l - 1]; }
string s;
int main() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	rep(i, 0, N) C[i][0] = 1;
	rep(i, 1, N) rep(j, 1, i + 1) C[i][j] = add(C[i - 1][j - 1], C[i - 1][j]);
	//rep(i, 0, 10) rep(j,0 , i + 1) cout << C[i][j] << " \n"[j == i];
  cin >> n >> m >> s;
  int _m = 1;
  rep(i, 1, m + 1) {
  	cin >> l[_m] >> r[_m];
  	_m += r[_m] > r[_m - 1];
	}
	m = _m - 1;
  rep(i, 1, n + 1) sum[i] = sum[i - 1] + (s[i - 1] == '1');
  dp[1][qry(l[1], r[1])] = 1;
	rep(i, 1, m) {
		rep(j, 0, n + 1) if (dp[i][j]) {
			int &dij = dp[i][j];
			rep(k, max(0, j - l[i + 1] + l[i]), max(0, min(r[i] - l[i + 1] + 1, j)) + 1) {
				int &d = dp[i + 1][k + qry(max(r[i] + 1, l[i + 1]), r[i + 1])]; 
				d = add(d, mul(dij, C[min(r[i] + 1, l[i + 1]) - l[i]][j - k]));
			}
		}
	}
	int ans = 0;
	rep(i, 0, r[m] - l[m] + 2) ans = add(ans, mul(dp[m][i], C[r[m] - l[m] + 1][i]));
	cout << ans;
	return 0;
}

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

int main()
{
    int x, n;
    cin >> n >> x;
    int re = x > 0 ? 1 : 0;
    int a[n], b[n + 1];
    b[0] = 0;
    for(int i = 0; i < n; ++i)
        cin >> a[i];
    for(int i = 1; i <= n; ++i)
    {
        b[i] = b[i - 1] + a[i - 1];
        if(b[i] <= x)
            re++;
    }
    cout << re;
    return 0;
}


Measured memory_bytes: 256
import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools, random
from collections import deque
from heapq import heappush, heappop
sys.setrecursionlimit(10 ** 7)
ans = 0
tmp = 0
inf = 10 ** 20
INF = float("INF")
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]
ddn9 = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1), (0, 0)]
"""for dx, dy in dd:
        nx = j + dx; ny = i + dy
            if 0 <= nx < w and 0 <= ny < h:"""
def wi(): return list(map(int, sys.stdin.readline().split()))
def wip(): return [int(x) - 1 for x in sys.stdin.readline().split()]#WideIntPoint
def ws(): return sys.stdin.readline().split()
def i(): return int(sys.stdin.readline())
def s(): return input()
def hi(n): return [i() for _ in range(n)]
def hs(n): return [s() for _ in range(n)]#HeightString
def mi(n): return [wi() for _ in range(n)]#MatrixInt
def mip(n): return [wip() for _ in range(n)]
def ms(n): return [ws() for _ in range(n)]

h, w, n = wi()
c = mip(n)

d = collections.defaultdict(int)

for i in range(n):
    for dx, dy in ddn9:
        nx = c[i][1] + dx;
        ny = c[i][0] + dy
        if 0 < nx < w - 1 and 0 < ny < h - 1:
            d[str(ny) + "+" + str(nx)] += 1#前のままだと，28+1,2+81とかがが被る

ansli = [0] * 10
for i in d:
    ansli[d[i]] += 1

ansli[0] = (h - 2) * (w - 2) - sum(ansli)
for i in ansli:
    print(i)

Measured memory_bytes: 147396
// g++ -std=gnu++1y -O2 xxx.cpp

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

int main() {
    int N,A,B;cin>>N>>A>>B;
    string S;cin>>S;

    int pass=0;
    int foreign=0;
    rep(i,N) {
        if (S[i]=='a') {
            if (pass < A+B) {
                cout << "Yes" << endl;
                pass++;
            } else {
                cout << "No" << endl;
            }
        } else if (S[i]=='b') {
            if (pass < A+B && foreign < B) {
                cout << "Yes" << endl;
                pass++;
                foreign++;
            } else {
                cout << "No" << endl;
            }
        } else {
            cout << "No" << endl;
        }
    }

    return 0;
}

Measured memory_bytes: 896
#include<bits/stdc++.h>
#define ll long long
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define pb push_back
using namespace std;
int main()
{
 	ll r,d,x2,y;
 	cin>>r>>d>>x2;
 	y=x2;
 	rep(i,0,10)
 	{
 		y=r*y-d;
 		cout<<y<<endl;
	 }
	
	
	
	
	
 return 0;
}

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

using std::cin;
using std::cout;
using std::endl;
using std::pair;
using std::vector;

typedef pair<int, int> PII;

int main(void) {
    int n; // number of kukan
    int m; // money
    int answer;

    while (cin >> n >> m) {
        if (n == 0 && m == 0) {
            break;
        }
        answer = 0;
        vector<PII> road(n);
        for (int i = 0; i < n; i ++) {
            cin >> road[i].second >> road[i].first; 
        }
        sort(road.begin(), road.end(), std::greater<PII>());

        for (int i = 0; i < n; i ++) {
            if (m <= 0) {
                answer += road[i].first * road[i].second;
                continue; 
            } else if (m > 0) {
                m -= road[i].second;
                if (m <= 0) {
                    answer += -m * road[i].first;      
                }
            }
        }
        cout << answer << endl;
    }
    return 0;
}

Measured memory_bytes: 3088
import sys
from collections import deque
import copy

sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def solve(D, G, inputs):
    problems = list(map(string_to_int, inputs))
    binary_max = 2 ** len(problems)

    min_num = -1
    for pattern in range(0, binary_max):
        binary_pattern = bin(pattern)[2:]
        while len(binary_pattern) != D:
            binary_pattern = '0' + binary_pattern

        incompleted_problem = -1
        count_num = 0
        count_score = 0

        for i in reversed(range(len(binary_pattern))):
            if binary_pattern[i] == '1':
                count_num += problems[i][0]
                count_score += (100 * (i+1)) * problems[i][0] + problems[i][1]
            elif incompleted_problem == -1 and binary_pattern[i] == '0':
                incompleted_problem = i

        if incompleted_problem != -1:
            for _ in range(problems[incompleted_problem][0]):
                if count_score >= G:
                    break
                count_num += 1
                count_score += 100 * (incompleted_problem+1)
        if count_score >= G and (min_num == -1 or count_num < min_num):
            min_num = count_num
    return min_num


def string_to_int(string):
    return list(map(int, string.split()))


if __name__ == "__main__":
    [D, G] = string_to_int(input())
    ret = solve(D, G, inputs(D))
    print(ret)


Measured memory_bytes: 3564
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;

int n, hp, maxim, ans, sum;
int a[N], b[N];
bool con;

int up(int a, int b) {
    if(a % b == 0) return a / b;
    return a / b + 1;
}

bool cmp(int x, int y) {
    return x > y;
}

void solve() {
    cin >> n >> hp;
    maxim = ans = 0;
    for(int i = 1; i <= n; i++) {
        cin >> a[i] >> b[i];
        maxim = max(maxim, a[i]);
    }
    sum = 0;
    con = true;
    sort(b + 1, b + n + 1, cmp);
    for(int i = 1; i <= n; i++) {
        if(b[i] >= maxim) {
            hp -= b[i];
            sum += b[i];
            ans++;
            if(hp <= 0) {
                con = false;
                break;
            }
        }
    }
    if(con) ans += up(hp, maxim);
    cout << ans << "\n";
}

int main() {

    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);

    solve();

}

Measured memory_bytes: 4372
using System;
using System.Text;

namespace ALDS1_6_B
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            string[] num = Console.ReadLine().Split(' ');
            int[] list = new int[N];
            for (int i = 0; i < N; i++)
            {
                list[i] = int.Parse(num[i]);
            }

            int pos = partition(list, 0, N - 1);

            string output = ArrayJoin(list, pos);
            Console.WriteLine(output);

            while (true)
            {
                if (string.IsNullOrEmpty(Console.ReadLine())) break;
            }
        }

        public static int partition(int[] arr, int p, int r)
        {
            int x = arr[r];
            int i = p - 1;
            int tmp = 0;
            for (int j = p; j < r; j++)
            {
                if (arr[j] <= x)
                {
                    i++;
                    tmp = arr[i];
                    arr[i] = arr[j];
                    arr[j] = tmp;
                }
            }
            tmp = arr[i + 1];
            arr[i + 1] = arr[r];
            arr[r] = tmp;
            return i + 1;
        }

        public static void swap(int x, int y)
        {
            int tmp = x;
            x = y;
            y = tmp;
        }

        public static string ArrayJoin(int[] arr, int x)
        {
            StringBuilder sb = new StringBuilder();
            for (int i = 0; i < arr.Length; i++)
            {
                if (sb.Length > 0)
                {
                    sb.Append(" ");
                }
                if (i == x)
                {
                    sb.Append("[");
                    sb.Append(arr[i]);
                    sb.Append("]");
                } else
                {
                    sb.Append(arr[i]);
                }
            }
            return sb.ToString();
        }
    }
}

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

int main(){
    int a;
    cin>>a;
    if(a==25) cout<<"Christmas"<<endl;
    if(a==24) cout<<"Christmas Eve"<<endl;
    if(a==23) cout<<"Christmas Eve Eve"<<endl;
    if(a==22) cout<<"Christmas Eve Eve Eve"<<endl;

}


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

int main()
{
    ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int t=1;
//cin>>t;
while(t--){
int n,l;
cin>>n>>l;
int q=n*l+(n*n-n)/2;
int min1=100000,ans;
for(int i=0;i<n;i++){
   if(abs(l+i)<min1){
    min1=abs(l+i);
    ans=q-l-i;
   }
}
cout<<ans<<endl;
}}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long int
#define mod 1000000007
#define string_mod 2549536629329_base_255
#define pb push_back
#define F first
#define S second
#define endl "\n"
#define ss second
#define all(v) v.begin(), v.end()
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
int power(int x, unsigned int y, int p)
{
	int res = 1;
	x = x % p;
	while (y > 0)
	{
		if (y & 1)
			res = (res * x) % p;
		y = y >> 1;
		x = (x * x) % p;
	}
	return res % p;
}
int lcm(int a, int b)
{
	return a / __gcd(a, b) * b;
}
void solve()
{
	string s;
	cin >> s;
	if(s[s.size()-1]=='s'){
		s += "es";
	}
	else{
		s += "s";
	}
	cout << s << endl;
}
int32_t main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int tc;
	tc = 1;
	//cin >> tc;
	while (tc--)
	{
		solve();
	}

	return 0;
}

Measured memory_bytes: 3656
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvi vector<vector<int> >
#define vvl vector<vector<ll> >
#define vll vector<ll>
#define rep(c, a, b) for(ll c=a;c<b;c++)
#define re(c, b) for(ll c=0;c<b;c++)
#define all(obj) (obj).begin(), (obj).end()
typedef long long int ll;
typedef long double ld;
using namespace std;

int main(int argc, char const *argv[]) {
  ll P = 1000000007, n;std::cin >> n;
  vll sample, a(n), ans(200000, 1);
  rep(i, 1, 200000) ans[i] = (ans[i-1]*2)%P;
  for(int i=-(n-1);i<n;i+=2) sample.push_back(abs(i));
  re(i, n) std::cin >> a[i];
  sort(all(a));sort(all(sample));
  bool flag = true;
  re(i, n) if(a[i]!=sample[i]) flag = false;
  if(flag) std::cout << ans[n/2] << '\n';
  else std::cout << 0 << '\n';
  return 0;
}


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

int main()
{
    ll A, B, N;
    cin >> A >> B >> N;

    ll max = 0;
    /*
    for(ll i = N; i > 0; i--){
        if()
        ll tmp = floor((A * i)/B) - A*floor(i/B);
        if(tmp > max){
            max = tmp;
        }
    }
    */
    ll tmp = floor((A * N) / B) - A * floor(N / B);
    if (tmp > max)
    {
        max = tmp;
    }

    if (N >= (B - 1))
    {
        ll tmp2 = 0;
        tmp2 = floor((A * (B - 1)) / B) - A * floor((B - 1) / B);

        if (tmp2 > max)
        {
            max = tmp2;
        }
    }

    cout << max << endl;
    return 0;
}

Measured memory_bytes: 3620
n=int(input())
#約分
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    return divisors
import sys
sys.setrecursionlimit(10**7)
def func(N,d):
    if d==1:
        return False
    while N>1:
        if N%d==0:
            N//=d
        else:
            if (N-1)%d==0:
                N=1
            else:
                N=0
    return True if N==1 else False

ans=len(set(make_divisors(n-1)))-1
l=set(make_divisors(n))
for li in l:
    if func(n,li):
        ans+=1
print(ans)
#print(ans)


Measured memory_bytes: 3828
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Map;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String s = br.readLine();
		String str[] = s.split("");

		if (str[str.length - 1].equals("s")) {
			System.out.println(s + "es");
		} else {
			System.out.println(s + "s");
		}
	}
}


Measured memory_bytes: 36844
#include <bits/stdc++.h>
#define fi first
#define se second
using namespace std;
using ll = long long;

int constexpr N = 1005, W = 20005;
int n;
tuple<int, int, int> sw[N];
ll dp[W];
ll constexpr INF = numeric_limits<ll>::max() / 1000;

int main() {
    ios::sync_with_stdio(0); cin.tie(0);
    cin >> n;
    for(int i = 1; i <= n; ++i) {
        cin >> get<1>(sw[i]) >> get<0>(sw[i]) >> get<2>(sw[i]);
        get<0>(sw[i]) += get<1>(sw[i]); // s += w
    }
    sort(sw + 1, sw + n + 1);
    fill(dp, dp + W, -INF);
    dp[0] = 0;

    for(int i = 1; i <= n; ++i) {
        int s = get<0>(sw[i]);
        int w = get<1>(sw[i]);
        int v = get<2>(sw[i]);
        for(int j = W - 1; j >= 0; --j) {
            if(j + w < W && dp[j] + v > dp[j + w] && j + w <= s) {
                dp[j + w] = dp[j] + v;
            }
        }
    }
    cout << *max_element(dp, dp + W) << '\n';
}

Measured memory_bytes: 384
N=int(input())
AB_list=list()
for _ in range(N):
    AB_list.append(list(map(int,input().split())))
AB_list.sort(key=lambda x:x[1])
time=0
boolean=True
for l in AB_list:
    time+=l[0]
    if time>l[1]:
        print("No")
        boolean=False
        break
    else:
        continue
if boolean:
    print("Yes")

Measured memory_bytes: 53728
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
const int INF=1e9,MOD=1e9+7;
const ll LINF=1e18;
using namespace std;
#define int long long
//template
int d[1002][1002];
//main
signed main(){
  int H,W,A,B;cin>>H>>W>>A>>B;
  std::vector<string> s(H);
  for(int i=0;i<H;i++)cin>>s[i];
  int sx,sy,gx,gy;
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      if(s[i][j]=='s'){sx=j;sy=i;}
      if(s[i][j]=='g'){gx=j;gy=i;}
    }
  }
  typedef pair<int,int> P;
  for(int i=0;i<1002;i++)for(int j=0;j<1002;j++)d[i][j]=LINF;
  queue<P> que;
  int x[8]={1,-1,0,0,1,1,-1,-1};
  int y[8]={0,0,1,-1,1,-1,1,-1};
  que.push(P(sy,sx));
  d[sy][sx]=0;
  while(que.size()){
    P p=que.front();que.pop();
    int pf=p.first,ps=p.second;
    bool bom=false;
    for(int i=max(0LL,pf-1);i<=min(H-1,pf+1);i++){
      for(int j=max(0LL,ps-1);j<=min(W-1,ps+1);j++){
        if(s[i][j]=='*')bom=true;
      }
    }
    //x[i]とy[i]逆に使った気がするけど問題はないので無視
    if(bom){
      for(int i=0;i<4;i++){
        if(pf+x[i]<0||pf+x[i]>=H||ps+y[i]<0||ps+y[i]>=W)continue;
        if(s[pf+x[i]][ps+y[i]]!='#'&&d[pf+x[i]][ps+y[i]]>d[pf][ps]+A){
          d[pf+x[i]][ps+y[i]]=d[pf][ps]+A;
          que.push(P(pf+x[i],ps+y[i]));
        }
      }
    }
    else{
      for(int i=0;i<4;i++){
        if(pf+x[i]<0||pf+x[i]>=H||ps+y[i]<0||ps+y[i]>=W)continue;
        if(s[pf+x[i]][ps+y[i]]!='#'&&d[pf+x[i]][ps+y[i]]>d[pf][ps]+A){
          d[pf+x[i]][ps+y[i]]=d[pf][ps]+A;
          que.push(P(pf+x[i],ps+y[i]));
        }
      }
      for(int i=0;i<4;i++){
        if(pf+x[i]<0||pf+x[i]>=H||ps+y[i]<0||ps+y[i]>=W)continue;
        if(d[pf+x[i]][ps+y[i]]>d[pf][ps]+A+B){
          d[pf+x[i]][ps+y[i]]=d[pf][ps]+A+B;
          que.push(P(pf+x[i],ps+y[i]));
        }
      }
      for(int i=4;i<8;i++){
        if(pf+x[i]<0||pf+x[i]>=H||ps+y[i]<0||ps+y[i]>=W)continue;
        if(d[pf+x[i]][ps+y[i]]>d[pf][ps]+A+A+B){
          d[pf+x[i]][ps+y[i]]=d[pf][ps]+A+A+B;
          que.push(P(pf+x[i],ps+y[i]));
        }
      }
    }
  }
  if(d[gy][gx]>100000000000000000)cout<<"INF"<<endl;
  else cout<<d[gy][gx]<<endl;
}



Measured memory_bytes: 11996
#include <iostream>
#include <cstdio>
using namespace std;
int n, cnt[5];
int main(){
	scanf("%d", &n);
	int a;
	for(int i=1;i<=n;i++){
		scanf("%d", &a);
		if(a%4==0) cnt[4]++;
		else if(a%2==0) cnt[2]++;
		else cnt[1]++;
	}
	if(cnt[2]) cnt[1]++;
	if(cnt[1]>cnt[4]+1) puts("No");
	else puts("Yes");
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
    int n,i;
    int a[101],b[101];
    cin>>n;
    for(i=1;i<=n;i++){
        cin>>a[i]>>b[i];
    }
    for(i=1;i<=n-2;i++){
        if(a[i]==b[i] && a[i+1]==b[i+1] && a[i+2]==b[i+2]){
            cout<<"Yes"<<endl;
            break;
        }
    }
    if(i==n-1){
        cout<<"No"<<endl;
    }

    return 0;
}


Measured memory_bytes: 3136
import java.util.Scanner;

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

		int a = in.nextInt();
		int b = in.nextInt();
		int C = in.nextInt();

		double h = b * Math.sin(Math.toRadians(C));
		double S = a * h / 2.0;
		double L = a + b + Math.sqrt((a*a + b*b - 2*a*b*Math.cos(Math.toRadians(C))));

		System.out.println(S);
		System.out.println(L);
		System.out.println(h);
	}
}

Measured memory_bytes: 26140
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main(){
  int n;
  cin >> n;
  int ans=0;
  int k=n/500;
  int u=n%500;
  int y=u/5;
  cout << k*1000+y*5 << endl;
}


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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"
#define PI 3.14159265358979
#define MOD 1000000007 // = 10^9 + 7

using namespace std;
using ll = long long;

int n;
double dist[8][8];

double dfs(int visited, int now, double total_dist)
{
	if (visited == ((1 << n) - 1))
	{
		return total_dist;
	}

	double ret = 0.0;

	for(int i = 0; i < n; ++i)
	{
		if((visited & (1 << i)) == 0)
		{
			ret += dfs(visited | (1 << i), i, total_dist + dist[now][i]);
		}
	}

	return ret;
}

void solve()
{
	cin >> n;
	vector<int> x(n);
	vector<int> y(n);
	for(int i = 0; i < n; ++i)
	{
		cin >> x[i] >> y[i];
	}

	for(int i = 0; i < n; ++i)
	{
		for(int j = i; j < n; ++j)
		{
			dist[i][j] = dist[j][i] = sqrt(pow(x[i] - x[j], 2) + pow(y[i] - y[j], 2));
		}
	}

	double ans = 0.0;
	for(int i = 0; i < n; ++i)
	{
		ans += dfs(1 << i, i, 0);
	}
	double factor = 1.0;
	for(int i = 1; i <= n; ++i)
	{
		factor *= i;
	}

	printf("%.7f\n", ans / factor);


}

int main()
{
	fastio;
	solve();

	return 0;
}

Measured memory_bytes: 256
n = int(input())
sdic = {"AC":0,"WA":0,"TLE":0,"RE":0}
for i in range(n):
    s = input()
    sdic[s] += 1
ac = str(sdic["AC"])
print("AC x "+ac)
wa = str(sdic["WA"])
print("WA x "+wa)
tle = str(sdic["TLE"])
print("TLE x "+tle)
re = str(sdic["RE"])
print("RE x "+re)


Measured memory_bytes: 9232
#include <iostream>
#include <algorithm>
#include <vector>
#include <deque>
#include <queue>
#include <set>
#include <map>
#include <limits>
#include <cmath>
#include <iomanip>
#include <functional>
#include <random>
#include <boost/multiprecision/cpp_int.hpp>

using namespace std;
using ll = long long;
namespace mp = boost::multiprecision;

ll BASE_NUM = 1000000007;

ll ans(ll h){
    if(h == 1){
        return 1;
    }else{
        return 2 * ans(h/2) + 1;
    }
}

int main()
{
    // 整数の入力
    ll H;
    cin >> H;
    cout << ans(H) << endl;
    return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define int long long
#define endl '\n'
using namespace std;
 
typedef long long ll;
#define db(x) cerr << #x << ": " << x << '\n';
#define read(a) int a; cin >> a;
#define readb(a, b) int a, b; cin >> a >> b;
#define readc(a, b, c) int a, b, c; cin >> a >> b >> c;
#define readarr(a, n) int a[(n) + 1] = {}; FOR(i, 1, (n)) {cin >> a[i];}
#define readmat(a, n, m) int a[n + 1][m + 1] = {}; FOR(i, 1, n) {FOR(j, 1, m) cin >> a[i][j];}
 
#define print(a) cout << a << endl;
#define printarr(a, n) FOR (i, 1, n) cout << a[i] << " "; cout << endl;
#define printv(v) for (int i: v) cout << i << " "; cout << endl;
#define printmat(a, n, m) FOR (i, 1, n) {FOR (j, 1, m) cout << a[i][j] << " "; cout << endl;} cout << endl;
#define all(v) v.begin(), v.end()
#define sz(v) (int)(v.size())
#define rz(v, n) v.resize((n) + 1);
#define pb push_back
#define fi first
#define se second
#define vi vector <int>
#define pi pair <int, int>
#define vpi vector <pi>
#define vvi vector <vi>
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define FORD(i, a, b) for (int i = (a); i >= (b); i--)
const ll inf = 1e15;
const ll mod = 1e9 + 7;
const ll N = 2e5 + 1;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int n, m, s, t;
vpi adj1[N], adj2[N];
vi d1, d2, d(N, inf);

void input()
{
	cin >> n >> m >> s >> t;
	FOR (i, 1, m)
	{
		readb(x, y);
		readb(a, b);
		adj1[y].pb({x, a});
		adj1[x].pb({y, a});
		adj2[y].pb({x, b});
		adj2[x].pb({y, b});
	}
}

void dijkstra(int s, vector<int> & d, auto& adj) {
    d.assign(n + 1, inf);

    d[s] = 0;
    using pii = pair<int, int>;
    priority_queue<pii, vector<pii>, greater<pii>> q;
    q.push({0, s});
    while (!q.empty()) {
        int v = q.top().second;
        int d_v = q.top().first;
        q.pop();
        if (d_v != d[v])
            continue;

        for (auto edge : adj[v]) {
            int to = edge.first;
            int len = edge.second;

            if (d[v] + len < d[to]) {
                d[to] = d[v] + len;
                q.push({d[to], to});
            }
        }
    }
}

signed main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);	
	input();
	dijkstra(s, d1, adj1);
	dijkstra(t, d2, adj2);
	
	FORD (i, n, 1) d[i] = min(d[i + 1], d1[i] + d2[i]);
	FOR (i, 1, n) cout << inf - d[i] << endl;
}















Measured memory_bytes: 24648
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define Rep(i,s,n) for(int i=s;i<n;i++)
#define per(i,s,n) for(int i=n-1;i>=s;i--)
#define fi first
#define se second
#define all(c) c.begin(),c.end()
typedef long long int ll;
typedef pair<int, int> P;
typedef long double ld;
void Ans(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}

const ll INF=1001001001;
const ll mod=1000000007;

int main(){
  int x;
  cin>>x;
  cout<<abs(1-x)<<endl;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define _GLIBCXX_DEBUG
#define all(x) x.begin(), x.end()
using namespace std;
typedef long long ll;
typedef pair<int, int> pair;
const int inf = 1000000000; //10^9
const ll inff = 1000000000000000000; //10^18

int main(){
    int x;
    cin >> x;
    cout << x * x * x << endl;

    return 0;
}


Measured memory_bytes: 3080
//Nihal Mittal - nihal_47
//Strike First , Strike Hard , No Mercy !!

/**⠀⠀⠀⠀⠀⠀⣀⣤⣤⣄⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⣠⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⣀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⣰⣿⣿⣿⣿⠿⠿⣿⣿⣿⣿⣿⣿⣿⣧⢀⠀⠀⠀⠀
⠀⠀⠀⣿⣿⣿⠋⠀⠀⠀⠀⠀⠙⠀⠙⣿⣿⣿⣷⢳⢀⠀⠀⠀
⠀⠀⣠⣿⣿⣿⢸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⣿⣿⣿⢀
⠀⠀⣸⣿⣿⣿⠸⠀⠀⠀⠒⠒⠒⠐⠀⠀⢿⣿⣿⣿⣿⣿⠀⠀
⠀⣴⣿⣿⣿⡿⠀⠒⣋⣙⡒⢰⠀⠤⣖⠒⢾⣿⣿⣿⣿⣧⠀⠀
⢺⣿⣿⣿⣿⢀⠀⠀⠉⠉⠉⠸⠀⡇⠉⠉⠀⢿⣿⣿⣿⣄⠀⠀
⠀⠙⣿⣿⣧⢻⠀⠀⠀⠀⠀⠠⠀⠰⠀⠀⠀⣸⠸⣿⣿⠿⠰⠀
⠀⠀⠀⠹⣿⣿⣿⣷⠀⡠⠙⣲⣔⣅⢡⣰⣷⣿⣿⣿⣧⠀⠀⠀
⠀⠀⠀⣼⣿⣿⣿⣿⠀⡿⠭⠭⠭⠭⢿⠀⣿⢻⣿⣿⠃⠀⠀⠀
⠀⠀⠀⠙⠛⣿⢻⠹⣿⠐⠙⠛⠟⠉⢀⣴⡟⢿⣿⡏⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⡟⠀⠀⠻⣦⣤⣶⠾⠋⠀⠀⠁⡦⢄⢀⠀⠀⠀
⠀⠀⠀⠀⡠⠁⡇⠑⢄⠀⠀⠀⠀⠀⠀⠔⠀⠀⠁⠀⠀⠀⠉⠁
⠀⠔⠊⠁⠀⠀⣇⠀⠀⠀⠑⡤⠤⢎⠁⠀⠀⡘⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⢢⠠⠀⡠⢆⠀⠀⡠⠙⢄⠀⡸⠀
**/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define ld long double
#define mk make_pair
#define pb push_back
#define in insert
#define se second
#define fi first
#define mod 1000000007
#define watch(x) cout << (#x) << " is " << (x) << "\n"
#define all(v) (v).begin(),(v).end()
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(0);
#define pii pair<ll,ll>
#define vi(x) vector<x>
#define maxn 100005
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
using namespace std;
using namespace __gnu_pbds;

signed main()
{
    fast;
   
    string s;
    cin>>s;
    if( s[2]==s[3] and s[4]==s[5]) cout<<"Yes";
    else cout<<"No";
}

Measured memory_bytes: 256
n = input()
x0, y0, t0 = 0, 0, 0
result = True
for i in range(n):
    t, x, y = map(int, raw_input().split())
    left = t - t0 - abs(x - x0) - abs(y - y0)
    if left < 0 or left % 2 != 0:
        result = False

if result:
    print "Yes"
else:
    print "No"


Measured memory_bytes: 5764
#include <bits/stdc++.h> 
using namespace std;
typedef long long ll;
typedef pair<int,int> Pint;
typedef pair<ll, ll> P;
//typedef pair<int, pair<int, int>> P;
//typedef tuple<int,int,int> T;
ll INFL = 1000000000000000010;//10^18 = 2^60
int INF = 2147483600;//10^9
ll MOD  = 1000000007;
vector<int> dy = {0,0,1,-1};
vector<int> dx = {1,-1,0,0};

//コンビネーション
const int MAXcomb = 200010;
ll fac[MAXcomb], finv[MAXcomb], inv[MAXcomb];
//facはn!,finvは1/n!
//invは逆元
void COMinit(){
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for(int i = 2; i < MAXcomb; i++){
        fac[i] = fac[i-1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD/i) % MOD;
        finv[i] = finv[i-1] * inv[i] % MOD;
    }
}
ll comb(int n, int k){
    if(n < k) return 0;
    if(n < 0 || k < 0) return 0;
    return fac[n] * finv[k] % MOD * finv[n-k] % MOD;
}

ll N, M, K;
int main(void){
    COMinit();
    cin >> N >> M >> K;
    ll ans = 0;
    
    for(int d = 0; d < M; d++){
        ans += N * N % MOD * (M - d) % MOD * d % MOD;
        ans %= MOD;
    }
    for(int d = 0; d < N; d++){
        ans += M * M % MOD * (N - d) % MOD * d % MOD;
        ans %= MOD;
    }
    ans *= comb(N * M - 2, K - 2);
    ans %= MOD;
    cout << ans << endl;
}


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

int main()
{
    int a, b, c, d; cin >> a >> b >> c >> d;
    int dx = c-a, dy = d-b;
    cout << string(dy, 'U') << string(dx, 'R');
    cout << string(dy, 'D') << string(dx, 'L');
    cout << 'L' << string(dy+1, 'U') << string(dx+1, 'R') << 'D';
    cout << 'R' << string(dy+1, 'D') << string(dx+1, 'L') << 'U';
    cout << endl; 
    system("pause");
}


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

n =int(input())
edge = [[] for _ in range(n)]
for i in range(n-1):
    a, b, c = map(int, input().split())
    a, b = a-1, b-1
    edge[a].append((c, b))
    edge[b].append((c, a))

q, k = map(int, input().split())
k -= 1

import heapq
INF = 10**18
def dijkstra_heap(s, edge):
    d = [INF] * n
    used = [True] * n #True: not used
    d[s] = 0
    used[s] = False
    edgelist = []
    for e in edge[s]:
        heapq.heappush(edgelist,e)
    while len(edgelist):
        minedge = heapq.heappop(edgelist)
        if not used[minedge[1]]:
            continue
        v = minedge[1]
        d[v] = minedge[0]
        used[v] = False
        for e in edge[v]:
            if used[e[1]]:
                heapq.heappush(edgelist,(e[0]+d[v],e[1]))
    return d

d = dijkstra_heap(k, edge)
#print(d)

for i in range(q):
    x, y = map(int, input().split())
    x, y = x-1, y-1
    print(d[x]+d[y])


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

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<ll> vll;
// #define int long long
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000               // 2e9
#define LLINF 2000000000000000000ll  // 2e18 (llmax:9e18)
#define fi first
#define sec second
#define all(x) (x).begin(), (x).end()
#define sq(x) ((x) * (x))
#define dmp(x) cerr << #x << ": " << x << endl;

template <class T>
void chmin(T &a, const T &b) {
  if (a > b) a = b;
}
template <class T>
void chmax(T &a, const T &b) {
  if (a < b) a = b;
}

template <class T>
using MaxHeap = priority_queue<T>;
template <class T>
using MinHeap = priority_queue<T, vector<T>, greater<T>>;
template <class T>
vector<T> vect(int len, T elem) {
  return vector<T>(len, elem);
}

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << p.fi << ',' << p.sec;
  return os;
}
template <class T, class U>
istream &operator>>(istream &is, pair<T, U> &p) {
  is >> p.fi >> p.sec;
  return is;
}
template <class T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
  for (int i = 0; i < vec.size(); i++) {
    os << vec[i];
    if (i + 1 < vec.size()) os << ' ';
  }
  return os;
}
template <class T>
istream &operator>>(istream &is, vector<T> &vec) {
  for (int i = 0; i < vec.size(); i++) is >> vec[i];
  return is;
}
void fastio() {
  cin.tie(0);
  ios::sync_with_stdio(0);
  cout << fixed << setprecision(20);
}

#define endl "\n"

void solve() {
  int N, K;
  cin >> N >> K;
  vector<int> A(N);
  cin >> A;
  sort(all(A));
  vector<P> rz;
  for (int i = 0; i < A.size(); i++) {
    if (rz.empty() || rz.back().first != A[i]) {
      rz.push_back(P(A[i], 1));
    } else {
      rz.back().second++;
    }
  }
  vector<int> ns;
  for (int i = 0; i < rz.size(); i++) ns.push_back(rz[i].second);
  sort(all(ns));
  reverse(all(ns));
  int ans = N;
  for (int i = 0; i < min((int)ns.size(), K); i++) ans -= ns[i];
  cout << ans << endl;
  return;
}

signed main() {
  fastio();
  solve();
  // int t; cin >> t; while(t--)solve();
  return 0;
}


Measured memory_bytes: 4464
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#include <algorithm>
#include <queue>
using namespace std;
struct node
{
    int x,y;
    int bu;
};
int n,m;
char mp[55][55];
int vis[55][55];
int fx[4][2] = {1,0,0,1,-1,0,0,-1};
int bfs(int qx,int qy)
{
    memset(vis,0,sizeof(vis));
    vis[qx][qy] = 1;
    node kai,xia,xian;
    kai.x = qx;
    kai.y = qy;
    kai.bu = 1;
    queue<node>q;
    q.push(kai);
    while(!q.empty())
    {
        xian = q.front();
        q.pop();
        if(xian.x == (n-1)&&xian.y == (m-1))
            return xian.bu;
        for(int i=0; i<4; i++)
        {
            xia.x = xian.x + fx[i][0];
            xia.y = xian.y + fx[i][1];
            if(xia.x<0||xia.y<0||xia.x>=n||xia.y>=m||vis[xia.x][xia.y]||mp[xia.x][xia.y]=='#')
                continue;
            vis[xia.x][xia.y] = 1;
            xia.bu = xian.bu +1;
            q.push(xia);
        }
    }
    return -1;
}
int main()
{
    scanf("%d %d",&n,&m);
    int lz=0;
    for(int i=0; i<n; i++)
    {
        scanf("%s",mp[i]);
        for(int j=0; j<m; j++)
        {
            if(mp[i][j]=='.')
                lz++;
        }
    }
    int x = bfs(0,0);
    if(x==-1)
        puts("-1");
    else
    {
        printf("%d\n",lz-x);
    }

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int
#define fip ios_base::sync_with_stdio(false); cin.tie(NULL) 
#define reptArIn(i,a,b,ar) for( i=a; i<b; ++i) cin>>ar[i];
#define rept(i,a,b) for(i=a; i<b; ++i)
#define maX(a,b)    ( (a) > (b) ? (a) : (b))
#define miN(a,b)    ( (a) < (b) ? (a) : (b))
#define pb(a) push_back(a)
using namespace std;

int main()
{
    int n,k;
    cin>>n>>k;
    if(k!=1)
    cout<<(n-k);
else
    cout<<"0";


    return 0;

}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<unordered_map>
#include<unordered_set>
#include<time.h>
#include<random>
#include<array>
#include <regex>
#include <functional>
#include <algorithm>
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;

vector<int> R_table;
vector<int> G_table;
vector<int> B_table;
int n;
long long int answer = 0;
string s;

void count_left(char c1, vector<int> & v1, int key1, int key2) {
	auto it = lower_bound(v1.begin(), v1.end(), key2+1);
	int left_count = v1.end() - it;
	answer += left_count;
	if (key2 * 2 - key1 < n && s[key2 * 2 - key1] == c1) {
		answer--;
	}
}
int main(void) {
	
	cin >> n;
	cin >> s;
	for (int i = 0; i < n; i++) {
		if (s[i] == 'R') {
			R_table.push_back(i);
		}
		if (s[i] == 'G') {
			G_table.push_back(i);
		}
		if (s[i] == 'B') {
			B_table.push_back(i);
		}
	}

	for (int i = 0; i < n-2; i++) {
		for (int j = i + 1; j < n-1; j++) {
			if (s[i] == 'R') {
				if (s[j] == 'G') {
					count_left('B', B_table, i, j);
				}
				else if (s[j] == 'B') {
					count_left('G', G_table, i, j);
				}
			}
			else if (s[i] == 'G') {
				if (s[j] == 'R') {
					count_left('B', B_table, i, j);
				}
				else if (s[j] == 'B') {
					count_left('R', R_table, i, j);
				}
			}
			else if (s[i] == 'B') {
				if (s[j] == 'R') {
					count_left('G', G_table, i, j);
				}
				else if (s[j] == 'G') {
					count_left('R', R_table, i, j);
				}
			}
		}
	}
	cout << answer << endl;
	return 0;
}

Measured memory_bytes: 3616