akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
int a[13][13];
int c[13];
int n,m,x;
int napzak(int bo, vector<int> v);
int main(){

        cin >> n >> m >> x;
        int cc, aa;
        for(int i = 0; i < n; i++){
                cin >> cc;
                c[i] = cc;
                for(int j = 0; j < m; j++){
                        cin >> aa;
                        a[i][j] = aa;
                }
        }
        vector<int> v;
        for(int i = 0; i < m; i++){
                v.push_back(0);
        }

        int ans = napzak(0, v);
        if(ans == 10000000)ans = -1;
        cout << ans << endl;


}


int napzak(int bo, vector<int> v){
        int ret;
        if(bo == n){
                bool tf = true;
                for(int i = 0; i < v.size(); i++){
                        if(v[i] < x)tf = false;
                }
                if(tf){
                        ret = 0;
                }else ret = 10000000;
        }

        else{

                int e = napzak(bo + 1, v);


                for(int i = 0; i < m; i++){
                        v[i] += a[bo][i];
                }

                int d = napzak(bo + 1, v) + c[bo];
                ret = min(e, d);
        }

        return ret;


}


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

#define rep(i,n) for(int i;i<(int)(n);i++)
#define Rep(i,n) for(int i;i<=(int)(n);i++)
#define all(v) v.begin,v.end
using namespace std;
using ll = long long;
using P = pair<int,int>;
const int MX = 1000005;

int main(){
    int n,k;
    cin>>n>>k;
    vector<int>a(n,0);
    rep(i,n) cin>>a[i];
    rep(i,n-k){
        if(a[i]<a[k+i]) cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
    }
}

Measured memory_bytes: 4052
#include<bits/stdc++.h>
using namespace std;
#define rep(j,n) for(int i=(int)(j);i<(int)(n);i++)
int main(){
  int N;
  cin>>N;
  vector<int> A(N);
  rep(0,N) cin>>A[i];
  sort(A.begin(),A.end());
  int ans=A[N/2]-A[N/2-1];
  cout<<ans<<endl;
}


Measured memory_bytes: 640
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000

int a[3][100010];
int dp[3][100010]; //dp[i][j]:= j日目の日にi個目を選んだときの最大値

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N; cin >> N;
    rep(i, N) rep(j, 3) cin >> a[j][i];
    rep(i, 3) dp[i][0] = a[i][0];
    REP(i, 1, N - 1) {
        rep(j, 3) dp[j][i] = max(dp[(j + 1) % 3][i - 1], dp[(j + 2) % 3][i - 1]) + a[j][i];
    }
    cout << max({dp[0][N - 1], dp[1][N - 1], dp[2][N - 1]}) << endl;


    return 0;
}


Measured memory_bytes: 2560
def grade(m, f, r):
    if m == -1 or f == -1:
        return 'F'
    s = m + f
    if s >= 80:
        return 'A'
    elif s >= 65:
        return 'B'
    elif s >= 50:
        return 'C'
    elif s < 30:
        return 'F'
    elif r >= 50:
        return 'C'
    else:
        return 'D'


while True:
    m, f, r = map(int, input().split())
    if m == f == r == -1:
        break
    print(grade(m, f, r))

Measured memory_bytes: 7628
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

fn main() {
    let v = read_vec::<usize>();
    let (n, m) = (v[0], v[1]);
    let mut d = vec![];
    for i in 0..m {
        let v = read_vec::<usize>();
        d.push((v[0] - 1, v[1]));
    }
    let mut nums = vec![10; n]; // 10 is unset
    for (s, c) in d {
        if s == 0 && c == 0 && n != 1 {
            println!("-1");
            return;
        }
        if nums[s] != 10 && nums[s] != c {
            println!("-1");
            return;
        }
        nums[s] = c;
    }
    for (i, num) in nums.into_iter().enumerate() {
        if i == 0 && num == 10 && n != 1 {
            print!("{}", 1);
        } else if num == 10 {
            print!("{}", 0);
        } else {
            print!("{}", num);
        }
    }
    println!("");
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define int int64_t
#define REP(i, n) for (int i = 0; (i) < (int)(n); ++ (i))
#define REP3(i, m, n) for (int i = (m); (i) < (int)(n); ++ (i))
#define REP_R(i, n) for (int i = (int)(n) - 1; (i) >= 0; -- (i))
#define REP3R(i, m, n) for (int i = (int)(n) - 1; (i) >= (int)(m); -- (i))
#define REPP(i, n) for (int i = 1; (i) < (int)(n+1); ++ (i))
#define REPR(i, n) for (int i = (int)(n) - 1; (i) >= 0; -- (i))
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define FORR(i, m, n) for(int i=(m)-1; i>=(n); i--)
#define ALL(v) v.begin(), v.end()
#define SZ(a) int((a).size())
#define SORT(c) sort((c).begin(),(c).end())
#define SORTR(c) sort((c).begin(),(c).end(),greater<int>());
#define BIT(n) (1LL<<(n))
#define PCNT(x) __builtin_popcountll(x)
#define GCD(x,y) __gcd(x,y)
#define LCM(x,y) x/__gcd(x,y)*y
#define PB push_back
#define MP make_pair
#define endl "\n"
#define yes cout << "Yes" << endl
#define no cout << "No" << endl
using namespace std;
using Graph = vector<vector<int> >;
using WeightedGraph = vector<vector<pair<int, int> > >;
typedef long double LD;
typedef vector<int> VI;
typedef vector<vector<int> > VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
const int INF = 2000000000;
const long double PI = acosl(-1);
const int MOD = 1000000007;
void print() {cout << endl;}
template <class Head, class... Tail> void print(Head&& head, Tail&&... tail) {cout << head; if (sizeof...(tail) != 0) cout << " ";print(forward<Tail>(tail)...);}
template <class T> void print(vector<T> &vec) {for (auto& a : vec) {cout << a; if (&a != &vec.back()) cout << " ";} cout << endl;}
template <class T> void print(vector<vector<T>> &df) { for (auto& vec : df) { print(vec);}}


signed main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    cout << fixed << setprecision(10);
    int ans = 0;
    
    int D, T, S;
    cin >> D >> T >> S;
    if ((LD)D/S <= T) yes;
    else no;
    
    
    
    return 0;
}

/*
cd ~/Desktop/Programming/AtCoder/contest/abc177/abc177_a && sh shellscripts/test_cpp.sh
cd ~/Desktop/Programming/AtCoder/contest/abc177/abc177_a && sh shellscripts/etest_cpp.sh
cd ~/Desktop/Programming/AtCoder/contest/abc177/abc177_a && sh shellscripts/submit_cpp.sh
*/


Measured memory_bytes: 3636
#include <iostream>
#include <cstdio>
#define MAXN 100005
//#define ivorysi
using namespace std;
typedef long long int64;
typedef double db;
int N;
int64 S,X[MAXN],P[MAXN],ans;
void Solve() {
    scanf("%d%lld",&N,&S);
    for(int i = 1 ; i <= N ; ++i) {
        scanf("%lld%lld",&X[i],&P[i]);
    }
    int L = 1,R = N;
    int dir = 0;
    while(1) {
        if(X[L] >= S) {ans += X[R] - S;break;}
        if(X[R] <= S) {ans += S - X[L];break;}
        if(P[L] >= P[R]) {
            if(dir != 1) {dir = 1;ans += X[R] - X[L];}
            P[L] += P[R];R--;
        }
        else {
            if(dir != 2) {dir = 2;ans += X[R] - X[L];}
            P[R] += P[L];L++;
        } 
    }
    printf("%lld\n",ans);
}
 
int main() {
#ifdef ivorysi
    freopen("f1.in","r",stdin);
#endif
    Solve();
    return 0;
}

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

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

    int n;
    cin >> n;
    vector<int> h(n+1);
    rep(i,n) cin >> h[i+1];
    
    vector<int> dp(n+1, INF);
    dp[0] = dp[1] = 0;
    dp[2] = abs(h[2] - h[1]);
    
    for(int i=3; i<=n; i++){
        dp[i] = min(dp[i-1]+abs(h[i] - h[i-1]), dp[i-2]+abs(h[i] - h[i-2]));
    }
    
    cout << dp[n] << endl;

    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <set>

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,j) FOR(i,0,j)
#define mp std::make_pair

const int INF = 1 << 24;
const int dx[8] = {0, 0, 1, -1, 1, 1, -1, -1}, dy[8] = {1, -1, 0, 0, 1, -1, 1, -1};

typedef unsigned long long ull;

bool isPrime[10000001];
std::vector<int> P, PQ;

int main(){
    std::fill(isPrime, isPrime+10000001, true);
    isPrime[0] = false;
    isPrime[1] = false;
    for(int i=4;i<=10000000;i+=2){
        isPrime[i] = false;
    }

    P.push_back(2);
    for(int i=3;i<=10000000;i+=2){
        if(isPrime[i]){
            P.push_back(i);
            for(int j=i*2;j<=10000000;j+=i){
                isPrime[j] = false;
            }
        }
    }
    
    for(int i=0;i+4<=P.size();i++){
        if(P[i]+2 == P[i+1] && P[i+1]+4 == P[i+2] && P[i+2]+2 == P[i+3]){
            //std::cout << P[i+3] << std::endl;
            PQ.push_back(P[i+3]);
        }
    }

    int n;
    while(std::cin >> n, n){
        std::cout << PQ[std::upper_bound(PQ.begin(), PQ.end(), n)-PQ.begin()-1] << std::endl;
    }
}

Measured memory_bytes: 15612
def gcd(a,b):
  amari = a % b
  if amari == 0:
    return b
  else:
    return gcd(b, amari)

K=int(input())
ans=0
for a in range(1,K+1):
  for b in range(1,K+1):
    ab=gcd(a,b)
    if ab == 1:
      ans += K
    else:
      for c in range(1,K+1):
        ans += gcd(ab,c)
print(ans)

Measured memory_bytes: 9144
#include <stdio.h>
#include <stdlib.h>

int main()
{
    int x,i,n,m,a,b,c;
    while(~scanf("%d",&n))
    {
        if(n==1)
        {
            printf("Hello World\n");
        }
        else
        {
            scanf("%d",&a);
            scanf("%d",&b);
            printf("%d\n",a+b);
        }
    }
    return 0;
}


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

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

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

ll dp[100010];

int main(){
    int n,m;
    vector<int> a(100010,-1);
    int tmp;
    cin >> n >> m;
    rep(i,m){
        cin >> tmp;
        a[tmp] = 1;
    }
    ll count = 0;
    rep(i,100010) dp[i] = 0;
    dp[0] = 1;
    if(a[1] != 1) dp[1] = 1;
    for(int i = 2; i < n+1; ++i){
        if(a[i] != 1) { 
            dp[i] += dp[i-2];
            dp[i] += dp[i-1];
        }
        if(dp[i] > 100000007) dp[i] %= 1000000007;
    }
    cout << dp[n] << endl;
    return 0;
}


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

string sdiv[4] = {"dream", "dreamer", "erase", "eraser"};

int main() {
    string s;
    cin >> s;

    reverse(s.begin(), s.end());
    for (int i = 0; i < 4; ++i)
    {
        reverse(sdiv[i].begin(), sdiv[i].end());
    } 

    bool f = true;
    for (int i = 0; i < s.size();) 
    {
        bool fdiv = false; 
        for (int j = 0; j < 4; ++j) 
        {
            string d = sdiv[j];
            if (s.substr(i, d.size()) == d) 
            {
                fdiv = true;
                i += d.size(); 
            }
        }
        if (!fdiv) 
        {
            f = false;
            break;
        }
    }

    if (f) cout << "YES" << endl;
    else cout << "NO" << endl;
}

Measured memory_bytes: 512
int main(int argc, const char * argv[]) {
    long long a[101][101]={0};
    long long b[101][101]={0};
    long long c[101][101]={0};
    int n, m ,l;
    int i, j, k;
    scanf("%d %d %d", &n, &m, &l);
    
    //aに代入
    for (i=1; i<=n; i++) {
        for (j=1; j<=m; j++) {
            scanf("%lld", &a[i][j]);
        }
    }
    //bに代入
    for (i=1; i<=m; i++) {
        for (j=1; j<=l; j++) {
            scanf("%lld", &b[i][j]);
        }
    }
    
    //a
//    for (i=1; i<=n; i++) {
//        for (j=1; j<=m; j++) {
//            printf("%lld ", a[i][j]);
//        }
//        printf("\n");
//    }
    
    //b
//    for (i=1; i<=m; i++) {
//        for (j=1; j<=l; j++) {
//            printf("%lld ", b[i][j]);
//        }
//        printf("\n");
//    }
    //printf("bに代入完了\n");
    //cを計算
    for (i=1; i<=n; i++) {
        for (j=1; j<=l; j++) {
            //一項分
            for (k=1; k<=m; k++) {
                c[i][j] += a[i][k]*b[k][j];
            }
        }
    }
    
    //cを印字
    for (i=1; i<=n; i++) {
        for (j=1; j<=l-1; j++) {
            printf("%lld ", c[i][j]);
        }
        printf("%lld\n", c[i][l]);//最後に空白(' ')を残さないために，行の最後だけ分ける
    }
    return 0;
}


Measured memory_bytes: 2104
#include <string>
#include <iostream>
using namespace std;
string s[5];
bool solve(int l, int r, int e) {
	if (s[e][l] == 'T') return true;
	if (s[e][l] == 'F') return false;
	if (s[e][l] == '-') return !solve(l + 1, r, e);
	int d = 0;
	for (int i = l + 1; i < r - 1; i++) {
		if (s[e][i] == '(') d++;
		if (s[e][i] == ')') d--;
		if (!d && s[e][i] == '*') return solve(l + 1, i, e) && solve(i + 1, r - 1, e);
		if (!d && s[e][i] == '+') return solve(l + 1, i, e) || solve(i + 1, r - 1, e);
		if (!d && s[e][i] == '-' && s[e][i + 1] == '>') return !solve(l + 1, i, e) || solve(i + 2, r - 1, e);
	}
	return true;
}
int main() {
	while (cin >> s[0], s[0] != "#") {
		for (int i = 0; i < s[0].size(); i++) {
			if (s[0][i] == '=') {
				s[1] = s[0].substr(0, i);
				s[2] = s[0].substr(i + 1, s[0].size() - i - 1);
			}
		}
		bool flag = true;
		for (int i = 0; i < 2048; i++) {
			s[3] = s[1], s[4] = s[2];
			for (int j = 0; j < 11; j++) {
				for (int k = 0; k < s[3].size(); k++) {
					if (s[1][k] == j + 97) s[3][k] = (i & (1 << j)) ? 'T' : 'F';
				}
				for (int k = 0; k < s[4].size(); k++) {
					if (s[2][k] == j + 97) s[4][k] = (i & (1 << j)) ? 'T' : 'F';
				}
			}
			if (solve(0, s[3].size(), 3) != solve(0, s[4].size(), 4)) {
				flag = false; break;
			}
		}
		printf("%s\n", flag ? "YES" : "NO");
	}
	return 0;
}

Measured memory_bytes: 3232
#include<bits/stdc++.h>
using namespace std;
#define endl '\n'
#define ll  long long
#define FASTINOUT ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
const int N=3009;
int main()
{
    FASTINOUT;
    int x,k;
    cin>>x>>k;
    int y[x];
    for (int i=0;i<x;i++)
        cin>>y[i];
    sort(y,y+x);
    int sum=0;
    for (int i=0;i<k;i++)
        sum+=y[i];
    cout<<sum;
    return 0;
}


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

#include <iostream>
#include <algorithm>

using namespace std;

#define abs (x)(x>0?x:-x)


int main()
{
	int N;
	int A[200000];
	int B[200000];

	scanf("%d", &N);

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

	sort(B, B+N);

	for (int i = 0; i < N; i++)
	{
		if (A[i] == B[N - 1])
			printf("%d\n", B[N - 2]);
		else
			printf("%d\n", B[N - 1]);
	}
}

Measured memory_bytes: 3200
n = int(input())
S = list(map(int, input().split()))
q = int(input())
T = list(map(int, input().split()))
 
count = 0
for key in T:
    left = 0
    right = n
    while left < right:
        mid = (right + left) // 2
        if S[mid] == key:
            count = count + 1
            break
        if key < S[mid]:
            right = mid
        else:
            left = mid + 1
print(count)

Measured memory_bytes: 18560
// AGC010_A
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <iterator>  // std::back_inserter()
#include <tuple>  // std::tuple std::get
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <queue>
#include <algorithm>  // std::copy()
#include <functional>  // std::greater<T>()
#include <utility>  // std::swap()
#include <numeric>  // accumulate(ALL(vec), 0)  0 は初期値
#include <bitset>  // static_cast<std::bitset<8>>
#include <sstream>  // std::stringstream
#include <cmath>
#include <climits>  // INT_MIN
#include <cctype>  // std::isdigit()
#include <iomanip>  // std::setprecision()
using namespace std;

#define ALL(obj) (obj).begin(), (obj).end()
#define REP(i, n) for (ll i=0; i < n; i++)  // 0 ~ n-1
#define REPN(i, n) for (ll i=1; i <= n; i++)  // 1 ~ n
#define MIN(vec) min_element(ALL((vec)))  // イテレータのため、値を取り出すときは * を先頭につける
#define MAX(vec) max_element(ALL((vec)))
#define IDX(vec, element_iter) distance((vec).begin(), element_iter)
#define SUM(vec) accumulate(ALL((vec)), 0LL)  // 0 は初期値
#define COPY(vec1, vec2) copy(ALL(vec1), back_inserter(vec2))  // vec1をvec2にコピーする vec2は空にしておく必要あり
#define zero_pad(num) setfill('0') << std::right << setw(num)
#define space_pad(num) setfill(' ') << std::right << setw(num)

typedef long long ll;

const ll MOD7 = 1000000007;  // 1 000 000 007
const ll MOD9 = 1000000009;  // 1 000 000 009

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

    // input
    ll N, odd_num = 0, even_num = 0;  // odd: 奇数
    cin >> N;
    vector<ll> vec(N);
    REP(i, N) {
        cin >> vec[i];
        if (vec[i]%2 == 0) {
            even_num++;
        } else {
            odd_num++;
        }
    }
    
    // calculation
    if (odd_num == 0) {
        // 奇数がなければ
        cout << "YES" << "\n";
    } else if (odd_num%2 == 0) {
        // 奇数が偶数個なら
        cout << "YES" << "\n";
    } else {
        // 奇数が奇数個なら
        cout << "NO" << "\n";
    }
    
    return 0;
}


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

int main() {
  int n,m;
  cin>>n>>m;
  ll a[n];
  rep(i,0,n) cin>>a[i];
  sort(a,a+n);
  P b[m];
  rep(i,0,m){
    cin>>b[i].second;
    cin>>b[i].first;
  }
  sort(b,b+m);
  reverse(b,b+m);
  int cur=0;
  rep(i,0,m){
    rep(j,cur,min(n,cur+b[i].second)){
      a[j]=max(a[j],b[i].first);
    }
    cur=min(n,cur+b[i].second);
  }
  ll ans=0;
  rep(i,0,n) ans+=a[i];
  cout<<ans<<endl;
}


Measured memory_bytes: 2560
#include <iostream>
#include <algorithm>
#include <cmath>

using namespace std;

int x[100];

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.setf(ios::fixed);
    int d1=0, di=0, y, n;
    double d2=0, d3=0;
    cin>>n;
    for(int i=0; i<n; i++) {
        cin>>x[i];
    }
    for(int i=0; i<n; i++) {
        cin>>y;
        d1+= abs(x[i]-y);
        d2+= (x[i]-y)*(x[i]-y);
        d3+= abs((x[i]-y)*(x[i]-y)*(x[i]-y));
        di = max(di, abs(x[i]-y));
    }
    cout<<d1<<'\n'<<sqrt(d2)<<'\n'<<pow(d3, 1.0/3.0)<<'\n'<<di<<'\n';
    return 0;
}

Measured memory_bytes: 1316
#include<stdio.h>
#define N 65536

int main(){
  int a[N],i,j;
  i=1;
  while(1){
    scanf("%d",&j);
    a[i]=j;
    j=i;
    if(a[i]==0){
      break;
    }
    i++;
  }
  for(i=1;i<j;i++){
    printf("Case %d: %d\n",i,a[i]);
  }
}

Measured memory_bytes: 1072
/*
--------------              |   /
      |                     |  /
      |                     | /
      |             *       |/          |    |         ------            *
      |                     |           |    |        /      \
      |             |       |\          |    |       |       |\          |
   \  |             |       | \         |    |       |       | \         |
    \ |             |       |  \        |    |        \     /   \        |
     V              |       |   \        \__/|         -----     \       |
*/
#include <bits/stdc++.h>
using namespace std;

#define EmiliaMyWife ios::sync_with_stdio(0); cin.tie(NULL);
#define mem(i,j) memset(i,j,sizeof (i));
#define F first
#define S second
#define lowbit(x) ((x)&(-(x)))
#define siz(v) (int)(v).size()
typedef int64_t ll;
typedef uint64_t ull;
typedef long double ld;
const double EPS  = 1e-8;
const int INF     = 0x3F3F3F3F;
const ll LINF     = 4611686018427387903;
const int MOD     = 1e9+7;
/*-----------------------------------------------------------------------------------------------------*/

signed main() {
	EmiliaMyWife

	int n;
	cin >> n;
	cout << (n>=30?"Yes":"No");

	return 0;
}


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

using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;

ll N,M;
ll S,T;
vector<vector<ll>> G;
ll dist[300000];

int main(){
    cin >> N >> M;
    G.resize(3*N);
    for(int i=0;i<M;i++){
        ll a,b;
        cin >> a >> b;
        a--,b--;
        for(int j=0;j<3;j++){
            G[N*j+a].push_back(N*((j+1)%3)+b);
        }
    }
    for(int i=0;i<3*N;i++) dist[i] = 1e15;
    cin >> S >> T;
    S--, T--;
    dist[S] = 1;
    queue<ll> q;
    q.push(S);
    while(!q.empty() && dist[T] == 1e15){
        ll n = q.front();
        q.pop();
        for(auto &e : G[n]){
            if(dist[e] != 1e15) continue;
            dist[e] = dist[n] + 1;
            q.push(e);
        }
    }
    if(dist[T] == 1e15) cout << -1 << endl;
    else cout << dist[T] / 3 << endl;
    return 0;
}

Measured memory_bytes: 18944
using System;
using System.Linq;//リストの使用
using System.Collections.Generic;
using System.Text;//テキストの高速出力に必要
class Program
{
	static void Main()
	{
		string[] input = Console.ReadLine().Split(' ');
		int n = int.Parse(input[0]);
		int m = int.Parse(input[1]);
		long[] nums = Array.ConvertAll(Console.ReadLine().Split(' '),long.Parse);
		long[] numsb = Array.ConvertAll(Console.ReadLine().Split(' '),long.Parse);
		long answer = 1;
		long answerMemo = 0;
		long mod = 1000000007;
    int checkedA = n-1;
    int checkedB = m-1;

    Array.Sort(nums);
    Array.Sort(numsb);

		for(int i = n-1; i >= 0; i--)
		{
			for(int j = m-1; j >= 0; j--)
			{
        if(n == 1 || m == 1) break;
        if(nums[n-1] != n*m || numsb[m-1] != n*m)
        {
          answer = 0;
          break;
        }
        int num = i*m+j+1;
        //Console.WriteLine(answer);

        if(checkedA != -1)
        {
          if(nums[checkedA] == num) checkedA--;
        }
        if(checkedB != -1)
        {
          if(numsb[checkedB] == num) checkedB--;
        }

        if(checkedA != -1)
        {
          if(nums[checkedA] >= num)
          {
            answer = 0;
          }
        }
        if(checkedB != -1)
        {
          if(numsb[checkedB] >= num)
          {
            answer = 0;
          }
        }

        if(nums[checkedA+1] == num && numsb[checkedB+1] == num)
        {
          answer *= 1;
        }else if(nums[checkedA+1] != num && numsb[checkedB+1] != num)
        {
          answerMemo = (n-checkedA-1) * (m-checkedB-1) - (n*m-num);
          answer *= answerMemo;
          answer %= mod;
          if(answerMemo < 0) answer = 0;
        }else if(nums[checkedA+1] == num)
        {
          answerMemo = m-checkedB-1;
          answer *= answerMemo;
          answer %= mod;
          if(answerMemo < 0) answer = 0;
        }else
        {
          answerMemo = n-checkedA-1;
          answer *= answerMemo;
          answer %= mod;
          if(answerMemo < 0) answer = 0;
        }
        
			}
		}
		
		if(n != 1 && m != 1) Console.WriteLine(answer);
    else
    {
      answer = 1;
      if(n == 1)
      {
        if(nums[0] != m) answer = 0;
        for(int i = 0; i < m; i++)
        {
          if(numsb[i] != i+1) answer = 0;
        }
      }
      if(m == 1)
      {
        if(numsb[0] != n) answer = 0;
        for(int i = 0; i < n; i++)
        {
          if(nums[i] != i+1) answer = 0;
        }
      }
      Console.WriteLine(answer);
    }
	}
}


Measured memory_bytes: 13404
#include <bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define rrep(i, a, b) for(int i = a; i >= (b); --i)
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
#define sz(x) (int)(x).size()
#define int long long
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<vi> vvi;

signed main() {
  cin.tie(0)->sync_with_stdio(0);
  cin.exceptions(cin.failbit);
  int N; cin >> N; vi v(N);
  for(int& i: v) cin >> i;
  vector<vi> dp(N, vi(N));
  rrep(l,N-1,0){
    rep(r,l,N){
      int d = N-l+r;
      if(d%2)
        dp[l][r] = max((l+1 > r ? 0 : dp[l+1][r]) + v[l], (r-1 < l ? 0 : dp[l][r-1]) + v[r]);
      else
        dp[l][r] = min((l+1 > r ? 0 : dp[l+1][r]) - v[l], (r-1 < l ? 0 : dp[l][r-1]) - v[r]);
    }
  }
  cout << dp[0][N-1];
  return 0;
}


Measured memory_bytes: 73668
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define shandom_ruffle random_shuffle

const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001; //check the limits, dummy

bool getBond(char c){
  if(c == 'A') return true;
  if(c == 'T') return true;
  if(c == 'G') return true;
  if(c == 'C') return true;
  return false;
}

bool isGood(string s){
  F0R(i,s.length())
    if(!getBond(s[i]))
      return false;
  return true;
}

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

    string s;
    cin >> s;
    int ans =0;
    F0Rd(i,s.length()+1){
      F0R(j,s.length()-i+1)
        if(isGood(s.substr(j,i)))
          {
            cout << i << endl;
            return 0;
          }
    }


    return 0;
}

// read the question correctly (ll vs int)
// template by super1 derived from bqi343


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(k,i,n) for(ll i=k;i<n;++i)
ll dx[8]={1,1,1,0,0,-1,-1,-1};
ll dy[8]={1,0,-1,1,-1,1,0,-1};
int main(void){
    // Your code here!
    ll h,w;
    cin>>h>>w;
    string s0[h][w];
    rep(0,i,h){
        string s;
        cin>>s;
        rep(0,j,w)s0[i][j]=s.substr(j,1);
    }
    rep(0,i,h){
        rep(0,j,w){
            ll sum=0;
            rep(0,k,8){
                ll x=i+dx[k],y=j+dy[k];
                if((x>=h||x<0)||(y>=w||y<0))continue;
                if(s0[x][y]=="#")++sum;
            }
            if(s0[i][j]==".")s0[i][j]=to_string(sum);
        }
    }
    rep(0,i,h){
        rep(0,j,w)cout<<s0[i][j];
        cout<<endl;
    }
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
using lli=long long int;
using vi=vector<int>;  using vs=vector<string>; using gi=greater<int>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define soao(c) sort((c).begin(),(c).end()) //昇順
#define sodo(c) sort((c).begin(),(c).end(),gi()) //降順
#define rev(c) reverse((c).begin(), (c).end())


int main(){
    int K,S; cin>>K>>S;
    int count=0;
    for(int x=0;x<=K;x++){
        for(int y=0;y<=K;y++){    
            if(S-x-y<=K&&S-x-y>=0) count++;     
        }
    }
    cout<<count<<endl;
}


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

int main() {
	int N;
	cin >> N;
	vector<int> A(N);
	int max,c,d;
	max=0;
	c=0;
	d=0;
	for(int i=0;i<N;i++){
		cin >> A.at(i);
		if(A.at(i)>=max){
			max=A.at(i);
			c=i;
		}
	}
	for(int i=0;i<N;i++){
		if(i==c){
			A.at(i)=0;
			cout << *max_element(A.begin(),A.end()) <<endl;
		}
		else{
			cout << max <<endl;
		}
	}
}

Measured memory_bytes: 2432
S = input()

len_s = len(S)
ans = 0
i = 0
pre_s = ''
while i < len_s:
    if pre_s != S[i]:
        ans += 1
        pre_s = S[i]
        i += 1
        # print(pre_s, end=' ')
    elif i < len_s - 1 and pre_s != S[i] + S[i+1]:
        ans += 1
        pre_s = S[i] + S[i+1]
        i += 2
        # print(pre_s, end=' ')
    else:
        break
# print()
print(ans)


Measured memory_bytes: 3500
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin>>N;
  vector<int> a(N);
  for(int i=0;i<N;i++){
  cin>>a.at(i);
  }
  sort(a.begin(),a.end());
  reverse(a.begin(),a.end());
  int A,B;
  A=0;
  B=0;
  int x;
  if(N%2==1){
    x=a.size()/2;
  for(int i=0;i<=x;i++){
  A+=a.at(2*i);
  }
  }
  if(N%2==0){
      x=(a.size()-1)/2;
  for(int i=0;i<=x;i++){
  A+=a.at(2*i);
  }
  }
  for(int i=0;i<N;i++){
  B+=a.at(i);
  }
  B-=A;
  cout<<A-B<<endl;
}

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

using namespace std;
typedef long long ll;

int main() {
    string N;
    cin >> N;
    ll a = 0, b = 1;
    for(auto i = N.begin(); i!= N.end(); i++){
        int t = *i - '0';
        ll ta = min({a + t, b + (10 - t)});
        ll tb = min(a + (t + 1), b + (10 - t - 1));
        a = ta;
        b = tb;
    }
    cout << a << endl;
}

Measured memory_bytes: 1412
using System;
using System.Collections.Generic;
using System.Text;
using System.Linq;


class Program
{
    public void Proc()
    {


        Reader.IsDebug = false;
        string inpt = Reader.ReadLine();

        Dictionary<char, bool> dic = new Dictionary<char, bool>();
        inpt.ToList().ForEach(a =>
        {
            dic[a] = true;
        });

        String ans = "No";


        if (dic.Keys.Count == 4)
        {
            ans = "Yes";
        }
        else if (dic.Keys.Count % 2 == 0)
        {
            if (dic.ContainsKey('N') && dic.ContainsKey('S'))
            {
                ans = "Yes";
            }
            else if (dic.ContainsKey('E') && dic.ContainsKey('W'))
            {
                ans = "Yes";
            }
        }
        Console.WriteLine(ans);


    }



    public class Reader
    {
        public static bool IsDebug = true;
        private static String PlainInput = @"


8
2
0
1
6
0
8
2
1


";
        private static System.IO.StringReader Sr = null;
        public static string ReadLine()
        {
            if (IsDebug)
            {
                if (Sr == null)
                {
                    Sr = new System.IO.StringReader(PlainInput.Trim());
                }
                return Sr.ReadLine();
            }
            else
            {
                return Console.ReadLine();
            }
        }
    }
    static void Main()
    {
        Program prg = new Program();
        prg.Proc();
    }
}

Measured memory_bytes: 3160
#include<bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
    int n,m;
    std::cin >> n>>m;
    std::vector<int> a (n,-1);
    int i;
    int b;
    a[0]=1;
    for (i=0;i<m;i++){std::cin >> b;a[b-1]=0;}
    if(a[1]!=0)a[1]=a[0]+1;
    for (i=2;i<n;i++){
        if(a[i]!=0)a[i]=(a[i-2]+a[i-1])%1000000007;
    }
    std::cout << a[n-1]%1000000007 << std::endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define ll long long
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
struct UF
{
    UF *root;
    ll con;
};
UF *root(UF *u)
{
    UF *_u = u;
    while (u->root != u)
        u = u->root;
    _u->root = u;
    return u;
}

bool isconnected(UF *a, UF *b)
{
    return (root(a) == root(b));
}

void unite(UF *a, UF *b)
{
    if (isconnected(a, b))
        return;
    a = root(a);
    b = root(b);
    b->root = a;
    a->con += b->con;
}
int main()
{
    ll n, m;
    cin >> n >> m;
    UF u[n];
    rep(i, n)
    {
        u[i] = UF{&u[i], 1};
    }
    pair<int, int> p[m];
    ll rest = n;
    ll ans[m];
    ans[m - 1] = n * (n - 1) / 2;
    //ans[0] = 0;
    rep(i, m) cin >> p[i].first >> p[i].second;
    for (int i = m - 2; i >= 0; i--)
    {
        int a = p[i + 1].first - 1, b = p[i + 1].second - 1;
        // cout << a << "," << b << endl;

        if (isconnected(&u[a], &u[b]))
        {
            ans[i] = ans[i + 1];
            continue;
        }
        //        cout << root(&u[a])->con << endl;
        ans[i] = ans[i + 1] - root(&u[a])->con * root(&u[b])->con;

        unite(&u[a], &u[b]);

        // rest -= u[a].con - 1;
        //cout << "r:" << rest << endl;
    }
    rep(i, m) cout << ans[i] << endl;
    return 0;
}

Measured memory_bytes: 4480
#include <stdio.h>
#include <math.h>

int main(void){

    double a,b,x;
    double tmp;
    double val;

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

    if((a*a*b)/2<x){
        // 台形の場合
        // printf("台形\n");
        tmp = 2*(a*a*b-x)/(a*a*a) ;
    }else if((a*a*b)/2==x){
        // 閾値　(三角形)
        // printf("閾値\n");
        tmp = b/a;
    }else{
        // 三角形の場合
        // printf("三角形\n");
        tmp = (a*b*b)/(2*x);
    }

    val = atan(tmp);

    printf("%lf\n",val*(180/M_PI));
    
    return 0;
}


Measured memory_bytes: 512
from bisect import bisect_left,bisect
s = list(input())
sn = len(s)
t = list(input())
tn = len(t)
kouho = []
for i in range(26):
    kar = []
    now = chr(ord('a') + i)
    for j in range(sn):
        if s[j] == now:
            kar.append(j)
    kouho.append(kar)

cou = 0
now = -1
for i in range(tn):
    u = ord(t[i])-ord("a")
    if kouho[u]:
        tugi = bisect(kouho[u],now)
        if tugi == len(kouho[u]):
            cou += 1
            now = kouho[u][0]
        else:
            now = kouho[u][tugi]
    else:
        print(-1)
        exit()

print(cou*sn + now + 1)

Measured memory_bytes: 14396
import java.util.*;
import java.lang.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while (true) {
			int n = sc.nextInt();
			if (n == 0) {
				System.exit(0);
			}
			int[] a = new int[n];
			double ave = 0;
			for (int i = 0; i < n; i++) {
				a[i] = sc.nextInt();
				ave += a[i];
			}
			ave /= n;
			Arrays.sort(a);
			int ok = 0;
			int ng = n;
			while (Math.abs(ok - ng) > 1) {
				int mid = (ok + ng) / 2;
				if (a[mid] <= ave) {
					ok = mid;
				} else {
					ng = mid;
				}
			}
			System.out.println(ok + 1);
		}
	}
}




Measured memory_bytes: 58608
n,m = map(int,input().split())
a = list(map(int,input().split()))
a.sort(reverse=True)
sumVote = sum(a)
ans = 0
for i in range(m):
    if a[i] < sumVote/(4*m):
        ans += 1
print('Yes' if ans == 0 else 'No')

Measured memory_bytes: 3060
#include <stdio.h>
#include <string.h>
int main(){
    char s[100001];
    int i=0,count=0,plan=0;
    
    scanf("%s",s);
    
    if(s[0]=='1')
    plan=1;
    
    
    for(i=1;i<strlen(s);i++){
        if(plan==1){
            if(i%2==1&&s[i]=='1')
            {
            count++;
            }
            else if(i%2==0&&s[i]=='0')
            {
            count++;
            }
        }
        else{
            if(i%2==1&&s[i]=='0')
            {
                count++;
                
            }
            else if(i%2==0&&s[i]=='1')
            {
                count++;
            }
        }
    }
    printf("%d",count);
    
    return 0;
}

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

int main() {
  string s;
  cin >> s;
  long long ans=0,temp=0;
  for(int i=0;i<s.size();i++) {
    if(s.at(i)=='W') {
      ans+=i-temp;
      temp++;
    }
  }
  cout << ans << endl;
}

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

using namespace std;
#define ll long long int

int main()
{
    ll n;
    cin>>n;
    ll a[n];
    map<ll,ll>mp;
    map<ll,ll>::iterator itr;
    ll sum=0;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        mp[a[i]]++;
        sum+=a[i];
    }
    ll q;
    cin>>q;
    while(q--)
    {
        ll b1,c1;
        cin>>b1>>c1;
        itr=mp.find(b1);
        if(itr!=mp.end())
        {
            sum-=b1*(itr->second);
            sum+=c1*(itr->second);
            ll x=itr->second;
            mp.erase(b1);
            mp[c1]+=x;
        }
        cout<<sum<<endl;
    }
}


Measured memory_bytes: 8276
//by tzupengwang™
#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> ii;

char s[ 500005 ] ;
int l ;

void init() {
  scanf( "%s" , s ) ;
  l = strlen( s ) ;
}

void process() {
  ll ans = 0 ;
  for ( int i = 0 ; i < l ; i ++ ) {
    if ( s[ i ] == 'g' ) ans ++ ;
    else ans -- ;
  }
  ll tl = ( l + 1 ) / 2 ;
  ans -= tl ;
  ans += ( l - tl ) ;
  printf( "%lld\n" , ans / 2 ) ;
}

int main() {
  init() ;
  process() ;
  return 0 ;
}


Measured memory_bytes: 512
from math import ceil, sqrt

Q = int(input())
querys = [tuple(map(int, input().split())) for i in range(Q)]

N = max(map(max, querys))

Primes = [False] * 2 + [True] * (N - 1)
for i in range(3, N + 1):
    for j in range(2, ceil(sqrt(i)) + 1):
        if i % j == 0:
            Primes[i] = False
            break

s2017s = [False] * (N + 1)
for i in range(1, N + 1, 2):
    if Primes[i] and Primes[(i + 1) // 2]:
        s2017s[i] = True

nums = [0] * (N + 1)
for i in range(1, N + 1, 2):
    nums[i] = nums[i - 2]
    if s2017s[i]:
        nums[i] += 1

for li, ri in querys:
    print(nums[ri] - nums[max(0, li - 2)])


Measured memory_bytes: 19708
#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <cstdio>
#include <math.h>
using namespace std;
#define ll long long 
int main(){
  	std::ios::sync_with_stdio(false);
  	cin.tie(0);
  	cout.tie(0);
  	ll s,x1,y1,x2,y2;
  	cin>>s;
  	x1=1e9;
  	x2=1;
  	y2=(s-1)/(x1)+1;
  	y1=x1*y2-s;
    cout<<"0 0 "<<x1<<" "<<y1<<" "<<x2<<" "<<y2;
  	return 0;
}


Measured memory_bytes: 256
#include <iostream>

using i64 = long long;

const int N = 3000 + 7;

int n;
i64 p, ans;

i64 binom[N][N], stirl[N][N];
i64 power(i64 a, i64 k, i64 p) {
	i64 t = 1;
	for (; k; a = a * a % p, k >>= 1)
		if (k & 1) t = t * a % p;
	return t;
}

int main() {
//	freopen("code.in", "r", stdin);
//	freopen("code.out", "w", stdout);

	scanf("%d%lld", &n, &p);
	for (int i = 0; i <= n + 1; ++i)
		for (int j = binom[i][0] = 1; j <= i; ++j)
			binom[i][j] = (binom[i - 1][j - 1] + binom[i - 1][j]) % p;
	stirl[0][0] = 1;
	for (int i = 1; i <= n + 1; ++i)
		for (int j = 1; j <= i; ++j)
			stirl[i][j] = (stirl[i - 1][j - 1] + stirl[i - 1][j] * j) % p;
	for (int i = 0; i <= n; ++i) {
		i64 res = 0;
		for (int j = 0; j <= i; ++j)
			( res += stirl[i + 1][j + 1] * power(2, 1ll * (n - i) * j, p) ) %= p;
		( ans += (i & 1 ? -1 : 1) * binom[n][i] * power(2, power(2, n - i, p - 1), p) % p * res ) %= p;
	}
	printf("%lld", (ans + p) % p);

	return 0;
}


Measured memory_bytes: 96940
#include <bits/stdc++.h>
using namespace std;
 
int main(){
 int N;
 int i;
 int j;
 cin >> N;
 int p[N];
for(i=0;i<N;i++)cin >> p[i];
 int tmp;
 int tmpsum = 100*100*10000;
 int sum;
for(i=1;i<101;++i){
 sum = 0;
 for(j=0;j<N;j++)sum += (p[j]-i)*(p[j]-i);
 if(sum<tmpsum){
     tmp=i;
     tmpsum = sum;
}}
 cout << tmpsum << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
using namespace std;
double n,a,b,c;
int main()
{
	cin>>a>>b>>n;
	double d,w,l,r;
	if((b+0.000001)*a/2*a<n)
	{
		w=n/a/a*2-b;
		d=sqrt(double(a*a)+double((b-w)*(b-w)));
		double s=(b-w)/d,p=3.14159;
		l=0,r=90,w=0;
		while(r-l>=0.000001)
		{
			w=(l+r)/2;
			if(sin(w*(p/180))<=s)
				l=w;
			else
				r=w;	
		} 
		w=(l+r)/2;
		printf("%0.7f\n",w);
	}
	else
	{
		w=n/a/b*2;
		d=sqrt(double(w*w)+double(b*b));
		double s=b/d,p=3.14159;
		l=0,r=90,w=0;
		while(r-l>=0.000001)
		{
			w=(l+r)/2;
			if(sin(w*(p/180))<=s)
				l=w;
			else
				r=w;	
		} 
		w=(l+r)/2;
		printf("%0.7f\n",w);
	}
} 

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
    //ll t;
    //cin>>t;
    //for(ll T=0;T<t;T++)
    //{
        
       string str;
       cin>>str;
       ll n=str.length();
       ll arr[n]={0};
       ll m=0;
       //char brr[n];
       //for(ll i=0;i<n;i++)
       //{
         //  str[i]=brr[i];
       //}
       for(ll i=0;i<n;i++)
       {
           if (str[i]== 'R')
           {
               arr[m]++;
           }
           else if(str[i]=='S')
           {
               m++;
           }
       }
       sort(arr, arr+n, greater<int>());
       ll ans=arr[0];
       
      cout<<ans<<"\n";
      //cout<<m<<"\n";
        
    //}
    return 0;
}

Measured memory_bytes: 3596
def main():

    s = input()
    s = str(s)
    flag = 0

    if(s[0] == s[1]):
        print('Bad')
        flag = 1
    
    if(flag == 0 and s[1] == s[2]):
        print('Bad')
        flag = 1
    
    if(flag == 0 and s[2] == s[3]):
        print('Bad')
        flag = 1
    
    if(flag == 0):
        print('Good')

if __name__ == '__main__':
    main()



Measured memory_bytes: 3064
N,H = map(int,input().split())
A = [-1 for _ in range(N)]
B = [-1 for _ in range(N)]
for i in range(N):
    a,b = map(int,input().split())
    A[i] = a
    B[i] = b
MA = max(A)
B.sort(reverse=True)
ans = 0

for i in range(N):
    if H > 0 and B[i] > MA:
        H -= B[i]
        ans += 1
    else:
        break
if H > 0:
    ans += (H+MA-1)//MA
print(ans)


Measured memory_bytes: 11360
#include <bits/stdc++.h>
#include <algorithm>
#include <functional>
#include <map>
#include <queue>
#include <set>
#include <stack>
using namespace std;
#define rep(i, m, n) for (int(i) = (int)(m); i < (int)(n); ++i)
#define rep2(i, m, n) for (int(i) = (int)(n)-1; i >= (int)(m); --i)
#define REP(i, n) rep(i, 0, n)
#define REP2(i, n) rep2(i, 0, n)
#define all(hoge) (hoge).begin(), (hoge).end()
#define en '\n'
using ll = long long;
using ull = unsigned long long;
using Edge = pair<int, long long>;
using Graph = vector<vector<Edge>>;
typedef vector<ll> vec;
typedef vector<vector<ll>> mat;
typedef vector<vector<vector<ll>>> mat3;
typedef vector<string> svec;
typedef vector<vector<string>> smat;
typedef pair<ll, ll> P;
constexpr long long INF = 1LL << 60;
constexpr int INF_INT = 1 << 25;
constexpr long long MOD = (ll)1e9 + 7;
// constexpr long long MOD = 998244353LL;
using ld = long double;
static const ld pi = 3.141592653589793L;
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;
}

long long gcd(long long x, long long y) { return y ? gcd(y, x % y) : x; }

vector<pair<long long, long long>> prime_factorize(long long N) {
    vector<pair<long long, long long>> res;
    for (long long a = 2; a * a <= N; ++a) {
        if (N % a != 0) continue;
        long long ex = 0;
        while (N % a == 0) {
            ++ex;
            N /= a;
        }
        res.push_back({a, ex});
    }
    if (N != 1) res.push_back({N, 1});
    return res;
}
// ~~~~~~~~~~~~~~memo~~~~~~~~~~~~~~
// for (int i = 0; i < n; ++i)
// vector<long long> v(n), c(n);
// cout << res << endl;
// cout << res << '\n';
// int型の2次元配列(h×w要素の)の宣言
// vector<vector<int>> data(h, vector<int>(w));
// rotate(s.begin(), s.begin() + 1, s.end());
// sort(all(a),greater<int>());
// s.substr(0,2) 先頭から2文字切り出す
// for (auto it = mp.rbegin();it != mp.rend(); ++it)

// ll dp[1005][3] = {99999999};

int main() {
    // ios::sync_with_stdio(false);
    // cin.tie(0);
    ll N, W;
    cin >> N >> W;
    vector<ll> w(N), v(N);
    rep(i,0,N) cin >> w[i] >> v[i];
    vector<vector<ll>> dp(N+1, vector<ll>(W+1,0));

    rep(i,0,N) {
        rep(j,0,W+1) {
            chmax(dp[i+1][j],dp[i][j]);
            if (j+w[i] <= W) {
                chmax(dp[i+1][min(j+w[i],W)],dp[i][j]+v[i]);
            }
        }
    }

    cout << dp[N][W] << '\n';
    return 0;
}


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

typedef long long int ll;
ll MOD = 1000000007;
ll INFL = 1ll << 60;
ll INF = 1 << 28;

// ====================================================================

int main() {
  int x, a;
  cin >> x >> a;
  if (x < a)
    cout << 0 << endl;
  else
    cout << 10 << endl;
}


Measured memory_bytes: 768
#include <iostream>

using namespace std;

int cnt[300001];

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

  cnt[0] = 0;

  char ch;
  for (int i = 1; i <= n; i++) {
    cin >> ch;
    cnt[i] = cnt[i - 1] + (ch == 'W' ? 1 : 0);
  }
  int min = n;
  for (int i = 1; i <= n; i++) {
    int r = cnt[i - 1] + n - i - cnt[n] + cnt[i];
    if (min > r) min = r;
  }
  cout << min << endl;
}

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

int main() {
  int N,M;
  cin>>N>>M;
  vector<vector<pair<int,int64_t>>> G(N*2-1);
  for(int i=0;i<M;i++){
    int a,b,c;
    cin>>a>>b>>c;
    a--,b--;
    G.at(a).push_back(make_pair(b,c));
    G.at(b).push_back(make_pair(a,c));
    G.at((2*N-2)-a).push_back(make_pair((2*N-2)-b,c));
    G.at((2*N-2)-b).push_back(make_pair((2*N-2)-a,c));
  }
  int v,a,b,c;
  cin>>v>>a>>b>>c;
  vector<int> p(c);
  for(int i=0;i<c;i++){
    p.at(i)=(a*i+b)%c;
  }
  vector<int64_t> r((2*N-1)*c,1000000000000000000);
  priority_queue<pair<int64_t,int>,vector<pair<int64_t,int>>,greater<pair<int64_t,int>>> pq;
  pq.push(make_pair(0,v));
  r.at(v)=0;
  while(!pq.empty()){
    int64_t x,y;
    tie(x,y)=pq.top();
    pq.pop();
    int64_t k=y/c,l=y%c;
    if(r.at(y)<x){
      continue;
    }
    else if(k==2*N-2){
      cout<<x<<endl;
      break;
    }
    else{
      for(auto Q:G.at(k)){
        if(r.at(Q.first*c+p.at(l))>x+l*Q.second){
          r.at(Q.first*c+p.at(l))=x+l*Q.second;
          pq.push(make_pair(x+l*Q.second,Q.first*c+p.at(l)));
        }
      }
    }
  }
    
}


Measured memory_bytes: 7532
#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 FDS(i, n) for(int i = 0; i < n; ++i)
#define FDSR(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 VSORT(v) sort(v.begin(), v.end());
#define INF 999999999
#define itn int
#define ednl endl
using namespace std;
typedef long long ll;
int main(){
	int a,b;
	cin>>a>>b;
	cout<<(a+b)%24<<endl;
}

Measured memory_bytes: 256
import java.math.BigInteger;
import java.util.Scanner;

public class Main {
    private static final int MOD = 1_000_000_007;
    private static final String YES = "Yes";
    private static final String NO = "No";

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

        int N = sc.nextInt();
        long[] A = new long[N];
        for (int i=0; i<N; i++) {
            A[i] = sc.nextLong();
        }


        System.out.println(solve(N, A));
    }

    private static String solve(int N, long[] A) {
        BigInteger b = BigInteger.ONE;
        BigInteger th = BigInteger.valueOf(1_000_000_000_000_000_000L);

        for (int i=0; i<N; i++) {
            if (A[i] == 0) return "0";
        }

        for (int i=0; i<N; i++) {
            b = b.multiply(BigInteger.valueOf(A[i]));

            if (b.compareTo(th) > 0) return "-1";
        }


        return b.toString();
    }
}

Measured memory_bytes: 61572
#include<cstdio>
#include<algorithm>
#define fo(i,a,b) for(i=a;i<=b;i++)
using namespace std;
const int maxn=100000+10;
int h[maxn],go[maxn*2],nxt[maxn*2],bit[maxn],f[maxn];
int i,j,k,l,t,n,m,tot,top,ans;
void add(int x,int y){
    go[++tot]=y;
    nxt[tot]=h[x];
    h[x]=tot;
}
void dfs(int x,int y){
    bit[x]=f[x]=0;
    int t=h[x],l=0;
    while (t){
        if (go[t]!=y){
            dfs(go[t],x);
            l|=(bit[x]&bit[go[t]]);
            bit[x]|=bit[go[t]];
        }
        t=nxt[t];
    }
    if (!bit[x]) bit[x]=1;
    else{
        while ((1<<f[x])<=l||(1<<f[x])&bit[x]) f[x]++;
        bit[x]=(bit[x]>>f[x]<<f[x])|(1<<f[x]);
    }
    ans=max(ans,f[x]);
}
int main(){
    scanf("%d",&n);
    fo(i,1,n-1){
        scanf("%d%d",&j,&k);
        add(j,k);add(k,j);
    }
    dfs(1,0);
    printf("%d\n",ans);
}

Measured memory_bytes: 6272