akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
//#include <boost/multiprecision/cpp_int.hpp>
//using multiInt = boost::multiprecision::cpp_int;

using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template <typename Q_temp>
using smaller_queue = priority_queue<Q_temp, vector<Q_temp>, greater<Q_temp>>;

const ll MOD = (ll)(1e9 + 7);
const int INF = (int)1e9;
const ll LINF = (ll)4e18;
const double PI = acos(-1.0);

#define REP(i, m, n) for (ll i = m; i < (ll)(n); ++i)
#define rep(i, n) REP(i, 0, n)
#define MP make_pair
#define MT make_tuple
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << endl
#define possible(n) cout << ((n) ? "possible" : "impossible") << endl
#define Yay(n) cout << ((n) ? "Yay!" : ":(") << endl
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x) cerr << #x << ":" << x << endl;

vector<int> Dx = {0, 0, -1, 1, -1, 1, -1, 1, 0};
vector<int> Dy = {1, -1, 0, 0, -1, -1, 1, 1, 0};

inline ll CEIL(ll a, ll b)
{
  return (a + b - 1) / b;
}

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(20) << setiosflags(ios::fixed);
  ll a;
  cin >> a;
  ll l = CEIL(a, 105);
  ll r = a / 100;
  cout << (l <= r) << endl;
  return 0;
}


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

namespace NotFounds
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve();
        }

        public void Solve()
        {
            var cin = new InputStream();
            var a = cin.Read() == "H";
            var b = cin.Read() == "H";

            if (a ^ b)
                WriteLine("D");
            else
                WriteLine("H");
        }
    }

    public class InputStream
    {
        private char separator = ' ';
        private Queue<string> inputStream;
        public InputStream(char separator = ' ')
        {
            this.separator = separator;
            inputStream = new Queue<string>();
        }

        public string Read()
        {
            if (inputStream.Count != 0) return inputStream.Dequeue();
            string[] tmp = Console.ReadLine().Split(separator);
            for (int i = 0; i < tmp.Length; i++)
                inputStream.Enqueue(tmp[i]);
            return inputStream.Dequeue();
        }
        public string ReadLine()   => Console.ReadLine();
        public int    ReadInt()    => int.Parse(Read());
        public long   ReadLong()   => long.Parse(Read());
        public double ReadDouble() => double.Parse(Read());
    }
}

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

using namespace std;
#define ll long long
#define pb push_back
#define vi vector<int>
#define inf 1000000100

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


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

using namespace std;

#define INF 1001000100010001000
#define MOD 1000000007
#define EPS 1e-10
#define int long long
#define rep(i, N) for (int i = 0; i < N; i++)
#define Rep(i, N) for (int i = 1; i < N; i++)
#define For(i, a, b) for (int i = (a); i < (b); i++)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define pii pair<int, int>
#define vi vector<int>
#define vvi vector<vi >
#define vb vector<bool>
#define vvb vector<vb >
#define vp vector< pii >
#define all(a) (a).begin(), (a).end()
#define Int(x) int x; cin >> x;
#define int2(x, y) Int(x); Int(y);
#define int3(x, y, z) Int(x); int2(y, z);
#define in(x, a, b) ((a) <= (x) && (x) < (b))
#define fir first
#define sec second
#define ffir first.first
#define fsec first.second
#define sfir second.first
#define ssec second.second
#define Decimal fixed << setprecision(10)

//int dxy[5] = {0, 1, 0, -1, 0};
// cmd

signed main()
{
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);

    Int(n);
    vector<int> data(n);
    for (int i = 0; i < n; i++) {
        cin >> data[i];
    }
    
    deque<int> funami;
    rep(i, n) {
        if (i % 2) {
            funami.push_front(data[i]);
        } else {
            funami.push_back(data[i]);
        }

    }

    while (funami.size()) {
        if (n % 2) {
            cout << funami.back() << " ";
            funami.pop_back();
        } else {
            cout << funami.front() << " ";
            funami.pop_front();
        }
    }
    cout << endl;

    return 0;
}


Measured memory_bytes: 5376
// ABC179A.cpp
//

#include <iostream>
#include <string>
using namespace std;
using ll = long long;
#define rep(i,n) for (ll i = 0; i < (n); ++i)
using P = pair<int, int>;
int main()
{
    string s;
    cin >> s;
    int l = s.size();
    if (s[l - 1] == 's') {
        cout << s + "es" << endl;
        return 0;
    }
    else {
        cout << s + "s" << endl;
        return 0;
    }
}


Measured memory_bytes: 3132
from collections import Counter

N = int(input())
A = list(map(int,input().split()))
a = list(set(A))
cc = Counter(A)
dup = set([x for x in a if cc[x] > 1])
c_l = [(cc[i]-1)*(cc[i])/2 for i in a]
al = sum(c_l)

for k in A:
    if k in dup:
        print(int(al-cc[k]+1))
    else :
        print(int(al))

Measured memory_bytes: 28852
#include <bits/stdc++.h>
#define ALL(a)  (a).begin(),(a).end()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
template <typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template <typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
const int INT_INF = 1LL << 30;

int main(){
  ll N;
  cin >> N;
  vll A(N), B(N);
  priority_queue<Pll> que;
  for(int i = 0; i < N; i++){
    cin >> A.at(i) >> B.at(i);
    que.push(Pll(B.at(i), A.at(i)));
  }
  ll border = INF;
  while(!que.empty()){
    ll A = que.top().second;
    ll B = que.top().first;
    que.pop();
    if(border > B){
      border = B - A;
    }
    else{
      border -= A;
    }
  }
  if(border < 0) cout << "No" << endl;
  else cout << "Yes" << endl;
}

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

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int Q;
	cin>>Q;
	while(Q--){
		int A,B,C,D;
		cin>>A>>B>>C>>D;
		int K = (max(A,B)-1)/(min(A,B)+1) + 1;
		int l = 0, r = A+B;
		while(l<r){
			int mid = (l+r+1) >> 1;
			int rA = A - (mid - mid /  (K+1));
			int rB = B - (mid /  (K+1));
			if(mid % (K+1) == 0){
				if(rA>=0&&rB>=0&&1LL*rA*K>=rB)
					l=mid;
				else
					r=mid-1;
			}
			else{
				if(rA>=0&&rB>=0 && 1LL*(rA+1)*K>=rB)
					l=mid;
				else
					r=mid-1;
			}
		}
		for(int i=C;i<=D;i++){
			if(i<=l){
				if(i%(K+1)==0)
					cout<<'B';
				else
					cout<<'A';
			}
			else{
				int r = A+B+1-i;
				if(r%(K+1)==0)
					cout<<'A';
				else
					cout<<'B';
			}
		}
		cout<<'\n';
	}
}


Measured memory_bytes: 384
#include <iostream>

using namespace std;

int main() {
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		long long int y, m, d;
		cin >> y >> m >> d;
		long long int dd = 0;
		for (int j = 1; j < y; j++) {
			if (j % 3 == 0) {
				dd += 20 * 10;
			}
			else {
				dd += 20 * 5 + 19 * 5;
			}
		}
		//cout << dd << ' ';
		for (int j = 1; j < m; j++) {
			if (y % 3 == 0) {
				dd += 20;
			}
			else {
				if (j % 2 == 0) {
					dd += 19;
				}
				else {
					dd += 20;
				}
			}
		}
		//cout << dd << ' ';
		dd += d;
		//cout << dd << ' ';
		cout << 196471-dd << endl;
	}
	return 0;
}


Measured memory_bytes: 3092
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np

rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.buffer.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.buffer.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7

a, b = rm()
print(a + b//2)














Measured memory_bytes: 27132
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <list>
#include <ctime>
#include <sstream>
#include <queue>
#include <stack>
#include <random>
#include <bitset>
#include <numeric>
#include <cassert>
using namespace std;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef long long ll;
#define rep(x, b, e) for(int x=(b); x<(e); ++x)
#define ford(x, b, e) for(int x=((int)(b))-1; x>=(e); --x)
#define all(c) c.begin(),c.end()
#define sz(x) ((int)((x).size()))
#define pb push_back
#define st first
#define nd second
#define mp(x,y) make_pair(x,y)
typedef short int sint;

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it) {
	*this << ((it != d.b) ? ", " : "") << *it;
  }
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

int main() {
	ios_base::sync_with_stdio(false);
	int x;
	cin >> x;
	int cur = x;
	int cnt = 1;
	while (cur % 360 != 0) {
		cur += x;
		++cnt;
	}
	cout << cnt << endl;
}

Measured memory_bytes: 3576
#include <bits/stdc++.h>
using namespace std;
bool isACGT(char c){
    return (c == 'A' || c == 'C' || c == 'G' || c == 'T');
}

int main()
{
    string s;
    cin >> s;
    int len = s.length();
    int i, j, maxlen = 0;
    for (i = 0; i < len; i++, j=0){
        while (isACGT(s[i+j])){ j++; }
        maxlen = max(j, maxlen);
    }
    cout << maxlen << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
 
int n,k;
int w[100001];
 
int check(int p){
  int i;
  int sum=0;
  int idx = 0;
  for(i=0;i<k;i++){
    sum = 0;
    while(w[idx] + sum <= p){
      sum+=w[idx];
      idx++;
      if(idx == n) return 1;
    }
  }
  return 0;
}
 
int main(){
  int i;
  int left = 0, right = 100000 * 10000;
  int mid ;
  scanf("%d%d",&n,&k);
  for(i=0;i<n;i++) scanf("%d",&w[i]);
  while(right - left > 1){
    mid = (left + right) / 2;
    if(check(mid)==1) right = mid;
    else left = mid;
  }
  printf("%d\n",right);
  return 0;
}


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

int main() 
{
  int n, k;
  cin >> n >> k;
  int num = 1;

  for (int i = 0; i < n; ++i) {
    if (num *2 < num + k) {
      num = num *2;
    }
    else {
      num = num + k;
    }

  }

  cout << num << endl;
  return 0;
  
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("O0")
typedef long long int ll;
typedef long double ld;
#define rep(i,n) for (ll i = 0; i < (n); ++i)
#define Rep(i,a,n) for (ll i = (a); i < (n); ++i)
const ll mod = 1e9+7;
const ll INF = 1e18;
#define All(a) (a).begin(),(a).end()
#define Pi acos(-1)
using Graph = vector<vector<ll>>;

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << setprecision(15) << fixed;
  chrono::system_clock::time_point start,end;
  start = chrono::system_clock::now();

  string s;
  ll k;
  cin >> s >> k;
  rep(i,s.size()-1) {
    if (s[i] == 'a') continue;
    if ('z' - s[i] + 1 <= k) {
      k -= 'z' - s[i] + 1;
      s[i] = 'a';
    }
  }
  s[s.size()-1] = 'a' + (s[s.size()-1]+k-'a')%26;
  cout << s << '\n';

  end = chrono::system_clock::now();
  auto elapsed = chrono::duration_cast< chrono::milliseconds >(end - start).count();
  cerr << elapsed << "ms" << '\n';
}

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

using namespace std;

int main() {
	
	int n;
	cin >> n;
	int total = 0;
	int a;
	for (int i = 0; i < n; i++) {
		cin >> a;
		while (a % 2 == 0) {
			total++;
			a /= 2;
		}
	}
	cout << total << endl;
}

Measured memory_bytes: 256
#include <cstring>
#include <map>
#include <unordered_map>
#include <string>
#include <list>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <cstdio>
#include <iostream>
#include <set>
#include <unordered_set>
using namespace std;

#define MAX(a,b) (a>b?a:b)
#define MIN(a,b) (a<b?a:b)
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef pair<int, int> pii;

int gi() {
    int a;
    scanf("%d", &a);
    return a;
}

ll gli() {
    ll a;
    scanf("%lld", &a);
    return a;
}

#define M 998244353

ll pw(ll a, ll b) {
    if (b == 0)
        return 1;
    ll x = pw(a, b/2);
    x = (x*x) % M;
    if (b%2)
        x = (x*a) % M;
    return x;
}

ll c[300001];

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

    ll n = gi();
    ll a = gi();
    ll b = gi();
    ll k = gli();

    c[0] = 1;
    for (ll i = 0; i < n; i++) {
        ll x = (c[i] * (n-i)) % M;
        c[i+1] = (x * pw(i+1, M-2)) % M;
    }

    ll res = 0;
    for (ll i = 0; i <= n; i++) {
        ll r = k - a*i;
        ll j = r/b;
        if (r >= 0 && r%b == 0 && j <= n) {
            res += (c[i] * c[j]) % M;
            res %= M;
        }
    }

    cout << res << endl;

    return 0;
}


Measured memory_bytes: 2560
N, *LR = map(int, open(0).read().split())
L, R = LR[::2], LR[1::2]

max_l = max(L)
min_r = min(R)

ab = [(max(0, r - max_l + 1), -max(0, min_r - l + 1)) for l, r in zip(L, R)]
ab.sort()

mi = float("inf")
ma = max(r - l + 1 for l, r in zip(L, R)) + max(0, min_r - max_l + 1)

for i in range(N - 1):
    mi = min(mi, -ab[i][1])
    ma = max(ma, mi + ab[i + 1][0])

print(ma)


Measured memory_bytes: 26504
s = int(input())

r = 1
l = 0

def f(x):
    m = (x  - (x // 2)*2)
    if (0 == m):
        return int(x / 2)
    else:
        return int(3*x + 1)

i = 1
L = [s]
while (True):
    i += 1
    s = f(s)
    #print(s)
    if (s in L):
        break
    L.append(s)
print(i)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const ll inf =1LL << 62;
const ll mod=1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b,const ll &mod) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b,const ll &mod) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b,const ll &mod) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b,const ll &mod) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
random_device rd;
mt19937 mt(rd());
uniform_int_distribution<int> dice(1,6);
uniform_real_distribution<double> score(0.0,10.0);

int main(void){
    string in; cin >> in;
    int len = in.size();

    int a = -1, b = -1;
    rep(i, len-1){
        if(in[i] == in[i + 1]){
            a = i+1, b = i+1 + 1;
            break;
        }
        if(i + 2 < len and in[i] == in[i + 2]){
            a = i+1, b = i+1 + 2;
            break;
        }
    }

    cout << a << " " << b << endl;

    return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<(b);++i)
#define rrep(i,a,b) for(int i=(a);i>=(b);--i)
#define fore(i,a) for(auto &i:a)
#define all(a) (a).begin(),(a).end()
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
using ll = long long; constexpr int inf = INT_MAX / 2; constexpr ll infl = 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; }

bool HasAcgt(char c) {
  if (c == 'A') return true;
  if (c == 'C') return true;
  if (c == 'G') return true;
  if (c == 'T') return true;
  return false;
}

void _main() {
  string S;
  cin >> S;
  int ssize = S.size();

  int ans = 0;
  int cnt = 0;
  rep(i, 0, ssize) {
    if (HasAcgt(S[i])) cnt++;
    else {
      chmax(ans, cnt);
      cnt = 0;
    }
  }
  chmax(ans, cnt);

  cout << ans << endl;
}

Measured memory_bytes: 256
// #define _GLIBCXX_DEBUG
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
using ll = long long; using pii = pair<int, int>; using vi = vector<int>; using vvi = vector<vi>; using pll = pair<ll, ll>; using vl = vector<ll>; using vvl = vector<vl>; using vb = vector<bool>; using vvb = vector<vb>;
#define rep0(TMS) for (int CNT = 0; CNT < (int)(TMS); CNT++)
#define rep(CNT, GOAL) for (int CNT = 0; CNT < (int)(GOAL); CNT++)
#define rep2(CNT, START, GOAL) for (int CNT = (int)(START); CNT < (int)(GOAL); CNT++)
#define rep3(CNT, START, GOAL) for (int CNT = (int)(START); CNT > (int)(GOAL); CNT--)
#define all(CONT) begin(CONT), end(CONT)
template <typename T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template <typename T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; }
void prec(const int &DIG) { cout << fixed << setprecision(DIG); cerr << fixed << setprecision(DIG); }
template <typename T> void CERR(const T &ELEM) { cerr << ELEM; }
#define dbl(OBJ) cerr << #OBJ << ": "; CERR(OBJ); cerr << "\n"
template <typename T, typename ...Ts> void CERR(const T &FIRST, const Ts &...REST) { CERR(FIRST); cerr << ", "; CERR(REST...); }
#define dbs(...) cerr << "(" << #__VA_ARGS__ << "): ("; CERR(__VA_ARGS__); cerr << ")\n"
#define itrep(ITR, CONT) for (auto ITR = begin(CONT); ITR != end(CONT); ITR++)
template <typename T> void CERR(const vector<T> &VEC) { cerr << "{ "; itrep(ITR, VEC) { CERR(*ITR); cerr << ", "; } cerr << "}"; }
#define YN(FLG) cout << (FLG ? "YES" : "NO") << "\n"
#define Yn(FLG) cout << (FLG ? "Yes" : "No") << "\n"
#define yn(FLG) cout << (FLG ? "yes" : "no") << "\n"

// #include <atcoder/all>

// using namespace atcoder;

// const ll INF = LONG_LONG_MAX;
const int INF = INT_MAX;
// const ll MOD = 1000000007; // 998244353;

// あるK個の連続するマスは同じ色になる。
// 連続するマスの選び方は(N-K+1)通り，白黒のどちらで塗るかを考慮すると2*(N-K+1)通り。
// 「これらのマスのスコア+他のマスに書かれた整数の絶対値の総和」の最大値が答え。

int N, K;
vl a, Sa;
vl b, Sb;

ll solve(int i) { // [i,i+K)を同じ色で塗る
	ll res = (Sb[i] - Sb[0]) + (Sb[N] - Sb[i + K]); // [0,i),[i+K,N)を非負にしたときのスコア
	ll temp = Sa[i + K] - Sa[i];
	res += max(temp, 0LL);
	return res;
}

int main() {
	cin >> N >> K;
	a = b = vl(N);
	Sa = Sb = vl(N + 1);
	rep(i, N) {
		cin >> a[i]; Sa[i + 1] = Sa[i] + a[i];
		b[i] = max(a[i], 0LL); Sb[i + 1] = Sb[i] + b[i];
	}
	// dbl(a); dbl(b); dbl(Sa); dbl(Sb);
	ll ans = 0;
	rep(i, N - K + 1) chmax(ans, solve(i));
	cout << ans << endl;
}

Measured memory_bytes: 6412
#include <bits/stdc++.h>
using namespace std;
#define FIN ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

typedef long long ll;

const ll MOD = 1000000007;

ll powMod(ll n, ll k) {
	if (k == 0)
		return 1;
	if (k == 1)
		return (n % MOD);
	ll e = powMod(n, k / 2);
	e = (e * e) % MOD;
	if (k % 2)
		e = (e * n) % MOD;
	return e;
}

ll comb(ll n, ll m) {
	ll num = 1, den = 1, o = (n - m);
	if (o < m) swap(o, m);
	for (; n > o; n--)
		num = (num * n) % MOD;
	for (; m > 1; m--)
		den = (den * m) % MOD;
	den = powMod(den, MOD - 2);
	return (num * den) % MOD;
}

int main() {FIN
	
	ll n, a, b, c;
	cin >> n >> a >> b;
	c = powMod(2, n);
	c = (((((c + MOD - 1) % MOD) + MOD - comb(n, a)) % MOD) + MOD - comb(n, b)) % MOD;
	cout << c << "\n";
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> pii;
typedef long long ll;
const int N = 2000010;
const int oo = 1e9;


string s;
int main() {
//	freopen("input.txt", "r", stdin);
	cin >> s;
	if(s.size() >= 4 && s[0]=='Y'&&s[1]=='A'&&s[2]=='K'&&s[3]=='I'){
		puts("Yes");
		return 0;
	}
	puts("No");
	return 0;
}

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

int degsum(int n) {
	int sum = 0;
	for(int i = 0;; i++) {
		if(n < 1) break;
		// cout << "degsum: " << n % 10 << endl;
		sum += n % 10;
		n = (int)(n / 10);
	}
	return sum;
}

int main() {
	int n;
	cin >> n;
	string ret = "No";
	// cout << degsum(n) << endl;
	if(n % degsum(n) == 0) ret = "Yes";
	cout << ret << endl;
	return 0;
}


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

#define pb push_back
#define mp make_pair
#define F(i, a, n) for(int i=a;i<n;i++)
#define REP(i, n) F(i, 0, n)
#define REP1(i, n) for(int i=1;i<=n;i++)
#define REV(i, n) for(int i=n;i>=0;i--)
#define PTR(it, x) for(auto it=x.begin();it!=x.end();++it)
#define MOD 1000000007

typedef unsigned long long ll;

const int MAX = 1e6 + 5;

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

	cin>>n;
	cout<<n*n*n;

	return 0;
}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Jaynil
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        APassword solver = new APassword();
        solver.solve(1, in, out);
        out.close();
    }

    static class APassword {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            out.println(n * n * n);
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



Measured memory_bytes: 22356
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,a,b) for(ll i=a;i<=b;i++)
#define repr(i,a,b) for(ll i=a;i>=b:i--)

const long long max_n = 1000005;
//Union_Find
long long ufpar[max_n], ufrank[max_n], ufnum[max_n];
//初期化
void ufinit(long long n){
	for(long long ii = 1; ii <= n; ii++){
		ufpar[ii] = ii;
		ufrank[ii] = 0;
		ufnum[ii] = 1;
	}
}
//木の根を求める
long long uffind(long long x){
	if(ufpar[x] == x) {
		return x;
	} else {
		ufpar[x] = uffind(ufpar[x]);
		return ufpar[x];
	}
}
//併合
void ufunite(long long x, long long y){
	x = uffind(x);
	y = uffind(y);
	if(x == y) return;
	if(ufrank[x] < ufrank[y]){
		ufpar[x] = y;
		ufnum[y] += ufnum[x];
		ufnum[x] = 0;
	} else {
		ufpar[y] = x;
		ufnum[x] += ufnum[y];
		ufnum[y] = 0;
		if(ufrank[x] == ufrank[y]) ufrank[y]++;
	}
}
//同じ集合か
bool ufsame(long long x, long long y){
	return uffind(x) == uffind(y);
}

int main() {
    // your code goes here
    ll n,m,k,a[100005],b[100005],c[100005],d[100005],ans[100005]={0};
    vector<ll> g[100005];
    cin >> n >> m >> k;
    ufinit(n);
    rep(i,0,m-1){
        cin >> a[i] >> b[i];
        ufunite(a[i],b[i]);
        g[a[i]].push_back(b[i]);
        g[b[i]].push_back(a[i]);
    }
    rep(i,1,n){
        ans[i]=ufnum[uffind(i)]-1-g[i].size();
    }
    rep(i,0,k-1){
        cin >> c[i] >> d[i];
        if(ufsame(c[i],d[i])){
            ans[c[i]]--;
            ans[d[i]]--;
        }
    }
    rep(i,1,n){
        cout << ans[i];
        if(i!=n) cout << " ";
        else cout << endl;
    }
    return 0;
}

Measured memory_bytes: 20596
use proconio::{input, fastout};

#[fastout]
fn main() {
  input!{
    n:i64,
    mut xl:[(i64,i64);n]
  }
  xl.sort_unstable_by_key(|t| t.0+t.1);
  let mut ans : i64 = 0;
  let mut t : i64 = std::i64::MIN;
  for (x,l) in xl {
      if t <= x-l {
        t = x+l;
        ans += 1;
      }
  }
  println!("{}",ans);
}


Measured memory_bytes: 5432
#include <iostream>
//#include <iomanip>
//#include <string>
#include <vector>
//#include <algorithm>
//#include <utility>
//#include <set>
//#include <map>
//#include <queue>
//#include <deque>
//#include <bitset>
//#include <math.h>
using namespace std ;
using ll = long long ;
//using ld = long double ;
using vll = vector<ll> ;
//using vvll = vector<vll> ;
//using vc = vector<char> ;
//using vvc = vector<vc> ;
//using vb = vector<bool> ;
//using vvb = vector<vb> ;
//using pll = pair<ll,ll> ;

ll mod = 1000000007 ;
//long double pie = acos(-1) ;

//string yorn(bool a){if(a) return"Yes" ; return "No" ;}
//string YorN(bool a){if(a) return"YES" ; return "NO" ;}
//ll gcd(long long a,long long b){if(b==0) return a ; return gcd(b,a%b) ;}
//ll lcm(long long a,long long b){return a/gcd(a,b)*b ;}
//ll sa(long long a,long long b){if(a>b) return a-b ; return b-a ;}
//void mysort(vector<long long> &a){sort(a.begin(),a.end()) ;}
//void myrev(vector<long long> &a){reverse(a.begin(),a.end()) ;}

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

int main(){
	ll n,k ;
	cin >> n >> k ;
	vll fac(n+5,1) ;
	for(int i=2;i<n+5;i++) fac.at(i) = fac.at(i-1)*i%mod ;
	n -= k ;
	for(int i=1;i<=k;i++){
		ll blue = fac.at(k-1)*modpow(fac.at(k-i),mod-2)%mod*modpow(fac.at(i-1),mod-2)%mod ;
		if(n+1-i<0){
			cout << 0 << endl ;
			continue ;
		}
		ll red = fac.at(n+1)*modpow(fac.at(n+1-i),mod-2)%mod*modpow(fac.at(i),mod-2)%mod ;
		cout << blue*red%mod << endl ;
	}
}


Measured memory_bytes: 256
// Problem : F - Three Variables Game
// Contest : AtCoder - AtCoder Beginner Contest 166
// URL : https://atcoder.jp/contests/abc166/tasks/abc166_f
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>

int n, a[100], d[100005];
char c[100005][4];

inline void doit(int &x, int &y, bool choice) {
  if (choice) --x, ++y; else ++x, --y;
}

void dfs(int x) {
  if (x > n) { puts("Yes"); for (int i = 1; i <= n; ++i) putchar(c[i][d[i]]), putchar('\n'); exit(0); }
  if (a[c[x][0]] != a[c[x][1]]) { d[x] = a[c[x][1]] < a[c[x][0]]; doit(a[c[x][0]], a[c[x][1]], d[x]); dfs(x + 1); }
  else if (a[c[x][0]] != 0) {
    d[x] = 0, ++a[c[x][0]], --a[c[x][1]];
    dfs(x + 1);
    d[x] = 1, --a[c[x][0]], --a[c[x][0]], ++a[c[x][1]], ++a[c[x][1]];
    dfs(x + 1);
    ++a[c[x][0]], --a[c[x][1]];
  }
}

int main() {
  scanf("%d%d%d%d", &n, &a['A'], &a['B'], &a['C']);
  for (int i = 1; i <= n; ++i) scanf("%s", c[i]);
  dfs(1);
  puts("No");
  return 0;
}

Measured memory_bytes: 5916
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
#define rep(i,n) for (int i=0; i<n;++i)
#define rep_down(i,n) for (int i=n-1; i>=0;--i)
typedef long long ll;
using namespace std;
const ll MOD = 1000000007LL;
const int INF = 1000000007;
int N;
double A[1001];

int main() {
  cin.sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);

  cin >> N;
  rep(i, N) cin >> A[i];
  double sm = 0;
  rep(i, N){
    sm += 1.0/A[i];
  }
  cout << setprecision(12) << 1.0/sm << endl;
  return 0;
}

Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; ++i)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = int64_t;
using ld = long double;
using P = pair<int, int>;
using vs = vector<string>;
using vi = vector<int>;
using vvi = vector<vi>;
template<class T> using PQ = priority_queue<T>;
template<class T> using PQG = priority_queue<T, vector<T>, greater<T> >;
const int INF = 100010001;
const ll LINF = (ll)INF*INF*10;
template<typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) {return a < b && (a = b, true);}
template<typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) {return a > b && (a = b, true);}
template<typename T1, typename T2>
istream &operator>>(istream &is, pair<T1, T2> &p) { return is >> p.first >> p.second;}
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) { return os << p.first << ' ' << p.second;}



//head

ll a[7];
ll ans;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  rep(i, 7) cin >> a[i];

  ans = a[0]/2*2 + a[1] + a[3]/2*2 + a[4]/2*2;
  if(a[0] and a[3] and a[4]) {
    if(a[0]&1 and a[3]&1 and a[4]&1) {
      ans +=  3;
    } else if((a[0]&1)+(a[3]&1)+(a[4]&1) == 2) {
      ans += 1;
    }
  }

  cout << ans << endl;
}

Measured memory_bytes: 3580
using namespace std;
#include<bits/stdc++.h>
#define BEGIN ios_base::sync_with_stdio(0);cin.tie(0)
#define END return EXIT_SUCCESS
#define FOR(I,A,B) for((I)=(A);(I)<(B);(I)++)
#define REP(I,N) FOR(I,0,N)
#define UP(I,A,B) for((I)=(A);(I)<=(B);(I)++)
#define DW(I,A,B) for((I)=(A);(I)>=(B);(I)--)
#define IN(P) cin>>(P)
#define IN2(P1,P2) cin>>(P1)>>(P2)
#define IN3(P1,P2,P3) cin>>(P1)>>(P2)>>(P3)
#define INS(I,N,V) REP(I,N) cin>>V[I]
#define INS2(I,N,V1,V2) REP(I,N) cin>>V1[I]>>V2[I];
#define INS3(I,N,V1,V2,V3) REP(I,N) cin>>V1[I]>>V2[I]>>V3[I];
#define OUT(P) cout<<P<<endl
#define OUT2(P1,P2) cout<<P1<<" "<<P2<<endl
#define OUT3(P1,P2,P3) cout<<P1<<" "<<P2<<" "<<P3<<endl
#define OUTS(I,N,V) REP(I,N) cout<<V[i]<<endl
#define ALL(C) (C).begin(),(C).end()
#define RALL(C) (C).rbegin(),(C).rend()
#define mp make_pair
#define pb push_back
typedef unsigned long ul;
typedef unsigned int ui;
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; }

long N,M,a,b,ans;
vector<vector<long> > G;
vector<bool> visited;

void dfs(long v){
  visited[v]=true;
  bool flag=true;
  for(long i=1;i<N;i++){
    if(!visited[i]){
      flag=false;
      break;
    }
  }
  if(flag){
    ans++;
    return;
  }
  for(long i=0;i<(long)G[v].size();i++){
    if(!visited[G[v][i]]){
      dfs(G[v][i]);
      visited[G[v][i]]=false;
    }
  }
}

inline void solve(){
  long i;
  IN2(N,M);
  G.resize(N);
  visited.resize(N);
  REP(i,M){
    IN2(a,b);
    G[--a].pb(--b);
    G[b].pb(a);
  }
  dfs(0);
  OUT(ans);
}

int main(int argc,char**argv){
  BEGIN;
  solve();
  END;
}


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

class Program
{   
    static void Main(string[] args)
    {
        var result = new List<double>();
       
        do
        {
            int n = int.Parse(Console.ReadLine());
            if(n == 0)
            {
                break;
            }
            string[] str = Console.ReadLine().Split(' ');
            int[] data = new int[n];
            double ave = 0.0;
            double sum = 0;
            for(int i = 0; i < n; i++)
            {
                data[i] = int.Parse(str[i]);
                sum += data[i];
            }

            ave = sum / n;

            double k = 0;
            for(int i = 0; i < n; i++)
            {
                k += Math.Pow((data[i] - ave), 2);
            }

            result.Add(Math.Sqrt(k / n));

        } while (true);

        foreach(var s in result)
        {
            Console.WriteLine(s);
        }

    }
}


Measured memory_bytes: 17992
import java.util.Scanner;

class Main{
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int kosu=sc.nextInt();

		if(kosu%2==0) {
			System.out.println((kosu/2)*(kosu/2));
		}
		else {
			System.out.println(((kosu+1)/2)*((kosu-1)/2));
		}
	}
}

Measured memory_bytes: 21972
#include<stdio.h>
int main(void)
{
	int x[28],y,i;
	for(i=0;i<28;i++)
	{
		scanf("%d",&x[i]);
	}
	for(y=1;y<31;y++)
	{
		for(i=0;i<28;i++)
		{
			if(x[i]==y)
			{
			break;
			}
			else if(x[i]!=y&&i==27)
			{
				printf("%d\n",y);
			}
		}
	}
	return 0;
}


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

using namespace std;

int main() {
    string S, T;
    cin >> S >> T;

    string subStringOfT = T.substr(0, T.size() - 1);

    if (subStringOfT == S) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 3596
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<functional>
#include<math.h>
#include<random>
#include <bitset>
using namespace std;
#define N (1000000000+7)
//#define N 998244353
#define INF 1e16
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> Q;

const int inf = (int)1e9; 

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

ll dp[200010][2][2];

ll ten[200010];

int main(void){
	string S,T;
	cin>>S>>T;
	ll n = S.length();
	dp[0][1][0]=1;
	dp[0][0][0]=0;
	ten[0]=1;
	for(ll i=0;i<=200000;i++){
		ten[i+1] = (10*ten[i])%N;
	}
	for(ll i=0;i<n;i++){
		if(T[i]=='?'){
			ll x = S[i]-'0';
			ll s = x*(x-1)/2;
			dp[i+1][1][0] = dp[i][1][0];
			dp[i+1][0][0] = ((dp[i][1][0]*x)%N+(dp[i][0][0])*10)%N;
			dp[i+1][1][1] = dp[i][1][1] + (x*((dp[i+1][1][0]*ten[n-i-1])%N))%N;
			dp[i+1][1][1] = dp[i+1][1][1]%N;
			dp[i+1][0][1] = (dp[i][0][1]*10)%N+(45*((ten[n-i-1]*dp[i][0][0])%N))%N;
			dp[i+1][0][1] = dp[i+1][0][1]%N;
			dp[i+1][0][1] = dp[i+1][0][1]+ (dp[i][1][1]*x)%N+(((s*ten[n-i-1])%N)*(dp[i][1][0]))%N;
			dp[i+1][0][1] = dp[i+1][0][1]%N;
		}
		else{
			if(S[i]==T[i]){
				ll x = T[i]-'0';
				dp[i+1][1][0] = dp[i][1][0];
				dp[i+1][0][0] = dp[i][0][0];
				dp[i+1][1][1] = dp[i][1][1] + (((x*ten[n-i-1])%N)*dp[i][1][0])%N;
				dp[i+1][0][1] = dp[i][0][1] + (((x*ten[n-i-1])%N)*dp[i][0][0])%N;
				dp[i+1][1][1] = dp[i+1][1][1]%N;
				dp[i+1][0][1] = dp[i+1][0][1]%N;
			}
			else{
				if(S[i]<T[i]){
					ll x = T[i]-'0';
					dp[i+1][0][0] = dp[i][0][0];
					dp[i+1][0][1] = dp[i][0][1]+(((x*ten[n-i-1])%N)*dp[i+1][0][0])%N;
					dp[i+1][0][1] = dp[i+1][0][1]%N;
				}
				else{
					ll x = T[i]-'0';
					dp[i+1][0][0] = (dp[i][0][0]+dp[i][1][0])%N;
					dp[i+1][0][1] = (dp[i][0][1]+dp[i][1][1])%N+(((x*ten[n-i-1])%N)*dp[i+1][0][0])%N;
					dp[i+1][0][1] = dp[i+1][0][1]%N;
				}
			}
		}
	}
	//cout<<dp[3][0][0]<<endl;
	cout<<(dp[n][0][1]+dp[n][1][1])%N<<endl;
	return 0;
}


Measured memory_bytes: 11100
const fs = require('fs');

function divmod(a, b) {
  var q = Math.floor(a / b);
  var r = a % b;
  return [q, r]
}

function main(input) {
  var arr = input.split(' ');
  arr = arr.map((n) => parseInt(n, 10));
  n = arr[0]; a = arr[1]; b = arr[2];

  var res = 0;
  var tot;
  var q;
  var r;
  var d;
  for (var i = 0; i <= n; i++) {
    q = i;
    tot = 0;
    while (q) {
      d = divmod(q, 10);
      q = d[0]; r = d[1];
      tot += r;
    }
    if (a <= tot && tot <= b) {
      res += i;
    }
  }
  console.log(res);
}

input = fs.readFileSync('/dev/stdin', 'utf8');
main(input);

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

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

	string a, b;
	cin >> a;
	cin >> b;
	if (a.size() > b.size()){
		cout << "GREATER" << "\n";
		return 0;
	}else if (a.size() < b.size()){
		cout << "LESS" << "\n";
		return 0;
	}
	for (int i = 0; i < a.size(); ++i){
		if (a[i] > b[i]){
			cout << "GREATER" << "\n";
			return 0;
		}else if (a[i] < b[i]){
			cout << "LESS" << "\n";
			return 0;
		}
	}
	cout << "EQUAL" << "\n";
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <iomanip>
#include <vector>
#include <cstring>
#include <queue>
#include <map>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
using uld = unsigned long long;
using P = pair<int,int>;
const int dx[4] = {0,1,0,-1};
const int dy[4] = {1,0,-1,0};
template<class T> inline bool chmax(T &a,T& b){if(a < b){a = b; return true;} else return false;}
template<class T> inline bool chmin(T &a,T& b){if(a > b){a = b; return true;} else return false;}
//struct area

//function area

//main area
int main(){
    int a, b;
    cin >> a >> b;
    int ans = -1;
    rep(i, 10000){
        if(i * 2 / 25 == a && i / 10 == b){
            ans = i;
            break;
        }
    }
    cout << ans << endl;
}
/*

[N * 0.08] = A
[N * 0.10] = B
を満たす最小の自然数Nを求める
1 <= B <= 100なので、
シミュレーションすればできそう
おそらく 1000 + α まで計算すればいいけど、余裕をもって10000
O(1)でもできそう

*/

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

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

  int n, k, dig = 0;

  cin >> n >> k;

  int d;
  for (int i = 0; i < k; i++) {
    cin >> d;
    dig |= 1 << d;
  }

  for (int i = n; ; i++) {
    string num = to_string(i);
    bool bad = false;
    for (auto c : num)
      if (dig & (1 << (c - '0'))) {
        bad = true;
        break;
      }

    if (!bad) {
      cout << num << endl;
      break;
    }
  }

  return 0;
}

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

template <class Abel> struct BIT {
    vector<Abel> dat[2];
    Abel UNITY_SUM = 0;                     // to be set
    
    /* [1, n] */
    BIT(int n) { init(n); }
    void init(int n) { for (int iter = 0; iter < 2; ++iter) dat[iter].assign(n + 1, UNITY_SUM); }
    
    /* a, b are 1-indexed, [a, b) */
    inline void sub_add(int p, int a, Abel x) {
        for (int i = a; i < (int)dat[p].size(); i += i & -i)
            dat[p][i] = dat[p][i] + x;
    }
    inline void add(int a, int b, Abel x) {
        sub_add(0, a, x * -(a - 1)); sub_add(1, a, x); sub_add(0, b, x * (b - 1)); sub_add(1, b, x * (-1));
    }
    
    /* a is 1-indexed, [a, b) */
    inline Abel sub_sum(int p, int a) {
        Abel res = UNITY_SUM;
        for (int i = a; i > 0; i -= i & -i) res = res + dat[p][i];
        return res;
    }
    inline Abel sum(int a, int b) {
        return sub_sum(0, b - 1) + sub_sum(1, b - 1) * (b - 1) - sub_sum(0, a - 1) - sub_sum(1, a - 1) * (a - 1);
    }
    
    /* debug */
    void print() {
        for (int i = 1; i < (int)dat[0].size(); ++i) cout << sum(i, i + 1) << ",";
        cout << endl;
    }
};

int main() {
    int N; cin >> N;
      int Q; cin >> Q;
    vector<int> a(N);
    for (int i = 0; i < N; ++i) cin >> a[i];


    vector<int> lefts(Q), rights(Q), ids(Q);
    for (int i = 0; i < Q; ++i) {
        cin >> lefts[i] >> rights[i];
        --lefts[i];
        ids[i] = i;
    }
    sort(ids.begin(), ids.end(), [&](int i, int j) {
            return rights[i] < rights[j];});

    BIT<int> bit(N+5);
    vector<int> prev(1100000, -1);
    vector<int> res(Q, 0);
    int r = 0;
    for (auto i : ids) {
        for (; r < rights[i]; ++r) {
            bit.add(prev[a[r]]+2, r+2, 1);
            prev[a[r]] = r;
        }
        int tmp = bit.sum(lefts[i]+1, lefts[i]+2);
        res[i] = max(res[i], tmp);
    }
    for (int i = 0; i < Q; ++i) cout << res[i] << endl;
}

Measured memory_bytes: 21728
// C++ 14
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <algorithm>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <unordered_map>
#include <math.h>

#define ll long long
#define Int ll
#define loop(x, start, end) for(Int x = start; x < end; x++)
#define loopdown(x, start, end) for(int x = start; x > end; x--)
#define rep(n) for(Int x = 0; x < n; x++)
#define span(a,x,y) a.begin()+x,a.begin()+y
#define span_all(a) a.begin(),a.end()
#define len(x) (x.size())
#define last(x) (x[x.size()-1])

using namespace std;

#define EPS 0.0000000001

class Vector2 {
public:
  double x, y;
  
  Vector2(double x = 0, double y = 0): x(x), y(y) {}
  
  Vector2 operator + (Vector2 v) { return Vector2(x + v.x, y + v.y); }
  Vector2 operator - (Vector2 v) { return Vector2(x - v.x, y - v.y); }
  Vector2 operator * (double k) { return Vector2(x * k, y * k); }
  Vector2 operator / (double k) { return Vector2(x / k, y / k); }
  
  double length() { return sqrt(norm()); }
  double norm() { return x * x + y * y; }
  double dot (Vector2 v) { return x * v.x + y * v.y; }
  double cross (Vector2 v) { return x * v.y - y * v.x; }
  
  bool operator < (const Vector2 &v) const {
    return x != v.x ? x < v.x : y < v.y;
  }
  
  bool operator == (const Vector2 &v) const {
    return fabs(x - v.x) < EPS && fabs(y - v.y) < EPS;
  }
};

ostream & operator << (ostream & out, Vector2 const & v) { 
  out<< "Vector2(" << v.x << ", " << v.y << ')';
  return out;
}

istream & operator >> (istream & in, Vector2 & v) { 
  double x, y;
  in >> x;
  in >> y;
  v.x = x;
  v.y = y;
  return in;
}

#define MAX_X 1000000000000000000
Int X, Y;

void input() {
  cin >> X >> Y;
}

void solve() {
  Int count = 0;
  Int x = X;
  while (x <= Y) {
    count++;
    x *= 2;
  }
  cout << count << endl;
}

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


Measured memory_bytes: 256
#include<cstdio>
int n;
int dig[11][11];
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;++i){
		int x=i;
		while(x>=10)x/=10;
		++dig[x][i%10];
	}
	long long ans=0;
	for(int i=0;i<10;++i)
	for(int j=0;j<10;++j)
	ans+=1ll*dig[i][j]*dig[j][i];
	printf("%lld\n",ans);
}

Measured memory_bytes: 128
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
#include <iostream>
#include <string>
#include <set>
#include <map>
#include <unordered_map>
#include <complex>
#include <iomanip>
#include <cmath>
#include <tuple>
using namespace std;

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

    int height[n];
    int maxHeight = 0;
    for (int i = 0; i < n; i++) {
        cin >> height[i];
        maxHeight = max(maxHeight, height[i]);
    }

    int res = 0;
    while (1) {
        int now = 0;
        while (1) {
            bool through = false;
            while (1) {
                if (height[now] == 0 || now == n) {
                    if (through) ++res;
                    break;
                }
                through = true;
                --height[now];
                ++now;
            }
            if (now == n) break;
            else ++now;
        }
        bool end = true;
        for (int i = 0; i < n; i++) {
            if (height[i] > 0) end = false;
        }
        if (end) {
            cout << res << endl;
            return 0;
        }
    }
}


Measured memory_bytes: 256
# include <bits/stdc++.h>
# define ll long long
using namespace std;
const ll oo = 1e15, N = 2e5 + 10;
vector < int > edges[N];
int ans, h[N];
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	int n, m;
	cin >> n >> m;
	for(int i = 1; i <= n; ++i){
		cin >> h[i];
	}
	for(int i = 1; i <= m; ++i){
		int u, v;
		cin >> u >> v;
		edges[u].push_back(v);
		edges[v].push_back(u);
	}
	for(int i = 1; i <= n; ++i){
		bool ok = true;
		for(int j = 0; j < edges[i].size(); ++j){
			if(h[edges[i][j]] >= h[i])ok = false;
		}
		ans += ok;
	}
	cout << ans << '\n';
}

Measured memory_bytes: 11496
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
const int INF=1<<30;
int main(){
  int x,n;
  vector<int>vec;
  cin>>x>>n;
  for(int i=0;i<n;i++){
    int data;
    cin>>data;
    vec.push_back(data);
  }
  vec.push_back(INF);
  vec.push_back(-INF);
  sort(vec.begin(),vec.end());
  
  int d=0;
  int left=*lower_bound(vec.begin(),vec.end(),x);
  int right=*lower_bound(vec.begin(),vec.end(),x);
  while(left==x-d&&right==x+d){
    d++;
    left=*lower_bound(vec.begin(),vec.end(),x-d);
    right=*lower_bound(vec.begin(),vec.end(),x+d);
  }
  
  if(left!=x-d){
    cout<<x-d<<endl;
  }else{
    cout<<x+d<<endl;
  }
  return(0);
}

Measured memory_bytes: 3632
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys


mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

def LI(): return list(map(int, sys.stdin.readline().split()))

N, D, A = LI()
xh = []

for i in range(N):
    xh.append(LI())
xh.sort()
X = []
for i in range(N):
    X.append(xh[i][0])

bomb = [0 for i in range(N)]
ans = 0
now_dm = 0
for i in range(N):
    x,H = xh[i]
    now_dm += bomb[i]
    if now_dm >= H:
        pass
    else:
        ans += math.ceil((H - now_dm)/A)
        dm = math.ceil((H-now_dm)/A) * A
        ind = bisect.bisect_right(X, x+2*D)
        if i + 1 < N:
            bomb[i+1] += dm
        if ind < N:
            bomb[ind] -= dm

print(ans)


Measured memory_bytes: 124436
#include<iostream>
#include<vector>
#include<cstring>
using namespace std;
typedef long long ll;
#define ip(arr, n) for(int i=0; i<n; i++) cin>>arr[i];
#define op(arr, n) for(int i=0; i<n; i++) cout<<arr[i]<<" ";
#define fstIO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define mod 1000000007

ll dp[10005][105][2];
ll d;
string s;

ll solve(int pos, int sum, bool tight){
    if(pos == s.length()) return sum==0;

    if(dp[pos][sum][tight] != -1) return dp[pos][sum][tight];

    ll ans=0;
    int end = ((tight)?(s[pos]-'0'):9);
    for(int i=0; i<=end; i++){
        ans = (ans + solve(pos+1, (sum+i)%d, tight&(i==end)))%mod;
    }
    dp[pos][sum][tight]=ans;
    return dp[pos][sum][tight];
}

int main(){
    cin>>s;
    cin>>d;
    memset(dp, -1, sizeof(dp));
    ll ans = solve(0, 0, 1);
    ans = (ans-1+mod)%mod;
    cout<<ans<<endl;
    return 0;
}

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

int main()
{
  long long n; cin >> n;
	int p = 0;
	long long a = 2;
	while (true)
	{
		if (a > n)break;
		p++;
		a *= 5;
	}
	long long ans = 0;
	if (n % 2 == 0)
	{
		for(int i=1;i<=p;i++)
		{
			ans += n / (long long)(2 * pow(5, i));
		}
	}
cout<<ans<<endl;
	return 0;
}


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

int main(){
  string word;
  string com[3]={"the","this","that"};
  int cou=0;

  while(1){
    //bool flag = false;
    getline(cin,word);
    if(cin.eof()){
      break;
    }
    while(1){
      bool flag = false;
      for(int i=0;i<word.size();i++){
	if(word[i] == 'z'){
	  word[i] = 'a';
	}
	else if(word[i] >= 'a' && word[i] <= 'z'){
	  word[i]++;
	}
      }
      for(int i=0;i<3;i++){
	int index = word.find(com[i],0);
	if(index != string::npos){
	  cout << word << endl;
	  flag = true;
	  break;
	}
      }
      if(flag == true) break;
    }
  }
}

Measured memory_bytes: 1188