akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define sanyes ios_base::sync_with_stdio(0), cout.tie(0); cin.tie(0);
#define llong long long int
#define pb push_back
#define bpc __builtin_popcount
#define f first
#define s second

const llong mxn = 1e5 + 7;
const llong mod = 1e9 + 7;
const llong inf = 1e18 + 9;

using namespace std;

llong n, l, r, a[mxn], dp[mxn][2], cnt = 0, sum = 0;

string s;

int main(){
    cin >> s;
    for (int i = 0; i < s.size(); i ++){
        if(s[i] != '0'){
            cnt ++;
        }
    }if(cnt == 1 && s[0] == '1'){
        cout << 10;
        return 0;
    }for (int i = 0; i < s.size(); i ++){
        sum += (s[i] - '0');
    }cout << sum;
    return 0;
}


Measured memory_bytes: 256
while True:
    a,op,b=input().split()
    if op=="?":
        break
    a=int(a)
    b=int(b)
    if op=="+":
        print(int(a+b))
    elif op=="-":
        print(int(a-b))
    elif op=="*":
        print(int(a*b))
    else :
        print(int(a/b))


Measured memory_bytes: 5596
#include"bits/stdc++.h"
using namespace std;
using ll=long long;
using ull=unsigned long long;
constexpr auto inf=static_cast<ll>(1e18);
template<typename T=ll>inline T in(){T ret;cin>>ret;return ret;}
template<typename T=ll>inline auto vec2(size_t h,size_t w,T v=T()){return vector<vector<T>>(h,vector<T>(w,v));}
inline void setp(int n){cout<<fixed<<setprecision(n);}
inline void delnl(){cin.ignore(numeric_limits<streamsize>::max(),'\n');}

int main()
{
    cout<<[](ll x){return x*x;}(in())<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i, s, n) for (int i = (s); i < (n); ++i)
#define rrep(i, n, g) for (int i = (n)-1; i >= (g); --i)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define len(x) (int)(x).size()
#define dup(x, y) (((x) + (y)-1) / (y))
#define pb push_back
#define Field(T) vector<vector<T>>
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
  char a;
  cin >> a;
  if(a=='a'||a=='i'||a=='u'||a=='e'||a=='o')
  cout << "vowel"<< endl;
  else
    cout << "consonant" << endl;
}

Measured memory_bytes: 3632
from collections import defaultdict

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

D = defaultdict(int)
for a in A:
  D[a] += 1

ans = 0
for a, x in D.items():
  if x >= a:
    ans += x-a
  else:
    ans += x

print(ans)

Measured memory_bytes: 22304
use proconio::*;
use proconio::marker::*;

#[fastout]
fn run() {
    input! {
        s: Bytes,
    }
    let ans = if s.iter().all(|c| *c == b'R') {
        3
    } else if s.windows(2).any(|s| s == [b'R', b'R']) {
        2
    } else if s.iter().any(|p| *p == b'R') {
        1
    } else {
        0
    };
    println!("{}", ans);
}

fn main() {
    run();
}

Measured memory_bytes: 2160
#include <stdio.h>
 
int main() {
	
	int n, a[100];
	scanf("%d", &n);
	for(int i = 0; i < n; ++i) { //配列aをn個出力
		scanf("%d", &a[i]);
	}
	for(int i = n-1; i >= 0; --i) { //n個の出力された数字を逆順に出力
		printf("%d", a[i]);
		if(i != 0) {
			printf(" ");
		} else {
			printf("\n");
		}
	}
	return 0;
}


Measured memory_bytes: 2036
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P  = pair<ll, ll>;

#define FOR(i,a,b)      for(ll (i)=a;(i)<(b);++(i))
#define RFOR(i,a,b)     for(ll (i)=a;(i)>=(b);--(i))
#define REP(i,n)        FOR(i,0,n)
#define RREP(i,n)       RFOR(i,n,0)
#define ALL(v)          (v).begin(),(v).end()
#define BIT(n)          (1LL<<(n))
#define IN(x,l,r)       ((l)<=(x)&&(x)<=(r))
#define INCLUDE(s,v)    (s.find(v)!=string::npos)
#define LEN(s)          (string(s)).length()
#define SHOW(x)         cout<<#x<<" = "<<x<<endl
#define SORT(v)         sort(ALL(v))
#define SZ(v)           (ll)(v).size()
#define UNIQ(v)         SORT(v);(v).erase(unique(ALL(v)),(v).end())
#define PERM(v)         for(bool p=1;p;p=next_permutation(ALL(v)))
#define PQ(T)           priority_queue<T,vector<T>,greater<T>>
#define REPLACE(s,f,t)  for(auto p=s.find(f);p!=string::npos;p=s.find(f,p+LEN(t)))s.replace(p,LEN(f),t);

template<class T>string join(const vector<T>& v,string d=" ") {stringstream s;REP(i,SZ(v))s<<d<<v[i];return s.str().substr(LEN(d));}
template<class T>ostream& operator<<(ostream& o,const vector<T>& v) {o<<"{";if(SZ(v))o<<join(v,", ");o<<"}";return o;}
template<class T,class U>ostream& operator<<(ostream& o,const pair<T,U>& p) {o<<"(";o<<p.first<<", "<<p.second;o<<")";return o;}

const ll INF = 1e15;
const ll MOD = 1e9+7;
const double EPS = 1e-10;

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

int main() {
    string S; cin >> S;
    
    string T = S;
    REPLACE(T, "x", "");
    
    ll TN = LEN(T);
    REP(i, TN) if (T[i] != T[TN-1-i]) {
        cout << -1 << endl;
        return 0;
    }
    
    ll ans = 0;
    
    ll SN = LEN(S);
    ll l = 0;
    ll r = SN-1;
    while (l < r) {
        if (S[l] == S[r]) {
            l++;
            r--;
        } else if (S[l] == 'x') {
            l++;
            ans++;
        } else if (S[r] == 'x') {
            r--;
            ans++;
        }
    }
    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 512
#include<iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int main(){

  int a;
  string s;
  cin >> a >> s;
  
  if(a >= 3200){
  	cout << s <<endl;
  	return 0;
  }
  cout << "red" <<endl;
  
  return 0;
}



Measured memory_bytes: 256
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
//#include <utility>
#include <set>
#include <iostream>
//#include <memory>
#include <string>
#include <vector>
#include <algorithm>
//#include <functional>
#include <sstream>
//#include <deque>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
//#include <cctype>
#include <cstring>
//#include <ctime>
#include <iterator>
#include <bitset>
//#include <numeric>
//#include <list>
//#include <iomanip>

#if __cplusplus >= 201103L
#include <array>
#include <tuple>
#include <initializer_list>
#include <unordered_set>
#include <unordered_map>
#include <forward_list>

#define cauto const auto&
#else

#endif

using namespace std;


namespace{
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
    v.assign(a, vector<T>(b, t));
}

template <class F, class T>
void convert(const F &f, T &t){
    stringstream ss;
    ss << f;
    ss >> t;
}


#define reep(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) reep((i),0,(n))
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define F first
#define S second
#define mkp make_pair
#define RALL(v) (v).rbegin(),(v).rend()


#define MOD 1000000007LL
#define EPS 1e-8
static const int INF=1<<24;
vvint vv,tt,ans;
int dd[]={0,1,0,-1,0};
bool check(int y,int x){
	if(0<=y&&y<10&&0<=x&&x<10) return true;
	return false;
}
void foo(int y,int x){
	tt[y][x]=1-tt[y][x];
	rep(i,4){
		if(check(y+dd[i],x+dd[i+1])) tt[y+dd[i]][x+dd[i+1]]=1-tt[y+dd[i]][x+dd[i+1]];
	}
}
void mainmain(){
	int n;
	cin>>n;
	rep(g,n){
		// vvint vv;
		initvv(vv,10,10);
		rep(i,10) rep(j,10) cin>>vv[i][j];
		rep(i,1<<10){
			tt=vv;
			initvv(ans,10,10,0);
			rep(j,10){
				if(i&(1<<j)){
					ans[0][j]=1;
					foo(0,j);
				}
			}
			reep(j,1,10){
				rep(k,10){
					if(tt[j-1][k]==1){
						ans[j][k]=1;
						foo(j,k);
					}
				}
			}
			bool f=true;
			rep(j,10){
				if(tt[9][j]==1){
					f=false;
					break;
				}
			}
			if(f){
				rep(j,10){
					rep(k,10){
						if(k) cout<<" ";
						cout<<ans[j][k];
					}
					cout<<endl;
				}
				break;
			}
		}
	}
}



}
main() try{
    mainmain();
}
catch(...){
}

Measured memory_bytes: 1212
#include <bits/stdc++.h>
using namespace std;
const char *pat = "hpb";
const int pos[] = {1, 1, 0, 2, 0, 0, 1, 0, 1, 0};
int main() {
	int T = 1;
	// scanf("%d", &T);
	for(int Case = 1; Case <= T; ++Case) {
		int n;
		scanf("%d", &n);
		printf("%con\n", pat[pos[n % 10]]);
	}
	return 0;
}

Measured memory_bytes: 3752
//java 11.0.1 2018-10-16 LTS

import java.util.*;

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

		char c = s.toCharArray()[0];
		int i = (int)c;
		i++;
		
		System.out.println((char)i);
	}
}

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

public class Main {
    public static void main(String[] args) {
        try {
            char alpha[] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};
            // 標準入力
            InputStreamReader isr = new InputStreamReader(System.in);
            BufferedReader br = new BufferedReader(isr);
            int n = Integer.parseInt(br.readLine());
            String strArr[] = new String[n];
            for (int i = 0; i < n; i++) {
                strArr[i] = br.readLine();
            }
            for (int i = 0; i < 26; i++) {
                boolean flag = true;
                int min = 0;
                for (int j = 0; j < n; j++) {
                    int temp = getCharCount(strArr[j], alpha[i]);
                    if (flag || min > temp) {
                        min = temp;
                        flag = false;
                    }
                }
                if (min > 0) {
                    for (int k = 0; k < min; k++) {
                        System.out.print(alpha[i]);
                    }
                }

            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    public static int getCharCount(String str, char target) {
        int count = 0;
        for (char ch : str.toCharArray()) {
            if (ch == target) {
                count++;
            }
        }
        return count;
    }
}

Measured memory_bytes: 23252
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define int long long
using namespace std;
typedef vector<int>   vint;
typedef pair<int,int> pint;

int cnt1[100005],cnt2[100005];

signed main()
{   
    int N; cin>>N;
    REP(i,N){
        int t; cin>>t;
        if(i%2==0)
            cnt1[t]++;
        else
            cnt2[t]++;
    }
    
    vector<pint> v1,v2;
    for(int i=1;i<=100000;i++) v1.push_back(pint(cnt1[i],i));
    for(int i=1;i<=100000;i++) v2.push_back(pint(cnt2[i],i));
    sort(ALL(v1),greater<pint>());
    sort(ALL(v2),greater<pint>());

    int ans;
    if(v1[0].second!=v2[0].second)
        ans=N-(v1[0].first+v2[0].first);
    else
        ans=N-max(v1[0].first+v2[1].first,v1[1].first+v2[0].first);
    cout<<ans<<endl;

}


Measured memory_bytes: 6384
#include<iostream>
#include<vector>
#include<queue>
#include<stack>
#include<string>
#include<cmath>
#include<algorithm>
#include<bitset>
#include<map>
#include<functional>
#include<set>
#include<numeric>

#pragma region
using namespace std;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define rep(i,n) FOR(i,0LL,n)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define rrep(i,n) RFOR(i,0LL,n)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define COUNT(a,x,y) upper_bound(all(a), y) - lower_bound(all(a), x)
#define UNIQUE(a) sort(all(a)); a.erase(unique(all(a)), a.end())
#define SUM(a) accumulate(all(a),0LL)
#define scan(x) scanf("%lld",&x)
#define pb push_back
typedef long long int ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef vector<string> vs;
typedef map<ll, ll> MAP;
typedef set<ll> SET;
typedef double D;
const ll inf = 2222222222222222222LL;
const ll mod = 1000000007LL;
const D pi = acos(-1);
const D eps = 1e-10;

ll n = 0, m = 0, ans = 0, cnt = 0, tmp = 0, ma = -inf, mi = inf;
string s;
bool ok, flag;
ll dx[5] = { 1,-1,0,0,0 }, dy[5] = { 0,0,1,-1,0 };
ll ddx[9] = { 1,-1,0,0,1,1,-1,-1,0 }, ddy[9] = { 0,0,1,-1,1,-1,1,-1,0 };
#pragma endregion
#define MAX 111111


int main(void) {
  cin >> n;
  vll a(n);
  rep(i, n) scan(a[i]);
  ma = SUM(a) - n;
  cout << ma << endl;


  return 0;
}

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

namespace NTL1C
{
    public class Program
    {
        void Solve(StreamScanner ss, StreamWriter sw)
        {
            //---------------------------------
            var N = ss.Next(int.Parse);
            var A = ss.Next(long.Parse, N);
            sw.WriteLine(A.Aggregate(MathX.Lcm));
            //---------------------------------
        }

        static void Main()
        {
            var ss = new StreamScanner(new StreamReader(Console.OpenStandardInput()));
            var sw = new StreamWriter(Console.OpenStandardOutput()) {AutoFlush = false};
            new Program().Solve(ss, sw);
            sw.Flush();
        }
    }

    public static partial class MathX
    {
        public static long Gcd(long a, long b)
        {
            return b == 0 ? a : Gcd(b, a % b);
        }

        public static long Lcm(long a, long b)
        {
            return checked(a * (b / Gcd(a, b)));
        }
    }

    public class StreamScanner
    {
        static readonly char[] Sep = {' '};
        readonly Queue<string> buffer = new Queue<string>();
        readonly TextReader textReader;

        public StreamScanner(TextReader textReader)
        {
            this.textReader = textReader;
        }

        public T Next<T>(Func<string, T> parser)
        {
            if (buffer.Count != 0) return parser(buffer.Dequeue());
            var nextStrings = textReader.ReadLine().Split(Sep, StringSplitOptions.RemoveEmptyEntries);
            foreach (var nextString in nextStrings) buffer.Enqueue(nextString);
            return Next(parser);
        }

        public T[] Next<T>(Func<string, T> parser, int x)
        {
            var ret = new T[x];
            for (var i = 0; i < x; ++i) ret[i] = Next(parser);
            return ret;
        }

        public T[][] Next<T>(Func<string, T> parser, int x, int y)
        {
            var ret = new T[y][];
            for (var i = 0; i < y; ++i) ret[i] = Next(parser, x);
            return ret;
        }
    }
}


Measured memory_bytes: 10504
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair< ll, ll > Pi;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep2(i,n) for(int i=1;i<=(n);i++)
#define rep3(i,i0,n) for(int i=i0;i<(n);i++)
#define pb push_back
#define mod 1000000007
const ll INF = 1LL << 60;
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; }
ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}
#define all(x) x.begin(), x.end()
#define mp make_pair
bool compare(Pi a, Pi b) {
    if(a.first != b.first){
        return a.first < b.first;
        
    }else{
        return a.second < b.second;
    }
}


bool In_map(ll y,ll x,ll h,ll w){
    if(y<0 || x<0 || y>=h || x>=w){
        return 0;
    }else{
        return 1;
    }
}
const vector<ll> dx{1,0,-1,0};
const vector<ll> dy{0,1,0,-1};


int main() {
    ll A,B,C;
    cin >>A>>B>>C;
    
    cout << max({A,B,C})*9+A+B+C << endl;


    return 0;
    

}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using mii = map<int, int>;
using mll = map<ll, ll>;
using vi = vector<int>;
using vii = vector<vi>;
using vpi = vector<pii>;
using vl = vector<ll>;
using vll = vector<vl>;
using vpl = vector<pll>;
using vs = vector<string>;

int main()
{
    int n, k;
    cin >> n >> k;
    vi hs(n);
    for(int i=0; i<n; i++) cin >> hs.at(i);
    int cnt = 0;
    for(auto h : hs)
    {
        if(h >= k) cnt++;
    }
    cout << cnt << endl;

    return 0;
}


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

using namespace std;

int main(){
  int X;
  cin >> X;
  
  int a = X / 500;
  int b = (X - a * 500) / 5;
  int ret = a *1000 + 5 * b;
  
  cout << ret;
  return 0;
}

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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------


void solve() {
    int i,j,k,l,r,x,y;
    int N;
    string s;
    bool exit = false;
    cin >> N;
    vector<int> V;
    FOR(i,25){
        FOR(j,13){
            x = 4*i + 7*j;
            if(x==0) continue;
            if(x>100) continue;
            
            if(find(ALL(V), x) != V.end()) continue;
            V.push_back(x);
        }
    }
    //FORR(x, V) cout<<x<<endl;
    FOR(i, V.size()){
        if(N==V[i]){
            cout<<"Yes"<<endl;
            return;
        }
    }
    if(N==0){
        cout<<"Yes"<<endl;
        return;
    }
    cout<<"No"<<endl;
    return;
    /*cin>>N;
    vector<ll> V;
    FOR(x,N+1) {
            FOR(y,N+1) {
                    ll ret=1;
                    FOR(i,x) ret*=2;
                    FOR(i,y) ret*=5;
                    V.push_back(ret);
            }
    }
    sort(ALL(V));
    FORR(v,V) cout<<v<<endl;*/
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}



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

int main() {
    string s;
    cin >> s;
    if((s[5] == '0' && s[6] > '4') || s[5] > '0'){
        cout << "TBD" << endl;
    }else if(s[5] == '0' && s[6] == '4' && s[8] == '3' && s[9] == '0'){
        cout << "Heisei" << endl;
    }else{
        cout << "Heisei" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include <stdio.h>
#include<iostream>
#include<iomanip>
#include<cmath>
#include<array>
#include<vector>
#include<set>
#include <utility>
#include <map>
#include<bitset>

using namespace std;



int main(){
int n,k; cin>>n>>k;

long long ans=0;

for(int i=k+1;i<=n;i++){
  ans+=(n/i)*(i-k);
  if(n%i==0){continue;}
  else {ans+=max(n%i-max((k-1),0),0); }

}
cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <cmath>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <set>
#include <map>
#include <iterator>
#include <stack>
#include <string.h>
#include <cstdlib>
#include <queue>
#include <list>
#include <string>
#define rep(i,n) for(int i = 0; i < (n); i++) 
using namespace std;


int main() {
	long long int a,b,c;
	vector<int> data;
	string str;
	string str2;
	cin >> str;
	cin >> str2;
	bool flag = true;
	rep(i,str.size()) {
		if (str[i] != str2[i]) {
			flag = false;
			break;
		}
	}		
	if(flag) {
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}
	
	return 0;
}


Measured memory_bytes: 3624
#include <string.h>
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <istream>
#define INF 2147483647
#define LLINF 9223372036854775807
typedef long long ll;
using namespace std;
long double a[200010];
long double num[200010];
int main(){
	int n,k;
	cin>>n>>k;
	for(int i=0;i<n;i++){
		cin>>a[i];
		num[i]=(a[i]+1.00)/2.00;
	}
	long double ans=0.00;
	long double mx=0.00;
	for(int i=0;i<k;i++){
		ans+=num[i];
	}
	mx=max(mx,ans);
//	cout<<ans<<endl;
	for(int i=0;i<n-k;i++){
		ans-=num[i];
		ans+=num[i+k];
//		cout<<ans<<" "<<i+k-1<<" "<<endl;
		mx=max(mx,ans);
	}
	cout<<fixed<<setprecision(1)<<mx<<endl;
	return 0;
}

Measured memory_bytes: 6528
import sys
stdin = sys.stdin

sys.setrecursionlimit(10 ** 7)

def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x) - 1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())


a,b = li()
print(max(0, -(-(b-1) // (a-1))))

Measured memory_bytes: 3064
S = input()
mod = 10 ** 9 + 7
count = 0
leftA = (1 if S[0] == "A" else 0)
leftQ = (1 if S[0] == "?" else 0)
rightC = S[1:].count("C")
rightQ = S[1:].count("?")

def mult(a, b, mod):
    if b == 0:
        return a
    else:
        return ((3*a + b) * pow(3, b-1, mod))

for i in range(1,len(S)-1):
    if S[i] == "B" or S[i] == "?":
        rightQ -= (1 if S[i] == "?" else 0)
        count += mult(leftA, leftQ, mod) * mult(rightC, rightQ, mod)
        count %= mod
        leftQ += (1 if S[i] == "?" else 0)
    elif S[i] == "A":
        leftA += 1 
    else:
        rightC -= 1
print(count)

Measured memory_bytes: 3188
import java.io.*;
import java.util.*;
import java.util.function.*;

final class Solver {
	void solve(Supplier<String> sc) {
		int N = Integer.parseInt(sc.get());
		int[] count = new int[N + 1];
		for (int x = 1; x <= 100; x++) {
			for (int y = 1; y <= 100; y++) {
				for (int z = 1; z <= 100; z++) {
					var res = (long) x * x + y * y + z * z + x * y + y * z + z * x;
					if (0 < res && res < count.length) count[(int) res]++;
				}
			}
		}
		for (int i = 1; i < count.length; i++) {
			System.out.println(count[i]);
		}
	}
}

class Main {
	public static void main(String... args) {
		System.setOut(new PrintStream(new BufferedOutputStream(System.out)));
		var reader = new BufferedReader(new InputStreamReader(System.in));
		new Solver().solve(new Supplier<>() {
			StringTokenizer line;

			public String get() {
				while (line == null || !line.hasMoreTokens()) try {
					line = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new UncheckedIOException(e);
				}
				return line.nextToken();
			}
		});
		System.out.flush();
	}
}

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

using namespace std;

int main(){
ios_base::sync_with_stdio(0);cin.tie(0);
int a,b;
cin >> a >> b;
if(a>b) cout<< 2*a-1;
else if (a==b) cout << 2*a;
else cout << 2*b-1;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)
#define N 100000
typedef long long ll;
#define ALL(v) (v).begin(),(v).end()
#define SZ(x) int(x.size())
#define OUT(a) cout<<(a)<<endl
#define VECIN(type, c, n) vector<type> c(n);for(auto& i:c) cin>>i;

int main(){
	int n;
    cin>>n;
    vector<int> a(n);
    map<int,int> m;
    REP(i,n){
        cin>>a[i];
        m[a[i]-1]++;
        m[a[i]]++;
        m[a[i]+1]++;
    }
    int ans=0;
    for(auto p:m){
        ans=max(ans,p.second);
    }
    OUT(ans);

    
    
	return 0;
}

Measured memory_bytes: 5120
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define shosu(n) setprecision(n)
using namespace std;
int main() {
  int a, b, c;
  cin >> a >> b >> c;
  if (a < b && b < c)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 3036
#include <bits/stdc++.h>
using namespace std; 
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0); 
	long long N; cin >> N; 
	long long pow[13] = {}; 
	pow[1] = 26; 
	long long sum[13] = {}; 
	sum[1] = 26; 
	for(int i = 2; i <= 12; i++){
		pow[i] = pow[i-1] * 26; 
		sum[i] = sum[i-1] + pow[i]; 
	}
	int D = lower_bound(sum, sum + 13, N) - sum; 
	long long num = N - sum[D-1] - 1; 
	string S; 
	for(int i = 0; i < D; i++){
		S.push_back('a' + num % 26); 
		num /= 26; 
	}
	reverse(S.begin(), S.end()); 
	cout << S << "\n"; 
}

Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<n;++i)
typedef long long ll;
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}

int main(){
   int n;
   cin >> n;
   vector<int> a(n),b(n),c(n-1);
   rep(i,n) cin >> a[i];
   rep(i,n) cin >> b[i];
   rep(i,n-1) cin >> c[i];
   int sum=0;
   rep(i,n){
      sum+=b[a[i]-1];
      if(i){
         if(a[i-1]+1==a[i]) sum += c[a[i-1]-1];
      }
   }

   cout << sum << endl;
   return 0;
}


Measured memory_bytes: 256
n,k=map(int,input().split())
ab=[]
for i in range(n):
    a,b=map(int,input().split())
    ab.append([a,b])
abc=sorted(ab,key=lambda x:x[0])
temp=0
for j in abc:
    temp+=j[1]
    if temp>=k:
        print(j[0])
        exit()

Measured memory_bytes: 92956
import scala.io.StdIn._
object Main extends App {
  val Array(a, b, c, d) = readLine.split(" ").map(_.toLong)
  def gcd(l: Long, r: Long): Long = if (l % r == 0) r else gcd(r, l % r)
  val lcm = c * d / gcd(c, d)
  def num(div: Long): Long = b / div - (a - 1) / div
  println(b - (a - 1) - (num(c) + num(d) - num(lcm)))
}

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

#define int long long int
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define endl "\n"

int32_t main()
{
	IOS;
	int a,b,h;
  	cin>>a>>b>>h;
  	cout<<h*(a+b)/2<<endl;

	return 0;
}

Measured memory_bytes: 256
#!usr/bin/env python3
from collections import defaultdict
from heapq import heappush, heappop
import sys
import math
import bisect
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return list(sys.stdin.readline())
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
mod = 1000000007

#A
"""
a, b = LI()
print((a+b+1)//2)
"""

#B
"""
a = S()
a = a[:-1]
b = S()
b = b[:-1]
a.sort()
b.sort(reverse=True)
if a < b:
    print("Yes")
else:
    print("No")
"""

#C
n = I()
a = LI()
a.sort()
seta = set(a)
ans = 0
for i in seta:
    x = bisect.bisect_right(a,i) - bisect.bisect_left(a,i)
    if x != 0 and x >= i:
        ans += x - i
    else:
        ans += x
print(ans)        

Measured memory_bytes: 60712
c=int(input())
b=int(input())
a=int(input())
t=int(input())
t=t//50
m=0
sum=0
while(m<=a):
	n=0
	while(n<=b):
		o=0
		while(o<=c):
			if(m+(2*n)+(10*o)==t):
				sum+=1
			o+=1
			if(m+(2*n)+(10*o)>t):
				break
		n+=1
	m+=1			
print(sum)

Measured memory_bytes: 3064
import java.util.*;
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int K = sc.nextInt();
        int X = sc.nextInt();
        int Y = sc.nextInt();
        int M;
        if(N >= K){
            M = K * X + (N - K) * Y;
            System.out.println(M);
        }else{
            M = N * X;
            System.out.println(M);
        }
    }
}

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

int main() {
  int w, h, n;
  cin >> w >> h >> n;
  vector<int> x(n), y(n), a(n);
  for (int i = 0; i < n; ++i) {
    cin >> x.at(i) >> y.at(i) >> a.at(i);
  }

  vector<vector<bool>> area(w, vector<bool>(h, true));
  for (int i = 0; i < n; ++i) {
    switch (a.at(i)) {
      case 1:
        for (int j = 0; j < x.at(i); j++) {
          for (int k = 0; k < h; k++) {
            area.at(j).at(k) = false;
          }
        }
        break;
      case 2:
        for (int j = x.at(i); j < w; j++) {
          for (int k = 0; k < h; k++) {
            area.at(j).at(k) = false;
          }
        }
        break;
      case 3:
        for (int j = 0; j < w; j++) {
          for (int k = 0; k < y.at(i); k++) {
            area.at(j).at(k) = false;
          }
        }
        break;
      case 4:
        for (int j = 0; j < w; j++) {
          for (int k = y.at(i); k < h; k++) {
            area.at(j).at(k) = false;
          }
        }
        break;
    }
  }

  int count = 0;
  for (int i = 0; i < w; i++) {
    for (int j = 0; j < h; j++) {
      if (area.at(i).at(j) == true) count++;
    }
  }
  cout << count << endl;
}

Measured memory_bytes: 256
N, M = map(int, input().split())
set_a = set([int(input()) for _ in range(M)])
MOD = 10**9 + 7

dp = [0] * (N + 1)
dp[0] = 1
dp[1] = 0 if 1 in set_a else 1
for i in range(2, N+1):
    dp[i] = 0 if i in set_a else dp[i-1] + dp[i-2]
ans = dp[N] % MOD

print(ans)

Measured memory_bytes: 460020
#include<bits/stdc++.h>
#define ll long long

using namespace std;

int main()
{
	ll a,b,T;
	cin>>a>>b>>T;
	ll t=a;
	ll tmp=a;
	ll ans=0;
	while(t<=T)
	{
		tmp+=a;
		t+=a;
		ans+=b;
	}
	cout<<ans<<endl;
	return 0;
 } 

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector> 
#include<limits>
#include<numeric>
#include<type_traits>
#include<math.h>
#include<fstream>
#include<set>
using namespace std;
typedef long long ll;

#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++)
#define out(str) cout << str << endl
#define ALL(a) (a).begin(),(a).end()
#define INF (1<<29)

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; }

char now;
int N,ans=1;
string S;

int main(){
    cin>>N>>S;
    now=S[0];
    rep(i,N){
        if(S[i]!=now){
            now=S[i];
            ans++;
        }
    }
    out(ans);
    
    
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  int s=0;
  int s2=0;
  for(int i=0;i<n;i++){
    int a;
    cin>>a;
    s+=a;
    s2+=a*a;
  }
  cout<<(s*s-s2)/2<<endl;
}

Measured memory_bytes: 256
// 単に貪欲法で解く
#include <iostream>
#include <algorithm>

using namespace std;

struct Task {
  long long a;
  long long b;
  
  bool operator<(const Task& other) {
    return b < other.b;
  }
};

int main() {
  int n,a,b;
  cin >> n;
  Task tasks[n];
  for (int i = 0; i < n; i++) {
    cin >> a;
    cin >> b;
    
    tasks[i] = {a, b};
  }
  sort(tasks, tasks + n);
  
  long long time = 0;
  for(Task &task : tasks) {
    time += task.a;
    if (time > task.b) {
      cout << "No" << endl;
      return 0;
    }
  }
  
  cout << "Yes" << endl;
  return 0;
}

Measured memory_bytes: 3328
#include <iostream>
#include <math.h>
using namespace std;
using ll = long long;

int main() {
	int k, n, a[200000], ans, length = 0, length_max = 0;
	cin >> k >> n;

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

	for (int i = 0; i < n; i++) {
		length = ((a[i] - a[(i == 0) ? n - 1 : i - 1]) + k) % k;
		if (length > k / 2)
			length = k - length;
		if (length_max < length || i == 0)
			length_max = length;
	}

	ans = k - length_max;

	cout << ans << endl;
}

Measured memory_bytes: 1024
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>

#define MAX_N (100000)
#define rep(i, n) for(int64_t i = 0; i < (n); i++)

typedef struct {
  int A;
  int B;
} st_nums;

int nums_sort(const void *a, const void *b) {
  return (((st_nums*)a)->A - ((st_nums*)b)->A);
}

int main(void) {
  int64_t N, K;
  scanf("%ld %ld", &N, &K);

  st_nums NUM[MAX_N];
  rep(i, N) {
    scanf("%d %d", &NUM[i].A, &NUM[i].B);
  }
  qsort(NUM, N, sizeof(st_nums), nums_sort);

  int64_t ANS;
  int64_t SUM = 0;
  rep(i, N) {
    SUM += NUM[i].B;
    if(SUM >= K) {
      ANS = NUM[i].A;
      break;
    }
  }
  printf("%ld\n", ANS);
  return 0;
}


Measured memory_bytes: 1788
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<utility>
#include<cmath>
#include<string>
#include<cstring>
#include<map>
#include<queue>
#include<set>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define prin(arg) cout<<arg<<"\n"
#define prin2(arg1,arg2) cout<<arg1<<" "<<arg2<<"\n"
#define fill(arg,n) memset(arg,n,sizeof(arg))
#define mp make_pair
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<int,int> pi;
typedef vector<int> vi;
typedef vector<pi> vpi;
typedef set<int> si;
typedef string str;
const int INF=1e+9;
const ll INFLL=1e+17;
const ll MOD=1e+9+7;
int N,K;
vpi v;
int main(){
  cin>>N>>K;
  int c=(N-1)*(N-2)/2;
  if(c<K){
    prin(-1);
    return 0;
  }
  rep(i,N-1){
    v.pb(mp(1,i+2));
  }
  int n=c-K,m=N-2,t=2;
  while(n>0){
    rep(i,min(m,n)){
      v.pb(mp(t,t+i+1));
    }
    n-=m;
    m--;
    t++;
  }
  prin(v.size());
  rep(i,v.size()){
    prin2(v[i].first,v[i].second);
  }
  
  return 0;
}


Measured memory_bytes: 384
@n = gets.to_i
@list = @n.pred.times.collect { gets.split.collect(&:to_i) }

def run(i, t)
  if i >= @n.pred
    return t
  end
  c, s, f = @list[i]
  if t < s
    t = s
  else
    unless (t % f).zero?
      t = t + f - (t % f)
    end
  end
  t += c
  run(i + 1, t)
end

@n.times do |i|
  puts run(i, 0)
end


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

const int RLEN=1<<18|1;
inline char nc() {
    static char ibuf[RLEN],*ib,*ob;
    (ib==ob) && (ob=(ib=ibuf)+fread(ibuf,1,RLEN,stdin));
    return (ib==ob) ? -1 : *ib++;
}
inline int rd() {
    char ch=nc(); int i=0,f=1;
    while(!isdigit(ch)) {if(ch=='-')f=-1; ch=nc();}
    while(isdigit(ch)) {i=(i<<1)+(i<<3)+ch-'0'; ch=nc();}
    return i*f;
}

const int N=1e5+50;
int n,k,mxd[N],del[N],ans;
vector <int> edge[N];
inline void dfs(int x,int f) {
    for(auto v:edge[x]) {
        dfs(v,x);
        if(!del[v]) mxd[x]=max(mxd[x],mxd[v]+1);
    }
    if(mxd[x]==k-1 && f>1) del[x]=1, ++ans;
}
int main() {
    n=rd(), k=rd(), ans+=(rd()!=1);
    for(int i=2;i<=n;i++) edge[rd()].push_back(i);
    dfs(1,0); cout<<ans<<'\n';
}

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

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  int maxabc = max(max(a,b),c);
  if (a+b+c-maxabc==maxabc) cout << "Yes" << endl;
  else cout << "No" << endl;
}


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const int INF = 1000000000;

int main() {
    map<int,bool>mp;

    int a, b, c;
    cin >> a >> b >> c;

    int ans = 0;
    ans++;
    mp[a] = true;

    if (!mp[b]){
        ans++;
        mp[b] = true;
    }

    if (! mp[c])ans++;
    cout << ans << endl;
}

Measured memory_bytes: 256
#pragma GCC optimize(3,"Ofast","inline")
#include<bits/stdc++.h>
#define IOS ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define ms(a,b) memset(a,b,sizeof(a))
#define msn(a,n,b) for(int i=0;i<=n;i++)a[i]=b
#define lson l,mid,rt<<1
#define rson mid+1,r,rt<<1|1
#define fi first
#define se second
using namespace std;
mt19937 rng_32(chrono::steady_clock::now().time_since_epoch().count());
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef double db;
const int mod=998244353;
const int seed=233;
const double PI=acos(-1.0);
const double eps=1e-7;
const int inf=0x3f3f3f3f;
const int max_n=100005;
ll ceil(ll x,ll y){if(x==0)return 0;if(y<0)x=-x,y=-y;bool sign=x>0;x=abs(x);return sign?(x+y-1)/y:-x/y;}
ll floor(ll x,ll y){if(x==0)return 0;if(y<0)x=-x,y=-y;bool sign=x>0;x=abs(x);return sign?x/y:-(x+y-1)/y;}
namespace {
    inline int Add(int x,int y){return (x+=y)>=mod?x-mod:x;}
    inline int Sub(int x,int y){return (x-=y)<0?x+mod:x;}
    inline int Mul(int x,int y) {return 1ll*x*y%mod;}
    inline int Pow(int x,int y=mod-2){if(y==0)return 1;int res=1;while(y){if(y&1)res=1ll*res*x%mod;x=1ll*x*x%mod;y>>=1;}return res;}
}
/**********************head************************/
int n;
int p2[max_n];
P p[max_n];
int main(){
    scanf("%d",&n);
    p2[0]=1;
    for(int i=1;i<=n;i++)p2[i]=Mul(p2[i-1],2);
    for(int i=1;i<=n;i++)scanf("%d%d",&p[i].fi,&p[i].se);
    int ans=n+1;
    map<P,int> mp;
    for(int i=1;i<=n;i++){
        mp.clear();
        for(int j=i+1;j<=n;j++){
            int x=p[j].fi-p[i].fi,y=p[j].se-p[i].se;
            int d=__gcd(x,y);
            x/=d,y/=d;
            if(x<0)x=-x,y=-y;
            else if(x==0&&y<0)y=-y;
            mp[P(x,y)]++;
        }
        for(int j=1;j<i;j++){
            int x=p[j].fi-p[i].fi,y=p[j].se-p[i].se;
            int d=__gcd(x,y);
            x/=d,y/=d;
            if(x<0)x=-x,y=-y;
            else if(x==0&&y<0)y=-y;
            mp[P(x,y)]=0;
        }
        for(auto p:mp){
            if(p.se){
                int c=p.se+1;
                ans=Add(ans,Sub(p2[c],c+1));
            }
        }
    }
    ans=Sub(p2[n],ans);
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, a) for(int i=0; i<(a); i++)
typedef long long ll;
template<typename T>
struct edge {
  int src, to;
  T cost;
  edge(int to, T cost) : src(-1), to(to), cost(cost) {}
  edge(int src, int to, T cost) : src(src), to(to), cost(cost) {}
  edge &operator=(const int &x) {
    to = x;
    return *this;
  }
  operator int() const { return to; }
};
template<typename T>
using Edges = vector<edge<T>>;
template<typename T>
using WeightedGraph = vector<Edges<T>>;
using UnWeightedGraph = vector<vector<int>>;
template<typename T>
using Matrix = vector<vector<T>>;

/////////////////////////////////////////////////////////////////////
const ll inf = 1LL<<60;

int main()
{
  ll d; cin>>d;
  vector<ll> c(26);
  rep(i, 26) cin>>c[i];
  vector<vector<ll>> s(d, vector<ll>(26));
  rep(i, d) rep(j, 26) cin>>s[i][j];

  vector<ll> ans(d);
  vector<ll> sc(26);
  vector<ll> last(26, -1);
  rep(i, d) {
    ll t = 0;
    ll ma = -inf;
    rep(j, 26) {
      if (s[i][j] > ma) {
        ma = s[i][j];
        t = j;
      } else if (s[i][j] == ma) {
        if (sc[j] < sc[t]) {
          t = j;
        }
      }
    }
    last[t] = i;
    ans[i] = t;
    rep(j, 26) {
      if (t == j) sc[j] += s[i][j];
      else sc[j] -= c[j]*(i-last[j]);
    }
  }

  rep(i, d) cout << ans[i]+1 << endl;

  return 0;
}


Measured memory_bytes: 3720
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(v) (v).begin(),(v).end()
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
typedef pair<int, int> P;
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;
const ll MOD = 1e9+7;
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

int main() {
    string S;
    cin >> S;
    cout << S.substr(0,4) << ' ' << S.substr(4) << endl;
	return 0;
}


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

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

  using ldouble= long double;
  using coord= pair<ldouble, ldouble>;

  vector<coord> data(N);
  ldouble bufx, bufy;
  for(int i=0; i<N; i++){
    cin >> bufx >> bufy;
    data.at(i)= make_pair(bufx, bufy);
  }

  vector<vector<ldouble>> dists_by2(N, vector<ldouble>(N));
  vector<vector<coord>> midpoints(N, vector<coord>(N));
  vector<vector<coord>> normals(N, vector<coord>(N));
  for(int i=0; i<N; i++){
    for(int j= i+1; j<N; j++){
      auto [x_i, y_i]= data.at(i);
      auto [x_j, y_j]= data.at(j);

      ldouble x_m= (x_i+ x_j)/ 2.0L;
      ldouble y_m= (y_i+ y_j)/ 2.0L;
      ldouble dist= sqrt((x_j- x_i)*(x_j- x_i) + (y_j- y_i)*(y_j- y_i));

      dists_by2.at(i).at(j)= dist/ 2.0L;
      midpoints.at(i).at(j)= make_pair(x_m, y_m);
      normals.at(i).at(j)= make_pair(-(y_j- y_i)/dist, (x_j- x_i)/dist);
    }
  }

  constexpr ldouble eps= 1e-7;
  ldouble inc= sqrt(2.0L)* 500;
  ldouble exc= 0.0L;
  while(abs(inc- exc) > eps){
    ldouble mid= (inc+ exc)/ 2;

    auto is_inc= [&](ldouble mid){
      bool bool_mid= false;
      for(int i=0; i<N; i++){
        for(int j= i+1; j<N; j++){
          ldouble h= dists_by2.at(i).at(j);
          auto [x_m, y_m]= midpoints.at(i).at(j);
          auto [nx, ny]= normals.at(i).at(j);

          if(mid < h){ continue; }
          else{
            ldouble d_norm= sqrt(mid*mid - h*h);

            ldouble x_cand1= x_m+ d_norm* nx;
            ldouble y_cand1= y_m+ d_norm* ny;

            ldouble x_cand2= x_m- d_norm* nx;
            ldouble y_cand2= y_m- d_norm* ny;

            bool cand1= true;
            for(auto [x,y]:data){
              if((x- x_cand1)*(x- x_cand1)+ (y- y_cand1)*(y- y_cand1) > (mid+eps)*(mid+eps)){
                cand1= false;
                break;
              }
            }
            
            bool cand2= true;
            for(auto [x,y]:data){
              if((x- x_cand2)*(x- x_cand2)+ (y- y_cand2)*(y- y_cand2) > (mid+eps)*(mid+eps)){
                cand2= false;
                break;
              }
            }

            if(cand1 or cand2){
              bool_mid= true;
              break;
            }
          }
        }
        if(bool_mid){ break; }
      }

      return bool_mid;
    };

    if(is_inc(mid)){ inc= mid; }
    else           { exc= mid; }
  }
  
  cout << fixed;
  cout << setprecision(6) << inc << endl;
}

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

#define ll long long
#define ar array

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

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

#define all(c) (c).begin(), (c).end()
#define sz(x) (int)(x).size()

#define F_OR(i, a, b, s) for (int i = (a); ((s) > 0 ? i < (b) : i > (b)); i += (s))
#define F_OR1(e) F_OR(i, 0, e, 1)
#define F_OR2(i, e) F_OR(i, 0, e, 1)
#define F_OR3(i, b, e) F_OR(i, b, e, 1)
#define F_OR4(i, b, e, s) F_OR(i, b, e, s)
#define GET5(a, b, c, d, e, ...) e
#define F_ORC(...) GET5(__VA_ARGS__, F_OR4, F_OR3, F_OR2, F_OR1)
#define FOR(...) F_ORC(__VA_ARGS__)(__VA_ARGS__)

#define E_ACH2(x, a) for (auto& x: a)
#define E_ACH3(x, y, a) for (auto& [x, y]: a)
#define E_ACH4(x, y, z, a) for (auto& [x, y, z]: a)
#define E_ACHC(...) GET5(__VA_ARGS__, E_ACH4, E_ACH3, E_ACH2)
#define EACH(...) E_ACHC(__VA_ARGS__)(__VA_ARGS__)

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

	int n;
	cin >> n;
	vector<int> a(n);
	FOR(n)
		cin >> a[i];
	sort(all(a), greater<int>());
	vector<ll> b;
	FOR(n) {
		b.push_back(a[i]);
		if(i)
			b.push_back(a[i]);
	}
	ll ans=0;
	FOR(n-1)
		ans+=b[i];
	cout << ans;
}

Measured memory_bytes: 8212
#include <bits/stdc++.h>
using namespace std;
int main() {
  int a,b,c,d,e,k; cin >> a >> b >> c >> d >> e >> k;
  vector<int> An(5);
  bool ans = true;
  
  An ={a,b,c,d,e};
  for(int i=0; i<5; i++) {
    for(int j=0; j<5; j++) {
      if(i != j && i < j) {
        if(An.at(j) - An.at(i) > k) ans = false;
      }
    }
  }
  if(ans==false) cout << ":(" << endl;
  else cout << "Yay!" << endl;
}

Measured memory_bytes: 3580
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define fi first
#define se second
#define PI (acos(-1))

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;
}
template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){
	int len=d.size();
	rep(i,len){
		s<<d[i];if(i<len-1) s<<" ";
	}
	return s;
}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){
	int len=d.size();
	rep(i,len){
		s<<d[i]<<endl;
	}
	return s;
}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){
	s<<"{ ";
	for(auto itr=v.begin();itr!=v.end();++itr) {
		if (itr!=v.begin()) {s<< ", ";}
		s<<(*itr);
	}
	s<<" }";
	return s;
}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){
	s<<"{"<<endl;
	for(auto itr=m.begin();itr!=m.end();++itr){
		s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;
	}
	s<<"}"<<endl;
	return s;
}

const ll mod=1e9+7;
const ll inf=1e15;
const int INF=1e9;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int a,b;
	cin>>a>>b;
	vector<bool> now(3,true);
	a--,b--;
	now[a]=false,now[b]=false;
	rep(i,3){
		if(now[i]){
			cout<<i+1<<endl;
			return 0;
		}
	}
}

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

main() {
  int N,D,X;
  cin >> N >> D >> X;
  int cnt=0;
  vector<int> A(N);
  for(int i=0; i<N; i++){
    cin >> A[i];
    int c=1;
    while( c <= D ){
      cnt++;
      c += A[i];
    }
  }
  cout << cnt+X << endl;
  return 0;
}  

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include <cstdlib>  
#include <math.h>
#include <cmath>
#include<complex>
#include<cctype>
#include<string>
#include<set>
#include<iomanip>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include<bitset>
#include <deque>
#include <climits>
#include <typeinfo>
#include <utility> 
using namespace std;
using Complex = complex<double>;
using ll = long long;
template<typename T>using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
const ll inf = 1145141919810364364LL;
double PI = acos(-1.0);
#define all(x) (x).begin(),(x).end()
#define puts(x) cout << x << endl
#define rep(i,m,n) for(ll i = m;i < n;++i)
#define pb push_back
#define fore(i,a) for(auto &i:a)
#define rrep(i,m,n) for(ll i = m;i >= n;--i)

ll H, N;
ll A[1010], B[1010];
ll dp[1010][10101];

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

	cin >> H >> N;
	for (int i = 0; i < N; i++)cin >> A[i] >> B[i];
	for (int i = 0; i < 1010; i++)for (int j = 0; j < 10101; j++)dp[i][j] = inf;

	dp[0][0] = 0;
	for (int i = 0; i < N; i++) {
		dp[i][0] = 0;
		dp[i + 1][0] = 0;
		for (int j = 0; j <= H; j++) {
			dp[i + 1][j] = min(dp[i][j], dp[i+1][max(j-A[i],0LL)] + B[i]);
		}
	}
	puts(dp[N][H]);
	
	return 0;
}

Measured memory_bytes: 80000
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7

def LI(): return list(map(int,input().split()))
def I(): return int(input())
def LS(): return input().split()
def S(): return input()

def main():
  n=I()
  l=LI()

  mn=inf
  for i in range(len(l)):
    mn=min(mn,abs(sum(l[:i])-sum(l[i:])))

  return mn

print(main())


Measured memory_bytes: 6048