akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <iomanip>
#include <climits>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<string> VS;
typedef vector< vector<int> > VVI;
typedef vector< vector<ll> > VVL;
typedef pair<int,int> PII;
typedef pair<ll,ll> PLL;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define all(a) (a).begin(),(a).end()
#define pf push_front
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define ub upper_bound
#define lb lower_bound

int main(){
  int H,W,K;
  cin>>H>>W>>K;
  VS Z(H);
  rep(i,H) cin>>Z[i];
  int S,T;
  rep(i,H) rep(j,W) if(Z[i][j]=='S'){
    S=i;
    T=j;
  }
  VVI X(H,VI(W,-1));
  X[S][T]=0;
  queue<PII> Q;
  Q.push(mp(S,T));
  vector<PII> Y;
  Y.pb(mp(S,T));
  while(!Q.empty()){
    PII tmp=Q.front();
    Q.pop();
    int A=tmp.first;
    int B=tmp.second;
    if(X[A][B]==K) break;
    if(A){
      if(X[A-1][B]==-1 and Z[A-1][B]=='.'){
        X[A-1][B]=X[A][B]+1;
        Q.push(mp(A-1,B));
        Y.pb(mp(A-1,B));
      }
    }
    if(A<H-1){
      if(X[A+1][B]==-1 and Z[A+1][B]=='.'){
        X[A+1][B]=X[A][B]+1;
        Q.push(mp(A+1,B));
        Y.pb(mp(A+1,B));
      }
    }
    if(B){
      if(X[A][B-1]==-1 and Z[A][B-1]=='.'){
        X[A][B-1]=X[A][B]+1;
        Q.push(mp(A,B-1));
        Y.pb(mp(A,B-1));
      }
    }
    if(B<W-1){
      if(X[A][B+1]==-1 and Z[A][B+1]=='.'){
        X[A][B+1]=X[A][B]+1;
        Q.push(mp(A,B+1));
        Y.pb(mp(A,B+1));
      }
    }
  }
  int ans=1001001001;
  rep(i,Y.size()){
    ans=min(ans,1+(min({Y[i].first,H-1-Y[i].first,Y[i].second,W-1-Y[i].second})+K-1)/K);
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 13676
#include<iostream>
#include<stdio.h>
#include <vector>
#include <algorithm>
#include<string>
#include<math.h>
using namespace std;

int main(){
  int x;
  cin>>x;
  bool flag=0;
  for(int i=-120;i<120;i++){
    if(flag)break;
    for(int j=-120;j<120;j++){
      if(x==pow(i,5)-pow(j,5)){
	cout<<i<<" "<<j<<endl;
	flag=1;
      }
    }
  }
  return 0;
}


Measured memory_bytes: 3936
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
const int N=1e5+100;
int n,m,a[N],x,y,ans;
vector <int> e[N];
int rec(int ind){
    if(~a[ind])
        return a[ind];
    int ret=0;
    for(int i=0;i<e[ind].size();i++){
        ret=max(ret,rec(e[ind][i]));
    }
    if(e[ind].size()) ret++;
    return a[ind]=ret;
}
int main(){
    cin.tie(NULL);
    cout.tie(NULL);
    ios_base::sync_with_stdio(false);
    cin>>n>>m;
    while(m--){
        cin>>x>>y;
        e[x].pb(y);
    }
    memset(a,-1,sizeof a);
    for(int i=1;i<=n;i++){
        if(~a[i])
            continue;
        ans=max(ans,rec(i));
    }
    cout<<ans<<'\n';
    return 0;
}


Measured memory_bytes: 8192
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp> 
//#include <ext/pb_ds/tree_policy.hpp> 
//using namespace __gnu_pbds;
using namespace std;

typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
#define f0(i,a,b) for(int i=a;i<b;i++)
#define f1(i,a,b) for(int i=a;i<=b;i++)
#define f2(i,a,b) for(int i=a;i>b;i--)
#define f3(i,a,b) for(int i=a;i>=b;i--)
#define all(a) a.begin(),a.end()
#define pb push_back
#define mp make_pair
#define pii pair<int,int>
#define int long long
#define fi first
#define se second
#define ncr(n,r) fact[n]*modInv(fact[r])*modInv(fact[n-r])
#define modInv(a) binExp(a,mod-2)
#define mod 1000000007
//#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
//#define os_find(k) find_by_order(k)
//#define os_order(k) order_of_key(k)
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define make_graph(k) int x,y; f0(i,0,k){cin>>x>>y; adj[x].pb(y);}
#define test int t;cin>>t;while(t--)

double dp[3001][3001];

signed main()
{
    fast

    int n;
    cin>>n;

    double p[n+1];
    f1(i,1,n) cin>>p[i];

    f1(i,0,n) f1(j,0,n) dp[i][j] = 0;
    dp[0][0] = 1;
    f1(i,1,n)
    {
        f1(j,0,i)
        {
            dp[i][j] += dp[i-1][j]*(1-p[i]);
            if(j!=0)
            dp[i][j] += dp[i-1][j-1]*p[i];
        }
    }
    
    int k = ceil(1.0*(n+1)/2);
    double ans = 0;
    f1(i,k,n)
    {
        ans += dp[n][i];
    }
    cout<<fixed<<setprecision(10)<<ans;
}

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

namespace ABC166
{
    public class Solve
    {
        public static void Main(string[] args)
        {
            new ABC_A();
        }
    }
    public class ABC_A
    {
        public ABC_A()
        {
            var s = Ex.Read;

            var str = s == "ABC" ? "ARC" : "ABC";
            str.Cw();
        }
    }
    public class ABC_B
    {
        public ABC_B()
        {
        }
    }
    public class ABC_C
    {
        public ABC_C()
        {
        }
    }
    public class ABC_D
    {
        public ABC_D()
        {
        }
    }
    public class ABC_E
    {
        public ABC_E()
        {
        }
    }
    public class ABC_F
    {
        public ABC_F()
        {
        }
    }
    public static class Ex
    {
        public static void Cw(this object s) { Console.WriteLine(s); }

        public static List<string> FastSort(this List<string> s) { s.Sort(StringComparer.Ordinal); return s.ToList(); }
        public static string yesno(this bool b) { return b ? "yes" : "no"; }
        public static string YesNo(this bool b) { return b ? "Yes" : "No"; }
        public static string YESNO(this bool b) { return b ? "YES" : "NO"; }

        public static string Read { get { return Console.ReadLine().Trim(); } }
        public static int ReadInt { get { return int.Parse(Read); } }
        public static long ReadLong { get { return long.Parse(Read); } }
        public static double ReadDouble { get { return double.Parse(Read); } }
        public static string[] ReadArray() { return Read.Split(' '); }
        public static int[] ReadIntArray() { return Read.Split(' ').Select(int.Parse).ToArray(); }
        public static long[] ReadLongArray() { return Read.Split(' ').Select(long.Parse).ToArray(); }
        public static string[] ReadArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
        public static int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
        public static long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
    }
}


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

using namespace std;

const int MAXN = 1000100;
const int MOD7 = 1000000007ll;
const int MOD9 = 1000000009ll;
const int INF = 2000000000;
const double EPS = 1e-9;
const double PI = 3.14159265358979;
const int dir_4r[] = { -1, 1, 0, 0 };
const int dir_4c[] = { 0, 0, -1, 1 };
const int dir_8r[] = { -1, -1, -1, 0, 0, 1, 1, 1 };
const int dir_8c[] = { -1, 0, 1, -1, 1, -1, 0, 1 };

int main()
{
	int ans = 0;
	int n, l, r;
	scanf("%d", &n);
	for (int i = 0; i < n; ++i)
	{
		scanf("%d%d", &l, &r);
		ans += (r - l + 1);
	}
	printf("%d\n", ans);

	//system("pause");
	return 0;
}

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

string stransform(string s){
	for(int i = 0; i < s.size(); i++){
		if(65 <= int(s[i]) && int(s[i]) <= 90){
			s[i] = char(int(s[i] + 32));
		}else if(97 <= int(s[i]) && int(s[i]) <= 122){
			s[i] = char(int(s[i] - 32));
		}
	}
	return s;
}

void Main()
{
	//cout << int('a') <<' '<< int('z') <<' '<< int('A') <<' '<< int('Z') << endl;
	string s;
	//cin >> s;
	if (std::getline(std::cin, s)) {
    	//std::cout << s << std::endl;
  	}
	cout << stransform(s) << endl;
}

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


Measured memory_bytes: 3232
class Integer
  def divisor
    res = []
    1.upto((self**0.5)) do |i|
      if self % i == 0
        res.push i
        res.push self / i if i != self / i
      end
    end
    res.sort
  end
end

def answer_if_valid(x, a, d)
  b = a - d
  if x == a ** 5 - b ** 5
    puts "#{a} #{b}"
    exit
  end
end

x = gets.to_s.to_i

r = x % 5

x.divisor.each do |d|
  (-100000..100000).each{ |a| answer_if_valid(x, a, d) }
end

Measured memory_bytes: 14680
import math
N,D = map(int,input().split(' '))
l = [list(map(int,input().split())) for _ in range(N)]
ans = 0
for i in range(N):
    for ii in range(i+1,N):
        d = 0
        for j in range(D):
            d += (l[i][j] - l[ii][j])**2
        k = math.sqrt(d)
        if k==0:
            continue
        if k==int(k):
            ans += 1
print(ans)

Measured memory_bytes: 3064
using System;
using System.Collections.Generic;
using System.IO.Compression;
using System.IO.Pipes;
using System.Linq;
using System.Numerics;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var NM = ReadInts();
            var A = ReadDoubles();

            var count = 0;
            for (int i = 0; i < A.Length; i++)
            {
                if (A[i] / A.Sum() >= 1.0 / (4 * NM[1]))
                {
                    count++;
                }
            }
            if (count >= NM[1])
            {
                WriteLine("Yes");
            }
            else
            {
                WriteLine("No");
            }
        }

        private static string Read() { return ReadLine(); }
        private static string[] Reads() { return (Read().Split()); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


Measured memory_bytes: 13268
#include <bits/stdc++.h>
#define ALL(x) (x).begin(),(x).end()
#define PB push_back
#define MP make_pair
#define Mod 998244353
#define MOD 1000000007
using namespace std;
using lint = long long;
using vi = vector<lint>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using pii = pair<lint, lint>;

// cout << fixed << setprecision(12)

lint modpow(lint a, lint n, lint m = MOD){
  lint ans = 1;
  while(n>0){
    if(n%2==1) ans *= a; 
    ans %= m;
    a *= a; 
    a %= m;
    n /= 2;
  }
  return ans;
}

lint inv(lint a, lint m = MOD){
  return modpow(a, m-2, m);
}

///////////////////////////////////

int main(){
  string S,T;cin>>S>>T;
  lint sl = S.size();
  lint tl = T.size();
  
  lint ans = 100000;
  
  for(lint i=0; i<=sl-tl; i++){
    lint cnt = 0;
    for(lint j=0; j<tl; j++){
      cnt += (S[i+j]!=T[j]);
    }
    ans = min(ans, cnt);
  }
  
  cout << ans << endl;
}


Measured memory_bytes: 3596
<?php
 
function input($func = null) {
    if ($func === null) {
        return trim(fgets(STDIN));
    } else {
        return $func(trim(fgets(STDIN)));
    }
}
function input_array($func = null) {
    if ($func === null) {
        return explode(' ', input());
    } else {
        return array_map(function($v) use ($func) {
            return $func($v);
        }, explode(' ', input()));
    }
}

$d = input('intval');

echo 'Christmas';
for ($i = 0, $max = 25 - $d; $i < $max; $i++) {
    echo ' Eve';
}
echo "\n";

Measured memory_bytes: 4728
import heapq

def solve(n, m, a):
    v = []
    for i in range(n):
        heapq.heappush(v, -a[i])
    for i in range(m):
        x = heapq.heappop(v)
        x /= 2
        heapq.heappush(v, x)
    res = sum([int(-heapq.heappop(v)) for i in range(n)])
    return int(res)

n, m = map(int, input().split())
a = list(map(int, input().split()))
print(solve(n, m, a))



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

int main()
{
    std::vector<int> vec;
    int tmp, K;
    for (int i = 0; i < 3; i++)
    {
        std::cin >> tmp;
        vec.push_back(tmp);
    }
    std::cin >> K;

    std::sort(vec.begin(), vec.end());
    for (int i = 0; i < K; i++) { vec[2] *= 2; }
    std::cout << vec[0] + vec[1] + vec[2] << std::endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h> 
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define all(vec) vec.begin(), vec.end()
#define tmax(x,y,z) max((x),max((y),(z)))
#define tmin(x,y,z) min((x),min((y),(z)))
typedef long long ll;ll MM = 1000000000;ll mod = MM + 7; ll MMM=9223372036854775807;//2^63 -1
typedef vector<ll> lvec;typedef vector<double> dvec;typedef vector<string> svec;
ll GCD(ll x, ll y) {if (y == 0) return x;else return GCD(y, x % y);}
ll LCM(ll x, ll y) { return x / GCD(x, y) * y;}
//cout << fixed << setprecision(10);

int main(){
  ll k; cin>>k;
  if(k%2==0) cout<<k/2*k/2<<endl;
  else cout<<(k-1)/2*((k-1)/2+1)<<endl;
}

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

typedef long long int lli;

int main(void)
{
	lli n;
	scanf("%lld", &n);
	vector<lli> A(n), P(n);
	for(lli i = 0;i < n;i++) scanf("%lld", &A[i]);
	sort(A.begin(), A.end());
	for(lli i = 0;i < n;i++)
	{
		P[i] = A[i];
		if(i) P[i] += P[i-1];
	}
	lli res = 0;
	for(lli i = 0;i < n;i++)
	{
		lli val = P[i], prev = i;
		while(val*2ll < A.back())
		{
			lli nex = lli(upper_bound(A.begin(), A.end(), val*2ll)-A.begin())-1;
			if(nex > prev)
			{
				val = P[nex];
				prev = nex;
			}
			else break;
		}
		if(val*2ll >= A.back()) res++;
	}
	printf("%lld\n", res);
}

Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <string>
#include <unordered_set>
#include <unordered_map>
#include <sstream>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <numeric>

#define repAll(n) (n).begin(), (n).end()
#define repConAll(n) (n).cbegin(), (n).cend()

using namespace std;

namespace {
	const set<int> setStandard{ 3, 5, 7 };
}

int DFS(long long tmpN, vector<int>numbers, int N)
{
	if (tmpN > N){
		return 0;
	}
	int countAll = 0;
	if (set<int>(numbers.begin(), numbers.end()) == setStandard){
		countAll = 1;
	}
	
	for (const auto elem : setStandard){
		vector<int> numbers2(numbers);
		numbers2.push_back(elem);
		countAll += DFS(tmpN * 10 + elem, numbers2, N);
	}

	return countAll;
}

int Work5_core(int N)
{
	vector<int> numbers;
	return DFS(0, numbers, N);
}

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

	int result = Work5_core(N);

	cout << result;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll  unsigned long long
#define ld  long double
#define endl '\n'
#define FAST ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const ll MOD = 998244353;
const double PI = 3.141592653589793238463;
const int MAXN = 1000030;

int main()
{
    FAST
    int n;
    cin>>n;
    if(n%10==3)
        cout<<"bon"<<endl;
    else if((n%10==8) || (n%10==6) || (n%10==1) || (n%10==0))
        cout<<"pon"<<endl;
    else{
        cout<<"hon"<<endl;
    }
    return 0;
}


Measured memory_bytes: 3624
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Linq.Expressions;
using System.Text;

class Procon {
    static void Main (string[] agrs) {
        var r = Long();
        var D = Long();
        var x = Long();

        for (int i = 0; i < 10; i++) {
            x = r * x - D;
            Console.WriteLine(x);
        }
    }

    static string String () => Scanner.nextString ();
    static int Int () => int.Parse (Scanner.nextString ());
    static long Long () => long.Parse (Scanner.nextString ());
    static double Double () => double.Parse (Scanner.nextString ());
    static char[] Chars () => String ().ToCharArray ();
    static string[] Strings () => Console.ReadLine ().Split (' ');
    static int[] Ints () => Strings ().Select (v => int.Parse (v)).ToArray ();
    static long[] Longs () => Strings ().Select (v => long.Parse (v)).ToArray ();
    static double[] Doubles () => Strings ().Select (v => double.Parse (v)).ToArray ();
    const int M = 1000000007;
}

class PriorityQueue<T> where T : IComparable<T> {
    public T[] heap;
    public int size;
    public int sign;
    public PriorityQueue (int N, bool descend = false) {
        heap = new T[N];
        sign = 1;
        if (descend) sign = -1;
    }
    public int Compare (T x, T y) {
        return x.CompareTo (y) * sign;
    }
    public void Push (T x) {
        int i = size++;
        while (i > 0) {
            int p = (i - 1) / 2;
            if (Compare (x, heap[p]) >= 0) {
                break;
            }
            heap[i] = heap[p];
            i = p;
        }
        heap[i] = x;
    }
    public T Pop () {
        T ret = heap[0];
        T x = heap[--size];
        int i = 0;
        while (i * 2 + 1 < size) {
            int a = i * 2 + 1;
            int b = i * 2 + 2;
            if (b < size && Compare (heap[a], heap[b]) > 0) {
                a = b;
            }
            if (Compare (heap[a], x) >= 0) {
                break;
            }
            heap[i] = heap[a];
            i = a;
        }
        heap[i] = x;
        return ret;
    }
    public int Count () {
        return size;
    }
}

class Scanner {
    static string[] s = new string[0];
    static int i = 0;
    static int max_i = 0;
    static public string nextString () {
        if (i >= s.Length) {
            s = Console.ReadLine ().Split (' ');
            max_i = s.Length;
            i = 0;
            if (max_i == 0) {
                return "";
            }
            return s[i++];
        }
        return s[i++];
    }
}


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

int main() {
 int A,B,a;
 cin>>A>>B>>a;
  
  
   int count=0;  
  
  vector<int>prue(B);
  
 for(int i=0;i<B;i++){
   cin>>prue[i];
 }
  
  
  for(int i=0;i<A;i++){
    vector<int>bi(B);
    int counti=a;
    for(int j=0;j<B;j++){
      cin>>bi[j];
      counti+=bi[j]*prue[j];
    }
  
    
     if(counti>0){
       count++;
     }
     
  
  }
  cout<<count;
  
}



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

// @author: pashka

int main() {
    ios::sync_with_stdio(false);

    long x;
    cin >> x;
    int t = 0;
    long cur = 100;
    while (cur < x) {
        cur = cur + cur / 100;
        t++;
    }
    cout << t << "\n";

    return 0;
}

Measured memory_bytes: 3620
n,m = map(int,input().split())

dp = [0]*m

for _ in range(n):
    t = list(map(int,input().split()))
    a = t.pop(0)
    for i in range(a):
        dp[t[i]-1] += 1
ans = 0
#print(dp)
for i in dp:
    if i == n:
        ans += 1
print(ans)

Measured memory_bytes: 38256
import Control.Monad
import Data.Maybe
import qualified Data.ByteString.Char8 as BS
import Data.List
import qualified Data.IntMap.Strict as IM

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words
getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine

main = do
    n <- getInt
    as <- getIntList
    let ls = zipWith (+) [1..] as
        rs = zipWith (-) [1..] as
        ans = sum [ fromMaybe 0 $ m IM.!? l | l <- ls]
            where m = IM.fromListWith (+) $ zip rs [1,1..]
    print ans

Measured memory_bytes: 50404
#include <iostream>
#include <vector>
#include <string>
#include <cstdint>

unsigned int N;
std::vector<unsigned int> data;

inline void build(const std::string& s){
    const unsigned int n = s.size();
    N = 1; while(N < n) N <<= 1;  data.resize(2 * N);
    unsigned int i, j;
    for(i = 0, j = N; i < n; ++i, ++j) data[j] = 1 << (s[i] - 'a');
    for(; i < N; ++i, ++j) data[j] = 0;
    for(i = N - 1; i ; --i) data[i] = data[i << 1] | data[(i << 1) | 1];
}

inline void update(unsigned int index, const char c){
    data[index += N] = 1 << (c - 'a');
    for(; index > 1; index >>= 1) data[index >> 1] = data[index] | data[index ^ 1];
}

inline unsigned int query(unsigned int l, unsigned int r){
    unsigned int res = 0; l += N; r += N;
    while(l < r){
        if(l & 1) res |= data[l++]; l >>= 1;
        if(r & 1) res |= data[--r]; r >>= 1;
    }
    return res;
}

int main(void){
    std::ios::sync_with_stdio(false); std::cin.tie(nullptr);
    int n, q; std::string s; std::cin >> n >> s >> q;
    build(s);
    while(q--){
        char c; std::cin >> c;
        if(c == '1'){
            int i; char a; std::cin >> i >> a; update(--i, a);
        }
        else{
            int l, r; std::cin >> l >> r;
            std::cout << __builtin_popcount(query(--l, r)) << '\n';
        }
    }    
    return 0;
}


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

#define all(v) v.begin(), v.end()
#define mp make_pair
#define EPS (int)1e-9
#define PI acos(-1)
#define endl '\n'
#define pb push_back
#define fi first
#define se second

using namespace std;
using ld = long double;
using ll = long long;
using vi = vector<int>;
using pii = pair<int, int>;

const int mod = 1000000007;


int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	string s;
	cin >> s;

	int n = s.size();

	for(int i = 0; i < n; i+=2)
		cout << s[i];
	cout << endl;
	return 0;	
}

Measured memory_bytes: 592
import sys

n = int(input())
a_list = list(map(int,input().split()))

if 0 in a_list:
  print(0)
  sys.exit()

cur = 1
for a in a_list:
  cur *= a
  if cur > 10 ** 18:
    print(-1)
    sys.exit()

print(cur)
  

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

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0);
    int n, x;
    cin >> n >> x;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    sort(a.begin(), a.end());
    int ans = 0, r = 0;
    for (int i = 0; i < n; i++) {
        if (a[i] <= x) {
            x -= a[i];
            ans++;
        } else {
            r++;
        }
    }
    if (x > 0 && r == 0) {
        ans--;
    }
    cout << ans << endl;
}



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <tuple>
#include <cmath>
#include <iomanip>
#include <map>
#include <cstring> //memset(dp,0,sizeof(dp))
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define fi first
#define se second
#define pb push_back
#define ALL(a) (a).begin(),(a).end()
using namespace std;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
typedef pair<ll,ll> P;
typedef pair<ll,ll> Pll;
//小数点以下　cout << fixed << setprecision(10) << num << endl;
//桁数はlog10(mid)でやれ　log(mid)/log(10)はWA
//long*long<0で判定するな
//開区間と閉区間
//アルファベットが何番目かは x=s[i]-'a'
//bfsはmain()内で　rep(i,h)rep(j,w)rep(i,4)でバグ
//切り上げ：(a+(b-1))/b
//32bit以上は 1ull<<j
// map 初期値0 for(auto itr=mp.begin();itr!=mp.end();++itr) itr->fi itr->se で全探索
// for(auto u:mp) u.fi u.se も可能
//n個のgcd,lcmは一つずつみて更新していく
//大きな数を扱うときは素因数分解した形で持っておく
// (l/a[i]) = l*powmod(a[i],MOD-2)%MOD;
//auto itr=lower_bound(ALL(a),key) a[itr-a.begin()]

int main(){
    int n; cin >> n;
    ll c; cin >> c;
    ll x[n],v[n];
    rep(i,n){
        cin >> x[i] >> v[i];
    }
    ll ans=0;
    ll a[n],b[n];
    
    ll now=v[0]-x[0];
    a[0]=now;
    rep(i,n){
        if(i==0) continue;
        now+=v[i]-(x[i]-x[i-1]);
        a[i]=now;
    }
    rep(i,n) chmax(ans,a[i]);
    
    now=v[n-1]-(c-x[n-1]);
    b[0]=now;
    rep(i,n){
        if(i==0) continue;
        now+=v[n-1-i]-(x[n-i]-x[n-1-i]);
        b[i]=now;
    }
    rep(i,n) chmax(ans,b[i]);
    
    //a[i]-x[i]+b[j]のうち、i+1+j+1<=nのMAX j<=n-i-2のMAX
    //a[i]+b[j]-(c-x[j])のうち、i+j+2<=nのMAX
    ll aa[n],bb[n];
    ll maa=b[0]-(c-x[n-1]);
    rep(i,n){
        chmax(maa,b[i]-(c-x[n-1-i]));
        bb[i]=maa;
    }
    maa=a[0]-x[0];
    rep(i,n){
        chmax(maa,a[i]-x[i]);
        aa[i]=maa;
    }
    rep(i,n){
        if(n-i-2>=0){
            chmax(ans,a[i]+bb[n-i-2]);
            chmax(ans,b[i]+aa[n-i-2]);
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 4992
import java.io.InputStream;
import java.io.PrintStream;
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	InputStream in = System.in;
	PrintStream out = System.out;

	boolean f(String s, char a, char b, char c) {
		int idx = s.indexOf(a);
		if (idx == -1) {
			return false;
		}

		idx = s.indexOf(b, idx + 1);
		if (idx == -1) {
			return false;
		}

		idx = s.indexOf(c, idx + 1);
		if (idx == -1) {
			return false;
		}

		return true;
	}

	public void _main(String[] args) {
		Scanner sc = new Scanner(in);

		int N = sc.nextInt();
		String S = sc.next();

		sc.close();

		int ans = 0;
		for (int x = 0; x <= 999; x++) {
			if (f(S, (char) (x / 100 + '0'), (char) ((x / 10) % 10 + '0'), (char) ((x % 10) + '0'))) {
				ans++;
			}
		}

		out.println(ans);

	}

	public static void main(String[] args) {
		new Main()._main(args);
	}
}


Measured memory_bytes: 22228
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<cstdio>
#include<cmath>
#include<numeric>
#include<queue>
#include<stack>
#include<cstring>
#include<limits>
#define rep(i,a) for(int i=(int)0;i<(int)a;++i)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
using ll=long long;
static const ll mod = 1e9 + 7;
static  ll INF = 1e9;
using namespace std;

signed main(){
	int n;
	cin>>n;
	if(n<10)cout<<n<<endl;
	else if(n<100)cout<<9<<endl;
	else if(n<1000)cout<<n-90<<endl;
	else if(n<10000)cout<<909<<endl;
	else if(n<100000)cout<<n-9090<<endl;
	else cout<<90909<<endl;
	return 0;
}


Measured memory_bytes: 256
#define DEBUGGING  // Enables DEBUG macro.
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
using u64 = unsigned long long;
#define REP(i, n) for (int i = 0; (i64)(i) < (i64)(n); ++i)

#ifndef DEBUGGING
#define debug(...)
#define DEBUG(...)
#else
template <typename T>
void debug(T value) {
  std::cerr << value;
}
template <typename T, typename... Ts>
void debug(T value, Ts... args) {
  std::cerr << value << ", ";
  debug(args...);
}
#define DEBUG(...)                     \
  do {                                 \
    cerr << " (L" << __LINE__ << ") "; \
    cerr << #__VA_ARGS__ << ": ";      \
    debug(__VA_ARGS__);                \
    cerr << endl;                      \
  } while (0)
#endif

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int N;
  cin >> N;
  vector<int> P(N), Q(N);
  for (auto& x : P) cin >> x;
  for (auto& x : Q) cin >> x;
  vector<int> v(N);
  REP(i, N) v[i] = i + 1;
  int k = 1;
  int a = -1, b = -1;
  do {
    if (v == P) {
      a = k;
    }
    if (v == Q) {
      b = k;
    }
    ++k;
  } while (next_permutation(v.begin(), v.end()));
  cout << abs(a - b) << endl;
}

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

// int/long:		-2147483648 - 2147483648 (-2^31 <= int < 2^31)
// long/long long:	-9223372036854775808 - 9223372036854775807 (-2^63 <= long < 2^63)

#define	INF (1<<29)
//536870912

// lower_bound(A.begin(), A.end(), N)
// upper_bound(...

// bit: &/and, |/or, ^/xor, ~/not

#define	MOD 1000000007

int	main() {
	string s;
	cin >>s;
	for (int i=0; i<s.size(); i++)
		if (0==i%2)
			cout <<s.at(i);
	cout <<endl;
	return 0;
}



Measured memory_bytes: 512
// Garg's Code
#include <bits/stdc++.h>
using namespace std;
#define set set <ll>
#define ll long long
#define vec vector < ll >
#define pb push_back
#define po pop_back
#define mp make_pair
#define mt make_tuple
#define F  first
#define S  second
#define f(i,x,n) for(ll i=x;i<n;i++) 
#define all(c) c.begin(),c.end()
#define fast() ios_base::sync_with_stdio(false);cin.tie(NULL)
const ll MAX = LLONG_MAX;
const ll MIN = LLONG_MIN;

int main() 
{
  fast();
  

  ll n;
  cin >> n;
  ll arr[n], brr[n], crr[n-1];
  ll ans = 0;
  f(i,0,n)
  {
  	cin >> arr[i];
  }
  f(i,0,n)
  {
  	cin >> brr[i];
  }
  f(i,0,n-1)
  {
  	cin >> crr[i];
  }
  ll prev = MAX;
  f(i,0,n)
  {
  	ans += brr[arr[i]-1];
  	if(prev == arr[i] - 1)
  	{
  		ans += crr[prev - 1];
  	}
  	//cout << ans << " ";
  	prev = arr[i];
  }
  cout << ans;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
void err() {
  cout << -1 << endl;
  exit(0);
}
void dfs (int crr, int dpt, vector<vector<int>>& grh, long long& cnt) {
  cnt += dpt;
  for (int nxt : grh[crr]) {
    dfs(nxt, dpt + 1, grh, cnt);
  }
}
int main() {
  int n;
  cin >> n;
  vector<long long> d(n);
  map<long long, int> mp;
  for (int i = 0; i < n; i++) {
    cin >> d[i];
    mp[d[i]] = i;
  }
  sort(d.begin(), d.end(), greater<long long>());
  vector<long long> sz(n, 1);
  vector<vector<int>> grh(n);
  for (auto it = d.begin(); next(it) != d.end(); it++) {
    auto i = mp[*it];
    long long ptv = *it - n + 2 * sz[i];
    auto jt = lower_bound(d.rbegin(), d.rend(), ptv);
    if (jt == d.rend() || *jt != ptv) err();
    auto p = mp[*jt];
    grh[p].push_back(i);
    sz[p] += sz[i];
  }
  long long cnt = 0;
  int rt = mp[d[n - 1]];
  dfs(rt, 0, grh, cnt);
  if (d[n - 1] != cnt) err();
  for (int crr = 0; crr < n; crr++) {
    for (int nxt : grh[crr]) {
      cout << crr + 1 << ' ' << nxt + 1 << endl;
    }
  }
  return 0;
}


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

using namespace std;

int main() {
  int N; vector<int> a;
  cin>>N;
  int x;
  bool all_zero = true;
  for(int i = 0; i < N; i++) { cin>>x; a.push_back(x); all_zero = all_zero && (x == 0); }

  if(N % 3 != 0) {
    if(all_zero) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
  } else {
    sort(a.begin(), a.end());
    bool all_same = true;
    for(int i = 1; i < N / 3; i++) { all_same = all_same && (a[i] == a[0]); }
    for(int i = N / 3 + 1; i < 2 * (N / 3); i++) { all_same = all_same && (a[i] == a[N / 3]); }
    for(int i = 2 * (N / 3) + 1; i < N; i++) { all_same = all_same && (a[i] == a[2 * (N / 3)]); }
    bool target = a[0] ^ a[N / 2] ^ a[N - 1];
    if(target == 0 && all_same) {
      cout<<"Yes"<<endl;
    } else {
      cout<<"No"<<endl;
    }
  }
  return 0;
}


Measured memory_bytes: 892
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <string>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>

using std::cin;
using std::cout;
using std::endl;
using std::setprecision;
using std::fixed;
using std::pair;
using std::make_pair;
using std::string;
using std::vector;
using std::list;
using std::map;
using std::set;
using std::queue;
using std::priority_queue;
using std::stack;

typedef vector<int> VI;
typedef vector<vector<int> > VII;
typedef vector<string> VS;
typedef pair<int, int> PII;

int string_to_int(string str) {
    int length = str.length();
    int number = 0;
    for (int i = 0; i < length; i++) {
        number += (int)(str[i] - '0');
        number *= 10;
    }
    number /= 10;
    return number;
}

string int_to_string(int num) {
    string str = "";
    while (1) {
        if (num / 10 == 0) {
            break; 
        }
        str += (char)((num % 10) + '0');
        num /= 10;
    }
    str += (char)(num + '0');
    reverse(str.begin(), str.end());
    return str; 
}

int times(string left, string right) {
    int l = string_to_int(left);
    int r = string_to_int(right);
    return l * r;
}

void multiple(string &str) {
    int length = str.length();
    int max = 0;
    for (int i = 1; i < length; i++) {
        string left = str.substr(0, i); 
        string right = str.substr(i, length - i); 
        int max_temp = times(left, right);
        if (max_temp > max) {
            max = max_temp;
        }
    }
    str = int_to_string(max);
    return; 
}

int main(void) {
    int q;
    cin >> q;
    for (int loop = 0; loop < q; loop++) {
        string str;
        cin >> str;
        int times = 0;
        while (1) {
            int length = str.length();
            if (length == 1) {
                break;
            }
            times++;
            multiple(str);
        }
        cout << times << endl;
    }
    return 0;
}

Measured memory_bytes: 3208
// Example program
#include <iostream>
#include <string>
#include <map>
#include <algorithm>

using namespace std;

map< pair<int, pair<int, int> > , bool> mp;

int main(){
    
    int A[3] = {};
    
    cin >> A[0] >> A[1] >> A[2];
    
    int ans = 0;
    
    while(1){
        
        sort(A, A + 3);
        
        if((A[0] & 1) || (A[1] & 1) || (A[2] & 1)){
            break;
        }
        
        if(mp[{A[0], {A[1], A[2]}}] == true){
            cout << "-1\n";
            return 0;
        }
        
        mp[{A[0], {A[1], A[2]}}] = true;
        
        int a, b, c;
        
        a = (A[1] + A[2]) >> 1;
        b = (A[0] + A[2]) >> 1;
        c = (A[0] + A[1]) >> 1;
        
        A[0] = a;
        A[1] = b;
        A[2] = c;
        
        ans++;
        
    }
    
    cout << ans << "\n";
    
    return 0;
}

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

int main(int argc, char const *argv[])
{
    int n;
    cin >> n;
    int t = 2 * n;
    double r = Pi * t;
    // printf("%lf\n", r);
    cout << fixed << setprecision(20) << r << endl;

    return 0;
}


Measured memory_bytes: 3788
#include <bits/stdc++.h>
 
using namespace std;
		
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    long long int i,a,b;
    cin>>i;
    if(i==1){
    	cout<<"Hello World";
	}
	else{
		cin>>a;
		cin>>b;
		cout<<a+b;
	}
    return 0;
}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Scanner;
import java.util.function.IntToDoubleFunction;
 
public class Main {
 
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = getInt(sc);
		int b = getInt(sc);
		System.out.println(a * b);
	}
 
	/**
	 * *汎用メソッド<br>
	 * 入力した配列に対する順列を取得
	 *
	 * @param numArray
	 * @return
	 */
	private static List<Integer[]> getPermutation(int[] numArray) {
		List<Integer[]> permutation = new ArrayList<>();
		Integer[] ans = new Integer[numArray.length];
		boolean[] used = new boolean[numArray.length];
 
		return buildPermutaion(permutation, numArray, ans, used, 0);
	}
 
	/**
	 * *汎用メソッド(内部)<br>
	 * 入力した配列に対する順列を作成
	 *
	 * @param list
	 * @param numArray
	 * @param ans
	 * @param used
	 * @param depth
	 * @return
	 */
	private static List<Integer[]> buildPermutaion(List<Integer[]> list, int[] numArray, Integer[] ans, boolean[] used,
			int depth) {
 
		// 全部使い切った時=>できた順列を返す
		if (depth == numArray.length) {
			list.add(ans.clone());
			return list;
		}
		// 使い切っていない場合
 
		for (int i = 0; i < numArray.length; i++) {
			if (used[i]) {
				continue;
			}
			ans[depth] = numArray[i];
			used[i] = true;
			list = buildPermutaion(list, numArray, ans, used, depth + 1);
 
			used[i] = false;
		}
 
		return list;
	}
 
	/**
	 * *汎用メソッド <br>
	 * スキャナーからの入力値をlongで返却
	 *
	 * @return
	 */
	public static long getLong(Scanner sc) {
 
		return Long.parseLong(sc.next());
	}
 
	/**
	 * *汎用メソッド <br>
	 * スキャナーからの入力値をintで返却
	 *
	 * @return
	 */
	public static int getInt(Scanner sc) {
 
		return Integer.parseInt(sc.next());
	}
 
	/**
	 * *汎用メソッド <br>
	 * スキャナーからの入力値をStringで返却
	 *
	 * @return
	 */
	public static String getString(Scanner sc) {
 
		return sc.next();
	}
 
	/**
	 * *汎用メソッド <br>
	 * スキャナーからの入力値をint配列で返却
	 *
	 * @return
	 */
	public static int[] getIntArray(Scanner sc) {
		String line = "";
		// 直前にnext()を実行していると改行コードだけ取ってしまうのでその対策
		while (line.equals("")) {
			line = sc.nextLine();
		}
 
		String[] strArray = line.split(" ");
		int[] intArray = new int[strArray.length];
		for (int i = 0; i < strArray.length; i++) {
			intArray[i] = Integer.parseInt(strArray[i]);
		}
		return intArray;
	}
 
}
 
class Status {
	int row = 0;
	int col = 0;
	int candies = 0;
 
	public Status(int row, int col, int candies) {
		this.row = row;
		this.col = col;
		this.candies = candies;
	}
}

Measured memory_bytes: 35732
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt(),m=sc.nextInt();
		int a;
		a = n*(n-1)/2 + m*(m-1)/2;
		System.out.println(a);
	}
}


Measured memory_bytes: 21844
#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 );
}

int main()
{
    int N;
    cin >> N;
    vector<int> d(N);

    REP(i, N){
        cin >> d[i];
    }
    int ans = 0;
    for(int i=0; i<N-1; i++){
        for(int j=i+1; j<N; j++){
            ans += d[i]*d[j];
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    Map<Integer, Integer> map = new HashMap<>();

    for (int i = 0; i < n; i++) {
      int key = sc.nextInt();
      Integer mapVal = map.get(key);
      map.put(key, mapVal == null ? 1 : ++mapVal);
    }

    long sum = map.entrySet().stream().mapToLong(v -> v.getKey() * v.getValue()).sum();

    int q = sc.nextInt();
    for (int j = 0; j < q; j++) {
      int b = sc.nextInt();
      int c = sc.nextInt();

      Integer bVal = map.get(b);
      Integer cVal = map.get(c);

      map.remove(b);

      if (bVal != null) {
        map.put(c, cVal == null ? bVal : cVal + bVal);
        sum += (long) (c-b) * bVal;
      }

      System.out.println(sum);
    }
  }
}


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

typedef long long ll;

#define PB push_back
#define MP make_pair

const int mx = 1e7 + 1;
int c[mx];

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);
    ll n; cin >> n;
    for (ll i = 1; i <= n; ++i) {
        for (ll j = 0; (j += i) <= n; ) {
            ++c[j];
        }
    }
    ll ans = 0;
    for (ll i = 1; i <= n; ++i) {
        ans += i * c[i];
    }
    cout << ans << "\n";
}

Measured memory_bytes: 42668
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<unordered_map>
#include<queue>
#include<iomanip>
#include<math.h>
#include<bitset>
#include<cassert>
#include<random>
#include<time.h>
using namespace std;
using ll=long long;
using ld=long double;
using P=pair<int,int>;
#define MOD 1000000007LL
#define INF 1000000000LL
#define EPS 1e-10
#define FOR(i,n,m) for(ll i=n;i<(ll)m;i++)
#define REP(i,n) FOR(i,0,n)
#define DUMP(a) REP(d,a.size()){cout<<a[d];if(d!=a.size()-1)cout<<" ";else cout<<endl;}
#define ALL(v) v.begin(),v.end()
#define UNIQUE(v)  sort(ALL(v));v.erase(unique(ALL(v)),v.end());
#define pb push_back

/* --------------------------------------- */

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n;
	cin >> n;
	vector<ll> a(n);
	REP(i,n) cin >> a[i];
	sort(ALL(a));
	vector<ll> acm(n, 0);
	acm[0] = a[0];
	FOR(i,1,n) acm[i] = acm[i - 1] + a[i];
	vector<bool> b(n, false);
	b[n - 1] = true;
	for(ll i = n - 2; i >= 0; i--) {
		if(a[i + 1] <= 2 * acm[i] && b[i + 1]) b[i] = true;
	}
	ll ans = 0;
	REP(i,n) {
		ll lb = i, ub = n;
		while(ub - lb > 1) {
			ll m = (lb + ub) / 2;
			if(a[m] <= 2 * a[i]) lb = m;
			else ub = m;
		}
		if(b[lb]) ans++;
	}
	cout << ans << endl;
	return 0;
}

/* --------------------------------------- */


Measured memory_bytes: 1792
#include <iostream>
#include <algorithm>
#include <functional>

#define f first
#define s second

using namespace std;

typedef pair<int, int> pii;

int main ( void )
{
	int n, m;
	pii p[1000];

	while ( cin >> n >> m, n | m )
	{
		for (int i = 0; i < m; ++i)
		{
			p[i].f = 0;
			p[i].s = m - i;
		}
		for (int i = 0; i < n; ++i)
		{
			for (int j = 0, x; j < m; ++j)
			{
				cin >> x;
				p[j].f += x;
			}
		}

		sort(p, p+m, greater<pii>());

		for (int i = 0; i+1 < m; ++i)
			cout << m - p[i].s + 1 << ' ';
		cout << m - p[m-1].s + 1 << endl;
	}
	return 0;
}

Measured memory_bytes: 1172
#include <iostream>
#include <vector>
#include <cassert>
#include <algorithm>
#include <functional>
#include <cmath>
#include <queue>
#include <set>
#include <stack>
#include <deque>
using ll = long long;
int MOD = 1e9 + 7;
using namespace std;
int main()
{
    string s;
    cin >> s;
    bool h=true;
    int a,b;
    for(int i=0;i<s.size();i++){
        if(s[i]==s[i+1]){
            a=i+1;b=i+2;
            h=false;
            break;
        }
        if(s[i]==s[i+2]){
            a=i+1;b=i+3;
            h=false;
            break;
        }
    }
    if(h){
        cout<<-1<<" "<<-1<<endl;
    }else{
        cout<<a<<" "<<b<<endl;
    }
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
#include<iostream>
#include<string>
#include<cmath>
#include<cstdio>
#include<cctype>
#include<cstring>
#include<iomanip>
#include<cstdlib>
#include<ctime>
#include<set>
#include<map>
#include<utility>
#include<queue>
#include<vector>
#include<stack>
#include<sstream>
#include<algorithm>
#define forn(i,a,b)for(int i=(a),_b=(b);i<=_b;i++)
#define fore(i,b,a)for(int i=(b),_a=(a);i>=_a;i--)
#define rep(i,n)for(int i=0,_n=n;i<n;i++)
#define ll long long
#define pii pair<int,int>
#define vi vector<int>
#define vpii vector<pii>
#define m_p make_pair
#define re return
#define pb push_back
#define si set<int>
#define ld long double
#define X first
#define Y second
#define st string
#define ull unsigned long long
#define mod 1000000007
#define INF 1000000007
#define x1 XZVJDFADSPFOE
#define y1 GASDIJSLDAEJF
#define x2 DFDAJKVOHKWIW
#define y2 PSFSAODSXVNMQ
#define LLINF 0x3f3f3f3f3f3f3f3fLL
using namespace std;
inline void read(int &x)
{
	short negative=1;
    x=0;
    char c=getchar();
    while(c<'0' || c>'9')
    {
		if(c=='-')
			negative=-1;
		c=getchar();
	}
    while(c>='0' && c<='9')
        x=(x<<3)+(x<<1)+(c^48),c=getchar();
    x*=negative;
}
ll quickpower(ll n,ll k){
	ll ans=1;
	while(k){
		if(k%2){
			ans*=n;
			ans%=mod;
		}
		n*=n;
		n%=mod;
		k/=2;
	}
	return ans;
}
string int_to_string(int n)
{
	string s="";
	while(n)
	{
		int now=n%10;
		s+=now+'0';
		n/=10;
	}
	reverse(s.begin(),s.end());
	return s;
}
int string_to_int(string s)
{
	int n=0;
	rep(i,s.size())
	{
		n*=10;
		n+=s[i]-'0';
	}
	return n;
}
int main()
{
	ios::sync_with_stdio(0);
	//think twice,code once
	ll n;
	cin>>n;
	ll now=100;
	int cnt=0;
	while(now<n)
	{
		now+=0.01*now;
		cnt++;
	}
	cout<<cnt<<endl;
	return 0;
}



Measured memory_bytes: 3656
#include <bits/stdc++.h>
#define all(X) (X).begin(),(X).end()
#define rall(X) (X).rbegin(),(X).rend()
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define ff first
#define ss second
#define P 1000000007
#define in(x, a, b) (a <= x && x < b)

using namespace std;
using ll = long long;
typedef pair<int, int> ii;
typedef vector<ii> vii; 
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
const ll inf = 1000000001, INF = (ll)1e18 + 1;

ll power(ll a, ll b) {
	ll result = 1;
	while(b) {
		if(b % 2) result = (result * a) % P;
		a = (a * a) % P;
		b /= 2;
	}
	
	return result;
}

ll divide(ll a, ll b) {
	return a * power(b, P - 2) % P;
}

void solve() {
	int s;
	cin >> s;
	
	ll ans = 0;
	for(int i = 1; i <= s; i++) {
		int n = s - 3 * i;
		if(n < 0) break;
		
		ll res = 1;
		for(int j = 1; j <= n + i - 1; j++) res = (res * j) % P;
		for(int j = 1; j <= n; j++) res = divide(res, j);
		for(int j = 1; j <= i - 1; j++) res = divide(res, j);
		
		ans = (ans + res) % P;
	}
	
	cout << ans << endl;
}

int main() {
	ios_base::sync_with_stdio(false);
	solve();
    return 0;
}

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

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

int main()
{
	int n;
	while(cin >> n, n) {
		
		vector<int> xs(1, 0), ys(1, 0);

		int left = 0, right = 0, top = 0, bottom = 0;

		for(int i = 0; i < n - 1; ++i) {
			int m, d;
			cin >> m >> d;

			int x = xs[m] + dx[d], y = ys[m] + dy[d];
			
			left = min(left, x);
			right = max(right, x);
			top = min(top, y);
			bottom = max(bottom, y);

			xs.push_back(x);
			ys.push_back(y);
		}
		
		/*for(int i = 0; i < n; ++i) {
			cout << xs[i] << ' ' << ys[i] << endl;
		}*/
		cout << right - left + 1 << ' ' << bottom - top + 1 << endl;
	}
}

Measured memory_bytes: 3072
import java.util.*;

public class Main {
		public static void main(String[] args) {
		
	   Scanner sc = new Scanner(System.in);
	   
	   int A = sc.nextInt();
	   int B = sc.nextInt();
	   
	   int ans = A - 2*B;
	   
	   if(ans >= 0) {
		   System.out.println(ans);
	   }else if(ans < 0) {
		   System.out.println(0);
	   }
	   }
}


Measured memory_bytes: 21844
/*
           Nothing is absolute.
     This is the only absolute truth.
*/

#include<bits/stdc++.h>

using namespace std;

using ull = unsigned long long;
using ll = long long;

#define READ freopen("in.txt", "r", stdin)
#define ROUT freopen("out.txt", "w", stdout)
#define pb push_back
#define endl '\n'

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

void fasterIO()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
}

void fileIO()
{
    READ;
    ROUT;
}

void solve()
{
    int i, j;

    string s;

    cin>>s;

    for(i=0; i<s.size(); i++){
        if(s[i]=='B'){
            for(j=i; j>=0; j--){
                if(s[j]=='0' || s[j]=='1'){
                    s[j]='2';
                    break;
                }
            }
        }
    }

    for(i=0; i<s.size(); i++){
        if(s[i]=='0' || s[i]=='1'){
            cout<<s[i];
        }
    }

    cout<<endl;

}

int main()

{
    ///fileIO();
    fasterIO();

    solve();

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <array>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <tuple>
#include <bitset>
#include <memory>
#include <cmath>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <numeric>
#include <climits>
#include <cfloat>

int main() {
	std::cin.tie(0); std::cin.sync_with_stdio(false);
	int n; std::cin >> n;
	std::vector<int> cards(n); for (auto& card : cards) std::cin >> card;
	std::vector<int> card_count(n);
	for (const auto card : cards) {
		card_count[card - 1]++;
	}
	std::sort(card_count.begin(), card_count.end());
	std::vector<int> sum_of_card_count{ 0 }; sum_of_card_count.reserve(n + 1);
	for (auto c: card_count) sum_of_card_count.push_back(c + sum_of_card_count.back());
	for (auto t = 1; t <= n; ++t) {
		auto small = sum_of_card_count[n - t];
		auto min = 0;
		auto max = n / t;
		while (min < max) {
			auto mid = (min + max + 1) / 2;
			if (card_count[n - t] >= mid) min = mid;
			else {
				auto idx = std::distance(card_count.begin(), std::lower_bound(card_count.begin(), card_count.end(), mid));
				auto middle = sum_of_card_count[idx] - small;
				auto middle_count = t - (n - idx);
				if (middle + small >= middle_count * mid) {
					min = mid;
				}
				else {
					max = mid - 1;
				}
			}
		}
		std::cout << min << '\n';
	}
}


Measured memory_bytes: 4352