akhauriyash/Code-Regression huggingface dataset:
def main():
	a,b,c,k = [int(x) for x in input().split(" ")]

	m = min(a, k)
	s = m
	if m <= k:
		k -= m
		m = min(b, k)
		if m <= k:
			k -= m
			m = min(c, k)
			s -= m

	print(s)

main()

Measured memory_bytes: 61792
class Dice():

    def __init__(self, d):
        self.d = d
        self.north = [2, 6, 3, 4, 1, 5]
        self.south = [5, 1, 3, 4, 6, 2]
        self.east = [4, 2, 1, 6, 5, 3]
        self.west = [3, 2, 6, 1, 5, 4]
        self.label = [(self.d[0], self.d[1], self.d[2])]

    def roll(self, direction):
        if direction == 'S':
            self.d = [ self.d[self.south[i]-1] for i in range(6) ]
        elif direction == 'N':
            self.d = [ self.d[self.north[i]-1] for i in range(6) ]
        elif direction == 'E':
            self.d = [ self.d[self.east[i]-1] for i in range(6) ]
        elif direction == 'W':
            self.d = [ self.d[self.west[i]-1] for i in range(6) ]

    def rollAll(self):
        for i in range(4):
            for i in range(4):
                self.roll('E')
                self.label.append((self.d[0], self.d[1], self.d[2]))
            self.roll('S')
        self.roll('E')
        self.roll('S')
        for i in range(4):
            self.roll('E')
            self.label.append((self.d[0], self.d[1], self.d[2]))
        self.roll('S')
        self.roll('S')
        for i in range(4):
            self.roll('E')
            self.label.append((self.d[0], self.d[1], self.d[2]))

    def getLabel(self):
        return set(self.label)

    def getDice(self):
        return self.d



n = int(input())
ll = []
for i in range(n):
    d = [ int(s) for s in input().split() ]
    dice = Dice(d)
    dice.rollAll()
    l = dice.getLabel()
    if l not in ll:
        ll.append(l)

if len(ll) == n:
    print('Yes')
else:
    print('No')


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

int main()
{
    int a,b,c,d,e,f,g,h,i,j,k;
    cin >>a>>b>> k;

    if (b-a+1 > 2*k)
    {
        for (int i = a; i < a+k; i++)
        {
            cout << i << endl;
        }
        for (int i = b-k+1; i <= b; i++)
        {
            cout << i << endl;
        }
    }
    else
    {
        for (int i = a; i <= b; i++)
        {
            cout << i << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
struct Node{
	int a[10];
}a[20];
int n,d;
int dis(int i,int j){
	int ans=0;
	for(int k=0;k<d;k++)ans+=(a[i].a[k]-a[j].a[k])*(a[i].a[k]-a[j].a[k]);
	return ans;
}
int main(){
	scanf("%d%d",&n,&d);
	int ans=0;
	for(int i=0;i<n;i++){
		for(int j=0;j<d;j++)scanf("%d",&a[i].a[j]);
		for(int j=i-1;~j;j--){
			int w=dis(i,j),w1=sqrt(w);
			if(w1*w1==w)ans++;
		}
	}
	printf("%d",ans);
	return 0;
}

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

typedef long l;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int, string> pis;
typedef pair<long, long> pll;

#define EACH(t, c) for (auto&& t : c)
#define ALL(c) begin(c), end(c)
#define FOR(i, s, e) for (int i = (s); i < (int)(e); ++i)
#define REP(i, n) FOR(i, 0, n)
#define endl '\n'
#define F first
#define S second
#define pb push_back
#define mp make_pair

const int DX[] = {1, 0, -1, 0, 1, 1, -1, -1}, DY[] = {0, 1, 0, -1, 1, -1, 1, -1};
const int MOD = (int)1e9 + 7;
const int INF = 999999999;

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

  int res = 0;
  REP(i, n) {
    res += pow(100, d);
    if (res % (int)pow(100, d + 1) == 0) {
      res += pow(100, d);
    }
  }

  cout << res << endl;

}



Measured memory_bytes: 512
#include<bits/stdc++.h>
#define FLASH cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(false);
#define pb push_back
#define int long long
#define fr(i,a,b) for(int i=a;i<b;i++)
#define mod 1000000007
#define FILEIO freopen("/home/aman/Desktop/Kachda/input.txt", "r", stdin); freopen("/home/aman/Desktop/Kachda/output.txt", "w", stdout);

using namespace std;

signed main()
{
	
 	FLASH

 	int a, b, c, x, y, z;
 	cin>>x>>y>>z;

 	a = min(x, min(y, z)), c = max(x, max(y, z));
 	b = x + y + z - a - c;

 	int m = (a + b + c)&1;
 	int e = c + ((c&1) != m);
 	int ans = ((c&1) != m);
 	a += ans;

 	ans += (e - a)/2 + (e - b)/2 + ((e - a)&1);
 	cout<<ans;
}

Measured memory_bytes: 256
import re

while True:
    Time,Team,Quiz,n = map(int,input().split())
    if Time+Team == 0:break
    score = {}
    accept = {}
    ans = ""
    for i in range(Team-1,-1,-1):
        score[i] = 0
        accept[i] = 0
    miss = [[0 for _ in range(Quiz)] for _ in range(Team)]
    for _ in range(n):
        h,t,q,j = map(int,input().split())
        if j == 0:
           accept[t-1] += 1
           score[t-1] += (h + miss[t-1][q-1])
        else:
            miss[t-1][q-1] += 20
    for i in range(max(accept.values()),-1,-1):
        stack = {}
        for t,sc in accept.items():
            if sc == i:
                stack[t] = score[t]
        stack = sorted(stack.items(), key=lambda x:x[1])
        for i,a in enumerate(stack):
            if ans != "":
                if i == 0 or a[1] != stack[i-1][1]:
                    ans += "," + str(a[0]+1)
                else:
                    ans += "=" + str(a[0]+1)
            else:
                ans += str(a[0]+1)
    print(ans)


Measured memory_bytes: 6556
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <array>
#include <bitset>
#include <assert.h>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

ll dp[20][6][2];

int main() {
    ll s = lin();

    ll tmp = s;
    VI a;
    while (tmp){
        a.push_back(tmp % 10);
        tmp /= 10;
    }
    reverse(ALL(a));
    int n = a.size();

    dp[0][0][0] = 1;
    REP(i,n) REP(j,5) REP(f,2){
        int lim = f ? 9 : a[i];
        REP(k,lim+1){
            int c = 0;
            if (j == 0 && k == 5) c = 1;
            if (j == 1 && k == 1) c = 2;
            if (j == 1 && k == 5) c = 1;
            if (j == 2) c = 3;
            if (j == 2 && k == 5) c = 4;
            if (j == 3 && k == 3) c = 5;
            if (j == 3 && k == 5) c = 1;
            if (j == 4 && k == 3) c = 5;
            if (j == 4 && k == 1) c = 2;
            if (j == 4 && k == 5) c = 1;
            if (j == 5) c = 5;
            dp[i+1][c][f | (k < a[i])] += dp[i][j][f];
        }
    }

    // REP(j,5){
    //     FOR(i,1,n) cout << dp[i][j][1] << " ";
    //     cout << endl;
    // }

    ll sum = 0;
    REP(j,5) REP(f,2) sum += dp[n][j][f];
    cout << s - sum + 1 << endl;

    return 0;
}


Measured memory_bytes: 3228
#include "bits/stdc++.h"
using namespace std;
const int maxn = 200200;
int trie[maxn * 30][2], cnt[maxn * 30], nds = 1;
void ins(int bt, int v){
    int cur = 0;
    for(int e = bt; e >= 0; e--){
        int & u = trie[cur][(v>>e)&1];
        if(u == -1) u = nds++;
        cur = u;
        cnt[cur]++;
    }
}
int ways(int val, int bt, int node, int need_carry){
    if(node == -1) return 0;
    if(bt == -1){
        if(need_carry) return 0;
        return cnt[node];
    }
    int res = 0;
    if(val&(1<<bt)){
        if(need_carry){
            if(trie[node][1] != -1) res += cnt[trie[node][1]];
            res += ways(val, bt - 1, trie[node][0], 1);
        } else {
            res += ways(val, bt - 1, trie[node][0], 0);
        }
    } else {
        if(need_carry){
            res += ways(val, bt - 1, trie[node][1], 1);
        } else {
            if(trie[node][0] != -1) res += cnt[trie[node][0]];
            res += ways(val, bt - 1, trie[node][1], 0);
        }
    }
    return res;
}
int ina[maxn], inb[maxn];
int a[maxn], b[maxn];
int main(){
    int n;
    cin >> n;
    for(int e = 0; e < n; e++) scanf("%d", ina + e);
    for(int e = 0; e < n; e++) scanf("%d", inb + e);
    int res = 0;
    for(int e = 28; e >= 0; e--){
        memset(trie, -1, sizeof(trie));
        memset(cnt, 0, sizeof(cnt));
        nds = 1;
        for(int f = 0; f < n; f++) a[f] = ina[f]&((1<<(e + 1)) - 1);
        for(int f = 0; f < n; f++) b[f] = inb[f]&((1<<(e + 1)) - 1);
        for(int f = 0; f < n; f++) ins(e, b[f]);
        int tot = 0;
        for(int f = 0; f < n; f++){
            if(a[f]&(1<<e)){
                tot += ways(a[f], e - 1, trie[0][0], 0) % 2;
                tot += ways(a[f], e - 1, trie[0][1], 1) % 2;
            } else {
                tot += ways(a[f], e - 1, trie[0][1], 0) % 2;
                tot += ways(a[f], e - 1, trie[0][0], 1) % 2;
            }
        }
        tot %= 2;
        if(tot) res ^= 1<<e;
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 73728
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.util.InputMismatchException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            int k = in.nextInt();

            long tmp1 = n / k;
            long tmp2 = k % 2 == 0 ? (n + k / 2) / k : 0;

            out.println(tmp1 * tmp1 * tmp1 + tmp2 * tmp2 * tmp2);
        }

    }

    static class InputReader {
        private BufferedReader br;
        private StringTokenizer st;

        public InputReader(InputStream inputStream) {
            br = new BufferedReader(new InputStreamReader(inputStream));
            st = new StringTokenizer("");
        }

        public String nextString() {
            while (!st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine(), " ");
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
            }
            return st.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(nextString());
        }

    }
}



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

string s[500], t[500];
vector<int>E[26];
int in[26], d[26], p;
bool used[26];
int main() {
	int n;
	while (scanf("%d", &n), n) {
		memset(used, 1, sizeof(used));
		memset(in, 0, sizeof(in));
		rep(i, 26)E[i].clear();
		rep(i, n) {
			cin >> s[i]; t[i] = s[i];
			for (char c : s[i])used[c - 'a'] = false;
		}
		rep(i, 10) {
			rep(j, n)for (int k = j + 1; k < n; k++) {
				if (i < s[j].size() && i < s[k].size() && s[j][i] != s[k][i] && s[j].substr(0, i) == s[k].substr(0, i)) {
					in[s[k][i] - 'a']++; E[s[j][i] - 'a'].push_back(s[k][i] - 'a');
				}
			}
		}
		queue<int>Q;
		p = 0;
		rep(i, 26) {
			if (!in[i] && !used[i])Q.push(i);
			while (!Q.empty()) {
				int u = Q.front(); Q.pop();
				used[u] = true; d[u] = p++;
				for (int v : E[u]) {
					in[v]--; if (!in[v])Q.push(v);
				}
			}
		}
		rep(i, 26) {
			if (!used[i]) {
				puts("no"); goto g;
			}
		}
		sort(t, t + n, [&](string a, string b) {
			rep(i, min(a.size(), b.size())) {
				if (a[i] != b[i])return d[a[i] - 'a'] < d[b[i] - 'a'];
			}
			return a.size() < b.size();
		});
		rep(i, n) {
			if (s[i] != t[i]) {
				puts("no"); goto g;
			}
		}
		puts("yes");
	g:;
	}
}

Measured memory_bytes: 8500
#include<iostream>
#include<cmath>
#include<algorithm>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<map>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())

const int MAX = 510000;
const int MOD = 1000000007;

int main(){
  ll N;cin>>N;
  vector<ll> p(N+1);
  repn(i,N) cin>>p[i];
  ll cnt=0;
  repn(i,N){
    if(p[i] == i) cnt++;
  }
  // cout<<cnt<<endl;
  if(cnt>=N-2) cout<<"YES"<<endl;
  else cout<<"NO"<<endl;


}


Measured memory_bytes: 256
#include<stdio.h>
int main(void){
char s[101],t[101],*pt,*pt2;
scanf("%s%s",s,t);
pt=&s[0];
pt2=&t[0];
  while(*pt2){
printf("%c",*pt2);
pt2++;
}
while(*pt){
printf("%c",*pt);
pt++;
}
printf("\n");
return 0;
}


Measured memory_bytes: 128
first = 1
second = 1 
while first != 0 or second != 0:
    input_number = input().split()
    first = int(input_number[0])
    second = int(input_number[1])
    if first==0 and second==0:
        break
    elif (first>=second):
        print(second,first)
    else:
        print(first,second)



Measured memory_bytes: 5612
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int N;
    cin >> N;
    vector<long long> A(N);
    for(int i = 0; i < N; i++) cin >> A[i];
    long long ans = 0;
    for(int i = 0; i < N; i++){
        for(int j = i + 1; j < N; j++){
            ans = max(ans,abs(A[i]-A[j]));
        }
    }
    cout << ans << endl;
}


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

typedef long long ll;
typedef pair<int,int> P;
ll const mod = 998244353;

#define p_ary(ary,a,b) do { cout << "["; for (int count = (a);count < (b);++count) cout << ary[count] << ((b)-1 == count ? "" : ", "); cout << "]\n"; } while(0)
#define p_map(map,it) do {cout << "{";for (auto (it) = map.begin();;++(it)) {if ((it) == map.end()) {cout << "}\n";break;}else cout << "" << (it)->first << "=>" << (it)->second << ", ";}}while(0)

template<typename T1,typename T2>ostream& operator<<(ostream& os,const pair<T1,T2>& a) {os << "(" << a.first << ", " << a.second << ")";return os;}

const char newl = '\n';

int main() {
    int n,s;
    cin >> n >> s;
    vector<int> a(n);
    for (int i = 0;i < n;++i) cin >> a[i];
    vector<vector<ll>> dp(n+1,vector<ll>(s+1,0));
    for (int i = 0;i < n;++i) dp[i][0] = 1;
    for (int i = 0;i < n;++i) {
        for (int j = 0;j < s+1;++j) {
            (dp[i+1][j] += dp[i][j]) %= mod;
            if (j+a[i] <= s) (dp[i+1][j+a[i]] += dp[i][j]) %= mod;
        }
    }
    ll ans = 0;
    for (int i = 0;i < n+1;++i) (ans += dp[i][s]) %= mod;
    cout << ans << endl;
}

Measured memory_bytes: 70784
package main

import "fmt"

func main() {
	// Code for A - Between Two Integers
	var A, B, C int
	fmt.Scanf("%d %d %d", &A, &B, &C)

	if C >= A && C <= B {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


Measured memory_bytes: 1832
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<ctype.h>
#include<math.h>
#include<bits/stdc++.h>
#include<vector>
#include<queue>

#define             ll                      long long
#define             si(a)                   scanf("%d",&a)
#define             sii(a,b)                scanf("%d%d",&a,&b)
#define             siii(a,b,c)             scanf("%d%d%d",&a,&b,&c)
#define             pii                     pair<int,int>
#define             pb(a)                   push_back(a)
#define             fr(i,n)                 for(int i=0;i<n;i++)
#define             bl                      printf("\n")
#define             pi                      acos(0.0)
#define             inf                     1000000
#define             sz                      100
#define             MOD                     1000000007
#define             base                    2147483647


using namespace std;


int main(){

    int n,t,c,time;
    sii(n,t);
    int cst = 1010;
    while(n--){
        sii(c,time);
        if(c < cst && time <= t){
            cst = c;
        }
    }

    if(cst == 1010) printf("TLE\n");
    else printf("%d\n",cst);


    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
int main(void){
    // Your code here!
    int ans = 700;
    string t;
    cin>>t;
    for (int i=0;i<3;i++)
    if (t[i]=='o')
        ans +=100;
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
while True:
    H, W = map(int, input().split())
    if H == 0 and W == 0:
        break
    for h in range(H):
        tmp = ''
        for w in range(W):
            if  0 < h < H - 1 and 0 < w < W - 1:
                tmp += '.'
            else:
                tmp += '#'
        print(tmp)
    print()

Measured memory_bytes: 5608
#include <iostream>
#include <iomanip>
#include<math.h>
#include<list>
#include <algorithm>
#include<set>
#include<vector>
#include<math.h>
#include<map>
#include<string>
#include <numeric>
#include <queue>
#include <sstream>
#include <bitset>
#include<stack>

using namespace std;
using ll = long long;
using vll = vector<long long>;
using sll = set<long long>;

template<typename T>
T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template<typename T>
T lcm(T a, T b) { return a / gcd(a, b) * b; }

template<typename T>
map<T, T> getPrimeFactor(T n) {
	map<T, T> res;
	for (T i = 2; i * i <= n; ++i) {
		while (n % i == 0) {
			res[i] ++;
			n /= i;
		}
	}
	if (n != 1) res[n] = 1;
	return res;
}

template<typename T>
bool IsPrimeNumber(T num)
{
	if (num <= 2) return true;
	else if (num % 2 == 0) return false;

	double sqrtNum = sqrt(num);
	for (int i = 3; i <= sqrtNum; i += 2)
	{
		if (num % i == 0)
		{
			return false;
		}
	}

	return true;
}

long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}

#define rep(i,s,e) for(ll i=s;i<e;i++)
#define repeq(i,s,e) for(ll i=s;i<=e;i++)


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

	ll ans = 0;
	ll cnt = 0;
	rep(i, 0, (ll)s.size() - 2) {
		if (s[i] == 'A') {
			cnt++;
			if (s[i + 1] == 'B' && s[i + 2] == 'C') {
				ans += cnt;
				s[i + 2] = 'A';
				cnt--;
				i++;
			}
		}
		else {
			cnt = 0;
		}
	}
	std::cout << ans << endl;
	return 0;
}


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

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

    # 010101...のとき
    ans1 = 0
    for i in range(0, len(S)):
        if i%2==0 and S[i] == "1":
            ans1 += 1
        elif i%2==1 and S[i] == "0":
            ans1 += 1
    
    # 1010101...のとき
    ans2 = 0
    for i in range(0, len(S)):
        if i%2==0 and S[i] == "0":
            ans2 += 1
        elif i%2==1 and S[i] == "1":
            ans2 += 1

    print(min(ans1, ans2))

if __name__ == "__main__":
    solve()

Measured memory_bytes: 3956
#include <iostream>
#include <iomanip>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
#include <queue>
#include <cmath>
#include <numeric>
#include <set>

using namespace std;
struct aaa{aaa(){cin.tie(nullptr); ios::sync_with_stdio(false); cout<<fixed<<setprecision(20);};}aaa;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v){o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}
#define debug(v) {cerr<<"\033[1;36m[debug]\033[m "<<#v<<" : "<<v<<endl;}

using int64 = long long;

int main() {
    int n,x;
    int64 ans = 0;
    cin >> n >> x;
    vector<int> a(n);
    for (int i=0; i<n; i++) cin >> a[i];

    for (int i=0; i<n-1; i++) {
        if (a[i] + a[i+1] > x) {
            int balance = a[i] + a[i+1] - x;
            ans += balance;
            a[i+1] = max(0, a[i+1] - balance);
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 640
import sys
N = int(input())
if N < 1 or N > 10 ** 5:
    sys.exit()

int_array = []
for I in range(N):
    int_array.append(int(input()))
if len(int_array) < 0 or len(int_array) > N:
    sys.exit()

next = int_array[0]
count = 1
for L in range(N):
    if next == 2:
        print(count)
        sys.exit()
    next = int_array[next-1]
    count += 1
print("-1")

Measured memory_bytes: 12936
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;

int main() {
    int a, b, c;
    cin >> a >> b >> c;

    if(a + b + c > 21) {
        out("bust");
    }
    else {
        out("win");
    }
    
    re0;
}

Measured memory_bytes: 764
import java.io.*;
import java.util.*;

class Main{
    public static void main(String[] args){
        solve();
    }

    public static void solve(){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int i=0;
        while(true){
        	if((n+i)%111==0){
        		System.out.println(n+i);
        		break;
        	}
        	i++;
        }
    }
}

Measured memory_bytes: 23124
#include <bits/stdc++.h>
using namespace std;
int main(){
    int N,X;
    cin>>N>>X;
    int mini = 1000;
    int sum=0;
    int m;
    for(int i=0;i<N;i++){
        cin>>m;
        sum+=m;mini=min(m,mini);
    }
    cout<<(X-sum)/mini+N<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <bitset>
using namespace std;

#ifdef LOCAL
	#define eprintf(...) fprintf(stderr, __VA_ARGS__);fflush(stderr);
#else
	#define eprintf(...) 42
#endif

using ll = long long;
using ld = long double;
using uint = unsigned int;
using ull = unsigned long long;
template<typename T>
using pair2 = pair<T, T>;
using pii = pair<int, int>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second

double startTime;
double getCurrentTime() {
	return ((double)clock() - startTime) / CLOCKS_PER_SEC;
}

const int N = 200200;
const int K = 32;

struct Item {
	ll a, b;

	Item() : a(), b() {}
	
	void scan() {
		ll x, y;
		scanf("%lld%lld", &x, &y);
		a = x + 1;
		b = x + y + 1;
	}

	bool operator < (const Item &I) const {
		return (I.a - 1) * b < (a - 1) * I.b;
	}
};
vector<Item> items;
ll dp[K];
ll T;
vector<ll> z;
int n;

int main()
{
	startTime = (double)clock();
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);

	scanf("%d%lld", &n, &T);
	for (int i = 0; i < n; i++) {
		Item I;
		I.scan();
		if (I.a == 1) {
			z.push_back(I.b);
		} else {
			items.push_back(I);
		}
	}
	sort(items.begin(), items.end());
	sort(z.begin(), z.end());

	dp[0] = 0;
	for (int i = 1; i < K; i++)
		dp[i] = T + 1;
	for (Item I : items) {
		for (int i = K - 2; i >= 0; i--) {
			if (dp[i] > T) continue;
			dp[i + 1] = min(dp[i + 1], I.a * dp[i] + I.b);
		}
	}
	int ans = 0;
	for (int t = 0; t < K; t++) {
		if (dp[t] > T) continue;
		ll w = dp[t];
		int res = t;
		for (ll x : z) {
			if (w + x > T) break;
			w += x;
			res++;
		}
		ans = max(ans, res);
	}
	printf("%d\n", ans);

	return 0;
}


Measured memory_bytes: 6512
d, g = map(int, input().split())

problems = []
ans = 0

for i in range(d):
    p, c = map(int, input().split())
    problems.append(((i+1)*100, p, c))
    ans += p

for mask in range(1 << d):
    solved_amount = 0
    my_score = 0
    for i in range(d):
        score, occ, bonus = problems[i]
        if mask & (1 << i) > 0:
            solved_amount += occ
            my_score += score * occ + bonus

    for x in range(d-1, -1, -1):
        if my_score >= g:
            break

        if (mask & (1 << x)) > 0:
            continue
        score, occ, bonus = problems[x]
        for _ in range(occ):
            solved_amount += 1
            my_score += score
            if my_score >= g:
                break

    if my_score >= g:
        ans = min(ans, solved_amount)

print(ans)


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

int main(void){
    int N, M, C, result{0};
    cin >> N >> M >> C;
    vector<int> B(M);
    for(int i=0; i<M; ++i)
        cin >> B[i];
    for(int n=0; n<N; ++n){
        int sum{C};
        for(int i=0; i<M; ++i){
            int tmp;
            cin >> tmp;
            sum += tmp*B[i];
        }
        if(sum>0)
            ++result;
    }
    cout << result << endl;
}


Measured memory_bytes: 256
#!usr/bin/env python3
from collections import defaultdict, deque, Counter, OrderedDict
from bisect import bisect_left, bisect_right
from functools import reduce, lru_cache
from heapq import heappush, heappop, heapify

import itertools, bisect
import math, fractions
import sys, copy

def L(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline().rstrip())
def S(): return list(sys.stdin.readline().rstrip())
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI1(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LS(): return [list(x) for x in sys.stdin.readline().split()]
def IR(n): return [I() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def LIR1(n): return [LI1() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
def LR(n): return [L() for _ in range(n)]

alphabets = "abcdefghijklmnopqrstuvwxyz"
ALPHABETS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

sys.setrecursionlimit(1000000)
dire = [[1, 0], [0, 1], [-1, 0], [0, -1]]
dire8 = [[1, 0], [1, 1], [0, 1], [-1, 1], [-1, 0], [-1, -1], [0, -1], [1, -1]]
MOD = 1000000007

def main():
    N = I()
    A = LI()

    def lcm(a, b): return a * b // math.gcd(a, b)
    l = reduce(lcm, A, 1) % MOD

    ans = 0
    for ai in A:
        ans = (ans + l * pow(ai, MOD - 2, MOD)) % MOD

    print(ans)





if __name__ == '__main__':
    main()

Measured memory_bytes: 78908
n = gets.to_i
strs = gets.chomp.split(' ').map(&:to_i)

dp = [0, (strs[0]-strs[1]).abs]
[*2..(n-1)].each do |i|
  dp << [dp[i-2] + (strs[i-2]-strs[i]).abs, dp[i-1] + (strs[i-1]-strs[i]).abs].min
end
puts dp[-1]

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

int main() {
  int N;
  cin >> N;
  vector<int> card(N);
  for (int i = 0; i < N; i++){
  	cin >> card.at(i);
  }
  
  int Alice = 0, Bob = 0;
  
  for (int i = 0; i < N; i++){
  	if (i % 2 == 0){
    	int score = 0;
      	for (int j = 0; j < N; j++){
        	if (card.at(j) > score){
            	int back;
              	back = score;
              	score = card.at(j);
              	card.at(j) = back;
            }
        }
      	Alice += score;
    }
    
    if (i % 2 == 1){
    	int score = 0;
      	for (int j = 0; j < N; j++){
        	if (card.at(j) > score){
            	int back;
              	back = score;
              	score = card.at(j);
              	card.at(j) = back;
            }
        }
      	Bob += score;
    }
  }
  
  cout << Alice - Bob;
  
  
}

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

int main() {
  string K;
  int a[255]={0};
  cin>>K;
  for (int i(0);i<K.size();i++){
    a[(int)K[i]]+=1;
  }
  for (int i(0);i<255;i++){
    if (a[i]%2==1){
      cout<<"No"<<endl;
      return 0;
    }
  }
  cout<<"Yes"<<endl;
}

Measured memory_bytes: 256
//高知能系Vtuberの高井茅乃です。
//Twitter: https://twitter.com/takaichino
//YouTube: https://www.youtube.com/channel/UCTOxnI3eOI_o1HRgzq-LEZw

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

#define INF INT_MAX
#define LLINF LLONG_MAX
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define MODA 1000000007 

template <typename T>
std::istream& operator>>(std::istream& is, std::vector<T>& vec) {
    for (T& x: vec) { is >> x; }
    return is;
}

int main() {
	ll ans = 0;
	ll tmp;
	int n; cin >> n;
	vector<ll> a(n);
	map<ll, int> m;
	REP(i, n){
		cin >> tmp;
		a[i] = tmp;
		m[tmp]++;
	}
	sort(a.rbegin(), a.rend());
	REP(i, n){
		if(m[a[i]]>0){
			ll two = 1 << (int)ceil(log2(a[i]+(ll)1));
			//cout << a[i] << " " << two << endl;
			if((two-a[i] != a[i] && m[two-a[i]]>0) || (two-a[i]==a[i] && m[a[i]] > 1)){
				ans++;
				m[two-a[i]]--;
				m[a[i]]--;
			}
		}	
	}
	cout << ans << endl;
}

Measured memory_bytes: 30100
N,A,B = map(int,input().split())
cnt = 0
for i in range(1,N+1):
  if i<10:
    if A <= i <= B:
      cnt += i
  elif 10 <= i < 100:
    if A <= int(str(i)[0])+int(str(i)[1]) <= B:
      cnt += i
  elif 100 <= i < 1000:
    if A <= int(str(i)[0])+int(str(i)[1])+int(str(i)[2]) <= B:
      cnt += i
  elif 1000 <= i < 10000:
    if A <= int(str(i)[0])+int(str(i)[1])+int(str(i)[2])+int(str(i)[3]) <= B:
      cnt += i
  else:
    if A <= 1 <= B:
      cnt += i
print(cnt)

Measured memory_bytes: 9248
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <string>
#include <vector>
#include <math.h>
#include <queue>
#include <map>
#define ll long long
const int MOD = 1e9+7;
using namespace std;



int main(){
	int n;
	string s;
	cin >> n >> s;
	if (n%2){
		cout << "No" << endl;
		return 0;
	}
	for (int i = 0; i < n/2; i++){
		if (s[i] != s[n/2+i]){
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
	return 0;
}

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

int main(){
    while(1){
        int n,x;
        cin >> n >> x;
        if(n==0)break;
        int count=0;
        for(int i=1; i<=n; i++){
            for(int j=i+1; j<=n; j++){
                for(int k=j+1; k<=n; k++){
                    if(i+j+k==x) count++;
                }
            }
        }
        cout << count << endl;
    }
    return 0;
}


Measured memory_bytes: 3096
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
ll MOD = 1e9+7;

#define vec     vector<int>
#define vecll   vector<ll>
#define vec2    vector<vector<int>>
#define vec2ll  vector<vector<ll>>
#define vpair   vector<pair<int, int>>
#define vpairll vector<pair<ll, ll>>

#define rep(i,n)         for(ll i=(ll)0; i<(ll)n; i++)
#define REP(i,m,n)       for(ll i=(ll)m; i<(ll)n; i++)
#define arr(var, n)      vec var(n); rep(i,n){cin >> var[i];}
#define arrll(var, n)    vecll var(n); rep(i,n){cin >> var[i];}
#define all(var)         (var).begin(), (var).end()
#define sortall(var)     sort(all(var))
#define uniqueall(v)     v.erase(unique(v.begin(), v.end()), v.end());
#define f_sum(var)       accumulate(all(var), 0)
#define f_sumll(var)     accumulate(all(var), 0LL)
#define chmin(v1, v2)    v1 = min(v1, v2)
#define chmax(v1, v2)    v1 = max(v1, v2)
#define mpair(v1, v2)    make_pair(v1, v2)
#define pb(var)          push_back(var)
#define prt(var)         cout << var << "\n"
#define prtd(n, var)     cout << fixed << setprecision(n) << var << "\n"
#define prtfill(n, var)  cout << setw(n) << setfill('0') << var;
#define prt2(v1, v2)     cout << v1 << " " << v2 << "\n"
#define prt3(v1, v2, v3) cout << v1 << " " << v2 << " " << v3 << "\n"
#define prtall(var)      rep(i,var.size()){cout << var[i] << " ";} cout << "\n"
vector<string> yesno={"No", "Yes"};
//----------------------------------------------------------------
int main(void) {
  string s;
  cin >> s;

  bool ok=false;
  rep(i,3){
    if(s[i]=='7') ok=true;
  }

  prt(yesno[ok]);

}


Measured memory_bytes: 3628
#include<iostream>

using namespace std;

 int main(){
  int a,b,sum,count;
  
  while(cin >> a >> b){
  
   sum = a + b;
   count = 0;
   
   for(int i = sum; i >= 1; i= i/10){
    count++;
   }
    
   cout << count << endl;
    
  }
  
 return 0;
}

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


#define ll long long
#define mp make_pair
#define pb push_back

ll dp[200005], pre[200005];

ll mod = 998244353;

int main()
{
  ll n, k; cin>>n>>k;

  vector< pair<ll, ll>> v;
  for(int i=0; i<k; i++)
  {
    ll l, r; cin>>l>>r;

    v.pb(mp(l, r));
  }
  dp[0] = 0;
  pre[0] = 0;
  dp[1] = 1;
  pre[1] = 1;

  for(ll i=2; i<=n; i++)
  {
    ll lmt = i-1;
    ll ways = 0;
    for(int j=0; j<k; j++)
    {
      ll l = v[j].first, r = v[j].second;

      if(l> lmt) continue;

      ll new_r = min(lmt, r);

      ways = (ways + ((pre[i-l] - pre[(i-new_r)-1] + mod) % mod) ) % mod;
    }

    dp[i] = ways;
    pre[i] = (ways + pre[i-1]) % mod;
  }
  cout<<dp[n];
  return 0;
}


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

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

  int cnt = 0;
  for (int i = 0; i < M; ++i){
    if (A.at(i) == N) cnt++;
  }

  cout << cnt << endl;
  return 0;
}



Measured memory_bytes: 256
#include <string>
#include <vector>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <map>
#include <list>
#include <set>
#include <numeric>
#include <queue>
#include <stack>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <climits>
#include <cfloat>
#include <ctime>
#include <complex>
#include <cassert>
#include <array>
#include <bitset> 
#include <unordered_map>

using namespace std;
typedef long long LL;
typedef pair<int,int> P;

int main() {
	bool a[4]={};
	int v;
	cin >> v;
	a[v]=true;
	cin >> v;
	a[v]=true;
	for(int i=1;i<=3;i++){
		if(!a[i]){
			cout << i << endl;
		}
	}

	return 0;
}



Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
int main(){
    int n,m;
     cin >> n >> m;
   
    vector<int>ans(n);
    vector<int>g_x(n),g_y(n),p_x(m),p_y(m);
   
    rep(i,n){
        cin >> g_x[i];
        cin >> g_y[i];
    }
    rep(i,m){
        cin >> p_x[i];
        cin >> p_y[i];
    }
    rep(i,n){
        ll best = 1000000000;
        rep(j,m){
            ll kyori;
            kyori = abs(g_x[i] - p_x[j]) + abs(g_y[i] - p_y[j]);
            if(kyori < best){
                best = kyori;
                ans[i] = j+1;
            }
                
            }
        }
        rep(i,n) cout << ans[i] <<endl;
    }


Measured memory_bytes: 256
#include<stdio.h>
int main(void){
  int a, b;
  scanf("%d  %d", &a, &b);
  if (a < b) {
  	printf("a < b\n");
  }else if (a > b) {
	printf("a > b\n");
  }else{
	printf("a == b\n");
  }
  return 0;
}


Measured memory_bytes: 2044
#include <set>
#include <map>
#include <queue>
#include <ctime>
#include <cmath>
#include <cstdio>
#include <vector>
#include <string>
#include <cctype>
#include <bitset>
#include <cstring>
#include <cstdlib>
#include <utility>
#include <iostream>
#include <algorithm>
#define REP(i,a,b) for(int i=(a);i<=(b);i++)
#define PER(i,a,b) for(int i=(a);i>=(b);i--)
#define RVC(i,S) for(int i=0;i<(S).size();i++)
#define RAL(i,u) for(int i=fr[u];i!=-1;i=e[i].next)
using namespace std;
typedef long long LL;
typedef pair<int,int> pii;
     
template<class T> inline
void read(T& num) {
    bool start=false,neg=false;
    char c;
    num=0;
    while((c=getchar())!=EOF) {
        if(c=='-') start=neg=true;
        else if(c>='0' && c<='9') {
            start=true;
            num=num*10+c-'0';
        } else if(start) break;
    }
    if(neg) num=-num;
}
/*============ Header Template ============*/

const int maxn=505;
const int INF=(int)(1e9)+100;
int a[maxn][maxn];
int c[maxn],d[maxn],inq[maxn];
char s[maxn][maxn];
queue<int> Q;
int n;

void SPFA() {
    REP(i,1,n) if(!d[i]) Q.push(i),inq[i]=1;
    while(!Q.empty()) {
        int x=Q.front();Q.pop();
        inq[x]=0;
        REP(i,1,n) if(d[i]>d[x]+1) {
            d[i]=d[x]+1;
            if(!inq[i]) {
                Q.push(i);
                inq[i]=1;
            }
        }
    }
}

int main() {
    read(n);
    REP(i,1,n) scanf("%s",s[i]+1);
    int mx=0;
    REP(i,1,n) REP(j,1,n) {
        a[i][j]=(s[i][j]=='#');
        c[i]+=a[i][j];mx=max(mx,c[i]);
    }
    if(!mx) {
        printf("-1\n");return 0;
    }
    REP(i,1,n) d[i]=INF;
    REP(i,1,n) REP(j,1,n) if(a[i][j]) d[j]=0;
    SPFA();
    int tmp=INF,id=0;
    REP(i,1,n) {
        if(d[i]!=INF && n-c[i]<tmp) {
            tmp=min(tmp,n-c[i]+d[i]);id=i;
        }
    }
    REP(j,1,n) REP(i,1,n) if(!a[i][j]) {
        tmp++;break;
    }
    printf("%d\n",tmp);
    return 0;
}

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

#define rep(i,s,n) for (int i = (int)s; i < (int)n; i++)
#define ll long long
#define pb push_back
#define eb emplace_back
#define All(x) x.begin(), x.end()
#define Range(x, i, j) x.begin() + i, x.begin() + j
#define lbidx(x, y) lower_bound(x.begin(), x.end(), y) - x.begin()
#define ubidx(x, y) upper_bound(x.begin(), x.end(), y) - x.begin()
#define llbidx(x, y, z) lower_bound(x.begin(), x.end(), z) - lower_bound(x.begin(), x.end(), y) // 二要素間の距離
#define deg2rad(deg) ((((double)deg)/((double)360)*2*M_PI))
#define rad2deg(rad) ((((double)rad)/(double)2/M_PI)*(double)360)
#define Find(set, element) set.find(element) != set.end()
#define Decimal(x) printf("%.10f\n", x) // 小数点を10桁まで表示
// debug用
#define PrintVec(x) for (auto elementPrintVec: x) { cout << elementPrintVec << " "; } cout << endl;

typedef pair<int, int> PI;
typedef pair<ll, ll> PLL;

int POWINT(int x, int n) {
  int ret = 1;
  rep(i, 0, n) ret *= x;
  return ret;
};

ll POWLL(int x, int n) {
  ll ret = 1;
  rep(i, 0, n) ret *= x;
  return ret;
};

template<class T>
inline bool chmax(T &a, T b) {
  if(a < b) {
    a = b;
    return true;
  }
  return false;
};

template<class T>
inline bool chmin(T &a, T b) {
  if(a > b) {
    a = b;
    return true;
  }
  return false;
};

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

  int A, B;
  cin >> A >> B;
  int AB = A*B;
  bool flag = false;
  rep(C, 1, 4) {
    if ((C * AB) % 2 == 1) {
      flag = true;
      break;
    }
  }

  if (flag) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }

  return 0;
};


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include <boost/multiprecision/cpp_int.hpp>

using namespace std;
namespace mp = boost::multiprecision;

int main(void){
  string S;
  mp::cpp_int K = 0;
  int num_no1 = -1;
  cin >> S >> K;
  //1以外の文字が最初に出てくる番号を調べる
  for(int i = 0; i < S.size(); i++){
    if(S[i] != '1') {
      num_no1 = i;
      break;
    }
  }
  //1以外が出てこない場合->一番最初の文字がKのやつ
  if(num_no1 == -1) cout << '1' << endl;
  else if(K <= 100 && K - 1< num_no1) cout << '1' << endl;
  else cout << S[num_no1] << endl;
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
   int i,j,n,k,d,a[100],x,ans;
   char s[4];

   scanf("%d %d",&n,&k);
   for (i=0;i<n;i++) a[i]=0;
   for (i=0;i<k;i++) {
      scanf("%d",&d);
      for (j=0;j<d;j++) {
          scanf("%d",&x);
          a[x-1]++;
      }
   }
   for (ans=i=0;i<n;i++)
      if (a[i]==0) ans++;
   printf("%d\n",ans);
   return 0;
}


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


static const int MAX = 200000;

int main() {
    int R[MAX], n;
    cin >> n;
    rep(i,n) cin >> R[i];

    int maxv = -2000000000; //十分小さい値を初期値に設定
    int minv = R[0];

    for (int i = 1; i < n; i++) {   //ここで毎回 R[i] を読み込めば、配列は不要
        maxv = max(maxv, R[i] - minv); //最大値を更新
        minv = min(minv, R[i]);  //ここまでの最小値を保持しておく
    }

    cout << maxv << endl;

    return 0;
}


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

typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;
#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev
#define dump(x)  cout << #x << " = " << (x) << endl;	//debug
#define SZ(x) ((int)(x).size())
#define REP(i, n) for(ll i = 0; i < (n); i++)
#define REPR(i, n) for (ll i = (n); i >= 0; i--)
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define ps(s) cout << #s << endl;
#define pv(v) cout << (v) << endl;
#define ALL(a)  (a).begin(),(a).end()
#define RANGE(a, l, r)  (a).begin()+(l),(a).begin()+(r)


int main() {
	int n;
	cin >> n;
	int res = 0;
	FOR(i, 1, n) {
		if (i % 2 == 0) { continue; }
		int cnt = 0;
		FOR(j, 1, i) {
			if (i%j == 0) {
				cnt++;
			}
		}
		if (cnt == 8) {
			res++;
		}
	}
	pv(res)
	return(0);
}

Measured memory_bytes: 256
// ===================================
//   author: M_sea
//   website: http://m-sea-blog.com/
// ===================================
#include <algorithm>
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <cstdio>
#include <vector>
#include <cmath>
#include <queue>
#define re register
using namespace std;

inline int read() {
    int X=0,w=1; char c=getchar();
    while (c<'0'||c>'9') { if (c=='-') w=-1; c=getchar(); }
    while (c>='0'&&c<='9') X=X*10+c-'0',c=getchar();
    return X*w;
}

const int N=500000+10;
const int inf=0x3f3f3f3f;

int n,k,a[N];

#define ls (o<<1)
#define rs (o<<1|1)
int minv[N<<2];
inline void pushup(int o) { minv[o]=min(minv[ls],minv[rs]); }
inline void modify(int o,int l,int r,int p,int w) {
    if (l==r) { minv[o]=w; return; }
    int mid=(l+r)>>1;
    if (p<=mid) modify(ls,l,mid,p,w);
    else modify(rs,mid+1,r,p,w);
    pushup(o);
}
inline int query(int o,int l,int r,int ql,int qr) {
    if (ql>qr) return inf;
    if (ql<=l&&r<=qr) return minv[o];
    int mid=(l+r)>>1,res=inf;
    if (ql<=mid) res=min(res,query(ls,l,mid,ql,qr));
    if (qr>mid) res=min(res,query(rs,mid+1,r,ql,qr));
    return res;
}
#undef ls
#undef rs

struct edge { int v,nxt; } e[N<<1];
int head[N],deg[N];
inline void addEdge(int u,int v) {
    static int cnt=0;
    e[++cnt]=(edge){v,head[u]},head[u]=cnt;
}

priority_queue<int,vector<int>,greater<int> > Q;
int ans[N],tim=0;
inline void topsort() {
    for (re int i=1;i<=n;++i) if (!deg[i]) Q.push(i);
    while (!Q.empty()) {
        int u=Q.top(); Q.pop(); ans[u]=++tim;
        for (re int i=head[u];i;i=e[i].nxt) {
            int v=e[i].v; --deg[v];
            if (!deg[v]) Q.push(v);
        }
    }
}

int main() {
    n=read(),k=read();
    for (re int i=1;i<=n;++i) a[read()]=i;
    memset(minv,0x3f,sizeof(minv));
    for (re int i=n;i;--i) {
        int x=query(1,1,n,a[i]+1,min(a[i]+k-1,n));
        if (x<=n) addEdge(a[i],a[x]),++deg[a[x]];
        int y=query(1,1,n,max(1,a[i]-k+1),a[i]-1);
        if (y<=n) addEdge(a[i],a[y]),++deg[a[y]];
        modify(1,1,n,a[i],i);
    }
    topsort();
    for (re int i=1;i<=n;++i) printf("%d\n",ans[i]);
    return 0;
}


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

int main() {
  string s;
  cin >> s;
  for (int i=0; i<s.length(); i++)
    if (s[i] == ',')
      s[i] = ' ';
  for (int i=0; i<s.length(); i++)
    cout << s[i];
  return 0;
}

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

#define debug(x) cout <<"DEBUG"<<" "<< #x << ":" << x << '\n'
#define rep(i,n) for(int_fast32_t i = 0; i < ((int_fast32_t)(n)); i++)   // 0-indexed昇順
#define rep1(i,n) for(int_fast32_t i = 1; i <= ((int_fast32_t)(n)); i++) // 1-indexed昇順
#define rrep(i,n) for(int_fast32_t i = ((int_fast32_t)(n)-1); i >= 0; i--)  // 0-indexed降順
#define rrep1(i,n) for(int_fast32_t i = ((int_fast32_t)(n)); i >= 1; i--)   // 1-indexed降順
#define all(x) (x).begin(),(x).end()

using namespace std;

template<typename T>
using vec = vector<T>;
using i32 = int_fast32_t;
using i64 = int_fast64_t;
using u32 = uint_fast32_t;
using u64 = uint_fast64_t;
using ll = long long;
using ld = long double;
using vi = vec<int_fast32_t>;
using vl = vec<int_fast64_t>;
using vld = vec<ld>;
using vii = vec<vi>;  // 2次元配列
using PII = pair<int_fast32_t, int_fast32_t>;

template<class T>
using maxheap = std::priority_queue<T>;
template<class T>
using minheap = std::priority_queue<T, std::vector<T>, std::greater<T>>;

template<class T,class U> inline bool chmax(T &a, const U &b){if(a<b){a=b;return 1;}return 0;}
template<class T,class U> inline bool chmin(T &a, const U &b){if(a>b){a=b;return 1;}return 0;}

const ld Pi = std::acos(-1.0L);
constexpr ll infll = (1LL<<62)-1;
constexpr int inf = (1<<30)-1;
const int mod = 1000000007;
// const int mod = 998244353;


/*FUNCs=================================================*/


/*MAIN==================================================*/
signed main(){
    int START_TIME = clock();
    cin.tie(nullptr);
    ios::sync_with_stdio(false);   //cin cout 高速化
//    cout << fixed << setprecision(15);

    i32 n; cin >> n;
    vi a(n), b(n);
    rep(i,n) cin >> a[i] >> b[i];
    sort(all(a));
    sort(all(b));

    if(n&1) {
        i32 lb = a[n/2], ub = b[n/2];
        cout << ub - lb + 1 << '\n';
    }
    else {
        i32 lb1 = a[n/2], ub1 = b[n/2];
        i32 lb2 = a[(n-1)/2], ub2 = b[(n-1)/2];
        cout << (ub1+ub2) - (lb1+lb2) + 1 << '\n';
    }

    // printf("ExecutionTime: %d /ms\n",1000*(int)((clock()-START_TIME)/CLOCKS_PER_SEC));
}


Measured memory_bytes: 6428
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
using namespace std;
int main() {
    long long int A, V, B, W, T; cin >> A >> V >> B >> W >> T;
    bool t = false;
    int i = 0;
    if (A >= B) {
        while (i <= T) {
            if (B >= A) {
                t = true; break;
            }
            else {
                A -= V, B -= W, i++;
            }
        }
    }
    else {
        while (i <= T) {
            if (A >= B) {
                t = true; break;
            }
            else {
                A += V, B += W, i++;
            }
        }
    }
    if (t) printf("%s\n", "YES");
    else printf("%s\n", "NO");
}


Measured memory_bytes: 3544
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

const int MAX_N = 1e5 + 5;
const int MAX_L = 20; // ~ Log N
const long long MOD = 1e9 + 7;
const long long INF = 1e9 + 7;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef vector<vi> vvi;

#define LSOne(S) (S & (-S))
#define isBitSet(S, i) ((S >> i) & 1)



void solve() 
{
    int n;
    cin>>n;
    vector<ll> height(n);
    ll stool = 0;
    for(int i =0; i<n; i++)
    {
        cin>>height[i];
    }
    ll sum  = 0;
    for(int i = 1; i<n; i++)
    {
        if(height[i]<height[i-1])
        {
            ll stools;
            stools = height[i-1]-height[i];
            height[i] = height[i-1];
            sum += stools;
        }
    }
    cout<<sum;
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    #ifdef LOCAL
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif

    int tc = 1; 
    //cin >> tc;
    for (int t = 1; t <= tc; t++) {
        // cout << "Case #" << t  << ": ";
        solve();
    }
}


Measured memory_bytes: 4764