akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
    int n = 5;
    vector<int>v;
    int x;
    for (int i = 0; i < n; i++) {
        cin >> x;
        v.push_back(x);
    }
    auto i = find(v.begin(), v.end(), 0);
    cout << i - v.begin()+1;


    return 0;
}

Measured memory_bytes: 3604
package main

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

var (
	readString func() string
	stdout     *bufio.Writer
)

func init() {
	readString = newReadString(os.Stdin)
	stdout = bufio.NewWriter(os.Stdout)
}

func newReadString(ior io.Reader) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = readInt()
	}
	return b
}

func readLengthAndSlice() (int, []int) {
	n := readInt()
	return n, readIntSlice(n)
}

func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(stdout, f, args...)
}

func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(stdout, args...)
}

func eprintln(args ...interface{}) (int, error) {
	return fmt.Fprintln(os.Stderr, args...)
}

// readString() string
// readInt() int
// readIntSlice(n int) []int
// readLengthAndSlice() []int

// -----------------------------------------------------------------------------

func main() {
	defer stdout.Flush()
	n := readInt()
	k := readInt64()
	ans := k
	for i := 1; i < n; i++ {
		ans *= (k - 1)
	}
	println(ans)
}

// -----------------------------------------------------------------------------


Measured memory_bytes: 640
#include<stdio.h>

int main(void){
        int r, c;
        scanf("%d %d", &r, &c);
        int table[r+1][c+1];
        for(int i=0; i<r; i++){
                int sm = 0;
                for(int j=0; j<c; j++){
                        scanf("%d", &table[i][j]);
                        sm += table[i][j];
                }
                table[i][c] = sm;
        }
        for(int j=0; j<=c; j++){
                int sm = 0;
                for(int i=0; i<r; i++){
                        sm += table[i][j];
                }
                table[r][j] = sm;
        }

        for(int i=0; i<=r; i++){
                for(int j=0; j<=c; j++){
                        printf("%d", table[i][j]);
                        if(j==c) putchar('\n');
                        else putchar(' ');
                }
        }
        return 0;
}


Measured memory_bytes: 2120
#include <bits/stdc++.h>
#define rep(i,n) for(int i=1;i<(n);++i)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
 
int main() {

    int n;
    cin >> n;

    int ans = 0;

    rep(i,n) {
        rep(j,n) {
            if(i*j<n) ans++;
            else break;
        }
    }

    cout<<ans<<endl;


 return 0;
}


Measured memory_bytes: 3640
// 2020 3/24 ABC159 C Maximum Volume
/*
    a * a * a = a^3
    a * (a+i) * (a-i) = a * (a^2 - i^2)
    相加相乗平均
 */

#include <iostream>
#include <stdio.h>
#include <cmath> // for pow()
using namespace std;

int main() {
    double L;
    cin >> L ;

    double x = L/3;
    double ans = pow(x, 3);
    printf("%.10f\n", ans);

    return 0;

}

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

def is_zorome(Nstr):
    init = Nstr[0]
    for n in Nstr[1:]:
        if n != init:
            return False
    return True

def find_min_zorome(Nstr):
    init = Nstr[0]
    candidate = ""
    for _ in range(len(Nstr)):
        candidate += init

    if int(Nstr) < int(candidate):
        return candidate
    else:
        candidate = ""
        if init == "9":
            for _ in range(len(Nstr)+1):
                candidate += "1"
        else:
            for _ in range(len(Nstr)):
                candidate += str(int(init)+1)
        return candidate

if is_zorome(N):
    print(N)
else:
    print(find_min_zorome(N))


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

int main() {
    int n, m;
    cin >> n >> m;

    vector<int> d;
    for (int i = 1; i * i <= m; i++) {
        if (m % i != 0) continue;
        d.push_back(i);
        if (i * i != m) d.push_back(m / i);
    }

    sort(begin(d), end(d));
    cout << m / *lower_bound(begin(d), end(d), n) << endl;
}


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


using namespace std;

using hint32 = int32_t;
using hint64 = int64_t;
using huint32 = uint32_t;
using huint64 = uint64_t;
using hint = hint32;
using huint = huint32;


#define hrep( i, n )		for( hint i = 0; i < ( hint )( n ); ++i )
#define hrepr( i, n )		for( hint i = ( hint )( n ); i >= 0; --i)
#define hfor( i, a, n )		for( hint i = ( hint )( a ); i < ( hint )( n ); ++i )
#define hforr( i, a, n )	for( hint i = ( hint )( n ); i >= ( hint )( a ); --i)


#define all(x)	(x).begin(),(x).end()


#define dump(x)			std::cout << #x << " = " << x << "\n";
#define hout(x)			std::cout << x << "\n";
#define hout2(x,y)		std::cout << x << "," << y << "\n";
#define hout3(x,y,z)	std::cout << x << "," << y << "," << z << "\n";

#define ini	std::cin.tie(0);std::ios::sync_with_stdio(false)



int main()
{
	ini;

	hint n;
	string s;

	cin >> n >> s;
	map<char, hint> m;
	m['E'] = 0;
	m['W'] = 0;
	hrep(i, n)
	{
		++m[s[i]];
	}

	hint a = n;
	hint b = 0;
	int res = n;
	hrep(i, n)
	{
		--m[s[i]];
		res = min(res, m['E'] + b);
		a = m['E'] + b;
		if (s[i] == 'W')
		{
			b++;
		}
		
	}
	hout(res);
	return 0;
}



//w  e


Measured memory_bytes: 720
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define vi vector<int>
#define vl vector<long long>
#define pii pair<int, int>
#define pll pair<long long, long long>
#define abu ios_base::sync_with_stdio(0)
#define said cin.tie(0)
using namespace std;

void yes(){
    cout<<"Yes"<<endl;
}

void no(){
    cout<<"No"<<endl;
}
ll ctr[200100];
void solve(){
    ll n;
    cin>>n;
    vl a(n);
    for(int i=0;i<=n;i++){
        ctr[i] = 0;
    }
    for(int i=0;i<n;i++){
        cin>>a[i];
        ctr[a[i]]++;
    }
    ll tot = 0;
    for(int i=1;i<=n;i++){
        tot += ctr[i]*(ctr[i]-1)/2;
    }
    for(int i=0;i<n;i++){
        cout<<tot-(ctr[a[i]]-1)<<endl;
    }
}

int main(){
    abu;
    said;
    int t = 1;
    //cin>>t;
    while(t--){
        solve();
    }

    return 0;
}


Measured memory_bytes: 5760
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<stdlib.h>
#include<string.h>
#include<queue>
#define LL long long
using namespace std;
inline int read( )
{
  int sum=0;char c=getchar( );bool f=0;
  while(c<'0'||c>'9') {if(c=='-') f=1;c=getchar( );}
  while(c>='0'&&c<='9') {sum=sum*10+c-'0';c=getchar( );}
  if(f) return -sum;
  return sum;
}
const int N=200005;
const int mod=1000000007;
int n,X[N],s[N],L[N],R[N],top;
struct ex{int x,v;}p[N];
inline bool operator < (const ex &a,const ex &b) {return a.v<b.v;}
inline int b1(int x)
{
  int l=1,r=top,mid;
  while(l<=r)
    {
      mid=(l+r)>>1;
      if(X[s[mid]]>x) l=mid+1;
      else r=mid-1;
    }
  return s[l];
}
inline int b2(int x)
{
  int l=1,r=top,mid;
  while(l<=r)
    {
      mid=(l+r)>>1;
      if(X[s[mid]]<x) l=mid+1;
      else r=mid-1;
    }
  return s[l];
}
vector<int>S[N];int sum[N];
vector<int>::iterator it,ed;
inline void up(int &x,int y) {x+=y;if(x>=mod) x-=mod;}
int main( )
{
  int i,j,x,y,k;
  n=read( );
  for(i=1;i<=n;i++) p[i].x=read( ),p[i].v=read( );
  for(sort(p+1,p+n+1),i=1;i<=n;i++) X[i]=p[i].x;
  for(i=n;i>=1;i--) (X[i]<X[s[top]]||!top)?s[++top]=i:0,R[i]=b1(X[i]);top=0;
  for(i=1;i<=n;i++) (X[i]>X[s[top]]||!top)?s[++top]=i:0,L[i]=b2(X[i]);top=0;
  for(i=1;i<=n;i++) S[R[i]].push_back(L[i]);
  for(i=1;i<=n;i++) sort(S[i].begin( ),S[i].end( ));
  for(sum[0]=1,i=1;i<=n;i++)
    {
      x=sum[i-1];
      for(it=S[i].begin( ),ed=S[i].end( );it!=ed;it++)
	{
	  y=*it;k=x-(y==1?0:sum[y-2]);
	  up(x,k<0?k+mod:k);
	}
      sum[i]=x;
    }
  up(x,mod-sum[n-1]);
  printf("%d\n",x);
  return 0;
}


Measured memory_bytes: 16640
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define rep(i, n) for(int i=0;i<n;++i)
#define rrep(i, n) for(int i=n;i>=0;--i)
const int inf=1e9+7;
const ll mod=1e9+7;
const ll mod1=998244353;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  string S, T;
  cin>>S>>T;
  int ans = 0;
  int tmpans;
  for(int i=0;i<=S.size()-T.size();++i) {
    tmpans = 0;
    for(int j=0;j<T.size();++j) {
      if(S[i+j]==T[j]) tmpans++;
    }
    ans = max(ans, tmpans);
  }
  cout<<T.size()-ans<<endl;
}



Measured memory_bytes: 3628
#include <algorithm>
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <vector>
#include <sstream>
#include <set>
using namespace std;
using ll = long long;

class range {private: struct I{int x;int operator*(){return x;}bool operator!=(I& lhs){return x<lhs.x;}void operator++(){++x;}};I i,n;
public:range(int n):i({0}),n({n}){}range(int i,int n):i({i}),n({n}){}I& begin(){return i;}I& end(){return n;}};

int main() {
  int N, K;
  while (scanf("%d%d", &N, &K) != EOF) {
    vector<ll> v(N);
    for (int i : range(N)) {
      scanf("%lld", &v[i]);
    }

    vector<ll> sum(N + 1), ps(N + 1);
    ll ideal = 0;
    for (int i : range(N)) {
      sum[i + 1] = sum[i] + v[i];
      ps[i + 1] = ps[i] + max(v[i], 0LL);
    }

    ll res = 0LL;
    for (int i : range(N - K + 1)) {
      ll add = max(0LL, sum[i + K] - sum[i]);
      ll cand = add + ps[N] - (ps[i + K] - ps[i]);
      res = max(res, cand);
    }
    printf("%lld\n", res);
  }
}


Measured memory_bytes: 2688
//  ~~kassablanca~~  \\                                                                                                                                                                                              //look down



#include <bits/stdc++.h>

//#pragma GCC optimize("Ofast")

using namespace std;

typedef long long ll;
typedef long double ld;

mt19937 rnd(time(0));
#define ioss ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define file freopen("dead", "r", stdin); freopen("tmp.out", "w", stdout);
#define s second
#define f first
#define pb push_back
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()

template<class T>
ll upmax(T &a, T b) { return (b > a) ? a = b, 1 : 0; }

template<class T>
ll upmin(T &a, T b) { return (b < a) ? a = b, 1 : 0; }

template<class T>
ll gcd(T a, T b) { return b ? gcd(b, a % b) : a; }

const ll INF = 1e18;
constexpr ll mod = 1e9 + 7;

void solve() {
    char t;
    cin>>t;
    t++;
    cout<<t<<'\n';
}

signed main() {
    //ioss
    //clock_t time = clock();
    //if ((double) (clock() - time) / CLOCKS_PER_SEC > 0.96) {
    int t = 1;
    //cin >> t;
    while (t--) {
        solve();
    }
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1e9+7,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<int,int> P;

void Main() {
  ll n,m;
  cin >> n >> m;
  ll a[n],b[n];
  rep(i,n) cin >> a[i] >> b[i];
  ll dp[111111];
  fill(dp,dp+111111,MAXL);
  dp[0]=0;
  rep(i,n) {
    rrep(j,111111) {
      if(j+b[i]<=100001) dp[j+b[i]]=min(dp[j+b[i]],dp[j]+a[i]);
    }
  }
  ll ans=0;
  rep(i,111111) {
    if(dp[i]<=m) ans=i;
  }
  pr(ans);
}

int main(){ios::sync_with_stdio(0);cin.tie(0);Main();return 0;}


Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n)for(int i=0;i<(n);i++)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
using ll = long long;
using P = pair<int, int>;

const int mod = 1e9+7;

ll dp[100005][5];

void add(ll &a, ll b){
    a += b;
    if(a >= mod) a -= mod;
}

int main(){
    string s; 
    cin >> s;
    memset(dp, 0, sizeof(dp));
    dp[0][0] = 1;
    for(int i = 0; i < s.size(); i++){
        
        for(int j = 0; j < 5; j++){
            //ABCの場所を選ばない場合
            if(s[i] != '?') add(dp[i+1][j], dp[i][j]);
            else add(dp[i+1][j], dp[i][j] * 3 % mod);
        }
        
        //ABCの場所を選ぶ場合
        if(s[i] == 'A' || s[i] == '?') add(dp[i+1][1], dp[i][0]);
        if(s[i] == 'B' || s[i] == '?') add(dp[i+1][2], dp[i][1]);
        if(s[i] == 'C' || s[i] == '?') add(dp[i+1][3], dp[i][2]);
        /*
        for(int j = 0; j < 5; j++){
            //ABCの場所を選ばない場合
            if(s[i] != '?') add(dp[i+1][j], dp[i][j]);
            else add(dp[i+1][j], dp[i][j] * 3 % mod);
        }
        */
    }
    cout << dp[s.size()][3] << endl;
}

Measured memory_bytes: 7576
def main():
    x = int(input())
    ans = solve(x)
    print(*ans if ans is not None else '')


def solve(x):
    numbers = {i:i ** 5 for i in range(10 ** 3 + 1)}
    #print(numbers)
    for n1, i in numbers.items():
        for n2, j in numbers.items():
            if i - j == x:
                return n1, n2
            if i + j == x:
                return n1, -n2


if __name__ == '__main__':
    main()

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

typedef long long ll;
#define type(a) typeid(a).name();
#define print(arr) cout << "[" ;for(unsigned int i=0;i<(unsigned int) arr.size();i++){ (i==arr.size()-1)?cout << arr[i]:cout << arr[i] << ",";}cout << "]" << endl
#define Arr(arr,l) cout << "[" ;for(unsigned int i=0;i<(unsigned int) l;i++){ (i==l-1)?cout << arr[i]:cout << arr[i] << ",";}cout << "]" << endl
#define console(arr) cout << "["<<endl; for(ll i=0;i<(ll)arr.size();++i){cout << " [";for(ll j=0;j<(ll)arr[i].size();++j){(j==(int)arr[i].size()-1)?cout << arr[i][j]:cout << arr[i][j] << ",";}cout << "]"<<endl;} cout << "]"<<endl
int main(){
   int n1,n2;
   cin >> n1 >> n2;
   if(n1<10 && n2 <10){
	   cout << n1*n2;
   }else{
	 cout << -1;  
	 }
}  

















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

int main(){
    int n,d,ans=0;
    cin>>n>>d;
    int tmp=0,len=2*d+1;
    while(n>tmp){
        tmp+=len;
        ans++;
    }
    cout<<ans<<"\n";
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <math.h>
#include <set>
#include <string>
#include <vector>
#include <array>

#define INT_MAX 2000000000
#define MOD 1000000007
#define ll long long
#define rep(i,a,b) for(i = (a); i < (b); i++)
#define bitget(a,b) (((a) >> (b)) & 1)

using namespace std;

int i, j, k;

int main()
{
	int h, w, n;
	int a[10000];
	cin >> h >> w >> n;
	rep(i, 0, n){
		cin >> a[i];
	}
	int ans[100][100] = {};
	int now = 1;
	rep(i, 0, h*w){
		ans[i / w][i%w] = now;
		a[now - 1]--;
		if (a[now - 1] == 0){
			now++;
		}
	}
	rep(i, 0, h){
		rep(j, 0, w){
			if (i % 2 == 0){
				cout << ans[i][j];
			}
			else{
				cout << ans[i][w - j - 1];
			}
			if (j != w - 1){
				cout << " ";
			}
		}
		cout << endl;
	}

	return 0;
}

Measured memory_bytes: 384
#include<cstdio>
#include<cstring>
#include<algorithm>
#define MAXN 100000
using namespace std;
typedef long long LL;
int N,Q,t;
LL stk[MAXN+5],q[MAXN+5];
LL xs[MAXN+5],res[MAXN+5],ans[MAXN+5];
void DFS(LL len,LL pre)
{
	int p=upper_bound(stk,stk+1+t,len)-stk-1;
	if(p==0)
	{
		res[1]+=pre;
		res[len+1]-=pre;
		return;
	}
	xs[p]+=pre*(len/stk[p]);
	len%=stk[p];
	DFS(len,pre);
}
int main()
{
//	freopen("seq.in","r",stdin);
//	freopen("seq.out","w",stdout);
	scanf("%d %d",&N,&Q);
	if(Q==0)
	{
		for(int i=1;i<=N;i++)
			printf("1\n");
		return 0;
	}
	for(int i=1;i<=Q;i++)
		scanf("%lld",&q[i]);
	stk[++t]=q[Q];
	q[0]=N;
	for(int i=Q-1;i>=0;i--)
		if(stk[t]>q[i])
			stk[++t]=q[i];
	for(int i=1;i<=t/2;i++)
		swap(stk[i],stk[t-i+1]);
	xs[t]=1LL;
	for(int i=t-1;i>=1;i--)
	{
		xs[i]+=xs[i+1]*(stk[i+1]/stk[i]);
		DFS(stk[i+1]%stk[i],xs[i+1]);
	}
	for(int i=1;i<=N;i++)
		res[i]+=res[i-1];
	for(int i=1;i<=N;i++)
		if(i<=stk[1])
			ans[i]=xs[1]+res[i];
		else
			ans[i]=res[i];
	for(int i=1;i<=N;i++)
		printf("%lld\n",ans[i]);
	return 0;
}

Measured memory_bytes: 5504
#include <bits/stdc++.h>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (ll i = (ll)(a); i < (ll)(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define ll long long
#define lld long double
#define ALL(x) x.begin(), x.end()
#ifdef DEBUG
#define line() cerr << "[" << __LINE__ << "] ";
#define dump(i) cerr << #i ": " << i << " ";
#define dumpl(i) cerr << #i ": " << i << endl;
#else
#define line(i)
#define dump(i)
#define dumpl(i)
#endif
using namespace std;
int main(int argc, char const *argv[])
{
    ll n, k, s;
    cin >> n >> k >> s;
    ll dummy;
    if (s == 1e9)
    {
        dummy = s - 1;
    }
    else
    {
        dummy = s + 1;
    }
    rep(i, k)
    {
        cout << s << " ";
    }
    rep(i, n - k)
    {
        cout << dummy << " ";
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 1280
#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <iomanip>
using namespace std;
using P = pair<int,int>;
typedef long long ll;


#define rep(i,n) for (int i=0; i<(n); i++)
const int INF =1001001001;
const ll BIG = 1000000007;
const double PI = 3.141592653589793;


bool is_prime(ll N) {
    //素数かどうかをTFで返す
    //Ex. input 13=>false, 2=>true
    if (N == 1) return false;
    for (ll i=2; i*i<=N; i++) {
        if (N % i == 0) return false;
    }
    return true;
}
vector<ll> factor(ll N) {
    //全約数を返す
    //Ex. input 24=>[1,2,3,4,6,8,12,24]
    vector<ll> res;
    for (ll i=1; i*i <= N; i++) {
        if (N%i == 0) {
            res.push_back(i);
            // 重複しないならば i の相方である N/i も push
            if (N/i != i) res.push_back(N/i);
        }
    }
    // 小さい順に並び替える
    sort(res.begin(), res.end());
    return res;
}
vector<pair<ll, ll>> factors(ll N) {
    //Nの素因数分解を返す
    //Ex. input:24=>{{2, 3}, {3, 1}}
    vector<pair<ll, ll>> res;
    for(ll i=2; i*i<=N; i++){
        if(N%i!=0) continue;
        ll ex = 0;
        while(N%i==0){
            ex++;
            N /= i;
        }
        res.push_back({i,ex});
    }
    if(N!=1) res.push_back({N, 1});
    return res;
}

int main(){
    ll n;
    cin >> n;
    //vector<pair<ll, ll>> p_num;
    //p_num = factors(n);
    auto p_num = factors(n);
    int ans = 0;
    for(auto p: p_num){
        int i = 1;
        while(1){
            if(((i+1)*(i+2)/2)>p.second) break;
            i++;
        }
        //cout << i<< endl;
        ans += i;
    }
    cout << ans << endl;
    return 0;
}


/*
int main(){
    ll n;
    cin >> n;
    map<ll, ll> primes;
    for (ll p = 2; p * p <= n; p++) {
        int k = 0;
        while (n % p == 0) {
            n /= p;
            k++;
        }
        if (k > 0) {
            primes[p] = k;
        }
    }
    if (n > 1) {
        primes[n] = 1;
    }
    int ans = 0;
    for(auto prime : primes) {
        int i = 1;
        while(1){
            if(((i+2)*(i+1))>2*prime.second){
                break;
            }
            i++;
        }
        //cout << i << endl;
        ans += i;
    }
    cout << ans <<endl;
    return 0;
}
*/

Measured memory_bytes: 3600
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

int inputValue(){
    int a;
    cin >> a;
    return a;
};

void inputArray(int * p, int a){
    REP(i, a){
        cin >> p[i];
    }
};

void inputVector(vector<int> * p, int a){
    REP(i, a){
        int input;
        cin >> input;
        p -> push_back(input);
    }
}

void getHyojunkei(int *w, int lv, int maxlv, int ch, int maxch){
    w[lv-1] = ch;
    if(lv == maxlv){
        REP(i, maxlv){
            char c = 'a' - 1 + w[i];
            cout << c;
        }
        cout << endl;
    }else{
        REP(i, maxch){
            getHyojunkei(w, lv+1, maxlv, i+1, maxch);
        }
        getHyojunkei(w, lv+1, maxlv, maxch+1, maxch+1);
    }
}

int main()
{
    int N = inputValue();
    int w[10];
    REP(i, N){
        w[i] = 0;
    }
    getHyojunkei(w, 1, N, 1, 1);
}


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

int fib[200000] ={ 1,1,2 };

int main(){
	int x, y;
	cin >> x >> y;
	if(x == 0 && y == 0){
		cout << 1 << endl;
		return 0;
	}
	if(x == 1 && y == 0){
		cout << 2 << endl;
		return 0;
	}
	int l = 0;
	int r = 1;
	int u = 2;
	int d = 1;
	for(int i=2; i<100000; i++){
		if(l <= x && x <= r && d <= y && y <= u){
			cout << i%3 +1 << endl;
			break;
		}
		fib[i+1] = fib[i] + fib[i-1];
		if(i % 4 == 0){
			u = d + fib[i+1] - 1;
			l = r + 1;
			r = l + fib[i+1] - 1;
		}
		if(i % 4 == 1){
			l = r - fib[i+1] + 1;
			d = u + 1;
			u = d + fib[i+1] - 1;
		}
		if(i % 4 == 2){
			d = u - fib[i+1] + 1;
			r = l - 1;
			l = r - fib[i+1] + 1;
		}
		if(i % 4 == 3){
			r = l + fib[i+1] - 1;
			u = d - 1;
			d = u - fib[i+1] + 1;
		}
	}
	return 0;
}


Measured memory_bytes: 3168
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  string S;
  cin >> S;
  int count=0;
  int ans=0;
  vector<int> ss;
  for(int i=0;i<S.length();i++)
  {
    if(S[i]=='A'||S[i]=='C'||S[i]=='G'||S[i]=='T') ss.push_back(1);
    else  ss.push_back(0);
  }
  for(int i=0;i<S.length();i++)
  {
    count=0;
    for(int j=0;j<S.length()-i;j++)
    {
      if(ss[i+j]==1) count++;
      else
      {
        if(ans<count) ans=count;
        break;
      }
      if(ans<count) ans=count;
    }
  }
  cout << ans;
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	static Scanner sc = new Scanner(System.in);
	static int N, K;
	static int[] C;

	public static void main(String[] args) throws Exception {
		while (true) {
			N = sc.nextInt();
			K = sc.nextInt();
			if (N == 0) break;
			C = new int[N];
			for (int i = 0; i < N; ++i) {
				C[i] = sc.nextInt();
			}
			int prev = calc();
			int best = 0;
			for (int i = 0; i < N; ++i) {
				for (int j = i + 1; j < N; ++j) {
					int tmp = C[i];
					C[i] = C[j];
					C[j] = tmp;
					best = Math.max(best, calc());
					C[j] = C[i];
					C[i] = tmp;
				}
			}
			if (best < prev) {
				System.out.println("NO GAME");
			} else {
				System.out.println(best - prev);
			}
		}
	}

	static int calc() {
		int v = 1;
		for (int i = 0; i < K; ++i) {
			v *= C[i];
		}
		int max = v;
		for (int i = K; i < N; ++i) {
			v /= C[i - K];
			v *= C[i];
			max = Math.max(max, v);
		}
		return max;
	}

}

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

int main()
{
	int n;
	cin >> n;
	cout << (n  + 1) / 2 << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define f(i,a,b) for( ll i = a; i < b ; i++ )
#define af(i,a,b) for( ll i = a; i >= b ; i--)
#define rep(i,a,b,k) for(ll i = a; i < b ; i+= k )
#define arep(i,a,b,k) for( ll i = a; i >= b ; i-= k)
#define ones(x) (ll) __builtin_popcount(x)
#define fs first
#define sc second
#define pb push_back
#define po pop_back
#define mp make_pair  
#define sz(a) (ll) a.size()
#define all(a) a.begin(), a.end()
#define sor(a) sort( a.begin(), a.end() )
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL)
#define ller ios::sync_with_stdio(false);cin.tsie(nullptr);cout.tie(nullptr)
#define watch(x) cout << (#x) << " is #" << (x) <<"#" <<endl
#define PI 3.1415926535
using namespace std;
typedef long long ll;
typedef long double ld; 
typedef pair<ll,ll> ii ;
typedef vector<ll>  vi ;
typedef vector<ii> vii ;
const ll mod = 1e9+7;
const ll MAX = 1e2+5;
const ll inf = 1e18+7;

ll a[MAX],cont[MAX];

int main() {
  fastio;
  ll n;
  cin>>n;
  f(i,0,n){
      cin>>a[i];
  }
  sort(a,a+n);
  ll ans = 0;
  f(i,0,n){
    f(j,i+1,n){
      f(k,j+1,n){
        ll x = a[i];
        ll y = a[j];
        ll z = a[k];
        if(x!=y&&y!=z&& x+y>z){ 
          ans++;
        //  cout<<"TRIANGULO "<<i+1<<" "<<j+1<<" "<<k+1<<"\n";
        }
      }
    }
  }
  cout<<ans<<"\n";
 return 0;
}
 

Measured memory_bytes: 3628
def main():
    n = int(input())
    a = list(enumerate(map(int, input().split())))

    a.sort(key=lambda x: x[1], reverse=True)
    a.append((-1, 0))

    # min_ind = min(a[:i+1])[0]
    min_ind = n
    ans = [0] * n
    for i in range(n):
        ind, value = a[i]
        if ind < min_ind:
            min_ind = ind

        ans[min_ind] += (value - a[i+1][1]) * (i+1)

    for i in ans:
        print(i)

main()

Measured memory_bytes: 88784
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,a,b;
    cin >> n >> a >> b;
    int ans=0;
    for(int i=1;i<=n;i++){
        int tmp=i;
        int sum=0;
        while(tmp>0){
            sum += tmp%10;
            tmp/=10;
        }
        if(sum>=a && sum<=b)ans+=i;
    }
    cout << ans;
}

Measured memory_bytes: 3588
#include<stdio.h>
int main()
{
	int a,b,c,k;
	scanf("%d%d%d%d",&a,&b,&c,&k);
	if(k<=a) printf("%d",k);
	else {
		if(k-a<=b) printf("%d",a);
		else  printf("%d",2*a+b-k);
		}
	return 0;
}

Measured memory_bytes: 1736
import numpy as np
N, W = map(int, input().split(" "))

dp = np.zeros(W+1,dtype=int)
for i in range(N):
    w,v = map(int, input().split(" "))
    dp[w:] = np.maximum(dp[w:], dp[:-w]+v)
print(int(dp[-1]))

Measured memory_bytes: 21132
#include <iostream>
#include <cmath>
#include <vector>
#include <utility>
#define eps 1.0e-10

using namespace std;

struct vec2d{
	double x, y;
	vec2d(){}
	vec2d(double x, double y){
		this->x = x, this->y = y;
	}
	double add(double a, double b){
		if( fabs(a+b) < eps * (fabs(a) + fabs(b)) ) return 0.0;
		return a+b;
	}
	vec2d operator+(vec2d ope){
		return vec2d( add(x, ope.x), add(y, ope.y) );
	}
	vec2d operator-(vec2d ope){
		return vec2d( add(x, -ope.x), add(y, -ope.y) );
	}
	vec2d operator*(double t){
		return vec2d( x*t, y*t );
	}
	bool operator<(const vec2d &ope)const{
		return (x < ope.x) || ( (x == ope.x) && (y < ope.y) );
	}
	double dot(vec2d ope){
		return x*ope.x + y*ope.y;
	}
	double cross(vec2d ope){
		return x*ope.y - y*ope.x;
	}
};

double distPP(vec2d p, vec2d q)
{
	double t = (p-q).dot(p-q);
	if(t == 0) return 0.0;
	return sqrt(t);
}

vec2d crossP(vec2d p, vec2d q, vec2d r, vec2d s)
{
	double t = (r-p).cross(s-r) / (q-p).cross(s-r);
	return p + (q-p)*t;
}

bool PonL(vec2d p, vec2d q, vec2d c)
{
	return fabs((p-c).cross(q-c)) < eps && (p-c).dot(q-c) <= 0;
}

int n;
vec2d S[105], T[105];
vector<vec2d> mul;

int main(void)
{
	while(1){
		cin >> n;
		if(n == 0) break;
		
		double x1, y1, x2, y2;
		for(int i = 0; i < n; i++){
			cin >> x1 >> y1 >> x2 >> y2;
			S[i] = vec2d(x1, y1);
			T[i] = vec2d(x2, y2);
		}
	
		vec2d c;
		bool flag;
		int ans = n+1;
		
		for(int i = 0; i < n; i++){
			mul.clear();
			for(int j = 0; j < i; j++){
				c = crossP(S[i], T[i], S[j], T[j]);
				if( !(c.x > -100 && c.x < 100 && c.y > -100 && c.y < 100) ) continue;
				
				flag = true;
				for(int k = 0; k < mul.size(); k++){
					if( distPP(mul[k], c) < eps){
						flag = false;
						break;
					}
				}
				if(flag){
					ans++;
					mul.push_back(c);
				}
			}
		}
		
		cout << ans << endl;
	}
	
	return 0;
}

Measured memory_bytes: 3084
#include <iostream>
#include <stdio.h>
#include <fstream>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <limits.h>
#include <math.h>
#include <functional>
#include <bitset>
#include <iomanip>
#include <cassert>

#define repeat(i,n) for (long long i = 0; (i) < (n); ++ (i))
#define debug(x) cerr << #x << ": " << x << '\n'
#define debugArray(x,n) for(long long i = 0; (i) < (n); ++ (i)) cerr << #x << "[" << i << "]: " << x[i] << '\n'
#define debugArrayP(x,n) for(long long i = 0; (i) < (n); ++ (i)) cerr << #x << "[" << i << "]: " << x[i].first<< " " << x[i].second << '\n'

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> Pii;
typedef vector<int> vint;
typedef vector<ll> vll;
const ll INF = INT_MAX;
const ll MOD = 1e9+7;

int main(){
  int H,W,N;cin>>H>>W>>N;
  vector<vll> array(W);
  repeat(i,N){
    int x,y;cin>>x>>y;
    x--;y--;
    array[y].push_back(x);
  }
  repeat(i,W){
    array[i].push_back(H);
    sort(array[i].begin(),array[i].end());
  }
  ll ans = H;
  ll y=0;
  repeat(i,H){
    //debug(i);
    //debug(y);
    int idx = lower_bound(array[y].begin(),array[y].end(),i+1)-array[y].begin();
    //debug(array[y][idx]);
    ans = min(ans,array[y][idx]);
    if(array[y][idx]==i+1){
      break;
    }
    //debug(ans);
    if(y+1>=W)break;
    idx = lower_bound(array[y+1].begin(),array[y+1].end(),i+1)-array[y+1].begin();
    if(array[y+1][idx]!=i+1){
      y++;
    }
  }
  cout << ans << endl;
  return 0;
}


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

using namespace std;

int main(void){
    string S;
    cin >> S;
    long ans = 0;
    long B_cnt = 0;
    
    for(int i = 0; i < S.length(); i++){
        if(S[i] == 'B'){
            B_cnt++;
        }
        if(S[i] == 'W'){
            ans += B_cnt;
        }
        // cout << B_cnt << " " << ans << endl;
    }
    
    cout << ans << "\n";
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
const int mod = 1e9 + 7;
//const int mod = 998244353;
const ll infll = (1LL << 62) - 1;
const int inf = (1 << 30) - 1;
void YesNo(bool j){cout << (j ? "Yes" : "No") << endl; return;}
void yesno(bool j){cout << (j ? "yes" : "no") << endl; return;}
template<class Head> void pt(Head&& head){cout << head << endl; return;}



int main() {
    string s;
    cin >> s;
    string t;
    rep(i,3) {
      t+=s[i];
    }
    pt(t);
    return 0;
}


Measured memory_bytes: 3576
#include <iostream>
#include <vector>
#include <string.h>
#include <stack>
#include <queue>
#include <algorithm>
#include <climits>
#include <cmath>
#include <map>
#include <set>
#include <assert.h>
#define REP(i,n) for(ll i=0;i<(n);i++)
#define MOD 1000000007
#define int long long
#ifdef int
const long long INF = LLONG_MAX / 10;
#else
const int INF = 1010101010;
#endif
using namespace std;
typedef long long ll;
typedef vector<vector<ll>> mat;
typedef pair<int, int> P;
//typedef pair<double, double> P;

int N;
int l, r;

signed main()
{
    cin >> N;
    int A;
    cin >> A;
    
    cout << N * N - A << endl;
}


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

int main(){
  
  string a,b;
  cin >> a >> b;
  
  if(( (a.at(0) == b.at(2)) && (a.at(2) == b.at(0)) ) && (a.at(1) == b.at(1))){
    
    cout << "YES" << endl;
    
  }
  
  else{
    
    cout << "NO" << endl;
    
  }
  
}


Measured memory_bytes: 3600
// Charan Sriramula
 
#include<bits/stdc++.h>
using namespace std;
typedef long double ld;
typedef long long int ll;
 
const ll lg=22;
const ll N=2e5+5;
const ll M=5e8;
const ll INF=1e18;
const ll mod=1e9+7;
const double PI = 3.14159265358979323846;
 
#define is(n) scanf("%d",&n)
#define io(n) printf("%d\n",n)
#define ls(n) scanf("%lld",&n)
#define lo(n) printf("%lld\n",n)
 
#define f first
#define s second
#define pb(x) push_back(x)
#define pf(x) push_front(x)
#define mp(x,y) make_pair(x,y)
#define GCD(a,b) __gcd((a),(b))
#define all(v) v.begin(),v.end()
#define bits(x) __builtin_popcount(x)
#define LCM(a,b) ((a)*(b))/GCD((a),(b))
#define fast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
template<typename T> T power(T x,T y,ll m){T ans=1;while(y>0){if(y&1LL) ans=(ans*x)%m;y>>=1LL;x=(x*x)%m;}return ans%m;}
 
inline ll mul(ll a, ll b, ll p){ return (a * 1ll * b) % p; }
inline ll sub(ll a, ll b, ll p){ ll c = a - b; if(c < 0) c += p; return c; }
inline ll add(ll a, ll b, ll p){ ll c = a + b; if(c > p) c -= p; return c; }
 
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl

int main()
{
    ll l,r;
    cin>>l>>r;
    ll mini=INF;
    ll total=(r/2019)-((l-1)/2019);
    if(total){cout<<0<<endl;exit(0);}
    for(ll i=l;i<=r;i++)
    {
        for(ll j=i+1;j<=r;j++)
        {
            ll pro=(i*j);
            pro%=2019;
            mini=min(mini,pro);
        }
    }
    cout<<mini<<endl;
}


Measured memory_bytes: 256
# coding: utf-8

n = int(input())
a = [int(i) for i in input().split()]
total = 0

while(any(i % 2 == 0 for i in a)):
    total += sum(i % 2 == 0 for i in a)
    a = [i // 2 for i in a if i % 2 == 0]

print(total)


Measured memory_bytes: 4148
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define PI 3.141592653589793
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rrep(i, n, k) for (int i = (n); i >= (k); i--);
#define all(x) (x).begin(), (x).end()
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
template<class T>vector<T> make_vector(size_t a){return vector<T>(a);}
template<class T, class... Ts>auto make_vector(size_t a, Ts... ts){return vector<decltype(make_vector<T>(ts...))>(a, make_vector<T>(ts...));}
const int inf = 2e18;
const int mod = 1e9 + 7;

signed main() {
    string S;
    cin >> S;
    vector<vector<int>> dp(1e5 + 5, vector<int>(2, 0));
    dp[0][0] = 1;
    for (int i = 0; i < S.length(); i++) {
        if (S[i] == '0') {
            {
                dp[i + 1][0] += dp[i][0];
                dp[i + 1][1] += dp[i][1];
            }
            {
                dp[i + 1][1] += dp[i][1] * 2 % mod;
            }
        } else {
            {
                (dp[i + 1][1] += dp[i][0] + dp[i][1]) %= mod;
            }
            {
                (dp[i + 1][0] += dp[i][0] * 2) %= mod;
                (dp[i + 1][1] += dp[i][1] * 2) %= mod;
            }
        }
    }
    cout << (dp[S.length()][0] + dp[S.length()][1]) % mod << endl;
}


Measured memory_bytes: 5760
# include <bits/stdc++.h>
using namespace std;
# define ll long long
const int N = 2e5 + 10, mod = 1e9 + 7, INF = 1e9 + 100;
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
    string s, t, u;
    int a, b;
    cin >> s >> t >> a >> b >> u;
    a -= s == u;
    b -= t == u;
    cout << a << ' ' << b << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define sz(A) (int)(A.size())
#define all(x) (x).begin(),(x).end()
#define get(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
typedef long long ll;
typedef pair<int, int> PII;
typedef vector<int> VI;
vector<int> b;
int n, m, ans;
bool check(vector<vector<int> > need, int bit) {
	for (int i = 0; i < m; i++) {
		int cnt = 0;
		for (int j = 0; j < need[i].size(); j++) {
			if (bit&(1 << (need[i][j] - 1)))cnt++;
		}
		//cout << bit << " --- " << cnt << endl;
		if ((cnt & 1) == b[i]);
		else return false;
	}
	return true;
}
void solve() {
	
	cin >> n >> m;
	vector<vector<int>> need(m);
	
	rep(i, 0, m) {
		int s;
		cin >> s;
		rep(j, 0, s) {
			int t;
			cin >> t;
			need[i].push_back(t);
		}
	}
	rep(i, 0, m) {
		int t;
		cin >> t;
		b.push_back(t);
	}
	for (int bit = 0; bit < (1 << n); ++bit) {
		if (check(need, bit)) {
			ans++;
		}
	}
	cout << ans << endl;
}
int main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int T_ = 1;
	//cin >> T_;
	for (int i = 0; i < T_; i++)solve();
	return 0;
}







Measured memory_bytes: 256
import java.util.*;
import java.io.*;
import java.awt.geom.*;
import java.math.*;

public class Main {

	static final Scanner in = new Scanner(System.in);
	static final PrintWriter out = new PrintWriter(System.out,false);
	static boolean debug = false;

	static void solve() {
		int n = in.nextInt();
		int[] a = new int[n];
		for (int i=0; i<n; i++) {
			a[i] = in.nextInt();
		}
		long ans = 0;
		long carry = 0;
		for (int i=0; i<n; i++) {
			ans += (a[i]+carry)/2;
			carry = a[i] == 0 ? 0 : (a[i]+carry)%2;
		}

		long ans2 = 0;
		long carry2 = 0;
		for (int i=n-1; i>=0; i--) {
			ans2 += (a[i]+carry2)/2;
			carry2 = a[i] == 0 ? 0 : (a[i]+carry2)%2;
		}

		out.println(Math.max(ans, ans2));
	}

	public static void main(String[] args) {
		debug = args.length > 0;
		long start = System.nanoTime();

		solve();
		out.flush();

		long end = System.nanoTime();
		dump((end - start) / 1000000 + " ms");
		in.close();
		out.close();
	}

	static void dump(Object... o) { if (debug) System.err.println(Arrays.deepToString(o)); }
}

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

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i,n) {
    cin >> a.at(i);
    }
    
    int count = 0;
    int curMin = 1e9;
    rep(i,n) {
        curMin = min(curMin, a.at(i));
        if(curMin == a.at(i)) {
        count++;
        }
    }
    cout << count;
    
}

Measured memory_bytes: 4004
#define _CRT_NONSTDC_NO_WARNINGS
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <array>
#include <algorithm>
#include <list>
#include <iomanip>
#include <queue>
#include <functional>
#include <cassert>
#include <cmath>
#include <set>
#include <map>
#include <numeric>

#define NL << endl
#define REP(i,n) for(int (i) = 0; i < (n); ++(i))

using namespace std;
using ll = long long;
using ull = unsigned long long;
const int INTMAX = numeric_limits<int>::max();
const int INTMIN = numeric_limits<int>::min();
const ll LLMAX = numeric_limits<long long>::max();
const ll LLMIN = numeric_limits<long long>::min();
const int MOD = 1000000007;


int gcd(int a, int b) { return b ? gcd(b, a%b) : a; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }

using namespace std;

signed main() {
	int n;
	ll ans = 1;
	cin >> n;
	REP(i, n) {
		ll t;
		cin >> t;
		ans = t / gcd(t, ans) * ans;
	}

	cout << ans NL;

	return 0;

}



Measured memory_bytes: 256
N=int(input())
T,A=map(int,input().split())
H=list(map(int,input().split()))
good_tmp=10**9
for i in range(N):
    tmp=T-H[i]*0.006
    if good_tmp>abs(A-tmp):
        good_tmp=abs(A-tmp)
        ans=i+1
print(ans)

Measured memory_bytes: 3060
// 2014/05/20 Tazoe

#include <iostream>
#include <cstring>
using namespace std;

int main()
{
	while(true){
		char s[101];
		cin >> s;

		if(strcmp(s, "0")==0)
			break;

		int A = 0, B = 0;

		for(int i=1; s[i]!='\0'; i++){
			if(s[i]=='A'){
				A++;
			}
			else{
				B++;
			}
		}

		if(A>B){
			A++;
		}
		else{
			B++;
		}

		cout << A << ' ' << B << '\n';
	}

	return 0;
}

Measured memory_bytes: 1140
#include <bits/stdc++.h>
using namespace std;
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<MACROS>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
#define 	TIEMPO_CORRIDA		cerr << "tiempo: "<<1.0*clock()/CLOCKS_PER_SEC <<" seg.\n";
#define 	FILES				freopen("input.txt","r",stdin),freopen("output.txt","w",stdout);
#define 	FORIT(it,e)			for(it = e.begin() ; it != e.end() ; it++)
#define 	FOR(i,a,b)			for(i = a ; i < b ; i++)
#define 	RFOR(i,a,b)			for(i = a ; i >= b ;i--)
#define 	FORSW(i,a,b,sw)		for(i = a ; i < b && sw ; i++)
#define 	RFORSW(i,a,b,sw)	for(i = a ; i >= b && sw ; i--)
#define 	fast 				ios::sync_with_stdio(false),cin.tie(),cout.tie();
#define 	to_int(x) 			atoi(x.data())
#define 	to_long(x) 			atoll(x.data())
#define 	ALL(x) 				x.begin(),x.end()
#define 	RALL(x) 			x.rbegin(),x.rend()
typedef 	long long 			ll;
typedef 	pair<int,int> 		ii;
typedef 	pair<ll,ll> 		lolo;
const		int 				modN = 1e9+7;
const		double 				PI = 3.1415926535897932384626433832795028841;
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

int main(){
	int n;
	string x;
	cin >> n;
	map<string,int> m;
	while(n--){
		cin >> x;
		m[x]++;
	}
	cout<<"AC" <<" x "<< m["AC"]<<endl;
	cout<<"WA" <<" x "<< m["WA"]<<endl;
	cout<<"TLE" <<" x "<<  m["TLE"]<<endl;
	cout<<"RE" <<" x "<< m["RE"]<<endl;

	return 0;
}

Measured memory_bytes: 3632
import math

l = input().split()
# print(l)
a = int(l[0])
b = int(l[1])
ln = len(l[1])
# print(ln)

num = a*10**ln+b
# print(num)
sq = math.sqrt(num)

if math.floor(sq)**2 == num:
	print("Yes")
else:
	print("No")

Measured memory_bytes: 3060
n, x, m = map(int, input().split())

ans = []
c = [0]*m
flag = False
for i in range(n):
    if c[x] == 1:
        flag = True
        break
    ans.append(x)
    c[x] = 1
    x = x**2 % m
if flag:
    p = ans.index(x)
    l = len(ans) - p
    d, e = divmod(n-p, l)
    print(sum(ans[:p]) + d*sum(ans[p:]) + sum(ans[p:p+e]))
else:
    print(sum(ans))


Measured memory_bytes: 11956
#include <bits/stdc++.h>
#define int long long
using namespace std;

signed main() {
  int n, x = 1, y = 1;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    int A, T;
    cin >> T >> A;
    int p = max(x/T + (x%T ? 1 :0), y/A + (y%A ? 1: 0));
    x = p * T, y = p * A;
  }
  cout << x + y << endl;
}
  

Measured memory_bytes: 256
#include <cstdlib>
#include <iostream>
#include <vector>

using namespace std;

int n;
int a[20];

bool solve(int i, int tgt){
    if(tgt < 0){
        return false;
    }

    if(tgt == 0){
        return true;
    }

    if(i == n-1){
        //cout << "compare" << tgt << " : " << a[i] << endl;
        return (tgt == a[i]);
    }

    return (solve(i+1,tgt) || solve(i+1,tgt-a[i]) );
}

int main(){
    int q;
    int m[200];

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

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

    for(int i=0; i<q; i++){
        if(solve(0,m[i])){
            cout << "yes" << endl;
        }else{
            cout << "no" << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 3092
s[1<<17],t[1<<17];a,b,c;main(d){for(;d=getchar(a++)/11;)s[a+1]=s[a]+d-4;for(;d=getchar(b++)/11;)t[b+1]=t[b]+d-4;for(gets(&a);~scanf("%d%d%d%d",&a,&b,&c,&d);)puts((s[b+1]-s[a]-t[d+1]+t[c])%3?"NO":"YES");}

Measured memory_bytes: 1280
#include <iostream>
#include <bits/stdc++.h>
#include <string>
#include <math.h>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
    int r; cin>>r;
    double ans;
    ans= 2*r*3.14159;
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3784
n,k=map(int,input().split())
p=list(map(int,input().split()))
c=list(map(int,input().split()))
from collections import deque
toku=[0]*(n+1)
for i in range(1,n+1):
  ans=[0]
  d=deque()
  visit=[0]*(n+1)
  d.append(i)
  while d:
    now=d.pop()
    if visit[now]==0:
      visit[now]=1
      ans.append(ans[-1]+c[p[now-1]-1])
      d.append(p[now-1])
  syuki=sum(visit)
  if ans[-1]>=0:
    if k%syuki==0:
      toku[i]=max((k//syuki)*ans[-1],(k//syuki-1)*ans[-1]+max(ans))
      
    else:
      toku[i]=(k//syuki)*ans[-1]+max(ans[1:k%syuki+1])
  else:
    if k//syuki==0:
      toku[i]=max(ans[1:k%syuki+1])
    else:
      toku[i]=max(ans[1:])
print(max(toku[1:]))      
    


Measured memory_bytes: 91832
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.*;
import java.util.*;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;

import static java.util.stream.Collectors.*;
import static java.util.Map.Entry.*;

public class Main {

	public static void main(String[] args) throws IOException {
		FastReader in = new FastReader(System.in);
		PrintWriter out = new PrintWriter(System.out);
		int n = in.nextInt();
		int m = in.nextInt();
		int [] a = in.nextIntArray(m);
		Arrays.sort(a);
		long [] b = new long[m-1];
		for (int i = 0; i < m-1; i++) {
			b[i] = a[i+1] - a[i];
		}
		Arrays.sort(b);
		long sum = 0;
		for (int i = 0; i < b.length- (n-1); i++) {
			sum += b[i];
			
		}
		out.println(sum);;
		out.close();

	}

	static class FastReader {
		StringTokenizer st;
		BufferedReader br;

		public FastReader(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}

		public FastReader(FileReader fileReader) {
			br = new BufferedReader(fileReader);
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public int[] nextIntArray(int n) throws IOException {
			int[] ret = new int[n];
			for (int i = 0; i < n; i++) {
				ret[i] = nextInt();
			}
			return ret;
		}

		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public String nextLine() throws IOException {
			return br.readLine();
		}

		public boolean ready() throws IOException {
			return br.ready();
		}
	}

}

Measured memory_bytes: 35472
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<algorithm>
#define rep(i,x) for(int i = 0; i < x; i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> ivec;
const ll N = 1e9+7;

int main(){
    int n;cin >> n;
    vector<ll> a(n);
    rep(i,n)cin >> a[i];
    set<ll> st;
    rep(i,n){
        st.insert(a[i]);
    }
    int st_size = st.size();
    bool ok = false;
    if(st_size == 1){
        auto itr = st.begin();
        if(!*itr)ok = true;
    }
    else if(st_size == 2){
        if(n % 3 == 0){
            auto itr = st.begin();
            int count = 0;
            if(!*itr){
                rep(i,n){
                    if(a[i] == 0)count++;
                }
            }
            if(count == n/3)ok = true;
        }
    }
    else if(st_size == 3){
        if(n % 3 == 0){
            auto itr = st.begin();
            ll x,y,z;
            x = *itr;itr++;
            y = *itr;itr++;
            z = *itr;
            //cout << x << " " << y << " " << z << endl;
            int count[3] = {};
            if((x^y^z) == 0){
                ok = true;
                rep(i,n){
                    if(a[i] == x)count[0]++;
                    else if(a[i] == y)count[1]++;
                    else count[2]++;
                }
                rep(i,3){
                    if(count[i] != n/3)ok = false;
                }
            }
        }
    }
    if(ok)cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 4480