akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#define NIL -1

struct Node {
    int parent, left, right;
};

Node *T;
int *D, *H; // depth, height

void setDepth(int u, int depth) {
    D[u] = depth;
    if (T[u].left != NIL) { setDepth (T[u].left, depth+1); }
    if (T[u].right != NIL) { setDepth (T[u].right, depth+1); }
}

int setHeight(int u) {
    int h1 = 0, h2 = 0;
    if (T[u].left != NIL) {
        h1 = setHeight(T[u].left) + 1;
    }
    if (T[u].right != NIL) {
        h2 = setHeight(T[u].right) + 1;
    }
    return H[u] = (h1 > h2 ? h1 : h2);
}

int getSibling(int u) {
    if (T[u].parent == NIL) {
        return NIL;
    } else if (T[T[u].parent].left != u && T[T[u].parent].left != NIL) {
        return T[T[u].parent].left;
    } else if (T[T[u].parent].right != u && T[T[u].parent].right != NIL) {
        return T[T[u].parent].right;
    } else {
        return NIL;
    }
}

void print(int n) {
    for (int i = 0; i < n; i++) {
        printf("node %d: ", i);
        printf("parent = %d, ", T[i].parent);
        printf("sibling = %d, ", getSibling(i)); 
        printf("degree = %d, ", (T[i].left != NIL) + (T[i].right != NIL));
        printf("depth = %d, ", D[i]);
        printf("height = %d, ", H[i]);

        if (T[i].parent == NIL) {
            printf("root\n");
        } else if (T[i].left == NIL && T[i].right == NIL) {
            printf("leaf\n");
        } else {
            printf("internal node\n");
        }
    }
}

int main() {
    int n;
    scanf("%d", &n);

    T = new Node[n];
    D = new int[n];
    H = new int[n];

    // initialize tree
    for (int i = 0; i < n; i++) {
        T[i].parent = T[i].left = T[i].right = NIL;
    }

    for (int i = 0; i < n; i++) {
        int v, left, right;
        scanf("%d %d %d", &v, &left, &right);
        T[v].left = left;
        T[v].right = right;
        if (left != NIL) { T[left].parent = v; }
        if (right != NIL) { T[right].parent = v; }
    }

    int root;
    for (int i = 0; i < n; i++) {
        if (T[i].parent == NIL) {
            root = i;
            break;
        }
    }
    setDepth(root, 0);
    setHeight(root);
    print(n);
    return 0;
}


Measured memory_bytes: 2756
import java.util.Scanner;


public class Main {


	public static void main(String[] args) {

		long ans = 0;
//		double ans = 0.0;
//		int ans = 0;
//		String ans = "";

		Scanner sc = new Scanner(System.in);
//		double waru = 1000000007;


//		long k = sc.nextLong();
//		long m = sc.nextLong();
//		long n = sc.nextLong();

		int n = sc.nextInt();
		int h = sc.nextInt();
		int k = sc.nextInt();
//		String s = sc.next();


//		String string = sc.next();

//		StringBuilder s = new StringBuilder(string);

//		String[] strArray = string.split("");

		boolean f = false;

//		String[] s = new String[n];

//		int[] a = new int[n];
//		int[] b = new int[n];
//		int[][] a = new int[n][m];

//		long[] p = new long[a];
//		long[] q = new long[b];
//		long[] r = new long[c];

//		ArrayList<Long> list = new ArrayList<>();

//		for (int i = 0; i < n; i++) {
//			a[i]= sc.nextInt();
//		}


//		for (int i = 0; i < h; i++) {
//			for(int j = 0; j < w; j++) {
//				a[i][j] = sc.nextInt();
//			}
//		}








		System.out.println(k);
		System.out.println(n);
		System.out.println(h);

		sc.close();
	}
}

Measured memory_bytes: 24276
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <utility>
#include <stack>
#include <vector>
#include <queue>
#include <algorithm>
#include <map>
#include <climits>
#include <set>
#include <cmath>
#include <numeric>
#include <iomanip>

using namespace std;
pair <pair <int, int>, pair<int, int> > cut(pair<int, int> piece, int s){
  int w = piece.first;
  int d = piece.second;
  s = s % (2 * w + 2 * d);
  if(s <= w){
    int width1 = s;
    int width2 = w - s;
    if(width1 > width2){
      return make_pair(make_pair(width2, d), make_pair(width1, d));
    } else {
      return make_pair(make_pair(width1, d), make_pair(width2, d));
    }
  } else if (s <= w + d){
    int depth1 = s - w;
    int depth2 = d - (depth1);
    if(depth1 > depth2){
      return make_pair(make_pair(w, depth2), make_pair(w, depth1));
    } else {
      return make_pair(make_pair(w, depth1), make_pair(w, depth2));
    }
  } else if(s <= 2 * w + d){
    int width1 = s - (w + d);
    int width2 = w - width1;
    if(width1 > width2){
      return make_pair(make_pair(width2, d), make_pair(width1, d));
    } else {
      return make_pair(make_pair(width1, d), make_pair(width2, d));
    }
  } else {
    int depth1 = s - (2 * w + d);
    int depth2 = d - (depth1);
    if(depth1 > depth2){
      return make_pair(make_pair(w, depth2), make_pair(w, depth1));
    } else {
      return make_pair(make_pair(w, depth1), make_pair(w, depth2));
    }
  }
}
int main(void){
  while(true){
    int n;
    int w;
    int d;
    cin >> n >> w >> d;
    if(n == 0 && w == 0 && d == 0){
      break;
    }

    vector <pair<int, int> > pieces;
    pieces.push_back(make_pair(w, d));
    for(int i = 0; i < n; i++){
      int p;
      int s;
      cin >> p >> s;
      pair <int, int> cut_piece = pieces[(p - 1)];
      pieces.erase(pieces.begin() + (p - 1));
      pair<pair<int, int>, pair<int, int> > tmp = cut(cut_piece, s);
      //cout << cut_piece.first << " " << cut_piece.second << " " << s << endl;
      //cout << tmp.first.first << " " << tmp.first.second << " " << tmp.second.first << " " << tmp.second.second << endl;
      pieces.push_back(tmp.first);
      pieces.push_back(tmp.second);
    }

    vector <int> piece_sizes;
    for(int i = 0; i < pieces.size(); i++){
      piece_sizes.push_back(pieces[i].first * pieces[i].second);
    }
    sort(piece_sizes.begin(), piece_sizes.end());
    for(int i = 0; i < piece_sizes.size(); i++){
      if(i != piece_sizes.size() - 1){
        cout << piece_sizes[i] << " ";
      } else {
        cout << piece_sizes[i] << endl;
      }
    }
  }
  return 0;
}



Measured memory_bytes: 3124
#define DEB
#include<bits/stdc++.h>
#define REP(i,m) for(int i=0;i<(m);++i)
#define REPN(i,m,in) for(int i=(in);i<(m);++i)
#define ALL(t) (t).begin(),(t).end()
#define CLR(a) memset((a),0,sizeof(a))
#define pb push_back
#define mp make_pair
#define fr first
#define sc second

using namespace std;


#ifdef DEB
#define dump(x)  cerr << #x << " = " << (x) << endl
#define prl cerr<<"called:"<< __LINE__<<endl
#define dumpR(x) cerr<<"\x1b[31m"<<#x<<" = " <<(x)<<"\x1b[39m"<<endl
#define dumpY(x) cerr<<"\x1b[33m"<<#x<<" = " <<(x)<<"\x1b[39m"<<endl
#define dumpG(x) cerr<<"\x1b[32m"<<#x<<" = " <<(x)<<"\x1b[39m"<<endl
template<class T> void debug(T a,T b){ for(;a!=b;++a) cerr<<*a<<' ';cerr<<endl;}
#else
#define dump(x) ;
#define dumpR(x) ;
#define dumpY(x) ;
#define dumpG(x) ;
#define prl ;
template<class T> void debug(T a,T b){ ;}
#endif

template<class T> void chmin(T& a,const T& b) { if(a>b) a=b; }
template<class T> void chmax(T& a,const T& b) { if(a<b) a=b; }

typedef long long int lint;
typedef pair<lint,lint> pi;

namespace std{
  template<class S,class T>
  ostream &operator <<(ostream& out,const pair<S,T>& a){
    out<<'('<<a.fr<<','<<a.sc<<')';
    return out;
  }
}

const lint INF=1e18;


struct max_handler_with_index{
  typedef pi node;
  max_handler_with_index(){}
  static node def_node() { return mp(-INF,-INF);}
  static node merge(const node& a,const node& b){
    return max(a,b);
  }
};

int nsum[35];
int n,V,K,m;

int dp[1<<20];
int ar[200005],dif[200005];

int d2[20];
int nxt[20][200005];
pi range[200005];


int br[200005],n2;
bool solve(){
  REP(i,n2-1) dif[i]=br[i+1]-br[i];

  REP(i,K){
    for(int j=n2-1;j>=0;--j){
      if(j==n2-1) nxt[i][j]=n2;
      else if(dif[j]<=d2[i]) nxt[i][j]=nxt[i][j+1];
      else nxt[i][j]=j+1;
    }
  }
  memset(dp,-1,sizeof(dp));
  dp[0]=0;
  REP(bit,1<<K) if(dp[bit]>=0){
    if(dp[bit]>=n2) return true;
    REP(i,K) if(!(bit>>i&1)){
      chmax(dp[bit|(1<<i)],nxt[i][dp[bit]]);
    }
  }
  return false;
}
int main(){
  cin>>n>>V;
  d2[0]=V;
  K=19;
  REP(i,K) d2[i+1]=d2[i]/2;
  while(d2[K-1]==0) --K;
  assert(d2[K-1]==1);
  ++K;
  reverse(d2,d2+K);
  --K;
  REP(i,n) scanf("%d",&ar[i]);


  REP(i,n){
    int l=i,r=i;
    while(r<n-1 && ar[r+1]-ar[r]<=V){
      ++r;
    }
    range[m++]={l,r};
    i=r;
  }
  if(m>=20){
    REP(i,n) puts("Impossible");
    return 0;
  }


  REP(i,m){
    n2=0;
    REP(j,n) if(j<range[i].fr || range[i].sc<j) br[n2++]=ar[j];

    int len=range[i].sc-range[i].fr+1;
    bool res=solve();
    REP(hoge,len) puts(res?"Possible":"Impossible");
  }
  return 0;
}





Measured memory_bytes: 26368
#include <iostream>
using namespace std;
int main(){
  int a,b,c;
  cin>>a>>b;
 
  if(a<b){c=b;b=a;a=c;}
 
  while(b){c=a%b;a=b;b=c;}

  cout <<a<<endl;
   
  return 0;
}

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



int main(void){
    int N;
    cin>>N;
    bool flag=false;
    for(int i=0;i<=25;i++){
        for(int j=0;j<=14;j++){
            if(4*i+7*j==N){
                flag=true;
                break;
            }
        }
    }
    if(flag) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}



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

int n,k,a[123456],s=1000000000;

int main(){
    scanf("%d%d",&n,&k);
	for(int i=1;i<=n;i++)scanf("%d",&a[i]);sort(a+1,a+n+1);
	for(int i=1;i<=n-k+1;i++)s=min(s,a[i+k-1]-a[i]);
	printf("%d",s);
    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define endl '\n';

typedef long long ll;

using namespace std;

const string YES = "";
const string NO  = "";

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

    string s;

    cin >> s;

    for (int i = 0; i < s.size(); ++i) {
        if (s[i] == '1') {
            s[i] = '9';
        } else if (s[i] == '9') {
            s[i] = '1';
        }
    }

    cout << s << endl;

    return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<ios>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<vector>
#include<stack>
#include<queue>
#include<deque>
#include<string>
#include<list>
#include<utility>
#include<tuple>
#include<map>
#include<unordered_map>
#include<complex>
#include<set>
#define itn int
#define retrun return
#define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
using namespace std;
typedef long long llong;
llong gcd(llong a, llong b) {
	if (a < b) std::swap(a, b);
	if (a % b == 0) return b;
	else return gcd(b, a % b);
}
llong lcm(llong a, llong b) {
	llong g = gcd(a, b);
	return a * b / g;
}
const llong MOD = 1000000007;
typedef pair<int, int> pii;
//ここまで共通
int N;
vector<pair<int, int>>A;
bool F(pii a, pii b) {
	return a.second < b.second;
}
int main() {
	cin >> N;
	for (int i = 0; i < N; i++) {
		int tmp;
		cin >> tmp;
		auto p = make_pair(i, tmp);
		A.push_back(p);
	}
	sort(A.begin(), A.end(), F);
	for (int i = 0; i < A.size(); i++) {
		cout << A[i].first + 1 << ' ';
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 1780
b = ["the", "this", "that"]
while 1:
        try:
                a = raw_input()
        except EOFError:
                break
        for y in range(26):
                for x in b:
                        if x in a:
                                print a
                                break
                a = list(a)
                for x in range(len(a)):
                        if a[x] == "z":
                                a[x] = "a"
                        elif "a" <= a[x] < "z":
                                a[x] = chr(ord(a[x])+1)
                a = "".join(a)

Measured memory_bytes: 4224
#include "bits/stdc++.h"
using namespace std;

#define ASC(vec) vec.begin(), vec.end()		// 昇順ソート 例：sort(ASC(vec));
#define DESC(vec) vec.rbegin(), vec.rend()	// 降順ソート 例:sort(DESC(vec));
#define rep(i, n) for(int i = 0; i < n; i++)
#define Rep(i, n) for(int i = 1; i < n; i++)
#define In(vec) rep(i, n) cin>>vec[i];
#define ANS(s) cout << s << endl
#define inc(a, b) cin >> a >> b;

const int mod = 1000000007;
const int inf = (int)1e9 + 7;
const long long INF = 1LL << 60;

typedef long long ll;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<ll> vl;
typedef vector<vector<int>> vvi;
typedef vector<pair<int, int>> vii;

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

ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
int round_int(int a, int b) { return (a + (b - 1)) / b; }


// 4,8方向に探索する際に用いる配列
//int dx[4] = { 0,  0, 1, -1 };
//int dy[4] = { 1, -1, 0,  0 };
int dx[8] = { 1, 0, -1,  0, 1, -1, -1,  1 };
int dy[8] = { 0, 1,  0, -1, 1,  1, -1, -1 };

constexpr auto MAX = 100010;

// ────────────────────────────────────────────────────

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

	vd v(n);
	rep(i, n) cin >> v[i];

	sort(ASC(v));

	double ans = (v[0] + v[1]) / 2;

	for (int i = 2; i < n; ++i) {
		ans = (ans + v[i]) / 2;
	}

	cout << setprecision(10) << ans << endl;
}

/*
4
1 8 12 20
*/

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

using namespace std;
typedef long long ll;

const int MAXN = 5010;

int n, k;
ll a[MAXN];

void solve() {
  sort(a, a + n);
  ll sum = 0;
  int ans = n;
  for (int i=n-1;i>=0;i--) {
    if (sum + a[i] < k) {
      sum += a[i];
    } else {
      ans = min(ans, i);
    }
  }
  cout << ans << endl;
}

int main() {
  cin >> n >> k;
  for (int i=0;i<n;i++) {
    cin >> a[i];
  }
  solve();
}


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

int main()
{

        int N, L;
        cin >> N >> L;

        vector<string> S(N);
        for (int i = 0; i < N; ++i) {
                cin >> S.at(i);
        }
        sort(S.begin(), S.end());
        for(int i = 0; i < N; ++i) {
                cout << S.at(i);
        }
        cout << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define mo 1000000007
#define pi 3.1415926535898
#define eps 1e-9 
using namespace std;
long long read(){
    long long xx=0,flagg=1;
    char ch=getchar();
    while((ch<'0'||ch>'9')&&ch!='-')
        ch=getchar();
    if(ch=='-'){
        flagg=-1;
        ch=getchar();
    }
    while(ch>='0'&&ch<='9'){
        xx=xx*10+ch-'0';
        ch=getchar();
    }
    return xx*flagg;
}
void pus(long long xx,long long flagg){
    if(xx<0){
        putchar('-');
        xx=-xx;
    }
    if(xx>=10)
        pus(xx/10,0);
    putchar(xx%10+'0');
    if(flagg==1)
        putchar(' ');
    if(flagg==2)
        putchar('\n');
    return;
}
long long n,i,x[1005],y[1005],flag;
void gz(long long u,long long v,long long w){
	if(w<0)
		return;
	if(abs(u)>abs(v)){
		if(u>0){
			putchar('R');
			gz(u-(1LL<<w),v,w-1);
		}
		else{
			putchar('L');
			gz(u+(1LL<<w),v,w-1);
		}
	}
	else{
		if(v>0){
			putchar('U');
			gz(u,v-(1LL<<w),w-1);
		}
		else{
			putchar('D');
			gz(u,v+(1LL<<w),w-1);
		}
	}
	if(w==0)
		putchar('\n');
}
int main(){
	n=read();
	for(i=1;i<=n;i++){
		x[i]=read();y[i]=read();
		if((x[i]+y[i])&1)
			flag|=1;
		else
			flag|=2;
	}
	if(flag==3){
		pus(-1,2);
		return 0;
	}
	if(flag==2){
		pus(37,2);
		pus(1,1);
		for(i=35;i>=0;i--)
			pus(1LL<<i,1);
		cout<<endl;
		for(i=1;i<=n;i++){
			putchar('L');
			gz(x[i]+1,y[i],35);
		}
	}
	else{
		pus(36,2);
		for(i=35;i>=0;i--)
			pus(1LL<<i,1);
		cout<<endl;
		for(i=1;i<=n;i++)
			gz(x[i],y[i],35);
	}
    return 0;
}

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

constexpr ll INF = ll(1e+18) + 1;

void countAround(char** s, int h, int w, int H, int W);

int main() {
    char **s;
    int H, W;

    cin >> H >> W;

    s = new char*[H];

    // stdin
    rep(i, H) {
        s[i] = new char[W];
        cin >> s[i];
    }

    // solve
    rep(i, H) {
        rep(j, W) {
            if (s[i][j] == '.') {countAround(s, i, j, H, W);}
        }
    }

    // show
    rep(i, H) {
        cout << s[i] << endl;
    }
    
}

void countAround(char** s, int h, int w, int H, int W) {
    int count = 0;

    for (int i = -1; i <= 1; i++) {
        for (int j = -1; j <= 1; j++) {
            if (h+i<0 || H<=h+i || w+j<0 || W<=w+j) {continue;}

            if (s[h+i][w+j] == '#') {count++;}
        }

    }

    s[h][w] = count+'0';
}

Measured memory_bytes: 256
import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.regex : regex;
import std.container;
import std.bigint;


void main()
{
  auto n = readln.chomp.to!int;
  auto p = new int[][](n, 2);

  foreach (i; 0..n) {
    p[i] = readln.chomp.split.to!(int[]);
  }

  p.sort!((a,b)=>a[0] == b[0] ? a[1] < b[1] : a[0] < b[0]);

  string p2s(int dx, int dy) {
    return dx.to!string ~ ":" ~ dy.to!string;
  }

  int[string] pat;
  foreach (i; 0..n) {
    foreach (j; i+1..n) {
      auto l = p2s(p[i][0]-p[j][0], p[i][1]-p[j][1]);
      pat[l]++;
    }
  }
  int m;
  foreach (k; pat.keys) {
    m = max(m, pat[k]);
  }

  writeln(n-m);
  
}


Measured memory_bytes: 508
#include<bits/stdc++.h>
using namespace std;
string s;
int n;
int main()
{
	cin>>n>>s;
	for(int i=0;i<s.size();i++)
		s[i]+=n;
	for(int i=0;i<s.size();i++)
		if(s[i]<='Z') cout<<s[i];
		else cout<<char('A'+s[i]%('Z'+1)); 
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <vector>
using namespace std;

int main()
{
    int n, k;
    cin >> n >> k;
    vector<int> count(n, 0);
    for (int i = 0; i < k; i++) {
        int d;
        cin >> d;
        for (int j = 0; j < d; j++) {
            int a;
            cin >> a;
            a--;
            count[a]++;
        }
    }
    int ans = 0;
    for (int i = 0; i < n; i++) {
        if (count[i] == 0) ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3200
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author NikuKyabe
 */

#include "bits/stdc++.h"

using namespace std;
#define int long long
#define FOR(i, a, b) for(int i=(int)(a);i<(int)(b);++i)
#define REP(i, n)  FOR(i,0,(n))


class BBitterAlchemy {
public:
    void solve(std::istream &in, std::ostream &out) {
      int n, x;
      in >> n >> x;
      vector<int> m(n);
      REP(i, n) in >> m[i];
      int sum = accumulate(m.begin(), m.end(), 0ll);
      int minm = *min_element(m.begin(), m.end());
      int left = x - sum;
      out << n + left / minm << endl;
    }
};


signed main() {
  ios::sync_with_stdio(false);
  cout.tie(0);
  cout << fixed;
  BBitterAlchemy solver;
  std::istream &in(std::cin);
  std::ostream &out(std::cout);
  solver.solve(in, out);
  return 0;
}


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

int main(){
    while (1)
    {
        int m,f,r;
        cin >> m >> f >> r;

        if(m == -1 && f == -1 && r == -1) break;

        if(m == -1 || f == -1){
            cout << "F" << endl;
        }
        else if(m+f >= 80){
            cout << "A" << endl;
        }
        else if(m+f >= 65){
            cout << "B" << endl;
        }
        else if(m+f >= 50 || (m+f >= 30 && r >= 50)){
            cout << "C" << endl;
        }
        else if(m+f >= 30){
            cout << "D" << endl;
        }
        else{
            cout << "F" << endl;
        }
    }
}


Measured memory_bytes: 3104
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>

#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 repi(i, a, b) for (int i = (a); i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define bit(b) (1ull << (b))

using namespace std;
using i32 = long long;
using u32 = unsigned long long;
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> void amax(T &x, S y) { if (x < y) x = y; }
template<typename T, typename S> void amin(T &x, S y) { if (y < x) x = y; }

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(16);
  map<i64, i64> m;
  m[0] = 1;
  i32 n;
  cin >> n;
  vi32 a(n);
  rep(i, n) cin >> a[i];
  i64 sum = 0;
  rep(i, n) m[sum += a[i]]++;
  i64 ans = 0;
  for (auto x: m) {
    i64 y = x.second - 1;
    ans += y * (y + 1) / 2;
  }
  cout << ans << endl;
  return 0;
}


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


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

  int ans = 0;
  rep(i,n){
    int a;
    cin >> a;
    if((i+1)%2==1 && a%2==1) ans++;
  }

  cout << ans << endl;

  return 0;
}

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

// template {{{  0 
// using {{{ 1
using ll = long long int;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vii = vector<pii>;
using vll = vector<pll>;
// }}} 1
// definition {{{ 1
// scaning {{{ 2
#define Scd(x) scanf("%d", &x)
#define Scd2(x,y) scanf("%d%d", &x, &y)
#define Scd3(x,y,z) scanf("%d%d%d", &x, &y, &z)
#define Scll(x) scanf("%lld", &x)
#define Scll2(x,y) scanf("%lld%lld", &x, &y)
#define Scll3(x,y,z) scanf("%lld%lld%lld", &x, &y, &z)
#define Scc(c) scanf("%c", &c);
#define Scs(s) scanf("%s", s);
#define Scstr(s) scanf("%s", &s);
// }}} 2
// constants {{{ 2
#define EPS (1e-7)
#define INF (2e9)
#define PI (acos(-1))
// }}} 2
// systems {{{ 2
#define Repe(x,y,z) for(ll x = z; x < y; x++)
#define Rep(x,y) Repe(x,y,0)
#define RRepe(x,y,z) for(ll x = y-z-1; x >= 0; x--)
#define RRep(x,y) RRepe(x,y,0)
// }}} 2
// output {{{ 2
#define YesNo(a) (a)?printf("Yes\n"):printf("No\n")
#define YESNO(a) (a)?printf("YES\n"):printf("NO\n")
// }}} 2
// }}} 1
// input {{{ 1
// }}} 1
// }}} 0

int main() {

    int H,W,K;
    Scd3(H,W,K);
    char s[321][321];
    Rep(i,H){
        Scs(s[i]);
    }

    vector<bool> exi(H,false);
    int cnt = 1;
    int ans[321][321];
    Rep(i,H){
        Rep(j,W){
            ans[i][j] = cnt;
            if( s[i][j] == '#' ) cnt++, exi[i]=true;
        }
        RRep(j,W){
            if( s[i][j] == '#' ) break;
            ans[i][j] = cnt-1;
        }
    }

    Rep(qi,H){
    Rep(i,H-1){
        if( !exi[i] ) if( exi[i+1] ){
            Rep(j,W) ans[i][j] = ans[i+1][j];
            exi[i] = true;
        }
    }
    RRep(i,H-1){
        if( !exi[i+1] ) if( exi[i] ){
            Rep(j,W) ans[i+1][j] = ans[i][j];
            exi[i+1] = true;
        }
    }
    }

    Rep(i,H) Rep(j,W)
    printf ("%d%s", ans[i][j], j==W-1?"\n":" " );

    return 0;
}





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

#define all(x) (x).begin(), (x).end()

typedef long long ll;
typedef array<int, 3> tri;
typedef long double ld;

template <class T> istream& operator>>(istream& I, vector<T>& v) {for (T &e: v) I >> e; return I;}
template <class T> ostream& operator<<(ostream &O, const vector<T>& v) {for (const T &e: v) O << e << ' '; return O;}



void _main() {
        string s, t; cin >> s >> t;
        vector<vector<int>> where(26);
        for (int i = 0; i < s.size(); i++) {
                where[s[i] - 'a'].emplace_back(i);
        }

        ll  last = -1, copy = 1;
        for (int i = 0; i < t.size(); i++) {
                auto a = where[t[i] - 'a'];
                if (a.empty()) {
                        cout << -1;
                        return;
                }

                int l = 0, r = a.size() - 1, here = -1;
                while (l <= r) {
                        int mid = (l + r) / 2;
                        if (a[mid] > last) here = a[mid], r = mid - 1;
                        else l = mid + 1;
                }


                if (here < 0) {
                        last = a.front();
                        copy++;
                } else last = here;
        }

        cout << (copy - 1) * (ll) s.size() + last + 1;
}



signed main() {
        ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
//        freopen("input.txt", "r", stdin);
        int _t = 1;
//        cin >> _t;
        while (_t--) _main();
        return 0;
}

Measured memory_bytes: 4404
#include <bits/stdc++.h>
#define ADD(a, b) a = (a + ll(b)) % mod
#define MUL(a, b) a = (a * ll(b)) % mod
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)
#define all(a) (a).begin(), (a).end()
#define sz(v) (int)(v).size()
#define pb push_back
#define sec second
#define fst first
#define debug(fmt, ...) Debug(__LINE__, ":", fmt, ##__VA_ARGS__)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<int, pi> ppi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> mat;
typedef complex<double> comp;
void Debug() {cerr << '\n'; }
template<class FIRST, class... REST>void Debug(FIRST arg, REST... rest){
	cerr<<arg<<" ";Debug(rest...);}
template<class T>ostream& operator<<(ostream& out,const vector<T>& v) {
	out<<"[";if(!v.empty()){rep(i,0,sz(v)-1)out<<v[i]<<", ";out<<v.back();}out<<"]";return out;}
template<class S, class T>ostream& operator<<(ostream& out,const pair<S, T>& v){
	out<<"("<<v.first<<", "<<v.second<<")";return out;}
const int MAX_N = 500010;
const int MAX_V = 100010;
const double eps = 1e-6;
const ll mod = 1000000007;
const int inf = (1 << 30) - 1;
const ll linf = 1LL << 60;
const double PI = 3.14159265358979323846;
mt19937 rng; //use it by rng() % mod, shuffle(all(vec), rng)
///////////////////////////////////////////////////////////////////////////////////////////////////

string S;

void solve() {
	cin >> S;
	int res = 0;
	rep(i, 0, sz(S) - 1) {
		if(S[i] != S[i + 1]) res++;
	}
	cout << res << "\n";
}

uint32_t rd() {
	uint32_t res;
#ifdef __MINGW32__
	asm volatile("rdrand %0" :"=a"(res) ::"cc");
#else
	res = std::random_device()();
#endif
	return res;
}

int main() {
#ifndef LOCAL
	ios::sync_with_stdio(false);
    cin.tie(0);
#endif
    cout << fixed;
	cout.precision(20);
    cerr << fixed;
	cerr.precision(6);
	rng.seed(rd());
#ifdef LOCAL
	//freopen("in.txt", "wt", stdout); //for tester
	if(!freopen("in.txt", "rt", stdin)) return 1;
#endif	
	solve();
    cerr << "Time: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
	return 0;
}



Measured memory_bytes: 512
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace test
{
    class Program
    {
        static void Main(string[] args)
        {
            var line = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
            int A = line[0], B = line[1], C = line[2], X = line[3], Y = line[4], ans = 0;

            if (A + B <= 2 * C)
            {
                ans = A * X + B * Y;
                Console.WriteLine(ans);
                return;
            }

            int many = 0, few = 0, manyP = 0, fewP = 0;

            if (X >= Y)
            {
                many = X;
                few = Y;
                manyP = A;
                fewP = B;
            }
            else
            {
                many = Y;
                few = X;
                manyP = B;
                fewP = A;
            }
            
            ans += 2 * C * few;
            many -= few;
            few -= few;

            if (manyP > 2 * C)
            {
                ans += many * 2 * C;
            }else
            {
                ans += many * manyP;
            }            

            Console.WriteLine(ans);
        }
    }
}

Measured memory_bytes: 13396
#include <bits/stdc++.h>
using namespace std;
int zet(int a){
  if(a>=0)
    return a;
  if(a<0)
    return -1*a;
}
int main() {
  int W,a,b;
  cin >> W >> a >> b;
  
  if(zet(b-a-W) < zet(a-b-W) && b-a-W >=0)
    cout << b-a-W << endl;
  else if(zet(b-a-W) > zet(a-b-W) && a-b-W >=0)
    cout << a-b-W << endl;
  else
    cout << "0" << endl;
}


Measured memory_bytes: 256
n = int(input())
a = []
b = []
c = []
dp = []
for i in range(n):
    dp.append([0, 0, 0])
for i in range(n):
    a_i, b_i, c_i = [int(i) for i in input().split(' ')]
    a.append(a_i)
    b.append(b_i)
    c.append(c_i)

dp[0][0] = a[0]
dp[0][1] = b[0]
dp[0][2] = c[0]
for i in range(1, n):
    dp[i][0] = max(dp[i - 1][1], dp[i - 1][2]) + a[i]
    dp[i][1] = max(dp[i - 1][0], dp[i - 1][2]) + b[i]
    dp[i][2] = max(dp[i - 1][0], dp[i - 1][1]) + c[i]

print(max(dp[-1]))

Measured memory_bytes: 34768
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <queue>
#include <sstream>
#include <utility>
#include <vector>

#define REP(i, n) for(int i = 0; i < (n); i++)
#define ALL(a) (a).begin(), (a).end()
#define AALL(a, n) (a), a + n
#define FILL(a, n) memset((a), n, sizeof(a))
#define FILLZ(a) FILL(a, 0)

using namespace std;

typedef long long ll;

const double EPS = 1e-10;
const double PI = acos(-1.0);

inline int toInt(string s) {
	int v;
	istringstream sin(s);
	sin >> v;
	return v;
}

int main() {
	int n;
	scanf("%d", &n);
	printf("%d\n", n * n * n);
	return 0;
}

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

int main(){
  int n,d[100];
  cin>>n;
  for (int i(0);i<n;i++)cin>>d[i];
  sort(d,d+n);
  int cnt(1);
  for (int i(0);i<n-1;i++){
    if (d[i]<d[i+1])cnt+=1;
    else continue;
  }
  cout << cnt << endl;
}


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

int main() {
  int s, s1, s2, s3;
  // input s
  cin >> s;
  // get s1, s2, s3
  s1 = s / 100;
  s2 = (s - s1*100) / 10 ;
  s3 = s - s1*100 - s2*10;
  
  // output the number of marbles 
  cout << s1 + s2 + s3 << endl;
  
}

Measured memory_bytes: 3612
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
	public static void main(String args[]) throws Exception
	{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String ns = br.readLine();
		int n = Integer.parseInt(ns);

		String as = br.readLine();
		String[] as_ary = as.split(" ");

		int[] a_ary = new int[n];
		for (int i = 0; i < n; i++) {
			a_ary[i] = Integer.parseInt(as_ary[i]);
		}

		int minj;
		int min;
		int count = 0;
		for (int i = 0; i < n; i++) {
			minj = i;
			for (int j = i + 1; j < n; j++) {
				if (a_ary[j] < a_ary[minj]) {
					minj = j;
				}
			}

			if (i != minj) {
				count += 1;
				min = a_ary[minj];
				a_ary[minj] = a_ary[i];
				a_ary[i] = min;
			}
		}

		for (int i = 0; i < n; i++) {
			System.out.printf(a_ary[i] + (i != n - 1 ? " ": ""));
		}
		System.out.println("\n"+count);
	}
}


Measured memory_bytes: 24588
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define mod 1000000007

signed main() 
{
	int txor = 0 , n;
	cin >> n;
	int a[n];
	for(int i = 0 ; i < n ; i++)
		cin >> a[i] , txor = (txor^a[i]);
	for(int i = 0 ; i < n ; i++)
		cout << (txor^a[i]) << ' ';
	
}

Measured memory_bytes: 5056
//#include <algorithm>
//#include <iostream>
//#include <vector>
//#include <numeric>
//#include <string>
//#include <stdio.h>
//#include <set>
//#include <iomanip>
#include <bits/stdc++.h>
using namespace std;
 
 
int main(){
    int M, N;
    long long int K;
    int r = 0;
    cin >> N >> M >> K;
    //vector<long long> A(N);
    long long int A, B;
    vector<long long int> SA(N+1, 0);
    //vector<long long> B(M);
    vector<long long int> SB(M+1, 0);
    //int p = 0;
    //int q = 0;

    for (int i=0; i<N; i++){
        cin >> A;
        SA[i+1] = SA[i] + A;
    }
    for (int j=0; j<M; j++){
        cin >> B;
        SB[j+1] = SB[j] + B;
    }
    int j = M;
    for (int i=0; i<N+1; i++){
        if (SA[i] > K){
            break;
        }
        while (K - SA[i] < SB[j]){
            j -= 1;
        }
        r = max(r, i + j);
    }
    cout << r << endl;
    return 0;
}

Measured memory_bytes: 6400
#include <iostream>  /*{{{*/
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define REPS(i, n) for(int i = 1; i <= (int)(n); 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 FOR(i, m, n) for(int i = m;i < n;i++)
#define RFOR(i, m, n) for(int i = m;i >= n;i--)
#define ALL(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define FILL(x,y) memset(x,y,sizeof(x))
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define PB(a) push_back(a)
#define INF 999999999
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};
/*}}}*/

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

  string s[3];
  int idx[3]={};
  int curr=0;

  REP(i, 3) cin >> s[i];
  while (1) {
    curr = s[curr][idx[curr]++] - 'a';
    if (idx[curr] == s[curr].size()){
      cout << (char)('A'+curr) << endl;
      return 0;
    }
  }

  return 0;
}


Measured memory_bytes: 256
//package AtCoder.ABC158;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) {
        String q = in.next();
        if (q.charAt(0)==q.charAt(1) && q.charAt(1)==q.charAt(2)) {
            out.println("No");
        } else {
            out.println("Yes");
        }
        out.close();
    }

    static InputStream inputStream = System.in;
    static OutputStream outputStream = System.out;
    static InputReader in = new InputReader(inputStream);
    static PrintWriter out = new PrintWriter(outputStream);

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

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

        public int NI() {
            return Integer.parseInt(next());
        }

        public long NL() {
            return Long.parseLong(next());
        }

    }
}

Measured memory_bytes: 22484
n = int(input())
s = input()

ans = 0

for i in range(n+1):
    li1 = [0]*26
    li2 = [0]*26
    s1 = s[:i]
    s2 = s[i:]
    for j in s1:
        li1[ord(j)-97] += 1
    for j in s2:
        li2[ord(j)-97] += 1
    tmp = 0
    for j in range(26):
        if li1[j] > 0 and li2[j] > 0:
            tmp += 1
    ans = max(ans, tmp)

print(ans)


Measured memory_bytes: 3064
#include <iostream>

using namespace std;

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

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

    int ans = 0;
    // l : h[i] > 0なる最小のi
    for (int l = 0; l < N; ++l) {
        while (h[l] > 0) {
            int r;
            for (r = l + 1; r < N; ++r) {
                if (h[r] == 0) break;
            }
            // 区間[l, r)は全て正
            // この区間に対して水やりをする
            for (int x = l; x < r; ++x) --h[x];
            ++ans;
        }
    }

    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author jignesh1604
 */

#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include <bits/stdc++.h>

using namespace std;

class AtcoderA {
public:
	void solve(std::istream& in, std::ostream& out) {
	    long long int n , m ;
	    in >> n >> m ;
	    if(n==1 || m==1) out << 1 << "\n";
	    else
	        out << (n*m + 1) / 2 << "\n";

	}
};


int main() {
	AtcoderA solver;
	std::ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 256
a,b=[int(i) for i in input().split()]

def prime_decomposition(n):
    i = 2
    table = [1]
    while i * i <= n:
        while n % i == 0:
            n /= i
            table.append(i)
        i += 1
    if n > 1:
        table.append(int(n))
    return table

A=list(set(prime_decomposition(a)))
B=list(set(prime_decomposition(b)))


ans=0
for i in A:
    if i in B:
        ans+=1

print(ans)



Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
 
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse4")
 
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define RFOR(i, b, a) for(int i = (b) - 1; i >= (a); --i)
 
#define SZ(a) (int)((a).size())
#define ALL(a) a.begin(), a.end()
 
typedef long long LL;
typedef pair<int, int> PII;

const int mod = 1000 * 1000 * 1000 + 7;
const int LOG = 18;
const int MAX = 1 << LOG;

void updAdd(int& x, int val)
{
	x += val;
	if(x >= mod)
		x -= mod;
}

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

int p[MAX];
int inv[MAX];
int f[MAX], g[MAX];
vector<int> vec[MAX];
int last[MAX][LOG];
int ptr[MAX][LOG], sum[MAX][LOG];

int main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int h;
	cin >> h;
	inv[1] = f[1] = g[1] = 1;
	FOR(i, 2, 1 << h)
	{
		inv[i] = mult(inv[mod % i], mod - mod / i);
		f[i] = mult(i, f[i >> 1]);
		g[i] = mult(inv[i], g[i >> 1]);
	}
	FOR(i, 1, 1 << h)
		g[i] = mult(i, mult(g[i], g[i]));
	int l = 1 << (h - 1);
	FOR(i, 0, l)
	{
		cin >> p[i];
		p[i]--;
		int v = l + p[i];
		while(v)
		{
			vec[v].push_back(i);
			v >>= 1;
		}
	}
	FOR(i, 1, 1 << h)
		FOR(j, 0, h)
			last[i][j] = -1;
	int ans = 0;
	FOR(i, 0, l)
	{
		int s2 = 0;
		for(int v = l + p[i]; v > 1; v >>= 1)
		{
			int s1 = 0;
			for(int u = l + i, du = h - 1; du; u >>= 1, du--)
			{
				if(!(u & 1))
				{
					if(last[v ^ 1][du] < (u ^ 1))
					{
						sum[v ^ 1][du] = 0;
						while(ptr[v ^ 1][du] < SZ(vec[v ^ 1]) && ((l + vec[v ^ 1][ptr[v ^ 1][du]]) >> (h - 1 - du)) <= (u ^ 1))
						{
							if(((l + vec[v ^ 1][ptr[v ^ 1][du]]) >> (h - 1 - du)) == (u ^ 1))
								updAdd(sum[v ^ 1][du],
									mult(f[l + vec[v ^ 1][ptr[v ^ 1][du]]], f[l + p[vec[v ^ 1][ptr[v ^ 1][du]]]]));
							ptr[v ^ 1][du]++;
						}
						last[v ^ 1][du] = u ^ 1;
					}
					updAdd(s1, mult(g[u >> 1], sum[v ^ 1][du]));
				}
			}
			updAdd(s2, mult(g[v >> 1], s1));
		}
		updAdd(ans, mult(mult(f[l + i], f[l + p[i]]), s2));
	}
	cout << ans << "\n";
	return 0;
}


Measured memory_bytes: 83608
#include<iostream>
#include<string>
#include<algorithm>
#include <stdio.h>
#include<iostream>
#include<iomanip>
#include<cmath>
#include<array>
#include<vector>
#include<set>
#include <utility>
#include <map>
using namespace std;
long long max(long long a,long long b){
  if(a<b) return b;
  else return a;

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

cout<<max(a+b,max(a-b,a*b));

}


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

int main()
{
  string s,t;
  cin >> s >> t;
  
  int flag = 0;
  if(s.size() + 1 != t.size()){
    flag = 1;
  }

  int n = s.size();
  for(int i = 0; i < n; i++){
    if(s[i] != t[i]){
      flag = 1;
      break;
    }
  }
  
  if(flag == 0){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 3628
<?php
$N = (int)(trim(fgets(STDIN)));
$new_arr = [$N];
$count = 1;
function fun($number){
    if($number%2 === 0){
        return $number/2;
    }else{
        return 3*$number+1;
    }
}

while (true){
    $new_n = fun($N);
    $count += 1;
    if(in_array($new_n,$new_arr,true)){
        break;
    }
    array_push($new_arr,$new_n);
    $N = $new_n;
}
echo $count;

Measured memory_bytes: 4604
N = int(input())
e = [0] * (N+1)
for i in range(2,N+1):
    cur = i
    for j in range(2,i+1):
        while cur % j == 0:
            e[j] += 1
            cur //= j
def num(m):
    return len(list(filter(lambda x: x>=m-1, e)))

print(num(75) + num(25) * (num(3) - 1) + num(15) * (num(5) - 1)
 + num(5) * (num(5) - 1) * (num(3) - 2) // 2)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
#define rep1(i,N) for(int i=1;i<int(N);++i)
#define all(a) (a).begin(),(a).end()		//sort(all(vi S)) sort(all(string S))
#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }
#define printpair(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<"{"<<_.first<<","<<_.second<<"}"<<", "; cerr<<"]"<<endl; }

using P = pair<int, int>;		//P.first, P.second
typedef long long ll;
typedef vector<int> vi;
typedef set<int> seti;
typedef vector<string> vs;

const int MOD = 1e9+7;
const int INF = 1e9;

ll Count(ll X, ll Y){
	ll cnt = X/Y;
	return cnt;
}
ll gcd(ll a,ll b){return b==0 ? a : gcd(b,a%b);}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
int main() {
	ll A,B,C,D;
	cin>>A>>B>>C>>D;
	if(C==1||D==1){
		cout<<0<<endl;
		return 0;
	}
	ll A1 = Count(A-1,C)+Count(A-1,D)-Count(A-1,lcm(C,D));
	ll B1 = Count(B,C)+Count(B,D)-Count(B,lcm(C,D));
	ll ans = B-A+1 - (B1-A1);
	cout<<ans<<endl;
}

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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N;
  cin >> N;
  vector<int> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  int p = 1, res = 0;
  for (int i = 0; i < N; i++) {
    if (p == A[i]) {
      p++;
    } else {
      res++;
    }
  }
  cout << (res == N ? -1 : res) << '\n';
  return 0;
}


Measured memory_bytes: 1024
import java.util.Scanner;
 
public class Main {
    public static void main(String args[]){
        Scanner stdIn = new Scanner(System.in);
        
        
        int num[] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
        int k = stdIn.nextInt();
        //int b = stdIn.nextInt();
        //int c = stdIn.nextInt();
        //int x = stdIn.nextInt();
        //int num[] = new int[];
        //String s = stdIn.next();
        //String t = stdIn.next();
        System.out.println(num[k - 1]);
        //int sum = 0;
        //boolean flag = true;
        //for(int i = 0; i < s.length(); i++){
        //}
 
 
        //System.out.println();
        //System.out.print();
 
        stdIn.close();
    }
}

Measured memory_bytes: 22996
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define lper(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[4]={1,0,-1,0};
const ll dx[4]={0,-1,0,1};
long long fac(ll a){
    long long ans=1;
    while(a>1){
        ans*=a;
        ans%=1000000007;
        a--;
    }
    return ans;
}
long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m; 
    if (u < 0) u += m;
    return u;
}
int main(){
    vvl b(3,vl(3));
    rep(i,3){
        rep(j,3){
            cin >> b[i][j];
        }
    }
    ll n;
    cin >> n;
    rep(i,n){
        ll a;
        cin >> a;
        rep(j,3){
         rep(k,3){
            if(b[j][k]==a)b[j][k]=0;
        }
        }
    }
    rep(i,3){
    if(b[i][0]==0&&b[i][1]==0&&b[i][2]==0){
        cout << "Yes" << endl;
        return 0;
    }
    }
    rep(i,3){
    if(b[0][i]==0&&b[1][i]==0&&b[2][i]==0){
        cout << "Yes" << endl;
        return 0;
    }
    }
    if(b[0][0]==0&&b[1][1]==0&&b[2][2]==0){
        cout << "Yes" << endl;
        return 0;
    }
     if(b[0][2]==0&&b[1][1]==0&&b[2][0]==0){
        cout << "Yes" << endl;
        return 0;
    }
    cout << "No" << endl;
}
    

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

typedef long long ll;

struct tree_distance{
    int n;
    vector<vector<int>> g;
    vector<int> d;
    int s;
    tree_distance(int _n,int _s){
        n = _n;
        g.resize(n);
        d.resize(n);
        for (int i = 0; i < n; ++i)
        {
            d[i] = -1;
        }
        s = _s;
    }
    void add(int a,int b){
        g[a].push_back(b);
    }
    void init(){
        dfs(s,0);
    }
    void dfs(int x,int dis){
        d[x] = dis;
        for(int i : g[x]){
            if(d[i] < 0){
                dfs(i,dis+1);
            }
        }
    }
};

int main(int argc, char const *argv[])
{
    int n,u,v;scanf("%d %d %d",&n,&u,&v);u--,v--;
    tree_distance T(n,u),A(n,v);
    for (int i = 0; i < n-1; ++i)
    {
        int a,b;scanf("%d %d",&a,&b);
        a--,b--;
        T.add(a,b);T.add(b,a);
        A.add(a,b);A.add(b,a);
    }
    T.init();
    A.init();
    int ans = 0;
    for (int i = 0; i < n; ++i)
    {
        if(T.d[i] < A.d[i]){
            ans = max(ans,A.d[i]);
        }
    }
    cout << ans-1 << endl;
    return 0;
}

Measured memory_bytes: 13824
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin >> s;
  string ans;
  for(int i=0;i<s.size();i++){
    if(s[i] != 'B'){
      ans+=s[i];
    }else{
      if(ans.size()){
	ans.erase(ans.size()-1);
      }
    }
  }
  cout << ans << endl;
}
    

Measured memory_bytes: 256
import java.util.*;

public class Main {
    private static Scanner sc = new Scanner(System.in);
    public static void main(String[] args) throws Exception {
        int n = sc.nextInt();
        int t = sc.nextInt();
        int[] ary = new int[n+1];
        for (int i = 1;i <= n;i++) {
            ary[i] = sc.nextInt();
        }
        int max = 0;
        int min = Integer.MAX_VALUE;
        int cnt = 0;
        for (int i = 1;i <= n;i++) {
            int tmp = ary[i];
            if (tmp<min) {
                min = tmp;
            } else {
                int diff = tmp - min;
                if (max==diff) {
                    cnt++;
                } else if (max<diff) {
                    max = diff;
                    cnt = 1;
                }
            }
        }
        System.out.println(cnt);
    }
}


Measured memory_bytes: 45748