Sponsors

Codeforces Round #389 (Div. 2, Rated, Based on Technocup 2017 – Elimination Round 3), problem: (E) Santa Claus and Tangerines Solution in C/C++

Codeforces Round #389 (Div. 2, Rated, Based on Technocup 2017 – Elimination Round 3), problem: (E) Santa Claus and Tangerines Solution in C/C++

 

#include<stdio.h>
typedef long long unsigned llu;
typedef unsigned u;
u T[1111111],n,s;
u G(u y,u x)
{
if(y<x)return 0;
u z,r=1,a=0,b=0;
for(z=y;z>=x;z>>=1,++b)r<<=1;r>>=1;
if(z+1==x)a=y&((1u<<b)-1);
return r>a?r:a;
}
u F(u x)
{
u i;llu r=0;
for(i=-1;++i<n;)r+=G(T[i],x);
return r;
}
int main()
{
u i=-1,lo=0,hi=10000001,mi;
for(scanf(“%u%u”,&n,&s);++i<n;)scanf(“%u”,T+i);
while((mi=(lo+hi)>>1)>lo)
{
if(F(mi)>=s)lo=mi;
else hi=mi;
}
printf(lo?”%u\n”:”-1\n”,lo);
return 0;
}

Mapping the Jazz Faculty...

Mapping the Jazz Faculty Gender Gap: A Berklee-Sponsored Study...

Burning Man festivalgoer is...

Burning Man Festivalgoer Found Dead in Pool of Blood;...

Fleischmann says ‘never’ to...

Fleischmann Declares 'Never' to Town Halls, Calling Them 'Left-Wing...

Plastic pollution poses growing...

Plastic Pollution: A Growing Health Threat in Malaysia Malaysia is...

Is A Battery-Powered Cooler...

Is a Battery-Powered Cooler Like the Anker SOLIX EverFrost...

One to watch: Macquarie...

Macquarie Predicts Double-Digit Returns for ASX Healthcare Stock Macquarie Group,...

Mapping the Jazz Faculty Gender Gap

Mapping the Jazz Faculty Gender Gap: A Berklee-Sponsored Study Reveals Stark Imbalance A recently published study sponsored by Berklee College of Music paints a concerning...

Burning Man festivalgoer is found dead in pool of blood as cops launch murder probe

Burning Man Festivalgoer Found Dead in Pool of Blood; Murder Investigation Launched A tragic incident has cast a shadow over the iconic Burning Man festival...

Fleischmann says ‘never’ to town hall (Ruby Rayner/timesfreepress.com)

Fleischmann Declares 'Never' to Town Halls, Calling Them 'Left-Wing Bait' Chattanooga Congressman Chuck Fleischmann has emphatically ruled out holding town hall meetings, labeling them as...

Plastic pollution poses growing health threat as Malaysia eyes Extended Producer Responsibility law

Plastic Pollution: A Growing Health Threat in Malaysia Malaysia is grappling with a significant environmental and health crisis: plastic pollution. A recent report highlights...

Is A Battery-Powered Cooler Like The Anker SOLIX EverFrost 2 Worth It?

Is a Battery-Powered Cooler Like the Anker SOLIX EverFrost 2 Worth It? The summer heat is on, and keeping your drinks refreshingly cold can be...

One to watch: Macquarie tips double-digit returns for this ASX healthcare stock

Macquarie Predicts Double-Digit Returns for ASX Healthcare Stock Macquarie Group, a prominent Australian financial services company, has issued a bullish prediction for a specific ASX-listed...

THE FREEPER CANTEEN – The Look That Up, It Must Be On My Bucket List Quiz – Wednesday, August 27, 2025

The Freeper Canteen: A Look That Up, It Must Be On My Bucket List The Freeper Canteen, a unique online community, has recently launched a...

215% PENGU Rally Incoming? Analyst Says Token ‘Inches’ From Next Leg Up

215% PENGU Rally Incoming? Analyst Predicts Imminent Breakout The cryptocurrency market is constantly fluctuating, and predicting the next big move is a challenge. However, one...

Junk is the new punk: Why we’re falling back in love with retro tech

Junk is the New Punk: Why We're Falling Back in Love with Retro Tech In a world dominated by sleek, minimalist designs and cutting-edge technology,...