akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
template<class T> inline T sqr(T x) {return x*x;}
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) sort((c).rbegin(),(c).rend())
#define UNIQUE(c) SORT(c); (c).erase(unique((c).begin(), (c).end()), (c).end());
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
const double INF = 1e7;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
#define CLR(a) memset((a), 0 ,sizeof(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;


LL sum_digits(LL X) {
	string s = toString(X);
	LL sum = 0;
	REP(i, SZ(s)) {
		sum += s[i] - '0';
	}
	return sum;
}


void solve(LL N){
	LL A, B;
	LL min_s = 1e7;
	for (A = 1; A < N; A++) {
		B = N - A;
		LL s = sum_digits(A) + sum_digits(B);
		if (s < min_s) {
			min_s = s;
		}
	}
	cout << min_s << endl;
}


int main(){	
	LL N;
	scanf("%lld",&N);
	solve(N);
	return 0;
}



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

using namespace std;

#define MAX 100005

bool dp[MAX];
int arr[] = {100, 101, 102, 103, 104, 105};

int main()
{
    memset(dp, false, sizeof dp);
    for(int i=0; i<6; i++) dp[arr[i]] = true;
    for(int i=106; i<MAX; i++){
        for(int j=0; j<6; j++){
            dp[i] = dp[i-arr[j]] || dp[i];
        }
    }
    int n;
    scanf("%d", &n);
    cout << (int) dp[n];
}

Measured memory_bytes: 384
N,M=map(int, input().split())
A=[int(i) for i in input().split()]
sum=0
for i in range(0, N):
  sum+=A[i]
x=sum/(4*M)
item=0
for i in range(0, N):
  if(A[i]>=x):
    item+=1
if(item>=M):
  print("Yes")
else:
  print("No")

Measured memory_bytes: 3064
// $%D%$.$%M%$.$%Y%$
// $%h%$:$%m%$:$%s%$

#pragma GCC optimize("O3")

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define IOS ios::sync_with_stdio(false); cin.tie(0)
#define ll long long
#define ld long double
#define rep(i,a,n) for (int i=(int)(a);i<(int)(n);i++)
#define per(i,a,n) for (int i=(int)(n-1);i>=(int)(a);i--)
#define mp(a, b) make_pair(a, b)
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pil pair<int, ll>
#define pli pair<ll, int>
#define fi first
#define se second


const int MOD = 1e9+7; // 998244353; // = (119<<23)+1
const int MX = 2e5+5;
const ll INF = 1e18;
const ld PI = 4*atan((ld)1);
const int xd[4] = {1,0,-1,0}, yd[4] = {0,1,0,-1};


template <typename T>
using ordered_set =
    tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;


int main() {
    int n;
    cin >> n;
    vector<pair<ll, ll> > v(n);
    for (int i = 0; i < n; ++i) {
        cin >> v[i].fi >> v[i].se;
    }
    ll ans = 0;

    for (int t = 0; t < 2; ++t) {
        ll mx = -INF;
        int mx_p;
        ll mi = INF;
        int mi_p;
        for (int i = 0; i < n; ++i) {
            v[i].se *= -1;
            if (v[i].first + v[i].second > mx) {
                mx = v[i].first + v[i].second;
                mx_p = i;
            }
            if (v[i].first + v[i].second < mi) {
                mi = v[i].first + v[i].second;
                mi_p = i;
            }
        }

        ans = max(ans, abs(v[mx_p].first - v[mi_p].first) +  abs(v[mx_p].second - v[mi_p].second)); 
    }
    cout << ans << '\n';
}

Measured memory_bytes: 6424
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;

const ll MOD = 1e9 + 7;

int main() {
  int n;
  string s;
  cin >> n >> s;
  map<char, int> m;
  for (char c = 'a'; c <= 'z'; c++) m[c] = 0;
  for (int i = 0; i < n; i++) m[s[i]]++;
  ll ans = 1;
  for (auto e : m) {
    int num = e.second + 1;
    ans = ans * num % MOD;
  }
  ans -= 1;
  cout << ans << endl;
}

Measured memory_bytes: 3732
#include <bits/stdc++.h>
#include <boost/algorithm/string/join.hpp>
#include <boost/range/irange.hpp>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
using boost::irange;
using boost::algorithm::join;

typedef long long ll;
typedef unsigned long long ull;
//typedef long double ld;

typedef map<int, int> mii;
typedef pair<int, int> pii;
typedef pair<double,double> pdd;
typedef set<int> si;
typedef set<ll> sll;
typedef vector<int> vi;
typedef vector<pair<int, int > > vii;
typedef vector<ll> vll;
typedef vector<double> vd;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
typedef vector<vll> vvll;

constexpr ll MOD = 1e9+7;
template<typename T>constexpr auto inf=numeric_limits<T>::max()/4;
constexpr int INF=inf<int>;
constexpr ll LINF=inf<ll>;

#define Sort(x) sort(begin(x),end(x))
#define Reverse(x) reverse(begin(x),end(x))
#define ABS(a,b) ((a)<(b)?(b)-(a):(a)-(b))
#define nbit(n) (1ull<<(n))
#define _ol3(_1,_2,_3,name,...)name
#define _rep(i,n)_repi(i,0,n)
#define _repi(i,a,b)for(int i=a,i##_l=(b);i<i##_l;++i)
#define REP(...) _ol3(__VA_ARGS__,_repi,_rep,)(__VA_ARGS__)
#define REPR(i,n) for(int i=n-1;i>=0;--i)
#define REPA(i,v) REP(i,(v).size())

// sort(begin(x), end(x), greater<ll>());
// lower_bound(a.begin(), a.end(), val): a[i] ≥ valである最左の位置
// upper_bound(a.begin(), a.end(), val): a[i] > valである最左の位置

// Returns minimum of a and b.
// If a is less b, a is set to b.
template<typename T>
T chmin(T& a, T b) {
  if (a > b) {
    a = b;
  }
  return a;
}

// Returns maximum of a and b.
// If a is less b, a is set to b.
template<typename T>
T chmax(T& a, T b) {
  if (a < b) {
    a = b;
  }
  return a;
}

template <typename T>
void dumpContents(const T& v, const string& msg)
{
  cerr << "### " << msg << " ###\n";
  for (const auto& x : v) {
    cerr << x << " ";
  }
  cerr << endl;
}

struct before_main_function {
  before_main_function() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<setprecision(20)<<fixed;
    #define endl "\n"
  }
} before_main_function;

// ========== end of template ==========
int N;
vi A;
vvi X;
vvi Y;

bool validate(uint32_t mask_int) {
  vector<bool> mask(N);
  REP(i, N) {
    mask[i] = (mask_int >> i) & 1u;
  }

  REP(i, N) {
    REP(j, A[i]) {
      int x = X[i][j];
      if (mask[i]) {
        // 正直者
        if (Y[i][j] != mask[x]) {
          return false;
	}
      }
    }
  }

  return true;
}

int main(int argc, char** argv) {
  cin >> N;
  A.resize(N);
  X.resize(N);
  Y.resize(N);

  REP(i, N) {
    cin >> A[i];
    X[i] = vi(A[i]);
    Y[i] = vi(A[i]);

    REP(j, A[i]) {
      cin >> X[i][j] >> Y[i][j];
      X[i][j]--;
    }
  }

  int ret = 0;
  for (uint32_t i=0; i<nbit(N); i++) {
    if (!validate(i)) continue;

    // count 1
    int c = 0;
    REP(j, N) {
      c += i>>j & 1u;
    }
    chmax(ret, c);
  }

  cout << ret << endl;

  return 0;
}


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

int main()
{
    long numa, numb;
    cin >> numa >> numb;

    if(numa>=numb*2){
        cout << numb/2 << endl;
    }else if(numb>numa*2){
        cout << numa + (numb-numa*2)/4 << endl;
    }else{
        cout << numb/2 << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define MAXN 300005
typedef long long ll;
using namespace std;

int n;
ll p = 1e9 + 7,a[MAXN],sum[MAXN],ans = 0;

inline int read()
{
	char c = getchar(); int res = 0;
	while(c < '0' || c >'9') c = getchar();
	while(c >= '0' && c <= '9')
	{
		res = res * 10 + c - '0';
		c = getchar();
	}
	return res;
}

int main(){
	
	n = read();
	for(int i = 1 ; i <= n ; i++)a[i] = read();
	for(int i = n ; i >= 1 ; i--)sum[i] = (sum[i + 1] + a[i]) % p;
	for(int i = 1 ; i <= n ; i++){
		ans = (ans + a[i] * sum[i + 1]) % p;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 6708
import java.io.*;
class Main{
public static void main(String[] args)throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
int x=0;
boolean i=true;
while(i){
String str=br.readLine();
String[] arr=str.split(" ");
int a=Integer.parseInt(arr[0]);
int b=Integer.parseInt(arr[2]);
switch(arr[1]){
case "+": x=a+b; break;
case "-": x=a-b; break;
case "*": x=a*b; break;
case "/": x=a/b; break;
case "?": i=false; break;
default: break;
}
if(i==true) System.out.println(x);
}
br.close();
}
}

Measured memory_bytes: 24228
#include <algorithm>
#include <iostream>

using namespace std;

int main()
{
	int a[ 3 ];
	for( int i = 0; i < 3; ++i )
	{
		cin >> a[ i ];
	}
	sort( a, a + 3 );
	cout << ( a[ 0 ] + a[ 1 ] == a[ 2 ] ? "Yes" : "No" ) << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <math.h>
#include <cassert>
#define rep(i,n) for(int i = 0; i < n; ++i )
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main() {
  int n;
  cin >> n;
  map<string,vector<P>> m;
  rep(i,n) {
    string s; int p;
    cin >> s >> p;
    m[s].emplace_back(p,i+1);
  }
  for(auto itr:m){
    sort(itr.second.rbegin(),itr.second.rend());
    for(P p:itr.second){
      cout << p.second << endl;
    }
  }
}


Measured memory_bytes: 256
//include,using,define等
#pragma region header
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <math.h>
#include <cstring>

// ===============================================================
//using系
#pragma region header
using namespace std;
using ll = long long;
using lint = long long;
using vl = vector<long long>;
using vvl = vector<vector<long long>>;
using vvi = vector<vector<int>>;
using vs = vector<string>;
using vc = vector<char>;
using vcc = vector<vector<char>>;
using vm = vector<short>;
using vmm = vector<vector<short>>;
using pii = pair<int, int>;
using psi = pair<string, int>;
using ld = long double;
using ull = unsigned long long;
using ui = unsigned int;
using qul = queue<ll>;
using pql = priority_queue<ll>;
const int dx[] = { 1,0,-1,0 };
const int dy[] = { 0,1,0,-1 };
constexpr ll mod = 1e9 + 7;
constexpr long double pi = 3.141592653589793238462643383279;
#pragma endregion
// ========================================================================
//define
#pragma region header
//#define int long long
#define rep(i, n) for(ll i = 0; i < n; i++)
#define REP(i, n) for(ll i = 1; i <= n; i++)
#define INF (ll)10000000000000000
#define mod (ll)1000000007
#define P pair<lint,lint>
template <class T>
bool chmax(T & a, const T & b) {
	if (a < b) {
		a = b;  // aをbで更新
		return true;
	}
	return false;
}
template <class T>
bool chmin(T& a, const T& b) {
	if (a > b) {
		a = b;  // aをbで更新
		return true;
	}
	return false;
}
#pragma endregion
#pragma endregion



int main(void) {
	int a, b; cin >> a >> b;
	if (a + b == 15)
		printf("%c\n", '+');
	if (a * b == 15)
		printf("%c\n", '*');
	if (a + b != 15 && a * b != 15)
		printf("%c\n", 'x');

	return 0;
}

Measured memory_bytes: 3656
N, M, C = map(int, input().split())
B = [int(i) for i in input().split()]
A = [[int(i) for i in input().split()] for i in range(N)]
ans = 0
for i in range(N):
    check = 0
    for j in range(M):
        check += B[j] * A[i][j]

    if check + C > 0:
        ans += 1
print(ans)

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

int main(){
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	int x = (a+d-1)/d; //ceil(a/d)
	int y = (c+b-1)/b; //ceil(c/b)
	cout<< (x>=y? "Yes":"No") <<endl;
}

Measured memory_bytes: 3648
import java.util.Scanner;

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

        int S = scan.nextInt();

        
        
        System.out.print( S / 3600 );
        System.out.print(":");
        System.out.print( S % 3600 / 60);
        System.out.print(":");
        System.out.println( S % 3600 % 60 );
    } 
}


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

#define MAX 100000
#define SENTINEL 2000000000

using namespace std;
struct Card{
  char design;
  int num;
};

Card L[MAX/2+2], R[MAX/2+2];

void mergeSort(Card[],int,int,int);
int partition(Card[],int,int,int);
void quickSort(Card[],int,int,int);
void merge(Card[],int,int,int,int);

int main(){
  int n,i,v;
  Card pre[MAX],subPre[MAX];
  char str[10];
  int stable = 1;
  cin >> n;
  for(i = 0; i < n; i++){
   cin >> str >> v;
   pre[i].design = subPre[i].design = str[0];
   pre[i].num = subPre[i].num = v;
  }

  mergeSort(pre,n,0,n);
  quickSort(subPre,n,0,n-1);

  for(i = 0; i < n; i++){
    if( pre[i].design != subPre[i].design ){
      stable = 0;
    }
  }
  if( stable == 1 ){
    cout << "Stable" << endl;
  }
  else{
    cout << "Not stable" << endl;
  }
  for(i = 0; i < n; i++){
    cout << subPre[i].design << " " << subPre[i].num << endl;
  }
  return 0;
}


void mergeSort(Card pre[], int n, int left, int right){
  int mid;
  if(left +1 < right){
    mid = (left + right)/2;
    mergeSort(pre,n,left,mid);
    mergeSort(pre,n,mid,right);
    merge(pre, n,left,mid,right);
  }
}


int partition(Card pre[],int n,int p,int r){
  int i,j;
  Card card1,card2;
  card2 = pre[r];
  i = p-1;
  for(j = p; j < r; j++){
    if(pre[j].num <= card2.num){
      i++;
      card1 = pre[i];
      pre[i] = pre[j];
      pre[j] = card1;
    }
  }
  card1 = pre[i+1];
  pre[i+1] = pre[r];
  pre[r] = card1;
  return i+1;
}


void quickSort(Card pre[],int n, int p, int r){
  int q;
  if(p < r){
    q = partition(pre,n,p,r);
    quickSort(pre,n,p,q-1);
    quickSort(pre,n,q+1,r);
  }
}

void merge(Card pre[],int n, int left, int mid, int right){
  int i,j,k;
  int n1 = mid-left;
  int n2 = right - mid;
  for(i = 0; i < n1; i++){
    L[i] = pre[left+i];
  }
  for(i = 0; i < n2; i++){
    R[i] = pre[mid+i];
  }
  L[n1].num = R[n2].num = SENTINEL;
  i = j = 0;
  for(k = left; k < right; k++){
    if(L[i].num <= R[j].num){
      pre[k] = L[i++];
    }
    else{
      pre[k] = R[j++];
    }
  }
}

Measured memory_bytes: 5452
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <sstream>
#include <unordered_map>
#include <vector>


#define INF 4000000000000000000LL
#define MOD 1000000007
#define ALL(x) std::begin(x), std::end(x)


int main(int argc, char** argv)
{
  std::cin.tie(0);
  std::ios_base::sync_with_stdio(0);

  std::cout << std::fixed << std::setprecision(6);
  std::cerr << std::fixed << std::setprecision(6);

  int N;

  std::cin >> N;

  long long A[222222], S = 0;

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

    if (i) {
      if (A[i] < A[i - 1]) {
        S += A[i - 1] - A[i];
        
        A[i] = A[i - 1];
      }
    }
  }

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


Measured memory_bytes: 5156
#include<iostream>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<limits>
#include<sstream>      

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;

const int inf = numeric_limits<int>::max() /4;
const ll linf = numeric_limits<ll>::max() /4;
const ull ulinf = numeric_limits<ull>::max()/4;
const double pi = acos(-1);
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int dx8[8]={-1,0,1,-1,1,-1,0,1};
const int dy8[8]={-1,-1,-1,0,0,1,1,1};

#define p_queue(i) priority_queue<i> 
#define rp_queue(i) priority_queue<i, vector<i>, greater<i>> 
#define P(p) cout<<(p)<<endl
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define mod(i) ((i)%(ll)(1e9 + 7))
#define divm(a,b) (mod(a * modpow((ll)b,(ll)(1e9+5))))
#define rsort(a,b,c) sort(a, b, greater<c>())
#define vsort(v) sort(v.begin(), v.end());
#define rvsort(v) sort(v.end(), v.begin());
#define ft first
#define sd second
#define pb push_back
#define it insert
#define sz(x) ((int)(x).size())
#define lb(a,n,k) (lower_bound(a,a+n,k) - a) 
#define vlb(a,k)  (lower_bound(a.begin(),a.end(),k) - a.begin())
#define ub(a,n,k) (upper_bound(a,a+n,k) - a) 
#define vub(a,k)  (upper_bound(a.begin(),a.end(),k) - a.begin())
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return

ll modpow(ll i,ll j){ ll tmp=1; while(j){ if(j%2)tmp=mod(tmp*i);i=mod(i*i);j/=2;}return tmp;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

vector<string> split(const string &str, char sep){
    vector<string> v;
    stringstream ss(str);
    string buffer;
    while( getline(ss, buffer, sep) ) {
        v.push_back(buffer);
    }
    return v;
}

//ll ncr[100][100];
//ll nCr(int n, int r){if(n==r) ret ncr[n][r] = 1; if(r==0) ret ncr[n][r] = 1; if(r==1) ret ncr[n][r] = n;if(ncr[n][r]) ret ncr[n][r]; ret ncr[n][r] = nCr(n-1,r) + nCr(n-1,r-1);}

//ll npr[100][100]={};
//ll nPr(int n,int r){if(npr[n][r])ret npr[n][r];if(r==0)ret npr[n][r] = 1;if(r==1)ret npr[n][r] = n;ret npr[n][r] = n * nPr(n-1,r-1);}

//ll nHr(int n,int r){ret nCr(n+r-1,r);}

///////////////////////////////////////////////////////////////////////////



int main(){
    int n,k;
    cin >>n >> k;
    ll x[55] = {},y[55] = {};
    pair<ll,ll> d[55] = {};

    rep(i,0,n){
        cin >> x[i] >> y[i];
        d[i].ft = x[i];
        d[i].sd = y[i];
    }

    sort(x,x+n);
    sort(y,y+n);

    ll ans = (x[n-1]-x[0])*(y[n-1]-y[0]);

    rep(xl,0,n){
        rep(xr,xl+1,n){
            rep(yl,0,n){
                rep(yr,yl+1,n){
                    int cnt = 0;
                    rep(i,0,n){
                        if(x[xl] <= d[i].ft && d[i].ft <= x[xr] && y[yl] <= d[i].sd && d[i].sd <= y[yr])cnt++;
                    }
                    if(cnt >= k)ans = min(ans,(x[xr]-x[xl])*(y[yr]-y[yl]));
                }
            }
        }
    }
	
	P(ans);
	return  0;
}

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

using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;

#define REP(i, n, m) for(ll i=n; i<(ll)m; ++i)
#define IREP(i, n, m) for(ll i=n-1; i>=m; --i)
#define rep(i, n) REP(i, 0, n)
#define irep(i, n) IREP(i, n, 0)
#define all(v) v.begin(), v.end()
#define vprint(v) for(auto e:v){cout<<e<<" ";};cout<<endl;
#define vvprint(vv) for(auto v:vv)vprint(v);

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

    ll N;
    cin >> N;

    if(N==1){
        cout << 0 << endl;
    }
    else{
        unordered_map<ll, ll> m;
        function<void(ll)> solve = [&](ll n){
            if(n==1) return;
            bool flag = false;
            for(ll k=2; k*k<=n; ++k){
                if(n%k==0){
                    solve(k);
                    solve(n/k);
                    flag = true;
                    break;
                }
            }
            if(!flag){
                if(m.find(n)!=m.end()) ++m[n];
                else m[n] = 1;
            }
        };
        solve(N);

        ll total = 0;
        for(auto it : m){
            ll e = it.second;
            ll cnt = 1;
            while(e>0){
                e -= cnt;
                if(cnt+1>e) break;
                ++cnt;
            }
            total += cnt;
        }
        cout << total << endl;
    }
}


Measured memory_bytes: 3652
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>

using namespace std;

int X;
int N;

int main()
{
  	scanf("%d", &X);
    N = X / 2;
    if(X % 2 == 1)
    {
    	N++;
    }
  	printf("%d", N);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<long long> vl;
#define pll pair<ll, ll>
#define vpl vector<pll>
#define vb vector<bool>
#define PB push_back
#define MP make_pair
#define ln "\n"
#define forn(i,e) for(ll i=0; i<e; i++)
#define forsn(i,s,e) for(ll i=s; i<e; i++)
#define rforn(i,e) for(ll i=e; i>=0; i--)
#define rforsn(i,s,e) for(ll i=s; i>=e; i--)
#define vasort(v) sort(v.begin(), v.end())
#define vdsort(v) sort(v.begin(), v.end(),greater<int>())
#define F first
#define S second

#define out1(x1) cout << x1 << ln
#define out2(x1,x2) cout << x1 << " " << x2 << ln
#define out3(x1,x2,x3) cout << x1 << " " << x2 << " " << x3 << ln
#define out4(x1,x2,x3,x4) cout << x1 << " " << x2 << " " << x3 << " " << x4 << ln
#define out5(x1,x2,x3,x4,x5) cout << x1 << " " << x2 << " " << x3 << " " << x4 << " " << x5 << ln
#define out6(x1,x2,x3,x4,x5,x6) cout << x1 << " " << x2 << " " << x3 << " " << x4 << " " << x5 << " " << x6 << ln

#define in1(x1) cin >> x1
#define in2(x1,x2) cin >> x1 >> x2
#define in3(x1,x2,x3) cin >> x1 >> x2 >> x3
#define in4(x1,x2,x3,x4) cin >> x1 >> x2 >> x3 >> x4
#define in5(x1,x2,x3,x4,x5) cin >> x1 >> x2 >> x3 >> x4 >> x5
#define in6(x1,x2,x3,x4,x5,x6) cin >> x1 >> x2 >> x3 >> x4 >> x5 >> x6

#define mz(a)   memset(a,0,sizeof(a))
#define arrin(a,n) forn(i,n) cin >> a[i];
#define arrout(a,n) forn(i,n) {cout << a[i] << " ";} cout << ln;
#define TYPEMAX(type)   std::numeric_limits<type>::max()
#define TYPEMIN(type)   std::numeric_limits<type>::min()

#define zoom ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
int main() {
    zoom;
    ll n;
    in1(n);
    string s;
    in1(s);
    ll i=0,j=n-1;
    ll s1=0;
    while(i<j){
        while(i<j && s[i]=='R') i++;
        while(i<j && s[j]=='W') j--;
        if (i>=j) break;
        swap(s[i],s[j]);
        s1++;
    }
    out1(s1);
    return 0;
}

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

#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
#define MOD 1000000007

using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

int iy[]={0, 0, 1, -1};
int ix[]={1, -1, 0, 0};

int n, m, x, y, mi, ma;

int main(){
	cin >> n >> m >> x >> y;
	ma = 0 - 1000;
	mi = 1000;
	for(int i=0;i<n;i++){
		int xi;
		cin >> xi;
		ma = max(ma, xi);
	}
	for(int i=0;i<m;i++){
		int xi;
		cin >> xi;
		mi = min(mi, xi);
	}
	if(mi-ma>=1&&ma>x&&mi<=y){
		cout << "No War" << endl;
	}else{
		cout << "War" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long int
#define mod 1000000007
#define string_mod 2549536629329_base_255
#define pb push_back
#define F first
#define S second
#define ff first
#define endl "\n"
#define ss second
#define all(v) v.begin(), v.end()
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
int power(int x, unsigned int y, int p)
{
    int res = 1;
    x = x % p;
    //  cout << x << " ";
    while (y > 0)
    {

        if (y & 1)
            res = (res * x) % p;

        y = y >> 1;
        x = (x * x) % p;
    }
    return res % p;
}
int lcm(int a, int b)
{
    return (a * b) / __gcd(a, b);
}

int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int tc;
    tc = 1;
    while (tc--)
    {
        int n;
        cin >> n;
        int a[n];
        int ans = 0, k = 1;
        for (int i = 0; i < n;i++){
            cin >> a[i];
            if(a[i]==k){
                k++;
                ans++;
            }
        }
        if(ans==0){
            cout << -1 << endl;
            return 0;
        }
        cout << n - ans << endl;
    }

    return 0;
}

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

int main() {
  string a, b;
  cin >> a >> b;
  if (a.at(0) == b.at(2) && a.at(1) == b.at(1) && a.at(2) == b.at(0)) cout << "YES" << endl;
  else cout << "NO" << endl;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){

	int H, W;
	
	while (1){
		cin >> H >> W;
		if (H == 0 && W == 0)break;


		for (int i = 0; i < H; i++)
		{
			for (int j = 0; j < W; j++)
			{
				if (i == 0 || i == H - 1 || j == 0 || j == W - 1)
				{
					cout << "#";
				}
				else
				{
					cout << ".";
				}
			}
			cout << endl;
		}
		cout << endl;
	}






	return 0;
}

Measured memory_bytes: 3032
#pragma region Template
#include <bits/stdc++.h>
using namespace std;
struct ios_accelerate { ios_accelerate() { ios::sync_with_stdio(false); cin.tie(nullptr); } } CALL;

#define REP(i, n) for(int i = 0; i < n; i++)
#define RNG(i, a, b) for(int i = a; i < b; i++)
#define RBF(i, v) for(auto& i : v)
#define ALL(x) x.begin(), x.end()

using LL = long long;
using UL = unsigned long;
using ULL = unsigned long long;
template<typename T> using V = vector<T>;
template<typename T> using VV = vector<vector<T>>;
template<typename T> using P = pair<T, T>;

const double PI = 3.141592653589793;
const int MOD = 1000000007;
const LL INF64 = static_cast<LL>(1e18) + 2;
const int INF = static_cast<int>(1e9) + 2;

template<typename T> inline void upsort(vector<T>& x) { sort(x.begin(), x.end()); }
template<typename T> inline void downsort(vector<T>& x) { sort(x.begin(), x.end(), greater<T>()); }
template<typename T> inline void col(T x) { cout << x << '\n'; }
template<> inline void col(double x) { cout << fixed << setprecision(12) << x << '\n'; }
#pragma endregion

signed main()
{	
	string s;
	cin >> s;
	reverse(ALL(s));

	int n = s.size();
	V<int> mods(2019, 0);
	mods[0] = 1;
	V<P<int>> memo(10);
	REP(i, 10) {
		memo[i] = { i,0 };
	}

	int pre = 0;
	REP(i, n) {
		int x = s[i] - '0';
		while (memo[x].second < i) {
			memo[x].first = 10 * memo[x].first % 2019;
			memo[x].second++;
		}
		pre += memo[x].first;
		mods[pre % 2019]++;
	}

	int ans = 0;
	RBF(m, mods) {
		if (m > 1) {
			ans += m * (m - 1) / 2;
		}
	}

	col(ans);
	return 0;
}


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

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define LCM(a, b) (a) / __gcd((a), (b)) * (b)
#define CEIL(a, b) (a)/(b)+(((a)%(b))?1:0)
#define ln '\n'

using namespace std;
using LL = long long;
using ldouble = long double;
using P = pair<int, int>;
using LP = pair<LL, LL>;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1e9 + 7;
static const int SIZE = 200005;

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

vector<LL> Div(LL n) {
    vector<LL> ret;
    for(LL i = 1; i * i <= n; ++i) {
        if(n % i == 0) {
            ret.pb(i);
            if(i * i != n) ret.pb(n / i);
        }
    }
    sort(all(ret));
    return ret;
}

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

    LL K;
    cin >> K;
    LL res[50];
    for(int i = 0; i < 50; ++i) {
        res[i] = i + K / 50;

    }

    K %= 50;
    while(K > 0) {
        K--;
        int mpos;
        LL mn = LINF;
        for(int i = 0; i < 50; ++i) {
            if(mn > res[i]) {
                mpos = i;
                mn = res[i];

            }
        }

        for(int i = 0; i < 50; ++i) {
            if(i == mpos) res[i] += 50;
            else res[i]--;

        }
    }

    cout << 50 << endl;
    cout << res[0];
    for(int i = 1; i < 50; ++i) cout << " " << res[i];
    cout << endl;

    return 0;
}



Measured memory_bytes: 256
#include <iostream>
//#include <iomanip>
//#include <string>
//#include <vector>
//#include <algorithm>
//#include <utility>
//#include <set>
//#include <map>
//#include <queue>
//#include <deque>
//#include <bitset>
#include <math.h>
using namespace std ;
using ll = long long ;
//using ld = long double ;
//using vll = vector<ll> ;
//using vvll = vector<vll> ;
//using vc = vector<char> ;
//using vvc = vector<vc> ;
//using vb = vector<bool> ;
//using vvb = vector<vb> ;
//using pll = pair<ll,ll> ;

//ll mod = 1000000007 ;
//long double pie = acos(-1) ;

//void yorn(bool a){if(a) cout << "Yes" << endl ; else cout << "No" << endl ;}
//void YorN(bool a){if(a) cout << "YES" << endl ; else cout << "NO" << endl ;}
//ll gcd(long long a,long long b){if(b==0) return a ; return gcd(b,a%b) ;}
//ll lcm(long long a,long long b){return a/gcd(a,b)*b ;}
//ll sa(long long a,long long b){if(a>b) return a-b ; return b-a ;}
//void mysort(vector<pll> &a){sort(a.begin(),a.end()) ;}
//void myrev(vector<pll> &a){reverse(a.begin(),a.end()) ;}

int main(){
	ll n,k ;
	cin >> n >> k ;
	ll ans ;
	ans = pow(n/k,3) ;
//	cout << n/k << " " << pow(n/k,3) << endl ;
//	cout << ans << endl ;
	if(k%2==0) ans += pow(n/(k/2)-n/k,3) ;
	cout << ans << endl ;
}


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


a.sort(reverse=True)
cnt = a.pop(0)
if (n-2) % 2 == 0:
    tmp = 2 * sum(a[0:(n-2)//2])
else:
    tmp = 2 * sum(a[0:(n-2)//2]) + a[(n-2)//2]
cnt += tmp
print(cnt)

Measured memory_bytes: 31480
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
const lint mod = 1e9 + 7;
#define all(x) (x).begin(), (x).end()
#define bitcount(n) __builtin_popcountl((lint)(n))
#define fcout cout << fixed << setprecision(15)
#define highest(x) (63 - __builtin_clzl(x))
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T = string, class U = char>int character_count(T text, U character){ int ans = 0; for(U i: text){ ans += (i == character); } return ans; }
lint power(lint base, lint exponent, lint module){ if(exponent % 2){ return power(base, exponent - 1, module) * base % module; }else if(exponent){ lint root_ans = power(base, exponent / 2, module); return root_ans * root_ans % module; }else{ return 1; }}
struct position{ int y, x; }; position mv[4] = {{0, -1}, {1, 0}, {0, 1}, {-1, 0}}; // double euclidean(position first, position second){ return sqrt((second.x - first.x) * (second.x - first.x) + (second.y - first.y) * (second.y - first.y)); }
template<class T, class U> string to_string(pair<T, U> x){ return to_string(x.first) + "," + to_string(x.second); } string to_string(string x){ return x; }
template<class itr> void array_output(itr start, itr goal){ string ans; for(auto i = start; i != goal; i++) ans += to_string(*i) + " "; if(!ans.empty()) ans.pop_back(); cout << ans << endl; }
template<class itr> void cins(itr first, itr last){ for(auto i = first; i != last; i++){ cin >> (*i); } }
template<class T> T gcd(T a, T b){ if(a && b){ return gcd(min(a, b), max(a, b) % min(a, b)); }else{ return a; }} template<class T> T lcm(T a, T b){ return a / gcd(a, b) * b; }
struct combination{ vector<lint> fact, inv; combination(int sz) : fact(sz + 1), inv(sz + 1){ fact[0] = 1; for(int i = 1; i <= sz; i++){ fact[i] = fact[i - 1] * i % mod; } inv[sz] = power(fact[sz], mod - 2, mod); for(int i = sz - 1; i >= 0; i--){ inv[i] = inv[i + 1] * (i + 1) % mod; } } lint C(int p, int q) const{ if(q < 0 || p < q) return 0; return (fact[p] * inv[q] % mod * inv[p - q] % mod); } };
template<class itr> bool next_sequence(itr first, itr last, int max_bound){ itr now = last; while(now != first){ now--; (*now)++; if((*now) == max_bound){ (*now) = 0; }else{ return true; } } return false; }
template<class itr, class itr2> bool next_sequence2(itr first, itr last, itr2 first2, itr2 last2){ itr now = last; itr2 now2 = last2; while(now != first){ now--, now2--; (*now)++; if((*now) == (*now2)){ (*now) = 0; }else{ return true; } } return false; }

int main(){
    double a, b, x;
    cin >> a >> b >> x;
    double low = 0, high = M_PI / 2;
    for(int i = 0; i < 100; i++){
        double mid = (low + high) / 2;
        double deal;
        if(tan(mid) < b / a){
            deal = a * b - a * a / 2 * tan(mid);
        }else{
            deal = b * b / 2 / tan(mid);
        }
        if(deal * a < x){
            high = mid;
        }else{
            low = mid;
        }
    }
    fcout << low / M_PI * 180 << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <limits.h>
#include <float.h>
#include <math.h>

int main(int argc, char *argv[])
{
    char s[100001];
    int count_red, count_blue;
    int min;
    int i;
    int ans;

    scanf("%s", s);

    count_red = 0;
    count_blue = 0;

    for (i = 0; s[i] != 0; i++) {
        switch(s[i]) {
            case '0':
                count_red++;
                break;
            case '1':
                count_blue++;
                break;
            default:
                printf("INPUT ERROR (%d)\n", s[i]);
                exit(1);
        }
    }

    min = (count_red<count_blue)?count_red:count_blue;

    ans = 2 * min;

    printf("%d\n", ans);

    return 0;
}


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

#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) begin(r),end(r)
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)
#define vvl(v,w,h,init) vector<vector<ll>> v(w,vector<ll>(h,init))
#define mp(a,b) make_pair(a,b)

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

using ll = long long;
using pii = pair<int,int> ;
using pll = pair<ll,ll> ;

template<typename T>
void O(T t){
  cout << t << endl;
}

const ll mod = 1e9+7;
constexpr ll inf = ((1<<30)-1)*2+1 ;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1,0,1,-1,1,-1};
const int dx[] = {0,-1,0,1,1,-1,-1,1};


int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n,a,b;
  cin >> n >> a >> b;
  vector<ll> v(n),c(n);
  ll s = 0;
  rep(i,n){
    cin >> v[i];
    s += v[i];
  }
  sort(all(v));
  ll l = 0,r = mod;
  /* if(a > 2 * b) a = 2*b; */
  rep(_,100){
    ll m = (l+r)/2;
    ll k = 0;
    rep(i,n){
      if(v[i] - b * m > 0){
        k += ceil(1.0 * (v[i] - b * m)/(a-b));
      }
    }
    if(k <= m){
      r = m;
    }
    else l = m;
  }
  cout << r << endl;
  return 0;
}


Measured memory_bytes: 1792
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		scan.close();
		if(2<n) System.out.println(2*n/gcd(2,n));
		else System.out.println(2*n/gcd(n,2));
	}

	static int gcd(int x,int y) {
		if(x%y==0)return y;
		else return gcd(y,x%y);
	}
}

Measured memory_bytes: 23252
#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <numeric>
#include <string>
#include <functional>

using namespace std;

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

int main(void){
    int N;
    cin>>N;
    vector<pair<int,int>> A(N);
    rep(i,N){
        cin>>A[i].first;
        A[i].second=i+1;
    }
    sort(A.begin(),A.end());
    rep(i,N){
        cout<<A[i].second<<" ";
    }
    cout<<endl;
    return 0;
}

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

using namespace std;
typedef long long ll;
typedef pair<ll, ll> p_ll;

template<class T>
void debug(T itr1, T itr2) { auto now = itr1; while(now<itr2) { cout << *now << " "; now++; } cout << endl; }
#define repr(i,from,to) for (int i=(int)from; i<(int)to; i++)
#define all(vec) vec.begin(), vec.end()
#define rep(i,N) repr(i,0,N)
#define per(i,N) for (int i=(int)N-1; i>=0; i--)

const ll MOD = 998244353;
const ll LLINF = pow(2,61)-1;
const int INF = pow(2,30)-1;

vector<ll> fac;
void c_fac(int x=pow(10,6)+10) { fac.resize(x,true); rep(i,x) fac[i] = i ? (fac[i-1]*i)%MOD : 1; }
ll inv(ll a, ll m=MOD) { ll b = m, x = 1, y = 0; while (b!=0) { int d = a/b; a -= b*d; swap(a,b); x -= y*d; swap(x,y); } return (x+m)%m; }
ll nck(ll n, ll k) { return fac[n]*inv(fac[k]*fac[n-k]%MOD)%MOD; }
ll gcd(ll a, ll b) { if (a<b) swap(a,b); return b==0 ? a : gcd(b, a%b); }
ll lcm(ll a, ll b) { return a/gcd(a,b)*b; }


int main() {
  string S; cin >> S;
  int N = S.length();
  int r[2*N] = {}, b[2*N] = {};
  rep(i,N) {
    int s = S[i] - '0';
    r[i] = i==0 ? s : r[i-1] + s;
    b[i] = i==0 ? 2-s : b[i-1] + (2-s);
  }
  repr(i,N,2*N) { r[i] = r[N-1]; b[i] = b[N-1]; }
  // debug(r,r+2*N); debug(b,b+2*N);

  int dp[2*N+1][2*N+1] = {}; dp[0][0] = 1;
  rep(i,2*N) {
    repr(j,max(0,(i+1)-r[i]),b[i]+1) {
      dp[i+1][j] = 1;
      dp[i+1][j] = dp[i][j];
      if (j!=0) dp[i+1][j] += dp[i][j-1];
      dp[i+1][j] %= MOD;
    }
  }
  // rep(i,2*N+1) debug(dp[i],dp[i]+(2*N+1));

  ll result = 0;
  rep(i,2*N+1) result = (result + dp[2*N][i])%MOD;
  cout << result << endl;
  return 0;
}

Measured memory_bytes: 62848
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
namespace AtCoder
{
    class Program
    {
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }
        static long Mod = (long)998244353;
        static void Main(string[] args)
        {
            //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            Solve();
            Read();
            //Out.Flush();
        }
        static void Solve()
        {
            var NM = Sarray();
            var N = NM[0];
            var M = NM[1];
            var g = Enumerable.Range(0, (int)N).Select(_ => new List<long>()).ToArray();
            for (var i = 0; i < M; ++i)
            {
                var ab = Sarray();
                var a = ab[0] - 1;
                var b = ab[1] - 1;
                g[a].Add(b);
                g[b].Add(a);
            }
            var q = new Queue<long>();
            q.Enqueue(0);
            var sign = Enumerable.Repeat(-1L, (int)N).ToArray();
            sign[0] = 0;
            while (q.Any())
            {
                var r = q.Dequeue();
                foreach (var nr in g[r])
                {
                    if (sign[nr] != -1) continue;
                    sign[nr] = r;
                    q.Enqueue(nr);
                }
            }
            WriteLine("Yes");
            for (var i = 1; i < N; ++i)
                WriteLine(sign[i] + 1);
        }
    }
}

Measured memory_bytes: 55056
#include <iostream>

using namespace std;

int main(int argc, char* argv[]) {
  int N, D, X;
  cin >> N >> D >> X;

  for (int i = 0; i < N; ++i) {
    int a;
    cin >> a;
    X += 1;
    X += (D - 1) / a;
  }

  cout << X << endl;

  return 0;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        boolean[] broken = new boolean[n + 1];
        for (int i = 0; i < m; i++) {
            broken[sc.nextInt()] = true;
        }

        // 累積和的にDPする。抜けた段は0でSKIP
        int[] dp = new int[n + 1];
        Arrays.fill(dp, 0);
        dp[0] = 1;
        dp[1] = broken[1] ? 0 : 1; // 最初の段が壊れている可能性

        for (int i = 2; i <= n; i++) {
            if (broken[i]) {
                continue;
            }
            dp[i] = dp[i - 1] + dp[i - 2]; // 遷移元を累積和
            dp[i] %= 1000000007;
        }

        // 2段連続で壊れていないか
        boolean canNotUpStairs = false;
        for (int i = 1; i < broken.length; i++) {
            if (broken[i - 1] && broken[i]) {
                canNotUpStairs = true;
            }
        }

        if (canNotUpStairs) {
            System.out.println(0);
        } else {
            System.out.println(dp[dp.length - 1]);
        }
    }
}


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

int main(){
	int k, s;
	cin >> k >> s;
	int pattern = 0;
	for(int x=0; x<=k; ++x){
		for(int y=0; y<=k; ++y){
			if(0<=s-x-y && s-x-y<=k){
				pattern++;
			}
		}
	}
	cout << pattern << endl;
	return 0;
}


Measured memory_bytes: 256
Sx,Sy,Tx,Ty=[int(i) for i in input().split()]
x,y=[Tx-Sx,Ty-Sy]
if y>0:
    U="U"
    D="D"
else:
    U="D"
    D="U"
if x>0:
    R="R"
    L="L"
else:
    R="L"
    L="R"
x=abs(x)
y=abs(y)
print(U*y+R*x+U+L*(x+1)+D*(y+1)+R*(x+1)+U*y+R+D*(y+1)+L*(x+1)+U)

Measured memory_bytes: 3064
#create date: 2020-03-22 21:08

import sys
stdin = sys.stdin

def ns(): return stdin.readline().rstrip()
def ni(): return int(ns())
def na(): return list(map(int, stdin.readline().split()))

def main():
    l = ni()
    print("{:.10f}".format((l/3)**3))

if __name__ == "__main__":
    main()

Measured memory_bytes: 3060
// AOJ 2663: RUPC
// 2018.1.3 bal4u@uu

#include <stdio.h>
#include <stdlib.h>

int a[300002]; long long sa[300002]; int sz;
int b[1000002];
long long c[300002];

int cmp(int *a, int *b) { return *a - *b; }

//#define getchar_unlocked()  getchar()
int in()
{
	int n, c;
//	while ((c = getchar_unlocked()) < '0');
	c = getchar_unlocked();
	n = 0; do n = (n<<3)+(n<<1) + (c & 0xf), c = getchar_unlocked();
	while (c >= '0');
	return n;
}

long long inl()
{
	int c; long long n;
//	while ((c = getchar_unlocked()) < '0');
	c = getchar_unlocked();
	n = 0; do n = (n<<3)+(n<<1) + (c & 0xf), c = getchar_unlocked();
	while (c >= '0');
	return n;
}

int bsch(int x)
{
	int m, l = 0, r = sz;

    while (l < r) {
        m = (l + r) >> 1;
		if (a[m] == x) return m;
        if (a[m] < x) l = m + 1; else r = m;
    }
	return l-1;
}

int uniq(int *a, int n)
{
	int i, j, k;
	
	for (i = 0, j = 1; j < n; j++) {
		k = 1;
		while (j < n && a[j] == a[i]) j++, k++;
		if (j < n) {
			if (i == 0) sa[0] = (long long)a[0]*k;
			else        sa[i] = sa[i-1] + (long long)a[i]*k;
			if (++i != j) a[i] = a[j];
		}
	}
	if (i == 0) sa[0] = (long long)a[0]*k;
	else        sa[i] = sa[i-1] + (long long)a[i]*k; 
	return i+1;
}

int main()
{
	int n, m, i;
	long long s;

	n = in();

#if 0
	for (i = 0; i < n; i++) a[i] = in();
	qsort(a, n, sizeof(int), cmp);
#else
#define VMAX 1000000
	i = n; while (i--) b[in()]++;
	for (m = 0, i = 0; i <= VMAX; i++) while (b[i]) a[m++] = i, b[i]--;
#endif

	sz = uniq(a, n);

	m = in();
	for (i = 0; i < m; i++) b[i] = in();
	for (i = 0; i < m; i++) c[i] = inl();

	for (i = 0; i < m; i++) {
		if (b[i] < a[0]) s = 0;
		else             s = sa[bsch(b[i])];

		puts(s >= c[i]? "Yes": "No");
	}
	return 0;
}




Measured memory_bytes: 10888
#include <cstdio>
#include <cctype>
#include <cstring>
#include <algorithm>
#include <vector>
#include <set>

#define debug(...) fprintf(stderr, __VA_ARGS__)

#ifndef AT_HOME
#define getchar() IO::myGetchar()
#define putchar(x) IO::myPutchar(x)
#endif

namespace IO {
	static const int IN_BUF = 1 << 23, OUT_BUF = 1 << 23;

	inline char myGetchar() {
		static char buf[IN_BUF], *ps = buf, *pt = buf;
		if (ps == pt) {
			ps = buf, pt = buf + fread(buf, 1, IN_BUF, stdin);
		}
		return ps == pt ? EOF : *ps++;
	}

	template<typename T>
	inline bool read(T &x) {
		bool op = 0;
		char ch = getchar();
		x = 0;
		for (; !isdigit(ch) && ch != EOF; ch = getchar()) {
			op ^= (ch == '-');
		}
		if (ch == EOF) {
			return false;
		}
		for (; isdigit(ch); ch = getchar()) {
			x = x * 10 + (ch ^ '0');
		}
		if (op) {
			x = -x;
		}
		return true;
	}

	inline int readStr(char *s) {
		int n = 0;
		char ch = getchar();
		for (; isspace(ch) && ch != EOF; ch = getchar())
			;
		for (; !isspace(ch) && ch != EOF; ch = getchar()) {
			s[n++] = ch;
		}
		s[n] = '\0';
		return n;
	}

	inline void myPutchar(char x) {
		static char pbuf[OUT_BUF], *pp = pbuf;
		struct _flusher {
			~_flusher() {
				fwrite(pbuf, 1, pp - pbuf, stdout);
			}
		};
		static _flusher outputFlusher;
		if (pp == pbuf + OUT_BUF) {
			fwrite(pbuf, 1, OUT_BUF, stdout);
			pp = pbuf;
		}
		*pp++ = x;
	}

	template<typename T>
	inline void print_(T x) {
		if (x == 0) {
			putchar('0');
			return;
		}
		std::vector<int> num;
		if (x < 0) {
			putchar('-');
			x = -x;
		}
		for (; x; x /= 10) {
			num.push_back(x % 10);
		}
		while (!num.empty()) {
			putchar(num.back() ^ '0');
			num.pop_back();
		}
	}

	template<typename T>
	inline void print(T x, char ch = '\n') {
		print_(x);
		putchar(ch);
	}

	inline void printStr_(const char *s, int n = -1) {
		if (n == -1) {
			n = strlen(s);
		}
		for (int i = 0; i < n; ++i) {
			putchar(s[i]);
		}
	}

	inline void printStr(const char *s, int n = -1, char ch = '\n') {
		printStr_(s, n);
		putchar(ch);
	}
}
using namespace IO;

const int N = 100005;

int n, a[N], b[N], p[N], A[N], B[N];

int main() {
	read(n);
	for (int i = 1; i <= n; ++i) {
		read(a[i]);
	}
	for (int i = 1; i <= n; ++i) {
		read(b[i]);
	}
	for (int i = 1; i <= n; ++i) {
		p[i] = i;
	}
	std::sort(p + 1, p + 1 + n, [&](int x, int y) {
		return b[x] < b[y];
	});
	std::sort(b + 1, b + 1 + n);
	for (int i = 1; i <= n; ++i) {
		B[i] = A[i] = std::lower_bound(b + 1, b + 1 + n, a[p[i]]) - b;
	}
	std::sort(B + 1, B + 1 + n);
	bool flag = 1;
	for (int i = 1; i <= n; ++i) {
		if (B[i] > i) {
			printStr("No");
			return 0;
		}
		flag &= B[i] == i;
	}
	if (!flag) {
		printStr("Yes");
		return 0;
	}
	int cnt = 1;
	for (int i = A[1]; i != 1; i = A[i]) {
		++cnt;
	}
	if (cnt < n) {
		printStr("Yes");
	} else {
		printStr("No");
	}
}


Measured memory_bytes: 6724