akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define lint                     long long 
#define setbits(x)              __builtin_popcountll(x)
#define zrbits(x)               __builtin_ctzll(x)
#define zlbits(x)               __builtin_clzll(x)
#define parsbits(x)             __builtin_parityll(x)
#define mem(a, b)               memset(a, (b), sizeof(a))
#define MOD                     1000000007
#define inf                     1e17 
#define neginf                  -1e17 
#define sp(x,y)                 fixed<<setprecision(x)<<y
#define testcase(t)             lint t; cin>>t; while(t--)
#define power(a,b)              (double)pow((double)a,(double)b)
#define FOR(i,n)                for(lint i=0;i<n;i++)
#define gcd(a,b)                __gcd(a,b)
#define PI                      3.1415926535
#define pb                      push_back
#define ss                      second
#define ff                      first
#define umap                    unordered_map           
#define ummap                   unordered_multimap
#define uset                    unordered_set
#define umset                   unordered_multiset

             
typedef unsigned long long   ull;

typedef tree<int,null_type,less<int>,rb_tree_tag,
tree_order_statistics_node_update> indexed_set;
         
void c_p_c()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
//    #ifndef ONLINE_JUDGE
  //  freopen("C:\\Users\\pranjal bhatt\\Desktop\\code contests\\input1.txt", "r", stdin);
    //freopen("C:\\Users\\pranjal bhatt\\Desktop\\code contests\\output1.txt", "w", stdout);
    //#endif
}

lint me(lint x, lint y, lint p)  
{  
    lint res = 1;     
     
    x = x % p; 
           
    if (x == 0) return 0; 
          
    while (y > 0)  
    {  
                
        if (y & 1)  
        res = (res*x) % p;  
          
                  
        y = y>>1;  
        x = (x*x) % p;  
    }  
    return res;  
}

    /*---------------------------SOLUTION---------------------------------*/

void solve()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    string s;
    cin>>s;
    lint n=s.length();
    stack<char> st;
    for(lint i=0;i<n;i++)
    {
        if(s[i]=='0')
            st.push('0');
        else if(s[i]=='1')
            st.push('1');
        else
        {
            if(st.empty())
                continue;
            else
                st.pop();
        }
    }
    string s1;
    while(!st.empty())
    {
        s1.pb(st.top());
        st.pop();
    }
    if(s1.length()==0)
    {
        cout<<""<<endl;
        return;
    }
    for(lint i=s1.length()-1;i>=0;i--)
    {
        cout<<s1[i];
    }

}


int main()
{
    c_p_c();
    lint flg99=0;
    if(flg99==1)
    {
        testcase(t)
        {
             solve();
        }
    }
    else
    {
        solve();
    }
    return 0;
            
}
                
            
                

                

                



Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll, ll> Pll;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define srep(i,l,n) for(int i = l; i < (int)(n); i++)
#define drep(i,n) for(int i = (int)(n-1); i >= 0; i--)
#define debug(var)  do{std::cout << #var << " : ";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }
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; }
void Yes(){cout << "Yes" << endl;}
void No(){cout << "No" << endl;}
void YES(){cout << "YES" << endl;}
void NO(){cout << "NO" << endl;}
void err() {cout << -1 << endl;}
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define pb push_back

const int MOD = 1000000007;
const int INF = 1e9;

#define PI acos(-1);
int dx[4] = {1,-1,0,0};
int dy[4] = {0,0,1,-1};
int ddx[8] = {1,1,1,-1,-1,-1,0,0};
int ddy[8] = {0,1,-1,0,1,-1,1,-1};


int main(){
    int n;
    cin >> n;
    vector<int> a(n), b(n);
    ll sum = 0;
    bool ok = false;
    rep(i, n) {
        cin >> a[i] >> b[i];
        if(a[i] != b[i]) ok = true;
        sum += a[i];
    }
    if(!ok) {
        cout << 0 << endl;
        return 0;
    }
    int mi = INF;
    rep(i, n) {
        if(a[i] > b[i]) chmin(mi, b[i]);
    }
    ll ans = sum - mi;
    cout << ans << endl;
}

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

#define f(a, b) for(auto i = a;i < b;i++)
typedef long long int ll;

void solve()
{
	return ;	
}

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

	ll y = n - (n/500)*500;
	cout << (n/500)*1000 + (y/5)*5 << "\n";
}

Measured memory_bytes: 256
#関数リスト
def main():
    import sys
    input = sys.stdin.readline

    def I(): return int(input())
    def MI(): return map(int, input().split())
    def LI(): return list(map(int, input().split()))
    def ruiseki(mydata):
        res = [0]*(len(mydata)+1)
        for i in range(len(mydata)):
            res[i+1] = res[i] + mydata[i]
        return res

    n, k , m = MI()
    a = ruiseki(LI())
    b = ruiseki(LI())

    result = 0
    index = k
    for i, ii in enumerate(a):
        if ii > m:
            break
        while b[index] + ii > m:
            index -= 1
        result = max(result, i+index)
    print(result)
    
main()


Measured memory_bytes: 120768
/*
Author: CNYALI_LK
LANG: C++
PROG: abc.cpp
Mail: cnyalilk@vip.qq.com
*/
#include<bits/stdc++.h>
#define debug(...) fprintf(stderr,__VA_ARGS__)
#define DEBUG printf("Passing [%s] in LINE %d\n",__FUNCTION__,__LINE__)
#define Debug debug("Passing [%s] in LINE %d\n",__FUNCTION__,__LINE__)
#define all(x) x.begin(),x.end()
using namespace std;
const double eps=1e-8;
const double pi=acos(-1.0);
typedef long long ll;
typedef pair<int,int> pii;
template<class T>int chkmin(T &a,T b){return a>b?a=b,1:0;}
template<class T>int chkmax(T &a,T b){return a<b?a=b,1:0;}
template<class T>T sqr(T a){return a*a;}
template<class T>T mmin(T a,T b){return a<b?a:b;}
template<class T>T mmax(T a,T b){return a>b?a:b;}
template<class T>T aabs(T a){return a<0?-a:a;}
#define min mmin
#define max mmax
#define abs aabs
int read(){
	int s=0,base=1;
	char c;
	while(!isdigit(c=getchar()))if(c=='-')base=-base;
	while(isdigit(c)){s=s*10+(c^48);c=getchar();}
	return s*base;
}
char WriteIntBuffer[1024];
template<class T>void write(T a,char end){
	int cnt=0,fu=1;
	if(a<0){putchar('-');fu=-1;}
	do{WriteIntBuffer[++cnt]=fu*(a%10)+'0';a/=10;}while(a);
	while(cnt){putchar(WriteIntBuffer[cnt]);--cnt;}
	putchar(end);
}
int a[1048576];
int main(){
#ifdef cnyali_lk
	freopen("abc.in","r",stdin);
	freopen("abc.out","w",stdout);
#endif
	int n,d=0,ans;
	n=read();
	for(int i=1;i<=n;++i){
		a[i]=read();
		d+=abs(a[i]-a[i-1]);
	}
	d+=abs(a[n]);
	for(int i=1;i<=n;++i){
		ans=d-abs(a[i]-a[i-1])-abs(a[i]-a[i+1])+abs(a[i-1]-a[i+1]);
		printf("%d\n",ans);
	}
	return 0;
}



Measured memory_bytes: 1664
#include <iostream>
#include <fstream>
#include <typeinfo>
#include <vector>
#include <stack>
#include <cmath>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <iomanip>
#include <cctype>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<28;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-10;
const ll mod=1e9+7;
const vi emp;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,-0};
const int DX[8]={-1,-1,-1,0,0,1,1,1},DY[8]={1,0,-1,1,-1,1,0,-1};

class Graph{
	private:
	int V;
	vvi List;
	public:
	Graph(int v){
		V=v;
		List=vvi(v);
	}
	void add_edge(int s,int t){
		List[s].push_back(t);
		List[t].push_back(s);
	}
	int solve(){
		vi a;
		set<int> s;
		s.insert(0);
		for(int i=0;i<List[0].size();i++){
			a.push_back(List[0][i]);
			s.insert(List[0][i]);
		}
		for(int i=0;i<a.size();i++) for(int j=0;j<List[a[i]].size();j++){
			int v=List[a[i]][j];
			s.insert(v);
		}
		return s.size()-1;
	}
};
\
int n,m;

int main(){
	while(1){
		cin>>n>>m;
		if(!n) break;
		Graph g(n);
		for(int i=0;i<m;i++){
			int s,t;
			cin>>s>>t;
			g.add_edge(s-1,t-1);
		}
		cout<<g.solve()<<endl;
	}
}

Measured memory_bytes: 3240
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
using namespace std;
#define rep(i, a, b) for(int i = a; i < (b); ++i)
typedef long long ll;
int main() {
    int N,M;
    cin >> N >> M;
    
    if(M==1 && 1==N){
        cout << 1 << endl;
        return 0;
    }
    if (N == 1 && 1 < M){
        cout << M-2 << endl;
        return 0;
    }
    if (M == 1 && 1 < N){
        cout << N-2 << endl;
        return 0;
    }
    ll ans = (ll)(N-2)*(M-2);
    cout << ans << endl;
    
    return 0;
}

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

// definition {{{ 1

// scaning {{{ 2
#define Scd(x) scanf("%d", &x)
#define Scd2(x,y) scanf("%d%d", &x, &y)
#define Scd3(x,y,z) scanf("%d%d%d", &x, &y, &z)

#define Scll(x) scanf("%llu", &x)
#define Scll2(x,y) scanf("%llu%llu", &x, &y)
#define Scll3(x,y,z) scanf("%llu%llu%llu", &x, &y, &z)

#define Scc(c) scanf("%c", &c);
#define Scs(s) scanf("%s", s);
#define Scstr(s) scanf("%s", &s);
// }}} 2

// constants {{{ 2
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
// }}} 2

// systems {{{ 2
#define Rep(x,y) for(int x = 0; x < y; x++)
#define Repe(x,y,z) for(int x = z; x < y; x++)
// }}} 2

// output {{{ 2
#define YesNo(a) (a)?printf("Yes\n"):printf("No\n");
// }}} 2

// }}} 1

int main() {

    int N,M;
    Scd2(N,M);

    vector<ll> dp(N+13);
    vector<bool> b(N+12,false);
    dp[0] += 1;

    vector<int> a(M);
    Rep(i,M){
        Scd(a[i]);
        b[a[i]] = true;
    }

    Rep(i,N){
        if( !b[i+1] ){
            dp[i+1] += dp[i];
            dp[i+1] %= 1000000007;
        }
        if( !b[i+2] ){
            dp[i+2] += dp[i];
            dp[i+2] %= 1000000007;
        }
    }

    printf ("%llu\n", dp[N] );

    return 0;
}



Measured memory_bytes: 1408
#include <iostream>
#include <map>
#define P pair<int,int>
using namespace std;
int main(){
  int N,n,d;
  map<int,P > m;
  while(cin>>N&&N){
    m[0] = P(0,0);
    P mx(0,0),mn(0,0);
    for( int i=1;i<N;i++ ){
      cin >> n >> d;
      P p=m[n];
      switch(d){
      case 0: p.first--;  break;
      case 1: p.second--; break;
      case 2: p.first++;  break;
      case 3: p.second++; break;
      }
      m[i] = p;
      mx.first  = max(mx.first,  p.first);
      mx.second = max(mx.second, p.second);
      mn.first  = min(mn.first,  p.first);
      mn.second = min(mn.second, p.second);
    }
    cout << (mx.first-mn.first+1) << " " << (mx.second-mn.second+1) << endl;
  }
  return 0;
}

Measured memory_bytes: 1208
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long; 
using pii =  pair<int, int>;
using pll =  pair<long long, long long>;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
//constexpr long long MOD = 998244353LL;
template<class T, class U> inline bool chmax(T &a, U b) { if (a < b) { a = b; return true;} return false; }
template<class T, class U> inline bool chmin(T &a, U b) { if (a > b) { a = b; return true;} return false; }
const ll INF = (ll)1e18 + 1;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    
    char b; cin >> b;
    char ans;
    if(b == 'A') ans = 'T';
    else if(b == 'T') ans = 'A';
    else if(b == 'G') ans = 'C';
    else ans = 'G';
    
    cout << ans << ln;
    return 0;
}

Measured memory_bytes: 256
a = int(raw_input())
b = int(raw_input())
def f(l, h, i):
    if i == 0:
        return h - l + 1
    t = (1 << i)
    if h < t:
        return f(l, h, i - 1)
    if l >= t:
        return f(l - t, h - t, i - 1)
    k = f(0, h - t, i - 1)
    if k >= l:
        return t - l + t
    else:
        return (t - l) * 2 + k
    return res
print f(a, b, 60)


Measured memory_bytes: 2568
#include <stdio.h>

int main(){
  int i,j,l,m,n;
  long a;

  while(scanf("%d",&n)!=EOF){
    a=0;
    if(n>2000) n=4000-n;
    if(n>1000) m=1001; else m=n+1;
    for(i=0;i<m;i++){
      for(j=0;j<m;j++){
        l=n-i-j;
        if(l<0) break; else if(l<=1000) a+=1+l; else if(l<=2000) a+=2001-l;
      }
    }
    printf("%ld\n",a);
  }
  return 0;
}

Measured memory_bytes: 596
#include<bits/stdc++.h>
//typedef long long int ll;
using namespace std;
void solve()
{
    int n;
    cin >> n;
    int cnt=0;
    if(n%1000==0)
    {
        cout << 0 << endl;
    }
    else
    {
        while(1)
        {
            if(n%1000==0)
            {
                break;
            }
            else
            {
                n++;
                cnt++;
            }
        }
        cout << cnt << endl;
    }
   

}
int main()
{
  /*int t;
    cin >> t;
    while(t--)
    {
        solve();
    }
  */ solve();
    return 0;
}

Measured memory_bytes: 3632
import java.util.Scanner;

public class Main{
	public static void main(String args[]){
		// 入力読み込み
		Scanner scan = new Scanner(System.in);
		String S = scan.next();
		// 入力終わり
		scan.close();

		// 文字列の数を取得
		int Slength = S.length();

		// 文字列を一文字ずつの配列に置き換え
		char[] tmp = S.toCharArray();

		// 回文にするために必要なハグの回数をカウントする変数
		int C = 0;

		// 両端から文字が一致しているか確認していく
		for(int i=0; i<Slength/2; i++){
			// 一致していない場合、カウント用変数をインクリメントする
			if(tmp[i]!=tmp[Slength-i-1]){
				C++;
			}
		}
		System.out.println(C);
	}
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
#define _itr ::iterator
#define forn(i, x, y) for (ll i = x; i < y; ++i)
#define ford(i, x, y) for (ll i = x; i > y; --i)
#define forne(i, x, y) for (ll i = x; i <= y; ++i)
#define forde(i, x, y) for (ll i = x; i >= y; --i)
#define rd(x) cin >> x; cin.ignore();
#define rdstr(x) getline(cin, x);
#define rdarr(x, y) for (ll i = 0; i < y; ++i) cin >> x[i];
#define rdmtr(x, y, z) for (ll i = 0; i < y; ++i) for (ll j = 0; j < z; ++j) cin >> x[i][j];
#define pb push_back

#define X first
#define Y second

using namespace std;
typedef long long ll;
typedef long double ld;

const ll MaxN = 1e6 + 7;
const ll MaxM = 5e3 + 7;
const ll MDL = 1e9 + 7;
const ll INF = 1e18 + 7;

typedef pair<ll, ll> pi;
typedef vector<ll> vi;
typedef ll arr[MaxN];

ll REPIT = 1;

const bool MQ = false;

ll n;
arr so, pr, app;

void Sieve(ll u)
{
    fill(app, app + u + 1, 0);
    fill(pr, pr + u + 1, -1);
    pr[0] = pr[1] = 1;
    for (ll i = 2; i <= u; ++i)
    {
        if (pr[i] >= 0) continue;
        pr[i] = i;
        for (ll j = i * i; j <= u; j += i)
        {
            if (pr[j] >= 0) continue;
            pr[j] = i;
        }
    }
}

void Factor(ll u)
{
    ll temp = u, cur = 0, c = 0;
    while (temp > 1)
    {
        if (cur != pr[temp])
        {
            ++app[cur];
            cur = pr[temp], c = 0;
        }
        ++c;
        temp /= pr[temp];
    }
    ++app[cur];
}

void Solve()
{
    cin >> n; rdarr(so, n);
    ll mx = *max_element(so, so + n);
    Sieve(mx);
    for (ll i = 0; i < n; ++i) Factor(so[i]);
    int ok = 2;
    for (ll i = 2; i <= mx; ++i)
    {
        if (pr[i] != i) continue;
        if (app[i] > 1)
        {
            --ok;
            break;
        }
    }
    if (ok == 2)
    {
        cout << "pairwise coprime";
        return;
    }
    ll r = so[0];
    forn(i, 1, n)
    {
        r = __gcd(r, so[i]);
        if (r == 1)
        {
        cout << "setwise coprime";
        return;
        }
    }
    cout << "not coprime";
}

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    #ifdef OFFLINE
    freopen("input.inp", "r", stdin);
    #endif
    if (MQ == true)
    {
        rd(REPIT);
    }
    while (REPIT--) Solve();
    cout.flush();
    #ifdef OFFLINE
    fclose(stdin);
    #endif
}


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

using namespace std;

void printArray(int array[3][10], int floors, int rooms)
{
	for(int i = 0; i < floors; i++)
	{	
		for(int j = 0; j < rooms; j++)
			printf(" %d", array[i][j]);
		printf("\n");
	}
}

int main()
{
	int buildingA[3][10] = {0}, buildingB[3][10] = {0}, buildingC[3][10] = {0}, buildingD[3][10] = {0};
	int n, b, f, r, v;
	
	scanf("%d", &n);
	
	for(int i = 0; i < n; i++)
	{
		scanf("%d %d %d %d", &b, &f, &r, &v);
		
		if(b == 1)
		{
			if(v > 0)
				buildingA[f-1][r-1] += v;
			else
			{
				if((buildingA[f-1][r-1] + v) >= 0)
					buildingA[f-1][r-1] += v;
				else
					buildingA[f-1][r-1] = 0;
			}
		}
			
		else if(b == 2)
		{
			if(v > 0)
				buildingB[f-1][r-1] += v;
			else
			{
				if((buildingB[f-1][r-1] + v) >= 0)
					buildingB[f-1][r-1] += v;
				else
					buildingB[f-1][r-1] = 0;
			}
		}
		else if(b == 3)
		{
			if(v > 0)
				buildingC[f-1][r-1] += v;
			else
			{
				if((buildingC[f-1][r-1] + v) >= 0)
					buildingC[f-1][r-1] += v;
				else
					buildingC[f-1][r-1] = 0;
			}
		}
		else
		{
			if(v > 0)
				buildingD[f-1][r-1] += v;
			else
			{
				if((buildingD[f-1][r-1] + v) >= 0)
					buildingD[f-1][r-1] += v;
				else
					buildingD[f-1][r-1] = 0;
			}
		}
	}
	
	printArray(buildingA, 3, 10);
	cout << string(20, '#') << "\n";
	printArray(buildingB, 3, 10);
	cout << string(20, '#') << "\n";
	printArray(buildingC, 3, 10);
	cout << string(20, '#') << "\n";
	printArray(buildingD, 3, 10);
	
	return 0;
}


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

// 型定義
typedef long long ll;
typedef pair<ll, ll> P;

// forループ
#define REP(i,n) for(ll i=0; i<(ll)(n); ++i)

// 定数宣言
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

// グラフ表現
using Graph = vector<vector<int>>;

// グラフの辺表現
using Edge = map<pair<int,int>,int>;

// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

// 最大公約数
ll gcd(ll a,ll b){
   if (a%b == 0) return(b);
   else return(gcd(b, a%b));
}

// 最小公倍数
ll lcm(ll a, ll b){
    return a*b/gcd(a, b);
}

int main()
{
    cout << fixed << setprecision(15);
    ll R, G;
    cin >> R >> G;

    cout << 2*G - R << endl;
    return 0;
}

Measured memory_bytes: 3592
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <numeric> // accumulate(v.begin(), v.end(), 0)

using namespace std;
#define ll long long

int main(){
  int H, W;
  cin >> H >> W;
  vector<string> A(H);
  vector<bool> row(H, true);
  vector<bool> col(W, true);
  for(int i=0; i<H; i++) {
    cin >> A[i];
    for(int j=0; j<W; j++) {
      if(A[i][j] == '#') {
	row[i] = false;
	col[j] = false;
      }
    }
  }
  
  for(int i=0; i<H; i++) {
    for(int j=0; j<W; j++) {
      if(!row[i] && !col[j]) {
	cout << A[i][j];
      }
    }
    if(!row[i])
      cout << endl;
  }
  
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
#define mk make_pair
#define se second
#define fi first
using namespace std;
int main(){
  int a[3];
  cin>>a[0]>>a[1]>>a[2];
  int s=a[0]*100+a[1]*10+a[2];
  if(s%4==0)cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
}

Measured memory_bytes: 256
n = int(input())
t, a = map(int, input().split())
h = list(map(int, input().split()))
min = 1000000
for i in range(n):
    temp = t - h[i]*0.006
    k = abs(a-temp)
    if min > k:
        min = k
        ans = i+1
print(ans)



Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(n) begin(n), end(n)
using ll = long long;
using namespace std;

int main(){
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  while(1){
    c -= b;
    if(c <= 0){
      cout << "Yes" << endl;
      return 0;
    }
    a -= d;
    if(a <= 0){
      cout << "No" << endl;
      return 0;
    }
  }
  return 0;
}

Measured memory_bytes: 3620
#if defined(__GNUC__)
#include <bits/stdc++.h>
#define __int32 __int32_t
// __GNUC__
#else
#include "bits/stdc++.h"
#endif
using namespace std;

#define int long long

#define itn __int32
#define REP(i, n) for(itn (i) = 0; (i) < (n); ++(i))
#define REP2(i, x, n) for(itn (i) = x; (i) < (n); ++(i))
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define SORT(x) std::sort(ALL(x))
#define RSORT(x) std::sort(ALL(x), greater<decltype(x)::value_type>())
#define RSORT2(x, T) std::sort(ALL(x), greater<T>())
#define REVERCE(x) std::reverce(ALL(x))
#define ACM(x, y) std::accumulate(ALL(x), y)

#define INT_POW(x, y) [](int a, int b) -> int {int c = a; REP(i, b - 1){c *= a;} return c;}(x, y)
#define INT_POWM(x, y, m) [](int a, int b, int m) -> int {int c = a; REP(i, b - 1){c *= a; c %= m;} return c;}(x, y, m)
#define FCT(x) [](int a) -> int {int r = 1; REP(i, a){r *= i;} return r;}(x)

// デバッグ用
#define PUT_LIST(x, y) std::copy(ALL(x), std::ostream_iterator<decltype(x)::value_type>(std::cout, y))

itn main() {
	std::ios::sync_with_stdio(false);

	int n, k;

	cin >> n >> k;

	int res = 0;

	while (n) {
		n /= k;
		++res;
	}

	cout << res;

	return 0;
}


Measured memory_bytes: 256
/***********************
*  Author: xuziyuan    * 
***********************/

#include <bits/stdc++.h>

#define rt0 return 0
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define replet(c) for(char c='a';c<='z';c++) 
#define LL long long
#define pii pair <int,int>
#define pb push_back
#define fi first
#define se second
#define mpr make_pair
#define sqr(a) ((a)*(a))

using namespace std;

const LL MOD=1e9+7;

int n,m,x,y,z,val[100010];
vector <pii> g[100010];

void dfs(int pos,int no,int co)
{
	if(val[pos]!=INT_MAX&&val[pos]!=co)
	{
		puts("No");
		exit(0);
	}
	if(val[pos]!=INT_MAX) return;
	val[pos]=co;
	rep(i,g[pos].size()) if(g[pos][i].fi!=no) dfs(g[pos][i].fi,pos,co+g[pos][i].se);
}

int main()
{
	cin>>n>>m;
	rep(i,m)
	{
		scanf("%d%d%d",&x,&y,&z);
		g[x].pb({y,z});
		g[y].pb({x,-z});
	}
	rep(i,100005) val[i]=INT_MAX;
	repn(i,n) if(val[i]==INT_MAX) dfs(i,0,0);
	puts("Yes");
	rt0;
}

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

using namespace std;

typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;

#define EPS 1e-14
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
#define INFLL (ll)1e18 //Long long infinity
#define INF (int)1e9 //Int infinity
#define MX 100005

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef vector<vd> vvd;
typedef vector<string> vstr;

#define us unordered_set
#define um unordered_map
#define bs bitset

#define RANGE(i,a,b,d) for (int i=min((int)a,(int)b); i<max((int)a,(int)b); i+=d)
#define RRANGE(i,a,b,d) for (int i=max((int)a,(int)b); i>min((int)a,(int)b); i+=d)
#define FOR(i,a,b) RANGE(i,a,b,1)
#define RFOR(i,a,b) RRANGE(i,a,b,-1)
#define REP(i,s) FOR(i,0,s)
#define RREP(i,s) RFOR(i,s-1,-1)
#define FORIT(it,l) for (auto it = l.begin(); it != l.end(); it++)
#define EACH(x,v) for (auto &x : v)

#define sz(x) (int)(x).size()
#define len(x) (int)sizeof(x)/sizeof(*x)
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define contains(m,x) (m.find(x) != m.end()) // check if an element in a map
#define isIn(S, s) (S.find(s) != string::npos) // check if substring

#define pv(v) EACH(x, v) cout << x << " "; cout << endl; // print vector/array
#define pvv(vv) EACH(xx, vv){pv(xx);} // print 2-d vector/2-d array
#define pm(m) EACH(x, m) cout << x.F << ":" << x.S << " "; cout << endl; //print map/lookup table

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

namespace std{
  // Used for hashing pair
  template <> struct hash<pi>{
    size_t operator()(const pi&x)const{
      ll P=38923, Q=109797901;
      return (size_t)((x.F*P+x.S)%Q);
    }
  };
};

// This is min queue
template<class T> using pqg = priority_queue<T, vector<T>, greater<T>>;

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

//Python style printing
template<typename T, typename... Args>
void print(T t, Args... args){
  cout << t << " ";
  print(args...);
}

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  map<string, ll> m;
  REP(i, n) {
    string s;
    cin >> s;
    sort(all(s));
    m[s]++;
  }
  ll sol = 0;
  EACH(s, m) {
    sol += (s.S * (s.S-1))/2;
  }
  cout << sol << endl;
  return 0;
}


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

using namespace std;

const int N = 100 * 1000 + 17;
const int MOD = 1000 * 1000 * 1000 + 7;

int n, k;
int a[N];

bool read() {
    if (!(cin >> n >> k))
        return false;

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

    return true;
}

void solve() {
    auto ans = 0ll;

    for (int l = 0; l <= n; ++l) {
        vector<int> v(a, a + l);

        for (int r = n - 1; r >= l - 1 && v.size() <= k; --r) {
            sort(v.begin(), v.end());
            auto sum = accumulate(v.begin(), v.end(), 0ll);
            ans = max(ans, sum);

            for (int j = 0; j < v.size() && v[j] < 0 && v.size() + j + 1 <= k; ++j)
                ans = max(ans, (sum -= v[j]));

            if (r >= l)
                v.push_back(a[r]);
        }
    }

    cout << ans << endl;
}

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    while (read())
        solve();

    return 0;
}



Measured memory_bytes: 256
N, x = map(int, input().split())
A = [0] + list(map(int, input().split()))
ans = 0
for i in range(N):
    if A[i] + A[i + 1] > x:
        tmp = A[i] + A[i + 1] - x
        ans += tmp
        A[i + 1] -= tmp
print(ans)


Measured memory_bytes: 19908
#include <bits/stdc++.h>
#define ll long long int
#define yorn(f) cout<<((f)?"Yes":"No")<<endl;
#define YORN(f) cout<<((f)?"YES":"NO")<<endl;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define println(x) cout << x << endl;
using namespace std;
int main()
{
    vector<int> x(5);
    rep(i, 5) cin >> x[i];
    int k;
    cin >> k;

    rep(i, 5) rep (j, 5) {
        if (abs(x[i] - x[j]) > k) {
            println(":(");
            return 0;
        }
    }
    
    println("Yay!");
    return 0;
}

Measured memory_bytes: 3600
#include<iostream>
#include<string>
#include<sstream>
using namespace std;

class Stack{
private:
  int sp;
  int S[100];
public:
  Stack(){
    sp=0;
  }
  bool isFull(){
    return (sp==100);
  }
  bool isEmpty(){
    return (sp==0);
  }
  void push(int d){
    if(isFull()){
      return;
    }
    S[sp++] = d;
  }
  void pop(){
    if(isEmpty()){
      return;
    }
    sp--;
  }
  int top(){
    if(isEmpty()){
      return -1;
    }
    return S[sp-1];
  }
};

int main(){
  Stack s;
  string expr;
  getline(cin, expr);

  istringstream is(expr);

  while(!is.eof()){
    string op;
    is >> op;

    int tmp1,tmp2;

    switch(op[0]){
      case'+':
        tmp1 = s.top();
        s.pop();
        tmp2 = s.top();
        s.pop();
        s.push(tmp2+tmp1);
        break;
      case'-':
        tmp1 = s.top();
        s.pop();
        tmp2 = s.top();
        s.pop();
        s.push(tmp2-tmp1);
        break;
      case'*':
        tmp1 = s.top();
        s.pop();
        tmp2 = s.top();
        s.pop();
        s.push(tmp2*tmp1);
        break;
      default:
        istringstream is2(op);
        is2 >> tmp1;
        s.push(tmp1);
        break;
    }
  }
  cout << s.top() << endl;

  return 0;
}



Measured memory_bytes: 3200
#include"bits/stdc++.h"
using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second

typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef pair<int, int> pii;

void Main()
{
	int n, a, b;
	cin >> n >> a >> b;
	auto wa = [&](int x){
		int sum = 0;
		while(x>0){
			sum += x%10;
			x /= 10;
		}      
		return sum;
	};
	ll ans = 0;    
	rep3(i,1,n){
		if(a <= wa(i) && wa(i) <= b) ans += i;
	}
	cout << ans << endl;
	return;
}

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

Measured memory_bytes: 256
import java.util.*;
import java.io.*;

class Main{
    public static void main(String args[])throws IOException{
      try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))){
        long H = Long.parseLong(br.readLine());
        long result = culcurate(H);
        
        System.out.println(result);
      }
    }

    public static long culcurate(long h){
      if(h == 1){
        return 1;
      }
      return 2*culcurate(h / 2) + 1;
    }
} 

Measured memory_bytes: 21204
using System;
using System.Collections.Generic;
using System.Linq;

namespace CSharpSample01
{
    

    class Program
    {

        static List<int> data;

        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());

            data = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToList();

            data.Sort((a, b) => b - a);

            long ans = 0;


            int s = 0;
            int t = 0;

            int i;
            int j;

            int tmp = 0;
            int u = data.First();

            for(i = 0; i < N; i++)
            {
                
                if(u == data[i])
                {
                    tmp++;
                    if(tmp == 2)
                    {
                        s = u;
                        j = i;
                        break;
                    }
                }
                else
                {
                    u = data[i];
                    tmp = 1;
                }
                
            }


            if (i + 1 < N) u = data[i + 1];

            tmp = 1;

            for (j = i + 2; j < N; j++)
            {

                if (u == data[j])
                {
                    tmp++;
                    if (tmp == 2)
                    {
                        t = u;                        
                        break;
                    }
                }
                else
                {
                    u = data[j];
                    tmp = 1;
                }

            }

            ans = (long)s * t;
           
            Console.WriteLine(ans);            

        }
    }
}


Measured memory_bytes: 27232
#include <iostream>
#include <cstdint>

using namespace std;

uint32_t R[4001];
uint32_t G[4001];
uint32_t B[4001];
uint8_t str[4001];

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

	for (uint32_t i = 1; i <= N; i++) {
		uint8_t c;
		cin >> c;
		str[i] = c;
	}
	str[N + 1] = 0;

	uint32_t Rcnt = 0;
	uint32_t Gcnt = 0;
	uint32_t Bcnt = 0;
	for (uint32_t i = 1; i <= N; i++) {
		if (str[i] == 'R') {
			Rcnt++;
		}
		if (str[i] == 'G') {
			Gcnt++;
		}
		if (str[i] == 'B') {
			Bcnt++;
		}
		R[i] = Rcnt;
		G[i] = Gcnt;
		B[i] = Bcnt;
	}

	/*
	for (uint32_t i = 0; i <= N; i++)
		cout << R[i] << " ";
	cout << endl;
	for (uint32_t i = 0; i <= N; i++)
		cout << G[i] << " ";
	cout << endl;
	for (uint32_t i = 0; i <= N; i++)
		cout << B[i] << " ";
	cout << endl;
	*/

	uint32_t cnt = 0;
	for (uint32_t i = 1; i < N; i++) {
		uint8_t center = str[i];

		uint32_t min = i - 1;
		if (min > N - i)
			min = N - i;

		uint32_t mcnt = 0;
		for (uint32_t d = 1; d <= min; d++) {
			if (str[i] == 'R') {
				if (str[i - d] == 'G' && str[i + d] == 'B')
					mcnt++;
				if (str[i - d] == 'B' && str[i + d] == 'G')
					mcnt++;
			}
			if (str[i] == 'G') {
				if (str[i - d] == 'R' && str[i + d] == 'B')
					mcnt++;
				if (str[i - d] == 'B' && str[i + d] == 'R')
					mcnt++;
			}
			if (str[i] == 'B') {
				if (str[i - d] == 'G' && str[i + d] == 'R')
					mcnt++;
				if (str[i - d] == 'R' && str[i + d] == 'G')
					mcnt++;
			}
		}

		if (str[i] == 'R')
			cnt +=
			    G[i - 1] * (B[N] - B[i]) + (G[N] - G[i]) * B[i - 1];

		if (str[i] == 'G')
			cnt +=
			    R[i - 1] * (B[N] - B[i]) + (R[N] - R[i]) * B[i - 1];

		if (str[i] == 'B')
			cnt +=
			    G[i - 1] * (R[N] - R[i]) + (G[N] - G[i]) * R[i - 1];

		cnt -= mcnt;
	}

	cout << cnt << endl;

	return 0;
}


Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define repx(i, a, b) for(int i = a; i < b; i++)
#define rep(i, n) repx(i, 0, n)
#define repr(i, a, b) for(int i = a; i >= b; i--)
const int INF = 2020202020;
const int MAX = 111111;
int d[MAX];

int main(){
    
    // 1. 入力情報.
    int N, M;
    char S[111111];
    scanf("%d %d %s", &N, &M, S);
    rep(i, MAX) d[i] = INF;
    
    // 2. 解説通り.
    // 連続する '1' が, M以上のものが存在したら, ゴールへの到達は不可能.
    int maxOne = 0, one = 0;
    rep(i, N + 1){
        if(S[i] == '1') one++;
        else            maxOne = max(maxOne, one), one = 0;
    }
    if(maxOne >= M){
        puts("-1");
        return 0;
    }
    
    // 3. 目的地点から, 各出発地点までの最短手数を求める.
    int bef = N, dx = 1, mIndex;
    d[N] = 0;
    repr(i, N - 1, 0){
        if(bef - i > M){
            bef = mIndex;
            dx++;
        }
        if(S[i] == '0' && bef - i <= M){
            d[i] = dx;
            mIndex = i;
        }
    }
    // rep(i, N + 1) printf("%d ", d[i]);
    // printf("\n");
    
    // 4. 最短経路の情報を保存.
    vector<int> v;
    int r = d[0];
    rep(i, N + 1) if(d[i] == r) v.pb(i), r--;
    
    // 5. 出力.
    int l = v.size();
    rep(i, l - 1){
        printf("%d", v[i + 1] - v[i]);
        if(i < l - 2) printf(" ");
    }
    printf("\n");
    return 0;
    
}

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

int main() {
  int n;
  cin >> n;
  while(n--) {
    int x,y,s,t;
    cin >> x >> y >> s >> t;
    int sum=x*s+y*t;
    int min=sum;
    if(s>=5 && t>=2) min*=0.8;
    else if(s<5 && t>=2) {
      if(min>(sum+(5-s)*x)*0.8) min=(sum+(5-s)*x)*0.8;
    } else if(s>=5 && t<2) {
      if(min>(sum+(2-t)*y)*0.8) min=(sum+(2-t)*y)*0.8;
    } else {
      if(min>(sum+(5-s)*x+(2-t)*y)*0.8) min=(sum+(5-s)*x+(2-t)*y)*0.8;
    }
    sum=min;
    cout << sum << endl;
  }
  return 0;
}


Measured memory_bytes: 1160
from collections import defaultdict
h, w=map(int,input().split())
n=int(input())
a=list(map(int,input().split()))

ans=[0]*h
for i in range(h):
    ans[i]=[0]*w

b=[]
for i in range(n):
    for k in range(a[i]):
        b.append(i+1)

hidx=0
widx=0
for i in range(len(b)):
    ans[hidx][widx]=b[i]
    if hidx%2==0:
        widx+=1
    else:
        widx-=1
    if widx==w:
        widx=-1
        hidx+=1
    if widx==-(w+1):
        widx=0
        hidx+=1

for i in range(h):
    answer=ans[i]
    L=[str(a) for a in answer]
    L=" ".join(L)
    print(L)




Measured memory_bytes: 9864
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef int ll;
typedef long double ld;
const ll N = 200005;
char en = '\n';
ll inf = 1e16;
ll mod = 1e9 + 7;
ll power(ll x, ll n, ll mod) {
  ll res = 1;
  x %= mod;
  while (n) {
    if (n & 1)
      res = (res * x) % mod;
    x = (x * x) % mod;
    n >>= 1;
  }
  return res;
}

bool pal(string s) {
  string s2 = s;
  reverse(s2.begin(), s2.end());
  return s == s2;
}

int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);

  ll l;
  cin >> l;

  ld a = (ld)l / 3;

  cout << fixed << setprecision(10) << a * a * a << en;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, s, n) for (int i = s; i < n; i++)
#define ALL(a) a.begin(), a.end()
#define MOD 1000000007
using namespace std;
typedef long long ll;

int main() {
    int N, K, S; cin >> N >> K >> S;
    vector<int> A(N);
    REP(i, 0, N) {
        if (i < K) {
            A[i] = S;
        } else {
            if (S > 2) {
                A[i] = S - 1;
            } else {
                A[i] = pow(10, 8);
            }
        }
    }

    REP(i, 0, N) {
        if (i != N - 1) cout << A[i] << " ";
        else cout << A[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 1664
/*
このコード、と～おれ!
Be accepted!
∧＿∧　
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
 　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
		  　　　　　　　　　　(¸.·´ (¸.·'* ☆
					*/

#include <stdio.h>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstring>
#include <vector>
#include <numeric>
#include <iostream>
#include <random>
#include <map>
#include <unordered_map>
#include <queue>
#include <regex>

#pragma GCC optimize("Ofast")
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define rep1(i, n) for(int i = 1; i <= (n); ++i)
#define rep2(i, n) for(int i = 2; i < (n); ++i)
#define repr(i, n) for(int i = n; i >= 0; --i)
#define reprm(i, n) for(int i = n - 1; i >= 0; --i)
#define printynl(a) printf(a ? "yes\n" : "no\n")
#define printyn(a) printf(a ? "Yes\n" : "No\n")
#define printYN(a) printf(a ? "YES\n" : "NO\n")
#define printin(a) printf(a ? "possible\n" : "inposible\n")
#define printdb(a) printf("%.50lf\n", a)//少数出力
#define printdbd(a) printf("%.16lf\n", a)//少数出力(桁少なめ)
#define prints(s) printf("%s\n", s.c_str())//string出力
#define all(x) (x).begin(), (x).end()
#define allsum(a, b, c) ((a + b) * c / 2)//等差数列の和、初項,末項,項数
#define pb push_back
#define priq priority_queue
#define rpriq priq<int, vector<int>, greater<int>>
#define deg_to_rad(deg) (((deg)/360.0)*2.0*PI)
#define rad_to_deg(rad) (((rad)/2.0/PI)*360.0)
#define Please return
#define AC 0

using ll = long long;

constexpr int INF = 1073741823;
constexpr int MINF = -1073741823;
constexpr ll LINF = ll(4661686018427387903);
constexpr ll MOD = 1000000007;
const double PI = acos(-1);

using namespace std;

void scans(string& str) {
	char c;
	str = "";
	scanf("%c", &c);
	if (c == '\n')scanf("%c", &c);//最初の改行対策
	while (c != '\n' && c != -1) {
		str += c;
		scanf("%c", &c);
	}
}

void scanc(char& str) {
	char c;
	scanf("%c", &c);
	if (c == -1)return;
	while (c == '\n') {
		scanf("%c", &c);
	}
	str = c;
}

double acot(double x) {
	return PI / 2 - atan(x);
}

/*-----------------------------------------ここからコード-----------------------------------------*/


int main() {
	
	int a, b, c;
	scanf("%d%d%d", &a, &b, &c);
	printyn(a + b >= c);
	
	Please AC;
}


Measured memory_bytes: 888
#include <iostream>
#include <stack>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <vector>
#include <set>
using namespace std;
 
pair<int,int> rot(pair<int,int> x){
	return make_pair(x.second,x.first);
}

int main(){
	int N;
	cin >> N;
	vector< pair<int,int> > w;
	for(int i = 0 ; i < N ; i++){
		int a,b;
		cin >> a >> b;
		if( b < a ) swap(a,b);
		w.push_back(make_pair(a,b));
	}
	sort(w.begin(),w.end());
	
	multiset<int> current;
	current.insert(-1e9);
	for(int i = 0 ; i < w.size() ; ){
		int j = i;
		while( j < w.size() && w[j].first == w[i].first ) j++;
		
		for(int k = i ; k < j ; k++){
			multiset<int>::iterator it = --current.lower_bound(w[k].second);
			if( (*it) > 0 ){
				current.erase(it);
			}
		}
		for(int k = i ; k < j ; k++)
			current.insert(w[k].second);
		
		i = j;
	}
	cout << current.size() - 1 << endl;
	
	
}


Measured memory_bytes: 1200
# include <bits/stdc++.h>
#define INF 1e9
using namespace std;

int main(){

  int N, D;
  cin >> N >> D;
  int range = 2*D+1;
  int ans;
  ans = N / (2*D+1);
  if (N % (2*D+1) != 0){
    ans++;
  }

  cout << ans << endl;

}


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

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

	string s;
	cin >> s;
	int r = 0, b = 0;
	for (int i = 0; i < N; i++) {
		if (s[i] == 'R') {
			r += 1;
		}
		else {
			b += 1;
		}
	}
	if (r > b) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef long double ld;
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int n,k;
	cin >> n >> k;
	vector<int> d(k);
	REP(i,k) cin >> d[i];
	while(true){
		int n_cp = n;
		bool flag = true;
		while(n_cp){
			int dig = n_cp%10;
			if(find(ALL(d), dig) != d.end()){
				flag = false;
				break;
			} 
			n_cp /= 10;
		}
		if(flag){
			cout << n << '\n';
			return 0;
		}
		n++;
	}
	return 0;
}



Measured memory_bytes: 508
#include <iostream>
#include <fstream>
#include <vector>
#include <stack>
#include <queue>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <cstdio>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <map>
#include <set>

using namespace std;

typedef long long ll;
typedef pair<int,int> PP;

/*
    freopen("input","r",stdin);
    freopen("output","w",stdout);
*/

vector<int> G[3010];
int D[3010];
int S[3010];

int solve(int n) {
	if (S[n] != 0) return S[n];
	S[n] = -1;
	for (int i = 0;i < G[n].size();i++) {
		int q = solve(G[n][i]);
		if (q == -1) S[n] = 1;
	}
	return S[n];
}

int main() {
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    for (int i = 1;i <= N;i++) cin >> D[i];
    memset(S, 0, sizeof(S));
    for (int i = 1;i < N;i++) {
    	int a, b;
    	cin >> a >> b;
    	if (D[a] > D[b]) G[a].push_back(b);
    	if (D[b] > D[a]) G[b].push_back(a);
    }
    vector<int> ans;
    for (int i = 1;i <= N;i++) {
    	int tmp = solve(i);
    	if (tmp == 1) ans.push_back(i);
    }
    for (int i = 0;i < ans.size();i++) {
    	if (i != 0) cout << ' ';
    	cout << ans[i];
    }
    cout << endl;
    return 0;
}

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

int main(){
    int N,K,Q;
    cin >> N >> K >> Q;
    
    int A[Q];
    rep(i,Q) cin >> A[i];
    
    int point[N];
    rep(i,N) point[i] = K - Q;
    
    int i;
    for(i=0; i < Q; i++){
        point[A[i]-1] ++;
    }
    
    for(i = 0; i <N; i++){
        if(point[i] <= 0){
            cout << "No" << endl;
        }else{
            cout << "Yes" << endl;
        }
    }
    
    return 0;
}
    
    


Measured memory_bytes: 1408
#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#define FOR(i,j,n) for(int i=(j);i<=((int)n);++i)
#define N 1000005
#define MOD 1000000007

typedef long long int ll;
using namespace std;
vector <int>g[N];
void init()
{
	for(int i = 0; i < N; i++) {
		g[i].clear();
	}
}

int a[25][25];
ll dp[25][1<<22];
ll n;
ll go(int k,int mask)
{
		if (__builtin_popcount(mask)==n)
	return 1;
	else if (dp[k][mask]!=-1)
	return dp[k][mask];
	else
	{
		ll z=0;
		for (int i=0;i<n;i++)
		{
			if (a[k][i]==1 and (!(mask&(1<<i))))
			{
				ll u=mask;
				u|=(1<<i);
				z=(z+go(k+1,u))%MOD;
			}
		}
		dp[k][mask]=z%MOD;
		return z%MOD;
	}


}


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    cin>>n;
    FOR(i,0,n-1)
    FOR(j,0,n-1)
    cin>>a[i][j];
    
memset(dp,-1,sizeof(dp));
cout<<go(0,0);


}




Measured memory_bytes: 843008
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System;
using System.IO;

public class Playground
{
    private static int[] nums;
    private static int[] elem;

    public static void Main(string[] args)
    {
        Input();
        Method();
        System.Console.ReadLine();
    }

    private static void Input()
    {
        Console.ReadLine();
        nums = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
        Console.ReadLine();
        elem = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
    }

    private static bool Solve(int p, int t)
    {
        if (p >= nums.Length)
        {
            return false;
        }
        if (t - nums[p] == 0)
        {
            return true;
        }
        return Solve(p + 1, t - nums[p]) || Solve(p + 1, t);
    }

    private static void Method()
    {
        var results = new StringBuilder();
        for (int i = 0; i < elem.Length; i++)
        {
            bool res = Solve(0, elem[i]);
            if (i != 0)
            {
                results.Append("\n");
            }
            if (res)
            {
                results.Append("yes");
            }
            else
            {
                results.Append("no");
            }
        }
        Console.WriteLine(results.ToString());
    }
}

Measured memory_bytes: 8940
/* 
chirag11032000
Chirag Thakur
*/

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

using namespace std;
using namespace __gnu_pbds;

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

template < typename T > using OrderedSet = tree < T, null_type, less < T >, rb_tree_tag, tree_order_statistics_node_update >;
template < typename T > using MinPriorityQueue = priority_queue < T, vector < T >, greater < T > >;

#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template < typename Arg1 >
void __f(const char* name, Arg1&& arg1) {
	cerr << name << " : " << arg1 << std::endl;
}
template < typename Arg1, typename... Args >
void __f(const char* names, Arg1&& arg1, Args&&... args) {
	const char* comma = strchr(names + 1, ',');
	cerr.write(names, comma - names) << " : " << arg1 << " | ";
	__f(comma + 1, args...);
}
#else
#define trace(...)
#endif

#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define unique_sort(x) sort(all(x)), x.resize(distance(x.begin(), unique(all(x))))

const db PI = acos(-1);
const ll LINF = LLONG_MAX;
const int INF = INT_MAX, MOD = 1e9 + 7, N = 1e5 + 10;

void test_case();

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	test_case();
	cerr << "Time taken: " << int((clock() * 1000.) / CLOCKS_PER_SEC) << "ms\n";
	return 0;
}

void test_case() {
	int n;
	cin >> n;
	vector < int > l(n);
	for (auto &el: l) {
		cin >> el;
	}
	sort(all(l));
	int pre_sum = accumulate(all(l), 0) - l.back();
	if (l.back() < pre_sum) {
		cout << "Yes\n";
	} else {
		cout << "No\n";
	}
}

Measured memory_bytes: 256