akhauriyash/Code-Regression huggingface dataset:
N, X = map(int, input().split())
x = list(map(int, input().split()))


def gcd(a, b):
    if a < b:
        a, b = b, a
    while a % b != 0:
        a, b = b, a % b
    return b


y = [abs(X - x[0])]
for i in range(len(x) - 1):
    y.append(abs(x[i + 1] - x[i]))

ans = y[0]
for i in range(1, len(y)):
    ans = gcd(ans, y[i])
print(ans)

Measured memory_bytes: 14252
def f v, list, num, n
	ans = 0
	jd = true
	list.each do |ll|
		if ll == 0
			jd = false 
			break
		end
	end
	if jd 
		return 1 
	end
	n.times do |i|
		next if i == num 
		next if list[i] == 1
		if v[num][i] == 1 
			list[i] = 1 
			ans +=	f v,list, i, n
			list[i] = 0
		end
	end
	return ans
end


N,M = gets.split.map(&:to_i)

v = Array.new(N){Array.new(N){0}}

M.times do
	a = gets.split.map(&:to_i)
	v[a[0] - 1][a[1] - 1] = 1
	v[a[1] - 1][a[0] - 1] = 1
end
list = Array.new(N){0}
list[0] = 1

ans = f v, list, 0, N

puts ans

Measured memory_bytes: 1788
/**
 *    author: gxfireball       
**/
#include <bits/stdc++.h>
#define ll long long
#define endl '\n'
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); 
using namespace std;

void solve(){
   ll n,m;
   cin >> n >> m;
   ll H[n];
   vector<ll> ans(n,0);
   for(ll i=0; i<n; ++i) cin >> H[i];
   for(ll i=0; i<m; ++i){
	   ll a,b;
	   cin >> a >> b;
	   a--;b--;
	   ans[a] = max(H[b],ans[a]);
	   ans[b] = max(H[a],ans[b]);
   }
   ll cnt=0;
   for(ll i=0; i<n; ++i){
	   if(H[i] > ans[i]) cnt++;
   }
   cout << cnt;
   
}

int main(){
    fastio;
    int t;
    t = 1;
    //cin>>t;
    while(t--){
    	solve();
    }
    return 0;
}



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

int main() {
  int N, K;
  cin >> N >> K;
  vector<int> h(N);
  for(int i=0;i<N;i++){
    cin >> h.at(i);
  }
  int count = 0;
  for(int i=0;i<N;i++){
    if(h.at(i) >= K){
      count++;
    }
  }
  
  cout << count << endl;

}


Measured memory_bytes: 640
import java.util.Scanner;


public class Main {
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		while(stdIn.hasNext()){
			double weight = stdIn.nextDouble();
			if(weight <= 48.00){
				System.out.println("light fly");
			}else if(48 < weight & weight <= 51){
				System.out.println("fly");
			}else if(51 < weight & weight <= 54){
				System.out.println("bantam");
			}else if(54 < weight & weight <= 57){
				System.out.println("feather");
			}else if(57 < weight & weight <= 60){
				System.out.println("light");
			}else if(60 < weight & weight <= 64){
				System.out.println("light welter");
			}else if(64 < weight & weight <= 69){
				System.out.println("welter");
			}else if(69 < weight & weight <= 75){
				System.out.println("light middle");
			}else if(75 < weight & weight <= 81){
				System.out.println("middle");
			}else if(81 < weight & weight <= 91){
				System.out.println("light heavy");
			}else if(91 < weight){
				System.out.println("heavy");
			}
		}
	}
}

Measured memory_bytes: 12000
#include<bits/stdc++.h>
#define ll long long int
#define pb(x) push_back(x)
using namespace std;
vector<ll> arr[200005];
ll vis[200005],dep[200005],ans[200005];
void bfs(ll src)
{
    queue<ll> q;
    q.push(src);
    dep[src]=0;
    vis[src]=1;
    while(!q.empty())
    {
        ll node=q.front();
        q.pop();
        for(ll child : arr[node])
        {
            if(vis[child]==0)
            {
                ans[child]=node;
                vis[child]=1;
                dep[child]=dep[node]=1;
                q.push(child);
            }
        }
    }
}
void dfs(ll node)
{
    vis[node]=1;
    for(ll child: arr[node])
    {
        if(vis[child]==0)
        dfs(child);
    }
}
int main()
{
    ll n,m;
    cin>>n>>m;
    for(ll i=0;i<n;i++)
    {
        ans[i]=INT_MAX;
    }
    for(ll i=0;i<m;i++)
    {
        ll x,y;
        cin>>x>>y;
        x--,y--;
        arr[x].pb(y);
        arr[y].pb(x);
    }
    // ll c=0;
    // for(ll i=0;i<n;i++)
    // {
    //     if(vis[i]==0)
    //     {
    //         dfs(i);
    //         c++;
    //     }
    // }
    // if(c>1)
    // {
    //     cout<<"No"<<endl;
    //     return 0;
    // }
    // else
    // {
    //     cout<<"Yes"<<endl;
    // }
    // for(ll i=0;i<n;i++)
    // {
    //     vis[i]=0;
    // }
    bfs(0);
    bool flag=true;
    for(ll i=0;i<n;i++)
    {
        if(vis[i]==0)
        {
            flag=false;
            break;
        }
    }
    if(!flag)
    {
        cout<<"No"<<endl;
        return 0;
    }
    else
    {
        cout<<"Yes"<<endl;
    }
    

    for(ll i=1;i<n;i++)
    {
        cout<<ans[i]+1<<" "; 
    }
    cout<<endl;
    return 0;
}

Measured memory_bytes: 16820
package main

import "fmt"

func main() {
	var n int
	var s string
	fmt.Scan(&n, &s)

	s += "#"
	ct := 0
	for i := 1; i < len(s); i++ {
		if s[i-1] != s[i] {
			ct++
		}
	}
	fmt.Println(ct)
}


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

using namespace std;

int D, T, S;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	
	cin >> D >> T >> S;
	
	if (T * S >= D) cout << "Yes\n";
	else cout << "No\n";
	
	return 0;
}


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

const int N = 2e6 + 20, mod = 1e9 + 7;
int n, k, fact[N], factRev[N], ans;
string s;

int sum(int a, int b) {
        return ((1LL * a + b) % mod + mod) % mod;
}

int mul(int a, int b) {
        return ((1LL * a * b) % mod + mod) % mod;
}

int pw(int a, int b) { 
        int res = 1, tmp = a;
        while (b) {
                if (b & 1)
                        res = mul(res, tmp);
                tmp = mul(tmp, tmp);
                b >>= 1;
        }
        return res;
}

int c(int a, int b) {
        return mul(fact[a], mul(factRev[a - b], factRev[b]));
}

void prepros() {
        fact[0] = 1;
        for (int i = 1; i < N; i++)
                fact[i] = mul(fact[i - 1], i);
        factRev[N - 1] = pw(fact[N - 1], mod - 2);
        for (int i = N - 2; ~i; i--)
                factRev[i] = mul(factRev[i + 1], i + 1);
}

int main() {
        ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
        cin >> k >> s;
        n = s.size();
        prepros();
        for (int i = 0; i <= k; i++)
                ans = sum(ans, mul(c(n + i - 1, n - 1), mul(pw(26, k - i), pw(25, i))));
        return cout << ans << "\n", 0;
}

Measured memory_bytes: 19824
#include <bits/stdc++.h>
#define int long long
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define rep(i,a,n) for(int i=a;i<n;i++)
#define repr(i,a,n) for(int i=a;i>n;i--)
#define leng(n) (int)(log10(n)+1)
#define INF 9000000000000000000
using namespace std;

int gcd(int a,int b){return b?gcd(b,a%b):a;}  //  最大公約数gcd
int lcm(int a,int b){return a/gcd(a,b)*b;}  //  最小公倍数lcm

signed main() {
  int n;
  cin >> n;
  
  int ans = 1;
  rep(i,0,n){
    ans *= (i+1);
    ans %= 998244353;
  }
  
  char p;
  vector<int> c(3);
  rep(i,0,3*n){
    cin >> p;
    if (p == 'R'){
      if(c[0]>=c[1] && c[0]>=c[2]) c[0]++;
      else if (min(c[1],c[2])==0) {
        ans *= (max(c[1],c[2]) - c[0]);
        c[0]++;
      }
      else {
        ans *= min(c[1],c[2]);
        c[1]--;
        c[2]--;
      }
    }
    if (p == 'G'){
      if(c[1]>=c[0] && c[1]>=c[2]) c[1]++;
      else if (min(c[0],c[2])==0) {
        ans *= (max(c[0],c[2]) - c[1]);
        c[1]++;
      }
      else {
        ans *= min(c[0],c[2]);
        c[0]--;
        c[2]--;
      }
    }
    if (p == 'B'){
      if(c[2]>=c[0] && c[2]>=c[1]) c[2]++;
      else if (min(c[0],c[1])==0) {
        ans *= (max(c[0],c[1]) - c[2]);
        c[2]++;
      }
      else {
        ans *= min(c[0],c[1]);
        c[0]--;
        c[1]--;
      }
    }
    ans %= 998244353;
  }
  
  cout << ans << endl;
}


Measured memory_bytes: 256
import itertools
import numpy as np

def calc(n, a, b):
    if a > b:
        return 0
    elif a == b:
        return 1
    elif n == 1:
        return 0

    return (b - a) * (n - 2) + 1

N, A, B = map(int, input().split())


print(calc(N, A, B))

Measured memory_bytes: 12504
#include <iostream>
#include <queue>
#include <map>
#include <set>
 
using namespace std;
 
int len;
string str;
 
bool check(string s){
  char ch = s[0];
 
  for(int i = 1 ; i < len ; i++){
    if(ch != s[i]) return false;
  }
  return true;
}
 
int bfs(){
  string ans;
  queue<string> Q;
  Q.push(str);
 
  bool found = false;
  set<string> used;
  used.insert(str);
  map<string,int> dist;
  dist[str] = 0;
 
  while(!Q.empty()){
    string s = Q.front(); Q.pop();
     
    if(check(s)){
      found = true;
      ans = s;
      break;
    }
 
    for(int i = 1 ; i < len ; i++){
      string next = s;
      if(s[i-1] == 'b' && s[i] == 'r' ||
     s[i-1] == 'r' && s[i] == 'b'){
    next[i-1] = next[i] = 'g';
      }else if(s[i-1] == 'b' && s[i] == 'g' ||
           s[i-1] == 'g' && s[i] == 'b'){
    next[i-1] = next[i] = 'r';
      }else if(s[i-1] == 'r' && s[i] == 'g' ||
           s[i-1] == 'g' && s[i] == 'r'){
    next[i-1] = next[i] = 'b';
      }
       
      if(!used.count(next)){
    dist[next] = dist[s] + 1;
    used.insert(next);
    Q.push(next);
      }
    }
  }
 
  if(!found) return -1;
  return dist[ans];
}
 
int main(){
  while(cin >> str,str != "0"){
    len = (int)str.size();
    int res = bfs();
    if(res == -1){
      cout << "NA" << endl;
    }else{
      cout << res << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 5980
import math

N,M = (int(i) for i in input().split())

if abs(N-M)>1:
    ans = 0
elif abs(N-M) == 1:
    ans = math.factorial(N)*math.factorial(M)
else:
    ans = math.factorial(N)*math.factorial(M)*2
    
                        
print(ans%(10**9+7))

Measured memory_bytes: 5192
#include<bits/stdc++.h>
using namespace std;
//#define int long long
#define itn int
#define mod 1000000007
#define INFi 2147483647
#define INFl 9223372036854775807LL
#define fi first
#define se second
#define be begin()
#define en end()
int abs(int a,int b){
    return max(a,b)-min(a,b);
}
signed main(){
// __builtin_ctz(N); Nを２で何回割り切れるかを返す
//(n+1)*n/2; １からNまでの総和を求める式
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a;
    string b,c;
    cin>>a>>b>>c;
    for(int i=0;i<a;i++){
	cout<<b[i]<<c[i];
    }
    cout<<"\n";
}


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


//TEMPLATE
#define pb                push_back
#define mp                make_pair
#define ll                long long
#define ld                long double
#define pii               pair <ll, ll>
#define piii              pair <ll, pii>
#define F                 first
#define S                 second

#define newline           printf("\n")
#define minusone          printf("-1\n")
#define zeroo             printf("0\n")
#define scl1(a)           scanf("%lld", &a)
#define scl2(a, b)        scanf("%lld %lld", &a, &b)
#define scl3(a, b, c)     scanf("%lld %lld %lld", &a, &b, &c)
#define prl1(a)           printf("%lld\n", a)
#define prl2(a, b)        printf("%lld %lld\n", a, b)
#define ssl1(s)           scanf(" %[^\n]", s)
#define scd1(a)           scanf("%lf", &a)
#define scd2(a, b)        scanf("%lf %lf", &a, &b)
#define prd(a)            printf("%lf\n", a)
#define prld(a)           printf("%Lf\n", a)
#define prcase(cs)        printf("Case %lld: ", cs)
#define cin1(a)           cin >> a
#define cin2(a, b)        cin >> a >> b
#define cin3(a, b, c)     cin >> a >> b >> c
#define cin4(a, b, c, d)  cin >> a >> b >> c >> d
#define cot1(a)           cout << a << "\n"
#define cot2(a, b)        cout << a << " " << b << "\n"
#define cot3(a, b, c)     cout << a << " " << b << " " << c << "\n"
#define cot4(a, b, c, d)  cout << a << " " << b << " " << c << " " << d << "\n"
#define cotline           cout << "\n"
#define cotminus          cout << "-1\n"
#define cot0              cout << "0\n"
#define cotyes            cout << "YES\n"
#define cotno             cout << "NO\n"
#define cotcase(cs)       cout << "Case " << cs << ": "

#define reversed(s)       reverse(s.begin(), s.end())
#define asort(s)          sort(s.begin(), s.end())
#define dsort(s)          sort(s.rbegin(), s.rend())
#define all(s)            s.begin(), s.end()
#define uniq(s)           s.resize(distance(s.begin(),unique(s.begin(), s.end())))
#define found(s, x)       (s.find(x) != s.end())

#define for0(i, n)        for (i = 0; i < n; i++)
#define for1(i, n)        for (i = 1; i <= n; i++)
#define fora(i, a, b)     for (i = a; i <= b; i++)
#define forb(i, b, a)     for (i = b; i >= a; i--)
#define fori(it, s)       for(auto it = s.begin(); it != s.end(); it++)

#define FR                ios_base::sync_with_stdio(false);cin.tie(NULL)
#define ms(a, x)          memset(a, x, sizeof a)
#define bitcount(n)       __builtin_popcountll(n)

//#define pi              3.1415926536
#define pi                acos(-1)

const ll INF = LLONG_MAX;
const ll SZ = 4e5+5;
const ll mod = 2019;


ll n;
ll f[2100];
ll suf[SZ];



int main() {
    ll cs = 0, tc = 1, x, y, z, i, j, k, g, p, q, ans = 0, sum = 0, c = 0, t = 0;
//    ll a, b, d;
    string s, s1, s2;

    cin1(s);
    n = s.size();

    p = 1;
    f[0] = 1;

    forb(i, n-1, 0) {
        x = s[i] - '0';
        suf[i] = ((x * p) + suf[i+1]) % mod;
        ans += f[suf[i]];

        f[suf[i]]++;
        p = (p*10) % mod;
    }

    cot1(ans);

    return 0;
}



Measured memory_bytes: 5180
using System;
using System.Linq;
using System.Collections.Generic;
using System.IO;
using static System.Console;


namespace atcorder2
{
    class Program
    {
        public static long Read()
        {

            return long.Parse(Console.ReadLine());
        }

        public static long[] Reads()
        {


            return Console.ReadLine().Split().Select(long.Parse).ToArray();
        }

       
       
        public static long gcd(long x,long y)
        {
            if (x < y) gcd(y, x);
            
            while (y > 0)
            {
                var z = x % y;
                x = y;
                y = z;
            }
            return x;
        }

        public static long lcm(long x,long y)
        {
            return x * y / gcd(x, y);
        }



        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);


            var n = Read();
            var a = Reads();
            var ans = new long[n];
            for (int i = 0; i < n-1; i++)
            {
                ans[a[i] - 1]++;
            }
            for (int i = 0; i < n; i++)
            {
                WriteLine(ans[i]);
            }
          
            Console.Out.Flush();
        }
    }
}




Measured memory_bytes: 41696
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ll long long
#define ld long double
#define pb push_back
#define all(x) (x).begin(), (x).end()
template <typename T> using ord_set = tree <T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update>;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const int N = (1 << 11), K = 11;
int n, k, q, a[N], val[N], used[N], m;
vector <int> pos[N];
int par[N];
multiset <int> st[N];
priority_queue <int> pq;

void upd(int x) {
	while ((int)st[x].size() > k - 1) {
		pq.push(*st[x].begin());
		st[x].erase(st[x].begin());
	}
}

void make_set(int x) {
	par[x] = x;
	st[x].insert(a[x]);
}

int find_set(int x) {
	if (x == par[x]) return x;
	return par[x] = find_set(par[x]);
}

void union_set(int x, int y) {
	x = find_set(x), y = find_set(y);
	if (x == y) return;
	if ((int)st[x].size() < (int)st[y].size())
		swap(x, y);
	par[y] = x;
	for (int i : st[y])
		st[x].insert(i);
	upd(x);
}

void add(int x) {
	upd(x);
	used[x] = 1;
	if (used[x - 1])
		union_set(x - 1, x);
	if (used[x + 1])
		union_set(x, x + 1);
}

int main() {
	ios_base::sync_with_stdio(false), cin.tie(NULL);
	#ifdef LOCAL
		freopen("input.txt", "r", stdin);
	#endif
	
	cin >> n >> k >> q;
	vector <int> b;
	for (int i = 1; i <= n; i++) cin >> a[i], b.pb(a[i]);
	sort(all(b));
	b.erase(unique(all(b)), b.end());
	m = b.size();
	for (int i = 1; i <= n; i++) {
		int x = lower_bound(all(b), a[i]) - b.begin() + 1;
		val[x] = a[i];
		a[i] = x;
		pos[x].pb(i);
		make_set(i);
	}
	int ans = 1e9;
	for (int i = m; i >= 1; i--) {
		for (int j : pos[i])
			add(j);
		while ((int)pq.size() > q) pq.pop();
		if ((int)pq.size() == q)
			ans = min(ans, val[pq.top()] - val[i]);
	}
	cout << ans;
}


Measured memory_bytes: 4244
#include <bits/stdc++.h>
using namespace std;
#define rep(shoki,i,n) for(int i=shoki; i<n; i++)
#define _GLIBCXX_DEBUG
using ll = long long;
using vi = vector<int>;
using vs = vector<string>;

int main(){
    int n; cin>>n;
    vi a(n*3);
    rep(0,i,n*3) cin>>a[i];
    sort(a.begin(),a.end());
    ll sum = 0;
    rep(0,i,n*2){
        if(i%2==0) sum+=a[i+n];
    }
    cout << sum << endl;
}

Measured memory_bytes: 1408
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
using namespace std;
typedef long long int lli;
typedef pair<lli, lli> pll;

int main(){
    lli t,n;
    cin >> t >> n;

    vector<pair<lli, lli>> p(n);
    for(int i=0; i<n; i++){
        cin >> p[i].first >> p[i].second;
    }

    vector<lli> len(n+1, 0);
    for(int i=0; i<n; i++){
        len[i+1] = len[i] +p[i].second -p[i].first;
    }
    lli ans = 0;
    for(int i=0; i<n; i++){
        lli b = p[i].first;
        lli e = b+t;
        int idx = lower_bound(p.begin(), p.end(), pll(e, 0)) -p.begin() -1;
        lli sub = len[idx] -len[i];
        if(p[idx].first < e){
            sub += min(e-p[idx].first, p[idx].second-p[idx].first);
        }
        ans = max(ans, sub);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 5208
#include <iostream>
#include <math.h>
using namespace std;
int main(void){
    int N;
    cin >> N;
    int ai[N];
    int out;
    for (int i = 0; i < N ; i++)
    {
        cin >> ai[i];
        while ( ai[i]% 2 == 0){
            ai[i] = ai[i]/2;
            out++;
        }
    }
    
    cout << out << endl;
}

Measured memory_bytes: 888
fun main(args: Array<String>) {
	val A = readLine()!!.toInt()
	val B = readLine()!!.toInt()
	val C = readLine()!!.toInt()
	val X = readLine()!!.toInt()
	var cnt = 0

	for (a in 0 .. A) {
		for (b in 0 .. B) {
			for (c in 0 .. C) {
				if (500 * a + 100 * b + 50 * c == X) {
					cnt += 1
				}
			}
		}
	}
	println(cnt)
}

Measured memory_bytes: 31768
a, b, c, d = map(int, input().split())

flg = 0

if (max(a, c) - min(a, c)) <= d:
	flg = 1

if (max(a, b) - min(a, b)) <= d and (max(c, b) - min(c, b)) <= d:
	flg = 1

if flg == 0:
	print("No")
else:
	print("Yes")

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,t; cin >> n >> t;
    int ans = 0;
    int bf; cin >> bf;
    for(int i = 1; i < n; i++){
        int now; cin >> now;
        ans += min(t, now - bf);
        bf =  now;
    }
    cout << ans + t << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <utility>

using namespace std;

#define INFTY (1 << 30)
#define MAX 2000000

int n = 0, A[MAX + 1];

int parent( int i ){

    return i/2;

}

int left( int i ){

    return 2*i;

}

int right( int i ){

    return 2*i + 1 ;

}


void maxHeapify( int i){

    int l, r, largest;

    l = left(i);
    r = right(i);

    //左の子、自分、右の子のうち最大の値を持つものを選ぶ

    if( l <= n &&  A[l] > A[i] ){

        largest = l;

    } else {

        largest = i;

    }

    if( r <= n && A[r] > A[largest] ){

        largest = r;

    }

    if( largest != i ){

        swap( A[i], A[largest] );

        maxHeapify(largest);

    }

}

void heapIncreaseKey( int i, int key){

    if( key < A[i] ) return;

    A[i] = key;

    while( i > 1 && A[ parent(i) ] < A[i] ){

        swap( A[i], A[ parent(i) ] );

        i = parent(i);

    }

}

void insert( int key ){

    n++;
    A[n] = -INFTY;

    heapIncreaseKey( n, key);

}

int extract(){

    if( n < 1 ) return -INFTY;

    int max = A[1];

    A[1] = A[n];

    n--;

    maxHeapify( 1 );

    return max;

}

int main(){

    char com[10];
    int key;

    while(1){

        scanf("%s", com);

        if( com[0] == 'e' && com[1] == 'n'){
            
             break;

        } else if ( com[0] == 'i' ){

            scanf("%d", &key);

            insert(key);

        } else {

            int x = extract();

            printf("%d\n", x);

        }


    }

    return 0;

}


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

bool prime[105];
 vector<pair<int,int> >v;

void seive()
{
    for(int i=1;i<=105;i++)prime[i]=true;
    for(int i=2;i*i<=105;i++)
    {
        if(prime[i]==true)
        {
            for(int j=i*2;j<=105;j+=i)
            {
                prime[j]=false;
            }
        }
    }
}

int f(int pos,int sum)
{
     if(sum>75)return 0;
     if(sum==75)return 1;
     if(pos==v.size())return 0;

    int ans=0;

    for(int i=0;i<=v[pos].second;i++)
    {
        ans+=f(pos+1,sum*(i+1));
    }
    return ans;
}

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

     for(int i=2;i<=n;i++)
     {
         if(prime[i])
         {
             int a=i;
             int sum=0;
             while(a<=n)
             {
                 sum+=n/a;
                 a*=i;
             }
            // cout<<i<<" "<<sum<<endl;
             v.push_back(make_pair(i,sum));
         }
     }
     cout<<f(0,1)<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    vector<int> s(n);
    int sum = 0;
    for(int i=0; i < n; i++){
        int t;
        cin>>t;
        sum += t;
        s[i]=t;
    }
    sort(s.begin(),s.end());
    if(sum%10==0){
        for(int i = 0; i < n; i++){
            if((sum-s[i])%10!=0){
                cout<<sum-s[i];
                return 0;
            }
        }
        cout<<"0";
        return 0;
    }
    cout<<sum;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
 int N,K,count = 0;
 cin >> N >> K;
 vector<int> h(N);
 for(int i = 0; i < N; i++){
   cin >> h[i];
   if(h[i] >= K) count++;
 }
  cout << count; 
}

Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
#define M 1000000007
typedef long long ll;
ll n,r,l;
int k[100005];
ll kai[100005];
ll z(ll a,ll x){
    ll res=1;
    for(int i=0;1<<i<=x;i++){
        if(x>>i&1)res=res*a%M;
        a=a*a%M;
    }
    return res;
}
ll com(ll a,ll b){
    if(a<b)return ll(0);
    return kai[a]*z(kai[a-b],M-2)%M*z(kai[b],M-2)%M;
}
int main(void){
    scanf("%lld",&n);
    n++;
    kai[0]=1;
    for(int i=1;i<=n;i++)kai[i]=kai[i-1]*i%M;
    for(int i=1;i<=n;i++){
        int a;
        scanf("%d",&a);
        if(k[a]==0){
            k[a]=i;
        }else{
            r=k[a]-1+n-i;
        }
    }
    cout<<n-1<<endl;
    for(int i=2;i<=n;i++)printf("%lld\n",(com(n,i)+M-com(r,i-1))%M);
}


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

int main() {
    int N, Q;
    cin >> N >> Q;
    string S;
    cin >> S;
    vector<int> l(Q), r(Q);
    for (int i = 0; i < Q; i++)
        cin >> l[i] >> r[i];

    vector<int> cnt(N);
    cnt[0] = 0;
    for (int i = 1; i < N; i++) {
        cnt[i] = cnt[i - 1];
        if (S[i - 1] == 'A' && S[i] == 'C')
            cnt[i]++;
    }

    for (int i = 0; i < Q; i++) {
        cout << cnt[r[i] - 1] - cnt[l[i] - 1] << endl;
    }
    return 0;
}

Measured memory_bytes: 2176
#include <bits/stdc++.h>
using namespace std;
int main(){
        long long int n; cin >> n;
        set<long long int> s;
        for (long long int x = 0; x < n; ++x){
            long long int q; cin >> q;
            auto it = s.find(q);
            if (it == s.end()) s.insert(q);
            else s.erase(it);
        }
        cout << s.size() << endl;
    return 0;
}


Measured memory_bytes: 8172
#include<stdio.h>

int main(){
   int n;
   scanf("%d", &n);
   int a[n];
   int judge = 0;
   for(int i=0; i<n; i++){
      scanf("%d", &a[i]);
      if(a[i] % 2 == 0){
         if(a[i] % 3 != 0 && a[i] %5 != 0){
            judge = 1;
         }
      }
   }

   if(judge == 0){
      printf("APPROVED");
   } else {
      printf("DENIED");
   }

   return 0;
}


Measured memory_bytes: 1684
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"

using namespace std;

const long long int MOD = 1000000007;
//const int MOD = 998244353;

//long long int N, M, K, H, W, L, R;
long long int N, M, K, H, W, L, R;


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

	cin >> N >> K;
	M = (N + 1) / 2;
	if (M >= K)cout << "YES\n";
	else cout << "NO\n";
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String input = scan.nextLine();
		scan.close();
		String[] ary = input.split(" ");
		int value = Integer.parseInt(ary[1]+ary[2]);
		if(value % 4 == 0) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}
		
	}
	
}

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

using namespace std;

#define int long long

vector<int> graph[200005];
void add_edge(int u, int v)
{
    graph[u].push_back(v);
    graph[v].push_back(u);
}

void depthFirst(int v, vector<int> graph[],
                vector<bool>& visited, int& ans)
{
    visited[v] = true;
    ans++;
    for (auto i : graph[v]) {
        if (visited[i] == false) {
            depthFirst(i, graph, visited, ans);
        }
    }
}

int UniqueConnectedComponent(int n,
                              vector<int> graph[])
{
    int mx = -1 ;
    vector<bool> visited(n + 1, false);
    unordered_set<int> result;
    for (int i = 1; i <= n; i++) {
        if (visited[i] == false) {
            int ans = 0;
            depthFirst(i, graph, visited, ans);
            result.insert(ans);
            mx = max (mx,ans);
        }
    }
    return mx ;
}
int32_t  main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n,m;
    cin >> n >> m;
    for(int i=0;i<m;i++){
        int a,b;
        cin >>a>>b;
        add_edge(a,b);
    }
    cout << UniqueConnectedComponent(n,graph);
    return 0;
}

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

constexpr int inf = 100000000;
int n, m, a[10005];
int digits[] = { 0,2,5,5,4,5,6,3,7,6 };
int dp[10005];
int main()
{
	std::cin >> n >> m;
	for (int i = 0; i < m; ++i)
		std::cin >> a[i];

	std::sort(a, a + m, std::greater<int>());
	std::fill(dp, dp + n + 1, -inf);

	dp[0] = 0;
	for (int i = 0; i < m; ++i) {
		auto cost = digits[a[i]];
		for (int j = 0; j <= n; ++j) {
			if (dp[j] < 0)
				continue;
			if (j + cost > n)
				break;
			dp[j + cost] = std::max(dp[j + cost], dp[j] + 1);
		}
	}

	int num = n;
	int idx = 0;
	while (num > 0) {
		auto cost = digits[a[idx]];
		if ((num >= cost) && (dp[num] == dp[num - cost] + 1)) {
			std::cout << a[idx];
			num -= cost;
		}
		else
			++idx;
	}

	std::cout << std::endl;
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <limits.h>
#include <ctype.h>
#define DIV 1000000007

long long N, M;

int main() {
  scanf("%lld %lld%*c", &N, &M);
  long long ans = 0;
  if (M < 2 * N) {
    ans = M / 2;
  } else {
    M -= 2 * N;
    ans = N + M / 4;
  }
  printf("%lld\n", ans);
  return 0;
}



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

//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
//#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>


#define INF             1e9
#define INFL            8e18
#define XX              first
#define YY              second
#define PB              push_back
#define MP              make_pair

#define NEWLINE         cerr << "\n";
#define HOISE           cerr << "hoise " << __LINE__ << "\n"
#define PAUSE           system("pause")
#define DEBUG(x)        cerr << #x << " = " << x << "\n"
#define READ            freopen("D:\\moidda CPP\\alu.txt", "r", stdin)
#define WRITE           freopen("D:\\moidda CPP\\vorta.txt", "w", stdout)
#define FASTIO          ios_base::sync_with_stdio(false);cin.tie(NULL)
#define MASK(x)         for(int i = 0; i < 8; i++){ if(x&(1<<i)){ cout << i << " "; } } cout << endl;

typedef long long ll;
typedef pair<int, int > pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pff;

const int MAX = 1e3 + 2;
const int MAXLOG = log2(MAX) + 2;
const int MAX_VALUE = 200 + 2;
const int MOD = 1e9 + 7;
const double PY = acos(-1.0);
const double EPS = 1E-9;

int32_t main()
{
//#ifndef ONLINE_JUDGE
//    READ;
//    WRITE;
//#endif

    FASTIO;

    int n;
    cin >> n;
    vector<ll> a(3*n);
    for(int i = 0; i < 3*n; i++)
        cin >> a[i];

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

    ll sum = 0;
    for(int i = 3*n-2, cnt = 0; cnt < n; i-=2, cnt++){
        sum += a[i];
    }
    cout << sum;

    return 0;
}


Measured memory_bytes: 2560
def main():
    n = int(input())
    A = list(map(int, input().split()))
    p = 10**9 + 7
    ans = 0
    sumA = sum(A)

    for i, Ai in enumerate(A[:-1]):
        sumA -= Ai
        ans += Ai * sumA % p

    print(ans % p)


if __name__ == '__main__':
    main()


Measured memory_bytes: 31576
N, M = map(int,input().split()) 
p = [0]*M
S = [0]*M
T = [0]*(N+1) 
U = [0,0]
for i in range(M):
  p[i],S[i] = input().split()
  P = int(p[i])
  if T[P] != -1:
    if S[i] == 'WA':
      T[P] += 1
    elif S[i] == 'AC':
      U[0] += 1
      U[1] += T[P]
      T[P] = -1


print(U[0],U[1])


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


using namespace std;


# 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)
# define rrep(i, n) for(int i=((int)(n)-1); i>=0; --i)
# define rreps(i, n) for(int i=((int)(n)); i>0; --i)
# define ALL(v) v.begin(), v.end()
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true;}return false;}
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true;} return false;}
template<typename T> void dump(T e){std::cout << e << std::endl;}
template<typename T> void dump(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void dump(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ dump(v); } }



const float INF = std::numeric_limits<float>::infinity();
const int MAX_N = 1e6;

int main() {
  int N, K;
  cin >> N >> K;
  int i = 0;
  int j = 1;
  
  vector<int64_t> dp(MAX_N);
  rep(i, MAX_N){dp.at(i) = INF;}
  
  vector<int> h(N+K);
  rep(i, N) {cin >> h.at(i);}

  dp.at(0) = 0;
  rep(i, N) {
    reps(j, K) {
      chmin(dp.at(i+j), dp.at(i) + abs(h.at(i) - h.at(i+j)));
    }
  }
  cout << dp[N-1] << endl;
}

Measured memory_bytes: 8448
N,W = map(int,input().split())

dp = [0]*(W+1)
L = []
for i in range(N):
    ta,tb = map(int,input().split())
    L.append([ta,tb])

for i in range(N):
    for w in range(W+1):
        if w-L[i][1]>=0 :dp[w] = max(dp[w],dp[w-L[i][1]]+L[i][0])
print(dp[-1])


Measured memory_bytes: 5724
#include <cstdio>
#include <iostream>
#include <stack>
using namespace std;

int n, a[200005];
int b[500005];
int l =200004, r = 200005;

int main()
{
    cin >> n;
    for(int i = 1; i<=n; i++)
    {
        scanf("%d", &a[i]);
        if(i%2 == 0)
            b[l--] = a[i];
        else
            b[r++] = a[i];
    }
    if(n%2==0)
        for(int i = l+1; i<r; i++)
            printf("%d ", b[i]);
    else
        for(int i = r-1; i>l; i--)
            printf("%d ", b[i]);
    printf("\n");
    return 0;
}


Measured memory_bytes: 3712
def min2(a,b)
    return a>b ? b : a
end
def max2(a,b)
    return a<b ? b : a
end

N,K = gets.split.map{|i| i.to_i}

V = gets.split.map{|i| i.to_i}
NKmin = N<K ?  N : K
mx = 0

for left in 0..N
    for right in 0..NKmin-left
        lg = V[0...left]
        rg = V[N-right...N]
        lr = lg+rg
        lr.sort!
        score = lr.inject(:+)
        if score.nil?
            score=0
        end
        disposal = min2(K-lr.length,lr.length)
        lr2 = lr[0...disposal]
        for i in lr2
            if i<0
                score -= i
            else
                break
            end
        end

        mx = max2(mx,score)
    end

end
puts mx


Measured memory_bytes: 1916
#include <bits/stdc++.h>
using namespace std;
int LCS(string &X, string &Y) {
  X = " " + X;
  Y = " " + Y;
  int X_size = X.size(), Y_size = Y.size();
  vector<vector<int>> CS(Y_size, vector<int>(X_size, 0));
  for (int i = 0; i < Y_size; i++) {
    for (int j = 0; j < X_size; j++) {
      if (i == 0 || j == 0) continue;
      else if (X[j] == Y[i]) {
        CS[i][j] = CS[i - 1][j - 1] + 1;
      } else {
        CS[i][j] = max(CS[i][j - 1], CS[i - 1][j]);
      }
    }
  }
  return CS[Y_size - 1][X_size - 1];
}
int main() {
  int q;
  cin >> q;
  string X, Y;
  for (size_t i = 0; i < q; i++) {
    cin >> X >> Y;
    cout << LCS(X, Y) << endl;

    X.clear();
    Y.clear();
  }
}



Measured memory_bytes: 6868
n=int(input())
sl=[]
tl=[]
for i in range(n):
  s,t=input().split()
  sl.append(s)
  tl.append(int(t))
  
x=input()

flg=-1
for i in range(n):
  if x==sl[i]:
    flg=i
    break

sum=0
for i in range(flg+1,n):
  sum+=tl[i]
print(sum)


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

const int LIMIT = 100000;
int n, m, x[LIMIT], diff[LIMIT], ans;

int main() {
    cin >> n >> m;
    rep(i, m) cin >> x[i];
    sort(x, x + m);
    rep(i, m-1) diff[i] = x[i+1] - x[i];
    sort(diff, diff + m - 1);
    rep(i, m - n) ans += diff[i];
    cout << ans << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= (n); i++)
#define all(a) (a).begin(), (a).end()
#define bit(b) (1ull << (b))

using namespace std;
using i32 = int;
using u32 = unsigned int;
using i64 = long long;
using u64 = unsigned long long;
using f64 = double;
using vi32 = vector<i32>;
using vu32 = vector<u32>;
using vi64 = vector<i64>;
using vu64 = vector<u64>;
using vf64 = vector<f64>;
using vstr = vector<string>;
using vvi32 = vector<vi32>;
using vvu32 = vector<vu32>;
using vvi64 = vector<vi64>;
using vvu64 = vector<vu64>;
using vvf64 = vector<vf64>;

template<typename T, typename S> bool amax(T &x, S y) { if (x < y) { x = y; return 1; } return 0; }
template<typename T, typename S> bool amin(T &x, S y) { if (y < x) { x = y; return 1; } return 0; }

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(16);
  i64 N, A, B;
  cin >> N >> A >> B;
  vi64 X(N);
  rep(i, N) cin >> X[i];
  i64 x = X[0];
  i64 ans = 0;
  reps(i, N - 1) {
    i64 next_x = X[i];
    if ((next_x - x) * A > B) {
      ans += B;
    } else {
      ans += (next_x - x) * A;
    }
    x = next_x;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1024
import java.util.Arrays;
import java.util.Scanner;
public class Main
{
	public static void main(String arg[])
	{
		Scanner in=new Scanner(System.in);
		while(in.hasNext())
		{
			int n=in.nextInt();
			if(n==0)
				return;
			int a[]=new int[n];
			for(int i=0;i<n;i++)
				a[i]=in.nextInt();
			Arrays.sort(a);
			int sum=0;
			for(int i=1;i<a.length-1;i++)
				sum+=a[i];
			System.out.println(sum/(n-2));
		}
	}
}

Measured memory_bytes: 12000
#include <iostream>
#include <algorithm>
#include <cstring>
#include <functional>
#include <cstdio>
using namespace std;

typedef long long ll;

const ll INF = 1LL << 32;
ll Map[105][105];
int v, e;
void printAns();
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	for (int i = 0; i < 105; ++i)
	{
		for (int j = 0; j < 105; ++j)
		{
			Map[i][j] = i == j ? 0 : INF;
		}
	}
	int  s, t, d;
	cin >> v >> e;
	for (int i = 0; i < e; ++i)
	{
		cin >> s >> t >> d;
		Map[s][t] = d;
	}
	for (int k = 0; k < v; ++k)
	{
		for (int i = 0; i < v; ++i)
		{
			if (Map[i][k] == INF)
				continue;
			for (int j = 0; j < v; ++j)
			{
				if (Map[k][j] == INF)
					continue;
				Map[i][j] = min(Map[i][j], Map[i][k] + Map[k][j]);
			}
		}
	}
	bool negative = false;
	for (int i = 0; i < v; ++i)
		if (Map[i][i] < 0)
			negative = true;
	if (negative)
		cout << "NEGATIVE CYCLE\n";
	else
		printAns();

	return 0;
}

void printAns()
{
	for (int i = 0; i < v; ++i)
	{
		for (int j = 0; j < v; ++j)
		{
			if (j)
				cout << ' ';
			if (Map[i][j] == INF)
				cout << "INF";
			else
				cout << Map[i][j];
		}
		cout << '\n';
	}
}

Measured memory_bytes: 3292
#include <iostream>
#include <set>

int main()
{
    int N;
    std::cin >> N;
    std::set<int> s;
    for (int i = 0; i < N; i++) {
        int A;
        std::cin >> A;
        if (s.count(A))
            s.erase(A);
        else
            s.insert(A);
    }

    std::cout << s.size() << std::endl;
    return 0;
}

Measured memory_bytes: 8072
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		sc.close();
		
		int diff = b -a;
		int alen = 0;
		for(int i = 1;i < diff;++i)
			alen += i;
		System.out.println(alen - a);
	}
}


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

int main() {
	
	int i, j, v, n, A[101];
	cin >> n;
	for(i=0; i<n; i++){
		cin >> A[i];
	}
	for(i=0; i<n ; i++){
		cout << A[i];
		if(i!=n-1) cout << " ";
	}cout << endl;
	
	for(i=1; i<=n-1; i++){
		v = A[i];
		j = i - 1;
		while(j >= 0 && A[j] > v){
			A[j+1] = A[j];
			j--;
		}
		A[j+1] = v;
		for(int k=0; k<n; k++){
			cout << A[k];
			if(k!=n-1) cout << " ";
		}
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 1160
from collections import deque

class Process:
    def __init__(self, name, time):
        self.name = name
        self.time = time


n, q = [int(i) for i in input().split()]
queue = deque()
for i in range(n):
    name, time = [i for i in input().split()]
    queue.append(Process(name, int(time)))

end_time = 0
while len(queue) > 0:
    p = queue.popleft()
    if p.time > q:
        p.time -= q
        end_time += q
        queue.append(p)
    else:
        end_time += p.time
        print('%s %d' % (p.name, end_time))


Measured memory_bytes: 17660
package main

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

var sc = bufio.NewScanner(os.Stdin)

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

func main() {
	var tmp int
	rdx := strings.Fields(nextLine())
	r, _ := strconv.Atoi(rdx[0])
	d, _ := strconv.Atoi(rdx[1])
	x, _ := strconv.Atoi(rdx[2])
	tmp = x
	for i := 0; i < 10; i++ {
		tmp = r*tmp - d
		fmt.Printf("\n%d", tmp)
	}
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 1e5 + 5, mod = 1e9 + 7;

int a[maxn];
ll dp[maxn][2];
int main()
{
    ios::sync_with_stdio(0); cin.tie(0);
    string s;
    cin >> s;
    int ls = s.size();
    for (int i = 0; i < ls; ++i) a[i + 1] = (s[i] == '0' ? 0 : 1);
    if (a[1] == 1){
        dp[1][0] = 1;
        dp[1][1] = 2;
    }else{
        dp[1][0] = 0;
        dp[1][1] = 1;
    }
    for (int i = 2; i <= ls; ++i){
        dp[i][0] += 3 * dp[i - 1][0];
        dp[i][1] += dp[i - 1][1];
        if (a[i] == 1){
            dp[i][0] += dp[i - 1][1];
            dp[i][1] += dp[i - 1][1];
        }
        dp[i][0] %= mod;
        dp[i][1] %= mod;
    }
    cout << (dp[ls][0] + dp[ls][1]) % mod << endl;
    return 0;
}


Measured memory_bytes: 2384
#include <bits/stdc++.h>
using namespace std;
#define int long long
using ll=long long;
using vi=vector<int>;
using vl=vector<long long>;
using pii=pair<int,int>;
using pll=pair<long long,long long>;
#define ITR(i,c) for(auto i=begin(c);i!=end(c);++i)
#define FORE(x,c) for(auto &x:c)
#define REPF(i,a,n) for(int i=a,i##len=(int)(n);i<i##len;++i)
#define REP(i,n) REPF(i,0,n)
#define REPR(i,n) for(int i=(int)(n);i>=0;--i)
#define REPW(i,n) for(i=0;i<(int)(n);++i)
#define ALL(c) begin(c),end(c)
#define RALL(c) rbegin(c),rend(c)
#define SZ(c) ((int)c.size())
#define CONTAIN(c,x) (c.find(x)!=end(c))
#define OUTOFRANGE(y,x,h,w) (y<0||x<0||y>=h||x>=w)
#define dump(...)
const int DX[9]={0,1,0,-1,1,1,-1,-1,0},DY[9]={-1,0,1,0,-1,1,1,-1,0};
#define INF (1001001001)
#define INFLL (1001001001001001001ll)
template<class T> ostream& operator << (ostream &os,const vector<T> &v) {
    ITR(i,v) os << *i << (i==end(v)-1 ? "" : " "); return os; }
template<class T> istream& operator >> (istream &is,vector<T> &v) {
    ITR(i,v) is >> * i; return is; }
template<class T> istream& operator >> (istream &is, pair<T,T> &p) {
        is >> p.first >> p.second; return is; }
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;}
//------------------------------------------------------------------------------
struct before_main_function {
    before_main_function() {
        #ifdef int
            #undef INF
            #define INF INFLL
            #define stoi stoll
        #endif
        cin.tie(0);ios::sync_with_stdio(false);
        cout<<setprecision(15)<<fixed;
    }
} before_main_function;
//------------------8<------------------------------------8<--------------------

signed main() {
    string s;
    cin>>s;
    int cnt=0;
    REPF(i,1,SZ(s)) {
        if(s[i-1]!=s[i]) cnt++;
    }
    cout<<cnt<<endl;
    return 0;
}


Measured memory_bytes: 512
#include <iostream>

using namespace std;

int main()
{
    long long n, ans = 10e12;
    cin >> n;

    for(long long i = 1; i * i <= n; ++i)
        if(!(n % i) && ans > i + (n / i) - 2)
            ans = i + (n / i) - 2;

    cout << ans;
  	return 0;
}


Measured memory_bytes: 256
use proconio::input;

fn main() {
    input! {
        n: usize,
        k: usize,
        x: usize,
        y: usize
    };

    let mut ans = 0;

    for d in 0..n {
        if d < k {
            ans += x;
        } else {
            ans += y;
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 2136
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define INF 1e8;
typedef long long ll;
ll mod = 998244353;
long long fast_exp(long long a, long long b)
{
    if(b == 0)
	   return 1;
    else
    {
	   long long res = 1;
	   res = fast_exp(a,b/2);
	   res = (res*res)%mod;
	   if(b%2 == 1)
		  res = (res*a)%mod;
	   return res;
 
    }
}
const ll N = 1e6;




int main()
{
	//ios_base::sync_with_stdio(false);
	//cin.tie(NULL);
	int n;
	cin>>n;
	cout<<pow(n,3)<<endl;


	return 0;
	
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.TreeSet;

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		String[] sa = br.readLine().split(" ");
		Obj[] arr = new Obj[n];
		for (int i = 0; i < n; i++) {
			Obj o = new Obj();
			o.i = i;
			o.a = Integer.parseInt(sa[i]);
			arr[i] = o;
		}
		br.close();

		Arrays.sort(arr, (o1, o2) -> o1.a - o2.a);
		TreeSet<Integer> set = new TreeSet<>();
		set.add(-1);
		set.add(n);
		long ans = 0;
		for (Obj o : arr) {
			long l = o.i - set.lower(o.i);
			long r = set.higher(o.i) - o.i;
			ans += l * r * o.a;
			set.add(o.i);
		}
		System.out.println(ans);
	}

	static class Obj {
		int i, a;
	}
}


Measured memory_bytes: 68964
#include <iostream>
using namespace std;
int main()
{
    int a,b,c,ans=0;
    cin>>a>>b>>c;
    for(int i=1;i<=a;i++)
    {
        int x;
        cin>>x;
        if(x<b||x>=c)ans++;
    }
    cout<<ans<<endl;
    return 0;
}

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 fileio freopen("in.in", "r", stdin),freopen("out.out", "w", stdout);
#define ll long long int
#define FF first
#define SS second
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define pll pair<long long int,long long int>
#define sd(x) scanf("%d",&x)
#define slld(x) scanf("%lld",&x)
#define pd(x) printf("%d\n",x)
#define plld(x) printf("%lld\n",x)
#define pss printf
#define MOD 1000000007
#define INF 1e18
#define eps 0.00001
#define endl '\n'
#define debug(n1) cout<<n1<<endl
ll n,y;

int main() {

slld(n);slld(y);
y/=1000;
ll a=-1,b=-1,c=-1;
for(int i=0;i<=n;i++)
	for(int j=0;j<=n;j++)
	{
		if(y-i*10-j*5==n-i-j&&n-i-j>=0)
			a=i,b=j,c=n-i-j;
	}
pss("%lld %lld %lld\n",a,b,c);
	return 0;
           } 

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fraction() cout.unsetf(ios::floatfield); cout.precision(10); cout.setf(ios::fixed,ios::floatfield);
#define file() freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define faster() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const long long int infLL = 9000000000000000000;
#define mem(a,b) memset(a, b, sizeof(a) )
#define all(a) (a).begin(),(a).end()
#define mx_int_prime 999999937
const int inf = 2000000000;
const double PI = acos(-1);
const double eps = 1e-9;
typedef long double ld;
#define MOD 1000000007
const unsigned int M = 1000000007;
typedef long long ll;
const int mx=2e5+125;
int ar[mx],br[mx],pos[mx];
#define PB push_back
#define endl '\n'
#define S second
#define F first
void solve()
{
   int n;
   cin>>n;
   string s;
   cin>>s;
   int ck=n/2;
   string ans1="",ans2="";
   for(int i=0; i<ck; i++)
    ans1+=s[i];
    for(int i=ck; i<n; i++)
        ans2+=s[i];
    if(ans1==ans2)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;

}
int main()
{
    faster();
    int tc;
    tc=1;
    while(tc--)
        solve();
    return 0;
}



Measured memory_bytes: 3576
import itertools
import math
N, D = map(int, input().split())
X = [list(map(int, input().split())) for _ in range(N)]
ret = 0

def calc(a, b):
    s = 0
    for i in range(D):
        s += (a[i] - b[i]) ** 2
    s = math.sqrt(s)
    if s // 1 == s:
        return 1
    return 0

X = list(itertools.combinations(X,2))
for a, b in X:
    ret += calc(a, b)

print(ret)


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

int main()
{
	int x , y ;
	cin >> x >> y ;
	for(int i = 0 ; i <= x ; ++i)
	{
		int j = x - i ;
		if(2*i + 4*j == y)
		{
			cout << "Yes\n" ;
			return 0 ;
		}
	}
	cout << "No\n" ;
}


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

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

    int N, M;
    cin >> N >> M;
    vector<int> s(M);
    vector<char> c(M);
    for (int i = 0; i < M; ++i) {
        cin >> s.at(i) >> c.at(i);
        s.at(i)--;
    }

    for (int n = 0; n < pow(10, N); ++n) {
        string t = to_string(n);
        if (t.size() != N) continue;
        bool can = true;
        for (int i = 0; i < M; ++i) {
            if (t.at(s.at(i)) != c.at(i)) {
                can = false;
                break;
            }
        }
        if (can) {
            cout << t << endl;
            exit(0);
        }
    }
    cout << -1 << endl;

    return 0;
}

Measured memory_bytes: 256