akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;

int main(void) {
    string s;
    vector<char> a;
    cin >> s;
    for (char c : s) {
        if (c == 'B') {
            if (a.size() != 0) a.pop_back();
        } else {
            a.push_back(c);
        }
    }
    for (char c : a) {
        cout << c;
    }
}

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

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


int main() {
  int N,K;
  cin >> N >> K;
  ll cnt=0;
  rep2(b,K+1,N+1) {
    // cout << N/b*(b-K) + max(N%b-K+1,0) << endl;
    cnt += N/b*(b-K) + max(N%b-K+1,0);
  }
  if (K==0) cnt-=N;
  cout << cnt << endl;
}

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

int main() {
  int A, B;
  cin >> A >> B;
 
  if(A == 1){
    cout << B;
    return 0;
  }  
  
  int max = (A - 1) + B;
  int min = B - (A - 1);
  vector<int> vec(max - min);
  
  int j = 0;
  for(int i = min; i <= max; i++){
    vec.at(j) = i;
    cout << vec.at(j) << " ";
  }
  
}


Measured memory_bytes: 256
N, M = map(int, input().split())
A = [ int(x) for x in input().split() ]

B = [0]
sum_v = 0

for a in A:
    sum_v += a
    sum_v %= M
    B += [ sum_v ]

B.sort()
B += [ "@" ]

cur = B[0]
cnt, ans = 1, 0

for i, b in enumerate(B):
    if B[i+1] == "@":
        ans += cnt*(cnt-1)//2
        break

    if cur == B[i+1]:
        cnt += 1
    else:
        cur = B[i+1]
        ans += cnt*(cnt-1)//2
        cnt = 1

print(ans)


Measured memory_bytes: 14224
//code by lynmisakura.wish to be accepted!
#include<bits/stdc++.h>
using namespace std;

typedef long long ll;

template<class T>
vector<pair<T,int>> runlength(vector<T> arr) {
  int i = 0;
  int n = arr.size();
  vector<pair<T, int>> run;
  while (i < arr.size()) {
    T t = arr[i];
    int k = 0;
    while (i + k < n && arr[i + k] == t) k++;
    run.push_back(pair<T, int>(t, k));
    i += k;
  }
  return run;
}
vector<pair<char,int>> runlength(string s){
  int i = 0;
  int n = s.size();
  vector<pair<char, int>> run;
  while (i < n) {
    char t = s[i];
    int k = 0;
    while (i + k < n && s[i + k] == t) k++;
    run.push_back(pair<char, int>(t, k));
    i += k;
  }
  return run;
}
template<class T>
int freq(vector<T> arr) {
  vector<T> vec = arr;
  int n = arr.size();
  sort(all(vec));
  int i = 0;
  vector<pair<int, T>> run;
  while (i < arr.size()) {
      T t = arr[i];
    int k = 0;
    while (i + k < n && arr[i + k] == t) k++;
    run.push_back(pair<int, T>(k, t));
    i += k;
  }
  sort(all(run));
  reverse(all(run));
  return run[0].first;
}

int main(int argc, char const *argv[])
{
  int n;scanf("%d",&n);
  vector<ll> a(n);for(int i = 0;i < n;i++)cin >> a[i];
  sort(a.begin(),a.end());
  auto v = runlength(a);
  cout << v.size() << endl;
  return 0;
}


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

#define rep(i, a, b) for (int i = (a); i < (int)(b); i++)
#define rrep(i, a, b) for (int i = (a); i >= (int)(b); i--)
#define all(x) (x).begin(), (x).end()
using i32 = int32_t;
using i64 = int64_t;
using f32 = float;
using f64 = double;
using P   = pair<int, int>;

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

template <class T>
void dump_vec(const vector<T> &v) {
    auto len = v.size();
    rep(i, 0, len) {
        cout << v[i] << (i == (int)len - 1 ? "\n" : " ");
    }
}

struct Setup {
    Setup() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(20);
    }
} SETUP;

//---------------------------------------------------------------------------------------------------

//---------------------------------------------------------------------------------------------------

// 配列 A[p..r] を A[p..q − 1] の各要素が A[q] 以下で、
// A[q + 1.. r] の各要素が A[q] より大きい A[p..q − 1] と A[q + 1..r] に分割し、インデックス q を戻り値として返す
int partition(vector<int> &as, int p, int r) {
    auto x = as[r];
    int i  = p - 1;
    rep(j, p, r) {
        if (as[j] <= x) {
            i++;
            swap(as[i], as[j]);
        }
    }
    swap(as[i + 1], as[r]);
    return i + 1;
}

signed main() {
    int N;
    cin >> N;
    vector<int> A(N);
    rep(i, 0, N) cin >> A[i];
    auto p = partition(A, 0, N - 1);
    rep(i, 0, N) {
        if (i == N - 1) {
            if (i == p) {
                cout << "[" << A[i] << "]\n";
            } else {
                cout << A[i] << "\n";
            }
        } else {
            if (i == p) {
                cout << "[" << A[i] << "] ";
            } else {
                cout << A[i] << " ";
            }
        }
    }
}



Measured memory_bytes: 3192
#include <stdio.h>
int main()
{
	long int A;	/* 高橋君の持っているクッキー☆の数	*/
	long int B;	/* 青木君の持っているクッキー☆の数	*/
	long int K;	/* 行動を行った回数			*/

	/*
	 * 操作の回数がクッキー☆の総数よりも多いなら
	 * 出力は 0 0
	 * クッキー☆の総数が操作の回数より少ない場合と分けて考える
	 */

	scanf("%ld %ld %ld", &A, &B, &K);

	if((A + B) <= K){
		printf("0 0\n");
		return (0);
	}

	if(K > A){
		A = K - A;
		B = B - A;
		A = 0;
	}
	else if(K < A)
		A = A - K;
	else
		A = 0;

	printf("%ld %ld\n", A, B);
	return (0);
}

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

using namespace std;

#define llong long long int
#define ldouble long double
#define rep(i, n) for (int i = 0; i < n; ++i)
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()
#define stl_rep(itr, x) for (auto itr = x.begin(); itr != x.end(); ++itr)

const static int MOD = 1000000000 + 7;
const static llong INF = 1LL << 60;
const static int dy[] = {0, 1, 0, -1};
const static int dx[] = {1, 0, -1, 0};

template<typename T> T my_gcd(T a, T b) {
    return (a ? my_gcd(b % a, a) : b);
}

template<typename T> T my_lcm(T a, T b){
	return a * b / my_gcd(a, b);	
}

template<typename T> struct UF {
    vector<int> par;
    vector<T> sz;

    UF(int n) {
        par.resize(n);
        sz.resize(n);
        for (int i = 0; i < n; ++i) {
            par[i] = i;
            sz[i] = 1;
        }
    }

    int find_root(int x) {
        return par[x] == x ? x : par[x] = find_root(par[x]);
    }

    bool same(int x, int y) {
        return find_root(x) == find_root(y);
    }

    void unite(int x, int y) {
        x = find_root(x);
        y = find_root(y);
        if (x == y) return;
        
        if (sz[x] < sz[y]) swap(x, y);
        sz[x] += sz[y];
        par[y] = x;
    }

    T size_of_tree(int x) {
        return sz[find_root(x)];
    }
};

signed main (int argc, char *argv[]) {
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n;
    cin >> n;
    vector<int> p(n);
    rep(i, n) cin >> p[i];

    int M = 40000;
    vector<int> A(n), B(n);
    rep(i, n) {
        A[i] = M * (i + 1);
        B[i] = M * (n - i);
    }

    rep(i, n) A[p[i] - 1] += i + 1;

    rep(i, n) {
        if (i) cout << " ";
        cout << A[i];
    }
    cout << endl;

    rep(i, n) {
        if (i) cout << " ";
        cout << B[i];
    }
    cout << endl;

    return 0;
}

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

template <typename T>
void print(const T &v);

int main()
{
    string s;
    int k;
    cin >> s >> k;
    map<string, int> mp;
    int n = s.size();
    for (int i = 0; i < n; i++)
    {
        for (int j = 1; j <= min(n - i, 5); j++)
        {
            string sub = s.substr(i, j);
            mp[sub]++;
        }
    }
    int cnt = 1;
    for (auto m : mp)
    {
        if (cnt == k)
        {
            cout << m.first << endl;
            return 0;
        }
        cnt++;
    }
}

// Use For Debug
template <typename T>
void print(T const &v)
{
    for (int i = 0; i < v.size(); i++)
    {
        if (i)
            cout << " ";
        cout << v[i];
    }
    cout << endl;
}


Measured memory_bytes: 1920
N = input()
T = map(int,raw_input().split(" "))
A = map(int,raw_input().split(" "))




note = [1 for i in range(N)]
fx = [0 for i in range(N)]

def solve():
    global note
    if T[-1] != A[0]:
        return 0
    
    prev = 0
    for i in range(N):
        if prev > T[i]:
            return 0
        elif prev == T[i]:
            note[i] = prev
        else:
            note[i] = 1
            prev = T[i]
            fx[i] = T[i]
    prev = 0
    for i in range(N-1,-1,-1):
        if prev > A[i]:
            return 0
        elif prev == A[i]:
            if not fx[i]:
                note[i] = min(note[i],prev)
            else:
                if fx[i] > A[i]:
                    return 0

        else:
            if fx[i] and fx[i] != A[i]:
                return 0
            note[i] = 1
            prev = A[i]

    ans = 1
    for i in range(N):
        if not fx[i]:
            ans = (ans * note[i])%(10**9+7)
    return ans



    





print solve()


Measured memory_bytes: 14556
#include<bits/stdc++.h>
#include<algorithm>
#include<math.h>
#include<string>
#include<iostream>
#include<vector>
#include<cstdlib>
using namespace std;
 
template <class T> using V = vector<T>;
 
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
 
const long long INF = 1LL << 60;
 
using ll = long long;
using db = double;
using st = string;
using ch = char;
using bl = bool;
using vll = V<ll>;
using vpll =V<pair<ll,ll>>;
using vst = V<st>;
using vdb = V<db>;
using vch = V<ch>;
using vbl = V<bl>;
 
 
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define rFOR(i,a,b) for(ll i=(a);i>(b);i--)
#define oFOR(i,a,b) for(ll i=(a);i<(b);i+=2)
#define bgn begin()
#define en end()
#define SORT(a) sort((a).bgn,(a).en)
#define REV(a) reverse((a).bgn,(a).en)
#define M(a,b) max(a,b)
#define rM(a,b) min(a,b)
#define fi first
#define se second
#define sz size()
#define gcd(a,b) __gcd(a,b)
#define co(a) cout<<a<<endl;
#define ci(a) cin>>a;
 

vll dp(100100);

ll sum(ll n) {
  ll m=0;
  FOR(i,0,20){
    m+=n%10;
    n/=10;
    if(n==0){
      break;
    }
  }
  return m;
}
 
 
const int MAX = 510000;
const int MOD = 1000000007;
 
long long fac[MAX], finv[MAX], inv[MAX];
 
void Comuse() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
 
 
#define comuse Comuse()
 
ll combi(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
 
 
 
 
ll lcm(ll a,ll b){
  ll n;
  n=a/gcd(a,b)*b;
  return n;
}
 
 
/****************************************\
| Thank you for viewing my code:)        |
| Written by RedSpica a.k.a. RanseMirage |
| Twitter:@asakaakasaka                  | 
\****************************************/
 
 
signed main() {
  st s;	
  ci(s);
  if(s[0]=='S'){
    co("Cloudy")
  }
  else if(s[0]=='C'){
    co("Rainy")
  }
  else{
    co("Sunny")
  }
}

Measured memory_bytes: 1024
def test():

	n = int(input())
	
	max = -10000000000
	m_min = int(input())

	for i in range(n-1):

		next = int(input())

		if max < (next - m_min):
			max = next - m_min

		if m_min > next:
			m_min = next

	print(max)


if __name__ == "__main__":
	test()



Measured memory_bytes: 5612
<?php
fscanf(STDIN, "%d %d", $n, $x);
$c = $n + 1; $d = 0;
$l = array_map('intval', explode(' ', trim(fgets(STDIN))));
for ($i=0; $i < $n; $i++) {
  $d += $l[$i];
  if ($d > $x) {
    $c = $i + 1;
    break;
  }
}
echo $c;
?>


Measured memory_bytes: 3828
import sys
fin = sys.stdin.readline

N, T = [int(elem) for elem in input().split(' ')]
cost_and_times = [[int(elem) for elem in fin().split(' ')] for _ in range(N)]
min_cost = float('inf')
for c, t in cost_and_times:
    if t <= T:
        min_cost = min(min_cost, c)

if min_cost == float('inf'):
    print("TLE")
else:
    print(min_cost)


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

int main()
{
	int s;
	scanf("%d", &s);
	std::map<int, int> a;
	a[s] = 1;
	int num{s};
	for (int i{2}; i <= 1000000; i++)
	{
		if (num & 1) num = 3 * num + 1;
		else num /= 2;
		if (a.find(num) == a.end()) a[num] = i;
		else
		{
			printf("%d\n", i);
			break;
		}
	}

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
 
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
 
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
 
#define rep(i, n)    for(int i = 0; i < (n); ++i)
#define repA(i, a, n)  for(int i = a; i <= (n); ++i)
#define repD(i, a, n)  for(int i = a; i >= (n); --i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
#define fill(a)  memset(a, 0, sizeof (a))
#define fst first
#define snd second
#define mp make_pair
#define pb push_back
typedef long double ld;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

void pre(){


}
 
void solve(){
 
 
}

int main() {
	cin.sync_with_stdio(0); cin.tie(0);
	cin.exceptions(cin.failbit);
	pre();

    int n,k;cin>>n>>k;
    ll ans=0, m=n/k;
    ans=m*m*m;
    if(k%2==0){
        if((n/k)*k+k/2<=n) ans += (m+1)*(m+1)*(m+1);
        else m--, ans+=(m+1)*(m+1)*(m+1);
    }
    cout<<ans<<endl;


	return 0;
}
 



Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
class Program
{
    static void Main(string[] args)
    {
            // 入力
            string[] sS = Console.ReadLine().Trim().Split(' ');
            int ia = int.Parse(sS[0]);
            int ib = int.Parse(sS[1]);

            System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
            sw.Start();

            // 解析
            string sOut = "Even";
            if (ia % 2 == 1 && ib % 2 == 1) { sOut = "Odd"; }

            // 出力
            Console.WriteLine("{0}", sOut.ToString().Trim());

            sw.Stop();
#if DEBUG
            Console.WriteLine();
            Console.WriteLine("{0}", sw.Elapsed.ToString());
            Console.WriteLine("続行するには何かキーを押してください．．．");
            Console.ReadKey();
#endif
    }
}


Measured memory_bytes: 13268
#include <bits/stdc++.h>
#include <unordered_set>
using namespace std;
#define ll long long
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repeat(i,s,n) for(int (i)=s; (i)<(n); (i)++)
#define revrep(i,n) for(int (i)=(n)-1;i>=0; i--)

ll gcd(ll x,ll y) { return y ? gcd(y,x%y) : x; }

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<setprecision(std::numeric_limits<float>::max_digits10);
  cout<<fixed;
  ll k;cin>>k;
  ll s=0;
  repeat(a,1,k+1) {
    repeat(b,1,k+1) {
      repeat(c,1,k+1) {
	s+=gcd(a,gcd(b,c));
      }
    }
  }
  cout << s <<endl;
  return 0;
}


Measured memory_bytes: 3652
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <set> 
#include <map>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <cctype>
#define REP(i,n) for(int i=0; i<(n); ++i)
#define FOR(i,a,b) for(int i=(a); i<(b); ++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 100100100;
const ll INFLL = 1001001001001001001;  // > 10^18
const int MOD = (int)1e9 + 7;
const ll MODLL = (ll)1e9 + 7;
const double EPS = 1e-9;


int main () {
    
    int n,m; cin >>n>>m;
    vector<int> a(m); REP(i,m) cin >> a[i];
    vector<bool> flag(n+1, true);
    for (int i = 0; i < m; i++) {
        flag[a[i]] = false;
    }

    vector<int> dp(n+1, 0);
    dp[0] = 1;

    for (int i = 1; i <= n; i++) {
        if (flag[i]) {
            dp[i] += dp[i-1]; 
            dp[i] %= MOD;
            if (i >= 2) {
                dp[i] += dp[i-2];
                dp[i] %= MOD;
            } 
        } else {
            dp[i] = 0;
        } 
    }
    cout << dp[n] << endl;
    return 0;
}



Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc = new Scanner(System.in);

		//入力表示
		int N = sc.nextInt();

		int V[] = new int[N];

		for (int i = 0; i < N; ++i) {
			V[i] = sc.nextInt();
		}

		int C[] = new int[N];
		for (int i = 0; i < N; ++i) {
			C[i] = sc.nextInt();
		}

		int ans = 0;
		for (int i = 0; i < N; ++i) {
			if (V[i] > C[i]) {
				ans += V[i] - C[i];
			}
		}

		System.out.println(ans);

	}

}

Measured memory_bytes: 23124
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <iomanip>
#include <vector>
#include <string.h>
#include <string>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <math.h>
#include <algorithm>
#include <numeric>


using namespace std;

// マクロ&定数 ============================================================
typedef unsigned int uint;
typedef long long ll;
//typedef pair<int, int> P;

typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<bool> vbool;
typedef vector<string> vstring;

typedef vector<pair<int, int>> vpint;
typedef vector<pair<ll, ll>> vpll;
typedef vector<pair<double, double>> vpdouble;

typedef vector<vector<int>> vvint;
typedef vector<vector<ll>> vvll;
typedef vector<vpint> vvpint;
typedef vector<vpll> vvpll;
typedef vector<vector<double>> vvdouble;
typedef vector<vector<string>> vvstring;
typedef vector<vector<bool>> vvbool;

typedef vector<vector<vector<ll>>> vvvll;

const int c_YET = -1;
const int INF = 1e9 + 1;
const ll LLINF = 1e17 + 1;
const int DX[9] = { 0,  0, 1, -1, 1,  1, -1, -1, 0 }; // 4;４近傍
const int DY[9] = { 1, -1, 0,  0, 1, -1,  1, -1, 0 }; // 8:８近傍 9:(0,0)を含む
const ll MOD = 1e9 + 7; //10^9 + 7
const ll MAX = 1e9;
const double PI = 3.14159265358979323846264338327950288;
//========================================================================


int main() {

	////==================================
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(30);
	////==================================


	string S;
	cin >> S;

	ll a = 0;
	ll b = 0;
	ll c = 0;

	for (int i = 0; i < S.size(); i++)
	{
		a += S[i] == 'a';
		b += S[i] == 'b';
		c += S[i] == 'c';
	}

	if (abs(a - b) <= 1 && abs(b - c) <= 1 && abs(c - a) <= 1)
	{
		cout << "YES" << endl;
	}
	else
	{
		cout << "NO" << endl;
	}


}





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

#define REP(i,n) for(int i=0;i<(n);++i)
#define ll long long
const long long INF = 1LL<<60;
const long long mod = 1e9 + 7;

int main(){
    int y, m , d;
    char a, b;
    cin >> y >> a >> m >> b >> d;
    if(m<=4) cout << "Heisei" << endl;
    else cout << "TBD" << endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<cmath>
#include<bitset>
#include<iostream>
#include<algorithm>
#include<string>
#include<utility>
#include<tuple>
#include<vector>
#include<list>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<numeric>
#include<functional>
#include<iomanip>
#include<random>

#define IOS ios::sync_with_stdio(false),cin.tie(0)
#define REP(i,n) for(int i = 0;i < n;i++)
#define FOR(i,a,b) for(int i = a;i < b;i++)
#define MEM(a,b) memset(a,b,sizeof(a))
#define ALL(x) (x).begin(),(x).end()
#define LMAX 9223372036854775807
#define LMIN -9223372036854775808

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ull, ull> UP;
typedef tuple<int, int, int> T;

struct UnionFind {
	vector<int> data;
	UnionFind(int size) : data(size, -1) {}
	void unionSet(int x, int y) {
		x = root(x), y = root(y);
		if (x != y) {
			if (data[y] < data[x])swap(x, y);
			data[x] += data[y]; data[y] = x;
		}
	}
	bool findSet(int x, int y) {
		return root(x) == root(y);
	}
	int root(int x) {
		return data[x] < 0 ? x : data[x] = root(data[x]);
	}
	int size(int x) {
		return -data[root(x)];
	}
};

int gcd(int a, int b) {
	if (a < b)swap(a, b);
	int k = a % b;
	if (k == 1)return 1;
	if (k == 0)return b;
	int ans = gcd(b, k);
	return ans;
}
int digisum(ll a) {
	int sum = 0;
	while (a) {
		sum += a % 10;
		a /= 10;
	}
	return sum;
}


int main() {
	int n;
	string ans = "";
	cin >> n;
	while (n != 0) {
		if (n % 2 != 0) {
			ans = "1" + ans;
			n--;
		}
		else ans = "0" + ans;
		n /= -2;
	}
	if (ans == "")ans = "0";
	cout << ans << endl;
}



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

public class Main {

	static class Node<E> {
		E value;
		Node<E> prev;
		Node<E> next;
		public Node(E value) {
			this.value = value;
			prev = null;
			next = null;
		}
		public String toString() {
			return value.toString();
		}
	}
	
	static class DoublyLinkedList<E> {		
		
		private Node<E> head;
		private Node<E> tail;
		private int size;
		
		public DoublyLinkedList() {
			head = tail = null;			
			size = 0;
		}
		
		public int getSize() {
			return size;
		}
		
		public boolean isEmpty() {
			return size == 0;
		}

		public void appendToHead(E element) {
			Node<E> node = new Node<E>(element);
			if (head == null && tail == null) {
				head = tail = node;
			} else {
				head.prev = node;
				node.next = head;
				head = node;
			}
			size++;
		}
		
		public void delete(E element) {

			if (isEmpty()) {
				return;
			}
			
			if (head.value.equals(element)) {
				deleteFirst();
			} else {
				Node<E> current = head.next;
				Node<E> current2 = tail;
				Node<E> current3 = null;
				while (current != null) {
					if (current.value.equals(element)) {
						Node<E> prev = current.prev;
						Node<E> next = current.next;
						prev.next = next;
						if (next != null) {
							next.prev = prev;
						} else {
							tail = prev;
						}
						size--;
						break;
					} else if (current == current2) {
						if (current3 != null) {
							current = current3;
						} else {
							break;							
						}
					} else {
						current = current.next;						
						if (current2.value.equals(element)) {
							current3 = current2;
						}
						current2 = current2.prev;
					}
				}
			}
		}

		public void deleteFirst() {			
			if (isEmpty()) {
				return;
			}
			if (size == 1) {
				head = null;
				tail = null;
			} else {
				head = head.next;
				head.prev = null;
			}
			size--;
		}
		
		public void deleteLast() {			
			if (isEmpty()) {
				return;
			}
			if (size == 1) {
				head = null;
				tail = null;
			} else {
				tail = tail.prev;
				tail.next = null;
			}
			size--;
		}

		public void print() {
			Node<E> current = head;
			while (current != null) {
				System.out.print(current);
				current = current.next;
				if (current != null) {
					System.out.print(" ");
				}
			}
			System.out.println("");
		}
	}
	
	public static void main(String[] args) throws NumberFormatException, IOException {
				
		DoublyLinkedList<Integer> list = new DoublyLinkedList<Integer>();

		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(reader.readLine());
				
		for (int i = 0; i < n; i++) {
			String cmd = reader.readLine();
			if (cmd.startsWith("insert")) {
				list.appendToHead(Integer.parseInt(cmd.substring(7)));
			} else if (cmd.equals("deleteFirst")) {
				list.deleteFirst();
			} else if (cmd.equals("deleteLast")) {
				list.deleteLast();
			} else {
				list.delete(Integer.parseInt(cmd.substring(7)));
			}
		}
		list.print();
	}
}


Measured memory_bytes: 141160
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;
long long MOD = 1e9 + 7;
int main(){
    string S;
    cin >> S;
    vector<vector<long long>> dp(13, vector<long long>(S.size() + 1, 0));
    vector<long long> rui(S.size());
    rui[0] = 1;
    for(int i = 1; i < S.size(); i++){
        rui[i] = rui[i - 1] * 10 % 13;
    }
    reverse(S.begin(), S.end());
    for(int i = 0; i < S.size(); i++){
        if(S[i] == '?'){
            for(int j = 0; j < 10; j++){
                if(i == 0) {
                    dp[j][i + 1] += 1;
                    continue;
                }
                for(int k = 0; k < 13; k++){
                    if(i != 0){
                        dp[(k + j * rui[i]) % 13][i + 1] += dp[k][i];
                        dp[(k + j * rui[i]) % 13][i + 1] %= MOD;
                    }
                }
            }
        }
        else{
            long long s = S[i] - '0';
            if(i == 0){
                dp[s][i + 1] += 1;
                continue;
            }
            for(int k = 0; k < 13; k++){
                if(i != 0){
                    dp[(k + s * rui[i]) % 13][i + 1] += dp[k][i];
                    dp[(k + s * rui[i]) % 13][i + 1] %= MOD;
                }
            }
        }
    }
    cout << dp[5][S.size()] << endl;
}

Measured memory_bytes: 11504
#include <stdio.h>
#include <queue>
#include <algorithm>
#include <limits.h>
using namespace std;

struct room 
{
	int level, x, y;
	room(int level, int x, int y)
	{ this->level = level, this->x = x, this->y = y; }
	bool operator < (room rhs) const
	{ return this->level > rhs.level; }
};

int map[2][500][500];
bool visit[2][500][500];
int result[2][100001];

int main()
{
	int r, w[2], h[2], sx[2], sy[2], tmp, sec, open, ans;

	while(true) {
		scanf("%d", &r);
		if(r == 0) break;
		for(int i = 0; i < 2; ++i) {
			scanf("%d%d%d%d", &w[i], &h[i], &sx[i], &sy[i]);
			--sx[i], --sy[i];
			for(int y = 0; y < h[i]; ++y) {
				for(int x = 0; x < w[i]; ++x) {
					scanf("%d", &tmp);
					map[i][x][y] = tmp;
					visit[i][x][y] = false;
				}
			}
			for(int j = 1; j <= r; ++j) result[i][j] = -1;
			result[i][0] = 0;
		}

		priority_queue<room> next;
		queue<room> seek;

		for(int i = 0; i < 2; ++i) {
			open = 0;
			sec = 0;
			next.push(room(1, sx[i], sy[i]));

			while(!next.empty() && open < r) {
				sec = next.top().level;
				while(!next.empty()) {
					room m = next.top();
					if(m.level > sec) break;
					visit[i][m.x][m.y] = true;
					seek.push(m);
					next.pop();
				}

				while(!seek.empty()) {
					room at = seek.front();
					seek.pop();
					result[i][++open] = sec;
					for(int rx = at.x - 1; rx < at.x + 2; ++rx) {
						for(int ry = at.y - 1; ry < at.y + 2; ++ry) {
							if(abs(rx - at.x) + abs(ry - at.y) != 1) continue;
							if(rx < 0 || rx >= w[i] || ry < 0 || ry >= h[i]) continue;
							if(visit[i][rx][ry]) continue;
							if(map[i][rx][ry] <= sec) {
								seek.push(room(map[i][rx][ry], rx, ry));
								visit[i][rx][ry] = true;
							} else {
								next.push(room(map[i][rx][ry], rx, ry));
								visit[i][rx][ry] = true;
							}
						}
					}
				}
			}
			for(int j = 1; j <= open; ++j) {
				if(result[i][j] == -1)
					result[i][j] = result[i][j - 1];
				//printf("%d ", result[i][j]);
			}
			//printf("\n%d: open=%d level=%d\n", i, open, sec);
		}
		
		ans = INT_MAX;
		for(int i = 0; i <= r; ++i) {
			if(result[0][i] == -1 || result[1][r - i] == -1) continue;
			ans = min(ans, result[0][i] + result[1][r - i]);
		}
		printf("%d\n", ans);
	}

	return 0;
}

Measured memory_bytes: 4384
N,K=map(int,input().split())
def dice_coin(N,K):
    pro=[]
    for i in range(N):
        count=0
        j=0
        while K-(i+1)*2**j>0:
            j=j+1
        pro.append(1/N*(1/2)**j)
    return sum(pro)
print("{}".format(dice_coin(N,K)))

Measured memory_bytes: 6296
N, X = (int(i) for i in input().split())  
L = [1]
P = [1]

for _ in range(N):
  L.append(L[-1] * 2 + 3)
  P.append(P[-1] * 2 + 1)

def count(x,n):
  if n == 0:
    return 0 if x <= 0 else 1
  elif x <= L[n-1] + 1:
    return count(x-1, n-1)
  else:
    return P[n-1] + 1 + count(x-(L[n-1]+2),n-1)

#print(L,P)
print(count(X, N))

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <string>
#include <unordered_map>
#include <math.h>
#include <algorithm>
#include <deque>
#include <climits>
using namespace std;
#define rep(i,l,r) for(int i=l;i<r;i++)
#define repb(i,r,l) for(int i=r;i>l;i--)
#define ll long long
#define ull unsigned long long
#define ve vector
#define umap unordered_map
#define iter iterator

const int MxN=4e8+1;
pair<ll,ll> a[50], b[50];
void solve() {
    ll n,m;
    cin>>n>>m;
    for(ll i=0;i<n;i++) cin>>a[i].first>>a[i].second;
    for(ll i=0;i<m;i++) cin>>b[i].first>>b[i].second;
    for(ll i=0;i<n;i++) {
        ll min=MxN,k;
        for(ll j=0;j<m;j++) {
            ll d = abs(b[j].second-a[i].second)+abs(b[j].first-a[i].first);
            if(d < min) {
                min = d;
                k = j;
            }
        }
        cout<<k+1<<endl;
    }
}

int main() {
    solve();
    return 0;
}

Measured memory_bytes: 256
import itertools

N = int(input())
l = [0 for i in range(5)]
for i in range(N):
    S = input()[0]
    if S == "M":
        l[0] += 1
    elif S == "A":
        l[1] += 1
    elif S == "R":
        l[2] += 1
    elif S == "C":
        l[3] += 1
    elif S == "H":
        l[4] += 1

comb = list(itertools.combinations(range(5), 3))
ans = 0
for c in comb:
    ans += l[c[0]] * l[c[1]] * l[c[2]]
print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <set>
#include <string>
#include <vector>

int main(void){
    std::string n;
    std::cin >> n;

    if(n[0] == n[1] && n[1] == n[2]){
        std::cout << "Yes";
        return 0;
    }
    else if(n[1] == n[2] && n[2] == n[3]){
        std::cout << "Yes";
        return 0;
    }
    else{
        std::cout << "No";
        return 0;
    }

}




Measured memory_bytes: 256
function Main(input){
  input = input.split("\n");
  inputStr = input[0].split(" ");
  //パラメータSを文字列に格納
  var S = inputStr[0];
  var ans = "Good";
  //1文字ずらしながら、隣り合う文字を比較
  if(S[0]===S[1]){
    ans = 'Bad';
  } else if(S[1]===S[2]){
    ans = 'Bad';
  } else if(S[2]===S[3]){
    ans = 'Bad';
  }
  //AとBの小さい値に人数を掛けて計算する
  console.log(ans);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 7496
#include <iostream>
#include <vector>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <set>
#define REP(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using arr = vector<ll>;
constexpr ll MOD = 1000000007;
constexpr ll INF = 1LL << 60;
constexpr int MAX = 2020;

string s, t;
set<int> st[26];

int main()
{
  cin >> s >> t;
  int n = (int)s.size();
  int m = (int)t.size();
  s += s;


  for(int i = 0; i < n * 2; ++i) {
    st[s[i] - 'a'].insert(i);
  }

  ll ans = 0, pos = 0;
  for(int i = 0; i < m; ++i) {
    if (st[t[i] - 'a'].empty()) {
      cout << -1;
      return 0;
    }
    int next = *st[t[i] - 'a'].lower_bound(pos) + 1;
    ans += next - pos;
    pos = next % n;
  }
  cout << ans;
  return 0;
}

Measured memory_bytes: 9984
n=int(input())
inp=input()
num=[0]*(n+1)

k=0
for i in range(n):
  if inp[i]=='R':k+=1
  num[i+1]=k
R=num[-1]
W=n-R

ans=float('inf')
for i in range(n+1):
  rl=num[i]
  wl=i-rl
  rr=R-rl
  wr=W-wl
  swap=min(wl,rr)
  change=max(wl,rr)-swap
  ans=min(ans,swap+change)
print(ans)

Measured memory_bytes: 16916
def main():
    n = input()

    res = ''

    for i in range(len(n)):
        if n[i] == '1':
            res += '9'
        elif n[i] == '9':
            res += '1'
        else:
            res += n[i]
    
    print(int(res))

if __name__ == '__main__':
    main()

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

const int N = 5005;
const long long inf = 1e18;

int n, H[N], P[N];
int a[N];
long long f[N][N];

int main() {
	ios_base::sync_with_stdio(false); cin.tie(0);
	cin >> n;
	for (int i = 1; i <= n; ++i) cin >> H[i] >> P[i], a[i] = i;
	sort(a + 1, a + n + 1, [&](int x, int y) {
		return H[x] + P[x] < H[y] + P[y];
	});
	
	for (int i = 0; i <= n; ++i) {
		for (int j = 0; j <= n; ++j) f[i][j] = inf;
	}

	f[0][0] = 0;
	for (int i = 1; i <= n; ++i) {
		for (int j = 0; j <= i; ++j) {
			f[i][j] = f[i-1][j];
			if (j > 0 && H[a[i]] >= f[i-1][j-1]) {
				f[i][j] = min(f[i][j], f[i-1][j-1] + P[a[i]]);
			}
		}
	}

	for (int i = n; i >= 0; --i) if (f[n][i] != inf) {
		cout << i << endl; return 0;
	}
}

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

static const int N = 100;

int main(){
    int n,a[N + 1],b[N + 1][N + 1],k;
    cin >> n;
    for(int i = 1;i <= n;i++){
        cin >> a[i - 1] >> a[i];
    }
    for(int i = 1;i <= n;i++){
        b[i][i] = 0;
    }
    for(int i = 2;i <= n;i++){
        for(int j = 1;j <= n - i + 1;j++){
            k = j + i - 1;
            b[j][k] = (1 << 21);
            for(int l = j;l <= k - 1;l++){
                b[j][k] = min(b[j][k],b[j][l] + b[l + 1][k] + a[j - 1]*a[l]*a[k]);
            }
        }
    }
    cout << b[1][n] << endl;
    return 0;
}



Measured memory_bytes: 3136
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt(), b = sc.nextInt();
		int c = sc.nextInt(), x = sc.nextInt();
		sc.close();
		int tmpa = a, tmpb = b, tmpc = c, tmpx = x / 50;
		int r = tmpx % 2;
		int ans = 0;
		for (int i = r; i <= x; i += 2) {
			if(i > tmpc)break;
			int tmp = (tmpx - i) / 2;
			int tr = tmp % 5;
			for(int j = tr; j <= tmp; j += 5) {
				if(j > tmpb)break;
				int tmp2 = (tmp - j) / 5;
				if(tmp2 <= a && tmp >= 0)++ans;
			}
		}
		System.out.println(ans);
	}

}


Measured memory_bytes: 20820
#pragma GCC optimize(2)
#include <cstdio>
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <queue>
#include <deque>
#include <list>
#include <climits>
#include <bitset>
#include <fstream>
#include <algorithm>
#include <functional>
#include <stack>
#include <string>
#include <cmath>
#define fi first
#define se second
#define re register
#define ls i << 1
#define rs i << 1 | 1
#define pb push_back
#define pii pair<int,int>
#define ios ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define mod 1000000007

#define int long long

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const double eps = 1e-8;
const int inf = 0x3f3f3f3f;
const long long INF = 0x3f3f3f3f3f3f3f3f;
const double pi = acos(-1.0);
int tt;
inline int rd(){
  int x = 0, f = 1; char ch = getchar();
  while (ch < '0' || ch>'9') { if (ch == '-')f = -1; ch = getchar(); }
  while (ch >= '0' && ch <= '9') { x = x * 10 + ch - '0'; ch = getchar(); }
  return x * f;
}

void out(int a) {
  if (a < 0) putchar('-'), a = -a;
  if (a >= 10) out(a / 10);
  putchar(a % 10 + '0');
}

void solve() {
  int d = rd(), t = rd(), s = rd();
  puts(1.*d / s <= t ? "Yes" : "No");
}

signed main(){
//  for (tt = rd(); tt--; )
  solve();
  return 0;
}

Measured memory_bytes: 3668
import sys,queue,math,copy,itertools,bisect,collections,heapq

def main():
    sys.setrecursionlimit(10**7)
    INF = 10**9
    MOD = 10**9 + 7
    LI = lambda : [int(x) for x in sys.stdin.readline().split()]
    NI = lambda : int(sys.stdin.readline())

    N = NI()
    T = LI()
    A = LI()
    T = [0] + T + [T[-1]]
    A = [A[0]] + A + [0]

    ans = 1
    for i in range(1,N+1):
        m = 0
        if T[i] > T[i-1]:
            tmp1 = 1
            m1 = T[i]
        else:
            tmp1 = T[i]
            m1 = 1
        if A[i] > A[i+1]:
            tmp2 = 1
            m2 = A[i]
        else:
            tmp2 = A[i]
            m2 = 1

        if m1 <= m2 < m1 + tmp1 or m2 <= m1 < m2 + tmp2:
            tmp = min(tmp1,tmp2)
        else:
            tmp = 0
        ans = (ans * tmp) % MOD
    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 82976
#define _USE_MATH_DEFINES

#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <iterator>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <bitset>

#include <queue>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <ctime>
////
//#include <random>//
/////////

typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;

////定数
const int INF = (int)1e9 + 10;
const LL MOD = (LL)1e9 + 7;
const LL LINF = (LL)4e18 + 20;
const LD PI = acos(-1.0);
const double EPS = 1e-9; 
/////////
using namespace::std;
template<typename T>
void chmax(T& a, T b) {
	a = max(a, b);
}

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

template<typename T>
void IN(vector<T> &A,int N=-1) {
	if (N == -1) {
		N = A.size();
	}
	for (int i = 0; i < N; ++i) {
		cin >> A[i];
	}
}

template<typename T>
void SO(vector<T> &A,bool F=false) {
	sort(A.begin(), A.end());
	if (F) {
		reverse(A.begin(), A.end());
	}
}
//////////////


void solve() {
	LL X;
	cin >> X;
	LL now = 100;
	int ans = 0;
	while (now < X) {
		ans++;
		now = now + now / 100;
	}
	cout << ans << endl;
}

signed main(void) {
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	

	solve();
}

Measured memory_bytes: 3648
import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.regex : regex;
import std.container;
import std.bigint;


void main()
{
  auto n = readln.chomp.to!int;
  auto a = readln.chomp.split.to!(int[]);
  int cnt = 1;
  int res;
  foreach (e; a) {
    if (cnt == e) {
      cnt++;
    } else {
      res++;
    }
  }
  if (res == n) {
    writeln(-1);
  } else {
    res.writeln;
  }
}


Measured memory_bytes: 11408
import sys
#import string
#from collections import defaultdict, deque, Counter
#import bisect
#import heapq
#import math
#from itertools import accumulate
#from itertools import permutations as perm
#from itertools import combinations as comb
#from itertools import combinations_with_replacement as combr
#from fractions import gcd
#import numpy as np

stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)
MIN = -10 ** 9
MOD = 10 ** 9 + 7
INF = float("inf")
IINF = 10 ** 18

def solve():
    #n = int(stdin.readline().rstrip())
    h,n = map(int, stdin.readline().rstrip().split())
    A = list(map(int, stdin.readline().rstrip().split()))
    #numbers = [[int(c) for c in l.strip().split()] for l in sys.stdin]
    #word = [stdin.readline().rstrip() for _ in range(n)]
    #number = [[int(c) for c in stdin.readline().rstrip()] for _ in range(n)]
    #zeros = [[0] * w for i in range(h)]
    s = sum(A)
    if h <= s:
        print("Yes")
    else:
        print("No")

if __name__ == '__main__':
    solve()


Measured memory_bytes: 20552
n = int(input())
a = [int(input()) for i in range(n)]

a.sort()
cnt = 1
ans = 0
for i in range(1,n):
    if a[i] == a[i-1]:
        cnt += 1
    else:
        if cnt%2 != 0:
            ans += 1
        cnt = 1
else:
    if cnt%2 != 0:
        ans += 1

print(ans)


Measured memory_bytes: 7448
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define enld '\n'
#define rep(i,n) for(int i=0; i<(n); i++)
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("Ofast")
constexpr ll INF = 1e18;
constexpr int inf = 1e9;
constexpr ll mod = 1000000007;
constexpr ll mod2 = 998244353;
const double PI = 3.1415926535897932384626433832795028841971;
const int dx[6] = {1, 0, -1, 0,1,1};
const int dy[6] = {0, 1, 0, -1,1,-1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
// ---------------------------------------------------------------------------


int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N,M;
    cin >> N >> M;
    vector<ll> A(N);
    for(int i=0; i<N; i++){
        cin >> A[i];
    }
    vector<vector<double>> dp(N+1, vector<double> (M+2,0));
    double s = 0;
    for(int i=0; i<N; i++){
        s += A[i];
        dp[i+1][1] = s/(i+1);
    }
    for(int i=1; i<N; i++){
        for(int j=1; j<M; j++){
            if(dp[i][j] == 0) break;
            double sum = 0;
            for(int k=i+1; k<=N; k++){
                sum += A[k-1];
                chmax(dp[k][j+1],dp[i][j]+sum/(k-i));
            }
        }
    }
    // for(int i=0; i<=N; i++){
    //     for(int j=0; j<=M; j++){
    //         cout << dp[i][j] << " \n"[j==M];
    //     }
    // }
    cout << fixed << setprecision(10) << dp[N][M] << "\n";
    return 0;
}


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

int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  for (int i = 0; i < N; ++i)
    cin >> A[i];
  double ans = 0;
  for (int i = 0; i < N; ++i)
    ans += 1.0 / A[i];
  ans = 1 / ans;
  cout << fixed << ans << endl;
}

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

int bubsort(int A[],int N)
{
  int x=0;
  bool flag=1;
  for(int i=0;flag;i++)
    {
      flag=0;
      for(int j=N-1;j>=i+1;j--)
	{
	  if(A[j]<A[j-1])
	    {
	      swap(A[j],A[j-1]);
	      flag=1;
	      x++;
	    }
	}
    }
  return x;
}

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

  x=bubsort(A,N);

  for(int i=0;i<N;i++)
    {
      if(i) cout << " ";
      cout << A[i];
    }
  cout << endl;
  cout << x << endl;

  return 0;
}



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

int main() {
  int m, n, max = 0;

  cin >> m;
  vector<string> s(m);
  for(int i = 0; i < m; i++){
    cin >> s.at(i);
  }
  cin >> n;
  vector<string> t(n);
  for(int i = 0; i < n; i++){
    cin >> t.at(i);
  }

  for(int i = 0; i < m; i++){
    int sum = 1;
    for(int j = i+1; j < m; j++){
      if(s.at(i) == s.at(j)) sum++;
    }
    for(int j = 0; j < n; j++){
      if(s.at(i) == t.at(j)) sum--;
    }
    if(sum > max) max = sum;
  }
  cout << max << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
#define pb push_back
#define rep0(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(ll i=1;i<=n;i++)

using namespace std;

int main(){

	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	/*#ifndef ONLINE_JUDGE
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif*/

	int n,k;
	cin >> n >> k;
	string s;
	cin >> s;
	s[k-1] = s[k-1] - 'A' + 'a';
	cout << s;

	//cerr << "Time : " << (double)clock() / (double)CLOCKS_PER_SEC << "s\n";

	return 0; 
}

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

#define all(x) begin(x), end(x)

using i64 = int_fast64_t;
using f64 = double;
using p64 = pair<i64, i64>;

constexpr i64 INF = INT_FAST64_MAX / 2;
constexpr f64 EPS = DBL_EPSILON;

void solve() {
    string n;
    cin >> n;

    switch (n.back()) {
    case '2':
    case '4':
    case '5':
    case '7':
    case '9':
        cout << "hon" << endl;
        return;
    case '0':
    case '1':
    case '6':
    case '8':
        cout << "pon" << endl;
        return;
    case '3':
        cout << "bon" << endl;
        return;
    }
}

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


Measured memory_bytes: 3616
#pragma GCC optimize ("Ofast")
#include <bits/stdc++.h>
using namespace std;

#define _GLIBCXX_DEBUG

using _loop_ll = long long;
#define REP(i,n) for(_loop_ll (i)=0; (i)<(_loop_ll)(n); (i)++)
#define FOR(i,a,b) for(_loop_ll (i)=(_loop_ll)(a); (i)<(_loop_ll)(b); (i)++)
#define FORR(i,a,b) for(_loop_ll (i)=(_loop_ll)(b)-1; (i)>=(_loop_ll)(a); (i)--)
 
#define ALL(v) (v).begin(),(v).end()
 
#define DEBUG(x) cerr<<#x<<": "<<(x)<<endl
#define DEBUG_VEC(v) cerr<<#v<<": ";REP(__i,(v).size())cerr<<((v)[__i])<<", ";cerr<<endl

using ll = long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vvl = vector<vl>;

constexpr long long int MOD = 1000000007;

int main()
{
    ll N, A, B;
    cin >> N >> A >> B;

    if((A - B) % 2 == 0){
        cout << abs(A - B) / 2 << endl;
    }else{
        ll ma = max(A, B);
        ll mi = min(A, B);
        if(mi - 1 < N - ma){
            cout << (ma + mi - 1) / 2 << endl;
        }else{
            cout << (2 * N - ma - mi + 1) / 2 << endl;
        }
    }

    return 0;
};


Measured memory_bytes: 256
using System;
using System.Linq;
using System.Numerics;

public class Program
{
    static void Main()
    {
        int n = int.Parse(Console.ReadLine());
        long[] a = Array.ConvertAll(Console.ReadLine().Split(' '), long.Parse);
        BigInteger ans = 1;
        long m = (long)Math.Pow(10, 18);
        if (a.Contains(0))
            Console.WriteLine(0);
        else
        {
            for (int i = 0; i < n; i++)
            {
                ans *= a[i];
                if (ans > m)
                {
                    Console.WriteLine(-1);
                    return;
                }
            }
            Console.WriteLine(ans);
        }
    }
}

Measured memory_bytes: 41844
#include <iostream>
#include <sstream>
#include <vector>
#include <list>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
using namespace std;

int convert( int C[8] ) {
    int answer = 0;
    for ( int i = 0; i < 8; i++ ) {
        answer += C[i] * pow( 10, 8-i-1 );
    }
    return answer;
}

void rotate( int C[8] ) {
    int front = C[0];
    for ( int i = 1; i < 8; i++ ) {
        C[i-1] = C[i];
    }
    C[7] = front;
}

int main() {
    int P[8];
    while ( cin >> P[0] ) {
        for ( int i = 1; i < 8; i++ ) {
            cin >> P[i];
        }
        int C[8] = { 1, 2, 1, 2, 1, 4, 1, 4 };
        int answer[8];
        bool first = true;
        int minc;
        int mind;
        for ( int i = 0; i < 8; i++ ) {
            int c = 0;
            for ( int i = 0; i < 8; i++ ) {
                if ( P[i] - C[i] > 0 ) {
                    c += P[i] - C[i];
                }
            }
            if ( first || c < minc ) {
                first = false;
                minc = c;
                mind = convert( C );
                for ( int i = 0; i < 8; i++ ) {
                    answer[i] = C[i];
                }
            } else if ( c == minc ) {
                int d = convert( C );
                if ( d < mind ) {
                    first = false;
                    minc = c;
                    mind = d;
                    for ( int i = 0; i < 8; i++ ) {
                        answer[i] = C[i];
                    }
                }
            }
            rotate( C );
        }
        for ( int i = 0; i < 8; i++ ) {
            cout << answer[i];
            if ( i + 1 < 8 ) cout << " ";
        }
        cout << endl;
    }
    return 0;
}

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

int main() {
  int n;
  cin >> n;
  int a[n];
  int i;
  for (i = 0; i < n; i++) {
    cin >> a[i];
  }
  int res = 0;
  for (i = 0; i < n - 1; i++) {
    if (a[i] == a[i + 1]) {
      res++;
      a[i + 1] = 100000;
    }
  }
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 256