akhauriyash/Code-Regression huggingface dataset:
import std.stdio : write, writeln;
import std.array;
import std.range;
import std.algorithm : filter;

/+ やばいオーダー
bool[100+1][100+1] g;
bool[100+1][100+1] done;
int L;

bool dfs(int e, int n){
	if(n==L){
		return e==2;
	}
	
	bool f=false;
	for(int i=1; i<=100; ++i){
		if(g[e][i] && !done[e][i]){
			done[e][i] = true;
			f |= dfs(i, n+1);
			done[e][i] = false;
		}
	}
	
	return f;
}
+/

void main(){
	while(hasNext){
		// 一筆書き->オイラー路->準オイラーグラフ
		int[100+1] g;
		
		while(true){
			int s = next!int();
			int e = next!int();
			
			if((s|e)==0x00) break;
			
			++g[s];
			++g[e];
		}
		
		int cnt;
		for(int i=1; i<=100; ++i){
			if(g[i]%2==1){
				++cnt;
			}
		}
		
		writeln = cnt==2 ? "OK" : "NG";
	}
}


import std.stdio : readln, chomp;
import std.conv : to;
import std.string : split;
shared string[] input;
shared string delim = " ";
T next(T)()
in
{
	assert(hasNext());
}
out
{
	input.popFront;
}
body
{
	return input.front.to!T;
}

void next(T)(ref T v){
	v = next!T();
}

bool hasNext(){
	if(input.length > 0){
		return true;
	}
	
	string str = readln;
	if(str.length > 0){
		input ~= str.chomp.split(delim);
		return true;
	}else{
		return false;
	}
}


void dbg(T...)(T vs)
{
	import std.stdio : stderr;
	foreach(v; vs)
		stderr.write(v.to!string ~ " ");
	stderr.write("\n");
}

T clone(T)(T v){
	T v_;
	static if(isInputRange!(T)){
		foreach(ite; v){
			v_ ~= ite.clone;
		}
	}else{
		v_ = v;
	}
	
	return v_;
}

Measured memory_bytes: 1016
n,q = map(int,input().split())

Queue = []
for _ in range(n):
    tmp = input().split()
    name = tmp[0]
    time = int(tmp[1])
    Queue.append([name,time])

count = 0

while Queue:
    name = Queue[0][0]
    time = Queue[0][1]

    if time > q:
        Queue[0][1] -=q
        Queue.append(Queue.pop(0))

        count += q
    else:
        print(name,time+count)
        Queue.pop(0)
        count += time



Measured memory_bytes: 13012
// Problem : D - Div Game
// Contest : AtCoder - AtCoder Beginner Contest 169
// URL : https://atcoder.jp/contests/abc169/tasks/abc169_d
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define db long double
#define pb push_back
#define pii pair<int,int>
#define vi vector<int>
#define vl vector<ll>
#define vii vector<pii>
#define mi map<int,int>
#define ml map<ll,ll>
#define mii map<pii,int>
#define fi first
#define se second
#define all(a) (a).begin(),(a).end()
#define sz(x) (int)x.size()
#define mod 1000000007
#define MAX 4294967295
#define EPS 1e-9
#define io ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define MAXN 15000005
#define inf 1e10
#define PI acos(-1.0)
#define int long long

void solve(){
    int n;
    cin>>n;
    if(n == 1){
        cout<<0<<endl;
        return;
    }
    vii p;
    for(int i=2;i*i<=n;i++){
        int cnt = 0;
        if(n%i == 0){
            while(n%i == 0){
                n /= i;
                cnt++;
            }
            p.pb({i,cnt});
        }
    }
    if(n>1) p.pb({n,1});
    int res = 0;
    for(auto i : p){
        int x = i.se;
        int lo = 1, hi = x, ans;
        while(lo <= hi){
            int mid = (lo+hi)/2;
            int tmp = mid*(mid+1)/2;
            if(tmp <= x) ans = mid, lo = mid+1;
            else hi = mid-1;
        }
        res += ans;
    }
    cout<<res<<endl;
}

signed main(){
    io;
    //freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
    int t;
    //cin>>t;
    t = 1;
    while(t--){
        solve();
    }
    return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
#define eps 1e-7
#define PI acos(-1)
#define de(x) cout<<#x<<'='<<x<<" , "
#define dee(x) cout<<#x<<'='<<x<<endl
#define sz(x) x.size()
#define mp make_pair
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define mset(a,b) memset(a,b,sizeof(a))
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define pb push_back
typedef long long LL;
typedef pair<int,int> pii;
typedef vector<int> vi;

int main(){
    string s;
    cin>>s;
    rep(i,0,s.length()) cout<<s[i++];
    cout<<endl;
}


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

using namespace std;

#define rep(i, x)   for (__typeof(x) i = 0; i < x; i++)
#define mp             make_pair
#define pb             push_back
#define fi             first
#define se             second
#define sz(x)          (int)((x).size())
#define all(x)         (x).begin(), (x).end()
#define sci(x)         int x;       scanf("%d", &x);
#define scii(x, y)     int x, y;    scanf("%d %d", &x, &y);
#define sciii(x, y, z) int x, y, z; scanf("%d %d %d", &x, &y, &z);
#define TC(x)          sci(x); while(x --)
#define eprintf(...)   fprintf(stderr, __VA_ARGS__)
#define debug(x)       { cerr << #x << " = " << x << endl; }
#define repi(i, x)  for (__typeof(x) i = x-1; i >= 0; i --)
#define fore(itr, x)   for (__typeof(x.begin()) itr = x.begin(); itr != x.end(); itr ++)
#define forei(itr, x)  for (__typeof(x.end()) itr = x.end() - 1; itr != x.begin() - 1; itr --)
typedef long long      ll;
typedef pair<int, int> ii;
typedef pair<ii, int>  iii;
typedef vector<int>    vi;
typedef vector<ii>     vii;
typedef vector<iii>    viii;
typedef vector<vector<int> > vvi;
const   int            infi = numeric_limits<int>::max();
const   double         eps = 0;
const   int            ms  = 0;




int main()
{
    ios::sync_with_stdio(false);//endl->"\n"
    cin.tie(0);

    int A, B;
    cin >> A >> B;
    int K;
    cin >> K;
    int k = 0;
    for(int i = 100; i >= 1; i--){
        if(A%i == 0 && B%i == 0){
            k++;
        }
        if(k == K){
            cout << i << "\n";
            return 0;
        }
    }

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(){
  int x,y,tmp,r;
  scanf("%d %d",&x,&y);
  if(y > x){
    tmp = y;
    y = x;
    x = tmp;
  }
  while(y > 0){
    r = x%y;
    x = y;
    y = r;
  }
  printf("%d\n",x);
  return 0;
}

Measured memory_bytes: 592
#include <bits/stdc++.h>
#define SORT(a) sort(a.begin(), a.end())
#define RSORT(a) sort(a.rbegin(), a.rend())
#define REP(i, n) for (long long i = 0; i < n; i++)
#define RREP(i, n) for (long long i = n - 1; 0 <= i; i--)
#define FOR(i, start, end) for (long long i = start; i < end; i++)
#define RFOR(i, start, end) for (long long i = start - 1; 0 <= i; i--)
#define ALL(a) a.begin(), a.end()
#define MOD(a) a %= 1'000'000'007
using ll = long long;
using namespace std;
const int INF32       = 1'050'000'000;
const long long INF64 = 4'000'000'000'000'000'000;
const int MOD7        = 1'000'000'007;
const int MOD9        = 1'000'000'009;
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;
}
void print() { std::cout << '\n'; }
template <class H, class... T> void print(H &&head, T &&... args) {
    std::cout << head;
    sizeof...(args) == 0 ? std::cout << "" : std::cout << ' ';
    print(std::forward<T>(args)...);
}
template <class T> void print(std::vector<T> &v) {
    for (int i = 0; i < v.size(); i++) {
        std::cout << v[i];
        i == v.size() - 1 ? std::cout << '\n' : std::cout << ' ';
    }
}
template <class T> void print(std::vector<std::vector<T>> &v) {
    for (int i = 0; i < v.size(); i++) {
        for (int j = 0; j < v[i].size(); j++) {
            std::cout << v[i][j];
            j == v[i].size() - 1 ? std::cout << '\n' : std::cout << ' ';
        }
    }
}

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

    int N, M;
    cin >> N >> M;
    vector<pair<int, int>> v(M);
    for (auto &&i : v) {
        cin >> i.first >> i.second;
    }

    sort(ALL(v), [](const pair<int, int> x, const pair<int, int> y) {
        return x.second < y.second;
    });

    int ans  = 1;
    int last = v[0].second;
    FOR(i, 1, M) {
        if (last <= v[i].first) {
            ans++;
            last = v[i].second;
        }
    }
    print(ans);

    return 0;
}

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


int main() {
	int N, K;
	cin >> N >> K;
	double sum = 0;
	for(int i = 1; i <= N; i++){
		int cnt = 0;
		int i_copy = i;
		while(i_copy < K){
			i_copy *= 2;
			cnt++;
		}
		sum += pow(0.5, cnt);
	}
	sum /= N;
	cout << setprecision(11) << sum << endl;
	return 0;
}

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

#define fastio 			ios::sync_with_stdio(0);	cin.tie(0); cout.tie(0);  cout<<fixed;  cout<<setprecision(12);
#define randomINT 		mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define	newl 			cout<<"\n"
#define DISP(as)		for(auto it : as) cout<<it<<" ";newl;
#define all(x)         	(x).begin(),(x).end()
#define mset(x,val)    	memset(x,val,sizeof(x))
#define newl           	cout<<"\n"
#define pb             	push_back
#define mp             	make_pair
#define f 				first
#define s 				second
#define dline          cerr<<"///REACHED///\n";
#define deb1(x)        cerr<<#x<<" = "<<x<<'\n';
#define deb2(x,y)      cerr<<'['<<#x<<','<<#y<<"] = "<<'['<<x<<','<<y<<']'<<'\n';
#define deb3(x,y,z)    cerr<<'['<<#x<<','<<#y<<','<<#z<<"] = "<<'['<<x<<','<<y<<','<<z<<']'<<'\n';
#define N 1000000007 // prime modulo value 

typedef long long 				ll;
typedef long double 			ld;
typedef vector<ll> 				vll;
typedef pair<ll , ll> 			pll;
typedef pair<ld, ld> 			pld;
typedef unordered_map<ll, ll> 	um;
typedef vector<pll> 			vpll;

const ll 	MAX5 	= 	1e+5 + 7;
const ll 	MAX7 	= 	1e+7 + 7;
const ll 	MAXN 	= 	5e5;
const ll   	INF   	=  	0x7f7f7f7f7f7f7f7f;
const int  	INFi 	=  	0x7f7f7f7f;
const ll 	MOD		=  	1e+9 + 7;

vll adj[MAXN];ll vis[MAXN]={};
/*
int dx8[]={0,1,1,1,0,-1,-1,-1}, dy8[]={1,1,0,-1,-1,-1,0,1};
int dx4[]={0,1,0,-1}, dy4[]={1,0,-1,0};
*/
// <------------- Declare Variables Here ------------> //



ll T = 1;
ll n, x, k, m, r, sum = 0;
string s;
ll lvl[MAXN],par[MAXN];
ll dp[MAXN];
ll maxl;

struct Comparator
{
    bool operator() (const std::pair<ll, ll>& lhs,
                     const std::pair<ll, ll>& rhs) const
    {
      if (lhs.first == rhs.first)
        return lhs.second < rhs.second;
      else
        return lhs.first > rhs.first;
    }
};

set<pll,Comparator> val;

// <------------- Implement Functions Here ----------> //

void dfs(ll p=1, ll lv = 0,ll pp=1) {
	vis[p] = 1;
	par[p] = pp;
	lvl[lv]++;
	val.insert({lv,p});
	maxl = max(maxl,lv);
	ll cnt = 0;
	for(auto it : adj[p]) {
		if(!vis[it]) {
			cnt = 1;
			dfs(it,lv+1,p);
		}
	}
	if(cnt == 0) lvl[lv]--;
}

// <------------- Start of main() -------------------> //

void MAIN() {
	cin >> s;
	if(s[0]!=s[1] | s[1] != s[2]) cout<<"Yes\n";
	else cout<<"No\n";
}

int main() {
	fastio; randomINT;
	//cin >> T;
	while (T--) {
		MAIN();
	}
	return 0;
}


Measured memory_bytes: 15380
#define _USE_MATH_DEFINES
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <ctype.h>
#include <limits.h>
#define EPS 1e-10
#define sq(n) ((n)*(n))
#define rep(i,n) for(i=0;i<n;i++)
#define rev(i,n) for(i=n-1;i>=0;i--)
#define sort(a,n) qsort(a,n,sizeof(TYPE),cmp)
#define sort_r(a,n) qsort(a,n,sizeof(TYPE),cmp_r);
#define chsort(s,n) qsort(s,n,sizeof(char),cmp)
#define chsort_r(s,n) qsort(s,n,sizeof(char),char_cmp_r);
#define TYPE int
#define MEMSET(a) memset(a,0,sizeof(a))
long long mod=(long long)1e09+7;
int inf=1<<29;
long long llinf=1ll<<60;

int in(void){
    int i;scanf("%d",&i);
    return i;
}
long long llin(void){
    long long i;scanf("%lld",&i);
    return i;
}
double din(void){
    double i;scanf("%lf",&i);
    return i;
}
void chin(char s[]){
    scanf("%s",s);
}
void print(int a){
    printf("%d\n",a);
}
void llprint(long long a){
    printf("%lld\n",a);
}
void dprint(double a){
    printf("%.10f\n",a);
}
void print2(int a,int b){
    printf("%d %d\n",a,b);
}
long long max(long long a,long long b){
    return a>b?a:b;
}
long long min(long long a,long long b){
    return a<b?a:b;
}
int cmp(const void *a,const void *b){
    return *(TYPE *)a-*(TYPE *)b;
}
int cmp_r(const void *a,const void *b){
    return *(TYPE *)b-*(TYPE *)a;
}
int char_cmp(const void *a,const void *b){
    return strcmp((char *)a,(char *)b);
}
int char_cmp_r(const void *a,const void *b){
    return strcmp((char *)b,(char *)a);
}
void swap(int *a,int *b){
    int t=*a;
    *a=*b;
    *b=t;
}
long long gcd(long long x,long long y){
    return x%y?gcd(y,x%y):y;
}
long long lcm(long long x,long long y){
    return x/gcd(x,y)*y;
}

// write codes below this
// when you use 'sort',
// make sure TYPE macro is correct

int main(void){
    int n,i,j,l[40],a[]={5,7,5,7,7},t,f;
    char s[20];
    while(1){
        n=in();
        if(!n)break;
        rep(i,n){
            chin(s);
            l[i]=strlen(s);
        }
        rep(i,n){
            t=f=0;
            for(j=i;j<n+1;j++){
                if(t>a[f])break;
                if(t==a[f]){
                    t=0;
                    f++;
                    if(f==5)break;
                }
                t+=l[j];
            }
            if(f==5){
                print(i+1);
                break;
            }
        }
    }
    return 0;
}


Measured memory_bytes: 2144
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
using namespace std;

string A, B;

int main() {
    cin >> A >> B;
    if (A.size() > B.size()) {
        cout << "GREATER" << endl;
        return 0;
    }

    if (A.size() < B.size()) {
        cout << "LESS" << endl;
        return 0;
    }

    string ans = "EQUAL";
    rep(i, A.size()) {
        if (A[i] > B[i]) {
            ans = "GREATER";
            break;
        } else if (A[i] < B[i]) {
            ans = "LESS";
            break;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#include  <iostream>
#include <cmath>
#include <math.h>
#include <iomanip>
using namespace std;

int main(){
  int jisin,funsin,ji,fun;
  cin >> jisin >> funsin >> ji >> fun;
  static const double pi = 3.1415926535897932384;
  double rangel;

  double rangelji = (ji*60+fun)*(pi/360);

 //cout << rangelji<<"\n";
  double rangelfun = fun*pi/30;
  //cout << rangelfun<<"\n";
  if(rangelji>rangelfun) rangel = rangelji - rangelfun;
  else rangel = rangelfun-rangelji;
  //cout << rangel<<"\n";

  double length = sqrt(jisin*jisin + funsin*funsin -2*jisin*funsin*cos(rangel));
  cout << std::fixed << std::setprecision(15) << length;
 }


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

const double EPS = 1e-5;
using ll = long long;

struct point{
  int x;
  int y;
  int r;
  int equal(point p);
};

int point::equal(point p){
  if(abs(this->x - p.x) < EPS && abs(this->y - p.y) < EPS && abs(this->r - p.r < EPS)){
    return 1;
  }else{
    return 0;
  }
}

double cost_calc(point p1, point p2){
  double cost;

  //cout << (double)sqrt((ll)(p1.x - p2.x) * (p1.x - p2.x) + (ll)(p1.y - p2.y) * (p1.y - p2.y)) - (p1.r + p2.r) << " " ;
  cost = max(0.0, (double)sqrt((ll)(p1.x - p2.x) * (p1.x - p2.x) + (ll)(p1.y - p2.y) * (p1.y - p2.y)) - (p1.r + p2.r));
  //cout << sqrt(pow(p1.x - p2.x,2.0) + pow(p1.y - p2.y, 2.0)) - (p1.r + p2.r) << endl;
  //cost = max(0.0, sqrt(pow(p1.x - p2.x,2.0) + pow(p1.y - p2.y, 2.0)) - (p1.r + p2.r));

  return cost;
}

using SN = pair<double, int>;
priority_queue<SN, vector<SN>, greater<SN>> q;

double solve(){
  /*======Initialize=====*/
  SN sn;
  int x, y, r;
  vector<point> points;

  cin >> x >> y;
  point start = {x,y,0};
  cin >> x >> y;
  point goal = {x,y,0};

  int N;

  cin >> N;
  points.push_back(start);
  for(int i = 0; i < N; i++){
    cin >> x >> y >> r;
    point p = {x,y,r};
    points.push_back(p);
  }
  points.push_back(goal);

  double cost[N + 2];
  double dist[N+2][N+2];

  for(int i = 0; i < N + 2; i++){
    for(int j = 0; j < N + 2; j++){
      dist[i][j] = cost_calc(points[i],points[j]);
    }
  }

  for(int i = 0; i < N + 2; i++){
    cost[i] = DBL_MAX;
  }

  /*
  for(auto &elem:points){
    cout << elem.x << endl;
  }
  */

  sn = {0.0, 0};
  q.push(sn);

  /*======Solver======*/

  int count = 0;


  while(!q.empty()){
    SN here = q.top();
    q.pop();
    count++;


    for(int i = 0; i < N + 2; i++){
      //cout << points[i].x << endl;
      //cout << points[here.second].equal(points[i]) << endl;
      //if(points[here.second].equal(points[i])) continue;
      if(here.first + dist[here.second][i] < cost[i]){
        //cout << here.first + cost_calc(points[here.second], points[i]) << endl;
        cost[i] = here.first + dist[here.second][i];
        //cout << "i : " << i << " cost : " << cost[i] << endl;
        //sn = {cost[i], i};
        q.emplace(cost[i], i);
        //cout << sn.first << endl;
      }
    }
  }

  //cout << "count : " << count << endl;


  return cost[N+1];


}

int main(){
  double ans;
  ans = solve();

  printf("%.10f\n",ans);

  return 0;
}


Measured memory_bytes: 14332
/*
        _            _                  _            _       _     _         _   _          _          _             _        
       / /\         / /\               / /\         / /\    / /\  /\ \      /\_\/\_\ _     /\ \       /\ \     _    /\ \      
      / /  \       / /  \             / /  \       / / /   / / /  \ \ \    / / / / //\_\   \ \ \     /  \ \   /\_\ /  \ \     
     / / /\ \__   / / /\ \           / / /\ \__   / /_/   / / /   /\ \_\  /\ \/ \ \/ / /   /\ \_\   / /\ \ \_/ / // /\ \_\    
    / / /\ \___\ / / /\ \ \         / / /\ \___\ / /\ \__/ / /   / /\/_/ /  \____\__/ /   / /\/_/  / / /\ \___/ // / /\/_/    
    \ \ \ \/___// / /  \ \ \        \ \ \ \/___// /\ \___\/ /   / / /   / /\/________/   / / /    / / /  \/____// / / ______  
     \ \ \     / / /___/ /\ \        \ \ \     / / /\/___/ /   / / /   / / /\/_// / /   / / /    / / /    / / // / / /\_____\ 
 _    \ \ \   / / /_____/ /\ \   _    \ \ \   / / /   / / /   / / /   / / /    / / /   / / /    / / /    / / // / /  \/____ / 
/_/\__/ / /  / /_________/\ \ \ /_/\__/ / /  / / /   / / /___/ / /__ / / /    / / /___/ / /__  / / /    / / // / /_____/ / /  
\ \/___/ /  / / /_       __\ \_\\ \/___/ /  / / /   / / //\__\/_/___\\/_/    / / //\__\/_/___\/ / /    / / // / /______\/ /   
 \_____\/   \_\___\     /____/_/ \_____\/   \/_/    \/_/ \/_________/        \/_/ \/_________/\/_/     \/_/ \/___________/    
                                                                                                                              
*/
#include<bits/stdc++.h>
using namespace std;
#define ALL(obj) (obj).begin(), (obj).end()
#define REP(i, n) for(int i = 0;i < (n);++i)

#define endl '\n'
#define pb emplace_back
#define mkp make_pair
#define p_q priority_queue
#define INF 2000000000
#define PI 3.1415926

const int dx[]={1,0,-1,0}, dy[]={0,-1,0,1};
const int dx_8[]={1,1,0,-1,-1,-1,0,1}, dy_8[]={0,-1,-1,-1,0,1,1,1};
const long long MOD = 1e9+7;

// typedef long long ll;
#define int long long

template <typename T> inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template <typename T> inline T LCM(T a,T b){T c=GCD(a,b);a/=c;return a*b;}
template <typename T> inline T nCr(T a,T b){T i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
template <typename T> inline T nHr(T a,T b){return nCr(a+b-1,b);}

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

  int x, y, z, k, a[1000], b[1000], c[1000];
  cin >> x >> y >> z >> k;
  REP(i, x) cin >> a[i];
  REP(i, y) cin >> b[i];
  REP(i, z) cin >> c[i];

  vector<int> vec, v;
  REP(i, x) REP(j, y) vec.pb(a[i]+b[j]);
  sort(ALL(vec)); reverse(ALL(vec));

  REP(i, min(x*y, k)) REP(j, z) v.pb(vec[i]+c[j]);
  sort(ALL(v)); reverse(ALL(v));

  REP(i, k) cout << v[i] << endl;

  return 0;
}

Measured memory_bytes: 42980
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
 
typedef pair<int, int> p;
 
int main() {
	cin.tie(0);
    ios::sync_with_stdio(false);

    int N, A;
    cin >> N >> A;

    vector<map<int, ll> > m(N + 1);

    m[0][0] = 1;

    for(int i = 0; i < N; i++) {
        int x;
        cin >> x;
        for(int j = i; j >= 0; j--) {
            for(auto k = begin(m[j]); k != m[j].end(); k++) {
                m[j + 1][x + k -> first] += k -> second;
            }
        }
    }

    ll ans = 0;

    for(int i = 1; i <= N; i++) {
        ans += m[i][A * i];
    }

    cout << ans << endl;
}

Measured memory_bytes: 1536
#include<stdio.h>
int N, M, k[11], s[11][11], p[11];
int ans = 0;
int main(){
	scanf("%d%d", &N, &M);
	for(int i=0; i<M; i++){
		scanf("%d", k+i);
		for(int j=0; j<k[i]; j++){
			scanf("%d", &s[i][j]);
			s[i][j]--;
		}
	}
	for(int i=0; i<M; i++)scanf("%d", p+i);
	for(int S=0; S<(1<<N); S++){
		int cnt = 0;
		for(int i=0; i<M; i++){
			int P = 0;
			for(int j=0; j<k[i]; j++){
				P ^= (S>>s[i][j])&1;
			}
			cnt += P==p[i];
		}
		ans += cnt==M;
	}
	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 1736
n=input()
l=len(n)
m=n[l-1]

if m=="2" or m=="4" or m=="5" or m=="7" or m=="9":
    print("hon")
elif m=="0" or m=="1" or m=="6" or m=="8":
    print("pon")
elif m=="3":
    print("bon")

Measured memory_bytes: 9112
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
#include <map>
#include <queue>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep2(i, j, n) for (int i = j; i < (n); ++i);
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int iINF = 1001001001;
const long long llINF = 1LL << 60;
int main()
{
	// Tenka1 Programmer Beginner Contest-C, 1111, 
	int n; cin >> n;
	vector<ll> v(n);
	rep(i, n) cin >> v[i];
	sort(v.begin(), v.end());
	int left, right;
	ll ans = 0;
	vector<ll> ansvec(n);
	if (n % 2 == 0) {
		left = v[n / 2 - 1];
		right = v[n / 2];
		ansvec[0] = left;
		ansvec.back() = right;
		v.erase(find(v.begin(), v.end(), left));
		v.erase(find(v.begin(), v.end(), right));
		if (v.size() == 0) {
			ans = abs(left - right);
			cout << ans << endl;
			return 0;
		}
		for (int i = 1; i < n - 1; i += 2) {
			ansvec[i] = v[n - 2 - 1 - i / 2];
		}
		for (int i = 1; i < n - 1; i += 2) {
			ansvec[n - 1 - i] = v[i / 2];
		}
	}
	else {
		left = v[n / 2];
		if (abs(left - v[n / 2 - 1]) < abs(left - v[n / 2 + 1])) {
			right = v[n / 2 - 1];
			ansvec[0] = left;
			ansvec.back() = right;
			v.erase(find(v.begin(), v.end(), left));
			v.erase(find(v.begin(), v.end(), right));
			for (int i = 1; i < n - 1; i += 2) {
				ansvec[n - 1 - i] = v[n - 2 - 1 - i / 2];
			}
			for (int i = 2; i < n - 1; i += 2) {
				ansvec[i] = v[i / 2 - 1];
			}
		}
		else {
			right = v[n / 2 + 1];
			ansvec[0] = left;
			ansvec.back() = right;
			v.erase(find(v.begin(), v.end(), left));
			v.erase(find(v.begin(), v.end(), right));
			for (int i = 1; i < n - 1; i += 2) {
				ansvec[i] = v[i / 2];
			}
			for (int i = 2; i < n - 1; i += 2) {
				ansvec[n - 1 - i] = v[n - 2 - 1 - i / 2 + 1];
			}
		}
	}
	rep(i, n - 1) {
		ans += abs(ansvec[i] - ansvec[i + 1]);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 4852
#include <stdio.h>
#include <math.h>

double adjust(double d)
{
  if(-0.0005<=d && d<=0.0){
    return 0.0001;
  }else{
    return d;
  }
}

int main(void)
{
  double a,b,c,d,e,f;
  while(scanf("%lf %lf %lf %lf %lf %lf", &a, &b, &c, &d, &e, &f) != EOF){
    double det = a*e-b*d;
    double x = (e*c-b*f)/det;
    double y = (-d*c+a*f)/det;  
    printf("%.3f %.3f\n", adjust(x), adjust(y));
  }

  return 0;
}

Measured memory_bytes: 0
import java.util.*;
import java.lang.*;
import java.math.*;
import java.io.*;

import static java.lang.Math.*;
import static java.util.Arrays.*;

public class Main{

	Scanner sc=new Scanner(System.in);

	int INF=1<<28;
	double EPS=1e-9;

	void run(){
		String s=sc.next();
		int n=sc.nextInt();
		int a=0;
		for(int i=0; i<n; i++){
			String t=sc.next();
			if((t+t).indexOf(s)>=0){
				a++;
			}
		}
		println(""+a);
	}

	void debug(Object... os){
		System.err.println(Arrays.deepToString(os));
	}

	void print(String s){
		System.out.print(s);
	}

	void println(String s){
		System.out.println(s);
	}

	public static void main(String[] args){
		// System.setOut(new PrintStream(new BufferedOutputStream(System.out)));
		new Main().run();
	}
}

Measured memory_bytes: 12000
#include <iostream>
#include <string>
#include <stack>
#include <cctype>
#include <algorithm>
using namespace std;
const double PI = 3.14159265358979323846;
 
int main() {
	int R;
	cin >> R;
 
	cout << 2 * PI * R << endl;
	return 0;
}

Measured memory_bytes: 3764
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define SIZE 200005
#define INF 1000000005LL
//#define INF 1e18
#define MOD 1000000007

using namespace std;
typedef long long int ll;
typedef pair <int,int> P;

ll m,n;
//ll a[SIZE];

//xのn乗
ll mod_pow(ll x, ll n){
  if(n==0) return 1;
  ll res = mod_pow(x*x%MOD,n/2);
  if(n & 1) res = res*x%MOD;
  return res;
}


int main(){
  cin >> m >> n;
  cout << mod_pow(m,n) << endl;

  return 0;
}



Measured memory_bytes: 3092
import sys
n = int(input())
w_list = sys.stdin.readline().rstrip().split()
w_list = [int(x) for x in w_list]
#print(n)
#print(w_list)

min_dif = 100

for t in range(1,n):
    #print(w_list[0:t], w_list[t:n])
    
    s1 = sum(w_list[0:t])
    s2 = sum(w_list[t:n])
    dif = abs(s1-s2)
    if min_dif > dif:
        #print(t)
        min_dif = dif
        
print(min_dif)

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

long long gcd(long long a, long long b){
    
    if (a < b)
    {
        long long tmp = a;
        a = b;
        b = tmp;
    }

    return b ? gcd(b, a % b) : a;
}


int main(){    
    long long A,B;
    cin >>A >>B;
    long long a = gcd(A,B);
    long long b=2,c=0;
    long long d = a;
    bool f = false;
    while(a%b ==0){
        a/=b;
        f = true;
    }
    b++;
    if(f ==true){
        c++,f= false;
    }
    while(a!=1){
        while(a%b ==0){
            a/=b;
            f = true;
        }
        if( b*b > d){
            c++;
            break;
        }
        b+=2;
        if(f ==true){
            c++,f= false;
        }

    }
    cout << c+1;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(){
  int mid,end,re;

  while(1){
    scanf("%d %d %d",&mid,&end,&re);

    if(mid == -1 && end == -1 && re == -1) break;
    
    if(mid==-1 || end==-1) printf("F\n");

    else if(mid + end >= 80) printf("A\n");

    else if(mid + end >= 65 && mid + end < 80) printf("B\n");

    else if(mid + end >= 50 && mid + end < 65) printf("C\n");

    else if(mid + end >=30 && mid + end < 50){
      if(re >= 50) printf("C\n");

      else printf("D\n");
    }

    else if(mid + end < 30) printf("F\n");
  }
  return 0;
}

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

#define MAX_N 200005
#define MAX_M 100005

#define pb push_back
#define mp make_pair
#define all(V) (V).begin(),(V).end()
#define reset(V) (V).clear();(V).resize(0);

#define sq(x) ((x)*(x))
#define abs(x) ((x)>0?(x):(-(x)))

#define fi first
#define se second

#define LL_inf (1LL<<60)
#define full_inf 0x7fffffff
#define half_inf 0x3fffffff
#define inf 0x3fffffff

#define MOD 1000000007LL

#define cpx_mod(x) (((LD)(((LL)x.real())%MOD)),((LD)(((LL)x.imag())%MOD)))


using namespace std;

typedef long long LL;
typedef long double LD;
typedef pair<int,int> pii;
typedef pair<LL,LL> pil;
typedef pair<LL,string> pls;
typedef complex<LD> Complex;
typedef long double LD;
LL k,a,b,ans;
int main(){
	scanf("%lld %lld %lld",&k,&a,&b);
	if(k+1<=a)	return !printf("%lld\n",k+1);
	k-=(a-1);
	ans=a;
	LL x=b-a;
	x=x>2?x:2;
	printf("%lld\n",ans+(k/2)*x+(k%2));
	return 0;
}

Measured memory_bytes: 256
x, n = map(int, input().split())

num = [0,101]
for i in range(100):
  num.append(i + 1)
num.sort()

if n == 0:
  ans = x
else:
  p = list(map(int, input().split()))
  if p.count(x) == 0:
    ans = x
  else:
    for i in range(n):
      num.remove(p[i])
    for i in range(len(num)):
      num[i] -= x
    
    max_m = -200
    for i in range(len(num)):
      if num[i] < 0 and max_m < num[i]:
        max_m = num[i]
    
    min_p = 200
    for i in range(len(num)):
      if num[i] > 0 and min_p > num[i]:
        min_p = num[i]
    
    if abs(min_p) < abs(max_m):
      ans = min_p
    else:
      ans = max_m
    ans += x
print(ans)

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

int main() {
  int n,k,x,y;
  cin>> n>>k>>x>>y;
  
  if(n>k){
  cout<< k*x+(n-k)*y<< endl;
  }
  else{
    cout<<n*x<<endl;
  }
}

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

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
const long long LINF = 1000000000000000018ll;
const int INF = 1000000009;
const int mod = 1000000007;
const int mod2 = 998244353;

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

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

  int n, k; cin >> n >> k;
  int ans = k;
  for (int i = 0; i < n-1; i++) {
    ans *= (k-1);
  }
  cout << ans << endl;
  return 0;
}


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

struct S{
  int x,y;
  bool operator < (const S &a )const{
    //if(y!=a.y)
    return y<a.y;
  };
};

struct P{
  int x,y;
  bool operator < (const P &a )const{
    //if(y!=a.y)
    return y>a.y;
  };
};

int a,b,c,d,i,n,m,e,k,dx[10]={1,0,-1,0,1,1,-1,-1},dy[10]={0,1,0,-1,1,-1,1,-1};
int o[201001];
int l[200101];
int s[1];
long long x,y,z,mod=1000000007,hf=(mod+1)/2;

//string r,r1;
char r[111];
vector<P> v[2];
P u[1];
queue<int> q;
//set<int> s[2];
//stack<int> s;
map<int,int> p;
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
//rng()
bool as(P a,P b)
{
  return a.x<b.x;
}


int main()
{
  scanf("%d %d",&a,&b);
  for(int t=1;t<=a;t++)
    scanf("%d",&o[t]);
  for(int t=1;t<=b;t++)
  {
    //printf("%d\n",t);
    priority_queue<P> q;
    priority_queue<S> q1;
    for(int t=1;t<=a;t++)
      if(o[t]!=a) goto qwe;
    for(int t=1;t<=a;t++)
      printf("%d ",o[t]);
    return 0;
    qwe:;
    memset(l,-1,sizeof(l));
    for(int t=1;t<=a;t++)
    {
      q.push({t,t+o[t]});
      for(;q.size()&&q.top().y<t;q.pop());
      //printf("#%d ",q.size());
      l[t]+=q.size();
    }
    for(int t=a;t;t--)
    {
      q1.push({t,t-o[t]});
      for(;q1.size()&&q1.top().y>t;q1.pop());
      l[t]+=q1.size();
    }
    for(int t=1;t<=a;t++)
      o[t]=l[t];
  }
  for(int t=1;t<=a;t++)
    printf("%d ",o[t]);
}



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

public class Main {
	public static void main(String[] args) throws Throwable {
		MyScanner sc = new MyScanner();
		String s = sc.nextString();

		switch (s) {
		case "Sunny":
			System.out.println("Cloudy");
			break;
		case "Cloudy":
			System.out.println("Rainy");
			break;
		case "Rainy":
			System.out.println("Sunny");
			break;
		default:
			break;
		}
	}

	static class MyScanner {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		public String nextString() throws IOException {
			return br.readLine();
		}

		public int nextInt() throws NumberFormatException, IOException {
			return Integer.parseInt(nextString());
		}

		public String[] nextStringArr() throws IOException {
			return nextString().split(" ");
		}

		public Integer[] nextIntArr() throws IOException {
			String[] strArr = nextStringArr();
			Integer[] intArr = new Integer[strArr.length];
			for (int i = 0; i < strArr.length; i++) {
				intArr[i] = Integer.parseInt(strArr[i]);
			}
			return intArr;
		}
	}

}


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

bool vis[101];

int main() {
	int n;
	scanf("%d", &n);
	for (int i = 1; i <= 9; i++) {
		for (int j = 1; j <= 9; j++) {
			vis[i * j] = true;
		}
	}
	if (vis[n]) puts("Yes");
	else puts("No");
	return 0;
}


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

int main() {
  int x, y;
  cin >> x >> y;
  vector<string> G(x);
  vector<vector<int>> flip(x,vector<int>(y));
  for (auto &s : G) cin >> s;
  if (G[0][0] == '.') flip[0][0] = 0;
  else flip[0][0] = 1;
  for (int i = 1; i < y; i++) {
    flip[0][i] = flip[0][i-1];
    if (G[0][i-1] == '.' && G[0][i] == '#') flip[0][i] += 1;
  }
  for (int i = 1; i < x; i++) {
    for (int j = 0; j < y; j++) {
      if (j == 0) {
        flip[i][0] = flip[i-1][0];
        if (G[i-1][0] == '.' && G[i][0] == '#') flip[i][0] += 1;
      }
      else {
        int u = flip[i-1][j];
        int l = flip[i][j-1];
        if (G[i][j] == '#') {
          if (G[i-1][j] == '.') u++;
          if (G[i][j-1] == '.') l++;
        } 
        flip[i][j] = min(u,l);
      }
    }
  }
  cout << flip[x-1][y-1] << endl;
}

Measured memory_bytes: 3716
import sys
import math
import collections
from collections import deque
from functools import reduce
import heapq
#x = int(input())
a, b, c, k = map(int, sys.stdin.readline().split())
#s = input()
#h = list(map(int, sys.stdin.readline().split()))

if k < a:
    print(k)
elif a <= k <= a + b:
    print(a)
else:
    print(a - (k - a - b))


Measured memory_bytes: 9568
use std::io::*;
use std::str::FromStr;
use std::cmp;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char) 
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}


fn main() {
    let n = read();
    let mut u: u32 = read();
	let mut ans = u.trailing_zeros();
    for _ in 1..n{
    	u = read();
        u = u.trailing_zeros();
        ans = cmp::min(u,ans);
    }
    println!("{}",ans);
}


Measured memory_bytes: 4352
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <stdio.h>
using namespace std;
#define int long long
int MOD = 1000000007;
signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N, A;
	cin >> N;
	cin >> A;
	if (N % 500 <= A) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}

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

#define ll int64_t
#define Rep(i, n) for (ll i = 0; i < n; i++)

using namespace std;

const ll inf = 1LL << 60;

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

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

    ll N, M, P;
    cin >> N >> M >> P;
    vector<tuple<ll, ll, ll>> edges(M);
    vector<ll> dist(N, inf);
    Rep (i, M) {
        ll A, B, C;
        cin >> A >> B >> C;
        A--; B--;
        edges[i] = make_tuple(A, B, P-C);
    }

    dist[0] = 0;
    Rep (i, N-1) {
        for (auto e : edges) {
            ll from = get<0>(e);
            ll to = get<1>(e);
            ll cost = get<2>(e);

            if (dist[from] != inf) chmin(dist[to], dist[from] + cost);
        }
    }

    Rep (i, N) {
        for (auto e : edges) {
            ll from = get<0>(e);
            ll to = get<1>(e);
            ll cost = get<2>(e);

            if (dist[to] != inf && dist[to] > dist[from] + cost) {
                dist[to] = -inf;
            }
        }
    }

    // for (auto e : dist) {
    //     cout << -e << endl;
    // }

    if (-dist[N-1] < 0) dist[N-1] = 0;
    else if (dist[N-1] == -inf) dist[N-1] = 1;
    cout << -dist[N-1] << endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using Int = long long;  // clang-format off
#define REP_(i, a_, b_, a, b, ...) for (Int i = (a), lim##i = (b); i < lim##i; i++)
#define REP(i, ...) REP_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define ALL(v) std::begin(v), std::end(v)
struct SetupIO { SetupIO() { std::cin.tie(nullptr), std::ios::sync_with_stdio(false), std::cout << std::fixed << std::setprecision(13); } } setup_io;
#ifndef dump
#define dump(...)
#endif  // clang-format on

/**
 *    author:  knshnb
 *    created: Sat Sep 19 21:22:23 JST 2020
 **/

signed main() {
    std::string s;
    std::cin >> s;
    if (s.back() == 's') {
        s += "es";
    } else {
        s += "s";
    }
    std::cout << s << std::endl;
}


Measured memory_bytes: 3648
#include<iostream>
#include<vector>
#include<cinttypes>
#include<algorithm>
#include<queue>

using sl = std::int64_t;
int main(){
	int n;

	std::cin >> n;

	std::vector<sl> an( n );
	for( auto&e : an )
		std::cin >> e;
	

	std::sort( std::begin( an ), std::end( an ) );

	std::vector<std::pair<sl, sl>> res;
	sl ans{};
	if( an.front()*an.back() > 0 )
	{
		auto low = an.front();//ex -999 or 10
		auto high = an.back();//ex -10 or 999

		/*
			1 2 3 4 5	->	5 - (1-2-3-4)　=> X - (Y)
			-5 -4 -3 -2 -1	-> -1 - (-5) - (-4) - (-3) - (-2) 	

			すべて正
			->最小値から最大値X以外を減算して大きな負整数Yを作る
			->X-Y == X-abs(Y)
			->sum(An)―最小値*2

			すべて負
			->最大値Xから他の数をすべて減算
			->ans == 最大値X + abs(sum(An)― X)
		*/


		if( low < 0 )
			std::swap( low, high );

		auto t = low;
	
		
		for( int i{ 1 }; i < an.size() - 1; ++i )
		{
			res.emplace_back( t, an[i] );
			t -= an[i];
		}//tはanが負整数列なら大きい正の整数に、anが正の整数列なら大きい負の整数になる。

		auto r = high;
		if( high < 0 )
			std::swap( r, t );// always t < 0 < r

		res.emplace_back(r ,t );
		ans = r - t;
	}
	else
	{
		auto low = an.front();
		auto high = an.back();

		for( int i{ 1 }; i < n - 1; ++i )
		{
			auto ai = an[i];
			if( ai > 0 )
			{
				res.emplace_back( low, ai );
				low -= ai;
			}
			else
			{
				res.emplace_back( high, ai );
				high -= ai;
			}
		}
		res.emplace_back( high, low );
		ans = high - low;
	}

	std::cout << ans << "\n";
	for( const auto&e : res )
		std::cout << e.first << " " << e.second << "\n";


	return 0;
}


Measured memory_bytes: 4336
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
char s[100002];
int n,sg,sp,ans;
int main()
{
	scanf("%s",s);
	n=strlen(s);
	sg=sp=0;
	for(int i=0;i<n;i++)
		if(i%2==1&&s[i]=='g')ans++;
		else	if(i%2==0&&s[i]=='p')ans--;
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>

using namespace std;

int main(){
  int N;
  cin >> N;
  string S;
  cin >> S;

  int ans=0;
  for(int i=1;i<N-1;i++){
    int count=0;
    for(char c='a';c<='z';c++){
      bool left=false,right=false;
      for(int j=0;j<i;j++){
        if(S[j]==c) left=true;
      }
      for(int k=i;k<N;k++){
        if(S[k]==c) right=true;
      }
      if(left&&right) count++;
    }
    if(ans<count) ans=count;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int n;
    cin >> n;
    int a[4];
    a[0] = n %10;
    n = n /10;
    a[1] = n %10;
    n = n /10;
    a[2] = n %10;
    n = n /10;
    a[3] = n %10;
    n = n /10;
    if (a[0] == a[1]){
        if(a[1] == a[2]){
            cout << "Yes" << endl;
        }else {
            cout << "No" <<endl;
        }
    }
    else if( a[3] == a[2]){
        if (a[2] == a[1]) {
            cout << "Yes" << endl;
        } else {
            cout << "No" << endl;
        }
    } else {
        cout << "No" << endl;
    }

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int m, b, c, n, k, s;
 
int main (){
	cin >> m>> b>> c>>k;
	n= max(c,max(m,b));
	s= m+b+c-n;
	for(int i=1;i<=k;i++){
		n=2*n;
	}
	cout << n + s << endl;
	
	
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>


using namespace std;

#define repd(i,a,b) for (int i=(a);i<(b);++i)
#define rep(i,n) repd(i,0,n)
typedef long long ll;
typedef pair<int, int> P;

int main(int argc, const char * argv[]) {
  int n;
  cin >> n;
  vector<ll> a(n, 0);
  vector<int> a_vec(n, 0);
  rep(i, n){
    int tmp;
    cin >> tmp;
    tmp--;
    a_vec[i] = tmp;
    a[tmp]++;
  }
  ll ans = 0;
  rep(i, n){
    if(a[i] > 1){
      ans += a[i] * (a[i] - 1) / 2;
    } 
  }

  rep(i, n){
    if(a[a_vec[i]] > 1){
      // cout << ans - (a[a_vec[i]] - 1) << endl;
      printf("%ld\n", ans - (a[a_vec[i]] - 1));
    }else{
      printf("%ld\n", ans);
      // cout << ans << endl;
    }
  }
  return 0;
}


Measured memory_bytes: 4992
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <vector>
using namespace std;
template <class T>
inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}

typedef long long ll;
ll MOD = 1000000007;

// a^p
// 2^3 = 2 * 2^2
// 2^2 = 2 * (2^1)
// 2^1 = 2
ll modpow(ll a, ll p, ll mod) {
  if (p == 0) return 1;

  if (p % 2 == 0) {
    ll half = modpow(a, p / 2, mod) % mod;
    return half * half % mod;
  } else {
    return a * modpow(a, p - 1, mod) % mod;
  }
}

// nCa を求める
ll modCombination(ll n, ll a, ll mod) {
  if (n - a < a) {
    return modCombination(n, n - a, mod);
  }

  ll denominator = 1;  // 分母
  ll numerator = 1;    // 分子

  for (ll i = 0; i < a; i++) {
    denominator *= a - i;
    numerator *= n - i;
    denominator %= mod;
    numerator %= mod;
  }

  return numerator * modpow(denominator, mod - 2, mod) % mod;
}

class UnionFind {
 private:
  vector<ll> parents;

 public:
  UnionFind(ll n) : parents(n, -1) {}

  bool issame(ll x, ll y) { return root(x) == root(y); }

  bool merge(ll x, ll y) {
    if (issame(x, y)) return false;

    ll rx = root(x);
    ll ry = root(y);
    if (parents[rx] > parents[ry]) swap(rx, ry);
    // サイズ情報を更新
    parents[rx] += parents[ry];
    // yの親を更新
    parents[ry] = rx;

    return true;
  }

  ll size(ll x) { return -parents[root(x)]; }

 private:
  ll root(ll x) {
    if (parents[x] < 0) return x;
    // 根の親の値に木の(-)サイズの情報を入れる
    return parents[x] = root(parents[x]);
  }
};

int main() {
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);

  ll N;
  cin >> N;

  // dp[i][l][m][n]
  // => i-3文字目がl, i-2がm,
  // i-1がnのとき、条件を満たす長さiの文字列は何通りあるか
  vector<vector<vector<vector<ll>>>> dp(
      N + 1,
      vector<vector<vector<ll>>>(5, vector<vector<ll>>(5, vector<ll>(5, 0))));

  // 0: dummy
  // 1: A
  // 2: G
  // 3: C
  // 4: T

  // NG:
  // AGC
  // ACG
  // GAC
  // A[]GC
  // AG[]C
  dp[0][0][0][0] = 1;
  for (int n = 0; n < N; ++n) {
    for (int i = 0; i < 5; ++i) {
      for (int j = 0; j < 5; ++j) {
        for (int k = 0; k < 5; ++k) {
          for (int l = 1; l < 5; ++l) {
            // i: 3文字前
            // j: 2文字前
            // k: 1文字前
            // l: current

            if (j == 1 && k == 2 && l == 3) continue;
            if (j == 1 && k == 3 && l == 2) continue;
            if (j == 2 && k == 1 && l == 3) continue;
            if (i == 1 && k == 2 && l == 3) continue;
            if (i == 1 && j == 2 && l == 3) continue;

            // iからi + 1への遷移
            dp[n + 1][j][k][l] += dp[n][i][j][k];
            dp[n + 1][j][k][l] %= MOD;
          }
        }
      }
    }
  }

  ll ans = 0;
  for (ll i = 1; i < 5; ++i) {
    for (ll j = 1; j < 5; ++j) {
      for (ll k = 1; k < 5; ++k) {
        ans += dp[N][i][j][k];
        ans %= MOD;
      }
    }
  }

  cout << ans << endl;

  return 0;
}


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

int main() {
  int N;
  cin >> N;
  vector<int> V(N - 1);
  for (int i = 0; i < N - 1; i++) {
     cin >> V.at(i);
   }

  int ans = V.at(0) + V.at(N - 2);

  for (int i = 1; i < N - 1; i++) {
     ans += min(V.at(i - 1), V.at(i));
   }

  cout << ans << endl; 
   
}

Measured memory_bytes: 256
//This is the 3th power

#include<stdio.h>
int power(int);

int main()
{
	int x;
	scanf("%d",&x);
	printf("%d\n",power(x));

	return 0;
}

int power(int x)
{
	int y;

	y=x*x*x;
	return y;
}

Measured memory_bytes: 596
#include <stdio.h>
#include <iostream>
#include <math.h>
#include <string>
#include <vector>
#include <algorithm>
#include <tuple>


using namespace std;
#define ll long long
#define pb push_back

int main() {
  vector<tuple<string,int, int>> book;
  int n,k,p;
  string s;
  cin >> n;
  // ソートしたいので(レストラン名、点数、インデックス)でデータ挿入
  for(int i=0;i<n;i++){
      cin >> s >> p;
      book.push_back(make_tuple(s, abs(p-100), i+1));
  }
  sort(book.begin(), book.end());
 

  for (auto t : book) {
    int y, z;
    string x;
    tie(x, y, z) = t;
    
    cout << z << endl;
  }

}


Measured memory_bytes: 256
def main():
    n, k, c = map(int, input().split())
    s = input()
    dp = [0]*(n)
    dp2 = [0]*(n+1)
    for i in range(n):
        if i-c-1 < 0:
            dp[i] = 1
        else:
            dp[i] = max(dp[i], dp[i-1])
            if s[i] == "o":
                dp[i] = max(dp[i], dp[i-c-1]+1)
    for i in range(n-1, -1, -1):
        if i+c+1 >= n:
            dp2[i] = 1
        else:
            dp2[i] = max(dp2[i], dp2[i+1])
            if s[i] == "o":
                dp2[i] = max(dp2[i], dp2[i+c+1]+1)
    dp = [0]+dp[:n-1]
    dp2 = dp2[1:]
    dp3 = [dp[i]+dp2[i] for i in range(n)]
    for i in range(n):
        if dp3[i] < k:
            print(i+1)


main()

Measured memory_bytes: 28552
S=input()
ans=[1]*len(S)
for i in range(len(S)-2):
    if S[i]==S[i+1]=="R":
        ans[i+2]+=ans[i]
        ans[i]=0
for i in range(len(S)-1,1,-1):
    if S[i]==S[i-1]=="L":
        ans[i-2]+=ans[i]
        ans[i]=0
print(*ans)

Measured memory_bytes: 6400
def solve(N):
    ret = 0
    for i in range(3, N + 1, 2):
        div = 0
        for j in range(1, i + 1, 2):
            div += 1 if not i % j else 0
            if 8 < div:
                break
        ret += 1 if div == 8 else 0
    return ret

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

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

double	get_distance(auto&& XY1, auto && XY2)
{
	double	x;
	double	y;

	x = XY1.at(0) - XY2.at(0);
	y = XY1.at(1) - XY2.at(1);
	return (sqrt(x * x + y * y));
}

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

	int						n;
	double					sum;
	cin >> n;
	vector<vector<double>> XY(n, vector<double>(2));

	rep(i, n)
		cin >> XY.at(i).at(0) >> XY.at(i).at(1);
	sum = 0.0;
	rep(i, n - 1)
	{
		for (int j = i + 1; j < n; j++)
			sum += get_distance(XY.at(i), XY.at(j));
	}
	cout << fixed << setprecision(8) << sum * 2.0 / (n * 1.0) << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define lson root<<1
#define rson root<<1|1
using namespace std;
int n;
int a[200010];
int sum[200010];
struct node{
    int l,r,sum;
}tr[1600080];
int push_up(int root){
    tr[root].sum=tr[lson].sum+tr[rson].sum;
}
int build(int root,int l,int r){
    if(l==r){
        tr[root].sum=0;
        tr[root].l=l;
        tr[root].r=r;
        return 0;
    }
    tr[root].l=l;
    tr[root].r=r;
    int mid=(l+r)>>1;
    build(lson,l,mid);
    build(rson,mid+1,r);
    push_up(root);
}
int update(int root,int pos){
    if(pos==tr[root].l&&pos==tr[root].r){
        tr[root].sum++;
        return 0;
    }
    int mid=(tr[root].l+tr[root].r)>>1;
    if(pos<=mid){
        update(lson,pos);
    }
    else{
        update(rson,pos);
    }
    push_up(root);
}
int query(int root,int l,int r){
    if(l>r) return 0;
    if(l<=tr[root].l&&tr[root].r<=r) return tr[root].sum;
    int mid=(tr[root].l+tr[root].r)>>1;
    if(r<=mid){
        return query(lson,l,r);
    }
    else{
        if(l>mid){
            return query(rson,l,r);
        }
        else{
            return query(lson,l,mid)+query(rson,mid+1,r);
        }
    }
}
int check(int x){
    long long ans=0;
    memset(sum,0,sizeof(sum));
    for(int i=1;i<=n;i++){
        sum[i]=sum[i-1]+((a[i]<=x)?1:-1);
    }
    for(int i=0;i<=n;i++){
        sum[i]+=n+1;
    }
    build(1,1,200010);
    for(int i=0;i<=n;i++){
        ans+=query(1,1,sum[i]-1);
        update(1,sum[i]);
    }
    return ans>=1ll*n*(n+1)/4+1;
}
int main(){
    scanf("%d",&n);
    for(int i=1;i<=n;i++){
        scanf("%d",&a[i]);
    }
    int l=1,r=1e9,mid;
    while(l<=r){
        mid=(l+r)>>1;
        if(check(mid)){
            r=mid;
        }
        else{
            l=mid+1;
        }
        if(r-l<=1) {
            mid=check(l)?l:r;
            break;
        }
    }
    printf("%d\n",mid);
    return 0;
}


Measured memory_bytes: 9600