akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define chmax(x, y) x = max(x, y)
using namespace std;
//using ll = long long;
//using P = pair<int, int>;

int main() {
  string s, t;
  cin >> s >> t;
  int cnt = 0;
  for (int i = 0; i <= s.size()-t.size(); ++i) {
    int cntTmp = 0;
    rep(j, t.size()) {
      if (s[i+j] == t[j]) cntTmp++;
    }
    chmax(cnt, cntTmp);
  }
  int ans = t.size() - cnt;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3624
# A - Can't Wait for Holiday

S = input()

if S == 'SUN':
   print(7)
elif S=='MON':
    print(6)
elif S == 'TUE':
    print(5)
elif S == 'WED':
    print(4)
elif S == 'THU':
    print(3)
elif S == 'FRI':
    print(2)
elif S == 'SAT':
    print(1)


Measured memory_bytes: 9044
#include<bits/stdc++.h>
using ll  = long long;
#define int ll
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define erep(e,v) for(auto && e :v)
#define all(in) in.begin(), in.end()
#define MP make_pair
#define INF (sizeof(int) == 4 ? (int)1e9:(int)1e18)
#define EPS 0.0000000001
using namespace std;
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
template<typename Head, typename Value> auto vectors(const Head &head, const Value &v) { return vector<Value>(head, v); }
template<typename Head, typename... Tail> auto vectors(Head x, Tail... tail) { auto inner = vectors(tail...); return vector<decltype(inner)>(x, inner); }
template<class T> void join(T a){for(auto itr :a){if(itr != *a.begin())cout << " "; cout << itr;} }
using ld  = long double;
using pii = pair<int,int>;
using piii = pair<int,pii>;
int W,H;
int dx[]={0,0,1,-1}, dy[]={1,-1,0,0};
bool valid(int x,int y){return (0<=x&&x<W)&&(0<=y&&y<H);}
signed main(){
    int n; cin >> n;
    cout << (n-30)/2 <<endl;
}





Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double D;
typedef pair<ll,ll> P;
#define M 1000000007
#define F first
#define S second
#define PB push_back
#define INF 1000000000000000000
ll n,a[200005],ans=INF,s;
int main(void){
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a[i];
		s+=a[i];
	}
	for(int i=0;i<n-1;i++){
		if(i>0)a[i]+=a[i-1];
		ans=min(ans,abs(s-a[i]-a[i]));
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 1792
# -*- coding: utf-8 -*-
import sys
def solve(lines):
    N = int(lines.pop(0))
    V = list(map(int, lines.pop(0).split(' ')))
    C = list(map(int, lines.pop(0).split(' ')))
    res = 0
    for (v, c) in zip(V, C):
        if v > c:
            res += v - c
    print(res)

lines = [x.strip() for x in sys.stdin.readlines()]
solve(lines)


Measured memory_bytes: 3060
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#define ll long long
#define IO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
using namespace std;
const int N = 25 + 5, M = 3e5 + 5;

int a[N];
int b[N];
int c[N];
int main(){
    int n;
    scanf("%d", &n);
    for(int i = 1 ; i <= n ; ++i)
        scanf("%d", a + i);
    for(int i = 1 ; i <= n ; ++i)
        scanf("%d", b + i);
    for(int i = 1 ; i < n ; ++i)
        scanf("%d", c + i);
    int ans = 0;
    for(int i = 1 ; i <= n ; ++i){
        ans += b[a[i]];
        if(a[i] == a[i - 1] + 1 && a[i - 1])
            ans += c[a[i - 1]];
    }
    printf("%d\n", ans);
}

Measured memory_bytes: 256
//#pragma comment(linker,"/STACK:102400000,102400000")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 0x3f3f3f3f;
#define _for(i, a, b) for (int i = (a); i < (b); ++i)
#define _rep(i, a, b) for (int i = (a); i <= b; ++i)
const int max_number = 1000000;
const double pi=3.14159265358979323846264338328;


//TODO: atoi  <math.h>定义了圆周率M_PI

int main() //a/b problem
{
    int a, b;
    scanf("%d%d", &a, &b);
    int d, r;
    double real;
    d = a / b;
    r = a % b;
    real = (a+0.0) / b;
    printf("%d %d %.5lf\n", d, r, real);
    return 0;
}


Measured memory_bytes: 3208
// C.

#include <iostream>
#include <sstream>
#include <tuple>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <vector>

using namespace std;

typedef long long LL;

LL solve(int n, vector<int>& a) {
	if (n == 0) {
		return a[0] == 1 ? 1 : -1;
	}
	vector<LL> vmx(n + 1);
	LL mn = 0, mx = 0;
	for (int i = n; i >= 0; --i) {
		LL curr = a[i];
		LL upper = 1LL << min(60, i);
		mn = (mn + 1) / 2 + curr;
		if (mn > upper) return -1;
		mx = min(mx + curr, upper);
		vmx[i] = mx;
	}
	LL ans = 1 + a[n];
	mx = 1;
	for (int i = 1; i < n; ++i) {
		mx = min(vmx[i], (mx - a[i - 1]) * 2);
		ans += mx;
	}
	return ans;
}

int main(int argc, char* argv[]) {
#ifdef _MSC_VER
	while (true)
#endif
	{
		int n = -1;
		cin >> n;
		if (n < 0) return 0;
		vector<int> a(n + 1);
		for (int i = 0; i <= n; ++i) {
			cin >> a[i];
		}
		cout << solve(n, a) << endl;
	}
	return 0;
}


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

int main(){
  int64_t N, A, B;
  cin >> N >> A >> B;
  int64_t wa;
  if(A == 0 && B == 0) wa = 0;
  else{
    wa = (N / (A+B)) * A;
    if(N % (A+B) >= A) wa += A;
    else wa += N % (A+B);
  }
  cout << wa << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		
		String a = scan.next();
		String b = scan.next();
		String c = scan.next();

		if(a.charAt(a.length() -1) != b.charAt(0)){
			System.out.println("NO");
		} else if(b.charAt(b.length() -1) != c.charAt(0)){
			System.out.println("NO");
		} else {
			System.out.println("YES");
		}
	}
}

Measured memory_bytes: 21972
MOD = 10 ** 9 + 7

s = input()
l = len(s)
dp = [[0 for _ in range(13)] for _ in range(l + 1)]
dp[0][0] = 1
for i in range(l):
    if s[i] == "?":
        for k in range(10):
            for j in range(13):
                pos = (j * 10) + k
                pos %= 13
                dp[i + 1][pos] += dp[i][j]
                dp[i + 1][pos] %= MOD
    else:
        for j in range(13):
            pos = (j * 10) + int(s[i])
            pos %= 13
            dp[i + 1][pos] = dp[i][j]
print(dp[-1][5])

Measured memory_bytes: 96300
#include <iostream>
using namespace std;
int main()
{
    int n;
    bool card[4][14];
    for (int i = 0; i < 4; i++)
    {
        for (int j = 1; j <= 13; j++)
        {
            card[i][j] = false;
        }
    }
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        char mark;
        int num;
        cin >> mark >> num;
        if (mark == 'S'){
            card[0][num] = true;
        } else if (mark == 'H'){
            card[1][num] = true;
        } else if (mark == 'C'){
            card[2][num] = true;
        } else if (mark == 'D'){
            card[3][num] = true;
        }
    }
    for (int i = 0; i < 4; i++)
    {
        for (int j = 1; j <= 13; j++)
        {
            if (card[i][j] == false){
                if (i == 0){
                    cout << "S " << j;
                } else if (i == 1){
                    cout << "H " << j;
                } else if (i == 2){
                    cout << "C " << j;
                } else if (i == 3){
                    cout << "D " << j;
                }
                cout << endl;
            }
        }
    }
    return 0;
}


Measured memory_bytes: 3096
int main()
{
	int x,y;
	char c;
	for(;scanf("%d %c %d",&x,&c,&y),c!='?';)
	{
		switch(c)
		{
		case '+':printf("%d\n",x+y);break;
		case '-':printf("%d\n",x-y);break;
		case '*':printf("%d\n",x*y);break;
		case '/':printf("%d\n",x/y);break;
		}
	}
	return 0;
}

Measured memory_bytes: 600
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.StringTokenizer;

public class Main {

	static long mod=1_000_000_007;
	
	public static void main(String[] args) {
		FastScanner fs=new FastScanner();
		int n=fs.nextInt(), k=fs.nextInt();
		int[] a=fs.readArray(n);
		sort(a);
		if (k==n) {
			long prod=1;
			for (int i:a) prod=mul(prod, i);
			print(prod);
			return;
		}
		boolean havePos=false;
		for (int i:a) if (i>=0) havePos=true;
		if (!havePos) {
			long prod=1;
			if (k%2==0) {
				//ans == pos
				for (int i=0; i<k; i++) prod=mul(prod, a[i]);
			}
			else {
				//ans == neg
				for (int i=0; i<k; i++) prod=mul(prod, a[n-i-1]);
			}
			print(prod);
			return;
		}
		
		//we know we can make it positive
		int nNegs=0;
		for (int i:a) if (i<0) nNegs++;
		
		int[] pos=new int[n-nNegs], negs=new int[nNegs];
		int pIndex=n-nNegs-1, nIndex=0;
		for (int i=0; i<n; i++) {
			if (a[i]>=0) pos[pIndex--]=a[i];
			else negs[nIndex++]=a[i];
		}

		long[] posCS=new long[pos.length+1], negCS=new long[negs.length+1];
		posCS[0]=negCS[0]=1;
		for (int i=1; i<=pos.length; i++) posCS[i]=mul(posCS[i-1], pos[i-1]);
		for (int i=1; i<=negs.length; i++) negCS[i]=mul(negCS[i-1], negs[i-1]);
		
		int nPos=Math.min(pos.length, k);
		int nNeg=k-nPos;
		if (nNeg%2==1) {
			nNeg++;
			nPos--;
		}
		while (nNeg+2<=nNegs && nPos>=2 && 
				pos[nPos-1]*(long)pos[nPos-2] < negs[nNeg]*(long)negs[nNeg+1]) {
			nPos-=2;
			nNeg+=2;
		}
		print(mul(posCS[nPos], negCS[nNeg]));
	}
	
	static void print(long a) {
		System.out.println((a%mod+mod)%mod);
	}
	
	static long mul(long a, long b) {
		return a*b%mod;
	}
	
	static void sortAbs(int[] a) {
		ArrayList<Integer> l=new ArrayList<>();
		for (int i:a) l.add(i);
		Collections.sort(l, (aa, b)-> {
			return -Integer.compare(Math.abs(aa), Math.abs(b));
		});
		for (int i=0; i<a.length; i++) a[i]=l.get(i);
	}
	
	static void sort(int[] a) {
		ArrayList<Integer> l=new ArrayList<>();
		for (int i:a) l.add(i);
		Collections.sort(l);
		for (int i=0; i<a.length; i++) a[i]=l.get(i);
	}
	
	static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
		String next() {
			while (!st.hasMoreTokens())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}
		
		int nextInt() {
			return Integer.parseInt(next());
		}
		int[] readArray(int n) {
			int[] a=new int[n];
			for (int i=0; i<n; i++) a[i]=nextInt();
			return a;
		}
		long nextLong() {
			return Long.parseLong(next());
		}
	}

	
}


Measured memory_bytes: 58008
import java.util.*;

class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int tkMonsterHp = sc.nextInt();
    int tkMonsterAttack = sc.nextInt();
    int aoMonsterHp = sc.nextInt();
    int aoMonsterAttack = sc.nextInt();

    while (tkMonsterHp > 0 && aoMonsterHp > 0) {
      aoMonsterHp -= tkMonsterAttack;
      if(aoMonsterHp <= 0) {
        System.out.println("Yes");
        break;
      }

      tkMonsterHp -= aoMonsterAttack;

      if(tkMonsterHp <= 0) {
        System.out.println("No");
        break;
      }
      
    }
    sc.close();
  }
}

Measured memory_bytes: 35724
#include <iostream>
#include <math.h>
using namespace std;

int main(void){
    // Your code here!
    string A;
    cin>>A;
    int result =0;
    for (int i =0;i<A.size();i++){
        if(A.at(i)=='1'){
            result++;
            
        }
    }
    cout<<result<<endl;
}

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

const int N=100005;

int n,a[N];

bool cmp(int x,int y)
{
	return x>y;
}

int main()
{
	scanf("%d",&n);
	for (int i=1;i<=n;i++) scanf("%d",&a[i]);
	sort(a+1,a+n+1,cmp);
	int p;
	for (int i=1;i<=n;i++) if (i+1>a[i+1]) {p=i;break;}
	int q=p;
	while (q<n&&a[q+1]>=p) q++;
	int tag=0;
	if (p==q) tag=(a[p]-p)&1;
	else if (a[p]==p) tag=(q-p)&1;
	else tag=((a[p]-p)&1)|((q-p)&1);
	if (tag) puts("First");
	else puts("Second");
	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define INF 2147483647
#define INF_LL 9223372036854775807
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;

int main() {
	int A,B,C;
  	cin >> A >> B >> C;
  	int s = 0, f = 0;
  	if(A == 5) f++;
  	else if(A == 7) s++;
    if(B == 5) f++;
  	else if(B == 7) s++;
    if(C == 5) f++;
  	else if(C == 7) s++;
  	if(f == 2 && s == 1) cout << "YES" << endl;
  	else cout << "NO" << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
const ll mn=1e5+7;
ll ai[mn],bi[mn],ci[mn];
ll dp[mn][11];

int main(){
	ll n,m;cin>>n>>m;
	for(ll a=0;a<m;++a){cin>>ai[a]>>bi[a];--ai[a];--bi[a];}
	memset(dp,-1,sizeof(dp));
	ll q;cin>>q;
	for(ll a=0;a<q;++a){
		ll v,d;cin>>v>>d>>ci[a];
		--v;
		dp[v][d]=a;
	}
	for(ll a=10;a>=1;--a){
		for(ll b=0;b<n;++b)dp[b][a-1]=max(dp[b][a-1],dp[b][a]);
		for(ll b=0;b<m;++b){
			dp[ai[b]][a-1]=max(dp[ai[b]][a-1],dp[bi[b]][a]);
			dp[bi[b]][a-1]=max(dp[bi[b]][a-1],dp[ai[b]][a]);
		}
	}
	for(ll a=0;a<n;++a)cout<<(dp[a][0]>-1?ci[dp[a][0]]:0)<<endl;
	return 0;
}


Measured memory_bytes: 11520
#include <bits/stdc++.h>
//#pragma GCC optimize "-O3"
typedef unsigned long long ull;
typedef unsigned int ui;
typedef long long ll;
typedef long double ld;
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const ll infll=(1ull<<63)-1;
const int inf=(1ull<<31)-1;
bool q=true;
string a;

int main()
{
	//freopen("in.txt","r",stdin);freopen("out.txt","w",stdout);
	ios_base::sync_with_stdio(false);cin.tie(0);cout.precision(18);
	cin>>a;
	if (a[0]==a[a.size()-1]){
		if (a.size()&1)
			q=false;
	}
	else {
		if (!(a.size()&1))
			q=false;
	} 
	cout<<(q?"First":"Second");
	return 0;
}

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

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
#define PI 3.14159265359 //πの値
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素

 
int main() {
string X; cin >> X;
 REP(i,X.size())  if(X[i] == '?')  X[i] = 'D';
  cout << X;
}


Measured memory_bytes: 3752
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#define pp pair<int,int> 
using namespace std;

int main() {
    int n; 
    cin >> n;
    vector< vector<int> > A(2, vector<int>(100000,0));
    for(int i=0; i<n; ++i){
        int v;
        cin >> v;
        A[i % 2][v-1] += 1;
    }

    pp o1 = pp(0, A[0][0]);
    pp o2 = pp(1, A[0][1]);
    if(o1.second < o2.second) swap(o1, o2);
    for(int i=2; i<A[0].size(); ++i) {
        if(A[0][i] > o1.second) {
            o2 = o1;
            o1 = pp(i, A[0][i]);
        } else if(A[0][i] > o2.second) {
            o2 = pp(i, A[0][i]);
        }
    }

    pp e1 = pp(0, A[1][0]);
    pp e2 = pp(1, A[1][1]);
    if(e1.second < e2.second) swap(e1, e2);
    for(int i=2; i<A[1].size(); ++i) {
        if(A[1][i] > e1.second) {
            e2 = e1;
            e1 = pp(i, A[1][i]);
        } else if(A[1][i] > e2.second) {
            e2 = pp(i, A[1][i]);
        }
    }

    if(o1.first != e1.first) cout << n - o1.second - e1.second << endl;
    else {
        cout << min(n - o1.second - e2.second, n - o2.second - e1.second) << endl;
    }
}

Measured memory_bytes: 1408
n = int(input())

if 1 <= n <= 9:
    print(n)
elif 10 <= n <= 99:
    print(9)
elif 100 <= n <= 999:
    print(9 + (n - 99))
elif 1000 <= n <= 9999:
    print(909)
elif 10000 <= n <= 99999:
    print(909 + (n - 9999))
else:
    print(90909)

Measured memory_bytes: 3060
input()
d = {}
for i in map(int, input().split()):
    if i in d:
        d[i] += 1
    else:
        d[i] = 1
d = dict(sorted(d.items(), reverse=True))
ans = []
for i, j in d.items():
    if len(ans) < 2 and j >= 4:
        ans.append(i)
        d[i] -= 2
    if len(ans) < 2 and j >= 2:
        ans.append(i)
        d[i] -= 2
    if len(ans) == 2:
        print(ans[0] * ans[1])
        break
else:
    print(0)

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

long long n,i,x,y,j;

int main()
{
    cin>>n;
    for (i=1;i<=3500;i++) 
    for (j=1;j<=3500;j++) 
    {
        x=i;
        y=j;
        if (4*x*y-n*y-n*x>0)
        if (n*x*y%(4*x*y-n*y-n*x)==0) 
        {
            cout<<x<<" "<<y<<" "<<(n*x*y/(4*x*y-n*y-n*x));
            return 0;
            } 
        }
    return 0;
}
 


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
int main()
{
    int N,*H;
    scanf("%d",&N);
    H = (int*)malloc(sizeof(int)*N);
    int i,c = 0,max = 0;
    for(i=0; i<N; i++)
    {
        scanf("%d",&H[i]);
    }
    for(i=1; i<N; i++)
    {
        if(H[i-1]>=H[i]){c++; if(c>max)max = c;}
        else
        {
            c = 0;
        }
    }
    printf("%d\n",max);
    return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
inline int read(){
    int x=0,f=1;char ch=getchar();
    for(;!isdigit(ch);ch=='-'?f=-1:0,ch=getchar());
    for(;isdigit(ch);x=x*10+ch-'0',ch=getchar());
    return x*f;
}
int n,k,a[100005],ans=0x3f3f3f3f;
int main(){
	n=read(),k=read();
	for(int i=1;i<=n;++i)a[i]=read();
	for(int i=1;i<=n-k+1;++i){
		int j=i+k-1;
		if(a[i]>=0)ans=min(ans,a[j]);
		if(a[i]<0&&a[j]>=0)ans=min(ans,min(-a[i]*2+a[j],a[j]*2-a[i]));
		if(a[j]<0)ans=min(ans,-a[i]);
	}
	printf("%d",ans);
} 

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

int a[200000],b[200000];
vector<int>E[200000];
bool used[200000];
int deg[200000];

void dfs(int v){
	used[v]=true;
	for(int u:E[v]){
		if(!used[u])dfs(u);
	}
}
int main(){
	int n;cin>>n;
	map<int,int>mp;
	vector<int>vs;
	int x=0;
	rep(i,n){
		scanf("%d",&a[i]);
		mp[a[i]]++;
		x^=a[i];
		vs.push_back(a[i]);
	}
	a[n]=x;
	mp[x]++;
	vs.push_back(x);
	x=0;
	rep(i,n){
		scanf("%d",&b[i]);
		mp[b[i]]--;
		x^=b[i];
	}
	b[n]=x;
	mp[x]--;
	for(auto p:mp){
		if(p.second){
			puts("-1");return 0;
		}
	}
	map<int,vector<int>>want;
	rep(i,n){
		if(a[i]!=b[i]){
			want[b[i]].push_back(i);
		}
	}
	if(want.empty()){
		puts("0");return 0;
	}
	sort(vs.begin(),vs.end());
	vs.erase(unique(vs.begin(),vs.end()),vs.end());
	int cnt=0;
	rep(i,n+1){
		a[i]=lower_bound(vs.begin(),vs.end(),a[i])-vs.begin();
		b[i]=lower_bound(vs.begin(),vs.end(),b[i])-vs.begin();
		if(i==n||a[i]==b[i])continue;
		cnt++;
		E[b[i]].push_back(a[i]);
		E[a[i]].push_back(b[i]);
		deg[a[i]]++;
		deg[b[i]]++;
	}
	int K=0;
	rep(i,vs.size()){
		if(deg[i]&&!used[i]){
			K++;
			dfs(i);
		}
	}
	if(deg[a[n]]){
		cout<<cnt+K-1<<endl;
	}
	else{
		cout<<cnt+K<<endl;
	}
}

Measured memory_bytes: 28536
def main():
	N = int(input())
	seq = list(map(int, input().split()))
	seq = [seq[i] - i - 1 for i in range(N)]
	se = sorted(list(set(seq)))
	def helper(b):
		return sum([abs(seq[i] - b) for i in range(N)])
	L = 0
	R = len(se)
	while True:
		ind = (L + R) // 2
		temp = helper(se[ind])
		if helper(se[ind - 1]) > temp and temp > helper(se[ind + 1]):
			L = ind
		elif helper(se[ind - 1]) < temp:
			R = ind
		else:
			print(temp)
			return 0
main()

Measured memory_bytes: 26788
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
#define ll  long long
#define endl '\n'
#define pi 3.14159265
//seen soln
int main()
{       
    IOS;
    string s;
    cin>>s;
    ll n=s.length();
    ll arr[4]={0};
    for(ll i=0;i<n;i++)
    {
    	if(s[i]=='N')
    		arr[0]++;
    	if(s[i]=='S')
    		arr[1]++;
		if(s[i]=='E')
		    arr[2]++;
		if(s[i]=='W')
		    arr[3]++;
    }

    ll check=0;
    if(arr[0]!=0&&arr[1]==0)
    	check=1;
    if(arr[0]==0&&arr[1]!=0)
    	check=1;
    if(arr[2]!=0&&arr[3]==0)
    	check=1;
    if(arr[2]==0&&arr[3]!=0)
    	check=1;
    if(check)
    	cout<<"No";
    else
    	cout<<"Yes";
}   

Measured memory_bytes: 256
#include<iostream>
#include<math.h>
#include<iomanip>
#include<vector>
#include<algorithm>
#include<queue>
#include<string>
#include<stdlib.h>
using namespace std;
#define PI 3.14159265358979
typedef unsigned long long ll;
#define rep(i,n) for(int i=0;i<n;i++)
#include<set>
//---------------------------------------------
 
 
int main(void)
{
	ll n,k;
	cin>>n>>k;
	vector<ll> h(n);

	rep(i,n) cin>>h[i];

	sort(h.begin(),h.end(),greater<ll>());

	ll ans=0;
	rep(i,n)
	{
		if(k>0)
		{
			 h[i]=0;
			 k--;
		}
		else ans+=h[i];


	}

	cout<<ans<<endl;
}

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

#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)

using namespace std;

typedef long long ll;

#define MAX 600000

struct Data {
  ll a,b;
  bool operator < ( const Data &data ) const {
    if( a != data.a ) return a < data.a;
    return b < data.b;
  }
};

int N;
Data arr[MAX];
ll sum[MAX];

int main() {
  cin >> N;
  rep(i,N) cin >> arr[i].a >> arr[i].b;
  sort(arr,arr+N);
  sum[0] = arr[0].b;
  REP(i,1,N) sum[i] = sum[i-1] + arr[i].b;
  ll maxi = arr[0].b;
  ll mini = -arr[0].a;
  REP(i,1,N) {
    mini = min(mini,sum[i-1]-arr[i].a);
    ll score = sum[i] - arr[i].a - mini;
    maxi = max(maxi,score);
  }
  cout << maxi << endl;
  return 0;
}



Measured memory_bytes: 14880
#include<bits/stdc++.h>
using namespace std;
int main() 
{
    long long int n;
    cin>>n;
    long long int a[n];
    for(long long int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    long long int f=0;
    for(long long int i=1;i<n;i++)
    {
        f=f^a[i];
    }
    long long int fa[n];
    fa[0]=f;
    for(long long int i=1;i<n;i++)
    {
        long long int temp=a[i]^a[i-1];
        fa[i]=fa[i-1]^temp;
    }
    for(long long int i=0;i<n;i++)
    {
        cout<<fa[i]<<" ";
    }
return 0;
}


Measured memory_bytes: 6744
//Date : 16 - 06 - 18  //Author : Rishabh Paul

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

int main() {
	int a ,b;
	cin >> a >> b;
	if(max(a ,b) <= 8)	cout << "Yay!";
	else cout << ":(";
	return 0;
}

 // int main() {
 // 	int d ,n;
 // 	cin >> d >> n;
 // 	int ans;
 // 	if(d == 0)	ans = 1;
 // 	else if(d == 1)	ans = 100;
 // 	else ans = 10000;
 // 	ans *= n;
 // 	cout << ans;
 // 	return 0;
 // }

// int main() {
// 	int n ,ans = 0 ,x;
// 	cin >> n;
// 	while(n--) {
// 		cin >> x;
// 		while(x % 2 == 0 && x)	ans++ ,x /= 2;
// 	}
// 	cout << ans;
// 	return 0;
// }

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

// 	return 0;
// }

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

int main()
{
    int i, n, m, x, y, flag;

    cin >> n >> m;

    bool used[n+1];
    vector <int> adj[n+1];
    int parent[n+1];
    queue <int> q;

    memset(used, 0, sizeof(used));
    used[0]=1;
    for(i=0; i<=n; i+=1)
        parent[i]=i;
    for(i=0; i<m; i+=1)
    {
        cin >> x >> y;
        adj[x].push_back(y);
        adj[y].push_back(x);
    }

    x=1;
    used[x]=1;
    q.push(x);

    while(!q.empty())
    {
        x=q.front();
        q.pop();

        for(auto y: adj[x])
        {
            if(!used[y])
            {
                used[y]=1;
                parent[y]=x;
                q.push(y);
            }
        }
    }

    flag=1;
    for(i=2; i<=n; i+=1)
    {
        if(parent[i]==i)
        {
            flag=0;
            break;
        }
    }

    if(flag==0)
        cout << "No" << endl;
    else
    {
        cout << "Yes" << endl;
        for(i=2; i<=n; i+=1)
            cout << parent[i] << endl;
    }

}

Measured memory_bytes: 10512
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int max, min;
    int64_t sum;
        max = -1000000;
    min = 1000000;
    sum = 0;
    int N;
        cin >> N;
    for (int i = 0; i < N; i++){
        int a;
            cin >> a;
        if (a > max)
            max = a;
        if (a < min)
            min = a;
        sum += a;
    }
    cout << min << " " << max << " " << sum << endl;
}



Measured memory_bytes: 3092
import kotlin.math.abs

fun main() {
    val builder = StringBuilder()

    val (a, v) = readInputLine().split(" ").map { it.toLong() }
    val (b, w) = readInputLine().split(" ").map { it.toLong() }
    val t = readInputLine().toLong()

    if (w >= v) {
        builder.appendln("NO")
    } else {
        if ((abs(a - b) + (v - w) - 1L) / (v - w) <= t) {
            builder.appendln("YES")
        } else {
            builder.appendln("NO")
        }
    }

    print(builder.toString())
}

fun readInputLine(): String {
    return readLine()!!
}


Measured memory_bytes: 36440
n = int(input())
pre = list(map(int,input().split()))
ino = list(map(int,input().split()))

post=[]
i = -1
def reconstruction(l, r):
    global i
    if l >= r:
        return
    i += 1
    c = pre[i]
    m = ino.index(c)
    reconstruction(l, m)
    reconstruction(m+1, r)
    post.append(c)
reconstruction(0, n)
print(" ".join(map(str,post)))

Measured memory_bytes: 7652
#!/usr/bin/python
import sys
if sys.version_info[0]>=3: raw_input=input

def M(l,r):
	if l+1>=r: return 0
	if l+2==r:
		if A[l]<=A[l+1]: return 0
		A[l],A[l+1]=A[l+1],A[l]
		return 1
	m = (l+r)//2
	i=l
	j=m
	k=l
	cl=M(l,m)
	cr=M(m,r)
	c=0
	while i<m and j<r:
		if A[i]<=A[j]:
			W[k]=A[i]
			k+=1
			i+=1
		else:
			W[k]=A[j]
			k+=1
			j+=1
			c+=m-i
	while i<m:
		W[k]=A[i]
		k+=1
		i+=1
	while j<r:
		W[k]=A[j]
		k+=1
		j+=1
	for i in range(l,r): A[i]=W[i]
	return cl+cr+c

raw_input()
A=list(map(int,raw_input().split()))
W=[0]*len(A)
print(M(0,len(A)))



Measured memory_bytes: 27704
#include<stdio.h>

int main(){
	int N;
	int A[100];
	int i;
	double sum;

	scanf("%d",&N);
	for (i=0;i<N;i++){
	 	scanf("%d",&A[i]);
		sum += 1.0/A[i];
	}
	printf("%lf\n",1.0/sum);
	return 0;
}

Measured memory_bytes: 128
#include <stdio.h>
int main ()
{
  int H, W, i, j;
  while(1){
        scanf("%d %d",&H, &W);
	if( H == 0 && W ==0)break;
    for(i=0;i<H;i++){
      for(j=0;j<W;j++){
	if( i==0 || i==H-1  ){
	  printf("#");
	}
	else if( j == 0 || j == W-1){
	  printf("#");
	}
	else {
	  printf(".");
	}
      }
      
      printf("\n");
    }
    printf("\n");
  }
  return 0;
}

Measured memory_bytes: 572
package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)
	m := make(map[int]int)
	var a int
	for i := 0; i < n; i++ {
		fmt.Scan(&a)
		m[a]++
		if m[a] > 1 {
			fmt.Println("NO")
			return
		}
	}
	fmt.Println("YES")
}


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

int main() {
    int a, b;
    int d;
    int r;
    double f;

    cin >> a >> b;

    d = a / b;
    r = a % b;
    f = (double)a / (double)b;
    printf("%d %d %f\n", d, r, f);
}



Measured memory_bytes: 3152
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <iostream>
#include <memory.h>
#include <math.h>
#include <assert.h>
#include <queue>
#include <map>
#include <set>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> Pi;
typedef pair<ll,ll> Pll;

#define Fi first
#define Se second
#define pb(x) push_back(x)
#define sz(x) (int)x.size()
#define rep(i, n) for(int i=0;i<n;i++)
#define repp(i, n) for(int i=1;i<=n;i++)
#define all(x) x.begin(), x.end()

#define ABS(x) (((x) > 0 ) ? (x) : (-(x)))
#define MAX2(x, y) (((x) > (y)) ? (x) : (y))
#define MIN2(x, y) (((x) < (y)) ? (x) : (y))

#define MAX3(x, y, z) ( (x) > (y)  ? ( (x) > (z) ? (x) : (z)  ) : ( (y) > (z) ? (y) : (z) )  )
#define MIN3(x, y, z) ( (x) < (y)  ? ( (x) < (z) ? (x) : (z)  ) : ( (y) < (z) ? (y) : (z) )  )
#define MID3(val1,val2,val3) MAX2(MIN2(MAX2(val1,val2),val3),MIN2(val1,val2))

#define geti1(X) scanf("%d",&X)
#define geti2(X,Y) scanf("%d%d",&X,&Y)
#define geti3(X,Y,Z) scanf("%d%d%d",&X,&Y,&Z)
#define geti4(X,Y,Z,W) scanf("%d%d%d%d",&X,&Y,&Z,&W)

#define GET_MACRO(_1,_2,_3,_4,NAME,...) NAME
#define geti(...) GET_MACRO(__VA_ARGS__, geti4, geti3, geti2, geti1) (__VA_ARGS__)

#define INF 987654321
#define IINF 987654321987654321
#define MAXV 200500

#define MOD 1000000007
int N,M,K,T;

int main(){
	ll n,a,b; cin >> n >> a >> b;
	ll mn = a*(n-1)+b;
	ll mx = a+b*(n-1);
	cout << max(0LL,mx-mn+1);
}

Measured memory_bytes: 256
from bisect import bisect_left
N = int(input())
a = list(map(int,input().split()))
a.sort()
x = a[-1]
i = bisect_left(a, x/2, hi=N-2)
for j in [i-1, i, i+1]:
    if 0 <= j < N and abs(a[j]-x/2) < abs(a[i]-x/2):
        i = j
print(x, a[i])

Measured memory_bytes: 20096
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
#define int long long 
int F[2100010];

int Mul(int a, int b) {
	return ((a % mod) * (b % mod)) % mod;
}

void fact(void) {
	F[0] = 1;
	F[1] = 1;
	for (int i = 2; i <= 2100000; i++) {
		F[i] = Mul(i, F[i - 1]);
	}
}
int square(int x) {
	return (x * x) % mod;
}

int power(int x, int y) {
	if (y == 0) return 1;
	else if (y == 1) return x % mod;
	else if (y % 2 == 0) return square(power(x, y / 2)) % mod;
	else return square(power(x, y / 2)) * x % mod;
}

int Div(int a, int b) {
	return Mul(a, power(b, mod - 2));
}
int P(int n, int r) {
	if (n < r || n < 0 || r < 0) return 0;
	return Div(F[n], F[n - r]);
}

int C(int n, int r) {
	if (n < r || n < 0 || r < 0) return 0;
	int ret;
	ret = Div(F[n], Mul(F[n - r], F[r]));
	return ret;
}
int H(int n, int r) {
	if (n == 0 && r == 0) return 1;
	return C(n + r - 1, r);
}


signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N; cin >> N;
    fact();
    string S; cin >> S;
    vector<int> v;
    rep(i, N * 2) {
        if (i % 2 == 0 && S[i] == 'B') v.push_back(0);
        if (i % 2 == 0 && S[i] == 'W') v.push_back(1);
        if (i % 2 == 1 && S[i] == 'B') v.push_back(1);
        if (i % 2 == 1 && S[i] == 'W') v.push_back(0);   
    }
    // rep(i, N * 2) cout << v[i];
    // cout << endl;
    int ans = 1;
    int cnt = 0;
    RREP(i, N * 2 - 1, 0) {
        if (v[i] == 1) cnt++;
        else {
            ans = Mul(ans + mod, cnt + mod);
            cnt--;
        }
        if (ans == 0) break;
    }
    if(cnt > 0) cout << 0 << endl;
    else cout << Mul(ans, F[N]) << endl;

    return 0;
}


Measured memory_bytes: 19084
#include<stdio.h>
#include<stdlib.h>
#define MAX 500001
 
typedef struct cell{
 int id;
 struct cell *right;
 struct cell *left;
}cell;
 
 
void preorder(cell *root){
cell *p=root;
printf(" %d",p->id);
 
if(p->left!=NULL){preorder(p->left);}
if(p->right!=NULL){preorder(p->right);}
 
return;
}
 
void inorder(cell *root){
cell *p=root;
if(p->left!=NULL){inorder(p->left);}
printf(" %d",p->id);
if(p->right!=NULL){inorder(p->right);}
 
return;
}
 
 
cell* makecell(int x){
cell *new=malloc(sizeof(cell));
new->id=x;
new->left=NULL;
new->right=NULL;
 
return new;
}
 
void insert(cell **p,cell *new){
 
cell *temp;
 
if((*p)==NULL){(*p)=new;return;}
else{
 
 if( (*p)->left==NULL && (*p)->right==NULL ){/*子なし*/
   if((*p)->id < new->id){
     (*p)->right=new;return;}
   else{
     (*p)->left=new;return;}
  }
  else if((*p)->left==NULL&&(*p)->right!=NULL){/*左なし右あり*/
   if( (*p)->id > new->id ){
     (*p)->left=new;return;}
   else{insert(&((*p)->right),new);}
  }
  else if((*p)->left!=NULL&&(*p)->right==NULL){/*左あり右なし*/
   if( (*p)->id < new->id){
     (*p)->right=new;return;}
   else{insert(&((*p)->left),new);}
  }
  else{/*どっちも子あり*/
   if((*p)->id < new->id){
     insert(&((*p)->right),new);
   }
   else{insert(&((*p)->left),new);}
 }
}
 
return;
}
      
 
 
int find(cell *root,int x){
cell *p=root;
 
while(p!=NULL){
 if(p->id==x){return 1;}
 else if(p->id <x){p=p->right;}
 else{p=p->left;}
}
 
return 2;
}
 
 


cell* off(cell *q){
cell *temp;
cell **r;
  if(q->right==NULL&&q->left==NULL){/*子なし*/
   free(q);
   return NULL;}

  else if(q->right!=NULL&&q->left==NULL){/*右に子あり*/
     temp=q->right;
     free(q);
     return temp;}

  else if(q->right==NULL&&q->left!=NULL){/*左に子あり*/
     temp=q->left;
     free(q);
     return temp;}

  else{/*両方あり*/
    r=&(q->right);
    temp=*r;
    while(temp->left!=NULL){
     r=&(temp->left); temp=*r;
    }
    q->id=temp->id;
    *r=off(temp);
  }
return q;

}


void delete(cell **p,int x){
cell **r=p;
cell *q=*r;

while(q!=NULL){
 if(q->id==x){
  *r=off(q);
  return;
 }
 else if(q->id <x){r=&(q->right);}
 else{r=&(q->left);}
 q=*r;
}

return;
}








 
 
 
 
 
int main(){
int n,i,x,j,k;
char com[7];
cell *root=NULL;
cell *new;
int F[MAX]={0};
 
scanf("%d",&n);
 
 
for(i=0;i<n;i++){
 scanf("%s",com);
 
 switch(com[0]){
  case 'i':scanf("%d",&x);
           new=makecell(x);
           insert(&root,new);
           break;
 
  case 'p':inorder(root);
           printf("\n");
           preorder(root);
           printf("\n");
           break;
 
  case 'f':scanf("%d",&x);
           F[i]=find(root,x);
           if(F[i]==1){printf("yes\n");}
           else if(F[i]==2){printf("no\n");}
           break;

  case 'd':scanf("%d",&x);
           delete(&root,x);
           break;


 }/*switch end*/
 
}/*for end*/
 
 
 
 
return 0;
}



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

int main(void){
    int a, b, res;
    
    cin >> a >> b;
    
    if(a+b > a-b){
        if(a+b > a*b){
            res = a+b;
        } else {
            res = a*b;
        }
    } else {
        if(a-b > a*b){
            res = a-b;
        } else {
            res = a*b;
        }
    }
    
    cout << res << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <string>
#include <iomanip>
#include <map>
#include <set>
#include <cmath>
#include <cstdio>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define All(v) (v).begin(),(v).end()
typedef long long ll;

int main(){
    int n;cin >> n;
    vector<int> a(n);
    rep(i,n)cin >> a[i];
    vector<int> res(n);
    if(n%2==0){
        int suf = n/2;
        for(int i=0;0<=suf&&suf<n;i++){
            res[suf]=a[i];
            if(i%2==0){suf-=(i+1);}
            else{suf+=(i+1);}
        }
    }if(n%2==1){
        int suf = n/2;
        for(int i=0;0<=suf&&suf<n;i++){
            res[suf]=a[i];
            if(i%2==0){suf+=(i+1);}
            else{suf-=(i+1);}
        }
    }

    rep(i,n)cout << res[i] << " ";
    cout << endl;
    return 0;
}

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

int main() {
    int n;cin>>n;
    int a[n];
    for (int i=0;i<n;i++)
        cin>>a[i];
    int b[n]{};
    vector<int> ans;
    for (int i=n-1;i>=0;i--) {
        int c=0;
        for (int j=i+i+1;j<n;j+=i+1)
            c^=b[j];
        b[i]=a[i]^c;
        if (b[i])
            ans.push_back(i+1);
    }
    int m=ans.size();
    cout<<m<<endl;
    for (int i=m-1;i>=0;i--) {
        if (i!=m-1)
            cout<<' ';
        cout<<ans[i];
    }
    return 0;
}

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

#define min(a,b) (((a)<(b))?(a):(b))
#define max(a,b) (((a)>(b))?(a):(b))
#define abs(a) (((a)>0)?(a):(-a))

int main()
{
	int n;
	char s[300030];
	int count = 0, ans = 500000;

	scanf("%d %s", &n, s);
	for (int i = 0; i < n; i++)
	{
		if (s[i] == 'E')
        {
          count++;
        }
	}
	for (int i = 0; i < n; i++)
	{
		if (s[i] == 'E')
		{
			count--;
		}
		if (s[i-1] == 'W')
		{
			count++;
		}
		ans = min(ans, count);
	}
	printf("%d", ans);
	return 0;
}

Measured memory_bytes: 512
#include <cstdio>
#include <algorithm>
#include <vector>
#define repi(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define all(a) (a).begin(), (a).end()

int N;
int P[200010];

int main()
{
  scanf( "%d", &N );
  rep( i, N )
    scanf( "%d", P+i );

  int mi = 1<<30, ans = 0;
  rep( i, N )
  {
    if( P[i] <= mi )
    {
      ++ans;
      mi = P[i];
    }
  }

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

  return 0;
}

Measured memory_bytes: 1024
from collections import Counter
from math import factorial


def factorization(n):
    arr = Counter()
    temp = n
    for i in range(2, int(-(-n**0.5 // 1)) + 1):
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            arr[i] = cnt

    if temp != 1:
        arr[temp] = 1

    if len(arr.keys()) == 0:
        arr[n] = 1

    return arr


N = int(input())

primes = Counter()

for i in range(2, N + 1):
    tp = factorization(i)
    primes += tp


V = list(primes.values())


def num(n):
    return len(list(filter(lambda x: x >= n, V)))


print(num(74) + num(24) * (num(2) - 1) + num(14) * (num(4) - 1) + num(4) * (num(4) - 1) * (num(2) - 2) // 2)


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

using namespace std;

const int N = 1e5 + 123;
int n, m, kol[N];

int main(){
	cin >> n >> m;
	for(int i = 1; i <= m; i++){
		int l, r;
		cin >> l >> r;
		kol[l]++;
		kol[r]++;
	}
	for(int i = 1; i <= n; i++){
		if(kol[i] % 2 == 1){
			cout << "NO";
			exit(0);
		}
	}
	cout << "YES";
}

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

using namespace std;
typedef long long int ll;
typedef pair<int, int> ii;
#define DEBUG freopen("in.txt", "r", stdin);

struct fastio {
    fastio() {
        ios::sync_with_stdio(false);
        cout << setprecision(10) << fixed;
        cin.tie(0);
    }
};

fastio _fast_io;

string s;
bool d[26];
int main() {
    cin >> s;
    int n = s.length();
    for (int i = 0; i < n; ++i) {
        int o = s[i] - 'a';
        d[o] = true;
    }
    for (int i = 0; i < 26; ++i) {
        if (!d[i]) {
            cout << char('a' + i) << endl;
            exit(0);
        }
    }
    cout << "None" << endl;
    return 0;
}


Measured memory_bytes: 3684
# https://atcoder.jp/contests/abc065/tasks/arc076_a

def mod_fact(n, mod)
  (1..n).reduce(1) { |a, e| a * e % mod }
end

MOD = 10**9+7

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

d = (N - M).abs

if d > 1
  puts 0
  exit 0
end

ans = mod_fact(N, MOD)
ans = ans * mod_fact(M, MOD) % MOD
ans = ans * 2 % MOD if d.zero?

puts ans


Measured memory_bytes: 1788
r1,c1,r2,c2=map(int,input().split())
MOD=10**9+7
idx=r2+c2+2
perm=[1]*(idx+1)
perm_inv=[1]*(idx+1)
for i in range(1,idx+1):
    perm[i]=perm[i-1]*i
    perm[i]%=MOD
def inv_mod(a):
  return pow(a,MOD-2,MOD)
perm_inv[-1]=inv_mod(perm[-1])
for i in range(idx-1,-1,-1):
    perm_inv[i]=perm_inv[i+1]*(i+1)
    perm_inv[i]%=MOD
def comb(i,j):
    buf=perm[i+j+2]
    buf*=perm_inv[i+1]
    buf%=MOD
    buf*=perm_inv[j+1]
    buf%=MOD
    return buf
res=comb(r2,c2)
res-=comb(r2,c1-1)
res-=comb(r1-1,c2)
res+=comb(r1-1,c1-1)
print(res%MOD)


Measured memory_bytes: 71404
A, B = map(int, input().split())
S = input()

isCorrect = True
for i, c in enumerate(S):
    if (i<A or i>A):
        if not c.isdigit():
            isCorrect = False
            break
    elif c != "-":
        isCorrect = False
        break

print("Yes" if isCorrect else "No")

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
 
#define MOD 1000000007
#define INF 100000000
#define MAX 100001
//#define int ll
#define ll long long
#define ld long double
#define vi vector<int>
#define pa pair<ll, ll>
#define pb push_back
#define mp make_pair
 
#define INIT ios::sync_with_stdio(false);cin.tie(0);
#define VAR(type, ...)type __VA_ARGS__;MACRO_VAR_Scan(__VA_ARGS__);
template<typename T> void MACRO_VAR_Scan(T& t) { cin >> t; }
template<typename First, typename...Rest>void MACRO_VAR_Scan(First& first, Rest&...rest) { cin >> first; MACRO_VAR_Scan(rest...); }
#define VEC(type, c, n) vector<type> c(n);for(auto& i:c)cin>>i;
#define MAT(type, c, m, n) vector<vector<type>> c(m, vector<type>(n));for(auto& r:c)for(auto& i:r)cin>>i;
 
#define BR cout << "\n";
#define SP cout << " ";
#define ENDL cout<<endl;
#define OUT(d) cout<<(d);
#define OUTL(d) cout<<(d)<< "\n";
#define YES OUTL("YES")
#define Yes OUTL("Yes")
#define NO OUTL("NO")
#define No OUTL("No")
#define RET return 0;
 
#define REP(i, n) for(int i=0;i<(n);i++)
#define RREP(i, n) for(int i=n-1;i>=0;--i)
#define FOR(i, m, n) for(int i = m;i < n; i++)
#define RFOR(i, a, b) for(int i=(a)-1;i>=(b);--i)
#define AREP(a, n) for(auto (a):(n))
#define ALL(a) (a).begin(),(a).end()
#define IN(n, a, b) ((a)<=(n)&&(n)<(b))

signed main(){ INIT;
    VAR(int, n);
    OUTL(n/3);
RET;}


Measured memory_bytes: 256
/// Containers Start
#include <algorithm>
#include <bitset>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
/// C Header Files
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <math.h>
#include <stdio.h>
/// Containers End

using namespace std;

/// Math Start
#define PI acos(-1.0)
#define Pi 3.141592653589793
#define EPS (1e-7)
#define INF (0x3f3f3f3f)
/// Math End

/// Extra Start
#define nn '\n'
#define pb push_back
#define ull unsigned long long
#define ll long long
#define MOD 1000000007
#define sz(a) int((a).size())
#define space " "
#define All(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
/// Extra End

#define rep(i, n) for (int i = 0; i < n; i++)
#define Cini(a)                                                                \
    int a;                                                                     \
    cin >> a;
#define Cinii(a, b)                                                            \
    int a, b;                                                                  \
    cin >> a >> b;
#define Ciniii(a, b, c)                                                        \
    int a, b, c;                                                               \
    cin >> a >> b >> c;
#define Cins(s)                                                                \
    string s;                                                                  \
    cin >> s;
#define Cinss(s1, s2)                                                          \
    string s1, s2;                                                             \
    cin >> s1 >> s2;
#define Cinc(c)                                                                \
    char c;                                                                    \
    cin >> c;
/// Functions End


/// Debug Start
#define deb(x) cout << #x << ": " << x << endl
#define deb2(x, y) cout << #x << ": " << x << '\t' << #y << ": " << y << endl;
#define deb3(x, y, z)                                                          \
    cout << #x << ": " << x << '\t' << #y << ": " << y << '\t' << #z << ": "   \
         << z << endl;
/// Debug End

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

/**>>>>>>>>>>>>>>>>>>> END <<<<<<<<<<<<<<<<<<**/

/// template

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

signed main(void) {
    cin.sync_with_stdio(false);
    cin.tie(0);
    ll A,B;
    cin >> A >> B;
    cout << lcd(A,B) << nn;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <limits>
#include <math.h>
#define REP(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define RREP(i,n) for(ll i=(n)-1; i>=0; --i)
#define SREP(i,s,n) for(ll i=(s), i##_len=(n); i<i##_len; ++i)


using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;

template <typename T>
T gcd(T a, T b) {
    if(a < b) gcd(b, a);
    if (b == 1) return 1;
    T r;
    while ((r=a%b)) {
        a = b;
        b = r;
    }
    return b;
}

bool comp(pair<ll, ll> a, pair<ll, ll> b) {
    return (a.first*a.first + a.second*a.second) > (b.first*b.first + b.second*b.second);
}

struct UnionFind {
    vector<int> par;
    vector<int> rank;
    
    UnionFind(int n = 1) {
        init(n);
    }
    
    void init(int n = 1) {
        par.resize(n); rank.resize(n);
        for (int i = 0; i < n; ++i) {
            par[i] = i;
            rank[i] = 0;
        }
    }
    
    int root(int x) {
        if (par[x] == x) {
            return x;
        }
        else {
            int r = root(par[x]);
            return par[x] = r;
        }
    }
    
    bool issame(int x, int y) {
        return root(x) == root(y);
    }
    
    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (rank[x] < rank[y]) swap(x, y);
        if (rank[x] == rank[y]) ++rank[x];
        par[y] = x;
        return true;
    }
};

#define MOD (1000000007)

int main(int argc, const char * argv[]) {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    ll N, M, L;
    cin >> N >> M >> L;
    
    vector<vector<ll>> D(N+1, vector<ll>(N+1, 1e10));
    
    REP(i, M) {
        int A, B, C;
        cin >> A >> B >> C;
        D[A][B] = C;
        D[B][A] = C;
    }
    
    SREP(k, 1, N+1) {
        SREP(i,1, N+1) {
            SREP(j,1, N+1) {
                D[i][j] = min(D[i][j], D[i][k]+D[k][j]);
            }
        }
    }
    
    SREP(i,1, N+1) {
        SREP(j,1, N+1) {
            if (D[i][j] > L) D[i][j] = 1e10;
            else D[i][j] = 1;
        }
    }
    
    SREP(k, 1, N+1) {
        SREP(i,1, N+1) {
            SREP(j,1, N+1) {
                D[i][j] = min(D[i][j], D[i][k]+D[k][j]);
            }
        }
    }
    
    
    ll Q;
    cin >> Q;
    REP(i, Q) {
        int s, t;
        cin >> s >> t;
        cout << (D[s][t]%ll(1e10))-1 << endl;
    }
    
}


Measured memory_bytes: 1280