akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <iomanip>
#include <bitset>
#include <set>
#include <map>
#include <stdio.h>
#include <numeric>
#include <cstring>

#define rep(i,n) for (int i = 0; i < (n); i++)
#define rep1(i,n) for (int i = 1; i < (n); i++)
#define FOR(i,a,b) for (int i=(a); i < (b); i++)
#define MOD 1000000007 //10^9+7
using namespace std;
using ll = long long;
using PII = pair<int, int>;
using PLL = pair<ll, ll>;
const int INF = numeric_limits<int>::max();
const ll INFL = numeric_limits<ll>::max();


// 負の数にも対応した % 演算
long long mod(long long val, long long m) {
    long long res = val % m;
    if (res < 0) res += m;
    return res;
}

//greatest common divisor
long long gcd(ll a, ll b) 
{
    if (a % b == 0) {
        return b;
    } else {
        return gcd(b, a % b);
    }
}

//least common multiple
long long lcm(ll a, ll b)
{
    return a / gcd(a, b) * b ;
}

ll factorial(ll n) {
    ll res = 1;
    for (ll i = 1; i <= n; i++) {
        res *= i;
    }
    return res;
}

bool fn_is_prime(ll n) {
    for (ll i = 2; i * i <= n; i++) {
        if (n % i == 0) return false;
    }
    return n != 1;
}

bool isOK(int index, int key, vector<ll>& a) {
    if (a[index] >= key) return true;
    else return false;
}

int binary_search(int key, vector<ll>& a) {
    int ng = -1;
    int ok = a.size();

    while (abs(ok - ng) > 1) {
        int mid = (ok + ng) / 2;

        if (isOK(mid, key, a)) ok = mid;
        else ng = mid;
    }
    return ok;
}

int main()
{
    int n; cin >> n;
    string add = "";
    for (int i = n; i <= 24; i++) 
        add += " Eve";

    cout << "Christmas" << add << endl;
}


Measured memory_bytes: 3616
import std.algorithm, std.conv, std.range, std.stdio, std.string;

void main()
{
  auto x = readln.chomp.to!long;

  struct T { long t, y; }
  auto t = iota(0, x+1)
    .map!(t => T(t, t*(t+1)/2))
    .assumeSorted!"a.y < b.y"
    .lowerBound(T(0, x)).back.t;

  writeln(t+1);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
	int a, b, c, x, y;
	cin >> a >> b >> c >> x >> y;
	if (2 * c <= a + b) {
		cout << min(min(x, y) * 2 * c + max(0, x - y) * a + max(0, y - x) * b, max(x, y) * 2 * c);
	}
	else {
		cout << a * x + b * y;
	}
	return 0;
}

Measured memory_bytes: 256
s=list(map(int,list(input())))
first=s[0]*10+s[1]
second=s[2]*10+s[3]
flag_YYMM=False
flag_MMYY=False
if first<=12 and first>=1:
  flag_MMYY=True
if second<=12 and second>=1:
  flag_YYMM=True

if flag_MMYY and flag_YYMM:
  print("AMBIGUOUS")
elif flag_MMYY:
  print("MMYY")
elif flag_YYMM:
  print("YYMM")
else:
  print("NA")

Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <ctype.h>
#include <map>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <cctype>
#include <queue>
#include <set>
#include <list>
#define PI 3.141592653
#define rep(i,a,n) for(int i=a;i<(int)n;++i)
#define SZ(x) ((int)(x).size())	//size() unsigned -> int
#define DescSort(a) sort(a.begin(),a.end(),std::greater<int>())

using namespace std;
typedef long long ll;
const ll INF = 1e9 + 7;

int main() {
	int n;
	cin >> n;
	vector<int> h(n);
	rep(i, 0, n)cin >> h[i];
	bool can = true;
	for (int i = h.size() - 2;i >= 0;i--) {
		if (h[i] <= h[i + 1]) continue;
		else if (h[i] == h[i + 1] + 1)h[i] -= 1;
		else { can = false;break; }
	}
	if (can)cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 640
///   ***   ---   |||         In the name of ALLAH        |||   ---   ***   ///



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


typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef double dl;

#define endl '\n'
#define PB push_back
#define F first
#define S second
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define sz(x) (int)x.size()

const double PI = acos(-1);
const double eps = 1e-9;
const int inf = 2000000000;
const ll infLL = 9000000000000000000;
#define MOD 1000000007

#define mem(a,b) memset(a, b, sizeof(a) )
#define sqr(a) ((a) * (a))

#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define fraction() cout.unsetf(ios::floatfield); cout.precision(10); cout.setf(ios::fixed,ios::floatfield);
#define file() freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);

#define dbg(args...) do {cerr << #args << " : "; faltu(args); } while(0)
void faltu () {            cerr << endl;}
template < typename T, typename ... hello>void faltu( T arg, const hello &... rest) {cerr << arg << ' ';faltu(rest...);}


int main()
{
    optimize();

    int k, x;
    cin >> k >> x;

    if ( k * 500 >= x ) cout << "Yes\n";
    else cout << "No\n";


    return 0;
}


















Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
	"strings"
)

var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Split(bufio.ScanWords)
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func Pow(x int, y int) int {
	return int(math.Pow(float64(x), float64(y)))
}

func main() {
	n := nextInt()
	m := make([][]int, n + 1)
	for i := 0; i<n+1; i++ {
		m[i] = make([]int, n + 1)
		for j := 0; j<n+1; j++ {
			m[i][j] = -1
		}
	}

	for i := 0; i < n; i++ {
		a := nextInt()
		for j := 0; j < a; j++ {
			x := nextInt()
			y := nextInt()

			m[i+1][x] = y
		}
	}

	max := 0
	for i := 0; i < Pow(2, n); i++ {
		x := fmt.Sprintf("%0*s", n, strconv.FormatInt(int64(i), 2))

		if func() bool {
			for i, y := range x {
				for j := 0; j < n; j++ {
					if m[i+1][j+1] == -1 {
						continue
					}

					if y == '1' && strconv.Itoa(m[i+1][j+1]) != string(x[j]) {
						return false
					}
				}
			}
			return true
		}() {
			count := strings.Count(x, "1")
			if count > max {
				max = count
			}
		}
	}

	fmt.Printf("%d", max)
}


Measured memory_bytes: 2816
w, h, n = gets.chomp.split.map(&:to_i)
xya = []
n.times { xya << gets.chomp.split.map(&:to_i) }

space = []
(0..w - 1).each do |x|
  space[x] = []
  (0..h - 1).each do |y|
    space[x][y] = false
  end
end

(1..n).each do |i|
  x, y, a = xya[i - 1]
  if a == 1
    (0..x - 1).each do |j|
      (0..h - 1).each do |k|
        space[j][k] = true
      end
    end
  elsif a == 2
    (x..w - 1).each do |j|
      (0..h - 1).each do |k|
        space[j][k] = true
      end
    end
  elsif a == 3
    (0..w - 1).each do |j|
      (0..y - 1).each do |k|
        space[j][k] = true
      end
    end
  elsif a == 4
    (0..w - 1).each do |j|
      (y..h - 1).each do |k|
        space[j][k] = true
      end
    end
  end
end

ret = 0
(0..w - 1).each do |x|
  (0..h - 1).each do |y|
    ret += 1 unless space[x][y]
  end
end
puts ret


Measured memory_bytes: 1916
package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)
	b := make([]int, n-1)
	for i, _ := range b {
		fmt.Scan(&b[i])
	}

	ans := 0
	for i, v := range b {
		if i == 0 {
			ans += v
		}
		if i == len(b)-1 {
			ans += v
			fmt.Println(ans)
			return
		}
		ans += min(v, b[i+1])
	}
}

func min(a, b int) int {
	if a > b {
		return b
	}
	return a
}

Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <new>
using namespace std;

class Figure{
public:
	Figure(){
		for ( int i = 0; i < 10; ++i ){
			new( n + i ) int( 0 );
		}
	}

	bool isRemain(){
		for ( int i = 0; i < 10; ++i ){
			if ( n[ i ] ) return true;
		}
		return false;
	}

	void operator=( Figure f ){
		for ( int i = 0; i < 10; ++i ){
			n[ i ] = f.n[ i ];
		}
	}
	int& operator[]( int index ){
		return n[ index ];
	}


	int n[ 10 ];
};

bool makeMeld( Figure& o ){
	if ( !o.isRemain() ) return true;

	for ( int i = 1; i < 10; ++i ){
		if ( o[ i ] >= 3 ){
			o[ i ] -= 3;
			if ( makeMeld( o ) ){
				return true;
			}
			o[ i ] += 3;
		}
		if ( i <= 7 && ( o[ i ] && o[ i + 1 ] && o [ i + 2 ] ) ){
			--o[ i ];
			--o[ i + 1 ];
			--o[ i + 2 ];
			if ( makeMeld( o ) ){
				return true;
			}
			++o[ i ];
			++o[ i + 1 ];
			++o[ i + 2 ];
		}
	}
	return false;
}

bool makeHand( Figure& o ){
	for ( int i = 1; i < 10; ++i ){
		Figure n = o;
		if ( n[ i ] >= 2 ){
			n[ i ] -= 2;
			if ( makeMeld( n ) ){
				return true;
			}
		}
	}
	return false;
}

int main(){
	string s;
	while ( cin >> s ){
		Figure fig;
		bool result[ 10 ] = { false };
		for ( unsigned i = 0; i < s.size(); ++i ){
			++fig[ s[ i ] - '0' ];
		}

		for ( int i = 1; i < 10; ++i ){
			if ( fig[ i ] == 4 ) continue;
			++fig[ i ];
			result[ i ] = makeHand( fig );
			--fig[ i ];
		}

		bool first = true;
		for ( int i = 1; i < 10; ++i ){
			if ( result[ i ] ){
				if ( first ){
					cout << i;
					first = false;
				}else{
					cout << " " << i;
				}
			}
		}
		if ( first ) cout << 0;
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 0
N = int(input())
S = input()
dpe = [0] * (N+1)
dper = [0] * (N+1)
for i in range(N):
    dpe[i+1] = dpe[i]
    dper[N-1-i] = dper[N-i]
    if S[i] == "W":
        dpe[i+1] += 1
    if S[N-1-i] == "E":
        dper[N-1-i] += 1
ans = 10**6
for i in range(N):
    tmpl = dpe[i]
    tmp = dpe[i] + dper[i+1]

    ans = min(ans, tmp)
print(ans)

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

using ll = long long;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = (n-1); i >= 0; i--)
#define all(n) n.begin(), n.end()
#define print(n) cout << n << endl
ll mods = 1000000007;

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    //print(fixed << setprecision(10));

    int n;
    cin >> n;
    n %= 10;
    if(n==2 || n==4 || n==5 || n==7 || n==9) print("hon");
    else if(n==0 || n==1 || n==6 || n==8) print("pon");
    else print("bon");

    return 0;
}

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

int main() {
    ll k, a, b;
    cin >> k >> a >> b;
    ll ans = k+1;
    ll l = k-(a-1);
    if(l >= 0){
        ans = max(ans, l/2*(b-a) + a + l%2);
    }

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

Measured memory_bytes: 3560
// clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
// #define main int main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
#define stlice(from, to) substr(from, (to) - (from) + 1)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
using namespace std;
using pii = pair<int, int>;
using vi = vector<int>;
using vd = vector<double>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vpii = vector<pii>;
using vvi = vector<vi>;
using vvb = vector<vb>;
using vvpii = vector<vpii>;
template<typename A> using fn = function<A>;
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = acos(-1);
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
constexpr bool odd(const int &n) { return n & 1; }
constexpr bool even(const int &n) { return !odd(n); }
template<typename V> constexpr typename V::value_type sum(const V &v) { return accumulate(all(v), 0); }
void solve();
main { solve(); return 0; }
// clang-format on

void solve() {
  int a, b;
  cin >> a >> b;
  cout << a * b << ' ' << (a + b) * 2 << endl;
}

Measured memory_bytes: 3088
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

#define MAX(x,y) (x>y?x:y)
#define MIN(x,y) (x<y?x:y)
#define ABS(x) (x>0?x:-(x))
#define INF 1000000000

#define MOD 1000000007

void swap(int* a, int* b)
{
	int tmp;
	tmp = *a;
	*a = *b;
	*b = tmp;
}

void swap2(double* a, double* b)
{
	double tmp;
	tmp = *a;
	*a = *b;
	*b = tmp;
}

int gcd(int a, int b)  //最大公約数
{
	if (a < b)
		swap(&a, &b);

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

int lcm(int a, int b)
{
	return a * b / gcd(a, b);
}

long power(long x, int n) { //x^n 計算量O(logn)
	long ans = 1;
	while (n > 0) {
		if ((n & 1) == 1) {
			ans = ans * x;
		}
		x = x * x; //一周する度にx, x^2, x^4, x^8となる
		n >>= 1; //桁をずらす n = n >> 1
	}
	return ans;
}

int choose(int n, int k) {
	return k == 0 ? 1 : (long long)choose(n - 1, k - 1) * n % MOD * power(k, MOD - 2) % MOD;
}

void bubble_sort(int a[], int n)
{
	int i, j, tmp;

	for (i = 0; i < n; i++)
	{
		for (int k = 0; k < n; k++)
			printf("%d ", a[k]);

		for (j = n - 1; j > i; j--)
		{
			if (a[j - 1] > a[j])
			{
				tmp = a[j];
				a[j] = a[j - 1];
				a[j - 1] = tmp;
			}
		}
		printf("\n");
	}
}

void selection_sort(int a[], int n)
{
	int i, j, tmp, min, key;

	for (i = 0; i < n - 1; i++)
	{
		min = i;
		key = a[i];

		for (int k = 0; k < n; k++)
			printf("%d ", a[k]);

		for (j = i + 1; j < n; j++)
		{
			if (a[j] < a[min])
			{
				min = j;
				key = a[j];
			}
		}

		tmp = a[i];
		a[i] = a[min];
		a[min] = tmp;

		printf("\n");
	}

	for (int k = 0; k < n; k++)
		printf("%d ", a[k]);
}

void insertion_sort(int a[], int n)
{
	int i, j, tmp;

	for (i = 1; i < n; i++)
	{
		j = i;

		while (j >= 1 && a[j - 1] > a[j])
		{
			tmp = a[j];
			a[j] = a[j - 1];
			a[j - 1] = tmp;
			j--;
		}
	}
}

void shell_sort(int a[], int n)
{
	int h, i, j;

	for (h = 1; h < n / 9; h = h * 3 + 1)
		;

	for (; h > 0; h /= 3)
	{
		for (int k = 0; k < n; k++)
			printf("%d ", a[k]);

		for (i = h; i < n; i++)
		{
			j = i;
			while (j >= h && a[j - h] > a[j])
			{
				swap(&a[j - h], &a[j]);
				j -= h;
			}
		}
		printf("\n");
	}

	for (int k = 0; k < n; k++)
		printf("%d ", a[k]);
}

int partition(int a[], int l, int r)
{
	int i, j, pivot;

	i = l - 1;
	j = r;
	pivot = a[r];

	for (;;)
	{
		while (a[++i] < pivot)
			;
		while (i < j-- && pivot < a[j])
			;

		if (i >= j)
			break;

		swap(&a[i], &a[j]);
	}

	swap(&a[i], &a[r]);
	return i;
}

void quick_sort1(int a[], int l, int r)
{
	int v;

	if (l >= r)
		return;

	v = partition(a, l, r);

	quick_sort1(a, l, v - 1);
	quick_sort1(a, v + 1, r);
}

void quick_sort(int a[], int n)
{
	quick_sort1(a, 0, n - 1);
}

int keta(int a, int n)
{
	if (n == 1)
		return a % 10;

	for (int i = 0; i < n - 1; i++)
		a /= 10;

	return a % 10;
}

int main()
{
	long long int H, W;

	scanf("%lld%lld", &H, &W);

	if (H == 1 || W == 1)
		printf("1");
	else
		printf("%lld", (H * W + 1) / 2);
}


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

int main(){
    int a,n;
    cin>>a>>n;
    if(n==100){
        cout<< 101*(int)pow(100,a) << endl;
    }else{
        cout<< n*pow(100,a) << endl;
    }
    return 0;
}


Measured memory_bytes: 256
using System;
class Program
{
    static void Main(string[] args)
    {
        int n = int.Parse(Console.ReadLine());
        string line = " 3";
        for (int i = 4; i <= n; i++)
        {
            if (i % 3 == 0)
            {
                line = line + " " + i.ToString();
            }
            else if(INCLUDE3(i))
            {
                line = line + " " + i.ToString();
            }
        }
        Console.WriteLine(line);
    }
    static bool INCLUDE3(int i)
    {
        int divide = i / 10;
        if (i % 10 == 3)
        {
            return true;
        }
        else if (divide < 1)
        {
            return false;
        }
        else
        {
            return INCLUDE3(divide);
        }     
    }
}

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

using namespace std;

int main(void)
{
  int n;
  cin>>n;
  if(n / 10 == 9 || n % 10 == 9)
  {
    cout<<"Yes"<<endl;
  }
  else
  {
    cout<<"No"<<endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxx=1e5+100;
const int INF=1e9;
const int MOD=1e9+7;
vector<int> mapp[maxx];
int vis[maxx];
int n;
int ans[5];
void dfs(int x,int y)
{
    vis[x]=1;
    vis[y]=2;
    queue<int> q;
    q.push(x);
    q.push(y);
    while(!q.empty()){
        int p=q.front();
        ans[vis[p]]++;
        q.pop();
        for(int i=0; i<mapp[p].size(); i++){
            if(vis[mapp[p][i]])   continue;
            vis[mapp[p][i]]=vis[p];
            q.push(mapp[p][i]);
        }
    }
}
int main()
{
    cin>>n;
    int a,b;
    for(int i=1; i<n; i++){
        cin>>a>>b;
        mapp[a].push_back(b);
        mapp[b].push_back(a);
    }
    dfs(1,n);
    if(ans[1]>ans[2])  cout<<"Fennec"<<endl;
    else               cout<<"Snuke"<<endl;
    return 0;
}

Measured memory_bytes: 6272
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define INF (1LL<<50)
#define MOD 1000000007

int H,W;
int dx[] = {-1,0,0,1};
int dy[] = {0,-1,1,0};
int max_num;
vector<vector<int>> seen;
deque<pair<int,int>> dq;

void init_seen(){
    rep(i,H+2)rep(j,W+2) seen[i][j] = -1;
}

int main(){
    cin >> H >> W;
    vector<string> S(H+2);
    seen.resize(H+2,vector<int>(W+2));
    rep(i,H){
        cin >> S[i+1];
        S[i+1] = '#' + S[i+1] + '#';
    }
    rep(i,W+2){
        S[0] = S[0]+'#';
        S[H+1] = S[H+1]+'#';
    }
    int ans = -1;
    for(int i=0;i<H+2;i++){
        for(int j=0;j<W+2;j++){
            if(S[i][j]=='#') continue;
            max_num = -1;
            init_seen();
            dq.push_back(make_pair(i,j));
            seen[i][j]=0;
            while(!dq.empty()){
                int ni = dq.front().first;
                int nj = dq.front().second;
                dq.pop_front();
                for(int k=0;k<4;k++){
                    if(S[ni+dy[k]][nj+dx[k]]!='#'&&seen[ni+dy[k]][nj+dx[k]]==-1){
                        seen[ni+dy[k]][nj+dx[k]]=seen[ni][nj]+1;
                        max_num = max(max_num,seen[ni][nj]+1);
                        dq.push_back(make_pair(ni+dy[k],nj+dx[k]));
                    }
                }
            }
            ans = max(ans,max_num);
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
//ABC162 F

#include <bits/stdc++.h>
using namespace std;
typedef long long lint;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define reps(i, s, n) for(int i = s; i < (int)(n); i++)
const lint mod = 1000000007;


lint ans = 0;
lint n,m,l;
lint a[200000];


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

  if(n+m+l >= 22){
    printf("bust\n");
  }
  else printf("win\n");

  
  //printf("%lld\n",ans);
}


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

public class AtCoderA
{
    static void Main()
    {
        int n = int.Parse(Console.ReadLine());

        int[,] happy = new int[n, 3];
        for (int i = 0; i < n; i++)
        {
            var line = Console.ReadLine();
            var words = line.Split(' ');
            happy[i, 0] = int.Parse(words[0]);
            happy[i, 1] = int.Parse(words[1]);
            happy[i, 2] = int.Parse(words[2]);
        }

        int[,] dp = new int[n, 3];
        dp[0, 0] = happy[0, 0];
        dp[0, 1] = happy[0, 1];
        dp[0, 2] = happy[0, 2];

        for (int i = 1; i < n; i++)
        {
            dp[i, 0] = Math.Max(dp[i - 1, 1], dp[i - 1, 2]) + happy[i, 0];
            dp[i, 1] = Math.Max(dp[i - 1, 0], dp[i - 1, 2]) + happy[i, 1];
            dp[i, 2] = Math.Max(dp[i - 1, 0], dp[i - 1, 1]) + happy[i, 2];
        }

        int answer = Math.Max(dp[n - 1, 0], dp[n - 1, 1]);
        answer = Math.Max(answer, dp[n - 1, 2]);

        Console.WriteLine(answer);
    }
}

Measured memory_bytes: 19392
//  Copyright © 2020 Diego Garcia Rodriguez del Campo. All rights reserved.
#include<bits/stdc++.h>
#define MAX 200005
#define pii pair < int , int >
#define fi first
#define se second
#define optimiza_io cin.tie(0); ios_base::sync_with_stdio(0);
#define what_is(x) cerr << #x << " is " << x << endl;
using namespace std;
typedef long long ll;

ll calc( int x ) {
    int ans = 1;
    for( int i = 0; i < 5; i ++ )
        ans *= x;
    return ans;
}

ll N, X;
vector < pii > ans;

int main()
{
    optimiza_io
    N = 200;
    for( ll i = 0; i <= N; i ++ ) {
        ans.push_back( { calc( i ) , i } ) ;
        ans.push_back( { calc( - i ) , -i } ) ;
    }
    
    cin >> X;
    for( int i = 0; i < ans.size(); i ++ )
        for( int j = 0; j < ans.size(); j ++ ) 
            if( ans[i].fi - ans[j].fi == X ) {
                cout << ans[i].se << " " << ans[j].se << "\n";
                exit( 0 );
            }
    
    return 0;
}

// CHECAR LIMITES 

Measured memory_bytes: 3664
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
from operator import mul
from functools import reduce
import pprint
sys.setrecursionlimit(10 ** 9)


INF = 10 ** 20
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 1000000007

s = S()
if 'A' in s and 'B' in s:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 39664
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Main main = new Main();
		main.run();
	}

	public void run() {
		Scanner sc = new Scanner(System.in);
		int n= sc.nextInt();
		int A[] = new int[n];
		int cnt[] = new int[n];
		for(int i=0; i<n; i++) {
			A[i] = sc.nextInt();
			cnt[A[i]]++;
		}
		int s=0;
		if(n%2==0) {
			s=1;
		}
		boolean ok=true;
		for(int i=0; i<(n+1)/2; i++) {

			int j=2*i+s;
			int d=2;
			if(j==0) {
				d=1;
			}
			if(cnt[j] != d) {
				ok=false;
				break;
			}
		}
		long ans = 0;
		if(!ok) {
			ans=0;
		} else {
			ans = new ModInt(2).pow(n/2).x;
		}

		System.out.println(ans);
		sc.close();
	}
}
class ModInt {

	 final static int MOD = 1000000007;
	 public long x;
	 ModInt(long x){
		 this.x = (x % MOD + MOD) % MOD;
	 }
	 public ModInt plus(final ModInt a) {
		 ModInt res = new ModInt(this.x);
		 if((res.x += a.x) >= MOD) {
			 res.x -= MOD;
		 }
		 return res;
	 }
	 public ModInt minus(final ModInt a) {
		 ModInt res = new ModInt(this.x);
		 if((res.x += MOD-a.x) >= MOD) {
			 res.x -= MOD;
		 }
		 return res;
	 }
	 public ModInt mul(final ModInt a) {
		 ModInt res = new ModInt(this.x);
		 res.x *= a.x;
		 res.x %= MOD;
		 return res;
	 }
	 public ModInt pow(long t) {
		 if(t == 0) {
			 return new ModInt(1);
		 }
		 ModInt a = pow(t>>1);
		 a = a.mul(a);
		 if((t&1)==1) {
			 a = a.mul(this);
		 }
		 return a;
	 }
	 public ModInt inv() {
		 ModInt res = pow(MOD-2);
		 return res;
	 }
	 public ModInt div(ModInt a) {
		 ModInt inv = a.inv();
		 return mul(inv);
	 }

}

Measured memory_bytes: 60224
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
	return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
	o<<"{";
	for(const T& v:vc) o<<v<<",";
	o<<"}";
	return o;
}
using ll = long long;
template<class T> using V = vector<T>;
template<class T> using VV = vector<vector<T>>;
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n-1); }

#ifdef LOCAL
#define show(x) cerr << "LINE" << __LINE__ << " : " << #x << " = " << (x) << endl
#define dump(x) cerr << "LINE" << __LINE__ << " : " << #x << " = {";  \
	for(auto v: x) cerr << v << ","; cerr << "}" << endl;
#else
#define show(x) true
#define dump(x) true
#endif

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);		//DON'T USE scanf/printf/puts !!
	cout << fixed << setprecision(20);
	
	int N; cin >> N;
	V<int> to(N);
	rep(i,N){
		cin >> to[i];
		to[i]--;
	}
	V<int> d(N);
	rep(i,N) d[to[i]]++;
	V<int> ans(N,-1);
	int ban = -1;
	set<int> st; rep(i,N) st.insert(i);

	auto ANSWER = [&](){
		rep(i,N) cout << ans[i]+1 << " ";
		cout << endl;
		exit(0);
	};
	auto NO = [&](){
		cout << -1 << endl;
		exit(0);
	};

	rep(i,N){
		if(N-i <= 8){
			V<int> vs(all(st));
			do{
				bool ok = true;
				if(vs[0] == ban) ok = false;
				int K = vs.size();
				rep(i,K-1) if(to[vs[i]] == vs[i+1]) ok = false;
				if(ok){
					rep(j,K) ans[i+j] = vs[j];
					ANSWER();
				}
			}while(next_permutation(all(vs)));
			NO();
		}
		int K = N-i;
		for(int v: st){
			if(v == ban) continue;
			if(st.count(to[v]) && d[to[v]] == K-1) continue;
			ans[i] = v;
			st.erase(v);
			ban = to[v];
			d[to[v]]--;
			break;
		}
		if(ans[i] == -1){
			assert(i == 0);
			NO();
		}
	}
	rep(i,N) cout << ans[i]+1 << " ";
	cout << endl;
}


Measured memory_bytes: 6656
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static final int BIG_NUM  = 2000000000;
	public static final int MOD  = 1000000007;

	public static void main(String[] args) {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int table[] = new int[128];
		String work[] = new String[2];
		String outPut[] = {"S","H","C","D"};

		table['S'] = 0;
		table['H'] = 1;
		table['C'] = 2;
		table['D'] = 3;

		boolean check[][] = new boolean[4][14];
		for(int row = 0; row < 4; row++){
			for(int col = 1; col <= 13; col++)check[row][col] = false;
		}

		try {
			int N = Integer.parseInt(br.readLine());

			for(int loop = 0; loop < N; loop++){
				work = br.readLine().split("\\s+");
				check[table[work[0].charAt(0)]][Integer.parseInt(work[1])] = true;
			}

			for(int row = 0; row < 4; row++){
				for(int col = 1; col <= 13; col++){
					if(!check[row][col]){
						System.out.printf("%s %d\n", outPut[row],col);
					}
				}
			}

		} catch (NumberFormatException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}




Measured memory_bytes: 24720
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_map>
#include<climits>
#include<cstdlib>
#include<cmath>
#include<string>
#include<iomanip>
#include<bitset>
#include<list>

using namespace std;

#define ll long long int

ll const MOD = 998244353;
ll const INF = (long long int)1 << 61;

ll mypow(ll x,ll n,ll mod = MOD){
    ll ret = 1;
    while(n > 0){
        if(n&1){
            ret = (ret*x)%mod;
        }
        x = (x*x)%mod;
        n >>= 1;
    }
    return ret;
}

ll mygcd(ll a,ll b){
    if(b == 0)return a;
    return mygcd(b,a%b);
}

ll twoPow(ll shiftNum){
    return (1LL << (shiftNum - 1));
}

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

    vector<ll> d(n);
    for(int i = 0; i < n; i++){
        cin >> d[i];
    }

    if(d[0] > 0){
        cout << 0 << endl;
        return 0;
    }

    sort(d.begin(),d.end());

    vector<ll> ct;
    ll tmp = 1;
    ll cur = d[0];

    for(int i = 1; i < n; i++){
        if(d[i] == cur){
            tmp++;
        }else{
            ct.push_back(tmp);
            tmp = 1;
            if(d[i] != cur + 1){
                cout << 0 << endl;
                return 0;
            }
            cur = d[i];
        }
    }

    ct.push_back(tmp);

    if(ct[0] > 1){
        cout << 0 << endl;
        return 0;
    }

    ll ans = 1;

    for(int i = 1; i < ct.size(); i++){
        ans = (mypow(ct[i-1],ct[i])*ans)%MOD;
    }

    cout << ans << endl;

    return 0;
}

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

int main(){
  int a, b;
  cin >> a >> b;
  if(a>b){
    for(int i=0; i<a; i++){
      cout << b;
    }
    cout << endl;
    return 0;
  }
  for(int i=0; i<b; i++){
    cout << a;
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
const int maxs=1e9+1;
int a[100002];

using namespace std;
int main()
{
 int a,b,k,s=0;

  cin>>a>>b>>k;
  while(1)
  {
      if(a%2!=0)
      {
          a-=1;
          int t=a/2;
          a-=t;
          b+=t;
          s++;

      }
      else
      {
          int t=a/2;
          a-=t;
          b+=t;
          s++;
      }
      if(s==k)
        break;
      if(b%2!=0)
        {
            b-=1;
           int t=b/2;
             a+=t;
            b-=t;
            s++;

        }
        else
        {
            int t=b/2;
            b-=t;
            a+=t;
            s++;
        }
        if(s==k)
            break;

  }
  cout<<a<<' '<<b<<endl;
   /* int n,i,j,k;
    cin>>n;
    int maxs=0;
  for(i=0;i<n;i++)
  {
      cin>>a[i];
  }
  for(i=0;i<n-1;i++)
  {
      for(j=0;j<n-1-i;j++)
      {
          if(a[i]<a[j])
          {
              int t=a[i];
              a[i]=a[j];
              a[j]=t;
          }
         int  sum=0;
          for(k=1;k<n;k++)
          {
              sum+=a[k]-a[k-1];

          }
          maxs=max(maxs,sum);
      }
  }
 cout<<maxs<<endl;*/
return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
#define K 10005
int k, t;
int a[105];
int main(){
	cin >> k >> t;
	int maxnum = 0;
	for (int i = 0; i < t; i++){
		cin >> a[i];
		maxnum = max(maxnum, a[i]);
	}
	int ret = maxnum - 1 - k + maxnum;
	ret = max(0, ret);
	cout << ret << endl;
	return 0;
}

Measured memory_bytes: 384
#include <stdio.h>

int main(void)
{
    int h, w;
    int i, j;
    int row;

    while (1){
        row = 1;
        scanf("%d %d", &h, &w);
        if (h == 0 && w == 0){
            break;
        /*when w is even*/
        }else if (w % 2 == 0){
            for (i = 1; i <= h; i++){
                /*odd row*/
                if (row % 2 == 1){
                    for (j = 1; j <= (w / 2); j++){
                        printf("#.");
                    }
                /*even row*/
                }else{
                    for (j = 1; j <= (w / 2); j++){
                        printf(".#");
                    }
                }
                printf("\n");
                row++;
            }
        /*when w is odd*/
        }else{
            for (i = 1; i <= h; i++){
                /*odd row*/
                if (row % 2 == 1){
                    for (j = 1; j <= ((w - 1) / 2); j++){
                        printf("#.");
                    }
                    printf("#");
                /*even row*/
                }else{
                    for (j = 1; j <= ((w - 1) / 2); j++){
                        printf(".#");
                    }
                    printf(".");
                }
                printf("\n");
                row++;
            }
        }
        
        printf("\n");
    }

    return 0;
}

Measured memory_bytes: 1016
#include <cstdio>
char a[10],b[10];
int x,y;
int main()
{
    scanf("%s%s",a,b);
    if(a[0]=='H')
        x=0;
    else
        x=1;
    if(b[0]=='H')
        y=1;
    else
        y=0;
    y^=x;
    if(y)
        printf("H\n");
    else
        printf("D\n");
    return 0;
}


Measured memory_bytes: 128
#include <algorithm>
#include <cmath>
#include <climits>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <cassert>
#include <functional>

using namespace std;

#define LOG(...) printf(__VA_ARGS__)
//#define LOG(...)
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).rbegin(),(c).rend())
#define CLR(a) memset((a), 0 ,sizeof(a))

typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

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

int main() {
	int n, m;
	cin >> n >> m;
	vector<pair<int, int>> vpii(m);
	REP(i, m){
		cin >> vpii[i].first >> vpii[i].second;
	}
	int ans = n+1;
	int count = 0;
	int beg=0;
	FOR(i, 1, n + 1){
		REP(j, m){
			if (vpii[j].first == i){
				count++;
			if (count == 1)
				beg = i;
				}
			if (vpii[j].second == i){
				count--;
			if (count == 0)
				ans += (i - beg) * 2;
				}
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 3104
#include <bits/stdc++.h>
	#include <cstdio>
	#include <cstring>
	#include <cmath>
	#include <cstring>
	#include <chrono>
	#include <complex>
	#define endl "\n"
	#define ll long long int
	#define vi vector<int>
	#define vll vector<ll>
	#define vvi vector < vi >
	#define pii pair<int,int>
	#define pll pair<long long, long long>
	#define mod 1000000007
	#define mod2 998244353
	#define inf 1000000000000000001;
	#define all(c) c.begin(),c.end()
	#define sz(v) ((ll)(v).size())
	#define mp(x,y) make_pair(x,y)
	#define mem(a,val) memset(a,val,sizeof(a))
	#define eb emplace_back
	#define pb push_back
	#define f first
	#define s second
	#define dbg(a) cout<<#a<<" --> "<<(a)<<"\n";
	#define forn(i,n) for (ll i=0; i<(n); ++i)
	#define fornd(i,n) for (ll i=(n)-1; i>=0; --i)
	#define forab(i,a,b) for (ll i=(a); i<=(b); ++i)
	#define fast_io ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
	using namespace std;
	bool isPowerOfTwo(int x) {
    return x && (!(x & (x - 1)));
	}
	int takemod(int x) {
    return (x % mod + mod) % mod;
	}
 
	int fpow(int base, int power, int MOD) {
    int result = 1;
    base = base % MOD;
    while (power) {
        if (power & 1)
            result = (result * base) % MOD;
        base = (base * base) % MOD;
        power = power >> 1;
    }
    return result;
	}
 
	int modinv(int x) {return fpow(x, mod - 2, mod);}
	vector<pll> trial_division1(long long n) {
    vector<pll> factorization;
    for (long long d = 2; d * d <= n; d++) {
        if(n%d==0)
        {
        	ll er=d,pw=0;;
	        while (n % d == 0) {
	            //factorization.push_back(d);
	            pw++;
	            n /= d;
	        }
	        factorization.pb(mp(er,pw));
        }
    }
    if (n > 1)
        factorization.push_back(mp(n,1));
    return factorization;
}
		
	void solve()
	{
		ll n;
		cin>>n;
		vector<pll> tr=trial_division1(n);
		ll ans=0;
		//dbg(tr.size());
		for(auto i:tr)
		{
			ll ut=sqrt(1+8*i.s);
			ut-=1;
			ut/=2;
			ans+=ut;

		}
		cout<<ans<<endl;
	}
	int main()
	{	
		#ifndef ONLINE_JUDGE
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
		#endif
		fast_io;
		int T=1;
		//cin>>T;
		// cin.ignore(); must be there when using getline(cin, s)
		while(T--)
		{
			solve();
		}
		return 0;
	}


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

    return 0;
}

Measured memory_bytes: 4288
import itertools

N, M = (int(x) for x in input().split())
ls_k = []

for i in range(M):
    string_k = input().split()
    ls_k.append(list(map(int, string_k)))
    del ls_k[i][0]

string_p = input().split()
ls_p = list(map(int, string_p))

ans = 0


def S_gen(N):
    S_pat = []
    set_lis = list(range(1, N+1))
    for i in range(1, N+1):
        S_pat.extend(list(itertools.combinations(set_lis, i)))
    return S_pat


S_pat = S_gen(N)
S_pat.extend(("a"))
count = 0

for i in S_pat:
    correct = True
    for j in range(M):
        check = []
        # print(set(ls_k[j][:]))
        # print(set(i))
        check = list(set(ls_k[j][:]) & set(i))
        # print(check)
        if len(check) % 2 != ls_p[j]:
            correct = False
    # print(correct)
    if correct:
        count += 1

print(count)


Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
using namespace std;

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

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

  int n; cin >> n;
  vector<int> v(n);
  rep(i, n) cin >> v[i];
  sort(v.begin(), v.end());

  double ans = v[0];
  for(int i = 1; i < n; i++) {
    ans = (ans+v[i])/2.0;
  }

  cout << fixed << setprecision(10) << '\n';
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 256
//{{{
#include <bits/stdc++.h>
using namespace std;
#define repX(a,b,c,x,...) x
#define repN(a) repX a
#define rep(...) repN((__VA_ARGS__,rep3,rep2,loop))(__VA_ARGS__)
#define rrep(...) repN((__VA_ARGS__,rrep3,rrep2))(__VA_ARGS__)
#define loop(n) rep2(i_,n)
#define rep2(i,n) rep3(i,0,n)
#define rep3(i,begin,end) for(int i=(int)(begin),i##_end=(int)(end);i<i##_end;++i)
#define rrep2(i,n) rrep3(i,n,0)
#define rrep3(i,begin,end) for(int i=(int)(begin-1),i##_end=(int)(end);i>=i##_end;--i)
#define foreach(x,a) for(auto&x:a)
using ll=long long;
const ll mod=(ll)1e9+7;
//}}}

ll x[200000];
ll y[200000];
ll maxY[200000];
set<ll> st;

int main(){
  ll H, W, N;
  // cin >> H >> W >> N;
  cin >> W >> H >> N;
  rep(i, N){
    cin >> x[i] >> y[i];
    x[i]--;
    y[i]--;
    st.insert(y[i] * W + x[i]);
  }
  maxY[0] = 0;
  rep(w, 1, W){
    if(st.count((maxY[w - 1] + 1) * W + w)){
      maxY[w] = maxY[w - 1];
    }else{
      maxY[w] = maxY[w - 1] + 1;
    }
  }

  ll ans = W;
  rep(i, N){
    ll xx = x[i];
    ll yy = y[i];
    if(yy <= maxY[xx - 1]){
      ans = min(ans, xx);
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 14336
import bisect,collections,copy,heapq,itertools,math,string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())

n = I()
cnt = 0
for i in range(1, n+1, 2):
    divcnt = 0
    for j in range(1, i+1, 2):
        if i % j == 0:
            divcnt += 1
    if divcnt == 8:
        cnt += 1
print(cnt)

Measured memory_bytes: 10048
let cnt = ref 0
let (g : int list ref) = ref []

let insertion_sort (a : int array) n g =
  let rec insert j v =
    if j < 0 || a.(j) <= v then a.(j+g) <- v
    else begin
      a.(j+g) <- a.(j);
      incr cnt;
      insert (j - g) v
    end in
  let rec doit i =
    if i < n then begin
      insert (i - g) a.(i);
      doit (i + 1)
    end in
  doit g

let generate_g n =
  let rec doit i g acc =
    if g > n then acc
    else doit (i + 1) (int_of_float (4.**(float_of_int i) +. 3.*.2.**(float_of_int (i - 1)) +. 1.)) (g :: acc) in
  doit 1 1 []

let shell_sort (a : int array) n =
  cnt := 0;
  g := generate_g n;
  List.iter (fun g -> insertion_sort a n g) !g

let () =
  let n = read_int () in
  let a = Array.init n (fun _ -> read_int ()) in
  shell_sort a n;
  Printf.printf "%d\n" (List.length !g);
  List.iteri (fun i n -> if i <> 0 then print_string " "; print_int n) !g;
  print_newline ();
  Printf.printf "%d\n" !cnt;
  Array.iter (fun n -> Printf.printf "%d\n" n) a

Measured memory_bytes: 12608
#include<bits/stdc++.h>
#define _ ios_base::sync_with_stdio(0);cin.tie(0);
#define REP(i,n) for(int i=0;i<(int)(n);i++)

using namespace std;
int a[200010];
int main(){ _;
  int n;cin>>n;
  REP(i,n){
    cin>>a[i];
    a[i]--;
  }
  int cnt=0;
  REP(i,n){
    if(a[i]<i)continue;
    if(a[a[i]]==i)cnt++;
  }
  cout<<cnt<<endl;
}


Measured memory_bytes: 640
function Main(input) {
  input = input.split(' ').map(x => x*1);
   
  // Eulidean Algorithm
  function gcd(a1, a2) {
    return a2 == 0 ? a1 : gcd(a2, a1 % a2);
  }

  var result = gcd(input[0], input[1]);
  var answer = 1;

  for(var i = 2; i * i < result; i++) {
    if(result % i === 0) {
      answer++;
      while(result % i === 0) {
        result /= i;
      }
    }
  }
  if( result !== 1) {
    answer++;
  }

  console.log(answer);


}
Main(require('fs').readFileSync('/dev/stdin', 'utf-8'));


Measured memory_bytes: 7500
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using Graph=vector<vector<int>>;

int main(){
  int N,K;
  cin>>N>>K;
  vector<int> A(N);
  int k;
  for(int i=0;i<N;i++){
    cin>>A.at(i);
    if(A.at(i)==1){
      k=i+1;
    }
  }
  N--;
  cout<<(N-1)/(K-1)+1<<endl;
}


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

int main(){
	int N, M;
	cin >> N >> M;
	vector<pair<int, int> > P(N);
	for(int i = 0; i < N; i++) cin >> P[i].second >> P[i].first;
	vector<int> C(M);
	for(int i = 0; i < M; i++) cin >> C[i];
	sort(P.begin(), P.end(), greater<pair<int, int> >());
	sort(C.begin(), C.end(), greater<int>());
	int res = 0;
	int index = 0;
	for(int i = 0; i < N; i++){
		if(P[i].second <= C[index]){
			res++;
			index++;
		}
	}
	cout << res << endl;
	return 0;
}


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

// 2 2 -> 0
// 2 1 -> 2
// 2 0 -> 0
// 1 2 -> -2
// 1 1 -> 0
// 1 0 -> 0
// 0 2 -> 0
// 0 1 -> 0
// 0 0 -> 0


int main(){
     int d,t,s;
     cin>>d>>t>>s;
     if((double)d/s<=(double)t){
         cout<<"Yes";
     }else{
         cout<<"No";
     }
}


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

int main() {
  int n;
  cin >> n;
  vector<ll> a(n);
  rep(i,n) cin >> a.at(i);
  
  ll stock=0;
  ll balance=1000;
  
  for (int i=0; i<n-1; ++i) {
    if (a.at(i)<a.at(i+1)) {
      if (balance<a.at(i)) continue;
      stock+=balance/a.at(i);
      balance=balance%a.at(i);
    } else {
      if (stock==0) continue;
      balance+=stock*a.at(i);
      stock=0;
    }
  }

  if (stock!=0) {
    balance+=stock*a.at(n-1);
    stock=0;
  }
  
  cout << balance << endl;
  return 0;
}

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

int main(){
int A, B, C, D;
cin >> A >> B >> C >> D;
if (abs(A - C) <= D){
    cout << "Yes" << endl;
}
else if (abs(A -B) <= D && abs(B - C) <= D){
    cout << "Yes" << endl;
}
else {
    cout << "No" << endl;
}
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<string>
#include<cstring>
#include<queue>
#include<vector>
#include<functional>
#include<cmath>
#include<map>
#include<stack>
#include<set>
#include<numeric>
#include<limits>
#include<iomanip>
#include<iterator>

#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define rep(i,n) for(int i=0; i<n; i++)
#define FOR(i,a,n) for(int i=a; i<n; i++)

using namespace std;
typedef long long ll;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<ll, char> plc;

int main()
{
	int n,ki=0,gu = 0;
	cin >> n;

	rep(i, n) {
		int a;
		cin >> a;
		if (a % 2 != 0) ki++;
	}

	gu = n - ki;

	cout << pow(3, n) - max((int)pow(2,gu),1) << endl;
	return 0; 
}

Measured memory_bytes: 256
//                             In The Name Of Allah
#include <bits/stdc++.h>
#define	ss second
#define ff first
#define use_fast ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define ret(n) return cout << n, 0
#define se(n) cout << setprecision(n) << fixed
#define pb push_back
#define int long long
#define ld long double
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops")
#pragma GCC optimize("no-stack-protector,fast-math")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std; 

const int N = 100, OO = 1e16 + 7, T = 13, M = 1e9 + 7, P = 6151, SQ = 800, lg = 32;
typedef pair <int, int> pii;
int dp[N][20], dk[N];

int32_t main() {
	use_fast;
	int n;
	cin >> n;
	if(n <= 10)	
		return cout << n, 0;
	for(int i = 0; i <= 9; i++)
		dp[1][i] = 1;
	int sum = 9, en = 0;
	dk[1] = 9;
	for(int i = 2; i <= 50; i++) {
		for(int j = 0; j <= 9; j++) {
			dp[i][j] = dp[i - 1][j];
			if(j - 1 >= 0)
				dp[i][j] += dp[i - 1][j - 1];
			if(j + 1 <= 9)
				dp[i][j] += dp[i - 1][j + 1];
			if(j)
				sum += dp[i][j];
		}
		en = i;
		dk[i] = sum;
		if(sum >= n)
			break;
	}
	if(sum == n) {
		int ans = 0;
		for(int i = 0; i < en; i++)
			ans = (ans * 10) + 9;
		cout << ans << endl;
		return 0;
	}
	n -= dk[en - 1];
	int ans = 0;
	for(int i = en; i > 0; i--) {
		if(i == en) {
			for(int j = 1; j <= 9; j++) {
				if(dp[i][j] >= n) {
					ans = (ans * 10) + j;
					break;
				}
				n -= dp[i][j];
			}
		}
		else {
			int t = ans % 10;
			if(t - 1 >= 0) {
				if(dp[i][t - 1] >= n) {
					ans = (ans * 10) + t - 1;
					continue;
				}
				n -= dp[i][t - 1];
			} 
			if(dp[i][t] >= n) {
				ans = (ans * 10) + t;
				continue;
			}
			n -= dp[i][t];
			ans = (ans * 10) + (t + 1);
			continue;
		}
	}
	cout << ans << endl;
	return 0; 
} 
/*
be carefull :
1- if not solve after 20 min, read again twice
2- after submit read the code again
3- fun with contest
4- ... 
*/

Measured memory_bytes: 256