akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
using namespace std;

int main()
{

  int ans[32] = {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 num = 0;
  cin >> num;

  cout << ans[num-1];
  return 0;
}

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

int main (){
  
  int N;
  int sum = 0;
  cin >> N;
  
  for (int i = 0; i < N; i++){
    
    int l, r;
    cin >> l >> r;
    sum += r - l + 1;
    
  }
  
  cout << sum << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(void) {
	int N;
	int a, b;
	int ans=0;
	scanf("%d", &N);
	for (int i = 0; i <N; i++)
	{
		scanf("%d %d", &a, &b);
		ans += b - a+1;
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 128
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Convert;
using static System.Math;
//using Debug;
//using static System.Globalization.CultureInfo;
//using Edge = Pair<long, int>;
using System.Text;
class Program
{ 
    static void Main(string[] args)
    {
        Solve();
        //WriteLine(Solve());
    }
    static void Solve()
    {
        var str = ReadLine();

        WriteLine(str.Contains("AC") ? "Yes" : "No");
    }
}


Measured memory_bytes: 13140
n = int(input())
l = list(map(int, input().split()))

cnt = 0

for i in range(n):
    for j in range(i+1, n):
        for k in range(j+1, n):
            a = l[i]
            b = l[j]
            c = l[k]
            if a == b or b == c or c == a:
                continue
            if a + b > c and b + c > a and c + a > b:
                cnt += 1

print(cnt)

Measured memory_bytes: 9196
#include<iostream>
#include<stdio.h>
//#include <bits/stdc++.h>
#include<vector>
#include<float.h>
#include<iomanip>
#include<algorithm>
#include<string>
#include<cstring>
#include<math.h>
#include<cmath>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include<cassert>
#include<cmath>
#include<cstdint>

#define INF 1e9
#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 VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
#define vec(type,n) vector<type>(n)
#define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))
#define ALL(a)  (a).begin(),(a).end()

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using P = pair<ll, ll>;

const ll MOD = INF + 7;



int main(){
    int n;
    cin >> n;
    map<P, int>mp;
    vector<P>p;
    rep(i, n){
        int x, y;
        cin >> x >> y;
        p.emplace_back(x, y);
    }

    rep(i, n){
        rep(j, n){
            if(i == j)continue;
            mp[P(p[j].first - p[i].first, p[j].second - p[i].second)]++;
        }
    }
    int MX = 0;
    for(auto m : mp){
        MX = max(MX, m.second);
    }
    cout << n - MX << endl;
}

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

int main() {
    int arr[4];
    int req[4];
    req[0] = 1;
    req[1] = 9;
    req[2] = 7;
    req[3] = 4;

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

    int a = 0;
    for(int i = 0; i < 4; i++) {
        int q = req[i];
        for(int j = 0; j < 4; j++) {
            if(arr[j] == q) {
                a += 1;
                break;
            }
        }
    }

    if(a == 4) {
        cout << "YES";
    }else{
        cout << "NO";
    }

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<string>
#include<cstring> 
#include<cassert>
#include<cmath>
#include<sstream>
#include<fstream>
#include<map>
#include<set>
#include<vector>
#include<queue>
#include<stack>
#include<bitset>
using namespace std;
long long times[200005],num[200005];
long long a[100005];
long long b[200005];
int main(){
	int n,m;
	scanf("%d %d",&n,&m);
	long long sum=0;
	for(int i=0;i<n;i++){
		scanf("%d",&a[i]);
		a[i]--;
	}
	for(int i=1;i<n;i++){
		int x=a[i-1],y=a[i];
		if(y<x) y+=m;
		sum+=y-x;
		times[x+1]++;
		times[y+1]--;
		num[x+1]-=x;
		num[y+1]+=x;
	}
//	for(int i=0;i<2*m;i++) cout<<times[i]<<" ";
//	cout<<endl;
//	for(int i=0;i<2*m;i++) cout<<num[i]<<" "; 
//	cout<<endl;
//	cout<<times[0]<<" "<<num[0]<<endl;
	for(int i=1;i<2*m;i++){
		times[i]+=times[i-1];
		num[i]+=num[i-1];
		b[i]=i*times[i]+num[i]-times[i];
//		cout<<times[i]<<" "<<num[i]<<" "<<b[i]<<endl;
	}
	long long ma=-1;
	for(int i=0;i<m;i++){
		b[i]=b[i]+b[i+m];
//		cout<<b[i]<<"md"<<endl;
		ma=max(ma,b[i]);
	}
//	cout<<ma<<endl;
	cout<<sum-ma;
}

Measured memory_bytes: 5760
#include <bits/stdc++.h>
 
using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for (ll i = (ll)(n) - 1; i >= 0; i--)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007
#define INF (1LL << 62)

#define PI (acos(-1))
#define print(x) cout << x << endl
 
ll gcd(ll a, ll b) { return b ? gcd(b,a%b) : a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
typedef pair <ll,ll> P;

bool compare_by_b(pair<int, int> a, pair<int, int> b) {
    if(a.first != b.first){
        return a.first < b.first;
    }else{
        return a.second > b.second;
    }
}

template <typename T> 
ostream& operator<<(ostream& os, const vector<T>& v) 
{ 
    for (int i = 0; i < (int)v.size(); ++i) { 
        os << v[i]; 
        if (i != (int)v.size() - 1) 
            os << " "; 
    } 
    return os; 
} 

int main()
{
    ll N;
    cin >> N;
    vector<double> t(N);
    vector<double> v(N);
    vector<double> l(N);
    vector<double> r(N);
    double sum = 0.;
    rep(i, N) { 
        cin >> t[i];
        l[i] = sum;
        sum += t[i];
        r[i] = sum;
    }
    rep(i, N) {
        cin >> v[i];
    }
    v.insert(v.begin(), 0);
    v.push_back(0);
    l.insert(l.begin(), 0);
    l.push_back(sum);
    r.insert(r.begin(), 0);
    r.push_back(sum);
    vector<vector<double>> vel(N+2);
    rep(i, N+2) {
        for (double time = 0; time <= sum; time += 0.5) {
            if (time < l[i]) {
                vel[i].push_back(v[i] + (l[i] - time));
            } else if (l[i] <= time && time <= r[i]) {
                vel[i].push_back(v[i]);
            } else if (r[i] <= time) {
                vel[i].push_back(v[i] + (time - r[i]));
            } else {
                vel[i].push_back(0);
            }
        }
    }
    double ret = 0.;
    rep(i, vel[0].size()-1) {
        double upper = 1000;
        double bottom = 1000;
        rep(j, vel.size()) {
            upper = min(upper, vel[j][i]);
            bottom = min(bottom, vel[j][i+1]);
        }
        ret += (upper + bottom) * 0.5 / 2.0;
    }
    cout.precision(20);
    print(fixed << ret);
    return 0;
}

Measured memory_bytes: 32892
#include <iostream>
#include <algorithm>
#include <vector>
#define N_MAX (1<<15)
using namespace std;

bool isPrime[N_MAX];
vector<int> prime;


void make() {
  fill(isPrime, isPrime+N_MAX, true);
  isPrime[0] = isPrime[1] = false;
  for(int i = 2; i < N_MAX; ++i) {
    if(isPrime[i]) {
      prime.push_back(i);
      for(int j = i*2; j < N_MAX; j += i) isPrime[j] = false;
    }
  }
}


void solve(int &n) {
  int ans = 0;
  for(int i = 0; i < prime.size() &&  prime[i] <= n/2; ++i) {
    if(isPrime[n-prime[i]]) ans++;
  }
  cout << ans << endl;
}

main() {
  int n;
  make();
  while((cin >> n) && n) solve(n);
}

Measured memory_bytes: 0
// AOJ 2890: Pivots
// 2019.2.22 bal4u

#include <stdio.h>
#include <stdlib.h>

#if 1
#define gc() getchar_unlocked()
#define pc(c) putchar_unlocked(c)
#else
#define gc() getchar()
#define pc(c) putchar(c)
#endif
int in()
{
	int n = 0, c = gc();
	do n = 10 * n + (c & 0xf), c = gc(); while (c >= '0');
	return n;
}

int in2(char *s)
{
	int n = 0, c;
	
	*s++ = c = gc();
	do {
		n = 10 * n + (c & 0xf);
		*s++ = c = gc();
	} while (c >= '0');
	*(s-1) = 0;
	return n;
}

void out(char *s)
{
	while (*s) pc(*s++);
}

typedef struct { int pre, nxt; char a[7]; } T;
T tbl[100005]; int top, end;
int idx[100005];
int N;

int main()
{
	int i, Q, pre, nxt;

	N = in(), Q = in();
	for (i = 0; i < N; i++) {
		tbl[i].pre = i - 1, tbl[i].nxt = i + 1;
		idx[in2(tbl[i].a)] = i;
	}
	top = 0, end = N - 1;
	tbl[top].pre = tbl[end].nxt = -1;

	while (Q--) {
		i = idx[in()];
		pre = tbl[i].pre, nxt = tbl[i].nxt;
		if (pre >= 0) tbl[i].nxt = top, tbl[top].pre = i;
		if (nxt >= 0) tbl[i].pre = end, tbl[end].nxt = i;
		if (pre >= 0) end = pre; else end = i;
		if (nxt >= 0) top = nxt; else top = i;
		tbl[top].pre = tbl[end].nxt = -1;
	}
	out(tbl[top].a);
	for (nxt = tbl[top].nxt; nxt >= 0; nxt = tbl[nxt].nxt)
		pc(' '), out(tbl[nxt].a);
	pc('\n');
	return 0;
}


Measured memory_bytes: 3492
import sys
sys.setrecursionlimit(700000)

def s_in():
    return input()

def n_in():
    return int(input())

def l_in():
    return list(map(int, input().split()))

import math # version 3.5 >
from collections import defaultdict
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

def lcm(*numbers):
    return reduce(lambda x,y: (x * y) // math.gcd(x, y), numbers, 1)

def factorize(n):
    fct = []  # prime factor
    b, e = 2, 0  # base, exponent
    while b * b <= n:
        while n % b == 0:
            n = n // b
            e = e + 1
        if e > 0:
            fct.append((b, e))
        b, e = b + 1, 0
    if n > 1:
        fct.append((n, 1))
    return fct

n=n_in()
f=factorize(n)



res = 0

for _,i in f:
    j=1
    while i-j >= 0:
        i=i-j
        j+=1
        res += 1

print(res)


Measured memory_bytes: 67960
#include <stdio.h>
#define N 100000
#define Q 50000

int main(){

  int i,j,q,left,right,count=0,n,mid;
  int T[Q],S[N];
 
  scanf("%d",&n);
  for(i=0;i<n;i++) scanf("%d",&S[i]);
  scanf("%d",&q);
  for(j=0;j<q;j++) scanf("%d",&T[j]);
  
  for(j=0;j<q;j++){
    left=0;
    right=n;
    while(left < right){
      mid = (left + right) / 2;
      
      if(S[mid] == T[j]){
	count++;
	break;
      }
      else if(T[j] < S[mid]) right = mid; 
      else left = mid + 1;
    }
  }
  
  printf("%d\n",count);
  return 0;
}

Measured memory_bytes: 1184
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <stack>
#include <queue>
#define llong long long
#define INF (__INT32_MAX__ / 2)
#define MAX_NM 100000

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

int N, M, A[MAX_NM];
int main(int argc, char **argv) {
    cin >> N >> M;
    for(int i = 0; i < N; ++i)
        cin >> A[i];
    
    sort(A, A + N);

    priority_queue<ipair> p_que;
    for(int i = 0; i < M; ++i) {
        int B, C;
        cin >> B >> C;
        p_que.push(make_pair(C, B));
    }

    llong sum = 0;
    for(int i = 0; i < N; ++i) {

        ipair cur = p_que.empty() ? make_pair(-INF, 0) : p_que.top();
        if(A[i] < cur.first) {
            sum += cur.first;
            p_que.pop();
            if(cur.second >= 2) {
                p_que.push(make_pair(cur.first, cur.second - 1));
            }
        } else
            sum += A[i];
    }

    cout << sum << endl;
}

Measured memory_bytes: 1784
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int k = sc.nextInt();

        int n = 100;
        int count = 0;

        for(int i=0; i<1000; i++){
            if(a%n == 0 && b % n == 0){
                count++;
                if(count == k) break;
            }
            n--;
        }

        System.out.println(n);
        
    }
}

Measured memory_bytes: 23252
fn main() {
  fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
  }
  fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>().split_whitespace().map(|e| e.parse().ok().unwrap()).collect()
  }
  fn solve(input: Vec<i32>) -> i32 {
    let mut ans = input[0];
    for i in 1..input.len() {
      match input[i] - input[i-1] {
        x if x > 0 => ans += x,
        _ => {}
      };
    }
    ans
  }
  read_vec::<String>();
  let input = read_vec::<i32>();
  println!("{}", solve(input));
}



Measured memory_bytes: 4352
/*input
8 2
4 1 2 3 1 2 3 4
*/
#include <bits/stdc++.h>
using namespace std;

int read() {
	int x = 0, c = getchar();
	for(; !(c > 47 && c < 58); c = getchar());
	for(; (c > 47 && c < 58); c = getchar()) x = x * 10 + c - 48;
	return x;
}

const int N = 100005;
vector<int> G[N];
int a[N], n, k;

int ans = 0;

int dfs(int u) {
	int cur = 0;
	for(int v : G[u]) {
		int x = dfs(v);
		if(u > 1) {
			if(k - 1 == x) ++ ans;
				else cur = max(cur, x + 1);
		}
	}
	return cur;
}

int main(){
	n = read(), k = read();
	for(int i = 1; i <= n; a[i ++] = read());
	for(int i = 2; i <= n; ++ i) G[a[i]].emplace_back(i);

	dfs(1);
	printf("%d\n", ans + (a[1] > 1));
}

Measured memory_bytes: 14172
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Map<Integer, Integer> map = new HashMap<>();
        map.put(1, 2);
        map.put(2, 5);
        map.put(3, 5);
        map.put(4, 4);
        map.put(5, 5);
        map.put(6, 6);
        map.put(7, 3);
        map.put(8, 7);
        map.put(9, 6);
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int[] dp = new int[10002];
        Arrays.fill(dp, -1);
        dp[0] = 0;
        Integer[] a = new Integer[m];
        int[] b = new int[m];
        for (int i = 0 ; i < m ;i++) {
            a[i] = sc.nextInt();
        }
        Arrays.sort(a);
        for (int i = 0 ; i < m ; i++) {
            b[i] = map.get(a[m - 1 - i]);
        }
        for (int i = 1 ; i <= n ; i++) {
            for (int j = 0 ; j < m ; j++) {
                if (i >= b[j] && dp[i - b[j]] != -1) {
                    //最大の桁数の数字がb[j]だとすると、dp[i-b[j]]に一桁ついかしたものになるので
                    dp[i] = Math.max(dp[i - b[j]] + 1, dp[i]);
                }
            }
        }

        String ans = "";
        int remain = dp[n];
        int match = n;
        while (remain > 0) {
            for (int i = 0 ; i < m ; i++) {
                if (match >= b[i] && dp[match - b[i]] == remain - 1) {
                    ans += a[m - i - 1];
                    remain--;
                    match -= b[i];
                    break;
                }
            }
        }
        System.out.println(ans);

    }

}

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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template < typename T >
void vprint(T &v){
	REP(i, v.size()){
		cout << v[i] << " ";
	}
	cout << endl;
}

struct Edge{
    int dst;
    int weight;
    Edge(int dst, int weight): dst(dst), weight(weight) {}
};

struct TmpDist{
    int vertex;
    int dist;
    TmpDist(int vertex, int dist): vertex(vertex), dist(dist) {}
    bool operator< (const TmpDist& right)const{
        return dist > right.dist;
    }
};

typedef vector<Edge> Edges;
typedef vector<Edges> Graph;
const int INFINT = INT_MAX/2;

vector<int> dijkstra(Graph &G, int r){
    int V = G.size();
    vector<int> dist(V, INFINT);
    priority_queue<TmpDist> pq;
    vector<bool> check(V, false);
    TmpDist init(r, 0);
    pq.push(init);
    while(!pq.empty()){
        TmpDist td = pq.top();pq.pop();
        int now = td.vertex;
        if(!check[now]){
            check[now] = true;
            dist[now] = td.dist;
            for (int i=0;i<G[now].size();i++){
                if(dist[G[now][i].dst] > td.dist + G[now][i].weight){
                    TmpDist tdCandidate(G[now][i].dst, td.dist + G[now][i].weight);
                    pq.push(tdCandidate);
                }
            }
        }
    }
    return dist;
}

int main(){
	ll N, M, R;
	cin >> N >> M >> R;
	vector<ll> r(R);
	REP(i, R) cin >> r[i];
	REP(i, R) r[i]--;
	vector<ll> A(M), B(M), C(M);
	REP(i, M) cin >> A[i] >> B[i] >> C[i];
	REP(i, M) A[i]--;
	REP(i, M) B[i]--;

	ll dist[N][N];
	Graph G(N);
	REP(i, M){
		Edge e(B[i], C[i]);
		G[A[i]].push_back(e);
		Edge f(A[i], C[i]);
		G[B[i]].push_back(f);
	}

	REP(i, N){
		vector<int> dis = dijkstra(G, i);
		REP(j, N) dist[i][j] = dis[j];
	}

	vector<ll> perm(R);
	REP(i, R) perm[i] = i+1;

	ll res = LLONG_MAX/2;
	
	bool flag = true;
	while(1){
		ll tmp = 0;
		REP(i, R-1){
			tmp += dist[r[perm[i]-1]][r[perm[i+1]-1]];
		}
		res = min(res, tmp);
		if(!flag) break;
		flag = next_permutation(perm.begin(), perm.end());
	}
	

	cout << res << endl;

    return 0;
}

Measured memory_bytes: 1928
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  int M;
  cin >> M;
  
 if (N > 2*M) {
   cout << N-(2*M) << endl;
 }
  else {
    cout << 0 << endl;
  }
}

Measured memory_bytes: 256
#include<iostream>
#include<string.h>
using namespace std;
string s;
int const MAXN=300100;
int n, sin[MAXN], des[MAXN], res=1e9;
int main(){
	cin>>n>>s;
	if(s[0]=='W') sin[0]=1;
	for(int i=1;i<n;i++) sin[i]=(s[i]=='W')?sin[i-1]+1:sin[i-1];
	if(s[n-1]=='E') des[n-1]=1;
	for(int i=n-2;i>=0;i--) des[i]=(s[i]=='E')?des[i+1]+1:des[i+1];
	for(int i=0;i<n;i++){
		int sinistra=(i==0)?0:sin[i-1], destra=(i==n-1)?0:des[i+1];
		res=min(res,sinistra+destra);
	}
	cout<<res;
}

Measured memory_bytes: 2948
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <math.h> // sqrt
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <iomanip> // setprecision
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vb = vector<bool>;
using vll = vector<long long>;
using pii = pair<int, int>;
using psi = pair<string, int>;

int main() {
    int N, X, T;
    cin >> N >> X >> T;
    int ans = floor(N / X) * T;
    if (N % X != 0) {
        ans += T;
    }
    cout << ans << endl;
}


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

using namespace std;

#define llong long long int
#define ldouble long double
#define rep(i, n) for (int i = 0; i < n; ++i)
#define repr(i, n) for (int i = n; i >= 0; --i) 
#define stl_rep(itr, x) for (auto itr = x.begin(); itr != x.end(); ++itr)
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()

const static int MOD = 1000000000 + 7;
const static int INT_INF = 999999999;
const static llong INF = 1LL << 60;
const static double eps = 1e-6;
const static int dx[] = {1, 0, -1, 0};
const static int dy[] = {0, 1, 0, -1};

signed main (int argc, char *argv[]) {
    cin.tie(0);
    ios::sync_with_stdio(false);

    llong n, m;
    cin >> n >> m;
    vector<pair<llong, llong> > drink;
    vector<llong> A, B;
    rep(i, n) {
        llong a, b;
        cin >> a >> b;
        drink.push_back({a, i});
        A.push_back(a);
        B.push_back(b);
    }
    sort(all(drink));

    llong cur = 0;
    llong ans = 0;
    rep(i, drink.size()) {
        if (cur == m) break;
        int index = drink[i].second;
        if (cur + B[index] > m) {
            ans += A[index] * (m - cur);
            cur += m - cur;
        } else {
            cur += B[index];
            ans += A[index] * B[index];
        }
    }

    cout << ans << endl;

    return 0;
}

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

using namespace std;

bool palin(string x) {
	int n = x.size();
	int l = 0, r = n - 1;
	while(l <= r)
		if (x[l++] != x[r--])
			return false;
	return true;
}

bool check(string s) {
	int n = s.size();

	string a = s.substr(0, n / 2);
	string b = s.substr(n / 2 + 1);

	return palin(a) && palin(b) && palin(s);
}

int main() {
	
	ios_base :: sync_with_stdio(0); cin.tie(NULL);

	string s;
	cin >> s;

	cout << (check(s) ? "Yes" : "No") << '\n';



	return 0;	
}

Measured memory_bytes: 256
n = int(input())
red = []
blue = []
B = [0]*(n+1)
for i in range(n):
  red.append(list(map(int,input().split())))

for i in range(n):
  blue.append(list(map(int,input().split())))
red.sort(key=lambda x: x[1], reverse=True)
blue.sort(key=lambda x: x[0])
cnt = 0

for i in range(n):
  for j in range(n):
    if (red[j][0] < blue[i][0] and red[j][1] < blue[i][1]) and B[j+1] == 0:
      B[j+1] = 1
      cnt += 1
      break

print(cnt)

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

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

	vector<int> A(N);

	for (int i = 0; i < N; i++) {
		cin >> A.at(i);
	}

	bool ans = true;
	sort(A.begin(), A.end());//モンスターを体力の小さい順に並べる
	int sum = 0;//死んだ敵の数
	int j = 1;//生きてるモンスターの中で２番目に体力が小さいやつ


	while (sum < N - 1) {//モンスターが1匹以外全員死ぬまでやる
		for (int i = j; i < N; i++) {//生きてるモンスターの中で２番目に体力が小さいやつから順に
			A.at(i) = A.at(i) % A.at(j - 1);//一番体力が小さいモンスターの体力で割った余り
			if (A.at(i) == 0) {//0になったら
				sum++;//死んだモンスターの数を更新
			}
		}

		//次のループのための準備
		sort(A.begin(), A.end());//昇順に並び替える
		j = sum + 1;//jの値を更新して次のループへ
	}

	reverse(A.begin(), A.end());//1匹以外は全部0だから生き残ったモンスターが必ず一番最初にくるようになる
	cout << A.at(0) << endl;

	return 0;
}

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

int main() {
  int a, b, c, d;
  
  cin >> a >> b >> c >> d;
  
  int l = a + b, r = c + d;
  
  if (l < r ) {
    cout << "Right" << endl;
  } else if (r < l) {
    cout << "Left" << endl;
  } else {
    cout << "Balanced" << endl;
  }
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
	static public void main(String args[]){
		Scanner sc=new Scanner(System.in);
		 
		int n=sc.nextInt(),k=sc.nextInt();
		
		List<Integer>list=new ArrayList<>();
		
		for(int i=0;i<n;i++){
			int num=sc.nextInt();
			list.add(num);
		}
		Collections.sort(list);
		int sum=0;
		for(int i=0;i<k;i++){
			sum+=list.get(i);
		}
		System.out.print(sum);
		
	}
}

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

int main()
{
    string S, T;
    cin >> S >> T;

    int ans = 0;
    for (int i = 0; i < S.length(); i++) {
        if (S[i] != T[i]) ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3824
#include<cstdio> 
#include<algorithm>
#include<cmath>
#include<cstring>
#define fo(i,a,b) for(i=a;i<=b;i++)
using namespace std;
typedef long long ll;
const int maxn=200000+10;
char s[maxn];
int a[30][maxn],cnt[30],tree[maxn],dy[maxn];
bool bz[maxn];
int i,j,k,l,t,n,m,c;
ll ans;
bool czy,gjx;
int lowbit(int x){
	return x&-x;
}
void change(int x,int v){
	while (x<=n){
		tree[x]+=v;
		x+=lowbit(x);
	}
}
int query(int x){
	int t=0;
	while (x>0){
		t+=tree[x];
		x-=lowbit(x);
	}
	return t;
}
int main(){
	scanf("%s",s+1);
	n=strlen(s+1);
	fo(i,1,n) change(i,1);
	/*if (n%2==1){
		while (1);
	}*/
	c=n+1;
	fo(i,1,n){
		cnt[s[i]-'a']++;
		a[s[i]-'a'][cnt[s[i]-'a']]=i;
	}
	czy=1;
	if (n%2==1){
		gjx=0;
		fo(i,0,25)
			if (cnt[i]%2!=0){
				if (!gjx){
					gjx=1;
					k=i;
				}
				else{
					czy=0;
					break;
				}
			}
	}
	else{
		fo(i,0,25)
			if (cnt[i]%2!=0){
				czy=0;
				break;
			}
	}
	if (!czy){
		printf("-1\n");
		return 0;
	}
	fo(i,0,25){
		sort(a[i]+1,a[i]+cnt[i]+1);
		j=1;k=cnt[i];
		while (j<=k){
			//if (j==k) ans+=(ll)abs(a[i][j]-(n+1)/2);
			//else ans+=(ll)abs(c-a[i][j]-a[i][k]);
			dy[a[i][j]]=a[i][k];
			j++;k--;
		}
	}
	//fo(i,1,n) bz[i]=1;
	fo(i,1,n)
		if (!bz[i]){
			j=dy[i];
			if (i==j){
				ans+=(ll)(query(n)-query(j))/2;
				bz[i]=1;
				change(i,-1);
				change(i,-1);
				continue;
			}
			ans+=(ll)(query(n)-query(j));
			change(i,-1);change(j,-1);
			bz[i]=bz[j]=1;
		}
	//ans/=2;
	printf("%lld\n",ans);
}

Measured memory_bytes: 22272
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define all(V) V.begin(),V.end()
#define MOD 998244353

ll N, M, K;
ll A[200010], F[200010], I[200010];

ll modpow(ll x, ll y) {
	ll ans = 1;
	while (y) {
		if (y & 1)ans *= x;
		x *= x;
		ans %= MOD;
		x %= MOD;
		y /= 2;
	}
	return ans;
}

ll nCk(ll n, ll k) {
	return F[n] * I[k] % MOD * I[n - k] % MOD;
}

int main() {
	cin >> N >> M >> K;
	F[0] = I[0] = 1;
	for (ll i = 1;i < 200005;i++) {
		if (i == 1)A[i] = M;
		else A[i] = A[i - 1] * (M - 1);
		A[i] %= MOD;
		F[i] = F[i - 1] * i % MOD;
		I[i] = modpow(F[i], MOD - 2);
	}
	ll d, bar = 0, al = modpow(M, N);
	for (ll i = K + 1;i < N;i++) {
		d = N - i;
		bar += A[d] * nCk(N - 1, i);
		bar %= MOD;
	}
	al -= bar;
	if (al < 0)al += MOD;
	cout << al << endl;
}


Measured memory_bytes: 8324
#print#!/usr/bin/env python3
#%% for atcoder uniittest use
import sys
input= lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(10**9)
def pin(type=int):return map(type,input().split())
def tupin(t=int):return tuple(pin(t))
def lispin(t=int):return list(pin(t))
#%%code

def resolve():
    R,G,B,N=pin()
    cnt=0
    for r in range(N+1):
        for g in range(N+1):
            t=(R*r+G*g)
            if N<t:continue
            if (N-t)%B==0:
                #print(r,g,t)
                cnt+=1
    print(cnt)
#%%submit!    
resolve()


Measured memory_bytes: 39408
//#pragma GCC target ("avx2,sse2")
//#pragma GCC optimization ("Ofast")
//#pragma GCC optimization ("unroll-loops")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

#define ordered_set tree <pair <ll, int>, null_type, less <pair <ll, int> >, rb_tree_tag, tree_order_statistics_node_update>
#define ll long long
#define ull unsigned long long
#define db double
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define fi first
#define se second
#define mp make_pair
#define up_b upper_bound
#define low_b lower_bound
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
#define endl "\n"

#define left fsdsdfoisf
#define sum dpsdfioppsf
#define assign xcvjlkdjfio
#define trie fksdfkjkfnjuiv
#define next sidlfjsfkl
#define merge sdfksdkfsldf

#define int long long

using namespace std;

void dout() {
    cerr << endl;
}
template <typename Head, typename... Tail>
void dout(Head H, Tail... T) {
    cerr << H << ' ';
    dout(T...);
}

//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
typedef pair <int, int> pii;

const int N = 16;
int n, a[N][N], cost[(1 << N)], dp[(1 << N)];

void solve(int tc) {
    // check for (int i = 0; i < n; j++)
    cin >> n;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            cin >> a[i][j];
        }
    }
    for (int mask = 0; mask < (1 << n); mask++) {
        int res = 0;
        for (int i = 0; i < n; i++) {
            if (mask & (1 << i)) {
                for (int j = i + 1; j < n; j++) {
                    if (mask & (1 << j)) {
                        res += a[i][j];
                    }
                }
            }
        }
        cost[mask] = res;
    }
    for (int mask = 0; mask < (1 << n); mask++) {
        dp[mask] = cost[mask];
        for (int s = mask; s > 0; s = (s - 1) & mask) {
            dp[mask] = max(dp[mask], dp[s] + dp[mask ^ s]);
        }
    }
    cout << dp[(1 << n) - 1];
    //
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);
    int tc = 1;
//    cin >> tc;
    for (int i = 0; i < tc; i++) {
        solve(i);
//        cleanup();
    }
}



Measured memory_bytes: 1280
#coding:utf-8
#1_6_B 2015.4.5
suits = ['S','H','C','D']
cards = {suit:[i for i in range(1,14)] for suit in suits}

n = int(input())
for i in range(n):
    suit,rank = input().split()
    cards[suit].remove(int(rank))

for suit in suits:
    for i in cards[suit]:
        print(suit,i)

Measured memory_bytes: 6724
#include <iostream>
#include <cmath>

using namespace std;
int k,j,i,n,h[100005];
long long dp[100005];
int main()
{
    cin>>n>>k;
    for(i=1;i<=n;i++)
        cin>>h[i];
    for(i=1;i<=n;i++)
        dp[i]=1e17;
    dp[1]=0;
    for(i=1;i<=n;i++)
    {
        for(j=i+1;j<=min(i+k, n);j++)
            dp[j]=min(dp[j], dp[i]+(long long)abs(h[i]-h[j]));
    }
    cout<<dp[n];
    return 0;
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
using namespace std;


#define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
int main() {
  
  int A;
  cin >> A;
  
  cout << A*A << endl;
}



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


int main()
{
	long long a, b, c, d;

	std::cin >> a >> b >> c >> d;
	std::cout << std::max(a * b, c * d) << std::endl;
	return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;

namespace atcoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            var S = Console.ReadLine();
            var T = Console.ReadLine();

            var ans = int.MaxValue;
            for (int i = 0; i < S.Length - T.Length + 1; i++)
            {
                var cnt = 0;

                for (int j = 0; j < T.Length; j++)
                {
                    if (S[i + j] != T[j])
                        cnt++;
                }

                if (cnt < ans)
                    ans = cnt;
            }

            Console.WriteLine(ans == int.MaxValue ? 0 : ans);
        }
    }
}


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

int main() {
  int n,m;
  cin >> n >> m;
  vector<int> hw(m);
  rep(i,m) {
    cin >> hw.at(i);
  };
  int sum = 0;
  rep(i,m) {
    sum = sum + hw.at(i);
  };
  if (n - sum < 0) {
    cout << -1;
  } else {
    cout << n - sum;
  }
}


Measured memory_bytes: 3640
#include <cstdio>
#include <cctype>
#include <utility>
#include <string>
using namespace std;

#define gcu getchar_unlocked
#define pcu putchar_unlocked
#define _T template <typename T>
#define _HT template <typename H, typename... T>
#define _il inline
#define _in _il int in
#define _sc _il bool scan
_T T in(int c){T n=0;bool m=false;while(isspace(c)){c=gcu();}if(c=='-')m=true,c=gcu();
	do{n=10*n+(c-'0'),c=gcu();}while(c>='0');return m?-n:n;} //&&c<='9'
_in() {return in<int>(gcu());}
_T T scan(T &n){int c=gcu();return c==EOF?false:(n=in<T>(c),true);}
_sc(char &c){c=gcu();gcu();return c!=EOF;}
#ifdef _GLIBCXX_STRING
_sc(string &s){int c;s="";
	for(;;){c=gcu();if(c=='\n'||c==' ')return true;else if(c==EOF)return false;s+=c;}}
#endif
_HT _sc(H &h, T&&... t){return scan(h)&&scan(t...);}
#define _vo _il void out
#define _vl _il void outl
_vo(bool b) {pcu('0'+b);}
_vo(const char *s){while(*s)pcu(*s++);}
_vo(char c){pcu(c);}
#ifdef _GLIBCXX_STRING
_vo(string s){for(char c:s)pcu(c);}
#endif
_T _vo(T n){static char buf[20];char *p=buf;
	if(n<0)pcu('-'),n*=-1;if(!n)*p++='0';else while(n)*p++=n%10+'0',n/=10;
	while (p!=buf)pcu(*--p);}
_vl(){out('\n');}
#ifdef _GLIBCXX_VECTOR
_T _vo(vector<T> &v){for(T &x:v)out(&x == &v[0]?"":" "),out(x);outl();}
#endif
_HT _vo(H&& h, T&&... t){out(h);out(move(t)...);}
template <typename... T> _vl(T&&... t){out(move(t)...);outl();}

int main() {
	string s;
	for (int c, i = 0; c = gcu(), c != EOF;) {
		if (isspace(c) || c == ',' || c == '.') {
			if (s.size() > 2 && s.size() < 7) {
				if (i++)
					out(' ');
				out(s);
			}
			s = "";
		} else
			s += c;
	}
	outl();
}


Measured memory_bytes: 2488
import java.util.*;


public class Main {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        ArrayList<Restrunt> a = new ArrayList<>();
        
        
        for(int i =0;i <N;i++){
          	String name = sc.next();
          	int point = sc.nextInt();
          	Restrunt restrunt = new Restrunt(i + 1,name,point);
            a.add(restrunt);
        }
      
        
        Collections.sort(a, new RestruntComparator());

      	for(int j=0;j<a.size();j++){
                  System.out.println(a.get(j).no);
				}
      
    }
    
public static class Restrunt {
    
     private final int no;
     private final String name;
     private final int point;
     
     public Restrunt(int no, String name, int point){
         this.no = no;
         this.name = name;
         this.point = point;
     }
          
     public int getPoint(){
         return this.point;
     }
     
     public String getName(){
         return this.name;
     }
     
     public int setNo(){
         return this.no;
     }

}

public static class RestruntComparator implements Comparator<Restrunt> {

	@Override
	public int compare(Restrunt r1, Restrunt r2) {
		 if((r1.name).compareToIgnoreCase(r2.name) < 0){
		     return -1;
		 }else if((r1.name).compareToIgnoreCase(r2.name) > 0){
		     return 1;
		 }else{
		     return r1.point > r2.point ? -1 : 1;
		 }
	}
}

}

Measured memory_bytes: 21844
package main

import(
    "fmt"
)



func main() {
    var a,b int
    fmt.Scan(&a,&b)
    var m = make(map[int]int)
    for i:=2; i<=13; i++{
        m[i]=i-1
    }
    m[1]=13
    ans:="Draw"
    switch{
        case m[a]>m[b]:
            ans = "Alice"
        case m[a]<m[b]:
            ans = "Bob"
    }
    fmt.Println(ans)
}





func abs32(a int) int {
    if a<0{
        return -a
    }
    return a
}

func abs64(a int64) int64 {
    if a<0{
        return -a
    }
    return a
}

func min32(a, b int) int {
    if a >= b {
        return b
    }
    return a
}

func max32(a, b int) int {
    if a >= b {
        return a
    }
    return b
}

func min64(a, b int64) int64 {
    if a >= b {
        return b
    }
    return a
}

func max64(a, b int64) int64 {
    if a >= b {
        return a
    }
    return b
}

func gcd(a, b int64) int64 {
    if a % b == 0 {
        return b
    } else {
        return gcd(b, a%b)
    }
}

func lcm(a, b int64) int64 {
    return a / gcd(a, b) * b
}


Measured memory_bytes: 512
X,Y,Z,K = map(int,input().split())
A = [int(x) for x in input().split()]
B = [int(x) for x in input().split()]
C = [int(x) for x in input().split()]
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)

AB = [a+b for a in A for b in B]
AB.sort(reverse=True)
AB = AB[:min(3001,X*Y*Z+1)]

ABC = [ab+c for ab in AB for c in C]
ABC.sort(reverse=True)

for i in range(K):
    print(ABC[i])

Measured memory_bytes: 161156
#include <stdio.h>
int main(void){
  int a,b,c,y,z,x,n,m;
  x=0;
  scanf("%d%d",&a,&b);
  if(b>a){
    c=a;
    a=b;
    b=c;
  }
  x=x+a;
  a=a-1;
  if(b>a){
    c=a;
    a=b;
    b=c;
  }
  x=x+a;
  printf("%d\n",x);
}

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

#define rep(i,n) for(ll i=0;i<(n);++i)
#define reps(i,n) for(ll i=1;i<=(n);++i)
using ll = long long;
using str = string;
using pll = pair<ll,ll>;
constexpr long long INF = (1LL<<60);
constexpr long long MOD = (1e9+7);
template<class T>inline T gcd(T a,T b){if(b==0)return a; return(gcd(b,a%b));}
template<class T>inline T lcm(T a,T b){return a/gcd(a,b)*b;}
template<class T>inline bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>inline bool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;}
inline void dump(){cout<<endl;}
template<class Head,class... Tail>inline void dump(Head&& head, Tail&&... tail){cout<<head<<", ";dump(forward<Tail>(tail)...);}
template<typename T>inline istream &operator>>(istream&input,vector<T>&v){for(auto &elemnt:v)input>>elemnt;return input;}
// usi tree
class Segment_Tree {
private:
  ll n=1;
  pll init=pll(-1,-1);
  std::vector<pll> node;
  auto f(pll x,pll y){
    if(x.first>y.first)return x;
    else return y;
  }
public:
  Segment_Tree(std::vector<ll> v){
    ll sz = ((ll)v.size());    
    while(n<sz)n<<=1;
    node.resize(n*2-1,init);
    for(ll i=0;i<sz;++i)node[i+n-1]=pll(v[i],i);
    for(ll i=n-2;i>=0;--i)node[i]=f(node[i*2+1],node[i*2+2]);
  }
  
  void dec(ll idx){
    idx+=n-1;
    node[idx].first--;
    while(idx){
      idx--;
      idx/=2;
      node[idx]=f(node[idx*2+1],node[idx*2+2]);
    }
  }

  void update(ll idx,ll v){
    idx+=n-1;
    node[idx].first=v;
    while(idx){
      idx--;
      idx/=2;
      node[idx]=f(node[idx*2+1],node[idx*2+2]);
    }
  }

  auto query(ll a,ll b,ll k=0,ll l=0,ll r=-1){
    if(r<0)r=n;
    if(r<=a || b<=l)return init;
    if(a<=l && r<=b)return node[k];
    else{
      auto vl = query(a,b,2*k+1,l,(l+r)/2);
      auto vr = query(a,b,2*k+2,(l+r)/2,r);
      return f(vl,vr);
    }
  }
};
main(){
  cin.tie(0);
  ios::sync_with_stdio(0);
  cout<<fixed<<setprecision(10);
  
  ll n,m;
  cin>>n>>m;
  vector<ll> x(m),y(m),z(m);
  vector<vector<ll>> adj(n);
  vector<ll> deg(n);
  rep(i,m){
    cin>>x[i]>>y[i]>>z[i];
    x[i]--;y[i]--;
    deg[x[i]]++;
    deg[y[i]]++;
    adj[x[i]].push_back(y[i]);
    adj[y[i]].push_back(x[i]);
  }

  Segment_Tree next_d(deg);
  queue<ll> que;
  ll ans=0,ok=0;
  vector<bool> used(n,false);
  auto maxdeg=next_d.query(0,n);
  ll fst=maxdeg.second;
  que.push(fst);
  ans++;
  while(ok<n){
    if(que.empty()){
      auto maxd=next_d.query(0,n);
      ll nx_v=maxd.second;
      que.push(nx_v);
      ans++;
    }
    ll now_v=que.front();
    que.pop();
    if(used[now_v])continue;
    used[now_v]=true;
    //next_d.dec(now_v);
    next_d.update(now_v,-1);
    ok++;
    for(const auto& next_v:adj[now_v]){
      que.push(next_v);
    }
  }
  cout<<ans<<endl;

}


Measured memory_bytes: 14580
program sample
  implicit none
  integer(16) :: i,j,x,y,count,N
  integer(16) :: a(40)
    
  read(*,*) N

  x=N

  count=0

  do i=1,16
     if (x/10>=1) then
        x=x/10
        count = i
     end if
  end do

  if (count >0) then
     if (10**count-1 <= N .and. N<=2*10**count-2) then
        y=9*count
     else if (2*10**count-1 <= N .and. N<=3*10**count-2) then
        y=9*count+1
     else if (3*10**count-1 <= N .and. N<=4*10**count-2) then
        y=9*count+2
     else if (4*10**count-1 <= N .and. N<=5*10**count-2) then
        y=9*count+3
     else if (5*10**count-1 <= N .and. N<=6*10**count-2) then
        y=9*count+4
     else if (6*10**count-1 <= N .and. N<=7*10**count-2) then
        y=9*count+5
     else if (7*10**count-1 <= N .and. N<=8*10**count-2) then
        y=9*count+6
     else if (8*10**count-1 <= N .and. N<=9*10**count-2) then
        y=9*count+7
     else if (9*10**count -1 <= N .and. N<=10**(count+1) -2) then
        y=9*count+8
     else if (10*10**count-1 == N ) then
        y=9*count+9
     end if
  else
     y=N
  end if
     
  write(*,*) y
  
  stop
end program sample

Measured memory_bytes: 2840
#include <algorithm>
#include <climits>
#include <complex>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>

// using
using namespace std;

// typedef
typedef long long ll;

// define
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REVERSE(c) reverse(ALL(c))
#define UNIQ(c) unique(ALL(c))
#define FOR(i, a, b, c) for (int i = (int)(a); i < (int)(b); i += (int)(c))
#define REP(i, n) FOR(i, 0, n, 1)
#define RFOR(i, a, b, c) for (int i = (int)(a); i >= (int)(b); i -= (int)(c))
#define RREP(i, n) RFOR(i, n, 0, 1)

// functions
template <class T> T ceil(T a, T b) {
    return (a + b - 1) / b;
}
template <class T> T round(T a, T b) {
    return (a + b / 2) / b;
}
template <class T> T gcd(T a, T b) {
    return b ? gcd(b, a % b) : a;
}
template <class T> T lcm(T a, T b) {
    return a * b / gcd(a, b);
}
template <class T> bool amax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> bool amin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}

// main
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    const int MOD = 1e9 + 7;
    int N;
    cin >> N;
    N++;
    int cnt[10005] = {};
    FOR(i, 1, N, 1) {
        int n = i, a = 2;
        while (n >= a * a) {
            if (n % a == 0) {
                cnt[a]++;
                n /= a;
            } else {
                a++;
            }
        }
        cnt[n]++;
    }
    ll res = 1;
    FOR(i, 2, 10005, 1) {
        if (cnt[i] == 0) {
            continue;
        }
        res = res * (cnt[i] + 1) % MOD;
    }
    cout << res << endl;
    return 0;
}


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

const long long mod = 1e9 + 7;

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }

int n;
vector<bool> vis;
vector<vector<bool>> g;
void dfs(int x) {
    vis[x] = true;
    rep(i, n) if (g[x][i] && !vis[i]) dfs(i);
}

int main(){
    int m;
    cin >> n >> m;
    g = vector<vector<bool>>(n, vector<bool>(n));
    vi a(m), b(m);
    rep(i, m) {
        cin >> a[i] >> b[i];
        a[i]--; b[i]--;
    }
    rep(i, m) g[a[i]][b[i]] = g[b[i]][a[i]] = true;
    int ans = 0;
    rep(i, m) {
        g[a[i]][b[i]] = g[b[i]][a[i]] = false;
        vis = vector<bool>(n);
        dfs(0);
        bool brd = false;
        rep(i, n) if (!vis[i]) brd = true;
        if (brd) ++ans;
        g[a[i]][b[i]] = g[b[i]][a[i]] = true;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3572
#include<bits/stdc++.h>
typedef long long ll;
ll gi(){
	ll x=0,f=1;
	char ch=getchar();
	while(!isdigit(ch))f^=ch=='-',ch=getchar();
	while(isdigit(ch))x=x*10+ch-'0',ch=getchar();
	return f?x:-x;
}
std::mt19937 rnd(time(NULL));
#define rand rnd
#define pr std::pair<int,int>
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
template<class T>void cxk(T&a,T b){a=a>b?a:b;}
template<class T>void cnk(T&a,T b){a=a<b?a:b;}
#ifdef mod
int pow(int x,int y){
	int ret=1;
	while(y){
		if(y&1)ret=1ll*ret*x%mod;
		x=1ll*x*x%mod;y>>=1;
	}
	return ret;
}
template<class Ta,class Tb>void inc(Ta&a,Tb b){a=a+b>=mod?a+b-mod:a+b;}
template<class Ta,class Tb>void dec(Ta&a,Tb b){a=a>=b?a-b:a+mod-b;}
#endif
int n,m,Q,M,fa[300010];
int hd(int x){return fa[x]==x?x:fa[x]=hd(fa[x]);}
int num(int p,int q,int x){assert(0<=p&&p<2&&0<=q&&q<3&&1<=x&&x<=n);return (p*3+q)*n+x;}
void Union(int x,int y){fa[hd(x)]=hd(y);}
int ea[50010],eb[50010],ec[50010];
bool yes[1000010][2];
int main(){
#ifdef LOCAL
	freopen("in.in","r",stdin);
	//freopen("out.out","w",stdout);
#endif
	n=gi(),m=gi(),Q=gi(),M=gi();
	for(int i=1;i<=6*n;++i)fa[i]=i;
	int g=0;
	for(int i=1;i<=m;++i)ea[i]=gi(),eb[i]=gi(),ec[i]=gi(),g=std::__gcd(g,abs(ec[i]-ec[1]));
	if(!g)g=M;M=std::__gcd(g*3,M);
	int z=ec[1]%g;
	for(int i=1;i<=m;++i){
		int u=ea[i],v=eb[i],w=((ec[i]-z)/g%3+3)%3;
		for(int i=0;i<2;++i)for(int j=0;j<3;++j)Union(num(i,j,u),num(!i,(j+j+w)%3,v));
		for(int i=0;i<2;++i)for(int j=0;j<3;++j)Union(num(i,j,v),num(!i,(j+j+w)%3,u));
	}
	for(int i=0,x=z;!yes[x][i&1];++i,x=2*x%M)yes[x][i&1]=1;
	while(Q--){
		int s=gi(),t=gi(),r=gi();
		bool flg=0;
		for(int i=0;i<2;++i)for(int j=0;j<3;++j)if(hd(num(0,0,t))==hd(num(i,j,s))&&yes[((z+r-g*j)%M+M)%M][i])flg=1;
		puts(flg?"YES":"NO");
	}
	return 0;
}


Measured memory_bytes: 7072
#include <bits/stdc++.h>
#define ll long long
#define MODV 1000000007
#define INF INT_MAX // 2147483647
#define INFLL LLONG_MAX // 9223372036854775807
#define rep(i, n) for(ll i=0, i##_len=(ll)(n); i<i##_len; i++)
#define repf(i, n) for(ll i=1, i##_len=(ll)(n+1); i<i##_len; i++)
#define per(i, n) for(ll i=((ll)(n))-1; i>=0; i--)
#define perf(i, n) for(ll i=((ll)(n)); i>0; i--)
#define all(v) v.begin(), v.end()
#define endl "\n"
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define Yes() cout << "Yes" << endl
#define YES() cout << "YES" << endl
#define No() cout << "No" << endl
#define NO() cout << "NO" << endl
#define Init() std::ios::sync_with_stdio(false); std::cin.tie(0); std::cout<<fixed<<setprecision(15);
template<class T>bool chmax(T &a, const T &b){ if(a<b){ a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b){ if(b<a){ a=b; return 1; } return 0; }
using namespace std;

int main(){
    Init();
    ll n, i; cin >> n >> i;
    cout << n+1-i << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<cstring>
#define ll long long int
#define MOD 1000000007
using namespace std;

vector<int> tree[100001];
ll dp[100001][2];

ll independentSets(int u, bool constraint, int pr) {
    if(dp[u][constraint] != -1) return dp[u][constraint]; // Look Up
    ll ans = 0;
    ll w1 = 1;
    for(int child : tree[u]) {
        if(child != pr) {
            w1 = ((w1 * independentSets(child, 0, u)) % MOD);
        }
    }
    ans = ((ans + w1) % MOD);
    if(!constraint) {
        ll w2 = 1;
        for(int child : tree[u]) {
            if(child != pr) {
                w2 = ((w2 * independentSets(child, 1, u)) % MOD);
            }
        }
        ans = ((ans + w2) % MOD);
    }
    return (dp[u][constraint] = ans);    
}

int main() {
    int n;
    cin >> n;
    memset(dp, -1, sizeof(dp));
    for(int i = 0; i < (n - 1); i++) {
        int u, v;
        cin >> u >> v;
        tree[u].push_back(v);
        tree[v].push_back(u);
    }
    cout << independentSets(1, 0, -1) << endl;
    return 0;
}

Measured memory_bytes: 18928
//#include<bits/stdc++.h>
#include<iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#include <queue>
#include <deque>
#include <map>
#include <stack>
#include<bitset>
#include<list>
#include<cassert>
#include<numeric>

using namespace std;
const int N = 200005;
const int mod = 1000000007;
int n,F[4005][4005],fac[8005],inv[8005],A[N],B[N],ans;

int read()
{
	int ret = 0;
	int f = 1;
	char ch = getchar();
	while(ch < '0'||ch > '9')
	{
		if (ch == '-')
		{
			f =- f;
			ch = getchar();
		}
	}
	while (ch >= '0'&&ch <= '9')
	{
		ret = ret * 10 + ch - '0';
		ch = getchar();
	}
	return ret * f;
}

inline int QP(int a,int b)
{
	int ret = 1;
	int w = a;
	while(b)
	{
		if(b & 1) 
			ret = (long long)ret * w % mod;
		w = (long long)w * w % mod;
		b >>= 1;
	}
	return ret;
}
int C(int n,int m)
{
	return (long long)fac[n] * inv[m] % mod * inv[n - m] % mod;
}
int main()
{
	n = read();
	fac[0]=1;
	for(int i=1; i<=8000;i++)
	{
		fac[i] = (long long)fac[i - 1] * i % mod;
		inv[i] = QP(fac[i], mod - 2);
	}
	for(int i = 1; i <= n; i++)
	{
		A[i] = read();
		B[i] = read();
		F[2000 - A[i]][2000 - B[i]]++;
	}
	for (int i = 0;i <= 4000; i++)
	{
		for (int j = 0;j <= 4000; j++)
		{
			F[i][j] = ((long long)F[i][j] + (j ? F[i][j - 1] : 0) + (i ? F[i - 1][j] : 0)) % mod;
		}
	}
	for (int i = 1; i <= n;i++)
	{
		ans = (ans + F[2000 + A[i]][2000 + B[i]]) % mod;
		ans = (ans - C(A[i] + B[i] + A[i] + B[i], A[i] + A[i]) + mod)%mod;
	}
	ans = (long long)ans * QP(2,mod - 2) % mod;
	cout << ans << endl;
}


Measured memory_bytes: 64512