akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>

using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef vector<ll> vll;

#define PI (2*acos(0.0))
#define eps 1e-9
#define pb push_back
#define endl "\n"
#define watch(x) cout << (#x) << " is " << (x) << endl;
#define show(v) for(int fi = 0; fi < v.size(); fi++) cout << v[fi] << " "; cout << endl;
#define showpair(v) for(int fi = 0; fi < v.size(); fi++) cout << v[fi].first << " " << v[fi].second << endl;
#define ff first
#define ss second
#define fu cout << "lol" << endl;
#define precision(n) cout << fixed << setprecision(n);
#define lb lower_bound
#define up upper_bound
#define vscan for(i = 0;i<n;i++){cin>>in; v.pb(in);}
#define all(a) a.begin(), a.end()
#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c))
#define mem(a,val) memset(a,val,sizeof(a))
#define loop(i,n) for(i = 0; i < n; i++)
#define TC ull T; cin>>T; while(T--)
#define IN(x) {scanf("%d",&x);}
#define LL(x) {scanf("%lld",&x);}
#define CC(x) {scanf("%c",&x);}
#define pfl(x) printf("%d\n",x)
#define pfll(x) printf("%lld\n",x)
#define newl puts("")
#define space printf(" ")
#define MOD 1000000007
#define speed ios_base::sync_with_stdio(false); cin.tie(NULL);


int main()
{
    int i = 0, j = 0, cs = 0, in;
    int n; cin>>n;
    vll v(n);
    for(i = 0; i < n; i++) cin>>v[i];
    ll ans = 0;
    ll mx = v[0];
    for(i = 1; i < n; i++){
        ans += max(0*1LL, mx-v[i]);
        mx = max(mx, v[i]);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 4840
#include <iostream>
#include <algorithm>
#include <string.h>
#include <stdio.h>
#include <math.h>
using namespace std;
typedef long long LL;
const int inf=0x3f3f3f3f;
const int MAX=5345;
const LL llinf=1ll<<60;
int n,c[MAX],ub[MAX][MAX];
LL a,b,dp[MAX][MAX];
int main(){
    scanf("%d%lld%lld",&n,&b,&a);
    for(int i=1;i<=n;++i)scanf("%d",&c[i]);
    for(int i=0;i<=n+1;++i)ub[0][i]=inf;
    for(int i=1;i<=n;++i){
        for(int j=1;j<=n+1;++j){
            ub[i][j]=ub[i-1][j];
            if(c[i]>j&&c[i]<ub[i][j])ub[i][j]=c[i];
        }
    }
    for(int i=1;i<=n+1;++i){
        if(i<=c[1])dp[1][i]=b;
        else dp[1][i]=0;
    }
    for(int i=2;i<=n;++i){
        for(int j=1;j<=n+1;++j){
            if(j<=c[i]){
                dp[i][j]=dp[i-1][j]+b;
            }
            else if(j>c[i]&&j<=ub[i-1][c[i]]){
                dp[i][j]=dp[i-1][j];
            }
            else{
                dp[i][j]=min(dp[i-1][j]+a,dp[i-1][ub[i-1][c[i]]]);
            }
        }
    }
    LL sx5=llinf;
    /*for(int i=1;i<=n;++i){
        for(int j=1;j<=n+1;++j){
            printf("%d %d:%lld\n",i,j,dp[i][j]);
        }
    }*/
    for(int i=1;i<=n+1;++i){
        sx5=min(sx5,dp[n][i]);
    }
    printf("%lld\n",sx5);
    return 0;
}

Measured memory_bytes: 315648
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
// memo  fixed  setprecision(20);
using vvll = vector<vector<ll>>;
ll mod =1000000007;
/*"itob" int to "N"base */           template<typename TypeInt> string itob(const TypeInt v, int base){static const char table[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";string ret;static numeric_limits<TypeInt> t;TypeInt n = v;if (t.is_signed) {if (v < 0) n *= -1;}while (n >= base) {ret += table[n%base];n /= base;}ret += table[n];if (t.is_signed) {if (v < 0 && base == 10) ret += '-';}reverse(ret.begin(), ret.end());return ret;}
/*"chmin" a = MAX*/                  template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
/*"chmax" a = MIN*/                  template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
/*"ctoi"  char to int*/              int ctoi(char c) {return c-'0';}
/*"gcd"   MAX*/                      int gcd(ll a,ll b){return b?gcd(b,a%b):a;}
/*"lcm"   MIN*/                      int lcm(ll a,ll b){return a*b/gcd(a,b);}
/*"primecheck"If prime,return true.*/bool primecheck(ll n){if(n < 2) return false;else{for(int i = 2; i * i <= n; i++){if(n % i == 0) return false;}return true;}}
string  reverserange(string s,ll a,ll b){reverse(s.begin()+a-1,s.begin()+b); return s;}

int main(){
    int n,m;
    cin >> n >> m;
    ll ans = 0;
    if(n>=2){
        ll che = n*(n-1)/2;
        ans+=che;
    }
    if(m>=2){
        ll che = m*(m-1)/2;
        ans+=che;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
//g++ -std=c++11 

using namespace std;
typedef long long ll;

#define rep(i,n) for (long long i = 0; i < (n); ++i)
#define DIV 1000000007 //10^9+7

int main(){
	string S;
	cin >> S;
	if(S[S.size() - 1] == 's') {
		cout << S << "es" << endl;
	} else {
		cout << S << "s" << endl;
	}

}


Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
// memo  fixed  setprecision(20);
using vvll = vector<vector<ll>>;
ll mod =1e9+7;
/*"itob" int to "N"base */           template<typename TypeInt> string itob(const TypeInt v, int base){static const char table[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";string ret;static numeric_limits<TypeInt> t;TypeInt n = v;if (t.is_signed) {if (v < 0) n *= -1;}while (n >= base) {ret += table[n%base];n /= base;}ret += table[n];if (t.is_signed) {if (v < 0 && base == 10) ret += '-';}reverse(ret.begin(), ret.end());return ret;}
/*"chmin" a = MAX*/                  template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
/*"chmax" a = MIN*/                  template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
/*"ctoi"  char to int*/              int ctoi(char c) {return c-'0';}
/*"gcd"   MAX Euclidean */           ll gcd(ll a,ll b){if(b==0)return a; return gcd(b,a%b);}
    /*"lcm"   MIN*/                      ll lcm(ll a,ll b){ll g = gcd(a,b);return a/g*b;}
/*"primecheck"If prime,return true.*/bool primecheck(ll n){if(n < 2) return false;else{for(int i = 2; i * i <= n; i++){if(n % i == 0) return false;}return true;}}
string  reverserange(string s,ll a,ll b){reverse(s.begin()+a-1,s.begin()+b); return s;}
ll modpow(ll a,ll n, ll mod){ll res = 1;while(n>0){if (n%2==1){res = res * a % mod;}a = a * a % mod;n/=2;}return res;}
int main() {
    ll n;
    cin >> n;
    ll ans =0;
        for(ll i=2;i*i<=n;i++){
            int x=0;
            while(n%i==0){
                x++;
                n/=i;
            }
            int che =1;
        while(che<=x){
            ans++;
            x-=che;
            che++;
        }
        }
        if(n!=1)ans++;
    cout<<ans<<endl;
}
    



Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, o, n) for (auto i = (o); (i) < (n); ++(i))
#define REP(i, n) FOR(i, 0, n)
#define REPR(i, n) for (auto i = (n)-1; (i) >= 0; --i)
#define REPI(itr, v) for (auto itr = v.begin(); itr != v.end(); ++itr)
#define REPIR(itr, v) for (auto itr = v.rbegin(); itr != v.rend(); ++itr)
#define fi first
#define se second
#define ll long long
#define V2(name, h, w) vector<vector<int> > name((h), vector<int>(w));
int main(){
	string S, T; cin >> S >> T;
	sort(S.begin(), S.end());
	sort(T.begin(), T.end()); reverse(T.begin(), T.end());

	cout << (S < T ? "Yes" : "No") << endl;
}


Measured memory_bytes: 256
// Problem : B. Ternary Sequence
// Contest : Codeforces - Codeforces Round #665 (Div. 2)
// URL : https://codeforces.com/contest/1401/problem/B
// Memory Limit : 256 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

// 私に忍び寄るのをやめてください、ありがとう

#include<bits/stdc++.h>
using namespace std;
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define ll long long
#define int long long
#define mod 1000000007 //998244353
#define fast  ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define f(i,n) for(ll i=0;i<n;i++)
#define fore(i, a, b) for (ll i = (ll)(a); i <= (ll)(b); ++i)
#define nl "\n"
#define trace(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 x first
#define y second
#define vc vector
#define pb push_back
#define ar array
#define all(a) (a).begin(), (a).end()
#define ms(v,n,x) fill(v,v+n,x);
#define init(c,a) memset(c,a,sizeof(c))
#define pll pair<ll,ll>
#define mll map<ll,ll>
#define sll set<ll>
#define vll vector<ll>
#define vpll vector<pll>
#define inf 9e18
#define cases ll T;cin>>T;while(T--)
#define BLOCK 500
//const double PI = 3.141592653589793238460;
template<typename T> bool mmax(T &m, const T q) { if (m < q) {m = q; return true;} else return false; }
template<typename T> bool mmin(T &m, const T q) { if (m > q) {m = q; return true;} else return false; }
typedef std::complex<double> Complex;
typedef std::valarray<Complex> CArray;
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
// void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << t"[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

mt19937_64 rng(chrono::high_resolution_clock::now().time_since_epoch().count());

const int N=1<<20;

int32_t main()
{
    
	fast	

	ll n,x,t;
	cin>>n>>x>>t;

	ll d=(n+x-1)/x;
	cout<<t*d;
    

	return 0;
    
}

Measured memory_bytes: 3648
import sys
sys.setrecursionlimit(10**7)
INTMAX = 9223372036854775807
INTMIN = -9223372036854775808
DVSR = 1000000007
def POW(x, y): return pow(x, y, DVSR)
def INV(x, d=DVSR): return pow(x, d - 2, d)
def DIV(x, y, d=DVSR): return (x * INV(y, d)) % d
def LI(): return [int(x) for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LS(): return input().split()
def II(): return int(input())
    
L,R=LI()

if R-L >= 2019:
    print(0)
else:
    res = 3000
    for i in range(L, R+1):
        for j in range(i+1, R+1):
            res = min(i*j%2019, res)
    print(res)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define ALL(A) (A).begin(), (A).end()
#define ll long long
#define rep(i, n) for (int i = 0; i < (n); i++)

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

int dx[] = { 0, 1, -1, 0, 1, -1, 1, -1 };  // i<4:4way i<8:8way
int dy[] = { 1, 0, 0, -1, 1, -1, -1, 1 };

const ll mod = 1e9 + 7;
const ll INF = -1 * ((1LL << 63) + 1);
const int inf = -1 * ((1 << 31) + 1);

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    ll n,a,b;
    cin >> n >> a >> b;
    cout << (n/(a+b) * a) + (min(n%(a+b),a))  << endl;
}

Measured memory_bytes: 256
from sys import stdin

H, W, A, B = [int(x) for x in stdin.readline().rstrip().split()]

ans_top = [[1] * (W - A) + [0] * A for _ in range(H - B)]
ans_bottom = [[0] * (W - A) + [1] * A for _ in range(B)]
ans = ans_top + ans_bottom
for a in ans:
    print(*a, sep="")


Measured memory_bytes: 78556
#include <iostream>
#define N_MAX 101
#define M 1001
using namespace std;
int N,R,T,p[N_MAX],c[M],pos[N_MAX],a[M][M],ans;

int main(){
  cin>>N>>R>>T;
  for(int i=0;i<N;i++) cin>>p[i];
  for(int i=0;i<N;i++) pos[i]=p[i]%R;
  while(T--){
    for(int i=0;i<N;i++){
      if(c[pos[i]]) c[pos[i]]--;
      else ans++;
      int t=(pos[i]+p[i])%R;
      pos[i]=t;
      if(T) a[T-1][t]++;
    }
    for(int i=0;i<R;i++) c[i]+=a[T][i];
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 5072
#include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <string>
#include <map>
#include <algorithm>
using namespace std;


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

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

	bool flag = true;;
	for(int k=1;k<n;k++){
		if(v[k] < v[k-1]){
			flag = false;
		}
	}
	if(flag){
		cout << "YES" << endl;
		return 0;
	}

	for(int i=0;i<n;i++){
		for(int j=i+1;j<n;j++){
			swap(v[i], v[j]);
			bool flag = true;
			for(int k=1;k<n;k++){
				if(v[k] < v[k-1]){
					flag = false;
				}
			}
			if(flag){
				cout << "YES" << endl;
				return 0;
			}
			swap(v[i], v[j]);
		}
	}
	cout << "NO" << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<tuple>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<deque>
#include<cmath>
#include<stack>
#include<string.h>
#include <iomanip>
#define rep(i,n) for(int i = 0;i<n;i++)
#define _GLIBCXX_DEBUG
using ll = long long; 
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main() {
    int n;
    cin >> n;
    vector<ll> a(n);
    rep(i,n) cin >> a[i];
    map<int,int>mp;
    rep(i,n) {
        mp[a[i]]++;
    }
    bool ans = true;
    for(pair<int,int>p:mp) {
        if(p.second > 1) ans = false;
    }
    if(ans) cout << "YES" << endl;
    else cout << "NO" << endl;
}

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

using namespace std;

int main(){
  char str[100];
  cin>>str;
  int l=strlen(str);
  int flag=1;
  for(int i=0,j=0;i<l/2;i++,j++){
    if(str[i]!=str[l-1-i]){
      	flag=0;
      	break;
  		}
    else{
      if(j<l/4 && str[j]!=str[l/2-1-j]){
		flag=0;
        break;
    	}
	}
}
    if(flag)
      cout<<"Yes";
  	else
      cout<<"No";
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;

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

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

// Self settings
// clang-format off
#define MAX_N 100000
#define REP(i, N) for (int i = 0; i < (int)(N); ++i)
#define SLN(i,N) (i == N-1 ? "\n" : " ")
ll fact(ll n) { ll res = 1; for(ll i=2;i<=n;++i) res = res * i; return res;}
ll nCr(ll n, ll r) {return (fact(n)/fact(n-r)*fact(r)) ;}
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
const ll MOD = 1e9+7;
const ll INF = 1LL << 60;
const int inf = 1 << 30;
// clang-format on

int N, M;
int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> N >> M;
  vector<int> p(M);
  vector<string> S(M);
  REP(i, M) cin >> p[i] >> S[i];

  map<int, bool> ans;
  map<int, int> wrong;
  for (int i = 0; i < M; i++) {
    if (ans.count(p[i]) == 0) ans[p[i]] = (S[i] == "AC");
    ans[p[i]] |= S[i] == "AC";
    if (!ans[p[i]] && S[i] == "WA") wrong[p[i]]++;
  }

  int ansum = 0;
  for (auto a : ans)
    if (a.second) ansum++;
  int wrongsum = 0;
  for (auto a : ans) {
    if (a.second) {
      if (wrong.count(a.first) > 0) wrongsum += wrong[a.first];
    }
  }

  cout << ansum << " " << wrongsum << endl;

  return 0;
}


Measured memory_bytes: 11904
package main

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

var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	sc.Split(bufio.ScanWords)
	n := nextInt()

	xs := make([]int, n)
	for i := range xs {
		xs[i] = nextInt()
	}

	ys := make([]int, n)
	copy(ys, xs)
	sort.Ints(ys)
	mid1 := ys[len(ys)/2-1]
	mid2 := ys[len(ys)/2]

	for _, x := range xs {
		if x <= mid1 {
			fmt.Println(mid2)
		} else {
			fmt.Println(mid1)
		}
	}
}


Measured memory_bytes: 8192
#include<bits/stdc++.h>
//cervello|Phoenix
using namespace std;
#define ll long long int
#define eb emplace_back
#define mk make_pair
#define all(x) x.begin(),x.end()
#define mod 1000000007

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  ll n, x, t; cin>>n>>x>>t;
  if(n%x==0)
    cout<<(n/x)*t<<"\n";
  else
    cout<<((n/x)+1)*t<<"\n";
  return 0;
}

Measured memory_bytes: 3632
<?php
fscanf(STDIN,'%d%d%d',$A,$B,$C);
$judge=0;
$D=0;
for ($i=1; $i <=$B+1 ; $i++) {
  // code...
  $D=$A*$i;
  if($D%$B==$C){
    $judge=1;
    break;
  }
}
if($judge==1){
  echo 'YES';
}else {
  echo "NO";
}

 ?>


Measured memory_bytes: 3700
N,Y = map(int,input().split())
hantei = 0
for i in range(N+1):
  for j in range(N-i+1):
    if Y==i*10000+j*5000+(N-i-j)*1000 and N-i-j>=0:
      ans=[i,j,N-i-j]
      hantei +=1
if hantei == 0:
  print('-1 -1 -1')
else:
  print(ans[0],ans[1],ans[2])

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<(n);++i)
#define sayyes cout<<"Yes"<<endl;
#define sayno cout<<"No"<<endl;
using namespace std;
typedef long long ll;
const double PI=acos(-1);
typedef pair<int,int>P;
const int mod =1e9+7;

int main()
{
    int ans=0;
    int ansc=0;
    int n;
    cin>>n;
    if(n==1)
    {
        cout<<1<<endl;
        return 0;
    }
    for(int i=1;i<=n;i++)
    {
        int x=i;
        int c=0;
        while(x%2==0)
        {
            x/=2;
            c++;
        }
        if(ansc<c)
        {
            ansc=c;
            ans=i;
        }
    }
    cout<<ans<<endl;
}


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

typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;
const int INF = 1 << 27;
const ll LLINF = (ll)1 << 60;
const ll MOD = 1e9+7;

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

int main() {
  int n;
  scanf("%d", &n);
  vector<T> blocks;
  for (int i = 0; i < n; i++) {
    int w, s, v;
    scanf("%d %d %d", &w, &s, &v);
    blocks.emplace_back(s, w, v);
  }

  sort(blocks.begin(), blocks.end(), [](T& t1, T& t2) {return get<0>(t1) + get<1>(t1) < get<0>(t2) + get<1>(t2);});

  const int MAXS = 2e4+10;
  vector<ll> dp(MAXS, 0);
  for (int s = get<1>(blocks[0]); s < MAXS; s++) {
    dp[s] = get<2>(blocks[0]);
  }
  for (int i = 1; i < n; i++) {
    auto& block = blocks[i];
    int slimit = get<0>(block);
    int w = get<1>(block), v = get<2>(block);
    for (int s = MAXS - 1; s >= w; s--) {
      dp[s] = max(dp[s], v + dp[min(s - w, slimit)]);
    }
  }

  printf("%lld\n", dp[MAXS - 1]);
}


Measured memory_bytes: 384
N = int(input())
S = input()

table = [0] * (len(S)+1)
wordDict = {}

for i in range(len(S)):
  if S[i] in wordDict :
    wordDict[S[i]] = [wordDict[S[i]][0], i]
  else:
    wordDict[S[i]] = [i+1, i]

for ran in wordDict.values():
  if ran[0] > ran[1]:
    continue
  for i in range(ran[0], ran[1]+1):
    table[i] += 1

maxNum = 0
for i in range(len(S)+1):
  maxNum = max(maxNum, table[i])

print(maxNum)
  




Measured memory_bytes: 63900
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
template<class T> inline bool chmax(T &a, T b) {
        if(a<b) {
                a=b;
                return 1;
        }
        return 0;
}

int main() {
        int n,w; cin >> n >> w;
        vector<vector<ll>> goods(n,vector<ll>(2));
        for(int i=0; i<n; i++) {
          for(int j=0; j<2; j++) cin >> goods[i][j];
        }
        vector<vector<ll>> dp(n+1,vector<ll>(w+1,0));
        for(int i=1; i<=n; i++) {
          for(int j=0; j<=w; j++) {
            // i個目を選ばない
            chmax(dp[i][j], dp[i-1][j]);
            if(j>=goods[i-1][0]) chmax(dp[i][j], dp[i-1][j-goods[i-1][0]]+goods[i-1][1]);
          }
        }
        cout << dp[n][w] << endl;
}


Measured memory_bytes: 80256
#define _USE_MATH_DEFINES
#include  <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <string>
#include<math.h>
#include<iomanip>
#include<stdio.h>
#include <stdlib.h>
#include<stdio.h>
#include <queue>
#include<map>
#include <sstream>
#include<set>
#include<stack>
 
//#include<bits/stdc++.h>
 
 
using namespace std;
 
 
 
int main()
{
    int n;
  cin>>n;
  int a=n%10;
  if(a==3)cout<<"bon"<<endl;
  else if(a==0||a==1||a==6||a==8)cout<<"pon"<<endl;
  else cout<<"hon"<<endl;
    return 0;
 
}

Measured memory_bytes: 3612
import heapq
class Graph:
    #def __init__(self, N, adj):
    def __init__(self, N):
        self.number_of_node = N
        self.neighbour_list = [[] for _ in range (N)]
        #self.adj = adj

    def connect(self, from_node, to_node, weight):
        """
        from_nodeからto_nodeに長さweightの辺を追加する
        """
        self.neighbour_list[from_node].append((to_node, weight))
        #self.adj[from_node][to_node] = weight

    def dijkstra(self, source_node, target_node = None):
        """
        source_nodeからtarget_nodeへの最短路計算
        source_nodeの入次数は0と仮定する
        """
        INF = -1
        dist = [INF] * self.number_of_node
        #prev = [-1] * self.number_of_node
        dist[source_node] = 0
        hq = []
        heapq.heappush(hq, (0, source_node))
        while len(hq) > 0:
            d, from_node = heapq.heappop(hq)
            if dist[from_node] < d:
                continue
            #for to_node in range(self.number_of_node):
            for to_node, weight in self.neighbour_list[from_node]:
                """
                weight = adj[from_node][to_node]
                # 辺がないところはスキップ
                if weight < 0:
                    continue
                """
                if dist[to_node] == INF or dist[from_node] + weight < dist[to_node]:
                    dist[to_node] = dist[from_node] + weight
                    heapq.heappush(hq, (dist[to_node], to_node))
                    #prev[to_node] = from_node
        if target_node is None:
            return dist
        else:
            return dist[target_node]

V, E, r = map(int, input().strip().split())
graph = Graph(V)
#adj = [[-1 for _ in range(V)] for _ in range(V)]
for i in range(E):
    s, t, d = map(int, input().strip().split())
    graph.connect(s,t,d)
    #adj[s][t] = d
#graph = Graph(V, adj)
dist = graph.dijkstra(r)
for d in dist:
    if d == -1:
        print("INF")
    else:
        print(d)



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

void solve(std::istream &in, std::ostream &out);

int main() {
#ifdef LOCAL
  freopen("../IO/f.in", "r", stdin);
//  freopen("../IO/f.out", "w", stdout);
#else
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(nullptr);
  std::cout.tie(nullptr);
#endif
  solve(std::cin, std::cout);
  return 0;
}

constexpr int N = 1000'0225;
char buff[N];

void solve(std::istream &in, std::ostream &out) {
  int n;
  in >> n;
  vector<pair<int, int>> pos, neg;
  for (int i = 0; i < n; ++i) {
    in >> buff;
    int len = strlen(buff);
    int mn = 0, bal = 0;
    for (int j = 0; j < len; ++j) {
      if (buff[j] == '(') {
        ++bal;
      } else {
        --bal;
      }
      mn = min(mn, bal);
    }
    if (bal >= 0) {
      pos.emplace_back(-mn, bal);
    } else {
      neg.emplace_back(-mn, bal);
    }
  }
  int bal = 0;
  sort(pos.begin(), pos.end());
  sort(neg.begin(), neg.end(), [&](auto lhs, auto rhs) {
    return lhs.first + lhs.second > rhs.first + rhs.second;
  });
  bool bad = false;
  for (auto p : pos) {
    bad |= bal < p.first;
    bal += p.second;
  }
  for (auto p : neg) {
    bad |= bal < p.first;
    bal += p.second;
  }
  if (bad || bal) {
    out << "No\n";
  } else {
    out << "Yes\n";
  }
}


Measured memory_bytes: 11232
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
map<string,int>mp;
int main() {
	int q;
	cin >> q;
	while (q--) {
		int Q;
		cin >> Q;
		string s;
		int x;
		switch (Q) {
		case 0:
			cin >> s >> x;
			mp[s] = x;
			break;
		case 1:
			cin >> s;
			cout << mp[s] << endl;
			break;
		}
	}
	return 0;
}


Measured memory_bytes: 27768
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main(void){
    char ch[200],fch[200],bch[200];
    int n,i,cn=0;
    for(i=0;i<200;i++){
        ch[i]=0;
        fch[i]=0;
        bch[i]=0;
    }
    scanf("%s",ch);
    n=strlen(ch);
    for(i=0;i<n/2;i++){
        fch[i]=ch[i];
    }
    i++;
    for(;i<n;i++){
        bch[cn]=ch[i];
        cn++;
    }
    if(strcmp(bch,fch)==0){
        printf("Yes\n");
    }else{
        printf("No\n");
    }
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
// #include <boost/multiprecision/cpp_int.hpp> 

#define gc getchar//_unlocked
#define pc putchar//_unlocked
#define ll long long
#define ld long double
#define pb push_back
#define mp make_pair
#define pp pair<int,int>
#define ppl pair<ll,ll>
#define bigint boost::multiprecision::cpp_int
#define finp ios_base::sync_with_stdio(0);cin.tie(0);
#define bc __builtin_popcountll
#define afor(i,a,b) for(int i=a;i<=b;++i)
#define bfor(i,a,b) for(int i=a;i>=b;--i)
#define vi vector<int>
#define vpp vector<pp>
#define vll vector<ll>

using namespace std;
using namespace __gnu_pbds;

char putnb[20];
void putn(ll n) {if(!n)pc('0');if(n<0)pc('-'),n=0-n;int pi=0;while(n)putnb[pi++]=(n%10)+'0',n/=10;while(pi)pc(putnb[--pi]);}
void sci(int *x) {register char c = gc();*x = 0;for(; (c<48)||(c>57);c = gc());for(; (c>47)&&(c<58);c = gc())*x = (int)((((*x)<<1) + ((*x)<<3)) + c - 48);}
void scll(ll *x)  {register char c = gc();*x = 0;for(; (c<48)||(c>57);c = gc());for(; (c>47)&&(c<58);c = gc())*x =  (ll)((((*x)<<1) + ((*x)<<3)) + c - 48);}
ll fp(ll a,ll b,ll c) {if(b==0)return 1%c; if(b==1)return a%c; ll ret=fp(a,b/2,c); ret=(ret*ret)%c; if(b&1)ret=(ret*a)%c; return ret;}

const ll mod=1e9 +7;
const ll mod2=1999999973;
const ll inf=1e18;
const int infs=1e9 + 1000;
const int N=200000;
const long double PI = acos(-1);

template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

ll n;
ll A[N+5];
ll dp[55][N+5];
ll DP[N+5];
ll aux[N+5];
ll ans;

ll minv(ll i,ll j)
{
  ll len = j - i + 1;
  return min(dp[aux[len]][j],dp[aux[len]][i + (1 << aux[len]) - 1]);
}
int main()
{
  afor(i,2,N)
  {
    aux[i] = aux[i/2] + 1;
  }
  finp;
  cin>>n;
  afor(i,1,n)
  {
    cin>>A[i];
    dp[0][i] = A[i];
    afor(j,1,20)
    {
      dp[j][i] = dp[j-1][i];
      int px = i - (1 << (j-1));
      if(px >= 1)dp[j][i] = min(dp[j][i],dp[j-1][px]);
    }
  }

  DP[1] = A[1];
  ans = DP[1];

  afor(i,2,n)
  {

    int low = 1;
    int high = i-1;

    while(low < high)
    {
      if(low+1 == high)
      {
        if(minv(low,i-1) <= A[i])low=high;
        break;
      }
      int mid = (low + high)/2;
      if(minv(mid,i-1) <= A[i])low = mid+1;
      else high = mid;
    }

    if(minv(low,i-1) <= A[i])DP[i] = A[i] + DP[i-1];
    else DP[i] = DP[low-1] + A[i]*(i - low + 1);
    ans+=DP[i];
  }

  cout<<ans;
  
return 0;
}

Measured memory_bytes: 37760
#include <bits/stdc++.h>
#include <algorithm>
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define ll long long 
#define pb push_back
#define mk make_pair
#define mod 1000000007
#define endl "\n"
using namespace std;

ll gcd(ll a, ll b){
    return __gcd(a,b);
}

ll lcm(ll a, ll b){
    return (a*b)/gcd(a,b);
}

bool isPrime(ll n){
    if(n <= 1) return false;
    for(ll i=2; i<=sqrt(n); i++){
        if(n%i == 0){
            return false;
        }
    }
    return true;
}

void solve(){
    ll n;
    cin >> n;
    ll a=0,b=0,c=0,d=0;
    string s;
    while(n--){
        cin >> s;
        if(s=="AC") a++;
        else if(s=="WA") b++;
        else if(s=="TLE") c++;
        else d++;
    }
    cout << "AC x " << a << endl;
    cout << "WA x " << b << endl;
    cout << "TLE x " << c << endl;
    cout << "RE x " << d << endl;
}

int main() {
    fast;
    solve();
	//ll t; cin >> t; while(t--){ solve(); }
	return 0;
}

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

// a quote from http://www.igaris.com/math/c.pdf

#define MOD (1000000000+7)

long long C[1001*2][1001*2];

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

	// Pascal's triangle for combination
	C[0][0] = 1;
	for( int i = 1; i < 1001*2; i++ ) {
		for( int j = 0; j <= i; j++ ) {
			if( j == 0 || j == i ) {
				C[i][j] = C[i - 1][0];
			}
			else {
				C[i][j] = ( C[i - 1][j - 1] + C[i - 1][j] ) % MOD;
			}
		}
	}
	long long ans = C[n + k - 1][n];

	cout << ans << endl;

	return 0;
}



Measured memory_bytes: 25764
#include<bits/stdc++.h>
constexpr int MAXN = 1e5 + 5;
constexpr long long M = 998244353;
constexpr double EPS = 1e-7;
using namespace std;
template <typename T> inline void read(T &x) {
    int f = 1; x = 0;
    char ch = getchar();
    while (!isdigit(ch)) ch = getchar();
    while (isdigit(ch)) x = x * 10 + ch - 48, ch = getchar();
    x *= f;
}
struct segTree {
    using Node = segTree *;
    Node lson, rson;
    int l, r;
    long long mul;
}Tree[MAXN << 1];
using LL = long long;
LL a, b, c;
int main() {
    //freopen("test.in", "r", stdin);
    vector<int> vec{999, 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    std::ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
    //sort (vec.begin(), vec.end());
    cin >> a >> b >> c;
    long long tmp = c - a - b;
    long long tmp2 = abs(c - a - b);
    if (tmp <= 0) cout << "No" << endl;
    else if (4LL * a * b < tmp * tmp) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

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

int main(){
	int a, b;
	int m, n, r;
	while(cin >> a >> b){
		m = max(a, b);
		n = min(a, b);
		r = m % n;

		while(r != 0){
			m = n;
			n = r;
			r = m % n;
		}

		cout << n << ' ' << min(a,b)*(max(a,b)/n) << endl;
	}

	return(0);
}

Measured memory_bytes: 1160
from collections import deque
from bisect import bisect_right

n, d, a = map(int, input().split())
xh = [tuple(map(int, input().split())) for _ in range(n)]
xh.sort()
x, h = zip(*xh)
h = list(map(lambda x: -(-x//a), h))

s = [0] * (n+1)
ans = 0

for i in range(n):
    add = max(0, h[i] - s[i])
    j = bisect_right(x, x[i]+d*2)
    if j < n: s[j] -= add
    s[i] += add
    ans += add
    s[i+1] += s[i]

print(ans)


Measured memory_bytes: 47848
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int a,b;
    cin >> a >> b;

    string s;
    
    for (size_t i = 0; i < max(a,b); i++)
    {
        s += to_string(min(a,b));
    }
    
    cout << s << endl;
  
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
char start[5]={'M','A','R','C','H'};
ll counter[5];
int main(){
	int n;
	cin>>n;
	while(n--){
		string s;
		cin>>s;
		for(int i=0; i<5; i++){
			if(s[0]==start[i]){
				counter[i]++;
				break;
			}
		}
	}
	ll ret = 0;
	for(int i=0; i<5; i++){
		for(int j=i+1; j<5; j++){
			for(int k=j+1; k<5; k++) ret+=counter[i]*counter[j]*counter[k];
		}
	}
	cout<<ret;
}

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

using namespace std;

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

using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vvvl = vector<vvl>;
using vd = vector<double>;
using vvd = vector<vd>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vs = vector<string>;

const int INF = (1 << 30) - 1;
const ll INF64 = ((ll)1 << 62) - 1;
const double PI = 3.1415926535897932384626433832795;

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

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

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

	int x, y, z;
	cin >> x >> y >> z;

	int res = 0;
	int chair = x - z;
	while (chair - (y + z) >= 0) {
		chair -= y + z;
		res++;
	}

	cout << res << endl;
	return 0;
}


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


int main() {

    string s;
    cin >> s;
    int cnt = 0;
    rep(i, 3) {
        if (s[i] == 'o') ++cnt;
    }
    if (cnt == 3) cout << 1000 << endl;
    else if (cnt == 2) cout << 900 << endl;
    else if (cnt == 1) cout << 800 << endl;
    else cout << 700 << endl;
    return 0;
}

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

int main() {
  int x, y, k;
  cin >> x >> y >> k;
  vector<string> sb(x);
  vector<vector<int>> ans(x,vector<int>(y,0));
  int cutnum = 0;
  int fb = x;
  string noberry;
  for (int i = 0; i < y; i++) noberry += '.';
  for (int i = 0; i < x; i++) {
    cin >> sb[i];
    if (sb[i] == noberry) continue;
    cutnum += 1;
    bool b = true;
    fb = min(i,fb);
    for (int j = 0; j < y; j++) {
      if (!b && sb[i][j] == '#') cutnum += 1;
      if (b && sb[i][j] == '#') b = false;
      ans[i][j] = cutnum;
    }
  }
  
  for (int i = 0; i < x; i++) {
    if (i < fb) ans[i] = ans[fb];
    if (ans[i][0] == 0) ans[i] = ans[i-1];
  }
  
  for (int i = 0; i < x; i++) {
    for (int j = 0; j < y; j++) {
      cout << ans[i][j] << (j == y-1 ? "\n" : " ");
    }
  }
}

Measured memory_bytes: 1280
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
	Scanner scan = new Scanner(System.in);
	int a = scan.nextInt();
	int b = scan.nextInt();
	int c = scan.nextInt();
	
	if(a<b&&b<c){
		System.out.println("Yes");
	}else{
		System.out.println("No");
	}

	}

}

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

#define rep(i, n) REP(i, 0, n)
#define REP(i, x, n) for (int i = x; i < n; i++)
#define REP2(i, x, n) for (int i = x; i <= n; i++)
#define OP(x) cout << x << endl;
typedef long long ll;

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

    string rev = s;
    reverse(rev.begin(), rev.end());
    if(rev != s){
        cout << "No" << endl;
        return 0;
    }

    int n = s.length();
    int i = n / 2;
    string si1 = s.substr(0, i);
    string rev1 = si1;
    reverse(rev1.begin(), rev1.end());
    if(rev1 != si1){
        cout << "No" << endl;
        return 0;
    }

    int j = (n + 3) / 2 - 1;
    string sjn = s.substr(j, n - 1);
    string rev2 = sjn;
    reverse(rev2.begin(), rev2.end());
    if(rev2 != sjn){
        cout << "No" << endl;
        return 0;
    }

    OP("Yes");
}


Measured memory_bytes: 256
import Control.Arrow (second)
import Data.List (foldl')
import qualified Data.Set as S
import qualified Data.Vector.Unboxed as V
import qualified Data.ByteString.Char8 as B

solve :: B.ByteString -> Int -> B.ByteString
solve s k = S.toAscList go !! (k-1) where
  go = foldr (flip go') S.empty [1..k]
  go' arg p = foldr (flip go'') arg [0..max (B.length s - p) 0] where
    go'' substrs i
      | S.size substrs < k || sub < (S.toAscList substrs) !! (k-1) = S.insert sub substrs
      | otherwise = substrs
      where
        sub = B.take p $ B.drop i s

main = do
  s <- B.getLine
  k <- (fst . (\(Just x) -> x) . B.readInt) <$> B.getLine
  B.putStrLn $ solve s k



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

int main(){
    ll n; cin>>n;
    unsigned long long odd=0,even=0,sum=0;
    rep(i,n){
        ll a;
        cin>>a;
        if(a%2==0){
            odd++;//偶数
        }else{
            even++;//奇数
        }
        sum+=a;
    }
    /*
    bool ok;
    if(odd%2!=0 && even%2==0){
        ok=true;
    }else if(odd%2==0 && even%2!=0){
        ok=false;
    }
    if(ok) cout<<"YES\n"; 
    else cout<<"NO\n"; 
    */
    if(sum%2==0) cout<<"YES\n";
    else if(sum%2!=0) cout<<"NO\n";
}

Measured memory_bytes: 3636
#!/user/bin/env python3
# -*- conding: utf-8 -*-

def main():
    N, M = map(int, input().split())

    ee = N * (N-1) / 2
    oo = M * (M-1) / 2

    print(int(ee + oo))



if __name__ == '__main__':
    main()

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

using namespace std;

#define TEMP_T template<typename T>
TEMP_T void sort(T& v){ sort(v.begin(), v.end()); }
TEMP_T void revs(T& v){ reverse(v.begin(), v.end()); }
TEMP_T void uniq(T& v){ sort(v); v.erase(unique(v.begin(), v.end())); }
TEMP_T T    cums(T& v){ T r(v.size()); partial_sum(v.begin(), v.end(), r); return r; }
TEMP_T void show(T& v, char delim=' ', char end='\n'){ for(int i=0; i<v.size()-1; i++) cout << v[i] << delim; cout << v[v.size()-1] << end; }
TEMP_T T    acum(vector<T>& v, T b=0){ return accumulate(v.begin(), v.end(), b); }
TEMP_T vector<T> inpt(int n){ vector<T> v(n); for (int i=0; i<n; i++) cin >> v[i]; return v; }

static inline int in(){ int x; scanf("%d", &x); return x; }

struct Solver {
  Solver(){}
  int solve(){
  }
};

int main()
{
  int n = in();
  for (int i = 0; i < n; i++){
    int s = in();
    vector<int> vs = inpt<int>(s);
    vector<int> dvs;
    for (int j = 1; j < s; j++){
      dvs.push_back(vs[j] - vs[j - 1]);
    }
    sort(dvs);
    int mini = min(0, dvs[0]);
    int maxi = max(0, dvs[s - 2]);
    printf("%d %d\n", maxi, -mini);
  }
  return (0);
}

Measured memory_bytes: 1252
fn main() {
    let mut input = String::new();
    std::io::stdin().read_line(&mut input).unwrap();

    let mut n = input.trim().parse::<i32>().unwrap();

    let mut answer = String::new();
    loop {
        let div: i32;
        let amari: i32;

        if n > 0 {
            div = n / -2;
            amari = n % -2;
        } else {
            if n % -2 == 0 {
                div = n / -2;
                amari = n % -2;
            } else {
                div = n / -2 + 1;
                amari = 1;
            }
        }

        // eprintln!("div = {}, amari = {}", div, amari);

        answer.insert(0, match amari {
            0 => '0',
            1 => '1',
            _ => panic!(),
        });
        if div != 0 {
            n = div;
        } else {
            break;
        }
    }

    if answer.len() != 1 {
        answer = answer.trim_left_matches('0').to_string();
    }
    println!("{}", answer);
}


Measured memory_bytes: 4352
#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <cstdio>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <cstdlib>
#include <stack>
#include <vector>
#define INF 0x3f3f3f3f
typedef long long ll;

using namespace std;
char a[10];
int main()
{
    scanf("%s", a);
    int len = strlen(a);
    int sum = 0;
    for(int i = 0; i < len; i++)
    if(a[i] == '1')sum++;
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  long long N;
  cin >> N;
  vector<int> fc;
  for (long long i = 2; i * i < N; i++){
    if (N % i == 0){
      int cnt = 0;
      while (N % i == 0){
        cnt++;
        N /= i;
      }
      fc.push_back(cnt);
    }
  }
  if (N != 1){
    fc.push_back(1);
  }
  int M = fc.size();
  int ans = 0;
  for (int i = 0; i < M; i++){
    int t = 0;
    int f = 10000;
    while (f - t > 1){
      int m = (f + t) / 2;
      if (m * (m + 1) / 2 <= fc[i]){
        t = m;
      } else {
        f = m;
      }
    }
    ans += t;
  }
  cout << ans << endl;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vc = vector<char>;
using vs = vector<string>;
using vll = vector<long long>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using vvll = vector<vector<long long>>;
template<class T> inline bool chmax(T &a, T b) { if (a<b) {a=b; return 1;} return 0;}
template<class T> inline bool chmin(T &a, T b) { if (b<a) {a=b; return 1;} return 0;}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int x;
    cin >> x;
    int ans = 1;
    for (int b = 2; b <= x; b++) {
        bool flag = false;
        int c = b;
        while (c*b <= x) {
            flag = true;
            c *= b;
        }
        if (flag) chmax(ans, c);
    }
    cout << ans << endl;

}

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

using namespace std;

#define SZ(x) (int)(x.size())
#define REP(i, n) for(int i=0;i<(n);++i)
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define RREP(i, n) for(int i=(int)(n);i>=0;--i)
#define RFOR(i, a, b) for(int i=(int)(a);i>=(int)(b);--i)
#define ALL(a) (a).begin(),(a).end()
#define DUMP(x) cerr<<#x<<" = "<<(x)<<endl
#define DEBUG(x) cerr<<#x<<" = "<<(x)<<" (L"<<__LINE__<<")"<< endl;

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using P = pair<int, int>;

const double eps = 1e-8;
const ll MOD = 1000000007;
const int INF = INT_MAX / 2;
const ll LINF = LLONG_MAX / 2;

template <typename T1, typename T2>
bool chmax(T1 &a, const T2 &b) {
  if(a < b) {a = b; return true;}
  return false;
}

template <typename T1, typename T2>
bool chmin(T1 &a, const T2 &b) {
  if(a > b) {a = b; return true;}
  return false;
}

template<typename T1, typename T2>
ostream& operator<<(ostream &os, const pair<T1, T2> p) {
  os << p.first << ":" << p.second;
  return os;
}

template<class T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  REP(i, SZ(v)) {
    if(i) os << " ";
    os << v[i];
  }
  return os;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);

  ll x, k, d; cin >> x >> k >> d;

  x = abs(x);
  ll fl = x / d;
  if(fl > k) {
    cout << x - k * d << endl;
  } else {
    k -= fl;
    x = x % d;
    if(k % 2) {
      cout << d - x << endl;
    } else {
      cout << x << endl;
    }
  }

}








Measured memory_bytes: 3644
import java.util.*;

//update 2020/1/1 23:01

public class Main{

  static Scanner sc = new Scanner(System.in);
  static StringBuilder sb = new StringBuilder();

  public static void main(String[] args) {

    int n = nextInt();
    int m = nextInt();
    int c = nextInt();

    int[] b = new int[m];
    for(int i=0;i<m;i++){
      b[i] = nextInt();
    }

    int[][] a = new int[n][m];
    for(int i=0;i<n;i++){
      for(int j=0;j<m;j++){
        a[i][j] = nextInt();
      }
    }

    int ans = 0;
    long check = c;
    for(int i=0;i<n;i++){
      for(int j=0;j<m;j++){
        check += a[i][j]*b[j];
      }
      if(check>0){
        ans++;
      }
      check = c;
    }



    System.out.println(ans);

  }

  static int lcm(int a,int b){
    return a*b*gcd(a,b);
  }

  static int gcd(int a,int b){
    if(a%b!=0){
      return gcd(b,a%b);
    }
    else{
      return b;
    }
  }

  /*
    static String toSmall(String s){
      char c = s.charAt(0);
      //if(Character.isUpperCase(c)){
      if(c<=90){
        c += 32;
      }
      return String.valueOf(c);
    }
    static String toBig(String s){
      char c = s.charAt(0);
      //if(Character.isLowerCase(c)){
      if(c>=97){
        c -= 32;
      }
      return String.valueOf(c);
    }
  */

  static String toSmall(String s){
    return s.toLowerCase();
  }

  static String toBig(String s){
    return s.toUpperCase();
  }

  static String next(){
    return sc.next();
  }

  static int nextInt(){
    return Integer.parseInt(sc.next());
  }

  static long nextLong(){
    return Long.parseLong(sc.next());
  }

  static double nextDouble(){
    return Double.parseDouble(sc.next());
  }

  static String[] splitString(String s){
    return s.split("");
  }

  static char[] splitChar(String s){
    return s.toCharArray();
  }

  static int charToInt(char a){
    return a - 48;
  }

////////////////////////////////////////////
  public static int max(int[] a){
    int lng = a.length;
    int max = a[0];
    for(int i=1;i<lng;i++){
      max = Math.max(max,a[i]);
    }
    return max;
  }
  public static long max(long[] a){
    int lng = a.length;
    long max = a[0];
    for(int i=1;i<lng;i++){
      max = Math.max(max,a[i]);
    }
    return max;
  }
////////////////////////////////////////////

////////////////////////////////////////////
  public static int min(int[] a){
    int lng = a.length;
    int min = a[0];
    for(int i=1;i<lng;i++){
      min = Math.min(min,a[i]);
    }
    return min;
  }
  public static long min(long[] a){
    int lng = a.length;
    long min = a[0];
    for(int i=1;i<lng;i++){
      min = Math.min(min,a[i]);
    }
    return min;
  }
////////////////////////////////////////////

}


Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n) ;i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
using ll=long long;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define MOD  1000000007
const ll INF=1e18;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b){ a = b; return 1; } return 0; }



int main(int argc, char const *argv[]) {
  int a[3][3],n;
  rep(i,3)rep(j,3) cin >> a[i][j];
  cin >> n;

  rep(i,n){
    int x; cin >> x;
    rep(i,3)rep(j,3) if(a[i][j]==x)a[i][j]=-1;
  }

  rep(i,3){
    if(a[i][0]==-1 && a[i][1]==-1 && a[i][2]==-1){
      cout << "Yes" << endl;
      return 0;
    }
  }
  rep(i,3){
    if(a[0][i]==-1 && a[1][i]==-1 && a[2][i]==-1){
      cout << "Yes" << endl;
      return 0;
    }
  }

  if(a[0][0]==-1 && a[1][1]==-1 && a[2][2]==-1 ){
    cout << "Yes" << endl;
    return 0;
  }
  if(a[0][2]==-1 && a[1][1]==-1 && a[2][0]==-1 ){
    cout << "Yes" << endl;
    return 0;
  }

  cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define pb push_back
#define mp make_pair
using namespace std;
const int inf = 1e18 + 7;
const int N = 1e6 + 7;
const int md = 1e9 + 7;
void sol() {
  double s;
  cin >> s;
  double length = (s/3);
  double width = (s - length)/2;
  double height = s - length - width;
  double v = length*width*height;
  cout << setprecision(12) << fixed << v << "\n";
}

int32_t main() 
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int T = 1;
  //cin >> T; while(T--) 
  sol();
  return 0;
}


Measured memory_bytes: 256
<?php
$map[] = explode(" ", trim(fgets(STDIN)));
$map[] = explode(" ", trim(fgets(STDIN)));
$map[] = explode(" ", trim(fgets(STDIN)));

$flag = true;
for($i = 0; $i < 2; $i++){
    if($map[$i][1] - $map[$i][0] != $map[$i+1][1] - $map[$i+1][0])$flag = false;
    if($map[$i][2] - $map[$i][1] != $map[$i+1][2] - $map[$i+1][1])$flag = false;
    if($map[1][$i] - $map[0][$i] != $map[1][$i+1] - $map[0][$i+1])$flag = false;
    if($map[2][$i] - $map[1][$i] != $map[2][$i+1] - $map[1][$i+1])$flag = false;
}
echo $flag ? "Yes" : "No";

Measured memory_bytes: 4604
#include <iostream>
#include <vector>
#include <queue>
#include <map>
#include <algorithm>
using namespace std;

int N;

int main() {
    cin >> N;
    vector<int> bonus;
    int nxt;
    int tmp = -1, ans = 0;
    for (int i = 0; i < N; i++) {
        cin >> nxt;
        if (nxt == tmp + 1) {
            bonus.push_back(tmp);
        }
        tmp = nxt;
    }
    int b;
    for (int i = 0; i < N; i++) {
        cin >> b;
        ans += b;
    }
    vector<int> C(N);
    for (int i = 1; i < N; i++) {
        cin >> C[i];
    }
    for (int i = 0; i < bonus.size(); i++) {
        ans += C[bonus[i]];
    }
    cout << ans << endl;
}



Measured memory_bytes: 256