akhauriyash/Code-Regression huggingface dataset:
let split_string ?(pattern="") = Str.split @@ Str.regexp pattern
let n, k = Scanf.sscanf (read_line ()) "%d %d" @@ fun n k -> (n, k)
let a = read_line () |> split_string ~pattern:" " |> List.map int_of_string |> Array.of_list

let print_array arr = arr 
  |> Array.to_list 
  |> List.map string_of_int 
  |> String.concat " " 
  |> print_endline

let f a =
  let b = Array.make n 0 in
  Array.iteri (fun i a ->
    let l, r = max 0 (i - a), min (n - 1) (i + a) in
    b.(l) <- b.(l) + 1;
    if r + 1 < n then b.(r + 1) <- b.(r + 1) - 1
  ) a;
  for i = 1 to n - 1 do b.(i) <- b.(i) + b.(i - 1) done;
  b

let rec loop i b =
  if i = min k 41 then b
  else loop (i + 1) (f b)

let () = print_array @@ loop 0 a

Measured memory_bytes: 47092
#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>

#ifndef U_L_LONG
typedef unsigned long long ULLONG;
#endif
#ifndef L_LONG
typedef long long LLONG;
#endif

static const int MOD_NUM = 1000000007;

template <class _T> static _T tp_abs(const _T& a) {
	//	usage:  tp_abs<type name>(a);
	return ((a < 0) ? (a * -1) : a);
}
template <class _T> static _T tp_min(_T a, _T b) {
	return a < b ? a : b;
}
template <class _T> static _T tp_max(_T a, _T b) {
	return a > b ? a : b;
}
template<class _T> static void get1int(_T& a) {
	const char* fmt = " %d";
	if (sizeof(_T) == sizeof(long long)) {
		fmt = " %lld";
	}

	if (scanf(fmt, &a) < 0) {
		printf("g1int Error\n");
	}
}
template<class _T> static void get2int(_T& a, _T& b) {
	const char* fmt = " %d %d";
	if (sizeof(_T) == sizeof(long long)) {
		fmt = " %lld %lld";
	}

	if (scanf(fmt, &a, &b) < 0) {
		printf("g2int Error\n");
	}
}
template<class _T> static void get3int(_T& a, _T& b, _T& c) {
	const char* fmt = " %d %d %d";
	if (sizeof(_T) == sizeof(long long)) {
		fmt = " %lld %lld %lld";
	}

	if (scanf(fmt, &a, &b, &c) < 0) {
		printf("g3int Error\n");
	}
}
template <class _T> static void tp_swap(_T& right, _T& left) {
	//	usage:  tp_swap<type name>(a, b);
	_T tmp = right;
	right = left;
	left = tmp;
}
static void getstring(char* buff) {
	if (scanf(" %s", buff) < 0) {
		printf("getstr error!\n");
	}
}
template <class _T> static _T tp_pow(int base, int exp)
{
	_T ans = 1;

	for (int i = 0; i < exp; i++) {
		ans *= base;
	}
	return ans;
}


static void ABC109B_Shiritori();

#if 1
int main()
{
	ABC109B_Shiritori();
	fflush(stdout);
	return 0;
}
#endif

static void ABC109B_Shiritori()
{
	int N;
	get1int(N);

	char word[11] = { 0 };
	std::map<std::string, int> list;
	std::vector<std::string> vstr;
	for (int i = 0; i < N; i++) {
		getstring(word);
		std::string tmp = word;
		if (list.find(tmp) != list.end()) {
			printf("No\n");
			return;
		}
		list[tmp] = 1;
		vstr.push_back(tmp);
	}

	for (int i = 1; i < N; i++) {
		std::string bfr = vstr[i - 1];
		std::string now = vstr[i];

		if (*(bfr.rbegin()) != *(now.begin())) {
			printf("No\n");
			return;
		}
	}
	printf("Yes\n");
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <functional>

using namespace std;

int main() {
  int n, m;
  cin >> n >> m;
  int a[n];
  int sum = 0;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) sum += a[i];
  double valid_num = (double)sum / (double)(4 * m);

  sort(a, a+n, greater<int>());

  string ans = "Yes";
  for (int i = 0; i < m; i++) {
    if (a[i] < valid_num) {
      ans = "No";
      break;
    }
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
A,B,C,X,Y=map(int,input().split())
if A+B>2*C:
  if X>=Y:
    print(min(C*X*2,Y*2*C+((X-Y)*A)))
  else:
    print(min(C*Y*2,X*2*C+((Y-X)*B)))
else:
  print(A*X+B*Y)

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

int main(){
  string s;
  cin >> s;
  
  int i = 0,j = 0;
  while(j < 4){
    if(s[j] == '-')i = i - 1;
    else i = i + 1;
    j++;
  }
  cout << i;
}
    
     


Measured memory_bytes: 3596
#include <cmath>
#include <iostream>
#include <map>
#include <string>
#include <utility>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
  int N;
  map<int, int> m;
  cin >>N;

  for (size_t i = 1; i <= 9; i++)
  {
    for (size_t j = 1; j <= 9 ; j++)
    {
      m[i*j]++;
    }
  }

  if (m.count(N) != 0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }

  return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
#define int long long
using namespace std;
int n,m,a[1001],ans;
bool cmp(int x,int y)
{
	return x<y;
}
signed main()
{
	scanf("%lld%lld",&n,&m);
	for(int i=1;i<=n;i++)
	scanf("%lld",&a[i]);
	sort(a+1,a+n+1,cmp);
	for(int i=1;i<=m;i++)
	ans+=a[i];
	printf("%lld",ans);
    return 0;
}

Measured memory_bytes: 3736
#include "bits/stdc++.h"
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a),i##_len=(b);i<i##_len;++i)
#define BUGAVOID(x) x
#define rep(...) BUGAVOID(_overload3(__VA_ARGS__,repi,_rep,_rep)(__VA_ARGS__))
#define sz(c) (int)(c.size())
#define all(c) c.begin(),c.end()
#define mp make_pair
#define write(x) cout<<(x)<<"\n"
using namespace std; typedef long long ll;
typedef vector<int> vi; typedef vector<ll> vll; template<class T, class U>using vp = vector<pair<T, U>>;
template<class T>using vv = vector<vector<T>>; template<class T, class U>using vvp = vv<pair<T, U>>;
template<class T>vv<T> vvec(const size_t n, const size_t m, const T v) { return vv<T>(n, vector<T>(m, v)); }
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; }
constexpr int INF = 1 << 28; constexpr ll LINF = 1ll << 60;
constexpr int MAX = 1e5 + 5; constexpr int MOD = 1e9 + 7; constexpr double EPS = 1e-6;
constexpr int dy[4] = { 0,1,0,-1 }; constexpr int dx[4] = { 1,0,-1,0 };
struct aaa { aaa() { cin.tie(0); ios::sync_with_stdio(0); }; }aaaa;

int N, A;
vi X;

int main(){
    cin >> N >> A;
    X.resize(N);
    rep(i, N) cin >> X[i];

    vv<vll> dp = vvec<vll>(N + 1, 51, vector<ll>(2551, 0));
    dp[0][0][0] = 1;
    rep(i, 0, N) {
        rep(j, 0, i + 1) {
            rep(k, 0, 50 * j + 1){
                dp[i + 1][j][k] += dp[i][j][k];
                dp[i + 1][j + 1][k + X[i]] += dp[i][j][k];
            }
            int a = 0;
        }
        int b = 0;
    }

    ll ans = 0;
    rep(i, N) {
        ans += dp[N][i + 1][A * (i + 1)];
    }
    write(ans);
}

Measured memory_bytes: 53248
#include "bits/stdc++.h"

using namespace std;

using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using vvvll = vector<vector<vector<ll>>>;
using vvvvll = vector<vector<vector<vector<ll>>>>;
using pl4 = pair<ll,ll>;
using str = string;
using vpl4 = vector<pair<ll,ll>>;

#define sz size()
#define be begin()
#define en end()
#define fi first
#define se second
#define pb push_back
#define mp make_pair

#define llin(x) ll (x);cin >>(x);
#define stin(x) str (x);cin >>(x);
#define vllin(x,n) vll (x)(n);FOR(i,0,n-1){cin >>(x)[i];}
#define vllin2(a,b,n) vll (a)(n);vll (b)(n);FOR(i,0,n-1){cin >>(a)[i]>>(b)[i];}
#define vllin3(a,b,c,n) vll (a)(n);vll (b)(n);vll (c)(n);FOR(i,0,n-1){cin >>(a)[i]>>(b)[i]>>(c)[i];}
#define vlling(x,n) (x).assign(n,0);FOR(i,0,n-1){cin >>(x)[i];}
#define vlling2(a,b,n) (a).assign(n,0);(b).assign(n,0);FOR(i,0,n-1){cin >>(a)[i]>>(b)[i];}
#define vlling3(a,b,c,n) (a).assign(n,0);(b).assign(n,0);(c).assign(n,0);FOR(i,0,n-1){cin >>(a)[i]>>(b)[i]>>(c)[i];}
#define vpl4in(x,n) vpl4 (x)((n),mp(0,0));FOR(i,0,n-1){cin >>x[i].fi>>x[i].se;}
#define FOR(i,a,b) for(ll i = a ; i <= b ; i++)
#define rFOR(i,b,a) for(ll i = a; i >= b ; i--)
#define SORT(x) sort(x.be, x.en)
#define rSORT(x) sort(x.rbegin(), x.rend())
#define say(x) cout<<(x);
#define sal(x) cout<<(x)<<endl;
#define says(x) cout<<(x)<<(' ');
#define sas cout<<(' ');
#define sayR(x) cout<<fixed<<setprecision(10)<<(x);
#define salR(x) cout<<fixed<<setprecision(10)<<(x)<<endl;
#define yn(a) cout <<((a)?"yes":"no")<<endl;
#define Yn(a) cout <<((a)?"Yes":"No")<<endl;
#define YN(a) cout <<((a)?"YES":"NO")<<endl;
#define Imp(a) cout <<((a)?"Possible":"Impossible")<<endl;
#define IMP(a) cout <<((a)?"POSSIBLE":"IMPOSSIBLE")<<endl;
#define pow(a,b) ll(pow(a,b))

ll MOD=1000000007;

vll p(100005,0);
str l="";

ll solve(ll c){
        if(c==0) return 1;
        if(l[l.sz-c]=='0'){
                return solve(c-1);
        }
        if(l[l.sz-c]=='1'){
                return (2*solve(c-1)+p[c-1])%MOD;
        }
}

signed main(){
        cin >>l;
        p[0]=1;
        FOR(i,1,l.sz){
                p[i]=(p[i-1]*3)%MOD;
        }
        sal(solve(l.sz))
}


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

using namespace std;

#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 each(i,c) for(__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define all(v) v.begin(), v.end()
#define mset(a, n) memset(a, n, sizeof(a))

typedef long long ll;

const int INF = 1000000000;
const int MOD = 1000000007;

ll x;

ll calc (ll n) {
	return n >= 0 ? n / x + 1 : 0;
}

int main () {
	ll a, b;
	cin >> a >> b >> x;
	cout << calc(b) - calc(a - 1) << endl;
}


Measured memory_bytes: 256
def digit_sum(n):
    rtn = 0
    while n > 0:
        rtn += n%10
        n //= 10
    return rtn

def main():
    n = int(input())
    x = digit_sum(n)
    y = digit_sum(10**(len(str(n))-1)-1)
    z = 0
    if str(n)[0] != 1:
        z = digit_sum(int(str(n)[0]) * 10**(len(str(n))-1)-1)
    print(max(x, y, z))

if __name__ == "__main__":
    main()

Measured memory_bytes: 3064
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <vector>
#include <cctype>
#include <algorithm>
#include <functional>
#include <cmath>
#include <string>
#include <cstring>
#include <vector>
#include <numeric>
#include <iomanip>
#include <limits>
#include <sstream>
#include <bitset>

#define roop(i, n) for(int i=0;i<n;i++)
#define DIV 1000000007
#define MOD ((int)1e9+7)
//static const long double pi = 3.1415926535897932;

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

char toSmall(char c) { // 大文字を小文字へ
	return (c + 0x20);
}

char toLarge(char c) { // 小文字を大文字へ
	return (c - 0x20);
}

float myPower(int a, int n) { // aのn乗の計算
	float x = 1;
	while (n > 0) { // 全てのbitが捨てられるまで
		if ( n & 1) { // 一番右のbitが１のとき
			x *= a;
		}
		a *= a;
		n >>= 1; // bit全体を右に1つシフトして一番右を捨てる
	}
	return x;
}

struct Combination {
	const int num=51e4;			//要素数
	const int mod=1e9+7;
	vector<ll> fact,inv,finv; //階乗,逆元,逆元の階乗.
	
	Combination():fact(num),inv(num),finv(num){
		fact[0]=fact[1]=1;
		inv[1]=1;
		finv[0]=finv[1]=1;
		for(int i=2;i<num;++i){
			fact[i]=fact[i-1]*i%mod;
			inv[i]=mod-inv[mod%i]*(mod/i)%mod;
			finv[i]=finv[i-1]*inv[i]%mod;
		}
	}
	
	int nCk(int n,int k){
		if(n<k) return 0;
		if(n<0 or k<0) return 0;
		return fact[n]*(finv[k]*finv[n-k]%mod)%mod;
	}
	int big_nCk(int n,int k){ //nが大きいとき
		ll res=1LL;
		for (int i = 0; i < k; i++) {
			res=res*(n-i)%mod;
		}
		res = res*finv[k]%mod;
		return res;
	}
	int nHk(int n,int k){return nCk(n+k-1,n-1);}//重複組み合わせ.
};

vector<string> split(const string& src, const char* delim = ",") { //カンマ区切り
	vector<string> vec;
	string::size_type len = src.length();

	for (string::size_type i = 0, n; i < len; i = n + 1) {
		n = src.find_first_of(delim, i);
		if (n == string::npos) {
			n = len;
		}
		vec.push_back(src.substr(i, n - i));
	}

	return vec;
}

bool check_int(string str)
{
	if (all_of(str.cbegin(), str.cend(), [](char ch) { return isdigit(ch);}))
	{
		return true;
	}
	return false;
}

struct rest {
	string s;
	int p;
	int num;

	/* -------------------------------------
	sort関数を使用したときのソートの定義をする。
	まずは文字列sでソートする。
	文字列sが同じだった場合、pでソートする。
	この条件を参考演算子で表現(ifでもOK)
	-------------------------------------*/
	bool operator<(const rest& right) const {
		return s == right.s ? p > right.p : s < right.s;
	}
};

ll pow_mod(ll n, ll k, ll p) { // n^k(mod p)
	if (k == 0) {
		return 1;
	}
	ll res = pow_mod(n * n % p, k / 2, p);
	if (k & 1) {
		res = res * n % p;
	}
	return res;
}

bool vector_finder(std::vector<int> vec, int number) { // vector 内にnumberがあるかどうか
	auto itr = std::find(vec.begin(), vec.end(), number);
	size_t index = std::distance( vec.begin(), itr );
	if (index != vec.size()) { // 発見できたとき
		return true;
	}
	else { // 発見できなかったとき
		return false;
	}
}

int main() {
	string s;
	int w;
	cin >> s >> w;
	for (int i = 0; i < s.length(); i++) {
		if (i % w == 0) {
			cout << s[i];
		}
	}
	return 0;
}

Measured memory_bytes: 3612
#include<stdio.h>
int main(){
  int a[6],i,j;
  for(i=0;i<3;i++){
    for(j=0;j<6;j++){
      scanf("%d",&a[j]);
    }
    a[1]+=a[0]*60;
    a[4]+=a[3]*60;
    a[2]+=a[1]*60;
    a[5]+=a[4]*60;
    a[5]-=a[2];
    printf("%d %d %d\n",a[5]/3600,(a[5]/60)%60,a[5]%60);
  }
  return 0;
}

Measured memory_bytes: 600
from collections import Counter
n = int(input())
S = []
for _ in range(n):
    s = input()
    S.append(s)
cnt = Counter(S)
l = max(cnt.values())

ans = []
for k,v in cnt.items():
  if v == l:
    ans.append(k)

ans.sort()
for i in ans:
  print(i)

Measured memory_bytes: 35572
N,M=map(int,input().split())
ac=[False]*N
wa=[0]*N
for _ in range(M):
  p,S=input().split()
  p=int(p)-1
  if S=='AC':
    ac[p]=True
  else:
    if not ac[p]:
      wa[p]+=1
a=0
b=0
for i in range(N):
  if ac[i]:
    a+=1
    b+=wa[i]
print(*[a,b])

Measured memory_bytes: 4596
using System;
using System.Linq;
using System.Text;
using System.Collections.Generic;

public class Hello{
    public static void Main(){
        int N = int.Parse(Console.ReadLine());
        if(N==1){
            Console.WriteLine("Yes");
        }else{
            var line = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            int min = line[0]-1;
            bool isYes = true;
            for(int i=0;i<N;i++){
                if(line[i]-min>1){
                    min = line[i] - 1;
                }
                if(min>line[i]){
                    isYes = false;
                    break;
                }
            }
            if(isYes){
                Console.WriteLine("Yes");
            }else{
                Console.WriteLine("No");
            }
        }
    }
}

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

int main() {
  int n;
  double ans=0;
  cin>>n;
  vector<double> x(n);
  vector<string> u(n);
  for(int i=0;i<n;i++){
    cin>>x.at(i);
    cin>>u.at(i); 
    if(u.at(i)=="BTC"){
      ans+=x.at(i)*380000;
    }
    else{
      ans+=x.at(i);
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
m=str(raw_input())
n=[int(i) for i in m]
n.insert(0,0)
l=len(n)
ans=0
for i in range(l-1,-1,-1):
    current=n[i]
    if(current<5):
        ans+=current
    elif(current==5):
        ans+=current
        if(n[i-1]>=5):
            n[i-1]+=1
    else:
        ans+=10-current
        n[i-1]+=1
print ans


Measured memory_bytes: 43240
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
using ll=long long;
using vec=vector<ll>;
using Graph = vector<vector<ll>>;
#define loop(i,n) for(ll i=0;i<n;i++)
#define Loop(i, m, n) for(ll i = m;i < n;i++)
#define pool(i,n) for(ll i=n;i>=0;i--)
#define Pool(i, m, n) for(ll i=n;i>=m;i--)
#define MAX 99999999999ll
#define MIN -99999999999ll
#define setbit bitset<63>
#define flagcount __builtin_popcount
#define flag(x) (1<<x)
#define flagadd(bit,x) bit|=flag(x)
#define flagpop(bit,x) bit&=~flag(x) 
#define flagon(bit,i) bit&flag(i)
#define flagoff(bit,i) !(bit & (1<<i))
#define all(v) v.begin(),v.end()
#define low2way(v,x) lower_bound(all(v),x)
#define high2way(v,x) upper_bound(all(v),x)
#define count2way(v,x) high2way(v,x)-low2way(v,x)
#define lower(v,x) low2way(v,x)-v.begin() //1番左が0、もし見つから無いならｎを出力
#define higher(v,x) high2way(v,x)-v.begin()-1 //1番左が0、もし見つからないならn-1を出力（注意）
#define putout(a) cout<<a<<endl
#define putout2(a,b) putout(a);putout(b)
#define putout3(a,b,c) putout(a);putout(b);putout(c)
#define putout4(a,b,c,d) putout(a);putout(b);putout(c);putout(d)
#define putout5(a,b,c,d,e) putout(a);putout(b);putout(c);putout(d);putout(e)
#define Gput(a,b) G[a].push_back(b)
#define cin1(a) cin>>a
#define cin2(a,b) cin>>a>>b
#define cin3(a,b,c) cin>>a>>b>>c
#define cin4(a,b,c,d) cin>>a>>b>>c>>d
#define cin5(a,b,c,d,e) cin>>a>>b>>c>>d>>e
#define sum(v) accumulate(all(v), 0ll)
#define gcd(x,y) __gcd(x,y)
ll ctoi(char c){
	if(c>='0'&&c<='9'){
		return c-'0';
	}
	return 0;
}
ll lcm(ll x,ll y){
  ll z=gcd(x,y);
  return x*y/z;
}
int main() {
  cout << fixed << setprecision(30);
  ll n;
  cin>>n;
  vec a(n);
  loop(i,n)cin>>a[i];
  bool check=false;
  sort(all(a));
  if(a[n-1]==0)check=true;
  if(n%3==0){
    ll p=(n/3)-1;
    ll q=(n/3)*2-1;
    if(a[p]==0&&a[p+1]==a[n-1])check=true;
    if(a[0]==a[p]&&a[p+1]==a[q]&&a[q+1]==a[n-1]&&a[0]!=a[p+1]&&a[p+1]!=a[q+1]){
      ll x=a[0],y=a[p+1],z=a[q+1];
      setbit X(x);
      setbit Y(y);
      setbit Z(z);
      X^=Y;
      X^=Z;
      if(X.to_ullong()==0)check=true;
    }
  }
  
  if(check)putout("Yes");
  else putout("No");
  
  
}

Measured memory_bytes: 1024
import sys
from collections import deque
import copy
import math
def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline


def bin_count(x, N):
    count = 0
    for i in range(N):
        mask = 0x01 << i
        if (x & mask) != 0:
            count += 1
    return count


def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    [N, M] = [int(input_raw[0]), int(input_raw[1])]
    mask_list = []
    for i in range(M):
        input_raw = read_func().strip().split()
        [K] = [int(input_raw[0])]
        mask = 0
        for j in range(K):
            mask += 0x01 << (int(input_raw[j + 1]) - 1)
        mask_list.append(mask)


    input_raw = read_func().strip().split()
    P_list = [int(input_raw[i]) for i in range(M)]

    ans = 0
    for i in range((0x01 << N)):
        is_ok = True
        for j in range(len(mask_list)):
            mask = mask_list[j]
            if (P_list[j] != (bin_count(mask & i, N)%2)):
                is_ok = False
                break
        if is_ok == True:
            ans += 1
    print ans




if __name__ == '__main__':
    main()


Measured memory_bytes: 3056
#include <iostream>
#include <stdio.h>
#include<vector>
#include<climits>
#include<algorithm>
#include<bitset>
#include<cmath>
#include<functional>
#include <numeric>
#include <map>
#define FORi(N) for(int i=0;i<N;++i)
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
ll gcd(ll m,ll n){
  if(n==0)return abs(m);
  return(gcd(n,m%n));
}
void putYN(bool b){
  if(b){
    cout<<"YES"<<endl;
  }else{
    cout<<"NO"<<endl;
  }
}
int main(){
  ll N;
  string S;
  cin >> S;
  N = S.size();
  ll r =0, b =0;
  FORi(N){
    if(S[i]=='0')r++;
    else b ++;
  }
  cout<<min(r,b)*2<<endl;
  return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <iomanip>
#include <string>
#include <cstring>
#include <cctype>
#include <ctime>
#include <climits>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <tuple>
#include <bitset>
#include <cmath>
#include <algorithm>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <complex>
#include <random>
#include <cassert>
#include <chrono>
#include <cstdint>
#include <functional>

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#ifndef M_PI
#define M_PI 3.141592653589793238462643383279
#endif

#define int long long

#define mp make_pair
#define mt make_tuple
#define fr first
#define sc second
#define pb push_back
#define pp pop_back
#define all(x) x.begin(), x.end()
#define get0 get<0>
#define get1 get<1>
#define get2 get<2>
#define get3 get<3>

#define debug(x) cerr << #x << " = " << x << ", line = " << __LINE__ << endl

typedef long long ll;
typedef long double ld;
typedef unsigned int ui;
typedef tuple<long long, long long, long long> tlll;
typedef tuple<int, int, int> tiii;
typedef tuple<int, int, int, int> tiiii;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

const int MOD = 1e9 + 7;



int32_t main()
{
#ifdef chikibambony
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#else
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#endif
    int n;
    cin >> n;
    vector<int> a(n), b(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    for (int j = 0; j < n; ++j) {
        cin >> b[j];
    }
    reverse(all(b));
    int c = -1;
    for (int i = 0; i < n; ++i) {
        if (a[i] == b[i]) {
            c = a[i];
            break;
        }
    }
    int l = 0;
    for (int i = 0; i < n; ++i) {
        if (a[i] == c && b[i] == c) {
            l = i;
            break;
        }
    }
    int r = -1;
    for (int i = n - 1; i >= 0; --i) {
        if (a[i] == c && b[i] == c) {
            r = i;
            break;
        }
    }

    for (int i = 0; i < n; ++i) {
        if (a[i] != c && b[i] != c && l <= r) {
            swap(b[i], b[l]);
            ++l;
        }
    }

    if (l <= r) {
        cout << "No\n";
        return 0;
    }

    cout << "Yes\n";

    for (int i = 0; i < n; ++i) {
        cout << b[i] << ' ';
        assert(b[i] != a[i]);
    }
    cout << "\n";

    return 0;
}


Measured memory_bytes: 6336
//in the name of ALLAH
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    ll n,k,x,y;
    cin>>n>>k>>x>>y;
    ll a=n-k;
    if(k>n){
        k=n;
        a=0;
    }
    cout<<x*k+a*y<<endl;

}



Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define pb push_back
#define pii pair < int , int >
#define F first
#define S second
typedef long long int ll;
using namespace std;
int main(){
    string a;
    cin >> a;
    ll n=a.size();
    ll ans=0;
    for (int i=0;i<n/2;i++){
        if (a[i]!=a[n-i-1]){
            ans++;
        }
    }
    cout << ans;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <functional>
#include<vector>
#include<math.h>
#include<bitset>
#include<string>
#include <deque>
#include<queue>
#include<map>
using namespace std;

long long int A[100008];

int main() {
	

	long long int N, K;
	cin >> N >> K;
	int a, b;
	for (int i = 0; i < N; i++) {
		cin >> a >> b;
		A[a] += b;
	}
	int Y = 0;
	for (int i = 0; K > 0;i++) {
		K -= A[i];
		if (K <= 0) {
			cout << i << endl;
			
		}
	}


	return 0;
}


Measured memory_bytes: 1024
import bisect

x = int(input())
n = 10 ** 5 + 10
fl = [1] * n
fl[0] = 0
fl[1] = 0
lprime = []
for i in range(n):
    if fl[i] == 1:
        lprime.append(i)
        ti = i * 2
        while ti < n:
            fl[ti] = 0
            ti += i

res = lprime[bisect.bisect_left(lprime, x)]
print(res)


Measured memory_bytes: 39920
#include <bits/stdc++.h>
#define REP(i, N) for (int i = 0; i < (N); ++i)
#define ALL(x) (x).begin(), (x).end()
#define MOD 1000000007
#define PB push_back
#define MP make_pair
using namespace std;
typedef long long ll;
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
ll div_ceil(ll, ll);

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

int main() {
  ll N, M;
  std::cin >> N >> M;
  vector<ll> A(N);
  REP(i, N) std::cin >> A[i];
  sort(ALL(A));
  vector<pair<ll, ll>> BC(M);
  REP(i, M) { std::cin >> BC[i].second >> BC[i].first; }
  sort(ALL(BC));
  reverse(ALL(BC));
  vector<ll> D(N);
  int id = 0;
  bool frag = false;
  REP(i, M) {
    REP(j, BC[i].second) {
      D[id] = BC[i].first;
      id++;
      if (id == N) {
        frag = true;
        break;
      }
    }
    if (frag) {
      break;
    }
  }
  ll sum = 0;
  REP(i, N) {
    if (A[i] < D[i]) {
      sum += D[i];
    } else {
      sum += A[i];
    }
  }
  std::cout << sum << '\n';
}

ll div_ceil(ll a, ll b) {
  ll quotient = a / b;
  ll remainder = a % b;
  if (remainder == 0) {
    return quotient;
  } else {
    return quotient + 1;
  }
}


Measured memory_bytes: 3328
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; i++)
#define repr(i, n) for(int i = n; i >= 0; i--)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main()
{
  ll x;
  cin >> x;
  for(ll i = -1000; i < 1001; i++) {
    for(ll j = -1000; j < 1001; j++) {
      if (pow(i, 5) - pow(j, 5) == x) {
        cout << i << " " << j << endl;
        return 0;
      }
    }
  }
  return 0;
}

Measured memory_bytes: 4028
l =    [2,	3,	5,	7,	11,	13,	17,	19,	23,	29,	31,	37,	41,	43,	47,	53,	59,	61,	67,	71,
        73,	79,	83,	89,	97,	101,	103,	107,	109,	113,	127,	131,	137,	139,	149,	151,	157,	163,	167,	173,
        179,	181,	191,	193,	197,	199,	211,	223,	227,	229,	233,	239,	241,	251,	257,	263,	269,	271,	277,	281,
        283,	293,	307,	311,	313,	317,	331,	337,	347,	349,	353,	359,	367,	373,	379,	383,	389,	397,	401,	409,
        419,	421,	431,	433,	439,	443,	449,	457,	461,	463,	467,	479,	487,	491,	499,	503,	509,	521,	523,	541,
        547,	557,	563,	569,	571,	577,	587,	593,	599,	601,	607,	613,	617,	619,	631,	641,	643,	647,	653,	659,
        661,	673,	677,	683,	691,	701,	709,	719,	727,	733,	739,	743,	751,	757,	761,	769,	773,	787,	797,	809,
        811,	821,	823,	827,	829,	839,	853,	857,	859,	863,	877,	881,	883,	887,	907,	911,	919,	929,	937,	941,
        947,	953,	967,	971,	977,	983,	991,	997]
ans = 1
n = int(input())
for i in l:
  temp = n
  c = 1
  while temp >= i:
    temp //= i
    c += temp
  ans *= c
print(ans%(10**9+7))

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

typedef long long ll;

int main()
{
    vector<int>x(3);
    rep(i,3)cin>>x[i];
    sort(x.begin(),x.end());
    int a=x[0],b=x[1],c=x[2],ans=0;
    ans=x[2]-x[1];
    x[0]+=ans;
    ans+=(x[2]-x[0])/2;
    if((x[2]-x[0])%2!=0)ans+=2;
    cout<<ans<<endl;
    
    return 0;
}


Measured memory_bytes: 256
a = int(input())
b = int(input())
c = int(input())
x = int(input())
count = 0

for i in range(a+1):
  for j in range(b+1):
    for k in range(c+1):
      if i*500 + j*100 + k*50 == x:
        count+=1

print(count)

Measured memory_bytes: 3064
from heapq import heapify, heappop, heappush

N, M = map(int, input().split())
A = []
for i in input().split():
    A.append(-int(i))
heapify(A)
for _ in range(M):
    a = -heappop(A)
    heappush(A, (a // 2) * -1)
# print('A', A)
ans = -sum(A)
print(ans)


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

using namespace std;

typedef long long ll;

#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define FORd(i,a,b) for(int i=a;i>=b;i--)
#define fi first
#define se second
#define II pair<ll,ll>

const int maxn=1e6+10;
const ll maxN=1e18+10;

int main()
{
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  int n;
  ll h;
  cin >> h >> n;
  FOR(i,1,n) {
  	int m;
  	cin >> m;
  	h-=m;
  }
  if (h<=0) cout << "Yes";
  else cout << "No";
}
    

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<set>
#include<math.h>
#include<vector>
#include<sstream>
#include<queue>
#include<functional>
#include<bitset>
#include<cstdio>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include <string.h>

using ll = long long;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define reps(i, x) for(int i=1;i<=(int)(x);i++)
#define rrep(i, x) for(int i=((int)(x)-1);i>=0;i--)
#define rreps(i, x) for(int i=(int)(x);i>0;i--)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))
#define vll vector<ll>
#define vi vector<int>
#define vpll vector<pair<ll,ll>>
#define vpi vector<pair<int,int>>
#define mod 1000000007
#define put2darr(arr, row, col) rep(i, row) { rep(j, col) { printf("%18d", arr[i][j]); } cout << endl; }

using namespace std;

template<class T>
inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}

template<class T>
inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return 1;
    }
    return 0;
}

/* 1..10
 * rep:   0 1 2 3 4 5 6 7 8 9
 * reps:  1 2 3 4 5 6 7 8 9 10
 * rrep:  9 8 7 6 5 4 3 2 1 0
 * rreps: 10 9 8 7 6 5 4 3 2 1
 */


int main() {
    ll l, r;
    ll ans = 1 << 30;
    cin >> l >> r;
    if (r - l >= 2019) {
        cout << 0 << endl;
    } else {
        for (ll i = l; i < r; ++i) {
            for (ll j = l+1; j <= r; ++j) {
                chmin(ans, i*j% 2019);

            }
        }
        cout <<ans<< endl;
    }
}



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

namespace Practice
{
    class Program
    {
        static void Main(string[] args)
        {
            Solve();
        }
        private const long MOD = 1000000007;
        
        static void Solve()
        {
            string sa = Console.ReadLine();
            string sb = Console.ReadLine();
            string sc = Console.ReadLine();
            string[] names = { "A", "B", "C" };
            string[] s = { sa, sb, sc };
            int[] indexs = new int[s.Length];

            int curTarget = 0;
            string ans = null;
            while(true)
            {
                string card = s[curTarget];
                int idx = indexs[curTarget];

                if( idx >= card.Length)
                {
                    ans = names[curTarget];
                    break;
                }

                int nextTarget = card[idx] - 'a';

                indexs[curTarget]++;
                curTarget = nextTarget;
            }
            Console.WriteLine(ans);
        }
        #region よく使う便利関数
        private static bool isPrime(long x)
        {
            if (x == 2) { return true; }
            if (x < 2 || x % 2 == 0) { return false; }
            long i = 3;
            while (i * i <= x)
            {
                if (x % i == 0) { return false; }
                i = i + 2;
            }
            return true;
        }
        private static long lcm(long x, long y)
        {
            return x / gcd(x, y) * y;
        }
        private static long gcd(long x, long y)
        {
            return y > 0 ? gcd(y, x % y) : x;
        }
        private static long pow(long x, long n)
        {
            if (n == 0) { return 1; }
            long res = pow(x * x % MOD, n / 2);
            if (n % 2 == 1)
            {
                res = res * x % MOD;
            }
            return res;
        }
        private static int ReadAndParseInt()
        {
            return int.Parse(Console.ReadLine());
        }
        private static int[] ReadAndParseIntArr()
        {
            return Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
        }
        private static long ReadAndParseLong()
        {
            return long.Parse(Console.ReadLine());
        }
        private static long[] ReadAndParseLongArr()
        {
            return Array.ConvertAll(Console.ReadLine().Split(' '), long.Parse);
        }
        #endregion
    }
}

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

char grid[55][55];
int dist[55][55];
const int INF = INT_MAX;
int di[]={0,1,0,-1};
int dj[]={1,0,-1,0};

int main(){
  int h,w;
  cin>>h>>w;
  int black = 0;
  rep(i,h)rep(j,w){
    cin>>grid[i][j];
    dist[i][j]=INF;
    if(grid[i][j]=='#') black++;
  }
  dist[0][0]=0;
  queue<P> q;
  q.push(make_pair(0,0));
  while(!q.empty()){
    int pi,pj;
    tie(pi,pj)=q.front(); q.pop();
    int past = dist[pi][pj];
    rep(tmp,4){
      int ni=pi+di[tmp],nj=pj+dj[tmp];
      int now=past+1;
      if(ni<0 || ni>=h || nj<0 || nj>=w) continue;
      if(grid[ni][nj]=='#') continue;
      if(dist[ni][nj]<=now) continue;
      dist[ni][nj]=now;
      q.push(make_pair(ni,nj));
    }
  }
  if(dist[h-1][w-1]!=INF) cout<<h*w - black - dist[h-1][w-1] -1<<endl;
  else cout<<-1<<endl;
}
 

Measured memory_bytes: 3636
#include <iostream>
#include <cstring>

#define rep(i, a, b) for (ll i = a; i < b; i++)

#define MAX_N 100
#define MAX_W 10000

using namespace std;

typedef long long ll;

ll dp[MAX_N + 1][MAX_W + 1];

ll rec(ll i, ll j, ll *v, ll *w, const ll &N)
{
    if (dp[i][j] >= 0)
    {
        return dp[i][j];
    }

    ll res;
    if (i == N)
    {
        res = 0;
    }
    else if (j < w[i])
    {
        res = rec(i + 1, j, v, w, N);
    }
    else
    {
        res = max(rec(i + 1, j, v, w, N), rec(i + 1, j - w[i], v, w, N) + v[i]);
    }

    return dp[i][j] = res;
}

int main()
{
    ll N, W;
    cin >> N >> W;

    ll v[N], w[N];

    memset(dp, -1, sizeof(dp));

    rep(i, 0, N)
    {
        ll a, b;
        cin >> a >> b;
        v[i] = a;
        w[i] = b;
    }

    cout << rec(0, W, v, w, N) << endl;

    return 0;
}


Measured memory_bytes: 11016
#include<stdio.h>
int main(void)
{
	int S = 0;
	char a, b, c, d;
	char e = '+';

		scanf("%c%c%c%c", &a, &b, &c, &d);

	if (a == e) {
		S++;
	}
	else {
		S--;
	}
	if (b == e) {
		S++;
	}
	else {
		S--;
	}

	if (c == e) {
		S++;
	}
	else {
		S--;
	}

	if (d == e) {
		S++;
	}
	else {
		S--;
	}
	printf("%d", S);
	return 0;

}

Measured memory_bytes: 128
import sys

f_i = sys.stdin

V, E = map(int, f_i.readline().split())

adj_list = [[] for i in range(V)]

is_visited = [False] * V

indeg = [0] * V

for l_i in f_i:
    s, t = map(int, l_i.split())
    adj_list[s].append(t)
    indeg[t] += 1

import collections

Q = collections.deque()
out = collections.deque()


def bfs(s):
    Q.append(s)
    is_visited[s] = True
    while Q:
        u = Q.popleft()

        out.append(u)

        for v in adj_list[u]:
            indeg[v] -= 1
            if indeg[v] == 0 and is_visited[v] == False:
                is_visited[v] = True
                Q.append(v)


# Topological Sort
for u in range(V):
    if indeg[u] == 0 and is_visited[u] == False:
        bfs(u)

print(*out, sep = '\n')

Measured memory_bytes: 11408
#include<stdio.h>

void selectionSort(int,int[]);

int main(){

  int n;
  int data[100];
  int minj;
  int i;

  scanf("%d",&n);

  for(i = 0; i < n; i++){

    scanf("%d",&data[i]);

  }

  selectionSort(n,data);

  return 0;

}

void selectionSort(int num, int data[]){

  int i,j,minj,change,count= 0;

  for(i = 0; i <= num -1; i++){

    minj = i;

    for(j = i; j <= num-1; j++){

      if(data[j] < data[minj]){

	minj = j;

      }
    }


    if(data[i] != data[minj]){
 
    change = data[minj];

    data[minj] = data[i];

    data[i] = change;
    
    count++;
    
    }
  }


  for(i = 0; i < num; i++){

    if(i == num-1){

    printf("%d\n",data[i]);

    }

    else{

      printf("%d ",data[i]);

    }
  }

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

}

Measured memory_bytes: 600
#![allow(non_snake_case)]
#![allow(unused_imports)]
use proconio::input;
use std::cmp::max;
use std::cmp::min;
use std::collections::HashMap;
use std::collections::VecDeque;

fn main() {
    input! {
        N: usize,
    }

    let mut ans: i64 = 0;

    for a in 1..N {
        // a * 1, a * 2, ... a * ?
        // 最も大きいのは、A * B = N -1
        // 最も小さいのは、A * 1 = A;

        let b_max = (N - 1) / a;
        let c_max = N - a * b_max;
        if c_max <= 0 {
            return;
        }

        let _b_min = 1;
        let c_min = N - a;
        if c_min <= 0 {
            return;
        }

        ans += b_max as i64;
    }

    println!("{}", ans);
}


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

// 総数を1000000007（素数）で割った余り
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 main(){
    int n, m;
    cin >> n >> m;
    vi a(n), b(n);
    rep(i, n) cin >> a[i] >> b[i];
    map<int, ll> mp;
    rep(i, n) mp[a[i]] += b[i];
    ll ans = 0;
    for (auto s : mp) {
        ll buy = min((ll)m, s.second);
        ans += (ll)buy * s.first;
        m -= buy;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 7296
#include <cstdio>
#include <cmath>
using namespace std;

struct P { double x, y; };

void print(P p) {
}

void dfs(P a, P b, int d) {
    if (d == 0) return;

    double th = M_PI * 60.0 / 180.0;
    P s, t, u;

    s.x = (2.0 * a.x + 1.0 * b.x) / 3.0;
    s.y = (2.0 * a.y + 1.0 * b.y) / 3.0;
    t.x = (1.0 * a.x + 2.0 * b.x) / 3.0;
    t.y = (1.0 * a.y + 2.0 * b.y) / 3.0;
    u.x = (t.x - s.x) * cos(th) - (t.y - s.y) * sin(th) + s.x;
    u.y = (t.x - s.x) * sin(th) + (t.y - s.y) * cos(th) + s.y;

    dfs(a, s, d - 1);
    printf("%.8f %.8f\n", s.x, s.y);
    dfs(s, u, d - 1);
    printf("%.8f %.8f\n", u.x, u.y);
    dfs(u, t, d - 1);
    printf("%.8f %.8f\n", t.x, t.y);
    dfs(t, b, d - 1);
}

int main(void) {
    int n;
    P a, b;
    a.x = 0; a.y = 0;
    b.x = 100; b.y = 0;
    scanf("%d", &n);

    printf("%.8f %.8f\n", a.x, a.y);
    dfs(a, b, n);
    printf("%.8f %.8f\n", b.x, b.y);

    return 0;
}

Measured memory_bytes: 1068
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <queue>
#include <string>
#define REP(i,n) for(ll i = 0; i < (ll)n; i++)
using namespace std;
typedef long long ll;

int main(){
  int a,b,c;
  cin >> a >> b >> c;
  cout << a+b+c-max(a,max(b,c)) << endl;
  return 0;
}


Measured memory_bytes: 256
N = int(input())
mod = 10 ** 9 + 7
dp = [{} for i in range(N)]
forbid = set(['AGC', 'GAC', 'ACG'])


def search(i, prefix):
    if prefix in forbid:
        return 0
    elif i == N:
        return 1
    elif prefix in dp[i]:
        return dp[i][prefix]

    ret = 0
    for c in 'ACGT':
        if prefix[0] == 'A' and (prefix[1] == 'G' or prefix[2] == 'G') and c == 'C':
            continue
        ret += search(i + 1, prefix[1:] + c)
    dp[i][prefix] = ret % mod
    return ret % mod


print(search(0, 'BBB'))

Measured memory_bytes: 9620
from math import floor, ceil
N = int(input())
WHITE = 0
RED = 1
str = list(map(str, list(input())))
r = []
w = []

for i in range(N):
  w.append(i) if str[i] == "W" else r.append(i)
  str[i] = WHITE if str[i] == "W" else RED
r.reverse()
max_count = min(len(r), len(w))
count = 0
for i in range(max_count):
  if r[i] - w[i] > 0:
    count += 1

print(count)


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

using namespace std;

int main(){
  int prime[] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97};
  
  int n;
  cin >> n;
  
  int g74 = 0;
  int g24 = 0;
  int g14 = 0;
  int g4 = 0;
  int g2 = 0;
  for(int i = 0; i < 25; i++){
    int power = prime[i];
    int tmp = 0;
    while(n / power > 0){
      tmp += n / power;
      power *= prime[i];
    }
    if(tmp >= 74){
      g74++;
      g24++;
      g14++;
      g4++;
      g2++;
    }else if(tmp >= 24){
      g24++;
      g14++;
      g4++;
      g2++;
    }else if(tmp >= 14){
      g14++;
      g4++;
      g2++;
    }else if(tmp >= 4){
      g4++;
      g2++;
    }else if(tmp >= 2){
      g2++;
    }
  }
  cout << g74 + g24 * (g2 - 1) + g14 * (g4 - 1) + (g4 * (g4 - 1) / 2) * (g2 - 2) << '\n';
  
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
    string s;
    cin>>s;
    int f=0;
    for(auto i:s){
        if(!f&&i=='C'){
            f=1;
        }
        else if(f==1&&i=='F') f=2;
    }
    if(f==2) puts("Yes");
    else puts("No");
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdlib>
template<typename T>
void fin(T const& t){ std::cout << t << std::endl; exit(0); }

int main() {
  std::cin.tie(0); std::ios::sync_with_stdio(false);
  int X; std::cin >> X;
  for(int i = 1;; ++i) if(i*X%360 == 0) fin(i);
  return 0;
}


Measured memory_bytes: 3648
import heapq
n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
ans = 0
tmp = []
heapq.heappush(tmp, -a[0])
for i in range(1, n):
    point = -heapq.heappop(tmp)
    ans += point
    heapq.heappush(tmp, -a[i])
    heapq.heappush(tmp, -a[i])
print(ans)


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

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

    cin >> N >> X;

    ll ans = 0;
    ans += N;

    ll a = X;
    ll b = N-X;

    while (true) {
        if (a < b) {
            ll na = a;
            ll nb = b % a;

            ans += ((b - b%a) / a) * a * 2;

            if (nb == 0) {
                ans -= a;
                break;
            } else {
                a = na;
                b = nb;
            }
        } else if (a > b) {
            ll na = a % b;
            ll nb = b;

            ans += ((a - a%b) / b) *b * 2;

            if (na == 0) {
                ans -= b;
                break;
            } else {
                a = na;
                b = nb;
            }
        } else {
            ans += a;
            break;
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
#define chmin(a, b) ((a) = min((a), (b)))
#define chmax(a, b) ((a) = max((a), (b)))
#define fs first
#define sc second
#define eb emplace_back
using namespace std;

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

const ll MOD = 1e9 + 7;
const ll INF = 1e18;
const double pi = acos(-1);
const double eps = 1e-10;

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

int main(){
    int n, f; cin>>n>>f;
    map<pair<string, string>, int> cnt;
    for(int i=0; i<n; i++){
        int m; cin>>m;
        vector<string> s(m);
        for(int j=0; j<m; j++){
            cin>>s[j];
        }

        for(int j=0; j<m; j++){
            for(int k=j+1; k<m; k++){
                cnt[make_pair(min(s[j], s[k]), max(s[j], s[k]))]++;
            }
        }
    }

    vector<pair<string, string>> ans;
    for(auto i : cnt){
        if(f <= i.second){
            ans.emplace_back(i.first);
        }
    }

    cout << ans.size() << endl;
    for(auto i : ans){
        cout << i.first << " " << i.second << endl;
    }
}


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

int main(){
    string a, b;
    cin >> a >> b;
    int ans = 0;
     if(a[0] == b[0]){
        ans++;
     }
     if(a[1] == b[1]){
        ans++;
     }
     if(a[2] == b[2]){
        ans++;
     }
     cout << ans << '\n';
}

Measured memory_bytes: 256
use proconio::{input, fastout};

macro_rules! debug {
      ($($a:expr),*) => {
          eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
      }
  }

#[fastout]
fn main() {
    input!{
        a: usize,
        b: usize,
    }

    if (a*b)%2==1 {
        println!("Yes");
    } else {
        println!("No");
    }

}


Measured memory_bytes: 2148
N = int(input())
S = list(input())
S = [int(S[i]) for i in range(N)]
count = 0
for i in range(10):
    for l in range(10):
        for q in range(10):
            t = 0
            for s in range(N):
                if t == 1:
                    break
                if S[s] == i:
                    p = s
                    for r in range(p + 1, N):
                        if t == 1:
                            break
                        if S[r] == l:
                            p = r
                            for b in range(p + 1, N):
                                if t == 1:
                                    break
                                if S[b] == q:
                                    count += 1
                                    t = 1
                                    break
                                elif b == N - 1:
                                    t = 1
                        elif r == N-1:
                            t = 1
                elif s == N - 1:
                    t = 1
print(count)


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

using namespace std;
template<class T, class T2> inline void chkmax(T &x, const T2 &y) { if(x < y) x = y; }
template<class T, class T2> inline void chkmin(T &x, const T2 &y) { if(x > y) x = y; }
const int MAXN = (1 << 20);
const int P = 20000;

int n;
int perm[MAXN];

void read()
{
	cin >> n;
	for(int i = 0; i < n; i++)
		cin >> perm[i];
}

int a[MAXN], b[MAXN];

void solve()
{
	for(int i = 1; i <= n; i++)
		a[i] = i * P, b[i] = (n - i + 1) * P;

	for(int i = 0; i < n; i++)
		a[perm[i]] += i;

	for(int i = 1; i <= n; i++) cout <<	a[i] << " "; 
	cout << endl;
	for(int i = 1; i <= n; i++) cout <<	b[i] << " "; 
	cout << endl;
}

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

	read();
	solve();
	return 0;
}



Measured memory_bytes: 4864
n = int(input())
spi = {}
for i in range(n):
    t = input().split()
    if t[0] in spi:
        spi[t[0]] += [(int(t[1]), i+1)]
    else:
        spi[t[0]] = [(int(t[1]), i+1)]

for e in spi:
    spi[e] = sorted(spi[e], key=lambda x: x[0], reverse=True)

spi = sorted(zip(*[spi.keys(), spi.values()]), key=lambda x: x[0])

for e in spi:
    for r in e[1]:
        print(r[1])


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(long long i=0;i<x;i++)
#define repn(i,x) for(long long i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
vector<pair<string,P> >vec;
// vector<vector<int>> data(3, vector<int>(4));

void solve(string S){
	if (S == "AAA" || S == "BBB") cout << "No" << endl; else cout << "Yes" << endl;
}

int main(){	
	string S;
	cin >> S;
	solve(S);
	return 0;
}



Measured memory_bytes: 764
main = do
    [a, b, k] <- (map read . words) <$> getLine
    mapM_ print $ resovle a b k

resovle:: Int -> Int -> Int -> [Int]
resovle a b k
  | d < k = [a..b]
  | otherwise = [a..(a + k - 1)] ++ [(b - k + 1)..b]
  where d = div (b - a + 1) 2


Measured memory_bytes: 764
#include <iostream>
#include <iomanip>

using namespace std;

int main(int argc, char const *argv[])
{
    int a,b,d,r;
    double f;
    cin >> a >> b;
    d=a/b;
    r=a%b;
    f=(double)a/b;
    cout << d << " " << r << " " << fixed << setprecision(5) << f << endl;
    return 0;
}


Measured memory_bytes: 3280
'''
INPUT SHORTCUTS
N, K = map(int,input().split())
N ,A,B = map(int,input().split())
string = str(input())
arr = list(map(int,input().split()))
N = int(input())
'''

N = int(input())
arr = list(map(int,input().split()))
arr.sort()
ans = 0
for i in range(N-1):
	if arr[i]==arr[i+1]:
		ans = 1
		break

if ans:
	print("NO")
else:
	print("YES")




Measured memory_bytes: 86228