akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
#ifndef err
#define err(...)(void)0
#endif
using namespace std;
using ll = long long;
using ull = decltype(1ull);
template<class T>int size(T&&a) { return a.size(); }
#define REP(t,a)for(typename make_signed<decltype(a.second)>::type t=a.first,_l##t=a.second;t<_l##t;t++)
#define RREP(t,a)for(typename make_signed<decltype(a.second)>::type t=a.second-1,_l##t=a.first;t>=_l##t;t--)
template<class B>pair<int, B>make_pair(B b) { return{ 0,b }; }
#define rep(t,...)REP(t,make_pair(__VA_ARGS__))
#define rrep(t,...)RREP(t,make_pair(__VA_ARGS__))
#define all(a)begin(a),end(a)
#define rall(a)a.rbegin(),a.rend()

void Calc();
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr); cin.exceptions(istream::failbit | istream::badbit);
  cout << fixed << setprecision(15); Calc(); cout.flush(); return 0;
}
template<class A>void amax(A&a, A b) { a = max(a, b); }
template<class A>void amin(A&a, A b) { a = min(a, b); }
struct Scanner
{
  template<class A = string>A Next() { A a; cin >> a; return a; }
  template<class A = int>vector<A>Array(int n) { vector<A>a(n); for ( A&i : a ) cin >> i; return a; }
  string Line() const { string s; getline(cin, s); return s; }
  template<class A>Scanner&operator,(A&a) { a = Next<A>(); return *this; }
  template<class A>operator A() { return Next<A>(); }
}in;
/*---------------------------------------------------------------------*/


void Calc()
{
  string s = in;

  int n = s.size();
  ll ans = 0;
  rep(i, 1 << n)
  {
    ll a = 0;
    rep(j, n)
    {
      if ( (i >> j) & 1 )
      {
        a *= 10;
        a += s[j] - '0';
      }
      else
      {
        ans += a;
        a = 0;
      }
    }
    ans += a;
  }
  cout << (ans) << endl;
}


Measured memory_bytes: 256
en_num, hiss_num = [int(a) for a in input().split(' ')]
en_h_list = [int(b) for b in input().split(' ')]
en_h_list.sort()

aa = max(0, len(en_h_list)-hiss_num)

en_h_list = en_h_list[:aa]

print(
  sum(en_h_list)
)

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

signed main () {
    int a, b, c, k;
    cin >> a >> b >> c >> k;
    if (k <= a + b)
        cout << min(k, a) << '\n';
    else {
        k = min(k, a + b + c);
        cout << a - (k - (a + b)) << '\n';
    }
}


Measured memory_bytes: 3632
#include <string>
#include <queue>
#include <iostream>
using namespace std;
int main() {
  int n, q, t;
  int total = 0;
  cin >> n >> q;
  queue<pair<string, int>> Q;
  string name[n];
  int time[n];
  for (int i=0; i<n; i++) cin >> name[i] >> time[i];
  for (int i=0; i<n; i++)  Q.push({name[i], time[i]});

  while (! Q.empty()) {
    pair<string, int> a = Q.front();
    if (a.second - q > 0) {
      Q.pop();
      Q.push({a.first, a.second-q});
      total += q;
    } else {
      Q.pop();
      total += a.second;
      cout << a.first << " " << total << endl;
    }
  }

}


Measured memory_bytes: 6680
#include <iostream>
#include <cstdio>
#include <fstream>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <deque>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <map>
#include <stack>
#include <set>
#include <sstream>
#define IOS ios_base::sync_with_stdio(0); cin.tie(0);
#define mod 1000000007
#define eps 1e-6
#define ll long long
#define INF 0x3f3f3f3f
#define MEM(x,y) memset(x,y,sizeof(x))
#define pb push_back
#define mk make_pair
#define pi pair<int, int>
#define rep(i, a, b) for (int i = (a); i <= (b); ++i)
#define per(i,a,b) for(int i=a;i>=(b);--i)
using namespace std;
int dt[][2]= {{1,0},{-1,0},{0,1},{0,-1},{0,0}};
//typedef pair<int, int> P;
//priority_queue<int, vector<int>, greater<int> > q;
 
int n,m,q;
int a[50], b[50], c[50],d[50];
int s[15], ans=-1;
 
void dfs(int , int);
 
int main(){
    cin >> n >> m >> q;
    rep(i,1,q){
        cin >> a[i] >> b[i] >> c[i] >> d[i];
    }
    dfs(1,1);
    cout << ans << endl;
}
 
void dfs(int dep, int pre){
    if(dep==n+1){
        int sum=0;
        rep(i,1,q)
            if (s[b[i]] - s[a[i]] == c[i])
                sum+=d[i];
        ans = max(ans, sum);
        return;
    }
    rep(i,pre,m){
        s[dep] = i;
        dfs(dep + 1, i);
    }
}


Measured memory_bytes: 3192
def ans_is_zero():
    print(0)
    exit(0)

def solve():
    n=int(input())
    if n > 23: ans_is_zero()

    d=list(map(int,input().split()))
    for num in d:
        if num == 0: ans_is_zero()

    ans=0

    N = 1 << n
    for i in range(N):#left or right
        t=1
        ret = 100
        for j in range(n):
            if (i>>j)&1: num = d[j]
            else: num = 24 - d[j]

            if (t >> num)&1:
                ret = -1
                break
            t |= (1 << num)
        
        if ret == -1:
            continue

        if bin(t).count("1") < n + 1:#重複あり
            continue

        prev = 0
        for j in range(1, 24):
            if ((t>>j)&1) == 0: continue
            ret = min(ret, j - prev)
            prev = j

        ret = min(ret, 24-prev)
        ans = max(ans, ret)
    print(ans)
solve()


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

 
int main(){
    int N;
   
    int a[10010]; 
    cin >> N;
    int c = 0;
    for (int i = 0; i < N; ++i) {
        cin >> a[i];
        while(a[i] % 2 == 0){
            a[i] = a[i] / 2;
            c++;
        }
     
        }

   
    
        cout << c << endl;
    }


Measured memory_bytes: 256
def main():
    N,M=map(int,input().split())
    L=2**N
    inf=10**8
    dp=[inf for i in range(L)]
    dp[0]=0


    for i in range(M):
        a, _ = map(int, input().split())
        key=sum([2**(int(i)-1) for i in input().split()])
        for j in range(L):
                q=j|key
                dp[q]=min(dp[j]+a,dp[q])


    ans=dp[L-1]
    print(ans if ans<inf else -1)

if __name__ == '__main__':
    main()

Measured memory_bytes: 3188
n = gets.to_i
ss = n.times.map{gets.chomp}.sort
cnt = 1
max_cnt = cnt
present = ss.shift
ans_array = []
ss.each do |s|
  if s == present
    cnt += 1
  else
    if max_cnt < cnt
      ans_array = [present]
      max_cnt = cnt
    elsif max_cnt == cnt
      ans_array << present
    end
    cnt = 1
    present = s
  end
end
if max_cnt < cnt
  ans_array = [present]
  max_cnt = cnt
elsif max_cnt == cnt
  ans_array << present
end

ans_array.sort!.each do |ans|
  puts ans
end

Measured memory_bytes: 23272
import java.util.*;

public class Main {

    public static void main(String args[]) {

        // 入力
        Scanner sc = new Scanner(System.in);
        int a = Integer.parseInt(sc.next());
        int b = Integer.parseInt(sc.next());
        sc.close();

        // 主処理
        List<Integer> list = new ArrayList<>(
                Arrays.asList(new Integer[] { 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 1 }));
        String result;
        if (list.indexOf(a) < list.indexOf(b)) {
            result = "Bob";
        } else if (list.indexOf(a) > list.indexOf(b)) {
            result = "Alice";
        } else {
            result = "Draw";
        }

        // 出力
        System.out.println(result);
    }
}


Measured memory_bytes: 23124
#include <vector>
#include <complex>
#include <iostream>
using namespace std;

#define P complex<T>
#define EPS (1e-9)
typedef complex<double> point;

template<typename T>
int sig(T a){
    return a==0?0:a>0?1:-1;
}

template<typename T>
T oprod(P p1, P p2){
    return (p1.real()*p2.imag()) - (p1.imag()*p2.real());
}

template<typename T>
P isLL(P p1, P p2, P q1, P q2){
    T d = oprod(q2-q1, p2-p1);
    if(abs(d) < EPS) return NULL;
    return p1 + (oprod(q2-q1,q1-p1)/d*(p2-p1));
}

template<typename T>
vector<P> convexCut(vector<P> ps, P p1, P p2){
    int n = ps.size();
    vector<P> ans;
    for(int i=0; i<n; i++){
        int d1 = sig(oprod(p2-p1,ps[i]-p1));
        int d2 = sig(oprod(p2-p1,ps[(i+1)%n]-p1));
        if(d1 >= 0) ans.push_back(ps[i]);
        if(d1*d2<0) ans.push_back(isLL(p1,p2,ps[i],ps[(i+1)%n]));
    }
    return ans;
}

int solve(vector<point> ps){
    vector<point> as;
    as.push_back( point(-200000, +200000) );
    as.push_back( point(-200000, -200000) );
    as.push_back( point(+200000, -200000) );
    as.push_back( point(+200000, +200000) );
    int n = ps.size();
    for(int i=0; i<n; i++){
        as = convexCut(as, ps[i], ps[(i+1)%n]);
    }
    return as.empty()?0:1;
}

int main(){
    int n;
    double x, y;
    while(cin>>n,n){
        vector< point > ps;
        for(int i=0;i<n;i++){
            cin >> x >> y;
            ps.push_back( point(x,y) );
        }
        cout << solve(ps) << endl;
    }
}

Measured memory_bytes: 0
def input_int():
    return(int(input()))

def input_int_list():
    return(list(map(int,input().split())))

def input_int_map():
    return(map(int,input().split()))

def run():
    S = list(input())

    S = S[:len(S) - 1]

    for target_len in range(len(S) - 1, 1, -1):
        if target_len % 2 == 0:
            mid = target_len // 2
            first = S[:mid]
            second = S[mid:mid + mid]

            if first == second:
                print(target_len)
                return

run()




Measured memory_bytes: 62048
#include <bits/stdc++.h>
 
using namespace std;
#define ll long long
#define ld long double
#define PI 3.141592653L
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
const ll INF = (ll)1e18;
const int N = 2e6 + 6;
const ll MOD = 1e9+7;
 
int parent[N];
 
int gcd(int a, int b) { 
    if (a == 0) 
        return b;  
    return gcd(b%a, a);  
} 
   
int lcm(int a, int b) {  
    return (a*b)/gcd(a,b);  
} 
 
ll pow(ll x, ll y, ll p) {
    if(y == 0) return 1;
    ll res = 1;
    x %= p;
    if(x == 0) return 0LL;
    while(y > 0) {
        if(y & 1) res = (res*x) % p;
        y >>= 1;
        x = (x*x) % p;
    }
    return res;
}
 
int find(int x) {
    return x == parent[x] ? x : parent[x] = find(parent[x]);
}
 
void Union(int x, int y) {
    int xPar = find(x), yPar = find(y);
    if(xPar != yPar) parent[xPar] = yPar;
}
 
ll nCr(ll n, ll r) {
    ll res = 1;
    for(ll i=1;i<=r;i++) {
        res = res * (n - r + i) / i;
        // is different from
        // res *= (n -r + i) / i;
    }
    return res;
}
 
int ask(int i, int j) {
    cout << "? " << i + 1 << ' ' << j + 1 << endl;
    int v;
    cin >> v;
    return v;
}

void solve() {
    int n;
    cin >> n;
    cout << !n << endl;
    return;
} 

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


Measured memory_bytes: 3612
#include <iostream>
#include <cmath>
#include <algorithm>
using namespace std;
#define constret(b) do{a = min(a,b); }while(0)

int main(){
  int x,y,a=10000000000;
  cin >> x >> y;
  if(x==y) constret(0);
  if(x==-y) constret(1);
  if(x<0&&y>abs(x)) constret(y-abs(x)+1);
  if(y>x) constret(y-x);
  if(x<=0&&y>=0&&abs(y)<abs(x)) constret(abs(x)-abs(y)+1);
  if(x>=0&&y<=0&&abs(y)>x) constret(abs(y)-x+1);
  if(abs(y)<abs(x)&&x>0&&y>0) constret(abs(x)-abs(y)+2);
  if(x<0&&y<0&&abs(y)>abs(x)) constret(abs(y)-abs(x)+2);
  if(abs(y)<abs(x)&&x>0&&y<=0) constret(abs(x)-abs(y)+1);
  cout << a << endl;
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int min(int x,int y){
  if (x<=y){
    return x;
  }
    return y;
}

int main(){
  int N;
  scanf("%d",&N);
  int X[N];
  for(int i=0;i<N;i++){
    scanf("%d",&X[i]);
  }

  int ans=1001001001;
  for(int p=1;p<=100;p++){
    int now =0;
    for(int j=0;j<N;j++){
      now += (X[j]-p)*(X[j]-p);
    }
     ans = min(ans,now);
  }
  printf("%d",ans);

  return 0;
}

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

int main() {
  int N, K, M;
  cin >> N >> K >> M;
  vector<int> P(N,0);
  for (int i = 0; i < M; i++) {
    int x;
    cin >> x;
    P[x-1] += 1;
  }
  
  for (int i = 0; i < N; i++) {
    if (P[i] + K > M) cout << "Yes" << endl;
    else cout << "No" << endl;
  }
}

Measured memory_bytes: 1024
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <limits>
#include <numeric>

using namespace std;
typedef long long int ll;
typedef long double ld;
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }                   // 最大公約数
ll lcm(ll a, ll b) { return a * b / gcd(a, b); };                      // 最小公倍数
ll getDigit(ll num) { return log10(num) + 1; }                         // 桁数
ll digitSum(ll n) { return (n < 10) ? n : digitSum(n / 10) + n % 10; } // 各桁の和
#define MOD 1e9 + 7
#define pb push_back
#define rep(i, n) for (ll i = 0; i < n; i++)
#define repn(i, n) for (ll i = 1; i <= n; i++)
#define repi(i, a, b) for (ll i = ll(a); i < ll(b); ++i)
#define all(x) (x).begin(), (x).end()
#define PI 3.14159265359

template <typename T>
void printVector(string name, vector<T> vec)
{
    cout << name << ": ";
    rep(i, vec.size())
    {
        cout << vec[i] << " ";
    }
    cout << endl;
}

void Main()
{
    ll n, m;
    cin >> n >> m;
    vector<ll> l(m);
    vector<ll> r(m);
    rep(i, m) cin >> l[i] >> r[i];
    if (*min_element(all(r)) - *max_element(all(l)) + 1 > 0)
        cout << (*min_element(all(r)) - *max_element(all(l)) + 1) << endl;
    else
        cout << 0 << endl;

    return;
}

signed main(void)
{
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#define rep(i,a,b) for(int (i)=(a);i<(b);i++)
#define INF 100000000
#define MAX_N 1000000
using namespace std;

int main(){
    int n,m,a=0,b=0;
    cin>>n>>m;
    int ans=0;
    cin>>a;
    int z=a;
    b=a;
    rep(i,1,m){
        cin>>a;
        ans=max(a-b,ans);
        //cout<<ans<<endl;
        b=a;
    }
    //cout<<ans<<endl;
    if(ans/2<n-a&&z-1<n-a){
        cout<<n-a<<endl;
    }else{
        cout<<max(ans/2,z-1)<<endl;
    }
    return 0;
}

Measured memory_bytes: 3080
#include <cstdio>
#include <cmath>
#include <cstring>
#include <algorithm>
using namespace std;
typedef long long LL;
struct NODE {
	int x; int y;
}flag[100005];

int a[305][305], c[100005];

int main()
{
	int h, w, d, q;
	scanf("%d %d %d", &h, &w, &d);
	for(int i = 1; i <= h; i++)
		for(int j = 1; j <= w; j++)
		{
			scanf("%d", &a[i][j]);
			flag[a[i][j]].x = i;
			flag[a[i][j]].y = j;
		}
	int pp = h * w;
	int tt = pp / d;
	for(int i = 1; i <= d; i++)
	{
		int qwe = i;
		while(qwe <= pp)
		{
			qwe += d;
			if(qwe > pp) break;
			c[qwe] = abs(flag[qwe].x - flag[qwe - d].x) + abs(flag[qwe].y - flag[qwe - d].y) + c[qwe - d];
		}
	}
	for(int i = tt * d + 1; i <= pp; i++)
	{
		c[i] = c[i - d] + abs(flag[i].x - flag[i - d].x) + abs(flag[i].y - flag[i - d].y);
	}
	scanf("%d", &q);
	for(int i = 1; i <= q; i++)
	{
		int l, r;
		scanf("%d %d", &l, &r);
		int p = c[r] - c[l];
		printf("%d\n", p);
	}
}

Measured memory_bytes: 2432
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#define int long long
using namespace std;
signed main() {
	int N;
	cin >> N;
	int A = 0;
	vector<int>p(N);
	for (int i = 0; i < N; i++) {
		cin >> p[i];
		A += p[i];
	}
	sort(p.begin(), p.end()); // {1, 2, 2, 5}
	reverse(p.begin(), p.end());
	cout << A - p[0] / 2 << endl;
}

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

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

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

  string a, b, c;
  cin >> a >> b >> c;

  if (a.back() == b.front() and b.back() == c.front()) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
const bool debug=true;
// const bool debug=false;
#define DEBUG if(debug==true)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll MOD = 1000000007;

int n,a,b,k;
int h[100005];

bool check(int x){
    ll res=0;
    rep(i,n)res+=max(0, h[i]-b*x+a-b-1)/(a-b);
    // DEBUG{cout << (res<=x) << endl;}
    return res<=x;
}

int binary_search(int a, int b){
    int from=a,to=b,mid;
    while(true){
        if(to-from<=1){
            if(check(from))return from;
            return to;
        }
        mid = (to+from)/2;
        if(check(mid))to=mid;
        else from=mid;
    }
}

int main(void) {
    cin>>n>>a>>b;
    int max_h=0;
    rep(i,n){
        cin>>h[i];
        max_h=max(max_h,h[i]);
    }
    k = max_h/b+1;
    cout << binary_search(1,k) << endl;
    return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <vector>
using namespace std;

vector<int> dp0, dp1;

void Init(const string& s) {
  dp0.resize(s.size() + 1, 0);
  dp1.resize(s.size() + 1, 0);

  int ac = 0;
  for (int i = 0; i < s.size(); ++i) {
    if (s[i] == 'A' && s[i + 1] == 'C')
      ++ac;
    dp1[i + 1] = dp0[i] = ac;
  }
  dp0[s.size()] = dp0[s.size() - 1];
}

int Solve(const string& s, int l, int r) {
  return dp1[r] - dp0[l] + (s[l] == 'A' && s[l + 1] == 'C');
}

int main() {
  int n, q;
  cin >> n >> q;
  string s;
  cin >> s;
  Init(s);
  for (int i = 0; i < q; ++i) {
    int l, r;
    cin >> l >> r;
    cout << Solve(s, l - 1, r - 1) << "\n";
  }
  return 0;
}


Measured memory_bytes: 1792
#include<iostream>
#include<cstdio>
#include<cmath>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<algorithm>
#include<complex>
#include<string>
#include<cstring>
using namespace std;
#define rep2(x,from,to) for(long long x=(from);(x)<(to);(x)++)
#define rep(x,to) rep2(x,0,to)
#define INF 100000000
#define debug(x) cout<<#x<<": "<<x<<endl

#define all(x) x.begin(),x.end()
typedef pair<long long,long long> P;
typedef pair<long long,P> PP;
long long input_n;
long long ans;
long long n;
long long a[200005];
set<long long> st;
long long indeX[200005];
long long l[200005];
long long r[200005];
int main()
{
	cin>>n;
	rep(i,n)
	{
		cin>>a[i];
		indeX[a[i]-1]=i;
	}
	rep(i,n)
	{
		st.insert(indeX[i]);
		set<long long>::iterator it=st.find(indeX[i]);
		set<long long>::iterator iit=it;
		set<long long>::iterator itt=it;
		iit--;
		itt++;
		if(it==st.begin())
		{
			l[indeX[i]]=0;
		}
		else
		{
			 l[indeX[i]]=(*iit)+1;
		}
		if(itt==st.end())
		{
			r[indeX[i]]=n-1;
		}
		else
		{
			//if(indeX[i]==0)cout<<"a";
			 r[indeX[i]]=(*itt)-1;
		}
	}
	rep(i,n)
	{
		//cout<<l[i]<<" "<<r[i]<<endl;
		ans+=a[i]*(i-l[i]+1)*(r[i]-i+1);
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 15872
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<iomanip>
#include<map>
#include<set>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>
using namespace std;
#define DEBUG(x) cout<<#x<<"="<<x<<endl
#define DEBUG2(x,y) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<endl
typedef long long ll;
class Solver{
public:
    static const int MAXN=1e4+10;
    int H,N;
    int a[MAXN];
    int b[MAXN];
    int dp[MAXN*2];
    void solve(){
        ios::sync_with_stdio(false);
        cin.tie(0);
        cin>>H>>N;
        for(int u=1;u<=N;u++)
            cin>>a[u]>>b[u];
        memset(dp,0x3f,sizeof(dp));
        dp[0]=0;
        for(int u=0;u<=H;u++){
            for(int v=1;v<=N;v++){
                dp[u+a[v]]=min(dp[u+a[v]],dp[u]+b[v]) ;
            }
        }
        int ans=0x3f3f3f3f;
        for(int v=H;v<MAXN;v++)ans=min(ans,dp[v]);
        cout<<ans;
    }
};
int main()
{
    // freopen("in.txt","r",stdin);
    (new Solver())->solve();
}

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

int main() {
    string s;
    int cnt = 0, tmp;
    cin >> s;
    for (int i = 2; i < s.size() - 1; i++)
    {
        if (s[i] == 'C')
        {
            cnt++;
            tmp = i;
        }
    }
    if (s[0] != 'A' || cnt != 1)
    {
        cout << "WA" << endl;
        return 0;
    }
    
    for (int i = 1; i < tmp; i++)
    {
        if (isupper(s[i]))
        {
            cout << "WA" << endl;
            return 0;
        }
    }
    
    for (int i = tmp + 1; i < s.size(); i++)
    {
        if (isupper(s[i]))
        {
            cout << "WA" << endl;
            return 0;
        }
    }
    cout << "AC" << endl;
}


Measured memory_bytes: 256
a = input().split(" ")
K = int(input())
max = 0
k = 0
for i in range(3):
    if int(a[i]) >= max:
        max = int(a[i])
        k = i
a[k] = int(a[k]) * (2 **K)
print(int(a[0])+int(a[1])+int(a[2]))

Measured memory_bytes: 3064
from collections import Counter
s = input()
t = input()

cs = Counter(s)
ct = Counter(t)

ok = 1
for k in ct:
    if k not in cs:
        ok = 0
if not ok:
    print("-1")
    exit(0)

N = len(s)
D = [-1]*26
E = [None]*(N+1)
cA = ord('a')
for i in range(N-1, -1, -1):
    E[i+1] = D[:]
    D[ord(s[i])-cA] = i
E[0] = D

ans = 0
p = -1
for c in t:
    v = ord(c) - cA
    q = E[p+1][v]
    if q == -1:
        q = E[0][v]
        ans += q + (N - p)
    else:
        ans += (q - p)
    p = q
print(ans)

Measured memory_bytes: 35644
#include<bits/stdc++.h>
using namespace std;
int n;
int d;
int main () {
	scanf("%d%d" ,&n , &d);
	 d = 2 * d + 1;
	if(n % d == 0){
		cout << n / d <<endl;
	}
	if(n % d != 0){
		cout << (n / d) + 1 << endl;
	}
}

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

int main(void)
{
    int K, S;
    int x, y, z;
    cin >> K >> S;
    int c = 0;
    for (x=0; x<K+1; x++) {
        for (y=0; y<x+1; y++) {
            if (x + y > S) break;
            for (z=0; z<y+1; z++) {
                if (x + y + z == S) {
                    if (x!=y & x!=z & y!=z) c += 6;
                    else if (x==y & x==z & y==z) c += 1;
                    else c += 3;
                    break;
                }
            }
        }
    }
    cout << c << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void){
	int m, f, r, sum;
	do{
		scanf("%d %d %d\n", &m, &f, &r);
		sum = m+f;
		if(m==-1 && f==-1 && r==-1){
			break;
		}else if(m == -1 || f == -1){
			printf("F\n");
		}else if(sum >= 80){
			printf("A\n");
		}else if(sum >= 65){
			printf("B\n");
		}else if(sum >= 50){
			printf("C\n");
		}else if(sum >= 30){
			if(r >= 50){
				printf("C\n");
			}else{
				printf("D\n");
			}
		}else if(sum < 30){
			printf("F\n");
		}
	}while(1);
	return 0;
}



Measured memory_bytes: 2084
#include<stdio.h>
#include<stdlib.h>
/*
int size[] = {9,10};
int value[] = {5,4};
*/
#define N (sizeof(size)/sizeof(size[0]))

#define MAX_M 10000

int size[MAX_M];
int value[MAX_M];

int main(int argc, char **argv){
  int i,j;
  int m;
  int total[MAX_M];
  int choice[MAX_M];
  int repack_total;
  int k;
  int f;
  int goods_num;
  int front_choice[MAX_M];
  int tmp;

  /*
  if(argc != 2){
    fprintf(stderr,"usage:knapsack m\n");
    exit(1);
  }
  */

  if(!scanf("%d %d",&goods_num,&m)) exit(1);

  for(i = 0; i < goods_num; i++){
    if(!scanf("%d %d",&value[i],&size[i])) exit(1);
  }


  for(i = 0; i < goods_num; i++){
      for(j = goods_num-1; j > i; j--){

	if(size[j] < size[j-1] || (size[j] == size[j-1] && value[j] > value[j-1])){
	  tmp=size[j];
	  size[j]=size[j-1];
	  size[j-1]=tmp;

	  tmp=value[j];
	  value[j]=value[j-1];
	  value[j-1]=tmp;
	}
      }
    }

  /*  m = atoi(argv[1]);
  printf("size of knapsack is %d\n",m);
  if(m >= MAX_M){
    fprintf(stderr,"Size over\n");
    exit(1);
  }
  */

  for(i = 0; i <= m; i++){
    total[i] = 0;
    choice[i] = -1;
    front_choice[i] = -1;
  }

  for(i = 0; i < goods_num; i++){

    for(j = m; j >= size[i]; j--){
      f = 0;
      
/*
      for(k = j-size[i]; choice[k] >= 0; k -= size[choice[k]]){
	if(choice[k] == i){
	  f = 1;
	  break;
	}
      }
  */    

      if(!f){
	
	repack_total = total[j - size[i]] + value[i];
	
	if(repack_total > total[j]){
	  total[j] = repack_total;
	  choice[j] = i;
	}

      }
    
    }

    for(k = 0; k <= m; k++) front_choice[k] = choice[k];
    
    /*
    printf("i = %d\n",i);
    printf("total  = ");
    for(j = 0; j <= m; j++) printf("%2d ",total[j]);
    printf("\nchoice = ");
    for(j = 0; j <= m; j++) printf("%2d ",choice[j]);
    printf("\n");
    */
  }
  /*
  for(i = m; choice[i] >= 0; i -= size[choice[i]]){
    printf("\ngoods%d(size=%d, value=%d)",choice[i], size[choice[i]], value[choice[i]]);
    } 
  printf("\ntotal value = %d\n",total[m]);
  */
  printf("%d\n",total[m]);
  return 0;

}

Measured memory_bytes: 644
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef set<int> si;
typedef pair<int,int> pii;
#define rep(i,a,b) for(int i=(a); i<(b); ++i)
#define per(i,a,b) for(int i=(b)-1; i>=(a); --i)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define F first
#define S second
const int INF = 987654321;
const ll MOD = 1000000007LL;

ll ipow(ll base, ll exp)
{
    ll result = 1LL;
    for (;;)
    {
        if (exp & 1)
            result *= base;
        exp >>= 1;
        if (!exp)
            break;
        base *= base;
    }

    return result;
}

struct DisjointSet {
    vector<int> parent, rank, size;
    DisjointSet(int n) : parent(n), rank(n, 1), size(n, 1) {
        for(int i = 0; i < n; ++i) 
            parent[i] = i;
    }

    int find(int u) {
        if(u == parent[u]) return u;
        return parent[u] = find(parent[u]);
    }

    void merge(int u, int v) {
        u = find(u); v = find(v);
        if(u == v) return;
        if(rank[u] > rank[v]) swap(u, v);
        parent[u] = v;
        if(rank[u] == rank[v]) ++rank[v];
        size[v] += size[u];
    }
};

//const long double PI = (acos(-1));
//const long double EPS = 0.0000000001;
int n, m;


int main(void) {
    ios_base::sync_with_stdio(false); 
    cin.tie(0); 
    cout.tie(0);
    //freopen("in.txt", "r", stdin);
    cin >> n >> m;
    DisjointSet s(n);
    rep(i,0,m) {
        int a,b,c;
        cin >> a >> b >> c;
        s.merge(a-1,b-1);
    }
    int cnt = 0;
    rep(i,0,n) {
        if(s.find(i) == i) {
            cnt++;
        }
    }
    cout << cnt << endl;
    return 0;
}


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

int main(){
  int a,b,c;
  cin >> a >> b >> c;
  
  if(a==5 && b == 5 && c==7){
    cout << "YES" << endl;
  }else if(a==5 && b==7 && c==5){
    cout << "YES" << endl;
  }else if(a==7 && b==5 && c==5){
    cout << "YES" << endl;
  }else{
    cout << "NO" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef  long long ll;
using vll=vector<ll>;
using vvll=vector<vll>;
using vi=vector<int>;
using vvi=vector<vector<int>>;
using vb=vector<bool>;
using pii=pair<int,int>;
using vpii=vector<pair<int,int>>;
using plli=pair<ll,int>;
using vplli=vector<pair<ll,int>>;
using pllll=pair<ll,ll>;
using vpllll=vector<pair<ll,ll>>;

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

//pow(llpow,modpow)
template<class T> ll llpow(ll x,T n){ll ans=1;if(x==0)ans=0;while(n){if(n&1)ans*=x;x*=x;n>>=1;}return ans;}
long long modpow(long long a, long long n, long long mod) {long long res = 1;while (n > 0) {if (n & 1) res = res * a % mod;a = a * a % mod;n >>= 1;}return res;}
//最大公約数
template<class T> inline T gcd(T x,T y){if(y==0)return x; else {return gcd(y,x%y);}}
//最小公倍数
template<class T> inline T lcm(T x,T y){return x/gcd(x,y)*y;}
//逆元
long long modinv(long long a, long long m) {long long b = m, u = 1, v = 0;while (b) {long long t = a / b;a -= t * b; swap(a, b);u -= t * v; swap(u, v);}u %= m;if (u < 0) u += m;return u;}

#define rep(i, begin_i, end_i) for (ll i = (ll)begin_i; i < (ll)end_i; i++)
//試験導入
#define irep(i, end_i, begin_i) for (ll i = (ll)begin_i-1; i >= (ll)end_i; i--)

long long INF = 1LL<<60;
int main( ){
    int a;
    rep(i,0,5){
        cin>>a;
        if(a==0){
            cout<<i+1<<endl;
            return 0;
        }
    }
    return 0;
}




Measured memory_bytes: 3632
n=int(input())
a = list(map(int, input().split()))
m = sum(a)/n

min_i = 0
min_v = float('inf')

for i,v in enumerate(a):
    if abs(v-m) < min_v:
        min_i = i
        min_v = abs(v-m)
print(min_i)

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

int main()
{
  int N , l , r , sum ;
  sum = 0 ;
  
  cin >> N ;
  
  for (int i=0; i<N; i++)
  {
    cin >> l >> r ;
    
    sum += r-l+1 ;
  }
  
  cout << sum << endl ;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#define LEN 100005

typedef struct pp {
  char name[100];
  int t;
} P;

P Q[LEN];
int head, tail, n;

void enqueue(P x) {
  Q[tail] = x;
  tail = (tail + 1) % LEN;
}

P dequeue() {
  P x = Q[head];
  head = (head + 1) % LEN;
  return x;
}

int min(int a, int b) { return a < b ? a : b; }

int main() {
  int elaps = 0, c;
  int i, q;
  P u;
  scanf("%d %d", &n, &q);

  for ( i = 1; i <= n; i++ ) {
    scanf("%s", Q[i].name);
    scanf("%d", &Q[i].t);
  }
  head = 1; tail = n + 1;

  while ( head != tail ) {
    u = dequeue();
    c = min(q, u.t);
    u.t -= c;
    elaps += c;
    if ( u.t > 0 ) enqueue(u);
    else printf("%s %d\n", u.name, elaps);
  }

  return 0;
}


Measured memory_bytes: 11920
#include<bits/stdc++.h>
//#define int long long
#define endl '\n'
#define mod 1000000007
#define inf 1e18
#define PI 3.14159265358979323846264338327950L
#define w(x) int x; cin>>x; while(x--)
using namespace std;
bool sieve[2000006];
void sieve_make() 
{
	memset(sieve,true,sizeof(sieve));
	sieve[0]=sieve[1]=false;
	for(int i=2;i*i<2000006;i++)
	{
		if(sieve[i])
		{
			for(int j=i*i;j<2000006;j+=i)
				sieve[j]=false;
		}
	}
}

int max(int a,int b)
{
	if(a>b)
		return a;
	return b;
}
int min(int a,int b)
{
	if(a<b)
		return a;
	return b;
}
int modexp(int a,int b,int c)
{
	if(a==0) return 0;
	if(b==0) return 1;

	int ans;
	if(b%2==0)
	{
		int small=modexp(a,b/2,c);
		ans=(small*small)%c;
	}
	else
	{
		int small=modexp(a,b-1,c);
		ans=(a%c);
		ans=(small*ans)%c;
	}
	return (ans+c)%c;
}
bool sign(int x)
{
	if(x>0)
		return true;
	return false;
}
int kadane(int* a,int n)
{
	int loc=a[0],glo=a[0];
	for(int i=1;i<n;i++)
	{
		loc=max(a[i],loc+a[i]);
		glo=max(glo,loc);
	}
	return glo;
}

int dp[100001];

bool solve(vector<int>& a,int k)
{
	if(k==0)
		return 0;

	if(dp[k]!=-1)
		return dp[k];
	for(int i=0;i<a.size();i++)
	{
		if(a[i]<=k and !solve(a,k-a[i]))
			return dp[k]=1;
	}
	return dp[k]=0;
}
int32_t main()
{
	ios::sync_with_stdio(NULL);
    cin.tie(NULL);
    cout.tie(NULL);
	
	
	
	
	memset(dp,-1,sizeof dp);
	int n,k;
	cin>>n>>k;
	vector<int>a(n);

	for(int i=0;i<n;i++) cin>>a[i];


	if(solve(a,k))
		cout<<"First"<<endl;
	else
		cout<<"Second"<<endl;
}



Measured memory_bytes: 7120
#include<stdio.h>
#define MAX 100
#define INF 999999
#define WHITE 0
#define BLACK 2

void dijkstra();

int n, G[MAX][MAX];

int main()
{
  int i, j, u, v, c, k;

  scanf("%d", &n);
  for(i=0; i<n; i++)
    {
      for(j=0; j<n; j++) G[i][j] = INF;
    }

  for(i=0; i<n; i++)
    {
      scanf("%d %d", &u, &k);
      for(j=0; j<k; j++)
	{
	  scanf("%d %d", &v, &c);
	  G[u][v] = c;
	}
    } 
  
  dijkstra();
  
  return 0;
}

void dijkstra()
{
  int d[n], color[n], i, u, v, mincost;

  for(i=0; i<n; i++)
    {
      d[i] = INF;
      color[i] = WHITE;
    }

  d[0] = 0;
  while(1)
    {
      mincost = INF;
      for(i=0; i<n; i++)
	{
	  if( d[i] < mincost && color[i] != BLACK )
	    {
	      mincost = d[i];
	      u = i;
	    }
	}

      if(mincost == INF)break;

      color[u] = BLACK;

      for(v=0; v<=n; v++)
	{
	  if(G[u][v] == INF) continue;

	  if(d[v] > d[u] + G[u][v]) 
	    {
	      d[v] = d[u] + G[u][v];
	    }
	}
    }
  
  for(i=0; i<n; i++)
    {
      printf("%d %d\n", i, d[i]);
    }
}

Measured memory_bytes: 636
def main():
    N, K, S = (int(i) for i in input().split())
    if S == 10**9:
        A = [S]*K + [1]*(N-K)
    else:
        A = [S]*K + [10**9]*(N-K)
    print(*A)


if __name__ == '__main__':
    main()


Measured memory_bytes: 73140
#include<iostream>
#include<vector>
#define INF 100000000
#define MAX 1000001
using namespace std;
typedef long long ll;
signed main(){
  ll n,sz,dp[MAX],ans=INF;
  vector<ll> num;
  fill(dp,dp+MAX,INF);
  cin >> n;
  for(ll i=6;i<=n;i*=6){
    num.push_back(i);
  }
  for(ll i=9;i<=n;i*=9){
    num.push_back(i);
  }
  sz=num.size();
  dp[0]=0;
  for(int i=0;i<sz;i++){
    for(int j=num[i];j<=n;j++){
      dp[j]=min(dp[j],dp[j-num[i]]+1);
    }
  }
  ans = n;
  for(int i=n;i>=1;i--){
    if(dp[i]<INF){
      ans = min(ans,dp[i]+n-i);
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 8064
#include <algorithm>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <set>
#include <stdlib.h>
#include <string>
#include <utility>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define loop(i, x, n) for (int i = (x); i < (n); i++)
#define all(v) (v).begin(), (v).end()
#define int long long
using namespace std;
const int MOD = 1e9 + 7;
const int INF = 1e10;
template<typename T> void cmax(T &a, T b) { a = max(a, b); }
template<typename T> void cmin(T &a, T b) { a = min(a, b); }

signed main() {
  string s, t;
  cin >> s >> t;
  int s2t[26], t2s[26];
  memset(s2t, -1, sizeof(s2t));
  memset(t2s, -1, sizeof(t2s));

  rep(i, s.size()) {
    if (s2t[s[i] - 'a'] >= 0) {
      if (s2t[s[i] - 'a'] != t[i] - 'a') {
        cout << "No" << endl;
        return 0;
      }
    } else {
      s2t[s[i] - 'a'] = t[i] - 'a';
    }
    if (t2s[t[i] - 'a'] >= 0) {
      if (t2s[t[i] - 'a'] != s[i] - 'a') {
        cout << "No" << endl;
        return 0;
      }
    } else {
      t2s[t[i] - 'a'] = s[i] - 'a';
    }
  }
  cout << "Yes" << endl;
  return 0;
}


Measured memory_bytes: 776
import sys
sys.setrecursionlimit(2000000)
s=input()
d='dream'
dr='dreamer'
e='erase'
er='eraser'
l=len(s)
def solve(s,end):
    if end==-1:
        print('YES')
        exit(0)
    if s[end-6:end+1]==dr:
        end-=7
    elif s[end-5:end+1]==er:
        end-=6
    elif s[end-4:end+1]==e or s[end-4:end+1]==d:
        end-=5
    else:
        print('NO')
        exit(0)
    solve(s,end)
solve(s,l-1)

Measured memory_bytes: 47856
#-*-coding:utf-8-*-

def main():
    a, b, x = map(int, input().split())

    start = -(-a // x)
    end = b // x
    #print(start, end)
    if start <= end:
        ans = end - start + 1
    else:
        ans = 0
    print(ans)

if __name__ == '__main__':
    main()

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

// macro
#define rep(i,n) for(int i=0;i<n;i++)
#define ll long long
#define all(v) v.begin(), v.end()

// code starts

int main()
{
  int n,k;cin>>n>>k;
  vector<int> v(n);
  int i,j,l;
  rep(i,n)cin>>v[i];
  int ans=0;
  for(i=0;i<=min(n,k);i++)
  {
    int kans=0;
    priority_queue<int,vector<int>,greater<int>> got;
    priority_queue<int> rev;
    rep(l,i)
    {
      kans+=v[l];
      got.push(v[l]);
    }
    int left=k-i;
    while(left>0&&!got.empty())
    {
      int val=got.top();
      if(val>=0)break;
      kans-=val;
      left--;
      got.pop();
      rev.push(val);
    }
    ans=(kans>ans)?kans:ans;
    for(j=1;j<=min(n-i,k-i);j++)
    {
      if(v[n-j]>=0)
      {
        got.push(v[n-j]);
        kans+=v[n-j];
        left--;
      }
      else
      {
        rev.push(v[n-j]);
        left-=2;
      }
      while(left<0)
      {
        int tp=rev.top();
        kans+=tp;
        got.push(tp);
        rev.pop();
        left++;
      }
      ans=(kans>ans)?kans:ans;
    }
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
 string S;
 cin >> S;
 if(S.at(0)=='S')
 {
     cout << "Cloudy"<<endl;
 }
 if(S.at(0)=='C')
 {
     cout << "Rainy"<<endl;
 }
 if(S.at(0)=='R')
 {
     cout << "Sunny"<<endl;
 }
}


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


using namespace std;


#define ll long long
#define mk make_pair
#define pb push_back
#define fi first
#define se second
#define all(x) x.begin(), x.end()
#define sz(x) (int) (x).size()


ll sum(int n);

void go(){
	string s;cin>>s;
	cout << s.substr(0,3);
}
int main(){
   
   ios_base::sync_with_stdio(0);
   cin.tie(0);
   cout.tie(0);

   go();

   return 0;
}

ll sum(int n){                
   if(n == 0){
      return n;
   }else{
      return sum(n/10) + n%10;
   }
}


Measured memory_bytes: 3644
def shave(m):
    m_root = int(m**0.5)
    candidate = [i for i in range(3,m+1,2)]
    for i in range(3,m_root+2,2):
        candidate = [ j for j in candidate if j == i or j % i != 0]   
    candidate = [2] + candidate
    return candidate

def comb(a,b,m):
	if b == 0 or b == a:
		ret = 1
	else:
		ret = 1
		for i in range(a-b+1,a+1):
			ret = (ret * i) % m
		for i in range(1,b+1):
			ret = (ret * pow(i,m-2,m) ) % m
	return ret

mod = 10**9+7
prime_list = shave(int(33333))

n, m = [ int(v) for v in input().split() ]

p_list = []

for i in prime_list:
    if m == 1:
        break
    elif m % i == 0:
        q = 0
        while m % i == 0:
            m //= i
            q += 1
        p_list.append(q)
if m != 1:
    p_list.append(1)

ans = 1
for i in p_list:
    ans *= comb(i+n-1,n-1,mod)
    ans %= mod
print(ans)

Measured memory_bytes: 41052
#include<bits/stdc++.h>
using namespace std;
long long arr[1000000];
int main()
{
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);   
    long long n,k,x,y,z;
    cin>>n>>k;
    x=n%k;
    y=k-x;
    cout<<min(x,y)<<endl;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include<iostream>
#include<vector>
#include<cstdio>
#include<string>
#include<algorithm>
#include <sstream>
#include<map>
#include<cmath>
#include<queue>
#include <functional>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define PI 3.141592

using namespace std;

int main() {
	int N;
	cin >> N;
	vector<double> vNum(N,0);
	rep(i, N) cin >> vNum[i];

	double tmp = 0;
	rep(i, N)
	{
		tmp += 1.0f / vNum[i];
	}

	double result = 1 / tmp;


	printf("%.10f", result);
}


Measured memory_bytes: 256
N,M = map(int,input().split())
AC_list = [0]*N
Pena_list = [0]*N
for i in range(M):
    p,s = input().split()
    p = int(p)
    if s == "WA":
        if AC_list[p-1] == 1:
            continue
        else:
            Pena_list[p-1] += 1
    else:
        AC_list[p-1] = 1
for i in range(N):
    if AC_list[i] == 0:
        Pena_list[i] = 0
print(AC_list.count(1),end=" ")
print(sum(Pena_list))


Measured memory_bytes: 4596
#include <bits/stdc++.h>
#define maxn 300005
#define MP make_pair
#define PB push_back
#define fore(i, l, r) for(int i = int(l); i < int(r); i++)
#define forn(i, n) fore(i, 0, n)

#define sz(a) int((a).size())

using namespace std;

mt19937 rnd(chrono::system_clock::now().time_since_epoch().count());
// shuffle(begin, end, rnd), rnd() % n

typedef long long ll;
typedef pair<int, int> PII;

int main() {
    int N;
    string s;
    cin >> N >> s;
    int r = 0, b = 0;
    forn (i, N) {
        if (s[i] == 'R')
            ++r;
        else
            ++b;
    }
    if (r > b)
        printf ("Yes\n");
    else
        printf ("No\n");

    return 0;
}



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

int main() {
	string n;
	cin>>n;
	bool ok=false;
	for(int i=0; i<n.size(); i++){
		if(n[i] == '7'){
			ok=true;
			break;
		}
		
	}
	if(ok) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
}

Measured memory_bytes: 3060
#import time
import numpy as np
from math import *

def main():
    A, B, H, M = list(map(int, input().split()))
    pai = 3.1415926535897323846264338327950
    kakuH = H*360/12 + M*30/60
    kakuM = M*360/60
    kakuS = absolute(kakuH, kakuM)
    #print(kakuH, kakuM, kakuS)
    ans =(A**2 + B**2 - 2*A*B*cos(radians(kakuS)) )**(1/2)

    return ans

def absolute(a, b):
    if a>=b:
        if a-b>180:
            return 360-(a-b)
        else:
            return a-b
    else:
        if b-a>180:
            return 360-(b-a)
        else:
            return b-a

if __name__ == '__main__':
    #start = time.time()
    print(main())
    #elapsed_time = time.time() - start
    #print("経過時間:{}".format(elapsed_time * 1000) + "[msec]")

Measured memory_bytes: 27220
#include <bits/stdc++.h>
#define ll long long
#define INF 1000000005
#define MOD 1000000007
#define EPS 1e-10
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define srep(i,s,t) for(int i=(int)(s);i<(int)(t);++i)
#define each(a,b) for(auto& (a): (b))
#define all(v) (v).begin(),(v).end()
#define len(v) (int)(v).size()
#define zip(v) sort(all(v)),v.erase(unique(all(v)),v.end())
#define cmx(x,y) x=max(x,y)
#define cmn(x,y) x=min(x,y)
#define fi first
#define se second
#define pb push_back
#define show(x) cout<<#x<<" = "<<(x)<<endl
#define sar(a,n) cout<<#a<<":";rep(pachico,n)cout<<" "<<a[pachico];cout<<endl

using namespace std;

template<typename S,typename T>auto&operator<<(ostream&o,pair<S,T>p){return o<<"{"<<p.fi<<","<<p.se<<"}";}
template<typename T>auto&operator<<(ostream&o,set<T>s){for(auto&e:s)o<<e<<" ";return o;}
template<typename S,typename T,typename U>
auto&operator<<(ostream&o,priority_queue<S,T,U>q){while(!q.empty())o<<q.top()<<" ",q.pop();return o;}
template<typename K,typename T>auto&operator<<(ostream&o,map<K,T>m){for(auto&e:m)o<<e<<" ";return o;}
template<typename T>auto&operator<<(ostream&o,vector<T>v){for(auto&e:v)o<<e<<" ";return o;}
void ashow(){cout<<endl;}template<typename T,typename...A>void ashow(T t,A...a){cout<<t<<" ";ashow(a...);}

typedef pair<int,int> P;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef vector<P> vp;
typedef vector<double> vd;
typedef vector<string> vs;

const int MAX_N = 55;

int a[MAX_N], b[MAX_N];
vi ad;

// k 以下とその他
void build(vvi& G, int k)
{
    srep(i,1,51){
        srep(j,1,min(i,k)+1){
            G[i].pb(i%j);
        }
        each(j,ad){
            if(j <= i) G[i].pb(i%j);
        }
    }
}

bool dfs(int u, const int t, vvi& G)
{
    if(u == t) return true;
    each(v, G[u]){
        if(dfs(v, t, G)) return true;
    }
    return false;
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    rep(i,n){
        cin >> a[i];
    }
    rep(i,n){
        cin >> b[i];
    }
    ll ans = 0;
    for(int k = 51; k >= 1; k--){
        bool ok = true;
        vvi G(51);
        build(G, k-1);
        rep(i,n){
            if(!dfs(a[i], b[i], G)){
                ok = false;
                break;
            }
        }
        if(!ok){
            if(k == 51){
                cout << "-1\n";
                return false;
            }else{
                ans += 1LL << k;
                ad.pb(k);
            }
        }
    }
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define RS(X) scanf("%s", (X))
#define CASET int ___T, case_n = 1; scanf("%d ", &___T); while (___T-- > 0)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
#define RF(x) freopen(x,"r",stdin)
#define WF(x) freopen(x,"w",stdout)
typedef long long LL;
using namespace std;
typedef pair<LL,LL> PLL;
typedef pair<int,int> PII;
const LL MOD = 1e9+7;
const int SIZE = 1e6+5;
const LL INF = 1LL<<62;
const double eps = 1e-4;
const double PI=3.1415926535897932;

LL x[100009];
LL dp[2][100009];
LL rs[2][100009];

int main(){
	DRI(n);LL a,b;
	scanf("%lld%lld",&a,&b);
	REP(i,n)scanf("%lld",&x[i]);
	x[n]=INF;
	rs[0][0]=rs[1][0]=dp[0][0]=dp[1][0]=1;
	int ap=-1,bp=-1;
	REPP(i,1,n+1){
		int p2=upper_bound(x,x+i-1,x[i]-b)-x;
		if(p2>=ap-1){
			if(p2>=0)dp[0][i]+=rs[1][p2];
			if(ap>=1)dp[0][i]-=rs[1][ap-1];
		}
		p2=upper_bound(x,x+i-1,x[i]-a)-x;
		if(p2>=bp-1){
			if(p2>=0)dp[1][i]+=rs[0][p2];
			if(bp>=1)dp[1][i]-=rs[0][bp-1];
		}
		if(x[i]-x[i-1]<a)ap=i;
		if(x[i]-x[i-1]<b)bp=i;
		//if(ap==-1)dp[0][i]++;
		//if(bp==-1)dp[1][i]++;
		rs[0][i]=(rs[0][i-1]+dp[0][i])%MOD;
		rs[1][i]=(rs[1][i-1]+dp[1][i])%MOD;
	}
	/*REP(i,n+1){
		printf("%lld %lld\n",dp[0][i],dp[1][i]);
	}*/
	printf("%lld",((dp[0][n]+dp[1][n])%MOD+MOD)%MOD);
}


Measured memory_bytes: 4224
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define FORR(i, m, n) for (int i = (m); i >= (n); --i)
#define equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const ll mod2 = 998244353;
const ll INF = 1e18;
const long double EPS = 1e-10;

int main() {
  vector<int> a(3);
  rep(i, 3) cin >> a[i];

  sort(a.begin(), a.end());
  int ans = 0, res = 0;
  rep(i, 3) {
    if (a[i] != res) {
      ans++;
      res = a[i];
    }
  }
  cout << ans << endl;


  
  return 0;
}

Measured memory_bytes: 256
#####
# C #
#####

N = int(input())
A = list(map(int,input().split()))

key = A[0]
ans = 0

for a in A:
    if  a < key:
        ans += key - a
        # print(a,key-a,ans,'debug')
    else:
        key = a

print(ans)


Measured memory_bytes: 105092
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(v) v.begin(), v.end()
typedef long long ll;

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

int main(){
  int h;
  while(cin>>h){
    if(h==0) return 0;
    
    vector<int> A[5];
    int x;
    rep(i,h){
      rep(j,5){
        cin>>x;
        A[j].push_back(x);
      }
    }
    rep(i,5) reverse(ALL(A[i]));
    rep(i,10){
      rep(j,5) A[j].push_back(0);
    }
    
    int ans=0;
    rep(i,10){
      for(int j=9;j>=0;j--){
        if(A[0][j]!=0 && A[0][j]==A[1][j] && A[0][j]==A[2][j] &&
           A[0][j]==A[3][j] && A[0][j]==A[4][j]){
          ans+=5*A[0][j];
          rep(k,5) A[k].erase(A[k].begin()+j);
        }
        else if(A[0][j]!=0 && A[0][j]==A[1][j] && A[0][j]==A[2][j] &&
           A[0][j]==A[3][j]){
          ans+=4*A[0][j];
          rep(k,4) A[k].erase(A[k].begin()+j);
        }
        else if(A[1][j]!=0 && A[1][j]==A[2][j] && A[1][j]==A[3][j] &&
           A[1][j]==A[4][j]){
          ans+=4*A[1][j];
          for(int k=1;k<=4;k++) A[k].erase(A[k].begin()+j);
        }
        else if(A[0][j]!=0 && A[0][j]==A[1][j] && A[0][j]==A[2][j]){
          ans+=3*A[1][j];
          for(int k=0;k<=2;k++) A[k].erase(A[k].begin()+j);
        }
        else if(A[1][j]!=0 && A[1][j]==A[2][j] && A[1][j]==A[3][j]){
          ans+=3*A[1][j];
          for(int k=1;k<=3;k++) A[k].erase(A[k].begin()+j);
        }
        else if(A[2][j]!=0 && A[2][j]==A[3][j] && A[2][j]==A[4][j]){
          ans+=3*A[2][j];
          for(int k=2;k<=4;k++) A[k].erase(A[k].begin()+j);
        }
      }
    }
    cout<<ans<<endl;
  }
  
  return 0;
}


Measured memory_bytes: 3128
#include <bits/stdc++.h>
using namespace std;
const int sz=1e5+9;
map<string,int> m;
long long ans;
string s;
int n;

int main()
{
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    scanf("%d",&n);
    while(n--){
        cin>>s;
        sort(s.begin(),s.end());
        m[s]++;
    }
    for(auto u:m){
        if(u.second==1) continue;
        long long k=u.second;
        ans+=k*(k-1)/2;
    }
    printf("%lld",ans);
    return 0;
}


Measured memory_bytes: 11136
#include<stdio.h>
#include<ctype.h>
#include<string.h>

int main(){
	char kata[1300];
	scanf("%[^\n]", kata);
	int len = strlen(kata);
//	printf("%d", len);
	for(int i=0; i<len; i++){
		if(isupper(kata[i])) kata[i]=tolower(kata[i]);
		else if(islower(kata[i])) kata[i]=toupper(kata[i]);
	}
		printf("%s\n", kata);
}


Measured memory_bytes: 2624