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

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}

using ll=long long;
using R=long double;
const R EPS=1e-9L; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r){return(r > EPS)-(r < -EPS);}
inline R sq(R x){return sqrt(max(x,0.0L));}

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

const pid_t pid = getpid();
// Problem Specific Parameter:

const int limit = 5010;
ll dp[limit][limit];
int p[limit];

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

	rep(i, n) cin >> p[i], p[i]--;

	rep(i, n + 1)rep(j, n + 1) dp[i][j] = 1LL << 60;
	dp[0][0] = 0LL;

	rep(i, n + 1)rep(j, n + 1){
		if(i + 1 <= n and j + 1 <= n and p[i] == j){
			chmin(dp[i + 1][j + 1], dp[i][j]);
		}

		if(i + 1 <= n){
			if(p[i] <= j){
				chmin(dp[i + 1][j], dp[i][j] + b);
			} else {
				chmin(dp[i + 1][j], dp[i][j] + a);	
			}
		}

		if(j + 1 <= n){
			chmin(dp[i][j + 1], dp[i][j]);
		}
	}

	cout << dp[n][n] << endl;

	return 0;	
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = 1e16;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,N) for(int i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE (1LL << 20)
#define NIL -1

ll n;

int main(){
    cin >> n;
    cout << (n-2)*180 << endl;
}

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

using namespace std;

typedef long long  ll;

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

    int n, swap_time = 0;

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

    for (int i = 0; i < n; ++i) {
        int min_idx = i;
        for (int j = i; j < n; ++j)
            if (a[j] < a[min_idx])
                min_idx = j;
        if (min_idx != i) {
            ++swap_time;
            swap(a[min_idx], a[i]);
        }
    }

    for (int i = 0; i < n; ++i)
        cout << a[i] << (i == n - 1 ? '\n' : ' ');
    cout << swap_time << "\n";

    return 0;
}

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

int partition(vector<int> &V, int left, int right)
{
    int i = left - 1;
    int x = V[right];
    for (int j = left; j < right; j++)
    {
        if (V[j] <= x)
        {
            i++;
            swap(V[i], V[j]);
        }
    }
    swap(V[++i], V[right]);

    return i;
}

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

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

    int idx = partition(A, 0, n - 1);

    for (int i = 0; i < n; i++)
    {
        if (i == idx)
        {
            cout << "[" << A[i] << "]";
        }
        else
        {
            cout << A[i];
        }

        if (i < n - 1)
        {
            cout << " ";
        }
    }
    cout << endl;

    return 0;
}


Measured memory_bytes: 3128
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A, B;
  cin >> A >> B;
  int C, D, E;
  C = A+B;
  D = A-B;
  E = A*B;
  if (C >= D){
  if (C >= E){
  cout << C;
  }else
  cout << E;
  }else{
  if (D >= E){
  cout << D;
  }else
  cout << E;
  }
}

Measured memory_bytes: 256
#include<iostream>
#include<math.h>
#include<stdlib.h>
#include<string>
#include<limits.h>
#include<utility>
#include<vector>
#include<tuple>
#include<algorithm>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define rep(i,n) for(int i=0;i<n;i++)
#define ALL(A) A.begin(),A.end()
bool comparator(P a, P b) {
	return a.first / a.second < b.first / b.second;
}

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

	int a = s[2] - '0';
	if (s.size() == 2) {
		a = s[1] - '0';

	}
	if (s.size() == 1) {
		a = s[0] - '0';
	}
	if (a == 3) {
		cout << "bon" << endl;
	}
	else if (a == 0 || a == 1 || a == 6 || a == 8) {
		cout << "pon" << endl;
	}
	else {
		cout << "hon" << endl;
	}
}


Measured memory_bytes: 3040
#include<cstdio>
#include<algorithm>
using namespace std;
int n,m,a[200100],Ans,ans;
int main(){
	scanf("%d%d",&n,&m);
	for(int i=1;i<=2*n;i++)
		scanf("%d",&a[i]);
	sort(a+1,a+2*n+1);
	int L=0,R=n,ans;
	while(L<=R){
		int mid=(L+R)/2;
		bool bo=true;
		for(int i=mid+1;i<=n;i++)
			if(a[mid+i]+a[2*n-i+mid+1]<m){
				bo=false;
				break;
			}
		if(bo)ans=mid,R=mid-1;
		else L=mid+1;
	}
	for(int i=1;i<=ans;i++)
		Ans=max(Ans,a[i]+a[ans*2-i+1]);
	for(int i=ans+1;i<=n;i++)
		Ans=max(Ans,a[ans+i]+a[2*n-i+ans+1]-m);
	printf("%d\n",Ans);
}

Measured memory_bytes: 896
#include<iostream>
#include<algorithm>
#include<math.h>
#include<set>
#include<vector>
#include<map>
#include<functional>
#include<iomanip>
#include<queue>
#include<random>
#include<numeric>
#include<string>
#include<cstring>
typedef long long ll;
typedef long double ld;
using namespace std;
ll dx[] = { 0,0,1,-1 };
ll dy[] = { 1,-1,0,0 };

ll gcd(ll a, ll b) {
	if (a<b) { return gcd(b, a); }
	else if (a%b) { return gcd(b, a%b); }
	else { return b; }
}
int main() {
	ll X, Y;
	ll ans = 0;
	cin >> X >> Y;
	while (X <= Y) {
		X = X * 2;
		ans++;
	}
	cout << ans << endl;
}



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

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

    if(s.length() < t.length()){
        cout << "UNRESTORABLE" << endl;
        return 0;
    }
    
    set<string> candidates;

    for(int i = 0; i <= s.length()-t.length(); i++){
        int j;
        for(j = 0; j < t.length(); j++){
            if(s[i+j] == '?' || s[i+j] == t[j]) continue;
            else    break;
        }

        if(j == t.length()){
            string tmp = s;
            for(j = 0; j < t.length(); j++) tmp[i+j] = t[j];
            for(j = 0; j < s.length(); j++) if(tmp[j] == '?')   tmp[j] = 'a';
            candidates.insert(tmp);
        }
    }

    if(candidates.size() > 0){
        cout << *candidates.begin() << endl;
    }else{
        cout << "UNRESTORABLE" << endl;
    }

    return 0;
}

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

#define mod 1000000007
#define ten5 100005
#define PI 3.1415926
using namespace std;

int num[15];

int main()
{
    //int m,n,o=0,i,j,k;
    long long int sum=0,sum2=0,n1=0,n2=0,n3;
    double ans=0.0,half;
    long long int m,n,o,i,j,k=1,now=1;
    long long int a,a1,a2,a3,a4;
    //float f,g,h;
    char c;
    string s,s1;
    priority_queue<long long int> pq;
    vector<long long int> vint;
    //map<string,int> mp;
    //map<string,int>::iterator iter;
    cin>>n;
    for(i=0;i<n;i++)
    {
        cin>>m;
        pq.push(m);
    }
    a1=pq.top();pq.pop();
    while(pq.size()>0)
    {
        if(a1==pq.top())
        {
            vint.push_back(a1);
            pq.pop();
            a1=pq.top();
            pq.pop();
            if(vint.size()==2)
            {
                cout<<vint[0]*vint[1];
                return 0;
            }
        }
        else
        {
            a1=pq.top();
            pq.pop();
        }
    }
    cout<<0;
    return 0;
}



Measured memory_bytes: 1400
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner scan = new Scanner(System.in);
        int N = scan.nextInt();
        int[] L = new int[N];
        int count = 0;
        for(int i = 0; i < N; i++){
            L[i] = scan.nextInt();
        }
        for(int i = 0; i < N; i++){
            for(int j = i+1; j < N; j++){
                for(int k = j+1; k < N; k++){
                    if(L[i] != L[j] && L[j] != L[k] && L[k] != L[i]){
                        if((L[i]+L[j]>L[k]) && (L[j]+L[k]>L[i]) && (L[k]+L[i]>L[j])){
                            count++;
                        }
                    }
                }
            }
        }
        System.out.println(count);
    }
}

Measured memory_bytes: 36808
import java.util.Scanner;

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

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

int main(){
    char a,b;
    cin >> a;
    if(a == 'A'){
        b = 'T';
    }else if(a == 'T'){
        b ='A';
    }else if(a =='C'){
        b = 'G';
    }else{
        b ='C';
    }
    cout << b << endl;
    
}

Measured memory_bytes: 256
import sys

input = sys.stdin.readline


class AtCoder:
    def main(self):
        S = input().rstrip()

        for i in range(1, 4):
            if S[i - 1] == S[i]:
                print("Bad")
                exit()
        print("Good")


# Run main
if __name__ == '__main__':
    AtCoder().main()


Measured memory_bytes: 38256
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
#include <atcoder/all>

using boost::multiprecision::cpp_int;
using namespace std;
using namespace atcoder;

#if __has_include("print.hpp")
  #include "print.hpp"
#endif

#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define MOD 998244353

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; }

typedef long long ll;
typedef pair<ll, ll> p;

using mint = modint998244353;
struct S{
  mint x, w;
  S(mint x=0, mint w=1): x(x), w(w){}
};

S op(S a, S b){
  return S(a.x*b.w + b.x, a.w*b.w);
}

S e() {return S();}

S mapping(int f, S a){
  if(f == 0) return a;
  return S((a.w-1)/9 * f, a.w);
}

int comp(int f, int g){
  if(f == 0) return g;
  return f;
}

int id(){ return 0;}


int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n, q;
  cin >> n >> q;

  lazy_segtree<S, op, e, int, mapping, comp, id> t(n);

  rep(i, n) t.set(i, S(1, 10));
  while(q--){
    int l, r, d;
    cin >> l >> r >> d;
    l--;
    t.apply(l, r, d);
    // S ans = t.prod(0, n);
    // cout << ans.x.val() << endl;
    printf("%lld\n", (ll)t.all_prod().x.val());
    // cout << t.all_prod().x.val() << endl;
  }
}


Measured memory_bytes: 9816
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))

char s[110];
int main(){
	scanf("%*s%s%*s",s);
	printf("A%cC",s[0]);
}

Measured memory_bytes: 128
let n = int64(stdin.ReadLine())
let a = stdin.ReadLine().Split() |> Array.map(int64)

let inf = 1_000_000_000_000_000_000L
let sorted = Array.sort(a) // benchmarking

let res =
    Array.fold (
        fun accum x ->
            if x = 0L then
                0L
            else if accum <= inf / x && accum >= 0L then
                accum * x
            else 
                -1L
        )
        1L
        sorted
 
printfn "%i" res


Measured memory_bytes: 44028
#include <iostream>
#include <string>
#include <vector>
#include <queue>

using namespace std;

int main(void)
{
	int h, w;
	cin >> h >> w;
	vector<string> s(h);
	for (int i = 0; i < h; i++) {
		cin >> s[i];
	}

	vector<vector<int>> id(h, vector<int>(w));
	int now = 1;
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			if (s[i][j] == '#' && id[i][j] == 0) {
				queue<pair<int, int>> q;
				q.push(make_pair(i, j));
				while (!q.empty()) {
					pair<int, int> p = q.front();
					q.pop();

					if (id[p.first][p.second] == now) {
						continue;
					}
					id[p.first][p.second] = now;

					char c = s[p.first][p.second];
					int dx[] = { -1, 1, 0, 0 };
					int dy[] = { 0, 0, -1, 1 };
					for (int i = 0; i < 4; i++) {
						int nx = p.first + dx[i];
						int ny = p.second + dy[i];

						if (nx < 0) continue;
						if (nx >= h) continue;
						if (ny < 0) continue;
						if (ny >= w)continue;
						if (s[nx][ny] == c) continue;
						q.push(make_pair(nx, ny));
					}
				}

				now++;
			}
		}
	}

	long long ans = 0;
	vector<pair<long long, long long>> b(now);
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			if (s[i][j] == '#') {
				b[id[i][j]].first++;
			} else {
				b[id[i][j]].second++;
			}
		}
	}

	for (int i = 1; i < now; i++) {
		ans += b[i].first * b[i].second;
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 6080
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp>
#include <functional> // for less
#include <iostream>
using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
#define pf(n) cout << n << endl
#define ps() cout <<" ";
#define sf(n) cin >> n
#define in(i,n) for (int i = 0; i < n; i++)
#define vi vector<int>
#define vp vector<pair<int, int>>
#define graph vector< vector<int> >
#define vs vector<string>
/**  '' "\n" ^ -  =**/

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    string str;
    cin>>str;
    for(int i=0;i<str.length();i++)
    {
        if(i%2)
        {
            if(str[i]=='R')
            {
                cout<<"No\n";
                return 0;
            }
        }
        else
        {
            if(str[i]=='L')
            {
                cout<<"No\n";
                return 0;
            }
        }
    }
    cout<<"Yes\n";
}


Measured memory_bytes: 384
package main

import (
	"fmt"
	"math"
)

func main() {
	var l, r int64
	fmt.Scan(&l)
	fmt.Scan(&r)

	if r-l >= 2019 {
		fmt.Println(0)
		return
	}

	for i := l; i <= r; i++ {
		if i%2019 == 0 {
			fmt.Println(0)
			return
		}
	}

	min := int64(math.MaxInt64)
	for i := l; i <= r; i++ {
		for j := i + 1; j <= r; j++ {
			x := ((i % 2019) * (j % 2019)) % 2019
			if x < min {
				min = x
			}
		}
	}
	fmt.Println(min)
}


Measured memory_bytes: 512
package main

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

var rdr = bufio.NewReaderSize(os.Stdin, 1000000)

func main() {
	R, G, B, N := oneInt(), oneInt(), oneInt(), oneInt()

	cnt := 0

	for x := 0; x <= N; x++ {
		for y := 0; y <= N; y++ {
			if (N-R*x-G*y)%B == 0 && (N-R*x-G*y) >= 0 {
				//fmt.Println(x, y)

				cnt++
			}
		}
	}

	fmt.Println(cnt)

}

func oneInt() int {
	var a int
	fmt.Scan(&a)
	return a
}
func oneStr() string {
	var a string
	fmt.Scan(&a)
	return a
}

func readLine() string {
	buf := make([]byte, 0, 1000000)
	for {
		l, p, e := rdr.ReadLine()
		if e != nil {
			panic(e)
		}
		buf = append(buf, l...)
		if !p {
			break
		}
	}
	return string(buf)
}

func scanNums(n int) (nums []int) {
	str := readLine()
	s := strings.Split(str, " ")
	for i := 0; i < n; i++ {
		num, _ := strconv.Atoi(s[i])
		nums = append(nums, num)
	}
	return nums
}

func scanStrings() []string {
	str := readLine()
	s := strings.Split(str, " ")

	return s
}

func abs(a int) int {
	if a >= 0 {
		return a
	} else {
		return -a
	}
}

func pow(p, q int) int {
	return int(math.Pow(float64(p), float64(q)))
}

func min(nums ...int) int {
	if len(nums) == 0 {
		panic("funciton min() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Min(float64(res), float64(nums[i])))
	}
	return res
}

func max(nums ...int) int {
	if len(nums) == 0 {
		panic("funciton max() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Max(float64(res), float64(nums[i])))
	}
	return res
}

func strSearch(a []string, b string) bool {
	for i := 0; i < len(a); i++ {
		if a[i] == b {
			return true
		}
	}
	return false
}

func sortAsc(a []int) []int {
	sort.Ints(a)
	return a
}

func sortDesc(a []int) []int {
	sort.Sort(sort.Reverse(sort.IntSlice(a)))
	return a
}

func gcd(a, b int) int {
	if b == 0 {
		return a
	}
	return gcd(b, a%b)
}

func lcm(a, b int) int {
	if a == 0 && b == 0 {
		return 0
	}
	return a * b / gcd(a, b)
}

func cumSum(nums []int) []int {
	sums := []int{0}

	for i := 0; i < len(nums); i++ {
		sums = append(sums, sums[i]+nums[i])
	}
	return sums
}


Measured memory_bytes: 640
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
using namespace std;

#define debug(x) cout << #x << ": " << x << endl;
#define ll long long

#define mod 998244353

ll inv[1<<20]; // ith index will store (1/i)%mod

void populate(int n) {
    inv[1] = 1;
    for(int i = 2;i <= n;i++) {
        inv[i] = mod-((inv[mod%i]*(mod/i))%mod);
    }
}

int N, MV = 1000000;
ll A[1<<20], freq[1<<20], sum[1<<20], answer = 0;
vector<int> divs[1<<20];

void populate_divs() {
  for(int i = 1;i <= MV;i++) {
    int num = i;
    while(num <= MV) {
      divs[num].push_back(i);
      num += i;
    }
  }
}

int main() {
 // freopen("input.in","r",stdin);
 // freopen("output.out","w",stdout);

  cin >> N;
  for(int i = 0;i < N;i++) {
    cin >> A[i];
    freq[A[i]]++;
  }

  populate(MV);
  //populate_divs();

  for(ll d = MV;d >= 1;d--) {
      ll num = d;
      ll sum_m = 0;
      ll sq_sum = 0;

      while(num <= MV) {
        sum_m = (sum_m + freq[num]*num)%mod;
        sq_sum = (sq_sum + freq[num]*((num*num)%mod))%mod;
        num += d;
      }

      ll a = (sum_m*sum_m)%mod;
      ll b = (a - sq_sum + mod)%mod;
      ll c = (b*inv[2])%mod;

      sum[d] = c;
      num = d + d;
      while(num <= MV) {
        sum[d] = (sum[d]-sum[num]+mod)%mod;
        num += d;
      }

      answer = answer + ((sum[d]*inv[d])%mod);
      answer %= mod;
  }

  cout << answer << endl;

  return 0;
}


Measured memory_bytes: 51456
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <iomanip>

#define rep(i,n) for (int i = 0; i < (n); ++i)

using namespace std;

typedef long long ll;

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

  int n, m;
  cin >> n >> m;

  int is_broken[100005] = {0};
  rep(i, m) {
    int a;
    cin >> a;
    is_broken[a] = 1;
  }

  // dp[x] := x段目に行く方法の場合の数
  ll dp[100005] = {1};
  ll mod = 1000000007;

  rep(i, n) {
    dp[i+1] += !is_broken[i+1] * dp[i];
    dp[i+2] += !is_broken[i+2] * dp[i];
    dp[i] %= mod;
    dp[i+1] %= mod;
    dp[i+2] %= mod;
  }

  cout << dp[n] << endl;

  return 0;
}

Measured memory_bytes: 1408
#include<iostream>
using namespace std;
int main(){
  int ma[100005]={};
  int n;
  cin >> n;
  int i,j,k;
  int a,b;
  for(i=0;i<n;i++){
    cin >> a >> b;
    for(j=a;j<=b;j++) ma[j]++;
  }
  int m=0;
  for(i=0;i<100005;i++){
    //if(i<10)
    //cout << i <<":" << ma[i]<<endl;
    if(i<=ma[i]+1)
      m=max(m,i-1);
  }
  cout << m << endl;
  return 0;
}


Measured memory_bytes: 3500
#include<stdio.h>
int max(int h,int w){
  if(h>w){
    return h;
  }
  else{
    return w;
  }
}
int main(){
  int h,w,n,sum=0,cnt=0;
  scanf("%d",&h);
  scanf("%d",&w);
  scanf("%d",&n);
  while(sum<n){
    sum+=max(h,w);
    cnt++;
  }
  printf("%d\n",cnt);
  return 0;
}


Measured memory_bytes: 128
import sys

answer=124999999999999995

n = int(input())

if n%2==1:
  print(int(0))
  sys.exit()

i=1
j=1
count=0


while 10**i <= n:
  count+= n//(10**i)
  i+=1

while 10*(5**j) <= n:
  count += n//(10*(5**j)) - n//(10**(j+1))
  #print(n//(10*(5**j)) - n//(10**(j+1)))
  j +=1

print(count)
#print(answer-count)

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

int main(){
  long long N,K;
  cin>>N>>K;
  long long ans=0;
  
  if(K == 0){
    cout<<N*N<<endl;
    return 0;
  }
  

  for(long long i=K+1;i<=N;i++){
    //cout<<((N+1)/i)*(i-K)<<endl;
    ans+=((N+1)/i)*(i-K);
    long long temp=(N+1)/i;
    if(N+1-i*temp-K>0){
      ans+=(N+1-i*temp-K);
    }
  }
  
  
  cout<<ans<<endl;
  return 0;
}

    
  

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

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

const ll MOD = 1e9 + 7;
const ll inf = 1LL<<60;
const double eps = 1e-9;

const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };
 
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()
{
    string s;
    cin >> s;
    bool ok = true;
    if (s.size() % 2) {
        cout << "No" << endl;
        return 0;
    }
    for (int i = 0; i < int(s.size()) - 1; i+=2) {
        if (!(s[i] == 'h' and s[i+1] == 'i')) ok = false;
    }
    if (ok) cout <<"Yes" << endl;
    else cout << "No" << endl;
    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
#define F first
#define S second
#define pb push_back
#define INF 1e18
#define MOD 1000000007
#define N 1000005
#define BB(V) V[V.size()-2]
#define ex(V) return printf(V),0
using namespace std;
pii a[1005];
vector<int>d;
char dir[5]="LUDR";
int main() {
    int n;
    scanf("%d",&n);
    for(int i=0;i<n;i++){
		int t1,t2;
		scanf("%d%d",&t1,&t2);
		a[i]={t1+t2,t1-t2};
		if(!!(a[0].F%2)!=!!(a[i].F%2))ex("-1");
    }
    for(int i=30;i>=0;i--)d.push_back(1<<i);
    if(a[0].F%2==0)d.push_back(1);
    printf("%u\n",d.size());
    for(auto &p:d)printf("%d ",p);
    puts("");
    for(int i=0;i<n;i++){
        ll x=0,y=0;
        for (auto &p:d){
			int f=0;
            if(x<a[i].F)f+=1,x+=p;
            else x-=p;
            if(y<a[i].S)f+=2,y+=p;
            else y-=p;
            printf("%c",dir[f]);
        }
        puts("");
    }
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
int a,b,c;
scanf("%d",&a);
scanf("%d",&b);
scanf("%d",&c);
if(a >= b && b >= c )
	printf("%d %d %d\n",c,b,a);
else if(a >= c && c >= b)
	printf("%d %d %d\n",b,c,a);
else if(b >= a && a >= c)
	printf("%d %d %d\n",c,a,b);
else if(b >= c && c >= a)
	printf("%d %d %d\n",a,c,b);
else if(c >= a && a >= b)
	printf("%d %d %d\n",b,a,c);
else if(c >= b && b >= a)
	printf("%d %d %d\n",a,b,c);
return 0;

}

Measured memory_bytes: 596
//                          **********  YATIN KWATRA  ********** 

//AC bakshi Rabha

#include <bits/stdc++.h>
#define ll                      long long 
#define ull                     unsigned long long 
#define FIO                     ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl                    "\n"
#define fo(i,a,b)               for(int i = a; i<=b ; i++)
#define rfo(i,a,b)              for(int i = a; i>=b ; i--)
#define vii                      vector<int>
#define vll                     vector<ll>
#define pq                      priority_queue
#define uom                      unordered_map                
#define all(v)                  v.begin(),v.end()
#define mp                      make_pair
#define pb                      push_back
#define pob                     pop_back
#define ff                      first
#define ss                      second
#define pii                     pair<int,int> 
#define pll                     pair<long,long>
#define mll                     map<ll,ll>
#define mii                     map<int,int>
#define vvii                    vector<vii>
#define vvll                    vector<vll>
#define mod                     1000000007
#define pi                      3.1415926535897932384626433832795
// #define node                    Node

using namespace std;

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

}

#define ld long double
void solve()
{ 
       ll n;
       ld m;
       cin >> n >> m;

       ll ans = ((ld)(m*n) + 0.001);

       cout << ans << endl;
    
 }   
int main() {
    
    FIO
    INPUT();
    
    int t;
    t = 1;
 //   cin >> t;
    
    while(t--)
    {
       solve();
    }
    return 0;
}


Measured memory_bytes: 3692
n = int(input())
S = {}
for i in range(n):
    a = input()
    if a in S:
        S[a] += 1
    else:
        S[a] = 1

S = sorted(S.items(), key=lambda x: x[1], reverse=True)
max_str = []
before = S[0][1]
for i in range(len(S)):
    if before > S[i][1]:
        break
    max_str.append(S[i][0])
    before = S[i][1]
max_str.sort()
for s in max_str:
  print(s)

Measured memory_bytes: 112344
#include<bits/stdc++.h>
using namespace  std;
int main(){


  int N;
  long long A[200000];
  cin>>N;

  for(int i=0;i<N;i++){
    cin>>A[i];

  }
  int sta=0;
  int po=1;

  for(int i=0;i<N;i++){
    if(po==A[i]) {po++; }
    else { sta++; }

  }
  if(N==sta) cout<<-1<<endl;
 else  cout<<sta<<endl;
}

Measured memory_bytes: 1792
#N, *a = map(int, open(0).read().split())
def main():
    N = int(input())
    a=[]
    for i in range(N):
        a.append(int(input()))

    b = [0 for _ in range(N+2)]
    cnt = 1
    ans = 0
    flag = 1
    i = 0
    for i in reversed(range(N)):
        if b[a[i]+1] > 0:
            b[a[i]] = b[a[i]+1] + 1
        else:
            b[a[i]] = 1
        
    return N-max(b)
print(main())


Measured memory_bytes: 18860
from math import ceil 

n,k = map(int,input().split())

count = 0
num = n // k
bb = [(i+1)*k for i in range(num) ]
s = len(bb) 
count += s + 3*s*(s-1) + s*(s-1)*(s-2)  

if k % 2 == 0:    
  bb=[]
  tmp = k//2  
  while tmp <= n:
    bb.append(tmp)
    tmp += k      
  s = len(bb)
  count += s + 3*s*(s-1) + s*(s-1)*(s-2)

print(count)  

Measured memory_bytes: 11032
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,k;
  cin>>n>>k;
  int count=0;
  vector<int>vec(n);
  for (int i=0;i<n;i++){
    cin>>vec.at(i);
    if(vec.at(i)>=k){
      count++;
    }
  }
cout<<count<<endl;
}

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

#define rep(i, n) for(int i = 0; i < n;i++)

int main()
{
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    cout << (abs(a - c) <= d ? "Yes" : (abs(a - b) <= d && abs(b - c) <= d) ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int x,a,b,n,m;
	cin>>x>>a>>b;
	n=abs(x-a);
	m=abs(x-b);
	if(m>n)
	cout<<"A";
	if(m<n)
	cout<<"B";
	return 0;
}

Measured memory_bytes: 256
n, m = map(int, input().split())
in_list = input().split()
vote_list = [int(i) for i in in_list]

ans = 0
for ai in vote_list:
    if ai >= 1/(4*m)*sum(vote_list):
        ans += 1

if ans < m :
    print('No')
else:
    print('Yes')

Measured memory_bytes: 9080
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int64_t n,k = 0;
  cin >> n >> k;
  vector<int64_t> h(n);
  for(int i = 0; i < n; i++) {
    cin >> h.at(i);
  }
  int64_t sum = 0;
  sort(h.begin(),h.end());
  reverse(h.begin(),h.end());
  for(int i = k ; i < n; i++) {
    sum += h.at(i);
  }
  cout << sum << endl;
}

Measured memory_bytes: 1792
import numpy as np

n, m, c = map(int, input().split())
b = np.array(list(map(int, input().split())))

cnt = 0
for _ in range(n):
    a = np.array(list(map(int, input().split())))
    if sum(a * b) + c > 0:
        cnt += 1

print(cnt)

Measured memory_bytes: 27156
#include <iostream>
#include <fstream>
#include <cassert>
#include <typeinfo>
#include <vector>
#include <stack>
#include <cmath>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <iomanip>
#include <cctype>
#include <random>
#include <complex>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<P,int> pip;
typedef vector<pip> vip;
const int inf=1<<29;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-7;
const ll mod=1e9+7;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

int n;
vp a;

int main(){
	while(1){
		cin>>n;
		if(!n) break;
		a=vp(n);
		int sum=0,M=0,wsum=0;
		for(int i=0;i<n;i++){
			int r,w;
			cin>>r>>w;
			sum+=r;
			wsum+=w;
			M=max(M,r);
			a[i]={r,w};
		}
		sort(a.begin(),a.end());
		if(sum<2*M){
			int S=2*M-sum;
			vi dp(S+1);
			dp[0]=1;
			for(int i=0;i<n-1;i++) for(int j=S;j>=a[i].second;j--){
				dp[j]|=dp[j-a[i].second];
			}
			for(int i=S;i>=0;i--) if(dp[i]){
				cout<<2*M+wsum-i<<endl;
				break;
			}
		}
		else cout<<sum+wsum<<endl;
	}
}

Measured memory_bytes: 3108
import sys
input = sys.stdin.readline
from operator import itemgetter
sys.setrecursionlimit(10000000)
INF = 10**30

def main():
    h, w, wa, hb = list(map(int, input().strip().split()))
    for i in range(h):
        if i < hb:
            print('0' * wa + '1' * (w-wa))
        else:
            print('1' * wa + '0' * (w-wa))


if __name__ == '__main__':
    main()


Measured memory_bytes: 39792
#include <algorithm>
#include <bitset>
#include <cmath>
#include <complex>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <vector>

const int MOD = 1e9 + 7;
const int iINF = 2147483647 / 2;
const long long int llINF = 9223372036854775807 / 2;

using namespace std;
using ll = long long int;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vvvl = vector<vector<vector<ll>>>;

typedef pair<ll, ll> pll;
bool paircomp(const pll &a, const pll &b) {
  if (a.first == b.first)
    return a.second < b.second;
  return a.first < b.first;
}

#define REP(i, n) for (ll i = 0; i < (n); i++)
#define RREP(i, n) for (ll i = (n)-1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define AUTO(i, m) for (auto &i : m)
#define ALL(a) (a).begin(), (a).end()
#define MAX(vec) *std::max_element(vec.begin(), vec.end())
#define MIN(vec) *std::min_element(vec.begin(), vec.end())
#define ARGMAX(vec)                                                            \
  std::distance(vec.begin(), std::max_element(vec.begin(), vec.end()))
#define ARGMIN(vec)                                                            \
  std::distance(vec.begin(), std::min_element(vec.begin(), vec.end()))
#define REV(T) greater<T>()
#define PQ(T) priority_queue<T, vector<T>, greater<T>>
#define VVL(a, b, c) vector<vector<ll>>(a, vector<ll>(b, c))
#define VV(T, a, b, c) vector<vector<T>>(a, vector<T>(b, c))
#define VVVL(a, b, c, d)                                                       \
  vector<vector<vector<ll>>>(a, vector<vector<ll>>(b, vector<ll>(c, d)))
#define VVV(T, a, b, c, d)                                                     \
  vector<vector<vector<T>>>(a, vector<vector<T>>(b, vector<T>(c, d)))
#define SP(a) setprecision(a)
#define SQRT(a) sqrt((long double)(a))
#define DPOW(a, b) pow((long double)(a), (long double)(b))
#define UNIQUE(vec)                                                            \
  do {                                                                         \
    sort(ALL((vec)));                                                          \
    (vec).erase(std::unique(ALL((vec))), (vec).end());                         \
  } while (0)

ll POW(ll n, ll m) {
  if (m == 0) {
    return 1;
  } else if (m % 2 == 0) {
    ll tmp = POW(n, m / 2);
    return (tmp * tmp);
  } else {
    return (n * POW(n, m - 1));
  }
}

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

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ll po1 = 912131111;
  ll po2 = 913101313;
  ll N, K, S;
  cin >> N >> K >> S;
  REP(i, K) cout << S << " ";
  REP(i, N - K) {
    if (S % po1 != 0)
      cout << po1 << " ";
    else
      cout << po2 << " ";
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 1280
import java.util.*;
import java.awt.geom.*;

public class Main{
	boolean [] isPrime;
	int MAX = 1000000,size = 1000 + 2, offset = size / 2 - 1, INF = 1 << 24;
	int [][] data;
	
	private void prime(){
		isPrime = new boolean[MAX + 1];
		Arrays.fill(isPrime, true);
		isPrime[0] = false;
		isPrime[1] = false;
		for(int i = 2; i * 1 <= MAX; i++){
			if(isPrime[i]){
				for(int j = i + i; j <= MAX; j+=i){
					isPrime[j] = false;
				}
			}
		}
	}
	
	private void numArray(){
		data = new int[size][size];
		for(int i = 0; i < size; i++){
			Arrays.fill(data[i], INF);
		}
		int now = 1, posx = offset, posy = offset;
		for(int i = 1;now <= MAX;i++){
			System.out.print("");
			if(i % 2 == 1){
				//right up
				for(int j = 0; j < i && now <= MAX; j++){
					data[posy][posx] = now;
					posx++;
					now++;
				}
				for(int j = 0; j < i && now <= MAX; j++){
					data[posy][posx] = now;
					posy--;
					now++;
				}
			}
			else{
				//left down
				for(int j = 0; j < i && now <= MAX; j++){
					data[posy][posx] = now;
					posx--;
					now++;
				}
				for(int j = 0; j < i && now <= MAX; j++){
					data[posy][posx] = now;
					posy++;
					now++;
				}
			}
		}
	}
	
	public void doit(){
		Scanner sc = new Scanner(System.in);
		prime();
		numArray();
		while(sc.hasNext()){
			int m = sc.nextInt();
			int n = sc.nextInt();
			if((m|n) == 0) break;
			
			int x = -1, y = -1;
			for(int i = 0; i < size; i++){
				for(int j = 0; j < size; j++){
					if(data[i][j] == n){
						y = i;
						x = j;
					}
				}
			}
			int [][] dp = new int[size][size];
			dp[y][x] = 1;
			int max = 1, ind = 0;
			for(int i = y; i < size; i++){
				for(int j = 0; j < size; j++){
					if(i == y && data[i][j] != n) continue;
					if(data[i][j] > m) continue;
					if(dp[i][j] == 0) continue;
					
					if(isPrime[ data[i][j] ]){
						dp[i][j]++;
						if(max < dp[i][j]){
							max = dp[i][j];
							ind = data[i][j];
						}
						else if(max == dp[i][j]){
							if(ind < data[i][j]){
								ind = data[i][j];
							}
						}
					}

					dp[i + 1][j] = Math.max(dp[i + 1][j], dp[i][j]);
					if(j - 1 >= 0){
						dp[i + 1][j - 1] = Math.max(dp[i + 1][j-1], dp[i][j]);
					}
					if(j + 1 < size){
						dp[i + 1][j + 1] = Math.max(dp[i + 1][j + 1], dp[i][j]);
					}
				}
			}
			System.out.println((max-1) + " " + ind);
		}
	}

	private void debug(Object... o) {
		System.out.println("debug = " + Arrays.deepToString(o));
	}

	public static void main(String[] args) {
		new Main().doit();
	}
}

Measured memory_bytes: 112816
import java.util.*;

class Main{
  static int n,m,q;
  static int[] a,b,c,d;
  static int[] ary;
  static long ans=0;
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    n=sc.nextInt();
    m=sc.nextInt();
    q=sc.nextInt();
    a=new int[q];
    b=new int[q];
    c=new int[q];
    d=new int[q];
    for(int i=0;i<q;i++){
      a[i]=sc.nextInt();
      b[i]=sc.nextInt();
      c[i]=sc.nextInt();
      d[i]=sc.nextInt();
    }
    ary=new int[n];
    calc(0,m);
    System.out.println(ans);
  }
  static void calc(int pos,int remi){
    if(pos==n){
      long ten=0;
      for(int i=0;i<q;i++){
        if(ary[b[i]-1]-ary[a[i]-1]==c[i]){
          ten=ten+d[i];
        }
      }
      ans=Long.max(ten,ans);
      return;
    }
    if(pos==0){
      for(int i=1;i<=remi;i++){
        ary[0]=i;
        calc(1,remi-i);
      }
    }else{
      for(int i=0;i<=remi;i++){
        ary[pos]=ary[pos-1]+i;
        calc(pos+1,remi-i);
      }
    }
  }
}

Measured memory_bytes: 37052
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll md = 1e9 + 7;

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

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

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll n, res = 0;
	vector<ll> f(1e7+1, 1);
	cin >> n;
	for(ll i = 1; i <= n; i++) {
		ll x = i, fi = 1;
		if(i!=1) {
			for(int j = i; j <= n; j+=i) {
				f[j]++;
			}
		}
		res += i * f[i];
	}
	cout << res << "\n";
	return 0;
}

Measured memory_bytes: 81292
#include <bits/stdc++.h>
using namespace std;
using LL = int64_t;
using ULL = uint64_t;
using P = pair<LL, LL>;
#define rep(i, n) for (LL i = 0; i < (n); ++i)
//#define DEBUG

int main() {
  string s;
  cin >> s;
 
  LL len = s.size();
  LL n = (1u << (len - 1));

  LL sum = 0u;
  rep(i, n) {
    string exp = "";
    rep (j, len - 1) {
      exp += s[j]; 
      if (i & (1u << j)) {
        exp += '+';
      }
    }
    exp += s[len - 1];

    LL current_head = 0;
    while (exp.find('+', current_head) != string::npos) {
      LL end = exp.find('+', current_head);
      sum += stoll(exp.substr(current_head, end - current_head));
      current_head = end + 1;
    }
    sum += stoll(exp.substr(current_head, exp.size() - current_head));
    #ifdef DEBUG
    cout << exp << endl;
    cout << sum << endl;
    #endif

  }
  cout << sum << endl;
  
  
  #ifdef DEBUG
  #endif
}



Measured memory_bytes: 256
N,M = map(int,input().split())
K=[0]*N
A=[[0] for _ in range(N)]
for i in range(N):
  tmp = list(map(int,input().split()))
  K[i]=tmp[0]
  A[i]=set(tmp[1:])
  
for j,item in enumerate(A):
  if j==0:
    ans=A[j]
    #print(j,ans)
  else:
    ans=ans.intersection(item)
    #print(j,ans)
    
print(len(ans))

Measured memory_bytes: 3064
I=input
r=range
a=[[[0 for i in r(10)]for j in r(3)]for k in r(4)]
for i in r(int(I())):b,f,r,v=map(int,I().split());a[b-1][f-1][r-1]+=v
f=0
for i in a:
  if f:print('#'*20)
  else:f=1
  for j in i:print('',*j)

Measured memory_bytes: 7788
using System;

namespace ABC139_C
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());

            var line = Console.ReadLine().Split();

            int now = 0, count = 0, max = 0;
            int pre = int.Parse(line[0]);

            for (int i = 1; i < n; i++)
            {
                now = int.Parse(line[i]);
                if (pre >= now)
                    count++;
                else
                    count = 0;
                if (count > max)
                    max = count;
                pre = now;
            }

            Console.WriteLine(max);
        }
    }
}


Measured memory_bytes: 28508
#line 1 "/mnt/c/Users/leafc/dev/compro/lib/math/prime_factorization/prime_factorization.hpp"
#include <vector>
#ifndef PRIME_FACTORIZATION
#define PRIME_FACTORIZATION

// TODO: 一般化
// nの素因数分解を行う。計算量O(sqrt(n))
template <class T> std::vector<T> prime_factorization(T n) {
  std::vector<T> ret;
  for (T d = 2; d * d <= n; d++) {
    while (n % d == 0) {
      ret.push_back(d);
      n /= d;
    }
  }
  if (n != 1)
    ret.push_back(n);
  return ret;
}
#endif
#line 1 "/mnt/c/Users/leafc/dev/compro/lib/template.hpp"


#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) (v).begin(), (v).end()
#define coutd(n) cout << fixed << setprecision(n)
#define ll long long int
#define vl vector<ll>
#define vi vector<int>
#define MM << " " <<

using namespace std;

template <class T> void say(bool val, T yes = "Yes", T no = "No") { cout << (val ? yes : no) << "\n"; }

template <class T> void chmin(T &a, T b) {
  if (a > b)
    a = b;
}

template <class T> void chmax(T &a, T b) {
  if (a < b)
    a = b;
}


#line 3 "abc169_d.cpp"

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

  auto p = prime_factorization(n);
  int s = p.size();
  map<ll, int> mp;

  REP(i, s) { mp[p[i]]++; }

  int ans = 0;
  for (const auto v : mp) {
    int cnt = v.second;
    int po = 1;
    while (cnt > 0) {
      if (cnt < po)
        break;
      cnt -= po;
      ans++;
      po++;
    }
  }

  cout << ans << endl;
}


Measured memory_bytes: 3660
#include <bits/stdc++.h>
#define rep(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define debug(x) cout<<#x<<": "<<x<<endl
using namespace std;
using ll = long long;
const ll MOD = 1e9+7;
const ll LINF = LLONG_MAX;
const int INF = INT_MAX;
const double PI=acos(-1);
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;
	if(n>=30){
		cout<<"Yes"<<endl;
	}else{
		cout<<"No"<<endl;
	}
}

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

long long int fun(int n,vector<long long int> &a,vector<long long int> &b,vector<long long int> &c,vector<vector<long long int>> &dp,int k){
    if(n<0) return 0;
    if(dp[n][k]!=-1) return dp[n][k];
    int ans=0;
    int v[2]={-1};
    if(k==0){
        ans = a[n];
        v[0]=1;
        v[1]=2;
    }
    if(k==1){
        ans = b[n];
        v[0]=0;
        v[1]=2;
    }
    if(k==2){
        ans = c[n];
        v[0]=1;
        v[1]=0;
    }
    dp[n][k] = ans+max(fun(n-1,a,b,c,dp,v[0]),fun(n-1,a,b,c,dp,v[1]));
    return dp[n][k];
}
int main(){
	long long int n,x,k,y;
	cin>>n;
	vector<long long int> a,b,c;
	vector<vector<long long int>> dp(n+1,vector<long long int>(3,-1));
	for(int i=0;i<n;i++){
		cin>>x>>y>>k;
		a.push_back(x);
		b.push_back(y);
		c.push_back(k);
	}
	long long int ans = fun(n-1,a,b,c,dp,0);
	ans = max(ans,fun(n-1,a,b,c,dp,1));
	ans = max(ans,fun(n-1,a,b,c,dp,2));
	cout<<ans<<endl;
}

Measured memory_bytes: 20620
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define dump(x) cout << x << endl
typedef int64_t Int;

using namespace std;
using Graph = vector<vector<Int>>;

const double pi = M_PI;
const Int MOD = 1000000007;

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

int H, W;
vector<string> field;
vector<vector<int>> dist;
int bfs(int h, int w) {
    int distmax = 0;
    queue<pair<int, int>> que;
    que.push({h, w});

    while (!que.empty()) {
        pair<int, int> v = que.front();
        que.pop();

        for (int i = 0; i < 4; i++) {
            int nh = v.first + dx[i];
            int nw = v.second + dy[i];

            if (nh < 0 || nw < 0 || H <= nh || W <= nw) {
                continue;
            }
            if (dist[nh][nw] != -1) {
                continue;
            }
            if (field[nh][nw] == '#') {
                continue;
            }

            dist[nh][nw] = dist[v.first][v.second] + 1;
            distmax = max(distmax, dist[nh][nw]);
            que.push({nh, nw});
        }
    }

    return distmax;
}

int main() {
    cin >> H >> W;
    dist.assign(H, vector<int>(W, -1));
    for (int i = 0; i < H; i++) {
        string s;
        cin >> s;
        field.push_back(s);
    }

    int distm = 0;
    for (int h = 0; h < H; h++) {
        for (int w = 0; w < W; w++) {
            if (field[h][w] == '#') {
                continue;
            }

            dist.assign(H, vector<int>(W, -1));
            dist[h][w] = 0;
            distm = max(distm, bfs(h, w));
        }
    }

    cout << distm << endl;

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#define max(a, b) ((a)<(b) ? (b) : (a))
#define swap(type, x, y) do{ type t = x; x = y; y = t; }while(0)
int main(){
  char s[100005];  scanf("%s", s);
  int lcount = 0, rcount = 0;
  int lpos, rpos, ave;
  int table[100005] = {0};
  int flag;
  for(int i=0; i<strlen(s); i++){
    if(s[i]=='R'){
      if(lcount > 0){
	lpos = i - lcount, rpos = i - lcount - 1;
	ave = (lcount + rcount) / 2, flag = (lcount + rcount) % 2;
	if(max(lcount, rcount) % 2 == 1)  swap(int, rpos, lpos);
	if(lcount > rcount && flag){
	  rcount = ave + 1,  lcount = ave;
	}else if(lcount < rcount && flag){
	  lcount = ave + 1,  rcount = ave;
	}else{
	  lcount = ave,  rcount = ave;
	}
	table[lpos] = lcount;
	table[rpos] = rcount;
	lcount = rcount = 0;
      }
      rcount++;
    }else{
      lcount++;
    }
  }
  lpos = strlen(s) - lcount;
  rpos = lpos - 1;
  if(max(lcount, rcount) % 2 == 1)  swap(int, rpos, lpos);
  ave = (lcount + rcount) / 2;
  flag = (lcount + rcount) % 2;
  if(lcount > rcount && flag){
    rcount = ave + 1;
    lcount = ave;
  }else if(lcount < rcount && flag){
    rcount = ave;
    lcount = ave + 1;
  }else{
    lcount = rcount = ave;
  }
  table[lpos] = lcount;
  table[rpos] = rcount;
  for(int i=0; i<strlen(s); i++)
    printf("%d ", table[i]);
  puts("");
  return 0;
}


Measured memory_bytes: 896
#include <stdio.h>

int main(void)
{
	char s[4];
	scanf("%s",s);
	if(s[0]!=s[1] && s[0]!=s[2] && s[1]!=s[2]){
		printf("Yes\n");
	}else{
		printf("No\n");
	}
	return 0;
}

Measured memory_bytes: 128
S = list(input())
T = list(input())
flag = False

for i in reversed(range(len(S) - len(T) + 1)):
  T_flg = S[i: i + len(T)]
  for j in range(len(T)):
    if T_flg[j] != T[j] and T_flg[j] != "?":
      break
  else:
    flag = True
    S[i:i + len(T)] = T
    break

if flag == False:
  print("UNRESTORABLE")
else:
  for i in range(len(S)):
    if S[i] == "?":
      S[i] = "a"
  print("".join(map(str,S)))


Measured memory_bytes: 3064
string = input().strip()

def main(string):
    if string[0] != 'A':
        return 'WA'
    if 'C' not in string[2:-1]:
        return 'WA'
    count = 0
    for s in string:
        if s.isupper():
            count += 1
    if count != 2:
        return 'WA'
    return 'AC'

print(main(string))

Measured memory_bytes: 3060
# coding: utf-8


def solve(*args: str) -> str:
    n, m, v, p = map(int, args[0].split())
    A = list(map(int, args[1].split()))
    A.sort()

    left, right = -1, n

    while left+1 < right:
        i = (left+right)//2

        if A[i]+m < A[n-p]:
            left = i
            continue

        pts = m*min(n, i+p)
        for j in range(i+1, n-(p-1)):
            pts += max(0, A[i]+m-A[j])

        if m*v <= pts:
            right = i
        else:
            left = i

    return str(n-right)


if __name__ == "__main__":
    print(solve(*(open(0).read().splitlines())))


Measured memory_bytes: 15332
/**
  @date Time-stamp: <2019-05-19 11:19:54 tagashira>
  @file a.cpp
  @title A - White Cells
  @brief https://atcoder.jp/contests/abc121/tasks/abc121_a
**/

#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main(int argc, char* argv[]) {
  int H, W, h, w;
  cin >> H >> W;
  cin >> h >> w;

  cout << (H-h)*(W-w) << "\n";

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define Phuong_ ios_base::sync_with_stdio(0); cin.tie(0);
#define REP(i,a,b) for(int i=a; i<=b; ++i)

/// easy access -------------
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
typedef pair<int,int> pi;
typedef tuple<bool, int, int> tp;
typedef vector<vector<int>> vv;
///-------------------------
const ll mod = 1e9+7;

int main()
{
    Phuong_; /// <3333
    int s;
    cin >> s;
    vector<ll> dp(s+1, 0);
    dp[0] =1;
    for(int i = 3; i<=s; ++i){
        for(int j=3; j<=i; ++j){
            dp[i] = (dp[i] + dp[i-j])% mod;
        }
    }
    cout << dp[s];
    return 0;
}


Measured memory_bytes: 3632