akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
const ll md = 1000000007;
vector<ll> fact(1e6+7), invfact(1e6+7);

ll fn(ll n, ll a, ll r, ll mod = md) {
    ll res = 1, x = r%mod;
    ll ans = 0;
    while(n) {
        if(n&1) ans = (x*ans + res)%mod;
        res = ((res*x)%mod + res%mod)%mod;
        x = (x*x)%mod;
        n = n/2;
    }
    ans = (ans*a)%mod;
    return ans;
}

ll nCr(ll n, ll r) {
    if(r == 0) return 1;
    ll num = fact[n];
    ll den = (invfact[r] % md *invfact[n-r] % md)%md;
    return (num*den)%md;
}

ll mul(ll a, ll b, ll mod = md) {
    ll res = (a%mod * b%mod)%mod;
    return res;
}

ll mulm(ll a, ll b, ll mod = md) {
    ll r = 0;
    a %= mod;
    while (b) {
        if (b & 1) r = (r+a)%mod;
        a = (a+a)%mod;
        b = b/2;
    }
    r %= mod;
    return r;
}

ll power(ll x, ll n, ll mod = md) {
    ll res = 1;
    x %= mod;
    while (n) {
        if (n & 1)  res = (res*x)%mod;
        n = n/2;
        x = (x*x)%mod;
    }
    return res;
}

ll power2(ll x, ll n) {
    ll res = 1;
    while (n)  
    {  
        if (n & 1)  res = (res*x);  
        n = n/2; 
        x = (x*x);  
    }  
    return res;
}

bool is_prime(ll x) {
    if(x == 1 || x == 0) return false;
    for(int i=2; i*i <= x; i++) {
        if(x%i == 0) return false;
    }
    return true;
}

ll compgcd(ll n, vector<ll> const &primes) 
{ 
    ll res = n; 
    for (ll i=0; primes[i]*primes[i] <= n; i++) {
        if (n % primes[i]== 0) { 
            res -= (res / primes[i]); 
            while (n%primes[i]== 0) {
               n/=primes[i]; 
            }
        } 
    } 
    if (n > 1) {
       res -= (res / n); 
    }
    return res; 
} 

void sieve(vector<bool> &prime, vector<ll> &primes, ll lim) {
    for(int i = 2; i*i <= lim; i++) {
        if(prime[i]) {
            for(int j = 2; j*i <= lim; j++) {
                prime[j*i] = false;
            }
        }
    }
    for(int i = 2; i <= lim; i++) {
        if(prime[i]) {
            primes.push_back(i);
        }
    }
}

void sieveGCD(ll lim, vector<ll> &tab, vector<ll> const &primes) {
    for(int  i = 1; i <= lim; i++) {
        tab[i] = i;
    }
    for(int i = 0; i<primes.size() && primes[i] <= lim; i++) {
        tab[primes[i]] = primes[i]-1;
        for(int j = 2; primes[i]*j <= lim; j++) {
            tab[primes[i]*j] = (tab[primes[i]*j]/primes[i])*(primes[i]-1);
        }
    }
}

int main() 
{ 
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n, count = 0;
    cin >> n;
    map<string, int> m;
    while(n--) {
        string s;
        cin >> s;
        if(m[s] == 0) {
            count++;
            m[s]++;
        }
    }
    cout << count << "\n";
    return 0; 
}

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

//#define ll long long
#define ld long double
#define pb push_back
#define eb emplace_back
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()

//#define int long long
using namespace std;
const int INF = 2e9;
const int MOD = 1e9 + 7;
const int MB = 20;

void solve() {
	int n, m;
	cin >> n >> m; 
	vector<int> a(n + 1), b(m + 1);
	for (int i = 1; i <= n; i++) cin >> a[i];
	for (int i = 1; i <= m; i++) cin >> b[i];
	vector<vector<int>> sum(n + 1, vector<int>(m + 1));
	for (int i = 0; i <= n; i++) sum[i][0] = 1;
	for (int j = 0; j <= m; j++) sum[0][j] = 1;

	int ans = 1;
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= m; j++) {
			int x = 0;
			if (a[i] == b[j]) x += sum[i - 1][j - 1];
			ans = (ans + x) % MOD;
			sum[i][j] = (((sum[i - 1][j] + sum[i][j - 1]) % MOD - sum[i - 1][j - 1] + MOD) % MOD + x) % MOD;
		}
	}
	cout << ans;
}


signed main() {
	/*
	freopen("search.in", "r", stdin);
	freopen("search.out", "w", stdout);
	*/
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	cout << fixed;
	cout.precision(12);
	solve();
}

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

using namespace std;

#define ll long long
ll input(){
	ll x=0,f=0;char ch=getchar();
	while(ch<'0'||ch>'9') f|=ch=='-',ch=getchar();
	while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
	return f? -x:x;
}

const int N=3007;

int dp[N][N];
string s,t;
string res;

int main(){
	cin>>s>>t;

	for(int i=0;i<s.length();i++){
		for(int j=0;j<t.length();j++){
			if(s[i]==t[j]) dp[i+1][j+1]=max(dp[i+1][j+1],dp[i][j]+1);
			dp[i+1][j+1]=max(dp[i+1][j+1],max(dp[i+1][j],dp[i][j+1]));
		}
	}

	int x=s.length(),y=t.length();
	while(x>0&&y>0){
		if(dp[x][y]==dp[x-1][y]) x--;
		else if(dp[x][y]==dp[x][y-1]) y--;
		else res=s[x-1]+res,x--,y--;
	}

	cout<<res<<endl;
}

Measured memory_bytes: 35456
#include <cstdio>
#include <cstring>
#include <vector>
typedef long long lld;
const int MAXS = 105;
std::vector<int> C;
char S[MAXS];
int K, N;

int cnt, sum;

void push() {
    C.push_back(cnt);
    sum += cnt / 2;
    cnt = 0;
}

void count() {
    cnt = 1;
    sum = 0;
    for (int i = 1; i < N; ++i) {
        if (S[i] != S[i-1]) {
            push();
        }
        ++cnt;
    }
    push();
}

lld solve() {
    count();
    if (C.size() == 1u) {
        return 1LL * K * N / 2;
    }
    if (S[0] != S[N-1]) {
        return 1LL * K * sum;
    }
    int f = C.front();
    int b = C.back();
    int join = (f + b) / 2 - f / 2 - b / 2;
    return 1LL * K * sum + 1LL * (K - 1) * join;
}

int main() {
    scanf(" %s", S);
    scanf("%d", &K);
    N = strlen(S);
    printf("%lld\n", solve());
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <algorithm>
#define rep(i, n) for(i = 0; i < (n); i++)
#define chmax(x, y) x = max(x, y)
#define MOD 1000000007
#define INF 1 << 30

using namespace std;
typedef long long ll;
typedef pair<int, int> pp;

int main(void) {
	int num, i;
	ll a, k, ans = 0;
	cin >> num;
	queue<int> que;
	rep(i, num) {
		cin >> a >> k;
		while (k > 0) {
			if (k & 1)
				que.push(a);
			k >>= 1;
			ans += k;
			a <<= 1;
			if (a >= 10) {
				ans += k;
				a = a % 10 + 1;
			}
		}
	}
	a = que.front();
	que.pop();
	ans += que.size();
	while (!que.empty()) {
		a += que.front();
		que.pop();
		if (a >= 10) {
			ans++;
			a = a % 10 + 1;
		}
	}
	cout << ans << "\n";
	return 0;
}

Measured memory_bytes: 13584
#include<bits/stdc++.h>
using namespace std;
using ll=int64_t;
using vi=vector<int>;
using vll=vector<ll>;
int main() {
  int n,x,i;
  cin>>n;
  vi a(n);
  for(i=0;i<n;i++){
    cin>>a.at(i);
    if(i==0) x=a.at(i);
    else x=x xor a.at(i);
  }
  bitset<32> xb(x);
  for(i=0;i<n;i++){
    bitset<32> ab(a.at(i));
    int k=0;
    for(int j=0;j<32;j++){
      if(xb.test(j) && ab.test(j)) ;
      else if(xb.test(j) && !ab.test(j)) k+=(1<<j);
      else if(!xb.test(j) && ab.test(j)) k+=(1<<j);
      else if(!xb.test(j) && !ab.test(j)) ;
    }
    cout<<k;
    if(i<n-1) cout<<' ';
    else cout<<endl;
  }
}

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

# define REP(i,n) for (int i=0;i<(n);++i)
# define rep(i,a,b) for(int i=a;i<(b);++i)
# define p(s) std::cout << s ;
# define pl(s)  std::cout << s << endl;
# define printIf(j,s1,s2) cout << (j ? s1 : s2) << endl;
# define YES(j) cout << (j ? "YES" : "NO") << endl;
# define Yes(j) std::cout << (j ? "Yes" : "No") << endl;
# define yes(j) std::cout << (j ? "yes" : "no") << endl;
# define all(v) v.begin(),v.end()
# define showVector(v) REP(i,v.size()){p(v[i]);p(" ")} pl("")
template<class T> inline bool chmin(T &a, T b){ if(a > b) { a = b; return true;} return false;}
template<class T> inline bool chmax(T &a, T b){ if(a < b) { a = b; return true;} return false;}
typedef long long int ll;
typedef pair<ll,ll> P_ii;
typedef pair<double,double> P_dd;

template<class T>
vector<T> make_vec(size_t a){
    return vector<T>(a);
}

template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts){
  return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

template<typename T,typename V>
typename enable_if<is_class<T>::value==0>::type
fill_v(T &t,const V &v){t=v;}

template<typename T,typename V>
typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t,const V &v){
  for(auto &e:t) fill_v(e,v);
}


const int MOD = 1000000007;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;

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

  string s;
  cin >> s;

  int ans = 0;
  REP(i, N - 1) if(s[i] == s[i + 1]) ans++;

  cout << N - ans << endl;

  return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <utility>
#include <cmath>
#include <tuple>
#include <queue>
#include <bitset>
#include <set>
#include <map>
#include <list>

using namespace std;


void solve(long long N, std::string S){
  for (int i = 0; i < S.size(); i++) {
    int a = (S[i] - 'A' + N) % 26;
    S[i] = 'A' + a;
  }
  std::cout << S << std::endl;
}

int main(){
  long long N;
  scanf("%lld",&N);
  std::string S;
  std::cin >> S;
  solve(N, S);
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define rrep(i,n) for(int i=1;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int inf = 1001001001;
const int mod = 1000000007;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n, k;
	cin >> n >> k;
	vector<int> d(k);
	vector<vector<int>> a(k);
	set<int> st;
	rep(i, k) {
		cin >> d[i];
		rep(j, d[i]) {
			int b;
			cin >> b;
			st.insert(b);
		}
	}
	int ans = n - st.size();
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3652
#include<bits/stdc++.h>
#define int long long
#define endl "\n"
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;


const int maxn = 16;
int a[maxn][maxn],dp[1LL<<maxn];
int n;
int32_t main()
{
	IOS
	memset(dp,0,sizeof(dp));
	cin>>n;
	for(int i=0;i<n;i++)
	for(int j=0;j<n;j++)
	cin>>a[i][j];
	
	
	for(int i=0;i<(1LL<<n);i++)
	{
		int msk = i;
		for(int j=0;j<n;j++)
		for(int k=j;k<n;k++)
		if( ((msk>>j)&1)   &&  ((msk>>k)&1) )
		{
			dp[msk]+=a[j][k];
		}
	}
	
	for(int i=0;i<(1LL<<n);i++)
	{
		
		for(int j=i;j;j=(j-1)&i)
		{
			int msk1 = j;
			int msk2 = i^j;
			
			dp[i]=max(dp[i],dp[msk1]+dp[msk2]);
		}
	}
	
	cout << dp[(1LL<<n)-1] << endl;
	
	
}


Measured memory_bytes: 768
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <iostream>
#include <set>
#include <map>
#include <time.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


vector<int> V[100001];

int main(){

	int N,M;
	scanf("%d %d",&N,&M);

	bool* check_GU = new bool[N+1];
	bool* check_KI = new bool[N+1];

	for(int i = 1; i <= N; i++){
		check_GU[i] = false;
		check_KI[i] = false;
	}

	int from,to;
	for(int loop = 0; loop < M; loop++){
		scanf("%d %d",&from,&to);
		V[from].push_back(to);
		V[to].push_back(from);
	}

	bool FLG,GU_FLG = true,KI_FLG = true;

	check_GU[1] = true;
	vector<int> new_GU,new_KI;
	int loop = 0;
	new_GU.push_back(1);

	int current,num_GU = 1,num_KI = 0;

	while(GU_FLG == true && KI_FLG == true){

		if(loop%2 == 0 && GU_FLG == true){
			new_KI.clear();

			FLG = false;

			for(int i = 0; i < new_GU.size(); i++){
				current = new_GU[i];
				for(int k = 0; k < V[current].size(); k++){
					if(check_KI[V[current][k]] == false){
						FLG = true;
						check_KI[V[current][k]] = true;
						new_KI.push_back(V[current][k]);
						num_KI++;
					}
				}
			}

			if(num_KI == N){
				printf("%d\n",loop+1);
				return 0;
			}
			if(!FLG){
				KI_FLG = false;
			}

		}else if(loop%2 == 1 && KI_FLG == true){
			new_GU.clear();

			FLG = false;

			for(int i = 0; i < new_KI.size(); i++){
				current = new_KI[i];
				for(int k = 0; k < V[current].size(); k++){
					if(check_GU[V[current][k]] == false){
						FLG = true;
						check_GU[V[current][k]] = true;
						new_GU.push_back(V[current][k]);
						num_GU++;
					}
				}
			}

			if(num_GU == N){
				printf("%d\n",loop+1);
				return 0;
			}
			if(!FLG){
				GU_FLG = false;
			}
		}
		loop++;
	}

	printf("-1\n");

	return 0;
}

Measured memory_bytes: 9652
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int gcd(int a, int b) { return b?gcd(b,a%b):a;}

int main(){
  int n;
  cin >> n;
  ll ans=0;
  for(int i=1; i<=n; ++i){
    for(int j=1; j<=n; ++j){
      for(int k=1; k<=n; ++k){
        int x = gcd(i,gcd(j,k));
        ans += x;
      }
    }
  }
  cout << ans << endl;
}

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

class Main
{
    public static void main(String[] args) throws IOException{
        PrintWriter out = new PrintWriter(System.out);

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        // StringTokenizer st = new StringTokenizer(br.readLine());

        String S = br.readLine();
        int ans = 0;
        if (S.equals("RRS") || S.equals("SRR")) {
            ans = 2;
        }
        else if(S.equals("RRR"))
            ans = 3;
        else if(S.contains("R"))
            ans = 1;

        out.println(ans);
        

        
        out.close();
    }

    

}


Measured memory_bytes: 32700
import os
import sys

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18


# MOD = 10 ** 9 + 7


# MOD = 998244353


def get_factorials(max, mod=None):
    """
    階乗 0!, 1!, 2!, ..., max!
    :param int max:
    :param int mod:
    :return:
    """
    ret = [1]
    n = 1
    if mod:
        for i in range(1, max + 1):
            n *= i
            n %= mod
            ret.append(n)
    else:
        for i in range(1, max + 1):
            n *= i
            ret.append(n)
    return ret


def mod_invs(max, mod):
    """
    逆元のリスト 0 から max まで
    :param int max:
    :param int mod:
    """
    invs = [1] * (max + 1)
    for x in range(2, max + 1):
        invs[x] = (-(mod // x) * invs[mod % x]) % mod
    return invs


def factorial_invs(max, mod):
    """
    階乗 0!, 1!, 2!, ..., max! の逆元
    :param int max:
    :param int mod:
    """
    ret = []
    r = 1
    for inv in mod_invs(max, mod):
        r = r * inv % mod
        ret.append(r)
    return ret


class Combination:
    def __init__(self, max, mod):
        """
        :param int max:
        :param int mod: 3 以上の素数であること
        """
        self._factorials = get_factorials(max, mod)
        self._finvs = factorial_invs(max, mod)
        self._mod = mod

    def ncr(self, n, r):
        """
        :param int n:
        :param int r:
        :rtype: int
        """
        if n < r:
            return 0
        return (
                self._factorials[n]
                * self._finvs[r]
                % self._mod
                * self._finvs[n - r]
                % self._mod
        )


P = int(sys.stdin.readline())
A = list(map(int, sys.stdin.readline().split()))


# A = np.array(A, dtype=int)
# vpow = np.vectorize(lambda a, b: pow(a, b, P))
# mat = []
# for i in range(P):
#     mat.append(vpow(i, np.arange(P)))
# print(np.array(mat).sum(axis=1) % P)
# print(np.array(mat).sum(axis=0) % P)
# mat = np.hstack((mat, [[a] for a in A]))
#
# print(mat)
#


def power_table():
    ret = np.ones((P, P), dtype=int)
    row = -np.arange(P, dtype=int)
    for i in range(1, P):
        ret[i] = ret[i - 1] * row % P
    return ret


# 解説AC
# f(x) = 1−(x - j)^(P - 1) は、x == j のとき1、それ以外のとき0
# A[j] == 1 である j について上記の式を足し合わせる
comb = Combination(max=P - 1, mod=P)
ncr = np.array([comb.ncr(P - 1, i) for i in range(P)])
# power[i][j]: (-j)^i
power = power_table()

B = np.zeros(P, dtype=int)
for j, a in enumerate(A):
    if a == 0:
        continue
    B -= power[:, j] * ncr % P
    B[-1] += 1
    B %= P
print(*B[::-1])


Measured memory_bytes: 83384
from fractions import gcd
def lcm(arr, n):
    ans = arr[0]
    for i in range(1, n):
        ans = ((arr[i] * ans) // gcd(arr[i], ans))
    return ans

n, m = [int(x) for x in raw_input().split()]
arr = [int(x) for x in raw_input().split()]
v = []
for x in arr:
    y = x
    cnt = 0
    while y % 2 == 0:
        y = y // 2
        cnt += 1
    v.append(cnt)
mx = max(v)
mn = min(v)
if mx != mn:
    print 0
else:
    strt = lcm(arr, n) // 2
    if strt > m:
        print 0
    else:
        print 1 + (m - strt) // (2 * strt)


Measured memory_bytes: 45720
#include <cstdio>

int main(){
    int n,m,f,r;
    while(1){
    scanf("%d %d %d",&m,&f,&r);
    if(m == -1 && f == -1){break;}
    for(n = 1;;n++){
    if(m + f >= 80){printf("A\n");break;}
    else if(m == -1){printf("F\n");break;}
    else if(f == -1){printf("F\n");break;}
    else if(m + f >= 65 && m + f < 80){printf("B\n");break;}
    else if(m + f >= 50 && m + f < 65){printf("C\n");break;}
    else if(m + f < 30){printf("F\n");break;}
    else if(m + f >= 30 && m + f < 50){
        if(r < 50){printf("D\n");break;}
        else if(r >= 50){printf("C\n");break;}
    }
    }
    }
    return 0;
}


Measured memory_bytes: 2596
N=int(input())
if N==1:
    print(1)
    exit()
def divisor(n):
    m=N//n
    return n*m*(m+1)//2
M=N//2
ans=0
for i in range(2,M+1):
    ans+=divisor(i)
ans+=N*(N+1)-M*(M+1)//2
print(ans)







    









        

    









    

        




    















    



    





    






        






    
















        


























            
    


    


    
    














    


    














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

using namespace std;
typedef long long ll;

#define MOD (long long)(1e9+7)
#define REP(i,n) for(ll i = 0; i < n; i++)
#define REP1(i,n) for(ll i = 1; i <= n; i++)

ll gcd(ll a, ll b)
{
  if(b == 0) return a;
  return gcd(b, a % b);
}

void solve()
{
  ll d,n, k; cin >> n >> k;
  // ll x, y, z; cin >> x >> y >> z;
  // string s; cin >> s;
  vector<ll> a(n); REP(i, n) cin >> a[i];
  ll ans = -1;

  sort(a.begin(), a.end());

  REP(i, n - k + 1) {
    d = a[i + k - 1] - a[i];
    if(ans < 0 || ans > d) ans = d;
  }
  
  cout << ans << endl;
  
}


int main(void)
{
  // ll t; cin >> t; REP(i, t)
  solve();
}


Measured memory_bytes: 1024
n=int(input())
p=list(map(int,input().split()))
cnt=0
temp=0
for i,pi in enumerate(p,1):
    #print(i,pi)
    if i==pi:
        if temp==1:
            temp=0
        else:
            cnt+=1
            temp=1
        continue
    temp=0

print(cnt)


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


int main(){
    ll x;
    cin >> x;
    ll n = 1;
    while(n*(n+1) < 2*x){
        n++;
    }
    cout << n << endl;
    
    return 0;    
}

Measured memory_bytes: 256
import sys
import math
from collections import Counter
import itertools
#from functools import reduce

# 入力を整数に変換して受け取る
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def MI1(): return map(int1, sys.stdin.readline().split())
# 入力全てを整数に変換したものの配列を受け取る
def LI(): return list(map(int, sys.stdin.readline().split()))
# 入力全てを整数に変換して1引いたものの配列を受け取る
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SR(): return sys.stdin.readline().rstrip()

ascii_lowercase = 'abcdefghijklmnopqrstuvwxyz'
ascii_uppercase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
ascii_uppercase2 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ'

# リストを改行区切りで出力する
p2D = lambda x: print(*x, sep="\n")
p2E = lambda x: print(''.join(x))
p2S = lambda x: print(*x, sep=" ")

# ###########################################

N=II()
V=LI()
C=LI()

ans=0
for i in range(N):
    if V[i] - C[i] >0:
        ans+=V[i] - C[i]
print(ans)

Measured memory_bytes: 3316
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <vector>
#include <map>
#include <list>
#include <stack>
#define REP(i, n) for(i=0; i<n; i++)
#define REPR(i, n) for(i=n; i>=0; i--)
#define FOR(i, m, n) for(i=m; i<n; i++)
using namespace std;
typedef long long ll;
typedef pair<ll, ll> p;

ll rec(ll n);

int main(void) {
    ll n, a, b;
    cin >> n >> a >> b;
    if(abs(a-b)%2==1) {
        cout << "Borys" << endl;
        return 0;
    }else
        cout << "Alice" << endl;
    
    
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.UncheckedIOException;
import java.util.StringTokenizer;

public class Main {
	public static void main(String[] args) {
		SC sc = new SC(System.in);
		int H=sc.nextInt();
		int W=sc.nextInt();
		int N=sc.nextInt();
		int[][] GRID=new int[H][W];
		int[] layer=new int[N];
		for(int i=0; i<N; i++) {
			layer[i]=sc.nextInt();
		}
		int jyouge=1;
		int x=0;
		int color=0;
		while(true) {
			if(color==N) {
				break;
			}
			else {
				if(jyouge==1) {
					for(int i=0; i<H; i++) {
						if(layer[color]>0) {
							//pl(i+" "+x+" "+(color+1));
							GRID[i][x]=color+1;
							layer[color]--;
						}
						if(color<N && layer[color]==0) {
							color++;
						}
						if(i==H-1) {
							jyouge=-1;
							x++;
						}
					}
				}
				else {
					for(int i=H-1; i>=0; i--) {
						if(layer[color]>0) {
							//pl(i+" "+x+" "+(color+1));
							GRID[i][x]=color+1;
							layer[color]--;
						}
						if(color<N && layer[color]==0) {
							color++;
						}
						if(i==0) {
							jyouge=1;
							x++;
						}
					}
				}
			}
		}

		for(int i=0; i<H; i++) {
			for(int j=0; j<W; j++) {
				if(j==W-1) {
					p(GRID[i][j]);
					pl();
				}
				else {
					p(GRID[i][j]+" ");
				}
			}
		}
	}
	public static void pl(Object o) {
		System.out.println(o);
	}
	public static void pl() {
		System.out.println();
	}
	public static void p(Object o) {
		System.out.print(o);
	}
	static class SC {
		private BufferedReader reader = null;
		private StringTokenizer tokenizer = null;
		public SC(InputStream in) {
			reader = new BufferedReader(new InputStreamReader(in));
		}
		public String next() {
			if (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new UncheckedIOException(e);
				}
			}
			return tokenizer.nextToken();
		}
		public int nextInt() {
			return Integer.parseInt(next());
		}
		public long nextLong() {
			return Long.parseLong(next());
		}
		public double nextDouble() {
			return Double.parseDouble(next());
		}
		public String nextLine() {
			try {
				return reader.readLine();
			} catch (IOException e) {
				throw new UncheckedIOException(e);
			}
		}
	}
	static void quick_sort(long[][] d, int left, int right) {
		if (left>=right) {
			return;
		}
		long p = d[(left+right)/2][0];
		int l = left, r = right;
		long tmp,tmp1,tmp2;
		while(l<=r) {
			while(d[l][0] < p) { l++; }
			while(d[r][0] > p) { r--; }
			if (l<=r) {
				tmp = d[l][0]; d[l][0] = d[r][0]; d[r][0] = tmp;
				tmp1=d[l][1]; tmp2=d[r][1]; d[l][1]=tmp2; d[r][1]=tmp1;
				l++; r--;
			}
		}
		quick_sort(d, left, r);
		quick_sort(d, l, right);
	}
}

Measured memory_bytes: 24596
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvi vector<vector<int> >
#define vvl vector<vector<ll> >
#define vl vector<ll>
typedef long long int ll;
typedef long double ld;
using namespace std;

int main(int argc, char const *argv[]) {
  string S;
  ll K, c = 0;
  std::cin >> S;
  string T = S[S.size()-1] + S;
  std::cin >> K;
  for(int i=1;i<S.size()-1;i++){
    if(S[i]==S[i+1]&&S[i]==S[i-1]) {
      c++;
      S[i] = 'A';
    }
  }
  for(int i=0;i<S.size()-1;i++){
    if(S[i]==S[i+1]) {
      c++;
      (i==S.size()-2?S[i+1]:S[i]) = 'A';
    }
  }
  ll dpA = c;
  ll dpq = 0;
  c = 0;
  for(int i=1;i<T.size()-1;i++){
    if(T[i]==T[i+1]&&T[i]==T[i-1]) {
      c++;
      T[i] = 'A';
    }
  }
  for(int i=0;i<T.size()-1;i++){
    if(T[i]==T[i+1]) {
      c++;
      (i==T.size()-2?T[i+1]:T[i]) = 'A';
    }
  }
  //std::cout << dpA << " " << dpq << '\n';
  dpq = c;
  ll pat;
  if(S[S.size()-1]=='A'||S[S.size()-1]!=S[0]){
    std::cout << dpA * K << '\n';
    pat = 1;
  }else{
    if(T[T.size()-1]==S[0]&&T[T.size()-1]!='A'){
      std::cout << dpA + dpq*(K-1) << '\n';
    }else if(K%2==0){
      std::cout << (dpq+dpA)*K/2 << '\n';
      pat = 2;
    }else{
      std::cout << dpA*((K+1)/2) + dpq*(K/2) << '\n';
      pat = 3;
    }
  }
  //std::cout << S << '\n';
  //std::cout << T << '\n';
  return 0;
}


Measured memory_bytes: 888
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<functional>
#include<cmath>
#include<iomanip>
#include<bits/stdc++.h>
using namespace std;
int main (){
    cout << fixed << setprecision(12);
    while(1){
    int n;
    double s[1000],sum = 0,S = 0;
        cin >> n;
        if(n == 0)break; 
        for(int i = 0;i < n;i++){
            cin >> s[i];
        }
        for(int i = 0;i < n;i++){
            sum += s[i];
        }
    double ave = sum/n;
    for(int i = 0;i < n;i++){
        S += pow(s[i] - ave,2);
    }
    double x = S/n;
    cout << sqrt(x) << endl;
    }
}


Measured memory_bytes: 3280
a = int(input())+1
b = int(input())+1
c = int(input())+1
x = int(input())
ans = 0
for l in range(a):
    for m in range(b):
        for n in range(c):
            total = 500*l + 100*m + 50*n
            if total ==x:
                ans+=1

print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define FOR(x,n) for(int x=0; x<n; x++)
#define FOR1e(x,n) for(int x=1; x<=n; x++)
#define pb push_back
#define all(x) x.begin(), x.end()
typedef pair<int,int> ii;
typedef long long ll;

ll ways2[3009][3009], ways[3009];
ll fat[3009], invfat[3009], p2[3009*3009];

ll fexp(ll a, ll b, ll mod) {
	ll ans = 1;
	while (b > 0) {
		if (b&1) { ans = (a*ans)%mod; }
		a = (a*a)%mod;
		b >>= 1;
	}
	return ans;
}

ll C(int n, int a, int mod) {
	return ((fat[n] * invfat[a]) % mod) * invfat[n-a] % mod;
}

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

	fat[0] = 1; invfat[0] = 1;
	FOR1e(i, N) { fat[i] = fat[i-1]*i % M; invfat[i] = fexp(fat[i], M-2, M); }

	for (int i = 0; i <= N; i++) {
		ways2[i][0] = 1;
	}
	for (int i = 1; i <= N; i++) {
		for (int j = 1; j <= N; j++) {
			ways2[i][j] = (ways2[i-1][j-1] + ways2[i-1][j] + 1LL*j*ways2[i-1][j]) % M;
		}
	}
	p2[0] = 1;
	for (int i = 1; i <= N*N; i++) p2[i] = 2*p2[i-1] % M;

	for (int i = 0; i <= N; i++) {
		ways[i] = 0;
		for (int j = 0; j <= N; j++) {
			// Remaining N-i form 2^(N-i) sets. Each of them is either present or not
			ways[i] = (ways[i] + ways2[i][j]*p2[(N-i)*j]) % M;
		}
		ways[i] = (ways[i] * fexp(2, fexp(2, N-i, M-1), M)) % M;
	}

	ll ans = 0;
	for (int i = 0; i <= N; i++) {
		if (i&1) {
			ans = (ans - C(N, i, M)*ways[i]) % M;
			ans = (ans + M) % M;
		} else {
			ans = (ans + C(N, i, M)*ways[i]) % M;
		}
	}

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

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

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

    int A, B;
    cin >> A >> B;
 
    int res = 0;
    for (int i = 0; i < 2; ++i) {
       res += max(A, B);
       if (A >= B) --A;
       else --B;
    }
 
    cout << res << "\n";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(int i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(int i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(int i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define uniq(x) (x).erase(unique((x).begin(), (x).end()), (x).end())

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    string r = "AKIHABARA";
    int pos = 0;
    rep(i, r.length()) {
        if (s[i] == r[i]) continue;
        if (r[i] == 'A') {
            if (i >= s.length()) {
                s += 'A';
            }
            else {
                s = s.substr(0, i) + 'A' + s.substr(i);
            }
        }
    }
    cout << ((s == r) ? "YES" : "NO") << endl;
    return 0;
}

Measured memory_bytes: 256
def get_i() #空白区切の入力を数値(整数)の配列で返す
  return gets.chomp.split(" ").map(&:to_i)
end
def get_f() #空白区切の入力を数値(実数)の配列で返す
  return gets.chomp.split(" ").map(&:to_f)
end
def get() #空白区切の入力を文字列の配列で返す
  return gets.chomp.split(" ")
end
def get_nsp() #入力されたものを一文字ずつに区切った文字列の配列で返す
  return gets.chomp.split("")
end
def yn_judge(bool,y="Yes",n="No") #boolに真偽を投げることで、trueならy、falseならnの値を出力する
  return bool ? y : n 
end
def array(size,n=1,init=nil) #nに配列の次元数、sizeに配列の大きさ、initに初期値を投げることでその配列を返す
  if n==1
    return Array.new(size){init}
  else
    return Array.new(n).map{Array.new(size){init}}
  end
end

def cal(val,x,min)
  temp=0
  x.each do|num|
    temp+=(num-val)**2
  end 
  return temp
end
n=gets.to_i
x=get_i
p_=(x.inject(:+).to_f/n.to_f).round
ans=0
x.each do|num|
  ans+=(p_-num)**2
end
puts ans

Measured memory_bytes: 1788
#include<iostream>
using namespace std;
const int N = 1e5 + 5;
int cnt[N],a[N]; 
int main(){
    int n ;
    cin >> n;
    long long ans = 0;
    for(int i=1;i<=n;i++){
        cin >> a[i];
        cnt[a[i]]++;
        ans+=a[i];
    }

    int q;
    cin>>q;

    for(int i=1 , B , C ; i<=q; i++){
        cin >> B >> C ;
        ans = ans - ( (long long)cnt[B] * B );
        ans = ans + ( (long long)cnt[B] * C );
        cnt[C]+=cnt[B];
        cnt[B]=0;
        cout<<ans<<"\n";
    }
}

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

using namespace std;

#define LL long long
#define N 300000

LL n,a[N],b[N],c[N],ans,sum;

int main(){
	scanf("%lld",&n);
	for (LL i=1;i<=n;++i) scanf("%lld",a+i);
	sort(a+1,a+n+1);
	if (n&1){
		for (int i=1;i<=n/2;++i) sum-=(b[i]=a[i])*2;
		for (int i=n/2+1;i<=n;++i) sum+=(c[i-n/2]=a[i])*2;
		sum-=c[1]+c[2];
		ans=sum;
		sum=0;
		for (int i=1;i<=n/2+1;++i) sum-=(b[i]=a[i])*2;
		for (int i=n/2+2;i<=n;++i) sum+=(c[i-n/2-1]=a[i])*2;
		sum+=b[n/2+1]+b[n/2];
		ans=max(ans,sum);
	}
	else{
		for (int i=1;i<=n/2;++i) ans-=(b[i]=a[i])*2;
		for (int i=n/2+1;i<=n;++i) ans+=(c[i-n/2]=a[i])*2;
		ans+=b[n/2]-c[1];
	}
	printf("%lld\n",ans);
	
	return 0;
}
			

Measured memory_bytes: 4736
#include<bits/stdc++.h>
using namespace std;
#define INF 1000000000

bool comp(vector<int> &a, vector<int> &b){
    return a.back() > b.back();
}

int main(void){
    
    int n, d;
    while(1){
        cin >> n >> d;
        if(n == 0) break;
        vector<vector<int> > missiles(n);
        for(int i = 0; i < n; i++){
            int m; cin >> m;
            int sum = 0;
            for(int j = 0; j < m; j++){
                int input; cin >> input;
                sum += input;
                missiles[i].push_back(input);
            }
            missiles[i].push_back(sum);
        }
        
        bool flag;

        while(1){

            int aaa = 1;
            /*for(int i = 0; i < n; i++){
                for(int j = 0; j < missiles[i].size(); j++){
                    cout << missiles[i][j] << " ";
                }
                cout << endl;
            }
            cout << endl;
            */

            int sum = 0;
            for(int i = 0; i < n; i++){
                sum += missiles[i].size();
            }
            if(sum == 0){
                cout << "Yes" << endl;
                return 0;
            }
            
            flag = false;

            sort(missiles.begin(), missiles.end(), comp);

            /*for(int i = 0; i < n; i++){
                for(int j = 0; j < missiles[i].size(); j++){
                    cout << missiles[i][j] << " ";
                }
                cout << endl;
            }*/
            int first = missiles[0].back();
            for(int i = 0; i < n; i++){
                first = max(first, missiles[i].back());

                if(i == 0){
                    while(missiles[1].back() - ( missiles[0].back() - missiles[0][missiles[0].size() - 2]) <= d){
                        missiles[0].back() -= missiles[0][missiles[0].size() - 2];
                        missiles[0][missiles[0].size() - 2] = missiles[0].back();
                        missiles[0].pop_back();
                        flag = true;
                    }
                    first = missiles[0].back();
                }else{
                    while(first - ( missiles[i].back() - missiles[i][missiles[i].size() - 2]) <= d){
                        missiles[i].back() -= missiles[i][missiles[i].size() - 2];
                        missiles[i][missiles[i].size() - 2] = missiles[i].back();
                        missiles[i].pop_back();
                        flag = true;
                    }
                }

            }

            int r  = 1;

            for(int j = 0; j < n; j++){
                if(missiles[j].back() != 0) r = 0;
            }

            
            if(r == 1){
                cout << "Yes" << endl;
                aaa = 0;
            }


            if(flag == false){
                cout << "No" << endl;
                aaa = 0;
            }

            if(aaa == 0) break;

        }
        
    }

    return 0;
}

Measured memory_bytes: 3168
#include <stdio.h>

int main()
{
  int i,j,key,n,m;
  int l[100];

  scanf("%d",&n);/* ????´??????°???????´? */

  for(i=0;i<n;i++){
    scanf("%d",&l[i]);/* ?????????????´? */
  }
  for(i=0;i<n;i++){
    printf("%d",l[i]);/* ???????????????????????¨??? */
    if(i<n-1)printf(" ");/* ???????????¨??? */
  }
  printf("\n");/* ???????????¨??? */

  for(i=1;i<n;i++){
    key = l[i];/* ???????????????????????????????¶????????????\???????????° */
    j = i - 1;
    while(l[j]>key && j>=0){/* ???????????????????????¶ */
      l[j+1] = l[j];/* ??????????????? */
      j--;
    }
    l[j+1] = key;/* ??????????????? */
    for(m=0;m<n;m++){
      printf("%d",l[m]);/* ???????????????????????¨??? */
      if(m<n-1)printf(" ");/* ???????????¨??? */
    }
  printf("\n");/* ???????????¨??? */
  } 
   return 0;
}

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

using namespace std;

using i64 = int64_t;

const i64 MOD = 1e9+7;

const i64 INF = 1e18+7;


signed main(){
    string s;
    cin >> s;
    for(int i = 0; i < s.size(); i += 2)
        cout <<  s[i];
    cout << endl;
}


Measured memory_bytes: 512
#input
S = input()

#output
N = len(S)

if (S == S[::-1]) and (S[:(N-1)//2] == S[:(N-1)//2][::-1]) and (S[(N+3)//2-1:] == S[(N+3)//2-1:][::-1]):
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3060
// #pragma GCC optimize(2)
// #pragma G++ optimize(2)
// #pragma comment(linker,"/STACK:102400000,102400000")

#include <bits/stdc++.h>
using namespace std;

typedef long long LL;
typedef unsigned int ui;
typedef unsigned long long ull;
typedef float fl;
typedef long double ld;
typedef pair<int,int> pii;
#if (WIN32) || (WIN64) || (__WIN32) || (__WIN64) || (_WIN32) || (_WIN64) || (WINDOWS)
#define lld "%I64d"
#define llu "%I64u"
#else
#define lld "%lld"
#define llu "%llu"
#endif
#define ui(n) ((unsigned int)(n))
#define LL(n) ((long long)(n))
#define ull(n) ((unsigned long long)(n))
#define fl(n) ((float)(n))
#define ld(n) ((long double)(n))
#define char(n) ((char)(n))
#define Bool(n) ((bool)(n))
#define fixpoint(n) fixed<<setprecision(n)

const int INF=1061109567;
const int NINF=-1044266559;
const LL LINF=4557430888798830399;
const ld eps=1e-15;
#define MOD (1000000007)
#define PI (3.1415926535897932384626433832795028841971)

#define MP make_pair
#define MT make_tuple
#define All(a) (a).begin(),(a).end()
#define pall(a) (a).rbegin(),(a).rend()
#define Log(x,y) log(x)/log(y)
#define SZ(a) ((int)(a).size())
#define rep(i,n) for(int i=0;i<((int)(n));i++)
#define rep1(i,n) for(int i=1;i<=((int)(n));i++)
#define repd(i,n) for(int i=((int)(n))-1;i>=0;i--)
#define repd1(i,n) for(int i=((int)(n));i>=1;i--)
#define repv(itr,v) for(__typeof((v).begin()) itr=(v).begin();itr!=(v).end();itr++)
#define repV(i,v) for(auto i:v)
#define repE(i,v) for(auto &i:v)
#define MS(x,y) memset(x,y,sizeof(x))
#define MC(x) MS(x,0)
#define MINF(x) MS(x,63)
#define MCP(x,y) memcpy(x,y,sizeof(y))
#define UN(v) sort(All(v)),v.erase(unique(All(v)),v.end())
#define filein(x) freopen(x,"r",stdin)
#define fileout(x) freopen(x,"w",stdout)
#define fileio(x)\
	freopen(x".in","r",stdin);\
	freopen(x".out","w",stdout)
#define filein2(filename,name) ifstream name(filename,ios::in)
#define fileout2(filename,name) ofstream name(filename,ios::out)
#define fileio2(filename,name) fstream name(filename,ios::in|ios::out)
#define sqr(x) ((x)*(x))
#define Pause system("pause")
#define Cls system("cls")
#define fs first
#define sc second
#define SF scanf
#define PF printf

const int maxn=2000010;

int n,m;
string s;
LL fac[maxn],inv[maxn],ans;

inline LL powmod(LL a,LL b)
{
	LL res=1;a%=MOD;

	for(;b;b>>=1)
	{
		if(b&1) res=res*a%MOD;
		a=sqr(a)%MOD;
	}

	return res;
}

inline LL C(int a,int b)
{
	if(b>a) return 0ll; else return fac[a]*inv[b]%MOD*inv[a-b]%MOD;
}

int main()
{
	fac[0]=fac[1]=1;
	for(int i=2;i<=2000000;i++) fac[i]=fac[i-1]*i%MOD;

	inv[2000000]=powmod(fac[2000000],MOD-2);
	for(int i=2000000-1;i>=0;i--) inv[i]=inv[i+1]*(i+1)%MOD;

	cin>>n>>s;m=SZ(s);

	for(int i=m;i<=n+m;i++) ans=(ans+C(n+m,i)*powmod(25,n+m-i)%MOD)%MOD;
	
	cout<<ans;

	return 0;
}

Measured memory_bytes: 36552
/*********************
*@Author:   CKang *
*@Language: C++11    *
*********************/
#include<bits/stdc++.h>
#pragma comment(linker, "/STACK:102400000,102400000")
//#define DEBUG
#define RI register int
#define endl "\n"

using namespace std;

typedef long long ll;
//typedef __int128 lll;
//const int N=100000+10;
const int M=100000+10;
const int MOD=1e9+7;
const double PI = acos(-1.0);
const double EXP = 1E-9;
const int INF = 0x3fffffff;
const ll LINF = 0x3fffffffffffffff;

inline ll read(){
    long long x=0,f=1;
    char ch=getchar();
    while(ch<'0'||ch>'9'){
        if(ch=='-')
            f=-1;
        ch=getchar();
    }
    while(ch>='0'&&ch<='9'){
        x=(x<<1)+(x<<3)+(ch^48);
        ch=getchar();
    }
    return x*f;
}

int main()
{
#ifdef DEBUG
    freopen("input.in", "r", stdin);
    //freopen("output.out", "w", stdout)
#endif
    //cout.tie(0);
    //ll t = read() ;
    //while(t--){}
    ll n=read(),sum=0;
    for(ll i=1;i<=n;i++){
        if(i%3==0||i%5==0)continue;
        else sum+=i;
        //cout<<sum<<endl;
    }
    cout<<sum<<endl;
#ifdef DEBUG
    printf("Time cost : %lf s\n",(double)clock()/CLOCKS_PER_SEC);
#endif
    //cout << "Fuck You !" << endl;
    return 0;
}


Measured memory_bytes: 3640
import numpy as np
last=[0]*26
D=int(input())
c=list(map(int, (input().split(' '))))
s=[]
a=[0]*D

sat=0

for i in range(D):
    s.append(list(map(int, (input().split(' ')))))
for i in range(D):
    a[i]=int(input())
    last[a[i]-1] = i+1
    sat += s[i][a[i]-1] - np.dot(c, list(map(lambda x: i+1-x, last)))
    print(sat)

Measured memory_bytes: 27260
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author GYSHGX868
 */
public class Main {
  public static void main(String[] args) {
    InputStream inputStream = System.in;
    OutputStream outputStream = System.out;
    InputReader in = new InputReader(inputStream);
    OutputWriter out = new OutputWriter(outputStream);
    TaskA solver = new TaskA();
    solver.solve(1, in, out);
    out.close();
  }

  static class TaskA {
    public void solve(int testNumber, InputReader in, OutputWriter out) {
      int n = in.nextInt();
      int k = in.nextInt();
      int x = in.nextInt();
      int y = in.nextInt();
      out.printLine(x * Math.min(n, k) + y * Math.max(n - k, 0));
    }

  }

  static class InputReader {
    private InputStream stream;
    private byte[] buf = new byte[1024];
    private int curChar;
    private int numChars;
    private InputReader.SpaceCharFilter filter;

    public InputReader(InputStream stream) {
      this.stream = stream;
    }

    public int read() {
      if (numChars == -1) {
        throw new InputMismatchException();
      }
      if (curChar >= numChars) {
        curChar = 0;
        try {
          numChars = stream.read(buf);
        } catch (IOException e) {
          throw new InputMismatchException();
        }
        if (numChars <= 0) {
          return -1;
        }
      }
      return buf[curChar++];
    }

    public int nextInt() {
      int c = read();
      while (isSpaceChar(c)) {
        c = read();
      }
      int sgn = 1;
      if (c == '-') {
        sgn = -1;
        c = read();
      }
      int res = 0;
      do {
        if (c < '0' || c > '9') {
          throw new InputMismatchException();
        }
        res *= 10;
        res += c - '0';
        c = read();
      } while (!isSpaceChar(c));
      return res * sgn;
    }

    public boolean isSpaceChar(int c) {
      if (filter != null) {
        return filter.isSpaceChar(c);
      }
      return isWhitespace(c);
    }

    public static boolean isWhitespace(int c) {
      return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    }

    public interface SpaceCharFilter {
      boolean isSpaceChar(int ch);

    }

  }

  static class OutputWriter {
    private final PrintWriter writer;

    public OutputWriter(OutputStream outputStream) {
      writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
    }

    public OutputWriter(Writer writer) {
      this.writer = new PrintWriter(writer);
    }

    public void close() {
      writer.close();
    }

    public void printLine(int i) {
      writer.println(i);
    }

  }
}



Measured memory_bytes: 21460
def resolve():
	answer = 0
	N = int(input())
	if N==1:
		print(answer)
	else:
		# 素因数pを見つける。範囲は2から√Nまででよい。
		for p in range(2, int(N**0.5)+2):
			e = 0
			while (N % p == 0):
				N /= p
				e += 1
			# z=p**eが見つかった
			if e>0:
				# eを1, 2, 3, 4...に分けられる回数カウント
				for i in range(1, e+1):
					if e >= i:
						e -= i
						answer += 1
		# √Nまでで割り切れなかった場合、N自身が素数
		if N!=1:
			answer += 1
		print(answer)
        
resolve()

Measured memory_bytes: 9388
/*
    Mbak Sana Dong
    Mbak Chaeyoung Dong
*/
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
    int n,i,j,k,x,y,ans,curr,m;
    int tc;
    string s;
    cin >> s;
    string a  ="";
    for(i=0;i<3;i++) a += s[i];
    cout << a << endl;
    return 0;
}


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

//1点更新,区間最大
class SegmentTree {
public:
    SegmentTree(int64_t n, int64_t value) {
        n_ = (int64_t)pow(2, ceil(log2(n)));
        nodes_.resize(2 * n_ - 1, value);
    }
    void update(int64_t x, int64_t v) {
        nodes_[x + n_ - 1] = v;
        for (int64_t i = (x + n_ - 2) / 2; ; i = (i - 1) / 2) {
            nodes_[i] = max(nodes_[2 * i + 1], nodes_[2 * i + 2]);
            if (i == 0) {
                break;
            }
        }
    }

    int64_t getMax(int64_t a, int64_t b, int64_t k = 0, int64_t l = 0, int64_t r = -1) {
        if (r < 0) {
            r = n_;
        }
        if (r <= a || b <= l) {
            return INT_MIN;
        }
        if (a <= l && r <= b) {
            return nodes_[k];
        }
        int64_t lv = getMax(a, b, 2 * k + 1, l, (l + r) / 2);
        int64_t rv = getMax(a, b, 2 * k + 2, (l + r) / 2, r);
        return max(lv, rv);
    }

private:
    //2のべき乗
    int64_t n_;
    vector<int64_t> nodes_;
};

struct Robot {
    int64_t X, D;
};

int main() {
    int64_t N;
    cin >> N;
    vector<Robot> robots(N);
    for (Robot& r : robots) {
        cin >> r.X >> r.D;
    }

    sort(robots.begin(), robots.end(), [&](Robot& lhs, Robot& rhs){
        return (lhs.X == rhs.X ? lhs.D < rhs.D : lhs.X < rhs.X);
    });

    //remove_index[i] := iを起動した場合にどこまで消えるか
    vector<int64_t> remove_index(N);
    SegmentTree st(N, 0);
    iota(remove_index.begin(), remove_index.end(), 0);
    for (int64_t i = 0; i < N; i++) {
        st.update(i, i);
    }
    for (int64_t i = N - 2; i >= 0; i--) {
        auto itr = lower_bound(robots.begin(), robots.end(), robots[i].X + robots[i].D, [&](Robot& lhs, int64_t x){
            return lhs.X < x;
        });
        int64_t index = itr - robots.begin();
        remove_index[i] = remove_index[st.getMax(0, index)];
        st.update(i, remove_index[i]);
    }

    constexpr int64_t MOD = 998244353;
    vector<int64_t> dp(N + 1, 0);
    dp[0] = 1;
    for (int64_t i = 0; i < N; i++) {
        (dp[i + 1] += dp[i]) %= MOD;
        (dp[remove_index[i] + 1] += dp[i]) %= MOD;
    }

    cout << dp[N] << endl;
}

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

using namespace std;

typedef pair<int, int> P_ii;
typedef pair<string, int> P_si;
typedef long long int ll;

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

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

const int MOD = 1000000007;
const ll MAX = 100010;

struct Edge {
    /* Parameters     *
     * (int) to : 辺の行き先
     * (int) weight : 辺の重み
    */

    int to;
    int weight;
    Edge(int t, int w) : to(t), weight(w) {}
};

int main() {
    int A, B, C, D;
    cin >> A >> B >> C >> D;

    int ans = 0;
    int begin = max(A, C);
    int end = min(B, D);
    chmax(ans, end - begin);
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 256
N = int(input())
A = input().split()
B = input().split()
C = input().split()
sat = 0
for i in range(N):
    A[i] = int(A[i])
    B[i] = int(B[i])
    if i != N - 1:
        C[i] = int(C[i])

for i in range(N):
    sat += B[i]
    if i != N - 1:
        if A[i+1] == A[i] + 1:
            sat += C[A[i]-1]
    
print(sat)

Measured memory_bytes: 3064
N = int(input())
A = list(map(int, input().split()))

A.append(0)
ans = 0
tmp = 1
tmp2 = 0
bef = A[0]
che = A[0]
for i in range(1,N):
    if A[i] == bef:
        tmp += 1
    else:
        bef = A[i]
        ans += tmp//2
        tmp = 1
ans += tmp//2
print(ans)


Measured memory_bytes: 3060
#include "bits/stdc++.h"
using namespace std;

int main() {
    double L;
    cin >> L;
    cout << fixed << setprecision(12) << (L / 3) * (L / 3) * (L / 3) << endl;

    //cout << (L/3)* (L / 3)* (L / 3) << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int k = sc.nextInt();
		int count = 0;
		for (int i = 1; i <= k; i+=2) {
			for(int j = 2; j <= k; j +=2) {
				count++;
			}
		}
		System.out.println(count);
	}

}


Measured memory_bytes: 35628
#include<iostream>
const double eps = 1e-11;
using namespace std;

int main() {
	double x[8], y[8], z;
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		for (int k = 0; k < 4; k++) {
			cin >> x[k] >> y[k];
		}
		x[0] -= x[1];
		y[0] -= y[1];
		x[2] -= x[3];
		y[2] -= y[3];
		z = x[0] * y[2] - x[2] * y[0];
		if (-eps < z &&z < eps) cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	return 0;
}

Measured memory_bytes: 1224
#include <iostream>
#include <cstring>
using namespace std;
int main()
{
	string s;
	cin>>s;
	int n = s.size();
	if(s[0] != 'A')
	{
		printf("WA\n");
		return 0;
	}
	if(s[0] == 'C' || s[1] == 'C' || s.back() == 'C')
	{
		printf("WA\n");
		return 0;
	}
	int cnt = 0;
	for(int i = 2;i < n - 1; ++i)
	{
		if(s[i] == 'C')
		{
			cnt++;
		}
	}
	if(cnt != 1)
	{
		printf("WA\n");
		return 0;
	}
	for(int i = 0;i < n; ++i)
	{
		if(s[i] != 'A' && s[i] != 'C')
		{
			if(isupper(s[i]))
			{
				printf("WA\n");
				return 0;
			}
		}
	}
	printf("AC\n");
	return 0;
}

Measured memory_bytes: 256