akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
int K;
vector<int>even,odd;
vector<pair<int,int>>pairs;
main(){
  cin>>K;
  for(int i=1;i<=K;++i){
    if(i%2)odd.push_back(i);
    else even.push_back(i);
  }
  for(auto&i:odd)for(auto&j:even)pairs.push_back({i,j});
  cout<<pairs.size()<<endl;
}


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

const int RLEN=1<<18|1;
inline char nc() {
	static char ibuf[RLEN],*ib,*ob;
	(ib==ob) && (ob=(ib=ibuf)+fread(ibuf,1,RLEN,stdin));
	return (ib==ob) ? -1  : *ib++;
}
inline int rd() {
	char ch=nc(); int i=0,f=1;
	while(!isdigit(ch)) {if(ch=='-')f=-1; ch=nc();}
	while(isdigit(ch)) {i=(i<<1)+(i<<3)+ch-'0'; ch=nc();}
	return i*f;
}

const int N=1e5+50;
int n;
vector <int> edge[N];

inline int sg(int x,int f) {
	int sum=0;
	for(auto v:edge[x])
		if(v^f) sum^=(sg(v,x)+1);
	return sum;
}
int main() {
	n=rd();
	for(int i=1;i<n;i++) {
		int x=rd(), y=rd();
		edge[x].push_back(y);
		edge[y].push_back(x);
	} puts(sg(1,0) ? "Alice" : "Bob");
}

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

using namespace std;
using ll = long long;
using ld = long double;

#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define ALL(x) ((x).begin()), ((x).end())

#define READ(x) (cin >> (x))
#define WRITE_N(x) (cout << (x) << endl)
#define WRITE(x) (cout << (x))
#define WRITE_YESNO(x) (WRITE_N((x) ? "Yes" : "No"))

#define PRECISE_COUT std::cout << std::setprecision(15) << std::fixed

bool xor_logic(bool x, bool y) { return (x && y) || (!x && !y); }

ll solve(vector<ll> &friendly_vec, ll N) {
  vector<ll> sorted_friendly_vec = friendly_vec;
  sort(ALL(sorted_friendly_vec), greater<ll>());

  ll effect_people_num = (N + 1) / 2;
  bool is_last_effective_person_double = (N % 2 == 0);

  ll retv =
      2 * accumulate(sorted_friendly_vec.begin(),
                     sorted_friendly_vec.begin() + effect_people_num, 0LL) -
      sorted_friendly_vec[0] -
      (is_last_effective_person_double
           ? 0
           : sorted_friendly_vec[effect_people_num - 1]);
  return retv;
}

int main() {
  // get values from input
  cin.tie(0);
  ios::sync_with_stdio(false);

  ll N;
  cin >> N;

  std::vector<ll> A(N, 0);
  for (size_t i = 0; i < N; i++) {
    cin >> A[i];
  }

  // main procedure
  ll ans = solve(A, N);

  // output
  cout << ans << endl;

  return 0;
}

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

int main(){
  
  int N, M;
  cin >> N >> M;
  
  vector<int> count(N);
  
  int i,k;
  for(i = 0; i < 2*M; i++){
    cin >> k;
    ++count.at(k - 1);
  }
  
  for(i = 0; i < N; i++){
    cout << count.at(i) << endl;
  }
}
    


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
auto main()->int
{
	int k, x;
	cin >> k >> x;
	for (auto i = x - k + 1; i <= x + k - 1; ++i) {
		cout << i;
		if (i != x + k - 1) {
			cout << " ";
		}
	}
	cout << endl;
	return 0;
}


Measured memory_bytes: 256
/**************
*	Shell Sort
*************/

#include <iostream>
#include <vector>	//??£?¨?
#include <algorithm>
using namespace std;

void insertionSort(vector<int>* A, int g, int* cnt  ){

	for(unsigned int i=g ; i<(A->size()); i++){
		int v = (*A)[i];
		int j = i-g;
		while(j>=0 && (*A)[j]>v){
			(*A)[j+g] = (*A)[j];
			j = j-g;
			(*cnt)++;
		}
		(*A)[j+g] =v;
	}
	return ;
}
//---------------------------------------------------------
void shellSort(vector<int>* A, vector<int>* G, int* cnt){

	for(unsigned int i=0; i<(G->size()); i++){
		insertionSort(A, (*G)[i], cnt);
	}

	return;
}
//--<<???????????¢??°>>-------------------------------------------------------
int main(){

	//??\???
	int n;
	cin >> n;
	vector<int> A;
	A.resize(n);
	for(unsigned int i=0; i< A.size(); i++){
		cin >> A[i];
	}

	//??????
	vector<int> G;
//	G.reserve(100);//????????????????´???°???????????£??????????????¨????????????
	int sum = 1;
	while(sum <= n){
	    G.push_back(sum);
		sum = sum * 3 + 1;
	}
	reverse(G.begin(), G.end());

	int cnt = 0;
	shellSort(&A, &G, &cnt);

	//??????
	cout << G.size() << endl;
	for(unsigned int i=0; i<(G.size()); i++){
		cout << G[i];
		if(i!=(G.size()-1)){
			 cout <<" " ;
		}
	}
	cout << endl;
	cout << cnt << endl;
	for(int i=0; i< n; i++){
		cout << A[i]<< endl;
	}

	return 0;
}
//-----------------------------------------------

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

#define REP(i,n) for (int i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()

using namespace std;

using ll = long long;

int main() {
    constexpr int C_MAX = 100000;
    int N, M, R;
    cin >> N >> M >> R;
    vector<int> r(R);
    REP(i, R) {
        cin >> r[i];
        --r[i];
    }
    // const ll INF = C_MAX * N;
    const ll INF = LLONG_MAX;
    vector<vector<ll>> d(N, vector<ll>(N, INF));
    REP(i, N) d[i][i] = 0;
    REP(i, M) {
        int A, B, C;
        cin >> A >> B >> C;
        --A; --B;
        d[A][B] = C;
        d[B][A] = C;
    }

    REP(k, N) REP(i, N) REP(j, N) {
        if (d[i][k] != INF && d[k][j] != INF) {
            d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
        }
    }

    ll result = INF;
    vector<int> a(R);
    REP(i, R) a[i] = i;
    do {
        ll L = 0;
        REP(i, R - 1) {
            ll dist = d[r[a[i]]][r[a[i + 1]]];
            if (dist == INF) {
                L = INF;
                break;
            } else {
                L += dist;
            }
        }
        result = min(result, L);
    } while (next_permutation(all(a)));
    cout << result << endl;
    return 0;
}

Measured memory_bytes: 512
import std.stdio;
import std.string;
import std.math;
import std.conv;

void main(){
  const int N=1000000;
  auto p=new bool[N+1];
  for(int i=0;i<=N;++i)p[i]=true;
  p[0]=p[1]=false;
  for(int i=2;i*i<=N;++i){
    if(p[i]){
      for(int j=2;i*j<=N;++j)p[i*j]=false;
    }
  }
  string s;
  while(s=readln.chomp,s!=""){
    int n=to!int(s),count=0;
    for(int i=2;i<=n;++i)if(p[i])++count;
    writeln(count);
  }
  
}

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

double getDistance( double x1, double y1, double x2, double y2 )
{
    return sqrt( ( x2 - x1 ) * ( x2 - x1 ) + ( y2 - y1 ) * ( y2 - y1 ) );
}

double calcASurfaceArea( double a, double b, double c )
{
    double z = ( a + b + c ) / 2;
    return sqrt( z * ( z - a ) * ( z - b ) * ( z - c ) );
}

int main()
{
    int n = 0;
    char p;

    double x[20];
    double y[20];

    int i = 0;
    while( cin >> x[i] >> p >> y[i] )
    {
        i++;
        n++;
    }

    int tri = 0, j = 0;
    double sa = 0;
    while( tri != n - 2 )
    {
        int j1 = 0, j2 = j + 1, j3 = j + 2;
        //cout << "j1: " << j1 << " j2: " << j2 << " j3: " << j3 << endl;
        sa += calcASurfaceArea( getDistance( x[j1], y[j1], x[j2], y[j2] ), getDistance( x[j2], y[j2], x[j3], y[j3] ), getDistance( x[j1], y[j1], x[j3], y[j3] ) );
        j++;
        tri++;
        //cout << sa << endl;
    }

    cout << fixed << setprecision(8) << sa << endl;

    return 0;
}


Measured memory_bytes: 3200
#include <stdio.h>
#include <stdlib.h>
int cmpint(const void *x, const void *y) {
	return *(int *)x - *(int *)y;
}
int main() {
	int n;
	scanf("%d", &n);
	int l[100000];
	for (int i = 0; i < n; i++) {
		scanf("%d", &l[i]);
	}
	int ans = 0;
	qsort(l, n, sizeof(int), cmpint);
	for (int i = 0; i < n; i++) {
		for (int j = i + 1; j < n; j++) {
			for (int k = j + 1; k < n; k++) {
				if (l[i] != l[j] && l[j] != l[k]) {
					if (l[i] + l[j] > l[k] && l[j] + l[k] > l[i] &&
						l[k] + l[i] > l[j]) {
						ans++;
					}
				}
			}
		}
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 1740
#![allow(non_snake_case, unused_imports)]

// Input
macro_rules! input { (source = $s:expr, $($r:tt)*) => { let mut iter = $s.split_whitespace(); let mut next = || { iter.next().unwrap() }; input_inner!{next, $($r)*} }; ($($r:tt)*) => { let stdin = std::io::stdin(); let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock())); let mut next = move || -> String{ bytes.by_ref().map(|r|r.unwrap() as char).skip_while(|c|c.is_whitespace()).take_while(|c|!c.is_whitespace()).collect() }; input_inner!{next, $($r)*} }; }
macro_rules! input_inner { ($next:expr) => {}; ($next:expr, ) => {}; ($next:expr, $var:ident : $t:tt $($r:tt)*) => { let $var = read_value!($next, $t); input_inner!{$next $($r)*} }; ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => { let mut $var = read_value!($next, $t); input_inner!{$next $($r)*} }; }
macro_rules! read_value { ($next:expr, ( $($t:tt),* )) => { ( $(read_value!($next, $t)),* ) }; ($next:expr, [ $t:tt ; $len:expr ]) => { (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>() }; ($next:expr, [ $t:tt ]) => { { let len = read_value!($next, usize); (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>() } }; ($next:expr, chars) => { read_value!($next, String).chars().collect::<Vec<char>>() }; ($next:expr, bytes) => { read_value!($next, String).into_bytes() }; ($next:expr, usize1) => { read_value!($next, usize) - 1 }; ($next:expr, $t:ty) => { $next().parse::<$t>().expect("Parse error") }; }

// Module
use std::cmp::{min,max};
use std::collections::{HashSet,HashMap,BTreeMap,VecDeque,BinaryHeap};

// Functions

// Main
fn main(){
    input!{
        N: usize,
        M: u64,
        A: [u64; N]
    }
    // 優先度付きキューにつめる
    let mut bh = BinaryHeap::new();
    for a in A{
        bh.push(a);
    }
    // 大きい方から2で割っていく
    for _i in 0..M{
        let t = bh.pop().unwrap();
        bh.push(t/2);
    }
    // 答えを集計する
    let ans = bh.into_iter().sum::<u64>();
    println!("{}", ans);
}


Measured memory_bytes: 6396
#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;
    cin >> n;
    vector<string> s(n);
    rep(i,n) cin >> s[i];
    map<string,int> cnt;
    int m_hindo=0;
    
    rep(i,n){
        cnt[s[i]]++;
        m_hindo = max(m_hindo,cnt[s[i]]);
    }
    for(auto a:cnt){
        string d = a.first;
        int v = a.second;
        if(v == m_hindo) cout << d << endl;
    }
    return 0;
}
   

Measured memory_bytes: 26752
//Author rahuliitkgp

/*A thing of beauty is a joy forever,
Its loveliness increases,
it will never pass into nothingness.*/
//Men at Work :)

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef long long int ll;

#define setbits(x)      __builtin_popcountll(x)
#define mod             1000000007
#define ps(x,y)         fixed<<setprecision(y)<<x
#define w(x)            int x; cin>>x; while(x--)
#define INF (int)1e9 + (int)1e8
mt19937_64 mt(chrono::steady_clock::now().time_since_epoch().count());

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

void cpp(){
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
}


ll dp[3000][3000];
ll helper(ll l, ll r, vector<ll>& v, bool turn){
    if(l>r) return 0;
    if(dp[l][r]!=-1) return dp[l][r];
    ll val = 0;
    if(turn){
        val = max(v[l]+helper(l+1, r, v, !turn), v[r]+helper(l, r-1, v, !turn));
    }
    else{
        val = min(helper(l+1, r, v, !turn), helper(l, r-1, v, !turn));
    }
    return dp[l][r] = val;
}

int main(){
    cpp();
    ll n;
    memset(dp, -1, sizeof dp);
    cin>>n;
    vector<ll> v(n);
    ll sum = 0;
    for(ll i=0; i<n; i++){
        cin>>v[i];
        sum+=v[i];
    }
    ll ans = helper(0, v.size()-1, v, 1);
    cout<<2*ans-sum<<endl;
    return 0;
}






Measured memory_bytes: 74144
#include<bits/stdc++.h>
using namespace std;
int n, k;
int dp[100000+10][2], arr[105];
int recur(int a, int b){
    if(a > k)return b;
    if(a == k)return b^1;
    if(dp[a][b] != -1)return dp[a][b];
    dp[a][b] = b^1;
    for(int i = 0; i < n; i++){
        if(recur(a+arr[i], b^1) == b)dp[a][b] = b;
    }
    return dp[a][b];
}
int main()
{
    cin >> n >> k;
    memset(dp, -1, sizeof(dp));
    for(int i = 0; i  < n; i++)cin >> arr[i];
    cout << (recur(0, 0) == 0 ? "First" : "Second");
}

Measured memory_bytes: 8832
import sys

class Node:
    __slots__ = ['key', 'left', 'right']
    def __init__(self, key):
        self.key = key
        self.left = self.right = None

root = None

def insert(key):
    global root
    x, y = root, None
    while x: x, y = x.left if key < x.key else x.right, x
    if y is None: root = Node(key)
    elif key < y.key: y.left = Node(key)
    else: y.right = Node(key)

def find(target):
    result = root
    while result and target != result.key:
        result = result.left if target < result.key else result.right
    return result is None

def delete(target):
    def remove_node(p, c, a):
        if p.left == c: p.left = a
        else: p.right = a
    p, c = None, root
    while c.key != target: p, c = c, c.left if target < c.key else c.right
    if c.left is None:
        remove_node(p, c, c.right)
    elif c.right is None:
        remove_node(p, c, c.left)
    elif c.right.left is None:
        c.right.left = c.left
        remove_node(p, c, c.right)
    else:
        g = c.right
        while g.left.left: g = g.left
        c.key = g.left.key
        g.left = g.left.right

def inorder(node):
    return inorder(node.left) + f' {node.key}' + inorder(node.right) if node else ''
def preorder(node):
    return f' {node.key}' + preorder(node.left) + preorder(node.right) if node else ''

input()
for e in sys.stdin:
    if e[0] == 'i': insert(int(e[7:]))
    elif e[0] == 'd': delete(int(e[7:]))
    elif e[0] == 'f': print(['yes','no'][find(int(e[5:]))])
    else: print(inorder(root)); print(preorder(root))


Measured memory_bytes: 56180
#include <iostream>
#include <math.h>

using namespace std;

int main()
{
	const double rate = 1.05;
	int n;
	
	while (cin >> n) {
		double debt = 100;	// 100kYen
		
		for (int i = 0; i < n; ++i) {
			debt = ceil(debt * rate);
		}
		
		cout << debt << "000" << endl;
	}
	
	return 0;
}

Measured memory_bytes: 1236
#include<cstdio>
using namespace std;
int x,cnt[100020],n,i,ans;
int main()
{
	scanf("%d",&n);
	for (i=1;i<=n;i++)
	{
		scanf("%d",&x);
		cnt[x+1]++;
	}
	ans=0;
	for (i=1;i<=100010;i++)
	{
		int now=cnt[i]+cnt[i-1]+cnt[i+1];
		if (now>=ans) ans=now;
	}
	printf("%d\n",ans);
}

Measured memory_bytes: 512
#include<cmath>
#include<cstdio>

using namespace std;

double area(double a,double b,double c){
	return sqrt((a+b+c)*(b+c-a)*(c+a-b)*(a+b-c))/4;
}

int main(){
	for(int a,l,x;~scanf("%d%d%d",&a,&l,&x);) printf("%.9f\n",area(a,l,l)+2*area(l,(l+x)/2.,(l+x)/2.));
	return 0;
}

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

#define INF 1e9

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

vector<string> s;
int d[60][60];

void dfs(int y,int x,int cost){
    if (s[y][x] == '#') return;
    if (d[y][x] > cost) {
        d[y][x] = cost;
        rep(i,4) dfs(y+dy[i],x+dx[i],cost+1);
    }
}

int main(void){
    int h,w;
    cin>>h>>w;
    s = vector<string>(h+2);
    s[0] = s[h+1] = string(w+2,'#');
    rep(y,h){
        string line;
        cin>>line;
        s[y+1] = "#"+line+"#";
    }
    int dot = 0;
    rep1(y,h)rep1(x,w){
        d[y][x] = INF;
        if(s[y][x] == '.') dot++;
    }
    dfs(1,1,1);
    cout<<(d[h][w] == INF ? -1 :dot-d[h][w])<<endl;
    return 0;
}


Measured memory_bytes: 384
#include <iostream>

using namespace std;
using ll = long long;

int main() {
    string s;
    cin >> s;
    if(s[1] == 'R') {
        if(s[0]=='R' && s[2]=='R') cout << 3;
        else if(s[0]=='R' || s[2]=='R') cout << 2;
        else cout << 1;
    }
    else {
        if(s[0]=='R' || s[2]=='R') cout << 1;
        else cout << 0;
    }
    return 0;
}


Measured memory_bytes: 3624
//written by libra9z
#include <algorithm>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <list>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <cstring>
#include <cmath>
#include <cstdlib>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define rep(i,n) for (int i=0;i<(n);i++)
#define repit(it,a) for (__typeof(a.begin()) it=a.begin();it!=a.end();++it)
#define RET(p,x) return p<<x<<endl,0
#define all(a) (a).begin(),(a).end()
#define reunique(v) v.erase(unique(all(v)),v.end())
#define sz(a) (int)a.size()
#define sqr(x) ((x)*(x))
const int inf=1e9;
const ll lnf=1e18;
const int mod=1e9+7;
const int Maxn=1e5+5;
int n;
int a[Maxn];
int main()
{
	ios_base::sync_with_stdio(0);cin.tie();cout.tie();
	cout<<setprecision(15);
	cin>>n;
	for (int i=0;i<n;++i) cin>>a[i];
	int x=*max_element(a,a+n),y=0,z;
	for (int i=0;i<n;++i)
	{
		if (min(a[i],x-a[i])>y)
		{
			y=min(a[i],x-a[i]);
			z=a[i];
		}
	}
	cout<<x<<' '<<z<<endl;
	return 0;
}

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

int main () {
  string N;
  cin >> N;
  if((N.at(0) == N.at(1) && N.at(1) == N.at(2)) || (N.at(1) == N.at(2) && N.at(2) == N.at(3))){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}



Measured memory_bytes: 256
#include<iostream>
    #include<algorithm>
    #include<cstdio>
    #include<cstdlib>
    #include<string>
    #include<cstring>
    #include<cmath>
    #include<vector>
    #include<set>
    #include<map>
    #include<stack>
    #include<queue>
    #include<time.h>
    #define ll long long
    #define mp make_pair
    #define pb push_back
    #define lson l,mid,pos<<1
    #define rson mid+1,r,pos<<1|1
    using namespace std;

    const int maxn=200000+3;
    //const int maxm=2000+5;
    //const ll mod=1e9 + 7;
    //const int inf=0x3f3f3f3f;
    //const double PI=acos(-1);
    //const double eps=1e-8;
    //int dir[4][2]={0,1,1,0,0,-1,-1,0};
    //const ll INF = 0x3f3f3f3f3f3f3f3fLL;
    //ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
    //ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
    //ll inv(ll b){if(b==1) return 1; return (mod-mod/b)*inv(mod%b)%mod;}
    //ll fpow(ll n,ll k){ll r=1;for(;k;k>>=1){if(k&1)r=r*n%mod;n=n*n%mod;}return r;}

      char s[10];
    int main()
    {
      scanf("%s", s);
      if(strstr(s, "AC")!=NULL)
      {
          cout<<"Yes"<<endl;
      }
      else
        cout<<"No"<<endl;
      return 0;
    }


Measured memory_bytes: 256
import std.algorithm;
import std.array;
import std.ascii;
import std.container;
import std.conv;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.typecons;
void log(A...)(A arg) { stderr.writeln(arg); }
int size(T)(in T s) { return cast(int)s.length; }

void main() {
    int N, M; readf("%d %d\n", &N, &M);
    auto A = new string[N];
    auto B = new string[M];
    foreach (i; 0 .. N) { A[i] = readln.chomp; }
    foreach (i; 0 .. M) { B[i] = readln.chomp; }

    bool check(int sy, int sx) {
        int ty = sy + M;
        int tx = sx + M;
        for (int y = sy; y < ty; y++) {
            for (int x = sx; x < tx; x++) {
                if (A[y][x] != B[y - sy][x - sx]) return false;
            }
        }
        return true;
    }

    int ans = 0;
    for (int sy = 0; sy <= N - M; sy++) {
        for (int sx = 0; sx <= N - M; sx++) {
            if (check(sy, sx)) ans++;
        }
    }
    writeln(ans > 0 ? "Yes" : "No");
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <list>
#include <climits>

using namespace std;

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

     if(N <= 1)
     {
         cout << "0\n";
         return 0;
     }

  	int K = 2;
	vector<int> h(N);
	vector<int> dp(N, INT_MAX);
	dp[0] = 0;

 	for(int i = 0; i < N; ++i)
		cin >> h[i];

	for(int i = 0; i < N; ++i)
	{
		for(int j = i + 1; j <= i + K && j < N; ++j)
		{
			dp[j] = min(dp[j], dp[i] + abs(h[j] - h[i]));
		}
	}

	cout << dp[N - 1] << "\n";

    return 0;
}


Measured memory_bytes: 1024
#pragma GCC optimize ("Ofast")
#pragma GCC target ("avx2")
#include <bits/stdc++.h>
#define deb(x) cerr << #x << ": " << x << '\n';
#define ios ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
using namespace std;
typedef long long ll;
const int INF = 1e9;
ll N,X;
struct Item{
    ll cost,pages;
};
vector<Item>Items;
bool cached[100001][101]; //100000000   = 100 MBytes
ll    memo[100001][101]; //100000000 * 4  = 400 MBytes // Limit = 512 MB

ll Knapsack(ll x, ll idx){
    if(x < 0)  return -INF;
    if(x == 0 || idx == N) return 0;
    if(cached[x][idx])
        return memo[x][idx];
    //Descision 1 entrar en la mochila
    ll res1 = Knapsack(x - Items[idx].cost, idx+1) + Items[idx].pages;
    //Descision 2 dejar fuera de la mochila
    ll res2 = Knapsack(x, idx+1);
    ll res = max(res1,res2);
    cached[x][idx] = true;
    memo[x][idx] = res;
    return res;
    
}


int main(){
    ios;
    cin >> N >> X;
    Items = vector<Item>(N);
    for(ll i = 0; i < N; ++i)
        cin >> Items[i].cost >> Items[i].pages;
    cout << Knapsack(X, 0);
    return 0;
}


Measured memory_bytes: 91932
import Data.Functor ((<$>))

main :: IO ()
main = do
  [a,op,b] <- words <$> getLine
  if op == "?"
    then return ()
    else do
      print $ case op of
        "+" -> read a + read b
        "-" -> read a - read b
        "*" -> read a * read b
        "/" -> read a `div` read b
      main



Measured memory_bytes: 3940
#include <iostream>
#include <vector>
#include <cmath>
#include <map>

using namespace std;

const int TABLE_SIZE = 1e6;
const int MOD = 1e9 + 7;

vector<bool> PrimeTable(TABLE_SIZE + 1, true);

void PrimeTableInit() {
    PrimeTable[0] = false;
    PrimeTable[1] = false;
    for (int i = 2; i < sqrt(TABLE_SIZE) + 1; i++) {
        if (PrimeTable[i]) {
            int j = 2;
            while(i * j <= TABLE_SIZE) {
                PrimeTable[i * j] = false;
                j++;
            }}}}

long long modpow(long long a, long long n) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return res;
}

long long modinv(long long a) {
    return modpow(a, MOD - 2);
}


int main() {
    PrimeTableInit();
    int N; cin >> N;
    vector<int> A(N);
    map<int, int> lcm;
    for (int i = 0; i < N; i++) cin >> A[i];
    for (int i = 0; i < N; i++) {
        if (PrimeTable[A[i]]) {
            lcm[A[i]] = max(lcm[A[i]], 1);
        } else {
            map<int, int> primefact;
            int n = A[i];
            int i = 2;
            while (n != 1) {
                if (n % i == 0) {
                    n /= i;
                    primefact[i]++;
                } else {
                    i++;
                }
            }
            for (auto x: primefact) {
                lcm[x.first] = max(lcm[x.first], x.second);
            }
        }
    }
    long long l = 1;
    for (auto x: lcm) {
        for (int i = 0; i < x.second; i++) {
            l = (l * x.first) % MOD;
        }
    }
    long long ans = 0;
    for (int i = 0; i < N; i++) {
        ans += (l * modinv(A[i]) % MOD);
    }
    cout << ans % MOD << endl;
}

Measured memory_bytes: 896
#include <bits/stdc++.h>
#include <stdlib.h>
using namespace std;
typedef long long ll;

int main() {
  string s;
  cin>>s;
  if(s.size()%2!=0){
    cout<<"No"<<endl;
    return 0;
  }
  bool ans=true;
  for(int i=0;i<s.size();){
    if(s[i]=='h' && s[i+1]=='i') {
      i+=2;
      continue;
    }
    else{
      ans=false;
      break;
    }
  }
  if(ans) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <boost/optional.hpp>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <functional>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#define REP(i, n) for(int i = 0, i##_MACRO = (n); i < i##_MACRO; i++)
#define RANGE(i, a, b) for(int i = (a), i##_MACRO = (b); i < i##_MACRO; i++)
#define EACH(e, a) for(auto&& e : a)
#define ALL(a) std::begin(a), std::end(a)
#define RALL(a) std::rbegin(a), std::rend(a)
#define FILL(a, n) memset((a), n, sizeof(a))
#define FILLZ(a) FILL(a, 0)
#define INT(x) (static_cast<int>(x))

using namespace std;

using ll = long long;
using VI = vector<int>;
using VI2D = vector<vector<int>>;

constexpr int INF = 2e9;
constexpr double EPS = 1e-10;
constexpr double PI = acos(-1.0);

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

template <typename T>
constexpr int sign(T x) {
	return x < 0 ? -1 : x > 0 ? 1 : 0;
}

template <>
constexpr int sign(double x) {
	return x < -EPS ? -1 : x > EPS ? 1 : 0;
}

template <typename T, typename U>
constexpr void chmax(T& m, U x) {
	m = max(m, x);
}

template <typename T, typename U>
constexpr void chmin(T& m, U x) {
	m = min(m, x);
}

template <typename T>
constexpr T square(T x) {
	return x * x;
}

struct interval {
	int n;
	int a;
	int b;
	interval() {}
	interval(int n, int a, int b) : n(n), a(a), b(b) {}
};

int main() {
	int n;
	cin >> n;
	VI a(n);
	VI b(n);
	REP(i, n) { cin >> a[i] >> b[i]; }

	sort(ALL(a));
	sort(ALL(b));
	int result;
	if(n % 2) {
		result = b[n / 2] - a[n / 2] + 1;
	} else {
		result = (b[n / 2] + b[(n - 1) / 2]) - (a[n / 2] + a[(n - 1) / 2]) + 1;
	}

	cout << result << endl;

	return 0;
}


Measured memory_bytes: 4844
from collections import defaultdict
N, M = map(int, input().split())

d = defaultdict(list)
for _ in range(M):
    a, b = map(int, input().split())
    d[a].append(b)
    d[b].append(a)


def dfs(n, path):
    count = 0
    path.append(n)
    if len(path) == N:
        count += 1
        return count
    for i in d[n]:
        if i not in path:
            count += dfs(i, path)
            path.pop()

    return count


print(dfs(1, []))


Measured memory_bytes: 9368
#include<iostream>
#include<string>
using namespace std;
int main(){
	string S;
  
  cin>>S;
  int count=0;
  for(int i=0;i<S.size();i++){
  	if(S[i]=='o'){
    	count++;
    }
  }
  
  if((15-S.size()+count)>=8){
  	cout<<"YES";
  }else{
  	cout<<"NO";
  }
  return 0;
}

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

long long int N, K;
long long int x[100010], y[100010], col[100010];

const long long int MAXK = 2005;
long long int black[MAXK + 5][MAXK + 5], white[MAXK + 5][MAXK + 5];

long long int getSum(long long int arr[][MAXK + 5], int sx, int sy, int gx, int gy) {
    long long int ret = 0; // gx++; gy++;
    ret += arr[sx][sy];
    ret += arr[gx][gy];

    ret -= arr[sx][gy];
    ret -= arr[gx][sy];
    return ret;
}

int main() {
    cin >> N >> K;
    for(int i=0; i<N; i++) {
        char c;
        cin >> x[i] >> y[i] >> c;
        x[i] %= (2*K);
        y[i] %= (2*K);
        col[i] = (c == 'W' ? 1 : 0);

        if(col[i]) white[ x[i]+1 ][ y[i]+1 ]++;
        else       black[ x[i]+1 ][ y[i]+1 ]++;
    }

    for(int i=0; i<MAXK; i++) {
        for(int j=0; j<MAXK; j++) {
            white[i][j+1] += white[i][j];
            black[i][j+1] += black[i][j];
            // fprintf(stderr, "i = %d, j = %d\n", i, j);
        }
    }
    for(int j=0; j<MAXK; j++) {
        for(int i=0; i<MAXK; i++) {
            white[i+1][j] += white[i][j];
            black[i+1][j] += black[i][j];
        }
    }

    // 黒四角の左上を固定
    long long int ans = 0;
    for(int i=0; i<=K; i++) {
        for(int j=0; j<=K; j++) {
            long long int sum1 = 0;
            sum1 += getSum(black, 0  , 0  , i  , j  );
            sum1 += getSum(black, i+K, 0  , 2*K, j  );
            sum1 += getSum(black, i  , j  , i+K, j+K);
            sum1 += getSum(black, 0  , j+K, i  , 2*K);
            sum1 += getSum(black, i+K, j+K, 2*K, 2*K);

            sum1 += getSum(white, 0  , j  , i  , j+K);
            sum1 += getSum(white, i  , 0  , i+K, j  );
            sum1 += getSum(white, i+K, j  , 2*K, j+K);
            sum1 += getSum(white, i  , j+K, i+K, 2*K);

            long long int sum2 = 0;
            sum2 += getSum(white, 0  , 0  , i  , j  );
            sum2 += getSum(white, i+K, 0  , 2*K, j  );
            sum2 += getSum(white, i  , j  , i+K, j+K);
            sum2 += getSum(white, 0  , j+K, i  , 2*K);
            sum2 += getSum(white, i+K, j+K, 2*K, 2*K);

            sum2 += getSum(black, 0  , j  , i  , j+K);
            sum2 += getSum(black, i  , 0  , i+K, j  );
            sum2 += getSum(black, i+K, j  , 2*K, j+K);
            sum2 += getSum(black, i  , j+K, i+K, 2*K);
            ans = max({ans, sum1, sum2});
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 65792
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main()
{
    int n,a,b,c,d,x,y,sum,z;
    while(~scanf("%d %d %d %d",&a,&b,&c,&d))
    {
        z=9999;
        y=9999;
        if(z>a)
        {
            z=a;
        }
        if(z>b)
        {
            z=b;
        }
        if(y>c)
        {
            y=c;
        }
        if(y>d)
        {
            y=d;
        }
        printf("%d\n",z+y);

    }
    return 0;
}

Measured memory_bytes: 128
# coding: utf-8
# Your code here!
L = ['A','C','G','T']
S = input()
N = len(S)
cnt = -1
cnt1 = 0
for i in range(N):
    if S[i] in L:
        cnt1 += 1
    else:
        cnt = max(cnt,cnt1)
        cnt1 = 0

ans = max(cnt,cnt1)

print(ans)

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

#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4")

#define ll long long
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define o cout<<"BUG"<<endl;
#define	IOS ios_base::sync_with_stdio(0);
#define en "\n"
#define FOR(i, j, n) for(int j = i; j < n; ++j)
#define forn(i, j, n) for(int j = i; j <= n; ++j)
#define nfor(i, j, n) for(int j = n; j >= i; --j)
#define sortv(vv) sort(vv.begin(), vv.end())
#define all(v) v.begin(), v.end()
#define ld long double
#define ull unsigned long long
#define pii pair <int, int>


using namespace std;
const ll maxn=5e5+100,inf=1e18,LOG=23,mod=1e9 + 7;
int block = 300, timer = 0;
const ld EPS = 1e-7;

#define bt(i) (1 << (i))
//#define int ll

string s, t;
int ans;

main()
{
	cin >> s >> t;
	if(s[0] == t[0])ans++;
	if(s[1] == t[1])ans++;
	if(s[2] == t[2])ans++;
	cout << ans;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define int long long
#define ld long double
#define fi first
#define se second
#define all(uiet) uiet.begin(),uiet.end()
#define read(UIET) for(int i = 0; i < n; ++i) cin >> UIET[i]
#define out(UIET) for(int i = 0; i < n; ++i) cout << UIET[i] << " "
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define vpp vector<pair< int, int > >
#define pll pair<int , int >
#define ppll pair < pll , pll >
#define debug(n1) cout << n1 << endl
#define len(a) ((int) (a).size())
#define endl "\n"
#define mod 1000000007
const int INF=(1LL<<60)-1;
bool isPerfectSquare(long double x) {   
    long double sr = sqrt(x); 
    return ((sr - floor(sr)) == 0); 
} 
bool isPrime(int x){
    for(int i = 2; i * i <= x; ++i){
        if(x % i == 0) return 0;
    }
    return 1;
}
int fun(int n){
    if(n & 1) return 3 * n + 1;
    else return n/2;
}
int sumDig(int n){
    int cnt = 0;
    while(n > 0){
        cnt += n % 10;
        n /= 10;
    }
    return cnt;
}
int32_t main(){
    SPEED;
    int n, a, b;
    cin >> n >> a >> b;
    int ans = 0;
    for(int i = 1; i <= n; ++i){
        if(sumDig(i) >= a && sumDig(i) <= b) ans += i;
    }
    cout << ans ;
}

Measured memory_bytes: 3536
Class Main
    Public Shared Sub Main()
    Dim NM() As string = Split(Console.ReadLine())
    dim A as long = Long.Parse(NM(0))
    dim B as long = clng(NM(1))
    dim C as long = clng(NM(2))
    dim K as long = clng(NM(3))
    dim i1,i2 as long
    if K > A then
      i1 = A
      i2 = K - A
      if i2 > B then
        i2 = i2 - B
        i1 = i1 - i2
      end if  
    else
      i1 = K
    end if  
      Console.WriteLine(i1)
   End Sub
End Class

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

#define rep(i,n) for(int i=0; i<(n); ++i)
#define rrep(i,n) for(int i=1; i<=(n); ++i)
#define drep(i,n) for(int i=(n)-1; i>=0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define fi first
#define se second
#define v(T) vector<T>
#define imposs {cout<<"-1\n";return 0;}
#define LL_MAX LLONG_MAX
#define LL_MIN LLONG_MIN

typedef unsigned int uint;
typedef long long int ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int,int> pii;
typedef vector<pii> vpii;
typedef set<int> si;
typedef multiset<int> msi;
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}

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

  int N;
  cin >> N;
  set<string> ss;
  multiset<string> mss;
  rep(i,N) {
    string s;
    cin >> s;
    ss.insert(s);
    mss.insert(s);
  }
  int ma = 0;
  for(auto v : ss) {
    ma = max(ma, (int)mss.count(v));
  }
  for (auto v : ss) {
    if (ma == (int)mss.count(v)) {
      cout << v << "\n";
    }
  }
  return 0;
}


Measured memory_bytes: 30080
#include <bits/stdc++.h>
#define maxN 100002
using namespace std;

int n, v[maxN];

int ans = 1;

int main()
{
    scanf("%d", &n);
    int sign = 0;
    scanf("%d", &v[1]);
    for (int i = 2; i <= n; ++ i)
    {
        scanf("%d", &v[i]);
        if (i != 1 && v[i] == v[i - 1])
            continue;
        if (!sign)
        {
            sign = 1;
            if (v[i] < v[i - 1])
                sign = -1;
        }
        if ((sign == 1 && v[i] < v[i - 1]) || (sign == -1 && v[i] > v[i - 1]))
        {
            sign = 0;
            ++ ans;
        }

    }
    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <list>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <tuple>

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i <= (n); i++)
#define show(a, n) rep(i,n) {cout<<a[i]<<' ';} cout<<endl;

using namespace std;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef long long ll;
typedef pair<long long, long long> pll;

const int INF = 1 << 30;
const long long INFL = 1LL << 62;
const int MOD = 1000000007;
const int MAX = 100000;
const int N = 100010;

struct mint {
    ll x;
    mint(ll x=0):x((x%MOD+MOD)%MOD){}
    mint operator-() const { return mint(-x);}
    mint& operator+=(const mint a) {if ((x+=a.x)>=MOD) x-=MOD; return *this;}
    mint& operator-=(const mint a) {if ((x+=MOD-a.x)>=MOD) x-=MOD; return *this;}
    mint& operator*=(const mint a) {(x*=a.x)%=MOD; return *this;}
    mint operator+(const mint a) const {mint res(*this); return res+=a;}
    mint operator-(const mint a) const {mint res(*this); return res-=a;}
    mint operator*(const mint a) const {mint res(*this); return res*=a;}
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const { return pow(MOD-2);}
    mint& operator/=(const mint a) { return (*this) *= a.inv();}
    mint operator/(const mint a) const {mint res(*this); return res/=a;}
};

const int cmax = 400010;
mint fac[cmax],finv[cmax],inv[cmax];

void com_init() {
    fac[0]=fac[1]=1;
    finv[0]=finv[1]=1;
    inv[1]=1;
    for (int i=2; i<cmax; i++) {
        fac[i]=fac[i-1]*i;
        inv[i]=-inv[MOD%i]*(MOD/i);
        finv[i]=finv[i-1]*inv[i];
    }
}

ll com(int n, int k) {
    if (n<k) return 0;
    if (n<0||k<0) return 0;
    mint ret=fac[n]*finv[k]*finv[n-k];
    return ret.x;
}

int main() {
	ll n, k;
	cin >> n >> k;
	com_init();
	mint ans = com(2*n-1, n);
	for(ll i = k+1; i <= n-1; i++) {
		ans -= com(n, i) * com(n-1, i);
	}
	cout << ans.x << endl;
}


Measured memory_bytes: 9600
/// Code By t_bone_289 (Tushar Singh)
/// An Immature Programmer.... I'm still developing !!
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/trie_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define pll pair<ll,ll>
#define fi first
#define se second
#define mp make_pair
#define pb emplace_back
#define endl '\n'
#define M 1000000007
#define error(x) cout << #x << " = " << x << endl;
#define pi 3.14159265358979323846
typedef long long ll;
typedef double d;
typedef long double ld;
template <typename T>
void ContainerError(T &v){cout<<"{";for(auto &x:v){cout<<x<<',';}cout<<"}"<<endl;return;}
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
ll powmod(ll base,ll exp,ll MOD){ll res=1;while(exp>0){if(exp%2==1) res=(res*base)%MOD;base=(base*base)%MOD;exp/=2;}return (res%MOD);}
ll mpow(ll base,ll exp){ll res=1;while(exp>0){if(exp%2==1) res=(res*base);base=(base*base);exp/=2;}return (res);}
ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}

//dfs(i,G,dp,vis);

void dfs(ll ver,vector<vector<ll> > &G,vector<ll> &dp,vector<ll> &vis)
{
    if(vis[ver])
    {
        return;
    }
    vis[ver]=1;
    for(ll j=0;j<G[ver].size();j++)
    {
        ll v = G[ver][j];
        dfs(v,G,dp,vis);
        dp[ver] = max(dp[v]+1,dp[ver]);
    }
    return;
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll n,m;
    cin>>n>>m;
    vector<vector<ll> > G(n);
    for(ll i=0;i<m;i++)
    {
        ll a,b;
        cin>>a>>b;
        a--;
        b--;
        G[a].pb(b);
    }
    vector<ll> dp(n,0);
    vector<ll> vis(n,0);
    for(ll i=0;i<n;i++)
    {
        dfs(i,G,dp,vis);
    }
    ll ans=dp[0];
    for(auto x:dp)
    {
        ans=max(ans,x);
    }
    cout<<ans;
    return 0;
}




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

int main() {
	int n;
	cin >> n;
	queue<int> q;

	for (int i = n, k; i--;) {
		cin >> k >> k;
		for (int j = 0, v; j < k; j++) {
			cin >> v;
			q.push(v);
		}

		for (int j = 1; j <= n; j++) {
			cout << (j == 1 ? "" : " ");
			if (k && q.front() == j) {
				cout << 1; 
				q.pop();
			} else
				cout << 0;
		}
		cout << endl;
	}
}


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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define all(x) (x).begin(),(x).end()
#define foreach(u,v) for(auto (u) : (v))
#define pb push_back
#define mp make_pair
#define mt make_tuple

#define int long long 

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<ll, ll> pll;
typedef vector<ll> vl;

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

/*
*/

int f(int b, int n)
{
  if(n < b) return n;
  return f(b, n/b) + (n%b);
}

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

  if(n < s){
    cout << -1 << endl;
    return 0;
  }
  
  if(n == s){
    cout << n+1 << endl;
    return 0;
  }

  for(int i = 2; i*i <= n; i++){
    if(f(i, n) == s){
      cout << i << endl;
      return 0;
    }
  }

  int ans = linf;
  for(int i = 1; i*i <= n; i++){
    int b = (n-s)/i+1;
    if(b < 2) continue;
    if(f(b, n) == s) ans = min(ans, b);
  }

  if(ans == linf) cout << -1 << endl;
  else cout << ans << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <map>
#include <iterator>

using namespace std;

int N;
std::map<int, int> factors;

void getFactors(int num)
{
	
	while (num % 2 == 0)
	{
		num = num / 2;
		factors[2]++;
	}
	
	int d = 3;
	while (d * d <= num)
	{
		while (num % d == 0)
		{
			num = num / d;
			factors[d]++;
		}
		d = d + 2;
	}
	
	if (num > 1)
		factors[num]++;
}

int num74, num24, num14, num4, num2;

int main()
{
	scanf("%d", &N);
	
	for (int i = 2 ; i <= N ; i++)
		getFactors(i);
	
	num74 = 0;
	num24 = 0;
	num14 = 0;
	num4 = 0;
	num2 = 0;
		
	std::map<int, int>::iterator iFactor;
	for (iFactor = factors.begin() ; 
		 iFactor != factors.end() ; 
		 iFactor++)
	{
		if (iFactor->second >= 2) num2++;
		if (iFactor->second >= 4) num4++;
		if (iFactor->second >= 14) num14++;
		if (iFactor->second >= 24) num24++;
		if (iFactor->second >= 74) num74++;
	}
	
//	printf("%d %d %d %d %d\n", num2, num4, num14, num24, num74);
	
	int ans = 0;
	//75, 74 only
	ans = ans + num74;
	//25*3, 24, 4
	ans = ans + num24 * (num2 - 1);
	//15*5, 14, 4
	ans = ans + num14 * (num4 - 1);
	//5*5*3, 4,4,2
	ans = ans + (num4) * (num4 - 1) / 2 * (num2 - 2);
	
	printf("%d\n", ans);
		
	return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Globalization;
using System.Diagnostics;
using static System.Console;
using Pair = System.Collections.Generic.KeyValuePair<int, int>;
//using System.Numerics;
 
class Program
{
    static void Main()
    {
        SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
        new Program().solve();
        Out.Flush();
    }
    Scanner cin = new Scanner();
    Random rnd = new Random();
    Stopwatch sw = new Stopwatch();
    readonly int[] dd = { 0, 1, 0, -1, 0 };
    readonly int mod = 1000000007;
    readonly string alfa = "abcdefghijklmnopqrstuvwxyz";
    readonly string ALFA = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
 
    int N;
    void solve()
    {
        var S = cin.next;
        var K = S.ToCharArray();
        Array.Reverse(K);
        
        if (S == new string(K))
        {
            WriteLine("Yes");
        }
        else
        {
            WriteLine("No");
        }
    }
}
 
class Scanner
{
    string[] s; int i;
    char[] cs = new char[] { ' ' };
    public Scanner() { s = new string[0]; i = 0; }
    public string[] scan { get { return ReadLine().Split(); } }
    public int[] scanint { get { return Array.ConvertAll(scan, int.Parse); } }
    public long[] scanlong { get { return Array.ConvertAll(scan, long.Parse); } }
    public double[] scandouble { get { return Array.ConvertAll(scan, double.Parse); } }
    public string next
    {
        get
        {
            if (i < s.Length) return s[i++];
            string st = ReadLine();
            while (st == "") st = ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            i = 0;
            return next;
        }
    }
    public int nextint { get { return int.Parse(next); } }
    public long nextlong { get { return long.Parse(next); } }
    public double nextdouble { get { return double.Parse(next); } }
}

Measured memory_bytes: 11216
#include <cstring>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <unordered_set>
#include <functional>
 
using namespace std;
 
int main() {
int a,b;
    cin>>a>>b;
    int p=ceil(a/0.08);
    int q=ceil(b/0.1);
    int price=max(p,q);
    if (((int)(price*0.08)!=a)||((int)(price*0.1)!=b)){
    cout<<"-1";
    }else
    cout<<price;
}

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

int main() {
	
 int N;
 int t;
 int c;
 int sum=0;
 int count=1;
 cin>>N;
 cin>>t;
 while(N-->0){
 	
 cin>>c;
 sum=sum+c;
 if(sum<=t){
 	
 	count=count+1;
 }
 }
 cout<<count<<endl;
 return 0;
 }

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    string ans = "Yes";
  	string s, t;
  	map<char, char> s2t, t2s;
	cin >> s >> t;
    for(int i = 0; i < s.size(); i++){
      if(s2t.count(s[i]) > 0 && s2t[s[i]] != t[i]){
        ans = "No";
      } else if(t2s.count(t[i]) > 0 && t2s[t[i]] != s[i]){
        ans = "No";
      }else{
        s2t[s[i]] = t[i];
        t2s[t[i]] = s[i];
      }
    }
  	cout << ans << endl;
  
}

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

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

int main(){
  string s; cin >> s;
  int n = s.size();
  int cnt = 0;
  for(int i=0; i<n; i++) if(s[i] == 'o') cnt++;
  for(int i=n; i<15; i++) cnt++;
  if(cnt >= 8) cout << "YES" << endl;
  else cout << "NO" << endl;
  return 0;
}


Measured memory_bytes: 256
N, M = map(int, input().split())
p = []
S = []
flag = [0 for i in range(N)]
wa_cnt_list = [0 for i in range(N)]
ac_cnt = 0
wa_cnt = 0
#print(flag)

for i in range(M):
    pi, Si = input().split()
    p.append(int(pi))
    S.append(Si)
    

# print(p)
# print(S)

for i in range(M):
    # print("now",i)
    if(flag[p[i]-1]==1):
        # print("CONTINUE",p[i])
        continue
    else:
        if(S[i]=='WA'):
            wa_cnt_list[p[i]-1] += 1
            # print("WA No.",p[i],":cnt=",wa_cnt_list[p[i]-1])
        else:
            flag[p[i]-1] = 1
            ac_cnt += 1
            wa_cnt += wa_cnt_list[p[i]-1]

# print(sum(wa_cnt))
# print(ac_cnt)
#print(flag)

print(ac_cnt, wa_cnt)

Measured memory_bytes: 61232
#include <iostream>
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <cmath>
using namespace std;

const long long maxn=2005;
typedef long long ll;

int n;
struct Node
{
	ll v;
	ll id;
}a[maxn];

bool cmp(Node x, Node y)
{
	return x.v>y.v;
}

ll f[maxn],g[maxn];

int main()
{
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i].v;
		a[i].id=i;
	}
	sort(a+1,a+n+1,cmp);
	g[0]=a[1].v*(n-a[1].id);
	g[1]=a[1].v*(a[1].id-1);
//	cout<<"f "<<1<<' '<<0<<' '<<g[0]<<endl;
//	cout<<"f "<<1<<' '<<1<<' '<<g[1]<<endl;
	for(int i=2;i<=n;i++)
	{
		for(int j=1;j<=i;j++)
			f[j]=g[j-1]+a[i].v*abs(a[i].id-j);
		for(int j=0;j<i;j++)
			f[j]=max(f[j],g[j]+a[i].v*abs(a[i].id-(n-(i-j)+1)));
		for(int j=0;j<=i;j++)
		{
		//	cout<<"f "<<i<<' '<<j<<' '<<f[j]<<endl;
			g[j]=f[j];
			f[j]=0;
		}
	}
	ll ans=0;
	for(int i=0;i<=n;i++)
		ans=max(ans,g[i]);
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3700
//#include <bits/stdc++.h>
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <climits>
#include <iomanip>
#include <stack>
#include <bitset>

#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define ROF(i, j, k) for(int i = (int)(j); i >= (int)(k); --i)
#define FORLL(i, n, m) for(long long i = n; i < (long long)(m); i++)
#define SORT(v, n) sort(v, v+n)
#define REVERSE(v) reverse((v).begin(), (v).end())

using namespace std;
using ll = long long;
const ll MOD=1000000007LL;
typedef pair<int, int> P;

ll ADD(ll x, ll y) { return (x+y) % MOD; }
ll SUB(ll x, ll y) { return (x-y+MOD) % MOD; }
ll MUL(ll x, ll y) { return x*y % MOD; }
ll POW(ll x, ll e) { ll v=1; for(; e; x=MUL(x,x), e>>=1) if (e&1) v = MUL(v,x); return v; }
ll DIV(ll x, ll y) { /*assert(y%MOD!=0);*/ return MUL(x, POW(y, MOD-2)); }

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

ll n,q;
string s;
//ll l[100100],r[100100];

ll num[100100];

int
main(void){  
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> q;
  cin >> s;

  bool A = false;
  REP(i, n){
    if(s[i] == 'A') {
      A = true;
      continue;
    }
    if(A && ((s[i] == 'T') || s[i] == 'G')){
      A = false;
    }
    if(s[i] == 'C' && A) {
      num[i]++;
      A = false;
    }
  }
  REP(i, n-1){
    num[i+1] = num[i+1] + num[i];
  }

  REP(i,q){
    ll l, r;
    cin >> l >> r;
    l--; r--;
    //FOR(j, l, r+1) cerr << s[j];
    //cout << endl;
    cout << max(0LL, num[r] - num[l]) << endl;
  }
  
  //REP(i, n) cerr << num[i] << " ";
  //cout << endl;
  
  
  return 0;
}


Measured memory_bytes: 1872