akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using i64=int_fast64_t;
using i32=int_fast32_t; 
using P=pair<i64,i64>;
const i64 MOD=1000000007;
const i64 INF=1000000010;
const i64 LINF=4000000000000000010;
template<typename T>
struct PriorityQueue{
    using F=function<bool(T,T)>;
    i32 n;
    vector<T> node;
    F f;
    PriorityQueue(F f):n(0),f(f){node.resize(1);};
    void push(const T& x){
        ++n;
        if(node.size()>n){
            node[n]=x;
        }else{
            node.emplace_back(x);
        }
        i32 k=n;
        while(k>1){
            if(f(node[k],node[k>>1])){
                swap(node[k],node[k>>1]);
                k>>=1;
            }else{
                break;
            }
        }
    }
    void pop(){
        node[1]=node[n];
        --n;
        i32 k=1;
        while((k<<1)<=n){
            if((k<<1|1)>n){
                if(f(node[k<<1],node[k]))swap(node[k],node[k<<1]);
                break;
            }
            if(f(node[k<<1],node[k<<1|1])&&f(node[k<<1],node[k])){
                swap(node[k],node[k<<1]);
                k<<=1;
            }else if(f(node[k<<1|1],node[k])){
                swap(node[k],node[k<<1|1]);
                k<<=1,++k;
            }else{
                break;
            }
        }   
    }
    T top(){
        assert(node.size()>1);
        return node[1];
    }
    bool empty(){
        return n<1;
    }
};
int main(){
    auto f=[](i64 a,i64 b){
        return a<b;
    };
    auto g=[](i64 a,i64 b){
        return a>b;
    };
    PriorityQueue<i64> q1(f);
    PriorityQueue<i64> q2(g);
    i32 n;cin>>n;
    vector<i64> a(3*n+10),sum1(3*n+10),sum2(3*n+10);
    for(i32 i=0;i<3*n;i++){
        cin>>a[i];
    }
    for(i32 i=0;i<n;i++){
        if(i)sum1[i]=sum1[i-1];
        q1.push(a[i]);
        sum1[i]+=a[i];
    }
    for(i32 i=3*n-1;i>=2*n;i--){
        sum2[i]=sum2[i+1];
        q2.push(a[i]);
        sum2[i]+=a[i];
    }
    for(i32 i=n;i<2*n;i++){
        sum1[i]=sum1[i-1];
        q1.push(a[i]);
        sum1[i]+=a[i];
        sum1[i]-=q1.top();
        q1.pop();
    }
    for(i32 i=2*n-1;i>=n;i--){
        sum2[i]=sum2[i+1];
        q2.push(a[i]);
        sum2[i]+=a[i];
        sum2[i]-=q2.top();
        q2.pop();
    }
    
    i64 ans=-LINF;
    for(i32 i=n-1;i<2*n;i++){
        ans=max(sum1[i]-sum2[i+1],ans);
    }
    cout<<ans<<endl;
    return 0;
}   

Measured memory_bytes: 9588
#include <bits/stdc++.h>
using namespace std;
#define ll int64_t
#define ALL(a)  (a).begin(),(a).end()
 
const ll mod = 1000000007;
const ll LINF = 1e13;
const ll LLINF = 1e18;
const ll ALPHABET = 26;
 
template <class T>
void Swap(T& r, T& l) {
  T tmp = r;
  r = l;
  l = tmp;
}
 
template<typename T>
istream& operator >> (istream& is, vector<T>& vec) {
  for (T& x : vec) is >> x; //for(int i=0; i<vec.size(); i++) is >> x[i]; とかでもいい
  return is;
}


int main(){
    ll a,b;
    cin >> a >> b;
    ll sum = 1;
    ll ans = 0;

    for (ll i = 0; i < 1000; i++){
      if (sum>=b)break;
      sum+=(a-1);
      ans++;
      
    }

    cout << ans;
    
    
}


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

using namespace std;

using ll = long long;
using Vi = vector<int>;
using Vl = vector<ll>;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

//===


const int INF = int(1e9 + 7);


int main() {
	int N;
	cin >> N;
	Vl a(N);
	for (int i = 0; i < N; ++i) {
		cin >> a[i];
	}
	ll sum = 0;
	for (int i = 0; i < N; ++i) {
		sum ^= a[i];
	}

	bool ans = true;
	for (int i = 0; i < N; ++i) {
		if (a[i] != (sum ^ a[i])) {
			ans = false;
			break;
		}
	}
	cout << (ans ? "Yes" : "No") << endl;
}


Measured memory_bytes: 1024
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int A[2], K;
    cin >> A[0] >> A[1] >> K;
    rep(i, K) {
        if (A[i % 2] % 2 == 1) A[i % 2]--;
        A[(i + 1) % 2] += A[i % 2] / 2;
        A[i % 2] /= 2;
    }
    cout << A[0] << " " << A[1] << endl;

    return 0;
}


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++)
//'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122

int main() {
    int n;
    cin >> n;
    int a[n];
    int ans = 0;
    rep(i, n) {
        cin >> a[i];
        ans += a[i];
    }

    sort(a, a + n);
    rep(i, n) {
        if (ans % 10 != 0) break;
        else {
            if (a[i] % 10 != 0) ans -= a[i];
        }
    }

    if (ans % 10 == 0) ans = 0;
    
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
import sys
from bisect import *
from collections import *
from copy import deepcopy
from heapq import *
from itertools import *
from math import *
from operator import *
import numpy as np

sys.setrecursionlimit(10**8)

input = sys.stdin.readline

def main():
    """ main """
    S = list(input().rstrip())
    N = len(S)

    for bit in range(1<<N-1):
        total = int(S[0])
        res = S[0]
        for i in range(N-1):
            if bit & 1<<i:
                total += int(S[i+1])
                res += '+'
                res += S[i+1]
            else:
                total -= int(S[i+1])
                res += '-'
                res += S[i+1]
        if total == 7:
            res += '=7'
            print(res)
            return 0


if __name__ == '__main__':
    main()

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

#define task "B"
#define all(v) (v).begin(), (v).end()
#define rep(i, l, r) for (int i = (l); i <= (r); ++i)
#define Rep(i, r, l) for (int i = (r); i >= (l); --i)
#define DB(X) { cerr << #X << " = " << (X) << '\n'; }
#define DB1(A, _) { cerr << #A << "[" << _ << "] = " << (A[_]) << '\n'; }
#define DB2(A, _, __) { cerr << #A << "[" << _ << "][" << __ << "] = " << (A[_][__]) << '\n'; }
#define DB3(A, _, __, ___) { cerr << #A << "[" << _ << "][" << __ << "][" << ___ << "] = " << (A[_][__][___]) << '\n'; }
#define PR(A, l, r) { cerr << '\n'; rep(_, l, r) DB1(A, _); cerr << '\n';}
#define SZ(x) ((int)(x).size())
#define pb push_back
#define eb emplace_back
#define pf push_front
#define F first
#define S second
#define by(x) [](const auto& a, const auto& b) { return a.x < b.x; } // sort(arr, arr + N, by(a));
#define next ___next
#define prev ___prev
#define y1 ___y1
#define left ___left
#define right ___right
#define y0 ___y0
#define div ___div
#define j0 ___j0
#define jn ___jn

using ll = long long;
using ld = long double;
using ull = unsigned long long;
using namespace std;
typedef pair<int, int> ii;
typedef pair<ii, int> iii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<ll> vl;

int main()
{
#ifdef HynDuf
    freopen(task".in", "r", stdin);
    //freopen(task".out", "w", stdout);
#else
    ios_base::sync_with_stdio(false); cin.tie(nullptr);
#endif
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    ll ans = max({a * c, a * d, b * c, b * d});
    cout << ans;
    return 0;
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
#define endl '\n'
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()
#define F first
#define S second

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double db;

const db inf = 1e18;
const db pi = acos(-1);
const db eps = 1e-9;
const int mod = 998244353;

int main () {
	#ifdef ernestico
		freopen ("a.in", "r", stdin );
//		freopen ("a.out", "w", stdout );
	#endif
	ios_base::sync_with_stdio(0);
	cin.tie(0);

	int a, b; cin >> a >> b;
	cout <<a * b << endl;


	return 0;
}


Measured memory_bytes: 3636
n,m,v,p= map(int, input().split())
a= list(map(int, input().split()))
a.sort(reverse=True)
ans=p
x = a[p - 1]
if v<=p:
    for i in range(p,n):
        if a[i]+m>=x:
            ans+=1
        else:
            break

else:
    # 当落ラインを変えずにどれくらい点を割り振れるか記録
    b=[0]*n
    for i in range(p,n):
        b[i]+=b[i-1]
        b[i]+=x-a[i]

    for i in range(p,n):
        r=v-n+i-p+1
        if r<=0:
            if a[i]+m>=x:
                ans+=1
            else:
                break
        else:
            # 新しい当落ライン=x1
            if r*m<=b[i-1]:
                x1=x
            else:
                x1=-(-(r*m-b[i-1])//(i-p+1))+x

            if a[i]+m>=x1:
                ans+=1
            else:
                break

print(ans)

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

int main(){
  int H,W,N;
  cin>>H>>W>>N;
  vector<int> a[H];
  int n = 0;
  int cnt = 0;
  for(int i=0;i<N;i++){
    int t; cin>>t;
    for(int j=0;j<t;j++){
      a[n].push_back(i+1);
      cnt++;
      if(cnt%W == 0) n++;
    }
  }
  for(int i=0;i<H;i++){
    if(i & 1)
      reverse(a[i].begin(),a[i].end());
    for(int j=0;j<a[i].size();j++)
      printf("%d ",a[i][j]);
    printf("\n");
  }
  return 0;
}


Measured memory_bytes: 384
n = input()
a = list(map(int, input().split()))
a.sort(reverse=True)
ans = 0

for i in range(len(a)//2):
    ans += a[2 * i] - a[2 * i + 1]

if len(a) % 2:
    ans += a[len(a) - 1]

print(ans)


Measured memory_bytes: 3060
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <iomanip>
using namespace std;

typedef pair<int, int> P;
#define rep(i, n) for (int i=0; i<(n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007

int r, g, b;
signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  cin >> r >> g >> b;
  int x = 100*r+10*g+b;
  if (x % 4 == 0) cout << "YES\n";
  else cout << "NO\n";
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
 
using namespace std;
 
int main(){
  int a;
  string s, ans;
  
  cin >> a >> s;
  
  if(a >= 3200){
    ans = s;
  } else {
    ans = "red";
  }
  
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstring>
#include <climits>
using namespace std;
typedef long long ll;
ll INF=1<<29;

int main(){
    ios::sync_with_stdio(false);
	ll N,W;
	cin>>N>>W;
	ll w[N],v[N],dp[110][100010];
	memset(dp,0,sizeof(dp));
	for(int i=0;i<N;i++) cin>>w[i]>>v[i];
	for(int i=0;i<N;i++){
		for(int j=0;j<=W;j++){
			if(j-w[i]>=0) dp[i+1][j]=max(dp[i][j-w[i]]+v[i],dp[i+1][j]);
			dp[i+1][j]=max(dp[i][j],dp[i+1][j]);
		}
	}
	cout<<dp[N][W];
}

Measured memory_bytes: 86272
#include <iostream>
using namespace std;
int main(void) {
  int n, m, a[128], b[128];
  while(cin >> n >> m, (n+m)) {
    int sa = 0, sb = 0;
    for(int i = 0;i < n; i++) cin >> a[i], sa += a[i];
    for(int i = 0;i < m; i++) cin >> b[i], sb += b[i];

    int ca = -1, cb = -1;
    for(int i = 0;i < n; i++) {
      for(int j = 0;j < m; j++) {
        if(sa - a[i] + b[j] == sb - b[j] + a[i]) {
          if(ca == -1 || ca+cb > a[i]+b[j]) ca = a[i], cb = b[j];
        }
      }
    }
    if(ca == -1) cout << -1 << endl;
    else cout << ca << ' ' << cb << endl;
  }
}


Measured memory_bytes: 1160
#include<bits/stdc++.h>
#define ll long long
#define getc(x) scanf("%s",x+1);
#define rep(i,x,y) for(register int i=x;i<=y;++i)
using namespace std;
const int N=88989;
inline int read()
{
	int x=0,ff=1;
	char ch=getchar();
	while(!isdigit(ch)) {if(ch=='-') ff=-1;ch=getchar();}
	while(isdigit(ch)) {x=(x<<1)+(x<<3)+(ch^48);ch=getchar();}
	return x*ff;
}
int main()
{
//	freopen("1.in","r",stdin);
	ll a=read(),b=read(),c=read(),k=read();
	ll sum=0;
	if(k<=a) printf("%lld",k);
	else if(k>a&&k<=a+b) printf("%lld",a);
	else printf("%lld",a-(k-a-b)); 
	return 0;
}


Measured memory_bytes: 3700
/**
 *    author:   abdullahkhilji.github.io
 *    created:  27.04.19
**/
#include <bits/stdc++.h>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstring>
#include <chrono>
#include <complex>
#define endl "\n"
#define ll long long int
#define vi vector<int>
#define vll vector<ll>
#define vvi vector < vi >
#define pii pair<int,int>
#define pll pair<long long, long long>
#define mod 1000000007
#define inf 1000000000000000001;
#define all(c) c.begin(),c.end()
#define mp(x,y) make_pair(x,y)
#define mem(a,val) memset(a,val,sizeof(a))
#define eb emplace_back
#define f first
#define s second

using namespace std;
int main()
{
  std::ios::sync_with_stdio(false);
  int a,b,t;
  cin>>a>>b>>t;
  // cin.ignore(); must be there when using getline(cin, s)
  cout<<(t/a)*b;
  

  return 0;
}


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

int main() {
    string s;
    cin >> s;
    if (s == "SUN") {
        cout << 7 << endl;
    }
    else if (s == "MON") {
        cout << 6 << endl;
    }
    else if (s == "TUE") {
        cout << 5 << endl;
    }
    else if (s == "WED") {
        cout << 4 << endl;
    }
    else if (s == "THU") {
        cout << 3 << endl;
    }
    else if (s == "FRI") {
        cout << 2 << endl;
    }
    else if (s == "SAT") {
        cout << 1 << endl;
    }

}

Measured memory_bytes: 256
#import numpy as np
#import math
#from fractions import gcd

def main():

    ##get int
    first_input = list(map(lambda x:int(x), input().split(" ")))
    #second_input = list(map(lambda x:int(x), input().split(" ")))

    ##get float
    #first_input = list(map(lambda x:float(x), input().split(" ")))
    #second_input = list(map(lambda x:float(x), input().split(" ")))

    ##get string
    #first_input = input().split(" ")

    N = first_input[0]
    K = first_input[1]

    sunuke_list = [0]*N
    for i in range(K):
        _dummy = input()
        current_input = list(map(lambda x:int(x), input().split(" ")))
        for j in current_input:
            sunuke_list[j-1] = 1

    print(N-sum(sunuke_list))

if __name__ == '__main__':
    main()


Measured memory_bytes: 67700
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <cmath>
#include <queue>
#include <iomanip> 
#define rep(i, a, b) for (int i = a; i < b; i++)
#define per(j, a, b) for (int j = a; j >= b; j--)
using namespace std;
const int MOD = 1e9 + 7;
const int MAX = 1e9 + 7;
void add(int& a, int b){
    a=(long long)a+b;
    if(a>=MOD)a-=MOD;
}
int abs_diff(int a, int b){
    return abs(a-b);
}
void get_max(int& a, int b){
    a = max(a, b);
}
void get_min(int& a, int b){
    a = min(a, b);
}
int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n;
    cin >> n;
    vector <vector <int> > v(n, vector<int>(3)), dp(n+2, vector<int>(3, 0));
    rep(i,0,n){
        rep(j,0,3){
            cin>> v[i][j];
        }
    }
    dp[0]= v[0];
    rep(i,1,n){
        rep(j,0,3){
            rep(k,0,3){
                if(k==j)continue;
                get_max(dp[i][j], v[i][j]+ dp[i-1][k]);
            }
        }
    }
    int x = 0;
    rep(i,0,3){
        get_max(x, dp[n-1][i]); 
    }
    cout << x << endl;
    return 0;
}

Measured memory_bytes: 11264
using System;

namespace Atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = Int32.Parse(Console.ReadLine());
            int i = 0;
            while (N > 0) 
            {
                N = N - 2;
                i = i + 1;
            }
            Console.WriteLine(i);
        }
    }
}


Measured memory_bytes: 11092
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
#include <ctype.h>
#include <stdint.h>
#include <string.h>
#include <wchar.h>
#include <math.h>

#define N_MAX (100)
#define P_MAX (100)
#define DP_ARRAY_SIZE (N_MAX * P_MAX / 32 + 1)

#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define ABS(a) ((a) < 0 ? -(a) : (a))
#define ABSS(a, b) ((a) > (b) ? (a) - (b) : (b) - (a))

int compare_sz_asc(const void* a, const void* b) {
    return *((size_t*)a) < *((size_t*)b) ? -1 : 1;
}

int compare_sz_desc(const void* a, const void* b) {
    return *((size_t*)a) > * ((size_t*)b) ? -1 : 1;
}

int compare_i64_asc(const void* a, const void* b) {
    return *((int64_t*)a) < *((int64_t*)b) ? -1 : 1;
}

int compare_i64_desc(const void* a, const void* b) {
    return *((int64_t*)a) > * ((int64_t*)b) ? -1 : 1;
}

int compare_c_asc(const void* a, const void* b) {
    return *((char*)a) < *((char*)b) ? -1 : 1;
}

int compare_c_desc(const void* a, const void* b) {
    return *((char*)a) > * ((char*)b) ? -1 : 1;
}

static size_t comb(const size_t n, const size_t r) {
    size_t result = 1;

    for (size_t i = 0; i < r; i++) {
        result *= n - i;
        result /= i + 1;
    }

    return result;
}

static uint64_t combU64(const uint64_t n, const uint64_t r) {
    uint64_t result = 1;

    for (uint64_t i = 0; i < r; i++) {
        result *= n - i;
        result /= i + 1;
    }

    return result;
}

static size_t gcdZu(size_t m, size_t n) {
    size_t temp;

    while (m % n != 0) {
        temp = n;
        n = m % n;
        m = temp;
    }

    return n;
}

static uint64_t gcdU64(uint64_t m, uint64_t n)
{
    uint64_t temp;

    while (m % n != 0) {
        temp = n;
        n = m % n;
        m = temp;
    }

    return n;
}

static size_t A[300][300];

struct {
    size_t row;
    size_t col;
} idxList[90001];

static size_t distanceSum[90001];

int main(void) {
    size_t H, W, D;

    scanf("%zu %zu %zu\n", &H, &W, &D);
    for (size_t row = 0; row < H; row++) {
        for (size_t col = 0; col < W; col++) {
            scanf("%zu", &(A[row][col]));
            scanf(col<W-1?" ":"\n");

            idxList[A[row][col]].row = row;
            idxList[A[row][col]].col = col;
        }
    }

    for (size_t i = 1; i <= D; i++) {
        distanceSum[i] = 0;
        for (size_t ofs = 1; i + ofs * D <= H * W; ofs++) {
            distanceSum[i + ofs * D] = distanceSum[i + (ofs - 1) * D] + ABSS(idxList[i + (ofs - 1) * D].row, idxList[i + ofs * D].row) + ABSS(idxList[i + (ofs - 1) * D].col, idxList[i + ofs * D].col);
        }
    }

    size_t Q;

    scanf("%zu\n", &Q);
    for (size_t i = 0; i < Q; i++) {
        size_t L, R;
        scanf("%zu %zu", &L, &R);
        if (i < Q - 1) {
            scanf("\n");
        }

        printf("%zu\n", distanceSum[R] - distanceSum[L]);
    }

    return 0;
}


Measured memory_bytes: 3840
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
#define rep2(i,a,n) for(int i=(a); i<(n); i++)
#define all(vec) vec.begin(),vec.end()
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;

int main(){
  string S; cin >> S;
  ll K; cin >> K;
  
  if(K==1){cout << S[0] << endl; return 0;}
  ll p;
  rep(i, S.size()){
    if(S[i]=='1') continue;
    else {p=i; break;}
  }
  if(K>p) {cout << S[p] << endl; return 0;}
  else {cout << S[0] << endl; return 0;}
  

  return 0;

}

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

using namespace std;

const int N = 2e5 + 5;

int n, k, a[N], used[N], cnt = 0;
long long f[N], bit[N];
vector <pair <long long, int> > comp;

void update (int x, int val) {
    for (int i = x; i < N; i += i & -i) bit[i] += val;
}

long long get (int x) {
    long long ans = 0;
    for (int i = x; i > 0; i -= i & -i) ans += bit[i];
    return ans;
}

signed main(){
    scanf("%d %d", &n, &k);
    long long ans = 0;

    f[0] = 0;
    for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
    for (int i = 1; i <= n; i++) f[i] = f[i - 1] + a[i];
    for (int i = 1; i <= n; i++) comp.push_back(make_pair(f[i] - 1LL * k * i, i));
    comp.push_back(make_pair(0, 0));

    sort(comp.begin(), comp.end());
    used[comp[0].second] = ++cnt;
    for (int i = 1; i < comp.size(); i++) {
        if (comp[i].first > comp[i - 1].first) used[comp[i].second] = ++cnt;
        else used[comp[i].second] = cnt;
    }

    for (int i = 1; i <= n; i++) {
        update(used[i - 1], 1);
        ans += get(used[i]);
    }

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


Measured memory_bytes: 9584
#include <bits/stdc++.h>
using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long

int32_t main()
{
	IOS;
	int x, a; 
	cin >> x >> a;
	if(x < a)
		cout << 0;
	else
		cout << 10;
	return 0;
}

Measured memory_bytes: 764
#include <bits/stdc++.h>
using namespace std;
int main ()  {
int a,b;
cin>>a>>b;
int o=a*b;
int u=a+b;
int c=a-b;
if(o>=u&&o>=c){
    cout<<o;
}
else if(u>=o&&u>=c){
    cout<<u;
}
else{
    cout<<c;
}
}



Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
typedef vector<vector<P>> vvP;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;

int main() {
    ll x;
    cin >> x;

    ll u = 0;
    exrep(i, 1, 50000) {
        u += i;
        if(x <= u) {
            out(i);
            re0;
        }
    }

    re0;
}

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

a = h[0]
cnt, ans = 0, 0
for i in range(1, n):
    if a >= h[i]:
        cnt += 1
    else:
        ans = max(ans, cnt)
        cnt = 0
    a = h[i]
print(max(ans, cnt))

Measured memory_bytes: 20232
#include<iostream>
using namespace std;
char A[6] = "ABCDE";
int a, b, maxn, maxid;
int main() {
	while (true) {
		maxn = 0;
		for (int i = 0; i < 5; i++) {
			cin >> a >> b;
			if (a == 0 && b == 0) { goto E; }
			if (maxn < a + b) {
				maxn = a + b;
				maxid = i;
			}
		}
		cout << A[maxid] << ' ' << maxn << endl;
	}
E:;
	return 0;
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
#define pi acos(-1.0)
using namespace std;

const int maxn = 1e5 + 10, mod = 1e9 + 7;
char str[maxn];
long long dp[maxn][20];

int main() {
  #ifdef LOCAL
  freopen("in", "r", stdin);
  freopen("out", "w", stdout);
  #endif

  ios::sync_with_stdio(false);
  cin >> str;
  int n = strlen(str);
  reverse(str, str + n);
  if (str[0] == '?') for (int i = 0; i < 10; ++i) dp[0][i] = 1;
  else dp[0][str[0] - '0'] = 1;

  long long curm = 10;
  for (int i = 0; i < n - 1; ++i) {
    if (str[i + 1] == '?') {
      for (int j = 0; j < 10; ++j) {
        for (int k = 0; k < 13; ++k) {
          int pos = (j * curm % 13 + k) % 13;
          dp[i + 1][pos] += dp[i][k];
          dp[i + 1][pos] %= mod;
        }
      }
    } else {
      for (int k = 0; k < 13; ++k) {
        int pos = ((str[i + 1] - '0') * curm % 13 + k) % 13;
        dp[i + 1][pos] += dp[i][k];
        dp[i + 1][pos] %= mod;
      }
    }
    curm *= 10;
    curm %= 13;
  }
  cout << dp[n - 1][5];
  return 0;
}

Measured memory_bytes: 16000
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#define MN 101000

typedef long long ll;

int h[MN], nxt[2 * MN], to[2 * MN], K = 0;
int n, m, fa[MN]; 
int a[MN], c[MN], p[MN];
std::vector<int> e[MN];
ll sum[MN];
bool vis[MN];
ll Ans = 1e18;

void ins(int u, int v) {nxt[++K] = h[u]; h[u] = K; to[K] = v;} 

int Find(int x) {return fa[x] == x ? x : fa[x] = Find(fa[x]);}

bool cmp(int a, int b) {return c[a] < c[b];}

void dfs(int x)
{
	sum[x] = a[x] - c[x];
	for(int i = h[x]; i; i = nxt[i])
		dfs(to[i]), sum[x] += sum[to[i]];
}

void solve(int x, ll w)  
{
	Ans = std::min(Ans, std::max((ll)c[x], w));
	for(int i = h[x]; i; i = nxt[i])
	{
		solve(to[i], std::max(w, c[x] - sum[to[i]]));
	}
}

int main()
{
	scanf("%d%d", &n, &m);
	for(int i = 1; i <= n; i++)
	{
		int a, b; scanf("%d%d", &a, &b);
		a = std::max(a, b);
		::a[i] = a; c[i] = a - b;
		fa[i] = i; p[i] = i;
	}
	for(int i = 1; i <= m; i++)
	{
		int u, v; scanf("%d%d", &u, &v);
		e[u].push_back(v);
		e[v].push_back(u);
	}

	std::sort(p + 1, p + n + 1, cmp);
	
	for(int i = 1; i <= n; i++)
	{
		int x = p[i]; vis[x] = 1;
		for(int j = 0; j < e[x].size(); j++)
		{
			if(vis[e[x][j]])
			{
				int y = Find(e[x][j]);
				if(x != y)
				{
					ins(x, y);
					fa[y] = x;
				}
			}
		}
	}
	
	dfs(p[n]);
	solve(p[n], 0);
	
	printf("%lld\n", Ans + sum[p[n]]); 
}

/*
a_i = max(a_i, b_i)  c_i = a_i - b_i
一定存在一种方案，使得不经过已经捐赠过的点（并且可以只考虑目前要捐赠的点的权值，不用考虑路径上的其它点） 
就是在捐赠过程中，一直保持未捐赠的点形成一个连通块
考虑倒着做，就是-c_i+a_i，那么假设你知道了起始点，肯定是找相邻的c_i最小的点捐赠
那么找一棵最小生成树就好了嘛
但是一般的最小生成树性质不够好，不好求每个点出发的答案 
考虑找一棵树，满足大根堆的性质（按 c_i 从小到大排序，连边的时候向连通块的点权最大那个点连边（因为做生成树过程中往哪个点连边都是一样的，如果从那个连通块出发，那么肯定是先把连通块走遍，如果从当前这个点出发，那么目前的钱一定够以任何顺序走遍这个连通块）） 
那么从每个点出发肯定是先把它的子树走遍，然后往父亲走，这个点答案为 max(c_i,c_{fa_i}-{sum_i},c_{fa_{fa_i}}-{sum_{fa_i}}...) 
*/ 

Measured memory_bytes: 12284
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from sys import stdin
import math

# 標準入力をスペースで区切って、intに変換 listに収納
S = stdin.readline()
T = stdin.readline()

cnt=0
for i in range(3):
    if S[i] == T[i]:
        cnt+=1


print(cnt)


Measured memory_bytes: 2940
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cstring>
using namespace std;
#define ll long long
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define FORD(i,a,b) for(int i=a;i>=b;i--)
#define FORL(i,x) for(int i=head[x];i;i=nxt[i])
#define clr(x,y) memset(x,y,sizeof(x))
#define in(a) a=read()
#define out(a) printf("%d\n",a)
inline ll read(){
    char c=getchar();ll f=1,x=0;
    while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
    while(c>='0'&&c<='9')x=x*10+(c-'0'),c=getchar();
    return x*f;
}
#define mod 1000000007
void MOD(int &x){if(x>=mod)x-=mod;}
#define maxn 2010
#define inf (1<<30)
int main(){
	int n;
	in(n);
	double ans=0;
	while(n--){
		double a;
		scanf("%lf",&a);
		char s[10];
		scanf("%s",s+1);
		if(s[1]=='B')a*=380000;
		ans+=a;
	}
	printf("%.6lf\n",ans);
}

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

using namespace std;

typedef long long ll;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)

int main(){
	int n;
	cin>>n;
	ll fact=1;
	FOR(i,2,n+1){
		fact*=i;
	}
	cout<<fact<<endl;
	return 0;
}

Measured memory_bytes: 1156
from collections import Counter

N = int(input())
A = list(map(int, input().split()))
A = sorted(A)
c = Counter(A)

flags = [True] * (A[-1] + 1)

for a in A:
    for mul in range(2, A[-1] // a + 1):
        flags[a * mul] = False
print(sum([flags[a] and c[a] == 1 for a in A]))

Measured memory_bytes: 135392
parseInt(x)=parse(Int,x)
parseMap(x::Array{SubString{String},1})=map(parseInt,x)

function main()
	a = Array{Int}(2,3)
	for i in 1:3
		a[:,i] = readline() |> split |> parseMap
	end
	b = Array{Int}(4)
	for i in 1:2
		for j in 1:3
			b[a[i,j]] += 1
		end
	end
	if 3 in b
		println("NO")
	else
		println("YES")
	end
end

main()

Measured memory_bytes: 173068
#include <iostream>
#define ll long long
using namespace std;

int main(){
  ll n,a,b; cin>>n>>a>>b;
  
  if(a>b){cout<<0;}
  else if(a<b&&n==1){cout<<0;}
  else{cout<<b*(n-2)-a*(n-2)+1;}
  
  return 0;
}

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

int main()
{
  int N, K;
  cin>>N>>K;
  bool good[10];
  for(int i=0; i<10; i++)
   good[i] = true;
  for(int i=0, a; i<K; i++)
  {
    cin>>a;
    good[a] = false;
  }

  for(int i=N; i<=10*N; i++)
  {
    int tmp = i;
    bool isgood = true;
    while(tmp != 0)
    {
      if(!good[tmp%10])
       isgood = false;
      tmp/=10;
    }
    if(isgood)
    {
      cout<<i<<endl;
      return 0;
    }
  }
  return 0;
}


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

int main(){
	LL T;
	cin >> T;
	for(int t = 0; t < T; t++){
		LL A, B, C, D;
		cin >> A >> B >> C >> D;
		if(A < B || D < B){
			cout << "No" << '\n';			
			continue;
		}
		LL r = __gcd(B,D);
		LL mult = (C + 1 - (A % r) + r - 1) / r;
		LL F = mult * r + (A % r);
		if(F >= B){
			cout << "Yes" << '\n';
		} else {
			cout << "No" << '\n';
		}
	}
}


Measured memory_bytes: 256
import collections
a = int(input())
ar = list(map(int,input().split(" ")))
br = collections.Counter(ar)
cr = set(ar)
count = 0
for r in cr:
    if br[r] < r:
        count += br[r]
    elif br[r] >= r:
        count += br[r] - r
print(count)

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

int main()
{
 int n;
  cin >> n;
  long h[101000];
  for (int i = 0;i < n;i++)
    cin >> h[i];
  
  for (int i = n-2; i >= 0; i--)
  {
   	if (h[i] > h[i+1])
      h[i]--;
  }
  
  bool f = true;
  for (int i = 0;i < n-1;i++)
  {
   	 if (h[i] > h[i+1])
       f= false;
  }
    
  if (f) 
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}


Measured memory_bytes: 1024
#include <iostream>
#include <array>
#include <algorithm>
#include <vector>
#include <bitset>
#include <set>
#include <unordered_set>
#include <cmath>
#include <complex>
#include <deque>
#include <iterator>
#include <numeric>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
#include <functional>
#include <cassert>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
#define ALL(v) v.begin(),v.end()
template < class T > inline bool chmax(T& a, T b) {if (a < b) { a=b; return true; } return false; }
template < class T > inline bool chmin(T& a, T b) {if (a > b) { a=b; return true; } return false; }
#define DEBUG_VLL(vec) REP(sz, vec.size()) std::cerr<<vec[sz]<<(sz==vec.size()-1?'\n':' ');

const long long MOD = 1000000007;
const long long HIGHINF = (long long)1e18;
const int INF = (int)1e9;

ll n, m;
vll a;

ll gcd(ll a, ll b) {
    if (b == 0) return a;
    else return gcd(b, a % b);
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n >> m;
    a.resize(n);
    for (ll i = 0; i < n; i++) cin >> a[i];
    vll hafa(n);
    for (ll i = 0; i < n; i++) hafa[i] = a[i] / 2;
    ll lcm = 1;
    for (ll i = 0; i < n; i++) {
        ll g = gcd(hafa[i], lcm);
        lcm *= hafa[i] / g;
    }
    
    for (ll i = 0; i < n; i++) {
        if (!((lcm / hafa[i]) & 1)) {
            cout << 0 << '\n';
            return 0;
        }
    }

    if (lcm > m) cout << 0 << '\n';
    else cout << (m - lcm) / (2 * lcm) + 1 << '\n';
    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;

int main() {
  int a, b;
  cin >> a >> b;
  if ((a <= 0 && 0 <= b) || a == 0 || b == 0) {
    cout << "Zero" << endl;
  } else if ((0 < a) || (b - a + 1) % 2 == 0) {
    cout << "Positive" << endl;
  } else {
    cout << "Negative" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
 
 int main()
{
 int a,b,f,r,v,i,j,n,k;

 int t[4][3][10]={0};

 scanf("%d",&n); 
 for(a=0;a<n;a++){
 scanf("%d%d%d%d",&b,&f,&r,&v);
 t[b-1][f-1][r-1]=t[b-1][f-1][r-1]+v;
                  }

for(k=0;k<4;k++){
                for(j=0;j<3;j++){
                                 for(i=0;i<10;i++){
                                                    printf(" %d",t[k][j][i]);
                                                   } 
                                 printf("\n");
                                  }                 
                 if(k==3){ 
                          break;
                          }
                 printf("####################\n");
                }
return 0;
}


Measured memory_bytes: 2052
#include <bits/stdc++.h>
#define ll long long
using namespace std;
ll x,k,d;
ll ans=LLONG_MAX;
ll myabs(ll x) {return (x<0?-x:x);}
int main() {
    ios::sync_with_stdio(false);cin.tie(0);cout.precision(10);cout << fixed;
#ifdef LOCAL_DEFINE
    freopen("input.txt", "r", stdin);
#endif
    cin>>x>>k>>d;
    if(x<0) x=-x;
    ll cnt=min(k, x/d);
    ll tk=k-cnt;
    ll temp=x-cnt*d;
    if(tk&1) {
        temp-=d;
        ans=min(ans, myabs(temp));
    } else{
        ans=min(ans, myabs(temp));
    }
    cnt=min(k, (x+d-1)/d);
    tk=k-cnt;
    temp=x-cnt*d;
    if(tk&1) {
        temp+=d;
        ans=min(ans, myabs(temp));
    } else{
        ans=min(ans, myabs(temp));
    }
    cout<<ans<<'\n';
#ifdef LOCAL_DEFINE
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
    return 0;
}


Measured memory_bytes: 3656
#include <bits/stdc++.h>
using namespace std;
#define  pi  acos(-1)
int main()
{
    double a,b,x,v,ans;
    cin>>a>>b>>x;
    v=a*a*b;
    if(v/2<=x)
    {
        ans=atan(2*(v-x)/(a*a*a));
    }
    else
    {
        ans=(pi/2)-atan(2*x/(a*b*b));
    }
    cout<<fixed<<setprecision(10)<<ans*(180/pi)<<"\n";
    return 0;
}


Measured memory_bytes: 256
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N = int(readline())
    F = [list(map(int, readline().split())) for _ in range(N)]
    P = [list(map(int, readline().split())) for _ in range(N)]

    ans = -INF
    for bits in range(1, 1 << 10):
        res = 0
        for i in range(N):
            c = 0
            for j in range(10):
                if F[i][j] and (bits & (1 << j)):
                    c += 1
            res += P[i][c]
        if ans < res:
            ans = res

    print(ans)
    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 9036
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
Max = sys.maxsize
def l(): #intのlist
	return list(map(int,input().split()))
def m(): #複数文字
	return map(int,input().split())
def onem(): #Nとかの取得
	return int(input())
def s(x): #圧縮
	a = []
	aa = x[0]
	su = 1
	for i in range(len(x)-1):
		if aa == x[i+1]:
			a.append([aa,su])
			aa = x[i+1]
			su = 1
		else:
			su += 1
	a.append([aa,su])
	return a
def jo(x): #listをスペースごとに分ける
	return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
	return max(map(max,x))

n,m= m()

if n*m > 0:
	print(n//m)
else:
	print(-(-n//m))


Measured memory_bytes: 6012
//Author ::  ABHINAV3010 ::

#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define fast ios_base::sync_with_stdio(false)
typedef long long ll;
typedef pair<ll,ll> p;
ll mod=1000000007;
ll gcd(ll a,ll b)
{
    return (b==0)?a:gcd(b,a%b);
}
ll power(ll x, ll y, ll p=mod)
{ll res = 1;x = x % p;while (y > 0){if (y & 1){res = (res*x) % p;}y = y>>1;x = (x*x) % p;}return res;}
int main()
{
fast;
ll h;
cin>>h;
ll cnt=0ll;
while(h>0)
{
    h=floor(h/2.0);
    cnt++;
}
ll ans=(ll)pow(2ll,cnt);
ans--;
cout<<ans<<endl;
return 0;
}


Measured memory_bytes: 512
#include <iostream>

using namespace std;

int main()
{
    int h, w, n;
    cin >> h >> w >> n;

    int sr, sc;
    cin >> sr >> sc;

    std::string s;
    cin >> s;
    std::string t;
    cin >> t;

    bool onboard = true;
    int x, y;

    x = sc;
    for (int i = 0; i < n; i++) {
        if (s[i] == 'L')
            x--;
        if (x < 1) {
            onboard = false;
            goto End;
        }
        if (t[i] == 'R')
            x = min(x + 1, w);
    }

    x = sc;
    for (int i = 0; i < n; i++) {
        if (s[i] == 'R')
            x++;
        if (x > w) {
            onboard = false;
            goto End;
        }
        if (t[i] == 'L')
            x = max(x - 1, 1);
    }

    y = sr;
    for (int i = 0; i < n; i++) {
        if (s[i] == 'U')
            y--;
        if (y < 1) {
            onboard = false;
            goto End;
        }
        if (t[i] == 'D')
            y = min(y + 1, h);
    }

    y = sr;
    for (int i = 0; i < n; i++) {
        if (s[i] == 'D')
            y++;
        if (y > h) {
            onboard = false;
            goto End;
        }
        if (t[i] == 'U')
            y = max(y - 1, 1);
    }

End:
    cout << (onboard ? "YES" : "NO") << endl;

    return 0;
}


Measured memory_bytes: 776
#include<bits/stdc++.h>
using namespace std;
int main()
{
    
    int r,d,x;
    cin>>r>>d>>x;
    for(int i=0;i<10;i++)
    {
        cout<<r*x-d<<"\n";
        x=r*x-d;
    }
    
    
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#define MAXLEN 1024
#define MIN 3
#define MAX 6

int main(int argc, char *argv[]){
     int n, f=1; char buf[MAXLEN];
     
     n=0;
     while((buf[n]=getchar())!=EOF){
	  if(buf[n]==' ' || buf[n]==',' || buf[n]=='.'){
	       if(n>=MIN && n<=MAX){
		    if(!f) printf(" "); else f=0;
		    buf[n]='\0', printf("%s",buf);
	       }
	       n=0;
	  }

	  else n++;
     }

     puts("");

     return 0;
}

Measured memory_bytes: 0
x,n=map(int,input().split())
P=list(map(int,input().split()))
P=set(P)
if not(x in P):
    print(x)
else:
    i=1
    while True:
        if not(x-i in P):
            print(x-i)
            break
        elif not(x+i in P):
            print(x+i)
            break       
        i+=1

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, n) for (int i = 1; i <= (int)(n); i++)
using ll = long long;
using P = pair<ll,ll>;
#define pb push_back
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; }

/*
 string -> int : stoi(S);
 int -> string : to_string(N);
 Sのn文字以降をm文字取り出す : S.substr(n,m)
cout << fixed << setprecision(2) << 3.14 << endl; //3.1

 int: -2,147,483,648 ～ 2,147,483,647 (2×10^9)
 ll: -9,223,372,036,854,775,808 ~ 9,223,372,036,854,775,807 (9×10^18)

*/

int main() {

  ll n, m, count=0;
  string s;
 
  cin >> n;

  vector<vector<int>> u(n);
  vector<vector<int>> w(n);  
  vector<int> ans(n,-1);

  int a,b,c;

  rep(i,n-1){
    cin >> a >> b >> c;
    a--;
    b--;
    u[a].pb(b);
    u[b].pb(a);
    w[a].pb(c%2);
    w[b].pb(c%2);
  }

  queue<int> q;
  q.push(0);
  ans[0]=0;

  while(!q.empty()){
    int l=q.front();
    q.pop();
    int size = u[l].size();
    rep(i,size){
      int to = u[l][i];
      if(ans[to]!=-1) continue;
      q.push(to);
      int a = ans[l];
      if(a==0){
        if(w[l][i]==0) ans[to]=0;
        else ans[to]=1;
      }
      else {
        if(w[l][i]==0) ans[to]=1;
        else ans[to]=0;
      }
    }
  }
  

  rep(i,n) cout << ans[i] << endl;
}

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

int main(void){
    
    string k_l = "qwertasdfgzxcvb";
    string k_r = "yuiophjklnm";
    while(1) {
        string s;
        cin >> s;
        int result = 0;
        int mode = -1;
        if (s == "#") break;
        for(int i=0; i<s.length(); i++) {
            if ((int)k_r.find(s[i]) >= 0) {
                if (mode==0) result += 1;
                mode = 1;
            } else {
                if (mode==1) result += 1;
                mode = 0;
            }
        }
        cout << result << endl;
    }
    
}

Measured memory_bytes: 1192
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <iomanip>
#include <cassert>
#include <cstring>
#include <sstream>
#include <numeric>
#include <cstdio>
#include <bitset>

using namespace std;

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

#define pb push_back
#define F first
#define S second
#define _sz(x) ((int)x.size())

#define int ll

const int N = 2e5 + 20;
int n;

ld a[N], b[N], c[N];

ld f[N], E[N];

int sz, stk[N];

int L[N], R[N];
bool mark[N];

inline bool is_bigger (pii a, pii b) {
    return (ld)a.F * b.S > (ld)b.F * a.S;
}

int32_t main()
{
    ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);

    cin >> n;

    int mx = 0;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        if (a[i] > a[mx]) mx = i;
    }
    
    for (int i = 0; i < n; i++) cin >> b[i];

    rotate(a, a + mx, a + n);
    rotate(b, b + mx, b + n);

    a[n] = a[0];

    c[0] = c[1] = 0;
    for (int i = 2; i <= n; i++) {
        c[i] = 2 * c[i - 1] + 2 * b[i - 1] - c[i - 2];
    }


    for (int i = 0; i <= n; i++) a[i] -= c[i];

    stk[sz++] = 0;
    
    for (int i = 1; i <= n; i++) {
        while (sz >= 2 && ((a[i] - a[stk[sz - 2]]) / (i - stk[sz - 2])) > ((a[stk[sz - 1]] - a[stk[sz - 2]]) / (stk[sz - 1] - stk[sz - 2]))) {
            sz--;
        }
        stk[sz++] = i; 
    }

    for (int i = 0; i < sz; i++) {
        mark[stk[i]] = 1;
        f[stk[i]] = a[stk[i]];
    }

    for (int i = 0; i <= n; i++) {
        if (mark[i]) L[i] = i;
        else L[i] = L[i - 1];
    }

    for (int i = n; i >= 0; i--) {
        if (mark[i]) R[i] = i;
        else R[i] = R[i + 1];
    }

    for (int i = 0; i <= n; i++) {
        if (mark[i]) continue;

        f[i] = (f[L[i]] * (R[i] - i) + f[R[i]] * (i - L[i])) / (R[i] - L[i]);
    }

    for (int i = 0; i <= n; i++) E[i] = f[i] + c[i];
    
    ld sum = 0;
    for (int i = 0; i < n; i++) sum += E[i];



    ld result = sum / n;

    cout << fixed << setprecision(10) << result << '\n';
}


Measured memory_bytes: 24036
package main

import (
	"fmt"
	"math"
)

func main() {
	var a, b int
	fmt.Scan(&a, &b)

	var stringA, stringB int
	for i := 0; i < b; i++ {
		stringA += a * int(math.Pow(10, float64(i)))
	}
	for i := 0; i < a; i++ {
		stringB += b * int(math.Pow(10, float64(i)))
	}
	if stringA >= stringB {
		fmt.Println(stringA)
	} else {
		fmt.Println(stringB)
	}
}


Measured memory_bytes: 512
MOD = 10**9 + 7

strL = input().rstrip()

maxD = len(strL)

dp = [[0]*(2) for _ in range(maxD+1)]
dp[0][0] = 1
for d, Ld in enumerate(strL):
    Ld = int(Ld)
    for isLT in range(2):
        dp[d][isLT] %= MOD
        for a, b in [(0, 0), (0, 1), (1, 0)]:
            if not isLT and a+b > Ld: continue
            isLT2 = isLT or a+b < Ld
            dp[d+1][isLT2] += dp[d][isLT]

ans = (dp[-1][0] + dp[-1][1]) % MOD
print(ans)


Measured memory_bytes: 19752
#include<bits/stdc++.h>
using namespace std;
const int maxn=1e5+5;
const int inf=0x3f3f3f3f;
int a[maxn];
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	int x,n;
	cin>>x>>n;
	for(int i=1;i<=n;i++)
	{
		int tmp;
		cin>>tmp;
		a[tmp]++;
	}
	int c=0,flag=-1;
	while(1)
	{
		int tmp=x-c;
		if(a[tmp]==0)
		{
			flag=0;
			break;
		}
		tmp=x+c;
		if(a[tmp]==0)
		{
			flag=1;
			break;
		}
		c++;
	}
	if(flag==0)
		cout<<x-c;
	else if(flag==1)
		cout<<x+c;
	return 0;
}




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

#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define RFOR(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define LL long long
#define INF INT_MAX

const double EPS = 1e-14;
const double PI  = acos(-1.0);


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

  regex re("A?KIHA?BA?RA?");
  if (regex_match(s, re)) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
}


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

int main() {
  int N;
  cin >> N;
  int ans;

  // ここにプログラムを追記
  for(int i=0;i<N;i++){
    int l,r;
    cin >>l>>r;
    ans +=r-l+1;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
package main

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

var scanner = bufio.NewScanner(os.Stdin)

func main() {
	for scanner.Scan() {
		n, _ := strconv.Atoi(scanner.Text())
		if n == 0 {
			break
		}
		ans := make([]int, 7)
		for i := 0; i < n; i++ {
			scanner.Scan()
			a, _ := strconv.Atoi(scanner.Text())
			switch {
			case a < 10:
				ans[0]++
			case 10 <= a && a < 20:
				ans[1]++
			case 20 <= a && a < 30:
				ans[2]++
			case 30 <= a && a < 40:
				ans[3]++
			case 40 <= a && a < 50:
				ans[4]++
			case 50 <= a && a < 60:
				ans[5]++
			case 60 <= a:
				ans[6]++
			}
		}
		for i := range ans {
			fmt.Println(ans[i])
		}
	}
}


Measured memory_bytes: 3164
parseInt(x)=parse(Int,x)
parseMap(x::Array{SubString{String},1})=map(parseInt,x)

function main()
	n = readline() |> parseInt
	e = [Int[] for i in 1:n]
	for i in 1:n-1
		a,b = readline() |> split |> parseMap
		push!(e[a],b)
		push!(e[b],a)
	end
	vst = zeros(Int,n)
	vst.-=1
	vst[1] = 0
	vc = 1
	stack = Int[]
	for i in 1:length(e[1])
		push!(stack,e[1][i])
		vst[e[1][i]] = 1
		vc += 1
	end
	bef = 0
	now = 1
	while !isempty(stack) && vc < n
		now = shift!(stack)
		for i in 1:length(e[now])
			if vst[e[now][i]] < 0
				push!(stack,e[now][i])
				vst[e[now][i]] = vst[now] + 1
				vc += 1
			end
		end
	end
	u = indmax(vst)
	vst = zeros(Int,n)
	vst.-=1
	vst[u] = 0
	vc = 1
	stack = Int[]
	for i in 1:length(e[u])
		push!(stack,e[u][i])
		vst[e[u][i]] = 1
		vc += 1
	end
	bef = 0
	now = 1
	while !isempty(stack) && vc < n
		now = shift!(stack)
		for i in 1:length(e[now])
			if vst[e[now][i]] < 0
				push!(stack,e[now][i])
				vst[e[now][i]] = vst[now] + 1
				vc += 1
			end
		end
	end
	d = maximum(vst)
	println(d%3==1?"Second":"First")
end
main()


Measured memory_bytes: 169952
#include <iostream>
#include <algorithm>
#include <string>
#include <cstdio>
#include <cmath>

using namespace std;

int main(){
	int H, W;
	while (true){
		cin >> H >> W;
		if (H == 0 && W == 0) break;
		for (int i = 0; i < W; i++) cout << "#";
		cout << endl;
		for (int j = 0; j < H - 2; j++){
			cout << "#";
			for (int k = 0; k < W - 2; k++){
				cout << ".";
			}
			cout << "#" << endl;
		}
		for (int l = 0; l < W; l++) cout << "#";
		cout << endl;
		cout << endl;
	}
	return 0;
}

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

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

	for(int n, m; cin >> n >> m && (n | m);) {
		vector<int> times{0};
		times.reserve(n + m + 1);

		for(int i = 0; i < n; ++i) {
			int t;
			cin >> t;
			times.emplace_back(t);
		}

		for(int j = 0; j < m; ++j) {
			int t;
			cin >> t;
			times.emplace_back(t);
		}

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

		int ans = 0;
		for(unsigned i = 1; i < times.size(); ++i) {
			ans = max(ans, times[i] - times[i - 1]);
		}

		cout << ans << endl;
	}

	return 0;
}

Measured memory_bytes: 1292
#include<iostream>
#include<algorithm>
#include<string>
#include<sstream>
#include<iomanip>
#include<limits>
#include<deque>
#include<map>
#include<list>
#include<set>
#include <unordered_set>
#include<vector>
#include<cmath>
#include<cstdio>

using namespace std;



int main() {
	int n; cin >> n;
	int h[n];
	int ans = 0;
	for (int i = 0; i < n; i++) { cin >> h[i]; }

	while (*max_element(h, h + n) != 0) {
		int mi = 100;
		int z;
		for (int i = 0; i < n; i++) {
			if ((h[i] != 0) && mi >= h[i]) {
				int tmp = h[i];
				mi = tmp;
				z = i;
			}
		}

		for (int i=z; i < n; i++) {
			if (h[i] != 0) { h[i] -= 1; }
			else { break; }
		}
		for (int i=z-1; i >= 0; i--) {
			if (h[i] != 0) { h[i] -= 1; }
			else { break; }
		}
		ans++;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main() {
  int n, *a;
  cin >> n;
  a = new int[n];

  for(int i=0; i<n; i++) {
    cin >> a[i];
  }
  for(int i=n-1; i>0; i--) {
    cout << a[i] << " ";
  }
  cout << a[0] << "\n";
  return 0;
}



Measured memory_bytes: 3080
#include<bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
#define int long long
bool used[50];
typedef pair<int,int>P;
int n,k,a[100001];
signed main(){
  cin>>n>>k;
  int ans=0;
  r(i,n)cin>>a[i];
  if(a[0]>k)ans+=a[0]-k,a[0]=k;
  for(int i=1;i<n;i++){
    if(a[i-1]+a[i]>k){
      int t=k-a[i-1];
      ans+=a[i]-t;
      a[i]=t;
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 1024