akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;

namespace AtCoder.ABC._131
{
    class d
    {
        static void Main(string[] args)
        {
            var line = Console.ReadLine().Trim();
            var N = int.Parse(line);
            var AB = new List<Work>(N);
            for (var i = 0; i < N; ++i)
            {
                line = Console.ReadLine().Trim();
                var spl = line.Split(' ');
                AB.Add(new Work(int.Parse(spl[0]), int.Parse(spl[1])));
            }
            AB.Sort((a, b) => a.B - b.B);
            var A = 0L;
            var B = 0L;
            foreach(var c in AB)
            {
                A += c.A;
                B = c.B;
                if (A > B)
                {
                    Console.WriteLine("No");
                    return;
                }
            }
            Console.WriteLine("Yes");
        }

        class Work
        {
            public int A { get; set; }
            public int B { get; set; }

            public Work(int a, int b)
            {
                A = a;
                B = b;
            }
        }
    }
}


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

using namespace std;
using ll = long long;
// #define int ll
using PII = pair<ll, ll>;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()

template<typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template<typename T> bool IN(T a, T b, T x) { return a<=x&&x<b; }
template<typename T> T ceil(T a, T b) { return a/b + !!(a%b); }

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

template<class S,class T>
ostream &operator <<(ostream& out,const pair<S,T>& a) {
    out<<'('<<a.first<<','<<a.second<<')'; return out;
}
template<class T>
ostream &operator <<(ostream& out,const vector<T>& a){
    out<<'[';
    for(const T &i: a) out<<i<<',';
    out<<']';
    return out;
}
template<class T>
ostream &operator <<(ostream& out, const set<T>& a) {
    out<<'{';
    for(const T &i: a) out<<i<<',';
    out<<'}';
    return out;
}
template<class T, class S>
ostream &operator <<(ostream& out, const map<T,S>& a) {
    out<<'{';
    for(auto &i: a) out<<i<<',';
    out<<'}';
    return out;
}

int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0}; // DRUL
const int INF = 1<<30;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;

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

    ll n;
    cin >> n;
    vector<ll> a(n);
    REP(i, n) cin >> a[i];
    sort(ALL(a));

    vector<PII> ope;
    if(a[0] >= 0) {
        FOR(i, 1, n-1) {
            ope.push_back({a[0], a[i]});
            a[0] -= a[i];
        }
        ope.push_back({a[n-1], a[0]});
        a[n-1] -= a[0];
    }
    else if(a[n-1] <= 0) {
        REP(i, n-1) {
            ope.push_back({a[n-1], a[i]});
            a[n-1] -= a[i];
        }
    } else {
        ll idx = -1;
        REP(i, n) if(a[i]>=0) { idx=i; break; }
        assert(idx!=-1);
        FOR(i, idx, n-1) {
            ope.push_back({a[0], a[i]});
            a[0] -= a[i];
        }
        REP(i, idx) {
            ope.push_back({a[n-1], a[i]});
            a[n-1] -= a[i];
        }
    }

    cout << a[n-1] << endl;
    REP(i, n-1) cout << ope[i].first << " " << ope[i].second << endl;

    return 0;
}


Measured memory_bytes: 4336
/*ITP1_4_C:Simple Calculator*/
#include <iostream>
using namespace std;

int calc(int x,char op,int y) {
    switch (op) {
        case '+':
            return x + y;
        case '-':
            return x - y;
        case '*':
            return x * y;
        case '/':
            return x / y;
        default:
            break;
        }   
    return 0;
}

int main() {
    int a,b;
    char op; 
    cin >> a >> op >> b;

    while( op != '?' ) { 
        cout << calc(a,op,b) << endl;
        cin >> a >> op >> b;
    }   
    
    return 0;
}



Measured memory_bytes: 3084
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstring>

namespace IO {
    template <typename _T>
    inline bool read (_T& x) {
        x = 0;
        _T y = 1;
        char c = getchar();
        while ((c < '0' || '9' < c) && c != EOF) {
            if (c == '-') y = -1;
            c = getchar();
        }
        if (c == EOF) return false;
        while ('0' <= c && c <= '9') x = x * 10 + c - '0', c = getchar();
        x *= y;
        return true;
    }

    template <typename _T>
    inline _T input () {
        _T x = 0, y = 1;
        char c = getchar();
        while ((c < '0' || '9' < c) && c != EOF) {
            if (c == '-') y = -1;
            c = getchar();
        }
        if (c == EOF) return 0;
        while ('0' <= c && c <= '9') x = x * 10 + c - '0', c = getchar();
        x *= y;
        return x;
    }
};
using namespace IO;

#define reg register
#define MAX_N 300007
#define FIN(s) freopen(s, "r", stdin)
#define FOUT(s) freopen(s, "w", stdout)
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define rep(i, l, r) for(int i = l; i <= r; ++i)
#define lep(i, l, r) for(int i = l; i < r; ++i)
#define irep(i, r, l) for(int i = r; i >= l; --i)
#define ilep(i, r, l) for(int i = r; i > l; --i)
typedef long long ll;

int N;
int p[MAX_N];
int s[MAX_N], a[MAX_N], b[MAX_N];

inline void solve () {
    int M = N * N;
    rep (i, 1, M) {
        if (a[i]) {
            s[a[i]]++;
            if (s[a[i]] != a[i]) { puts("No"); exit(0); }
        } else {
            bool flag = false;
            rep (j, 1, N) if (s[b[j]] < b[j] - 1) {
                s[a[i] = b[j]]++;
                flag = true;
                break;
            }
            if (!flag) {
                rep (j, 1, N) if (s[j] >= j && s[j] < N) {
                    s[a[i] = j]++;
                    flag = true;
                    break;
                }
            }
            if (!flag) { puts("No"); exit(0); }
        }
    }
    puts("Yes");
    rep (i, 1, M) printf("%d ", a[i]); puts("");
}

bool cmp (int x, int y) { return p[x] < p[y]; }

int main () {
#ifdef LOCAL
    FIN("in");
#endif
    read(N);
    rep (i, 1, N) a[p[i] = input<int>()] = i, b[i] = i;
    std::sort(b + 1, b + N + 1, cmp);
    solve();
    return 0;
}

Measured memory_bytes: 4096
from collections import defaultdict
import math

def combinations(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def p_factors(n):
    if n < 2:
        return defaultdict(int)
    d = 2
    result = defaultdict(int)
    while n > 1 and d*d <= n:
        while n % d == 0:
            result[d] += 1
            n //= d
        d += 1
        
    if n > 1:
        # n is a prime
        result[n] += 1
    return result

N = int(input())
primes = defaultdict(int)
for i in range(2, N+1):
    for p, n in p_factors(i).items():
        primes[p] += n
check = [2, 4, 14, 24, 74]
n_factors_at_least = {i: 0 for i in check}
for _, n in primes.items():
    for i in check:
        if n < i:
            break
        n_factors_at_least[i] += 1
ans = n_factors_at_least[74]
ans += n_factors_at_least[24] * (n_factors_at_least[2]-1) if n_factors_at_least[2] > 1 else 0
ans += n_factors_at_least[14] * (n_factors_at_least[4]-1) if n_factors_at_least[4] > 1 else 0
ans += combinations(n_factors_at_least[4], 2) * (n_factors_at_least[2] - 2) if n_factors_at_least[2] > 2 else 0
print(ans)

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

int main() {
  string s;
  cin >> s;
  for (int i = 0; i < 4; ++i) cout << s[i];
  cout << ' ';
  for (int i = 4; i < 12; ++i) cout << s[i];
  cout << '\n';
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define REP(i, n) FOR(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define bit(x) (1L << (x))
using ll = long long;
using namespace std;

template<class T, T monoid>
class RMQ{
public:
  vector<T> dat;
  int _n;

  RMQ(int size) : _n{1}{
    while(size > _n) _n *= 2;
    dat.resize(_n, monoid);
  } 

  void update(int k, int a){
    k += _n-1;
    dat[k] = a;

    while(k > 0){
      k = (k-1) / 2;
      dat[k] = min(dat[k * 2 + 1], dat[k * 2 + 2]);
    }
  }

  T query(int a, int b){
    return _query(a, b, 0, 0, _n);
  }

private:
  T _query(int a, int b, int k, int l, int r){
    if(r <= a || b <= l) {
      return monoid;
    }
    if(a <= l && r <= b) {
      return dat[k];
    }
    else {
      T v1 = _query(a, b, k * 2 + 1, l, (l + r) / 2);
      T v2 = _query(a, b, k * 2 + 2, (l + r) / 2, r);

      return min(v1, v2);
    }
  }
};

int main(){
  int n, k; cin >> n >> k;
  vector<int> h(n), cost(n, INT_MAX >> 1);
  REP(i, n) cin >> h[i];

  cost[0] = 0;
  REP(i, n)FOR(j, 1, k+1) {
    if(i + j < n) {
      cost[i + j] = min(cost[i + j], cost[i] + abs(h[i + j] - h[i]));
    }
  }

  cout << cost[n-1] << endl;

  return 0;
}


Measured memory_bytes: 1024
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

#define int long long

#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPS(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF (3e15)

using namespace std;
typedef pair<int, int> P;

int N;
map<P, int> dp;

int mod = 1000000007;

int dfs(int s, int x) {
    if (dp.count({s, x}) != 0) {
        return dp[{s, x}];
    }
    if (s == 0 && x == 0) {
        return dp[{s, x}] = 1;
    }
    int res = dfs(s / 2, x / 2);

    if (s >= 1 && x >= 1) {
        res = (res + dfs((s - 1) / 2, (x - 1) / 2)) % mod;
    }

    if (s >= 2) {
        res = (res + dfs((s - 2) / 2, x / 2)) % mod;
    }
    return dp[{s, x}] = res % mod;
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    cin >> N;
    cout << dfs(N, N) << endl;
    return 0;
}


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

#define REP(i, a, b) for (int i = int(a); i < int(b); i++)
#define dump(val) cerr << __LINE__ << ":\t" << #val << " = " << (val) << endl

using namespace std;

typedef long long int lli;

template<typename T>
vector<T> make_v(size_t a, T b) {
    return vector<T>(a, b);
}

template<typename... Ts>
auto make_v(size_t a, Ts... ts) {
    return vector<decltype(make_v(ts...))>(a, make_v(ts...));
}

int main() {
    int H, W;
    cin >> H >> W;
    auto S = make_v(H, W, '.');
    REP(i, 0, H) {
        REP(j, 0, W) {
            cin >> S[i][j];
        }
    }
    bool ok = true;
    int dx[4] = {1, 0, -1, 0};
    int dy[4] = {0, 1, 0, -1};
    REP(i, 0, H) {
        REP(j, 0, W) {
            bool ch = false;
            if (S[i][j] != '#') {
                continue;
            }
            REP(k, 0, 4) {
                int ni = i + dy[k], nj = j + dx[k];
                if (ni < 0 || ni >= H || nj < 0 || nj >= W) {
                    continue;
                }
                if (S[ni][nj] == '#') {
                    ch = true;
                }
            }
            if (!ch) {
                ok = false;
            }
        }
    }
    cout << (ok ? "Yes" : "No") << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <numeric>
#include <cmath>
#include <algorithm>
#include<string>
#define myfor(i,N) for(i=0;i<N;i++)
#define myforFL(i,f,l) for(i=f;i<l;i++)

using namespace std;

int main(void){
	int K,N,A[200000],i,ans,tmp,m=0;
	cin >> K >> N;
	myfor(i,N){
		cin >> A[i];
	}
	m = K - (A[N-1] - A[0]);
	myforFL(i,0,N-1){
		m = max(m, A[i+1]-A[i]);
	}

	ans = K - m;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1024
A, V = map(int, input().split())
B, W = map(int, input().split())
T = int(input())

max_A = A + V*T
min_A = A - V*T
max_B = B + W*T
min_B = B - W*T

if max_A >= max_B and min_A <= min_B:
    print("YES")
else:
    print("NO")

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

unsigned long greed(vector<int> &a){
    unsigned long op=0;
    int sum = a[0];
    for(int i=1; i<a.size(); i++){
        if(sum > 0){
            if(sum+a[i]>=0){
                op += sum+a[i]+1;
                sum = -1;    
            }else{
                sum += a[i];
            }
        }else{
            if(sum+a[i]<=0){
                op += 1-sum-a[i];
                sum = 1;
            }else{
                sum += a[i];
            }
        }
    }
    return op;
}

int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    unsigned long op_pos = 0,op_neg=0;

    for(int i=0; i<n; i++){
        cin >> a[i];
    }
    int first = a[0];
    if(first>0){
        op_pos = greed(a);
        a[0] = -1;
        op_neg = greed(a) + first + 1;
    }else if(first<0){
        op_neg = greed(a);
        a[0] = 1;
        op_pos = greed(a) - first + 1;
    }else{
        a[0] = 1;
        op_pos = greed(a) + 1;
        a[0] = -1;
        op_neg = greed(a) + 1;
    }
    

    cout << min(op_neg,op_pos) << endl;
}

Measured memory_bytes: 640
import java.util.*;
import static java.lang.Math.*;
import java.math.BigInteger;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		// 入力
		int a = sc.nextInt();
		int b = sc.nextInt();
		String s = sc.next();
		
		// 計算
		String result = "No";
		String[] array = s.split("-");
		//System.out.println(Arrays.toString(array));
		if(array.length == 2 && array[0].length() == a && array[1].length() == b) result = "Yes";
		
		
		// 出力
		System.out.println(result);
	}
}




Measured memory_bytes: 23764
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

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

  int l;
  vector<int> L;
  for(int i = 0; i < N; i++) {
    cin >> l;
    L.push_back(l);
  }
  sort(L.begin(), L.end());

  int a, b, c, count = 0;
  for(int i = 0; i < N - 2; ++i) {
    for(int j = i + 1; j < N - 1; ++j) {
      for(int k = j + 1; k < N; ++k) {
        a = L[i];
        b = L[j];
        c = L[k];
        if(!(a < b + c && b < c + a && c < a + b)) {
          break;
        }
        ++count;
      }
    }
  }

  cout << count;
}


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

int gcd(int a, int b);
int gcd(const std::vector<int>& arr);

int main() {

        int r = 0;
        int D = 0;
        int x = 0;

        std::cin >> r >> D >> x;

        for (std::size_t n = 0; n < 10; ++n) {
                x = r * x - D;
                std::cout << x << std::endl;
        }

        return 0;
}

int gcd(int a, int b) {
        if (a > b) {
                std::swap(a, b);
        }

        for (int r = b % a; r != 0; b = a, a = r, r = b % a)
                ;

        return a;
}

int gcd(const std::vector<int>& arr) {
        const int size = arr.size();
        if (size == 0) {
                return 0;
        }
        else if (size == 1) {
                return arr[0];
        }

        int ret = gcd(arr[0], arr[1]);

        for (std::size_t i = 2; i < size && ret != 1; ++i) {
                ret = gcd(arr[i], ret);
        }

        return ret;
}



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

#define FOR(i, a, b) for (int i=a; i<b; i++)
#define For(i, a) for (int i=0; i<a; i++)
#define FORR(i,a,b) for (int i = a; i >= b; i--)
#define Forr(i,a) for (int i = a; i >= 0; i--)

#define deb(...) cerr << "[" << #__VA_ARGS__ << "] : [", DBG(__VA_ARGS__)
void DBG() { cerr << "]\n";}
template<typename T, typename ...Args> void DBG(T first, Args... args)
{cerr << first; if(sizeof...(args))cerr<<", "; DBG(args...); }




void solve(){
  int n; cin >> n;
  vector<int> a,b;
  For(i,n){
    int x,y; cin >> x >> y;
    a.push_back(x+y);
    b.push_back(x-y);
  }
  sort(a.begin(),a.end());
  sort(b.begin(),b.end());
  cout << max(a.back()-a.front(),b.back()-b.front())<<"\n";
}

int32_t main(){
  ios_base:: sync_with_stdio(false);
  cin.tie(0);
  int t=1;
  for(int tt=1;tt<=t;tt++){
    solve();
  }
}

Measured memory_bytes: 6696
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
using namespace std;

int main(){
    int d, n;
    cin >> d >> n;
    int a = pow(100, d);
    int an = a * n;
    if(n==100){
        an += pow(100, d);
    }
    cout << an << endl;
}

Measured memory_bytes: 512
#include<stdio.h>
#include<math.h>
#include<queue>
#include<stack>
#include<string.h>
#include<algorithm>
#include<cctype>
#include<vector>
#include<map>
#include<set>
typedef long long ll;
using namespace std;
const ll mod=1e9+7;
int a[105];
int main()
{
	int n,cou1=0,cou2=0;
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%d",&a[i]);
		cou1+=a[i]*a[i];
		cou2+=a[i];
	}int cou3=int(1.0*cou2/n+0.5);
	printf("%d\n",cou1-2*cou2*cou3+n*cou3*cou3);
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,f,n) for(int i=f; i<(n); i++)
int main()
{
  int ans = 0;
  int n;
  vector<int> a,b,c;
  cin >> n;
  REP(i,0,n){
    int inter;
    cin >> inter;
    a.push_back(inter);
    c.push_back(i+1);
  }
  REP(i,0,n){
    int inter;
    cin >> inter;
    b.push_back(inter);
  }

  int cnt=0;
  do{
    int a_co=0, b_co=0;
    cnt++;
    REP(i,0,n){
      if(c[i] == a[i])a_co++;
      if(c[i] == b[i])b_co++;
    }
    if(a_co==n)ans+=cnt;
    if(b_co==n)ans-=cnt;
  }while(next_permutation(c.begin(),c.end()));

  cout << abs(ans) << endl;

  //--debug : end_stoper
  //string end_stoper; cin >> end_stoper;

  return 0;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
int n, p[505][505], q, x, y, ans, dx[] = {0,0,1,-1}, dy[] = {1,-1,0,0}, used[505][505];
void dfs(int x, int y){
	p[x][y]--;
	rep(i,4){
		int nx = x + dx[i], ny = y + dy[i];
		if(p[nx][ny] + used[nx][ny] == p[x][y] + 2) dfs(nx,ny);
	}
}
int main(){
	scanf("%d", &n);
	ans = -n * n;
	rep(i,n) rep(j,n) p[i+1][j+1] = min({i,n-1-i,j,n-1-j}) + 1;
	rep(i,n) rep(j,n){
		scanf("%d", &q); q--;
		x = q % n + 1; y = q / n + 1;
		used[x][y] = 1;
		ans += p[x][y];
		dfs(x, y);
	}
	printf("%d\n", ans);
}

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

int main(){
    int n;
    cin>>n;
    vector<int> p(n);
    for(int i=0;i<n;i++) cin>>p[i];   

    vector<int> pos(n);
    for(int i=0;i<n;i++){
        pos[p[i]-1]=i;
    }
    vector<int> dp(n,1);
    for(int i=1;i<n;i++){
        if(pos[i-1]<pos[i]) dp[i]=dp[i-1]+1;
        else dp[i]=1;
    }
    cout<<n-*max_element(dp.begin(),dp.end());
    
    return 0;
}

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

using namespace std;
typedef long long ll;

vector<vector<int>> all;

void rec(int now, int cnt, vector<int> p, int n) {
    p.push_back(now);
    if (cnt == n) {
        all.push_back(p);
        return;
    }

    for (int i = 0; i < n; i++) {
        bool f = true;
        for (int j = 0; j < p.size(); j++) {
            f &= (p[j] != i);
        }
        if (f) rec(i, cnt+1, p, n);
    }

}

int main() {
    int n; cin >> n;
    vector<int> x(n), y(n);
    for (int i = 0; i < n; i++) {
        cin >> x[i] >> y[i];
    }

    for (int i = 0; i < n; i++) {
        rec(i, 1, vector<int>(), n);
    }

    double tot = 0;
    for (int i = 0; i < all.size(); i++) {
        for (int j = 0; j < all[i].size()-1; j++) {
            double xi = x[all[i][j]], xni = x[all[i][j+1]];
            double yi = y[all[i][j]], yni = y[all[i][j+1]];
            tot += sqrt(pow(xi - xni, 2) + pow(yi - yni, 2));
        }
    }
    double ans = tot / (double)all.size();
    printf("%.10lf\n", ans);
}


Measured memory_bytes: 3256
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define ll long long int
#define INF INT_MAX
#define mod
#define chutiyaap ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
using namespace std;
bool sortbysec(const pair<ll,ll> &a,const pair<ll,ll> &b){return (a.second < b.second);}
ll gcd(ll a, ll b){if(a==0)return b;return gcd(b % a, a);}
int main()
{
	chutiyaap;
	ll n;cin>>n;
	ll a[n+1];
	for(ll i=0;i<n;i++)cin>>a[i];
	sort(a,a+n);
	ll maxi=a[n-1];
	ll sum=0;
	for(ll i=0;i<n-1;i++)sum+=a[i];
	if(maxi<sum)cout<<"Yes";
	else cout<<"No";
}


Measured memory_bytes: 256
mod=10**9+7
n=10**6
inv_t=[0]+[1]
for i in range(2,n):
  inv_t+=[inv_t[mod%i]*(mod-int(mod/i))%mod]

kai=[1,1]
rev_kai=[1,inv_t[1]]
for i in range(2,n):
  kai.append(kai[-1]*i%mod)
  rev_kai.append(rev_kai[-1]*inv_t[i]%mod)

def cmb(n,r):
  return kai[n]*rev_kai[r]*rev_kai[n-r]%mod

def prm(n,r):
  return kai[n]*rev_kai[n-r]%mod

N,M=map(int, input().split())
def f(x):
  e=cmb(N,x)*prm(M,x)*prm(M-x,N-x)*prm(M-x,N-x)
  e%=mod
  return e

ans=0
for i in range(N+1):
  g=f(i)*((-1)**i)
  ans+=g
print(ans%mod)

Measured memory_bytes: 214236
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using vll = vector<ll>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vb = vector<bool>;
using pii = pair<int, int>;

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

//pow(llpow,modpow)
template <class T>
ll llpow(ll x, T n)
{
    ll ans = 1;
    if (x == 0)
        ans = 0;
    while (n)
    {
        if (n & 1)
            ans *= x;
        x *= x;
        n >>= 1;
    }
    return ans;
}
long long modpow(long long a, long long n, long long mod)
{
    long long res = 1;
    while (n > 0)
    {
        if (n & 1)
            res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
//最大公約数
template <class T>
inline T gcd(T x, T y)
{
    if (y == 0)
        return x;
    else
    {
        return gcd(y, x % y);
    }
}
//最小公倍数
template <class T>
inline T lcm(T x, T y) { return x / gcd(x, y) * y; }
//逆元
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;
}

#define rep(i, begin_i, end_i) for (ll i = (ll)begin_i; i < (ll)end_i; i++)
#define irep(i, end_i, begin_i) for (ll i = (ll)begin_i-1; i >= (ll)end_i; i--)

long long INF = 1LL << 60;
int main()
{
    int n;
    cin >> n;
    vi a(n); rep(i,0,n)cin>>a[i];
    vector<int> c;
    irep(i, 0, n)
    {
        auto p=upper_bound(c.begin(),c.end(),a[i]);
        if(p!=c.end()){
            int dist=distance(c.begin(),p);
            c[dist]=a[i];
        }
        else
        {
            c.push_back(a[i]);
        }
    }
    cout << c.size() << endl;
    return 0;
}


Measured memory_bytes: 1276
package main

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

func main() {
	log.SetFlags(log.Lshortfile)
	N := nextInt()
	M := nextInt()
	comb := NewCombination()
	mp := prime_factor(M)
	ans := 1
	for _, v := range mp {
		ans = ans * comb.c(v+N-1, N-1) % int(1e9+7)
	}
	fmt.Println(ans)
}
func prime_factor(n int) map[int]int {
	res := map[int]int{}
	for i := 2; i*i <= n; i++ {
		for n%i == 0 {
			res[i]++
			n /= i
		}
	}
	if n != 1 {
		res[n]++
	}
	return res
}

type Combination struct {
	max, mod int
	fact     []int
	factInv  []int
	inv      []int
}

func NewCombination() *Combination {
	c := &Combination{}
	c.max = 200010
	c.mod = int(1e9) + 7
	c.fact = make([]int, c.max)
	c.factInv = make([]int, c.max)
	c.inv = make([]int, c.max)
	return c
}

func (c *Combination) build() {
	c.inv[1], c.fact[0], c.factInv[0] = 1, 1, 1
	var i int
	for i = 2; i < c.max; i++ {
		c.inv[i] = c.inv[c.mod%i] * (c.mod - c.mod/i) % c.mod
	}
	for i = 1; i < c.max; i++ {
		c.fact[i] = c.fact[i-1] * i % c.mod
		c.factInv[i] = c.factInv[i-1] * c.inv[i] % c.mod
	}
}

func (c *Combination) chack() {
	if c.inv[1] != 1 {
		c.build()
	}
}

func (c *Combination) c(n, k int) int {
	c.chack()
	if n < 0 || k < 0 || n < k {
		return 0
	}
	return c.fact[n] * c.factInv[k] % c.mod * c.factInv[n-k] % c.mod
}

func (c *Combination) p(n, k int) int {
	c.chack()
	if k < 0 || k > n {
		return 0
	}
	return c.fact[n] * c.factInv[n-k] % c.mod
}

func (c *Combination) h(n, k int) int {
	c.chack()
	if n == 0 && k == 0 {
		return 1
	}
	return c.c(n+k-1, k)
}

// c:N 個の整数の中から，相異なる K 個の整数を選ぶパターンの数C(N,K)
// p:N 個の整数の中から，相異なる K 個の整数を選び，順番に並べるパターンの数P(N,K)
// h:N 個の整数の中から，重複を許して K 個の整数を選ぶパターンの数H(N,K)

func max(a ...int) int {
	r := a[0]
	for i := 0; i < len(a); i++ {
		if r < a[i] {
			r = a[i]
		}
	}
	return r
}
func min(a ...int) int {
	r := a[0]
	for i := 0; i < len(a); i++ {
		if r > a[i] {
			r = a[i]
		}
	}
	return r
}
func sum(a []int) (r int) {
	for i := range a {
		r += a[i]
	}
	return r
}
func minmax(a, b int) (int, int) {
	if a > b {
		return b, a
	}
	return a, b
}
func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

type Pair struct {
	a, b int
}

type Pairs []Pair

func (p Pairs) Len() int {
	return len(p)
}
func (p Pairs) Swap(i, j int) {
	p[i], p[j] = p[j], p[i]
}

func (p Pairs) Less(i, j int) bool {
	return p[i].b < p[i].b
}

var nextReader func() string

func init() {
	nextReader = NewScanner()
}

func NewScanner() func() string {
	r := bufio.NewScanner(os.Stdin)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)
	return func() string {
		r.Scan()
		return r.Text()
	}
}
func nextString() string {
	return nextReader()
}
func nextInt64() int64 {
	v, _ := strconv.ParseInt(nextReader(), 10, 64)
	return v
}
func nextInt() int {
	v, _ := strconv.Atoi(nextReader())
	return v
}
func nextInts(n int) []int {
	r := make([]int, n)
	for i := 0; i < n; i++ {
		r[i] = nextInt()
	}
	return r
}
func nextFloat64() float64 {
	f, _ := strconv.ParseFloat(nextReader(), 64)
	return f
}


Measured memory_bytes: 5504
import sys
from bisect import *
from collections import *
from copy import deepcopy
from datetime import *
from heapq import *
from itertools import *
# from math import *
from operator import *
from pprint import *

sys.setrecursionlimit(10**8)

input = sys.stdin.readline

def main():
    """ main """
    N,M = map(int, input().split())

    res = [i for i in range(1,M+1)]
    res = set(res)
    for _ in range(N):
        AS = list(map(int, input().split()))
        AS = set(AS[1:])
        res &= AS
    print(len(list(res)))

if __name__ == '__main__':
    main()

Measured memory_bytes: 3952
#include<bits/stdc++.h>
using namespace std ;
 
#define int long long
#define endl '\n'

#define IOS ios::sync_with_stdio(0) ; cin.tie(0) ; cout.tie(0) ;
 
#define pb push_back
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<vi>
#define vp vector<pii>
#define vs vector<string>
#define all(v) v.begin(),v.end()

#define lb  lower_bound
#define ub  upper_bound
#define bs  binary_search
#define ff  first
#define ss  second
#define sz(x) ((int)(x).size())
#define rep(i,l,r) for(int i=(l);i<(r);++i)
 
#define gcd(a,b)    __gcd((a),(b))
#define lcm(a,b)    ((a)*(b)) / gcd((a),(b))
     
#define pi 3.14159265358979323846264338327950L
#define MOD 1000000007

int32_t main(){

   
     int a,b,c,d,e;
     cin>>a>>b>>c>>d>>e;
     if(b!=a+1&&b+1==c)
      cout<<"1";
     else if(c!=b+1&&c+1==d)
      cout<<"2";
    else if(d!=c+1&&d+1==e)
      cout<<"3";
    else if(e!=d+1&&d-1!=c)
      cout<<"4";
    else
      cout<<"5";
    
  return 0;
}




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

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

int main( void ) {

	rep(i,3123){
		int a,b;
		cin >>a>>b;
		if(a==0 && b ==0)break;
		else
		cout << min(a,b) <<" "<<max(a,b)<<endl;
	}
    return 0;
}



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

int main() {

  vector<int> S(2);
  cin >> S.at(0);
  S.at(1) = S.at(0)%100;
  S.at(0) /= 100;
  
  if(0<S.at(0) && S.at(0)<13){
    if(0<S.at(1)&& S.at(1)<13){ 
      cout << "AMBIGUOUS" << endl;
    }else{
      cout << "MMYY" <<endl;
    }
    
  }else{
    if(0<S.at(1)&&S.at(1)<13){
      cout << "YYMM" << endl;
    }else{
      cout << "NA" << endl;
    }
  }
  
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define all(a) a.begin(), a.end()
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<ll,ll> P;
#define rep(i,a,b) for(int i=a ; i<b ; i++)
#define qrep(que, ite) for(auto ite=begin(que) ; ite!=end(que) ; ite++)
const int max_n = 1e5;
const ll mod = 1e9+7;
const ll INF = 1LL<<60;
const int inf = 1<<30;
//typedef long double ld;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};
ll mo = 998244353;
ll jou(ll n, ll x){
  ll res = 1;
  while(n){
    if(n & 1) res = res*x % mo;
    x = x*x % mo;
    n >>= 1;
  }
  return res;
}
int main(){
  ll s; cin >> s;
  ll k = 1e9;
  ll a = 1;
  ll b = 1e9;
  ll c = (s+b-1)/b;
  ll d = c*b-s;
  printf("0 0 1 %lld %lld %lld\n", b,c,d);
  return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
        int height,width;
        
        for(;;){
            cin >> height >> width;
            if((!height) && (!width)){
                break;
            }
            for(int i = 0; i < height; ++i){
                for(int j = 0; j < width; ++j){
                    if((i >= 1) && (i <= (height - 2)) && (j >=1) && (j <=(width - 2))){
                        cout << ".";
                    }
                    else{
                        cout << "#";
                        if(j == (width - 1)){
                        cout << "\n";
                        }
                    }
                }
            }
            cout << "\n";
        }
}



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

using namespace std;

int main(int argc, char const* argv[])
{
    int N;
    string S;
    cin >> N;
    cin >> S;
    for(char s : S)
        cout << (char)(((int)s-'A'+N)%26+'A'); 
    cout << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int
#define fl(i,x,y) for( int i=x;i<y;i++)
#define w(t) while(t--)
#define vi vector<ll>
#define vvi vector< vi >
#define si set<ll>
#define msi multiset<ll>
#define si_d set<ll, greater<ll> >
#define mii map<ll,ll>
#define pb push_back
#define msi_it  multiset<ll> :: iterator
#define si_it set<ll> :: iterator
#define sort1(v) sort(v.begin(),v.end());
#define F first
#define S second
using namespace std;
#define N 1000000007
#define mod 15000000000031
int main()
{
	int n;cin>>n;
	if(n%2==0) cout<<n/2;
	else cout<<(n/2)+1;
}

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

signed main() {
  int n;
  cin>>n;
  pair<int,int> a[n];
  int b;
  for(int i=1;i<=n;i++){
    cin>>b;
    a[i-1]=make_pair(b,i);
  }
  sort(a,a+n);
  for(int i=0;i<n;i++){
    cout<<a[i].second<<' ';
  }
  return 0;
}


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

lli n;

int main(void){
	cin >> n;
	vector<lli> a(n+1), b(n+1);
	for(int i = 1; i <= n; i++) cin >> a[i] >> b[i];
	lli c = 0;
	for(int i = n; i >= 1; i--){
		c+=(b[i]-(a[i]+c)%b[i])%b[i];
	}
	cout << c << endl;
	return 0;
}


Measured memory_bytes: 4824
#include<stdio.h>
#include<vector>
using namespace std;
typedef struct{
	int p,lch,rch;
}B;
B bar[100000];
vector<int> bars[1000];
int p[2][1000];
int us[1000];
int ls[1000];
int min(int a,int b){return a<b?a:b;}
int main(){
	int n,m,h,k;
	int i,j;
	while(1){
	scanf("%d %d %d %d",&n,&m,&h,&k);
	if(n==0)return 0;
	for(i=0;i<1000;i++)bars[i].clear();
	for(i=0;i<n;i++)scanf("%d",&ls[i]);
	for(i=0;i<m;i++){
		int pos,hh;
		scanf("%d %d",&pos,&hh);pos--;
		bar[i]=(B){pos,-1,-1};
		bars[hh].push_back(i);
	}
	for(i=0;i<n;i++)p[0][i]=i;
	for(i=1;i<h;i++){
		for(j=0;j<n;j++)p[i%2][j]=p[(i+1)%2][j];
		for(j=0;j<bars[i].size();j++){
			int x=bars[i][j];
			int pos=bar[x].p;
			bar[x].lch=p[(i+1)%2][pos];
			bar[x].rch=p[(i+1)%2][pos+1];
			p[i%2][pos]=p[(i+1)%2][pos+1];
			p[i%2][pos+1]=p[(i+1)%2][pos];
		}
	}
	int tot=0;
	for(i=0;i<n;i++){
		us[p[(h+1)%2][i]]=ls[i];
		if(p[(h+1)%2][i]<k)tot+=ls[i];
	}
	int ans=tot;
	for(i=0;i<m;i++){
		int l=bar[i].lch;
		int r=bar[i].rch;
		if((l<k&&r<k)||(r>=k&&l>=k))continue;
		if(l<k)ans=min(ans,tot-us[l]+us[r]);
		else ans=min(ans,tot-us[r]+us[l]);
	}
	printf("%d\n",ans);
	}
}

Measured memory_bytes: 2820
#include <bits/stdc++.h>
#define fast_io ios :: sync_with_stdio(false);
using namespace std;

int main() {
	cout << fixed << setprecision(3);
	fast_io;
	string s; cin >> s;
	int n = 0;
	for (int i = 0 ; i<4 ; i++){
		for (int j = 0 ; j<4 ; j++){
			if (s[i] == s[j])
				n++;
    	}
  	}
  
  	if (n == 8)
    	cout << "Yes\n";
  	else
    	cout << "No\n";
	return 0;	
}

Measured memory_bytes: 3612
while True:
    m, f, r = map(int, raw_input().split())
    if m == -1 and f == -1 and r == -1:
        break
    elif m == -1 or f == -1:
        print 'F'
    elif m+f >= 80:
        print 'A'
    elif m+f >= 65:
        print 'B'
    elif m+f >= 50 or (m+f >= 30 and r >= 50):
        print 'C'
    elif m+f >= 30:
        print 'D'
    else:
        print 'F'

Measured memory_bytes: 6304
#include <bits/stdc++.h>
#include <unordered_map>
#include <unordered_set>
#define initdp(a, b)  for (int i = 0; i <= a; i++)   for (int j = 0; j <= b; j++) dp[i][j] = -1;
#define fi first
#define se second
#define pb push_back
#define pii pair<int, int>
#define ll long long
#define pll pair<ll, ll>
#define all(arr) arr.begin(), arr.end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repd(i, n) for (int i = n - 1; i >= 0; i--)
#define fo(i, l, r) for (int i = l; i <= r; i++)
#define inf 1000000001
#define inf1 1000000000000000001
#define mod 1000000007
#define pie 3.14159265358979323846
#define N 1000005
#define mid(l, r) l + (r - l) / 2
#define vec vector<int>
#define vecl vector<ll>
#define yes cout << "Yes" << endl;
#define no cout << "No" << endl;
#define umapi unordered_map<ll, ll>
#define umapc unordered_map<char, int>
#define endl "\n"
#define pui pair<int, pair<int,int> >
using namespace std;

/*
            ॐ
    || Jai Shree Ram ||  
 
 */






void solve(){
    
    ll x,k,d;
    cin>>x>>k>>d;
    
    x = abs(x);

    ll req = x/d;

    // req--;

    if(k <= req) {
        cout<<abs(x - k*d);
        return;
    }

    k = k-req;

    if(k%2 == 0) {
        cout<<abs(x-req*d);
        return;
    } 

    cout<<abs(x-(req+1)*d);
    // if(x%d == 0 && req <= k) {
    //     if((req%2) == (k%2)) {
    //         cout<<0<<endl;
    //     } else {
    //         cout<<d<<endl;
    //     }
    //     return;
    // }
    // ll ans ;
    // if ( req >= k) {
    //     ans = abs(x - k*d);
    // } else {
    //     ans = min(abs(x - req*d), abs(x - (req-1)*d));
    // }

    // cout<<ans<<endl;


}

 
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cout<<fixed<<setprecision(10);
    int t = 1;
    // //cin >> t;
    while (t--)
    {
        solve();
    }
}



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

int main(void){
    string S,T;
    cin >> S >> T;
    for(int i = 0 ; i < S.size() ; i++){
        if(S.at(i) != T.at(i)){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 3636
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")
#pragma GCC target("avx,avx2,fma")
#include <bits/stdc++.h>
#define f first
#define s second
#define fore(i,a,b) for(lli i = (a), ThxMK = (b); i < ThxMK; ++i)
#define pb push_back
#define all(s) begin(s), end(s)
#define rall(s) rbegin(s), rend(s)
#define _ ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define sz(s) int(s.size())
#define ENDL '\n'
using namespace std;
typedef long double ld;
typedef long long lli;
typedef pair<lli,lli> ii;
typedef vector<lli> vi;
#define deb(x) cout << #x": " << (x) << endl;

int main(){ _
    lli t;
    cin >> t;
    if(t==0)cout << '1' <<ENDL;
    else cout << '0' <<ENDL;
    return 0;
}


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

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

int main() {
  int d, w;
  while ( cin >> d >> w, d ) {
    int e[d][w];
    for ( int i = 0; i < d; i++ ) {
      for ( int j = 0; j < w; j++ ) {
	cin >> e[i][j];
      }
    }

    int ans = 0;    
    for ( int a = 1; a <= 9; a++ ) {
      for ( int i = 1; i < d-1; i++ ) {
	for ( int j = 1; j < w-1; j++ ) {
	  if ( e[i][j] >= a ) continue;
	  int y = i, x = j;
	  while ( y+1 < d-1 && e[y+1][j] < a ) y++;
	  while ( x+1 < w-1 && e[i][x+1] < a ) x++;
	  bool flag = true;
	  int sum = 0;
	  // if ( a == 2 ) cout << i << j << y << x << endl;
	  for ( int r = i; r <= y; r++ ) {
	    for ( int c = j; c <= x; c++ ) {
	      sum += a-e[r][c];	      
	      for ( int k = 0; k < 9; k++ ) {	      
		int ny = r+dy[k], nx = c+dx[k];
		if ( k == 0 && e[ny][nx] >= a ) {		  
		  flag = false;
		  r = y; c = x; break;		  
		}
		if ( (ny < i || y < ny || nx < j || x < nx) && e[ny][nx] < a ) {
		  flag = false;
		  r = y; c = x; break;		  
		}
	      }	      
	    }
	  }
	  if ( flag ) {
	    ans = max(ans, sum);
	    // if ( sum == 22 ) cout << i << " " << j << " " << a << endl;
	  }	  
	}
      }
    }

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



Measured memory_bytes: 3008
use proconio::input;

fn main() {
    input! {
        n: usize
    }
    let mut res = 0;
    let g = |n| { n * (n+1) / 2 };
    for i in 1..=n {
        res += g(n/i) * i;
    }
    println!("{}", res);
}


Measured memory_bytes: 2156
#include<bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL)
#define ll long long
#define ld long double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pld pair<ld,ld>
#define pb push_back
const int MAXN = 1e5+7;
int ap[MAXN], bp[MAXN], mna=3*MAXN, mnb=3*MAXN;
int main(){
    fastio;
    int a,b,m; cin>>a>>b>>m;
    for(int i=1; i<=a; i++){
        cin>>ap[i];
        mna = min(ap[i], mna);
    }
    for(int i=1; i<=b; i++){
        cin>>bp[i];
        mnb = min(bp[i], mnb);
    }
    int ans = mna + mnb;
    for(int i=1; i<=m; i++){
        int xi, yi, ci; cin>>xi>>yi>>ci;
        ans = min(ans, ap[xi]+bp[yi]-ci);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 1024
n,m,q = map(int,input().split())
abcd = [list(map(int,input().split())) for i in range(q)]
ls = []
def dfs(a):
  if len(a) == n:
    ls.append(a)
  else:
    for i in range(a[-1],m+1):
      b = a+[i]
      dfs(b)
for i in range(1,m+1):
  dfs([i])
ans = 0
for x in ls:
  anstmp = 0
  for a,b,c,d in abcd:
    if x[b-1]-x[a-1] == c:
      anstmp += d
  ans = max(anstmp,ans)
print(ans)

Measured memory_bytes: 96552
#include<stdio.h>

int  n , yaku[101] = {0};

int num(int a){
  int c = 0;
  for(int i = 2;i <= n;i ++){
    if(yaku[i] >= a-1) c ++;
  }

  return c;
}

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


  for(int i = 2;i <= n;i ++){
    int a = i , waru = 2;
    while(a > 1){
      while(a%waru == 0){
        a /= waru;
        yaku[waru] ++;
      }
      waru ++; 
    }
  }

  int ans = num(75) + num(25)*(num(3)-1) + num(15)*(num(5)-1) + num(5)*(num(5)-1)*(num(3)-2)/2;

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

Measured memory_bytes: 1680
//{{{
#include<algorithm>
#include<cmath>
#include<deque>
#include<fstream>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<random>
#include<set>
#include<sstream>
#include<sys/time.h>
#include<unordered_map>
#include<unordered_set>
#include<vector>
using ll = long long;
enum : int { M = (int)1e9 + 7 };
enum : ll { MLL = (ll)1e18L + 9 };
using namespace std;
#ifdef LOCAL
#include"rprint2.hpp"
#else
#define FUNC(name) template <ostream& out = cout, class... T> void name(T&&...){ }
FUNC(printde) FUNC(printdbe) FUNC(printdwe) FUNC(printdu);
#endif
template <template <class T, class = std::allocator<T>> class V, class E>
istream& operator >> (istream& in, V<E>& v){ for(auto& e : v){ in >> e; } return in; }
//}}}

int main(){
    cin.tie(0); ios::sync_with_stdio(false);
    string s; cin >> s;
    cout << (s[0] == 'S' ? "Cloudy" : s[0] == 'C' ? "Rainy" : "Sunny") << '\n';
}


Measured memory_bytes: 760
h,w=map(int,input().split())
b=[["#"]*(w+2)]
a=0
for i in range(h):
  c=["#"]
  for j in input():
    a+=j=="#"
    c.append(j)
  b.append(c+["#"])
b+=[["#"]*(w+2)]
b[h][w]=0
Q=[(1,1)]
x=0
y=-1
while Q:
	x+=1
	p=[]
	for i,j in Q:
		for dx,dy in [(1,0),(-1,0),(0,1),(0,-1)]:
			if b[i+dx][j+dy]==".":
				p+=[(i+dx,j+dy)]
				b[i+dx][j+dy]="#"
			elif b[i+dx][j+dy]==0:
				y=x
	if y>0:break
	Q=p
if y>0:print((h*w)-a-y-1)
else:print(-1)


Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#define rep(i, n) for(i = 0; i < n; i++)
#define int long long
using namespace std;

int n;
string s;

signed main() {
	int i, j;
	
	map<vector<int>, int> dict;
	
	cin >> n;
	rep(i, n) {
		cin >> s;
		vector<int> cnts;
		rep(j, 26) cnts.push_back(0);
		rep(j, s.length()) {
			cnts[s[j] - 'a']++;
		}
		dict[cnts]++;
	}
	
	int ans = 0;
	for (map<vector<int>, int>::iterator it = dict.begin(); it != dict.end(); it++) {
		ans += it->second * (it->second - 1) / 2;
	}
	cout << ans << endl;
	return 0;
}

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

int main(){
    ll a;
    double b;
    cin>>a>>b;
    ll fb=(ll)floor(b);
    ll hb=(ll)((b-fb)*100+0.05);
    cout<<a*fb+(a*hb/100)<<endl;
    return 0;
}

Measured memory_bytes: 3840
#include <utility>
#include <vector>
#include <iostream>
#include <algorithm>
#include <functional>
#include <map>
#include <set>
#include <list>
#include <string>
#define REP(i, n) for (int i = 0; i < n; i++)
using namespace std;

typedef long long ll;
typedef pair<ll, ll> Pll;

int main()
{
    int A[5];
    int min = 299;
    int minIndex = 0;
    for (int i = 0; i < 5; i++)
    {
        cin >> A[i];
        if (A[i] % 10 != 0 && min % 10 > A[i] % 10)
        {
            min = A[i];
            minIndex = i;
        }
    }

    int ret = 0;
    for (int i = 0; i < 5; i++)
    {
        if (i == minIndex)
        {
            ret += A[i];
        }
        else if (A[i] % 10 == 0)
            ret += A[i];
        else
        {
            ret += (A[i] / 10) * 10;
            ret += 10;
        }
    }

    cout << ret << endl;
}

void cheatsheet()
{
    // loop
    // vector<int> vec(10);
    vector<int> vecloop;
    REP(i, 10)
    {
        vecloop.push_back(i);
    }

    // swap
    int a = 1;
    int b = 5;
    swap(a, b); // -> a = 5, b = 1

    // sort
    int arr[] = {1, 2, 3, 4, 5, 6, 7, 8, 9};
    sort(arr, arr + 9, greater<int>()); // 9 8 7 6 5 4 3 2 1

    // lower
    vector<int> vec(arr, end(arr));
    sort(vec.begin(), vec.end());
    cout << lower_bound(vec.begin(), vec.end(), 2)[0]; // 2

    // map
    map<Pll, ll> m;
    m[Pll(10, 100)] = 100;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <bitset>
#include <queue>
#include <stack>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <utility>
#include <string>
#include <algorithm>
#include <cmath>
#include <limits>

using namespace std;
using ll=long long;
using vint=vector<int>;
using pint=pair<int,int>;

const double EPS = 1e-9;
const int inf = numeric_limits<int>::max();

#define rep(i,n) for(int i=0;i<int(n);++i)
#define REP(i,a,b) for(int i=int(a);i<int(b);++i)
#define SHOW(a) cout << #a << " = " << a << endl
#define ARR(a,i,n) for(int i=0;i<int(n);++i) cout << #a << "[" << i << "]" << " = " << a[i] << endl

void solve(){
	int H, W;
	bool r[505][505] = {};
	bool b[505][505] = {};
	cin >> H >> W;

	rep(i, H)
		rep(j,W){
			if(i == 0){
				r[i][j] = true;
			}else if(i == H-1){
				b[i][j] = true;
			}else{
				if(j % 2){
					r[i][j] = true;
				}else{
					b[i][j] = true;
				}
			}
		}

	rep(i, H)
		rep(j,W){
			char t;
			cin >> t;
			if(t == '#'){
				r[i][j] = true;
				b[i][j] = true;
			}
		}

	rep(i, H){
		rep(j,W){
			if(r[i][j])
				cout << '#';
			else
				cout << '.';
		}
		cout << endl;
	}

	cout << endl;

	rep(i, H){
		rep(j,W){
			if(b[i][j])
				cout << '#';
			else
				cout << '.';
		}
		cout << endl;
	}
}

int main(){
	solve();
	return 0;
}

Measured memory_bytes: 1280
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long ll;
#define rep(n) for ( int i =0; i < n ; i ++)
int N, M;
int P[100000], Y[100000];
vector < int > yd[100001];
int main()
{
	scanf("%d %d ", &N, &M);
	rep(M) scanf("%d %d", &P[i], &Y[i]), yd[P[i]].push_back(Y[i]);
	rep(N) sort(yd[i + 1].begin(), yd[i + 1].end());
	rep(M) printf("%012lld\n", ll(P[i]) * 1000000 + int(lower_bound(yd[P[i]].
		begin(), yd[P[i]].end(), Y[i]) - yd[P[i]].begin()) + 1);
}

Measured memory_bytes: 7808
#include <cstdio>
#include <cstring>
#include <algorithm>

int main()
{
  char s[200001];
  
  scanf("%s", s);
  int len = strlen(s);
  char *p = s;
  while (*p == 'T') ++p;

  int remove = 0;
  int sc = 0;
  while (*p)
  {
    char* start = p;
    while (*p == 'S') ++p;
    if (*p == 0) break;
    sc += p - start;
    start = p;
    while (*p == 'T') ++p;
    int tc = p - start;
    remove += std::min(sc, tc) * 2;
    sc -= std::min(sc, tc);
  }
  printf("%d\n", len - remove);
  return 0;
}

Measured memory_bytes: 384
/*************************************************************************
	> File Name: c.cpp
	> Author: hrynb
	> Created Time: 2019年04月07日 星期日 23时45分37秒
 ************************************************************************/

#include<bits/stdc++.h>
using namespace std;
#define ff fisrt;
#define ss second;
#define mp(a,b) make_pair(a,b);
#define priority_queue PQ;
#define pb(a) emplace_back(a);
#define ll long long;
#define ull unsigned long long;
#define ld long double;
#define mem(a,b) memset(a,b,sizeof a)
#define all(a) a.begin(),a.end()
#define IOS ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
typedef pair<int,int> pii;
typedef map<int,int> mii;
typedef vector<int>V;

int main(){
	long long n,ans=0,a[10],minn;
	scanf("%lld",&n);
	for(int i=1;i<=5;i++)scanf("%lld",&a[i]);

	ans=n/a[1]+(n%a[1]==0?0:1);
	minn=a[1];
	for(int i=2;i<=5;i++){
		minn=min(minn,a[i]);
		if(a[i]>=a[i-1])ans++;
		else {
			long long less=n-minn*(ans-i+1);
			ans+=less/a[i]+(less%a[i]==0?0:1);
		}
	}

	printf("%lld\n",ans);
}


Measured memory_bytes: 256
#pragma GCC optimize("O3")
#include <bits/stdc++.h> 
using namespace std;
using ll=long long;
using P=pair<ll,ll>;
template<class T> using V=vector<T>; 
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
const ll inf=(1e18);
//const ll mod=998244353;
const ll mod=1000000007;
ll GCD(ll a,ll b) {return b ? GCD(b,a%b):a;}
ll LCM(ll c,ll d){return c/GCD(c,d)*d;}
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
int main(){
 ll d,t,s;
 cin>>d>>t>>s;
 cout<<(t>=(d+s-1)/s?"Yes":"No")<<"\n";
}


Measured memory_bytes: 3636