akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<queue>
#include<map>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;
typedef pair<int,int> P;
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;
    }
}

const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

double dp[3002][3002];

int main(){
    int n;
    cin >> n;
    double p[3001];
    rep(i,n) cin >> p[i];

    dp[0][0]=1.0;
    for(int i=0;i<n;i++){
        for(int j=0;j<=i;j++){
            dp[i+1][j+1] += dp[i][j]*p[i];
            dp[i+1][j] += dp[i][j]*(1.0-p[i]);
        }
    }
    double ans=0;
    for(int i=(n+1)/2;i<=n;i++){
        ans += dp[n][i];
    }
    printf("%.10f\n",ans);
}

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

using namespace std;

#define int long long
#define ff first
#define ss second
#define pii pair<int, int>
#define pb emplace_back
#define pf emplace_front
#define mp make_pair
#define ld long double

const int MAXN = 200009;
int a[MAXN];
int mi[MAXN];
int ma[MAXN];
int n, k;
int dp[MAXN];

signed main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin >> n >> k;
    for (int i = 0; i < n; i++)
        cin >> a[i];
    deque<int> cur;
    for (int i = 0; i < k + 1; i++)
    {
        while (!cur.empty() && cur.back() > a[i])
            cur.pop_back();
        cur.pb(a[i]);
    }
    mi[0] = cur.front();
    for (int i = k + 1; i < n; i++)
    {
        if (cur.front() == a[i - k - 1])
            cur.pop_front();
        while (!cur.empty() && cur.back() > a[i])
            cur.pop_back();
        cur.pb(a[i]);
        mi[i - k] = cur.front();
    }

    cur.resize(0);
    for (int i = 0; i < k + 1; i++)
    {
        while (!cur.empty() && cur.back() < a[i])
            cur.pop_back();
        cur.pb(a[i]);
    }
    ma[0] = cur.front();
    for (int i = k + 1; i < n; i++)
    {
        if (cur.front() == a[i - k - 1])
            cur.pop_front();
        while (!cur.empty() && cur.back() < a[i])
            cur.pop_back();
        cur.pb(a[i]);
        ma[i - k] = cur.front();
    }

    int cnt = 0;
    dp[0] = 1;
    for (int i = 1; i < n; i++)
    {
        if (a[i] > a[i - 1])
            dp[i] = dp[i - 1] + 1;
        else
            dp[i] = 1;
        if (dp[i] >= k)
            cnt++;
    }

    int ans = 1;
    if (dp[k - 1] == k)
        ans--;
    for (int i = 0; i < n - k; i++)
    {
        if (!(mi[i] == a[i] && ma[i] == a[i + k]) && dp[i + k] < k)
            ans++;
        //cout << ans << "\n";
    }

    if (cnt)
        ans++;

    cout << ans;
}


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

typedef long long ll;

int main(){
  ll n; cin >> n;
  
  map<ll, ll> mp;
  for(ll i=0; i<n; i++){
    int x; cin >> x;
    mp[x]++;
  }
  
  ll ans = 0;
  for(ll i=0; i < 100001; i++)
    ans = max(ans, mp[i-1] + mp[i] + mp[i+1]);
  
  cout << ans << endl;
}

Measured memory_bytes: 6528
#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;

int weishu(int i){
    if(i==0) return 0;
    int len = 0;
    while(i){
        len++;
        i/=10;
    }
    return len;
}

int main(){
    int a,b;
    cin >> a >> b;

    int wa = weishu(a);
    int wb = weishu(b);

    int sum = 0;
    sum = b+a*pow(10,wb)+0.5;
    //cout << pow(10,wb) << endl << sum << endl;
    int qsum = sqrt(sum);

    if(sum == qsum*qsum) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 384
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Buffer([]byte{}, math.MaxInt64)
	sc.Split(bufio.ScanWords)
}

func nextInt() int {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return i
}
func nextStr() string {
	sc.Scan()
	if err := sc.Err(); err != nil {
		panic(err)
	}
	return sc.Text()
}

func max(nums ...int) int {
	if len(nums) == 0 {
		panic("funciton max() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Max(float64(res), float64(nums[i])))
	}
	return res
}

func main() {
	a := nextInt()
	b:= nextInt()
	c:= nextInt()

	m:=max(a,b,c)

	fmt.Printf("%d\n",a+b+c-m)
}


Measured memory_bytes: 640
N = gets.to_i
A = gets.split.map(&:to_i)

denied = false
A.each do |a|
  next if a.odd?
  if a%3 != 0 && a%5 != 0
    denied = true
    break
  end
end
if denied
  puts 'DENIED'
else
  puts 'APPROVED'
end

Measured memory_bytes: 1788
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int t,temp=0;
    cin>>t;
    while(t--)
    {
        long long a,count=0;
        cin>>a;
        for(int i=2;i<=sqrt(a);i++)
        {
            if(a%i==0)
           {
            count++;
            break;
           }
        }
        if(count==0)
        temp++;

    }
    cout<<temp<<endl;

    return 0;
}



Measured memory_bytes: 3088
#include <bits/stdc++.h>
 
#pragma GCC optimize("O2")
#pragma GCC optimize("unroll-loops")
 
using namespace std;
#define ll long long
#define ull unsigned long long
#define rep(i,n,N) for(int i=n;i<=N;++i)
#define rap(i,n,N) for(int i=n;i>=N;--i)
#define mp make_pair
#define pb push_back
#define pob pop_back
#define pf push_front
#define pof pop_front
#define fi first
#define se second
#define ff fi.fi
#define fs fi.se
#define sf se.fi
#define ss se.se
#define lc (id<<1)
#define rc ((id<<1)|1)
#define db(x) cout << ">>>>>> " << #x << " -> " << x << endl
#define all(x) x.begin(),x.end()
#define pii pair<int,int> 
#define pll pair<ll,ll>
#define plll pair<ll,pll>
#define piii pair<int,pii>
#define piiii pair<pii,pll>
#define psi pair<string,int>
#define endl '\n'
const int MAX = 1e5+5;
const ll MAX2 = 11;
const ll MOD = 1010205047;
const ll MOD2 = 1000005329;
const ll INF = 2e18;
const int dr[]={1,0,-1,0,1,1,-1,-1,0};
const int dc[]={0,1,0,-1,1,-1,1,-1,0};
const double pi = acos(-1);
const double EPS = 1e-9;
const int block = 200;

ll n,q,x[MAX],z,a,b,ans;
 
int main(){
//	cout<<fixed<<setprecision(10);
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt","w",stdout);
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    cin>>n;
    rep(i,1,n)cin>>z, x[z]++, ans+= z;
    cin>>q;
    while(q--){
    	cin>>a>>b;
    	ans+= x[a]*(b-a);
    	cout<<ans<<endl;
    	x[b]+= x[a], x[a] = 0;
	}
	return 0;
}

Measured memory_bytes: 4436
#include <iostream>
#include <string>

using namespace std;
int main(){
    string o,e;
    cin>>o>>e;
    string a;
    int d=o.size();
    if(o.size()==e.size()){
        for(int i=0;i<d;i++){
        a=a+o[i]+e[i];
        }
    }else{
        for(int i=0;i,d;i++){
            if(i==d-1){
                a=a+o[i];
                cout<<a<<endl;
                return 0;
            }
            a=a+o[i]+e[i];
        }
    }
    
    cout<<a<<endl;
    return 0;
}


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

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    for (auto& e : a) cin >> e, e--;
    vector<int> d(n, -1);
    for (int i = 0, j = 0; d[i] == -1; i = a[i], j++) d[i] = j;
    cout << d[1] << endl;
}


Measured memory_bytes: 1024
from collections import defaultdict
from math import gcd
import sys


MOD = 10 ** 9 + 7
N = int(input())
sar = defaultdict(int)
zero = 0
for s in sys.stdin.readlines():
    A, B = map(int, s.split())
    if (A, B) == (0, 0):
        zero += 1
    else:
        a = abs(A)
        b = abs(B)
        x = gcd(a, b)
        if a == 0:
            sar[(0, b // x, 1)] += 1
        elif b == 0:
            sar[(a // x, 0, 0)] += 1
        else:
            sar[(a // x, b // x, int((A >= 0) ^ (B >= 0)))] += 1

ans = 1
done = set()
for k in list(sar.keys()):
    a, b, c = k
    if (a, b, c) not in done:
        cnt = pow(2, sar[(a, b, c)], MOD) + pow(2, sar[(b, a, c ^ 1)], MOD) - 1
        ans *= cnt
        ans %= MOD
        done.add((a, b, c))
        done.add((b, a, c ^ 1))

ans -= 1
ans += zero

print(ans % MOD)


Measured memory_bytes: 252444
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60


def main():
    A, B, K = map(int, readline().split())

    if K <= A:
        print(A - K, B)
    elif K <= A + B:
        print(0, A + B - K)
    else:
        print(0, 0)

    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = uint32_t;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max() / 32 * 15 + 208;

int main() {
    int n, m;
    vector<vector<int>> dp(2, vector<int>(256, INF<int>));
    while(cin >> n >> m, n){
        vector<int> c(m), x(n);
        for (auto &&i : c) scanf("%d", &i);
        for (auto &&i : x) scanf("%d", &i);
        for (int i = 0; i < 2; ++i) {
            fill(dp[i].begin(),dp[i].end(), INF<int>);
        }
        dp[0][128] = 0;
        for (int i = 0; i < n; ++i) {
            int now = i&1, nxt = now^1;
            fill(dp[nxt].begin(),dp[nxt].end(), INF<int>);
            for (int j = 0; j < 256; ++j) {
                for (int k = 0; k < m; ++k) {
                    int to = max(0, min(255,j+c[k]));
                    dp[nxt][to] = min(dp[nxt][to], dp[now][j]+(x[i]-to)*(x[i]-to));
                }
            }
        }
        cout << *min_element(dp[n&1].begin(),dp[n&1].end()) << "\n";
    }
    return 0;
}


Measured memory_bytes: 3296
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb emplace_back
#define mp make_pair
typedef long long ll;
typedef pair<int,int> pint;

int main(){
    int n,k,g,ai,mx;
    cin>>n>>k;
    mx=g=0;
    FOR(i,0,n){
        cin>>ai;
        g=__gcd(g,ai);
        mx=max(mx,ai);
    }
    if(mx>=k&&k%g==0) cout<<"POSSIBLE"<<endl;
    else cout<<"IMPOSSIBLE"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int a,b,c,d,e;
  cin>>a>>b>>c>>d>>e;
  if(a==0)
    cout<<1;
  else if(b==0)
    cout<<2;
  else if(c==0)
    cout<<3;
  else if(d==0)
    cout<<4;
  else if(e==0)
    cout<<5;
  return 0;
}

Measured memory_bytes: 3636
// Abu Hurayra (HurayraIIT)
// IIT, Jahangirnagar University

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <bitset>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <math.h>
#include <stdio.h>
#include <string.h>
using namespace std;

typedef long long LL;
typedef long long int int64;
typedef unsigned long long int  uint64;
typedef vector<int> vi; 

#define READ freopen("input.txt", "r", stdin);
#define WRITE freopen("output.txt", "w", stdout);
#define fast_io ios_base::sync_with_stdio(0);  cin.tie(0);
#define sz(a) int((a).size())
#define space " "
#define all(x) (x).begin(), (x).end()
#define endl '\n'
#define pi acos(-1.0)
#define MP make_pair
#define PB push_back
#define INF (int)1e9
#define MOD 1000000007
#define PRECISION(x) cout << fixed << setprecision(x); 
 
 
int main()
{
    fast_io
    
    string s ;
    cin >> s ;
    int i,n,l=s.size();
    vi v;
    int flg = 0 , cnt = 0, res=0;
    
    if(s=="SSR") cout << 1 << endl;
    else if(s=="SRS") cout << 1 << endl;
    else if(s=="RSS") cout << 1 << endl;
    else if(s=="RSR") cout << 1 << endl;
    else if(s=="SRR") cout << 2 << endl;
    else if(s=="RRS") cout << 2 << endl;
    else if(s=="RRR") cout << 3 << endl;
    else if(s=="SSS") cout << 0 <<endl;
    
    
    return 0;
}


 

Measured memory_bytes: 3640
#include <iostream>
#include <algorithm>

#define N 100000007

using namespace std;

int inverse(int x) {
    int n = N - 2;
    long long int a = x;
    long long int y = 1;
    while (n > 0) {
        if (n % 2 > 0) {
            y = y * a % N;
        }
        a = a * a % N;
        n /= 2;
    }
    return y;
}

int combination(int n, int k) {
    long long int c = 1;
    for (int i = 0; i < min(k, n - k); ++i) {
        c = c * (n - i) * inverse(i + 1) % N;
    }
    return c;
}

int main() {
    int r, c, a1, a2, b1, b2, w, h;
    long long int k = 1;
    cin >> r >> c >> a1 >> a2 >> b1 >> b2;
    w = min(abs(a1 - b1), r - abs(a1 - b1));
    h = min(abs(a2 - b2), c - abs(a2 - b2));
    if (w * 2 == r) {
        k *= 2;
    }
    if (h * 2 == c) {
        k *= 2;
    }
    cout << combination(w + h, w) * k % N << endl;
    return 0;
}

Measured memory_bytes: 1160
n,m,x=(map(int,input().split()))
a=[]
ans=99999999999999999999999999
for i in range(n):
    a.append(list(map(int,input().split())))
for i in range(2**n+1):
    ta=0
    temp=[0]*m
    for j in range(n):
        if (i&(1<<j))!=0:
            ta+=a[j][0]
            for k in range(m):
                temp[k]+=a[j][k+1]
    flag=True
    # print(*temp)
    for k in range(m):
        if temp[k]>=x:
            continue
        flag=False
        break
    if flag:
        ans=min(ta,ans)
if ans==99999999999999999999999999:
    print(-1)
else:
    print(ans)

Measured memory_bytes: 9260
n, a, b, c = list(map(int, input().split()))
ss = []
for i in range(n):
    ss.append(input())
ans = []
num_dic = {"A": a,"B": b, "C": c}

for i in range(n):
    s = ss[i]
    if num_dic[s[0]] == 0 and num_dic[s[1]] == 0:
        print("No")
        exit()
    elif num_dic[s[0]] > num_dic[s[1]]:
        num_dic[s[0]] -= 1
        num_dic[s[1]] += 1
        ans.append(s[1])
    elif num_dic[s[0]] < num_dic[s[1]]:
        num_dic[s[0]] += 1
        num_dic[s[1]] -= 1
        ans.append(s[0])
    elif i == n -1:
        ans.append(s[0])
        num_dic[s[0]] -= 1
        num_dic[s[1]] += 1
    elif s[0] in ss[i+1]:
        num_dic[s[0]] += 1
        num_dic[s[1]] -= 1
        ans.append(s[0])
    else:
        num_dic[s[0]] -= 1
        num_dic[s[1]] += 1
        ans.append(s[1])
print("Yes")
for a in ans:
    print(a)


Measured memory_bytes: 16900
from sys import stdin, stdout
import math
import bisect
import datetime

n = int(stdin.readline().strip())
arr = list(map(int, stdin.readline().strip().split()))
arr.insert(0,0)
d={}
for i in range(len(arr)):
    d[i] = arr[i]
arr = sorted(d.items(), key=lambda a: a[1])

dp = [[0 for i in range(2005)] for j in range(2005)]

for i in range(1, n + 1):
    dp[i][i]=arr[1][1]*abs(arr[1][0]-i)

for l in range(2, n + 1):
    pos, val = arr[l]
    for left in range(1, n - l + 2):
        right = left + l - 1
        dp[left][right] = max(dp[left + 1][right] + val * abs(pos - left), dp[left][right - 1] + val * abs(pos - right))

stdout.writelines(str(dp[1][n]) + '\n')

Measured memory_bytes: 102300
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <iostream>
#include <fstream>

#include<bits/stdc++.h>
using namespace std;

#define rep(i,n) for(int64_t i = 0;i < n;i++)
using ll = int64_t;
template<class T> bool chmin(T& a,T b){
    if(a > b){ a = b; return true; }else return false;
}
template<class T> bool chmax(T& a,T b){
    if(a < b){ a = b; return true; }else return false;
}


class CPushpush {
public:
	void solve(std::istream& cin, std::ostream& cout) {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(20);

        int64_t n;cin >> n;
        vector<int> a,b;

        rep(i,n){
            int64_t foo;cin >> foo;
            if(i % 2 == 0) a.push_back(foo);
            else b.push_back(foo);
        }

        if(n % 2 == 1){
            reverse(a.begin(),a.end());
            for(auto i : a)cout << i << ' ';
            for(auto i : b)cout << i << ' ';
            cout << '\n';
        }else{
            reverse(b.begin(),b.end());
            for(auto i : b)cout << i << ' ';
            for(auto i : a)cout << i << ' ';
            cout << '\n';
        }

        //int t;cin >> t;rep(i,t)main2(cin,cout);
	}
	void main2(istream& cin,ostream& cout){

	}
};


int main() {
	CPushpush solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define vlli vector<ll>
#define vi vector<int>
#define vs vector<string>
#define vplli vector< pair< ll,ll> >
#define plli pair< ll,ll >
#define vps vector< pair< string, string> >
#define vpi vector< pair< int, int> >
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define fast ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define forn(i,a,n) for(ll i=a;i<n;i++)
#define forr(i,n,a) for(ll i=n-1;i>=a;i--)
#define scan(arr,a,n) for(int i=(a);i<(n);i++)cin>>(arr)[i];
#define print(arr,a,n) for(int i=(a);i<(n);i++)cout<<(arr)[i]<<' ';

const ll inf = 1e18;

ll add(ll x, ll y) {ll res = x + y; return (res >= mod ? res - mod : res);}
ll mul(ll x, ll y) {ll res = x * y; return (res >= mod ? res % mod : res);}
ll sub(ll x, ll y) {ll res = x - y; return (res < 0 ? res + mod : res);}
ll power(ll x, ll y) {ll res = 1; x %= mod; while (y) {if (y & 1)res = mul(res, x); y >>= 1; x = mul(x, x);} return res;}
ll mod_inv(ll x) {return power(x, mod - 2);}

int main(){
	fast;
	ll n;
	cin>>n;
	ll a[n];
	scan(a, 0, n);
	ll ans = 0;
	forn(i, 1, n){
		if(a[i]<a[i-1]){
			ans+=abs(a[i] - a[i-1]);
			a[i] = a[i-1];
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 5200
#include <stdio.h>
int main() {
  char s[3];
  int ans;
  scanf ("%s", s);

  if (s[0] == 'M') ans = 6;
  else if (s[0] == 'W') ans = 4;
  else if (s[0] == 'F') ans = 2;
  else if (s[2] == 'N') ans = 7;
  else if (s[2] == 'E') ans = 5;
  else if (s[2] == 'U') ans = 3;
  else if (s[2] == 'T') ans = 1;

  printf ("%d\n", ans);

  return 0;
}


Measured memory_bytes: 128
#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;
#define maxn 7
#define maxm 55
template <typename T>inline T read()
{
    register T sum=0;
    register char cc=getchar();
    int sym=1;
    while(cc!='-'&&(cc>'9'||cc<'0'))cc=getchar();
    if(cc=='-')sym=-1,cc=getchar();
    sum=sum*10+cc-'0';
    cc=getchar();
    while(cc>='0'&&cc<='9')sum=sum*10+cc-'0',cc=getchar();
    return sym*sum;
}
template <typename T>inline T read(T &a)
{
    a=read<T>();
    return a;
}
template <typename T,typename... Others> inline void read(T& a, Others&... b)
{
    a=read(a);
	read(b...);
}
int n,m,cnt,a[maxn];
double ans,f[maxn*maxm][1<<maxn];
int main()
{
	read(n,m);
	for(int i=0;i<n;i++)
		read(a[i]);
	sort(a,a+n);
	do
	{
		memset(f,0,sizeof(f));
		f[n*a[n-1]][0]=1;
		for(int i=0;i<n*m;i++)
			for(int j=i;j<=n*m;j++)
				for(int k=0;k<(1<<(n-1));k++)
					if(i%n&&!((k>>(i%n-1))&1))
						f[min(max(j,i+n*a[i%n-1]),n*m)][k|(1<<(i%n-1))]+=f[j][k];
		ans+=f[n*m][(1<<(n-1))-1];
		cnt+=1;
	}while(next_permutation(a,a+n-1));
	printf("%.15lf\n",ans/cnt/pow(m,n-1));
    return 0;
}


Measured memory_bytes: 640
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <iterator>
#include <cmath>
#include <set>
#include <deque> 
#include <string>


using namespace std;

long long a, v;
long long b, w;
long long t;

int main()
{
	scanf("%lld%lld", &a, &v);
	scanf("%lld%lld", &b, &w);
	scanf("%lld", &t);
	long long ta, tb;
	
	
	long long dist = abs(a - b);
	long long vDist = v - w;
	if (vDist > 0) {
		if (dist > (t * vDist)) {
			printf("NO\n");
		} else {
			printf("YES\n");
		}
	} else {
		printf("NO\n");
	}
	
	
	return 0;
}


Measured memory_bytes: 1660
N=int(input())
T,A=map(int,input().split(" "))
H=[int(s) for s in input().split(" ")]

Temp=[]
for index in range(N):
    func=abs(A-(T-0.006*H[index]))
    func1=[func,index]
    Temp.append(func1)

Temp.sort()
    
    
print(Temp[0][1]+1)

Measured memory_bytes: 3188
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;
 
#define fi first
#define se second
#define mp make_pair
#define pb push_back
 
typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef unsigned long long ull;
typedef long double ld; 
typedef tree<ii, null_type, less<ii>, rb_tree_tag, tree_order_statistics_node_update> pbds;

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	ll k=0;
	int n; cin>>n;
	while((k*(k-1))/2 < n) k++;
	int cnt=0;
	if((k*(k-1))/2==n)
	{
		cout<<"Yes\n";
		cout<<k<<'\n';
		map<ii,int> ma;
		for(int i=0;i<k;i++)
		{
			cout<<k-1;
			if(k>0)
			{
				vi vec;
				for(int j=0;j<k;j++)
				{
					if(j==i) continue;
					if(ma.find(mp(min(i,j),max(i,j)))==ma.end())
					{
						ma[mp(min(i,j),max(i,j))]=cnt++;
					}
					vec.pb(ma[mp(min(i,j),max(i,j))]);
				}
				cout<<' ';
				for(int j=0;j<k-1;j++) 
				{
					cout<<vec[j]+1;
					if(j+1<k-1) cout<<' ';
				}
			}
			cout<<'\n';
		}
	}
	else
	{
		cout<<"No\n"; 
	}
}


Measured memory_bytes: 7680
#include<bits/stdc++.h>
#define rep(i,n,m) for(int i = (n); i <(m); i++)
#define rrep(i,n,m) for(int i = (n) - 1; i >=(m); i--)
using namespace std;
using ll = long long;
using pii = pair<int, int>;
const int INF = 1000000004;

int main()
{
    int n, m;
    cin >> n >> m;
    vector<pii> infos[n];
    rep(i, 0, m)
    {
        int l, r, d;
        cin >> l >> r >> d;
        --l, --r;
        infos[l].emplace_back(r, d);
        infos[r].emplace_back(l, -d);
    }

    vector<int> used(n, 0);
    vector<int> dis(n, INF);
    rep(i, 0, n)
    {
        if (used[i]) continue;
        dis[i] = 0;

        queue<int> que;
        que.push(i);
        while(que.size())
        {
            int now = que.front();
            que.pop();

            if(used[now]) continue;
            used[now] = 1;

            for (auto info: infos[now])
            {
                int next, d;
                tie(next, d) = info;

                int next_d = dis[now] + d;
                if (dis[next] == INF)
                    dis[next] = next_d;
                else
                {
                    if (dis[next] == next_d)
                        continue;
                    else
                    {
                        cout << "No" << endl;
                        return 0;
                    }
                }
                que.push(next);
            }
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 9728
#include <bits/stdc++.h>
using namespace std;
int main() {
	int l, r;
	cin >> l >> r;
	if (r - l >= 2 * 2019) {
		cout << "0" << endl;
		return 0;
	} else {
		int ans = 1e9;
		for (int i = l; i <= r; i++) {
			for (int j = i + 1; j <= r; j++) {
				int t1 = i%2019;
				int t2 = j%2019;
				ans = min(ans, (t1 * t2) % 2019);
			}
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 256
using System;

namespace a
{
    class Program
    {
        static void Main(string[] args)
        {
            var _ = Console.ReadLine().Split();
            var a = int.Parse(_[0]);
            var b = int.Parse(_[1]);

            if(a <= 9 && b <= 9){
                Console.WriteLine(a * b);
            }else{
                Console.WriteLine(-1);
            }
        }
    }
}


Measured memory_bytes: 13140
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
#include<list>
#include <array>
using namespace std;
#define i64  long long
#define int  long long
 
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807
#define INF I64_MAX
#define MOD 1000000007


void solve(void)
{
  string A,B,C;
  cin>>A;
  cin>>B;
  cin>>C;

  int index_A = 0; 
  int index_B = 0;
  int index_C = 0;

  while(true)
  {
    static int turn = 0;//0 1 2;

    if(turn == 0)
    {

      if(index_A == A.size())
      {
        cout<<"A"<<endl;
        break;
      }

      turn = A[index_A] - 'a';
      index_A++;
    }
    else if(turn == 1)
    {

      if(index_B == B.size())
      {
        cout<<"B"<<endl;
        break;
      }
      turn = B[index_B] - 'a';
      index_B++;
    }
    if(turn == 2)
    {

      if(index_C == C.size())
      {
        cout<<"C"<<endl;
        break;
      }
      turn = C[index_C] - 'a';
      index_C++;
    }
  }

  return;
}



int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  // std::cout << std::fixed;
  // std::cout << std::setprecision(8);

  solve();

 
  return 0;
}

Measured memory_bytes: 256
# include <bits/stdc++.h>
 
# define x first    
# define y second
# define mp make_pair
// everything go according to my plan      
# define pb push_back
# define sz(a) (int)(a.size())
# define vec vector         
// shimkenttin kyzdary, dzyn, dzyn, dzyn...
# define y1    Y_U_NO_y1
# define left  Y_U_NO_left
# define right Y_U_NO_right  
 
using namespace std;
 
typedef pair <int, int> pii; 
typedef long long ll;
typedef long double ld;
 
const int Mod = (int)1e9 + 7;
const int MX = 1073741822;
const ll MXLL = 4e18;
const int Sz = 1110111;
// a pinch of soul
inline void Read_rap () {
  ios_base :: sync_with_stdio(0);
  cin.tie(0); cout.tie(0);
}
inline void randomizer3000 () {
  unsigned int seed;
  asm ("rdtsc" : "=A"(seed));
  srand (seed);
}
void files (string problem) {   
  if (fopen ((problem + ".in").c_str(),"r")) {
    freopen ((problem + ".in").c_str(),"r",stdin);
    freopen ((problem + ".out").c_str(),"w",stdout);
  }
}
void localInput(const char in[] = "s") { 
  if (fopen (in, "r")) {
    freopen (in, "r", stdin);
  }
  else
    cerr << "Warning: Input file not found" << endl;
}
int n;
       
int a[Sz * 10], b[Sz * 10];
                   
int main()
{
  # ifdef Local
    //localInput();
  # endif
  Read_rap();
  cin >> n;      
  for (int i = 1; i <= n; i++) {
    int x; cin >> x;
    a[x] = b[x] = i;
  }
  int ptr = 1;                     
  for (int i = 1; i <= n*n; i++) {
    if (b[i]) {  
      for (int j = 1; j < b[i]; j++) {
        while (a[ptr] && ptr < i)
          ptr++;
        if (ptr >= i) {
          cout << "No"; return 0;
        }    
        a[ptr] = b[i];
      }
    }
  }
  ptr = n * n;
  for (int i = n*n; i >= 1; i--) {
    if (b[i]) {
      for (int j = 1; j <= n - b[i]; j++) {
        while (a[ptr] && ptr >= i)
          ptr--;
        if (ptr <= i) {
          cout << "No"; return 0;
        }
        a[ptr] = b[i];
      }
    }
  }
  cout << "Yes" << endl;
  for (int i = 1; i <= n*n; i++)
    cout << a[i] << ' ';         
 
 
  return 0;
}
 


Measured memory_bytes: 3968
#include "bits/stdc++.h"

using namespace std;

void Main() {
    int D, T, S;
    cin >> D >> T >> S;
    if (D <= S * T) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
}

int main() {
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 3628
#include <iostream>

using namespace std;

const long long P = 1000000007;

long long fac[1000001];
long long ifac[1000001];

long long mod_pow(long long a, long long p) {
	long long ans = 1;

	while (p != 0) {
		if (p & 1) {
			ans = ans * a % P;
		}
		a = a * a % P;
		p = p >> 1;
	}
	return ans;
}

void init_fac_table(void) {
	fac[0] = 1;
	ifac[0] = 1;
	for (int i = 0; i < 1000000; i++) {
		fac[i + 1] = fac[i] * (i + 1) % P;
		ifac[i + 1] = ifac[i] * mod_pow(i + 1, P - 2) % P;
	}
}

long long nCr(long long n, long long r) {
	if (n == 0 && r == 0) {
		return 1;
	}
	if (n < r || n < 0) {
		return 0;
	}
	long long t = ifac[n - r] * ifac[r] % P;
	return t * fac[n] % P;
}

int main(int argc, char *argv[])
{
	int X, Y;
	int m, n;

	cin >> X >> Y;

	if ((X + Y) % 3 != 0) {
		cout << 0 << endl;
		return 0;
	}

	m = (2 * X - Y) / 3;
	n = (2 * Y - X) / 3;
	if (m < 0 || n < 0) {
		cout << 0 << endl;
		return 0;
	}

	init_fac_table();
	long long ans = nCr(n + m, n);

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 15872
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.Scanner;
import java.util.function.Function;
import java.util.stream.Collectors;

public class Main {
	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
        Scanner sc = new Scanner(System.in);
		String s = sc.next();
		int ans = 0;
		int N = s.length();
		int M = 2019;
		Integer[] DP = new Integer[N+1];
		Arrays.fill(DP, 0);
		int ten = 1;
		DP[N-1] = Character.getNumericValue(s.charAt(N-1));
		for(int i=N-1;i>=0;i--) {
			DP[i] = (DP[i+1]+Character.getNumericValue(s.charAt(i))*ten)%M;
			ten = (ten*10)%M;
		}
		
		List<Integer> list = Arrays.asList(DP);
		
		Map<Integer, Long> counts = list.stream().collect(Collectors.groupingBy(Function.identity(), Collectors.counting()));
		
		for(Long value : counts.values()) {
			ans+=value*(value-1)/2;
		}
		
        System.out.println(ans);
        

	}
	
	
	
}




Measured memory_bytes: 47728
a = io.read()
b = io.read()
-- a = "abcdefghijklmnopqrstuvwxyz"
-- b = "ibyhqfrekavclxjstdwgpzmonu"
t1 = {}
t2 = {}
local function f(t, a, i)
	c = a:sub(i,i)
	t[c] = t[c] or 0
	t[c] = t[c] + 1
end
for i = 1, #a do
	f(t1, a, i)
	f(t2, b, i)
end

local function solve()
	for i = 1, #a do
		c1 = a:sub(i,i)
		c2 = b:sub(i,i)
		if t1[c1] ~= t2[c2] then
			return "No"
		end
	end
	return "Yes"
end
print(solve())

Measured memory_bytes: 836
/*

    author : s@if

*/

#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define 		NIL 			-1
#define		 	fi	 		    first
#define 		sec 			second
#define 		MAX 			INT_MAX
#define			INF 			99999999
#define 		ll 			    long long
#define 		PI 			    acos(-1.0)
#define			MOD 			1000000007
#define 		PLL 			pair<ll,ll>
#define 		PII			    pair<int,int>
#define 		ull 			unsigned long long
#define 		For(i,a,b) 		for(int i=a;i<=(int)b;i++)
typedef tree<int, null_type, less<int>, rb_tree_tag,
            tree_order_statistics_node_update> new_data_set;

//*find_by_order(k)  gives the kth element;
//order_of_key(item)   gives the index(number of element strictly less than item) of item;


inline int in() {int x; scanf("%d", &x); return x; }
bool Check(int N , int pos)	{	return (bool) (N & (1<<pos));}
int Set(int N, int pos) {	return N = N | (1<<pos);}

int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};
int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};
int hr[]={-2,-2,-1,+1,+2,+2,-1,+1};
int hc[]={+1,-1,+2,+2,-1,+1,-2,-2};
int dx[]={+1,-1,+0,+0};
int dy[]={+0,+0,+1,-1};

const int MAXN = (int)1e5+9;

int main()
{
/*	freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);  */

    int i,j,k,l,m,n,p,q,x,y,u,v,r,tc,t;

    string s, s1, s2; cin>>l;
    cin>>s; s1 = ""; s2 = "";

    if(l%2==1)
        cout<<"No\n";
    else
    {
        for(i=0; i<l/2; i++)
            s1+=s[i];
        for(; i<l; i++)
            s2+=s[i];

        if(s1==s2)
            cout<<"Yes\n";
        else
            cout<<"No\n";
    }

   // main();

    return 0;
}

// read the question correctly (is y a vowel? what are the exact constraints?)
// look out for SPECIAL CASES (n=1?) and overflow (ll vs int?)


Measured memory_bytes: 256
import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.regex : regex;
import std.container;
import std.bigint;


void main()
{
  auto rgb = readln.chomp.split.map!(to!int);
  writeln((rgb[0]*100+rgb[1]*10+rgb[2])%4?"NO":"YES");
}


Measured memory_bytes: 256
def solve():
    N = int(input())
    S = input()

    if N != len(S):
        return

    ans = 0
    for i in range(N-2):
        target_segment = S[i:i+3]
        if target_segment == "ABC":
            ans += 1
    print(ans)

if __name__ == "__main__":
    solve()

Measured memory_bytes: 9092
//  ____            _                  _                       _       _
// |  _ \ _   _ ___| |_    ___ _ __   | |_ ___ _ __ ___  _ __ | | __ _| |_ ___
// | |_) | | | / __| __|  / __| '_ \  | __/ _ \ '_ ` _ \| '_ \| |/ _` | __/ _ \
// |  _ <| |_| \__ \ |_  | (__| |_) | | ||  __/ | | | | | |_) | | (_| | ||  __/
// |_| \_\\__,_|___/\__|  \___| .__/___\__\___|_| |_| |_| .__/|_|\__,_|\__\___|
//                            |_| |_____|               |_|

//https://github.com/manta1130/Competitive_Programming_Template_Rust

#[macro_use]
mod input {

    use std;
    use std::io;

    const SPLIT_DELIMITER: char = ' ';

    #[macro_export]
    #[allow(unused_macros)]
    macro_rules! input {
    ( $($x:expr ),*) => {
        {
            let temp_str = input_line_str();
            let mut split_result_iter = temp_str.split_whitespace();
                $(
                let buf_split_result = split_result_iter.next();
                let buf_split_result = buf_split_result.unwrap();
                    ($x) = buf_split_result.parse().unwrap();
                )*
        }
    };
}

    #[allow(dead_code)]
    pub fn input_line_str() -> String {
        let mut s = String::new();
        io::stdin().read_line(&mut s).unwrap();
        s.trim().to_string()
    }

    #[allow(dead_code)]
    pub fn p<T>(t: T)
    where
        T: std::fmt::Display,
    {
        println!("{}", t);
    }

    #[allow(dead_code)]
    pub fn input_vector2d<T>(line: usize) -> Vec<Vec<T>>
    where
        T: std::str::FromStr,
    {
        let mut v: Vec<Vec<T>> = Vec::new();

        for _ in 0..line {
            let vec_line = input_vector();
            v.push(vec_line);
        }
        v
    }

    #[allow(dead_code)]
    pub fn input_vector<T>() -> Vec<T>
    where
        T: std::str::FromStr,
    {
        let mut v: Vec<T> = Vec::new();

        let s = input_line_str();
        let split_result = s.split(SPLIT_DELIMITER);
        for z in split_result {
            let buf = match z.parse() {
                Ok(r) => r,
                Err(_) => panic!("Parse Error"),
            };
            v.push(buf);
        }
        v
    }

    #[allow(dead_code)]
    pub fn input_vector_row<T>(n: usize) -> Vec<T>
    where
        T: std::str::FromStr,
    {
        let mut v = Vec::with_capacity(n);
        for _ in 0..n {
            let buf = match input_line_str().parse() {
                Ok(r) => r,
                Err(_) => panic!("Parse Error"),
            };
            v.push(buf);
        }
        v
    }

    pub trait ToCharVec {
        fn to_charvec(&self) -> Vec<char>;
    }

    impl ToCharVec for String {
        fn to_charvec(&self) -> Vec<char> {
            self.to_string().chars().collect::<Vec<_>>()
        }
    }
}
use input::*;

fn main() {
    let (mut a, b): (usize, usize);
    input!(a, b);
    let mut ans = 0;
    while a <= b {
        ans += 1;
        a *= 2;
    }
    println!("{}", ans);
}



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

using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for (ll i = (ll)(n) - 1; i >= 0; i--)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007
#define INF (1LL << 62)

#define PI (acos(-1))
#define print(x) cout << x << endl
 
ll gcd(ll a, ll b) { return b ? gcd(b,a%b) : a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
ll countDigit(ll n) { return floor(log10(n) + 1); } 
typedef pair <ll,ll> P;
static const ll dy[4] = {0,1,0,-1}, dx[4] = {1,0,-1,0};

template <typename T> 
ostream& operator<<(ostream& os, const vector<T>& v) 
{ 
    for (int i = 0; i < (int)v.size(); ++i) { 
        os << v[i]; 
        if (i != (int)v.size() - 1) 
            os << " "; 
    } 
    return os; 
} 

ll nCrModp(ll n, ll r, ll p)
{
    ll C[r+1];
    memset(C, 0, sizeof(C));

    C[0] = 1;

    for (ll i = 1; i <= n; i++)
    {
        for (ll j = min(i, r); j > 0; j--)
            C[j] = (C[j] + C[j-1])%p;
    }
    return C[r];
}

int main()
{
    ll N;
    cin >> N;
    vector<ll> d(N);
    rep(i, N) { 
        cin >> d[i];
    }
    ll cnt = 0;
    rep(i, N) {
        rep(j, N-i-1) {
            cnt += d[i] * d[i+j+1];
        }
    }
    print(cnt);
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
#define Boost                       \
  ios_base::sync_with_stdio(false); \
  cin.tie(NULL);
#define endl '\n'
#define pb push_back
#define mp make_pair
#define all(v) (v).begin(), (v).end()
#define fo(i, x, y) for (__typeof(x) i = x; i < y; ++i)
#define fr(i, x, y) for (__typeof(x) i = x; i > y; i--)
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define F first
#define S second
#define vdp(n, x) vector<vector<ll>> dp(n + 1, vector<ll>(x + 1));

const ll mod = 1000000007;
const ll AM = 2e5 + 5;

using namespace std;
#include <bits/stdc++.h>
using namespace std;

int main()
{
    Boost;
    ll n;
    cin>>n;
    ll k;
    cin>>k;
    ll ht[n];
    fo(i, 0, n) {
        cin>>ht[i];
    }
    ll dp[n];
    dp[1]=abs(ht[1]-ht[0]);
    dp[0]=0;
    ll min=INT_MAX;
    fo(i, 2, n) {
        fo(j, 1, k+1) {
            if (i-j<0)break;
            if ((dp[i-j]+abs(ht[i]-ht[i-j]))<min) min=(dp[i-j]+abs(ht[i]-ht[i-j]));
        }
        dp[i]=min;
        min=INT_MAX;
    }
    cout<<dp[n-1];
}

Measured memory_bytes: 5132
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    long long N;
    cin >> N;
    string out = "";
    char smla = 'a';
 
    while((N - 1) / 26) {
        long long n = N - 1 / 26;
        n = (N - 1) % 26;
        out += (smla + n);
        N = (N - 1) / 26;
    }
    long long n  = N;
    n = (n);
    if(n == 0) {
    } else {
        out += (smla + n - 1);
    }
    reverse(out.begin(), out.end());
    cout << out << endl;
    return 0;
}

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

int main() {
    long n, m;
    cin>>n>>m;
    if(n>=2 and m>=2){
        cout<<(n-2)*(m-2)<<endl;
    }else if(n==1 and m==1){
        cout<<1<<endl;
    }
    else{
        cout<<(n*m-2)<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
long long mo = 1e9 + 7;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
template<class A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}cout << "\n";}
ld PI=3.14159265358979323846;

int main(){
    ld A,B,H,M;
    //string S;
    cin >> A >> B >> H >> M;
    ld MM = H*60+M;
    ld L = M*2*PI/60;
    ld S = MM*2*PI/720;
    ld ang = (L-S);
    ld X2 = A*A + B*B - 2*A*B*cos(ang); 
    cout << setprecision(20) << sqrt(X2) << endl;
}


Measured memory_bytes: 4168
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
    int N;
    cin >> N;
    vector<int> L(N);
    for(int i = 0; i < N; i++) cin >> L[i];
    sort(L.begin(), L.end());
    int cnt = 0;
    for(int i = 0; i < N; i++){
        for(int j = i + 1; j < N; j++){
            int t = upper_bound(L.begin() + j + 1, L.end(), L[i] + L[j] - 1) - lower_bound(L.begin() + j + 1, L.end(), L[j] - L[i] + 1);
            cnt += t;
        }
    }
    cout << cnt << endl;
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
#define INF 987654321
typedef long long ll;
typedef pair<int, int> ii;
typedef tuple<int, int, int> iii;


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int a;
    string s;
    cin >> a >> s;
    if (a >= 3200) cout << s;
    else cout << "red";
    return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import numpy as np
import sys
from collections import deque
from collections import defaultdict
import heapq
import collections
import itertools
import bisect
from scipy.special import comb
import copy
sys.setrecursionlimit(10**6)


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


def z():
    return int(sys.stdin.readline())


def S():
    return sys.stdin.readline()[:-1]


def C(line):
    return [sys.stdin.readline() for _ in range(line)]


N, M = zz()
A = zz()
A = [-a for a in A]
heapq.heapify(A)

for i in range(M):
    money = heapq.heappop(A)
    money *= -1
    money //= 2
    money *= -1
    heapq.heappush(A, money)
print(sum(A)*-1)


Measured memory_bytes: 53752
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <utility>
#include <set>
#include <stack>
#include <climits>
#include <cmath>

#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define rep1(i,n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
#define reps(i,s,n) for(int i=s, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define MEMSET(v, h) memset((v), h, sizeof(v))
typedef long long ll;
const char sp = ' ';


using namespace std;

int main(void){
    ll H, W, D;
    cin>>H>>W>>D;
    ll zahyo[100000][2];
    ll cost[100000];
    ll A;
    rep(i, H) rep(j, W){
        cin>>A;
        zahyo[A-1][0]=i;
        zahyo[A-1][1]=j;
    }
    rep(i, D){
        ll site=i;
        cost[site]=0;
        site+=D;
        while(site<=H*W){
            cost[site]=cost[site-D]+abs(zahyo[site][0]-zahyo[site-D][0])+abs(zahyo[site][1]-zahyo[site-D][1]);
            site+=D;
        }
    }
    ll Q;
    cin>>Q;
    ll L, R;
    ll count=0;
    rep(i, Q){
        cin>>L>>R;
        cout<<cost[R-1]-cost[L-1]<<endl;
    }
    return 0;
}


Measured memory_bytes: 3200
#include <bits/stdc++.h>
using namespace std;
const int INF=0x3f3f3f3f;

int n,s,ans=INF;
int a[100005];

int main() {
    ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    cin>>n>>s;
    for (int i=0;i<n;++i) cin>>a[i];
    for (int i=0,j=0;j<=n;) {
        if (s>0) {
            s-=a[j];
            ++j;
        }
        else {
            ans=min(ans,j-i);
            s+=a[i];
            ++i;
        }
    }
    cout<<(ans==INF?0:ans)<<'\n';
}


Measured memory_bytes: 3608
#include <stdio.h>
#include <ctype.h>

int main(void)
{
    char W[11];
    char T_w[1001];
    char EoT[] = "END_OF_TEXT";
    int cnt = 0;

    scanf("%s", W);



    while (1) {
        scanf("%s", T_w);

        int i = 0;

        for (i = 0; i < 12; i++) {
            if (T_w[i] != EoT[i]) break;
        }
        if (i == 12) break;

        for (i = 0; i < 11; i++) {
            if (tolower(T_w[i]) != tolower(W[i])) break;
        }
        if (i != 0 && W[i - 1] == '\0') cnt++;
    }
    
    printf("%d\n", cnt);

    return 0;
}

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

using namespace std;

int main(){
    int n;
    cin >> n;
    vector<int> A(n);
    copy_n(istream_iterator<int>(cin), n, A.begin());

    for (const auto &a: A){
        if (a % 2 == 1)
            continue;
        if (a % 3 == 0)
            continue;
        if (a % 5 == 0)
            continue;
        puts("DENIED");
        return 0;
    }
    puts("APPROVED");
}

Measured memory_bytes: 256
#pragma GCC optimize("O3")
//#pragma GCC target("avx2")
//#pragma GCC optimize("unroll-loops")

#include <bits/stdc++.h>

using namespace std;

#ifdef LOCAL
#include <prettyprint.hpp>
#define debug(...)  cerr << "[" << #__VA_ARGS__ << "]: ", d_err(__VA_ARGS__);
#else
#define debug(...) 83;
#endif

void d_err() {
    cerr << endl;
}

template <typename H, typename... T>
void d_err(H h, T... t) {
    cerr << h << " ";
    d_err(t...);
}

template <typename T>
void print(T x) {
    cout << x << "\n";
}

#define ALL(x) (x).begin(), (x).end()
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REVFOR(i, m, n) for (int i = (n - 1); i >= (m); --i)
#define REP(i, n) FOR(i, 0, n)
#define REVREP(i, n) REVFOR(i, 0, n)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define bcnt __builtin_popcountll

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<ll,ll> Pll;
typedef pair<int,int> Pin;

ll INF = 1e16;
int inf = 1e9;
ll MOD = 1e9+7;

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    
    int a, b, c, d;
    cin >> a >> b >> c >> d;

    if (a + b > c + d) print("Left");
    else if (a + b == c + d) print("Balanced");
    else print("Right");
}


Measured memory_bytes: 3588
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mod 1000000007

struct mint {
  ll x;
  mint(ll x=0):x(x%mod){}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
};
int main()
{
  int n,k;
  cin>>n>>k;
  long long lsum=0;
  int left=k-1;
  int right=n-k+1;
  for(int i=0;i<k;i++)lsum+=i;
  long long rsum=0;
  for(int i=n;i>(n-k);i--)rsum+=i;
  mint ans=0;
  ans+=(rsum-lsum+1);
  for(int i=k+1;i<=n+1;i++)
  {
    left++;
    lsum+=left;
    right--;
    rsum+=right;
    ans+=(rsum-lsum+1);
  }
  cout<<ans.x<<endl;
  return 0;
}

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

typedef string::const_iterator Iterator;

vector<int> amida[26];

void print(vector<int> v)
{
	for (int i = 0; i < v.size(); i++){
		if (i) printf(" ");
		printf("%d", v[i] + 1);
	}
	puts("");
}

vector<int> add(vector<int> a, vector<int> b)
{
	vector<int> res(a.size());
	for (int i = 0; i < res.size(); i++){
		res[i] = a[b[i]];
	}
	return res;
}

vector<int> mul(int k, vector<int> a)
{
	vector<int> res(a.size());
	iota(res.begin(), res.end(), 0);
	auto b = a;
	
	while (k){
		if (k & 1) res = add(res, b);
		k >>= 1;
		b = add(b, b);
	}
	
	return res;
}

/**
 * <expr> := <term> | <expr>'+'<term>
 * <term> := <factor> | <number> <factor>
 * <factor> := '('<expr>')' | <vla> 
 */
 
vector<int> expr(Iterator&);
vector<int> term(Iterator&);
vector<int> factor(Iterator&);
vector<int> vla(Iterator&);
int number(Iterator&);

vector<int> expr(Iterator &it){
	auto res = term(it);
	while (true){
		if (*it == '+'){
			it++;
			res = add(res, term(it));
		}
		else break;
	}
	return res;
}

vector<int> factor(Iterator &it){
	if (*it == '('){
		it++;
		auto res = expr(it);
		it++;
		return res;
	}
	else return vla(it);
}

vector<int> term(Iterator &it){
	int coef = max(number(it), 1);
	return mul(coef, factor(it));
}

vector<int> vla(Iterator &it){
	auto res = amida[*it - 'A'];
	it++;
	return res;
}

int number(Iterator &it){
	int res = 0;
	while (isdigit(*it)){
		res *= 10;
		res += *it - '0';
		it++;
	}
	return res;
}

int main()
{
	int N, K;
	scanf("%d %d", &N, &K);
	for (int i = 0; i < 26; i++){
		amida[i].resize(N);
		iota(amida[i].begin(), amida[i].end(), 0);
	}
	
	for (int i = 0; i < K; i++){
		char p;
		int h;
		scanf(" %c %d", &p, &h);
		auto &vec = amida[p - 'A'];
		for (int j = 0; j < h - 1; j++){
			for (int k = 0; k < N - 1; k++){
				int g;
				scanf("%d", &g);
				if (!g) continue;
				//int A = find(vec.begin(), vec.end(), k) - vec.begin();
				//int B = find(vec.begin(), vec.end(), k + 1) - vec.begin();
				//swap(vec[A], vec[B]);
				swap(vec[k], vec[k + 1]);
			}
		}
	}
	
	int E;
	scanf("%d", &E);
	for (int i = 0; i < E; i++){
		string str;
		cin >> str;
		Iterator it = str.begin();
		auto res = expr(it);
		print(res);
	}
}

Measured memory_bytes: 1272