akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge {c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "



int main() {
	string s;
	cin >> s;
	for(int i = 0; i < (int) s.length() - 1; ++i)
		if(s[i] == 'A' && s[i+1] == 'C') {
			puts("Yes");
			return 0;
		}
	puts("No");
	
	//~ int n;
	//~ cin >> n;
	//~ int odd = 1, even = 0;
	//~ while(n--) {
		//~ int x;
		//~ cin >> x;
		//~ if(x % 2) {
			//~ even = 2 * (even + odd) + even;
			//~ odd = odd
		//~ }
		//~ else {
			
		//~ }
	//~ }
	//~ printf("%d\n", even);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define ctoi(x) x-'0'
#define pshb(a) cin >> x;a.push_back(x)
#define fr(i,n) for(ll i=0;i<n;i++)
#define fast ios_base::sync_with_stdio(false);
using namespace std;
bool sortbysec(const pair<int,int> &a,
              const pair<int,int> &b)
{
    return (a.second < b.second);
}
int main()
{
    int a ,b  ;
    cin>>a>>b ;
    if (a>b)
        cout<<"No"  ;
    else
        cout<<"Yes" ;
}




Measured memory_bytes: 256
#include<iostream>
using namespace std;
int  a[1000];
int main(){
    int N;
    int flag=0;
    cin>>N;
    for(int i=0;i<N;i++)
        cin>>a[i];
    for(int i=0;i<N;i++){
        if(a[i]%2==0)
            if(a[i]%3==0||a[i]%5==0)
            flag=1;
            else {cout<<"DENIED"<<endl;return 0;}
        }
    cout<<"APPROVED"<<endl;
    
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define LL long long 
using namespace std;
const int MAXN = 1e5 + 10, MAXM = 53, INF = 1e9 + 10, mod = 1e9 + 7;
inline int read() {
    char c = getchar(); int x = 0, f = 1;
    while(c < '0' || c > '9') {if(c == '0') f = -1; c = getchar();}
    while(c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
    return x * f;
}
int N, v[MAXN] = {0, 7, 3, 5, 0}, a[MAXN], flag[MAXN], ans;
map<int, bool> vis;
void pd() {
	LL now = 0;
	
	for(int i = 1; i <= 11; i++) {
		if(a[i] == 0) {
			for(int j = i; j <= 11; j++) a[j] = 0;
			break;
		} 
		else now = now * 10 + a[i];
	}
	if(now > N) return ;
	flag[3] = flag[5] = flag[7] = 0;
	for(int i = 1; i <= 11; i++) flag[a[i]] = 1;
	if(flag[3] && flag[5] && flag[7] && !vis[now]) 
		ans++, vis[now] = 1;
}
void dfs(int x) {
	if(x == 11) return ;
	pd();
	for(int i = 1; i <= 4; i++) 
		a[x] = v[i], dfs(x + 1);
}
int main() {
	N = read();
	dfs(1);
	cout << ans;
    return 0;
}
/*
2
4 2
1
2
10 1
5
*/

Measured memory_bytes: 1536
#include <cstdio>
#include <iostream>
#include <vector>
#include <list>
#include <cmath>
#include <fstream>
#include <algorithm>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <complex>
#include <iterator>
#include <cstdlib>
#include <cstring>
#include <sstream>

using namespace std;

#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) (EQ((a).real(),(b).real()) && EQ((a).imag(),(b).imag()))

typedef complex<double> P;
typedef pair<P,P> Edge;
typedef long long ll;

const double PI=4*atan(1.0);

void fast_stream(){
	std::ios_base::sync_with_stdio(0);
}
	

#ifdef RED_FILE
ifstream ifs("input.txt");
ofstream ofs("output.txt");
#define cin ifs
#define cout ofs
#endif

const int MAX_V=1000;
const int INF=1000000000;
const int MAX_E=200000;

struct edge{
	int to,cap,rev,id;
	int flow;
	edge(int to_,int cap_,int rev_,int id_){
		to=to_;
		cap=cap_;
		rev=rev_;
		id=id_;
		flow=0;
	}
};

vector<edge> G[MAX_V];
bool used[MAX_V];
// idxðßé
int lineIdx[MAX_V][MAX_V];

// edgeðÇÁ
void add_edge(int from,int to,int cap,int id){
	G[from].push_back(edge(to,cap,G[to].size(),id));
	G[to].push_back(edge(from,cap,G[from].size()-1,id));
    lineIdx[from][to]=G[from].size()-1;
}
// ÁpXðTõ
int dfs(int v,int t,int f){
	if(v==t) return f;
	used[v]=true;
	for(int i=0;i<(int)G[v].size();i++){
		edge &e=G[v][i];
		// Ü¾t[ð¬¹éÈçÎA¬·
		if(!used[e.to]&&e.flow<e.cap){
			// ¡ñÌ¬Ê
			int quan=e.cap-e.flow;
			int d=dfs(e.to,t,min(f,quan));
			if(d>0){
				e.flow+=d;
				// ½ÎÉÍ}CiXÌvfðüêÄ¨­
				G[e.to][e.rev].flow=-e.flow;
				return d;
			}
		}
	}
	return 0;
}
int max_flow(int s,int t){
	int flow=0;
	while(1){
		memset(used,0,sizeof(used));
		int f=dfs(s,t,INF);
		if(f==0)return flow;
		else flow+=f;
	}
	return 0;
}

pair<int,int> egs[10001];
int main(){
    int n,m;
    cin>>n>>m;
    for(int i = 0; i < m; i++){
        int x,y;
        cin>>x>>y;
        add_edge(x,y,1,i);
        egs[i].first=x;
        egs[i].second=y;
    }
    int s,t;
    cin>>s>>t;
    int res=max_flow(s,t);
    vector<int> rev;
    for(int i = 0; i < m; i++){
        int a=lineIdx[egs[i].first][egs[i].second];
        if(G[egs[i].first][a].flow<0)
            rev.push_back(i+1);
    }
    cout<<res<<endl;
    cout<<rev.size()<<endl;
    for(int i=0;i<rev.size();i++)
        cout<<rev[i]<<endl;
	return 0;
}

Measured memory_bytes: 0
#ifdef LOCAL
#define _GLIBCXX_DEBUG
#endif
#include<bits/stdc++.h>
using namespace std;
#define rep(i,s,t) for(ll i = (ll)(s); i < (ll)(t); i++)
#define rrep(i,s,t) for(ll i = (ll)(s-1);(ll)(t) <= i; i--)
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> Pll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
constexpr ll INF = numeric_limits<ll>::max()/4;
constexpr ll n_max = 2e5+10;
#define int ll

template <typename A, typename B>
string to_string(pair<A, B> p);
string to_string(const string &s) {return '"' + s + '"';}
string to_string(const char *c) {return to_string((string) c);}
string to_string(bool b) {return (b ? "true" : "false");}
template <size_t N>
string to_string(bitset<N> v){
    string res = "";
    for(size_t i = 0; i < N; i++) res += static_cast<char>('0' + v[i]);
    return res;
}
template <typename A>
string to_string(A v) {
    bool first = true;
    string res = "{";
    for(const auto &x : v) {
        if(!first) res += ", ";
        first = false;
        res += to_string(x);
    }
    res += "}";
    return res;
}
template <typename A, typename B>
string to_string(pair<A, B> p){return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";}

void debug_out() {cerr << endl;}
template<typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cerr << " " << to_string(H);
    debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

template<class T>
bool chmax(T &a, T b){if(a < b){a = b; return true;} return false;}
template<class T>
bool chmin(T &a, T b){if(a > b){a = b; return true;} return false;}

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    ll n; cin >> n;
    string s, t;cin >> s >> t;
    string ans;
    rep(i, 0, n) {
        
        ans += s[i];
        ans += t[i];
    }
    cout << ans << "\n";
}

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

#define ll long long
#define ii pair<ll, ll>
#define vi vector<int>
#define vl vector<ll>
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define ff first
#define ss second
#define pi 3.14159265
#define oo 1000000007
#define loo 10000000000000007

#define prime 1000000007

#define W(x) cerr << "\033[31m" << #x << " = " << x << "\033[0m" << "\n";
using namespace std;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    char c; cin >> c;
    cout << (char)(c+1) << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
   long long int N,K,h,l;
   cin >> N >> K;
   h = N%K;
   //cout << h << " ";
   if(h==0) cout << h;
   else{
       l = abs(h-K);
       if(l < N) cout << l;
       else cout << N;
   }
   return 0;
}

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

using namespace std;

#define COUNTOF(array) (sizeof(array) / sizeof(array[0]))
#define OUT(P) cout << (P) << endl
#define OUT2(P1, P2) cout << (P1) << " " << (P2) << endl
#define PRINT_ARRAY(P) for(int i=0; i<P.size(); i++) cout << P[i] << endl;

// integerの各桁を足す
int sum_digits(int num);

int main() {
    int x1, y1, x2, y2;    
    cin >> x1 >> y1 >> x2 >> y2;

    int x = x2 - x1;
    int y = y2 - y1;

    int x3 = x2 - y, y3 = y2 + x, x4 = x1 - y, y4 = y1 + x;

    cout << x3 << " " << y3 << " " << x4 << " " << y4 << endl; 

    return 0;

}

/******************************/
/***** DECRARED FUNCTIONS *****/
/******************************/

// integerの各桁を足す
int sum_digits(int num) {
    int rtn = 0;
    string num_str = to_string(num);
    for(int i=0; i<num_str.size(); i++) {
        rtn += num_str[i] - '0';
    }   
    return rtn;
}



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

int main() {
  vector<int> h(10);
  for (int i = 0; i < 10; i++) {
    cin >> h[i];
  }
  sort(begin(h), end(h), greater<int>());
  for (int i = 0; i < 3; i++) {
    cout << h[i] << endl;
  }
}



Measured memory_bytes: 3144
#include<bits/stdc++.h>
const int maxn=1e5+7;
int t[maxn];
int main()
{
	int n,c,k;
	scanf("%d%d%d",&n,&c,&k);
	for(int i=1;i<=n;i++)
	scanf("%d",&t[i]);
	std::sort(t+1,t+n+1);
	long long bus=1,cnt=1,cntt=t[1];
	for(int i=2;i<=n;i++)
	{
		cnt++;
		if(t[i]-cntt>k||cnt>c)
		bus++,cnt=1,cntt=t[i];
	}
	printf("%lld",bus);
	return 0;
}

Measured memory_bytes: 640
#include <iostream>

using namespace std;

int main() {
    int N;
    cin >> N;
    int arr[N];
    for (int i=0; i<N; i++)
        cin >> arr[i];
    int tallest = 0;
    int counter = 0;
    for (int i=0; i<N; i++) {
        if (arr[i]>=tallest) {
            counter++;
            tallest = arr[i];
        }
    }
    cout << counter << endl;
    return 0;
}



Measured memory_bytes: 256
n=int(input())
lst=[1, 6, 9, 36, 81, 216, 729, 1296, 6561, 7776, 46656, 59049]

dp=[None]*(n+1) #リストの番号と同じお金を払うのに必要な最短手数
dp[0]=0
for i in lst:
    if i<=n:
        dp[i]=1

for i in range(2,n+1):
    kouho=[]
    for j in lst:
        if i-j>=0:
            kouho.append(dp[i-j]+1)
    dp[i]=min(kouho)

print(dp[-1])

Measured memory_bytes: 75620
package main

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

var sc, wr = bufio.NewScanner(os.Stdin), bufio.NewWriter(os.Stdout)

func scanString() string { sc.Scan(); return sc.Text() }
func scanRunes() []rune { return []rune(scanString()) }
func scanInt() int { a,_ := strconv.Atoi(scanString()); return a }
func scanInt64() int64 { a,_ := strconv.ParseInt(scanString(),10,64); return a }
func scanFloat64() float64 { a,_ := strconv.ParseFloat(scanString(),64); return a }

func scanInts(n int) []int {
	res := make([]int, n); for i := 0; i < n; i++ { res[i] = scanInt() }; return res
}

func debug(a ...interface{}) { fmt.Fprintln(os.Stderr, a...) }

func abs(a int) int { if a<0 { return -a }; return a }
func min(a,b int) int { if a<b { return a }; return b }
func max(a,b int) int { if a>b { return a }; return b }

//•*¨*•.¸¸♪Main•*¨*•.¸¸♪(　-ω-)ノ　(　・ω・)

func main() {
	defer wr.Flush()
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 10000), 1001001)

	a := scanInt()
	b := scanInt()

	for i := 0; i < 100000; i++ {
		if int(float64(i)*0.08) == a && int(float64(i)*0.1) == b {
			fmt.Fprintln(wr, i)
			return
		}
	}

	fmt.Fprintln(wr, -1)
}


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

typedef long long int ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef vector<string>vst;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef map<int,int> dct;

#define fastio ios_base::sync_with_stdio(false);cin.tie(0)
#define all(ct) ct.begin() , ct.end()
#define endl "\n"
#define fr(i,a) for(auto i:a)
#define f(i,a,b) for(int i=a;i<b;i++)
#define fd(i,a,b) for(int i=a;i>=b;i--)
#define pb push_back
#define in(d,v) d.find(v)!=d.end()
#define mp make_pair

bool compare(pair<pii,int> a, pair<pii,int> b){
    return a.first.first*b.second<b.first.first*a.second;
}

const int mod = 1e9 + 7;
const ll inf = ll(1e18);

ll modexp(ll x,ll n,ll k){
    if(n==0)return k;
    if(n%2==0)return modexp((x*x)%mod,n/2,k);
    return (x*modexp((x*x)%mod,n/2,k))%mod;
}


int main(){
    fastio;
    //clock_t tm = clock();
    string s;
    cin>>s;int n=s.length();
    vi ans(n+1,-1);int curr=0;
//    f(i,1,n+1){
//        if(s[i-1]=='>')ans[i]=ans[i-1]-1;
//        else ans[i]=ans[i-1]+1;
//    }
//    int add=0;ll a=0;
//    f(i,0,n+1){
//        if(ans[i]>0)a=a+add+ans[i];
//        else{
//            if(abs(ans[i])>add){
//                add=abs(ans[i]);
//            }
//        }
//    }
//    add=0;ll b=0;
//    fd(i,n,0){
//        if(ans[i]>0)b=b+add+ans[i];
//        else{
//            if(abs(ans[i])>add){
//                add=abs(ans[i]);
//            }
//        }
//    }
    fd(i,n-1,0){
        if(s[i]=='>'){
            ans[i+1]=curr;curr++;
        }
        else {
            if(curr>0)ans[i+1]=curr;
            curr=0;
        }
    }
    if(curr>0)ans[0]=curr;
    curr=0;
    //f(i,0,n+1)cout<<ans[i]<<" ";
    //cout<<endl;
    int check=0;
    f(i,0,n+1){
       if(ans[i]!=-1){
           if(check==1 and ans[i-1]>=ans[i]){
               ans[i]=ans[i-1]+1;
           }
           curr=ans[i]+1;check=0;
       }
       else{
           check=1;
           ans[i]=curr;curr++;
       }
    }
    ll a=0;
    f(i,0,n+1){
        //cout<<ans[i]<<" ";
        a=a+ll(ans[i]);
    }
    cout<<a<<endl;
    //cout<<((clock()-tm)*1.0)/CLOCKS_PER_SEC<<endl;
}

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

ll N, K, T, W, H, M, C;

const int MAX = 5100000;
const int MOD = 1e9 + 7;

const double PI=3.14159265358979323846;


long long fac[MAX], finv[MAX], inv[MAX];

vector<double> cx, cy, c;
 ll MM = 1e12;

void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

std::vector<int> Eratosthenes(int n ){
    std::vector<bool> is_prime( n + 1 );
    for( int i = 0; i <= n; i++ ) is_prime[ i ] = true;
    std::vector<int> P;
    for( int i = 2; i <= n; i++ ){
        if( is_prime[ i ] ){
            for( int j = 2 * i; j <= n; j += i ){
                is_prime[ j ] = false;
            }
            P.emplace_back( i );
        }
    }
    return P;
}

ll gcd(ll a, ll b) {
  if(a < b) return gcd(b, a);
  ll r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}

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



int main(){
    string str;
    cin >>str;
    if(str[2] == '7' or str[1] == '7' or str[0] == '7') cout << "Yes";
    else cout << "No";
    return 0;
}

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

#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define BUFF ios::sync_with_stdio(false);

typedef long long int ll;
typedef long double ld;
typedef vector < int > vi;
typedef vector < vi > vvi;
typedef pair < int, int > ii;
typedef vector < ii > vii;

const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fll;
const int MOD = 1e9+7;
const ld pi = acos(-1);

int main() { BUFF
  string s; cin >> s;
  for(int i=0; i<s.size()-1; i++) {
    if(s[i] == s[i+1]) {
      cout << i+1 << " " << i+2 << endl;
      return 0;
    }
    if(s[i] == s[i+2]) {
      cout << i+1 << " " << i+3 << endl;
      return 0;
    }
  }
  cout << "-1 -1" << endl;
  return 0;
}


Measured memory_bytes: 512
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;

/*
 <url:https://arc085.contest.atcoder.jp/tasks/arc085_b>
 問題文============================================================
 N 枚のカードからなる山札があります。カードにはそれぞれ数が書かれており，
 上から i 枚目には ai が書かれています。
 
 この山札を使い，X さんと Y さんが 2 人でゲームをします。
 X, Y さんは最初，Z,W が書かれたカードを持っています。 そして X さんから交互に以下を行います。
 
 山札から何枚かカードを引く。そして今持っているカードを捨て，最後に引いたカードを代わりに持つ。
 ただし，必ず 1 枚は引かなくてはならない。
 山札がなくなるとゲームは終了で，2 人の持っているカードに書かれた数の差の絶対値がこのゲームのスコアになります。
 
 X さんはスコアを最大化するように，Y さんはスコアを最小化するようにゲームをプレイした時，
 スコアはいくつになるでしょうか？
 
 =================================================================
 
 解説=============================================================
 
 ================================================================
 */
int main(void) {
    cin.tie(0); ios::sync_with_stdio(false);
    ll N,Z,W; cin >> N >> Z >> W;
    vector<ll> a(N);
    for(auto &in:a) cin >> in;
    if(N != 1){
        cout << max({abs(a[N-1] - W),abs(a[N-2] - a[N-1])}) << endl;
    }else{
        cout << abs(a[N-1]-W) << endl;
    }
    return 0;
}


Measured memory_bytes: 256
i;
main(a,b,c){
	for(;scanf("%d%d",&a,&b),a;i++){
		i&&puts("");
		for(c=0;a<=b;a++)
			if( a%400==0 || (a%100!=0&&a%4==0) )
				c=printf("%d\n",a);
		!c&&puts("NA");
	}
	exit(0);
}

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

using namespace std;
typedef long long ll;
typedef long int li;
typedef long double lb;
#define rep(i,j,n) for (ll i = j; i < (n); i++)
#define repr(i,j,n) for(ll i = j; i >= (n); i--)
#define all(x) (x).begin(),(x).end()
#define CLR(mat,f) memset(mat, f, sizeof(mat))
#define IN(a, b, x) (a<=x&&x<b)
#define out(ans) cout << ans << endl
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 pair<ll,ll>P;
const ll mod=1e9+7;
const ll INF = 1LL<<60;

int main(){

  string s;
  while(cin>>s){
    if(s=="0")break;

    ll sum=0;
    rep(i,0,s.size())sum+=(s[i]-'0');

    out(sum);
  }

  return 0;
}



Measured memory_bytes: 3200
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    int p[n];
    int cnt =0;
    for(int i=0;i<n;i++) cin>>p[i];
    for(int i=0;i<n-2;i++){
        if((p[i+1]-p[i])*(p[i+2]-p[i+1])>0) cnt++;
    }
    cout <<cnt << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    string str;
    map<string,int> m;
    m.insert({"AC",0});
    m.insert({"WA",0});
    m.insert({"TLE",0});
    m.insert({"RE",0});
    for(int i=0;i<n;i++)
    {
        cin>>str;
        m[str]++;
    }
    
    
    
        cout<<"AC"<<" "<<"x"<<" "<<m["AC"]<<"\n";
        cout<<"WA"<<" "<<"x"<<" "<<m["WA"]<<"\n";
        cout<<"TLE"<<" "<<"x"<<" "<<m["TLE"]<<"\n";
        cout<<"RE"<<" "<<"x"<<" "<<m["RE"]<<"\n";

    return 0;
}

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

int main() {
    int n, v[50], c[50], cnt[50];
    cin >> n;
    int sum = 0;

    for (int i = 0; i < n; i++) {
        cin >> v[i];
    }
    for (int i = 0; i < n; i++) {
        cin >> c[i];
        if (v[i]-c[i] > 0) sum += v[i]-c[i];
    }

    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 256
#include <vector>
#include <algorithm>
#include <iostream>
using namespace std;
 
int main() {
  int N, L;
  cin >> N >> L;
  vector<string> S(N);
  for (int i=0; i<N; i++) {
    cin >> S.at(i);
  }
  sort(S.begin(),S.end());
  if (N==1) {
    cout << S.at(0) << endl;
  }
  else {
    for (int j=0; j<N-1; j++) {
      cout << S.at(j);
    }
    cout << S.at(N-1) << endl;
  }
}

Measured memory_bytes: 3104
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define cinf(n,x) for(int i=0;i<(n);i++)cin>>x[i];
#define ft first
#define sc second
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(),(v).end()
#define mod 1000000007
using namespace std;
typedef long long ll;
template<class T> using V=vector<T>;
using Graph = vector<vector<int>>;
using P=pair<ll,ll>;
typedef unsigned long long ull;
typedef long double ldouble;
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; }

const ll INF=1e18;

ll com(ll n,ll k){
    if(k==1) return n;
    if(k==0||n==k) return 1;
    return com(n-1,k-1)+com(n-1,k);
}

int main(){
    ll n,a,b;
    cin>>n>>a>>b;
    vector<ll> v(n),s(n+1,0);
    cinf(n,v);
    sort(all(v));
    rep(i,n) s[i+1]=s[i]+v[i];
    set<P> st;//(分子,分母)
    for(ll i=a;i<=b;i++){
        ll m=s[n]-s[n-i];
        ll g=__gcd(i,m);
        ll aa=i/g,bb=m/g;
        if(st.empty()){
            st.insert(P(bb,aa));
        }else{
            P p=*begin(st);
            ll left=p.sc*bb;
            ll right=p.ft*aa;
            if(left>right){
                st.clear();
                st.insert(P(bb,aa));
            }else if(left==right){
                st.insert(P(bb,aa));
            }
        }
    }
    ll cnt=0;
    for(ll i=a;i<=b;i++){
        P p=*begin(st);
        ll m=s[n]-s[n-i];
        ll g=__gcd(i,m);
        ll aa=i/g,bb=m/g;
        ll left=p.sc*bb;
        ll right=p.ft*aa;
        if(left==right){
            ll m=n-i;
            ll r=ub(all(v),v[m])-v.begin();
            ll l=lb(all(v),v[m])-v.begin();
            ll x=1;
            ll y=2;
            for(ll j=m-l+1;j<=r-l;j++){
                x*=j;
                while(x%y==0&&y<=r-m){
                    x/=y;
                    y++;
                }
            }
            cnt+=x;
        }
    }
    P p=*begin(st);
    double ans=(double)p.ft/p.sc;
    cout<<fixed<<setprecision(10)<<ans<<endl;
    cout<<cnt<<endl;
}

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

#define rep(i, n) for(ll i=0; i<n; i++)
#define ALL(v) v.begin(), v.end()

typedef long long ll;

int main(){

    ll N, K;
    cin >> N >> K;

    ll ans = 0;

    while(N > 0){
        N /= K;
        ans++;
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll N = (ll)4e5+9;
ll n;
vector<ll> dp(N), lis(N), a(N);
vector<vector<ll> > g(N);
void dfs(ll nod, ll &len, ll par){
    ll id, old;
    bool yes = 0;
    if(a[nod]>a[dp[len]]){
        old = dp[len];
        id = ++len;
        dp[id] = nod;
        yes = 1;
    }
    else if(a[nod]<a[dp[0]]){
        old = dp[0];
        id = 0;
        dp[0] = nod;
    }
    else{
        ll l = 0, r = len;
        while(r-l>1){
            ll mid = (l+r)/2;
            if(a[dp[mid]]<a[nod])
                l = mid;
            else
                r = mid;
        }
        l++;
        old = dp[l];
        id = l;
        dp[l] = nod;
    }
    lis[nod] = len;
    for(auto u : g[nod])
        if(u!=par)
            dfs(u, len, nod);
    dp[id] = old;
    if(yes)
        len--;
}
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cin >> n;
    for(ll i=1; i<=n; i++)
        cin >> a[i];
    for(ll i=0, u, v; i<n-1; i++){
        cin >> u >> v;
        g[u].push_back(v);
        g[v].push_back(u);
    }
    ll len = 1;
    dp[1] = 1;
    for(auto u: g[1])
        dfs(u, len, 1);
    lis[1] = 1;
    for(ll i=1; i<=n; i++)
        cout << lis[i] << '\n';
    return 0;
}

Measured memory_bytes: 42448
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<vector>
#include<deque>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<algorithm>
#include<functional>
#include<utility>
#include<bitset>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<cstdio>

using namespace std;

#define REP(i,n) for(int i=0;i<int(n);i++)
#define foreach(c,itr) for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
typedef long long ll;
typedef pair<int,int> P;

int main(void){
	int i;

	cin.tie(0);
	ios_base::sync_with_stdio(false);

	int N,d;
	cin >> N >> d;
	vector<int>v(N);
	for(i=0;i<N;i++) cin >> v[i];
	sort(v.begin(),v.end());
	reverse(v.begin(),v.end());

	int ans=0;
	for(i=0;i<N;i++){
		if(v[i]<=d) break;
		else{
			ans+=-d+v[i];
		}
	}

	if(ans<1) cout << "kusoge" << endl;
	else cout << ans << endl;


	return 0;
}

Measured memory_bytes: 1220
#include <stdio.h>
main(){
	int a,b,l=1,r=1500;scanf("%d%d",&a,&b);
	while(l<=r){
		int mid=l+r>>1;if((int)(mid*0.08)>=a&&(int)(mid*0.1)>=b) r=mid-1;else l=mid+1;
	}
	if((int)(l*0.08)==a&&(int)(l*0.1)==b) printf("%d\n",l);else printf("-1\n");
}

Measured memory_bytes: 128
def li():
    return list(map(int, input().split()))


if __name__ == "__main__":
    s = input()
    before = ""
    isBad = False
    for si in s:
        if before == si:
            isBad = True
            break
        before = si

    if isBad:
        print("Bad")
    else:
        print("Good")


Measured memory_bytes: 38384
#include <bits/stdc++.h>
#define fi first
#define se second
#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 maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))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;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
const int MX = 200005;
#define RET(ans) {cout<<ans<<endl;return 0;} 

    // 二次元ベクターの基本
    /*
    vector<vector<int>> dp; // 宣言
    dp.resize(n); // 1次元めの要素数決定
    dp[i].push_back(int); // プッシュバック
    rep(i,n){
        sort(dp[i].begin(),dp[i].end()); // 二次元めを昇順ソート
    }
    */

    // 整数スキャン（複数）
    /*
    int x,y,z;
    scanf("%d%d%d",&x,&y,&z);

    // n個の整数のスキャン
    /*
    ll a[n] = {};
    rep(i,n){
        scanf("%lld",&a[i]);
    }
    */

    // 文字列スキャン
    /*
    string s; cin >> s;
    */

    // n個の文字列スキャン
    /*
    vector<string> slist;
    rep(i,n){
        string s; cin >> s;
        slist.push_back(s);
    }
    */

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


    rep(i,n){
        if(s[i]==s[k-1]){
            cout << s[i];
        }else{
            cout << '*';
        }
    }
    cout << endl;
    return 0;
}
 
 


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

//const static double	de_PI	= 3.14159265358979323846;
//const static int	de_MOD	= 1000000007;
//const static int	de_MAX	= 999999999;
//const static int	de_MIN = -999999999;

int main(void) {

	//std::ifstream in("123.txt");	std::cin.rdbuf(in.rdbuf());

	std::vector<int> ans(5);
	for (int i = 0; i < 5; i++) {
		std::cin >> ans[i];
	}
	std::sort(ans.begin(), ans.end());
	for (int i = 4; i >= 1; i--) {
		std::cout << ans[i] << " ";
	}
	std::cout << ans[0] << std::endl;

}

Measured memory_bytes: 3092
#include <stdio.h>
#include <algorithm>
using namespace std;
int A, B, a[5000], b[5000];
int main() {
	scanf("%d%d", &A, &B);
	for(int i = 0; i < A; i++) scanf("%d", &a[i]);
	for(int i = 0; i < B; i++) scanf("%d", &b[i]);
	int ret = 0;
	for(int i = 0; i <= B - (ret ? ret : 1); i++) {
		int pos = i;
		for(int j = 0; j < A; j++) {
			if(pos == B) break;
			if(b[pos] == a[j]) pos++;
		}
		ret = max(ret, pos - i);
	}
	printf("%d\n", ret);
	return 0;
}

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

#define fr(i,n) _back
#define pb	push_back
#define eb	emplace_back
#define mk	make_pair
#define fi	first
#define se	second
#define endl	'\n'

typedef long long ll;
typedef pair<int,int> ii;
typedef vector<ii> vii;
const int INF = 0x3f3f3f3f;
const double PI = acos(-1.0);
const int T = 10;
const int N = 1e4+2;

int cost[T] = {0,2,5,5,4,5,6,3,7,6};
int prox[T];
bool ok[T];
int dp[N];
int choose[N];
int n,m;
vector<int> ans;

void build(int used) {
    if(used <= 0) return;
    int nxt;
    for(int i = 1; i <= 9; i++) {
        if(!ok[i] or used-cost[i] < 0) continue;
        if(dp[used-cost[i]] == dp[used]-1) nxt = i;
    }
    ans.pb(nxt);
    //cout << nxt << " " << used << endl;
    build(used-cost[nxt]);
}

int main() {
    ios_base::sync_with_stdio(false);
    cin >> n >> m;
    memset(dp, -INF, sizeof dp);

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

    dp[0] = 0;

    for(int i = 1; i < T; i++) {
        if(!ok[i]) continue;
        for(int j = 0; j+cost[i] <= n; j++) {
            if(dp[j+cost[i]] <= dp[j]+1) {
                dp[j+cost[i]] = dp[j]+1;
                choose[j+cost[i]] = i;
            }
        }
    }

    build(n);
    sort(ans.begin(),ans.end(), greater<int>());
    for(auto x : ans) cout << x;
    cout << endl;

    return 0;
}


Measured memory_bytes: 512
import fractions
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)
N,M = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]
a = 1
MOD = 10**9+7
cnt = 0
l = 0
for i in A:
  i = i//2
  a = lcm(a,i)
for i in A:
  cnt1=0
  i=i//2
  b=a//i
  if b%2==0:
    while b%2==0:
      b=b/2
      cnt1+=1
  if cnt==0:
    cnt=cnt1
    l+=1
  else:
    if cnt!=cnt1:
      print(0)
      exit()
if l==N and cnt!=0:
  print(0)
  exit()
print((M//a+2-1)//2)

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

using namespace std;
typedef long long ll;

ll n,w,arrw[105],arrv[105],mem[105][100005];

ll dp(int pos, int wi){
    if(wi>w)return -1000000000000;
    if(pos==n)return 0;
    if(mem[pos][wi]!=-1)return mem[pos][wi];
    ll o1=dp(pos+1,wi+arrw[pos])+arrv[pos];
    ll o2=dp(pos+1,wi);
    return mem[pos][wi]=max(o1,o2);
}

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    cin>>n>>w;
    for(int i=0;i<n;i++)cin>>arrw[i]>>arrv[i];
    memset(mem,-1,sizeof(mem));
    cout<<dp(0,0);
}

Measured memory_bytes: 82304
hoge = input()
int_line = [int(i) for i in input().split()]

cnt = 0
flag = False

while True:
    for m, i in enumerate(int_line):
        if i % 2 == 0:
            int_line[m] = i/2
        else:
            flag = True
    if flag == True:
        print(cnt)
        break
    else:
        cnt += 1

Measured memory_bytes: 9216
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <set>
#include <map>
#include <cassert>
#include <fstream>

using namespace std;

vector<int> dx = {1, -1, 0, 0};
vector<int> dy = {0, 0, 1, -1};

int main() {
    
    int h, w;
    cin >> h >> w;
    
    int ret = 0;
    vector<string> map;
    
    for (int i = 0; i < h; ++i)
    {
        string s;
        cin >> s;
        map.push_back(s);
    }
    
    queue<pair<int, int>> q;
    vector<vector<bool>> check(h, vector<bool>(w, 0));
    
    for (int i = 0; i < h; ++i)
    {
        for (int j = 0; j < w; ++j)
        {
            if (map[i][j] == '#')
            {
                q.push(make_pair(i, j));
                check[i][j] = 1;
            }
        }
    }
    
    
    while (1)
    {
        queue<pair<int, int>> currentq = q;
        queue<pair<int, int>> nextq;
        while (currentq.size() > 0)
        {
            int currentx = currentq.front().second;
            int currenty = currentq.front().first;
            for (int i = 0; i < 4; ++i)
            {
                int nextx = currentx + dx[i];
                int nexty = currenty + dy[i];
                
                if (nextx >= 0 && nextx < w && nexty >= 0 && nexty < h)
                {
                    if (check[nexty][nextx] == 0)
                    {
                        nextq.push(make_pair(nexty, nextx));
                        check[nexty][nextx] = 1;
                    }
                }
            }
            currentq.pop();
        }
        
        if (nextq.size() == 0)
        {
            break;
        }
        
        q = nextq;
        ret++;
    }
    
    cout << ret << endl;
    
    return 0;
}


Measured memory_bytes: 17808
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
using namespace std;
using namespace __gnu_pbds;

#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

#define lsc(x)      scanf("%lld",&x)
#define sc(x)       scanf("%d",&x)
#define lpr(x)      printf("%lld ",(long long)x)
#define pr(x)       printf("%d ",x)
#define n_l         printf("\n")
#define VI          vector<int>
#define VII         vector<long long int>
#define m_p         make_pair
#define pb          push_back
#define fi           first
#define se           second
#define mset(x,y)   memset(x,y,sizeof(x))
#define sz(v)       (int)v.size()
#define all(v)      v.begin(), v.end()
#define fr(i, a, n) for(int i=a;i<=n;i++)
#define FIO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
mt19937 rng32(chrono::steady_clock::now().time_since_epoch().count());
const int N=(int)1e6+5;
const int mod = 1000000007;
typedef long long ll;
// order_of_key (val): returns the no. of values strictly less than val
// find_by_order (k): returns the kth largest element iterator.(0-based)
// vector<int>::iterator itr=lower_bound(v.begin(),v.end(),x);
// s.substr(pos[0-indexed], len(default=till end))
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

ll fmod(ll x){if (x<mod) return x;return x%mod;}
ll mul(ll a, ll b, ll c){
	ll ret=0;while(b){if (b%2) ret=(ret+a)%c;a=(a*2)%c;b>>=1;}
    return ret;
}
int modpow(ll a, ll b){
    ll ret=1;while(b){if (b%2) ret=(ret*a)%mod;a=(a*a)%mod;b>>=1;}
    return (int)ret;
}
inline int inv(int x){ return modpow(x, mod-2);}
int isprime[N];
void calc_prime(){
	isprime[1]=1;for(ll i=2;i<N;i++) if (!isprime[i]) for(ll j=i*i;j<N;j+=i) isprime[j]=1;
}
int vis[N], vis1[N];
int main(){
    int n;sc(n);
    int g = 0;
    int f = 0;
    fr(i, 1, n){
        int x;sc(x);
        if (!g) g=x;
        else g = __gcd(g, x);
        if (x>1) {
            if (vis[x]){
                f=1;
            }
            vis[x]=1;
        }
    }
    if (g>1){
        cout<<"not coprime\n";
        return 0;
    }
    trace(f, g);
	isprime[1]=1;
    for(ll i=2;i<N;i++) 
        if (!isprime[i]) 
            for(ll j=i;j<N;j+=i) {
                if (vis[j]){
                    if (vis1[i]) f=1;
                    vis1[i] = 1;
                }

            }

    if (f){
        cout<<"setwise coprime\n";
    }else cout<<"pairwise coprime\n";
    return 0;
}



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


int main(){
	int N, K;
	cin >> N >> K;
	int ans = 0;
	for(int i = 1; i <= N - K + 1; ++i) {
		ans++;
	}
	cout << ans << endl;
}










Measured memory_bytes: 3584
a[1111],b[1111],c[1111],d[1111],p[1111],i,j,x,y,z;main(){for(;scanf("%d%d%d",a,b,c)&&(*a+=*b+*c);){for(i=0,scanf("%d",p);i++<*p;scanf("%d%d%d%d",a+i,b+i,c+i,d+i),p[i]=2);for(i=0;i++<*p;)for(j=0;j++<*p;d[j]?p[a[j]]=p[b[j]]=p[c[j]]=1:(x=p[a[j]]&1)&(y=p[b[j]]&1)?p[c[j]]=0:x&(z=p[c[j]])?p[b[j]]=0:y&z?p[a[j]]=0:0);for(i=0;i<*a;printf("%d\n",p[++i]));}exit(0);}

Measured memory_bytes: 620
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll k;
    cin>>k;
    while(k--){
        cout<<"ACL";
    }
    cout<<"\n";
    return 0;
}

Measured memory_bytes: 3588
#include <stdio.h>
#define rep(i,n) for(i=0;i<n;++i)
int a[1<<18],v[1<<18][3],n,m,q,c,i,j;
main(){scanf("%d%d%d",&n,&m,&q);rep(i,n)rep(j,2)v[i][j]=(i+n+1-2*j)%n;rep(i,m){scanf("%d",a+i);rep(j,a[i])c=v[c][a[i]&1];v[c][2]=1;rep(j,2)v[v[c][j^1]][j]=v[c][j];c=v[c][0];}rep(i,q)scanf("%d",&c),printf("%d\n",1-v[c][2]);}

Measured memory_bytes: 5120
#include <bits/stdc++.h>
#define sz(x) (int)(x).size()
#define For(i, a, b) for (int i = int(a); i < int(b); i++)
#define Dor(i, a, b) for (int i = int(b) - 1; i >= int(a); i--)
#define Foz(i, a) For(i, 0, a)
#define Doz(i, a) Dor(i, 0, a)
#define Trav(e, v) for (auto& e : v)
#define pb push_back
#define mp make_pair
#define all(x) begin(x), end(x)
using namespace std;
using ll = long long;
using ii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vii = vector<ii>;
template <typename T> bool ckmin (T& a, T b) { return (b < a) ? a = b, 1 : 0; }
template <typename T> bool ckmax (T& a, T b) { return (b > a) ? a = b, 1 : 0; }
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#ifdef XVENOM
	#define errp(...) fprintf(stderr, __VA_ARGS__)
	#define dbg(...) errp("[%s]: ", #__VA_ARGS__), dbg_str(__VA_ARGS__)
#else
	#define errp(...)
	#define dbg(...)
#endif
template <typename U, typename V> string to_string (pair<U, V>);
string to_string (string& e) { return "\"" + e + "\""; }
string to_string (char e) { return "\'" + string(1, e) + "\'"; }
string to_string (bool e) { return e ? "true" : "false"; }
template <typename T> string to_string (T e) {
	string s = "[ ";
	for (auto& x : e) s += to_string(x) + " ";
	return s + "]";
}
template <typename U, typename V> string to_string (pair<U, V> e) {
	return "(" + to_string(e.first) + ", " + to_string(e.second) + ")";
}
void dbg_str () { errp(" \n"); }
template <typename U, typename... V> void dbg_str (U u, V... v) {
 	errp(" %s", to_string(u).c_str()); dbg_str(v...);
}
/* --- */
int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);
	/* --- */
	const int N = 100010;
	const int INF = (int)1e9;
	vi f, ans;
	f.pb(6); 
	while (f.back() * 6 < N) f.pb(f.back() * 6);
	f.pb(9);
	while (f.back() * 9 < N) f.pb(f.back() * 9);	
	f.pb(1);
	int n;
	cin >> n;
	ans.assign(n + 1, INF);
	ans[0] = 0;
	Foz(i, n) Trav(x, f) if (x + i <= n)
		ckmin(ans[x + i], 1 + ans[i]);
	cout << ans[n] << '\n';
}



Measured memory_bytes: 640
def main():
    n,K = map(int, input().split())
    h = list(map(int, input().split()))

    DP = [[float("inf")]*(K+1) for i in range(K+1)]
    DP[0][0] = 0
    for i in range(n):
        hi = h[i]
        nxt = [[float("inf")]*(K+1) for i in range(K+1)]
        for j in range(min(i+1, K+1)):
            for k in range(j+1):
                l = i-k-1
                if l<0:
                    left = 0
                else:
                    left = h[l]
                a = hi-left if left<hi else 0
                nxt[j][0] = min(nxt[j][0], DP[j][k]+a)
                if j == K:
                    continue
                nxt[j+1][k+1] = min(nxt[j+1][k+1], DP[j][k])
        DP = nxt

    ans = float("inf")
    for i in DP:
        ans = min(ans, min(i))
    print(ans)

main()

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

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<string> vs;
typedef pair<int, int> P;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()

void YN(bool flg){if(flg) cout << "YES" << endl; else cout << "NO" << endl;}
void Yn(bool flg){if(flg) cout << "Yes" << endl; else cout << "No" << endl;}
void yn(bool flg){if(flg) cout << "yes" << endl; else cout << "no" << endl;}

int main()
{
    int n;
    cin >> n;
    vll a(n);
    rep(i, n) cin >> a[i];

    int zero = 0;
    rep(i, n) if(a[i] == 0) zero++;
    if(zero > 0) {
        cout << 0 << endl;
        return 0;
    }

    bool flg = false;
    ll ans = 1;
    rep(i, n) {
        if(1000000000000000000 / ans < a[i]) {
            flg = true;
            break;
        }
        ans *= a[i];
    }

    cout << (flg ? -1 : ans) << endl;

    return 0;
}


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

int main(){
	long long n,k;
	cin>>n>>k;
	n++;
	long long ans=0;
	for(long long i=k;i<=n;i++){
		long long mi=i*(i-1)/2,ma=n*(n-1)/2-(n-i)*(n-i-1)/2;
		ans+=ma-mi+1;
		ans%=1000000007;
	}
	cout<<ans<<endl;
}


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

int main(){
        int n, m;
        scanf("%d %d", &n, &m);
        vector<int> cc(m);
        for(int i=0; i<m; i++) scanf("%d", &cc[i]);
        sort(cc.begin(), cc.end());

        vector<int> dp(50001);
        fill(dp.begin(), dp.end(), 1e8);
        dp[0] = 0;
        for(int i=0; i<=n; i++){
                for(int j=0; j<m; j++){
                        if(n < i+cc[j]) break;
                        dp[i+cc[j]] = min(dp[i+cc[j]], dp[i]+1);
                }
        }
        printf("%d\n", dp[n]);
        return 0;
}


Measured memory_bytes: 3256
void main()
{
    long n, m;
    rdVals(n, m);

    long[] d = m.divisors;
    d.sort!"a > b";
    foreach (g; d)
    {
        if (g * n > m) continue;
        long x = m - g * n;
        if (x % g == 0)
        {
            g.writeln;
            return;
        }
    }
}

long[] divisors(long x)
{
    long[] result;
    for (long i = 1; i * i <= x; ++i)
    {
        if (x % i == 0)
        {
            result ~= i;
            if (i * i != x) result ~= x / i;
        }
    }
    return result;
}

enum long mod = 10^^9 + 7;
enum long inf = 1L << 60;

T rdElem(T = long)()
if (!is(T == struct))
{
    return readln.chomp.to!T;
}

alias rdStr = rdElem!string;
alias rdDchar = rdElem!(dchar[]);

T rdElem(T)()
if (is(T == struct))
{
    T result;
    string[] input = rdRow!string;
    assert(T.tupleof.length == input.length);
    foreach (i, ref x; result.tupleof)
    {
        x = input[i].to!(typeof(x));
    }
    return result;
}

T[] rdRow(T = long)()
{
    return readln.split.to!(T[]);
}

T[] rdCol(T = long)(long col)
{
    return iota(col).map!(x => rdElem!T).array;
}

T[][] rdMat(T = long)(long col)
{
    return iota(col).map!(x => rdRow!T).array;
}

void rdVals(T...)(ref T data)
{
    string[] input = rdRow!string;
    assert(data.length == input.length);
    foreach (i, ref x; data)
    {
        x = input[i].to!(typeof(x));
    }
}

void wrMat(T = long)(T[][] mat)
{
    foreach (row; mat)
    {
        foreach (j, compo; row)
        {
            compo.write;
            if (j == row.length - 1) writeln;
            else " ".write;
        }
    }
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.traits;
import std.container;
import std.functional;
import std.typecons;
import std.ascii;
import std.uni;

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

using namespace std;

#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define fin(ans) cout << (ans) << endl;
#define blank(ans) cout << (ans) << " ";
#define mp(p, q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()

typedef long long ll;
typedef long long lli;
typedef unsigned long long ull;
typedef long double ld;
typedef string str;

typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<ld> vd;
typedef vector<str> vs;
typedef vector<ll> vll;
typedef vector<pair<ll, ll>> vpll;
typedef vector<pair<ll, str>> vpls;
typedef vector<tuple<str, ll, ll>> vtsl;
typedef vector<vector<ll>> vvll;
typedef vector<vector<char>> vvc;
typedef vector<vector<str>> vvs;

const ld PI = acos(-1.0);
const ll MAX = 9000000000000000000;
const ll MIN = -9000000000000000000;
const ld DMAX = 4500;
const ld DMIN = -4500;
const ll MOD = 1000000007;

//実行部
void Main()
{
  vll a(3); rep(i, 3) cin >> a[i];
  sort(all(a));
  fin(a[2] * 10 + a[1] + a[0])
}

//前処理
int main()
{
  //ios::sync_with_stdio(false);
  //cin.tie(0);
  cout << fixed << setprecision(20); //高精度少数表示
  Main();
  return 0;
}


Measured memory_bytes: 256
use std::io::stdin;

fn main() {
    let mut is = String::new();
    stdin().read_line(&mut is).ok();
    let mut itr = is.split_whitespace().map(|e| e.parse().unwrap());
    let n: usize = itr.next().unwrap();
    let k: usize = itr.next().unwrap();
    is.clear();
    stdin().read_line(&mut is).ok();
    let mut a = is
        .split_whitespace()
        .map(|e| e.parse::<usize>().unwrap())
        .collect::<Vec<_>>();
    a.sort();

    println!("{}", a.iter().take(k).sum::<usize>());
}


Measured memory_bytes: 2100
N, M, K = [int(x) for x in input().split(" ")]

res = False

for n in range(N):
    t1 = K - n * M
    t2 = N - 2 * n
    if t2 == 0:
        if n * M == K:
            res = True
        continue
    if t1 % t2 != 0:
        continue
    m = t1 // t2
    if 0 <= m and m <= M:
        res = True

print("Yes" if res else "No")


Measured memory_bytes: 3316
from collections import Counter
n = int(input())
d = list(map(int, input().split()))
m = int(input())
t = list(map(int, input().split()))
d = Counter(sorted(d))
cnt = 0
for i in range(m):
    if t[i] in d and d[t[i]] > 0:
        d[t[i]] -= 1
        cnt += 1
    else: break
print("YES" if cnt == m else "NO")

Measured memory_bytes: 43364