akhauriyash/Code-Regression huggingface dataset:
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

// vectorの重複削除
// std::sort(test.begin(), test.end());
// test.erase(std::unique(test.begin(), test.end()), test.end());

using namespace std;
using ll = long long;
using P = pair<int, int>; // vector<P> ba(n); みたいな感じですぐ使える ba[i] = P(a, b); make_pairをしなくてもいい
// typedef vector<int> v;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v){o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}
#define debug(v) {cerr<<"\033[1;36m[debug]\033[m "<<#v<<" : "<<v<<endl;}
#define rep(i, c) for(int i = 0; i < int(c); i++)
#define ALL(x) (x).begin(), (x).end() //sort(ALL(obj))みたいな
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値
#define pb push_back //
// const int MOD = 1000000007;


int main() {
  int n,q,num;
  string s;
  cin >> n >> q >> s;
  std::vector<int> v(n, 0);
  rep(i,n-1) {
    if (s[i] == 'A' && s[i+1] == 'C') num = 1;
    else num = 0;
    v[i+1] = v[i] + num;
  }
  int l,r;
  rep(i,q) {
    cin >> l >> r;
    cout << v[r-1] - v[l-1] << endl;
  }
}


Measured memory_bytes: 1472
#include<string.h>
#include <iostream>
#include<cstdio>
#include <stack>
#include <vector>
using namespace std;
#define INF 0x7ffffff
typedef long long ll;
const int maxn=1e5+10;
int pre[maxn];
int dis[maxn];
int findset(int x)
{
    if(x==pre[x])   return x;
    int root=findset(pre[x]);
    dis[x]=dis[pre[x]]+dis[x];
    return pre[x]=root;
}
bool unionset(int x,int y,int w)
{
    int fx=findset(x),fy=findset(y);
    if(fx==fy)
        return w==dis[y]-dis[x];
    pre[fy]=fx;
    dis[fy]=dis[x]+w-dis[y];
    return true;
}
int n,m;       //input members
int main()    //main body
{
   scanf("%d%d",&n,&m);
   for(int i=1;i<=n;i++)
    pre[i]=i;
   bool lose=true;
   for(int i=0;i<m;i++)
   {
       int x,y,w;
   scanf("%d%d%d",&x,&y,&w);
        if(lose)
       lose=unionset(x,y,w);
   }
   if(lose) 
printf("Yes\n");     
   else     
printf("No\n");
}

Measured memory_bytes: 1024
def main():
    n,m = map(int,input().split())
    tf = [False]*n
    pnl = [0]*n
    for i in range(m):
        p,s = input().split()
        p = int(p)-1
        if tf[p] is False:
            if s == "WA":
                pnl[p] += 1
            else:
                tf[p] = True
    ac = sum(tf)
    wa_sum = 0
    for i,j in zip(pnl,tf):
        if j:
            wa_sum += i
    print(str(ac)+" "+str(wa_sum))
    
if __name__ == '__main__':
    main()

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

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

  int a, b;
  cin >> a >> b;
  for (int i = 1; i <= 3; i++)
    if (a != i && b != i)
      cout << i << endl;
}

Measured memory_bytes: 892
#include <bits/stdc++.h>
#define INF 5000000000000000000
#define ll long long
#define pll pair<ll, ll>
using namespace std;

int main()
{
  ll N, M;
  cin >> N >> M;
  vector<tuple<ll, ll, ll>> xyz(N);
  for (ll i = 0; i < N; ++i) {
    ll x, y, z;
    cin >> x >> y >> z;
    xyz.at(i) = make_tuple(x, y, z);
  }
  ll ans = 0;
  for (ll x_plus = 0; x_plus <= 1; ++x_plus) {
    for (ll y_plus = 0; y_plus <= 1; ++y_plus) {
      for (ll z_plus = 0; z_plus <= 1; ++z_plus) {
        vector<ll> point(N);
        for (ll i = 0; i < N; ++i) {
          ll temp = 0;
          if (x_plus == 1) {
            temp += get<0>(xyz.at(i));
          }
          else {
            temp -= get<0>(xyz.at(i));
          }
          if (y_plus == 1) {
            temp += get<1>(xyz.at(i));
          }
          else {
            temp -= get<1>(xyz.at(i));
          }
          if (z_plus == 1) {
            temp += get<2>(xyz.at(i));
          }
          else {
            temp -= get<2>(xyz.at(i));
          }
          point.at(i) = temp;
        }
        ll ans_temp = 0;
        sort(point.begin(), point.end());
        reverse(point.begin(), point.end());
        for (ll i = 0; i < M; ++i) {
          ans_temp += point.at(i);
        }
        ans = max(ans, ans_temp);
      }
    }
  }
  cout << ans << endl;
}


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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcount

#define INF INT_MAX/3
#define mod 1000000007

struct state{
  int S;
  int i,j;
  int d;
};

const int w=15;
const int h=19;
string s[22];
int idx[22][22];
int N=0;
int si,sj;
int dist[1<<21];

int di[]={-1,-1,-1,0,0,1,1,1};
int dj[]={-1,0,1,-1,1,-1,0,1};

int main(){
  rep(i,h)cin>>s[i];
  memset(idx,-1,sizeof(idx));
  rep(i,h)rep(j,w){
    if(s[i][j]=='X'){
      idx[i][j]=N++;
    }
    if(s[i][j]=='O'){
      si=i;sj=j;
    }
  }

  rep(i,1<<N)dist[i]=INF;
  queue<state> que;
  que.push((state){(1<<N)-1,si,sj,0});
  dist[(1<<N)-1]=0;
  while(que.size()){
    state cs=que.front(); que.pop();
    rep(dir,8){
      int ni=cs.i+di[dir],nj=cs.j+dj[dir];
      if(ni<0||ni>=h||nj<0||nj>=w)continue;
      if(idx[ni][nj]==-1||((cs.S>>idx[ni][nj])&1)==0)continue;
      vector<int> uidxs;
      while(ni>=0&&ni<h&&nj>=0&&nj<w&&idx[ni][nj]!=-1&&((cs.S>>idx[ni][nj])&1)){
        uidxs.push_back(idx[ni][nj]);
        ni+=di[dir];
        nj+=dj[dir];
      }
      if(ni==h||(ni==h-1&&nj>=0&&nj<w)){
        cout<<cs.d+1<<endl;
        return 0;
      }
      if(ni<0||nj<0||nj>=w)continue;
      int nxtS=cs.S;
      rep(i,uidxs.size())nxtS^=(1<<uidxs[i]);
      if(dist[nxtS]!=INF)continue;
      que.push((state){nxtS,ni,nj,cs.d+1});
      dist[nxtS]=cs.d+1;
    }
  }
  cout<<-1<<endl;
  return 0;
}




Measured memory_bytes: 7388
#include<iostream>
#include<algorithm>
#include<functional>
#include<cmath>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<deque>
using namespace std;
#define ll long long
const int mod = 1000000007;
const ll INF = 1000000000000000000;

int cnt[2][26];
int main()
{
	int N;
	string S;
	cin >> N >> S;
	int ans = 0;
	for (int i = 1; i < N - 1; i++) {
		for (int j = 0; j < 2; j++) {
			for (int k = 0; k < 26; k++) cnt[j][k] = 0;
		}
		for (int j = 0; j < i; j++) {
			cnt[0][S[j] - 'a']++;
		}
		for (int j = i; j < N; j++) {
			cnt[1][S[j] - 'a']++;
		}
		int c = 0;
		for (int j = 0; j < 26; j++) {
			if (cnt[0][j] != 0 && cnt[1][j]) c++;
		}
		ans = max(ans, c);
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <unordered_map>
#include <deque>
#include <list>
#include <set>
#include <random>
#include <deque>

using namespace std;
using ll = long long;
const int BIG = 100000007;


int main() {
    ll a,b,c;
    cin >> a >> b >> c;
    ll k;
    cin >> k;
    ll t = 0;
    while(a >= b){
        b *= 2;
        ++t;
    }
    while(b >= c){
        c *= 2;
        ++t;
    }
    cout << ((t <= k) ? "Yes" : "No") << endl;
}




Measured memory_bytes: 3104
G=[["#"]*100 for i in range(100)]
for i in range(50,100):
  for j in range(100):
    G[i][j]="."

A,B=map(int,input().split())   
A-=1
B-=1

i,j=0,0

while(A>0):
  G[i][j]="."
  A-=1
  j+=2
  if j>99:
    j=0
    i+=2
i,j=99,0
while(B>0):
  G[i][j]="#"
  B-=1
  j+=2
  if j>99:
    j=0
    i-=2
    
    
print(100,100)
for i in range(100):
  print("".join(G[i]))

Measured memory_bytes: 3188
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long ll;
int main(){
    int n;
    cin>>n;
    vector<ll> a(n+1),b(n);
    for(int i=0;i<n+1;i++) cin>>a[i];
    for(int i=0;i<n;i++) cin>>b[i];

    ll ans=0;
    for(int i=0;i<n;i++){
        //a[i]とb[i]の大小を比較
        //a[i]>=b[i]の時、敵が余る
        //ansにb[i]を加え、a[i]にa[i]-b[i]を代入
        //b[i]には0を代入
        //a[i]<b[i]の時、勇者が残る
        //ansにa[i]を加え、a[i]に0を代入
        //b[i]にb[i]-a[i]を代入
        //
        //b[i]>0の時、a[i+1]の場合を考える
        //a[i+1]>=b[i]の時、a[i+1]にa[i+1]-b[i]を代入
        //ansにはb[i]を加える
        //b[i]には0を代入
        //a[i+1]<b[i]の時、a[i+1]に0を代入
        //ansにはa[i+1]を加える
        //b[i]にb[i]-a[i+1]を代入
        //この一連の動作を繰り返す
        if(a[i]>=b[i]){
            ans+=b[i];
            a[i]=a[i]-b[i];
            b[i]=0;
        }else{
            ans+=a[i];
            b[i]=b[i]-a[i];
            a[i]=0;
        }

        if(b[i]>0){
            if(a[i+1]>=b[i]){
                ans+=b[i];
                a[i+1]=a[i+1]-b[i];
                b[i]=0;
            }else{
                ans+=a[i+1];
                b[i]=b[i]-a[i+1];
                a[i+1]=0;
            }
        }
/*
        for(int i=0;i<n+1;i++){
            cout << a[i];
            if(i!=n) cout <<" ";
            else cout << endl;
        }
        for(int i=0;i<n;i++){
            cout << b[i];
            if(i!=n-1) cout << " ";
            else cout << endl;
        }
*/
    }
    cout << ans << endl;
}


Measured memory_bytes: 1792
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long[] a = new long[n];
		for (int i = 0; i < a.length; i++) {
			a[i] = sc.nextLong();
		}
		Arrays.parallelSort(a);
		BigDecimal result = BigDecimal.ONE;
		for (int i = 0; i < a.length; i++) {
			if(a[i] == 0) {
				result = BigDecimal.ZERO;
				break;
			} else if(result.compareTo(BigDecimal.valueOf(-1)) == 0) {
				break;
			}
			result = result.multiply(BigDecimal.valueOf(a[i]));
			if(result.compareTo(BigDecimal.valueOf(1000000000000000000L)) > 0) {
				result = BigDecimal.valueOf(-1);
			}
		}
		System.out.println(result);
	}
}


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

#define INF (INT64_MAX)
#define MOD (1000000000+7)
#define MAX 100000

int main() {
	char c;

	cin >> c;

	if( c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u' ) {
		cout << "vowel" << endl;
	}
	else {
		cout << "consonant" << endl;
	}

	return 0;
}


Measured memory_bytes: 256
import sys
read=sys.stdin.buffer.readline

N,D=map(int,read().split())
X=[list(map(int,read().split())) for _ in range(N)]

ans=0
for i in range(N-1):
    for j in range(i+1,N):
        res=0
        for d in range(D):
            res+=abs(X[i][d]-X[j][d])**2
        res**=0.5
        if res%1==0:
            ans+=1
print(ans)
        

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

int main() {
  int n,t;
  string s, x;
  cin >> n;
  vector<string> vec_s(n);
  vector<int> vec_t(n);
  
  pair<string, int> p;
  for(int i = 0; i < n; i++){
    cin >> s >> t;
    vec_s.at(i) = s;
    vec_t.at(i) = t;
  }
  
  cin >> x;
  auto iter = find(vec_s.begin(), vec_s.end(), x);
  size_t index = distance(vec_s.begin(), iter);
  
  int st = (int) index + 1;
  int sum = 0;
  for(int i = st; i < n; i++ ){
    sum += vec_t.at(i);
  }
  cout << sum << endl;
}

Measured memory_bytes: 256
// I SELL YOU...! 
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<chrono>
#include<iomanip>
#include<map>
#include<set>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
void init_io(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(10);
}
signed main(){
  init_io();
  ll a[3][3],n,b;
  bool can = false;
  bool mark[3][3]={};
  for(int i=0;i<3;i++){
    for(int j=0;j<3;j++){
      cin >> a[i][j];
    }
  }
  cin >> n;
  for(int i=0;i<n;i++){
    cin >> b;
    for(int j=0;j<3;j++){
      for(int k=0;k<3;k++){
        if(a[j][k]==b){
          mark[j][k] = true;
        }
      }
    }
  }
  for(int i=0;i<3;i++){
    for(int j=0;j<3;j++){
    }
  }
  for(int i=0;i<3;i++){
    if(mark[i][0]&mark[i][1]&mark[i][2]) can = true;
    if(mark[0][i]&mark[1][i]&mark[2][i]) can = true;
  }
  if(mark[0][0]&mark[1][1]&mark[2][2]) can = true;
  if(mark[0][2]&mark[1][1]&mark[2][0]) can = true;
  if(can) cout <<"Yes\n";
  else cout <<"No\n";
}


Measured memory_bytes: 256
#include <sstream>
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <set>
#include <tuple>
#include <functional>
#include <map>
#include <unordered_map>
#include <queue>
#include <tuple>
#include <random>
#include <stack>

using namespace std;

#define endl '\n'

//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

using lld = long double;
using ull = unsigned long int;
using ll = long long;

void solve() {
  string s; cin >> s;
  int D; cin >> D;
  ll mod = 1e9 + 7;
  vector<vector<ll>> dp0(s.size() + 1, vector<ll>(D, 0));
  vector<vector<ll>> dp1(s.size() + 1, vector<ll>(D, 0));

  dp0[0][0] = 1;
  for (int i = 1; i <= (int) s.size(); ++i) {
    for (int v = 0; v < D; ++v) {
      dp1[i][v] = 0;
      int cur = s[i-1] - '0';
      int ss = (v - cur + 10 * D) % D;
      dp0[i][v] = dp0[i-1][ss];
      for (int d = 0; d < 10; ++d) {
        int sum = (v - d + 10 * D) % D;
        dp1[i][v] = (dp1[i][v] + dp1[i-1][sum]) % mod;
        if (d < cur) {
          dp1[i][v] = (dp1[i][v] + dp0[i-1][sum]) % mod;
        }
      }
    }
  }
  int n = s.size();
  cout << (dp1[n][0] + dp0[n][0] - 1 + mod) % mod << endl;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  const int precision = 13;
  cout.precision(precision);
  cout.setf(ios_base::fixed);

  solve();

  return 0;
}

Measured memory_bytes: 16640
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int k;
    cin>>k;
    int a,b;
    cin>>a>>b;
    bool flag=false;
    for(int i=a;i<=b;i++)
    {
        if(i%k==0)
        {
            flag=true;
            break;
        }
    }
    if(flag)
        cout<<"OK"<<endl;
    else
        cout<<"NG"<<endl;
}


Measured memory_bytes: 3644
#include<bits/stdc++.h>
using namespace std;
int main(){
	int h,w;
	string s;
	cin>>h>>w;
	for(int i=0;i<w;i++){
		cout<<"#";
	}
	cout<<"##";
	cout<<endl;
	for(int i=0;i<h;i++){
		cout<<"#";
		cin>>s;
		cout<<s;
		cout<<"#";
		cout<<endl;
	}
	for(int i=0;i<w;i++){
		cout<<"#";
	}
	cout<<"##";
	cout<<endl;
  return(0);
}

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

typedef long long int ll;
typedef unsigned long long int ull;
#define rep(i,n) for(auto i=0;i<(n);i++)
#define rep1(i,n) for(auto i=1;i<=(n);i++)
#define all(x) (x).begin(),(x).end()

using namespace std;


struct init{ init(){ cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20); }; }aaaaaaa;


int main(){
  ll n, k;
  cin >> n >> k;
  vector<ll> h(n);
  rep(i, n) cin >> h[i];


  ll cnt = 0;
  rep(i, n){
    if(k <= h[i]) cnt++;
  }
  cout << cnt << endl;


  return 0;
}


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

int main() {
	
	int n;
	cin >> n;
	vector<int> a(n);
	rep(i, n) cin >> a[i];
	sort(all(a));
	int mx = 0;
	rep(i, n){
		int cnt = upper_bound(all(a), a[i]+1) - lower_bound(all(a), a[i]-1);
		if(mx < cnt) mx = cnt;
	}
	cout << mx << endl;
	return 0;
}

Measured memory_bytes: 640
import heapq
import sys
input = sys.stdin.readline

def calc(front_sum, back_sum):
    heapq.heapify(a_front)
    heapq.heapify(a_back)
    front_sums = [front_sum]
    back_sums = [back_sum]
    for i in a_center:
        front_sum += i - heapq.heappushpop(a_front, i)
        front_sums += [front_sum]
    a_center.reverse()
    for i in a_center:
        back_sum += i + heapq.heappushpop(a_back, -i)
        back_sums += [back_sum]
    return max([front_sums[i] - back_sums[-i-1] for i in range(n+1)])



if __name__ == "__main__":
    n = int(input())
    a = [int(i) for i in input().split()]
    k = 0
    a_front = []
    a_center = []
    a_back = []
    front_sum = 0
    back_sum = 0

    for i in a:
        k += 1
        if k <= n:
            a_front += [i]
            front_sum += i
        elif k <= 2 * n:
            a_center += [i]
        else:
            a_back += [-i]
            back_sum += i

    print(calc(front_sum, back_sum))



Measured memory_bytes: 39516
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

#define int long long

#define override_rep(i, l, r, mes, ...) mes
#define rep1(i, n) for (int i = 0; i < n; i++)
#define rep2(i, l, r) for (int i = l; i < r; i++)
#define rep(...) override_rep(__VA_ARGS__, rep2, rep1)(__VA_ARGS__)

using namespace std;
using P = pair<int, int>;
using ll = long long;
using ld = double;

using bint = boost::multiprecision::cpp_int;

constexpr int MOD = 1e9 + 7;

template<typename T, typename U>
istream& operator>>(istream& in, pair<T, U>& p) {
    in >> p.first >> p.second;
    return in;
}

// https://twitter.com/vane11ope ←フォローしましょう
// (ノ)>◡<(ヾ)ﾓﾁﾓﾁ
signed main(signed argc, char* argv[]) {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);

    int x;
    cin>>x;
    cout<<!x<<endl;
}


Measured memory_bytes: 3648
# -*- encoding: UTF-8 -*-

n = int(input())

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

def isSecond(tgt, p1, p2) :
    if p1 > p2 :
        tmp = p1
        p1 = p2
        p2 = tmp
    if p2 > tgt and tgt > p1 :
        return True
    return False

count = 0
for i in range(1, n-1) :
    if isSecond(p[i], p[i-1], p[i+1]) :
        count = count + 1

print(count)

Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
		int a = scan.nextInt();
		int b = scan.nextInt();
		int c = scan.nextInt();

		if(a==7 && b==5 && c==5) {
			System.out.println("YES");
		}else if(a==5 && b==5 && c==7) {
			System.out.println("YES");
		}else if(a==5 && b==7 && c==5) {
			System.out.println("YES");
		}else {
		System.out.println("NO");
		}

	}

}


Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
const int N=5005;
int n,a[N],tmp[N];
vector<int> v;
int main()
{
    scanf("%d",&n);
    for(int i=1;i<=n;i++) scanf("%d",&a[i]);
    int ttt=n;
    while(ttt--)
    {
        int pos=-1;
        for(int i=n;i>=1;i--) if(i==a[i])
        {
            pos=i;
            break;
        }
        if(pos==-1)
        {
            puts("-1");
            return 0;
        }
        v.push_back(pos);
        int tot=0;
        for(int i=1;i<pos;i++) tmp[++tot]=a[i];
        for(int i=pos+1;i<=n;i++) tmp[++tot]=a[i];
        n=tot;
        for(int i=1;i<=n;i++) a[i]=tmp[i];
    }
    for(int i=(int)v.size()-1;i>=0;i--) printf("%d\n",v[i]);
    return 0;
}

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

const int N = (int)1e5 + 5;

int n,k,h[N],cnt;

int main(){
	cin >> n >> k;
	for(int i = 1; i <= n; i++){
		cin >> h[i];
		if(h[i] >= k) cnt++;
	}
	cout << cnt;
     return 0;
}

Measured memory_bytes: 640
s = input()
qq = int(input())
qs = []
flag = True
for i in range(qq):
    l = input().split()
    qs.append(l)
    if l[0] == "1":
        #print("pre")
        flag = not(flag)


from collections import deque

preflag = flag
res = ""
pre = deque([])
suf = deque([])
for i in range(qq-1, -1, -1):
    q = qs[i]
    if q[0] == "1":
        flag = not(flag)

    elif q[0] == "2":
        if q[1] == "1":
            if flag:
                pre.append(q[2])
            else:
                suf.appendleft(q[2])

        elif q[1] == "2":
            if flag:
                suf.appendleft(q[2])
            else:
                pre.append(q[2])

#print(pre)
#print(s)
#print(suf)
#print(preflag)
if preflag:
    print("".join(pre) + s + "".join(suf))
else:
    print("".join(suf)[::-1] + s[::-1] + "".join(pre)[::-1])

Measured memory_bytes: 113112
import java.util.Scanner;
class Main {
	int n,x,i,max = -1000000,min = 1000000;
	long kei;
	public void suzuki(){
		Scanner sc = new Scanner(System.in);
		n = sc.nextInt();
		if(n == 0){
			max = 0;
			min = 0;
			kei = 0;
		}else if(n == 1){
			x = sc.nextInt();
			max = x;
			min = x;
			kei = x;
		}else if(n >= 2){
			for(i = 0;i < n;i++){
				x = sc.nextInt();
				if(min > x){
					min = x;
				}else if(max < x){
					max = x;
				}
				kei = kei + x;
			}
		}
		System.out.println(min + " " + max + " " + kei);
	}
	public static void main(String[] args){
		new Main().suzuki();
	}
}

Measured memory_bytes: 31764
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define END getchar();getchar();return 0
#define rep(i,n) for(int i=0;i<n;i++)
#define inf 1000000007
typedef pair<int, int> P;

signed main() {
	int n, a[114514], cnt = 0;
	cin >> n;
	rep(i, n) {
		cin >> a[i];
		if (a[i] % 2 == 1) {
			cnt++;
		}
	}
	if (cnt % 2 == 0) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}

	END;
}

Measured memory_bytes: 1024
#include <cstdio>

int n,x,m;
int main(){

    scanf("%d%d", &n, &x);
    m=n*2-1;

    if(n==2){
        if(x==2)
            puts("Yes\n1\n2\n3");
        else
            puts("No");
        return 0;
    }

    if(x==1 || x==m){
        puts("No");
        return 0;
    }
    puts("Yes");
    if(x==2){
        int cnt=3;
        for(int i=0;i<n-2;++i){
            printf("%d\n", cnt++);
        }
        printf("%d\n%d\n%d\n%d\n", m, 2, 1, m-1);
        for(int i=0;i<n-3;++i){
            printf("%d\n", cnt++);
        }
    }else{
        int cnt=3;
        for(int i=0;i<n-2;++i){
            if(cnt==x) cnt++;
            printf("%d\n", cnt++);
        }
        printf("%d\n%d\n%d\n%d\n", 1, x, m, 2);
        for(int i=0;i<n-3;++i){
            if(cnt==x) cnt++;
            printf("%d\n", cnt++);
        }
    }
}


Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
constexpr ll mod=1e9+7;

int main()
{
  ll n,m;
  cin>>n>>m;
  set<int> broken;
  for (int i = 0; i < m; ++i)
  {
    int tmp;
    cin>>tmp;
    broken.insert(tmp);
  }
  vector<ll> pattern(n+1);
  pattern[0]=1;
  pattern[1]=
    (broken.find(1)!=broken.end())?
    0:1;
  for (int i = 2; i < pattern.size(); ++i)
  {
    if(broken.find(i)!=broken.end()) 
    {
      pattern[i]=0;
      continue;
    }
    pattern[i]=
    (pattern[i-1]+pattern[i-2])%mod;

  }
  cout<<pattern.back()<<endl;
}

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

ll H;


ll f( ll x ){
	if ( x == 1 )
		return 1;
	else
		return 1 + f(x/2)*2;
}

int main(){
	cin >> H;
	cout << f(H) << endl;
	return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
const int INF = (int)1e9 + 1;

const int nmax = 40, abmax = 10;

int a[nmax], b[nmax], c[nmax];
int dp[nmax + 1][nmax * abmax + 1][nmax * abmax + 1];

int main(void) {
	int n, ma, mb;
	cin >> n >> ma >> mb;
	for (int i = 0; i < n; i++) {
		cin >> a[i] >> b[i] >> c[i];
	}

	for (int i = 0; i <= n; i++) {
		for (int j = 0; j <= nmax * abmax; j++) {
			for (int k = 0; k <= nmax * abmax; k++) {
				dp[i][j][k] = INF;
			}
		}
	}
	dp[0][0][0] = 0;

	for (int i = 0; i < n; i++) {
		for (int ca = 0; ca <= nmax * abmax; ca++) {
			for (int cb = 0; cb <= nmax * abmax; cb++) {
				if (dp[i][ca][cb] == INF) continue;

				dp[i + 1][ca][cb] = min(dp[i + 1][ca][cb], dp[i][ca][cb]);
				dp[i + 1][ca + a[i]][cb + b[i]] = 
					min(dp[i + 1][ca + a[i]][cb + b[i]], dp[i][ca][cb] + c[i]);
			}
		}
	}

	int ans = INF;
	for (int ca = 1; ca <= nmax * abmax; ca++) {
		for (int cb = 1; cb <= nmax * abmax; cb++) {
			if (ca * mb == cb * ma) ans = min(ans, dp[n][ca][cb]);
		}
	}

	if (ans == INF) ans = -1;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 25984
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define pll pair<ll,ll>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))

using namespace std;

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;}

const ll INF=1e18;

int main()
{
    string s,t;
    cin >> s >> t;
    ll n=s.length();
    rep(i,n){
        bool ok=true;
        rep(j,n){
            if(s[(i+j)%n]!=t[j]) ok=false;
        }
        if(ok){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
} 

Measured memory_bytes: 256
/**
 * File    : C2.cpp
 * Author  : Kazune Takahashi
 * Created : 2018-8-12 14:17:31
 * Powered by Visual Studio Code
 */

#include <iostream>
#include <iomanip>   // << fixed << setprecision(xxx)
#include <algorithm> // do { } while ( next_permutation(A, A+xxx) ) ;
#include <vector>
#include <string> // to_string(nnn) // substr(m, n) // stoi(nnn)
#include <complex>
#include <tuple>
#include <queue>
#include <stack>
#include <map> // if (M.find(key) != M.end()) { }
#include <set>
#include <functional>
#include <random> // auto rd = bind(uniform_int_distribution<int>(0, 9), mt19937(19920725));
#include <chrono> // std::chrono::system_clock::time_point start_time, end_time;
// start = std::chrono::system_clock::now();
// double elapsed = std::chrono::duration_cast<std::chrono::milliseconds>(end_time-start_time).count();
#include <cctype>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
using namespace std;

#define DEBUG 0 // change 0 -> 1 if we need debug.

typedef long long ll;

// const int dx[4] = {1, 0, -1, 0};
// const int dy[4] = {0, 1, 0, -1};

// const int C = 1e6+10;
// const ll M = 1000000007;

int main()
{
  int N;
  cin >> N;
  string S = "";
  while (N != 0)
  {
    if (N % 2 == 0)
    {
      S = "0" + S;
      N = N / -2;
    }
    else
    {
      S = "1" + S;
      N = (N - 1) / -2;
    }
  }
  if (S == "")
  {
    S = "0";
  }
  cout << S << endl;
}

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

int main() {
  int P, Q, R;
  cin >> P >> Q >> R;
  int a, b, c;
  a = P + Q;
  b = Q + R;
  c = R + P;

  cout << min(a, min(b, c)) << endl;

  return 0;
}

Measured memory_bytes: 256
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
import heapq

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))

sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

sx, sy, tx, ty = MAP()

W = tx - sx
H = ty - sy

# first_cicle
A = "U" * H + "R" * W + "D" * H + "L" * W
B = "L" + "U" * (H + 1) + "R" * (W + 1) + "D" \
    + "R" + "D" * (H + 1) + "L" * (W + 1) + "U"
print(A+B)


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

using namespace std;


//repetition
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define euc_dis(x, y) sqrt(x*x + y*y)

#define pb push_back
#define mp make_pair
#define INF 999999999
#define MOD 1000000007
#define sp ' '
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()

//typedef
typedef long long ll;
typedef pair<int, int> pint;
typedef map<int, int> mint;
typedef vector<int> vint;
typedef vector<char> vch;
typedef vector<long long> vll;
typedef vector<string> vstr;


int mod(int a, int b){return (a%b+b)%b;}
int gcd(int a,int b){return b?gcd(b,a%b):a;}
void Yes(){cout << "Yes" << endl;}
void No(){cout << "No" << endl;}
void Judge(bool b){b?Yes():No();}
void YES(){cout << "YES" << endl;}
void NO(){cout << "NO" << endl;}
void JUDGE(bool b){b?YES():NO();}
ll powMod(ll a, ll b){ll ans=1; rep(i, b){ans=ans*a%MOD;} return ans;}

template<typename T>
void ppp(T n){cout << n << endl;}
template<typename T>
void dpp(T n){cerr << n << endl;}

const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int ddx[8] = {1,0,-1,0,1,-1,-1,1};
const int ddy[8] = {0,1,0,-1,1,1,-1,-1};




template < typename T > std::string to_string( const T& n )
{
    std::ostringstream stm ;
    stm << n ;
    return stm.str() ;
}


vector<string> split(const string &str, char sep)
{
    vector<string> v;
    stringstream ss(str);
    string buffer;
    while( getline(ss, buffer, sep) ) {
        v.pb(buffer);
    }
    return v;
}




int main(){

    cin.tie(0);
    ios::sync_with_stdio(false);

    int n;
    cin >> n;

    set<ll> num;
    ll cnt = 0;
    rep(i, n){
        ll tmp;
        cin >> tmp;
        if(!num.insert(tmp).second){
            cnt--;
            num.erase(tmp);
        }
        else{
            cnt++;
        }
    }

    ppp(cnt);









    return 0;
}


Measured memory_bytes: 4992
import java.util.Arrays;
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int num = sc.nextInt();
		String array[][] = new String[num][3];
		for(int i = 0; i < num; i ++) {
			array[i][0] = sc.next();
			array[i][1] = sc.next();
			array[i][2] = String.valueOf(i + 1);
		}
		Arrays.sort(array, (a, b) -> Integer.compare(Integer.parseInt(b[1]), Integer.parseInt(a[1])));
		Arrays.sort(array, (a, b) -> a[0].compareTo(b[0]));
		for(int i = 0; i < num; i ++) {
			System.out.println(array[i][2]);
		}
	}
}


Measured memory_bytes: 26448
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update

using namespace std;
using namespace __gnu_pbds;

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
ordered_set;	

#define FOR(i,a,b) for(int i = (a); i <= (b); ++i)
#define FORD(i,a,b) for(int i = (a); i >= (b); --i)
#define RI(i,n) FOR(i,1,(n))
#define REP(i,n) FOR(i,0,(n)-1)
#define mini(a,b) a=min(a,b)
#define maxi(a,b) a=max(a,b)
#define mp make_pair
#define pb push_back
#define st first
#define nd second
#define sz(w) (int) w.size()
typedef vector<int> vi;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<pii, int> para;
const ll inf = 1e18 + 7;
const ll maxN = 1e6 + 5;
const ll MOD = 1e9 + 7;

ll pow(ll a, ll b) {
	if (b == 0) return 1;
	ll d = pow(a, b / 2);
	ll z = 1;
	if (b % 2) z = a;
	return (((d * d) % MOD) * z) % MOD;
}

int n, p;
string s;
ll m[maxN];
vi m2, m1;

int main() {
	ios_base::sync_with_stdio(0);
	cin >> n >> p;
	cin >> s;
	if (p <= 5) {
		m2.resize(p);
		int ans = 0;
		ll cnt = 0;
		REP(i, n) {
			ans *= 10;
			ans += (s[i] - '0');
			ans %= p;
			m1.resize(p);
			REP(j, p) {
				m1[j * 10 % p] += m2[j];
			}
			swap(m2, m1);
			m1.clear();
			cnt += m2[ans];
			if (ans == 0) cnt++;
			m2[ans]++;
		}
		cout << cnt;
	} else {
		ll ans = 0;
		ll cnt = 0;
		ll pot = 1;
		FORD(i, n - 1, 0) {
			ans += (s[i] - '0') * pot;
			ans %= p;
			cnt += m[ans];
			if (ans == 0) cnt++;
			m[ans]++;
			pot *= 10;
			pot %= p;
		}
		cout << cnt;
	}
	return 0;
}


Measured memory_bytes: 720
s = gets.chomp!

i = 1
s.each_char do |c|
    if i % 2 == 1
        if c == "L"
            puts "No"
            exit
        end
    else
        if c == "R"
            puts "No"
            exit
        end
    end
    i += 1
end

puts "Yes"

Measured memory_bytes: 1788
#include <bits/stdc++.h>
#define rep(i,l,n) for(int i=l;i<n;i++)
#define all(a) a.begin(),a.end()
#define o(a) cout<<a<<endl
#define int long long
using namespace std;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;

signed main(){
	int n,x,y,b,p;
	cin>>n;
	rep(i,0,n){
		cin>>x>>y>>b>>p;
		int ans=0;
		if(b>=5 && p>=2) ans=(x*b+y*p)*8/10;
		else ans=min(x*b+y*p,(x*max((int)5,b)+y*max((int)2,p))*8/10);
		o(ans);
	}
}

Measured memory_bytes: 1156
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static void Main(string[] args)
    {
        var inputs = Console.ReadLine().Split(' ');

        var a = decimal.Parse(inputs[0]);
        var b = decimal.Parse(inputs[1]);

        var ans = a * b;
        Console.WriteLine(Math.Truncate((decimal)ans));

        Console.Read();
    }
}



Measured memory_bytes: 18048
n = int(input())
a = list(map(int, input().split()))

cnt = [0] * 10 ** 5
for v in a:
    cnt[v-1] += 1

res = [sum(a)]
q = int(input())
for _ in range(q):
    b, c = map(int, input().split())
    res.append(res[-1] + cnt[b-1] * (c - b))
    cnt[c-1] += cnt[b-1]
    cnt[b-1] = 0

for v in res[1:]:
    print(v)

Measured memory_bytes: 84496
#include "iostream"
#include "algorithm"
#include "vector"
#include "string"
// #include "cmath"
typedef long long ll;
using namespace std;


void search(int row, int col, int (&count_mat)[405][405],
  ll (&group_num1), ll (&group_num2), string S[405], ll HH, ll WW) {
  // group_num++;

  if (S[row][col] == '.') {
    group_num1++;
  }else{
    group_num2++;
  }
  count_mat[row][col] = 1;

  // std::cout << "row:"<<row<< " col:"<<col <<
  // " group_num1:"<<group_num1<<
  // " group_num2:"<<group_num2<<
  // '\n';

  if(col != WW-1) {if (S[row][col] != S[row][col+1] && count_mat[row][col+1]==0) {
    search(row, col+1, count_mat, group_num1, group_num2, S, HH, WW);
  }}

  if(row != HH-1) {if ( S[row][col] != S[row+1][col] && count_mat[row+1][col]==0) {
    search(row+1, col, count_mat, group_num1, group_num2, S, HH, WW);
  }}
  if(col != 0){if ( S[row][col] != S[row][col-1] && count_mat[row][col-1]==0) {
    search(row, col-1, count_mat, group_num1, group_num2, S, HH, WW);
  }}
  if(row != 0){if (S[row][col] != S[row-1][col] && count_mat[row-1][col]==0) {
    search(row-1, col, count_mat, group_num1, group_num2, S, HH, WW);
  }}
}

int main(int argc, char const *argv[]) {
  ll HH, WW;

  std::cin >> HH>>WW;

  string S[405];
  for (int i = 0; i < HH; i++) {
    std::cin >> S[i];
  }

  // for (int i = 0; i < HH; i++) {
  //   std::cout << S[i] << '\n';
  // }

  int count_mat[405][405];

  for (int i = 0; i < 405; i++) {
    for (int j = 0; j < 405; j++) {
      count_mat[i][j] = 0;
    }
  }

  ll group_count = 0;
  ll group_nums[170000];

  for (int i = 0; i < 170000; i++) {
    group_nums[i] = 0;
  }

  ll ans2 = 0;

  for (int row = 0; row < HH; row++) {
    for (int col = 0; col < WW; col++) {
      if (count_mat[row][col] == 0) {
        ll group_num1 = 0, group_num2 = 0;
        search(row, col, count_mat, group_num1,group_num2, S, HH, WW);

        group_nums[group_count] = group_num1 * group_num2;
        group_count++;
        ans2 += group_num1 * group_num2;
      }
    }
  }

  // for (int i = 0; i < group_count; i++) {
  //   std::cout << group_nums[i] << '\n';
  // }

  // for (int i = 0; i < HH; i++) {
  //   for (int j = 0; j < WW; j++) {
  //     std::cout << count_mat[i][j] << ' ';
  //   }
  //   std::cout  << '\n';
  // }

  ll ans = 0;
  for (int i = 0; i < group_count; i++) {
    ans+= group_nums[i];
  }
  std::cout << ans2 << '\n';

  return 0;
}


Measured memory_bytes: 25984
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
#include <iomanip>
#include <bitset>
#include <cassert>
using namespace std;

typedef long long ll;

int main() {
	int a, b, c; cin >> a >> b >> c;
	cout << min(c, b / a) << endl;
	return 0;
}


Measured memory_bytes: 256
fn interval(w: &[usize], m: usize) -> (usize, usize) {
    let (x, y) = (w[0], w[1]);
    if x <= y {
        (x, y)
    } else {
        (x, y + m)
    }
}

fn main() {
    let (_, m): (i32, usize) = readln();
    let a: Vec<usize> = readln::<Vec<usize>>().iter().map(|x| x-1).collect();
    let mut cost: Vec<i64> = vec![0; m*2 + 2];
    let mut num: Vec<i64> = vec![0; m*2 + 2];
    let mut all_cost: i64 = 0;

    for (u, v) in a.windows(2).map(|w| interval(w, m)).filter(|&(u, v)| u != v) {
        let d = (v - u) as i64;
        all_cost += d;
        num[u+1] += 1;
        num[v+1] -= 1;
    }

    let num_sum: Vec<i64> = num.iter()
        .scan(0, |s, &x| { *s = *s + x; Some(*s) })
        .collect();

    let mut cost_diff = num_sum.clone();

    for (u, v) in a.windows(2).map(|w| interval(w, m)).filter(|&(u, v)| u != v) {
        let d = (v - u) as i64;
        cost_diff[v+1] -= d;
    }

    let cost_sum: Vec<i64> = cost_diff.iter()
        .scan(0, |s, &x| { *s = *s + x; Some(*s) })
        .collect();

    let ans = all_cost - (0..m).map(|i| {
        cost_sum[i] + cost_sum[i+m] - num_sum[i] - num_sum[i+m]
    }).max().unwrap();

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

// --- template ---
#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::HashMap;

pub trait FromLn {
    fn fromln(s: &str) -> Self;
}
pub fn readln<T: FromLn>() -> T {
    let mut buf = String::new();
    let _ = ::std::io::stdin().read_line(&mut buf).unwrap();
    T::fromln(buf.trim())
}
pub fn readlns<T: FromLn>(n: usize) -> Vec<T> {
    let mut vs = vec![];
    for _ in 0..n { vs.push(readln()); }
    vs
}
macro_rules! fromln_primitives {
    ($($t:ty),*) => { $(
        impl FromLn for $t {
            fn fromln(s: &str) -> $t {
                s.parse().unwrap()
            }
        }
    )* }
}
fromln_primitives!(String, bool, f32, f64, isize, i8, i16, i32, i64, usize, u8, u16, u32, u64);
impl<T> FromLn for Vec<T> where T: FromLn {
    fn fromln(s: &str) -> Vec<T> {
        s.split_whitespace().map(T::fromln).collect()
    }
}
impl FromLn for Vec<char> {
    fn fromln(s: &str) -> Vec<char> {
        s.chars().collect()
    }
}
macro_rules! fromln_tuple {
    ($($t:ident),*) => {
        impl<$($t),*> FromLn for ($($t),*) where $($t: FromLn),* {
            fn fromln(s: &str) -> ($($t),*) {
                let mut it = s.split_whitespace();
                let t = ($($t::fromln(it.next().unwrap())),*);
                assert_eq!(it.next(), None);
                t
            }
        }
    }
}
fromln_tuple!(A, B);
fromln_tuple!(A, B, C);
fromln_tuple!(A, B, C, D);
fromln_tuple!(A, B, C, D, E);
fromln_tuple!(A, B, C, D, E, F);

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

#define rep(i, N) for (int i = 0; i < (N); i++)
#define all(a) (a).begin(), (a).end()
#define pb push_back

using ll = long long;
using i_i = tuple<int, int>;

int main() {
    int N; cin >> N;
    string s; cin >> s;
    int r = 0, b = 0;
    rep(i, N) if (s[i] == 'R') r++; else b++;
    if (r > b) cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
    int A, B; cin >> A >> B;
 int ans = 0;
 int o = 1;
 while (o < B) {
 o--;
 o += A;
 ans++;
 }
cout << ans;
    return 0;

}


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

using namespace std;

#define inf 1<<30
#define llong long long
#define usd unsigned
#define pqueue priority_queue
#define mp make_pair
#define pb push_back
#define fn fill_n
typedef pair<int, int> P;
typedef struct data{
	int place;
	int cost;

	bool operator<(const data &ri) const{
		return cost < ri.cost;
	}
	bool operator>(const data &ri) const{
		return cost > ri.cost;
	}
}data;
int nw[9] = {0, 1, 0, -1, -1, 1, 1, -1, 0};
int nh[9] = {1, 0, -1, 0, 1, 1, -1, -1, 0};



int main(){
	int a, b, k;
	cin >> a >> b >> k;
	for(int i = 0; i < k; i++){
		if(i%2){
			if(b%2) b--;
			b /= 2;
			a += b;
		}else{
			if(a%2) a--;
			a /= 2;
			b += a;
		}
	}

	cout << a << " " << b << endl;

	return 0;
}

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

#include <iostream>
#define pb push_back
#define sort_incr(v) sort(v.begin(),v.end());
#define sort_decr(v) {sort(v.begin(),v.end()); reverse(v.begin(),v.end());}
#define take_input(v,n) for(ll i=0,temp;i<n;i++){cin>>temp;v.pb(temp);}
#define fastio {ios_base::sync_with_stdio(false);    cin.tie(NULL);}
#define ALL(v) v.begin(),v.end()

typedef long long ll;
using namespace std; 

int main() 
{
    fastio;
    ll n;
    cin>>n;
    ll va=0;
    ll vaaa[200005];
    for(ll i=0;i<n;i++)
    {
        cin>>vaaa[i];
        va=va^vaaa[i];
    }
    for(ll i=0;i<n;i++)
    {
        cout<<(va^vaaa[i])<<" ";
    }
    
    return 0; 
} 

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

#define DUMP(x) cerr << #x << "=" << x << endl
#define DUMP2(x, y) cerr<<"("<<#x<<", "<<#y<<") = ("<<x<<", "<<y<<")"<< endl
#define BINARY(x) static_cast<bitset<16> >(x)

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,m,n) for (int i=m;i<(int)(n);i++)

#define in_range(x, y, w, h) (0<=(int)(x) && (int)(x)<(int)(w) && 0<=(int)(y) && (int)(y)<(int)(h))
#define ALL(a) (a).begin(),(a).end()

typedef long long ll;
const int INF   = 1e9;
const ll  INFLL = 1e18;
typedef pair<int, int> PII;
int dx[4]={0, -1, 1, 0}, dy[4]={-1, 0, 0, 1};

ll N, A, B, diff;
vector<ll> H;

bool check(int k)
{
    ll all = k * B;
    ll add = 0;

    for (auto h : H) {
        h -= all;
        if (h <= 0) continue;
        add += (diff + h - 1) / diff;
    }

    return add <= k;
}

int main()
{
    ios::sync_with_stdio(false);

    cin >> N >> A >> B;
    diff = A - B;

    H.resize(N);
    rep(i, N) cin >> H[i];

    ll ok = 1e9, ng = 0;
    while (ok - ng > 1) {
        ll mid = (ok + ng) / 2;
        (check(mid) ? ok : ng) = mid;
    }

    cout << ok << endl;
}

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

using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;

#define fi first
#define se second

const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll MOD3 = 1812447359;
const ll INF = 1ll << 62;
const double PI = 2 * asin(1);

void yes() {printf("yes\n");}
void no() {printf("no\n");}
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

int N;
ll H[int(1e5+5)], DP[int(1e5+5)];

int main(){
  cin >> N;
  for (int i = 0; i < N; i++) cin >> H[i];
  fill(DP, DP + N, 1e18);
  DP[0] = 0;
  for (int i = 0; i < N; i++){
    DP[i+1] = min(DP[i+1], DP[i] + abs(H[i] - H[i+1]));
    DP[i+2] = min(DP[i+2], DP[i] + abs(H[i]-H[i+2]));
  }
  cout << DP[N-1] << endl;

  return 0;
}


Measured memory_bytes: 5164
#include <stdio.h>
using namespace std;

int main()
{
  while (1)
  {
    int h, w;
    scanf("%d %d", &h, &w);
    if (h == 0 && w == 0)
      break;
    for (int i = 0; i < h; i++)
    {
      for (int j = 0; j < w; j++)
      {
        if ((i % 2 == 0 && j % 2 ==0) || (i % 2 != 0 && j % 2 != 0))
        {
          printf("#");
        }
        else
        {
          printf(".");
        }
      }
      printf("\n");
    }
    printf("\n");
  }
  return 0;
}


Measured memory_bytes: 2612
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MM = 1000000000;
const int MOD = MM + 7;
const int MAX = 510000;
#define rep(i, n) for(ll i=0; i<n; i++)
#define Rep(i, j, n) for(ll i=j; i<n; i++)
#define all(vec) vec.begin(), vec.end()
template<class T> inline bool chmin(T& a, T b) {if(a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) {if(a < b) {a = b; return true;} return false;}
const ll INF = 1LL << 60;


int main() {
    string s; cin >> s;
    int n = s.size();
    vector<int> cnt(2019);
    ll num = 0;
    ll dig = 1;
    cnt[0]++;
    rep(i, n) {
        num += dig * (s[n-i-1] - '0');
        num %= 2019;
        cnt[num]++;
        dig = dig * 10 % 2019;
    }
    ll ans = 0;
    rep(i, 2019) ans += cnt[i] * (cnt[i] - 1) / 2;
    cout << ans << endl;
}


Measured memory_bytes: 3712
# 10 -> [2,3,5,7]
def make_prime_list(k):
    p = [True] * (k+1)
    p[0] = False
    p[1] = False
    for i in range(2, k+1):
        if p[i]:
            for j in range(i*2, k+1, i):
                p[j] = False
    return [i for i in range(k + 1) if p[i]]


# 6 -> [[2,1],[3,1],[6,1]]
def get_prime_fact_dict(num):
    ps = make_prime_list(num//2)
    i = num
    prime_and_count = []

    for p in ps:
        count = 0
        while i % p == 0:
            i //= p
            count += 1
        if count > 0:
            prime_and_count.append([p, count])

    prime_and_count.append([num, 1])

    return prime_and_count


def solve(n):
    div_fact_count = [0] * (n+1)

    for i in range(2, n+1):
        xss = get_prime_fact_dict(i)
        for k, v in xss:
            div_fact_count[k] += v

    a = len([i for i in div_fact_count if i >= 74])
    b = len([i for i in div_fact_count if i >= 24])
    c = len([i for i in div_fact_count if i >= 14])
    d = len([i for i in div_fact_count if i >= 4])
    e = len([i for i in div_fact_count if i >= 2])

    # p**74
    c1 = a
    # p**24 * q**3
    c2 = b*(e-1)
    # p**14 ** q**4
    c3 = c * (d-1)
    # p**4 * q**4 * r*2
    # p and q are calculated as duplicated.
    c4 = (d * (d-1) * (e-2))//2

    return c1+c2+c3+c4


if __name__ == '__main__':
    n = int(input())
    print(solve(n))


Measured memory_bytes: 3188
eval"N,*A="+`dd`.split*?,;p N*2-1;b,a=A.minmax;c=A.index a;d=A.index b;S=?\n;N.times{|i|puts a>-b ?[[c+1,i+1]*S,[i,i+1]*S*-2[i]]:[[d+1,j=N-i]*S,[j+1,j]*S*-2[i]]}

Measured memory_bytes: 5876
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define rrep(i,n) for (int i = n-1; i >= 0; i--)
#define rep2(i,s,n) for (int i = s; i < n; ++i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define tmax(a,b,c) max(a,max(b,c))
#define tmin(a,b,c) min(a,min(b,c))
#define pb push_back
#define eb emplace_back
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vs vector<string>
#define vc vector<char>
#define vb vector<bool>
#define vp vector<P>
using namespace std;
using ll = long long;
using P = pair<int,int>;
using LP = pair<ll,ll>;
template<class T> istream& operator>>(istream& is,vector<T>& v) { for(T& t:v){is>>t;} return is; }
template<class T> ostream& operator<<(ostream& os,const vector<T>& v) { for(T t:v){os<<t<<" ";} os<<"\n"; return os; }
void Yes(bool b) { cout << (b ? "Yes" : "No") << endl; }
void YES(bool b) { cout << (b ? "YES" : "NO") << endl; }
template<class T> inline bool chmin(T& a,T b) {if(a > b){a = b; return true;} return false;}
template<class T> inline bool chmax(T& a,T b) {if(a < b){a = b; return true;} return false;}
const int inf = 1001001001;
const ll linf = 1001001001001001001;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);
    int n;
    cin >> n;
    int ind = 1;
    while(ind*(ind+1)/2 < n) ind++;
    rrep(i,ind) {
        if(n >= i+1) {
            cout << i+1 << endl;
            n -= i+1;
        }
    }
}


Measured memory_bytes: 256
import math
k = int(input())
gcd_sum_dic = {}
for i in range(1, k+1):
    gcd_sum_dic[i] = 0
    for j in range(1, k+1):
        gcd_sum_dic[i] += math.gcd(i, j)
ans = 0
for i in range(1, k+1):
    for j in range(1, k+1):
        ans += gcd_sum_dic[math.gcd(i, j)]
print(ans)


Measured memory_bytes: 65620
D = int(input())
C = list(map(int, input().split()))
S = [list(map(int, input().split())) for _ in range(D)]

manzoku = 0
last = [-1]*26


def teika(day):
    n = 0
    for i in range(26):
        n += C[i]*(day-last[i])
    return n

def check(day):
    contest_no = 0
    x = S[day][0] + C[0]*(day-last[0])
    
    for i in range(1, 26):
        y = S[day][i] + C[i]*(last[i]-day)
        if y > x:
            contest_no = i
    return contest_no

for day in range(D):
    n = check(day)
    print(n+1)
    last[n] = day
    manzoku += S[day][n]
    manzoku -= teika(day)
    

Measured memory_bytes: 9392