akhauriyash/Code-Regression huggingface dataset:
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>
#include <cstring>
#include <cmath>
#include <stack>
#include <iomanip>
#include <tuple>
#include <functional>
#include <cfloat>
#include <map>
#include <set>
#include <array>
#include <stdio.h>
#include <string.h>
using ll = long long;
using ull = unsigned long long;
using namespace std;
#define int long long
#define CONTAINS(v,n) (find((v).begin(), (v).end(), (n)) != (v).end())
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define ARY_SORT(a, size) sort((a), (a)+(size))
#define REMOVE(v,a) (v.erase(remove((v).begin(), (v).end(), (a)), (v).end()))
#define REVERSE(v) (reverse((v).begin(), (v).end()))
#define ARY_REVERSE(v,a) (reverse((v), (v)+(a)))
#define REP(i, n) for (int (i)=0; (i) < (n); (i)++)
#define CONTAINS_MAP(m, a) (m).find((a)) != m.end()
void YesNo(bool b) { cout << (b ? "Yes" : "No") << endl; }
void YESNO(bool b) { cout << (b ? "YES" : "NO") << endl; }
//max_element

int a, w, t, r;

signed main()
{
	int N;
	cin >> N;
	REP(i, N)
	{
		string s;
		cin >> s;
		if (s == "AC")
		{
			a++;
		}
		else if (s == "WA")
		{
			w++;
		}
		else if (s == "TLE")
		{
			t++;
		}
		else if (s == "RE")
		{
			r++;
		}
	}

	cout << "AC x " << a << endl;
	cout << "WA x " << w << endl;
	cout << "TLE x " << t << endl;
	cout << "RE x " << r << endl;
}



Measured memory_bytes: 3224
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
#include<queue>
#include<cmath>

using namespace std;


int main(){
    int H,W,N;
    cin >> H >> W >> N;
    int higher = H>W ? H : W;
    if(N%higher == 0){
        cout << N/higher;
    }else{
        cout << (N/higher)+1;
    }
    return 0;
}


Measured memory_bytes: 256
// by batr (TBhero.17)                      
// This will be Accepted!
 
#include <bits/stdc++.h>
 
#define jyldam ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
 
#define pb push_back
#define mp make_pair
 
#define B begin()
#define E end()
#define sz size()
#define skip continue
#define all(x) (x).begin(), (x).end()
 
#define F first
#define S second          
 
#define st(x) st+=x
#define pli pair<long long, int>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;     
 
const int N = 1e6 + 17, M = N * 4, D = 2e3 + 17, mod = 1e9 + 7;
const ll INF = 1e17 + 17;
 
int tt = 1;
ll n, x;
ll a[N];
   
void solve () {               
	cin >> n >> x;
	if (x == 1 || x == 2 * n - 1) {
		cout << "No";
		return;
	}
    
    a[n] = x;
    ll g = x;

    for(int i = n + 1; i <= 2 * n - 1; i++){
   		a[i] = ++x;
   		x %= (2 * n - 1);
    }

    for(int i = 1; i <= n - 1; i++){
    	a[i] = ++x;
    	x %= (2 * n - 1);
    }        

    cout << "Yes\n";

    for(int i = 1; i <= 2 * n - 1; i++){
    	cout << a[i] << ' ';
    }
}   
		    
int main() {
		jyldam;
						                  
		while (tt--) {   
			solve();
		}
   	
		return 0;
}

Measured memory_bytes: 3072
import java.util.ArrayList;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int S = sc.nextInt();
        ArrayList<Integer> done = new ArrayList<>();
        int counter = 1;
        done.add(S);
        while (true) {
            counter++;
            if (S%2==1) {
                S = 3*S + 1;
                if (done.contains(S)) {
                    System.out.println(counter);
                    break;
                }
                done.add(S);
            } else {
                S = S/2;
                if (done.contains(S)) {
                    System.out.println(counter);
                    break;
                }
                done.add(S);
            }
        }
    }
}


Measured memory_bytes: 23380
#include<bits/stdc++.h>
using namespace std;
 
#define int long long
typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
template<class T,class U>inline void chmin(T &t,U f){if(t>f)t=f;}
template<class T,class U>inline void chmax(T &t,U f){if(t<f)t=f;}
 
int T[111111];
int A[111111];
 
struct BIT{
    int N;
    vint dat;
    void init(int n){
        N=n;
        dat.resize(N+1);
    }
    void add(int k,int x){
        for(k++;k<=N;k+=k&-k)dat[k]+=x;
    }
    int sum(int k){
        int ret=0;
        for(k++;k;k-=k&-k)ret+=dat[k];
        return ret;
    }
};
 
BIT bit;
 
signed main(){
    int N;scanf("%lld",&N);
 
    rep(i,N){
        printf("? %lld %lld\n",i+1,N);fflush(stdout);
        scanf("%lld",&T[i]);
    }
 
    rep(i,N-1){
        A[i]=T[i]-T[i+1];
    }
 
    bit.init(N+114);
    rep(i,N)bit.add(i,1);
 
    rep(i,N){
        int lb=-1,ub=N+114;
        while(ub-lb>1){
            int mid=(ub+lb)/2;
            if(bit.sum(mid)>A[i])ub=mid;
            else lb=mid;
        }
        A[i]=ub+1;
        bit.add(ub,-1);
    }
 
    printf("!");
    rep(i,N)printf(" %lld",A[i]);
    puts("");
    return 0;
}

Measured memory_bytes: 288944
#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() {
    int n;
    cin >> n;
    int l=0, r=n;
    while ( r-l>1 ) {
        int x=(l+r)/2;
        if ( (LL)x*(x+1)/2>=n ) {
            r=x;
        } else {
            l=x;
        }
    }
    cout << r << '\n';
    return 0;
}

 





Measured memory_bytes: 3616
#include<algorithm>
#include<bitset>
#include<cmath>
#include<complex>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<iterator>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>

using namespace std;
typedef long long ll;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define D()
#define INF 1000000000000
#define MOD 10000007
#define MAXR 100000
#define PB push_back
#define MP make_pair
#define F first
#define S second

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

    if (((a % 2 == 0) && (b % 2 == 0) && (c % 2 == 0)) && ((a == b) && (a == c))) {
        cout << -1 << endl;
    } else {
        int tot = 0;
        while ((a % 2 == 0) && (b % 2 == 0) && (c % 2 == 0)) {
            int na = b / 2 + c / 2;
            int nb = a / 2 + c / 2;
            int nc = a / 2 + b / 2;
            a = na;
            b = nb;
            c = nc;
            tot++;
        }
        cout << tot << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#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(){
    string s;
    cin >> s;
    ll q;
    cin >> q;
    
    
int q1,q2;
string q3;
string s2,s3;
s2="";
s3="";
    



int h;
h=1;
rep(i,q){
    cin >> q1;
        


    if(q1==1){
    h*=-1;  
    }
    else{
        cin >> q2 >> q3;
        if(q2==1 and h==1 or q2==2 and h==-1){
            s2=q3+s2;
        }
        else{
            s3=s3+q3;
        }
    }
}

s=s2+s+s3;
ll l;
if(h==-1){
l=s.size();

rep(j,l/2){
          swap(s[j],s[l-1-j]);
      }
}
        cout << s << endl;
    


    

    return 0;
}

Measured memory_bytes: 1464
def main():
    w,h,n = map(int,input().split(' '))
    x_y_a=[]
    for i in range(n):
        x_y_a.append(list(map(int,input().split(' '))))

    up = [i[1] for i in x_y_a if i[2] == 4]+[h]
    down = [i[1] for i in x_y_a if i[2] == 3]+[0]
    left = [i[0]for i in x_y_a if i[2] == 1]+[0]
    right = [i[0] for i in x_y_a if i[2] == 2]+[w]
    if min(up)-max(down) < 0 or min(right) - max(left) < 0:
        ans = 0
    else:
        ans = (min(up)-max(down))*(min(right)-max(left))
    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <string>
#include <numeric>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <queue>
#include <deque>

using namespace std;
using ll = long long;

#define rep(countName, left, right, up) for (ll countName = left; countName < right; countName += up)
#define rev(countName, right, left, down) for (ll countName = right - 1; countName >= left; countName -= down)

auto solve1(const vector<int> &&v, int k)
{
    return v[k - 1];
}

int main(void)
{

    int k;
    vector<int> v = {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};

    cin >> k;

    cout << solve1(move(v), k) << endl;
    return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env ruby

require 'set'

class Dice
	attr_reader :top, :s, :e

    def initialize(top, s, e, w, n, bottom)
        @top    = top
        @s      = s
        @e      = e
        @w      = w
        @n      = n
        @bottom = bottom
	end

	def rotate!(dist)
		@top, @s, @e, @w, @n, @bottom = 
		case dist
		when 'N' then [@s, @bottom, @e, @w, @top, @n]
		when 'S' then [@n, @top, @e, @w, @bottom, @s]
		when 'E' then [@w, @s, @top, @bottom, @n, @e]
		when 'W' then [@e, @s, @bottom, @top, @n, @w]
		end
	end
end

if __FILE__ == $0 then
	dice1 = Dice.new(*gets.split.map(&:to_i))
	dice2 = Dice.new(*gets.split.map(&:to_i))

	ref1 = Set.new()
	ref2 = Set.new()
	1000.times do
		if ref1.size > 23 then
			break
		end
		ref1.add([dice1.top, dice1.s, dice1.e])
		ref2.add([dice2.top, dice2.s, dice2.e])

		dist = 'NSEW'[rand(4)]
		dice1.rotate!(dist)
		dice2.rotate!(dist)
	end

	puts ref1==ref2 ? 'Yes' : 'No'
end



Measured memory_bytes: 7016
using System;

namespace AtCoder2
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] x = Console.ReadLine().Split(' ');
            int A = int.Parse(x[0]);
            int B = int.Parse(x[1]);
            int C = 3;
            if (A * B * C % 2 == 0)
            {
                Console.WriteLine("No");
            }
            else
            {
                Console.WriteLine("Yes");
            }
       }
    }
}   

Measured memory_bytes: 13140
#include <bits/stdc++.h>
#define all(v) (v).begin(), (v).end()
#define pb push_back
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
using namespace std;
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template<class T>using numr=std::numeric_limits<T>;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const int INF = 1e9;
const ll LLINF = 1e16;
const int MOD = 1000000007;
const int MOD2 = 998244353;

int main() {
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
    int n; cin >> n;
    vector<int> num(100100);
    vector<int> A(n);
    for(int i = 0;i<n;i++) cin >> A[i];
    ll sum = 0;
    for(int i = 0;i<n;i++){
        sum += A[i];
        num[A[i]]++;
    }
    int q; cin >> q;
    while(q--){
        int b,c;
        cin >> b >> c;
        sum += (c-b) * num[b];
        num[c] += num[b];
        num[b] = 0;
        cout << sum << endl;
    }
}

Measured memory_bytes: 3992
while True:
    H,W=map(int,input().split())
    if H==0 and W==0: break
    for j in range(H):
        for i in range(W):
            if (j+i)%2 == 0:
                print('#',end="")
            else:
                print(".",end="")
        print()
    print()
                


Measured memory_bytes: 7000
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
 
#define BIG 2000000007
 
#define MOD 1000000007
typedef unsigned long long ull;
typedef   signed long long sll;
 
typedef struct {
	int a;
	int b;
} hw;
 
#define N_MAX 100000
#define M_MAX 100000
 
ull n, m, k;
ull h, w;
ull va, vb, vc, vd;
ull a[N_MAX];
// sll a[N_MAX];
ull b[N_MAX];
// ull dp[N_MAX][M_MAX + 1];
char s[N_MAX + 1];
// char t[N_MAX + 1];
// hw arr[N_MAX];
 
void swap_adj(ull *a, ull *b){
	ull tmp = *b;
	*b = *a;
	*a = tmp;
	return;
}

ull divide(ull a, ull b){
	ull x = MOD - 2;
	ull ans = 1;
	while (x) {
		if (x & 1) ans = (ans * b) % MOD;
		b = (b * b) % MOD;
		x /= 2;
	}
	return (a * ans) % MOD;
}
 
int digits(ull x){
	int i = 1;
	while (x >= 10) {
		x /= 10;
		i++;
	}
	return i;
}
 
int min(ull x, ull y){
	return (x < y) ? x : y;
}
 
ull gcd(ull x, ull y){
	if (x < y) {
		return gcd(y, x);
	} else if (y == 0) {
		return x;
	} else {
		return gcd(y, x % y);
	}
}
 
ull bitpow(ull a, ull x){
	ull result = 1;
	while (x) {
		if (x & 1) {
			result *= a;
			result %= MOD;
		}
		x /= 2;
		a = (a * a) % MOD;
	}
	return result;
}

int comp(const void *left, const void *right){
	if ((*(int*)left) < (*(int*)right)) {
		return -1;
	} else if ((*(int*)left) > (*(int*)right)) {
		return +1;
	} else {
		return 0;
	}
}

// int nextroute(int arr[]){
// 	int i = n - 1;
// 	int j, x;
// 	while (arr[i - 1] > arr[i]) i--;

// 	x = n;
// 	for (j = i; j < n; j++) {
// 		if (arr[j] < arr[i - 1]) continue;
// 		if (x == n || arr[x] > arr[j]) x = j;
// 	}
// 	arr[i - 1] ^= arr[x];
// 	arr[x] ^= arr[i - 1];
// 	arr[i - 1] ^= arr[x];

// 	qsort(&arr[i], n - i, sizeof(int), comp);
// 	return 0;
// }

ull solve(){
	int i, j;
	int x[256] = {0};
	char alphabets[] = "abcdefghijklmnopqrstuvwxyz";

	for (i = 0; s[i]; i++) {
		x[s[i]] = 1;
	}

	for (i = 0; alphabets[i]; i++) {
		if (!x[alphabets[i]]) {
			printf("%c\n", alphabets[i]);
			return 0;
		}
	}
	puts("None");


	return 0;
}
 
int main(void){
	int i, j;
	int x;

	scanf("%s", s);

	solve();

	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>
#define m_p make_pair
#define sz(x) (int)x.size()
#define out(x) cerr<<#x<<" = "<<x<<" "
#define outln(x) cerr<<#x<<" = "<<x<<endl
#define outarr(x,l,r) cerr<<#x"["<<l<<"-"<<r<<"] = "; for (int _i=l;_i<=r;++_i) cerr<<x[_i]<<" ";cerr<<endl;
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define gc() getchar()
//char buf[1<<23],*p1=buf,*p2=buf;
//#define gc() (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++)
template <class T> void read(T &x)
{
    x=0; char c=gc(); int flag=0;
    while (c<'0'||c>'9') flag|=(c=='-'),c=gc();
    while (c>='0'&&c<='9') x=(x<<3)+(x<<1)+(c^48),c=gc();
    if (flag) x=-x;
}
template <class T> T _max(T a,T b){return a>b ? a : b;}
template <class T> T _min(T a,T b){return a<b ? a : b;}
template <class T> bool checkmax(T &a,T b){return b>a ? a=b,1 : 0;}
template <class T> bool checkmin(T &a,T b){return b<a ? a=b,1 : 0;}
const int N=105;
int n,a,b;
void init()
{
	read(n); read(a); read(b);
}

void solve()
{
	if ((b-a)%2==0) printf("Alice\n");
	else printf("Borys\n"); 
} 
       
#undef int
int main()
{
	init();
	solve();
    return 0;
}

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

using namespace std;

#define rep(i,n) for(int i=0;i<(n);++i)
#define out(S) cout<<(S)<<endl;
#define ShowAll(collection) for(auto i:collection){out(i);}
#define beginend(v) v.begin(),v.end()
#define Foreach(item,collection) for(auto item : collection)

using pii=pair<int,int>;
using vb=vector<bool>;
using ll=long long;
using ull=unsigned long long;
using vi=vector<int>;
using vvi=vector<vi>;
using vvc=vector<vector<char>>;
using ti3=tuple<int,int,int>;
using ulong=unsigned long;
template<typename T> void removeAt(vector<T>& v, int index) { v.erase(v.begin() + index); }
#define OCB(c) (c&1)|(c&2)<<2|(c&4)<<4|(c&8)<<6|(c&16)<<8|(c&32)<<10|(c&64)<<12|(c&128)<<14

int main(){
  int n;
  cin >> n;
  vi box(n);
  int ans=1e9;
  rep(i,n) {
    int ai;
    cin >> ai;
    int cnt=0;
    while(ai%2!=1){ai/=2;cnt++;}
    ans=min(ans,cnt);
  }
  out(ans);
}


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

class Program
{
    static void Main(string[] args)
    {
        string[] cin = Console.ReadLine().Split();
        int r = int.Parse(cin[0]);
        int g = int.Parse(cin[1]);
        int b = int.Parse(cin[2]);
        int n = int.Parse(cin[3]);

        int ans = 0;
        for (int i = 0; r * i <= n; i++)
        {
            for (int j = 0; r * i + g * j <= n; j++)
            {
                if ((n - (r * i + g * j)) % b == 0) ans++;
            }
        }

        Console.WriteLine(ans);
    }
}

Measured memory_bytes: 13140
#include<iostream>
#include<vector>
#include<algorithm>

using namespace std;

vector<long> h;
vector<long> dp;
int main(void){
    long N;
    cin >> N;
    h = vector<long>(N);
    dp = vector<long>(N+2,1000000);
    for(long i = 0;i < N;i++){
        cin >> h[i];
    }

    dp[0] = 0;
    dp[1] = (h[0]-h[1] >= 0 ? h[0]-h[1]:(h[0]-h[1])*-1);

    for(long i=2;i<N;i++){
        long data1,data2;
        data1 = (h[i-1]-h[i] >= 0 ? h[i-1]-h[i]:(h[i-1]-h[i])*-1);
        data2 = (h[i-2]-h[i] >= 0 ? h[i-2]-h[i]:(h[i-2]-h[i])*-1);
        dp[i] = min(dp[i-1] + data1,dp[i-2] + data2);
    }
    cout << dp[N-1] << endl;
    return 0;
}

Measured memory_bytes: 1792
//		HYSO SERIOUS? WHY SO SERIOUS                            RIOUS? WHY SO SERIOUS? WHYSO SERIO
//		 ERIOUS? WHY SO SERIOUS ? WHY                          WHY SO SERIOUS? WHY SOSERIOUSWHYS
//		       OSERIOUS? WHY SO SERIOU         SERIOUS        ERIOUS? WHY SO SERIOUS? WHYS
//		          WHY SO SERIOUS? WHY SOSERIOUS? WHYSOSERIOUS? WHY SO SERIOUS?WHY SO SE
//		           ERIOUS? WHY SO SERIOUS? WHY SO SERIOUS? WHY SO SERIOUS? WHY SOSERIO
//		           WHY SO SERIOUS? WHY SO SERIOUS? WHY SO SERIOUS? WHY SO SERIOUS? WH
//		            SERIOUS?WHYSO SERIOUS? WHY SO SERIOUS? WHY SO SERIOUS? WHYSO SE
//		              ?WHYSOSERIOUS?WHY SO SERIOUS? WHY SO SERIOUS?WHYSO SERIOUS?
//		                           OSERIOUS? WHY SO SERIOUS?WHYSOSER
//		                                 HYSOSERIOUS?WHYSOSERI
//		                                     SOSERIOUS?W
//		                                         SER
//		                                          W


#include <iostream>
#include <queue>
#include <tuple>
#include <vector>
using namespace std;
#include<bits/stdc++.h>
#include <algorithm>
#define ll long long int
#define read(a) long long int a; cin>>a;
#define readstr(s) string s; cin>>s;
#define readarr(a,l) long long int a[l]={0}; for(ll i=0;i<l;i++) cin>>a[i];
#define loop(i,a,b) for(ll i=a;i<b;i++)
#define rloop(i,a,b) for(ll i=a;i>b;i--)
#define ff first
#define ss second
#define readmtrx(i,j,a,b) ll arr[a][b]={0};for(ll i=0;i<a;i++)for(ll j=0;j<b;j++) cin>>arr[i][j];
#define v(pi) vector<ll>pi
#define vp(pi) vector<pair<ll,ll>>pi
#define fast ios_base::sync_with_stdio(false);cin.tie(0);
#define pb(p) push_back(p)
#define mp make_pair
#include <cmath>
#include <map>
#include <string>
#define mi(lol) map<ll,ll>lol
#define fsort(vec) sort(vec.begin(),vec.end())
#define rsort(vec) sort(vec.begin(),vec.end(),compare)
#define inf ll inf=INT_MAX
//sorting according to the second element vector 

bool compare(pair<ll,ll> p,pair<ll,ll> q){
	return p.second < q.second;	
}

//   example:-

//   sort(vec.begin(),vec.end(),compare);
ll arr[100000];
ll temp=0;
ll dp[100000000];
ll frog(ll *arr, ll a, ll tp){
	if(tp==0) return 0;
	if(tp==1) return abs(arr[tp-1]-arr[tp]);
	if(dp[tp]!=-1) return dp[tp];
	dp[tp]=min(abs(arr[tp-2]-arr[tp])+frog(arr,a,tp-2),abs(arr[tp-1]-arr[tp])+frog(arr,a,tp-1));
	return dp[tp];
	}

int main() {
	fast;
	memset(dp,-1,sizeof dp);
	read(a)
	loop(j,0,a){
		read(f)
		arr[j]=f;
	}
	temp=a-1;
	cout<<frog(arr,a,temp);	
	return 0;
}


Measured memory_bytes: 790144
menu_yen = [100, 101, 102, 103, 104, 105]
menu_ten_yen = [1, 2, 3, 4, 5]
amount_of_menu = [100000]*len(menu_yen)

N = int(input())
if N<100:
    print(0)
    exit(0)

s = str(N)
h = int("".join(s[:-2]))
t = int("".join(s[-2:]))
total = [0]*5
for i in range(101):
    total[0] = i
    if t<total[0]:
        continue
    for j in range(51):
        total[1]=2*j+total[0]
        if t<total[1]:
            continue
        for k in range(34):
            total[2]=3*k+total[1]
            if t<total[2]:
                continue
            for l in range(26):
                total[3]=4*l+total[2]
                if t<total[3]:
                    continue
                for m in range(21):
                    total[4]=5*m+total[3]
                    if t<total[4]:
                        continue
                    if t==total[4] and (i+j+k+l+m)<=h:
                        print(1)
                        exit(0)
print(0)

Measured memory_bytes: 3064
#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 ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

template <typename X>
struct SegTree {
  using FX = function<X(X, X)>; // X•X -> X となる関数の型
  int n;
  FX fx;
  const X ex;
  vector<X> dat;
  SegTree(int n_, FX fx_, X ex_) : n(), fx(fx_), ex(ex_), dat(n_ * 4, ex_) {
    int x = 1;
    while(n_ > x) x *= 2;
    n = x;
  }
  void set(int i, X x) { dat[i + n - 1] = x; }
  void build() {
    for(int k = n - 2; k >= 0; k--) dat[k] = fx(dat[2 * k + 1], dat[2 * k + 2]);
  }
  void update(int i, X x) {
    i += n - 1;
    dat[i] = x;
    while(i > 0){
      i = (i - 1) / 2;  // parent
      dat[i] = fx(dat[i * 2 + 1], dat[i * 2 + 2]);
    }
  }
  X query(int a, int b) { return query_sub(a, b, 0, 0, n); }
  X query_sub(int a, int b, int k, int l, int r) {
    if (r <= a || b <= l){
      return ex;
    }else if(a <= l && r <= b){
      return dat[k];
    }else{
      X vl = query_sub(a, b, k * 2 + 1, l, (l + r) / 2);
      X vr = query_sub(a, b, k * 2 + 2, (l + r) / 2, r);
      return fx(vl, vr);
    }
  }
};

int main()
{
  int n; cin >> n;
  vector<int> a(n);
  REP(i,n) cin >> a[i];
  
  auto fx = [](int x1, int x2) -> int { return gcd(x1, x2); };
  int ex = 0;
  SegTree<int> rgq(n, fx, ex);
  REP(i,n) rgq.set(i, a[i]);
  rgq.build();
  
  int ans = 0;
  REP(i,n){
    int left = rgq.query(0, i);
    int right = rgq.query(i+1, n);
    ans = max(ans, gcd(left, right));
  }
  cout << ans << endl;
  return 0;
}

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

r = S.count('R')
g = S.count('G')
b = S.count('B')

c = 0
for i in range(N):
    for j in range(i+1, N):
        h = 2*j-i
        if h >= N:
            break
        if S[i]!=S[h] and S[i]!=S[j] and S[j]!=S[h]:
            c += 1

print(r*g*b-c)

Measured memory_bytes: 9204
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++){
    cin >> a[i];
  }
  int q;
  cin >> q;
  for (int i = 0; i < q; i++){
    int b, m, e;
    cin >> b >> m >> e;
    rotate(a.begin() + b, a.begin() + m, a.begin() + e);
  }
  for (int i = 0; i < n; i++){
    cout << a[i];
    if (i < n - 1){
      cout << ' ';
    }
  }
  cout << endl;
}


Measured memory_bytes: 3144
#-swank
(unless (member :child-sbcl *features*)
  (quit
   :unix-status
   (process-exit-code
    (run-program *runtime-pathname*
                 `("--control-stack-size" "128MB"
                   "--noinform" "--disable-ldb" "--lose-on-corruption" "--end-runtime-options"
                   "--eval" "(push :child-sbcl *features*)"
                   "--script" ,(namestring *load-pathname*))
                 :output t :error t :input t))))
(defmacro dp (name args memo-size &body body)
  (let ((memo (gensym)))
    `(let ((,memo (make-array ,memo-size :initial-element nil)))
       (defun ,name ,args
         (or (aref ,memo ,@args)
             (setf (aref ,memo ,@args)
                   ,@body))))))

(defun split (x str)
  (let ((pos (search x str))
        (size (length x)))
    (if pos
        (cons (subseq str 0 pos)
              (split x (subseq str (+ pos size))))
        (list str))))

(defmacro collect-times (time body)
  `(loop repeat ,time collect ,body))

(defun read-times (time)
  (collect-times time (read)))

(defmacro aif (expr then else)
  `(let ((it ,expr))
     (if it ,then ,else)))

(defmacro awhen (expr &rest then)
  `(aif ,expr (progn ,@then) nil))

(defun comulative (function list &key base)
  (if base
      (comulative function (cons base list))
      (do ((lst (cdr list) (cdr lst))
           (acc (list (car list))))
          ((null lst) (reverse acc))
        (push (funcall function (car acc) (car lst)) acc))))

(defun binary-search (function left right
                      &optional
                        (eps 1)
                        (average-function (lambda (x y) (ash (+ x y) -1))))
  (if (<= (abs (- left right)) eps)
      right
      (let ((mid (funcall average-function left right)))
        (if (funcall function mid)
            (binary-search function left mid eps average-function)
            (binary-search function mid right eps average-function)))))

(defun arithmetic-mean (&rest body)
  (/ (apply #'+ body) (length body)))

(defvar +MOD+ (+ (expt 10 9) 7))

(defun mapa-b (fn a b &optional (step 1))
  (do ((i a (+ i step))
       (result nil))
      ((> i b) (nreverse result))
    (push (funcall fn i) result)))

(defun map0-n (fn n)
  (mapa-b fn 0 n))

(defun map1-n (fn n)
  (mapa-b fn 1 n))

(defun read-string (&optional (stream *standard-input*))
  (labels ((is-empty (x)
             (or (char= x #\space) (char= x #\newline))))
    (loop for char = (read-char stream)
          with result
          when (is-empty char)
            do (return (concatenate 'string (nreverse result)))
          do (push char result))))

(defun main (d n)
  (* (expt 100 d) (if (= n 100) 101 n)))

(princ (main (read) (read)))


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

#define ll          long long
#define pb          push_back
#define pii         pair<int,int>
#define pll         pair<long,long>
#define vi          vector<int>
#define vll         vector<ll>
#define vii         vector<pii>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define f         first
#define s           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define mod        1000000007
#define rep(i,a,b)  for(int i=a;i<b;i++)
#define rem(i,a,b)  for(int i=a;i>b;i--)
#define mp(a,b)     make_pair(a,b)



void solve(){
    ll a,b,k;
    cin>>a>>b>>k;
    a=a-k;
    if(a>=0){
        cout<<a<<" "<<b;
    }
    else{
        b=b+a;
        if(b>=0){
            cout<<0<<" "<<b;
        }
        else cout<<0<<" "<<0;
    }

}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    long t=1;
    //cin>>t;
    while(t--){

        solve();
    }
    return 0;
}


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

int main(){
int n,i,sum=1;
char c;
cin>>n;
string s;
cin>>s;

for(i=0;i<n;i++){
    if(i==0)
        c=s[i];
    else if(s[i]!=c){
        c=s[i];
        sum+=1;
    }

}



cout<<sum;





return 0;
}


Measured memory_bytes: 512
#include <stack>
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <cmath>
#include <array>
#include <iomanip>
#include <string>
#include <limits>
using namespace std;
int gcd(int a, int b)//最大公約数
{
   if (a%b == 0)
   {
       return(b);
   }
   else
   {
       return(gcd(b, a%b));
   }
}
int mod = 1000000000 + 7;
vector<int> v;
class Calc
{
    // 宣言
    long long a;

    public:
        // 素因数分解
        void decompositPrime(long long a);
};

/*
 * 素因数分解
 */
void Calc::decompositPrime(long long n)
{
    // 割る数の初期値
    a = 2;
    // √n ≧ a ( n ≧ a * a ) の間ループ処理
    while (n >= a * a) {
        // a で割り切れたら、a は素因数
        // そして、割られる数を a で割る
        // a で割り切れなかったら、 a を 1 増加させる
        if (n % a == 0) {
            //printf("%d * ", a);
             v.push_back(a);
            n /= a;
        } else {
            a++;
        }
    }
    // 最後に残った n は素因数
    v.push_back(n);
    //printf("%d\n", n);
}
vector<int> divisor(int n) {//約数発見
    vector<int> ret;
    for (int i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            ret.push_back(i);
            if (i * i != n) ret.push_back(n / i);
        }
    }
    std::sort(ret.begin(), ret.end());
    return ret;
}
long nc2(long n){
    return n*(n-1)/2;
}
template<typename TypeInt>
std::string Itoa(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 += '-';
	}
	// 文字列の順番を逆にする
	std::reverse(ret.begin(), ret.end());

	return ret;
}
int main(){
    //std::stack<int> stack;
    long n,k;
    cin >> n >> k;
    vector<int> a(n);
    for(int i = 0; i < n; i++){
        cin >> a[i];
    }
    for(int i = 0; i < k; i++){
        vector<int> b(n,0);
        for(int j = 0; j < n; j++){
            b[max(0, j-a[j])] ++;
            if(j+a[j] < n-1){
                b[j+a[j]+1] --;
            }
        }
        
        for(int j = 1; j < n; j++){
            b[j] += b[j-1];
        }
        
        if(a == b){
            break;
        }
        a = b;
    }
    for(int i = 0; i < n; i++){
        if(i != n-1){
            cout << a[i] << " ";
        }else{
            cout << a[i] << endl;
        }
    }
    //cout << ans << endl;
    return 0;
}






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

dp = [N] * (N + 1)
dp[0] = 0

'''
もらうDP
for i in range(1, N + 1):
    pow6 = 1
    while pow6 <= i:
        dp[i] = min(dp[i], dp[i - pow6] + 1)
        pow6 *= 6

    pow9 = 1
    while pow9 <= i:
        dp[i] = min(dp[i], dp[i - pow9] + 1)
        pow9 *= 9
'''
# 配るDP
for i in range(N):
    pow6 = 1
    while i + pow6 <= N:
        dp[i + pow6] = min(dp[i + pow6], dp[i] + 1)
        pow6 *= 6

    pow9 = 1
    while i + pow9 <= N:
        dp[i + pow9] = min(dp[i + pow9], dp[i] + 1)
        pow9 *= 9

print(dp[N])


Measured memory_bytes: 3828
#include <algorithm>
#include <cmath>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
const int INT_INF = 500000000;
const long long LONG_LONG_INF = (long long)pow(10, 18);
const int MOD = pow(10, 9) + 7;
/* contest template */
string s;
bool a[26];

int main() {
  cin >> s;
  if (s.size() <= 25) {
    for (int i = 0; i < s.size(); i++) {
      a[s[i] - 'a'] = true;
    }
    int k = 0;
    while (true) {
      if (a[k] == false) {
        break;
      } else
        k++;
    }
    char x = 'a' + k;
    cout << s << x << endl;
  } else if (s == "zyxwvutsrqponmlkjihgfedcba") {
    cout << "-1" << endl;
  } else {
    int i = 25;
    while (true) {
      if (s[i - 1] < s[i]) {
        break;
      } else
        i--;
    }
    char y = 'z';
    for(int j=i;j<26;j++){
      if(s[i-1]<s[j]){
        if(y>=s[j]){
          y=s[j];
        }
      }
    }
    for (int j = 0; j < i - 1; j++) {
      cout << s[j];
    }
    cout << y << endl;
  }
  return 0;
}

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

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  for (int i = 0; i < 7; i++) {
    int a, b;
    cin >> a >> b;
    cout << a - b << endl;
  }

  return 0;
}


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

#define fastio()   ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll     long long int

int main()
{
    ll x;
    cin>>x;
    ll r=x+(x*x)+(x*x*x);
    cout<<r<<endl;
    return 0;
}


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

using namespace std;


int my_max(int a, int b) {
    return a > b ? a : b;
}

int my_abs(int x) {
    return x < 0 ? -x : x;
}

template <typename T>
map<T, T> prime_factor(T n) {
    map<T, T> ret;
    for(T i = 2; i * i <= n; i++) {
        T tmp = 0;
        while(n % i == 0) {
            tmp++;
            n /= i;
        }
        ret[i] = tmp;
    }
    if(n != 1) ret[n] = 1;
    return ret;
}

template <typename T>
T divisor_num(T n) {
    map<T, T> pf = prime_factor(n);
    T ret = 1;
    for(auto p : pf) {
        ret *= (p.second + 1);
    }
    return ret;
}

int main() {

    string s;
    cin >> s;

    int max = 0;
    for(int i=0; i<s.length(); i++) {
        for(int j=i+1; j<=s.length(); j++) {
            string temp = s.substr(i, j-i);
            bool ng = false;

            for(int k=0; k<temp.length(); k++) {
                if(!(temp[k] == 'A' || temp[k] == 'C' || temp[k] == 'G' || temp[k] == 'T')) {
                    ng = true;
                }
            }
            if(!ng) {
                if(max<j-i) max = j-i;
            }
        }
    }

    cout << max << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
int main(){
	int n;
	cin >> n;
	while(n--){	
		string s;
		int ans = 0 , cur = 0 , out = 0;
		while(out != 3 && cin >> s){
			if(s=="HIT"){
				cur = (cur << 1)+1;
				if(cur&8)cur -= 8 , ans++;
			}else if(s=="HOMERUN"){	
				ans += !!(cur&1) + !!(cur&2) + !!(cur&4) + 1;
				cur = 0;
			}else if(s=="OUT"){
				out++;
			}
		}
		cout << ans << endl;
		
	}
}

Measured memory_bytes: 0
import java.util.Scanner;

/**
 * https://beta.atcoder.jp/contests/abc072/tasks/abc072_a
 */
public class Main {

	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		int X = sc.nextInt();
		int t = sc.nextInt();
		sc.close();
		
		int ans = X>t ? X-t : 0;
		
		System.out.println(ans);

	}

}


Measured memory_bytes: 21972
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author aajisaka
 */

#include<bits/stdc++.h>

using namespace std;

void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

#define SPEED ios_base::sync_with_stdio(false);cin.tie(nullptr)
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

using ll = long long;
using P = pair<ll, ll>;

constexpr long double PI = 3.14159265358979323846264338327950288L;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

class DBannedK {
public:
    void solve(istream& cin, ostream& cout) {
      SPEED;
      int n; cin >> n;
      vector<int> a(n);
      vector<ll> cnt(n+1);
      rep(i, n) {
        cin >> a[i];
        cnt[a[i]]++;
      }

      vector<ll> now(n+1);
      ll sum = 0;
      for(int i=1; i<=n; i++) {
        now[i] = cnt[i]*(cnt[i]-1)/2;
        sum += now[i];
      }

      rep(i, n) {
        ll ret = sum - now[a[i]];
        ll p = cnt[a[i]];
        ret += (p-1)*(p-2)/2;
        cout << ret << '\n';

      }






    }
};

signed main() {
  DBannedK solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  solver.solve(in, out);
  return 0;
}

Measured memory_bytes: 6528
#include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<stack>
#include<cstdio>
#include<bitset>
#include<unordered_map>
#include<climits>
#include<fstream>
using namespace std;
///////////////////library zone!!!!!!!!!!!!!!!!!!!!!!!!!!!!
typedef long long ll;
typedef long double ld;
#define all(a) (a).begin(),(a).end()
const ll Mod = 1000000007;
const ll mod = 0;
struct H {
	ll x, y;
	bool operator<(const H &b) const {
		if (x != b.x) return x < b.x;
		return y < b.y;
	}
	bool operator>(const H &b) const {
		if (x != b.x) return x > b.x;
		return y > b.y;
	}
	bool operator==(const H &b) const { return x == b.x&&y == b.y; }
	bool operator!=(const H &b) const { return (*this) != b; }
};
struct P {
	ll pos, cost;
	bool operator<(const P &b) const { return cost < b.cost; }
	bool operator>(const P &b) const { return cost > b.cost; }
};
struct B {
	ll to, cost;
};
struct E {
	ll from, to, cost;
	bool operator<(const E &b) const { return cost < b.cost; }
	bool operator>(const E &b) const { return cost > b.cost; }
};
template<typename T, typename U>
void chmin(T &a, U b) {
	if (a > b) a = b;
}
template<typename T, typename U>
void chmax(T &a, U b) {
	if (a < b) a = b;
}
template<typename T>
T max_0(T a) {
	if (a < 0) return 0;
	return a;
}
template<typename T>
T min_0(T a) {
	if (a > 0) return 0;
	return a;
}
ll read() {
	ll u;
	scanf("%lld", &u);
	return u;
}
ll gcd(ll i, ll j) {
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcd(j%i, i);
}
ll mod_pow(ll x, ll n, ll p) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * x % p;
		x = x * x % p;
		n >>= 1;
	}
	return res;
}//x^n%p
const ll Inf = 3023372036854775807;
const int inf = 1500000000;
#define int long long
//----------------------------------------------------
int a[2000];
int b[2000];
signed main() {
	int n = read(), m = read(), c = read();
	for (int i = 0; i < m; i++) {
		cin >> b[i];
	}
	int ans = 0;
	for (int i = 0; i < n; i++) {
		int sum = 0;
		for (int j = 0; j < m; j++) {
			sum += read()*b[j];
		}
		if (sum + c > 0) {
			ans++;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
import sys
import heapq

def solve():
    input = sys.stdin.readline
    N, M, V, P = map(int, input().split())
    A = [int(a) for a in input().split()]
    A.sort()

    h, l = N, -1
    b = A[N - P]
    while h - l  > 1:
        m = (h + l) // 2
        NG = A[m] + M
        if NG < b: l = m
        elif m >= N - P: h = m
        else:
            room = (m + P) * M
            for i in range(m + 1, N - P + 1): room += NG - A[i]
            if room < M * V: l = m
            else: h = m

    print(N - l - 1)
    return 0

if __name__ == "__main__":
    solve()

Measured memory_bytes: 14380
#include<bits/stdc++.h>
using namespace std;
typedef double db;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pw(x) (1ll << (x))
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define rep(i,l,r) for(int i=(l);i<(r);++i)
#define per(i,l,r) for(int i=(r)-1;i>=(l);--i)
#define dd(x) cout << #x << " = " << (x) << ", "
#define de(x) cout << #x << " = " << (x) << "\n"
#define endl "\n"

//-----
const int N = 1e6 + 7, MOD = 1e9 + 7;
void inc(int &a, int b) { if ((a += b) >= MOD) a -= MOD; }
int add(int a, int b) { if ((a += b) >= MOD) a -= MOD; return a; }
int mul(int a, int b) { return ll(a) * b % MOD; }
int qpow(int a, int b) { int r = 1; for (; b; b >>= 1) { if (b & 1) r = mul(r, a); a = mul(a, a); } return r; }
int n, m, k;
int jc[N], ijc[N], pw3[N];
void ini() {
	jc[0] = 1; rep(i, 1, N) jc[i] = mul(jc[i - 1], i);
	ijc[N - 1] = qpow(jc[N - 1], MOD - 2); per(i, 0, N - 1) ijc[i] = mul(ijc[i + 1], i + 1);
	pw3[0] = 1; rep(i, 1, N) pw3[i] = mul(pw3[i - 1], 3);
}
int C(int a, int b) { return mul(jc[a], mul(ijc[b], ijc[a - b])); }
int main() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	ini();//rep(i, 0, 10) rep(j, 0, i + 1) cout << C(i, j) << " \n"[j == i];
	cin >> n >> m >> k;
	int g = 0, inv2 = qpow(2, MOD - 2);
	rep(j, 0, k + 1) inc(g, mul(pw3[k - j], C(j + n - 1, j)));
	int ans = 0;
	rep(i, 0, m + 1) {
		inc(ans, mul(pw3[m - i], mul(C(i + n - 1, i), g)));
		g = mul(g, 3);
		inc(g, MOD - C(i + k + n, i + n));
		g = mul(g, inv2);
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 12032
#include <bits/stdc++.h> 
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#include<cmath>
#include<string>
#define pb push_back
#define ll long long
#define ull unsigned long long
#define deb(x) cerr<<#x<<" "<<x<<"\n"
#define debi cerr<<"hey sparky\n"
#define x first
#define y second
#define fast ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define newline cout<<"\n"
#define yes cout<<"YES"<<"\n"
#define no cout<<"NO"<<"\n"
#define INF (int)1e5+5
#define nax (int)1e6+3
#define eps (double)1e-9
#define all(x) x.begin(),x.end()
#define MAX_N (int)1e6+2
//#define int long long
using namespace std;
using namespace __gnu_pbds; 
typedef tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> pdbs;

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 << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

// look for  all edge cases
//search for a pattern
	
signed main(){
	fast;
	ll n;
	cin >> n;
	ll val = n;
	ll ans  = 0;
	set<ll> included;
	vector<pair<ll,ll> > fac;
	//ll val = n;
	
	vector<ll> find;
	for(ll i = 1 ; i<= 60;i++ ){
		ll temp = (i*(i+1))/2;
		find.pb(temp);
	}
	
	for(ll i = 2; i*i <= n ;i++){
		if(val%i == 0){
			ll cnt = 0;
			while(val % i == 0){
				cnt++;
				val /= i;
			}
			fac.pb({i,cnt});
		}
	}
	
	if(val != 1ll){
		fac.pb({val,1});
	}
	
	
	for(ll i = 0 ; i< (ll)fac.size();i++){
		ll meter = fac[i].y;
		for(ll j = 0 ; j< 60; j++){
			if(meter < find[j]){
				ans += j;
				break;
			}
		}
	}
	
	
	cout<<ans;
	
	return 0;
}

	



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

const int maxn=1e5+10;
const int mo=1e9+7;

int n,f[maxn],Ans=1,deg[maxn];
int feet[maxn],sz[maxn],dp[maxn];
bool vis[maxn],cir[maxn];
queue<int> q;

int main()
{
#ifdef h10
	freopen("E.in","r",stdin);
	freopen("E.out","w",stdout);
#endif
	int i,j,u;
	scanf("%d",&n);
	for (i=1;i<=n;i++)
	{
		scanf("%d",&f[i]);
		deg[f[i]]++;
	}
	for (i=1;i<=n;i++)
		if (deg[i]>2) {puts("0"); return 0;}
	for (i=1;i<=n;i++)
		if (!deg[i]) q.push(i);

	while (!q.empty())
	{
		u=q.front(); q.pop();
		if (!(--deg[f[u]])) q.push(f[u]);
	}
	for (i=1;i<=n;i++) cir[i]=deg[i]!=0;
	memset(deg,0,sizeof(deg));
	for (i=1;i<=n;i++) deg[f[i]]++;

	for (i=1;i<=n;i++)
		if (!cir[i]&&deg[i]==2) {puts("0"); return 0;}

//	for (i=1;i<=n;i++)
//		printf("%d ",cir[i]);
//	puts("");

	for (i=1;i<=n;i++)
		if (deg[i]==0)
		{
			int cnt=0;
			for (u=i;!cir[u];u=f[u]) cnt++;
			feet[u]=cnt;
//			printf("feet[%d]=%d\n",u,cnt);
		}

	for (i=1;i<=n;i++)
		if (cir[i]&&!vis[i])
		{
			int cnt=0,flag=1,pos=0;
			for (u=i;;u=f[u])
			{
				vis[u]=1;
				cnt++;
				if (feet[u]) flag=0,pos=u;
				if (f[u]==i) break;
			}
			if (flag) sz[cnt]++;
			else
			{
				cnt=0;
				for (u=f[pos];;u=f[u])
				{
					cnt++;
					if (feet[u])
					{
						if (feet[u]<cnt) Ans=Ans*2%mo;
						if (feet[u]>cnt) Ans=0;
						cnt=0;
					}
					if (u==pos) break;
				}
			}
		}

	for (i=1;i<=n;i++)
		if (sz[i])
		{
//			printf("sz[%d]=%d\n",i,sz[i]);
			dp[0]=1;
			for (j=1;j<=sz[i];j++)
			{
				if (i>1&&i&1) dp[j]=dp[j-1]*2%mo;
				else dp[j]=dp[j-1];
				if (j>1) (dp[j]+=(LL)dp[j-2]*(j-1)%mo*i%mo)%=mo;
			}
//			printf("dp[%d]=%d\n",sz[i],dp[sz[i]]);
			Ans=(LL)Ans*dp[sz[i]]%mo;
		}
	printf("%d\n",Ans);
}


Measured memory_bytes: 1664
#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>

using namespace std;
long long n, a, b, x[100003];
long long ans;
int main()
{
    cin >> n >> a >> b;
    for(int i = 1;i <= n;++ i)
    {
        cin >> x[i];
    }
    for(int i = 1;i < n;++ i)
    {
        if((x[i + 1] - x[i]) * a < b) ans = ans + (x[i + 1] - x[i]) * a;
        else ans = ans + b;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1024
import java.util.*;
public class Main{
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
        double A = sc.nextDouble();
      	double B = Math.sqrt(A);
        long a = (long)A;
        long b = (long)B;
        for(long i=b;i>=1;i--){
          if(a%i==0){System.out.println((a/i + i - 2));break;}
        }
    }
}

Measured memory_bytes: 24148
using System;
using System.Text;
using System.Collections.Generic;
using static System.Math;
using System.Linq;
using static System.Array;

namespace AtcoderExpress
{


    class Program
    {

        static void Main(string[] args)
        {
            var N = long.Parse(Console.ReadLine());

            Console.WriteLine((N+1)/2);
        }


    }
}


Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ll long long
#define pp pair<ll,ll>
#define ld long double
#define all(a) (a).begin(),(a).end()
#define mk make_pair
ll MOD=998244353;
int inf=1000001000;
ll INF=1e18+5;
ll mod=INF;

int main() {
    int a,b;
    cin >> a >> b;
    cout << a*b << endl;
}


Measured memory_bytes: 3632
#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <list>
#include <deque>
#include <cstdio>
#include <cstring>
#include <queue>
#include <stack>
#include <algorithm>
#include <cmath>
#define ll long long
#define INF 0x3f3f3f3f
#define SIS std::ios::sync_with_stdio(false)
using namespace std;
ll fast_pow(ll a,ll b,ll mod)
{
    ll c=1;
    while(b>=2)
    {
        if(b%2==0)
            a*=a,b/=2;
        else
            c*=a,a*=a,b--,b/=2;
        a%=mod,c%=mod;
    }
    return (a*c)%mod;
}
ll cal(ll n,ll m);
int main()
{
    int n,m;
    while(cin>>n>>m)
    {
        ll ans=0;
        if(n>1)
            ans+=cal(n,2);
        if(m>1)
            ans+=cal(m,2);
        cout<<ans<<endl;
    }
    return 0;
}

ll cal(ll n,ll m)
{
    return n*(n-1)/2;
}


Measured memory_bytes: 256