akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <string>
#include <cmath>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <list>
#include <iostream>
#include <sstream>
#include <climits>
#include <cfloat>
#include <complex>

using namespace std;

typedef long long ll;

ll encode(int* state)
{
	ll res = 0;
	for (int i = 0; i < 13; ++i)
		res = res << 4 | state[i];
	return res;
}
void decode(int* d, ll e)
{
	for (int i = 12; i >= 0; --i, e >>= 4)
		d[i] = e & 15;
}

map<ll, int> minSteps;
int dir[] = { -1, 1, -2, 2, -4, 4 };
map<int, bool> ok[3];

const int InitialDepth = 14;
map<ll, int> problemSteps;

int start_from_initial(ll current, ll next)
{
	bool newState = minSteps.count(next) == 0;
	if (newState)
		minSteps[next] = minSteps[current] + 1;

	return newState && minSteps[next] < InitialDepth ? 0 : -1;
}
int start_from_problem(ll current, ll next)
{
	bool newState = problemSteps.count(next) == 0;
	if (newState)
		problemSteps[next] = problemSteps[current] + 1;

	if (minSteps.count(next))
		return problemSteps[next] + minSteps[next];

	return newState && problemSteps[next] < 20 - InitialDepth ? 0 : -1;
}
int bfs(ll initial, int (*f)(ll, ll))
{
	queue<ll> q;
	q.push(initial);

	while (!q.empty())
	{
		ll e = q.front();
		q.pop();
		int d[13];
		decode(d, e);

		int zero_pos[2];
		for (int i = 0, j = 0; j < 2; ++i)
			if (!d[i])
				zero_pos[j++] = i;

		for (int i = 0; i < 2; ++i)
		{
			for (int j = 0; j < 6; ++j)
			{
				int a = zero_pos[i];
				int b = a + dir[j];
				if (a > b)
					swap(a, b);
				if (a < 0 || b > 12 || !d[a] && !d[b] || !ok[j/2][a])
					continue;

				int copy[13];
				memcpy(copy, d, sizeof(copy));
				swap(copy[a], copy[b]);
				ll next = encode(copy);

				int r = f(e, next);
				if (r == 0)
					q.push(next);
				else if (r > 0)
					return r;
			}
		}
	}

	return -1;
}

int main()
{
	int o[][9] = {
		{ 1, 2, 4, 5, 6, 7, 9, 10, -1 },
		{ 0, 10, -1 },
		{ 1, 2, 3, 5, 6, 7, -1 }
	};
	for (int i = 0; i < 3; ++i)
		for (int j = 0; o[i][j] != -1; ++j)
			ok[i][o[i][j]] = true;

	int initial[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0 };
	ll t = encode(initial);
	minSteps[t] = 0;

	bfs(t, start_from_initial);

	while (true)
	{
		int d[13];
		for (int i = 0; i < 13; ++i)
			scanf("%d", d + i);
		if (d[0] == -1)
			break;

		int ans = -1;
		ll s = encode(d);
		if (minSteps.count(s))
			ans = minSteps[s];
		else
		{
			problemSteps.clear();
			ans = bfs(s, start_from_problem);
		}

		if (ans != -1)
			printf("%d\n", ans);
		else
			puts("NA");
	}

	return 0;
}

Measured memory_bytes: 0
use std::io::*;
use std::str::FromStr;
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char) 
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}
fn main(){
    let d:i64=read();
    if(d==25){
        println!("Christmas");
    }else if(d==24){
        println!("Christmas Eve");
    }else if(d==23){
        println!("Christmas Eve Eve");
    }else{
        println!("Christmas Eve Eve Eve");
    }
}

Measured memory_bytes: 2112
import math
from collections import defaultdict


def norm2(vec):
    return math.sqrt(vec[0]**2 + vec[1]**2)


# any 2 points must have different position.
def ConvexHull(point_list):
    pos2idx = {point_list[i]: i for i in range(len(point_list))}
    y_val = defaultdict(list)
    x_list = sorted(list(set([p[0] for p in point_list])))
    for x, y in point_list:
        y_val[x].append(y)

    upper = [(x_list[0], max(y_val[x_list[0]]))]
    lower = [(x_list[0], min(y_val[x_list[0]]))]
    prev = float('inf')
    for xi in x_list[1:]:
        x0, y0 = upper[-1]
        x1, y1 = xi, max(y_val[xi])
        if (y1 - y0) / (x1 - x0) < prev:
            upper.append((x1, y1))
            prev = (y1 - y0) / (x1 - x0)
        else:
            while True:
                x0, y0 = upper[-1]
                if len(upper) == 1:
                    upper.append((x1, y1))
                    break
                x00, y00 = upper[-2]
                if (y1 - y0) / (x1 - x0) > (y1 - y00) / (x1 - x00):
                    upper.pop()
                else:
                    prev = (y1 - y0) / (x1 - x0)
                    upper.append((x1, y1))
                    break

    prev = -float('inf')
    for xi in x_list[1:]:
        x0, y0 = lower[-1]
        x1, y1 = xi, min(y_val[xi])
        if (y1 - y0) / (x1 - x0) > prev:
            lower.append((x1, y1))
            prev = (y1 - y0) / (x1 - x0)
        else:
            while True:
                x0, y0 = lower[-1]
                if len(lower) == 1:
                    lower.append((x1, y1))
                    break
                x00, y00 = lower[-2]
                if (y1 - y0) / (x1 - x0) < (y1 - y00) / (x1 - x00):
                    lower.pop()
                else:
                    prev = (y1 - y0) / (x1 - x0)
                    lower.append((x1, y1))
                    break

    # return upper, lower
    # return [pos2idx[xy] for xy in upper], [pos2idx[xy] for xy in lower]

    upper_idx, lower_idx = [pos2idx[xy] for xy in upper], [pos2idx[xy] for xy in lower]
    if upper_idx[-1] == lower_idx[-1]:
        upper_idx.pop()
    CH_idx = upper_idx
    CH_idx.extend(reversed(lower_idx))
    if CH_idx[0] == CH_idx[-1] and len(CH_idx) > 1:
        CH_idx.pop()
    return CH_idx


N = int(input())
point_list = []
for _ in range(N):
    x, y = map(int, input().split())
    point_list.append((x, y))

CH = ConvexHull(point_list)
if len(CH) == 2:
    ans = [0] * N
    ans[CH[0]] = 0.5
    ans[CH[1]] = 0.5
    for i in range(N):
        print(ans[i])
    exit()
ans = [0] * N
for i in range(len(CH)):
    s, t, u = CH[i-1], CH[i], CH[(i+1)%len(CH)]
    x0, y0 = point_list[s]
    x1, y1 = point_list[t]
    x2, y2 = point_list[u]
    vec0 = (y0-y1, x1-x0)
    vec1 = (y1-y2, x2-x1)
    ans[t] = math.acos((vec0[0] * vec1[0] + vec0[1] * vec1[1]) / (norm2(vec0) * norm2(vec1))) / (2 * math.pi)

for i in range(N):
    print(ans[i])


Measured memory_bytes: 38512
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const int MOD = 1e9+7;

int main(){
  
  int n; cin>>n;
  map<string,int> m;
  for(int i=0; i<n; i++){
    string s; cin>>s;
    m[s]++;
  }
  cout<<"AC"<<" x "<<m["AC"]<<endl;
  cout<<"WA"<<" x "<<m["WA"]<<endl;
  cout<<"TLE"<<" x "<<m["TLE"]<<endl;
  cout<<"RE"<<" x "<<m["RE"]<<endl;
  
}


Measured memory_bytes: 3628
/*   --------------------
    |       LOSER        |
    |     ~NOOBOSS~      |
     --------------------
*/
#include <bits/stdc++.h>
using namespace std;
#define      mxx                 LLONG_MAX
#define      mnn                 LLONG_MIN
#define      Y()                 cout<< "YES" <<endl
#define      N()                 cout << "NO"<<endl
#define      endl                "\n"
#define      max_3(a,b,c)        max(a, max(b,c))
#define      min_3(a,b,c)        min(a, min(b,c))
#define      gcd(a,b)            __gcd(a,b)
#define      lcm(a,b)           (a*b)/gcd(a,b)
#define      loser               return 0
#define      ll                  long long
#define      PI                  acos(-1)
#define      mem(a,v)            memset(a,v,sizeof(a))
#define      SORT(v)             sort(v.begin(),v.end())
#define      REV(v)              reverse(v.begin(),v.end())
#define      B                   begin()
#define      E                   end()
#define      V                   vector
#define      F                   first
#define      S                   second
#define      PSB                 push_back
#define      MP                  make_pair
#define      flash               cout.flush()
#define      InTheNameOfGod      ios::sync_with_stdio(0);cin.tie(0); cout.tie(0);
constexpr ll MOD = 998244353;
constexpr ll mod = 1e9  + 7;
int dx[] = {0,0,1,-1};
int dy[] = {1,-1,0,0};
/*-----*/
#define bug1(a)  cerr<<a<<endl;
#define bug2(a,b)  cerr<<a<<" "<<b<<endl;
#define bug3(a,b,c)  cerr<<a<<" "<<b<<" "<<c<<endl;
/*----*/
const ll N=2e5+5;
vector<ll> adj[N];
ll power(ll n,ll p){if(p==0) return 1;if(p==1)return n;if(p%2)return power(n,p-1)*n;else{ll x=power(n,p/2);return x*x;}}
ll modpow(ll a,ll b,ll m){ll ans=1;while(b){if(b&1)ans=(ans*a)%m;b/=2;a=(a*a)%m;}return ans;}
ll nsum(ll num){return (num*(num+1))/2;}
void edge (ll u,ll v) {adj[u].PSB(v) ;adj[v].PSB(u);}
/*------------------START---------------------*/


/*-----*/
void solve(){
   ll n;
   string s;
   cin>>n;
   ll ans=0;
   for(ll i=1;i<n;i++){
    ll bal=n/i;
    if(n%i==0) bal--;
    ans+=bal;
   }
   cout<<ans;



}
/*-----*/
int main(){
   InTheNameOfGod

   ll Test=1;
   //cin>>Test;
   while(Test--){
     solve();
    }
  loser;
}
///////   C O D I N G  I S  L I F E   ///////


Measured memory_bytes: 8340
import math

n, k = map(int, input().split())
mod = 10 ** 9 + 7

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


for i in range(1, k + 1):
    # print("{0}C{1} * {2}C{3}".format(n - k + 1, i, k-1,i-1))
    if n -k +1 >=i:
        print(((cmb_count((n - k + 1), i) % mod) * (cmb_count(k - 1, i - 1)) % mod))
    else:
        print(0)


Measured memory_bytes: 3316
//inlclude前用define 
#define _USE_MATH_DEFINES

//include
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<type_traits>
#include<numeric>
#include<assert.h>
//#include<deque>
#include<iomanip>
#include<set>
#include<tuple>
#include<map>

using namespace std;

//typedef
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<char> VC;
typedef pair<int, int> P1;
typedef long long int ll;

//define
#define INF 1e18
#define NUM 1000000007
#define all(x) begin(x), end(x)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define REP(i,a,b) for(int i=int(a);i<int(b);++i)
#define chmin(a,b) a=min((a),(b))
#define chmax(a,b) a=max((a),(b))

int main(){
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	a = chmin(a, b);
	b = chmin(c, d);
	cout << a+b << endl;
}






Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <vector>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,s,n) for(int i = (s);i<(int)(n);i++)

int main(){
    int n , k;
    cin >> n >> k;
    int s , t;
    s = k + n;
    t = k - n + 1;
    rep2(i,t,s)cout << i << " " ;
}

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

int main() {
 char a,b,c,d;
  cin>>a>>b>>c>>d;
  if(a == b && a!=c && c==d)  cout<<"Yes"<<endl;
  else if(a == c && a!=b && b==d)cout<<"Yes"<<endl;
  else if(a==d && a!=b && b==c) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}

Measured memory_bytes: 256
n,k = gets.chomp.split(" ").map(&:to_i)
ab = n.times.map{gets.chomp.split(" ").map(&:to_i)}
ab.sort_by!{|arr|arr[0]}
if ab[0][1] >= k
  puts ab[0][0]
else
  for i in 1..n-1
    ab[i][1] += ab[i-1][1]
    if ab[i][1] >= k
      puts ab[i][0]
      exit
    end
  end
end

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

long long n, a, b;
string s;

int main() {
  cin >> n >> a >> b >> s;
  int suma = 0, sumb = 0;
  for (int i = 0; i < n; ++i) {
    if (s[i] == 'a' && suma + sumb < a + b) {
      ++suma;
      cout << "Yes" << endl;
    } else if (s[i] == 'b' && suma + sumb < a + b && sumb < b) {
      ++sumb;
      cout << "Yes" << endl;
    } else
      cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 3688
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define mkp make_pair
#define SZ(x) ((int)(x).size())
#define MEM(x,a) memset(x,a,sizeof(x))
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
typedef long long ll;
typedef pair<int,int> PII;
typedef pair<ll,ll> PLL;
typedef vector<int> VI;
typedef vector<ll> VL;
const ll mod=1000000007,N=1e5+5,M=1e5+5,INF=0x3f3f3f3f;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
//head

int main(void){
    int r;
    cin>>r;
    printf("%f",acos(-1)*2*r);
    return 0;
}

Measured memory_bytes: 3764
import java.io.*;

class Main{
	public static void main(String args[]) throws IOException{
		BufferedReader buf = new BufferedReader(new InputStreamReader(System.in));
		String str = buf.readLine();
		char[] a = str.toCharArray();

		for(int i=0; i<a.length; i++){
			if(Character.isLowerCase(a[i]))
				System.out.print(Character.toUpperCase(a[i]));
			else if(Character.isUpperCase(a[i]))
				System.out.print(Character.toLowerCase(a[i]));
			else 
				System.out.print(a[i]);
			if(i==a.length-1)
				System.out.println();

		}
	}
}

Measured memory_bytes: 24936
use std::io::*;
use std::str::FromStr;

struct Scanner<R: Read> {
    reader: R,
}

impl<R: Read> Scanner<R> {
    fn new(r: R) -> Scanner<R> {
        Scanner { reader: r }
    }
    fn read<T: FromStr>(&mut self) -> T {
        let token = self
            .reader
            .by_ref()
            .bytes()
            .map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        token.parse::<T>().ok().unwrap()
    }
}

fn main() {
    let cin = stdin();
    let cin = cin.lock();
    let mut sc = Scanner::new(cin);
    let n: usize = sc.read();
    let m: usize = sc.read();
    let mut v = vec![0;m];
    for _ in 0..n {
        let k = sc.read();
        for _ in 0..k {
            let a: usize = sc.read();
            v[a-1] += 1;
        }
    }
    let v: Vec<usize> = v.into_iter().filter(|x| *x == n).collect();
    println!("{}", v.len());
}


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

using namespace std;

#define INF 1001000100010001000
#define MOD 1000000007
#define EPS 1e-10
#define int long long
#define rep(i, N) for (int i = 0; i < N; i++)
#define Rep(i, N) for (int i = 1; i < N; i++)
#define For(i, a, b) for (int i = (a); i < (b); i++)
#define pb push_back
#define eb emplece_back
#define mp make_pair
#define i_i pair<int, int>
#define vi vector<int>
#define vvi vector<vi >
#define vb vector<bool>
#define vvb vector<vb >
#define vp vector< i_i >
#define all(a) (a).begin(), (a).end()
#define Int(x) int x; cin >> x;
#define int2(x, y) Int(x); Int(y);
#define int3(x, y, z) Int(x); int2(y, z);
#define fir first
#define sec second
#define ffir first.first
#define fsec first.second
#define sfir second.first
#define ssec second.second

//int dxy[5] = {0, 1, 0, -1, 0};
// assign avl ncm dijkstra geo2 kruskal graph uf lca BIT
// matrix dinic next_combination topcoder lcm

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

    Int(n);
    int ans = 0;
    rep(i, n) {
        int2(a, b);
        ans += b - a + 1;
    }
    std::cout << ans << std::endl;


    return 0;
}


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

#define rep(i,l,r) for(int i=(l);i<(r);i++)
#define pb push_back
#define fi first
#define se second

using ll = long long;
using G = vector<vector<int>>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const ll MOD = 1000000007;

ll GCD(ll x, ll y){
	return y ? GCD(y, x%y) : x;	
}
ll LCM(ll x, ll y){
	return x/GCD(x, y)*y;
}

int main() {
	ll n; cin >> n;
	ll a[200005];
	ll s = 0;
	rep(i, 0, n){
		cin >> a[i];
		s ^= a[i];
	}
	rep(i, 0, n){
		if(i>0) cout << ' ';
		ll ans = s^a[i];
		cout << ans;
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 5144
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace B
{
    public class Program
    {
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            Solve();
            Console.Out.Flush();
        }

        public static void Solve()
        {
            var n = byte.Parse(Console.ReadLine());
            var s = Console.ReadLine().ToCharArray();
            for (var i = 0; i < s.Length; i++)
            {
                var next = Convert.ToByte(s[i]) + n;
                if (next > Convert.ToByte('Z')) next -= 26;
                s[i] = Convert.ToChar(next);
            }
            Console.WriteLine(new string(s));
        }
    }
}


Measured memory_bytes: 11264
from itertools import accumulate
import bisect
n,m,k=map(int,input().split())
a=list(map(int,input().split()))
aa=[0]+list(accumulate(a))
b=[0]+list(map(int,input().split()))
bb=list(accumulate(b))
ans=0
for i in range(n+1):
    if aa[i]>k:
        break
    tmp=k-aa[i]
    t=bisect.bisect(bb,tmp)
    if i-1+t>ans:
        ans=i+t-1
print(ans)

Measured memory_bytes: 124928
import java.io.*;
import java.util.*;

public class Main {

	/**
	 * @param args
	 * @throws IOException 
	 */
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		while(true){
			String input = br.readLine();
			if(input.equals("0 0")){
				break;
			}
			String[] numbers = input.split(" ");
			Integer max = Integer.parseInt(numbers[0]);
			Integer target = Integer.parseInt(numbers[1]);
			ArrayList<Integer[]> result = new ArrayList<Integer[]>();
			for(int i = 1; i <= max; i++){
				for(int j = 1; j <= max; j++){
					if(j != i){
						for(int k = 1; k <= max; k++){
							if(k != i && k != j){
								if(i + j + k == target){
									Integer[] comb = {i, j, k};
									Arrays.sort(comb);
									boolean is_contain = false;
									for(int l = 0; l< result.size(); l++){
										if(result.size() > 0 && Arrays.equals(result.get(l), comb)){
											is_contain = true;
										}
									}
									if(!is_contain){
										result.add(comb);
									}
								}
							}
						}
					}
				}
			}
			System.out.println(result.size());
		}
	}

}

Measured memory_bytes: 31280
#include<stdio.h>
int main(void){

int a,b,d=0,r=0;
double f=0.0;
scanf("%d %d", &a,&b);
d=a/b;
r=a%b;
	f=(double)a/b;
printf("%d %d %f\n",d, r, f);
return 0;
}



Measured memory_bytes: 2148
#include <stdio.h>

int time, n;
int d[100], f[100], color[100];
int M[100][100];

void dfs(int u) {
    color[u] = 1;
    d[u] = ++time;
    for (int i=0; i<n; i++) {
        if(M[u][i] && color[i] == 0) {
            dfs(i);
        }
    }
    color[u] = 2;
    f[u] = ++time;
}

void dfs_init(){
    time = 0;
    for (int i=0; i<100; i++) color[i] = 0;
    
    for (int i=0; i<n; i++) {
        if(color[i] == 0) dfs(i);
    }
}

int main() {
    int u, k, v;
    scanf("%d", &n);
    
    for (int i=0; i<n; i++) {
        for (int j=0; j<n; j++) {
            M[i][j] = 0;
        }
    }
    
    for (int i=0; i<n; i++) {
        scanf("%d %d", &u, &k);
        for (int j=0; j<k; j++) {
            scanf("%d", &v);
            M[u-1][v-1] = 1;
        }
    }
    
    dfs_init();
    
    for (int i=0; i<n; i++) {
        printf("%d %d %d\n", i+1, d[i], f[i]);
    }
    return 0;
}


Measured memory_bytes: 2720
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <cmath>
#include <iomanip>
#define rep(i,n) for (int i=0; i < (n); ++i)
using namespace std;
typedef long long ll;

int main(){
    int n, ans=0;
    cin >> n;
    vector<int> a(n);
    vector<int> b(n-1);
    rep(i, n-1) cin >> b[i];
    rep(i, n-1){
        if(i == 0){
            a[i] = b[i];
            a[i+1] = b[i];
        }
        if(a[i] > b[i]) a[i] = b[i];
        a[i+1] = b[i];
    }
    rep(i,n) {
        ans += a[i];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3592
#include <stdio.h>
#include <math.h>

int N;
int x[8], y[8];

double accumulateDistance(int visitedN, char visited[8]) {
  if (visitedN == N) {
    double distance = 0;
    for (int i = 0; i < N - 1; i++) {
      int dx = x[visited[i]] - x[visited[i + 1]];
      int dy = y[visited[i]] - y[visited[i + 1]];
      distance += sqrt(dx * dx + dy * dy);
    }
    return distance;
  }

  double result = 0;

  for (int i = 0; i < N; i++) {
    int shouldCall = 1;
    for (int j = 0; j < visitedN; j++) {
      if (visited[j] == i) {
        shouldCall = 0;
      }
    }
    if (shouldCall) {
      char v[8];
      memcpy(v, visited, sizeof(visited));
      v[visitedN] = i;
      result += accumulateDistance(visitedN + 1, v);
    }
  }

  return result;
}

int main(void) {
  scanf("%d", &N);
  for (int i = 0; i < N; i++) {
    scanf("%d %d", &x[i], &y[i]);
  }

  int all = 1;
  for (int i = 1; i < N; i++) {
    all *= i;
  }

  double result = 0;
  for (char i = 0; i < N; i++) {
    char init[8] = { i, 0, 0, 0, 0, 0, 0, 0 };
    result += accumulateDistance(1, init) / all;
  }

  printf("%lf\n", result / N);
}


Measured memory_bytes: 128
S=input()
k=['R','U','D']
g=['L','U','D']
t=0
for i in S[0::2]:
    pr=[pr for pr in k if pr==i] 
    if pr==[]:
        print('No')
        t=1
        break

if t==0:
    for i in S[1::2]:
        pr=[pr for pr in g if pr==i] 
        if pr==[]:
            print('No')
            t=1
            break
if t==0:
    print('Yes')

Measured memory_bytes: 3188
from sys import stdin
import heapq
def main():

    input = stdin.readline

    K = int(input())

    h = []

    for i in range(1,10):
        h.append(i)
    
    for i in range(K):
        ans = h[i]

        if ans % 10 != 0:
            h.append(ans * 10 + (ans % 10 - 1))
        h.append(ans*10 + (ans%10))
        if ans % 10 != 9:
            h.append(ans * 10 + (ans % 10 + 1))
    
    print(ans)

    # for i in range(1,10):
    #     heapq.heappush(h,i)
    
    # for i in range(K):
    #     ans = heapq.heappop(h)

    #     if ans % 10 != 0:
    #         heapq.heappush(h,ans * 10 + (ans % 10 - 1))
    #     heapq.heappush(h,ans*10 + (ans%10))
    #     if ans % 10 != 9:
    #         heapq.heappush(h,ans * 10 + (ans % 10 + 1))
    
    # print(ans)

if __name__ == "__main__":
    main()

Measured memory_bytes: 16780
#!/usr/bin/env python3
import sys
from math import *
from itertools import *
from collections import *
from functools import *
try:
    from math import gcd
except Exception:
    from fractions import gcd


def solve(N: int, h: "List[int]"):
    ret = 0
    while True:
        b = 0
        while b < len(h) and  h[b] == 0:
            b += 1

        e = b
        while e < len(h) and 0 < h[e]:
            e += 1

        if b == e:
            break

        ret += 1
        for i in range(b, e):
            h[i] -= 1

    return ret


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    h = [ int(next(tokens)) for _ in range(N) ]  # type: "List[int]"
    result = solve(N, h)
    print(result)

if __name__ == '__main__':
    main()


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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int N,M;
vector<pair<int,ll>> E[101010];

ll V[2][2][101010];

void dfs(int id,int st,int cur,ll v) {
	if(V[id][st][cur]==1LL<<60) {
		V[id][st][cur]=v;
		FORR(e,E[cur]) dfs(id,st^1,e.first,e.second-v);
	}
	if(V[id][st][cur]!=v) {
		cout<<0<<endl;
		exit(0);
	}
}


void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N>>M;
	FOR(i,M) {
		cin>>x>>y>>r;
		E[x-1].push_back({y-1,r});
		E[y-1].push_back({x-1,r});
	}
	FOR(i,2) FOR(j,2) FOR(x,N) V[i][j][x]=1LL<<60;
	dfs(0,0,0,0);
	dfs(1,0,0,1);
	
	if(V[0][1][0]!=1LL<<60) {
		ll ret=abs(V[0][0][0]-V[0][1][0]);
		FOR(x,N) V[0][0][x]=V[0][1][x]=1LL<<60;
		dfs(0,0,0,ret/2);
		FOR(i,N) if(min(V[0][0][i],V[0][1][i])<=0) {
			cout<<0<<endl;
			return;
		}
		cout<<1<<endl;
	}
	else {
		
		ll L=1,R=1LL<<60;
		for(i=1;i<N;i++) {
			int cur=V[0][0][i]==1LL<<60;
			ll dif=V[1][cur][i]-V[0][cur][i];
			
			if(dif==1) L=max(L,1-V[0][cur][i]);
			if(dif==-1) R=min(R,V[0][cur][i]-1);
		}
		cout<<max(0LL,R-L+1)<<endl;
		
	}
	
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


Measured memory_bytes: 23040
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>	// require sort next_permutation count __gcd reverse etc.
#include <cstdlib>	// require abs exit atof atoi 
#include <cstdio>		// require scanf printf
#include <functional>
#include <numeric>	// require accumulate
#include <cmath>		// require fabs
#include <climits>
#include <limits>
#include <cfloat>
#include <iomanip>	// require setw
#include <sstream>	// require stringstream 
#include <cstring>	// require memset
#include <cctype>		// require tolower, toupper
#include <fstream>	// require freopen
#include <ctime>		// require srand
#define rep(i,n) for(int i=0;i<(n);i++)
#define ALL(A) A.begin(), A.end()

using namespace std;

typedef long long ll;
typedef pair<int, int> P;

/*
	http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DPL_1_A&lang=jp

	コイン問題

	有名なDP問題の一つ。
	dp[今何番目?][合計金額] := コインの最小枚数

	個数制限なしのナップサック問題と同様に、O(M*N*N) となるが

	dp[i+1][j] = 
	min {dp[i][j-k*d[i]] + k|0 <= k }	= min {dp[i][j], min{dp[i][j-k*d[i]] + k| 1 <= k } }
						= min {dp[i][j], min{dp[i][j-d[i]-(k-1)*d[i]] + (k-1)| 1 <= k} + 1 }
						= min {dp[i][j], min{dp[i][j-d[i] - k'*d[i]] + k'| 0 <= k'} + 1 }
						= min {dp[i][j], dp[i+1][j-d[i]] + 1 }
	より、O(M*N) となる。
 	詳細は蟻本 p.59

*/
const int MAX_N = 50000;
const int MAX_M = 20;
const int INF = 50001;

int N, M;
int d[MAX_M];
int dp[MAX_M+1][MAX_N+1];

int solve (void ){

	rep (i, M+1 ) rep (j, N+1 ) dp[i][j] = INF;

	dp[0][0] = 0;
	rep (i, M ){
		for (int j = 0; j <= N; j++ ){
			dp[i+1][j] = min (dp[i+1][j], dp[i][j] );
			if (j - d[i] >= 0 ){
				dp[i+1][j] = min (dp[i+1][j], dp[i+1][j-d[i]] + 1 );
			} // end for
		} // end for
	} // end rep

	
	return dp[M][N];
}

int main()
{
	memset (d, 0, sizeof (d ) );

	ios_base::sync_with_stdio(0);
	cin >> N >> M;

	rep (i, M ) cin >> d[i];

	int res = solve ();
	cout << res << endl;

	return 0;
}

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

using namespace std;

#define mp make_pair
#define pb push_back
#define ll long long

#define maxN 100011

ll x, n, q, i;
ll r[maxN];
ll tm, ini, a, b, c;

ll act_tm, nxt, dif;

void decrease_with(ll dif) {
    ll aux = min(c, dif);

    c -= aux;
    dif -= aux;
    if (dif == 0) return;

    if (b - a <= dif) {
        a = b = 0;
        return;
    }

    a += dif;
}

void increase_with(ll dif) {
    ll aux = min(x - (c + b - a), dif);

    c += aux;
    dif -= aux;
    if (dif == 0) return;

    if (b - a <= dif) {
        a = b = 0;
        c = x;
        return;
    }

    b -= dif;
    c += dif;
}

int main()
{
  // freopen("test.in","r",stdin);

    cin >> x >> n;
    for (i = 1; i <= n; i++) cin >> r[i];
    r[n + 1] = 1000000001;

    a = 0; b = x; c = 0;
    act_tm = 0; nxt = 1;

    cin >> q;
    for (i = 1; i <= q; i++) {
        cin >> tm >> ini;

        while (act_tm != tm) {
            if (tm < r[nxt]) {
                dif = tm - act_tm;
                if (nxt % 2 == 1)
                    decrease_with(dif);
                else
                    increase_with(dif);

                act_tm = tm;
            } else {
                dif = r[nxt] - act_tm;
                if (nxt % 2 == 1)
                    decrease_with(dif);
                else
                    increase_with(dif);

                act_tm = r[nxt];
                nxt++;
            }
        }

        if (ini <= a) {
            cout << c << '\n';
            continue;
        }

        if (ini >= b) {
            cout << c + b - a << '\n';
            continue;
        }

        cout << c + ini - a << '\n';
    }


    return 0;
}


Measured memory_bytes: 2048
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
*/

int main(void){
    int x,a,b; cin >> x >> a >> b;

    if(abs(x-a) < abs(x-b)) cout << 'A' << endl;
    else cout << 'B' << endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
using namespace std;
int sum[65][65];
char g[65][65];
int n,m,sx,sy;
int f[65][65][65][65];
int GS(int x1,int y1,int x2,int y2)
{
	if(x1>x2||y1>y2) return 0;
	//printf("%d\n",sum[x2][y2]-sum[x2][y1-1]-sum[x1-1][y2]+sum[x1-1][y1-1]);
	return sum[x2][y2]-sum[x2][y1-1]-sum[x1-1][y2]+sum[x1-1][y1-1];
}
void Min(int &x,int y)
{
	x=min(x,y);
}
int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++)
	{
		scanf("%s",g[i]+1);
		for(int j=1;j<=m;j++)
			if(g[i][j]=='P') sx=i,sy=j;
			else if(g[i][j]=='#') sum[i][j]=1;
	}
	for(int i=1;i<=n;i++)
		for(int j=1;j<=m;j++)
			sum[i][j]+=sum[i-1][j]+sum[i][j-1]-sum[i-1][j-1];
	for(int i=1;i<=n;i++)
		for(int j=1;j<=m;j++)
			for(int ti=1;ti<=n;ti++)
				for(int tj=1;tj<=m;tj++)
					f[i][j][ti][tj]=1e9;
	f[1][1][n][m]=0;
	for(int i=1;i<=sx;i++)
		for(int j=1;j<=sy;j++)
			for(int ti=n;ti>=sx;ti--)
				for(int tj=m;tj>=sy;tj--)
				{
					int v=f[i][j][ti][tj];
					for(int mi=sx;mi>=i;mi--)
						for(int mj=sy;mj<=tj;mj++)
							if(mi!=i||mj!=tj)
								Min(f[mi][j][ti][mj],v+GS(i,j,mi-1,mj)+GS(mi,mj+1,ti,tj));
					for(int mi=sx;mi>=i;mi--)
						for(int mj=sy;mj>=j;mj--)
							if(mi!=i||mj!=j)
								Min(f[mi][mj][ti][tj],v+GS(i,mj,mi-1,tj)+GS(mi,j,ti,mj-1));
					for(int mi=sx;mi<=ti;mi++)
						for(int mj=sy;mj<=tj;mj++)
							if(mi!=ti||mj!=tj)
								Min(f[i][j][mi][mj],v+GS(i,mj+1,mi,tj)+GS(mi+1,j,ti,mj));
					for(int mi=sx;mi<=ti;mi++)
						for(int mj=sy;mj>=j;mj--)
							if(mi!=ti||mj!=j)
								Min(f[i][mj][mi][tj],v+GS(i,j,mi,mj-1)+GS(mi+1,mj,ti,tj));
				}
	int ans=1e9;
	for(int i=1;i<=sx;i++)
		for(int j=1;j<=sy;j++)
			for(int ti=n;ti>=sx;ti--)
				for(int tj=m;tj>=sy;tj--)
				{
					int v=f[i][j][ti][tj];
					Min(ans,v+GS(i,j,sx,sy));
					Min(ans,v+GS(i,sy,sx,tj));
					Min(ans,v+GS(sx,j,ti,sy));
					Min(ans,v+GS(sx,sy,ti,tj));
				}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 43776
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<cstdio>
#include<sstream>
#include<iomanip>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef pair<int,pii> pip;
typedef vector<pip>vip	;
const double PI=acos(-1);
const double EPS=1e-8;
const int inf=1e8;
int main(){
	int n,k,m;
	while(cin>>n>>k>>m,n+m+k){
		m--;
		vi in(n);
		rep(i,n)in[i]=i;
		int t=m;
		in.erase(in.begin()+t);
		t--;
		if(t==-1)t=in.size()-1;
		while(in.size()!=1){
			t=(t+k)%in.size();
			in.erase(in.begin()+t);
			t--;
			if(t==-1)t=in.size()-1;
		}
		cout<<in[0]+1<<endl;
	}
}

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

// 最大公約数
template <typename T>
T gcd(T a, T b) {
  if (b > a) {
    T tmp = a;
    a = b;
    b = tmp;
  }
  // 避け
  if (b <= 0) {
    return -1;
  }

  T r = a % b;
  while (r != 0) {
    a = b;
    b = r;
    r = a % b;
  }
  return b;
}
template <typename T = float>
T gcd(T a, T b);
template <typename T = double>
T gcd(T a, T b);

// 最小公倍数
template <typename T>
T lcm(T a, T b) {
  return a * b / gcd(a, b);
}
template <typename T = float>
T lcm(T a, T b);
template <typename T = double>
T lcm(T a, T b);

int main() {
  uint64_t A, B;
  std::cin >> A >> B;
  auto tar = gcd(A, B);

  uint64_t num = 1;
  auto temp = tar;
  if (temp % 2 == 0) {
    ++num;
    while (temp % 2 == 0) {
      temp /= 2;
    }
  }

  for (uint64_t i = 3; i * i < temp; i += 2) {
    if (temp % i == 0) {
      ++num;
      while (temp % i == 0) {
        temp /= i;
      }
    }
  }

  if (temp != 1) ++num;

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


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <map>

#define reps(i,s,n) for(int (i) = (s); (i) < (n); (i)++)
#define rep(i,n) reps(i,0,n)
using namespace std;
using ll = long long;

int main(){
    ll k,s;
    cin >> k >> s;
    int ans=0;
    rep(x,k+1){
        rep(y,k+1){
            int z = s-(x+y);
            if(z >= 0 && z <= k){
                ans++;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

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

struct UnionFind{
  vector<int> d;
  UnionFind(int n){
    d.resize(n,-1);
  }
  int find(int x){
    if(d[x] < 0) return x;
    return d[x] = find(d[x]);
  }
  void unite(int x, int y){
    x = find(x);
    y = find(y);
    if(x == y) return;
    if(d[x] > d[y]) swap(x,y);
    d[x] += d[y];
    d[y] = x;
    return;
  }
  int size(int x){return -d[find(x)];}
};

int main(){
  int n, m;
  cin >> n >> m;
  UnionFind uf(n);
  int ai, bi;
  for(int i=0; i<m; ++i){
    cin >> ai >> bi;
    --ai; --bi;
    uf.unite(ai,bi);
  }
  int ans = 0;
  for(int i=0; i<n; ++i){
    ans = max(ans, uf.size(i));
  }
  cout << ans << endl;
}

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

int main(void){
    int K,A,B;
    cin >> K >> A >> B;
    
    for(int i=A;i<=B;i++){
        if(i%K==0){
            cout << "OK" << endl;
            return 0;
        }
    }
    
    cout << "NG" << endl;
    
}


Measured memory_bytes: 3624
#include <utility>
#include <iostream>
#include <algorithm>

using namespace std;

int main()
{
	int L[3], E[1000], N;
	
	cin >> N;

	for (int i = 0; i < N; i++)
	{
		cin >> L[0] >> L[1] >> L[2];

		if (L[0] < L[1]){ swap(L[0], L[1]); }
		if (L[0] < L[2]){ swap(L[0], L[2]); }
		if (L[1] < L[2]){ swap(L[1], L[2]); }

		E[i] = L[0] * L[0] - (L[1] * L[1] + L[2] * L[2]);
	}

	for (int i = 0; i < N; i++)
	{
		cout << ((E[i] == 0) ? "YES" : "NO") << endl;
	}

	return 0;
}

Measured memory_bytes: 1152
import java.util.*;
import java.lang.*;

class Main{
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.nextLine());
        String[] line = sc.nextLine().split(" ");
        int[] data =new int[n];
        for(int i=0; i < n; i++){
            data[i] = Integer.parseInt(line[i]);
        }

        int q = Integer.parseInt(sc.nextLine());
        String[] line2 = sc.nextLine().split(" ");
        int[] searcher = new int[q];
        for(int i=0; i < q; i++){
            searcher[i] = Integer.parseInt(line2[i]);
        }

        
        int result = 0;
        for(int search : searcher){
            int left = 0;
            int right = n;
            int mid;
            while(left < right){
                mid = (left + right) / 2;
                if(search == data[mid]){
                    result++;
                    break;
                }else if(search < data[mid]){
                    right = mid;
                }else if(search > data[mid]){
                    left = mid + 1;
                }
            }
        }
        System.out.println(result);
        



    }
    static void bubble(int[] arr, int n){

    }
    static void selection(int[] arr, int n){

    }
    static void insertionSort(int[] arr, int n, int g,int count){
        for(int i = g; i < n; i++){
            int v = arr[i];
            int j = i - g;
            while(j >= 0 && arr[j] > arr[i]){
                arr[i] = arr[j];
                j-=g;
                count++;
            }
            arr[j + g] = v;
        }
    }
    static void shellsort(int[] arr, int n){

        for(int i = 1; ; ){
            if(i > n){
                break;
            }

            i = (i * 3) + 1;
        }
    }
}
class Struct{
    String name;
    int time;
    public Struct(String n, int t){
        name = n;
        time = t;
    }
}

Measured memory_bytes: 65360
#include<bits/stdc++.h>
#define rep(i, n) for(int i = 0;i < (int)n;i++)
#define repb(i, n) for(int i = (int)n;i >= 0;i--)
#define reps(i, m, n) for(int i = (int)m;i < (int)n;i++)
#define repsb(i, m, n) for(int i = (int)m;i >= (int)n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define pb(a) push_back(a)
#define INF 999999999999999999
using namespace std;
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};
using namespace std;
int main(int argc, char const *argv[]) {
  int w,t=0;
  string s;
  cin>> s>>w;
  rep(i,s.size()){
    cout<<s[t];
    t=(i+1)*w;
    if(t>=s.size()) break;
  }
  cout<<endl;
  return 0;
}


Measured memory_bytes: 256
n,t = gets.split.map(&:to_i)
a = []
max_t=0
n.times do |i|
    a.push(gets.split.map(&:to_i))
    max_t = a[i][0] if a[i][0]>max_t
end

dp = Array.new(t+max_t, 0)
a.sort.each do |tt,pp|
    (t+tt-1).downto(tt) {|i| dp[i] = pp+dp[i-tt] if dp[i-tt]+pp>dp[i]}
end

p dp.max


Measured memory_bytes: 2172
while True:
 H,W = map(int,input().split())
 if H==0 and W==0:
   break
 else:
    x='#'
    y='.'
    for i in range(0,W-1):
      if x[-1]=="#":
        x+='.'
      else:
        x+='#'
    for i in range(0,W-1):
      if y[-1]==".":
        y+='#'
      else:
          y+='.'
    for s in range(0,H):
       if s % 2 == 0:
         print(x)
       else:
         print(y)
    print()

Measured memory_bytes: 7592
n,m,*t=map(int,open(0).read().split())
s=sorted
a=s(t[:n])[::-1]
for c,b in s(zip(t[n+1::2],t[n::2]))[::-1]:
 while(c>a[n-1])*n*b:n-=1;a[n]=c;b-=1
print(sum(a))

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

const long long mod=1e9+7;

string dd;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    long long a,b,c,xd;
    a=0;
    b=0;
    c=0;
    xd=1;
    cin>>dd;
    for(long long i=0;i<dd.size();i++)
    {
        if(dd.at(i)=='A')
        {
            a+=xd;
            a%=mod;
        }
        else
        if(dd.at(i)=='B')
        {
            b+=a;
            b%=mod;
        }
        else
        if(dd.at(i)=='C')
        {
            c+=b;
            c%=mod;
        }
        else
        {
            c*=3;
            c+=b;
            b*=3;
            b+=a;
            a*=3;
            a+=xd;
            xd*=3;
            xd%=mod;
            a%=mod;
            b%=mod;
            c%=mod;
        }
    }
    cout<<c;
}


Measured memory_bytes: 512
#![allow(
    non_snake_case,
    unused_variables,
    unused_assignments,
    unused_mut,
    unused_imports,
    dead_code
)]
//use proconio::fastout;
use proconio::input;
use proconio::marker::*;
//use std::collections::HashSet;
// use std::cmp::*;
//use std::collections::VecDeque;

fn main() {
    input! {
       N:usize
    }
    // 約数の個数は素因数分解して、各素因数の個数+1をかけたもの。
    // Ex: 12= 2^2*3^1なので、(2+1)*(1+1)=6個。1,2,3,4,6,12
    // 75=(2+1)*(4+1)*(4+1);
    // 100以下の素数は97までの25個。
    // 素数a,b,cについて、a<b<cとする。
    // N < c*2なら、cは N! に高々1個しか含まれないので、不可。
    // 同様に、N < b*4 も成立しない。
    // cの可能性があるのはN/2以下、a,bの可能性があるのはN/4
    let p = getPrimes(N);
    let mut ans = 0;
    //    let ts = getNumbersInN(N);
    let mut ts = vec![0; N + 1];
    for i in 0..p.len() {
        for j in p[i]..=N {
            let mut t = j;
            while t % p[i] == 0 {
                ts[p[i]] += 1;
                t = t / p[i];
            }
        }
    }
    //println!("{:?}", ts);
    let num = |m| {
        let mut s = 0;
        for &t in ts.iter() {
            if t >= m - 1 {
                s += 1;
            }
        }
        s
    };
    // 2個,4個,4個の場合
    // choose(num5,2) * (num3-num5) + 3*choose(num5,3)
    // = num5*(num5-1)*(num3-num5)/2 + num5*(num5-1)*(num5-2)/2
    // = num5*(num5-1)*(num3 -num5 +num5-2)/2
    // = num5*(num5-1)*(num3-2)/2
    ans += num(5) * (num(5) - 1) * (num(3) - 2) / 2;

    // 14,4の場合
    ans += num(15) * (num(5) - 1);

    // 24,2の場合
    ans += num(25) * (num(3) - 1);
    //print!("{} ", ans);
    // 74の場合
    ans += num(75);
    println!("{}", ans);
}
fn getPrimes(N: usize) -> Vec<usize> {
    let mut p = vec![true; N as usize + 1];
    let mut q = Vec::with_capacity(100);
    p[0] = false;
    p[1] = false;
    for i in 2..=N as usize {
        if p[i as usize] {
            q.push(i);
        }
        let mut j = 2;
        while i * j <= N {
            p[(i * j) as usize] = false;
            j += 1;
        }
    }
    q
}
// 75-1以上=1
// 25-1以上=3
// 15-1以上=4
// 5-1以上=9
// 3-1以上=15
// 1 + 4*48 + 6*23 + 24*23*47/2 = 1+192+138+12972
// 1 + 3*14 + 4*8 + 9*8*13/2 = 1+42+32+468=543

//[0, 97, 48, x32, 24,x18, 16, x13, x12, x11,
//  9,x8, 7,x7,x6,x6, 5,x5, 5, x5,
// x4,x4, 4,x4,x4,x3,x3,x3, 3,x3,
//  3,x3,x3,x2,x2,x2, 2,x2,x2,x2,
//  2,x2, 2,x2,x2,x2, 2,x2,x2,x2,
// 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
//  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
//  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]


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

using namespace std;

const int maxn=1e4;
long long n, m;

int main()
{
	cin >> n >>m;
	if((n > 0 && m>0) || (n<0 && m<0 && (m-n)%2==1)){
		cout << "Positive";
		return 0;
	}
	if(n<=0 && m>=0 ){
		cout << "Zero";
	}
	else{
		cout << "Negative";
	}
	
	return 0;
	
}


Measured memory_bytes: 256
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;

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 main() {
    let v = read_vec::<u64>();
    let (n, x) = (v[0], v[1]);
    let n = n as usize;
    let mut p_count = vec![0u64; n + 1];
    p_count[0] = 1;
    for i in 1..n + 1 {
        p_count[i] = p_count[i - 1] * 2 + 1;
    }

    let mut size_count = vec![0u64; n + 1];
    size_count[0] = 1;
    for i in 1..n + 1 {
        size_count[i] = size_count[i - 1] * 2 + 3;
    }

    let mut ans = 0u64;
    let mut x = x;
    for i in (1..n + 1).rev() {
        if x <= 1 {
            break;
        }
        x -= 1;
        if x == size_count[i - 1] {
            ans += p_count[i - 1];
            break;
        }
        if x == size_count[i - 1] + 1 {
            ans += p_count[i - 1] + 1;
            break;
        }
        if x >= 2 * size_count[i - 1] {
            ans += p_count[i];
            break;
        }
        if x > size_count[i - 1] {
            ans += p_count[i - 1] + 1;
            x -= size_count[i - 1] + 1;
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352
#include <cstdio>
const int mod = 998244353;
int dp[3010][3010];
int a, b;
int go(int h, int w) {
	if (h == a && w == b) return 1;
	if (dp[h][w] != -1) return dp[h][w];
	int &res = dp[h][w];
	res = 0;
	if (h > a) {
		res += go(h - 1, w) * 1ll * w % mod;
		if (res >= mod) res -= mod;
	}
	if (w > b) {
		res += go(h, w - 1) * 1ll * h % mod;
		if (res >= mod) res -= mod;
	}
	if (h > a && w > b) {
		res -= go(h - 1, w - 1) * 1ll * ((w - 1) * (h - 1)) % mod;
		if (res < 0) res += mod;
	}
	return res;
}
int main() {
	int c, d;
	scanf("%d%d%d%d", &a, &b, &c, &d);
	for (int i = 0; i <= c; i++) {
		for (int j = 0; j <= d; j++) {
			dp[i][j] = -1;
		}
	}
	printf("%d\n", go(c, d));
	return 0;
}


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

int main() {
    int c[3][3];
    for(int i=0; i<3; ++i) {
        for(int j=0; j<3; ++j) cin >> c[i][j];
    }

    bool flag = true;
    for(int i=0; i<2; ++i){
        for(int j=0; j<2; ++j) {
            if(c[i][j+1] - c[i][j] != c[i+1][j+1] - c[i+1][j]) flag = false;
            if(c[i+1][j] - c[i][j] != c[i+1][j+1] - c[i][j+1]) flag = false; 
        }
    }
    if(flag) cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 256
import java.lang.reflect.Array;
import java.util.*;
import java.io.*;
import java.lang.*;

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

        int n = sc.nextInt();
        int x = sc.nextInt();
        int t = sc.nextInt();

        if (n%x == 0)
            System.out.println((n/x)*t);
        else
            System.out.println(((n/x)+1)*t);
    }
}


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

#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define repn(i, n) for(int (i) = 1; (i) <= (n); (i)++)
#define repr(i, n) for(int (i) = (n-1); (i) >= 0; (i)--)
#define all(x) (x).begin(), (x).end()
#define lint long long
#define ulint unsigned long long
#define fi first
#define se second
#define setpre(x) cout << fixed << setprecision(x)
#define ii(x) int x; cin >> (x)
#define ii2(x, y) int x, y; cin >> (x) >> (y)
#define ii3(x, y, z) int x, y, z; cin >> (x) >> (y) >> (z)
#define out(x) cout << (x) << endl
#define yn(x) cout << ((x)?("Yes"):("No")) << endl
#define YN(x) cout << ((x)?("YES"):("NO")) << endl
#define bit_c(x) __builtin_popcountll(x)

inline void logger(){ cout << endl; }
template<typename A, typename... B>
void logger(const A& a, const B&... b){
    cout << a << " , ";
    logger(b...);
}

typedef pair<lint, lint> P;
const lint MOD = 1000000007;
const lint MOD9 = 998244353;
const lint INF = MOD * MOD;
const int MAX = 100005;

/* ...o(^-^)o... */

lint dp[1005][10005];

int main(){
    int h, n; cin>>h>>n;
    vector<P> mag;
    rep(i, n){
        lint a, b; cin>>a>>b;
        mag.push_back(P(a, b));
    }
    rep(i, n)repn(j, h){
        if(j == 0) { dp[i][j] = 0; continue; }

        int p = (int)mag[i].fi; lint c = mag[i].se;
        if(i == 0) { dp[i][j] = ((j + p - 1)/ p) * c; continue; }
        
        if(j <= p) dp[i][j] = min(dp[i-1][j], c);
        else dp[i][j] = min(dp[i-1][j], dp[i][j-p] + c);
    }
    out(dp[n-1][h]);
}


Measured memory_bytes: 78464
n = int(input())
A = list(map(int, input().split()))

dp = [0] * (n+1)
dp[2] = max(A[0], A[1])
s = A[0]

for i, a in enumerate(A, 1):
    if i <= 2:
        continue
    if i%2:  # 奇数
        dp[i] = max(dp[i-1], a+dp[i-2])
        s += a
    else:  # 偶数
        dp[i] = max(a+dp[i-2], s)


print(dp[-1])

Measured memory_bytes: 31444
#include <stdio.h>

int main(){
   int i,n,a[200000],b[200000];

   scanf("%d",&n);
   b[0]=0;
   for (i=1;i<n;i++) {
      scanf("%d",&a[i]);
      b[i]=0;
   }
   for (i=1;i<n;i++) b[a[i]-1]++;
   for (i=0;i<n;i++) printf("%d\n",b[i]);
   return 0;
}


Measured memory_bytes: 3240
#include <stdbool.h>
#include <stdio.h>
int main() {
	int n;
	char s[101], t[101];
	scanf("%d%s%s", &n, s, t);
	for (int i = 0; i <= n; i++) {
		bool isOK = true;
		for (int j = 0; j < n; j++) {
			if (i + j < n && s[i + j] != t[j]) {
				isOK = false;
				break;
			}
		}
		if (isOK) {
			printf("%d\n", n + i);
			break;
		}
	}
	return 0;
}

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

using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
#include <string>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <cmath>
#include <climits>
#include <bitset>
#include <array>
#include <deque>
#include <queue>
#include <map>
#include <set>
#define all(x) (x).begin(),(x).end()

const int MOD = 1e9 + 7;

void solve(){

}
int main(){
    string N;
    cin >> N;
    if (N[0] == '9' || N[1] == '9') {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}


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

int main() {
    int k, s, ans=0;
    cin >> k >> s;
    for (int x=0; x<=k; ++x)
        for (int y=0; y<=k; ++y) {
            int z = s - x - y;
            if (z >= 0 && z <= k) ans++;
        }
    cout << ans << endl;
}

Measured memory_bytes: 256