akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include <cstring>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;
const int MAX_C = 2010;
long long Com[MAX_C][MAX_C] = {0};


void calc_com() {
  Com[0][0] = 1;
    for (int i = 1; i < MAX_C; ++i) {
        Com[i][0] = 1;
        for (int j = 1; j < MAX_C; ++j) {
            Com[i][j] = (Com[i-1][j-1] + Com[i-1][j]) % mod;
        }
    }
}
int main(){
  int N, K;
  cin >> N >> K;
  ll ans[K];
  calc_com();
  rep(i, K){
    ans[i] = (Com[N-K+1][i+1]*Com[K-1][i])%mod;
    cout << ans[i] << endl;
  }
}

Measured memory_bytes: 31744
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cstring>
#include <map>
#include <queue>
#include <cmath>
#include <complex> // complex<double> a(1.2 , 2.3);// real(): 1.2, imag()2.3
using namespace std;

#define MOD 1000000007
#define EPS 1e-10
#define ll long long
#define ld long double
#define FOR(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rmsame(a) sort(all(a)),a.erase(unique(all(a)), a.end())
#define rmvector(a,b) rep(i,a.size())rep(j,b.size())if(a[i]==b[j]){a.erase(a.begin()+i);i--;break;}
#define first_more_idx(ve, num) upper_bound(all(ve), num)-ve.begin() // idx = first_more_idx(ve,num); if(idx = ve.size()) , then not exist
#define first_lessequal_idx(ve, num) lower_bound(all(ve), num)-ve.begin()
#define pq_pair_tB priority_queue <pair<ll,ll>, vector<pair<ll,ll> > , greater<pair<ll,ll> > >
#define pq_pair_ts priority_queue <pair<ll,ll> > // only sort first param
template<typename X> bool exist(vector<X> vec, X item){return find(all(vec), item)!=vec.end();}
ll gcd(ll a, ll b){if(b==0)return a;return gcd(b,a%b);}
ll lcm(ll a, ll b){return a/gcd(a,b)*b;}
ll power(ll x, ll n){if(n == 0) return 1;return  (n%2)? x*power(x, n-1)%MOD : power(x*x%MOD, n/2);}
ll dx[]={0, 0, -1, 1};
ll dy[]={1, -1, 0, 0};// up,down,left right


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

    ll N , X, Y;
    cin >> N >> X >> Y;
    
    vector<ll> ans(N, 0);
    
    for(ll i = 1; i <= N; i++){
        for(ll j = i+1; j <= N; j++){
            if((i <= X and j <= X)or
               (i >= Y and j >= Y)
               ){
                ans[j - i] ++;
            }else if(X <= i and i <= Y and X<= j and j <= Y){
                ans[min( j - i, (i - X) + 1LL + (Y - j))] ++;
            }else if(i <= X and Y<= j){
                ans[(j - Y) + 1LL + (X-i)]++;
            }else if(i <= X and X <= j and j <= Y){
                ans[(X-i) + min(1LL + Y - j, j - X)] ++;
            }else{
                ans[min(Y-i, i - X + 1LL) + (j - Y)] ++;
            }
        }
    }
    
    rep(i, ans.size() - 1){
        cout << ans[i + 1] << endl;
    }
    //cout << fixed << setprecision(16) << ans << endl;
    return 0;
}


Measured memory_bytes: 256
using System;

namespace Project
{
	class MainClass
	{
		public static void Main(string[] args)
		{
			while (true)
			{
				string s = Console.ReadLine();
				string[] sar = s.Split(' ');
				int H = int.Parse(sar[0]);
				int W = int.Parse(sar[1]);
				if (H == 0 && W == 0) { break;}

				char[,] c = new char[H, W];
				for (int i = 0; i < H; i++)
				{
					for (int j = 0; j < W; j++)
					{
						if ((i + j) % 2 == 0) { c[i, j] = '#'; }
						else { c[i, j] = '.';}
						Console.Write(c[i,j]);
					}
					Console.Write("\n");
				}
				Console.Write("\n");
			}
		}
	}
}

Measured memory_bytes: 8860
#include<stdio.h>
#include<string.h>
int main() 
{
	char x[666666];
	scanf("%s",x);
	char a[]= "Sunny";
	char b[] = "Cloudy";
	char c[] = "Rainy";
	if(strcmp(x,a)==0)
		printf("Cloudy");
	if(strcmp(x,b)==0)
                printf("Rainy");
	if(strcmp(x,c)==0)
                printf("Sunny");
return 0;
}


Measured memory_bytes: 128
/*  ex7_3
    kento_titech*/
#include<stdio.h>
#include<stdlib.h>
int main(void){
    int row,col,i,j,*check_row,*check_col;
    char **grid;
    scanf("%d %d",&row,&col);
    grid=(char**)malloc(sizeof(char*)*(row+1));//行に関して文字列配列を動的配列で割り当てる
    check_row=(int*)malloc(sizeof(int)*row);//チェック用の配列も動的配列で割り当てる
    check_col=(int*)malloc(sizeof(int)*col);
    if(grid==NULL){//エラー出力
        fprintf(stderr,"error\n");
        exit(1);
    }
    for(i=0;i<row;i++){
        grid[i]=(char*)malloc(sizeof(char)*(col+1));//列に関して文字列配列を動的配列で割り当てる
        if(grid[i]==NULL){//エラー出力
            fprintf(stderr,"error\n");
            exit(1);
        }
    }
    for(i=0;i<row;i++){
        for(j=0;j<col;j++){
            scanf(" %c",&grid[i][j]);//row行col列の入力
        }
    }
    for(i=0;i<row;i++){
        for(j=0;j<col;j++){
            if(grid[i][j]=='#'){//ある行にひとつでも黒色があればその行は消さない。列も同様
                check_row[i]=1;
                check_col[j]=1;
            }
        }
    }
    for(i=0;i<row;i++){
        if(check_row[i]==1){//ある行に黒色があれば列について確認、白色しかなければその行は出力しない
            for(j=0;j<col;j++){
                if(check_col[j]==1){//列について
                    printf("%c",grid[i][j]);
                }
            }printf("\n");
        }
    }
    for(i=0;i<row;i++){
        free(grid[i]);
    }
    free(grid);
    free(check_row);
    free(check_col);

    return 0;
}

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

#include <unistd.h>
 
using namespace std;
 
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl
#define DEBUG_MAT(v) cerr<<#v<<endl;for(int i=0;i<v.size();i++){for(int j=0;j<v[i].size();j++) {cerr<<v[i][j]<<" ";}cerr<<endl;}
 
 
typedef long long ll;
//#define int ll
 
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
template<class S, class T> pair<S, T> operator+(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first + t.first, s.second + t.second); }
template<class S, class T> pair<S, T> operator-(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first - t.first, s.second - t.second); }
template<class S, class T> ostream& operator<<(ostream& os, pair<S, T> p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
#define X first
#define Y second
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define rrep1(i,n) for(int i=(n);i>0;i--)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define in(x, a, b) (a <= x && x < b)
#define all(c) c.begin(),c.end()
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a = b; return 1; } return 0; }
#define UNIQUE(v) v.erase(std::unique(v.begin(), v.end()), v.end());
const ll inf = 1000000001;
const ll INF = (ll)1e18 + 1;
const ll MOD = 1000000007;
//const ll MOD = 998244353;
const double pi = 3.14159265358979323846;
#define Sp(p) cout<<setprecision(15)<< fixed<<p<<endl;
int dx_ori[4] = { -1,0, 1,0 }, dy_ori[4] = { 0,1,0,-1 };
int dx[4] = {0, 0, 0, 0}, dy[4] = {0, 0, 0, 0};
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };
#define fio() cin.tie(0); ios::sync_with_stdio(false);
// #define mp make_pair
//#define endl '\n'

int n;
vector<vector<pll>> G(111111);
vi ans(111111);

void dfs(int now, int par) {
  int par_c;
  vi cs;
  rep (i, G[now].size()) {
    if (G[now][i].first == par) {
      par_c = ans[G[now][i].second];
      break;
    }
  }
  int color = 0;
  rep (i, G[now].size()) {
    if (G[now][i].first == par) {
      continue;
    }
    while (color == par_c) color++;
    ans[G[now][i].second] = color;
    dfs(G[now][i].first, now);
    color++;
  }
}

signed main() {
  int n;
  cin >> n;
  rep (i, n - 1) {
    int u, v;
    cin >> u >> v;
    u--; v--;
    G[u].push_back(pll(v, i));
    G[v].push_back(pll(u, i));
  }

  dfs(0, -1);
  int max_color = 0;
  rep (i, n - 1) {
    chmax(max_color, ans[i] + 1);
  }
  cout << max_color << endl;
  rep (i, n - 1) {
    cout << ans[i] + 1 << endl;
  }
}


Measured memory_bytes: 10112
#coding:utf-8

n=input()
A=map(int, raw_input().split(" "))
A.sort()
last=-1
ans=A[0]

while True:
    if last==ans:
        break
    last=ans
    for a in A:
        m=a%ans
        if m!=0:
            ans=min(m,ans)

print(ans)

Measured memory_bytes: 11320
#include <bits/stdc++.h>
#define rep(i, m, n) for(int i = m; i < (n); i++)
#define print(x) cout << (x) << endl;
#define printa(x,n) for(int i = 0; i < n; i++){ cout << (x[i]) << " ";} cout << endl;
#define printa2(x,m,n) for(int i = 0; i < m; i++){ for(int j = 0; j < n; j++){ cout << x[i][j] << " ";} cout << endl;}
#define printp(x,n) for(int i = 0; i < n; i++){ cout << "(" << x[i].first << ", " << x[i].second << ") "; } cout << endl;
#define INF (1e18)
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
typedef struct{
    int x;
    int y;
} P;
typedef struct{
    ll to;
    ll cost;
} edge;
typedef pair<ll, ll> lpair;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    if(N == 3 || N == 5 || N == 7){
        print("YES");
    }else{
        print("NO");
    }


}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, x, y) for (ll i = x; i <= y; i++)
#define BIT(t) (1ll << t)
#define PER(i, y, x) for (ll i = y; i >= x; i--)
#define vll vector<ll>
#define vvll vector<vector<ll>>
#define pll pair<ll, ll>
#define SIZE(v) ll(v.size())
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
using namespace std;
typedef long long ll;
//        ios::sync_with_stdio(false);
//        cin.tie(nullptr);

int main(){
  string s;
  cin >> s;
  cout << s.substr(0,3) << endl;
}

Measured memory_bytes: 3628
#include <iostream>
#include <stdio.h>
#include <vector>
#include <string.h>

using namespace std;

const int N = 123456;

vector <int> v[N];
int dp[N][11];

void dfs(int k,int d,int c) {
    dp[k][d]=c;
    if(d==0) return;
    for(int x:v[k]) {
        if(dp[x][d-1]==0) dfs(x,d-1,c);
    }
    if(dp[k][d-1]==0) dfs(k,d-1,c);
}

int main() {
    int n,m;
    scanf("%d %d",&n,&m);
    memset(dp,0,sizeof(dp));
    for(int i=0;i<m;i++) {
        int a,b;
        scanf("%d %d",&a,&b);
        v[a].push_back(b);
        v[b].push_back(a);
    }
    int q;
    scanf("%d",&q);
    int voo[N],d[N],c[N];
    for(int i=0;i<q;i++) {
        scanf("%d %d %d",voo+i,d+i,c+i);
    }
    for(int i=q-1;i>=0;i--) {
        if(dp[voo[i]][d[i]]==0) dfs(voo[i],d[i],c[i]);
    }
    for(int i=1;i<=n;i++) printf("%d\n",dp[i][0]);
    return 0;
}


Measured memory_bytes: 13560
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(void){
  int N,K;
  cin >> N >> K;

  vector<int>num(N,0);
  for(int i=0;i<N;i++){
    cin >> num[i];
  }

  int point_1 = 0;

  for(int i=0;i<N;i++){
    if(num[i] == 1)
      point_1 = i;
  }

  int left_1 = point_1;
  int right_1 = N - point_1 - 1;

  cout << (N - 1 + K - 2) / (K - 1) << endl;

  return 0;
}


Measured memory_bytes: 640
n, m = gets.split.map(&:to_i)

edge = Array.new(n+1) {Array.new(n+1)}
dp = Array.new(n+1) {Array.new(n+1, 1000 * 100)}
m.times do
    a, b, c = gets.split.map(&:to_i)
    edge[a][b] = edge[b][a] = dp[a][b] = dp[b][a] = c
end
n.times {|i| dp[i][i] = 0}

1.upto(n) do |k|
    1.upto(n) do |s|
        (s+1).upto(n) do |f|
            dp[s][f] = dp[f][s] = [dp[s][f], dp[s][k] + dp[k][f]].min
        end
    end
end

ans = 0
1.upto(n) do |i|
    (i+1).upto(n) do |j|
        ans += 1 if edge[i][j] && edge[i][j] > dp[i][j]
    end
end

p ans

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

  unsigned long long gcd( unsigned long long a, unsigned long long b){
  if(a%b==0){
    return b;
  }else{
   return gcd(b,a%b);
  }
}

 int main(){
  unsigned long long A,B;
  cin>>A>>B;
 unsigned long long C=gcd(A,B);
 unsigned long long D=(A*B)/C;
  cout<<D<<endl;
}

Measured memory_bytes: 3576
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int N1 = sc.nextInt();
		int N2 = sc.nextInt();
		int ans = 0;
		for (int i = 1; i < N1 + 1; i++) {
			for (int j = 22; j < N2 + 1; j++) {
				if (j % 10 < 2) {
					continue;
				}
				if (i == ((j / 10) * (j % 10))) {
					ans++;
				}
			}
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 22740
while True:
    L=input()
    l=len(L)
    if l==1 and L[0]=="0":
        break

    n=[0 for i in range(l)]

    for i in range(l):
        n[i]=int(L[i])

        sum=0

    for i in range(l):
        sum=sum+n[i]

    print(f"{sum}")



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

int main(){
    int W, H, x, y, r;
    cin >> W >> H >> x >> y >> r;
    if( r <= x && x + r <= W && r <= y && y + r <= H ){
        cout << "Yes" << endl;
        }
    else{
        cout << "No" << endl;
    } 
    return 0;
}

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

using namespace std;

#define SZ(x) (int)(x.size())

using ll = long long;
using ld = long double;
using P = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
const double eps = 1e-10;
const int MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1ll<<50;

template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i == (int)(s.size())-1) cout << endl;
    else cout << " ";
  }
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);

  int r, g; cin >> r >> g;
  cout << g * 2 - r << endl;
}


Measured memory_bytes: 256
#include<iostream>

int main() {
	long  n, a, b, c, ans;
	std::cin >> n >> a >> b;
	c = a + b;

	ans = (n / c)*a;
	if (n > (n / c)*c + a)ans += a;
	else ans += n%c;

	std::cout << ans << std::endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <stdio.h>

using namespace std;
int main(void)
{
    int h, w;
    char c[110];

    cin >> h >> w;
    for (int i = 0; i < h; i++) {
        scanf("%s", c);
        printf("%s\n%s\n", c, c);
    }

    

    return 0;
}

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

int main() {
    string s;
    cin >> s;
    if (s.size() >= 4 && s.substr(0, 4) == "YAKI") cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}


Measured memory_bytes: 256
temp = input()
temp = temp.split()
N = int(temp[0])
M = int(temp[1])

temp = input()
temp = temp.split()
height = [int(s) for s in temp]
bridge = [0] * N
data = [0] * N

for i in range(M):
  temp = input()
  temp = temp.split()
  A = int(temp[0])
  B = int(temp[1])
  if height[A-1] > height[B-1]:
    data[B-1] = 1
  elif height[A-1] < height[B-1]:
    data[A-1] = 1
  else:
    data[A-1] = data[B-1] = 1
    
  bridge[A-1] = 1
  bridge[B-1] = 1

count = 0
for i in range(N):
  if data[i] == 0 or bridge[i] == 0:
    count += 1
print(count)

Measured memory_bytes: 21700
/*
 * ABC_083_D.cpp
 *
 *  Created on: May 18, 2018
 *      Author: 13743
 */
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<string>
#include<cstring>
using namespace std;
typedef long long lng;
typedef unsigned long long ulng;

#define pb push_back
#define SZ(a) int((a).size())
#define ALL(a) (a).begin(), (a).end
#define FOR(i,a,b) for(int i=(a); i<=(b); ++i)
#define FORD(i,b,a) for(int i=(b); i>=(a); --i)
#define REP(i,n) FOR(i,0,n-1)
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end())

lng power(lng b, lng e) {lng sol=1; while(e>0) {if(e&1) {sol=sol*b;} e>>=1; b*= b;} return sol;}



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

	string str;
	cin >> str;
	int maxK = SZ(str);
	REP(i, SZ(str)-1) {
		if(str[i] != str[i+1]) {
			int k = max(i+1, SZ(str)-i-1);
			maxK = min(maxK, k);
		}
	}
	cout << maxK << endl;
}






Measured memory_bytes: 512
from collections import Counter
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            # 経路圧縮
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

N,K,L = map(int,input().split())
l = []
ufp = UnionFind(N)
ufr = UnionFind(N)
for i in range(K):
    p,q = map(int, input().split())
    ufp.union(p-1, q-1)
for i in range(L):
    r,s = map(int,input().split())
    ufr.union(r-1, s-1)

for i in range(N):
    tup = (ufp.find(i), ufr.find(i))
    l.append(tup)
c = Counter(l)
for i in range(N):
    # 個数を調べたいデータを入れると、その個数が返される
    print(c[l[i]], end=" ")

Measured memory_bytes: 109404
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double lld;
ll MOD = (1e9)+7;
//#pragma GCC target ("avx2")
//#pragma GCC optimization ("O3")
//#pragma GCC optimization ("unroll-loops")
inline void fastIO(){
  ios_base::sync_with_stdio(0);cin.tie(0);
}

int main(){
  fastIO();
  int k,a,b;
  cin>>k>>a>>b;
  bool yes=false;
  for(int i=a;i<=b;i++){
    if(i%k==0)yes=true;
  }
  if(yes){
    cout<<"OK"<<endl;
  }else{
    cout<<"NG"<<endl;
  }
  return 0;
}


Measured memory_bytes: 3648
#include <stdio.h>
typedef unsigned long long data;
data gcd(data a,data b);
void lcm(data a,data b,data *c,data *d);
int main(){
	data a,b,c,d;
	while(scanf("%llu %llu",&a,&b)!=EOF){
		lcm(a,b,&c,&d);
		printf("%llu %llu\n",c,d);
	}
	return 0;
}
void lcm(data a,data b,data *c,data *d){
	*c=gcd(a,b);
	*d=a*b/gcd(a,b);
}
data gcd(data a,data b){
	data r;
	r=a%b;
	while(r!=0){
		a=b;
		b=r;
		r=a%b;
	}
	return b;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
typedef long long ll;
typedef pair<int, int> P;
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
int main() {
  ll N, M;
  cin >> N >> M;
  if (2 * M <= N) {
    cout << M / 2 << endl;
    return 0;
  } else if (2 * N < M) {
    ll num = 0;
    num = N;
    M -= 2 * N;
    num += M / 4;
    cout << num << endl;
  } else {
    cout << M / 2 << endl;
  }
}

Measured memory_bytes: 3640
#include <iostream>

using namespace std;

int main() {
    int a, b, n = 10000;
    while (cin >> a >> b && a != 0) {
        if (n != 10000) {
            cout << endl;
        }
        n = 0;
        for (int i = a; i <= b; i++) {
            if (i % 100 == 0) {
                if (i % 400 == 0) {
                    cout << i << endl;
                    n++;
                }
            }
            else if (i % 4 == 0) {
                cout << i << endl;
                n++;
            }
        }
        if (n == 0) {
            cout << "NA" << endl;
        }
    }

    return 0;
}

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

int gcd(long long a, long long b){
  long long M = max(a, b), m = min(a, b);
  while(m != 0){
  	long long r = M%m;
    M = m; m = r;
  }
  return M;
}

int digit_sum(long long n){
  long long ans;
  while(n != 0){
  	ans += n%10;
  	n /= 10;
  }
  return ans;
}

int main(){
  int n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  int ans = 0;
  vector<int> a;
  
  for(int i = 0; i < n-1; i++){
  	if(s.at(i) == 'L' && s.at(i+1) == 'R'){
    	a.push_back(0);
    }
  	else if(s.at(i) == 'R' && s.at(i+1) == 'L'){
    	a.push_back(1);
    }
  	else{
    	ans++;
    }
  }
  int m = a.size();
  int plus = 0;
  /*if(a.size() > 0){
  for(int i = 0; i < a.size()-1; i++){
  	if(a.at(i) != a.at(i+1)){
    	plus++;
    }
  }
  }
  cout << ans + min(k, (plus+1)/2)*2 << endl;*/
  if(m > 0){
  if(k >= (m+1)/2){
  	cout << ans + m << endl;
  }
  else if(k == (m+1)/2 - 1){
  	if(m%2 == 0){
    	cout << ans + m - 2 << endl;
    }
  	else{
    	cout << ans + m - 1 << endl;
    }
  }
  else{
  	cout << ans + 2*k << endl;
  }
  }
  else{
  cout << ans << endl;
  }
}

Measured memory_bytes: 1020
#include<iostream>
#include<algorithm>
using namespace std;
long dp[10][101][1001];
main()
{
	for(int i=0;i<=100;i++)dp[1][i][i]=1;
	for(int i=2;i<10;i++)
	{
		for(int s=0;s<=1000;s++)
		{
			for(int j=0;j<=100&&j<=s;j++)
			{
				for(int k=j+1;k<=100;k++)
				{
					dp[i][j][s]+=dp[i-1][k][s-j];
				}
			}
		}
	}
	int a,b;
	while(cin>>a>>b,a)
	{
		long ans=0;
		for(int i=0;i<=100;i++)ans+=dp[a][i][b];
		cout<<ans<<endl;
	}
}


Measured memory_bytes: 9776
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n=0,h=0,w=0;
  cin>>n>>h>>w;
  int a[n];
  int b[n];
  for(int i=0;i<n;i++)
    cin>>a[i]>>b[i];
  int cnt=0;
  for(int i=0;i<n;i++)
  {
    if(a[i]>=h&&b[i]>=w)
      cnt++;
  }
  cout<<cnt<<endl;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#define all(x) (x).begin(), (x).end()

using namespace std;

const char WALL = '#';
const int MSIZE = 1010;

const long long mod = 1e9 + 7;

long long dp[MSIZE][MSIZE];

int dx[2] {0, 1};
int dy[2] {1, 0};

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int n, m;
    cin >> n >> m;
    memset(dp, 0, sizeof dp);
    vector<string> arr(n);
    for (int i = 0; i < n; i++) cin >> arr[i];
    dp[0][0] = arr[0][0] != WALL;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            for (int k = 0; k < 2; k++) {
                int nx = i + dx[k];
                int ny = j + dy[k];
                if (nx == n || ny == m) continue;
                if (arr[nx][ny] == WALL) continue;
                dp[nx][ny] += dp[i][j];
                dp[nx][ny] %= mod;
            }        
        }
    }  
    cout << dp[n - 1][m - 1] << endl;
}


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

int N, T, L, B;
int arr[101];
double dp[101][101];

double calc(int d, int p)
{
	if (arr[p] == 1) d--;
	if (d < 0) return 0.0;
	if (p == N) return 1.0;
	double &res = dp[d][p];
	if (res > -1.) return res;
	
	res = 0;
	for (int i = 1; i <= 6; i++){
		int np = p + i;
		if (np > N) np = N - (np - N);
		if (arr[np] == 2) np = 0;
		res += calc(d - 1, np);
	}
	
	return res /= 6;
}

int main()
{
	while (scanf("%d %d %d %d", &N, &T, &L, &B), N){
		fill_n(arr, 101, 0);
		fill_n(*dp, 101 * 101, -1.);
		
		for (int i = 0; i < L; i++){
			int lose;
			scanf("%d", &lose);
			arr[lose] = 1;
		}
		
		for (int i = 0; i < B; i++){
			int back;
			scanf("%d", &back);
			arr[back] = 2;
		}
		
		printf("%f\n", calc(T, 0));
	}
	
	return 0;
}

Measured memory_bytes: 1304
#include <iostream>
#include <stack>
#include <string>
using namespace std;
int main(){
  stack<char> stack;
  string s;
  int len,i,flag;
  while(1){
    flag=0;
    getline(cin,s);
    if(s==".") break;
    len=s.size();
    for(i=0;i<len;i++){
      if(s[i]=='('||s[i]=='[') stack.push(s[i]);
      else if(s[i]==')'){
    if(stack.empty()!=true&&stack.top()=='('){
      stack.pop();
    }
        else{
      flag=1;
      break;
    }
      }
      else if(s[i]==']'){
    if(stack.empty()!=true&&stack.top()=='['){
      stack.pop();
    }
        else{
      flag=1;
      break;
    }
      }
    }
    if(flag==0&&stack.empty()==true){
      cout << "yes" << endl;
    }
    else{
      if(stack.empty()!=true){
    while(1){
      stack.pop();
      if(stack.empty()==true) break;
    }
      }
      cout << "no" << endl;
    }
  }
  return 0;
}

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

int main() {
  int N,K;
  cin >> N;
  K = 0;

 std::vector<int> P(N);
for (size_t i = 0; i <N; ++i) {
   cin >> P[i];
}

for (size_t t = 0; t <N; ++t) {
  if(P[t]!=t+1){
    K+=1;}
}
  
if(K<=2){
  cout << "YES" << endl;}
else {cout << "NO" << endl;}
  
return 0;
}


Measured memory_bytes: 256
// Problem : D - Div Game
// Contest : AtCoder - AtCoder Beginner Contest 169
// URL : https://atcoder.jp/contests/abc169/tasks/abc169_d
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

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

#define w cout
#define e '\n'
#define int long long
#define sz(x) (int)x.size()
#define re return 
#define vi vector<int>
#define vii vector<pair<int ,int > >
#define F first
#define S second
#define pussy push_back
template<class T> inline istream& operator>>(istream& str, vector<T> &a) { for (auto &i : a) str >> i; return str; }

const int N = 1e6 , mod = 1e9 + 7;

void solve() {
	int n ;cin >> n;
	//24=2*2*2*3
	vector<pair<int,int> >v;
	int pp = n;
	for(int i = 2; i<= sqrt(n); i ++ ){
		int c =0;
		while(n % i == 0) {
			c++;
			n = n / i;
		}
		if(c)v.pussy({c , i});
	}
	if(n > 2) v.pussy({1,n});
	
	int ans = 0;
	n = pp;
	int cnt = 1;
	while(n != 1){
		int f = 0;
		for(auto &i : v){
			if(i.F < cnt) continue;
			ans ++;
			n /= pow(i.S,cnt);
			f = 1;
			if(n==1) break;
			i.F -= cnt;
		}
		if(!f)break;
		cnt++;
	}
	w << ans;
}

signed main() {
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);	
	int t = 1;
	// cin >> t;
	while(t--) {
		solve();
	}	
}


Measured memory_bytes: 4088
n,m=map(int,input().split())
def divisor(n): #約数
    f=[]
    d=[1]
    c=0
    r=int(n**0.5)
    for i in range(2,r+2):
        while n%i==0:
            c+=1
            n=n//i
        if c!=0:
            f.append([i,c])
            c=0
    if n!=1:
        f.append([n,1])
    for i in range(len(f)):
        t=[]
        for j in range(1,f[i][1]+1):
            t.append(f[i][0]**j)
        for j in range(len(d)):
            for k in range(len(t)):
                d.append(d[j]*t[k])
    return sorted(d)
x=divisor(m)
if len(x)==1:
    print(1)
elif n==1:
    print(m)
else: 
    for i in range(len(x)):
        if m/x[i]<n:
            print(x[i-1])
            break

Measured memory_bytes: 3188
#include <bits/stdc++.h>
#include <string>
using namespace std;
#define ll long long
#define endl "\n"
#define print_array(name,n) for(ll o=0;o<n;o++) cout<<name[o]<<" "
#define fr(i,f,t) for(ll i=(f);i<t;i++)
#define fb(i,f,t) for(ll i=(f);i>=t;i--)
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define inf 2e18
bool sortbysecond(const pair<int,int> &a,const pair<int,int> &b){
	return (a.ss>b.ss);
}
template <typename T>
string NumberTostring(T Number )
{
	ostringstream ss;
	ss<<Number;
	return ss.str();
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    int n;
    cin>>n;
    ll sum = 0;
    for(int i=1;i<=n;i++){
    	if(i%3!=0 and i%5!=0){
    		sum+=i;
    	}
    }
    cout<<sum<<endl;
    return 0;
}

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

int main() {
	char s[20];
	scanf("%s", s);
	
	int N = strlen(s);
	int sol = 0, sum = 0;
	for (int i = 0; i < N; i++) {
		if (s[i] != '0')
			sol = max(sol, sum + s[i] - '1' + 9 * (N - i - 1));
		sum += s[i] - '0';
	}
	
	printf("%d\n", max(sol, sum));
	
	return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
typedef long long int lli;
const int MOD = 1000000007;
using namespace std;
int main() {
	cin.tie(0); ios::sync_with_stdio(false);
	int N, M;cin >> N >> M;
	vector<int> ver(N + 1, 0);
	for (int i = 0; i < M; i++) {
		int A; cin >> A;
		ver[A] = 1;
	}

	vector<int> dp(N + 1, 0);
	dp[0] = 1;
	if (ver[1] == 0) { dp[1] = 1; }

	for (int n = 2; n <= N; n++) {
		if (ver[n - 1] == 0) {dp[n] += dp[n - 1];}
		if (ver[n - 2] == 0) {dp[n] += dp[n - 2];}
		dp[n] %= MOD;
	}
	cout << dp[N] << endl;
}

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

#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define vecp(p) int aa;cin>>aa;(p).push_back(aa);
#define vecpl(p) long long aa;cin>>aa;(p).push_back(aa);
#define vecps(p) string aa;cin>>aa;(p).push_back(aa);
#define vecp2(p) cin>>aa;(p).push_back(aa);
#define vecpl2(p) long long a	b;cin>>ab;(p).push_back(ab);
#define vecps2(p) string ab;cin>>ab;(p).push_back(ab);
#define set0(k,n) for(int nn=0;nn<(n);nn++){ (k).push_back(0); }
#define sorts(c) sort((c).begin(),(c).end());
#define reverses(c) reverse((c).begin(),(c).end());
#define vec(b) vector<int> (b);
#define vecl(b) vector<long long> (b);
#define vecs(b) vector<string> (b);
#define vecsize(b,size) vector<int> (b)((size));
#define pb(b,a) (b).push_back((a));
#define doublece(a,b) cout<<(a)<<' '<<(b)<<endl;
#define pairs(s) vector<pair<int,int>> (s);
#define pairsl(s) vector<pair<ll,ll>> (s);
#define pairss(s) vector<pair<string,string>> (s);
#define pairsp(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairspl(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairsps(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairsREV(s) (s).push_back(make_pair(bb,aa));
#define pairslREV(s) (s).push_back(make_pair(bb,aa));
#define pairssREV(s) (s).push_back(make_pair(bb,aa));
#define MOD 1000000007

int main()
{
int N;
	vec(A)
		cin >> N;
	int maxi = 0;
	int sub = 0;
	map<int, int> S;

	fx(N) {
		vecp(A)
			S[A.at(x)]++;
		if (A.at(x)>=maxi) {
			sub = maxi;
			maxi = A.at(x);
		}
		else if (A.at(x)>=sub) {
			sub = A.at(x);
			}
	}

	if (S[maxi] > 1) {
		fx(N) {
			ce(maxi)
		}
	}
	else {
		fx(N) {
			if (A.at(x)==maxi) {
				ce(sub)
			}
			else {
				ce(maxi)
			}
		}
	}

    return 0;
}



Measured memory_bytes: 7924
# import bisect
# from collections import Counter, deque
# import copy
# from heapq import heappush, heappop, heapify
# from fractions import gcd
# import itertools
# from operator import attrgetter, itemgetter
import math

import sys

# import numpy as np

ipti = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)

def main():
    a, b = list(map(int,ipti().split()))

    for price in range(0, 10001):
        aa = math.floor(price * 0.08)
        bb = math.floor(price * 0.10)

        if a == aa and b == bb:
            print(price)
            sys.exit()

    print(-1)

if __name__ == '__main__':
    main()

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

int give_numbers(int x){
        
    int res = 0;
    while(x >= 0){
        res += 1;
        x -= 400;
    }
    
    return res;
    
}



int main(){
    
    
    int n;
    cin >> n;
    
    vector<int>arr(n);
    for(int i = 0; i < n; i++){
        cin >> arr[i];
    }
    
    set<int>s;
    int out_3200 = 0;
    for(int i = 0; i < n; i++){
        if(arr[i] < 3200){
            s.insert(give_numbers(arr[i]));
        }else{
            out_3200 += 1;
        }
    }
    int mn = (int)s.size();
    int mx = mn + out_3200;
    if(mn == 0)mn = 1;
    
    cout << mn << " " << mx << endl;
    
    
}


Measured memory_bytes: 3624
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

int main(){
    int N,M;
    int *ip;
 
    while(scanf("%d %d",&N,&M)<0);

    ip =(int *)malloc(M*sizeof(int)); //ipにN個のint領域を確保
    int i;
    for (i=0;i<M;i++){
        scanf("%d",&ip[i]);
    }
    //計算処理
    for(i=0;i<M;i++){
        N=N-ip[i];
    }
    //最終出力  
    if(N>=0){
        printf("%d",N);
    }else{
    printf("-1");
    }
    free(ip);
    return 0;
}

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

int main(){
  int n,m;
  cin >> n >> m;
  vector<bool> ac(n,false);
  vector<int> wa(n,0);
  for(int i=0;i<m;++i) {
    int p;
    string s;
    cin >> p >> s;
    if(ac[p-1]) continue;
    if(s == "AC"){
       ac[p-1] = true;
    }else{
      wa[p-1]++;
    } 
  
  }
  int ans_ac = 0,ans_wa = 0;
  for(int i=0;i<n;++i){
    if(ac[i]) {
      ans_ac++; 
      ans_wa += wa[i]; 
    }
  }
   cout << ans_ac << " " << ans_wa << endl;
}

Measured memory_bytes: 640
#include <stdio.h>

int main()
{
    int n, m, l;
    int A[100][100], B[100][100];
    long long int sum;
    int i, j, k;

    scanf("%d %d %d",&n, &m, &l);

    for (i = 0; i < n; i++) {
        for (j = 0; j < m; j++) {
            scanf("%d", &A[i][j]);
        }
    }
    for (i = 0; i < m; i++) {
        for (j = 0; j < l; j++) {
            scanf("%d", &B[i][j]);
        }
    }

    for (i = 0; i < n; i++) {
        for (j = 0; j < l; j++) {
            sum = 0;
            for (k = 0; k < m; k++) {
                sum += A[i][k] * B[k][j];
            }
            printf("%lld", sum);
            if (j == l - 1) printf("\n");
            else printf(" ");
        }
        
    }

    return 0;
}


Measured memory_bytes: 2104
N = int(input())
S = []
S.append(input())
ans = 'Yes'

for i in range(N - 1):
	s = input()
	S.append(s)

	# 重複した単語の場合はNG
	if S.count(s) != 1:
		ans = 'No'
		break

	# しりとりになっていない場合はNG
	if S[i][-1] != S[i + 1][0]:
		ans = 'No'
		break

print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
using ll = long long; using P = pair<int,int>;
using vl = vector<ll>; using vvl = vector<vl>;
#define mp make_pair
#define pb push_back
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define rrep(i,n) for (int i=(n-1);i >= 0;i--)
#define all(v) v.begin(),v.end()
#define sz(v) (int)((v).size())
#define MAX(v) *max_element(all(v))
#define MIN(v) *min_element(all(v))
#define Sort(v) sort(all(v))
#define Rev(v) reverse(all(v))
#define vec(type,name,...) vector<type> name(__VA_ARGS__)
#define VEC(type,name,size) vector<type> name(size);in(name)
#define vv(type,name,h,...) vector<vector<type>>name(h,vector<type>(__VA_ARGS__))
#define VV(type,name,h,w) vector<vector<type>>name(h,vector<type>(w));in(name)
void debug_out() { cout << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cout << H << " ";
    debug_out(T...);
}
#ifdef _DEBUG
#define debug(...) debug_out(__VA_ARGS__)
#else
#define debug(...) 
#endif
template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
    for (std::size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
    return os;
}
inline void IN(void){return;}
template <typename First, typename... Rest>
void IN(First& first, Rest&... rest){cin >> first;IN(rest...);return;}
template<class T>bool chmax(T &a, const T &b) {if(a<b){a=b; return 1;} return 0;}
template<class T>bool chmin(T &a, const T &b) {if(b<a){a=b; return 1;} return 0;}
const ll INF = 1LL << 60;
const ll mod = 1000000007;
const int dx[8] = {1,0,-1,0,1,1,-1,-1}; const int dy[8] = {0,1,0,-1,1,1,-1,-1};

int main(){
    cin.tie(0); ios::sync_with_stdio(false);
    int n,k; cin >> n >> k;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    vector<bool> dp(k+1, false);
    rep(i, 1, k+1) rep(j, n) {
        if(i-a[j] >= 0 && dp[i-a[j]] == false) dp[i] = true;
    }
    if(dp[k]) cout << "First" << endl;
    else cout << "Second" << endl;
}

Measured memory_bytes: 3680
#include<stdio.h>
#include<math.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#define max 200001
int main(){
 char s[max];long long i,j;
 scanf("%s",s);
 long long len=strlen(s);
  
 long long a[len],x,mod[len+1],y,b=1,cnt[2019]={0};
 mod[len]=0;cnt[0]++;
 for(x=len-1;x>=0;x--){
  a[x]=s[x]-'0';
  mod[x]=(a[x]*b)%2019;
  mod[x]=(mod[x]+mod[x+1])%2019;
  b=(b*10)%2019;
  cnt[mod[x]]++; 
 }
 long long ans=0;
 for(x=0;x<2019;x++)
  ans+=(cnt[x]-1)*cnt[x]/2;
 printf("%lld\n",ans);

return 0;}


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

using namespace std;

int R,C,N;

struct edge {
	int u,v;
	bool operator < (const edge &b) const {
		return u < b.u;
	}
}e[200010];
int cnt;

typedef pair<int,int> pii;
priority_queue<pii,vector<pii>,greater<pii> > q;

int main () {
	scanf("%d%d%d",&C,&R,&N);

	for(int i = 1;i <= N;++i) {
		int u,v,w,x;
		scanf("%d%d%d%d",&u,&v,&w,&x);
		if(u == 0 || u == C || v == 0 || v == R) {
            if(w == 0 || w == C || x == 0 || x == R) {
                if(v == 0)
					u = u + 1;
				else
					if(u == C)
						u = C + 1 + v;
				else
					if(v == R)
						u = C + 1 + R + (C - u);
				else u = C + 1 + R + C + (R - v);

				if(x == 0)
					v = w + 1;
				else
					if(w == C)
						v = C + 1 + x;
				else
					if(x == R)
						v = C + 1 + R + (C - w);
				else v = C + 1 + R + C + (R - x);
				if(u > v) swap(u,v);
				e[++cnt].u = u;
				e[cnt].v = v;
				e[++cnt].u = u + C + 1 + R + C + R;
				e[cnt].v = v + C + 1 + R + C + R;
            }
		}
	}
	if(cnt == 0) {
		printf("YES\n");
		return 0;
	}

	sort(e + 1,e + 1 + cnt);
	q.push(make_pair(e[1].v,e[1].u));

	for(int i = 2;i <= cnt;++i) {
		bool Done = 0;
        while(!q.empty()) {
			pii u = q.top();

			if(u.first < e[i].u) {
				q.pop();
				continue;
			}

			if(u.second < e[i].u && u.first > e[i].v) {
				q.push(make_pair(e[i].v,e[i].u));
				Done = 1;
				break;
			}

			if(u.first > e[i].u && u.first < e[i].v) {
                printf("NO\n");
				return 0;
			}
        }

        if(Done) continue;
        q.push(make_pair(e[i].v,e[i].u));

	}
	printf("YES\n");
}


Measured memory_bytes: 2428
#include <bits/stdc++.h>
#include <iterator>
#include <tuple>
using namespace std;
using ll = long long;

int main()
{
  ll x;
  cin >> x;
  ll sum = 0;
  for (ll i = 1; i < 1e9; ++i)
  {
    sum += i;
    if (x <= sum)
    {
      cout << i << endl;
      return 0;
    }
  }

  return 0;
}

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

 
int main() 
{ 
   string s;
   cin>>s;
   if(s[0]==s[1]||s[1]==s[2]||s[2]==s[3])
    cout<<"Bad";
    else
    cout<<"Good";
   
    return 0; 
} 

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

using std::cin;
using std::cout;
using std::endl;

using std::string;
using std::pair;

using std::vector;
using std::sort;

int main(){
    int n;
    cin >> n;
    int a;
    cin >> a;
    n%=500;
    if(n<=a){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
    return 0;
}



Measured memory_bytes: 256
import heapq as hq
import numpy as np

N, M = map(int, input().split())
job = [list(map(int, input().split())) for _ in range(N)]
ans = 0
job.sort()
job.append([np.inf, np.inf])
jobhq = []
index = 0
for day in range(1, M + 1):
    while day >= job[index][0]:
        hq.heappush(jobhq, - job[index][1])
        index += 1
    if jobhq:
        ans += - hq.heappop(jobhq)
print(ans)

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

int main()
{
  string N;
  cin >> N;
  
  int count = 0;
  for(int i = 0; i < N.size(); i++)
  {
    if(N.at(i) == '2')
      count++;
  }
  
  cout << count << endl;
}

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

/*第二引数で第一引数を割ったときの切り上げの計算*/
long long int maxtime(long long int x, long long int y) {
	return(x + y - 1) / y;

}
/*最大公約数*/
long long int lcm(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;

	if (number2 > number1) {
		m = number2;
		n = number1;
	}
	long long int s = -1;
	while (s != 0) {
		s = m % n;
		m = n;
		n = s;
	}
	return m;
}
/*最大公倍数*/
long long int gcd(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;
	return m / lcm(m, n) * n;
}
int main() {
	int n;
	cin >> n;
	vector<int> s;
	for (int i = 0; i < n; i++) {
		int a;
		cin >> a;
		s.push_back(a);
	}
	s.push_back(0);
	vector<int> ruiseki;
	int abc = 0;
	int ruisekiwa = 0;
	for (int i = 0; i < n; i++) {
		ruisekiwa = ruisekiwa + abs(s[i] - abc);
		ruiseki.push_back(ruisekiwa);
		abc = s[i];
	}
	ruiseki.push_back(ruisekiwa + abs(abc));
/*	for (int i = 0; i <= n; i++) {
		cout << ruiseki[i] << " ";
	}
*/
	for (int i = 0; i < n; i++) {
		if (i == 0) {
			cout << abs(s[i + 1]) + ruiseki[n] - ruiseki[1] << endl;
			continue;
		}
		if (i == n - 1) {
			cout << ruiseki[n - 2] + abs(s[n - 2]) << endl;
			continue;
		}
		cout << ruiseki[i - 1] + ruiseki[n] - ruiseki[i + 1] + abs(s[i + 1] - s[i - 1]) << endl;
	}
}

Measured memory_bytes: 2168
import java.util.*;

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

    int n = sc.nextInt();
    int k = sc.nextInt();
    long h[] = new long[n];
    long ans = 0;
    
    for(int i = 0; i < n; i++){
      h[i] = sc.nextInt();
    }

    Arrays.sort(h);

    if(n < k){
      ans = 0;
    } else {
      for(int i = 0; i < k; i++){
        h[n - i - 1] = 0;
      }
      for(int i = 0; i < n; i++){
        ans += h[i];
      }
    }

    System.out.println(ans);
  }
}


Measured memory_bytes: 87780
import Control.Applicative
import Control.Monad
import Data.List

rec :: [Float] -> Float
rec [x] = x
rec (x:y:xs) = rec (z:xs)
    where z = (x + y) / 2

solve :: [Float] -> Float
solve = rec . sort

main :: IO ()
main = do
    _ <- getLine
    line <- map read . words <$> getLine
    print $ solve line


Measured memory_bytes: 892
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = SR()
    return l
sys.setrecursionlimit(1000000)
mod = 1000000007

#A
def A():
    a,b,c = LI()
    if a == b and b == c:
        print("Yes")
    else:
        print("No")
    return

#B
def B():
    n = I()
    s = S()
    r = s.count("R")
    if r > n//2:
        print("Yes")
    else:
        print("No")
    return

#C
def C():
    return

#D
def D():
    return

#E
def E():
    return

#F
def F():
    return

#G
def G():
    return

#H
def H():
    return

#Solve
if __name__ == "__main__":
    B()


Measured memory_bytes: 39152
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>

using namespace std;

#define rep(i, n) for(long long i = 0; i < (long long)(n); i++)
#define all(x) (x).begin(),(x).end()

using ll = long long;

int main()
{
    int N;
    string S;
    cin >> N >> S;

    if(N % 2 == 1)
    {
        cout << "No" << endl;
        return 0;
    }

    bool ans = true;
    rep(i, N / 2) 
    {
        if(S[i] != S[i + N / 2])
        {
            ans = false;
            break;
        }
    }

    if(ans) cout << "Yes" << endl;
    else cout << "No" << endl;

	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
  string s;
  cin >> s;
  
  if ((s[0] == s[1] && s[2] == s[3] && s[0] != s[2])
      || (s[0] == s[2] && s[1] == s[3] && s[0] != s[1])
      || (s[0] == s[3] && s[1] == s[2] && s[0] != s[1]) )
    cout << "Yes" << endl;
  else
    cout << "No" << endl;

  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

//AtCoder Beginner Contest 148
//B	Strings with the Same Length
public class Main {

	static final int MOD = 1000000007;

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.next());
		String S = sc.next();
		String T = sc.next();
		sc.close();

		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < N; i++) {
			sb.append(S.charAt(i));
			sb.append(T.charAt(i));
		}
		System.out.println(sb.toString());
	}
}


Measured memory_bytes: 21844
// Example program
#include <iostream>
#include <string>
using namespace std;

int main()
{
    int a=0,b=0;
  cin>>a>>b;
  //cin>>b;
  
 cout<<a*b<<" "<<(a+b)*2<<endl;
  
  //cout<<a*b<<endl;
  //cout<<(a+b)*2<<endl;
}

Measured memory_bytes: 1164
#2問目
N, M = map(int, input().split())
link1 = [False for i in range(N+1)]
link2 = [False for i in range(N+1)]
flag = False
for i in range(M):
    A, B = map(int, input().split())
    if A == 1:
        link1[B] = True
    elif B == N:
        link2[A] = True
for i in range(2, N):
    if link1[i] and link2[i]:
        print("POSSIBLE")
        flag = True
        break
if flag == False:
    print("IMPOSSIBLE")

Measured memory_bytes: 6320
K,S = map(int, input().split())
count = 0
for i in range(K,-1,-1):
    if i <= S:
        z = i
        sum_xy = S - i
        for j in range(K, -1,-1):
            if j <= sum_xy:
                y = j
                if sum_xy - j <= K:
                    count += 1
    else:
        continue
print(count)

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

vector<vector<int>> v;
vector<int> d;

void dfs(int i, int j) {
  for (auto e : v[j]) {
    if (e == i) continue;
    d[e] = d[j] + 1;
    dfs(j, e);
  }
}

int main() {
  int n;
  cin >> n;
  v = vector<vector<int>>(n);
  for (int i = 0; i < n - 1; i++) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    v[a].push_back(b);
    v[b].push_back(a);
  }
  vector<int> c(n);
  for (auto& e : c) cin >> e;
  sort(rbegin(c), rend(c));

  d = vector<int>(n);
  dfs(0, 0);
  vector<int> t(n);
  iota(begin(t), end(t), 0);
  sort(begin(t), end(t), [&](int a, int b) { return d[a] < d[b]; });

  vector<int> r(n);
  int s = 0;
  for (int i = 1; i < n; i++) s += c[i];
  for (int i = 0; i < n; i++) r[t[i]] = c[i];

  cout << s << endl;
  for (auto e : r) cout << e << " ";
  cout << endl;
}


Measured memory_bytes: 1408
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main(){
  int x, a, b;

  scanf("%d%d%d", &x, &a, &b);

  if(abs(x-a) >= abs(x-b)){
    printf("B\n");
  }else{
    printf("A\n");
  }

  return 0;
}


Measured memory_bytes: 128
n = int(input())
a = int(100/4)
b = int(100/7)
flag=False
for i in range(a+1):
  for j in range(b+1):
    if (i)*4+(j)*7==n:
      flag=True
      break
    else:
      continue
    break
if flag ==True:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 3060
package main

import (
	"fmt"
	"strings"
)

func main() {
	var s string
	fmt.Scan(&s)

	if strings.Contains(s, "a") && strings.Contains(s, "b") && strings.Contains(s, "c") {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


Measured memory_bytes: 640
import java.io.*;

class Main
{
    public static void main (String[ ] args) throws Exception
    {
        BufferedReader br = new BufferedReader (new InputStreamReader (System.in));
        StringBuffer sb = new StringBuffer();
        
        while(true)
        {
            String[] strAry = (br.readLine()).split(" ");
            int h = Integer.parseInt(strAry[0]);
            int w = Integer.parseInt(strAry[1]);
        
            if(0 == h & 0 == w)
            {
                break;
            }

            for(int i = 0; i < h; i++)
            {
                for(int j = 0; j < w; j++)
                {
                    if(0 == ((i + j) % 2))
                    {
                        sb.append("#");
                    }
                    else
                    {
                        sb.append(".");
                    }
                }
                sb.append("\n");
            }
            sb.append("\n");
        }
        System.out.print(sb);
    }
}

Measured memory_bytes: 25580