akhauriyash/Code-Regression huggingface dataset:
import java.io.*;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		int apple = 0;
		int piece_apple = 0;
		
		InputStreamReader isr = new InputStreamReader(System.in);
		BufferedReader br = new BufferedReader(isr);
		
		try {
			String str = "";
			str = br.readLine();
			br.close();
			String strs[] = str.split(" ", 2);
			apple = Integer.parseInt(strs[0]);
			piece_apple = Integer.parseInt(strs[1]);
		} catch(IOException e) {
			e.printStackTrace();
		}
		
		System.out.println((3 * apple + piece_apple) / 2);
	}
}

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

#define ll long long

int main(){
  int N,M;
  cin >> N >> M;
  vector<ll> a(N);
  vector<ll> b(M);
  for(int i=0;i<N;i++){cin >> a[i];}
  for(int i=0;i<M;i++){cin >> b[i];}
  vector<ll> ans = convolution(a,b);
  for(int i=0;i<ans.size();i++){
    cout << ans[i];
    if(i==ans.size()-1){cout<<endl;}else{cout<<" ";}
  }
  return 0;
}

Measured memory_bytes: 27208
//templates
#include <iostream>
#include <algorithm>
#include <string>
#include <numeric>
#include <vector>
#include <unordered_map>
#include <map>
#include <cmath>
#include <iomanip>
#include <bitset>
#include <sstream>
#include <queue>
#define rep(i,n) for(int i = 0; i < (n); i++)
#define ALL(x) (x).begin(), (x).end()
#define sort_key(struct_name,key_name) [](const struct_name &x, const struct_name &y){return x.key_name < y.key_name;}
#define pb(x) push_back(x)
typedef long long ll;
const long long MOD = 1e9 + 7;
using namespace std;

//main
int main(){
  int N; cin >> N;
  vector<double> X(N), Y(N);
  rep(i,N) cin >> X[i] >> Y[i];
  double S = 0;
  double ans;
  rep(i,N-1){
    for (int j=i+1; j<N; j++) S += sqrt(pow(X[i]-X[j],2)+pow(Y[i]-Y[j],2));
  }
  ans = 2*S/N;
  cout << std::fixed << std::setprecision(15) << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <queue>
#include <cstring>
#include <vector>
#include <map>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <bitset>
#include <set>

using namespace std;

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define all(i,n) (i),(i+n)

int dx4[4]={1,0,-1,0};
int dy4[4]={0,-1,0,1};
int dx8[8]={1,0,-1,1,-1,1,0,-1};
int dy8[8]={1,1,1,0,0,-1,-1,-1};

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

const int INF = 1e9;
const ll LLINF = 1e18;
const int MAX_V = 1e6+1;
const ll mod = 1000000007;

// --------------------------------------
int a, b, c;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  cin >> a >> b >> c;

  int ma = max({a, b, c});
  int d = (ma - a) + (ma - b) + (ma - c);

  if(d % 2 == 0) cout << d / 2 << endl;
  else cout << d / 2 + 2 << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>

#define min(a, b) ((a) > (b) ? (b) : (a))
#define BUF_SIZE 50
int main(void) {
  char line[BUF_SIZE];
  FILE *fp = stdin;
  if(!fgets(line, BUF_SIZE, fp)) return 0;
  int a, b, ab;
  int x, y;
  sscanf(line, "%d %d %d %d %d", &a, &b, &ab, &x, &y);
  int cost;
  if(ab*2 >= a + b) {
    cost = a*x + b*y;
  } else {
    int ma = min(ab*2, a);
    int mb = min(ab*2, b);
    if(x > y) {
      cost = y*ab*2 + (x-y)*ma;
    } else {
      cost = x*ab*2 + (y - x)*mb;
    }
  }
  printf("%d\n", cost);

  return 0;
}

Measured memory_bytes: 128
n = int(input())
*A, = map(int, input().split())
for i in range(n):
    v = A[i]
    j = i - 1
    while j >= 0 and A[j] > v:
        A[j+1] = A[j]
        j -= 1
    A[j+1] = v
    print(*A)


Measured memory_bytes: 5976
#pragma GCC optimize("Ofast,inline,unroll-loops,fast-math")
#include <cstdio>
#include <cmath>
#include <cstring>
#include <iostream>
#include <sstream>
#include <bitset>
#include <memory>
#include <string>
#include <vector>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <deque>
#include <algorithm>
#include <random>
#include <iomanip>
using namespace std;


int main(int argc, char *argv[]) {
	unordered_map<string, int> um;
	vector<string> res;
	int m = 0;
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		string s;
		cin >> s;
		um[s]++;
		if (um[s] > m) {
			m = um[s];
			res.clear();
			res.push_back(s);
		}
		else if (um[s] == m) {
			res.push_back(s);
		}
	}
	sort(res.begin(), res.end());
	for (auto s : res) {
		cout << s << endl;
	}
}









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

public class MainClarss
{
	public const long Giri = 1000000007;
	
	class Term
	{
		public int Start{get;set;}
		public int End{get;set;}
		public bool Right{get;set;}
	}
	
	public static void Main(string[] args)
	{
		string input = Console.ReadLine();
		long[] dp = new long[input.Length];
		//int[][] dp2 = new int[input.Length][2];
		bool[] masu = new bool[input.Length];
		
		long kazu = 1000000000000000000;
		List<Term> terms = new List<Term>(input.Length);
		bool old = true;
		int startIndex = 0;
		for(int i = 0; i < input.Length; i++)
		{
			masu[i]=input[i]=='R';
			if(old!=masu[i])
			{
				terms.Add(new Term(){Start=startIndex,End=i-1,Right=old});
				//Console.WriteLine("Split:{0},{1}", startIndex, i-1);
				old=masu[i];
				startIndex=i;
			}
		}
		terms.Add(new Term(){Start=startIndex,End=input.Length-1,Right=old});
		//Console.WriteLine("Split:{0},{1}", startIndex, input.Length-1);
		
		
		int currentTerm = 0;
		for(int i = 0; i < input.Length; i++)
		{
			long cost = 0;
			int j = i;
			Term term = terms[currentTerm];
			if(!(term.Start<=i && term.End>=i))
			{
				term = terms[++currentTerm];
			}
			
			
			if(masu[i])
			{
				j=terms[currentTerm+1].Start;
				cost+=terms[currentTerm+1].Start-i;
			}
			else
			{
				j=terms[currentTerm-1].End;
				cost+=i-terms[currentTerm-1].End;
			}
			//Console.WriteLine(i + "," + j + ","+cost+",");
			
			//j--;
			if(masu[i])	//right start
			{
				if((kazu-cost)%2==1)
				{
					dp[j-1]++;
				}
				else
				{
					dp[j]++;
				}
			}
			else
			{
				if((kazu-cost)%2==1)
				{
					dp[j+1]++;
					
				}
				else
				{
					dp[j]++;
				}
			}
			
		}
		
		for(int i = 0; i < input.Length; i++)
		{
			Console.Write(dp[i]);
			if(input.Length-1!=i)
				Console.Write(" ");
		}
	}

	
	
	public static long GCD(long a, long b)
	{
		if(b == 1)
			return a;
		long p = b / a;
		return GCD(a, b - a*p);
	}
	
	public static string[] Input()
	{
		return Console.ReadLine().Split(' ');
	}

	
	public static int Clamp(int val, int max, int min = 0)
	{
		return Math.Min(max, Math.Max(min, val));
	}

}



Measured memory_bytes: 22492
package main

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

var stdInScanner = bufio.NewScanner(os.Stdin)

func nextString() string {
	stdInScanner.Scan()
	return stdInScanner.Text()
}

func main() {
	stdInScanner.Split(bufio.ScanWords)

	S := nextString()

	fmt.Println(S[0:3])
}


Measured memory_bytes: 1760
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<numeric>
#include<utility>

using namespace std;

typedef long long int ll;
const int INF = 1<<30;
const long long LINF = 1LL<<60;

int main(){
    int h, w, n;
    cin >> h >> w >> n;
    int x = max(h, w);
    int ans = (n + x - 1) / x;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#pragma once
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <deque>
#include <numeric>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 10e8;
const int MAX_V = 201;
int a[4];
int c[10];
bool use[10];
int t[10][10];
void ShoppingStreet() {

	int n;
	cin >> n;
	int f[101][11];
	for (size_t i = 0; i < n; i++)
	{
		for (int j = 0; j < 10; j++) {
			cin >> f[i][j];
		}
	}
	int p[101][15];
	for (size_t i = 0; i < n; i++)
	{
		for (size_t j = 0; j < 11; j++)
		{
			cin >> p[i][j];
		}
	}

	int c[10];
	ll res = -1000000000000;
	for (int i = 1; i < (1 << 10); i++)
	{
		int count = 0;
		for (int j = 0; j < 10; j++)
		{
			c[j] = (i >> j) % 2;
			count += c[j];
		}

		ll sum = 0;
		for (size_t j = 0; j < n; j++)
		{
			int nc = 0;
			for (size_t k = 0; k < 10; k++)
			{
				if (c[k] == 1 && f[j][k] == 1) nc++;
			}
			sum += p[j][nc];
		}
		res = max(sum, res);
	}
	cout << res << endl;
}

int main() {
	ShoppingStreet();
	return 0;
}



Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		sc.close();

		// A, T, G, C
		long[][] dp = new long[n + 1][4];
		dp[1] = new long[]{1, 1, 1, 1};
		dp[2] = new long[]{4, 4, 4, 4};
		dp[3] = new long[]{16, 16, 15, 14};
		for (int i = 4; i <= n; i++) {
			// A, T
			long sum = 0;
			for (int j = 0; j < 4; j++) {
				sum += dp[i - 1][j];
			}
			sum = getMod(sum);
			dp[i][0] = sum;
			dp[i][1] = sum;

			// G
			dp[i][2] = getMod(sum - dp[i - 2][0] + dp[i - 3][2]);

			// C
			dp[i][3] = getMod(sum - dp[i - 2][0] - dp[i - 2][2] - dp[i - 3][0] * 3);
		}

		long sum = 0;
		for (int j = 0; j < 4; j++) {
			sum += dp[n][j];
		}
		sum = getMod(sum);
		System.out.println(sum);
	}

	static long getMod(long val) {
		int mod = 1000000007;
		while (val < 0) {
			val += mod;
		}
		return val % mod;
	}
}


Measured memory_bytes: 23764
#include <bits/stdc++.h>
using namespace std;
#define int               long long
#define pb                push_back
#define ppb               pop_back
#define pf                push_front
#define ppf               pop_front
#define all(x)            (x).begin(),(x).end()
#define uniq(v)           (v).erase(unique(all(v)),(v).end())
#define sz(x)             (int)((x).size())
#define fr                first
#define sc                second
#define pii               pair<int,int>
#define rep(i,a,b)        for(int i=a;i<b;i++)
#define mem1(a)           memset(a,-1,sizeof(a))
#define mem0(a)           memset(a,0,sizeof(a))
#define ppc               __builtin_popcount
#define ppcll             __builtin_popcountll

template<typename T1,typename T2>istream& operator>>(istream& in,pair<T1,T2> &a){in>>a.fr>>a.sc;return in;}
template<typename T1,typename T2>ostream& operator<<(ostream& out,pair<T1,T2> a){out<<a.fr<<" "<<a.sc;return out;}
template<typename T,typename T1>T amax(T &a,T1 b){if(b>a)a=b;return a;}
template<typename T,typename T1>T amin(T &a,T1 b){if(b<a)a=b;return a;}

const long long INF=1e18;
const int32_t M=1e9+7;
const int32_t MM=998244353;

const int N=1e5+5;

int mn[N],mx[N];
int a[N];
int l[N];

void solve(){
	int n;
	cin>>n;
	rep(i,0,n+1){
		cin>>a[i];
		if(i <= 50){
			l[i] = (1ll<<i);
		}
		else{
			l[i] = (1ll<<50);
		}
	}
	if(n == 0){
		if(a[0] == 1){
			cout<<1;
		}
		else{
			cout<<-1;
		}
		return;
	}
	mn[n]=mx[n]=a[n];
	
	for(int i=n-1;i>=0;i--){
		mx[i] = min(l[i],mx[i+1]+a[i]);
		mn[i] = a[i] + (mn[i+1]+1)/2;
		if(mn[i] > mx[i]){
			cout<<-1;
			return;
		}
	}
	rep(i,0,n){
		amin(mx[i+1],2*(mx[i]-a[i]));
	}
	int ans=0;
	rep(i,0,n+1){
		if(mx[i] < mn[i]){
			cout<<-1;
			return;
		}
		ans += mx[i];
	}
	cout<<ans;
}
signed main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	#ifdef SIEVE
		sieve();
	#endif
	#ifdef NCR
		init();
	#endif
	int t=1;
	//cin>>t;
	while(t--) solve();
	return 0;
}


Measured memory_bytes: 6708
#include <stdio.h>

main(){
  int n, i;
  double xa, ya, xb, yb, ra, rb, ab;

  scanf("%d", &n);
  for(i=0;i<n;i++){
    scanf("%lf %lf %lf %lf %lf %lf", &xa, &ya, &ra, &xb, &yb, &rb);
    ab=(xa-xb)*(xa-xb)+(ya-yb)*(ya-yb);
    if(ab>((ra+rb)*(ra+rb))) printf("0\n");
    else if(ab==((ra+rb)*(ra+rb))) printf("1\n");
    else{
      if(ab<((ra-rb)*(ra-rb)) && (ra>rb)){
	printf("2\n");
      }
      else if(ab<((rb-ra)*(rb-ra)) && (ra<rb)){
	printf("-2\n");
      }
      else printf("1\n");
    }
  }
  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int, int>;
const int INF = 1001001001;
const ll LINF = 1LL << 60;

template <typename T>
void print(const T &v)
{
    for (int i = 0; i < v.size(); i++)
    {
        if (i)
            cout << ' ';
        cout << v[i];
    }
    cout << endl;
}

const int MAX_N = 100100; // 要素数の最大

ll par[MAX_N]; // 親
ll siz[MAX_N]; // 木のサイズ

// n要素で初期化
void init(int n)
{
    for (int i = 0; i < n; ++i)
    {
        par[i] = i;
        siz[i] = 1;
    }
}

// 木の根を求める
int find(int x)
{
    while (par[x] != x)
        x = par[x] = par[par[x]];
    return x;
}

// xとyの属する集合を併合
bool unite(int x, int y)
{
    x = find(x);
    y = find(y);
    if (x == y)
        return false;

    if (siz[x] < siz[y])
        swap(x, y);
    siz[x] += siz[y];
    par[y] = x;
    return true;
}

// 連結判定
bool same(int x, int y)
{
    return find(x) == find(y);
}

ll size(int x)
{
    return siz[find(x)];
}

int main()
{
    ll n, m;
    cin >> n >> m;
    init(n);
    vector<P> bridge(m);
    for (int i = 0; i < m; i++)
    {
        cin >> bridge[i].first >> bridge[i].second;
        --bridge[i].first;
        --bridge[i].second;
    }
    reverse(bridge.begin(), bridge.end());
    stack<ll> ans; // 答えを格納する
    ll total = n * (n - 1) / 2;
    for (int i = 0; i < m; i++)
    {
        ans.push(total);

        int a = bridge[i].first;
        int b = bridge[i].second;
        if (!same(a, b))
        {
            total -= size(a) * size(b);
            unite(a, b);
        }
    }
    while (!ans.empty())
    {
        cout << ans.top() << endl;
        ans.pop();
    }
    return 0;
}


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

int main() {
  string s;
  cin >> s;
  int n = s.size();
  int cnt = 0, maxl = 0;
  for (int i = 0; i < n; i++) {
    if (s.at(i) == 'A' || s.at(i) == 'C' || s.at(i) == 'G' || s.at(i) == 'T') {
      cnt++;
    }
    else {
      maxl = max(maxl, cnt);
      cnt = 0;
    }
    if (i == n - 1) maxl = max(maxl, cnt);
  }
  cout << maxl << endl;
}

Measured memory_bytes: 256
#include"bits/stdc++.h"
#define int long long
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(a);i<(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define itr(i,x) for(auto i=(x).begin();i!=(x).end();++i)
#define All(x) (x).begin(),(x).end()
#define gridif(a,x,b) if((a)<=(x)&&(x)<(b))
using namespace std;
typedef pair<int,int> P;
const int mod=1000000007;

int digitsum(int n,int b){
	if(b<2) return -1;
	if(n<b) return n;
	return digitsum(n/b,b)+n%b;
}
int mpow(int a,int x);
int m_inv(int n){return mpow(n,mod-2);}

int gcd(int x,int y){return y?gcd(y,x%y):x;}
int lcm(int x,int y){return x*y/gcd(x,y);}

signed main(){
    int N,K;
    cin>>N>>K;
    vector<vector<int>> dp(N+1,vector<int>(K));
    rep(i,N) rep(j,K) dp[i][j]=0;
    rep(i,K) dp[1][i]=1;
    rep(i,1,N){
    	int sum=0;
    	rep(j,K) sum+=dp[i][j];
    	rep(j,K) dp[i+1][j]=sum-dp[i][j];
    }
    int ans=0;
    rep(i,K) ans+=dp[N][i];
    cout<<ans<<endl;
}

int mpow(int a,int x){
	int ans=1;
	while(x>0){
		if(x%2==1) (ans*=a)%=mod;
		(a*=a)%=mod;
		x>>=1;
	}
	return ans;
}

Measured memory_bytes: 256
from collections import deque

s = deque(input())
q = int(input())

rev_flag = False
for i in range(q):
    tmp_in = list(input().split())

    if tmp_in[0] == '1':
        if rev_flag:
            rev_flag = False
        else:
            rev_flag = True
    else:
        if rev_flag:
            if tmp_in[1] == '1':
                s.append(tmp_in[2])
            else:
                s.appendleft(tmp_in[2])
        else:
            if tmp_in[1] == '1':
                s.appendleft(tmp_in[2])
            else:
                s.append(tmp_in[2])

if rev_flag:
    s.reverse()

ans = "".join(s)
print(ans)



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

int main() {
	int a, b;
	cin >> a >> b;
	
	if (a == 1) a = 14;
	if (b == 1) b = 14;
	
	if (a > b) {
		cout << "Alice";
	}
    else if (a < b) {
		cout << "Bob";
	}
	else if (a == b) {
		cout << "Draw";
	}
	return 0;
}

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

public class Hello
{
    public static void Main()
    {
        var n = int.Parse(Console.ReadLine().Trim());
        string[] line = Console.ReadLine().Trim().Split(' ');
        var a = Array.ConvertAll(line, int.Parse).ToList();
        a.Sort();
        var b = new List<int>();
        b.Add(a[0]);
        var amin = a.Min();
        while (true)
        {
            for (int i = 1; i < a.Count(); i++)
            {
                var t = a[i] % amin;
                if (t != 0) b.Add(t);
            }
            if (b.Count() == 1) { Console.WriteLine(b[0]); goto exit; }
            b.Sort();
            a.Clear();
            a.Add(b[0]);
            var bmin = b[0];
            for (int i = 1; i < b.Count(); i++)
            {
                var t2 = b[i] % bmin;
                if (t2 != 0) a.Add(t2);
            }
            if (a.Count() == 1) { Console.WriteLine(a[0]); goto exit; }
            a.Sort();
            b.Clear();
            b.Add(a[0]);
            amin = a[0];
        }
        exit:;
    }
}

Measured memory_bytes: 21088
while True:
    try:
        a, b, c = [int(x) for x in input().split()]
    except:
        break
    
    f = 0
    
    if c > 0:
        f += 1
    elif a + b > 1:
        f += 1
        
    if f:
        print("Open")
    else:
        print("Close")
    
    


Measured memory_bytes: 5604
// C.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//

#include <iostream>
#include<algorithm>

using namespace std;
int main()
{
    int n;
    cin >> n;

    int a[100005];


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

    sort(a, a + n);

    int ans = a[n / 2] - a[n / 2 - 1];

    cout << ans << endl;

    return 0;

}



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

using namespace std;

const int Nmax = int(1e5 + 2);
int n, m, val[Nmax];
bool vis[Nmax];
vector<pair<int, int>>G[Nmax];
void dfs(int x) {
   vis[x] = 1;
   for(auto it : G[x]) {
      int y = it.first, cost = it.second;
      if(!vis[y]) {
         val[y] = val[x] + cost;
         dfs(y);
      } else if(val[y] != val[x] + cost) {
         cout << "No";
         exit(0);
      }
   }
}
int32_t main() {
  //ifstream cin("a.in");
   cin >> n >> m;
   for(int i = 1; i <= m; ++i) {
      int l, r, c;
      cin >> l >> r >> c;
      G[l].emplace_back(r, c);
      G[r].emplace_back(l, -c);
   }
   for(int i = 1; i <= n; ++i)
      if(!vis[i]) dfs(i);
   cout << "Yes";
}



Measured memory_bytes: 11136
#include <atcoder/dsu>
#include <cstdio>

using namespace std;
using namespace atcoder;

int main() {
    int n, q;
    scanf("%d %d", &n, &q);
    dsu d(n);
    for (int i = 0; i < q; i++) {
        int t, u, v;
        scanf("%d %d %d", &t, &u, &v);
        if (t == 0) {
            d.merge(u, v);
        } else {
            if (d.same(u, v)) {
                printf("1\n");
            } else {
                printf("0\n");
            }
        }
    }
    return 0;
}


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

int main() {
  int n;
  cin >> n;
  vector<int> h(n);
  int cnt = 0, x;
  for (int i = 0; i < n; i++) {
    cin >> h.at(i);
    x = 0;
    for (int j = 0; j < i; j++) {
      if (h.at(i) < h.at(j)) {
        x = 1;
        break;
      }
    }
    if (x == 0) cnt++;
  }
  cout << cnt << endl;
}

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

const int N = 1e7 + 5;

bool vis[N];

int main() {
	long long n, siz, ans = 0;
    std::cin >> n;
    siz = std::sqrt(n);
    for(long long i = 2; i <= n / i; ++i) {
    	if(!vis[i]) {
    		for(long long j = (long long)i * i; j <= siz; j += i) vis[j] = 1;
    		long long cnt = 0;
    		while(n % i == 0) n /= i, ++cnt;
    		long long add, sum;
    		for(add = sum = 0; sum <= cnt;) sum += ++add;
    		ans += add - 1;
    	}
    }
    if(n > 1) ++ans;
    std::cout << ans;
    return 0;
}



Measured memory_bytes: 4656
#include<vector>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
#include<stack>
#include<bitset>
#include<functional>
#include<ctime>
#include<queue>
#include<deque>
#include<complex>
#include<cassert>
using namespace std;
#define pb push_back
#define pf push_front
typedef long long lint;
typedef complex<double> P;
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
//問題文および制約はちゃんと確認しよう！
//サイズは10^5じゃなくて2×10^5とかかもしれないし、重要な制約・条件を見落としているかも
//とりあえずサンプルを読んでから解法を考えよう？
lint cal(lint x){
	if(x<1L) return 0;
	return 1+2*cal(x/2);
}
int main()
{
	lint x;cin>>x;cout<<cal(x)<<endl;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <vector>

#define X first
#define Y second
#define PB push_back
#define H size()
#define W [0].size()


using namespace std;

typedef vector < vector < int > > mat;
typedef long long ll;

const int N = 1005;
const int MOD = 1e9 + 7;

char s[N][N];
int n, m; ll K;
int x, y, z, xu, yu;

inline int add(int A, int B){
	if(A + B >= MOD) return A + B - MOD;
	return A + B;
}

inline int mul(int A,int B){
	return (ll)A * B % MOD;
}

inline int pot(int A, ll B){
	int bs = A, ret = 1;
	for(; B ; B >>= 1LL){
		if(B & 1LL) ret = mul(ret, bs);
		bs = mul(bs, bs);
	}
	return ret;
}

mat mul(mat A, mat B){
	if(A[0][0] == -1) return B;
	if(B[0][0] == -1) return A;
	mat C;
	for(int i = 0;i < (int)A.H;i++){
		vector < int > tmp;
		for(int j = 0;j < (int)B W;j++){
			int cur = 0;
			for(int k = 0;k < (int)A W;k++){
				cur = add(cur, mul(A[i][k], B[k][j]));
			}
			tmp.PB(cur);
		}
		C.PB(tmp);
	}
	return C;
}

mat pot(mat A, ll B){
	mat bs = A, ret = {{-1}};
	for(; B ; B >>= 1LL){
		if(B & 1LL) ret = mul(ret, bs);
		bs = mul(bs, bs);
	}
	return ret;
}

int main(){
	scanf("%d%d%lld", &n, &m, &K);
	for(int i = 0;i < n;i++){
		for(int j = 0;j < m;j++){
			scanf(" %c", &s[i][j]);
			z += (s[i][j] == '#');
		}
	}
	for(int i = 0;i < n;i++)
		x += (s[i][0] == '#') && (s[i][m - 1] == '#');
	for(int i = 0;i < m;i++)
		y += (s[0][i] == '#') && (s[n - 1][i] == '#');
	for(int i = 0;i < n;i++)
		for(int j = 0;j + 1 < m;j++)
			xu += (s[i][j] == '#') && (s[i][j + 1] == '#');
	for(int i = 0;i + 1 < n;i++)
		for(int j = 0;j < m;j++)
			yu += (s[i][j] == '#') && (s[i + 1][j] == '#');
	if(x && y){
		printf("1\n");
		return 0;
	}
	else if(!x && !y){
		printf("%d\n", pot(z, K - 1));
		return 0;
	}
	if(!x) {swap(x, y), swap(xu, yu);};
	mat A = {{z, add(MOD, -xu)}, {0, x}};
	mat B = {{1}, {1}};
	printf("%d\n", mul(pot(A, K - 1), B)[0][0]);
}













Measured memory_bytes: 1280
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::*;
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
#[allow(unused_imports)]
use std::f64::consts::*;

#[allow(unused)]
const INF: usize = std::usize::MAX / 4;
#[allow(unused)]
const M: usize = 1000000007;

fn main() {
    input! {
        s: Chars,
    }
    let n = s.len();
    if (1..n).any(|i| s[i - 1] == s[i]) {
        println!("Bad");
    } else {
        println!("Good");
    }
}


Measured memory_bytes: 2096
#include<iostream>
#include<algorithm>
#include<ctime>
#include<vector>
#include<string>
#include<cmath>
#include<map>
#include<iomanip>
#include<numeric>
#include<queue>
#include<deque>
#include<cfloat>
#include<functional>
#include<tuple>
#include<math.h>
#include<bitset>
#include<stack>
#include<set>
#include<random>
#include<stdlib.h>
#define rip(i,n) for(int i=0;i<n;i++)
#define Rip(i,n) for(int i=1;i<=n;i++)
#define RIP(i,a,b) for(int i=a;i<b;i++)
#define all(V) V.begin(),V.end()
#define sec  setprecision;
#define _CRT_SECURE_NO_WARNINGS
#pragma target("avx")
#pragma optimize("O3")
#pragma optimize("unroll-loops");
constexpr double eps = 1e-9;
constexpr double pi = 3.141592653589793238462643383279;
using ll = long long;
using ld = long double;
using Pa = std::pair<ll, ll>;
using namespace std;
ll gcd(ll a, ll b)
{
	if (a % b == 0)	return(b);
	else return(gcd(b, a % b));
}
ll lcm(ll a, ll b)
{
	return a * b / gcd(a, b);
}
ll pow(ll x, ll n,ll mod) {
	x %= mod;
	if (n == 0)
		return 1;
	if (n % 2 == 0)
		return (pow(((x * x)%mod), n / 2,mod));
	else
		return ((x%mod) * pow(x, n - 1,mod));
}
bool prime(int n) {
	int i = 2;
	if (n == 2)return true;
	else if(n <= 1)return false;
	if (n % i == 0)return false;
	i = 3;
	while (i <= sqrt(n)) {
		if (n % i == 0)return false;
		i += 2;
	}
	return true;
}
ll mod = 998244353;
int main() {
	string s; cin >> s;
	ll k = s.size();
	ll ans = 0;
	rip(i, k) {
		ans += (s[i] - '0');
	}
	if (ans % 9 == 0)cout << "Yes" << endl;
	else cout << "No" << endl;
}

Measured memory_bytes: 3768
s = input()

ans = 0
for b in range(1<<(len(s)-1)):
    a = s[0]
    for i in range(len(s)-1):
        if b & (1<<i):
            a += "+" + s[i+1]
        else:
            a += s[i+1]
    ans += eval(a)
print(ans)


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


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

  int k;
  int a,b;
  cin >> k >> a >> b;

  for(int i=a;i<=b;i++){
    if(i%k==0) {
      cout << "OK" << endl;
      return 0;
    }
  }
    cout << "NG" << endl;
  return 0;
    

}


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

using namespace std;
int n;
void dfs(int i, int mx, string s) {
    if (i == n) {
        cout << s <<"\n";
        return;
    }
    for (int x = 0; x <= mx + 1; x++) {
        dfs(i+1, max(mx, x), s + (char('a'+x)));
    }
}
void solve() {
    cin >> n;
    dfs(0,-1,"");
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
    return 0;
}


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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N, K;
  cin >> N >> K;
  vector<int> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  int64_t res = 1LL << 60;
  for (int bit = 0; bit < (1 << N); bit++) {
    int64_t cost = 0;
    int k = 1, ma = A[0];
    for (int i = 1; i < N; i++) {
      int diff = 0;
      if ((bit >> i) & 1) {
        diff = max(0, ma - A[i] + 1);
        cost += diff;
      }
      if (A[i] + diff > ma) k++;
      ma = max(ma, A[i] + diff);
    }
    if (k >= K) res = min(res, cost);
  }
  cout << res << '\n';
  return 0;
}


Measured memory_bytes: 256
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby
    #from itertools import product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    from math import floor, ceil
    #from operator import itemgetter

    #inf = 10**17
    #mod = 10**9 + 7

    s = input().rstrip()
    t = input().rstrip()
    alphabet = 'abcdefghijklmnopqrstuvwxyz' #26

    for a in alphabet:
        l1, l2 = [], []
        for i in range(len(s)):
            if t[i] == a:
                l1.append(s[i])
            if s[i] == a:
                l2.append(t[i])
        if len(set(l1)) > 1 or len(set(l2)) > 1:
            print('No')
            exit()
    print('Yes')

if __name__ == '__main__':
    main()

Measured memory_bytes: 57384
#include <iostream>
#include <algorithm>
#include <iterator>
#include <vector>
#include <string>
#include <unordered_map>

using namespace std;

string march("MARCH");

int main() {
  int N;
  cin >> N;
  vector<string> S(N);
  copy_n(istream_iterator<string>(cin), N, S.begin());
  unordered_map<char, int64_t> m;
  for (auto& item : S) {
    if (string::npos != march.find_first_of(item[0], 0)) {
      if (m.count(item[0])) ++(m[item[0]]);
      else m[item[0]] = 1;
    }
  }

  int64_t result = 0;
  for (size_t i = 0; i < march.size() - 2; ++i) {
    for (size_t j = i + 1; j < march.size() - 1; ++j) {
      for (size_t k = j + 1; k < march.size(); ++k) {
        result += m[march[i]] * m[march[j]] * m[march[k]];
      }
    }
  }
  cout << result << endl;
  return 0;
}


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

typedef long long ll;
typedef long double ld;
typedef vector < ll > vl;
typedef vector < int > vi;
typedef vector < bool > vb;
typedef vector < vl > vvl;
typedef vector < vi > vvi;
typedef pair < int, int > pii;
typedef pair < ll, ll > pll;
typedef vector < pll > vpll;
typedef vector < pii > vpii;
typedef vector < vpll > vvpll;
typedef vector < vpii > vvpii;

#define pb push_back
#define eb emplace_back
#define pf push_front
#define all(c) (c).begin(), (c).end()
#define ff first
#define ss second
#define mp(x,y) make_pair((x), (y))
#define boost ios_base::sync_with_stdio(false); cin.tie(NULL)



void solve(){
    
    int l, r, d; cin >> l >> r >> d;
    cout << (r / d) - (l - 1) / d << '\n';
    
}


int main(){
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif

    boost;

    int t = 1;
    // cin >> t;


    for(int i = 1; i <= t; i++){
        // cout << "Case #" << i << ": ";

        solve();

    }
    return 0;
}

Measured memory_bytes: 3608
#include <algorithm>
#include <complex>
#include <cstdlib>
#include <ctime>
#include <time.h>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <numeric>
#include <limits>
#include <type_traits>

using namespace std;
#define SAY_YES cout << "YES" << endl;
#define SAY_Yes cout << "Yes" << endl;
#define SAY_NO cout << "NO" << endl;
#define SAY_No cout << "No" << endl;
#define IFYES(TRUE_OR_FALSE)   \
    if (TRUE_OR_FALSE)         \
    {                          \
        cout << "YES" << endl; \
    }                          \
    else                       \
    {                          \
        cout << "NO" << endl;  \
    }
#define IFYes(TRUE_OR_FALSE)   \
    if (TRUE_OR_FALSE)         \
    {                          \
        cout << "Yes" << endl; \
    }                          \
    else                       \
    {                          \
        cout << "No" << endl;  \
    }
#define IFyes(TRUE_OR_FALSE)   \
    if (TRUE_OR_FALSE)         \
    {                          \
        cout << "yes" << endl; \
    }                          \
    else                       \
    {                          \
        cout << "no" << endl;  \
    }
#define DEBUG_OUTPUT_ARRAY(XXX, ONE)                            \
    for (int i = 0; i < (ONE); i++)                             \
    {                                                           \
        cout << "DEBUG: i = " << i << " -> " << XXX[i] << endl; \
    }
#define DEBUG_OUTPUT_ARRAY2(XXX, ONE, TWO)                             \
    for (int i = 0; i < (ONE); i++)                                    \
    {                                                                  \
        cout << "<<< i = " << i << " >>>" << endl;                     \
        for (int j = 0; j < (TWO); j++)                                \
        {                                                              \
            cout << "DEBUG: j = " << j << " -> " << XXX[i][j] << endl; \
        }                                                              \
    }
#define DEBUG_OUTPUT_ARRAY2_BOX(XXX, ONE, TWO) \
    for (int i = 0; i < (ONE); i++)            \
    {                                          \
        cout << i << "  ";                     \
        for (int j = 0; j < (TWO); j++)        \
        {                                      \
            cout << XXX[i][j] << " ";          \
        }                                      \
        cout << endl;                          \
    }

typedef pair<long long int, long long int> pll;


const long long int mod = 1000000007;
const long long int INF = 1e18;


long long int N,M,K,A[200200],sum=0;
int main()
{
    cout << fixed << setprecision(18);
    cin>>N>>M>>K;
    cout<<max(0LL,K-N+M)<<endl;
    
        
}


Measured memory_bytes: 256
import numpy as np
K, N = map(int, input().strip().split())
A = list(map(int, input().strip().split()))

# min_=10**6
dA=np.diff(A)
dA=np.append(dA,A[0]+K-A[-1])
skip_dist=max(dA)
ans=K-skip_dist

print(ans)

Measured memory_bytes: 34160
#include <iostream>
#include <vector>
#include <map>

using namespace std;

int main(){
  map<int , int> m;
  
  for(int i = 0; i < 3; i++){
    int c;
    cin >> c;
    m[c]++;
  }
  
  int cnt = 0;
  for(auto iter = m.begin(); iter != m.end(); iter++) cnt++;
  cout << cnt;
}

Measured memory_bytes: 256
N = int(input())

B_ = 0
_A = 0
BA = 0
inner = 0

for i in range(N):
    s = list(input())
    for j in range(1,len(s)):
        if s[j-1] == "A" and s[j] == "B":
            inner += 1
    if s[0] == "B" and s[-1] == "A":
        BA += 1
    elif s[0] == "B":
        B_ += 1
    elif s[-1] == "A":
        _A += 1

#print(BA,B_,_A)

if BA > 0:
    print(BA + 1 + min(B_-1,_A-1,B_+_A-2) + inner)
else:
    print(min(B_,_A)+inner)

Measured memory_bytes: 3064
function Main(input) {
  input = input.split("\n");
  n=parseInt(input[0]);
  k=parseInt(input[1]);
  x=parseInt(input[2]);
  y=parseInt(input[3]);
  if(n>=k){
    s=k*x+(n-k)*y;
  }else{
    s=n*x;
  }
  console.log('%s', s);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
#include<bits/stdc++.h>
using namespace std;
bool myComparison(const pair<int,int> &a,const pair<int,int> &b)
{
  return a.second<b.second;
}
int main(){
  int n,m;
  cin>>n>>m;
  vector<pair<int,int>> p(m);
  bool b[n-1];
  for(int i=0;i<n-1;i++){
    b[i]=false;
  }
  for(int i=0;i<m;i++){
    int a,b;
    cin>>a>>b;
    p[i] = make_pair(a-1,b-1);
  }
  sort(p.begin(),p.end(),myComparison);
  b[p[0].second-1]=true;
  int bb=p[0].second-1;
  for(int i=1;i<m;i++){
    if(bb<p[i].first){
      b[p[i].second-1]=true;
      bb=p[i].second-1;
    }
  }
  int c=0;
  for(int i=0;i<n-1;i++){
    if(b[i])
      c++;
  }
  cout<<c;
}

Measured memory_bytes: 1152
#include <iostream>
#include <string>
using namespace std;
const int MAX = 60;
char A[MAX][MAX],B[MAX][MAX];

int check(int i,int j,int N,int M){ //左上がA[i][j]の場所がBと一致するかチェックする
  for(int k=0;k<M;k++){
    for(int l=0;l<M;l++){
      if(A[i+k][j+l]!=B[k][l]) return 0;
    }
  }
  return 1;
}

int main(){
  int N,M;

  cin >> N >> M;

  if(N < M){ //Bのほうが画像サイズが大きければNo
    cout << "No" << endl;
    return 0;
  }

  for(int i=0;i<N;i++) //入力
    for(int j=0;j<N;j++) cin >> A[i][j];
  for(int i=0;i<M;i++)
    for(int j=0;j<M;j++) cin >> B[i][j];
  
  for(int i=0;i<N-M+1;i++){ //左上の座標がA[i][j]の場所をチェック
    for(int j=0;j<N-M+1;j++){
      if(check(i,j,N,M)){
	cout << "Yes" << endl;
	return 0;
      }
    }
  }
  cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <string>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <functional>
#include <queue>
#include <stack>
#include <cmath>
#include <iomanip>
#include <list>
#include <tuple>
#include <bitset>
#include <ciso646>
#include <cassert>

using namespace std;

#define int long long
#define double long double

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

template<class T> string tostr(T x) { stringstream o; o << x; return o.str(); }
template<class T> T sqr(T x) { return x*x; }
template<class T> T mypow(T x, int n) { T r = 1; while (n > 0) { if (n & 1)r = r*x; x = x*x; n >>= 1; }return r; }

int toint(string s) { int v; stringstream i(s); i >> v; return v; }
bool check(int x, int y, int w, int h) { return x >= 0 && y >= 0 && w > x && h > y; }
int gcd(int a, int b) { return b ? gcd(b, a%b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }

#define REP(i,a,b)	for(int (i) = (a);i < (b);(i)++)
#define rep(i,n)	REP(i,0,n)
#define PER(i,a,b)	for(int (i) = (a-1);i >= (b);(i)--)
#define per(i,n)	PER(i,n,0)
#define each(i,n)	for(auto &i : n)
#define clr(a)		memset((a), 0 ,sizeof(a))
#define mclr(a)		memset((a), -1 ,sizeof(a))
#define all(a)		(a).begin(),(a).end()
#define dump(val) 	cerr << #val " = " << val << endl;
#define dum(val)	cerr << #val " = " << val;
#define FILL(a,v)	fill(a,a+sizeof(a)/sizeof(*a),v)

const int dx[8] = { +1,+0,-1,+0,+1,+1,-1,-1 };
const int dy[8] = { +0,-1,+0,+1,-1,+1,-1,+1 };
const int mod = 1e9 + 7;
const int INF = 1e17 + 9;

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

	int n;
	cin >> n;
	vector<int> a(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	sort(all(a));

	vector<int> s(n, 0);
	rep(i, n) {
		if (i == 0)s[i] = a[i];
		else s[i] = a[i] + s[i - 1];
	}

	int ans = 0;

	rep(i, n) {

		int now = a[i];
		int tl = -1;
		
		auto ok = [&](int m) {
			if (a[m] <= now * 2)return true;
			return false;
		};

		while (1) {
			int l = 0, r = n;
			rep(i, 30) {
				int m = (r + l) / 2.0;
				if (ok(m)) {
					l = m;
				}
				else {
					r = m;
				}
			}
			int ad = s[l] - ((tl == -1) ? 0 : s[tl]);
			if (tl < i && i <= l)ad -= a[i];
			tl = l;
			if (ad == 0)break;
			now += ad;
			if (now == s[n - 1]){
				ans++; break;
			}
		}

	}

	cout << ans << endl;


	return 0;
}

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

int main() {
  string s;
  cin >> s;
  s.length();
  int flag=0;
  for(int i=0;i<s.length();i++){
    if((i+1)%2==0){
      if(s[i]=='L'){
      }
      else if(s[i]=='U'){
      }
      else if(s[i]=='D'){
      }
      else
      {
        flag=1;
        break;
      }
    }
    else{
      if(s[i]=='R'){
      }
      else if(s[i]=='U'){
      }
      else if(s[i]=='D'){
      }
      else
      {
        flag=1;
        break;
      }      
    }
  }
  if(flag==0) cout << "Yes" << endl;
  if(flag==1) cout << "No" << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>

using namespace std;

bool isKaibun(string s){
    for(int i=0;i<s.length()/2;i++){
        if(s[i] != s[s.length()-1-i]) return false;
    }
    return true;
}

int main(){

    string str; cin>>str;
    int n = str.length();
    bool f1 = false, f2 = false, f3 = false;
    if(isKaibun(str)) f1 = true;
    if(isKaibun(str.substr(0, (n-1)/2))) f2 = true;
    if(isKaibun(str.substr((((n+3)/2)-1), n))) f3 = true;
    
    if(f1 && f2 && f3){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }

    return 0;
}

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

int main()
{
	long N;
	cin >> N;
	vector<long> A(N),B(N-1);
	rep(i, N - 1) {
		cin >> B.at(i);
	}

	A.at(0) = B.at(0);
	A.at(N - 1) = B.at(N - 2);
	rep(i, N - 2) {
		A.at(i + 1) = min(B.at(i), B.at(i+1));
	}

	long ans = 0;
	rep(i, N) {
		ans += A.at(i);
	}

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
// マクロ
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
// 型エイリアス
using ll = long long;
using vi = vector<int>;
using vs = vector<string>;
using vvi = vector<vi>;
using vvs = vector<vs>;

int main() {
    int x;
    cin >> x;
    vi expo(x+1, 0);
    expo[1] = 1;
    for(int i = 2; i <= x; i++) {
        int v = i * i;
        while(v <= x) {
            expo[v] = 1;
            v *= i;         
        }
    }
    for(int i =x; i >= 1; i--) {
        if(expo[i]) {
            cout << i << endl;
            break;
        }
        
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define ll              long long
#define pb              push_back
#define ppb             pop_back
#define endl            '\n'
#define mii             map<ll,ll>
#define pii             pair<ll,ll>
#define vi              vector<ll>
#define vs              vector<string>
#define all(a)          (a).begin(),(a).end()
#define F               first
#define S               second
#define sz(x)           (ll)x.size()
#define hell            1000000007
#define inf             (ll)1e18 + 5
#define PI              (double)3.14159265358979323844
#define DECIMAL(n)      cout << fixed << setprecision(n);
#define rep(i,a,b)      for (ll i=a;i<b;i++)
#define repr(i,a,b)     for (ll i=a-1;i>=b;i--)
#define bitcount(a)     (ll)__builtin_popcount(a)
#define lbnd            lower_bound
#define ubnd            upper_bound
#define mp              make_pair
#define ios             ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ordered_set     tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
#define trace(...)      __f(#__VA_ARGS__, __VA_ARGS__)

template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    std::cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');std::cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}

using namespace std;
using namespace __gnu_pbds;

/*----------------------Graph Moves----------------*/
//const int fx[]={+1,-1,+0,+0};
//const int fy[]={+0,+0,+1,-1};
//const int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};   // Kings Move
//const int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};  // Kings Move
//const int fx[]={-2, -2, -1, -1,  1,  1,  2,  2};  // Knights Move
//const int fy[]={-1,  1, -2,  2, -2,  2, -1,  1}; // Knights Move
/*------------------------------------------------*/

//primes for hashing 937,991,1013,1409,1741

void solve() {
    ll n;
    cin>>n;
    ll sum=0;
    rep(i,1,n+1){
    	if (i%3==0 || i%5==0){
    		continue;
    	}
    	else{
    		sum+=i;
    	}
    }
    cout<<sum<<endl;
}

signed main() {
    ios
    ll test=1;
    //cin>>test;
    while (test--) solve();
    return 0;
}


Measured memory_bytes: 3624
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
    ll x,y;
    cin>>x>>y;
    for(ll i=0;i<100;i++)
    {
        ll check=pow(2,i-1)*x;
        if(check>y)
        {
            cout<<i-1;
            break;
        }
    }
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long a = sc.nextLong(), b = sc.nextLong(), x = sc.nextLong();
        System.out.println(a%x==0? b/x-a/x+1 : b/x-a/x);
    }
}


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

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int  ,int > pii;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const ll maxn  = 3e6;
const ll mod =1e9+7;
const ld PI = acos((ld)-1);

#define pb push_back
#define endl '\n'
#define dokme(x) return(cout << x , 0);
#define migmig ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ms(x , y) memset(x , y , sizeof x);
#define file_init freopen("input.txt", "r+", stdin); freopen("output.txt", "w+", stdout);
ll pw(ll a, ll b, ll md = mod){ll res = 1;while(b){if(b&1){res=(a*res)%md;}a=(a*a)%md;b>>=1;}return(res);}

ll a , b;

int main(){
    migmig
    ll ans = 1e18;
    cin >> a >> b;
    if(a <= b)ans = min(ans , b-a);
    if(-a <= b)ans = min(ans ,b+a+1);
    if(-a <= -b)ans = min(ans ,a-b+2);
    if(a <= -b)ans = min(ans , -b-a+1);
    cout << ans;
    return(0);
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>

using namespace std;
using llng = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vs = vector<string>;

int main() {
    int N, K; cin >> N >> K;
    vi A(N); for (int i=0; i<N; i++) cin >> A[i];
    int gcd = A[0];
    for (int i=1; i<N; i++) {
        int a = A[i];
        while (a % gcd != 0) {
            int tmp = gcd;
            gcd = a % gcd;
            a = tmp;
        }
    }
    for (int i=0; i<N; i++) {
        if (A[i] >= K && (A[i] - K) % gcd == 0) {
            cout << "POSSIBLE" << endl;
            return 0;
        }
    }
    cout << "IMPOSSIBLE" << endl;
    return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <utility>
#include <tuple>
#include <algorithm>
#include <numeric>
#include <cstdio>
#include <cstring>
#include <cmath>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
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; }

class UnionFind {
  vector<int> par, rank, potential;
public:
  UnionFind(int n) {
    par.resize(n, -1);
    rank.resize(n, 0);
    potential.resize(n, 0);
  }
  int root(int x) {
    if (par[x] < 0)
      return x;
    int r = root(par[x]);
    potential[x] += potential[par[x]];
    return par[x] = r;
  }
  int size(int x) {
    return -par[root(x)];
  }
  int weight(int x) {
    root(x);
    return potential[x];
  }
  bool same(int x, int y) {
    return root(x) == root(y);
  }
  bool unite(int x, int y, int w = 0) {
    w += weight(x);
    w -= weight(y);
    x = root(x);
    y = root(y);
    if (x == y) {
      return false;
    }
    if (rank[x] < rank[y]) {
      swap(x, y);
      w = -w;
    }
    if (rank[x] == rank[y])
      rank[x]++;
    par[x] += par[y];
    par[y] = x;
    potential[y] = w;
    return true;
  }
  int diff(int x, int y) {
    return weight(y) - weight(x);
  }
};

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int h, w;
  cin >> h >> w;
  vector<string> grid(h);
  rep(i, h) cin >> grid[i];
  UnionFind uf(h*w);
  rep(i, h) rep(j, w) {
    if (i+1<h && grid[i+1][j] != grid[i][j])
      uf.unite(w*i+j, w*(i+1)+j);
    if (j+1<w && grid[i][j+1] != grid[i][j])
      uf.unite(w*i+j, w*i+(j+1));
  }
  map<int, pair<int, int>> mp;
  rep(i, h) rep(j, w) {
    if (grid[i][j] == '#')
      mp[uf.root(w*i+j)].first++;
    else
      mp[uf.root(w*i+j)].second++;
  }
  ll ans = 0;
  for (auto e : mp) {
    ll black, white;
    tie(black, white) = e.second;
    ans += black*white;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 10752