akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <iomanip>
#include <fstream>
#include <string>
#include <array>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <queue>
#include <bitset>
#include <tuple>
#include <cmath>
#include <complex>
#include <algorithm>
#include <utility>
#include <regex>
#include <cstdint>
#include <numeric>
#include <functional>
#include <cassert>

using namespace std;
using ll = int64_t;
using ull = uint64_t;

constexpr ll INF = 1000000000;/* 1e+9a */
namespace utils{

    class Repeater{
        int st;
        int ed;
        int d;
    public:
        class rep_iterator{
            int i; int d;
        public:
            rep_iterator(int x, int pd) :i(x), d(pd) {}

            int& operator*(){ return i; }
            bool operator==(const rep_iterator& k) const { return i == k.i; }
            bool operator!=(const rep_iterator& k) const { return i != k.i; }
            rep_iterator& operator++(){ i+=d; return *this; }
        };

        explicit Repeater(int N) :st(0), ed(N), d(1) {}
        Repeater(int b, int e) :st(b), ed(e), d(1) {if(st > ed){ st--; ed--; d = -1; } }

        rep_iterator begin() const{ return rep_iterator(st, d); }
        rep_iterator end() const{ return rep_iterator(ed, d); }

    };

    template<class T, class Compare> using p_queue = priority_queue<T, vector<T>, Compare>;
    template<class T> using min_queue = p_queue<T, greater<T>>;
    template<class T> using max_queue = p_queue<T, less<T>>;

    template<class T> bool min_update(T& X, const T& A){ if(X > A) {X = A; return true;} return false; }
    template<class T> bool max_update(T& X, const T& A){ if(X < A) {X = A; return true;} return false; }
#define ALL(x) begin(x), end(x)
#define rALL(x) rbegin(x), rend(x)
}
using namespace utils;


void sub_main(istream &is) {
    string S;
    is >> S;
    if(!is) return;
    map<char, int> mp;
    for (auto &&c : S) {
        mp[c]++;
    } // end c
    cout << (mp.size() == 2 and mp.begin()->second == 2 ? "Yes" : "No") << endl; 

}

int main(int argc, char *argv[]) {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << setprecision(16) << scientific;
#ifdef DEBUG
    string test_cases = "test_B.txt";
    cerr << "DEBUG MODE" <<  endl;
    cerr << test_cases << " -->" << endl;
    auto fs = fstream(test_cases, fstream::in);
    int lp = 0;
    while(fs) {
        lp++;
        cout << lp <<  "#------\n";
        sub_main(fs);
    }
    cout << "------#" << endl;
    if(lp <= 1) sub_main(cin);
#else
    sub_main(cin);
#endif
    return 0;
}


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

int main(){
  int n, m;
  cin >> n >> m;
  vector<int> v(m);
  rep(i, m) cin >> v[i];

  vector<ll> dp(n+10, 0);
  dp[0] = 1;
  dp[1] = 1;
  rep(i, m) dp[v[i]] = -1;
  int mo = 1e9 + 7;
  for(int i = 2; i <= n; ++i){
    if (dp[i] == -1) continue;
    ll s1 = dp[i-1];
    ll s2 = dp[i-2];
    if (s1 == -1) s1 = 0;
    if (s2 == -1) s2 = 0;

    dp[i] = (s1 + s2) % 1000000007;
  }
  cout << dp[n] << endl;
  return 0;
}

Measured memory_bytes: 4236
import numpy as np

s = input()
p = np.array([0]*13)
p[0] = 1

amari = [[0]*13 for _ in range(13)]
for j in range(10):
  for i in range(13):
    amari[i][(i*10+j)%13] += 1
M = np.array(amari)

for si in range(len(s)):
  a = np.array([0]*13)
  if s[si] == '?':
    a = np.dot(p,M)
  else:
    c = int(s[si])
    for i in range(13):
      a[(i*10+c)%13] += p[i]
  p = np.mod(a,1000000007)
print(p[5])

Measured memory_bytes: 14720
#include <iostream>
#include <cstdio>
#include <string>
using namespace std;
typedef long long ll;
int n,ans = 0;

void dfs(ll x,bool f3,bool f5,bool f7){
    if(x > n) return;
    if(f3&&f5&&f7) ans++;
    dfs(10*x+3,true,f5,f7);
    dfs(10*x+5,f3,true,f7);
    dfs(10*x+7,f3,f5,true);
}

int main(void){
    cin >> n;
    dfs(0,0,0,0);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,k;
    cin>>n>>k;
    vector<int> x(n);
    for(int i=0;i<n;i++)cin>>x[i];
    int ans=1e9;
    for(int i=0;i+k-1<n;i++){
        int left=x[i],right=x[i+k-1];
        ans = min(ans,min((right-left)+abs(right),(right-left)+abs(left)));
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define pb push_back
#define ll long long
#define ld long double
#define fi first
#define se second
const ll mod = 1000000000+7;
const int N = 100000+50;

ll dp[N];
ll a[N];

ll go(int x){
	if(x==0||x==1)return 0;
	if(dp[x]!=-1)return dp[x];
	return dp[x] = min(abs(a[x]-a[x-1]) + go(x-1) , abs(a[x]-a[x-2]) + go(x-2));
}

main()
{ 
	SPEED;
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	int n ;
	cin >> n;
	memset(dp,-1,sizeof(dp));
	for(int i = 1; i<=n;  i++)
	{
		cin >> a[i];
	}
	a[0] = a[1];
	cout << go(n) << endl;
}

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

int main(){
	int N;
	int a[110];
	cin >> N;
	for (int i=0;i<N;++i){
		cin >> a[i];
	}
	
	sort(a,a+N,greater<int>());	//a[0;N]を大きい順にソート
	/*int Alice = 0;
	int Bob = 0;
	*/
	int res = 0;
	int flag = 1;
	for(int i=0;i<N;++i){
		res += a[i]*flag;
		flag *= -1;
	}
	cout << res << endl;
}

Measured memory_bytes: 256
///AJoy Sarker ,CSE JAHANGIRNAGAR UNIVERSITY 48 Batch

#include<bits/stdc++.h>

using namespace std;
#define SORT(c) sort((c).begin(),(c).end());
#define inf INT_MAX/3
#define pb push_back
#define MP make_pair
#define pii pair<int,int>
#define pcc pair<char,char>
#define pic pair<int,char>
#define pci pair<char,int>
#define VS vector<string>
#define VI vector<int>
#define MIN(a,b) (a>b?b:a)
#define MAX(a,b) (a>b?a:b)
#define pi 3.141592653589793
#define in scanf
#define out printf
#define ll long long
#define ull unsigned long long
typedef unsigned long long UL;
template<typename T>inline T  S(T a)
{
    return a*a;
}
template<class T>inline string tostring(T a)
{
    ostringstream os("");
    os << a;
    return os.str();
}
template<typename T>inline ll tolong(T a)
{
    ll res;
    istringstream os(a);
    os>>res;
    return res;
}
template<typename T>inline T gcd(T a, T b)
{
    if (b == 0)return a;
    else return gcd(b, a % b);
}
template<typename T>inline T bigmod(T a, T b, T m)
{
    if (b == 0)return 1;
    else if (b % 2 == 0)return S(bigmod(a, b / 2, m)) % m;
    else return (a % m*bigmod(a, b - 1, m)) % m;
}
int h[10000005];
int ord[1000000];

int main()
{
    ios_base::sync_with_stdio(0);
    //ll n,c,cnt=0,prev;
    int n,cnt=0,c=0;
    cin >> n;

    for (int i=0; i<n;i++)
    {
        cin>>h[i];
    }
    for (int i=n-1;i>= 0; i--)
    {
        if (h[i]<= h[i-1]) c++;
        else
        {
            if (c>cnt) cnt=c;
            c=0;
        }
    }
    cout<<cnt<<endl;
}



Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repi(i, s, n) for (int i = (s); i < (n); i++)
#ifdef LOCAL
#define INPUT_FILE                              \
  ifstream in("atcoder-problems/arc102_a.txt"); \
  cin.rdbuf(in.rdbuf());
#define print_vec(v)                        \
  rep(l, v.size()) { cout << v[l] << " "; } \
  cout << endl;
#else
#define INPUT_FILE
#define print_vec(v)
#endif
#define CIN_OPTIMIZE \
  cin.tie(0);        \
  ios::sync_with_stdio(false);
typedef pair<int, int> P;
typedef long long ll;
typedef pair<ll, ll> pl;
const int INF = 100100100;
const ll LINF = 1e18 + 100;
const int MOD = 1e9 + 7;

int main() {
  INPUT_FILE CIN_OPTIMIZE;

  int N, K;
  cin >> N >> K;

  ll ans = 0;
  int cnt = N / K;
  ans = pow(cnt, 3);

  if (K % 2 == 0) {
    int cnt = 0;
    while (K / 2 * (cnt * 2 + 1) <= N) cnt++;
    ans += pow(cnt, 3);
  }

  cout << ans << endl;
}

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

using ll = long long;
#define REP(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
string char_to_string(char val) {
  return string(1, val);
}
int char_to_int(char val) {
  return val - '0';
}

int main() {
  int N; cin >> N;
  vector<int> B(N - 1); REP(i, N - 1) cin >> B[i];
  vector<int> A(N); REP(i, N) A[i] = 0;

  for(int i = N - 2; i >= 0; --i) {
    if(i == N - 2) {
      A[i + 1] = B[i];
      A[i] = B[i];
      continue;
    }

    if(B[i + 1] >= B[i]) {
      A[i + 1] = B[i];
      A[i] = B[i];
    } else {
      A[i] = B[i];
    }
  }
/*
  REP(i, N) {
    cout << A[i] << endl;
  } */

  ll a = accumulate(all(A), 0LL);
  cout << a << endl;
}

Measured memory_bytes: 256
import math

n = int(input())
ans = 0
for i in range(1, n+1):
    for j in range(i+1, n+1):
        for k in range(j+1, n+1):
            ans += 6 * math.gcd(math.gcd(i, j), k)

for i in range(1, n+1):
    for j in range(i+1, n+1):
        ans += 6 * math.gcd(i, j)

for i in range(1, n+1):
        ans += i


print(ans)


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

using namespace std;

int main(void){
  int n, a, b;
  cin >> n >> a >> b;
  
  int ans = 0;
  
  for(int i = 0;i <= n;i++){
    int sum = 0;
    for(int j = 0;j < to_string(i).length();j++){
      sum += to_string(i)[j] - '0';
      //cout << "sum:" << sum << endl;
    }
    
    if(a <= sum && sum <= b) {
      ans += i;
      //cout << i << endl;
    }
  }
  
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
//Optimisations
#pragma GCC target ("avx2")
#pragma GCC optimization ("unroll-loops")
#pragma GCC optimize("O2")
//shortcuts for functions
#define pb push_back
#define mp make_pair
#define ff first 
#define ss second
#define all(v) v.begin(),v.end()
#define prec(n) fixed<<setprecision(n)
#define n_l '\n'
// make it python 
#define gcd __gcd
#define append push_back
#define str to_string
// utility functions shortcuts
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define sswap(a,b) {a=a^b;b=a^b;a=a^b;}
#define swap(a,b) {auto temp=a; a=b; b=temp;}
#define init(dp) memset(dp,-1,sizeof(dp));
#define set0(dp) memset(dp,0,sizeof(dp));
#define bits(x) __builtin_popcount(x)
#define SORT(v) sort(all(v))
#define endl "\n"
#define forr(i,n) for(ll i=0;i<n;i++)
// declaration shortcuts
typedef long long int ll;
#define int ll
// Constants
constexpr int dx[] = {-1, 0, 1, 0, 1, 1, -1, -1};
constexpr int dy[] = {0, -1, 0, 1, 1, -1, 1, -1};
constexpr ll INF = 1999999999999999997; 
constexpr int inf= INT_MAX;
constexpr int MAXSIZE = int(1e6)+5;
constexpr auto PI  = 3.14159265358979323846L;
constexpr auto oo  = numeric_limits<int>::max() / 2 - 2;
constexpr auto eps = 1e-6;
constexpr auto mod = 1000000007;
constexpr auto MOD = 1000000007;
constexpr auto MOD9 = 1000000009;
constexpr auto maxn = 100006;
//void IOfile(){
//freopen(file_name, reade_mode, stdin);
//freopen(file_name, write_mode, stdout);
//}
void fastio(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
}

int get(string a, string b){
	int x  = 0;
	for(int i = 0; i < a.size(); i++){
		if(a[i] != b[i]) x++;
	}
	return x;
}

int32_t main(){
	fastio();
	string a,b;
	cin >> a >> b;
	int ans = mod;
	for(int i = 0; i < a.size(); i++){
		if(i + b.size() - 1 < a.size()) ans = min(ans,get(a.substr(i,(int)b.size()),b));
	}
	cout << ans;
}

Measured memory_bytes: 3648
package main

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

var sc = bufio.NewScanner(os.Stdin)

func scanInt() int {
	num, _ := strconv.Atoi(scanString())
	return num
}

func scanString() string {
	sc.Scan()
	return sc.Text()
}

func scanInts(n int) []int {
	sl := make([]int, n)
	for i := range sl {
		sl[i] = scanInt()
	}
	return sl
}

func init() {
	sc.Split(bufio.ScanWords)
}

const mod = 998244353

func main() {
	n, k := scanInt(), scanInt()
	l := make([]int, k)
	r := make([]int, k)
	for i := 0; i < k; i++ {
		l[i], r[i] = scanInt(), scanInt()
	}

	dp := make([]int, n+1)
	dpsum := make([]int, n+1)
	dp[1] = 1
	dpsum[1] = 1
	for i := 2; i <= n; i++ {
		for j := 0; j < k; j++ {
			li := i - r[j]
			ri := i - l[j]
			if ri < 0 {
				continue
			}
			li = max(li, 1)
			dp[i] += dpsum[ri] - dpsum[li-1]
			dp[i] %= mod
		}
		dpsum[i] = dpsum[i-1] + dp[i]
	}

	fmt.Println(dp[n])
}

func max(a, b int) int {
	if a < b {
		return b
	}
	return a
}


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

int main()
{
  int n, k;
  cin >> n>> k;
  int sum=0;

  for (int i = 0; i < n; i++)
  {
    int x, dis;

    cin >> x;
    dis = min(x, k - x);
    sum += dis*2;
  }

  cout<<sum<<endl;
}


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

#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>
#include<iomanip>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
#include<complex>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

//typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector< vector<int> > mat;

template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; }

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD =  (int)1e9 + 7;
const double EPS = 1e-9;

//C=AB
mat mul(mat& A, mat& B)
{
	mat C(A.size(), vector<int>(B[0].size()));
	rep(i, 0, SZ(A))rep(j, 0, SZ(B[0]))rep(k, 0, SZ(B))
	{
		C[i][j] = (C[i][j] + ((A[i][k] * B[k][j])%MOD))%MOD;
	}
	return C;
}

mat mpow(mat A, ll n)
{
	mat B(A.size(), vector<int>(A.size()));
	rep(i, 0, SZ(A))B[i][i] = 1;
	while (n > 0)
	{
		if (n & 1)B = mul(B, A);
		A = mul(A, A);
		n >>= 1;
	}
	return B;
}

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

	int N,K;
	cin>>N>>K;
	mat m(N,vector<int>(N,0));
	rep(i,0,N)rep(j,0,N)cin>>m[i][j];

	m=mpow(m,K);

	int ans=0;
	rep(i,0,N)rep(j,0,N)
	{
		ans=(ans+m[i][j])%MOD;
	}

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

Measured memory_bytes: 384
#include <algorithm>
#include <cmath>
#include <iostream>
using namespace std;
using ll = long long int;
const ll mod = 1000000007;

ll PowMod(ll n, ll p, ll m) {
  if (p == 0) return 1;
  if (p % 2 == 0) {
    ll t = PowMod(n, p / 2, m);
    return t * t % m;
  }
  return n * PowMod(n, p - 1, m) % m;
}

ll COM(ll n, ll r) {
  // 分母と分子。いい名前思いつかなかった
  ll res, deno, mole;
  res = deno = mole = 1;
  for (int i = 0; i < r; i++) {
    mole *= (n - i);
    mole %= mod;
    deno *= (r - i);
    deno %= mod;
  }
  // 分母の逆元
  res = PowMod(deno, mod - 2, mod);
  res = (res * mole) % mod;
  return res;
}

int main() {
  ll n, a, b;
  cin >> n >> a >> b;

  ll ans = PowMod(2, n, mod) - 1;
  ll diff = (COM(n, a) + COM(n, b)) % mod;
  cout << (ans - diff + mod) % mod << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
   static int gcd(int a,int b){
        if(a%b==0)return b;
       else return gcd(b,a%b);
    }
    public static void main(String[] args) {
        Scanner sc =new Scanner(System.in);
        int a=sc.nextInt();
        int b=sc.nextInt();
        int x=gcd(a,b);
        System.out.println(x);
        sc.close();
      
    }
}



Measured memory_bytes: 26140
#pragma region template
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using vld = vector<ld>;
using vvld = vector<vld>;
using vvvld = vector<vvld>;
using vs = vector<string>;
using pll = pair<ll, ll>;
using vp = vector<pll>;
template <typename T>
using pqrev = priority_queue<T, vector<T>, greater<T>>;
#define rep(i, n) for (ll i = 0, i##_end = (n); i < i##_end; i++)
#define repb(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repr(i, a, b) for (ll i = (a), i##_end = (b); i < i##_end; i++)
#define reprb(i, a, b) for (ll i = (b)-1, i##_end = (a); i >= i##_end; i--)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((ll)(x).size())
//*
constexpr ll MOD = 1e9 + 7;
/*/
constexpr ll MOD = 998244353;
//*/
constexpr ll INF = 1e+18;
constexpr ld EPS = 1e-12L;
constexpr ld PI = 3.14159265358979323846L;
constexpr ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
constexpr ll LCM(ll a, ll b) { return a / GCD(a, b) * b; }
template <typename S, typename T>
inline bool chmax(S &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename S, typename T>
inline bool chmin(S &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
#ifdef OJ_LOCAL
#include "dump.hpp"
#else
#define dump(...) ((void)0)
#endif
template <typename T>
bool print_(const T &a) {
  cout << a;
  return true;
}
template <typename T>
bool print_(const vector<T> &vec) {
  for (auto &a : vec) {
    cout << a;
    if (&a != &vec.back()) {
      cout << " ";
    }
  }
  return false;
}
template <typename T>
bool print_(const vector<vector<T>> &vv) {
  for (auto &v : vv) {
    for (auto &a : v) {
      cout << a;
      if (&a != &v.back()) {
        cout << " ";
      }
    }
    if (&v != &vv.back()) {
      cout << "\n";
    }
  }
  return false;
}
void print() { cout << "\n"; }
template <typename Head, typename... Tail>
void print(Head &&head, Tail &&... tail) {
  bool f = print_(head);
  if (sizeof...(tail) != 0) {
    cout << (f ? " " : "\n");
  }
  print(forward<Tail>(tail)...);
}
#pragma endregion

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  ll n;
  cin >> n;
  vll a(n);
  rep(i, n){
    cin >> a[i];
  }
  ll ma = a[0];
  ll ans = 0;
  repr(i, 1, n){
    chmax(ma, a[i]);
    ans += ma-a[i];
  }
  print(ans);
}


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

int main(void) {
  int a, b, c, count5 = 0, count7 = 0;
  scanf("%d %d %d", &a, &b, &c);
  if (a == 5) count5++;
  else if (a == 7) count7++;
  if (b == 5) count5++;
  else if (b == 7) count7++;
  if (c == 5) count5++;
  else if (c == 7) count7++;
  if (count7 == 1 && count5 == 2)
    printf("YES\n");
  else 
    printf("NO\n");
  return 0;
}

Measured memory_bytes: 384
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);

     int a = sc.nextInt();
     int b = sc.nextInt();
     int c = sc.nextInt();

     if (a < b && b < c){
    	 System.out.println("Yes");
     } else {
    	 System.out.println("No");
     }


}
}


Measured memory_bytes: 26296
#include<bits/stdc++.h>
typedef long long ll;
#define INF 100000000
#define MOD 100000007
int dx[4]={1,0,-1,0},dy[4]={0,-1,0,1};
using namespace std;
int main(void){
    int n;
    cin>>n;
    int l[n];
    int max_l=-INF,sum=0;
    for(int i=0;i<n;i++){
        cin>>l[i];
        sum+=l[i];
        if(l[i]>max_l){
            max_l=l[i];
        }
    }
    sum-=max_l;
    if(max_l<sum){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }

   return 0;
}

Measured memory_bytes: 764
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n; cin >> n;
	vector<int> a(n);
	for(int i = 0; i < n; i++) cin >> a[i];
	int j = 0, ans = 0;
	for(int i = 0; i < n; i = j){
		while(j < n && a[j] == a[i]) j++;
		ans += (j - i) / 2;
	}
	cout << ans << endl;
	return 0;
}


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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    long long N, K;
    cin >> N >> K;
    unordered_set<int> frontiers = {1};
    while (N--){
        unordered_set<int> new_frontiers;
        for (auto f : frontiers){
            new_frontiers.insert(2 * f);
            new_frontiers.insert(f + K);
        }
        swap(frontiers, new_frontiers);
    }
    cout << *min_element(begin(frontiers), end(frontiers)) << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
	static class pair{
		int x;
		char symbol;//+ or -
		pair(int x,char symbol){
			this.x = x;
			this.symbol = symbol;
		}
	}
	@SuppressWarnings("unchecked")
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		while(true){
			int n=sc.nextInt(), m=sc.nextInt(), a=sc.nextInt();
			//System.out.println("n="+n+" m="+m+" a="+a);
			//pair[] pa = new pair[n];
			ArrayList<ArrayList<pair>>al = new ArrayList<ArrayList<pair>>();
			pair ini = new pair(-1,'+');
			ArrayList<pair> li_ini = new ArrayList<pair>();
			li_ini.add(ini);
			for(int i=0;i<n;i++) al.add(li_ini);
			if((n|m|a)==0) break;
			for(int i=0;i<m;i++){
				int h=sc.nextInt(),p=sc.nextInt(),q=sc.nextInt();
				//System.out.println("h="+h+" p="+p+" q="+q);
				pair pa = new pair(h,'+');
				ArrayList<pair> li_pa = (ArrayList<pair>) al.get(p-1).clone();
				li_pa.add(pa);
				pair pa2 = new pair(h,'-');
				ArrayList<pair> li_pa2 = (ArrayList<pair>) al.get(q-1).clone();
				li_pa2.add(pa2);
				al.set(p-1, li_pa);
				al.set(q-1, li_pa2);
			}
			int height =1001;
			int wh = a;
			while(true){
				ArrayList<pair> check = al.get(wh-1);
				pair target = null;
				int max = 0;
				for(pair check_pair : check){
					int temp = check_pair.x;
					if(temp<height&&temp>max){
						max = temp;
						target = check_pair;
					}
				}
				height = max;
				//System.out.println("height="+height+" wh="+wh);
				if(target ==null) break;
				if(target.symbol=='+'){ 
					wh++;
				}else{
					wh--;
				}
			}
			System.out.println(wh);
		}
	}
}

Measured memory_bytes: 68256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		try (Scanner sc = new Scanner(System.in)) {
			long n = sc.nextLong();
			long count = 0;
			for (int i = 0; i < n; i++) {
				long l = sc.nextLong();
				long r = sc.nextLong();

				count += r - l + 1;
			}

			System.out.println(count);
		}
	}
}


Measured memory_bytes: 25936
n, k = map(int, raw_input().split())
bunny = [0] * 51
bad = [False] * 51
for i in xrange(k):
    nums = map(int, raw_input().split())[1:]
    for nu in nums:
        bunny[nu] = i
for i in xrange(input()):
    p, q = map(int, raw_input().split())
    if bunny[p]==bunny[q]:
        bad[p] = bad[q] = True
print bad.count(True)

Measured memory_bytes: 4228
until(n,m=gets.split.map(&:to_i))==[0,0]do
r,p,a=[],[],[]
n.times{r.unshift(gets.gsub("?",".").split)}
m.times{p<<gets.split}
p.each{|p|r.each{|r|if p[0]=~/#{r[1]}/&&p[1]=~/#{r[2]}/
a<<p*" "if r[0]=~/p/
break
end}}
puts a.size,a
end

Measured memory_bytes: 9412
#include <iostream>
#include <cfenv>
#include <cmath>
#include <vector>
#include <algorithm>
#include <string>
#include <deque>

using namespace std;
using ll = long long;

int main(){
  int one_counter = 0;
  string tmp;
  cin >> tmp;
  deque<string> s;
  s.push_back(tmp);

  int q;
  cin >> q;

  for(int i = 0; i < q; ++i){
    int t;
    cin >> t;
    if(t == 1){
      ++one_counter;
    } else if(t == 2){
      int f;
      string c;

      cin >> f >> c;

      if(one_counter % 2 == 0){
        if(f == 1){
          s.push_front(c);
        }else if(f == 2){
          s.push_back(c);
        }
      } else if(one_counter % 2 == 1){
        if(f == 1){
          s.push_back(c);
        }else if(f == 2){
          s.push_front(c);
        }
      }
    }
  }

  string ans = "";
  for(auto itr = s.begin(); itr != s.end(); ++itr) {
    ans += *itr;
  }

  if(one_counter % 2 == 1){
    reverse(ans.begin(), ans.end());
  }
  
  cout << ans << endl;

  return 0;
}


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

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll a,b,c,x,y;cin >> a >> b >> c >> x >> y;
	c*=2;
	ll ans=1000000000000000;
	rep(i,max(x,y)+1){
		ans=min(ans,c*i+max((x-i)*a,(ll)0)+max((y-i)*b,(ll)0));
	}
	cout << ans << endl;
}

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

int main() {
  int A, B, C, ans;
  cin>> A >> B >> C;
  vector<int> vec = {A, B, C};
    sort(vec.begin(), vec.end());
 
    ans = vec.at(2)*10+vec.at(1)+vec.at(0);
      cout << ans << endl;
}


Measured memory_bytes: 256
//#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
//#include<algorithm>
//#include<cmath>
//#include<string>
//#include<cctype>
using namespace std;

int main() {
	int a, b;
	while (cin >> a >> b) {
		if (a == 0 && b == 0) return 0;
		if (a*b%2)cout << "no" << endl;
		else cout << "yes" << endl;
	}
	return 0;
}

Measured memory_bytes: 3068
k['( '],n,a,b,i,m;p(int*x){n=*x-*1[&x];}main(c){for(scanf("%d%d%d%d",&n,&a,&b,&c);i<n;scanf("%d",k+i++));for(qsort(k,n,4,p);~i;a+=b,c+=k[--i])m=fmax(m,c/a);a=!printf("%d\n",m);}

Measured memory_bytes: 0
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <iomanip>
#include <iterator>
#include <algorithm>
#include <functional>
#include <typeinfo>
#include <utility>
#include <tuple>
#include <queue>

using namespace std;

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define reprrev(i, a, b) for (int i = (int)(b) - 1; i >= (int)(a); i--)
#define reprev(i, n) reprrev(i, 0, n)
#define all(arr) (arr).begin(), (arr).end()
#define yn(formula) (formula) ? (cout << "Yes" << endl) : (cout << "No" << endl)
#define YN(formula) (formula) ? (cout << "YES" << endl) : (cout << "NO" << endl)

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef vector<vb> vvb;
typedef vector<vc> vvc;
typedef vector<vs> vvs;
typedef vector<vpii> vvpii;
typedef vector<vpll> vvpll;

constexpr double PI = 3.14159265358979323846;
constexpr ll INF = 1ll << 59;
constexpr ll MOD = (ll)1e9 + 7;
constexpr double EPS = 1e-7;
constexpr int dy[4] = { 0, 1, 0, -1 };
constexpr int dx[4] = { 1, 0, -1, 0 };

/*<ここから>***********************************************************/


int main()
{
	int N, C;
	cin >> N >> C;
	vi s(N), t(N), c(N);
	rep(i, N) {
		int st, en, ch;
		cin >> st >> en >> ch;
		s[i] = st - 1;
		t[i] = en - 1;
		c[i] = ch - 1;
	}
	vvi tt(C, vi(2e5, 0));
	rep(i, N) {
		int range[2];
		if (s[i] != 0) range[0] = 2 * s[i] - 1;
		else range[0] = 0;

		repr(j, range[0], 2 * t[i]) tt[c[i]][j] = 1;
	}

	vi sum(2e5, 0);
	int ma = 0;
	rep(i, C) {
		rep(j, 2e5) {
			sum[j] += tt[i][j];
		}
	}

	sort(all(sum));

	cout << sum[2e5 - 1] << endl;
	
	return 0;
}


Measured memory_bytes: 25728
def conv(a):
    for i in range(len(a)):
        a[i] = int(a[i])
    return a
def main(n,blue,red):
    blueall = int(n/(blue + red))*blue
    n = n - (int(n/(blue + red))*(blue+red))
    if n >= blue:
        return blueall + blue
    else:
        return blueall + n
n,a,b = conv(input().split())
print(main(n,a,b))

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

#define pb push_back
#define mp make_pair
#define eb emplace_back
#define all(a) begin(a), end(a)
#define has(a, b) (a.find(b) != a.end())
#define fora(i, n) for(int i = 0; i < n; i++)
#define forb(i, n) for(int i = 1; i <= n; i++)
#define forc(a, b) for(const auto &a : b)
#define ford(i, n) for(int i = n; i >= 0; i--)
#define maxval(t) numeric_limits<t>::max()
#define minval(t) numeric_limits<t>::min()
#define imin(a, b) a = min(a, b)
#define imax(a, b) a = max(a, b)
#define sz(x) (int)(x).size()

#define dbgs(x) #x << " = " << x
#define dbgs2(x, y) dbgs(x) << ", " << dbgs(y)
#define dbgs3(x, y, z) dbgs2(x, y) << ", " << dbgs(z)
#define dbgs4(w, x, y, z) dbgs3(w, x, y) << ", " << dbgs(z)

using ll = long long;
using ld = long double;

int n[4];
int w[] = { 1, 1, 2, 2 };

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

	fora(i, 3) {
		int a, b;
		cin >> a >> b;
		--a ;--b;
		++n[a];
		++n[b];
	}

	sort(n, n+4);
	bool ok = true;
	fora(i, 4) ok &= n[i] == w[i];
	if (ok) cout << "YES";
	else cout << "NO";
	cout << endl;
}


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

int main(){
    int N;
    cin >> N;
    int tmp;
    long int sum[N+1];
    sum[0] = 0;
    for (int i=1;i<=N;i++){
        cin >> tmp;
        sum[i] = sum[i-1]+tmp;
    }
    long int min = sum[N] - 2*sum[1];
    if (min < 0) min *= -1;
    long int result;
    for (int i=2;i<=N-1;i++){
        result = sum[N] - 2*sum[i];
        if (result < 0) result *= -1;
        if (min > result) min = result;
    }
    cout << min << endl;
}


Measured memory_bytes: 1792
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<sstream>
#include<iterator>
using namespace std;
typedef  long long int lint;
typedef pair<int, int> IP;
typedef pair<lint, lint> LLP;
typedef pair<char, char>CP;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define sort(v) sort((v).begin(), (v).end())
#define reverse(v) reverse((v).begin(), (v).end())
#define upper(v,hoge) upper_bound(v.begin(),v.end(),hoge)
#define lower(v,hoge) lower_bound(v.begin(),v.end(),hoge)
#define llower(v,hoge) *lower_bound(v.begin(), v.end(), hoge)
#define lupper(v,hoge) *upper_bound(v.begin(), v.end(), hoge)

int main() {
	string S;
	cin >> S;
	reverse(S);
	cout << S << endl;
}


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

vector<pair<int,int>>PF(int n)
{
	vector<pair<int,int>>v;
	for(int i=2;i*i<=n;i++)
	{
		if(n%i==0)
		{
			int cnt=0;
			while(n%i==0)
			{
				n/=i;
				cnt++;
			}
			v.push_back(make_pair(i,cnt));
		}
	}
	if(n!=1)v.push_back(make_pair(n,1));
	return v;
}

int main()
{	
	int n,t[105]={},sum[5]={},ans=0;;
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		vector<pair<int,int>>w=PF(i);
		for(int j=0;j<w.size();j++)t[w[j].first]+=w[j].second;
	}
	for(int i=1;i<=100;i++)
	{
		if(t[i]>=24)sum[0]++;
		if(t[i]>=14)sum[1]++;
		if(t[i]>=4)sum[2]++;
		if(t[i]>=2)sum[3]++;
		if(t[i]>=74)sum[4]++;
	}
	if(sum[0])ans+=sum[0]*(sum[3]-sum[0])+sum[0]*(sum[0]-1);
	if(sum[1])ans+=sum[1]*(sum[2]-sum[1])+sum[1]*(sum[1]-1);
	ans+=sum[2]*(sum[2]-1)*(sum[2]-2)/2+sum[2]*(sum[2]-1)/2*(sum[3]-sum[2]);
	ans+=sum[4];
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
X,Y,Z,K = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))

import itertools
AB = [a + b for a, b in itertools.product(A,B)]
AB.sort(reverse=True)
ABC = [ab + c for ab, c in itertools.product(AB[:3000],C)]
ABC.sort(reverse=True)
for i in range(K):
    print(ABC[i])


Measured memory_bytes: 148020
#include <iostream>
#include <vector>
using namespace std;
using LL = long long;

LL calc(vector<LL> xs, LL n, LL mod){
    LL cum = 0;
    for (int i = 1; i < n; ++i){
        LL inc = xs[i] - xs[i - 1];
        inc = (inc * i) % mod;
        inc = (inc * (n - i)) % mod;
        cum = (cum + inc) % mod;
    }
    return cum;
}

int main() {
    ios::sync_with_stdio(false);
    LL n, m;
    cin >> n >> m;
    vector<LL> xs(n, 0);
    vector<LL> ys(m, 0);
    for (auto &x: xs) cin >> x;
    for (auto &y: ys) cin >> y;
    LL mod = 1e9 + 7;
    auto cumx = calc(xs, n, mod);
    auto cumy = calc(ys, m, mod);
    auto result = (cumx * cumy) % mod;
    cout << result << endl;
    return 0;
}

Measured memory_bytes: 2672
using System;
using System.Linq;

namespace ConsoleApp7
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] a = Console.ReadLine().Split().Select(int.Parse).ToArray();
            if( a[0] <= a[1] * a[2]) { Console.WriteLine("Yes"); }
            else { Console.WriteLine("No"); }

        }
    }
}


Measured memory_bytes: 28308
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <string>

#define rep(i, a, b) for ( int i = (a); i < (b); i++ )
#define per(i, a, b) for ( int i = (b)-1; i >= (a); i--)
#define pb push_back
#define mp make_pair
#define bg begin()
#define en end()


using namespace std;

typedef long long ll;

static const long long MOD = 1000000007;

string s, t;
int ans;

int main(void) {
  cin >> s;
  for (int i=0; i<(int)s.size(); i++) {
    if(s[i]!='x') t.pb(s[i]);
  }
  bool ok = true;
  for (int i=0; i <=((int)t.size()-1)/2; i++) {
    if (t[i] != t[(int)t.size()-1-i]) ok = false;
  }
  if (!ok) {
    puts("-1");
    return 0;
  }
  int l = 0;
  int r = (int)s.size()-1;
  while (l<r) {
    if (s[l]==s[r]) {
      l++; r--;
    } else {
      ans++;
      if (s[l]=='x') l++;
      else r--;
    }
  }
  cout << ans <<endl;
  
    return 0;
}



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

int main (){
    int N, K, X, Y;
    cin>>N>>K>>X>>Y;
    if(N<K+1){
        cout<<N*X<<endl;
    }
    else{
        cout<<K*X+(N-K)*Y<<endl;
    }
}

Measured memory_bytes: 256
H, W = map(int, input().split())
Cs = []
for i in range(10):
    c = list(map(int, input().split()))
    Cs.append(c)

As = []
for i in range(H):
    a = list(map(int, input().split()))
    As.append(a)


# 数字->数字に変えるcostを更新する（ワーシャルフロイド法）
for k in range(10):
    for i in range(10):
        for j in range(10):
            Cs[i][j] = min(Cs[i][j], Cs[i][k] + Cs[k][j])

# 解答
count = 0
for i in range(H):
    for j in range(W):
        if As[i][j] >= 0:
            #print('number=', As[i][j], 'cost=', Cs[As[i][j]][1])
            count += Cs[As[i][j]][1]

print(count)


Measured memory_bytes: 3444
from random import choice

class dice:
    def __init__(self, X):
        self.x = [0] * 6
        self.x[0] = X[0]
        self.x[1] = X[1]
        self.x[2] = X[2]
        self.x[3] = X[3]
        self.x[4] = X[4]
        self.x[5] = X[5]

    def roll(self, d):
        if d == 'S':
            self.x[0], self.x[1], self.x[2], self.x[3], self.x[4], self.x[5] = \
            self.x[4], self.x[0], self.x[2], self.x[3], self.x[5], self.x[1]
        elif d == 'E':
            self.x[0], self.x[1], self.x[2], self.x[3], self.x[4], self.x[5] = \
            self.x[3], self.x[1], self.x[0], self.x[5], self.x[4], self.x[2]
        elif d == 'W':
            self.x[0], self.x[1], self.x[2], self.x[3], self.x[4], self.x[5] = \
            self.x[2], self.x[1], self.x[5], self.x[0], self.x[4], self.x[3]
        elif d == 'N':
            self.x[0], self.x[1], self.x[2], self.x[3], self.x[4], self.x[5] = \
            self.x[1], self.x[5], self.x[2], self.x[3], self.x[0], self.x[4]

X = list(map(int, input().split()))
n = int(input())
dice1 = dice(X)
distances = ['S', 'E', 'W', 'N']
for i in range(n):
    x1, x2 = map(int, input().split())
    while True:
        d = choice(distances)
        dice1.roll(d)
        if dice1.x[0] == x1 and dice1.x[1] == x2:
            print(dice1.x[2])
            break


Measured memory_bytes: 8184
#include <stdio.h>
#include <ctype.h>

int main(){

	
	char c, i;
	int word[26]={0};
	

	while(1){

		c  = getchar();
		if( c == EOF ) break;

		if(isalpha(c))
			word[tolower(c)-0x61]++;	
		
		
	}

	for( i=0; i<26; i++ )
		printf( "%c : %d\n", 0x61+i, word[i] );


	return 0;

}

Measured memory_bytes: 524
#include<bits/stdc++.h>
using namespace std;
/*#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
/*template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
*/typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll,ll> pl;
typedef pair<int,int> pii;

#define LOCAL 0
#define dbg(x) cout << #x << " is " << x << "\n"
#define gll(x) scanf("%d",&x)
#define gll2(x,y) scanf("%d%d",&x,&y)
#define gll3(x,y,z) scanf("%d%d%d",&x,&y,&z)
#define gllarr(arr,n) f(i,n) gll(arr[i]);
#define sz(x) ((int)x.size())
#define s(x) sort(x.begin(),x.end())
#define all(v) v.begin(),v.end()
#define rs(v) { s(v) ; r(v) ; }
#define r(v) {reverse(all(v));}
#define pb push_back
#define f(i,n) for(int i=0;i<n;i++)
#define fr(i,n) for(int i=n-1;i>=0;i--)
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define repr(i,a,b) for(int i=a;i>=b;i--)

const ll mod = (ll)1e9 + 7;
const ll inf = (ll)1e16;
const ld eps = 1e-12;
const ll N = (int)1e5 + 5;
const ll LOGN = 19;
const ld PI = 3.14159265358979323846;
inline ll mul(ll a, ll b, ll m = mod) { return (ll)(a * b) % m;}
inline ll add(ll a, ll b, ll m = mod) { a += b; if(a >= m) a -= m; if(a < 0) a += m; return a;}
inline ll power(ll a, ll b, ll m = mod) { if(b == 0) return 1; if(b == 1) return (a % m); ll x = power(a, b / 2, m); x = mul(x, x, m); if(b % 2) x = mul(x, a, m); return x;}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    if (LOCAL) {
        freopen("C:\\Users\\Dishant\\Desktop\\Collection-DEV c++\\input.txt", "r", stdin);
        freopen("C:\\Users\\Dishant\\Desktop\\Collection-DEV c++\\output.txt", "w", stdout);
    }
    string s;
    cin>>s;
    int n = s.length(), ans = 0;
    char dx[] = {'A', 'T', 'G', 'C'};
    for(int i = 0; i < n; i++){
        if(s[i] == dx[0] || s[i] == dx[1] || s[i] == dx[2] || s[i] == dx[3]){
            int j = i + 1, len = 1;
            for(; j < n; j++){
                if(s[j] == dx[0] || s[j] == dx[1] || s[j] == dx[2] || s[j] == dx[3]) len++;
                else break;
            }
            ans = max(ans, len);
        }
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 256
from itertools import permutations

n, m = map(int, input().split())
paths = set()

for i in range(m) :
    _a, _b = map(int, input().split())
    paths.add((_a, _b))
    paths.add((_b, _a))
    
print(sum(all(s in paths for s in zip((1,) + p, p)) for p in permutations(range(2, n + 1))))



Measured memory_bytes: 3060
N = int(input())
from collections import Counter
from itertools import accumulate
from bisect import bisect_right
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a
cum_lis = list(accumulate([i for i in range(1000)]))
c = Counter(prime_factorize(N))
ans = 0
for num in c.values():
    ans += bisect_right(cum_lis, num)-1
print(ans)

Measured memory_bytes: 9532
//shara's here
//SPEEEEEEEEEED IS KEEEEEEEEEEY
#include <bits/stdc++.h>
using namespace std;
typedef int q;
typedef double w;
typedef string s;
typedef long long ll;
//using ll = long long;
typedef long double ld;
#define speed ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)

int main(){
    speed;
    s ss,dd;
    cin>>ss>>dd;
    sort(ss.begin(),ss.end());
    sort(dd.begin(),dd.end());
    reverse(dd.begin(),dd.end());
    if(ss<dd)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
return 0;}
/*
███████████████████████████████████████████████████
███████████████████████████████████████████████████
██████████████████████████████████▀████████████████
██████████████████████████████████░▀███████████████
██████████████████████████████▌███░░░▀▀████████████
██▀████████████████████▐██████░▐██░░░░░░▀▀█████████
██░████████████████████▐█████▌░██▌▄░░░░▄▄░▄████▀███
█▌░███████████████████▀░█████░░░█░░░▄████░░███▀▐███
█▌░▐██████████████████░░████▌░░░▀░░▀███▀▀░▐███▄████
██░▀██████████████▌▐█▐▄▄████▌░░░░░░░░░░░░░▌████████
███░███████████████▀░▄▄██▀█▐░░░░░░░░░░░░░░▐████████
███▄░██████████████▄░░░░░░▀▀▀░░░░░░░░░░░░░█▐███████
████▄░██████████████████▄▄▄▄▄▄▐▄░░░░░░░░░░░████████
█████▄█████████████████▀▀▀▀▀▀░░░░░░░░░░░░░░████████
████████████████████████▄░░░░░░░░░░░░░░░▄░░████████
██████████████████████████▄▄▄░░░░░░░░░▄█░▄█████████
████████████████████████████████▄░░░░██▄███▀░░▀████
█████████████████████████████▀█████▄███▀▀▀░░▄▄░████
████████████████████████████▀░░▀░░▀▀░░░░▄▄▄██▀░░▀▀█
███████████████████████████▌░░░░░░░░░░░███████░░░▄█
███████████████▄░▀████████▀░░░░░░▀░░░░███████▌░░░██
███▄▄████████████▄░▀██████▄░░░░░█░░░░████████░░░▀▀
░▀█████████████████▄░▀█████░░░░██░░░░▀██████░░░░░▄█
▐█▄▀█████████████████▄░▀████░░░██▌░░░▐████▀░░░░▄███
▐███▄▀▀█████████████████▄░▀▀░░░░▀██▌▄█▀▀░░░▄▄██████
▀▀▀▀▀░░░▀▀▀▀▀░░░▀▀▀▀▀▀▀▀▀▀▀░░░░░░░▀▀░░░░░░▀▀▀▀▀▀▀▀▀
*/

Measured memory_bytes: 256
N=int(input())
Ls = list(map(int,input().split()))
score=0
for i in range(0,N-2):
  a = Ls[i]
  for j in range(i+1, N-1):
      b = Ls[j]
      for k in range(j+1, N):
        c = Ls[k]
        if ((a+b>c)&(a+c>b)&(b+c>a)&(a!=b)&(a!=c)&(b!=c)):
          score+=1

print(score)

Measured memory_bytes: 9164
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;

public class Main {

    public static void main(String[] args) throws Exception {
	    String[] lines = Io.read();

        String result = Stream.of(lines)
                .skip(1)
                .sorted()
                .collect(Collectors.joining());

        Io.write(result);
    }
}

class Io {

    /**
     * 標準入力から1行ずつ受け取る
     * @return
     * @throws IOException
     */
    public static String[] read() throws IOException
    {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        List<String> inputs = new ArrayList<String>();
        String line;
        while ((line = br.readLine()) != null) {
            if (line.equals(""))
                break;

            inputs.add(line);
        }
        br.close();
        return inputs.toArray(new String[0]);
    }

    /**
     * 標準出力
     * @param line
     */
    public static void write(String line)
    {
        System.out.println(line);
    }
}

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

int main(int argc, char const* argv[])
{
	int a, b;
	cin >> a >> b;
	if (a == b) {
		cout << "a == b" << endl;
	} else if ( a > b ) {
		cout << "a > b" << endl;
	} else {
		cout << "a < b" << endl;
	}
	return 0;
}


Measured memory_bytes: 1156
import java.util.*

fun main(args: Array<String>) {
  val sc = Scanner(System.`in`)
  val n = sc.nextInt()
  val a = (1..n).map { sc.nextLong() }

  val sum = a.sum()
  var sunuke = a[0]

  val list = mutableListOf<Long>()
  for (i in 1 until n) {
    val arai = sum - sunuke
    val abs = Math.abs(sunuke - arai)

    list.add(abs)
    sunuke += a[i]
  }


  val min = list.min()
  println(min)


}


Measured memory_bytes: 67868
# 入力の取得(空白を除く)
s = list(input().split())

# 処理
isPoor = False
if s[0] == s[1] and s[1] != s[2]:
    isPoor = True
if s[1] == s[2] and s[2] != s[0]:
    isPoor = True
if s[2] == s[0] and s[0] != s[1]:
    isPoor = True

if isPoor:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 3060
#include<iostream>
#include<vector>
#include<string>
#include<map>
#include<set>
#include<algorithm>

#define MOD (1000000007)
#define MAX (100000)
using namespace std;

typedef long long int Int;

class UT {
    private:
        int par[MAX];
        int rank[MAX];
    public:
        UT(int n) {
            for(int i = 0;i < n;i++) {
                par[i] = i;
                rank[i] = 0;
            }
        }

        int root(int x) {
            return par[x] == x ? x : par[x] = root(par[x]);
        }

        bool same(int x,int y) {
            return root(x) == root(y);
        }

        void unite(int x,int y) {
            x = root(x);
            y = root(y);

            if(x == y)
                return;

            if(rank[x] < rank[y]) {
                par[x] = y;
            } else {
                par[y] = x;
                if(rank[x] == rank[y])
                    rank[x]++;
            }
        }
};

int main(void) {
    int N,M;
    vector<int> p;
    int num = 0;

    cin>>N>>M;

    UT ut(N);

    for(int i = 0;i < N;i++) {
        int temp;
        cin>>temp;
        p.push_back(--temp);
    }

    for(int i = 0;i < M;i++) {
        int x,y;
        cin>>x>>y;
        x--,y--;
        ut.unite(x,y);
    }

    for(int i = 0;i < N;i++) {
        if(ut.same(p[i],i))
            num++;
    }

    cout<<num<<endl;

    return 0;
}


Measured memory_bytes: 1660
#include <bits/stdc++.h>
#define int long long
#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++)
using namespace std;

signed main(){
    string s; cin >> s;
    rep(i,s.size()){
        if (i == s.size()-1) cout << "x" << endl;
        else cout << "x";
    }
    return 0;
}

Measured memory_bytes: 256
#[allow(dead_code)]
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()
}

#[allow(dead_code)]
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

#[allow(dead_code)]
fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}

fn main() {
    let v = read_vec::<f64>();
    let x1 = v[0];
    let y1 = v[1];
    let x2 = v[2];
    let y2 = v[3];

    let ans = ((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1)).sqrt();
    println!("{}", ans);
}



Measured memory_bytes: 5064
#include <bits/stdc++.h>
						using namespace std;
						#define pll pair<ll,ll>
						typedef long long ll;
						#define mod 51123987
						#define fi first
						#define se second
						#define mp make_pair
						#define pb push_back
						#define INF 1e15
						const int N=2e5+5;
						const int LG=21;
						
						int main()
						{
							ll a[10];
							map<ll,ll> m;
							for(ll i=1;i<=9;i++)
							{
								cin>>a[i];
								m[a[i]]=i;
							}
							ll n;
							cin>>n;
							ll b[10]={0};
							for(ll i=0;i<n;i++)
							{
								ll x;
								cin>>x;
								b[m[x]]=1;
							}
							
							int f=0;
							for(ll i=1;i<=9;i+=3)
							{
									if(b[i]&& b[i+1] && b[i+2])
										{
											f=1;
										}
							}
							for(ll i=1;i<=3;i++)
							{
								if(b[i] && b[i+3] && b[i+6])
								{
									f=1;
								}	
							}
							if(b[1] && b[5] && b[9])
								f=1;
							if(b[3] && b[5] && b[7])
								f=1;
							if(f)
							{
								cout<<"Yes";
							}
							else
							{
								cout<<"No";
							}
							
						}


Measured memory_bytes: 256
#include<iostream>
#include<queue>
using namespace std;
int main()
{
    int n,q,o,m,x;
    cin>>n>>q;
    priority_queue<int>Q[n];
    while(q--){

      cin>>o;

          if(o==0){
              cin>>m>>x;
              Q[m].push(x);
          }

         if(o==1){
              cin>>m;
               if(! Q[m].empty())
              cout<<Q[m].top()<<endl;
          }

          if(o==2){
              cin>>m;
              if(! Q[m].empty())
              Q[m].pop();
          }
  }
return 0;
}



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

int main(){
    long long h, w, answer;
    cin >> h >> w;
    if(h == 1){
        cout << 1 << endl;
        return 0;
    }
    if(w == 1){
        cout << 1 << endl;
        return 0;
    }
    else if(h % 2 == 0){
        answer = h / 2 * w;
        
    }
    else if (h % 2 == 1){
        if(w % 2 == 0){
            answer = w / 2 * h;
        }
        else if(w % 2 == 1){
            answer = (w / 2) * h + h / 2 + 1;
        }
    }
    cout << answer << endl;
    return 0;
}

Measured memory_bytes: 256