akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = (int)(n - 1); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) int(x.size())
#define get_unique(x) x.erase(unique(all(x)), x.end());
typedef long long ll;
typedef complex<double> Complex;
const int INF = 1e9;
const ll MOD = 1e9 + 7;
const ll LINF = 1e18;
template <class T>
bool chmax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T& a, const T& b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
struct mint {
    ll x;
    mint(ll x = 0) : x((x % MOD + MOD) % MOD) {
    }
    ll value() const {
        return x;
    }
    mint operator-() const {
        return mint(-x);
    }
    mint& operator+=(const mint a) {
        if ((x += a.x) >= MOD) x -= MOD;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += MOD - a.x) >= MOD) x -= MOD;
        return *this;
    }
    mint& operator*=(const mint a) {
        (x *= a.x) %= MOD;
        return *this;
    }
    mint operator+(const mint a) const {
        mint res(*this);
        return res += a;
    }
    mint operator-(const mint a) const {
        mint res(*this);
        return res -= a;
    }
    mint operator*(const mint a) const {
        mint res(*this);
        return res *= a;
    }
    mint pow(ll t) const {
        if (t == 0) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t % 2 == 1) a *= *this;
        return a;
    }
    mint inv() const {
        return pow(MOD - 2);
    }
    mint& operator/=(const mint a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint a) const {
        mint res(*this);
        return res /= a;
    }
};
struct combination {
    vector<mint> fact, ifact;
    combination(int n) : fact(n + 1), ifact(n + 1) {
        assert(n < MOD);
        fact[0] = 1;
        for (int i = 1; i <= n; i++) {
            fact[i] = fact[i - 1] * i;
        }
        ifact[n] = fact[n].inv();
        for (int i = n; i >= 1; i--) {
            ifact[i - 1] = ifact[i] * i;
        }
    }
    mint operator()(int n, int k) {
        if (k < 0 || k > n) return 0;
        return fact[n] * ifact[k] * ifact[n - k];
    }
    mint h(int n, int k) {
        n += k - 1;
        if (k < 0 || k > n) return 0;
        return fact[n] * ifact[k] * ifact[n - k];
    }
} comb(2002002);
int main() {
    int n, k;
    cin >> n >> k;
    for (int i = 0; i < k; i++) {
        mint ans = 1;
        ans *= comb.h(k - i, i);
        ans *= comb.h(n - k - i + 1, i + 1);
        cout << ans.value() << endl;
    }
}


Measured memory_bytes: 31488
/*
 ▓█████▄  ▄████▄  ▓██   ██▓ ██▓███   ██░ ██ ▓█████  ██▀███
▒██▀ ██▌▒██▀ ▀█   ▒██  ██▒▓██░  ██▒▓██░ ██▒▓█   ▀ ▓██ ▒ ██▒
 ░██   █▌▒▓█    ▄   ▒██ ██░▓██░ ██▓▒▒██▀▀██░▒███   ▓██ ░▄█ ▒
 ░▓█▄   ▌▒▓▓▄ ▄██▒  ░ ▐██▓░▒██▄█▓▒ ▒░▓█ ░██ ▒▓█  ▄ ▒██▀▀█▄
 ░▒████▓ ▒ ▓███▀ ░  ░ ██▒▓░▒██▒ ░  ░░▓█▒░██▓░▒████▒░██▓ ▒██▒
  ▒▒▓  ▒ ░ ░▒ ▒  ░   ██▒▒▒ ▒▓▒░ ░  ░ ▒ ░░▒░▒░░ ▒░ ░░ ▒▓ ░▒▓░
  ░ ▒  ▒   ░  ▒    ▓██ ░▒░ ░▒ ░      ▒ ░▒░ ░ ░ ░  ░  ░▒ ░ ▒░
  ░ ░  ░ ░         ▒ ▒ ░░  ░░        ░  ░░ ░   ░     ░░   ░
    ░    ░ ░       ░ ░               ░  ░  ░   ░  ░   ░
  ░      ░         ░ ░
*/
#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 fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define rep(i,a,b) for(ll i=a; i<b; i++)
#define per(i,a,b) for(ll i=a; i>=b; i--)
#define ll long long int
#define ld long double
#define vi vector<ll>
#define vii vector <pair<ll,ll> >
#define sedes set <ll, greater <ll> >
#define seasc set <ll>
#define pb push_back
#define mkp make_pair
#define ff first
#define ss second
#define MOD 1000000007
#define prec(n) fixed<<setprecision(n)
#define maxpq priority_queue<int>
#define minpq priority_queue<int, vector<int>, greater<int> >
#define umap unordered_map<ll, ll>
#define map map<ll, ll>
#define autoit(x,it) for(auto it = x.begin(); it != x.end(); it++)
#define mems(a, i) memset(a, i, sizeof(a))
#define endl '\n'
#define all(v) v.begin(),v.end()
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) ((a)*(b))/gcd((a),(b))
#define printx(x) printf("%lld\n",x);
#define printxy(x,y) cout << x << y <<endl;
#define printxyz(x,y,z) cout << x << y << z <<endl;
#define debuga(a) cout << "debug " << a << endl;
#define debugab(a,b) cout << "debug1 " << a <<" debug2 " << b << endl;
int main()
{
  fast;
#ifndef ONLINE_JUDGE
  freopen("/home/kushagra/Desktop/Kushagra/input.txt", "r", stdin);
  freopen("/home/kushagra/Desktop/Kushagra/output.txt", "w", stdout);
#endif
  ll a;
  ld b;
  cin >> a >> b;
  ld res = a * b;
  ll ans = floor(res);
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3748
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <functional>
#include <algorithm>
#include <string>
#include <vector>
#include <limits>
#include <numeric>
#include <queue>
#include <cmath>
#include <set>
#include <map>
#include <stack>

using namespace std;

#define INFint (1<<30)
#define BOUND 27182818284
#define MAT 2

typedef long long ll;
typedef long long int lli;
typedef pair<ll, ll> P;

ll MOD = 1000000007;
const ll INF = (1ll<<60);
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i, a, b) for(int i=int(a);i<int(b);++i)

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

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

// gcd
template<typename T>
T gcd(T a, T b) {
    if (a == 0)
        return b;
    return gcd(b % a, a);
}

int findGCD(vector<int> arr) {
    int result = arr[0];
    for (auto a: arr) {
        result = gcd(a, result);
    }
    return result;
}

template<typename T>
T lcm(T m, T n) {
    // 引数に0がある場合は0を返す
    if ((0 == m) || (0 == n))
        return 0;
    return ((m / gcd(m, n)) * n); // lcm = m * n / gcd(m,n)
}

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
    fill((T *) array, (T *) (array + N), val);
}


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

// v.front() = -BOUND;
// v.back() = BOUND;

//struct edge{
//    int cost, to;
//
//    edge(int in_cost, int in_to){
//        cost=in_cost;
//        to=in_to;
//    }
//    bool operator<(const edge &a) const
//    {
//        return cost > a.cost;
//    }
//};



int main() {
    int N, K; cin >> N >> K;
    string S; cin >> S;
    S.push_back('z');
    vector<ll> stand, rev;

    if(S[0]=='0'){
        rev.push_back(0);
    }

    int num=0;
    for(char i : S){
        if(i=='1'){
            num++;
        }else if(num!=0){
            rev.push_back(num);
            num=0;
        }
    }
    num = 0;
    for(char i : S){
        if(i=='0'){
            num++;
        }else if(num!=0){
            stand.push_back(num);
            num=0;
        }
    }

    while(stand.size()<S.size() + K+1){
        stand.push_back(0);
    }

    while(rev.size()<S.size() + K +1){
        rev.push_back(0);
    }

    ll rev_sum = 0;
    for(int i=0; i<K+1; i++){
        rev_sum+=rev[i];
    }

    ll stand_sum=0;
    for(int i=0; i<K; i++){
        stand_sum+=stand[i];
    }
    ll ans =stand_sum + rev_sum;
    for(int i=0; i<S.size(); i++){
        rev_sum+=(rev[K+1+i]-rev[i]);
        stand_sum+=(stand[K+i]-stand[i]);
        ans = max(ans, rev_sum+stand_sum);
    }

    cout << ans << endl;

    return 0;
}


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

static const long double pi = 3.141592653589793238462643383279;

typedef long double ldouble;

int main(void){
  int A, B, H, M;
  cin >> A >> B >> H >> M;
  ldouble min = (ldouble)pi*M/30;
  ldouble hour = (ldouble)pi*H/6 + (ldouble)M*pi/360;
  ldouble angle;
  ldouble t = abs(min-hour);
  if(t<pi) angle = t;
  else angle =2*pi-t;
  ldouble x =(ldouble) A*A +B*B-2*A*B*cosl(angle);
  cout << setprecision(15) << pow(x, 0.5) <<endl;
}

Measured memory_bytes: 4156
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define uli unsigned long long int
#define INF 99999999999
#define rep(i,m,n) for(lli i = m;i < n;i++)
#define rrep(i,m,n) for(lli i=m;i>n;i--)
#define pb(n) push_back(n)
#define UE(N) N.erase(unique(N.begin(),N.end()),N.end());
#define Sort(n) sort(n.begin(), n.end())
#define Rev(n) reverse(n.begin(),n.end())
#define Out(S) cout << S << endl
#define NeOut(S) cout << S
#define HpOut(S) cout << setprecision(20) << S << endl
#define Vecpr(K,L1,L2,N) vector<pair<L1,L2>> K(N)
#define Vec(K,L,N,S) vector<L> K(N,S)
#define DV(K,L,N,M,R) vector<vector<L>> K(N, vector<L>(M,R))
#define mod 1000000007
#define MAX 5100000
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
lli gcd(lli num1, lli num2){
    return num2 != 0 ? gcd(num2, num1 % num2) : num1;
}
int main(){
  lli A,B,C=0,D=0,E=0,F=INF,G=INF,H=0,N,M,K,sum=0;
  cin >> N;
  Vec(P,lli,N,0);rep(i,0,N)cin >> P[i];
  rep(i,1,N)P[i]=gcd(P[i-1],P[i]);
  Out(P[N-1]);
}

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

using namespace std;

typedef long long ll;
typedef long double ld;

const int mod = 1e9 + 7;
int n;

int add(int a, int b)
{
    return ((a % mod) + (b % mod)) % mod;
}

int mul(int a, int b)
{
    return ((ll)a * b) % mod;
}

vector<vector<int>> mult(vector<vector<int>> vec1, vector<vector<int>> vec2)
{
    vector<vector<int>> ret(n);
    for(int i = 0; i < n; i++)
    {
        ret[i].resize(n);
        for(int j = 0; j < n; j++)
        {
            for(int z = 0; z < n; z++){
                ret[i][j] = add(ret[i][j], mul(vec1[i][z], vec2[z][j]));
            }
        }
    }
    return ret;
}

vector<vector<int>> fastpow(vector<vector<int>> mat, ll power)
{
    if(!power)
    {
        vector<vector<int>> ret(n);
        for(int i = 0; i < n; i++)
        {
            ret[i].resize(n);
            ret[i][i] = 1;
        }
        return ret;
    }
    vector<vector<int>> ret = fastpow(mat, power / 2);
    ret = mult(ret, ret);
    if(power & 1)
        ret = mult(ret, mat);
    return ret;
}

int main()
{
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    ll k;
    cin >> n >> k;
    vector<vector<int>> mat(n);
    for(auto &x: mat){
        x.resize(n);
        for(auto &y: x)
            cin >> y;
    }
    vector<vector<int>> v = fastpow(mat, k);
    int ans = 0;
    for(int i = 0; i < n; i++)
        for(int j = 0; j < n; j++)
            ans = add(ans, v[i][j]);
    cout << ans;
}


Measured memory_bytes: 1024
//#include <bits/stdc++.h>
#include <cstdio>
#include <iostream>
#include <algorithm>
#define repe(i, a, b) for (int i = (a); i <= (b); i++)
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define mst(a, b)   memset((a), (b), sizeof(a))
#define gc() gutchar()
#define fi first
#define se second
using namespace std;
typedef pair<int, int> pr;
typedef long long ll;
const double eps = 1e-5;
const int inf = 0x3f3f3f3f;
const int dx[] = {-1, 0, 0, 1};
const int dy[] = {0, -1, 1, 0};
const ll mod = 1e9+7;
const int N = 2e5+5;

string s1, s2;

int main()
{
	int a, b;
	cin >> a >> b;
	rep(i, 0, a){
		s1 += b + '0';
	}
	rep(i, 0, b){
		s2 += a + '0';
	}
	if (s1 < s2)	cout << s1;
	else	cout << s2;
	return 0;
}

Measured memory_bytes: 256
N = int(input())
A = input()
B = input()
C = input()
ans = 0
for i in range(N):
  if A[i] == B[i] and B[i] == C[i]: pass
  elif A[i] != B[i] and B[i] != C[i] and A[i] != C[i]: ans += 2
  else: ans += 1
print(ans)    

Measured memory_bytes: 38256
#include <stdio.h>
#include <ctype.h>
 
int main(){
    int c;
     
    while((c = getchar()) != EOF){
        if(isupper(c)){
            putchar(tolower(c));
        }
         
        else if(islower(c)){
            putchar(toupper(c));
        }
         
        else {
            putchar(c);
        }
    }
     
    return 0;
}


Measured memory_bytes: 2044
#include<cstdio>
#include<cstring>
using namespace std;
const int maxn = 3e5 + 5, mod = 1e9 + 7;
int trans[][2] = {
	{2, 1}, {4, 3}, {6, 5}, {3, 3}, {7, 1}, {2, 1}, {2, 2}, {4, 4}
};
int dp[maxn][10], n;
char rs[maxn], *s;
 
int main() {
	scanf("%s", rs), n = strlen(rs), s = rs - 1, dp[0][0] = 1;
	for(register int i = 0; i < n; ++i) {
		for(register int j = 0; j < 8; ++j) {
			if(s[i + 1] != '0') 
				(dp[i + 1][trans[j][1]] += dp[i][j]) %= mod;
			if(s[i + 1] != '1') 
				(dp[i + 1][trans[j][0]] += dp[i][j]) %= mod;
		}
	}
	printf("%d", (dp[n][1] + dp[n][3]) % mod);
	return 0;
}

Measured memory_bytes: 12160
#include <bits/stdc++.h>
//#pragma GCC optimize(2)

using namespace std;

#define LL long long
#define Re register
#define U unsigned
#define forn(i,a,b) for(int i = a;i <= b;++i)
#define nfor(i,a,b) for(int i = a;i >= b;--i)
#define CLR(i,a) memset(i,a,sizeof(i))
#define BR printf("--------------------\n")
#define pb push_back
#define Rep(i,a,b) for(int i=a;i<=b;i++)
#define DEBUG(x) std::cerr << #x << '=' << x << std::endl
const double PI=atan(1.)*4.;
const int maxn=1e6+5;
const int inf = 0x3f3f3f3f;
const int mod=1e9+7;
const double e=2.71828182845904523536;
int dir[4][2]={1,0,0,1,-1,0,0,-1};

int main()
{
	ios::sync_with_stdio(false);
    cin.tie(0);
   	cout.tie(0);
    int n,cnt=0;
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        int tmp;
        cin>>tmp;
        if(tmp!=i)
        {
            cnt++;
        }
    }
    if(cnt==2||cnt==0)
        cout<<"YES";
    else
        cout<<"NO";
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
const long long LINF = 1e18;
#define dump(x)  cout << 'x' << ' = ' << (x) << ` `;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
typedef long long ll;
using namespace std;
typedef pair<ll, ll> P;

int main(int argc, char const *argv[]) {
	string s; cin>>s;
	bool ok = true;
	int n = s.length();
	rep(i,n) {
		if (i%2==0) {
			if (s[i]=='L') ok = false;
		}
		else {
			if (s[i]=='R') ok = false;
		}
	}
	if (ok) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<vector>
#include<map>
#include<stack>
#include<queue>
#include<string>
#include<utility>
#include<numeric>
#include<algorithm>
#include<cmath>
#include<climits>
using namespace std;

using ll = long long;

class Stream{
public:
    Stream(){

    }
    //配列以外の入力を受け取る
    void read(){

    }
    template<typename First, typename... Rest>
    void read(First& first, Rest&... rest){
        cin >> first;
        read(rest...);
    }
    //配列を区切って出力する
    template<typename T>
    void write_vec(vector<T>& v, char divider){
        for(size_t i = 0; i < v.size(); i++){
            cout << v[i] << divider;
        }
    }
};

struct UF{
    const int node_num;
    vector<int> parent;
    vector<int> size;

    UF(int N) : node_num(N), parent(N), size(N, 1) {
        for(int i = 0; i < N; ++i) parent[i] = i;
    }

    //xの根を得る
    int root(int x){
        if(parent[x] == x) return x;
        return parent[x] = root(parent[x]);
    }

    //xが属する木とyが属する木を一つに合わせる
    void unite(int x, int y){
        int root_x = root(x);
        int root_y = root(y);
        if(root_x == root_y) return;
        parent[root_y] = root_x;
        size[root_x] += size[root_y];
    }

    //xとyが属する木が同じならtrueを返す
    bool same(int x, int y){
        int root_x = root(x);
        int root_y = root(y);
        return root_x == root_y;
    }

    //xと同じ木に属する要素の数を返す
    int same_size(int x){
        int root_x = root(x);
        return size[root_x];
    }
};

int main(){
    Stream io;
    
    int A, B, C;
    io.read(A, B, C);
    string ans = "No";
    if(A <= C && C <= B){
        ans = "Yes";
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 256
import sys
readline = sys.stdin.buffer.readline
MOD = 10**9+7

def main():
    S = set(input())
    A = set('abcdefghijklmnopqrstuvwxyz')
    diff = A - S
    ans = list(diff)
    print(min(ans) if ans else 'None')


if __name__ == '__main__':
    main()

Measured memory_bytes: 3188
#include<stdio.h>
int main()
{
   int a,b,c,d,ab,bc,ac;
   scanf("%d %d %d %d",&a,&b,&c,&d);
   ab=a-b;
   bc=b-c;
   ac=a-c;
   if(ab<0){ab=ab*(-1);}
    if(bc<0){bc=bc*(-1);}
     if(ac<0){ac=ac*(-1);}
   if(ac<=d)
       {printf("Yes\n");}
   else if(ab<=d && bc<=d)
       {printf("Yes\n");}
   else{printf("No\n");}
   return 0;
   }


Measured memory_bytes: 1624
#include<stdio.h>

int main(){
    int one = -1;
    int two = -1;
    int three = -1;
    for(int i =1; i <= 10; i++){
       int h;
       scanf("%d", &h);
       if(h >= one){
           three = two;
           two = one;
           one = h;
       }else if(h >= two){
           three = two;
           two = h;
       }else if(h >= three){
           three = h;
       }
   }
   printf("%d\n%d\n%d\n", one, two, three);
    return 0;
}



Measured memory_bytes: 2108
#include <bits/stdc++.h>
#define IOS {ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);}
#define endl "\n"
#define int long long int
#define f(i, a, b) for(int i=a; i<b; i++)
#define fb(i, a, b) for(int i=a; i>=b; i--)
#define pb push_back
#define fi first
#define se second
#define vi vector <int>
#define pi pair <int, int>
#define LB lower_bound
#define UB upper_bound
#define fp(x, y) fixed<<setprecision(y)<<x
#define PI 3.141592653589793238462643383279502884
using namespace std;

const int M = (int)2e5+5;
const int mod = (int)1e9+7;

void solve()
{
    int n;
    cin>>n;
    int a, ans = 0;
    f(i, 0, n) cin>>a, ans += (i%2 == 0 && a%2 == 1);
    cout<<ans<<endl;
}

int32_t main()
{
    IOS
    int t = 1;
    // cin>>t;
    f(tno, 1, t+1)
    {
        solve();
    }
    return 0;
}

Measured memory_bytes: 3596
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>
#include <set>

using namespace std;

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

int main() {
	long long a, b;
	cin >> a >> b;

	long long g = gcd(a, b);

	set<int> factors = {1};

	long long factor = 2;
	while (g > 1) {

		while (g % factor == 0) {
			factors.insert(factor);
			g /= factor;
		}

		if (factor * factor > g) {
			factors.insert(g);
			break;
		}

		factor++;
	}

	cout << factors.size() << endl;
	return 0;
}


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

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

    int count = 0;
    for (int i = 0; i < N; i++) {
        if (i + 2 < N) {
            if (S.at(i) == 'A' && S.at(i + 1) == 'B' && S.at(i + 2) == 'C') {
                count++;
            }
        }
    }

    cout << count << endl;
}


Measured memory_bytes: 256
import collections

N = int(input())
D = list(map(int, input().split()))
M = int(input())
T = list(map(int, input().split()))

d = collections.Counter(D)
t = collections.Counter(T)

ans = 'YES'
t_v = list(t.values())
t_k = list(t.keys())
for i in range(len(t)):
    if t_v[i] > d[t_k[i]]:
        ans = 'NO'

print(ans)

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

#define ll long long
#define fornum(A,B,C) for(A=B;A<C;A++)

using namespace std;

/////////////////////////////////////////////////////
#define pll pair<ll,ll>


ll L,N,X[202020];
ll rSum[202020], lSum[202020];
ll i,ans;
int main(){
    scanf("%lld%lld",&L,&N);
    fornum (i,1,N+1){
        scanf("%lld", &X[i]);
    }
    fornum (i,1,N+1){
        rSum[i] = rSum[i - 1] + X[i];
        lSum[N-i+1] = lSum[N-i+2] + (L-X[N-i+1]);
    }
    /*
    fornum(i,0,N+1){
        printf("%lld:%lld,%lld\n", i, rSum[i], lSum[i]);
    }
    printf("dd\n");
    */
    /*
    fornum(i,0,N+1){
        printf("%lld:%lld,%lld\n", i, rSum[i], lSum[i]);
    }*/
    
    fornum(i,1,N+1){
        ll s = (rSum[(N-i)/2+i] - rSum[i-1]+ lSum[(N-i)/2+i+1])*2;
        if((N-i)%2){
            s -= L-X[(N-i)/2+i+1];
        }else{
            s -= X[(N-i)/2+i];
        }
        ans = ans < s ? s : ans;
    }
    fornum(i,1,N+1){
        ll s = (lSum[i-(i-1)/2] - lSum[i+1]+ rSum[i-(i-1)/2-1])*2;
        if(i%2){
            s -= L-X[i-(i-1)/2];
        }else{
            s -= X[i-(i-1)/2-1];
        }
        ans = ans < s ? s : ans;
    }

    printf("%lld", ans);
    return 0;
}

Measured memory_bytes: 4992
N=int(input())
S=[input() for i in range(N)]
S.sort()
def list_count(my_list):
    dic={} #辞書型の宣言
    for num in my_list:
        if num in dic: #もしnumがkeyとして辞書にあれば
            dic[num]+=1 #valueに+1
        else: #なければ
            dic[num]=1 #dicにnumというkeyを追加し、対応するvalueを1とする
    return dic
K=[]
A=list_count(S)
ookii=max(A.values())
K.append(ookii)
max_k_list = [kv[0] for kv in A.items() if kv[1] == K[0]]
max_k_list.sort()
for j in range(len(max_k_list)):
    print(max_k_list[j])

Measured memory_bytes: 99792
#include<stdio.h>
long gdc(long a, long b)
{
    long temp;
    for(;b>0;)
    {
        temp=b;
        b=a%b;
        a=temp;
    }
    return a;

}
int main()
{
    long a,b,gcom,i,j,k,c=1,l=0,m=0,n=0;
    scanf("%ld%ld",&a,&b);
    gcom=gdc(a,b);
    for(i=2;gcom>1 && gcom>= i*i;)
    {
        for(j=0;gcom%i==0;j++)
            gcom/=i;
            if(j>0)
                c++;
            if(i==2)
                i++;
            else i=i+2;
    }
    if(gcom>=i)
        c++;
    printf("%ld\n",c);
    return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define nn 2024024
#define int long long 
#define mod 1000000007ll
int qpow(int x,int y){
	int res=1;
	while(y){
		if(y&1) res=res*x%mod;
		x=x*x%mod;y=y/2;
	}
	return res;
}
int f[nn],rf[nn];
int C(int n,int m){
	if(n<m) return 0;
	return f[n]*rf[m]%mod*rf[n-m]%mod;
}
int n,m,ls,rs;
int dfs(int l,int r,int s){
	if(r*m>s) return 0;
	s-=r*m;int ans=0;l++;
	for(int i=0;i<=n-m and i*l<=s;i++){
		int o=C(n-m,i)*C(s-i*l+n,n)%mod;
		if(i&1) ans-=o;else ans+=o;
		ans%=mod;
	}
	return ans;
}
int calc(int s){
	int ans=0;//return 0;
	for(int x=1;x<=s;x++)
		ans=(ans+dfs(x-1,x,s)-dfs(x-1,x+1,s))%mod;
	return ans;
}
signed main()
{
	f[0]=1;for(int i=1;i<nn;i++) f[i]=f[i-1]*i%mod;
	rf[nn-1]=qpow(f[nn-1],mod-2);
	for(int i=nn-2;i>=0;i--) rf[i]=rf[i+1]*(i+1)%mod;
	cin>>n>>m>>ls>>rs;
	cout<<(C(rs+n,n)-C(ls-1+n,n)-C(n,m)*(calc(rs)-calc(ls-1))%mod+mod*10ll)%mod;
	return 0;
}

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

using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int, int> pii;

#define pb push_back
#define ff first
#define ss second
#define SIZE 200001
#define INF int(2e9 + 9)
#define BIG_INF ll(4e18 + 9)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define _sz(v) int((v).size())
#define sqr(x) (x) * (x)
#define cube(x) (x) * (x) * (x)

//#pragma GCC optimize("Ofast")

ll binpow(ll a, ll b, ll mod = BIG_INF)
{
    ll res = 1;
    while(b)
    {
        if(b & 1)
            res *= a;
        a *= a;
        b >>= 1;
        a %= mod;
        res %= mod;
    }
    res %= mod;
    return res;
}




int T = 1, n, k;
string s;

vector<int> a;


void solve()
{
    cin >> n >> k;
    if(k & 1)
    {
        cout << "No";
        return;
    }

    int mx = k / 2;

    int mn = k / 4;
    if(k % 4 != 0) mn++;

    if(n >= mn && n <= mx)
    {
        cout << "Yes";
        return;
    }
    cout << "No";
    return;
}

int main()
{

    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);

//    cin >> T;

    while(T--)
    {
        solve();
    }




    return 0;
}


Measured memory_bytes: 3604
#include<vector>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
#include<stack>
#include<bitset>
#include<functional>
#include<ctime>
#include<queue>
#include<deque>
#include<complex>
#include<cassert>
using namespace std;
#define pb push_back
#define pf push_front
typedef long long lint;
typedef complex<double> P;
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
//問題文および制約はちゃんと確認しよう！
//サイズは10^5じゃなくて2×10^5とかかもしれないし、重要な制約・条件を見落としているかも
//とりあえずサンプルを読んでから解法を考えよう？
int main()
{
	int a,b;cin>>a>>b;cout<<a+b/2<<endl;
}


Measured memory_bytes: 888
import math

def tax_increase(a, b):
    a_list = []
    b_list = []
    if (a+1.0)/0.08+1 == int((a+1.0)/0.08)+1:
        for i in range(math.ceil((a)/0.08), int((a+1.0)/0.08)):
            a_list.append(i)
    else:
        for i in range(math.ceil((a)/0.08), int((a+1.0)/0.08)+1):
            a_list.append(i)
    if (b+1.0)/0.1+1 == int((b+1.0)/0.1)+1:
        for i in range(math.ceil((b)/0.1), int((b+1.0)/0.1)):
            b_list.append(i)
    else:
        for i in range(math.ceil((b)/0.1), int((b+1.0)/0.1)+1):
            b_list.append(i)
    if a_list[0] == b_list[0]:
        return a_list[0]
    elif a_list[0] < b_list[0]:
        for a_i in a_list:
            if a_i in b_list:
                return a_i
    else:
        for b_i in b_list:
            if b_i in a_list:
                return b_i
    return -1

a, b = [int(i) for i in input().split()]

print(tax_increase(a, b))

Measured memory_bytes: 38384
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        int A = 0;
        int B = 0;
        int C = 0;

      Scanner in = new Scanner(System.in);

      String str = in.nextLine();

      char[] c = str.toCharArray();

      for(int cnt=0; cnt <str.length(); cnt++) {
          if(c[cnt] == 'a') {
              A++;
          }
          else if(c[cnt] == 'b') {
              B++;
          }
          else if(c[cnt] == 'c') {
              C++;
          }
      }

      in.close();

      if(A==1 && B==1 && C==1) {
          System.out.println("Yes");
      } else {
          System.out.println("No");
      }
    }

}


Measured memory_bytes: 23764
a,b,c=map(int,input().split())

if a<=b<=c:
    print(a,b,c)
elif a<=c<=b:
    print(a,c,b)
elif b<=a<=c:
    print(b,a,c)
elif b<=c<=a:
    print(b,c,a)
elif c<=a<=b:
    print(c,a,b)
else:
    print(c,b,a)


Measured memory_bytes: 5596
#include<stdio.h>

int main()
{
    int n,m,sum=0,cnt=0;

    scanf("%d%d",&n,&m);

    int arr[n];

    double lim=1.0/(4*m);

    for(int i=0;i<n;i++)
    {
        scanf("%d",&arr[i]);

        sum+=arr[i];
    }

    for(int i=0;i<n;i++)
    {
        if(((arr[i]*1.0)/sum)>=lim)
            cnt++;

        if(cnt==m)
        {
            printf("Yes");
            return 0;
        }
    }

    printf("No");
    return 0;
}


Measured memory_bytes: 128
n = gets.to_i
numbers = gets.chomp.split(" ").map(&:to_i)
count = 0
judge = true
begin
  numbers.each_with_index do |number, i|
    if number.even?
      numbers[i] = number / 2
    else
      judge = false
      break
    end
  end
  if judge == true
    count += 1
  else
    break
  end
end while true
puts count

Measured memory_bytes: 1788
def main():
    import sys
    input = sys.stdin.readline
    
    N,K = map(int,input().split())
    A = list(map(int,input().split()))
    from collections import defaultdict
    B = defaultdict(int)
    for i in A:
        B[i] += 1
    C = []
    for i in B:
        C.append(B[i])
    C = sorted(C)
    if len(C) <= K:
        ans = 0
    else:
        ans = 0
        for i in range(len(C)-K):
            ans += C[i]
    print(ans)
    
    
main()

Measured memory_bytes: 97224
use std::str::FromStr;

fn get_one<T : FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    return s.trim().parse().ok().unwrap();
}

fn get_vec<T : FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    return s.trim().split_whitespace().map(|e| e.parse().ok().unwrap()).collect();
}

fn get_vec_by_lines<T : FromStr>(n : usize) -> Vec<T> {
    let mut v : Vec<T> = Vec::new();
    for _i in 0..n {
        let x : T = get_one();
        v.push(x);
    }
    return v;
}

fn main() {
    let mut v : Vec<i64> = get_vec();
    let mut ans = 0;
    loop {
        let mut done = false;
        let mut cnt = 0;
        for i in 0..3 {
            if v[i] % 2 != 0 {
                done = true;
            }
            else if (v[i] / 2) % 2 != 0 {
                //println!("{} {}", i, v[i]);
                cnt += 1;
            }
        }
        if done {
            break;
        }
        if cnt == 3 {
            ans = -1;
            break;
        }
        if v[0] == v[1] && v[1] == v[2] {
            ans = -1;
            break;
        }
        let w = vec![v[0],v[1],v[2]];
        for i in 0.. 3 {
            v[i] = w[(i+1)%3] / 2 + w[(i+2)%3] / 2;
        }
        ans += 1;
    }
    println!("{}", ans)
}


Measured memory_bytes: 4352
//Robs Code
/***********HEADER***************/
#include <iostream>
#include <bitset>
#include <deque>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <string>
#include <algorithm>
#include <list>
#include <vector>
#include <unordered_set>
#include <unordered_map>
#include <stack>
#include <set>
#include <queue>
#include <map>
/***********MACROS***************/
#define int long long int
#define fri(l,k) for (i=l;i<=k;i++)
#define frj(l,k) for (j=l;j>=k;j--)
#define fij(a,b,l,k) for(i=a;i<=b;i++) for(j=l;j<=k;j++)
#define all(x) x.begin(),x.end()
#define allr(x) x.rbegin(),x.rend()
#define endl "\n"
#define pb push_back
#define _1 first
#define _2 second
#define mxsz 1000000007
#define mxval 1e9 + 7
#define grt [](auto x,auto y){return x>y;}
#define pii pair<int,int>
/*********VARIABLE****************/
using namespace std;
int i,j,n,m,k,l,q,t,a,b,sum[3],tot[3],cnt[3];
/*********FUNCTIONS**************/
int powom(int a,int b) {
    int result = 1;
    while (b > 0) {
        if (b & 1)
            result = result * a;
        a = a * a;
        b >>= 1;
    }
    return result;
}
/***********MAIN**************/
signed main(){
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    cin>>n>>k>>q;
    vector<int> v(n,0);
    fri(0,q-1){
        cin>>a;
        a--;
        v[a]++;
    }
    for(int i=0;i<n;i++){
        if((v[i]+k)>(q)){
            cout<<"Yes";
        }else{
            cout<<"No";
        }
        cout<<"\n";
    }
    return 0;
}
//.........

Measured memory_bytes: 1408
s = input()
y = 0
while y < len(s):
    if s[y:y+11] == "dreameraser":
        y += 11
    elif s[y:y+10] == "dreamerase":
        y += 10
    elif s[y:y+7] == "dreamer":
        y += 7
    elif s[y:y+6] == "eraser":
        y += 6
    elif s[y:y+5] == "dream" or s[y:y+5] == "erase":
        y += 5
    else: 
        print("NO")
        break
else: print("YES")

Measured memory_bytes: 3188
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = 0
for i in range(n):
    if a[i] < b[i]:
        c += -((a[i]-b[i])//2)
        a[i] += -((a[i]-b[i])//2) * 2
d = 0
for i in range(n):
    if b[i] < a[i]:
        d += a[i]-b[i]
if c == d:
    ans = 1
elif c < d:
    ans = 0
elif d < c:
    ans = 1
print(["No","Yes"][ans])

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

int main()
{
  int i , N , people = 0 ;
  cin >> N ;
  int A[N][2] ;
  
  for(i=0;i<N;i++){
	cin >> A[i][0] >> A[i][1] ;
    people += A[i][1] - A[i][0] + 1 ;
  }
  
  cout << people;
  
    
return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
bool evenstring(string s, int len){
string t = s.substr(0, s.size() - len);
int m = t.size();
string left = t.substr(0, m / 2);
string right = t.substr(m/2, m);
if(left == right)return true;
return false;
}
int main(){
string s;
cin>>s;
int cnt = 1;
while(cnt != s.size()){
if(evenstring(s, cnt))break;
cnt++;
}
cout<<s.size()  - cnt<<endl;
return 0;
}

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

using namespace std;

int main() {
	int N, K;
	cin >> N >> K;

	vector<int> A(N);
	for(auto &x : A) {
		cin >> x;
	}

	sort(A.begin(), A.end());

	int result = 0;
	for(int i = 0; i < K; i++) {
		result += A[i];
	}

	cout << result << endl;

	return 0;
}


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

int main() {
    int n, m;
    long long total = 0;
    cin >> n >> m;
    vector<pair<int, int>> ab(n);
    for (int i = 0; i < n; i++)
    {
        cin >> ab[i].first >> ab[i].second;
    }

    sort(ab.begin(), ab.end());

    //昇順にソートしたものを最初から取得していく
    for (int i = 0; i < n; i++)
    {
        //トータルマネーを計算
        if (m > ab[i].second)
        {
            m -= ab[i].second;
            total += (long long)ab[i].first * ab[i].second;
        }
        else if (m <= ab[i].second)
        {
            total += (long long)ab[i].first * m;
            m = 0;
            break;
        }
    }
    cout << total << endl;
}

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

using namespace std;

typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<vi> vvi;
#define INF 10000000000000000
#define pb push_back
#define sz(a) int((a).size())
#define all(c) c.begin(), c.end()
#define tr(c, i) for (typeof(c).begin() i = c.begin(); i != c.end(); i++)
#define present(c, x) (c.find(x) != c.end())
#define cpresent(c, x) (find(all(c), x) != c.end())
ll mod = 1e9 + 7;

ll bigmod(ll base, ll power)
{

    if (power == 0)
        return 1;
    ll x = bigmod(base, power / 2);

    if (power % 2 == 0)
        return (x * x) % mod;
    return (x * x * base) % mod;
}

int main()
{
    int x;
    cin>>x;
    if(x==0) cout<<1<<endl;
    else cout<<0<<endl;

    return 0;
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
int child[100001];
int marker[100001];
int maximumm=0;
int dfs(int head,vector<int> v[],int parent)
{
   // cout<<"dfs\n";
    //cout<<head<<"  "<<parent<<endl;
    child[head]=1;
    int maxi=0;
    for(int i=0;i<v[head].size();i++)
    {
      //  maxi=0;
        if(marker[v[head][i]]==0)
        {
            marker[v[head][i]]=1;
            int x=dfs(v[head][i],v,head);
      //      if(head==1)
        //    cout<<"if   "<<x<<endl;
            if(x>maxi)
            maxi=x;
          //  cout<<"maxi is "<<maxi<<endl;
        }
        else
        {
            int k=child[v[head][i]];
            if(k>maxi)
            maxi=k;
        }
    }
    child[head]+=maxi;
   // cout<<"child[head] is  "<<child[head]<<"  "<<head<<"   "<<parent<<endl;
    return child[head];
}

int main()
{
 /*   for(int i=0;i<=100001;i++)
    {
    child[i]=0;
    marker[i]=0;
    }*/
   // cout<<"ok"<<endl;
    int n,m;
    cin>>n;
    cin>>m;
    vector<int> v[n+1];
    for(int i=1;i<=n;i++)
    v[0].push_back(i);
    
    for(int i=0;i<m;i++)
    {
        int a,b;
        cin>>a;
        cin>>b;
        v[a].push_back(b);
    }
    
   // cout<<"ok2"<<endl;
    for(int i=0;i<=n;i++)
    {
    if(marker[i]==0)
    {
    marker[i]=1;
    //cout<<"ok3"<<endl;
    int y=dfs(i,v,0);
  //  cout<<"ok4"<<endl;
    if(y>maximumm)
    maximumm=y;
    }
    }
   // for(int i=1;i<=n;i++)
    //cout<<"child[i] is "<<child[i]<<endl;
    //cout<<"maximum is \n";
   // cout<<child[0]<<endl;
    
    child[0]--;
    child[0]--;
    cout<<child[0]<<endl;
    return 0;
}


Measured memory_bytes: 9592
#include <iostream>
 
using namespace std;
 
struct Dice {
  int values[6];
 
  int top;
  int bottom;
  int front;
  int back;
  int left;
  int right;
 
  void Init() {
    top = 1;
    bottom = 6;
    front = 2;
    back = 5;
    left = 4;
    right = 3;
  }
 
  int Value() const {
    return values[top - 1];
  }
 
  void Next(char d) {
    int temp = 0;
    switch (d) {
      case 'S':
        temp = front;
        front = top;
        top = back;
        back = bottom;
        bottom = temp;
        break;
      case 'N':
        temp = back;
        back = top;
        top = front;
        front = bottom;
        bottom = temp;
        break;
      case 'E':
        temp = right;
        right = top;
        top = left;
        left = bottom;
        bottom = temp;
        break;
      case 'W':
        temp = left;
        left = top;
        top = right;
        right = bottom;
        bottom = temp;
        break;
    }
  }
};
 
int main() {
  Dice dice;
  dice.Init();
  for (int i = 0; i < 6; ++i) {
    cin >> dice.values[i];
  }
  string ops;
  cin >> ops;
  for (size_t i = 0; i < ops.size(); ++i) {
    dice.Next(ops[i]);
  }
 
  cout << dice.Value() << endl;
  return 0;
}

Measured memory_bytes: 3148
#include <iostream>

using namespace std;

int main()
{
	for(int i=1; i<10; ++i)
	{
		for(int j=1; j<10; ++j)
		{
			cout << i << "x" << j << "=" << i*j << endl;
		}
	}
	
	return 0;
}

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

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	int64_t a,b,c,d; cin>>a>>b>>c>>d;
	int64_t llc=c/__gcd(c,d)*d;
	int64_t sma=a/c+a/d-a/llc;
	int64_t lar=b/c+b/d-b/llc;
	cout<<b-a+sma-lar+(a%c!=0&&a%d!=0)<<"\n"s;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
    int a,b,k;
    
    cin>>a>>b>>k;
    
    for(int i=a;i<=b;i++){
        if(i<= a+k-1 || i >= b-k+1)  cout<<i<<endl;
    }
    
 
}


Measured memory_bytes: 256
import java.util.Scanner;
import java.util.stream.IntStream;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        int q = sc.nextInt();
        int[] p = IntStream.range(0, n).map(e -> 0).toArray();
        for (int i = 0; i < q; i++) {
            p[sc.nextInt() - 1]++;
        }
        for (int i = 0; i < n; i++) {
            if (q - k < p[i]) {
                System.out.println("Yes");
            } else {
                System.out.println("No");
            }
        }
        sc.close();
    }
}

Measured memory_bytes: 69264
// cities to vapori-
// corner cases // int vs ll // cin vs scanf // clear structures // statement // doublesz
#include <bits/stdc++.h>
#define pb push_back
#define fst first
#define snd second
#define sz(x) int(x.size())
#define fill(x,v) memset(x,v,sizeof(x))
#define REP(i,a,b) for(int i = int(a); i < int(b); ++i)
#define trace(x) cout << #x << " = " << x << endl
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
using namespace std;
typedef long long ll;
typedef pair<int,int> ii;

int main(){

	fastio;
	int x;
	cin >> x;
	int a = 180 - x;
	for(int i = 3; ; ++i){
		if(x*i % 360 == 0){
			cout << i << endl;
			break;
		}
	}

	return 0;
}


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

int main() {
  int n, i, score = 0, x = 0;
  cin >> n;
  
  vector<int> s(n);
  for(i = 0; i < n; i++){
    cin >> s.at(i);
    score += s.at(i);
  }
  
  sort(s.begin(), s.end());
  
  if(score % 10 != 0){
    cout << score << endl;
  }
  else{
    for(i = 0; i < n; i++){
      if(s.at(i) % 10 != 0){
        score -= s.at(i);
        break;
      }
      else{
        x++;
      }
    }
    if(x == n){
      cout << 0 << endl;
    }
    else{
      cout << score << endl;
    }
  }
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

 public sealed class Begineer149
    {
        public static void Main()
        {
            long[] ABK = Console.ReadLine().Split(new char[] { ' ' }).Select(x => Convert.ToInt64(x)).ToArray();
            long A = ABK[0], B = ABK[1], k = ABK[2];

            if(k < A)
            {
               A = A - k;
               k = 0;               
            }
          	else
            {
               B =  Math.Max(0, B - (k - A));
               A = 0;               
            }

            Console.WriteLine($"{A} {B}");
        }
    }



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

int main() {
  int64_t N,A;
  cin>>N>>A;
  A--;
  int64_t a=2;
  for(int i=1;i<N;i++){
    int64_t b;
    cin>>b;
    if(a==b){
      a++;
    }
    else{
      b--;
      A+=b/a;
    }
  }
  cout<<A<<endl;
}

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

int main() {
  int n,m;
  cin>>n>>m;
  vector<int> road(m*2);
  for(int i=0;i<m*2;i++){
    cin>>road.at(i);
  }

  for(int i=0;i<n;i++){
    int ans=0;
    for(int j=0;j<m*2;j++){
      if(road.at(j)==i+1){
        ans++;
      }
    }
    cout<<ans<<endl;
  }
}

Measured memory_bytes: 256
n, k = map(int, input().split())
a = list(map(int, input().split()))
h = [[0, 0] for _ in range(41)]
b = list(map(int, bin(k)[2:].zfill(41)))
for i in a:
    for x, y in enumerate(map(int, bin(i)[2:].zfill(41))):
        h[x][y] += 1

ans = 0
ctr = 0
hm = [max(x, y)*2**(40-i) for i, [x, y] in enumerate(h)]
for i, v in enumerate(b):
    if not v:
        ctr += h[i][1]*2**(40-i)
    else:
        ans = max(ans, ctr+h[i][1]*2**(40-i)+sum(hm[i+1:]))
        ctr += h[i][0]*2**(40-i)
print(max(ans, ctr))


Measured memory_bytes: 14708
def BubbleSort(A):
    swapCount=0
    # sort
    for i in range(len(A)):
        for j in reversed(range(i+1,len(A))):
            if A[j] < A[j-1]:
                tmp=A[j]
                A[j]=A[j-1]
                A[j-1]=tmp
                swapCount+=1
    return swapCount
    

# input
n=int(input())
nums=list(map(int, input().split()))
count=BubbleSort(nums)
maplist=map(str, nums)
print(' '.join(maplist))
print(count)


Measured memory_bytes: 5600
/*
 * Problem Description: 8 Queens Problem
 * Category: Heuristic Search
 * Author: Khan
 * Date: 22th October, 2017
 */

#include <iostream>

using namespace std;

#define N 8 
#define FREE -1
#define NOT_FREE 1

int row[N], col[N], dpos[2 * N - 1], dneg[2 * N - 1];

bool X[N][N];

void initialize()
{
    for (int i = 0; i < N; ++i)
    {
        row[i] = FREE, col[i] = FREE;
    }
    for (int i = 0; i < 2 * N - 1; ++i)
    {
        dpos[i] = FREE;
        dneg[i] = FREE;
    }
}

void printBorad()
{
    for (int i = 0; i < N; ++i)
    {
        for (int j = 0; j < N; ++j)
        {
            if(X[i][j])
            {
                if(row[i] != j)
                    return;
            }
        }
    }
    for (int i = 0; i < N; ++i)
    {
        for (int j = 0; j < N; ++j)
            cout << ((row[i] == j) ? "Q" : ".");
        cout << endl; 
    }
}

void recursive(int i)
{
    if(i == N)
    {
        printBorad();
        return;
    }

    for (int j = 0; j < N; ++j)
    {
        if(NOT_FREE == col[j] || NOT_FREE == dpos[i + j] || NOT_FREE == dneg[i - j + N - 1])
            continue;
        row[i] = j;
        col[j] = dpos[i + j] = dneg[i - j + N - 1] = NOT_FREE;
        recursive(i + 1);
        row[i] = col[j] = dpos[i + j] = dneg[i - j + N - 1] = FREE;
    }
}

int main(int argc, char const *argv[])
{
    //freopen("sample.txt", "r", stdin);
    initialize();

    for (int i = 0; i < N; ++i)
        for (int j = 0; j < N; ++j)
            X[i][j] = false;

    int k;
    cin >> k;
    for (int i = 0; i < k; ++i)
    {
        int r, c;
        cin >> r >> c;
        X[r][c] = true;
    }

    recursive(0);
    return 0;
}

Measured memory_bytes: 3128
import java.io.File;
import java.io.IOException;
import java.lang.reflect.Array;
import java.util.*;
import java.util.Map.Entry;

public class Main{
	
	public static void main(String[] args) throws IOException{
		//File file = new File("input.txt");
		//Scanner in = new Scanner(file);
		Scanner in = new Scanner(System.in);
		
		int N = in.nextInt();
		HashMap<Integer, Integer> map = new HashMap<Integer, Integer>();
		
		for(int i = 0; i < N; i++){
			int a = in.nextInt();
			Integer count = map.get(a);
			if(count == null) map.put(a, 1);
			else map.put(a, count+1);
		}
		
		List<Entry<Integer, Integer>> listEntries = new ArrayList<Entry<Integer, Integer>>(map.entrySet());
        
		int ans = 0;
		for(Entry e : listEntries){
			if((int)e.getValue() % 2 != 0) ans++;
		}
        
        System.out.println(ans);
	}
}


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

int main() {
  string s;
  long long k;
  cin >> s >> k;
  int count=1;
  for (int i=1; i<s.length(); i++){
    if (s.at(i)==s.at(i-1)){
      count ++;
    }else{
      count =1;
    }
  }
  if(count==s.length()){
    cout << s.length()*k /2 << endl;
    return 0;
  }
  count =1;
  long long count1=0;
  long long count2=0;
  if(s.at(0)==s.at(s.length()-1)){
    count1 =1;
    count2 =1;
    for (int i=1; i<s.length(); i++){
      if(s.at(i)==s.at(i-1)){
        count1++;
      }else{
        break;
      }
    }
    for (int i=s.length()-1; i>0; i--){
      if(s.at(i)==s.at(i-1)){
        count2++;
      }else{
        break;
      }
    }
  }
  long long  sum=0;
  count=1;
  for (int i=count1+1; i<s.length()-count2; i++){
     if(s.at(i)==s.at(i-1)){
       count ++;
     }else{
       sum += count /2;
       count=1;
     }
  }
  sum += count /2;
  cout << k*sum + count1/2 + count2/2 +((count1+count2)/2)*(k-1)<< endl;
}





Measured memory_bytes: 256
# import bisect
# from collections import Counter, defaultdict, deque, namedtuple
# import copy
# from heapq import heappush, heappop, heapify
# from fractions import gcd
# import itertools
# from operator import attrgetter, itemgetter
# import math

import sys

# import numpy as np

ipti = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)

def main():
    k, a, b = list(map(int,ipti().split()))

    viscuit = 1

    #aをbにするとき増える枚数
    a2b = b - a

    #最初は1枚持っている

    if k >= (a-1):
        k -= (a-1)
        viscuit += (a-1)
    else:
        viscuit += k
        k = 0

    if a2b > 2:
        times = k // 2
        rem = k % 2
        viscuit += a2b * times
        viscuit += rem
    else:
        viscuit += k
        k = 0

    print(viscuit)


if __name__ == '__main__':
    main()

Measured memory_bytes: 38560
#include<bits/stdc++.h>
#define del(a,i) memset(a,i,sizeof(a))
#define ll long long
#define inl inline
#define il inl void
#define it inl int
#define ill inl ll
#define re register
#define ri re int
#define rl re ll
#define INF 0x3f3f3f3f
#define lowbit(x) (x&(-x))
#define mid ((l+r)>>1)
using namespace std;
template<class T>il read(T &x){
	x=0;int f=1;char k=getchar();
	for(;k>'9'||k<'0';k=getchar()) if(k=='-') f=-1;
	for(;k>='0'&&k<='9';k=getchar()) x=x*10+k-'0';
	x*=f;
}
template<class T>il _print(T x){
	if(x>9) _print(x/10);
	putchar(x%10+'0');
}
template<class T>il print(T x){
	if(x<0) putchar('-'),x=-x;
	_print(x);
}
const int N = 1e3+5;
int n,m,k,ans=INF,val[11][N],sum[11][N];
char s[N];
il Solve(int S){
	int res=0;
	vector<int> G;
	G.push_back(0);
	for(ri i=1;i<n;++i){
		if(!(S&(1<<(i-1)))) continue;
		++res,G.push_back(i);
	}
	G.push_back(n);
	int pre=1;
	for(ri i=1;i<=m;++i){
		char flag=0;
		for(ri j=1;j<(int)G.size();++j){
			int L=G[j-1]+1,R=G[j];
			int tval=sum[R][i]-sum[R][pre-1]-sum[L-1][i]+sum[L-1][pre-1];
			flag|=tval>k;
		}
		if(flag) ++res,pre=i;
	}
	for(ri j=1;j<(int)G.size();++j){
		int L=G[j-1]+1,R=G[j];
		int tval=sum[R][m]-sum[R][pre-1]-sum[L-1][m]+sum[L-1][pre-1];
		if(tval>k) return ;
	}
	ans=min(ans,res);
}
int main(){
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
	read(n),read(m),read(k);
	for(ri i=1;i<=n;++i){
		scanf("%s",s+1);
		for(ri j=1;j<=m;++j)
			val[i][j]=s[j]-'0';
	}
	for(ri i=1;i<=n;++i)
		for(ri j=1;j<=m;++j)
			sum[i][j]=val[i][j]+sum[i-1][j]+sum[i][j-1]-sum[i-1][j-1];
	int S=1<<(n-1);
	for(ri T=0;T<S;++T)
		Solve(T);
	print(ans);
	return 0;
}

Measured memory_bytes: 384