akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<cstring>
#include<functional>
#include<queue>
#include <iomanip>
#include<map>
#include<limits>
#include<cmath>
#include<algorithm>
#include<bitset>
#include<utility>
#include<complex>
#include<cstdlib>
#include<set>
#include<cctype>

#define DBG cerr << '!' << endl;
#define REP(i,n) for(int (i) = (0);(i) < (n);++i)
#define rep(i,s,g) for(int (i) = (s);(i) < (g);++i)
#define rrep(i,s,g) for(int (i) = (s);i >= (g);--(i))
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {for(int i = 0;i < (n);i++)cerr << v[i] << ' ';cerr << endl << endl;}
#define SHOW2d(v,i,j) {for(int aaa = 0;aaa < i;aaa++){for(int bbb = 0;bbb < j;bbb++)cerr << v[aaa][bbb] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(10)

using namespace std;

typedef long long ll;
typedef vector<int> iv;
typedef vector<iv> iiv;
typedef vector<string> sv;

int dp[310][310];
int n;
vector<int> node;

int dfs(int l,int r)
{
	if(l > r)return 0;
	if(l == r)return 0;
	if(dp[l][r] != -1)return dp[l][r];
	if(r - l == 1)return (abs(node[l]-node[r])<2)?2:0;
	
	int ret = 0;
	
	if(dfs(l+1,r-1)==r-l-1&&(abs(node[l]-node[r])<2))
	{
		return r-l+1;
	}
	
	for(int i=0;i < r-l;i++)
	{
		ret = max(ret,dfs(l,l+i)+dfs(l+i+1,r));
	}
	
	return dp[l][r] = ret;
}

int main()
{
	while(cin >> n,n)
	{
		
		REP(i,310)REP(j,310)dp[i][j] = -1;
		node.clear();
		
		REP(i,n)
		{
			int tmp;cin >> tmp;
			node.PB(tmp);
		}
		
		cout << dfs(0,n-1) << endl;
		
	}
	
	return 0;
}

Measured memory_bytes: 3556
#include <bits/stdc++.h>
#define FOR(i, a, b) for(ll i = (a); i < (b); ++i)
#define FORR(i, a, b) for(ll i = (a); i > (b); --i)
#define REP(i, n) for(ll i = 0; i < (n); ++i)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOREACH(x, a) for(auto &(x) : (a))
#define dump(x) cout << #x << " = " << (x) << endl;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
using namespace std;
using ll = long long;
using P = pair<ll, ll>;

#define int long long

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

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  int al = B - A + 1;
  int divc = B / C - (A - 1) / C;
  int divd = B / D - (A - 1) / D;
  int L = C * D / gcd(C, D);
  int divcd = B / L - (A - 1) / L;
  // dump(divc);
  // dump(divd);
  // dump(divcd);
  cout << al - (divc + divd - divcd) << endl;
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
struct Node{
	int key;
	struct Node *right, *left,*parent;
};

struct Node *root,*nil;

struct Node *treeMinimum(struct Node *x){
	while(x->left!=nil){
		x=x->left;
	}
	return x;
}


struct Node *find(struct Node *u,int k){
	while(u!=nil && k!=u->key){
		if(k<u->key){
			u=u->left;
		}
		else {
			u=u->right;
		}
	}
	return u;
}

struct Node *treeSuccessor(struct Node *x){
	if(x->right!=nil){
		return treeMinimum(x->right);
	}
	struct Node *y=x->parent;
	while(y!=nil && x==y->right){
		x=y;
		y=y->parent;
	}
	return y;
}

void treeDelete(struct Node *z){
	struct Node *y;
	struct Node *x;
	if(z->left== nil || z->right==nil){
		y=z;
	}
	else {
		y=treeSuccessor(z);
	}
	
	if(y->left!=nil){
		x=y->left;
	}
	else{
		x=y->right;
	}
	if(x!=nil){
		x->parent=y->parent;
	}
	if(y->parent==nil){
		root=x;
	}
	else{
		if(y==y->parent->left){
			y->parent->left=x;
		}
		else{
			y->parent->right=x;
		}
	}
	if(y!=z){
		z->key=y->key;
	}
	free(y);
}
void insert(int k){
	struct Node *y=nil;
	struct Node *x=root;
	struct Node *z;
	z=(struct Node*)malloc(sizeof(struct Node));
	z->key=k;
	z->left=nil;
	z->right=nil;
	
	while(x!=nil){
		y=x;
		if(z->key<x->key){
			x=x->left;
		}
		else{
			x=x->right;
		}
	}	
	
	z->parent=y;
	if(y==nil){
		root=z;
	}
	else{
		if(z->key<y->key){
			y->left=z;
		}
		else {
			y->right=z;
		}
	}
}

void inorder(struct Node *u){
	if(u==nil){
		return;
	}
	inorder(u->left);
	printf(" %d",u->key);
	inorder(u->right);
}

void preorder(struct Node *u){
	if(u==nil){
		return;
	}
	
	if(u==nil){
		return;
	}
	printf(" %d",u->key);
	preorder(u->left);
	preorder(u->right);
}

int main(void){
	int n,i,x;
	scanf("%d",&n);
	int d;
	char string[10];
	
	for(i=0;i<n;i++){
		scanf("%s %d",string,&d);
		if(string[0]=='i'){
			insert(d);
		}
		else if(string[0]=='p'){
			inorder(root);
			printf("\n");
			preorder(root);
			printf("\n");
		}
		else if(string[0]=='f'){
			struct Node *t=find(root,d);
			if(t!=nil){
				printf("yes\n");
			} 
			else{
				printf("no\n");
			}
		}
		else if(string[0]=='d'){
			treeDelete(find(root,d));
		}
	}
	
	return 0;
}


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

#include <unistd.h>
 
using namespace std;
 
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl
#define DEBUG_MAT(v) cerr<<#v<<endl;for(int i=0;i<v.size();i++){for(int j=0;j<v[i].size();j++) {cerr<<v[i][j]<<" ";}cerr<<endl;}
 
 
typedef long long ll;
//#define int ll
 
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
template<class S, class T> pair<S, T> operator+(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first + t.first, s.second + t.second); }
template<class S, class T> pair<S, T> operator-(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first - t.first, s.second - t.second); }
template<class S, class T> ostream& operator<<(ostream& os, pair<S, T> p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
#define X first
#define Y second
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define rrep1(i,n) for(int i=(n);i>0;i--)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define in(x, a, b) (a <= x && x < b)
#define all(c) c.begin(),c.end()
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a = b; return 1; } return 0; }
#define UNIQUE(v) v.erase(std::unique(v.begin(), v.end()), v.end());
const ll inf = 1000000001;
const ll INF = (ll)1e18 + 1;
const double pi = 3.14159265358979323846;
#define Sp(p) cout<<setprecision(15)<< fixed<<p<<endl;
int dx_ori[4] = { -1,0, 1,0 }, dy_ori[4] = { 0,1,0,-1 };
int dx[4] = {0, 0, 0, 0}, dy[4] = {0, 0, 0, 0};
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };
#define fio() cin.tie(0); ios::sync_with_stdio(false);
const ll MOD = 1000000007;
//const ll MOD = 998244353;
// #define mp make_pair
//#define endl '\n'

signed main() {
  int n;
  cin >> n;
  vl a(n);
  rep (i, n) cin >> a[i];

  ll ans = 0;
  rep (_, 60) {
    ll mask = 1LL << _;
    ll yu = 0, mu = 0;
    ll cnt = 0;
    rrep (j, n) {
      if (a[j] & mask) {
        cnt += mu;
      }
      else {
        cnt += yu;
      }
      if (a[j] & mask) yu++;
      else mu++;
    }
    cnt %= MOD;
    ans += mask % MOD * cnt % MOD;
    ans %= MOD;
  }
  cout << ans << endl;
}


Measured memory_bytes: 2560
N,M = map(int,input().split(" "))
H = list(map(int,input().rstrip().split(" ")))
ans = [True] * N
ansi = N
for i in range(M):
    K = list(map(int,input().rstrip().split(" ")))
    if (H[K[0] - 1] > H[K[1] - 1]):
        if ans[K[1] - 1] == True:
            ans[K[1] - 1] = False
            ansi -= 1
    elif (H[K[0] - 1] < H[K[1] - 1]):
        if ans[K[0] - 1] == True:
            ans[K[0] - 1] = False
            ansi -= 1
    else:
        if ans[K[1] - 1] == True:
            ans[K[1] - 1] = False
            ansi -= 1
        if ans[K[0] - 1] == True:
            ans[K[0] - 1] = False
            ansi -= 1
print(ansi)

Measured memory_bytes: 20172
public class Main {


  private static void solve() {
    long n = ni();
    
    int[] m = {0, 3, 5, 7};
    int ret = 0;
    for (int i = 1; ; i ++) {
      long x = 0;
      int y = i;
      long f = 1;
      int b = 0;
      while (y > 0) {
        b |= 1 << (y % 4);
        x += m[y % 4] * f;
        f *= 10;
        y /= 4;
      }
      
      if (x > n) break;
      if (b == 14) {
        ret ++;
      }

    }
    System.out.println(ret);
  }

  public static void main(String[] args) {
    new Thread(null, new Runnable() {
      @Override
      public void run() {
        long start = System.currentTimeMillis();
        String debug = args.length > 0 ? args[0] : null;
        if (debug != null) {
          try {
            is = java.nio.file.Files.newInputStream(java.nio.file.Paths.get(debug));
          } catch (Exception e) {
            throw new RuntimeException(e);
          }
        }
        reader = new java.io.BufferedReader(new java.io.InputStreamReader(is), 32768);
        solve();
        out.flush();
        tr((System.currentTimeMillis() - start) + "ms");
      }
    }, "", 64000000).start();
  }

  private static java.io.InputStream is = System.in;
  private static java.io.PrintWriter out = new java.io.PrintWriter(System.out);
  private static java.util.StringTokenizer tokenizer = null;
  private static java.io.BufferedReader reader;

  public static String next() {
    while (tokenizer == null || !tokenizer.hasMoreTokens()) {
      try {
        tokenizer = new java.util.StringTokenizer(reader.readLine());
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
    return tokenizer.nextToken();
  }

  private static double nd() {
    return Double.parseDouble(next());
  }

  private static long nl() {
    return Long.parseLong(next());
  }

  private static int[] na(int n) {
    int[] a = new int[n];
    for (int i = 0; i < n; i++)
      a[i] = ni();
    return a;
  }

  private static char[] ns() {
    return next().toCharArray();
  }

  private static long[] nal(int n) {
    long[] a = new long[n];
    for (int i = 0; i < n; i++)
      a[i] = nl();
    return a;
  }

  private static int[][] ntable(int n, int m) {
    int[][] table = new int[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[i][j] = ni();
      }
    }
    return table;
  }

  private static int[][] nlist(int n, int m) {
    int[][] table = new int[m][n];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[j][i] = ni();
      }
    }
    return table;
  }

  private static int ni() {
    return Integer.parseInt(next());
  }

  private static void tr(Object... o) {
    if (is != System.in)
      System.out.println(java.util.Arrays.deepToString(o));
  }
}


Measured memory_bytes: 22612
#include<iostream>
#include<string>
using namespace std;
int main() {
	int n;
	cin >> n;
	int taro = 0, hanako = 0;
	for (size_t i = 0; i < n; i++){
		string s, t;
		cin >> s >> t;
		if (s > t)taro += 3;
		else if (s < t)hanako += 3;
		else{
			++taro;
			++hanako;
		}
	}
	cout << taro << ' ' << hanako << endl;
	char c;
	cin >> c;
}

Measured memory_bytes: 3224
from statistics import mean, median,variance,stdev
import numpy as np
import sys
import math
import fractions
import itertools
import copy

def j(q):
    if q==1: print("YES")
    else:print("NO")
    exit(0)


def ct(x,y):
    if (x>y):print("GREATER")
    elif (x<y): print("LESS")
    else: print("EQUAL")

def ip():
    return int(input())


def calculate(a):
    s = 0
    for i in range(len(a)):
        for k in range(i+1,len(a)):
            s+=(a[i]*a[k])
    return s

#n = ip()                              #入力整数1つ
#n,m= (int(i) for i in input().split())      #入力整数横2つ
#a,b,k = (int(i) for i in input().split())    #入力整数横3つ
#n,a,b,c= (int(i) for i in input().split())  #入力整数横4つ
#a = [int(i) for i in input().split()]        #入力整数配列
a = input()                                  #入力文字列
#a = input().split()                          #入力文字配列
#n = ip()                      #入力セット(整数改行あり)(1/2)
#a=[ip() for i in range(n)]    #入力セット(整数改行あり)(2/2)
#a=[input() for i in range(h)]
#jの変数はしようできないので注意
#全足しにsum変数使用はsum関数使用できないので注意
left  = 0
for left in range(len(a)):
    if a[left] == "A":
        break
for right in range(len(a)-1,-1,-1):
    if a[right] =="Z":
        break
print(right-left+1)


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

#define LL long long
typedef pair<int, int> pii;

template< typename T > inline void read(T &x)
{
    static char _c;
    static bool _f;

    x = 0;
    _f = 0;
    _c = getchar();

    while(_c < '0' || '9' < _c) {if(_c == '-') _f = true; _c = getchar();}
    while('0' <= _c && _c <= '9') {x = (x << 1) + (x << 3) + (_c & 15); _c = getchar();}
    if(_f) x = -x;
}

template < typename T > inline void Min(T &x, T y) {if(y < x) x = y;}
template < typename T > inline void Max(T &x, T y) {if(x < y) x = y;}


#define lowbit(x) ((x) & -(x))
#define lson l,mid,id<<1
#define rson mid+1,r,id<<1|1
#define ls id<<1
#define rs id<<1|1
#define MID(l,r) ((l)+(((r)-(l))>>1))
#define fi first
#define se second
#define mk make_pair
#define pb push_back

const int INF = 0x3f3f3f3f;
const double pi = (double) acos(-1.0);
const double eps = (double) 1e-8;
const int MOD = (int) 1e9 + 7;
//const int MOD = (int) 998244353;
const int maxn = (int) 2e5 + 20;
const int maxm = (int) 1e6 + 20;

inline int sig(double x) {return x < -eps ? -1 : eps < x;}
LL fp(LL a, LL n, LL MOD)
{
    if(n < 0) a = fp(a, MOD - 2, MOD), n = -n;
    LL res = 1; for(; n; n >>= 1, a = a * a % MOD) if(n & 1) res = res * a % MOD; return res;
}

int n;
LL a[1111];

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

    LL ans = -1e15;
    int l, r;

    for(int i = 0; i < n; i++)
    {
        LL sum = 0;
        for(int j = i; j < n; j += 2)
        {
            if(i != j && a[j] < 0) continue;
            sum += a[j];
            if(sum > ans)
            {
                ans = sum;
                l = i;
                r = j;
            }
        }
    }

    cout <<ans <<endl;
    vector<int> step;
    for(int i = n - 1; i > r; i--) step.pb(i + 1);
    for(int i = 0; i < l; i++) step.pb(1);

    int cnt = 0;
    for(int i = r; i > l; i -= 2) if(a[i] < 0)
    {
        step.pb(i - l + 1);
        cnt++;
    }
    for(int i = r - l + 1 - cnt * 2; i > 1; i -= 2) step.pb(2);

    cout <<step.size() <<endl;
    for(auto x : step) cout <<x <<endl;
}


int main(int argc, char **argv)
{
#ifdef yukihana0416
freopen("in.txt", "r", stdin);
//freopen("out.txt", "w", stdout);
#endif // yukihana0416
//    get_prime();
//    pre();
    int tc = 1;
//    read(tc);
    for(int ca = 1; ca <= tc; ca++)
    {
//        printf("Case #%d: ", ca);
        work();
    }
    return 0;
}


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

typedef pair<int, int> pii;
typedef long long ll;
template<class T> using V = vector<T>;
template<class T> using VV = V<V<T>>;

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define ALL(c) (c).begin(),(c).end()
#define dump(x) cerr << #x << " = " << (x) << endl
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n-1); }

template<class T, class U> void chmin(T& t, const U& u) { if (t > u) t = u; }
template<class T, class U> void chmax(T& t, const U& u) { if (t < u) t = u; }

template<class T, class U>
ostream& operator<<(ostream& os, const pair<T, U>& p) {
	os<<"("<<p.first<<","<<p.second<<")";
	return os;
}

template<class T>
ostream& operator<<(ostream& os, const vector<T>& v) {
	os<<"{";
	rep(i, v.size()) {
		if (i) os<<",";
		os<<v[i];
	}
	os<<"}";
	return os;
}

int get_rank(VV<int> A) { //mod 2
	const int n = A.size(), m = A[0].size();
	int r = 0;
	for (int i = 0; r < n && i < m; ++i) {
		int pivot = r;
		for (int j = r+1; j < n; ++j) {
			if (A[j][i]) {
				pivot = j;
				break;
			}
		}
		swap(A[pivot], A[r]);
		if (A[r][i] == 0) continue;
		for (int j = r+1; j < n; ++j) {
			if (A[j][i]) {
				for (int k = i; k < m; ++k) {
					A[j][k] ^= A[r][k];
				}       
			}
		}
		++r;
	}
	return r;
}

const ll MOD = TEN(9) + 7;
const int maxn = 310;

ll powmod(ll x, ll k) {
    ll res = 1;
    for (; k; k /= 2, x = x * x % MOD) {
        if (k & 1) {
            res = res * x % MOD;
        }
    }
    return res;
}

ll a[maxn], b[maxn], c[maxn][maxn], d[maxn][maxn], f[maxn][maxn], g[maxn][maxn];
ll p2[maxn];

void precalc(int N) {
	p2[0] = 1;
	rep(i, maxn - 1) {
		p2[i+1] = p2[i] * 2 % MOD;
	}

	rep(i, maxn) {
		g[i][0] = 1;
		for (int j = 1; j <= i; ++j) {
			g[i][j] = g[i][j-1] * (p2[i] - p2[j-1] + MOD) % MOD;
		}
	}

	for (int i = 0; i <= N; ++i) {
		for (int j = 0; j <= i; ++j) {
			d[i][j] = g[i][j] * powmod(g[j][j], MOD - 2) % MOD;
		}
	}

	for (int i = 0; i <= N; ++i) {
		for (int j = 0; j <= i; ++j) {
			f[i][j] = g[j][j] * d[i][i-j] % MOD;
		}
	}

	for (int i = 0; i <= N; ++i) {
		for (int j = 0; j <= i; ++j) {
			c[i][j] = d[N][j] * f[i][j] % MOD * powmod(2, N*(N-i)) % MOD;
		}
	}

	for (int i = 0; i <= N; ++i) {
		b[i] = d[N][i] * f[N][i] % MOD;
	}

	for (int i = 0; i <= N; ++i) {
		for (int j = i; j <= N; ++j) {
			a[i] = (a[i] + b[j] * c[j][i]) % MOD;
		}
	}
}

int main() {
	int N; cin >> N;
	VV<int> C(N, V<int>(N));
	rep(i, N) rep(j, N) cin >> C[i][j];

	precalc(N);

	int R = get_rank(C);

	cout << a[R] * powmod(b[R], MOD - 2) % MOD << endl;
	
	return 0;
}

Measured memory_bytes: 3968
#include <bits/stdc++.h>
using ll=long long;
using namespace std;
#define rep_i(i, n) for (int i = 0; i < (n); ++i)
#define rep_ll(i, n) for (long long i = 0; i < (n); ++i)
#define r_rep_i(i, start, end) for (int i = (start); i < (end); ++i)
#define r_rep_ll(i, start, end) for (long long i = (start); i < (end); ++i)
#define debug_vi(v) copy((v).begin(), (v).end(), ostream_iterator<int>(cout, " "));
#define debug_vll(v) copy((v).begin(), (v).end(), ostream_iterator<long long>(cout, " "));
#define debug_vd(v) copy((v).begin(), (v).end(), ostream_iterator<double>(cout, " "));
#define sort_v(v) sort((v).begin(), (v).end()); //昇順
#define d_sort_vi(v) sort((v).begin(), (v).end(), greater<int>()); //昇順
#define d_sort_vd(v) sort((v).begin(), (v).end(), greater<double>()); //昇順

int main(){
  int n;
  cin >> n;
  vector<int> hoge(n);
  int tmp;
  int max_num = -101;
  int min_num = 101;
  rep_i(i, n){
    cin >> tmp;
    hoge[i] = tmp;
    if (tmp >= max_num){
      max_num = tmp;
    }
    if(tmp <= min_num){
      min_num = tmp;
    }
  }

  // cout << "max_num " << max_num << endl;
  // cout << "min_num " << min_num << endl;
  int min_const = 1000000000;
  int sum = 0;
  r_rep_i(i, min_num, max_num + 1){
    // cout << i << endl;
    rep_i(a, n){
      sum += pow(i - hoge[a], 2.0);
    }
    if (sum <= min_const){
      min_const = sum;
    }
    sum = 0;
  }
  cout << min_const << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
using namespace std;
int cnt[200010];
int A[200010];
int main()
{
	int n;
	scanf("%d",&n);
	long long sum=0;
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&A[i]);
		sum+=cnt[A[i]];
		cnt[A[i]]++;
	}
	for(int i=1;i<=n;i++)
		printf("%lld\n",sum-cnt[A[i]]+1);
	return 0;
}

Measured memory_bytes: 3712
a, v = map(int, input().split())
b, w = map(int, input().split())
t = int(input())
dist = abs(a-b)

if a == b:
	print("YES")
	exit()

if v <= w:
	print("NO")
	exit()

speed = v-w

if dist <= speed*t:
	print("YES")
else:
	print("NO")

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

#define int long long
#define rep(i,l,r) for(int i=(int)(l);i<(int)(r);i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
template<class T>bool chmax(T &a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a,T b){if(a>b){a=b;return 1;}return 0;}

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;

const int inf = 1LL<<60;
const int mod = 1e9 + 7;
const double eps = 1e-9;

/*{
}*/

signed main()
{
	int n, m;
	cin >> n >> m;

	vi s(n+1);
	rep(i, 0, m){
		int l, r;
		cin >> l >> r;
		s[l-1]++;
		s[r]--;
	}

	rep(i, 0, n) s[i+1] += s[i];

	int ans = 0;	
	rep(i, 0, n){
		if(s[i] == m) ans++;
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
using LL = long long;
const LL LINF = 1e18;
using namespace std;
#define COUT(v) cout<<(v)<<endl
#define CIN(n)  int(n);cin >> (n)
#define SCIN(s) string(s);cin >> (s)
#define YES(n) cout<<((n)? "YES" : "NO")<<endl
#define Yes(n) cout<<((n)? "Yes" : "No")<<endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) <<endl

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)

#define FOREACH(x,a) for(auto& (x) : (a) )

#define ALL(obj) (obj).begin(),(obj).end()

#define P pair<int,int>
#define I vector<int>
#define V vector
#define S set<int>
#define pb(v) push_back(v)
int main(){
    set<char> s;
    CIN(N);
    REP(a,N){
        char b;cin >> b;
        s.insert(b);
    }
    COUT(s.size()==4?"Four":"Three");
    return 0;
}


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

int main()
{
    int ara[8],i,in=0;
    for(i=1; i<6; i++)
    {
        cin>>ara[i];
        if(ara[i]==0)in=i;
    }
    cout<<in<<endl;
    return 0;
}


Measured memory_bytes: 3632
#include<iostream>
#include<math.h>
#include<algorithm>
#include<stdint.h>
#include<vector>
#include<deque>
#include<stack>
#include<functional>
#include<string>
#include<cstring>
#include<time.h>
#include<array>
#include<iomanip>
#include<list>
#include<set>
#include<map>
#include<random>
#include<unordered_map>
#include<unordered_set>
#include<bitset>
#include <queue>


using namespace std;
using ll = long long;
using ull = unsigned long long;
using uint = unsigned int;
using ldouble = long double;


//BDD,ZDD,kdtree, bdtree,bicalc, bolonoy, doloney, tree, chinesemod,segmenttree,daikusutora, saidairyuu, 2bugurahu, heirokenshutu, topologicalsort, kyourenketuseibun

#define REP(i,a,b) for(int i = a; i < b; ++i)
#define PRI(s) cout << s << endl
#define PRIY PRI("Yes")
#define PRIN PRI("No")

/*
int N,M;
vector<ll> A;
vector<ll> S;

pair<ll,ll> f(ll x) {
	ll ans = 0, tot = 0;
	for (ll a : A) {
		auto itr = lower_bound(A.begin(), A.end(), x - a);
		ll d = distance(A.begin(), itr);
		ll c = A.size() - d;
		tot += S[A.size()] - S[d];
		tot += a * c;
		ans += c;
	}
	return pair<ll, ll>(tot, ans);
}

ll bins(ll m) {
	ll l = 0;
	ll r = 10000000;
	while (r - l > 1) {
		ll mid = (r + l) / 2;
		ll tmp = f(mid).second;
		if (tmp >= m) l = mid;
		else r = mid;
	}
	return l;
}

ll solve(ll L) {
	auto p = f(L);
	ll ans = p.first;
	ans -= (p.second - M) * L;
	return ans;
}*/

int main() {
	/*
	cin >> N >> M;
	A.resize(N);
	REP(i, 0, N) cin >> A[i];
	sort(A.begin(), A.end());
	S.resize(N+1);
	S[0] = 0;
	REP(i, 1, N + 1)S[i] = S[i - 1] + A[i - 1];
	PRI(solve(bins(M)));*/
	int n;
	ll m;
	cin >> n >> m;
	vector<int> a(n);
	REP(i, 0, n)cin >> a[i];
	sort(a.begin(), a.end());
	vector<ll> s(n + 1);
	s[0] = 0;
	REP(i, 0, n) s[i + 1] = s[i] + a[i];

	auto calc = [&](int x) {
		ll tot = 0, num = 0;
		REP(i, 0, n) {
			auto itr = lower_bound(a.begin(), a.end(), x - a[i]);
			int d = distance(a.begin(), itr);
			num += n - d;
			tot += s[n] - s[d];
			tot += a[i] * (ll)(n - d);
		}
		return pair<ll, ll>(tot, num);
	};
	int l = 0, r = 10000000;
	while (l + 1 < r) {
		int c = (l + r) / 2;
		if (calc(c).second >= m) l = c; else r = c;
	}
	auto p = calc(l);
	ll ans = p.first;
	ans -= (p.second - m) * l;
	PRI(ans);
	return 0;
}




Measured memory_bytes: 4556
package main

import "fmt"

func main() {
	var ax, ay, bx, by int
	fmt.Scan(&ax, &ay, &bx, &by)
	cx := bx + (ay - by)
	cy := by + (bx - ax)
	dx := ax + (ay - by)
	dy := ay + (bx - ax)
	fmt.Println(cx, cy, dx, dy)
}


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

using std::cout;
using std::endl;
using std::cin;
using std::string;

// ????????¨??¢??°
void battle_check(string taro, string hanako, int arr[]) {
	string res;
	if (taro > hanako)
	{
		arr[0] = 3; arr[1] = 0;
	}
	else if (taro < hanako) {
		arr[0] = 0; arr[1] = 3;
	}
	else {
		arr[0] = 1; arr[1] = 1;
	}
}

int main() {
	
	int battle_num;			// ???????????°
	string taro_card;		// ????????????????????¢??????????????????
	string hanako_card;		// ??±?????????????????¢??????????????????
	int taro_score = 0;		// ?????????????????¢
	int hanako_score = 0;	// ??±??????????????¢
	//string result;			// ???????????????????´???¨?????°
	int result[] = { 0,0 };	// [0]????????????????????¢????¶??????????????????°???[1]?????±??????????????¢????¶??????????????????°

	// ??\???
	cin >> battle_num;

	for (size_t i = 0; i < battle_num; i++)
	{
		cin >> taro_card;
		cin >> hanako_card;

		// ??????
		battle_check(taro_card, hanako_card, result);

		// ???????????????????¶????????????????
		taro_score += result[0];
		hanako_score += result[1];
	}
	cout << taro_score << " " << hanako_score << endl;
	return 0;
}

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

typedef long long lli;

lli rec(int l, int r, vector<int> &A) {
  if(r-l <= 1) return 0;
  int m = (l+r)/2;
  lli res = rec(l, m, A) + rec(m, r, A);
  queue<int> a, b;
  for(int i = l; i < m; ++i) a.push(A[i]);
  for(int i = m; i < r; ++i) b.push(A[i]);
  int k = l;
  while(a.size() && b.size()) {
    if(a.front() <= b.front()) {
      A[k++] = a.front();
      a.pop();
    } else {
      A[k++] = b.front();
      b.pop();
      res += a.size();
    }
  }
  while(a.size()) {
    A[k++] = a.front();
    a.pop();
  }
  while(b.size()) {
    A[k++] = b.front();
    b.pop();
  }
  return res;
}

int main() {
  int n;
  vector<int> A;
  cin >> n;
  A.resize(n);
  for(int i = 0; i < n; ++i) cin >> A[i];
  cout << rec(0, n, A) << endl;
  return 0;
}

Measured memory_bytes: 2724
// vim: shiftwidth=2 expandtab foldmethod=marker

// include {{{
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cmath>
#include <utility>
#include <cstdlib>
#include <random>
// }}}

// debug(...) {{{
#ifdef LOCAL_DEBUG
#include "./debug.h"
#else
#define debug(...)
#define debugn(...)
#define debug_reset()
#endif

#include <cstdio>

template<class T>
std::string bin(int bits, const T& x) {
  char buf[bits + 1];
  buf[bits] = '\0';
  for(int i = 0; i < bits; i++) {
    if((x >> i) & 1) {
      buf[bits - i - 1] = '1';
    } else {
      buf[bits - i - 1] = '0';
    }
  }
  return std::string(buf);
}
std::string bin(int x) {
  if(x < 0) return bin(32, x);
  for(int i = 4; i < 31; i++) {
    int y = 1 << i;
    if(x < y) return bin(i, x);
  }
  return bin(32, x);
}
// }}}

// misc {{{
using namespace std;
typedef long long ll;
#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++)

template<class T>
void sort(T& arr) {
  std::sort(arr.begin(), arr.end());
}
template<class T, class By>
void sort_by(T& arr, By by) {
  std::sort(arr.begin(), arr.end(), [by](auto l, auto r){return  by(l) < by(r); });
}

template<class T>
void reverse(T& arr) {
  std::reverse(arr.begin(), arr.end());
}

// }}}

// main {{{
void solve();
int main() {
  solve();
}
// }}}

void solve() {
  long N;
  cin >> N;
  long ans = N * (N - 1) / 2;
  cout << ans << endl;
}


Measured memory_bytes: 888
#include<stdio.h>
int time[24][60];
int main(void)
{
	int i,j,h,m,f;
	for(i=0; i<2; i++) {
		scanf("%d",&j);
			for(;j>0;j--) {
				scanf("%d %d",&h,&m);
				time[h][m]=1;
				}
			}
			f=1;
			for(i=0;i<24;i++)
				for(j=0;j<60;j++)
					if(time[i][j]){
						if(!f)printf(" ");
						else f=0;
						printf("%d:%02d",i,j);
						}
					printf("\n");
					return 0;
}

Measured memory_bytes: 620
from collections import deque

n = int(input())

u = [0] * n
v = [0] * n
w = [0] * n

dist = [-1] * n
adj_list = [[] for _ in range(n)]

for i in range(n - 1):
    u, v, w = map(int, input().split())
    u -= 1
    v -= 1

    adj_list[u].append([v, w])
    adj_list[v].append([u, w])

q = deque()
dist[0] = 0
q.append(0)

while len(q) > 0:
    node = q.popleft()

    for next, d in adj_list[node]:
        if dist[next] > 0:
            continue

        if dist[next] == -1 or dist[next] > dist[node] + d:
            dist[next] = dist[node] + d
            q.append(next)

for i in range(n):
    if dist[i] % 2 == 0:
        dist[i] = 0
    else:
        dist[i] = 1
    print(dist[i])


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

int main(){
  int c[3][3];
  for(int i=0;i<3;i++){
    for(int j=0;j<3;j++){
      cin>>c[i][j];
    }
  }
  bool flag=true;
  for(int i=0;i<=1;i++){
    int a=c[i][0]-c[i+1][0];
    for(int j=1;j<=2;j++){
      if(c[i][j]-c[i+1][j]!=a){
        flag=false;
        break;
      }
    }
  }
  for(int j=0;j<=1;j++){
    int b=c[0][j]-c[0][j+1];
    for(int i=1;i<=2;i++){
      if(c[i][j]-c[i][j+1]!=b){
        flag=false;
        break;
      }
    }
  }
  if(flag){
    cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <numeric>

using namespace std;

#define ll long long
#define rep(cnt,a,n) for(ll cnt=a;cnt<n+a;cnt++) //aから始めてn回ループ
#define vector2(type,name,a,b) vector<vector<type>> name(a, vector<type>(b))
#define PI 3.141592653589793
int main()
{
    string s;
    string t;
    cin >> s;
    cin >> t;

    int siz = s.size();
    char hoge = t[siz];
    s = s + hoge;
    if (s == t) {
        cout << "Yes" << endl;
        return 0;
    }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define MOD 100000007
#define PI 3.141592653589793238
#define pb push_back
#define ALL(V) (V).begin(), (V).end()
#define rep(i, a, b) for(int i = (a); i < (b); ++i)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long long int lint;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef vector<int> VI;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
inline ll gcd(ll a, ll b) { return (a % b == 0 ? b : gcd(b, a % b)); }
inline ll lcm(ll a, ll b) { return a * b / gcd(a, b); }
inline ll char_to_ll(char c) { return (int)(c - '0'); }
inline ll string_to_ll(string s) { return atoi(s.c_str()); }
inline bool is_prime(ll x){ if(x <= 1) return false; for(ll i = 2; sqrt(i) <= x; i++) if(x % i == 0) return false; return true; }

int main(){
    ll N;
    string S;
    cin >> N >> S;
    ll r = 0, g = 0, b = 0;
    for(char c : S){
        switch(c){
            case 'R':
                r++;
                break;
            case 'G':
                g++;
                break;
            case 'B':
                b++;
                break;
        }
    }

    ll cases = r * g * b;

    rep(i, 0, N){
        rep(j, i + 1, N){
            ll k = j + (j - i);
            if(k < N && S[i] != S[j] && S[j] != S[k] && S[i] != S[k]){
                cases--;
            }
        }
    }

    cout << cases << endl;

    return 0;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define ll long long
#define MOD 1000000007

using namespace std;

ll n, m, s;

int main()
{
    cin >> n;
    m = n;
    while (n > 0) {
        s += (n % 10);
        n = n / 10;
    }
    if (m % s == 0)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
using ll = long long;
using P = pair<int,int>;
using PP = pair<int,pair<int,int>>;
using T = tuple<string,int,int>;
const ll INF = 1LL<<60;
const int ny[4] = {-1,1,0,0}, nx[4] = {0,0,-1,1};
int sy,sx,gy,gx;

int main(){
  int n,t,a; cin >> n >> t >> a;
  t *= 1000; a *= 1000;
  vector<int> h(n);
  rep(i,n) cin >> h[i];
  int ab = 1<<29;
  int id = 0;
  rep(i,n){
    int now = t - h[i] * 6;
    int temp = abs(now-a);
    if(ab > temp){
      id = i;
      ab = temp;
    }
  }
  cout << id+1 << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <stdlib.h>
using namespace std;
typedef long long int ll;
#define INF (1e9)
#define distance(x1,y1,x2,y2) sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
#define rep(i,N) for(ll i=0;i<N;i++)
using vvl=vector<vector<ll>>;
using vl=vector<ll>;
using vs=vector<string>;
using vvs=vector<vector<string>>;

bool func(vl s,vl t){
    return s[1]<t[1];
}

/*void printvl(vl v){
    rep(i,v.size()){
        cout<<i<<": "<<v[i]<<endl;}
}

void printvl2(vvl v){
    rep(i,v.size()){
        cout<<i<<": "<<v[i][0]<<" ,"<<v[i][1]<<endl;}
}*/

ll H,W;

ll ans(vs v){
    rep(i,H){
        rep(j,W){
            if(v[i][j]=='#'){
                if(i>0){
                    if(v[i-1][j]=='#'){
                        continue;
                    }
                }
                if(i<H-1){
                    if(v[i+1][j]=='#'){
                        continue;
                    }
                }
                if(j>0){
                    if(v[i][j-1]=='#'){
                        continue;
                    }
                }
                if(j<W-1){
                    if(v[i][j+1]=='#'){
                        continue;
                    }                    
                } 
                cout<<"No"<<endl;
                return 0;
            }
        }
    } 
        
    cout<<"Yes"<<endl;
    return 1;
}
    

int main(){
    cin>>H>>W;
    vs v(60);
    rep(i,H){
        cin>>v[i];
    }
    ans(v);    
    return 0;}

Measured memory_bytes: 256
# coding: utf-8
# hello worldと表示する
#float型を許すな
#numpyはpythonで
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi,factorial
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7

n=I()
lis=[SI() for i in range(n)]
c=Counter(lis)
mx=0
for x in c.keys():
    if c[x]>mx:
        mx=c[x]
answers=[]
for x in c.keys():
    if c[x]==mx:
        answers.append(x)
answers.sort()
for x in answers:
    print(x)

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

using namespace std;

using ll = long long;

template<typename T> using V = std::vector<T>;
using Vi = V<int>;
using VVi = V<V<int>>;
using Vl = V<ll>;
using VVl = V<V<ll>>;
using Vs = V<string>;

template<typename T1, typename T2> using P = std::pair<T1, T2>;
using Pii = P<int, int>;
using Pll = P<ll, ll>;
using Pdd = P<double, double>;

template<typename T1, typename T2> using M = std::map<T1, T2>;
using Mii = M<int, int>;
using Msi = M<string, int>;

#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define REP2(i,s,e) for(int i=(int)(s);i<(int)(e);++i)
#define RREP(i,s,e) for(int i=(int)(s);i>=(int)(e);--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin(),ie=(c).end();i!=ie;++i)
#define ALL(c) (c).begin(), (c).end()

const double PI = acos(-1);
const ll MOD = 1e9+7;

int n, m;
string s;
Vi a;

bool dfs(int depth, int val) {
    if (val == 0) return true;
    if (depth == n) return false;
    return dfs(depth+1, val) || dfs(depth+1, val-a[depth]);
}

int main() {
    cin >> n;
    a = Vi(n);
    REP(i, n) cin >> a[i];
    sort(ALL(a));

    cin >> m;
    REP(i, m) {
        int x; cin >> x;
        if (dfs(0, x)) {
            std::cout << "yes" << '\n';
        } else {
            std::cout << "no" << '\n';
        }
    }

    return 0;
}



Measured memory_bytes: 3184
#include<string>
#include<string.h>
#include<map>
#include<set>
#include<vector>
#include<stdio.h>
#include<math.h>
#include<iostream>
#include<algorithm>
#include<queue>
using namespace std;
int main(){
int a,b,c,d,f;
int e=0;
cin>>a>>b>>c>>f;
if(a>b)
d=a;
else
d=b;
if(c>d)
d=c;
e=a+b+c;
for(;f>0;f--){
e=e+d;
d=2*d;
}
cout<<e;
system("pause");
return 0;
}

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

int main () 
{
int n,i;
int a[1010];

scanf("%d",&n);

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

for(i=0;i<n;i++)
{
    if(a[i]%2==0)
    {
        if(a[i]%3!=0&&a[i]%5!=0)
        {
            printf("DENIED");
            return 0;
        }
    }
}
printf("APPROVED");
return 0;
}

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

int main(void){
    int N,M;
    cin >> N >> M;
    vector<pair<int,int>> req(M);
    for(int i=0;i<M;i++){
        int a,b;
        cin >> a >> b;
        req[i] = make_pair(b-1,a-1);
    }
    sort(req.begin(),req.end());

    int count = 0, pos = -10;
    for(int i=0;i<req.size();i++){
        if(req[i].second>pos){
            count++;
            pos = req[i].first-1;
        }
    }
    cout << count << endl;

}

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


class Program {

	static long mod = 1000000007;
	//static long mod =998244353;
	static int[] ans;
	static void Main(string[] args) {

		char[] cs = new char[] { ' ' };
		//char[] cs = new char[] { ' ', ',' };

		//int n = int.Parse(Console.ReadLine());
		//int val = int.Parse(Console.ReadLine());
		//int[] vals = parseAry(Console.ReadLine().Split(cs));
		//string str = Console.ReadLine();
		//string[] strs = Console.ReadLine().Split(cs);

		//string res = "";


		long res = 0;
		

		int n = int.Parse(Console.ReadLine());
		int[] vals = parseAry(Console.ReadLine().Split(cs));

		int[] sum = new int[n];
		sum[n-1]=vals[n-1];
		for ( int i = n - 2; i >= 0; i-- ) { 
			sum[i]=sum[i+1]+vals[i];
		}


		long lp = n - 1;
		for ( int i = 0; i < n-1; i++ ) {
			res += (long)vals[i] * sum[i + 1];
		
		}	

		Console.WriteLine(res);

		return;

	}




	//	int配列をスペース区切りの文字列に変換
	static string stringBuilderArrayInt(int[] a) {
		StringBuilder sb = new StringBuilder();

		for ( int i = 0; i < a.Length; i++ ) {
			sb.Append(a[i] + " "); 
		}
		if ( sb.Length > 1 ) {
			sb = sb.Remove(sb.Length - 1, 1);
		}
		return sb.ToString(); ;
	}


	//	文字列strをindex番目からdで上書き
	static string strOverWrite(string str, int i, string s) {
		return str.Remove(i, s.Length).Insert(i, s);
	}

	//　String[]  ----->  int[]
	static int[] parseAry(string[] str) {
		int[] nums = new int[str.Length];
		for ( int i = 0; i < str.Length; i++ ) { nums[i] = int.Parse(str[i]); }
		return nums;
	}
	//　String[]  ----->  long[]
	static long[] parseAryL(string[] str) {
		long[] nums = new long[str.Length];
		for ( int i = 0; i < str.Length; i++ ) { nums[i] = long.Parse(str[i]); }
		return nums;
	}

	//文字列を1文字ずつString[]に入れる
	static string[] strAry(String str) {
		string[] re = new string[str.Length];
		for ( int i = 0; i < str.Length; i++ ) { re[i] = str[i].ToString(); }
		return re;
	}



}

Measured memory_bytes: 11092
#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <ctype.h>
#include <math.h>
#include <stack>
#include <string>
#include <string.h>
using namespace std;
double PI = 3.1415926535897932;
long mod = 1000000007;

const long INF = 1e9 + 1;

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

  int ans = 0;
  for(int i = 1; i <= n; i++) {
    int cnt = 0;
    for(int j = 1; j <= i; j++) {
      if(i % j == 0) cnt++;
    }
    if(cnt == 8) ans++;
    i++;
  }
  cout << ans << endl;
}


Measured memory_bytes: 3540
#include<bits/stdc++.h>
using namespace std;
long long dp[100005][3],dp2[100005][3];
main()
{
	int t;
	scanf("%d",&t);
	for(int i = 0;i < t;i++)
	{
		for(int j = 0;j < 3;j++)
		{
			scanf("%lld",&dp2[i][j]);
		}
	}
	for(int i = 0;i < 3;i++)
	dp[0][i]=dp2[0][i];
	for(int i = 1;i < t;i++)
	{
		for(int j = 0;j < 3;j++)
		{
			for(int k = 0;k < 3;k++)
			{
				if(j!=k)
				dp[i][j]=max(dp[i-1][k]+dp2[i][j],dp[i][j]);
			}
		}
	}
	long long mx=0;
	for(int i=  0;i < 3;i++)
	mx=max(mx,dp[t-1][i]);
	printf("%lld",mx);
}

Measured memory_bytes: 4992
#include <bits/stdc++.h>
#include<iostream>
#include <algorithm>
#include<stdio.h>
#include<string.h>
#include <unordered_map>
#include <map>
#include <unordered_set>
#include<vector>
using namespace std;
#define fr(i,j,n)   for(int i=j;i<(n);++i)
#define bk(i,j,n)   for(int i=j;i>=n;--i)
#define pb push_back
#define mp make_pair
#define Fs first
#define Sc second
#define endl "\n"
#define MOD 1000000007
#define run ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define ordered_set tree<ll , null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>
typedef long long lli;

int main()
{
    int n;
    string s,t;
    cin>>n;
    cin>>s;
    cin>>t;
    for(int i=0;i<n;++i)
    {
        cout<<s[i]<<t[i];
    }
    cout<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>

#define int long long
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPS(i,n) for(int i=1, i##_len=(n); i<=i##_len; ++i)

using namespace std;

int A, B, C, D;

signed main()
{
    cin >> A >> B >> C >> D;
    cout << min(A, B) + min(C, D) << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N, count_minus = 0;
  bool existence_zero = false;
  long S=0, min=100000000;
  cin >> N;
  
  vector<long> A(N);
  for(int i=0;i<N;i++){
    cin >> A.at(i);
    if(A.at(i)<0){
      count_minus++;
      A.at(i) = -A.at(i);
    }
    else if(A.at(i)==0){
      existence_zero = true;
    }
    
    if(A.at(i)<=min && existence_zero==false){
      min = A.at(i);
    }
    
    S += A.at(i);
  }
  
  if(count_minus%2==1 && existence_zero==false){
    S -= 2*min;
  }
  cout << S << endl;
}


Measured memory_bytes: 1152
#include <iostream>

using namespace std;

int main(){
	long long N, X;
	while(cin >> N >> X){
		long long res = N;
		N -= X;
		while(true){
			if(N%X == 0){
				res += ((N/X - 1) * 2 + 1) * X;
				break;
			}
			if(N < X) swap(N, X);
			res += N/X * 2 * X;
			N %= X;
		}
		cout << res << endl;
	}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, x, n) for (int i = x; i < (n); i++)
#define all(n) begin(n), end(n)
struct cww
{
    cww()
    {
        ios::sync_with_stdio(false);
        cin.tie(0);
    }
} star;
const long long INF = numeric_limits<long long>::max();
typedef long long ll;
typedef vector<int> vint;
typedef vector<char> vchar;
typedef vector<vector<int>> vvint;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef unsigned long long ull;
template <class T>
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }

template <typename T, typename... Ts>
auto make_v(size_t a, Ts... ts)
{
    return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template <typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T &t, const V &v) { t = v; }

template <typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T &t, const V &v)
{
    for (auto &e : t)
        fill_v(e, v);
}
int main()
{
    ll N;
    cin >> N;
    ll sum = 0, Max = 0;
    for (int i = 1; i <= N; i++)
    {
        sum += i;
        if (sum >= N)
        {
            Max = i;
            break;
        }
    }
    sum = 0;
    vint ans;
    for (int i = Max; i >= 0; i--)
    {
        sum += i;
        if (sum < N)
        {
            ans.push_back(i);
        }
        else if (sum == N)
        {
            ans.push_back(i);
            for (auto &&i : ans)
            {
                cout << i << " ";
            }
            return 0;
        }
        else
        {
            sum -= i;
        }
    }

    return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
using namespace std;
#define rep(i, s, n) for(int i = s; i < n; i++) 
#define ll long long

int counter(int x) {
    if(x == 0) {
        return 0;
    }
    return counter(x >> 1) + (x & 1);
}

int main() {
    int n;
    cin >> n;
    
    vector<int> a(n);
    vector<vector<pair<int, int>>> xy(n);

    rep(i, 0, n) {
        cin >> a[i];
        //sum += a[i];
        rep(j, 0, a[i]) {
            int x, y;
            cin >> x >> y;
            xy[i].push_back(make_pair(x, y));
        }
    }

    int ans = 0;
    rep(bit, 1, (1<<n)) {
        bool ok = true;
        vector<bool> person(n);
        //vector<int> person(n);
        //cout << "person: ";
        rep(i, 0, n) {
            person[i] = (bit >> i) & 1;
            //cout << person[i] << " ";
        }
        //cout << endl;
        
        bool judge = false;
        int sum = 0;
        int count = 0;
        int trueman = 0;
        rep(i, 0, n) {
            if(person[i] == 1) {
                trueman++;
                sum += a[i];
                rep(j, 0, a[i]) {
                    //cout << person[xy[i][j].first-1] << " " <<  xy[i][j].second <<  endl;
                    if(person[xy[i][j].first-1] != xy[i][j].second) {
                        count = 0;
                        continue;
                    }
                    else {
                        count++;
                    }
                    //cout << "count : "<< count << endl;
                }
                //cout << "count: " << count << " " << "a: " << a[i] << endl;
                /*
                if(count == a[i]) {
                    trueman++;
                }
                */
                //count = 0;
            }
        }


        //cout << "count: " << count << " " << "sum: " << sum << endl;
        if(count == sum) {
            //cout << "tureman : " << trueman << endl;
            ans = max(ans, trueman);
        }

        
        //ans = max(ans, trueman);
        //if(ok) ans = max(ans, counter(bit));
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define fo for(int i=0;i<n;i++)
#define clear cin.clear();cin.ignore(numeric_limits<streamsize>::max(), '\n');
#define loopSolve int t; cin>>t; while(t--){solve();}
#define rep(i, n)    for(int i = 0; i < (n); ++i)
#define repA(i, a, n)  for(int i = a; i <= (n); ++i)
#define repD(i, a, n)  for(int i = a; i >= (n); --i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
#define fill(a)  memset(a, 0, sizeof (a))
#define fst first
#define snd second
#define mp make_pair
#define pb push_back
typedef long double ld;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

//INT_MAX         2,147,483,647                       <10^10
//U_INT_MAX       4,294,967,295                       <10^10
//LONG_LONG_MAX   9,223,372,036,854,775,807           <10^18
//U_LONG_LONG_MAX 18,446,744,073,709,551,615          <10^18
//ll power(int a, int b){
//    return (ll)(pow(a,b)+0.5);
//}

vector<int> gV(int n){
    vector<int> v(n);
    fo { cin>>v[i];  }
    return v;
}

int* gA(int n){
    int* arr = new int[n];
    fo cin>>arr[i];
    return arr;
}

void solve(){
    int x;
    cin>>x;
    if(x>=400 && x<=599)
        cout<<8<<endl;
    else if(x>=600 && x<=799)
        cout<<7<<endl;
    else if(x>=800 && x<=999)
        cout<<6<<endl;
        else if(x>=1000 && x<=1199)
        cout<<5<<endl;
        else if(x>=1200 && x<=1399)
        cout<<4<<endl;
        else if(x>=1400 && x<=1599)
        cout<<3<<endl;
        else if(x>=1600 && x<=1799)
        cout<<2<<endl;
        else if(x>=1800 && x<=1999)
        cout<<1<<endl;
}


int main() {
	ios_base::sync_with_stdio(false);
    std::cin.tie(NULL);
    std::cout.tie(NULL);

    solve();
    //loopSolve;

	return 0;
}


Measured memory_bytes: 3640