akhauriyash/Code-Regression huggingface dataset:
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define all(v) v.begin(), v.end()
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define Rep(n) for (ll _ = 0; _ < (ll)(n); _++)
#define P pair<ll,ll>
#define fs first
#define sc second

template<class S>S sum(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
ll min(int a,ll b){return min((ll)a,b);} ll min(ll a,int b){return min(a,(ll)b);}
template <class S> void print(vector<S> &v){for(ll i=0; i<(ll)v.size(); i++){cerr << v[i] << ' ';}cerr << endl;}
template <class S> void print(vector<vector<S>> &v) {for (ll i = 0; i < (ll)v.size(); i++) {for (ll j = 0; j < (ll)v[i].size(); j++) {cerr << v[i][j] << ' ';}cerr << endl;}}

int main(){
	int n; cin >> n;
	vector<ll> a(n), b(n);
	rep(i,n){
		cin >> a[i];
		cin >> b[i];
	}
	sort(all(a));
	sort(all(b));
	if(n%2){
		ll s = a[n/2];
		ll l = b[n/2];
		cout << l-s+1 << endl;
	}else{
		ld s = (a[n/2-1] + a[n/2])/2.;
		ld l = (b[n/2-1] + b[n/2])/2.;
		cout << (ll)((l-s)*2)+1 << endl;
	}
}

Measured memory_bytes: 6480
#include<iostream>

using namespace std;

int n;
int my_count=0;
int flag3=0,flag5=0,flag7=0;
int now=0;

int pow(int a,int b)
{
	int ans=1;
	for(int i=1;i<=b;i++)
		ans*=a;
	return ans;
}

void f(int a)
{
	for(int i=1;i<=3;i++)
	{
		if(i==1)
		{
			now+=3*pow(10,a-1);
			flag3++;
		}
		else if(i==2)
		{
			now+=(5-3)*pow(10,a-1);
			flag3--;
			flag5++;
		}
		else
		{
			now+=(7-5)*pow(10,a-1);
			flag5--;
			flag7++;
		}

		if(a==1)
		{
			if(flag3>0&&flag5>0&&flag7>0 && now<=n)
			{
				my_count++;
				//cout << now << ":YES" << endl;
			}
			else
			{
				//cout << now << ":NO" << endl;
			}
		}
		else
		{
			now/=(pow(10,a-1));
			now*=pow(10,a-1);
			f(a-1);		
		}
	}
	flag7--;
}

int main(void)
{
	cin>>n;
	
	int dig=0;
	int tmp=n;
	while(tmp!=0)
	{
		dig++;
		tmp/=10;
	}

	int ans=0;
	for(int i=3;i<=dig-1;i++)
	{
		int tmp2=pow(3,i)-pow(2,i)*3+3;
		ans+=tmp2;
		//cout<<tmp2<<endl;
	}
	
	f(dig);
	//cout<<my_count<<endl;
	ans+=my_count;

	cout << ans << endl;
}
	


	


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

#define int long long
#define rep(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define reps(i, n) for (int (i) = 1; (i) <= (n); (i)++)
typedef vector<int> vint;
typedef pair<int, int> pint;
const double PI = 3.141592653589793238462643383279;
const int DY[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const int DX[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
template<typename T, typename U> inline bool chmax(T &a, const U &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template<typename T, typename U> inline bool chmin(T &a, const U &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}
struct Init {
    Init() {
        cout << fixed << setprecision(20);
    };
} init;

int N;
int A[110000];
signed main() {
    cin >> N;
    rep(i, N) { cin >> A[i]; }
    vint a, b;
    for (int i = 0; i < N; i += 2) { a.push_back(A[i]); }
    sort(a.begin(), a.end());
    sort(A, A + N);
    for (int i = 0; i < N; i += 2) { b.push_back(A[i]); }
    b.push_back(LLONG_MAX);
    int j = 0, n = 0;
    rep(i, a.size()) {
        while (a[i] > b[j]) { j++; }
        if (a[i] == b[j]) { n++, j++; }
    }
    cout << a.size() - n << endl;
}

Measured memory_bytes: 2168
#include <iostream>

static const int MAX = 200000;

int main()
{
    int n, R[MAX];
    std::cin >> n;
    for (int i = 0; i < n; ++i) {
        std::cin >> R[i];
    }
    int maxv = -2147483648;
    int minv = R[0];
    for (int i = 1; i < n; ++i) {
        if (R[i] - minv > maxv)
            maxv = R[i] - minv;
        if (R[i] < minv)
            minv = R[i];
    }
    std::cout << maxv << std::endl;
    
    return 0;
}


Measured memory_bytes: 3836
package main

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

var sc = bufio.NewScanner(os.Stdin)

const initBufSize, maxBufSize = 10000, 1000000

func nextStr() string {
	sc.Scan()
	return sc.Text()
}

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

func nextInts(n int) []int {
	res := make([]int, n)
	for i := range res {
		res[i] = nextInt()
	}
	return res
}

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 abs(n int) int {
	return int(math.Abs(float64(n)))
}

func pow(r, n int) int {
	return int(math.Pow(float64(r), float64(n)))
}

func main() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, initBufSize), maxBufSize)
	s := nextStr()
	if s == "ABC" {
		fmt.Println("ARC")
	} else if s == "ARC" {
		fmt.Println("ABC")
	}
}


Measured memory_bytes: 1760
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

N =  INT()
S = input()

e = [0]*N
w = [0]*N

for i in range(1, N):
	if S[i-1] == 'W':
		w[i] = w[i-1]+1
	else:
		w[i] = w[i-1]

for i in range(N-2, -1, -1):
	if S[i+1] == 'E':
		e[i] = e[i+1]+1
	else:
		e[i] = e[i+1]

ans = INF
for i in range(N):
	ans = min(ans, w[i]+e[i]) 
print(ans)


Measured memory_bytes: 18252
/**
**	author : Raghav
**	codechef:raghav_456
**	codeforces:raghavramola7
**/
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define ff              first
#define ss              second
#define int             long long int
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;


void Raghav()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}
//int x = 1e6;
int a[1000000];
bool isPrime(int n)
{
	for (int i = 2; i <= sqrt(n) + 1; i++)
	{
		if (n % i == 0 && i != n)
		{
			return false;
		}
	}
	return true;
}
int32_t main()
{
	Raghav();
	int n;
	cin>>n;
	int a = n*n;
	cout<<n+a+(a*n);
	return 0;
}

Measured memory_bytes: 3596
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]
def input():
    return sys.stdin.readline().rstrip()
def rand_N(ran1, ran2):
    return random.randint(ran1, ran2)
def rand_List(ran1, ran2, rantime):
    return [random.randint(ran1, ran2) for i in range(rantime)]
def rand_ints_nodup(ran1, ran2, rantime):
  ns = []
  while len(ns) < rantime:
    n = random.randint(ran1, ran2)
    if not n in ns:
      ns.append(n)
  return sorted(ns)

def rand_query(ran1, ran2, rantime):
  r_query = []
  while len(r_query) < rantime:
    n_q = rand_ints_nodup(ran1, ran2, 2)
    if not n_q in r_query:
      r_query.append(n_q)
  return sorted(r_query)

from collections import defaultdict, deque, Counter
from sys import exit
from decimal import *
import heapq
import math
from fractions import gcd
import random
import string
import copy
from itertools import combinations, permutations, product
from operator import mul
from functools import reduce
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)
mod = 10 ** 9 + 7


#############
# Main Code #
#############

N, A, B, C = getNM()
L = getArray(N)

def counter(array):
    if (1 in array) and (2 in array) and (3 in array):
        opt = [0, 0, 0, 0]
        # 合成に10pかかる
        cnt = 0
        for i in range(len(array)):
            if opt[array[i]] > 0:
                cnt += 1
            if array[i] >= 1:
                opt[array[i]] += L[i]

        res = cnt * 10
        res += abs(opt[1] - A)
        res += abs(opt[2] - B)
        res += abs(opt[3] - C)

        return res

    else:
        return float('inf')

ans = float('inf')
def four_pow(i, array):
    global ans
    if i == N:
        ans = min(ans, counter(array))
        return
    # 4 ** Nループ
    for j in range(4):
        new_array = array + [j]
        four_pow(i + 1, new_array)

four_pow(0, [])
print(ans)

"""
4 ** Nループ
N = 5
L = [1, 1, 1, 1, 1]
cnt = 0
def four_pow(i, array):
    global cnt
    if i == N:
        cnt += 1
        return
    # ここの4を変えてrootを変更
    for j in range(4):
        new_array = array + [j]
        four_pow(i + 1, new_array)

four_pow(0, [])
# 1024
print(cnt)
"""

Measured memory_bytes: 81240
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define MOD 1000000007
#define INF (1<<30)
#define LINF (lint)(1LL<<56)
#define endl "\n"
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define Flag(x) (1<<(x))
#define Flagcount(x) __builtin_popcount(x)
#define pint pair<int,int>
#define pdouble pair<double,double>
#define plint pair<lint,lint>
#define fi first
#define se second
typedef long long lint;
int dx[8]={1,1,0,-1,-1,-1,0,1};
int dy[8]={0,1,1,1,0,-1,-1,-1};

vector<lint> ans;

void dfs(string now,int L){
    lint num=stoll(now);
    ans.push_back(num);
    if(L>10) return;
    lint last=now[L-1]-'0';
    for(int i=last-1;i<=last+1;i++){
        if(i<0 || i>=10) continue;
        char add='0'+i;
        dfs(now+add,L+1);
    }
}

int main(void){
    lint K;
    cin >> K;
    char c[10];
    c[0]='0';
    for(int i=1;i<=9;i++) c[i]=c[i-1]+1;
    for(int i=1;i<=9;i++){
        string in;
        in+=c[i];
        dfs(in,1);
    }
    sort(ans.begin(),ans.end());
    cout << ans[K-1] << endl;
}


Measured memory_bytes: 10604
h,w = gets.split.map {|n| n.to_i}
until h == 0 && w == 0
  for i in 1..h
    for j in 1..w
      if i == 1 || i == h || j == 1 || j == w
        print "#"
      else
        print "."
      end
    end
    print "\n"
  end
  print "\n"
  h,w = gets.split.map {|n| n.to_i}
end

Measured memory_bytes: 6104
package main

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

var sc *bufio.Scanner = func() *bufio.Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	return sc
}()

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

func calcP(n int) float64 {
	return math.Ceil(float64(n)/2.0) / float64(n)
}

func main() {
	n := nextInt()
	fmt.Println(calcP(n))
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int main()
{
   int a,b;
   cin>>a>>b;
   if((a==1 && b==2)||(a==2 && b==1))
   {
       cout<<3<<endl;
   }
   if((a==1 && b==3)||(a==3 && b==1))
   {
       cout<<2<<endl;
   }
   if((a==3 && b==2)||(a==2 && b==3))
   {
       cout<<1<<endl;
   }



}


Measured memory_bytes: 256
def gcd(p,q):
    while(q!=0):
        r=p%q
        p=q
        q=r
    return p
    
n=int(input())
sum=0
for a in range(1,n+1):
    for b in range(1,n+1):
        for c in range(1,n+1):
            sum+=gcd(a,gcd(b,c))
print(sum)

Measured memory_bytes: 68736
#include <cstdio>
#include <iostream>
#include <cmath>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <memory.h>
#include <iomanip>
#include <bitset>
#include <list>
#include <stack>
#include <deque>
#include <numeric>

using namespace std;

#define mod 1000000007


int main()
{
	int n;
	cin >> n;
	vector<int> a(n, 100001);
	for(int i = 0; i < n - 1; i++){
		int b;
		cin >> b;
		a[i] = min(a[i], b);
		a[i + 1] = min(a[i + 1], b);
	}
	cout << accumulate(a.begin(), a.end(), 0) << endl;
}

Measured memory_bytes: 256
import java.awt.*;
import java.io.*;
import java.util.*;
 
public class Main {
	Scanner sc = new Scanner(System.in);
	public static void main(String[] args){
		new Main();
	}
	public Main(){
		new TestB().doIt();
	}
	class TestB{
		void doIt() {
			int N = sc.nextInt();
			int cnt = 0;
			boolean renzoku3 = false;
			for(int i = 0;i < N;i++) {
				int D1 = sc.nextInt();
				int D2 = sc.nextInt();
				if(D1 == D2) {
					cnt++;
				}else {
					cnt = 0;
				}
				if(cnt >= 3) {
					renzoku3 = true;
				}
			}
			if(renzoku3)System.out.println("Yes");
			else System.out.println("No");
		}
	}
}

Measured memory_bytes: 36064
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;

#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#define start_routine() int begtime = clock();
#define end_routine() int endtime = clock(); cerr << endl << "Time elapsed: " << (endtime - begtime)*1000/CLOCKS_PER_SEC << " ms"; return 0
#define speed() cin.tie(0), cout.tie(0), ios_base::sync_with_stdio(false)
// #define exit(a, b) return cout << a, b;

// debugger
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cout << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#define debug(stuff) cout << #stuff << ": " << stuff <<endl
#define debugc(stuff) cout << #stuff << ": "; for(auto x: stuff) cout << x << " "; cout << endl;
// 

#define loop(i,a,b) for(ll i=a;i<b;i++)
#define all(v) v.begin(), v.end() 

#define print(stuff) cout << stuff << endl
#define printc(stuff) for(auto x: stuff) cout << x << " "; cout << endl;
#define printPrec(stuff) cout << fixed << setprecision(15) << stuff << endl;
#define len length
#define ret0 return 0
#define ret return 


#define ll long long
#define ld long double
#define fi first
#define endl '\n'
#define se second
#define pb push_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define fill(ar, x) memset(ar, x, sizeof ar)

#define vl vector<ll> 
#define sl set<ll>
#define pll pair<ll, ll>
#define mll map<ll, ll> 
#define pq priority_queue<ll>

// typedef tree<ll,null_type,less<ll>,rb_tree_tag,
// tree_order_statistics_node_update> indexed_set;

#define inf (long long int) 1e18
#define eps 0.000001
#define mod 1000000007
#define mod1 998244353
#define MAXN (ll)1e5+5

void solve(){
    ll n;
    cin>>n;
    ll a[n];
    loop(i,0,n){
        cin>>a[i];
    }
    ll dp[n];
    dp[n-1] = 0;
    for(ll i=n-2; i>=0; i--){
        if(a[i] >= a[i+1]){
            dp[i] = dp[i+1]+1;
        }
        else {
            dp[i] = 0;
        }
    }
    ll ans = -inf;
    loop(i,0,n){
        ans = max(ans, dp[i]);
    }
    print(ans);
}

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

    ll t = 1;
    // cin>>t;
    while(t--){
        solve();
    }
        
  
}



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

#define PAUSE system("pause")
#define LLI long long int
#define LD long double
#define PB push_back
#define PF push_front
#define MP make_pair
#define FORi(i, a, b) for(int i = a; i < b ; ++i)
#define FORd(i, a, b) for(int i = a; i > b ; --i)

using namespace std;

int main() {
	int n,k;
	cin >> n >> k;
	vector<int> a(n);
	FORi(i,0,n){
		cin >> a[i];
	}
	
	int mask = 0;
	LLI ans = 1e16;
	const int INF = 1 << n;
	while(mask < INF){
		mask++;
		int cnt = 0;
		FORi(i,0,n){
			cnt += (mask>>i) & 1;
		}
		if (cnt != k){
			continue;
		}
		
		LLI cost = 0, h = 0;
		FORi(i,0,n){
			LLI added = 0;
			if ((mask>>i) & 1){
				if (h >= a[i]){
					added = h + 1 - a[i];
				}
			}
			h = max(h, a[i]+added);
			cost += added;
		}
		ans = min(ans, cost);
	}
	cout << ans;
	cout << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define uni(x) x.erase(unique(rng(x)),x.end())
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define dup(x,y) (((x)+(y)-1)/(y))
#define v(T) vector<T>
#define vv(T) v(v(T))
using ll = int64_t;
using ull = uint64_t;
using uint = uint32_t;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using pil = pair<int,ll>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,v.size())i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,v.size())s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(v.size())o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
const double eps = 1e-6;
const ll LINF = 100200300400500600ll;
const int INF = 1001001001;
//--------------------------------------------------------
#define fastio cin.tie(nullptr); std::ios::sync_with_stdio(false);
#define myio ifstream iofi; if(argc>1){iofi.open(argv[1]); std::cin.rdbuf(iofi.rdbuf());}
#define myloopset int loop = 1; if(argc>2) loop =stoi(argv[2]); rep(i,loop)
//--------------------------------------------------------------
template <class T> T chmin(T &a,T b){if(a>b){a=b; return 1;}else return 0;}
template <class T> T chmax(T &a,T b){if(a<b){a=b; return 1;}else return 0;}
const int dx[4] = {0,1,0,-1};
const int dy[4] = {-1,0,1,0};
const int mod = 1000000007;
#define Yes(ifeq) cout<<((ifeq)? "Yes":"No")<<endl;

void Main(){
  string s;
  cin>>s;
  Yes(s[2]==s[3] and s[4]==s[5]);
  return;
} signed main(int argc,char** argv)
{fastio; myio; myloopset Main();}


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

int main() {
  int r;
  std::cin >> r;

  if (r < 1200) {
    std::cout << "ABC" << std::endl;
  } else if (r < 2800) {
    std::cout << "ARC" << std::endl;
  } else {
    std::cout << "AGC" << std::endl;
  }
  return 0;
}


Measured memory_bytes: 256
A, B, C, X = int(input()), int(input()), int(input()), int(input())

ans = 0
for n_500yen in range(int(min(X/500, A)+1)):  # 500円玉使用数。0枚時も含む
    for n_100yen in range(int(min(X/100, B)+1)):  # 100円玉使用数。0枚時も含む
        for n_50yen in range(int(min(X/50, C)+1)):  # 50円玉使用数。0枚時も含む
            if n_500yen*500+n_100yen*100+n_50yen*50 == X:
                ans += 1

print(ans)

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

int main() {
 int N;
 cin >> N;
 vector<int> d(N);
 for(int i = 0;i < N;i++)cin >> d.at(i);
 sort (d.begin(), d.end());
 if(N%2 == 1){
   cout << 0 << endl;}
 if(N%2 == 0){
   cout << d.at(N / 2 ) - d.at(N / 2 - 1) << endl;
 }
}


Measured memory_bytes: 640
n=int(input())

a=list(map(int,input().split()))
b=list(map(int,input().split()))

num=sum(b)-sum(a)
if num<0:
    print("No")
    exit()

need=0
for i in range(n):
    aa=a[i]
    bb=b[i]
    if aa>bb:
        need+=aa-bb
    elif aa<bb:
        need-=(bb-aa)//2

if need<=0:print("Yes")
else:print("No")

Measured memory_bytes: 4600
#[allow(unused_imports)]
use std::char::*;
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;

#[allow(unused_macros)]
macro_rules! debug {($($a:expr),*) => {println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);}}
#[allow(unused_macros)]
macro_rules! input { ( source = $ s : expr , $ ( $ r : tt ) * ) => { let mut iter = $ s . split_whitespace ( ) ; let mut next = || { iter . next ( ) . unwrap ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; ( $ ( $ r : tt ) * ) => { let stdin = std :: io :: stdin ( ) ; let mut bytes = std :: io :: Read :: bytes ( std :: io :: BufReader :: new ( stdin . lock ( ) ) ) ; let mut next = move || -> String { bytes . by_ref ( ) . map ( | r | r . unwrap ( ) as char ) . skip_while ( | c | c . is_whitespace ( ) ) . take_while ( | c |! c . is_whitespace ( ) ) . collect ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; }
#[allow(unused_macros)]
macro_rules! input_inner { ( $ next : expr ) => { } ; ( $ next : expr , ) => { } ; ( $ next : expr , $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let $ var = read_value ! ( $ next , $ t ) ; input_inner ! { $ next $ ( $ r ) * } } ; }
#[allow(unused_macros)]
macro_rules! read_value { ( $ next : expr , ( $ ( $ t : tt ) ,* ) ) => { ( $ ( read_value ! ( $ next , $ t ) ) ,* ) } ; ( $ next : expr , [ $ t : tt ; $ len : expr ] ) => { ( 0 ..$ len ) . map ( | _ | read_value ! ( $ next , $ t ) ) . collect ::< Vec < _ >> ( ) } ; ( $ next : expr , chars ) => { read_value ! ( $ next , String ) . chars ( ) . collect ::< Vec < char >> ( ) } ; ( $ next : expr , usize1 ) => { read_value ! ( $ next , usize ) - 1 } ; ( $ next : expr , $ t : ty ) => { $ next ( ) . parse ::<$ t > ( ) . expect ( "Parse error" ) } ; }

#[derive(PartialEq, PartialOrd)]
pub struct Total<T>(pub T);
impl<T: PartialEq> Eq for Total<T> {}
impl<T: PartialOrd> Ord for Total<T> { fn cmp(&self, other: &Total<T>) -> std::cmp::Ordering { self.0.partial_cmp(&other.0).unwrap() }}

#[allow(dead_code)]
const MAX:usize = 100006;
#[allow(dead_code)]
const INF_U32:u32 = 1 << 31;
#[allow(dead_code)]
const INF_I32:i32 = 1 << 30;
#[allow(dead_code)]
const INF_U64:u64 = 1 << 63;
#[allow(dead_code)]
const INF_I64:i64 = 1 << 62;
#[allow(dead_code)]
const MOD:i64 = 1e9 as i64 + 7;

#[allow(dead_code)]
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().split_whitespace()
        .map(|e| e.parse().ok().unwrap()).collect()
}

fn main() {
    input!{n:i64};
    if n%2!=0 { println!("0"); return(); }
    let mut n = n;
    let mut ans = 0;
    n /= 2;
    while n!=0 {
        n /= 5;
        ans += n;
    }
    println!("{}", ans);

}

Measured memory_bytes: 4352
#include <iostream>

using namespace std;

typedef long long ll;

int main()
{
    ios_base::sync_with_stdio(0);
    ll a, b, c, d, e, f;
    cin >> a >> b >> c >> d >> e >> f;
    ll mas = -1, cuk = -1, wod = -1;
    for (ll i = 0; 100 * a * i <= f; ++i)
    {
        ll s1 = 100 * a * i;
        for (ll j = 0; s1 + 100 * b * j <= f; ++j)
        {
            ll s2 = s1 + 100 * b * j;
            for (ll k = 0; s2 + k * c <= f; ++k)
            {
                ll s3 = s2 + k * c;
                for (ll o = 0; s3 + o * d <= f; ++o)
                {
                    ll s4 = s3 + o * d;
                    ll W = 100 * a * i + 100 * b * j;
                    ll C = k * c + o * d;
                    if (100 * C * (e + 100) <= (C + W) * 100 * e)
                    {
                        if (mas == -1 || (100 * cuk * (C + W) <= 100 * C * (cuk + wod)))
                        {
                            mas = s4;
                            cuk = C;
                            wod = W;
                        }
                    }
                }
            }
        }
    }
    cout << mas << " " << cuk;
    return 0;
}


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

int main() {
  int n, a, b;
  std::cin >> n >> a >> b;

  int count = 0;
  for (int i = 1; i <= n; i++) {
    auto j = i;
    int t = j % 10;
    j /= 10;
    t += j % 10;
    j /= 10;
    t += j % 10;
    j /= 10;
    t += j % 10;
    j /= 10;
    t += j % 10;
    if (a <= t && t <= b) {
      count += i;
    }
  }

  std::cout << count << std::endl;
  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#define N 100
using namespace std;

int main()
{
  int m[N + 1][N + 1], p[N + 1], n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++)
  {
    scanf("%d%d", &p[i], &p[i + 1]);
  }

  for (int i = 1; i <= n; i++) m[i][i] = 0;
  for (int l = 2; l <= n; l++)
  {
    for (int i = 1; i <= n - l + 1; i++)
    {
      int j = i + l - 1;
      m[i][j] = 1 << 21;
      for (int k = i; k <= j - 1; k++)
      {
        m[i][j] = min(m[i][j], m[i][k] + m[k + 1][j] + p[i - 1] * p[k] * p[j]);
      }
    }
  }
  printf("%d\n", m[1][n]);
  return 0;
}



Measured memory_bytes: 2772
using System;

namespace ALDS1_5A_2{
    public class Program{
        public static void Main(string[] args){
            var sr = new StreamReader();
            //---------------------------------
            var N = sr.Next<int>();
            var A = sr.Next<int>(N);
            var Q = sr.Next<int>();
            var M = sr.Next<int>(Q);

            Func<int, int, bool> solve = null;
            solve = (i, x) =>{
                if(x == 0) return true;
                if(i >= N) return false;
                return solve(i + 1, x - A[i]) || solve(i + 1, x);
            };

            foreach(var m in M){
                Console.WriteLine(solve(0, m) ? "yes" : "no");
            }
            //---------------------------------
        }
    }

    public class StreamReader{
        private readonly char[] _c = {' '};
        private int _index = -1;
        private string[] _input = new string[0];

        public T Next<T>(){
            if(_index == _input.Length - 1){
                _index = -1;
                while(true){
                    string rl = Console.ReadLine();
                    if(rl == null){
                        if(typeof(T).IsClass) return default(T);
                        return (T)typeof(T).GetField("MinValue").GetValue(null);
                    }
                    if(rl != ""){
                        _input = rl.Split(_c, StringSplitOptions.RemoveEmptyEntries);
                        break;
                    }
                }
            }
            return (T)Convert.ChangeType(_input[++_index], typeof(T), System.Globalization.CultureInfo.InvariantCulture);
        }

        public T[] Next<T>(int x){
            var ret = new T[x];
            for(var i = 0; i < x; ++i) ret[i] = Next<T>();
            return ret;
        }

        public T[][] Next<T>(int y, int x){
            var ret = new T[y][];
            for(var i = 0; i < y; ++i) ret[i] = Next<T>(x);
            return ret;
        }
    }
}

Measured memory_bytes: 10220
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    private static long lcm(long a, long b) {
        return a * (b / gcd(a, b));
    }

    private static long gcd(long a, long b) {
        return b==0 ? a : gcd(b, a%b);
    }

    public static void main(String[] args) {
        StringBuilder sb = new StringBuilder();
        try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
            String[] split = br.readLine().split("\\s+");
            int a = Integer.parseInt(split[0]);
            int b = Integer.parseInt(split[1]);
            System.out.println(lcm(a,b));
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}

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

using namespace std;

int main(){
	int n;
	cin >> n;
	int arr[n];
	int max = 0;
	int min = 100000;
	long long sum = 0;
	for(int i = 0; i < n; i ++){
		cin >> arr[i];
		sum += arr[i];
		if(arr[i]>max)
			max = arr[i];
		if(arr[i] < min)
			min = arr[i];
	}
	cout << sum-n << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#define INF (1 << 21)
using namespace std;

int main() {
    int n,m; cin >> n >> m;
    int c[21];
    for(int i=1;i<=m;i++) cin >> c[i];
    int T[50005];
    for(int i=0;i<50005;i++) T[i] = INF;
    T[0] = 0;
    for(int i=1;i<=m;i++) {
        for(int j=0;j + c[i] <= n; j++) {
            T[ j + c[i] ] = min(T[ j+c[i] ],T[j]+1);
        }
    }
    cout << T[n] << endl;
    return 0;
}



Measured memory_bytes: 3284
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n;i++)
using namespace std;
int main(){
    int n;
    cin >> n;
    vector<int> a(n), b(n), c(n - 1);
    rep(i, n){
        cin >> a[i];
        a[i]--;
    }
    rep(i, n) cin >> b[i];
    rep(i, n-1) cin >> c[i];
    int ans = b[a[0]];
    rep(i,n-1){
        ans += b[a[i + 1]];
        if(a[i+1]-1==a[i])
            ans += c[a[i]];
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
from fractions import gcd
from collections import Counter, deque, defaultdict
from heapq import heappush, heappop, heappushpop, heapify, heapreplace, merge
from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort
from itertools import product, combinations,permutations
from copy import deepcopy
import sys
from math import sqrt
sys.setrecursionlimit(4100000)



if __name__ == '__main__':
    N = int(input())

    max_N = int(sqrt(N))+2
    ans = 10e13
    for a in range(1, max_N):
        if N%a==0:
            b = N//a
            ans = min(ans, a+b-2)
    print(ans)

Measured memory_bytes: 10608
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <functional>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <fstream>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<P> vp;
#define rep(i,a,n) for(ll i = (a);i < (n);i++)
#define per(i,a,n) for(ll i = (a);i > (n);i--)
#define lep(i,a,n) for(ll i = (a);i <= (n);i++)
#define pel(i,a,n) for(ll i = (a);i >= (n);i--)
#define clr(a,b) memset((a),(b),sizeof(a))
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define sz size()
#define endl "\n"
#define print(X) cout << (X) << "\n"
// // #define input(X) getline(cin,X)
static const ll  INF = 1e9+7;
static const ll INFL = 1e18+7;
ll n,m,l, p;
string s,t;
ll d[200010],e[200010],dp[1001][1001];
char field[202][202];

void check(){
    lep(i,0,n){
        printf("%lld : %lld\n", i, d[i]);
    }
    puts("");
}

int main(){
    clr(d, 0);
    cin >> n >> m;
    rep(i,0,n)cin >> e[i];
    rep(i,0,n)d[i] = INF;

    d[0] = 0;
    rep(i,0,n)
        lep(k,1,m)
            if(i+k < n)d[i+k] = min(d[i+k], d[i] + abs(e[i+k]-e[i]));

    // check();

    print(d[n-1]);
    return 0;
}


Measured memory_bytes: 5120
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
  int n,j,a[100]={0};
  cin>>n;
  for(int i=0;i<n;i++){
          cin >> a[i];
    }
    cout<<a[n-1];
     
    for(int i=1; i<n; i++){
            j=(n-1)-i;
            cout << " " << a[j];
    }
    cout << endl;
  
}


Measured memory_bytes: 3084
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
Int m[90];
Int lu(Int i){
  if(~m[i]) return m[i];
  if(i>=2) return m[i]=lu(i-1)+lu(i-2);
  if(i==0) return m[i]=2;
  if(i==1) return m[i]=1;
}
signed main(){
  memset(m,-1,sizeof(m));
  Int n;
  cin>>n;
  cout<<lu(n)<<endl;
  
  return 0;
}


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

int main()
{
    int d;
    cin>>d;
    if(d==22)cout<<"Christmas Eve Eve Eve"<<endl;
    else if(d==23)cout<<"Christmas Eve Eve"<<endl;
    else if(d==24)cout<<"Christmas Eve"<<endl;
    else if(d==25)cout<<"Christmas"<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <queue>
#include <bitset>

using ll = long long int;
using ul = unsigned long long int;

namespace lamlib
{
	// Absolute
	template<class T> inline T abs(const T &a){ return (a>0) ? a : -a; }
	// GCD: a > b
	ul gcd(ul a,ul b) { return (!b) ? a : gcd(b,a%b); }
}

int main(int argc,char *argv[])
{
	ll n;
	std::cin >> n;

	ll ans = n%10;

	if(ans == 3) std::cout << "bon" << std::endl;
	else if(ans == 0||ans==1||ans==6||ans==8) std::cout << "pon" << std::endl;
	else std::cout << "hon" << std::endl;

	return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
#define _LIBCPP_DEBUG 0

using namespace std;
#define ll long long
#define rep(i,n) for (int i = 0; i < n; i++)
#define rrep(i,n) for (int i = n-1; i >= 0; i--)
#define MOD (1000000007)
#define vi vector<int>
#define vl vector<ll>
#define vb vector<bool>
#define vvi vector<vi>
#define vvl vector<vl>
#define pii pair<int, int>
#define pli pair<ll, int>a
#define pb push_back
#define sz(x) int(x.size())

#define mp make_pair
#define all(a) (a).begin(),(a).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; }

ll gcd(ll a, ll b) {
    if (b == 0) return a;
    else return gcd(b, a % b);
}

ll keta(ll n){
  string s = to_string(n);
  ll num = s.size();
  return num;
}

const ll INF = 1LL << 60;

const int dh[4] = {1,0,-1,0};
const int dw[4] = {0,1,0,-1};

struct Edge{
  int to;
  int weight;
  Edge(int t, int w) : to(t), weight(w){}
};
using Graph = vector<vector<Edge>>;
using P = pair<ll, int>;

class UnionFind{
public:
  vi Parent;
  UnionFind(int n){
    Parent = vi(n,-1);
  }

  int root(int a){
    if(Parent[a] < 0) return a;
    else return Parent[a] = root(Parent[a]);
  }

  int size(int a){
    return -Parent[root(a)];
  }

  bool merge(int a, int b){
    a = root(a);
    b = root(b);
    if(a == b) return false;

    if(size(a) < size(b)) swap(a,b);
    Parent[a] += Parent[b];
    Parent[b] = a;

    return true;
  }
};

class Factrial{
public:
  vl Fac;
  Factrial(int MAX){
    Fac = vl(MAX+1);
    rep(i,MAX) {
      if(i == 0) Fac[i+1] = 1;
      else Fac[i+1] = ((i+1)*Fac[i])%MOD;
    }
  }
};

int main(){
  int n,k; cin >> n >> k;
  int tmp = 1;
  rep(i,100) {
    tmp *= k;
    if(tmp > n){
      cout << i+1 << endl;
      return 0;
    }
  }
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<queue>
#include<utility>

using namespace std;

int n, s;

int cntBit(int bit)
{
	int cnt = 0;

	do
	{
		cnt += bit & 1;

		bit /= 2;

	} while (bit);

	return cnt;
}

int main(void)
{

	while (cin >> n >> s,n!=0||s!=0)
	{
		int cnt = 0;

		for (int i = 0; i < 1024; i++)
		{
			if (cntBit(i) != n)continue;

			int sum = 0;

			for (int j = 0; j < 10; j++)
				if ((i >> j) & 1)sum += j;

			if (sum == s)cnt++;
		}

		cout << cnt << endl;
	}
	

	return 0;
}


Measured memory_bytes: 3084
n, x = map(int, input().split())
arr = list(map(int, input().split()))

arr.sort()
ans = 0

for i in arr:
    x -= i
    if x < 0:
        break
    else:
        ans += 1
if x > 0 and ans > 0:
    ans -= 1

print(ans)

Measured memory_bytes: 9104
# https://atcoder.jp/contests/abc174/tasks/abc174_b

N, D = gets.split.map(&:to_i)
Xs = Array.new(N)
Ys = Array.new(N)
N.times do |i|
  Xs[i], Ys[i] = gets.split.map(&:to_i)
end

ans = N.times.count do |i|
  Xs[i]**2 + Ys[i]**2 <= D**2
end

puts ans


Measured memory_bytes: 17408
//#pragma GCC target("avx2")
//#pragma GCC optimize("O3")

//# include <x86intrin.h>
# include <bits/stdc++.h>

//# include <ext/pb_ds/assoc_container.hpp>
//# include <ext/pb_ds/tree_policy.hpp>

//using namespace __gnu_pbds;
using namespace std;
 
//template<typename T> using ordered_set = tree <T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define _USE_MATH_DEFINES_
#define ll long long
#define ld long double
#define Accepted 0
#define pb push_back
#define mp make_pair
#define sz(x) (int)(x.size())
#define every(x) x.begin(),x.end()
#define F first
#define S second
#define lb lower_bound
#define ub upper_bound
#define For(i,x,y)  for (ll i = x; i <= y; i ++) 
#define FOr(i,x,y)  for (ll i = x; i >= y; i --)
#define SpeedForce ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
// ROAD to...                                                                                                                                                                                                                Red

inline void Input_Output () {
	//freopen(".in", "r", stdin);
   //freopen(".out", "w", stdout);
}

const double eps = 0.000001;
const ld pi = acos(-1);
const int maxn = 1e7 + 9;
const int mod = 1e9 + 7;
const ll MOD = 1e18 + 9;
const ll INF = 1e18 + 123;
const int inf = 2e9 + 11;
const int mxn = 1e6 + 9;
const int N = 6e5 + 123;                                          
const int M = 22;
const int pri = 997;
const int Magic = 2101;

const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};
 
int n, m, k;
int cnt[N];
string s;
int a[N];
vector < int > g[N];
int u[N];
int ans, res;
int cur;
//	mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
//	shuffle(permutation.begin(), permutation.end(), rng);



int main () {
	SpeedForce;
	cin >> s;
	if (s[2] == s[3] && s[5] == s[4]) puts("Yes");
	else puts("No");
	return Accepted;
}

// B...a

Measured memory_bytes: 18688
#include <iostream>
#include <string>
#include <cmath>
#include <vector>
#include <map>
#include <algorithm>
#include <stdio.h>

int main(){
  int n;
  std::cin >> n;
  std::vector<int> a(n);
  for(int i=0;i<n;i++){
    std::cin >> a[i];
  }
  std::sort(a.begin(),a.end());

  std::cout << a.back()-a.front();
}

Measured memory_bytes: 3632
#include <stdio.h>
int main(void) {
    double hkm,km;
    while (scanf("%lf %lf",&hkm,&km)!=EOF) {
        if (hkm<35.5&&km<71.0) {
            printf("AAA\n");
        } else if (hkm<37.5&&km<77.0) {
            printf("AA\n");
        } else if (hkm<40.0&&km<83.0) {
            printf("A\n");
        } else if (hkm<43.0&&km<89.0) {
            printf("B\n");
        } else if (hkm<50.0&&km<105.0) {
            printf("C\n");
        } else if (hkm<55.0&&km<116.0) {
            printf("D\n");
        } else if (hkm<70.0&&km<148.0) {
            printf("E\n");
        } else {
            printf("NA\n");
        }
    }
    return 0;
}

Measured memory_bytes: 608
n,m = map(int, input().split())
ac,wa = [0]*n,[0]*n
ans = 0
miss = 0
for i in range(m):
  a,b = map(str, input().split())
  a = int(a)
  if b == "AC":
    if ac[a-1]==0:
      ans += 1
      miss += wa[a-1]
      ac[a-1] += 1
  else:
    if ac[a-1]==0:
      wa[a-1] += 1
    
print("%d %d" %(ans, miss))

Measured memory_bytes: 4596
#include <bits/stdc++.h>
using namespace std;
#define FAST_IO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
typedef long long ll;

const float PI = 3.14159;

int main() {
    FAST_IO;
    
    float a, b, x;
    cin >> a >> b >> x;

    float theta1 = atanf((2.0*(a*a*b - x))/(a*a*a));
    float theta2 = atanf((a*b*b)/(2.0*x));
    float res1 = 180.0*(theta1/PI);
    float res2 = 180.0*(theta2/PI);

    float z = b/tan(theta2);
    if (z < a) {
        cout << fixed;
        cout << setprecision(6) << res2 << endl;
    } else {
        cout << fixed;
        cout << setprecision(6) << res1 << endl;
    }
    
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<numeric>
#include<math.h>
#include<algorithm>
#include<iomanip>
#include<bitset>
#include<list>
using namespace std;

// 素因数分解
// n : 素因数分解したい数
vector<vector<long long>> decompositePrime(long long n) {
	// 素因数を格納するベクトル配列を初期化
	vector<vector<long long>> prime;
	vector<long long> d;
	prime.clear();
	d.clear();

	// 最小の素因数を格納
	long long a;
	a = 2;

	// √n >= a (n >= a * a)の間ループ処理
	while (n >= a * a) {
		// a で割り切れたら、a は素因数
		// 割り切れる場合、割られる数 n を更新
		if (n % a == 0) {
			// 素因数として格納
			d.push_back(a);
			// n を更新
			n /= a;
		}
		// a で割り切れない場合、a の値を更新
		else {
			a += 1;
			if (d.size() != 0) {
				prime.push_back(d);
				d.clear();
			}
		}
	}

	if (d.size() != 0) {
		prime.push_back(d);
		d.clear();
	}

	// 最後に残った n が 1 でなければ素因数
	if (n != 1) {
		if (prime.size() == 0) {
			d.clear();
			d.push_back(n);
			prime.push_back(d);
		}
		else if (prime[prime.size() - 1][0] == n) {
			prime[prime.size() - 1].push_back(n);
		}
		else {
			d.clear();
			d.push_back(n);
			prime.push_back(d);
		}
	}

	return prime;
}

int main() {

	long long N;
	cin >> N;

	vector<vector<long long>> prime = decompositePrime(N);

	long long ans = 0;
	long long cnt;
	long long ind;

	for (long long i = 0; i < prime.size(); i++) {
		cnt = prime[i].size();
		ind = 1;
		cnt -= ind;
		while (cnt >= 0) {
			ans += 1;
			ind += 1;
			cnt -= ind;
		}
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 3636
#include <iostream>
#include <string>
#include <math.h>
using namespace std;

int main(){
	string str;
	int a=0;
	bool flag=true;
	cin >> str;
	for(int i=0;i<str.size();i++){
		if(str[i] == 'A' && a==0) a=1;
		if(str[i] == 'Z' && a==1){
			cout << "AZ";
			flag=false;
			a=0;
		}
	}
	if(flag) cout<<"-1";
	cout<<endl;
	return 0;
}

Measured memory_bytes: 1180
<?php
$num=trim(fgets(STDIN));
$number=explode(" ",trim(fgets(STDIN)));
$count=0;

for($i=0;$i<count($number)-2;$i++){
    if ($number[$i]<$number[$i+1]&&$number[$i+1]<$number[$i+2]){
    $count++;    
    }
    
    if ($number[$i]>$number[$i+1]&&$number[$i+1]>$number[$i+2]){
    $count++;    
    }
}


echo $count;
?>

Measured memory_bytes: 4604
#include<cstdio>
#include<cmath>
#include<iostream>
#include<cstdlib>
#include<algorithm>
#include<cstring>
#include<queue>
#include<stack>
#include<vector>
using namespace std;
int main(){
	int a,b,c;
	scanf("%d%d%d",&a,&b,&c);
	if(a+b+c==17&&a*b*c==175)
		printf("YES\n");
	else
		printf("NO\n");
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,h;
    cin>>n>>h;
    int a[n],b[n];
    int normal=0;//通常攻撃の最大値
    for(int i=0;i<n;i++){
        cin>>a[i]>>b[i];
        normal=max(normal,a[i]);
    }
    sort(b,b+n,greater<int>());
    int x=0;
    while(x<n && b[x]>normal && h>0){
        h-=b[x];
        x++;
    }
    if(h<=0)cout<<x<<endl;
    else cout<<x+(h-1)/normal+1<<endl;
    return 0;
}

Measured memory_bytes: 1024
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
int n,k,a[200005];
ll ans;
int main(){
	cin>>n>>k;
	rep(i,n) cin >>a[i];
	sort(a,a+n,greater<int>());
	for(int x=k;x<n;x++) ans+=a[x];
	cout<<ans<<endl;
}

Measured memory_bytes: 1024
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<cstdio>
#include<cmath>
#include<numeric>
#include<queue>
#include<stack>
#include<cstring>
#include<limits>
#include<functional>
#include<unordered_set>
#include<iomanip>
#include<cassert>
#define rep(i,a) for(int i=(int)0;i<(int)a;++i)
#define pb push_back
#define eb emplace_back
using ll=long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 50;
 
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
using namespace std;

void solve(){
    int x;
    cin>>x;
    bool dp[100005];
    int a[]={100,101,102,103,104,105};
    memset(dp,0,sizeof(dp));
    rep(i,x+5){
        rep(j,6){
            if(i-a[j]<0)continue;
            else if(i-a[j]==0)dp[i]=true;
            else {
                dp[i]|=dp[i-a[j]];
            }
        }
    }
    cout<<dp[x]<<"\n";
}
 
int main(){
	ios::sync_with_stdio(false);
    cin.tie(0);
	cout<<fixed<<setprecision(15);
	solve();
	return 0;
}


Measured memory_bytes: 384
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		String s = sc.next();

		int count = 0;

		String t = s.substring(1,s.length()-1);
		count = t.length();

		System.out.println(s.substring(0,1)+count+s.substring(s.length()-1,s.length()));
	}
}


Measured memory_bytes: 23764
#include<bits/stdc++.h>
#include<boost/variant.hpp>
using namespace std;
typedef long long ll;
typedef vector<boost::variant<bool, ll, int, string, double, char*, const char*>> anys;
template<typename T> inline void pr(const vector<T> &xs){
	for(int i=0; i<xs.size()-1; i++) cout<<xs[i]<<" ";
	(xs.empty()?cout:(cout<<xs[xs.size()-1]))<<endl;
}
#ifdef DEBUG
#define debug(...) pr(anys{__VA_ARGS__})
#define debugv(x) pr((x))
#else
#define debug(...)
#define debugv(x)
#endif

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

	vector<pair<ll, int>> ai(N);
	for(int i=0; i<N; i++) ai[i]={A[i], i};
	sort(ai.rbegin(), ai.rend());
	vector<vector<ll>> dp(N+1, vector<ll>(N+1));
	for(int i=0; i<N; i++) for(int k=0; k<=i; k++){
		int l = N-i+k-1;
		dp[i+1][k] = max(dp[i+1][k], dp[i][k] + ai[i].first * abs(ai[i].second - l));
		dp[i+1][k+1] = max(dp[i+1][k+1], dp[i][k] + ai[i].first * abs(ai[i].second - k));
		debug(i, k, N-i+k-1, dp[i+1][k], dp[i+1][k+1]);
	}

	ll ans = 0;
	for(int k=0; k<=N; k++){
		ans = max(ans, dp[N][k]);
	}
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 34676
import sys
readline = sys.stdin.readline

N, S = map(int, readline().split())
A = list(int(x) for x in readline().split())
MOD = 998244353

dp = [[0] * (S+1) for _ in range(N+1)]
dp[0][0] = 1

for i in range(N):
    for j in range(S+1):
        # 1,2のケース。jが変わらない遷移が2通りある。
        dp[i+1][j] = (dp[i+1][j] + dp[i][j] * 2) % MOD
        # 3のケース。j+A[i] <= Sならば、j+A[i]に遷移する。
        if j + A[i] <= S:
            dp[i+1][j+A[i]] = (dp[i+1][j+A[i]] + dp[i][j]) % MOD
print(dp[N][S])

Measured memory_bytes: 138872