akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define itrfor(itr,A) for(auto itr = A.begin(); itr !=A.end();itr++)
typedef long long llong;
char moji[26]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
char moji2[26]={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
char moji3[10]={'0','1','2','3','4','5','6','7','8','9'};
#define Sort(a) sort(a.begin(),a.end());
#define Reverse(a) reverse(a.begin(),a.end());
#define print(a) cout << a << endl;
#define MAX 51



llong pmai[MAX];
llong allmai[MAX];

llong cnt(int lev,llong maisuu){
    llong ans=0;
    if(maisuu <= 1) return 0;
    maisuu -=1;
    if( allmai[lev-1] <= maisuu){

        ans += pmai[lev -1];

        maisuu -= allmai[lev -1];
    }
    else{
        ans += cnt(lev-1,maisuu);
        maisuu = 0;
    }
    if(maisuu == 0) return ans;
    maisuu -=1;
    ans += 1;
    if(maisuu == 0) return ans;
    if( allmai[lev-1] <= maisuu){
        ans += pmai[lev-1];
        return ans;
    }
    else{
        ans += cnt(lev-1,maisuu);
    }
    return ans;


}


int main(){
    int lev;
    llong x;
    cin >> lev;
    cin >> x;


    allmai[0] = 1;
    FOR(i,1,51) allmai[i] = 3 + 2 * allmai[i-1];


    pmai[0] = 1;
    FOR(i,1,51) pmai[i] = 1 + 2 * pmai[i-1];
   
    llong ans = cnt(lev,x);

    cout << ans << endl;
}

Measured memory_bytes: 256
/*
 * b.cpp
 *
 *  Created on: 2017/08/22
 *      Author: pinebooks
 */

#include <iostream>
#include <string>

using namespace std;

int main() {
  string s;
  cin >> s;
  for (char c = 'a'; c <= 'z'; c++) {
    bool found = false;
    for (int i = 0; i < s.length(); i++) {
      if (s[i] == c)
        found = true;
    }
    if (!found) {
      cout << c << endl;
      return 0;
    }
  }
  cout << "None" << endl;
  return 0;
}


Measured memory_bytes: 764
parseInt(x)=parse(Int,x)
parseMap(x::Array{SubString{String},1})=map(parseInt,x)
mod2(x::Int64)=mod(x,2)

function multiplier2(x::Int64)
    ret = 0
    while mod(x, 2) == 0
        x /= 2
        ret += 1
    end
    return(ret)
end

function main()
    n = parseInt(readline())
    a = parseMap(split(readline()))

    ans = 0
    for i in 1:n
        ans += multiplier2(a[i])
    end

    println(ans)
end

main()


Measured memory_bytes: 124576
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef std::vector<ll> lls;
constexpr ll INF = 1LL << 60;
template<class T> inline void chmin(T& a, T b) { if (a > b) a = b; }
template<class T> inline void chmax(T& a, T b) { if (a < b) a = b; }

void cinv(lls& llVec, ll n, bool to_0_origin = false) {
	ll val;
	llVec.reserve((size_t)(n));
	for (ll i = 0; i < n; i++) {
		cin >> val;
		if (to_0_origin) val--;
		llVec.push_back(val);
	}
}


int main()
{
	ll N;
	cin >> N;
	lls h;
	cinv(h, N);

	lls tbl(N, INF);
	tbl[0] = 0;

	for (ll i = 0; i < N - 1; i++) {
		if (i + 1 < N) {
			ll cost = h[i] - h[i + 1];
			if (cost < 0) cost *= -1;
			//tbl[i + 1] = std::min(tbl[i + 1], tbl[i] + cost);
			chmin(tbl[i + 1], tbl[i] + cost);
		}

		if (i + 2 < N) {
			ll cost = h[i] - h[i + 2];
			if (cost < 0) cost *= -1;

			//tbl[i + 2] = std::min(tbl[i + 2], tbl[i] + cost);
			chmin(tbl[i + 2], tbl[i] + cost);
		}
	}

	cout << tbl[N-1] << '\n';

	return 0;
}



Measured memory_bytes: 1792
# Binary search trees - Binary Search Tree II
class Tree:
    def __init__(self):
        self.root = None
        self.size = 0
    
    def find(self, key):
        return self._find(key, self.root)

    def _find(self, key, nd):
        if not nd: return False
        if nd.key == key: return True
        if key < nd.key:
            return self._find(key, nd.left)
        else:
            return self._find(key, nd.right)
    
    def printorder(self):
        self._preorder_walk(self.root)
        print()
        self._inorder_walk(self.root)
        print()

    def _inorder_walk(self, nd):
        print(' {0}'.format(nd.key), end='')
        if nd.left: self._inorder_walk(nd.left)
        if nd.right: self._inorder_walk(nd.right)

    def _preorder_walk(self, nd):
        if nd.left: self._preorder_walk(nd.left)
        print(' {0}'.format(nd.key), end='')
        if nd.right: self._preorder_walk(nd.right)

class Node:
    def num_child(self):
        d = 1 if self.left else 0
        d += 1 if self.right else 0
        return d
    def __init__(self, key):
        self.key = key
        self.right,self.left = None,None
        self.parent = None
    def __str__(self):
        return 'node key: ' + str(self.key)

def insert(T, z):
    y = None
    x = T.root
    while not x == None:
        y = x
        if z.key < x.key:
            x = x.left
        else:
            x = x.right
    z.parent = y
    if z.parent == None:
        T.root = z
    elif z.key < y.key:
        y.left = z
    else:
        y.right = z
    T.size += 1

m = int(input())
T = Tree()
for _ in range(m):
    ss = input().split()
    op = ss[0]
    if op == 'insert':
        v = int(ss[1])
        insert(T, Node(v))
    elif op == 'print':
        T.printorder()
    elif op == 'find':
        v = int(ss[1])
        if T.find(v): print('yes')
        else: print('no')


Measured memory_bytes: 124656
program Ferriswheel
 implicit none
 integer A, B, D, E
 read(*,*) A, B
 D = B/2
 E = 0
  if (A.le.5) then
  write(*,*) E
  else if (A.le.12) then
  write(*,*) D
  else if (A.ge.13) then
  write(*,*) B
  end if
end program

Measured memory_bytes: 768
#!/usr/bin/env python3
# Atcoder necoak answer
# https://atcoder.jp/contests/abc126/tasks/abc126_a

intext1 = input()
[n, k] = map(int, intext1.split())

intext2 = input()

outtext = intext2[:k-1] .lower()
if k == 1:
    outtext = intext2[0].lower() + intext2[1:]
elif k == n:
    outtext = intext2[:k-1] + intext2[k-1].lower()
else:
    outtext = intext2[0:k-1] + intext2[k-1].lower() + intext2[k:]

print(outtext)


Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
#include <iomanip>
#include <set>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define int long long
#define pie 3.141592653589793238462643383279
#define mod 1000000007
#define INF 1145141919364364
#define all(vec) vec.begin(),vec.end()
#define P pair<int,int>
#define S second
#define F first
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}
bool prime(int x) {
	for (int i = 2; i <= sqrt(x); i++) {
		if (x%i == 0)return false;
	}
	return true;
}

int kai(int x) {
	if (x == 1)return 1;
	return kai(x - 1)*x%mod;
}

int mod_pow(int x, int y, int moder) {
	int res = 1;
	while (y > 0) {
		if (y & 1)res = res * x%moder;
		x = x * x%moder;
		y >>= 1;
	}
	return res;
}

int comb(int x, int y) {
	if (y > x)return 0;
	if (x == y)return 1;
	return kai(x)* mod_pow(kai(x - y), mod - 2, mod) % mod * mod_pow(kai(y), mod - 2, mod) % mod;
}

int n, ans;

signed main(){
	cin >> n;
	for (int i = 1; i <= n; i++) {
		if (i < 10 || (i >= 100 && i < 1000) ||( i >= 10000&&i<100000))ans++;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#pragma region template
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using vld = vector<ld>;
using vvld = vector<vld>;
using vvvld = vector<vvld>;
using vs = vector<string>;
using pll = pair<ll, ll>;
using vp = vector<pll>;
template <typename T>
using pqrev = priority_queue<T, vector<T>, greater<T>>;
#define rep(i, n) for (ll i = 0, i##_end = (n); i < i##_end; i++)
#define repb(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repr(i, a, b) for (ll i = (a), i##_end = (b); i < i##_end; i++)
#define reprb(i, a, b) for (ll i = (b)-1, i##_end = (a); i >= i##_end; i--)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((ll)(x).size())
//*
constexpr ll MOD = 1e9 + 7;
/*/
constexpr ll MOD = 998244353;
//*/
constexpr ll INF = 1e+18;
constexpr ld EPS = 1e-12L;
constexpr ld PI = 3.14159265358979323846L;
constexpr ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
constexpr ll LCM(ll a, ll b) { return a / GCD(a, b) * b; }
template <typename S, typename T>
constexpr bool chmax(S &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename S, typename T>
constexpr bool chmin(S &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
#ifdef OJ_LOCAL
#include "dump.hpp"
#else
#define dump(...) ((void)0)
#endif
template <typename T>
bool print_(const T &a) {
  cout << a;
  return true;
}
template <typename T>
bool print_(const vector<T> &vec) {
  for (auto &a : vec) {
    cout << a;
    if (&a != &vec.back()) {
      cout << " ";
    }
  }
  return false;
}
template <typename T>
bool print_(const vector<vector<T>> &vv) {
  for (auto &v : vv) {
    for (auto &a : v) {
      cout << a;
      if (&a != &v.back()) {
        cout << " ";
      }
    }
    if (&v != &vv.back()) {
      cout << "\n";
    }
  }
  return false;
}
void print() { cout << "\n"; }
template <typename Head, typename... Tail>
void print(Head &&head, Tail &&... tail) {
  bool f = print_(head);
  if (sizeof...(tail) != 0) {
    cout << (f ? " " : "\n");
  }
  print(forward<Tail>(tail)...);
}
#pragma endregion

void Pr(bool f){
  cout << (f ? "Yes" : "No") << "\n";
  exit(0);
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  ll n, m, k;
  cin >> n >> m >> k;
  vll a(n);
  rep(i, n){
    cin >> a[i];
  }
  vll b(m);
  rep(i, m){
    cin >> b[i];
  }
  rep(i, n-1) a[i+1] += a[i];
  rep(i, m-1) b[i+1] += b[i];
  ll ans = 0;
  repb(i, m){
    if(b[i] <= k){
      chmax(ans, i+1);
      break;
    }
  }
  rep(i, n){
    auto cond = [&](ll mid) -> bool{
      return a[i]+b[mid]<=k;
    };
    auto BS = [&](ll true_max, ll false_min){
      while(false_min - true_max > 1){
        ll mid = true_max + ((false_min - true_max) / 2);
        (cond(mid) ? true_max : false_min) = mid;
      }
      return true_max;
    };
    ll res = BS(-1, m);
    dump(i, res);
    if(a[i] <= k) chmax(ans, i+2+res);
  }
  print(ans);
}


Measured memory_bytes: 6368
#![allow(non_snake_case)]
#![allow(unused_imports)]
#![allow(dead_code)]

use proconio::{input, fastout};
use proconio::marker::*;
use whiteread::parse_line;
use std::collections::*;
use num::*;
use num_traits::*;
use superslice::*;
use std::ops::*;

use itertools::Itertools;
use itertools_num::ItertoolsNum;


#[fastout]
fn solve() {
    const MOD: usize = 1_000_000_007;
    const INF: usize = std::usize::MAX;
    
    input!{
        n: usize, x: usize,
        m_vec: [usize; n]
    }

    let sum = m_vec.iter().sum::<usize>();
    
    let min = m_vec.iter().min().unwrap();

    println!("{}", (x - sum) / min + n);
}

fn main() {
    solve()
}

#[cfg(test)]
mod test {
    use super::solve;
}


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

using namespace std;

int main() {
int a,b;
cin >> a >> b;
if ((b/2019)-(a/2019)>0){std::cout << 0 << '\n';return 0;}
int c = a%2019;
int d = b%2019;
bool flag = false;
int e = 2019;
for (int i = c; i<d; ++i){
  for (int j = i+1; j<=d; ++j){
    if(((i*j)%2019)==0){flag = true;goto OUT;}
    e = min(e,(i*j)%2019);
  }
}
OUT:
if (flag){std::cout << 0 << '\n';}
else{std::cout << e << '\n';}
return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;
int digits[100005];
int main()
{
    for(int i=1;i<=100000;i++)
    {
        int tmp=i;
        while(tmp)
        {
            digits[i]+=tmp%10;
            tmp/=10;
        }

    }
    int N;
    cin>>N;
    int ans=1<<30;
    for(int i=1;i<=N/2+1;i++)
    {
        if(digits[i]+digits[N-i]<ans)
            ans=digits[i]+digits[N-i];
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
#define int long long
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr long long INFL = numeric_limits<long long>::max() / 2;
constexpr int MOD = 1000000007;
using Graph = vector<vector<int>>;



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

    int N;
    string s,t;
    cin>>N>>s>>t;
    int m=2*N;
    int ans=m;
    if(s==t) cout << N << endl;
    else{
        for(int i=1;i<N;i++){
            if(s.substr(N-i,i)==t.substr(0,i)){
                ans=min(m-i,ans);
            }
            
        }
        cout << ans << endl;
    }



}


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

int sum(vector<int> W,int n,int start) {
  // ベースケース
  if (n == start) {
    return W.at(start);
  }
  // 再帰ステップ
  int s = sum(W,n - 1,start);
  return s + W.at(n);
}



int main(){
    int N;
    cin >> N;
    vector<int> W(N);
    for(int i=0;i<N;i++){
      cin>>W.at(i);
    }

    int S1,S2,ans,min,total;
    total=sum(W,N-1,0);
    min=total;
    for (int t=0;t<N;t++){
    S1=sum(W,t,0);
    S2=total-S1;

    if(min>abs(S1-S2))min=abs(S1-S2);
  }
    cout << min << endl;
}


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

int main()
{
    int N, K;
    cin >> N >> K;
    int d;
    
    vector<int> Sunuke(N + 1, 0);
    for (int i = 0; i < K; ++i){
        cin >> d;
        for (int j = 0; j < d;++j){
            int a;
            cin >> a;
            Sunuke.at(a)++;
        }
    }

    int ans = 0;

    for (int i = 1; i <= N; ++i){
        if(Sunuke.at(i) == 0){
            ++ans;
        }
    }

    cout << ans << endl;

    return 0;
}

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

const int N = 2000;
const long long P = 1000000007;

long long ans[N+5];

int main(){
    ans[3] = 1;
    for (int i = 4; i <= N; ++i){
        ans[i] = (ans[i-1] + ans[i-3]) % P;
    }
    int n; cin >> n;
    cout << ans[n] << endl;
    return 0;
}

Measured memory_bytes: 3632
#include <stdio.h>
#include<iostream>
#include<string>
#include <string.h>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <climits>
#include <map>
using namespace std;
int main() {
    long long a,b,c,d,ans=LLONG_MIN;
    cin>>a>>b>>c>>d;
    ans=max(ans,a*c);
    ans=max(ans,a*d);
    ans=max(ans,b*c);
    ans=max(ans,b*d);
    cout<<ans<<endl;
    return 0;
}


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

using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define MOD 1000000007LL

#define rep(i, n) for(ll (i) = 0LL;(i) < (ll)(n);(i)++)
#define rep2(i, s, e) for(ll (i) = (ll)(s);(i) < (ll)(e);(i)++)
#define repi(i, n) for(ll (i) = 0LL;(i) <= (ll)(n);(i)++)
#define repi2(i, s, e) for(ll (i) = (ll)(s);(i) <= (ll)(e);(i)++)
#define per(i, n) for(ll (i) = (ll)(n) - 1LL;(i) >= 0LL;(i)--)
#define per2(i, s, e) for(ll (i) = (ll)(s) - 1LL;(i) >= (ll)(e);(i)--)
#define peri(i, n) for(ll (i) = (ll)(n);(i) >= 0LL;(i)--)
#define peri2(i, s, e) for(ll (i) = (ll)(s);(i) >= (ll)(e);(i)--)
#define iter(i, it) for(auto &(i): (it))

template<typename T, typename U> ostream& operator<<(ostream &s, const pair<T, U> m) {
    cout << "(" << m.first << ", " << m.second << ")";
    return s;
}
template<typename T, typename U> ostream& operator<<(ostream &s, const map<T, U> m) {
    ll c = 0;
    cout << "{ ";
    iter(i, m) cout << i << (c++ == m.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const vector<T> &v) {
    cout << "{ ";
    rep(i, v.size()) cout << v[i] << (i == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const list<T> &v) {
    ll c = 0;
    cout << "{ ";
    iter(i, v) cout << i << (c++ == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}

int main(void) {
    ll A, B, K;
    ll i;
    cin >> A >> B >> K;
    for(i = min(A, B);K;i--) {
        if(A % i == 0 && B % i == 0) K--;
    }
    cout << i + 1 << endl;
    return 0;
}


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


# 入力を整数に変換して受け取る
def input_int():
    return int(input())


# マイナス1した値を返却
def int1(x):
    return int(x) - 1


# 半角スペース区切り入力をIntに変換してMapで受け取る
def input_to_int_map():
    return map(int, input().split())


# 半角スペース区切り入力をIntに変換して受け取る
def input_to_int_tuple():
    return tuple(map(int, input().split()))


# 半角スペース区切り入力をIntに変換してマイナス1した値を受け取る
def input_to_int_tuple_minus1():
    return tuple(map(int1, input().split()))


def main():
    n = input_int()
    a_list = input_to_int_tuple()

    cnt = 0
    for index, value in enumerate(a_list):
        if (index + 1) % 2 == 1 and value % 2 == 1:
            cnt += 1

    return cnt

if __name__ == "__main__":
    print(main())

Measured memory_bytes: 9112
import fractions
import math
a,b,c,d=map(int,input().split())
k=c*d//fractions.gcd(c,d)
ans=b-a+1
ca=(a-1)//c+1
cb=b//c
da=(a-1)//d+1
db=b//d
ka=(a-1)//k+1
kb=b//k
ans-=cb-ca+1
ans-=db-da+1
ans+=kb-ka+1
print(ans)

Measured memory_bytes: 5044
# -*- coding: utf-8 -*-
"""
Created on Tue May 12 14:18:43 2020

@author: shinba
"""

def is_integer_num(n):
    if isinstance(n, int):
        return True
    if isinstance(n, float):
        return n.is_integer()
    return False

r,g,b,n = map(int,input().split())
ans = 0

for i in range(n+1):
    for j in range(n+1):
        if is_integer_num((n-i*r-j*g)/b) and 0 <= n-i*r-j*g:
            ans += 1

print(ans)
            


Measured memory_bytes: 42348
#include <bits/stdc++.h>
using namespace std ;
int main()
{
  int a,b;
  cin >> a >> b ;
  if(a>=13)
  cout << b ;
  else if(a>=6 && a<=12)
    cout << b/2 ;
  else if(a<=5)
    cout << 0 ;
  return 0 ;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define REP(i, n) for(ll i = 0;i < n;i++)
#define ll long long
#define MOD 1000000007
using vi = vector<ll>; // intの1次元の型に vi という別名をつける
using vvi = vector<vi>; // intの2次元の型に vvi という別名をつける

ll n,k,x,y;

//DFS
vector<vector<pair<int, int>>> g;
const int N = 1e5;
int used_t[N];
int used_a[N];
int col_t[N];
int col_a[N];


void dfs_t(int i, int c) {
  if(used_t[i]) return;
  used_t[i] = 1;
  col_t[i] = c;
  for(auto to : g[i]) {
    dfs_t(to.first, c + 1);
  }
}

void dfs_a(int i, int c) {
  if(used_a[i]) return;
  used_a[i] = 1;
  col_a[i] = c;
  for(auto to : g[i]) {
    dfs_a(to.first, c + 1);
  }
}



ll u,v;
int main() {
  ll ans=0;
  cin>>n>>u>>v;
  u--;
  v--;
  g.resize(n);
  for(int i = 0; i < n-1; i++) {
    int a, b, c;
    cin >> a >> b ;
    a--; b--;
    c=0;
    g[a].emplace_back(b, c);
    g[b].emplace_back(a, c);
  }

  dfs_t(u, 0);
  dfs_a(v, 0);


  REP(i,n){
    if (col_t[i]<=col_a[i]){
      ans=max(ans,(ll)col_a[i]);
    }
  }

  cout<<ans-1<<endl;



}


Measured memory_bytes: 9984
#include <iostream>
#include <string>

using namespace std;

int main()
{
	int n;
	cin >> n;
	n %= 10;
	switch (n) {
	case 0:
	case 1:
	case 6:
	case 8:
		cout << "pon" << endl;
		break;
	case 2:
	case 4:
	case 5:
	case 7:
	case 9:
		cout << "hon" << endl;
		break;
	case 3:
		cout << "bon" << endl;
		break;
	}

	return 0;
}

Measured memory_bytes: 3592
#include<bits/stdc++.h>
using namespace std;
int main()
{
string s;
map<string,int>m;
int a,b,i,j,k,l=0;
vector<string>v;
cin>>a;
for(i=1;i<=a;i++)
{
cin>>s;
m[s]++;v.push_back(s);
}
cin>>b;
for(i=1;i<=b;i++)
{
cin>>s;m[s]--;
}
for(i=0;i<v.size();i++)
{
l=max(l,m[v[i]]);

}
cout<<l<<endl;
}

Measured memory_bytes: 256
m,p=map(int,input().split())
a=list(map(int,input().split()))

from operator import mul
from functools import reduce

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

g=k=0
for i in a:
    if i % 2 == 0 : g+=1
    elif i % 2 == 1 : k+=1

all_g = all_k =0
for i in range(g+1):
    all_g += cmb(g,i)
        
if p == 0:
    for i in range(0,k+1,2):
        all_k += cmb(k,i)
elif p == 1:
    for i in range(1,k+1,2):
        all_k += cmb(k,i)
print(all_g * all_k)
        

Measured memory_bytes: 38512
import sys
sys.setrecursionlimit(1000000)

h, w = map(int, input().split())
s = [input() for _ in range(h)]
t = [[None]*w for _ in range(h)]

def dfs(i,j,color): # i,jの色がcolorと同じなら0, colorと異なるなら連結成分でまだカウントされていない要素を数えてその白黒の数を返す
    if not(0<=i<h and 0<=j<w): return 0,0 # i,jが意味をなさないとき
    if s[i][j]==color: return 0,0 # i,jの色がcolorと同じとき
    if t[i][j]: return 0,0 # すでにカウントしたi,jであったとき
    
    t[i][j]=True
    c = s[i][j]
    bl, wh=0,0
    if c=='#':
        bl+=1
    else:
        wh+=1
    

    # tmp1,tmp2=dfs(i+1,j,c)
    # bl,wh=bl+tmp1,wh+tmp2

    # tmp1,tmp2=dfs(i-1,j,c)
    # bl,wh=bl+tmp1,wh+tmp2
            
    # tmp1,tmp2=dfs(i,j-1,c)
    # bl,wh=bl+tmp1,wh+tmp2

    # tmp1,tmp2=dfs(i,j+1,c)
    # bl,wh=bl+tmp1,wh+tmp2

    # return bl,wh

    tmp1, tmp2 = dfs(i-1,j,s[i][j])
    bl,wh = bl+tmp1, wh+tmp2

    tmp1, tmp2 = dfs(i+1,j,s[i][j])
    bl,wh = bl+tmp1, wh+tmp2

    tmp1, tmp2 = dfs(i,j-1,s[i][j])
    bl,wh = bl+tmp1, wh+tmp2

    tmp1, tmp2 = dfs(i,j+1,s[i][j])
    bl,wh = bl+tmp1, wh+tmp2

    return bl,wh

ans = 0
for i in range(h):
    for j in range(w):
        a,b = dfs(i,j,'!')
        ans += a*b
print(ans)
    

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

using namespace std;

typedef long long ll;
#define fi first
#define se second
#define pb push_back

int main() {
    //ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int a, b, c;
    scanf("%d %d %d", &a, &b, &c);
    if (a + b + c >= 22) {
        printf("bust");
    } else {
        printf("win");
    }
    return 0;
}


Measured memory_bytes: 3748
#include<stdio.h>
#include<string.h>
#include<math.h>
using namespace std;
int main()
{
	int n,m,k;
	scanf("%d%d%d",&n,&m,&k);
	int sum=0;
	for(int i=100;i>=1;i--)
	{
		if(n%i==0&&m%i==0)
		sum++;
		if(sum==k)
		{
			printf("%d\n",i);
			break;
		}
	}
	return 0;
}

Measured memory_bytes: 128
#include "bits/stdc++.h"
using namespace std;
 
////////////// Prewritten code follows. Look down for solution. ////////////////

#define fs first
#define sc second
#define pb push_back
#define len(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()

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

const ll LINF = 1e18;
const int INF = 1e9;
const int MOD = 1e9+7;

/// command for char arrays with spaces -> scanf(" %[^\n]", texto);
 
////////////////////////// Solution starts below. //////////////////////////////

void change(ll& a, ll b){
	a = min(a, b);
}

int main(){

	int n, W;
	scanf("%lld %lld", &n, &W);
	vector<int> weight(n), value(n);
	int max_value = 0;
	for(int i = 0; i < n; i++){
		scanf("%d %d", &weight[i], &value[i]);
		max_value += value[i];
	}
	vector<ll> dp(max_value+1, LINF); ///minimum total weigth of items with value exactly i
	dp[0] = 0;
	for(int i = 0; i < n; i++){
		for(int value_now = max_value - value[i]; value_now >= 0; value_now--){
			change(dp[value_now + value[i]], dp[value_now] + weight[i]);
		}                                 
	}
	int ans = 0;
	for(int i = max_value; i >= 0; i--){
		if(dp[i] <= W){
			ans = i;
			break;
		}
	}
	printf("%d\n", ans);

	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <set>
using namespace std;

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

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

    set<string> values;
    for (int i = 0; i < n; ++i) {
        values.insert(s[i]);
    }


    cout << values.size() << endl;
}


Measured memory_bytes: 25372
n = int(input())
h = list(map(int,input().split()))

dp = [10**9]*n
dp[0]=0

for i in range(1,n):
    dp[i] = min(dp[i],dp[i-1]+abs(h[i]-h[i-1]))
    if i>1:
        dp[i] = min(dp[i],dp[i-2]+abs(h[i]-h[i-2]))
print(dp[n-1])


Measured memory_bytes: 20448
import math

def aaa(n):
    pl=[0]*(n+1)
    for i in range(1,n+1):
        for l in range (i,n+1,i):
            pl[l]+=1
    return(pl)

n=int(input())
p=(list(range(n+1)))
q=0
pl=aaa(n)
for i in range(n+1):
  q+=p[i]*pl[i]
print(q)

Measured memory_bytes: 229912
N = int(input())
A = [int(i) for i in input().split()]

cnt = 0
for _ in range(100):
    flag = 0
    for i in range(N):
        if A[i] != 0:
            if flag == 0:
                cnt += 1
                A[i] -= 1
                flag = 1
            else:
                A[i] -= 1
        else:
            flag = 0
    # print(cnt, A)
            
print(cnt)

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

const int nm = 2e5;
int n, a[nm], b = 0, l = 0, r = 0;
long long ans = 0;

int main() {
	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> a[i];
	while (l < n) {
		if (r < n && !(b & a[r])) {
			b |= a[r];
			r++;
		} else {
			ans += r - l;
			b &= ~a[l];
			l++;
		}
	}
	cout << ans << endl;
}


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

int main(){
    long long a,b,c;
    cin >> a >> b >> c;
    long long ans;
    if(c<=(a+b)){
        ans=b+c;
        cout << ans << endl;
    }else if(c>(a+b)){
        ans=a+2*b+1;
        cout << ans << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
int main()
{
    int H, W; cin >> H >> W;
    vector<int> count(26);
    for (int i = 0; i < H; i++) {
        string S; cin >> S;
        for (char c : S) count[c-'a']++;
    }
    int one = 0, two = 0, four = 0;
    for (int c : count) {
        four += c / 4, c %= 4;
        two += c / 2, c %= 2;
        one += c;
    }
    int o = H%2&&W%2;
    int t = (H%2&&W%2) ? H/2+W/2 : H%2 ? W/2 : W%2 ? H/2 : 0;
    bool ans = one == o && two <= t && two%2 == t%2;
    cout << (ans ? "Yes" : "No") << endl;
    return 0;
}

Measured memory_bytes: 256
N,M,C = map(int,input().split())
B = list(map(int,input().split()))

ans = 0

for i in range(N):
    temp_score = C
    A = list(map(int,input().split()))
    for j in range(M):
        temp_score += A[j] * B[j]

    if(temp_score > 0):
        ans += 1

print(ans)


Measured memory_bytes: 38512
#-swank
(unless (member :child-sbcl *features*)
  (quit
   :unix-status
   (process-exit-code
    (run-program *runtime-pathname*
                 `("--control-stack-size" "128MB"
                   "--noinform" "--disable-ldb" "--lose-on-corruption" "--end-runtime-options"
                   "--eval" "(push :child-sbcl *features*)"
                   "--script" ,(namestring *load-pathname*))
                 :output t :error t :input t))))
(defmacro dp (name args memo-size &body body)
  (let ((memo (gensym)))
    `(let ((,memo (make-array ,memo-size :initial-element nil)))
       (defun ,name ,args
         (or (aref ,memo ,@args)
             (setf (aref ,memo ,@args)
                   ,@body))))))

(defun split (x str)
  (let ((pos (search x str))
        (size (length x)))
    (if pos
      (cons (subseq str 0 pos)
            (split x (subseq str (+ pos size))))
      (list str))))

(defmacro collect-times (time body)
  `(loop repeat ,time collect ,body))

(defun read-times (time)
  (collect-times time (read)))


(defun ncdr (lst n)
  (if (zerop n)
      lst
      (ncdr (cdr lst) (1- n))))

(defun prefix-equal (str1 str2)
  (unless str1 (return-from prefix-equal t))
  (unless str2 (return-from prefix-equal nil))
  (and (char= (car str1) (car str2)) (prefix-equal (cdr str1) (cdr str2))))

(defun main (str)
  (let ((names (mapcar (lambda (x)
                         (coerce (reverse x) 'list)) (list "dream" "dreamer" "erase" "eraser")))
        (rts (coerce (reverse str) 'list)))
    (labels ((f (lst)
               (unless lst
                 (return-from f t))
               (loop for name in names
                     when (prefix-equal name lst)
                       do
                          (return-from f (f (ncdr lst (length name)))))
               nil))
      (f rts))))

(princ (if (main (read-line)) "YES" "NO"))


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

int main() {
    int n;
    int a;
    cin >> n;
    int t, u, v;
    t = u = v = 0;
    for (int i = 0; i < n; i++) {
        cin >> a;
        if (a % 2 != 0) {
            t++;
        } else if (a % 4 == 0) {
            v++;
        } else {
            u++;
        }
    }
    if (u > 0) {
        cout << ((t <= v)?"Yes":"No");
    } else {
        cout << (((t - 1) <= v)?"Yes":"No");
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
//shan61916
#include <bits/stdc++.h>
  using namespace std;
typedef   long long ll;
typedef   unsigned long long ull ;
typedef   double dll ;

#define   mp make_pair
#define   pb push_back
#define   ff first 
#define   ss second
#define   IOS ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define   endl "\n" 
#define   pll pair<ll, ll>
#define   all(x) x.begin(), x.end()
#define   vll vector<ll> 

const ll inf = (ll)(1e17 + 17);
const ll mod = (ll)(1e9 + 7);


int main(){
 IOS
#ifdef SHAN
    freopen("input.txt" , "r" , stdin);  
#endif
  ll k;
  cin >> k;
  vector<string> lunlun;
  ll point_at = 0;
  for(ll i = 1; i <= 9; i++) {
  	string p = "";
  	p.pb(char(i + '0'));
  	lunlun.pb(p);
  }
  ll tot = 9;
  while(tot < k) {
  	string get = lunlun[point_at];
  	point_at++;
  	ll zz = get.back() - '0';
  	string res;
  	if(zz - 1 > -1) {
  		res = get + char(zz - 1 + '0');
  		lunlun.pb(res);
  		tot++;
  	}	
  	if(zz > -1 and zz < 10) {
  		res = get + char(zz + '0');
  		lunlun.pb(res);
  		tot++;
  	}
  	if(zz + 1 < 10) {
  		res = get + char(zz + 1 + '0');
  		lunlun.pb(res);
  		tot++;
  	}
  }
  // for(auto it: lunlun) cout << it << " ";
  cout << lunlun[k - 1] << endl;
  return 0;
} //good night.

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

int main()
{
    ll x, k, d;
    cin >> x >> k >> d;
    x = abs(x);

    ll ans, temp = min(k, x / d);
    x -= temp * d;
    k -= temp;
    if (k % 2)
        ans = abs(x - d);
    else
        ans = x;

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


Measured memory_bytes: 3584
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
using ll = long long;
#define vl vector<long long>
#define vvl vector<vector<long long>>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using pll = pair<long long,long long>;
#define cY cout<<"Yes"<<endl
#define cN cout<<"No"<<endl
const long long INF = 1LL << 60;
const long long MOD = 1000000007;

//最大最小の入れ替え
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;
}

//約数列挙
vector<long long> divisor(long long n) {
    vector<long long> ret;
    for (long long i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            ret.push_back(i);
            if (i * i != n) ret.push_back(n / i);
        }
    }
    sort(ret.begin(), ret.end()); // 昇順に並べる
    return ret;
}
//コンビネーション
ll nCr(ll n, ll r) {
    ll ans = 1;
    for (int i = n; i > n - r; --i) {
        ans = ans*i;
    }
    for (int i = 1 ; i < r + 1; ++i) {
        ans = ans / i;
    }
    return ans;
}
//素因数分解
map< ll, ll > prime_factor(ll n) {
  map< ll, ll > ret;
  for(ll i = 2; i * i <= n; i++) {
    while(n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if(n != 1) ret[n] = 1;
  return ret;
}

//切り上げの割り算は(a + b - 1) / bでできる
//時間を意識しろ
//コードテストちゃんとして
//画面とにらめっこするな書け
//WA出すたびにABCは五億円払え
//わからない問題はとばせ
//躊躇なくぐぐれ

//ここから
int main(){
    ll a,b,x;
    cin>>a>>b>>x;
    ll Ans;
    if(a!=0){
    Ans=b/x-(a-1)/x;
    }else{
    Ans=b/x+1;
    }
    cout<<Ans<<endl;
}



Measured memory_bytes: 256
N = int(input())
B = list(map(int, input().split()))
A = [0] * N
for i in range(N):
    if i == 0:
        A[0] = B[0]
    elif i < N - 1:
        A[i] = min(B[i], B[i - 1])
    else:
        A[i] = B[i - 1]

print(sum(A))


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

int main() {
  int n;
  cin >> n;
  bool ans = false;

  rep(i, n / 4 + 1) {
    rep(j, n / 7 + 1) {
      if (4 * i + 7 * j == n) 
        ans = true;
    }
  }

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

  return 0;
}


Measured memory_bytes: 256
import std.stdio, std.string, std.conv;
import std.typecons;
import std.algorithm, std.array, std.range, std.container;
import std.math;

void main() {

	auto N = readln.split[0].to!int;
	auto S = readln.split[0].to!(dchar[]);
	
	ulong[] wnum = [0], bnum = [S.count('#')];
	foreach (d; S) {
		if (d == '.') wnum ~= wnum[$-1]+1, bnum ~= bnum[$-1];
		else wnum ~= wnum[$-1], bnum ~= bnum[$-1]-1;
	}
	
	//writeln(wnum, bnum);
	ulong ans = int.max;
	foreach (i; 0 .. wnum.length) {
		ulong tmp;
		tmp = i-wnum[i] + (N-i)-bnum[i];
		ans = min(ans, tmp);
	}
	writeln(ans);
}



Measured memory_bytes: 8060
#include <stdio.h>

int main(void){

	int S,h,ma,mb,s;

	scanf("%d",&S);

	ma = S/60;
	s = S%60;

	h = ma/60;
	mb = ma%60;

	printf("%d:%d:%d\n",h,mb,s);

	return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>
#include <string.h>

int main(void)
{
  char s[11];
  char a[11] = "2019/04/30" ;
  scanf("%s", s);

  if (strcmp(s, a) > 0)
    puts("TBD");
  else
    puts("Heisei");

  return 0;
}

Measured memory_bytes: 128
import sys
input = sys.stdin.readline

def digit_sum(n, b):
    res = 0
    while n > 0:
        res += n % b
        n //= b
    return res

def main():
    n = int(input())
    s = int(input())
    ans = -1

    if n < s:
        ans = -1

    elif n == s:
        ans = n + 1

    else:
        key = []
        start, first = n, 1

        for i in range(1, n):
            first = digit_sum(n, start)
            end = start - n // i // (i + 1)
            if start == end+1:
                judge = start
                break

            while end > 1:
                if digit_sum(n, end) == i * (start - end) + first:
                    end -= 1
                    continue
                break
            next_start = end
            value = digit_sum(n, start)
            end = value + (start - end - 1) * i
            key.append((start, value, end, i, first))
            judge = start
            start = next_start
            if start == 1:
                break

        for i in range(2, judge + 1):
            sub = digit_sum(n, i)
            if sub == s:
                ans = i
                break
        else:
            for index, start, end, i, first in reversed(key):
                if end < s or s < start:
                    continue
                if (s - start) % i:
                    continue
                ans = index - (s - first) // i
                break

    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 64072
import java.io.*;
import java.math.*;
import java.util.*;

import static java.util.Arrays.fill;
import static java.lang.Math.*;
import static java.util.Arrays.sort;
import static java.util.Collections.sort;

public class Main {
	static int mod = 1000000007;
	static InputReader in = new InputReader(System.in);
	static PrintWriter out = new PrintWriter(System.out);

	public static void main(String[] args) {

		boolean b=true;
		Set<String> set=new HashSet<>();
		int n=in.nextInt();
		String[] a=new String[n];
		for(int i=0;i<n;i++)
		{
			a[i]=in.nextLine();
			if(set.contains(a[i]))
			{
				b=false;
			}
			set.add(a[i]);
		}
		for(int i=1;i<n;i++)
		{
			if(a[i].charAt(0)!=a[i-1].charAt(a[i-1].length()-1))
			{
				b=false;
			}
		}
		if(b)
			out.println("Yes");
		else
			out.println("No");
		out.close();

	}

	static class InputReader {
		private final InputStream stream;
		private final byte[] buf = new byte[8192];
		private int curChar, snumChars;

		public InputReader(InputStream st) {
			this.stream = st;
		}

		public int read() {
			if (snumChars == -1)
				throw new InputMismatchException();
			if (curChar >= snumChars) {
				curChar = 0;
				try {
					snumChars = stream.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (snumChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		public int nextInt() {
			int c = read();
			while (isSpaceChar(c)) {
				c = read();
			}
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			int res = 0;
			do {
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public long nextLong() {
			int c = read();
			while (isSpaceChar(c)) {
				c = read();
			}
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			long res = 0;
			do {
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public String readString() {
			int c = read();
			while (isSpaceChar(c)) {
				c = read();
			}
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		public String nextLine() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isEndOfLine(c));
			return res.toString();
		}

		public boolean isSpaceChar(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		private boolean isEndOfLine(int c) {
			return c == '\n' || c == '\r' || c == -1;
		}
	}

	private static void tr(Object... o) {
		if (!(System.getProperty("ONLINE_JUDGE") != null))
			System.out.println(Arrays.deepToString(o));
	}
}




Measured memory_bytes: 22740
N, M = map(int,input().split(' '))
S=[]
for i in range(M):
    tmpk=list(map(int,input().split(' ')))
    S.append(tmpk[1:])
P=list(map(int,input().split(' ')))

Slist=[]
for i in range(pow(2,N)):
    #print(format(i,'0'+str(N)+'b'))
    Slist.append(format(i,'0'+str(N)+'b'))

#print(Slist)
ans = 0
for onoff in Slist:
    cnt=0
    for i in range(len(S)):
        tmp=0
        for chk in S[i]:
            #print(chk)
            if onoff[chk-1]=='1':
                tmp+=1
        if tmp%2 == P[i]:
            cnt+=1
    if cnt == M:
        ans+=1
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef long double ld;

int main()
{
  string s;
  cin >> s;
  ll n = s.size();
  map<char, ll> mp;
  REP(i,n) mp[s[i]]++;
  
  ll ans = n*(n-1)/2;
  for(auto p: mp) ans -= p.second*(p.second-1)/2;
  cout << ans+1 << '\n';
  return 0;
}


Measured memory_bytes: 640
//
//  main.cpp
//  Atcoder1
//
//  Created by Hamske on 2020/09/17.
//  Copyright © 2020 Author. All rights reserved.
//

#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <string>

using namespace std;

//#define pb push_back
//#define mp make_pair
//
//#define F first
//#define S second

typedef long long ll;

#define rept(_i,iv,n,type) for(type _i=(type)(iv);_i<(type)(n);++_i)
//#define repi(_i,iv,n) rept(_i,iv,n,int)
//#define repl(_i,iv,n) rept(_i,iv,n,ll)

#define rept0(_i,n,type) rept(_i,0,n,type)
#define repi0(_i,n) rept(_i,0,n,int)
#define repl0(_i,n) rept(_i,0,n,ll)

//#define repst(_i,iv,n,type) for(type _i=iv;_i<=(type)(n);++_i)
//#define repsi1(_i,n) repst(_i,1,n,int)

#define REPT(_i,iv,_l,n,type) for(type _i=(type)(iv),_l=(type)(n);_i<_l;++_i)
//#define REPI(_i,iv,_l,n) REPT(_i,iv,_l,n,int)
//#define REPL(_i,iv,_l,n) REPT(_i,iv,_l,n,ll)
//
#define REPT0(_i,_l,n,type) REPT(_i,0,_l,n,type)
#define REPI0(_i,_l,n) REPT(_i,0,_l,n,int)
#define REPL0(_i,_l,n) REPT(_i,0,_l,n,ll)


//#define rrept(_i,x,e,type) for(type _i=((type)(x)-1);_i>=e;--_i)
//
//#define rrept0(_i,x,type) rrept(_i,x,0,type)
//
//#define RREPT(_i,x,_e,e,type) for(type _i=((type)(x)-1),_e=(type)(e);_i>=_e;--_i)
//
//#define RREPT0(_i,x,_e,type) RREPT(_i,x,_e,0,type)
//
//#define RREPS(i,x) for(int i=((int)(x));i>0;i--)

//#define all(x) (x).begin(),(x).end()
#define REPV(v,_itr,_end) for(auto _itr=(v).begin(),_end=(v).end();_itr!=_end;++_itr)
#define REPVC(v,_itr,_end) for(auto _itr=(v).cbegin(),_end=(v).cend();_itr!=_end;++_itr)

#define td typedef
//#define tds(stl,type,name) typedef stl<type > name;
#define tdv(type,name) typedef vector<type > name;


//typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<vb > vvb;
typedef vector<int> vi;
typedef vector<vi > vvi;
typedef vector<ll> vll;
//typedef vector<vll > vvll;

#define mod99 998244353

int main(int argc, const char * argv[]) {
    int N;
    cin>>N;
    
    int count=0;
    for(int i=105;i<=N;++i){
        int cnt=0;
        for(int j=1;j<=i;++j){
            if(i%2==1&&i%j==0){
                ++cnt;
            }
        }
        if(cnt==8){
            ++count;
        }
    }
    cout<<count<<endl;
    return 0;
}


Measured memory_bytes: 3224
MOD = 1000000007

n = input()
tree = [[] for _ in range(n)]
for _ in range(n - 1):
    x, y = map(int, raw_input().split())
    tree[x - 1].append(y - 1)
    tree[y - 1].append(x - 1)

bfs = [0]
mark = [False] * n
mark[0] = True
for i in range(n - 1):
    for v in tree[bfs[i]]:
        if not mark[v]:
            bfs.append(v)
            mark[v] = True

dpw = [1] * n
dpb = [1] * n
mark = [False] * n
for i in range(n - 1, -1, -1):
    u = bfs[i]
    mark[u] = True
    for v in tree[u]:
        if mark[v]:
            dpb[u] = dpb[u] * dpw[v] % MOD
            dpw[u] = dpw[u] * (dpw[v] + dpb[v]) % MOD
print((dpw[bfs[0]] + dpb[bfs[0]]) % MOD)


Measured memory_bytes: 58524
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <set>
#include <algorithm>
#include <array>
#include <complex>
#include <string>
#include <utility>
#include <map>
#include <queue>
#include <list>
#include <functional>
#include <numeric>
#include <stack>
#include <tuple>
#include <fstream>
using namespace std;
int dx[4] = { -1,0,1,0 };
int dy[4] = { 0,1,0,-1 };
const int INF = 100000000;
const int BINF = 100000000000000001;
const long long LINF = 1000000000000000000;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-6;
const double pi = 3.14159265359;
using pii = std::pair<int, int>;
using ll = long long;
using pLL = std::pair<ll, ll>;
#define SORT(v) std::sort(v.begin(), v.end())
#define RSORT(v) std::sort(v.rbegin(), v.rend())


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    ll ans = LINF;
    for (ll i = 1; i * i <= N; ++i) {
        if (N % i == 0) {

            ans = min(ans, i + N/i - 2);
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits//stdc++.h>
using namespace std;
int in(void){int x;cin>>x;return x;}
#define ll long long int
#define rep(i,a,b) for(int i=ll(a);i<ll(b);i++)
long long int dx[4]={1,0,-1,0};
long long int dy[4]={0,1,0,-1};
int main() {
int a,b,c;
int n,m;
cin>>a>>b>>c;
n=b/a;
cout<<min(n,c);
	
	return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <array>
#include <queue>
#include <set>

using namespace std;

int main () {
    int N, M;
    cin>>N>>M;
    vector<int> v(N);
    for (int i = 0; i < N; i++) v[i] = i+1;
    set<pair<int,int>> e;
    for (int i = 0; i < M; i++) {
        int a,b;
        cin>>a>>b;
        e.insert(make_pair(a,b));
        e.insert(make_pair(b,a));
    }

    int count = 0;
    do {
        bool flag = true;
        for (int i = 0; i < N-1; i++) {
            if (e.count(make_pair(v[i], v[i+1])) == 0) {
                flag = false;
                break;
            }
        }
        if (flag) count++;
    } while (next_permutation(begin(v)+1, end(v)));

    cout<<count<<endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define mod 1000000007
using namespace std;
typedef pair<int,int> pi;
typedef long long int ll;

const int N = (int)1e5+5;
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    int n,m;
    cin>>n>>m;
    int ans = (n*(n-1))/2;
    ans += (m*(m-1))/2;
    cout<<ans;
}


Measured memory_bytes: 256
object Main {
  def main(args: Array[String]): Unit = {
    solve
  }

  def solve(): Unit = {
    val sc = new java.util.Scanner(System.in)
    val n, k = sc.nextInt
    val a = new Array[Int](n)
    for (i <- 0 until n) {
      a(i) = sc.nextInt
    }

    println((n - 1 - 1) / (k - 1) + 1)
  }
}


Measured memory_bytes: 48412
#include <bits/stdc++.h>
using namespace std;
#define M 1000000007
#define U 998244353
#define N 1000005
#define int long long
#define sz(c) (int)c.size()
#define fr first
#define ll long long 
#define sc second
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define rep(i,a,n) for(int i=a ; i<n ; i++)
#define r0 return 0;
#define endl '\n'
#define INF (int)1e15

/* Debug Begins */ 
# define trace(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); \
  stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
string to_string(char c) { return "'" + string(1, c) + "'";}
string to_string(string s) { return '"' + s + '"';}
string to_string(bool f) { if(f) return "True"; else return "False";}
string to_string(const char* s) { return to_string((string) s);}
template<typename A> string to_string(A);
template<typename A, typename B> string to_string(pair<A, B> p){
  return "(" + to_string(p.first) + ": " + to_string(p.second) + ")";}
template<typename A> string to_string(A v) {bool f = false; string r = "{"; 
  for (auto x: v) {if (f) r += ", "; r += to_string(x); f = true;} return r += "}";}
template<typename A> string to_string(vector<vector<A>> v) {string r; 
  for (auto x: v) r += "\n" + to_string(x); return r;}
int Nerr;
template<typename A> string to_string(A *p) {return to_string(vector<A>(p, p + Nerr));}
void err(istream_iterator<string>) { cerr << endl; }
template<typename T,typename... Args> void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << to_string(a) << "; "; err(++it, args...); }
template<typename T> void kek(T ans) {cout << ans << endl; exit(0);}
#define Lu(...) [&] (auto &&u) { return __VA_ARGS__; }
#define Luv(...) [&] (auto &&u, auto &&v) { return __VA_ARGS__; }
/***************************************************************/



signed main()
{
    ios_base::sync_with_stdio(0);
    int TESTS=1;
    // cin>>TESTS;
    while(TESTS--)
    {   
        int n,k;
        cin >> n >> k;
        vector<int> a(n);
        rep(i,0,n) cin >> a[i];
        sort(all(a));
        int ans = 0;
        rep(i,0,k) ans += a[i];
        cout << ans;
    }
}

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

#define fast_input() {ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); }
#define For(i, l, r) for(int (i) = (l); (i) <= (r); ++(i))
#define For1(i, l, r) for(int (i) = (r); (i) >= (l); --(i))

/*
MIKUNO - 15/02/1999
*/
//	priority_queue <ll, vector<ll>, greater<ll> > q;
#define INF 1e9+5
using ll = long long;
const int N = 1e5 + 5;
const ll mod = 1e9 + 7;
void add_self(int& a, int b) {
	a += b;
	if (a > mod)
		a -= mod;
}

int main() {
	fast_input();
	int H, W;
	cin >> H >> W;
	vector<vector<int>> dp(H + 1, vector<int>(W + 1, 0));
	dp[0][0] = 1;
	for (int i = 0; i < H; ++i) {
		for (int j = 0; j < W; ++j) {
			char ch;
			cin >> ch;
			if (ch == '#') continue;
			else {
				add_self(dp[i][j + 1], dp[i][j]);
				add_self(dp[i + 1][j], dp[i][j]);
			}
		}
	}
	cout << dp[H - 1][W - 1];
}



Measured memory_bytes: 4224