akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize("O3")

#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;

typedef long long ll;
tree<int,int,greater<int>,rb_tree_tag,tree_order_statistics_node_update> map_t;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define F0R(i, a) for(int i = 0; i < (a); ++i)
#define sz(x) (int)x.size()
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
#define REV(x) reverse(x.begin(),x.end())
int dx[]={-1,0,1,0};
int dy[]={0,-1,0,1};

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

    int x,y;
    cin >> x >> y;
    int lo=x*2;
    int hi=x*4;
    if(y>=lo && y<=hi && y%2==0) {
        cout << "Yes\n";
        return 0;
    }
    cout << "No\n";

    return 0;
}


Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
# define ll long long
# define int long long  //comment it out when MLE
//# define endl "\n"
#define gok ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
# define mo 1000000009
# define pi acos(-1)
# define f first
# define s second
using namespace std;

signed main()
{
    gok
    int k;
    cin>>k;
    if(k<=9)
    {
        cout<<k;
        return 0;
    }
   queue<int> qq;
   for(int i=1;i<10;i++)
    qq.push(i);
   while(k>1)
   {
       int tt=qq.front();
       //cout<<tt<<" ";
       qq.pop();
       int mm=tt%10;
       if(mm!=0)
       qq.push(10*tt + mm - 1);
       qq.push(10*tt + mm);
       if(mm!=9)
       qq.push(10*tt + mm+1);
       k--;
   }
   cout<<qq.front();











      return 0;
    }


Measured memory_bytes: 1792
#include "bits/stdc++.h"
using namespace std;
#define INF 1e9
#define rep(i, n) for(int i = 0; i < n; i++)
#define ALL(x) (x).begin(), (x).end()  //昇順
#define RALL(x) (x).rbegin(), (x).rend() // 降順
const long long mod = 1e9+7;
typedef priority_queue<int> PQ;
typedef vector<long long> VL;
typedef vector<int> VI;  // VI a(n);
typedef vector<string> VS;  
typedef vector<char> VC; 
typedef vector<VS> VSS;
typedef vector<VC> VCC;    
typedef vector<VI> VII;   // VII a(n,vector<int>(m)) n * m 
typedef vector<VL> VLL;
typedef pair<int, int> PII;
typedef map<int, int> MP;   //MP a;
typedef vector<pair<int, int> > PS;
typedef long long ll;  //ll とdoubleは違う
template <class T>  // chmax(max, a);
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> //chmin(min,a)
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
template<typename T>   // operator << (cout,a);
ostream& operator << (ostream& os, vector<T>& v) {
    os << "{";
    rep(i, (int)v.size()) { os << v[i] << (i < v.size() - 1 ? ", " : ""); }
    os << "}";
    return os;
}

ll Max=-1,Min=1e9+1;
       
int main(){
    ll a,b,c,x=0,y=0,n,m,k,w,sum=0,ans=0;
    string s,t;
    bool f=true;
    cin >> a >> b >> c;
    VI z(3);
    Max = max({a,b,c});
    z[0] = abs(Max-a);
    z[1] = abs(Max-b);
    z[2] = abs(Max-c);
    sort(ALL(z));
    ans += z[1];
    z[2] -= z[1];
    ans += z[2]/2;
    if(z[2]%2==1){
        ans += 2;
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <set>
#include <list>
#include <utility>
#include <queue>
#include <memory>
#include <cstring>
#include <vector>
#include <algorithm>
#include <functional>

using namespace std; 

int
main(int argc, char const *argv[])
{
    uint64_t a, b, ret;
    cin >> a >> b;


    if (a > b) {
	ret = a + a - 1;
    } else if (b > a) {
		ret = b + b - 1;
    } else {
	ret = 2 * a;
    }

    cout << ret << endl;

    return 0;
}


Measured memory_bytes: 256
# coding: utf-8
# 自分の得意な言語で
# Let's チャレンジ！！
input_line = input()
lines = input_line.split()
x=int(lines[0])
y=int(lines[1])
input_num=x*y
if(x==1 or y==1):
  print(1)
else:
  if((x*y)%2==1):
    print(int(input_num/2)+1)
  else:
    print(int(input_num/2))

Measured memory_bytes: 3060
#include<bits/stdc++.h>;
using namespace std;
//#define LOCAL
#define ll long long
#define fastIO ios::sync_with_stdio(0), cin.tie(0)
int main(){
#ifdef LOCAL
     freopen("in.txt", "r", stdin);
     //freopen("out.txt", "w", stdout);
#else
 fastIO;
#endif
//***************************//**************************//******************************

string p;
cin>>p;
if(p=="ABC"){
    cout<<"ARC"<<endl;
}
if(p=="ARC"){
    cout<<"ABC"<<endl;
}
}


Measured memory_bytes: 3648
/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <iostream>

using namespace std;

int n, a, b;

int main()
{
    cin>>n>>a>>b;
    if((b-a+1)%2==1){
        cout<<"Alice"<<endl;
    }else{
        cout<<"Borys"<<endl;
    }

    return 0;
}

Measured memory_bytes: 256
n,m=map(int,input().split())
INF=10**10
dp=[[INF]*(1<<n) for _ in range(m+1)]
for i in range(m+1):
    dp[i][0]=0
a=[0]
key=[0]
for i in range(m):
    a0,b=map(int,input().split())
    a.append(a0)
    *c,=map(int,input().split())
    tmp=0
    for j in c:
        tmp+=1<<(j-1)
    key.append(tmp)

for i in range(1,m+1):
    for j in range(1<<n):
        if dp[i-1][j]<INF:
            dp[i][j]=min(dp[i][j],dp[i-1][j])
            dp[i][j|key[i]]=min(dp[i][j|key[i]],dp[i-1][j|key[i]],dp[i-1][j]+a[i])

ans=dp[-1][-1]
if ans!=INF:
    print(ans)
else:print(-1)


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

public class Main {
	public static void main(String[] args) throws IOException {
		new Caddi2018().c();
	}
}

class Caddi2018 {
	void c()throws IOException {
		Scanner in = new Scanner(System.in);
		long N = in.nextLong(), P = in.nextLong();
		final int MAXSQRT_N = 2000000;
		List<Long> p = eratos(MAXSQRT_N);
		Map<Long, Long> m = new HashMap<>();
		m = decomp(P, p);
		long ans = 1L;
		for (Map.Entry<Long, Long> e :m.entrySet()) {
			long key = e.getKey(), value = e.getValue();
			ans *= (long)(Math.pow(key, value / N));
		}
		System.out.println(ans);
	}

	Map<Long, Long> decomp(long P, List<Long> p) {
		long Q = P;
		Map<Long, Long> m = new HashMap<>();
		for (int i=0; i < p.size() && Q > 1L; ++i) {
			long pi = p.get(i);
			while (Q % pi == 0L) {
				if (m.get(pi) == null) {
					m.put(pi, 0L);
				}
				m.put(pi, m.get(pi) + 1L);
				Q /= pi;
			}
		}
		if (Q > 1L) {
			m.put(Q, 1L);
		}
		return m;
	}

	List<Long> eratos(int N) {
		boolean[] isP = new boolean[N + 1];
		Arrays.fill(isP, true);
		isP[0] = isP[1] = false;
		for (int i=4; i <= N; i += 2) {
			isP[i] = false;
		}
		for (int i=3; i <= N; i += 2) {
			for (int j=i + i; j <= N; j += i) {
				isP[j] = false;
			}
		}
		List<Long> p = new ArrayList<>();
		for (int i=0; i < N; ++i) {
			if (isP[i]) {
				p.add((long)i);
			}
		}
		return p;
	}
}

Measured memory_bytes: 31828
// AOJ ITP1_10_A Distance
// 2018.4.28 bal4u
 
#include <stdio.h>
#include <math.h>
 
int main()
{
    double x1, y1, x2, y2;
     
    scanf("%lf%lf%lf%lf", &x1, &y1, &x2, &y2);
    printf("%.8lf\n", hypot(x1-x2, y1-y2));
    return 0;
}


Measured memory_bytes: 2112
from collections import defaultdict
p_to_y = defaultdict(set)

N,M = map(int,input().split())
PY = [[int(x) for x in input().split()] for _ in range(M)]
for p,y in PY:
  p_to_y[p].add(y)

def set_to_rank_dict(se):
  return {x:i for i,x in enumerate(sorted(se), 1)}

p_to_y = {p:set_to_rank_dict(se) for p,se in p_to_y.items()}
for p,y in PY:
  print('{:06g}{:06g}'.format(p,p_to_y[p][y]))

Measured memory_bytes: 85756
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _0014
{
    class Program
    {
        static void Main(string[] args)
        {
            List<int> answerList = new List<int>();
            string str = "";
            while ((str = Console.ReadLine())!=null)
            {
                int d = int.Parse(str);
                answerList.Add(Face(d));
            }
            foreach(var item in answerList)
            {
                Console.WriteLine(item);
            }


        }
        static int Face(int d)
        {
            int answer =0;
            for (int i = 1; i < 600 / d; ++i)
            {
                answer += d * i * i * d * d; 
            }
            if (600 % d != 0)
            {
                answer += d * (600 - d) * (600 - d);
            }
            return answer;
        }
    }
}



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

vector<string> vec;

string reversal_line(string);
void storage_line(string,int);

int main(){
    
    int n;
    string str;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>str;
        for(int j=1;j<str.size();j++){
            storage_line(str,j);
        }
        int ans=0;
        while(!vec.empty()){
            string tmp=vec[vec.size()-1];
            vec.pop_back();
            bool flag=true;
            for(int i=0;i<vec.size();i++){
                if(tmp==vec[i]) flag=false;
            }
            if(flag) ans++;
        }
        cout<<ans<<endl;
    }
    
    return 0;
}

void storage_line(string s,int k){
    
    string l,r;
    for(int i=0;i<k;i++) l+=s[i];
    for(int i=k;i<s.size();i++) r+=s[i];
    
    vec.push_back(l+r);
    vec.push_back(reversal_line(l)+r);
    vec.push_back(l+reversal_line(r));
    vec.push_back(reversal_line(l)+reversal_line(r));
    vec.push_back(r+l);
    vec.push_back(reversal_line(r)+l);
    vec.push_back(r+reversal_line(l));
    vec.push_back(reversal_line(r)+reversal_line(l));
    
    return ;
    
}

string reversal_line(string s){
    
    if(s.size()==1) return s;
    string cp=s;
    for(int i=0;i<s.size();i++){
        cp[i]=s[s.size()-1-i];
    }
    
    return cp;
}



Measured memory_bytes: 3312
import sys

def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def main():
    n, x, m = MI()
    a = x
    flag = [False]*(m+1)
    t = 0
    s = []
    idx = 0
    for _ in range(m+1):
        if flag[a]:
            idx = s.index(a)
            break
        flag[a] = True
        s.append(a)
        t += a
        a = (a*a) % m
        if a == 0:
            print(t)
            sys.exit()
    ans = sum(s[0:idx])
    ans += sum(s[idx:])*((n-idx)//(len(s)-idx))
    ans += sum(s[idx:idx+(n-idx)%(len(s)-idx)])
    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 12068
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define pll pair<ll,ll>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))

using namespace std;

template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}

const ll INF=1e9+7;

int main(){
    ll n;
    cin >> n;
    vector<ll> a(n),b(n);
    ll sum_a=0,sum_b=0;
    rep(i,n){
        cin >> a[i];
        sum_a+=a[i];
    }
    rep(i,n){
        cin >> b[i];
        sum_b+=b[i];
    }
    if(sum_b>sum_a){
        cout << -1 << endl;
        return 0;
    }
    ll tot=0;
    vector<ll> sup;
    ll ans=0;
    rep(i,n){
        if(a[i]<b[i]){
            tot+=b[i]-a[i];
            ans++;
        }
        if(a[i]>b[i]){
            sup.push_back(a[i]-b[i]);
        }
    }
    sort(sup.rbegin(),sup.rend());
    ll m=sup.size();
    ll sum=0;
    ll i=0;
    while(tot>0){
        tot-=sup[i];
        i++;
        ans++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 5484
#include <iostream>

using namespace std;

int main()
{
    while (true)
    {
        int N;
        cin>>N;
        if (N==0)
            break;
        int k[1000000];
        for (int i=0; i<N; i++)
            cin>>k[i];

        bool ok = false;
        int ans = 1;
        for (int i=0; i<N; i++)
        {
            if (k[i]>=1)
                ans++;
            if (k[i]>=2)
                ok = true;
        }
        if (ok)
            cout<<ans<<endl;
        else
            cout<<"NA"<<endl;
    }
}

Measured memory_bytes: 1204
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n,a;
 
 
  
  cin >> n;
 
  vector<int> vec(n);
  
  for(int i=0;i<n;++i){
    cin >> a;
    vec.at(a-1) = i+1;
  }
  
  for(int j=0;j<n;++j){
    cout << vec.at(j);
    if(j<n-1){
      cout  << " ";
    }
  }
  cout << endl;
}

Measured memory_bytes: 1152
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int a,b;
    cin>>a>>b;
    if (a>b)
        cout<<"a > b"<<endl;
    else if (a<b)
        cout<<"a < b"<<endl;
    else
        cout<<"a == b"<<endl;
}



Measured memory_bytes: 3100
n, m = map(int, input().split())
ss = []
for _ in range(m):
  k, *s = map(int, input().split())
  ss.append(s)
plist = list(map(int, input().split()))

ans = 0
for i in range(1, pow(2, n)+1):
  den = 0
  alist = [0 for _ in range(n+1)]
  j = 0
  while i > 0:
    if i % 2 == 1:
      alist[j] = 1
    j += 1
    i //= 2
  for i, s in enumerate(ss):
    on = 0
    for _s in s:
      if alist[_s-1] == 1:
        on += 1
    if on % 2 == plist[i]:
      den += 1
  if den == m:
    ans += 1

print(ans)


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

int mincount=1000000000;
int D,G;
vector<int> v(10),p(10),c(10);



void calc(vector<int> v){
  
  int count=0,rest=G,excount,maxpoint;
  
  for(int i=0;i<D;i++){
    if(v.at(i)==1){
      rest-=c.at(i)+100*(i+1)*p.at(i);
      count+=p.at(i);
    }
    else
      maxpoint=i;
  }
  
  while(rest>0){
    count++;
    excount++;
    if(excount>p.at(maxpoint))
      return;
    rest-=100*(maxpoint+1);
  }
  
  mincount=min(mincount,count);
}

  
void dfs(int depth){
  if(depth==D){
    calc(v);
    return;
  }
  
  for(int i=0;i<2;i++){
    v.at(depth)=i;
    dfs(depth+1);
  }
}


int main(){
  cin>>D>>G;
  for(int i=0;i<D;i++)
    cin>>p.at(i)>>c.at(i);
  
  dfs(0);
  
  cout<<mincount;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
#include <iomanip>
#include <bitset>
using namespace std;

typedef long long ll;


int main() {
	ll n, pr; cin >> n >> pr;
	if (n == 1) {
		cout << pr << endl;
		return 0;
	}
	if (n >= 62) {
		cout << 1 << endl;
		return 0;
	}
	ll ans = 1;
	for (ll i = 2; i <= 1000000; i++) {
		ll w = 1;
		bool flag = true;
		for (int t = 0; t < n; t++) {
			if (w*i > pr) {
				flag = false;
				break;
			}
			w *= i;
		}
		if (!flag) break;
		if (pr % w == 0) ans = max(ans, i);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
	"sort"
)

func sum(a []int) int {
	s := 0
	for _,e := range a {
		s += e
	}
	return s
}

func min(a,b int) int {
	if a<b {
		return a
	}
	return b
}

func max(a,b int) int {
	if a>b {
		return a
	}
	return b
}

func main() {
	var n,k int
	fmt.Scan(&n,&k)

	v := make([]int,n)
	for i := 0; i < n; i++ {
		fmt.Scan(&v[i])
	}

	ans := 0
	for i := 0; i < k+1; i++ {
		p := min(i,n)
		op := k-p
		jewel := make([]int,0)
		val := sum(v[:p])
		jewel = append(jewel,v[:p]...)

		q := min(op,n-p)

		for j := 0; j < q+1; j++ {
			val2 := val + sum(v[n-j:])
			jewel2 := make([]int,0)
			jewel2 = append(jewel2,jewel...)
			jewel2 = append(jewel2,v[n-j:]...)

			sort.Ints(jewel2)

			r := min(len(jewel2),op-j)

			for a := 0; a < r+1; a++ {
				// fmt.Println(val2, jewel2, jewel2[:a])
				ans = max(ans,val2-sum(jewel2[:a]))
			}
		}
	}

	fmt.Println(ans)
}


Measured memory_bytes: 1280
#include <bits/stdc++.h>
#define pb push_back
#define ll long long
#define x first
#define y second
#define PII pair < int , int >
#define PLL pair < ll , ll >
#define mod 1000000007
#define maxn 100100

using namespace std;
int n, a[100100], b[100100], nr;

ll F[maxn],var;
ll put(ll a, ll p){
    if(p == 0) return 1;
    if(p == 1) return a;
    ll pt = put(a,p/2);
    return pt*pt%mod*(p%2 ? a : 1)%mod;
}

ll inv(ll x){
    return put(x,mod-2);
}

ll comb(ll n,ll k){
    return ((F[n]*inv(F[k])%mod)*inv(F[n-k]))%mod;
}

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int st, en;
    F[0] = F[1] = 1;
    for(int i=2;i<maxn;i++) F[i] = (F[i-1]*i)%mod;
    cin >> n;
    for (int i = 1; i <= n+1; i++){
        cin >> a[i];
        b[a[i]]++;
        if (b[a[i]] > 1) nr = a[i], en = i;
    }
    for (int i = 1; i <= n; i++) if (a[i] == nr){st = i; break;}
    //cout << st << " " << en << " ";
    int nbi = st - 1, nbd = n - en + 1;
    //cout << nbi + nbd << "\n";
    //cout << n << "\n";
    for (int i = 1; i <= n+1; i++){
        ll tot = comb(n+1, i);
        if (i-1 <=nbi + nbd) tot -= comb(nbi + nbd, i-1);
        while (tot < 0) tot += mod;
        cout << tot << "\n";
    }
    //cout << comb(33, 1);
}

Measured memory_bytes: 2816
#include<bits/stdc++.h>
using namespace std;
 
int main(){
  string s;
  cin >> s;
  int price = 700;
  if(s[0] == 'o'){ price += 100; }
  if(s[1] == 'o'){ price += 100; }
  if(s[2] == 'o'){ price += 100; }


  cout << price;
 return 0;
}

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

int main() {
  int n, count=1;
  long long sum=0;
  cin >> n;
  vector<int> c(n), c2(n);
  vector<int> numLength(n+1,1);
  for(int i=0; i<n; i++) cin >> c[i];
  // とりあえず取り除かないパターンを計算してみる
  c2 = c;
  sort(c2.begin(), c2.end());
  for(int i=0; i<c2.size()-1; i++) {
    if(c2[i]==c2[i+1]) {
      count++;
      if(i==(int)c2.size()-2){
        sum+=(long long)count*(count-1)/2;
        numLength[c2[i]]=count;
      }
    } else
    if(c2[i]!=c2[i+1]) {
      sum+=(long long)count*(count-1)/2;
      numLength[c2[i]]=count;
      count = 1;
    }
  }
  //for(auto v:numLength) cout << v << endl;
  for(auto v:c) {
    long long ans = sum;
    ans-=numLength[v]-1;
    cout << ans << endl;
  }
}


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

using namespace std;

const int mod = 1000000000 + 7;

int main(void){
	string s;
	cin >> s;
	long long all = 1, a = 0, ab = 0, abc = 0;
	for(int i = 0 ; i < s.length() ; i++){
		if(s[i] == 'A'){
			a += all;
		}
		if(s[i] == 'B'){
			ab += a;
		}
		if(s[i] == 'C'){
			abc += ab;
		}
		if(s[i] == '?'){
			abc = abc * 3 + ab;
			ab = ab * 3 + a;
			a = a * 3 + all;
			all *= 3;
		}
		all %= mod;
		a %= mod;
		ab %= mod;
		abc %= mod;
	}
	cout << abc << endl;
	return 0;
}

Measured memory_bytes: 3636
object Main{
  def main(args: Array[String]){
    if (sys.env.getOrElse("TEST", "")=="1"){
      println(test());
    }else{
      val input=io.Source.stdin.getLines().mkString("\n");
      println(solve(input).trim());
    }
  }

  def solve(input:String):String={
    input.split("").filter(_=="1").size.toString()
  }

  val tests=List("""101""" -> """2""",
    """000""" -> """0""");

  def test():String= {
    return tests.map{case (i,o)=>(i.trim(),o.trim())}.zipWithIndex.map{case ((input,outputExpect),i)=>{
      val output=solve(input).trim();
      s"test${i+1}:"+(if(output==outputExpect){
        "Passed"
      }else{
        s"Failed\nexpect:\n${outputExpect}\noutput:\n${output}"
      })
    }}.mkString("\n");
  }
}

Measured memory_bytes: 25400
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep1(i, n) for(int i = 1; i < (int)(n); i++)
#include <iostream>
#include <string>
#include <string.h>
#include <vector>
#include <algorithm>
using namespace std;

int main()
{
	vector<string> vec;
	int a, b;
	string str = "";
	cin >> a >> b;

	rep(i, a)
		str += to_string(b);

	vec.emplace_back(str);

	str = "";

	rep(i, b)
		str += to_string(a);

	vec.emplace_back(str);

	sort(vec.begin(), vec.end());

	cout << vec[0];

	return 0;
}

Measured memory_bytes: 256
toInt :: (String -> Int)
toInt x = read x ::Int

getInts = do
  x <- getLine
  let y = (map$toInt)$words x
  return y

findMt xs mx
  | xs == [] = 0
  | (xs !! 0) >= mx = 1 + findMt (tail xs) (xs !! 0)
  | (length xs) > 0 = findMt (tail xs) mx
  | otherwise = 0

main :: IO ()
main = do
  n <- getLine
  an <- getLine
  let anIntList = map toInt (words an)
  print $ findMt anIntList 0


Measured memory_bytes: 508
// lannisters don't act like fools
#include <bits/stdc++.h>

using namespace std;
#define yah_faster_baby ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define MOD 1000000007







void solve() {
    int n, d;
    int count = 0;
    cin >> n >> d;
    while (n--) {
        double x, y;
        cin >> x >> y;
        double ans = sqrt(x * x + y * y);
        if (ans <= d)
            count++;
    }
    cout << count << endl;
}






int main() {
    yah_faster_baby
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output1.txt", "w", stdout);
#endif // ONLINE_JUDGE
    solve();
    return 0;
}

Measured memory_bytes: 3860
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <ctime>
#include <bitset>
#include <complex>
#include <chrono>
#include <random>
#include <functional>

using namespace std;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
typedef long long ll;

using ipair = pair<int, int>;

ll INF = 1e16+7;

bool operator>(const ipair a,const ipair b){return a.first > b.first;}


string S;

set<string> s;

ll decode_str(string str){
  ll ret = 0;

  vector<string> str_vect;
  ll tmp= 0;
  rep(i, str.size()){
    if(i==str.size()-1){
      ret += tmp*10+(str[i]-'0');
      continue;
    }
    if(str[i] == '+'){
      ret += tmp;
      tmp = 0;
      continue;
    }

    tmp = tmp*10 + (ll)(str[i]-'0');
  }
  // cout << "==" << endl;
  // cout << "str:" << str << endl;
  // cout << "ret:" << ret << endl;
  return ret;
}

void dfs(int depth, string str){
  if(depth == S.size()){
    if(str[0] == '+') return;
    s.insert(str);
    return;
  }

  string add_str = str + "+" + S[depth];
  string not_add_str = str+S[depth];

  dfs(depth+1, add_str);
  dfs(depth+1, not_add_str);

  return;
}

int main(){

  cin >> S;
  dfs(0, "");

  ll ans = 0;
  for(string str: s){
    ans += decode_str(str);
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <iostream>
#include <cstdio>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <algorithm>
#include <cmath>
#include <queue>
#include <deque>
#include <stack>
 
#define ll long long
#define pb push_back
#define vi vector<int>
#define sz(a) (int((a).size()))
#define mp make_pair
#define f first
#define s second
#define pii pair<int, int>
 
using namespace std;
 
const int mod = 998244353;
const int inf = (int)2e9;
const ll INF = (ll)2e18;
const int N = 100100;

string s, ans;

int main() {
	ios_base::sync_with_stdio(0), cin.tie(0);
	cin >> s;
	for (int i = 0; i < sz(s); i++) {
		if (s[i] != 'B') {
			ans += s[i];
		} else if (ans != "") ans.pop_back();
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
int main(){
    int N;
    cin >> N;
    vector<int> X(N+1),Y(N+1);
    for(int i = 0;i < N;i++){
        cin >> X[i];
        Y[i] = X[i];
    }
    sort(Y.begin(), Y.end());
    for(int i = 0;i < N;i++){
        if(X.at(i)<=Y.at(N/2)) cout << Y.at(N/2+1) << endl;
        else cout << Y.at(N/2) << endl;
    }
}




Measured memory_bytes: 3712
from collections import defaultdict
S = input()
T = input()
def solve(S, T):
    fanin = defaultdict(set)
    fanout = defaultdict(set)
    for s, t in zip(S, T):
        fanin[t].add(s)
        fanout[s].add(t)
    for x in fanin.values():
        if len(x) > 1:
            return False
    for x in fanout.values():
        if len(x) > 1:
            return False
    return True
print(['No', 'Yes'][solve(S, T)])

Measured memory_bytes: 4144
import sys
import math
input = sys.stdin.readline


def main():
    sc = Scan()
    N = sc.intarr()[0]
    D = sc.intarr_ver(N)

    print(len(set(D)))


class Scan():

    def intarr(self):
        num_array = list(map(int, input().split()))
        return num_array

    def intarr_ver(self, n):
        return [int(input()) for _ in range(n)]

    def strarr(self):
        line = input()
        array = line.split(' ')
        array[-1] = array[-1].strip('\n')
        return array


def display(array):
    for a in range(len(array)):
        if len(array) - a != 1:
            print(array[a], end=' ')
        else:
            print(array[a])


def gcd(a, b):  # 最大公約数
    while b:
        a, b = b, a % b
    return a


def lcm(a, b):  # 最小公倍数
    return a * b // gcd(a, b)


main()


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
int main () {
	int N, K;
	cin >> N >> K;
	int ans = 0;
	for (int i = 0; i < N; i++) {
		int h;
		cin >> h;
		if (h >= K) ans++;
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = (int)(n - 1); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) int(x.size())
#define get_unique(x) x.erase(unique(all(x)), x.end());
typedef long long ll;
typedef complex<double> Complex;
const int INF = 1e9;
const ll MOD = 1e9 + 7;
const ll LINF = 1e18;
template <class T>
bool chmax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T& a, const T& b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
struct modint {
    ll x;
    modint(ll x = 0) : x((x % MOD + MOD) % MOD) {
    }
    ll value() const {
        return x;
    }
    modint operator-() const {
        return modint(-x);
    }
    modint& operator+=(const modint a) {
        if ((x += a.x) >= MOD) x -= MOD;
        return *this;
    }
    modint& operator-=(const modint a) {
        if ((x += MOD - a.x) >= MOD) x -= MOD;
        return *this;
    }
    modint& operator*=(const modint a) {
        (x *= a.x) %= MOD;
        return *this;
    }
    modint operator+(const modint a) const {
        modint res(*this);
        return res += a;
    }
    modint operator-(const modint a) const {
        modint res(*this);
        return res -= a;
    }
    modint operator*(const modint a) const {
        modint res(*this);
        return res *= a;
    }
    modint pow(ll t) const {
        if (t == 0) return 1;
        modint a = pow(t >> 1);
        a *= a;
        if (t % 2 == 1) a *= *this;
        return a;
    }
    modint inv() const {
        return pow(MOD - 2);
    }
    modint& operator/=(const modint a) {
        return (*this) *= a.inv();
    }
    modint operator/(const modint a) const {
        modint res(*this);
        return res /= a;
    }
};
struct combination {
    vector<modint> fact, ifact;
    combination(int n) : fact(n + 1), ifact(n + 1) {
        assert(n < MOD);
        fact[0] = 1;
        for (int i = 1; i <= n; i++) {
            fact[i] = fact[i - 1] * i;
        }
        ifact[n] = fact[n].inv();
        for (int i = n; i >= 1; i--) {
            ifact[i - 1] = ifact[i] * i;
        }
    }
    modint operator()(int n, int k) {
        if (n < k || k < 0) return 0;
        return fact[n] * ifact[k] * ifact[n - k];
    }
    modint h(int n, int k) {
        n += k - 1;
        if (k < 0 || k > n) return 0;
        return fact[n] * ifact[k] * ifact[n - k];
    }

} comb(2002002);
modint calc(int r, int c) {
    return (comb(c + r + 2, r + 2) * (r + 2) - c - 1) / (c + 1);
}
int main() {
    int r1, c1, r2, c2;
    cin >> r1 >> c1 >> r2 >> c2;
    r1--;
    c1--;
    modint ans = 0;
    ans += calc(r2, c2);
    ans -= calc(r2, c1);
    ans -= calc(r1, c2);
    ans += calc(r1, c1);
    cout << ans.value() << endl;
}

Measured memory_bytes: 31488
#include<iostream>
#define ll long long int
using namespace std;
int main()
{
	ll N, M, cnt = 0, sum = 0;
	cin>>N>>M;
	ll arr[N];
	for(int i=0; i<N;i++)
	{
		cin>>arr[i];
		sum+=arr[i];
	}
	for(int i=0; i<N;i++)
	{
		if(arr[i]>=(1.0*sum/(4*M)))
			cnt++;
	}
	if(cnt>=M)
		cout<<"Yes";
	else
		cout<<"No";
	return 0;
}

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

int s[100000];

int main()
{
	int n, m;
	
	scanf("%d %d", &n, &m);
	
	for (int i = 2; i <= n; i++){
		scanf("%d", &s[i]);
		s[i] += s[i - 1];
	}
	
	int now = 1;
	int sum = 0;
	
	for (int i = 0; i < m; i++){
		int a;
		
		scanf("%d", &a);
		
		if (a < 0){
			sum += s[now] - s[now + a];
		}
		else {
			sum += s[now + a] - s[now];
			
//			printf("%d %d\n", now + a, now);
		}
		
		now += a;
		
//		printf("_%d\n", now);
		
		sum %= 100000;
	}
	
	printf("%d\n", sum);
	
	return 0;
}

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

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

  int x, y;
  cin >> x >> y;

  for (int i = 0; i <= x; ++i) {
    if (i * 2 + (x - i) * 4 == y) {
      cout << "Yes" << endl;
      return 0;
    }
  }

  cout << "No" << endl;

  return 0;
}



Measured memory_bytes: 3648
import io
import sys

def solve():
    line1 = sys.stdin.readline().rstrip()
    line2 = sys.stdin.readline().rstrip()
    line3 = sys.stdin.readline().rstrip()
    if int(line1) == 1:
        print("Hello World")
    else:
        print(int(line2)+int(line3))
solve()

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

#define rep(n) for(int i=0;i<n;i++)
#define repp(j, n) for(int j=0;j<n;j++)
#define reppp(i, m, n) for(int i=m;i<n;i++)
#define all(c) c.begin(), c.end()
#define rall(c) c.rbegin(), c.rend()
#define MOD 1000000007
#define EPS 1e-9
 
using namespace std;

typedef long long ll;
typedef pair<ll, ll> Pll;
typedef pair<int, int> Pii;
struct edge{int from, to; ll cost;};

string s;
int l;

ll solve(){
    vector<ll> v[5000];
    int d = 0, i = 0;
    while(i < l){
        if(s[i] == '['){
            d++;
            v[d].clear();
            i++;
        }else if(s[i] == ']'){
            int m = ((int)v[d].size() + 1) >> 1;
            ll total = 0;
            sort(all(v[d]));
            repp(j, m){
                total += v[d][j];
            }
            d--;
            v[d].push_back(total);
            i++;
        }else{
            int nl = 1;
            while(s[i+nl] != '[' && s[i+nl] != ']') nl++;
            v[d].emplace_back( (stoi(s.substr(i, nl)) + 1) >> 1 );
            i += nl;
        }
    }
    // rep(3){
    //     for(ll x: v[i]) cout << x << " ";
    //     cout << endl;
    // }
    // assert((int)v[0].size() == 1);
    return v[0][0];
}

int main(){
    int n;
    cin >> n;
    rep(n){
        cin >> s;
        l = (int)s.length();
        cout << solve() << endl;
    }
}



Measured memory_bytes: 3300
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
using namespace std;
#define mod 1e9+7
int n;
vector<int> dp(1<<21,-1);
int a[21][21];
int cal(int num,int h)
{
  int res=0;
  if(dp[num]!=-1)return dp[num];
  for(int i=0;i<n;i++)
  {
    if(a[h-1][i] && (num & (1<<i)))
    {
        res+=cal(num-(1<<i),h-1);
        if(res>=mod)res-=mod;
    }
  }
  dp[num]=res;
  return res;
}
int main()
{
  ios::sync_with_stdio(false);
  cin>>n;
  dp[0]=1;
  for(int i=0;i<n;i++)for(int j=0;j<n;j++)cin>>a[i][j];
  cout<<cal((1<<n)-1,n);
  return 0;

}


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

#define ll long long
#define ar array
#define ld long double
#define endl "\n"

const int mxN=1e3;
ll w, h, l, u, r, d;

void fastio(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}

int main(){
    fastio();
    const double pi =  3.1415926535;
    double r;
    cin>>r;
    double ans = (2*1.0)*pi*r;
    cout<<fixed<<setprecision(9)<<ans<<endl;
}

Measured memory_bytes: 3800
#include <stdio.h>
#include <string.h>
#include <math.h>

int h,w,visited[500][500];
long long ans,q,k;
char s[500][500];


int dfsw(int a,int b);
int dfsb(int a,int b);

int main(void){
    scanf("%d%d",&h,&w);
    for (int i=0; i<h; i++){
        scanf("%s",s[i]);
    }
    for (int i=0; i<h; i++){
        for (int j=0; j<w; j++){
            q=0;
            k=0;
            if (s[i][j]=='#' && visited[i][j]==0){
                q++;
                visited[i][j]=1;
                dfsb(i,j);
                
                
            }
            ans+=q*k;
        }
    }
    printf("%lld\n",ans);
    return 0;
}

int dfsb(int a,int b){
    if (a+1<h  && s[a+1][b]=='.' && visited[a+1][b]==0){
        k++;
        visited[a+1][b]=1;
        dfsw(a+1,b);
    }
    if (b+1<w && s[a][b+1]=='.' && visited[a][b+1]==0){
        k++;
        visited[a][b+1]=1;
        dfsw(a,b+1);
    }
    if (a-1>=0 && s[a-1][b]=='.' && visited[a-1][b]==0){
        k++;
        visited[a-1][b]=1;
        dfsw(a-1,b);
    }
    if (b-1>=0 && s[a][b-1]=='.' && visited[a][b-1]==0){
        k++;
        visited[a][b-1]=1;
        dfsw(a,b-1);
    }
    return 0;
}

int dfsw(int a,int b){
    if (a+1<h && s[a+1][b]=='#' && visited[a+1][b]==0){
        q++;
        visited[a+1][b]=1;
        dfsb(a+1,b);
    }
    if (b+1<w && s[a][b+1]=='#' && visited[a][b+1]==0){
        q++;
        visited[a][b+1]=1;
        dfsb(a,b+1);
    }
    if (a-1>=0 && s[a-1][b]=='#' && visited[a-1][b]==0){
        q++;
        visited[a-1][b]=1;
        dfsb(a-1,b);
    }
    if (b-1>=0 && s[a][b-1]=='#' && visited[a][b-1]==0){
        q++;
        visited[a][b-1]=1;
        dfsb(a,b-1);
    }
    return 0;
}

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


int main(){
    int n, k, x, y;
    cin >> n >> k >> x >> y;
    int ans = 0;
    while(n-- && k--){
        ans += x;
    }
    n++;
    while(n-- > 0){
        ans += y;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
typedef long long int ll;
int main()
{
   ll n;
   cin>>n;
   ll f=0,c=0;
   while(n--)
   {
   	  ll a,b;
   	  cin>>a>>b;
   	  if(a==b)
   	  c++;
   	  else
   	  c=0;
   	  if(c>=3)
   	  f=1;
   }
   if(f==1)
   cout<<"Yes"<<endl;
   else
   cout<<"No"<<endl;
}

Measured memory_bytes: 3620
x, n = gets.split(' ').map(&:to_i)
p = gets.chomp.split(' ').map(&:to_i)

q = p.map { |n| (n - x) }
ans = 0
(0..100).each { |i|
        if q.include?(i)
                if q.include?(-1 * i)
                        next
                else
                        ans = x - i
                        break
                end
        elsif q.include?(-1 * i)
                ans = x + i
                break
        else
                ans = x - i
                break
        end
}

puts ans

Measured memory_bytes: 14348
#include <iostream>
#include <map>
#include <vector>
#define rep(i, n) for (lli i = 0; i < (n); i++)
#define rrep(i, n) for (lli i = (n)-1; i >= 0; i--)
using namespace std;
using lli = long long int;
int main() {
  int a, b;
  cin >> a >> b;
  int c = 1;
  int ans = 0;
  rep(i, 100) {
    if (c >= b) {
      ans = i;
      break;
    }

    c += a - 1;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
/* Headers */
#include <unordered_map>
#include <algorithm>
#include <iostream>
#include <cstring>
#include <climits>
#include <cstdio>
#include <cctype>
#include <vector>
#include <cmath>
#include <queue>
#include <stack>
#include <set>
#define FOR(i,a,b,c) for(int i=(a);i<=(b);i+=(c))
#define ROF(i,a,b,c) for(int i=(a);i>=(b);i-=(c))
#define FORL(i,a,b,c) for(long long i=(a);i<=(b);i+=(c))
#define ROFL(i,a,b,c) for(long long i=(a);i>=(b);i-=(c))
#define FORR(i,a,b,c) for(register int i=(a);i<=(b);i+=(c))
#define ROFR(i,a,b,c) for(register int i=(a);i>=(b);i-=(c))
#define RevEdge(x) x^1
#define lowbit(x) x&(-x)
#define LeftChild(x) x<<1
#define RightChild(x) (x<<1)+1
#define CLOSE_IN() fclose(stdin);
#define CLOSE_OUT() fclose(stdout);
#define FILE_IN(x) freopen(x,"r",stdin);
#define FILE_OUT(x) freopen(x,"w",stdout);
#define IOS(x) std::ios::sync_with_stdio(x)
#define Dividing() printf("-----------------------------------\n");
namespace FastIO {
#define gc() (iS == iT ? (iT = (iS = ibuff) + fread(ibuff, 1, SIZ, stdin), (iS == iT ? EOF : *iS++)) : *iS++)
    const int SIZ = 1 << 21 | 1;
    char* iS, * iT, ibuff[SIZ], obuff[SIZ], * oS = obuff, * oT = oS + SIZ - 1, fu[110], cc;
    int fr;
    inline void out() {
        fwrite(obuff, 1, oS - obuff, stdout);
        oS = obuff;
    }
    template<class Type>
    inline void read(Type& x) {
        x = 0;
        Type y = 1;
        for (cc = gc(); (cc > '9' || cc < '0') && cc != '-'; cc = gc());
        cc == '-' ? y = -1 : x = (cc & 15);
        for (cc = gc(); cc >= '0' && cc <= '9'; cc = gc())
            x = x * 10 + (cc & 15);
        x *= y;
    }
    template<class Type>
    inline void print(Type x, char text = '\n') {
        if (x < 0)
            * oS++ = '-', x *= -1;
        if (x == 0)
            * oS++ = '0';
        while (x)
            fu[++fr] = x % 10 + '0', x /= 10;
        while (fr);
            * oS++ = fu[fr--];
        * oS++ = text;
        out();
    }
    inline void prints(char x[], char text = '\n') {
        for (register int i = 0; x[i]; ++i)
            * oS++ = x[i];
        * oS++ = text;
        out();
    }
}
using namespace FastIO;
template<typename T>
inline T max(T a, T b) {return (a > b) ? a : b;}
template<typename T>
inline T min(T a, T b) {return (a > b) ? b : a;}
/* definitions */
const int MAXN = 6e3 + 10, MOD = 1e9 + 7;
int n, mod, ans, c[MAXN], dp[MAXN];
/* functions */
int main(int argc, char *argv[]) {
    /* FILE_IN("data.in"); */
    read(n); read(mod); int mid = (n >> 1); 
    FOR(i, 2, mid + 1, 1) c[i] = i - 1;
    FOR(i, mid + 2, n, 1) c[i] = n - i + 2; dp[0] = 1;
    FOR(i, 2, n, 1)
        FOR(j, c[i], n - 1, 1)
            (dp[j] += dp[j - c[i]]) %= mod;
    FOR(i, 0, n - 1, 1) (ans += (1ll * dp[i] * (n - i)) % mod) %= mod;
    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 3804
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

int main(void){
    long long int a, b, c, d, i, j, min, sum=0, gcd, lcm, cc, dd, tmp;
    scanf("%lld %lld %lld %lld", &a, &b, &c, &d);
    cc = c;
    dd = d;
    while(cc%dd != 0){
        if(cc<dd){
            tmp=dd;
            dd=cc;
            cc=tmp;
        }
        cc = cc%dd;
    }
    lcm = c*d/dd;
    printf("%lld", (b-a+1)-(b/c-(a-1)/c)-(b/d-(a-1)/d)+(b/lcm-(a-1)/lcm));
    
    
}

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

int main() {
	int n, k;
	cin >> n >> k;
	vector<int> arr(n);
	for (int i = 0; i < n; i++) {
		cin >> arr[i];
	}
	vector<int> dp(n);
	dp[n - 1] = 0;
	dp[n - 2] = abs(arr[n - 2] - arr[n - 1]);
	for (int i = n - 3; i >= 0; i--) {
		dp[i] = INT_MAX;
		for (int j = i + 1; j < n && (j - i) <= k; j++) {
			dp[i] = min(dp[i], abs(arr[i] - arr[j]) + dp[j]);
		}
	}
	cout << dp[0] << endl;
	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
    using namespace std;
    typedef long long lint;
    typedef pair<int,int> pint;
    typedef vector<int> vint;
    #define rep(i, n) for(int i = 0; i < n; i++)
    #define rep2(elem, vec) for(auto elem: vec)
    #define SORT(V) sort((V).begin(),(V).end())
    #define RSORT(V) sort((V).rbegin(), (V).rend())
    lint gcd(int a,int b){return b?gcd(b,a%b):a;}
    lint lcm(int a,int b){return a*b/gcd(a,b);}
    lint comb(int a,int b){return b?comb(a-1,b-1)*a/b:1;}
    int dx[4] ={1,0,-1,0},dy[4] = {0,1,0,-1};
    int MOD = 1e9+7;

int main(){
    int N,K;
    cin >> N >> K;
    vint p(N);
    vector<double> q(N+1);
    rep(i,N)cin >> p[i];
    q[0] = 0.0;
    rep(i,N) q[i+1] =q[i] + (double)(p[i]+1)/2;
    
    double ans =0;
    rep(i,q.size()-K){
        ans = max(q[i+K]-q[i],ans);
    }
    cout << fixed << setprecision(10);
    cout << ans;
    return 0;
}

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


#include "boost/multiprecision/cpp_int.hpp"
#include "boost/multiprecision/cpp_dec_float.hpp"
namespace mp = boost::multiprecision;
typedef mp::cpp_int LL;
typedef mp::number<mp::cpp_dec_float<1024>> DD;// 仮数部が1024ビットの浮動小数点数型(TLEしたら小さくする)

 
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
typedef pair<dd,dd> d_d;
ll inf=(ll)1E16;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define rrep(i,r,l) for(ll i=r;i>=l;i--)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define fi first
#define se second
#define endl "\n"
#define SORT(v) sort(v.begin(),v.end())
#define ERASE(v) v.erase(unique(v.begin(),v.end()),v.end())
#define POSL(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define POSU(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
template<class T,class S>
inline bool chmax(T &a, S b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}
template<class T,class S>
inline bool chmin(T &a, S b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}

void mod_print(ll k){
    ll P=1000;
    rep(y,1,P){
        ll x=mod(y*k);
        if(x+P>=i_7){
            x-=i_7;
        }
        if(abs(x)<=P){
            cout<<x<<"/"<<y<<endl;
            return;
        }
    }
    cout<<"nun"<<endl;
}
#define all(c) c.begin(),c.end()
//////////////////////////


int main(){fastio
    
    ll h1,m1,h2,m2,k;cin>>h1>>m1>>h2>>m2>>k;
    m1+=h1*60;
    m2+=h2*60;
    cout<<m2-m1-k<<endl;
    
    return 0;
}


Measured memory_bytes: 3608
#include<bits/stdc++.h>
    using namespace std;
    #define ll long long 
    #define ld long double
    #define MOD 1000000007
    #define mod9 1000000009
    #define fast ios_base :: sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
    #define mp make_pair
    #define pb push_back
    #define ct ll t;cin>>t;while(t--)
    #define bi begin()
    #define ei end()
    #define fi first 
    #define se second  
    #define foe(i,a,b) for(ll i=a;i<b;i++)
    #define rfoe(i,a,b) for(ll i=a;i>=0;i--)
    #define sz(s) s.size() 
    #define mem(a,s) memset(a,s,sizeof(a)) 
    #define all(v) v.bi,v.ei
    #define MAX             8000000000000000064LL
    #define MIN            -8000000000000000064LL   

    typedef pair<ll,ll> pii;
    
    ll add(ll a, ll b){return (a%MOD + b%MOD + ((MAX)/MOD)*MOD)%MOD;}
    ll sub(ll a, ll b){return (a%MOD - b%MOD + ((MAX)/MOD)*MOD)%MOD;}
    ll mul(ll a, ll b){return ((a%MOD)*(b%MOD) + ((MAX)/MOD)*MOD)%MOD;}
    ll lcm(ll a,ll b){return(a*b)/__gcd(a,b);}
    ll fact[1000007 ]={0};
    ll expo(ll x, ll y) {ll res=1;x=x%MOD;while(y>0){if(y&1)res=(1ll*res*x)%MOD;
    y=y>>1;x=(1ll*x*x)%MOD;} return res;}
    void facto() {fact[0]=1;fact[1]=1;for(ll i=2;i<1000007;i++)fact[i]=(fact[i-1]*i)%MOD;}
    ll ncr(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(expo(fact[r],MOD-2)))%MOD; res=(res*(expo(fact[n-r],MOD-2)))%MOD; return res;}
    ll npr(ll n,ll r) {facto(); ll res=1; res=fact[n]; res=(res*(expo(fact[n-r],MOD-2)))%MOD; return res; }
    int const N=2e5+9;
    ll const INF = 2e18+5;
    ll dx[8]={0,0,1,-1,1,1,-1,-1};
    ll dy[8]={1,-1,0,0,-1,1,-1,1};
    long long binpow(long long a, long long b) {
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = mul(res,a);
        a = mul(a,a);
        b >>= 1;
    }
    return res;
}
  
    void solve()
    {  
        ll n;
        cin>>n;
        ll ans=n-1;
        foe(i,2,n)
        {
            ans+=n/i;
            if(n%i==0)ans--;
        }
        cout<<ans<<" ";
    }
    int main()
    {
        fast
        // facto();
        // Sieve();
    //    ct    
        { 
            solve();
        }
    }


Measured memory_bytes: 3652
//coded by: pranonrahman-------------------------------------
//-----------------------------------------------------------
//-----------------------------------------------------------
#include<bits/stdc++.h>
using namespace std;
#define O_o ios_base::sync_with_stdio(0)
#define O_O ios_base::sync_with_stdio(0); cin.tie(NULL)
#define o_O ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL)
#define fixedprecision(n) cout<<fixed<<setprecision(n)
#define endl '\n'
#define CASE(n) cout << "Case " << n << ": "
#define pi acos(-1.0)
#define _____(n) cout << "Dhukse " << n << endl
int main()
{
    O_o;
    long long t=1;
    //cin >> t;
    long long T=t;
    while(t--)
    {
        long long n;
        cin >> n;
        long long a[n+7];
        long long b[n+7];
        for(long long i=0;i<=n;i++)
        {
            cin >> a[i];
        }
        for(long long i=0;i<n;i++)    cin >> b[i];
        long long sum=0;
        for(long long i=0;i<n;i++)
        {
            sum+= min(b[i],a[i]);
            b[i]-= min(b[i],a[i]);
            sum+= min(b[i],a[i+1]);
            a[i+1]-=min(a[i+1],b[i]);
            b[i]-= min(b[i],a[i]);

        }
        cout << sum << endl;
    }
    return 0;
}



Measured memory_bytes: 1792
#include <iostream>
#include <cstring>
#define rep(i,n) for(int i = 0; i < n; i++)
using namespace std;

int dp[8][1001];
string str;
int n;

int main(){
	cin >> n >> str;
	if(str[0] == 'J'){
		for(int i = 4; i <= 7; i++) dp[i][1]++;
	} else if(str[0] == 'O'){
		dp[6][1]++;
		dp[7][1]++;
	} else{
		dp[5][1]++;
		dp[7][1]++;
	}
	for(int i = 2; i <= n; i++){
		if(str[i-1] == 'J'){
			dp[4][i] += dp[4][i-1]+dp[5][i-1]+dp[6][i-1]+dp[7][i-1];
			dp[5][i] += dp[4][i-1]+dp[5][i-1]+dp[6][i-1]+dp[7][i-1]+dp[1][i-1]+dp[3][i-1];
			dp[6][i] += dp[4][i-1]+dp[5][i-1]+dp[6][i-1]+dp[7][i-1]+dp[2][i-1]+dp[3][i-1];
			dp[7][i] += dp[4][i-1]+dp[5][i-1]+dp[6][i-1]+dp[7][i-1]+dp[1][i-1]+dp[2][i-1]+dp[3][i-1];
		} else if(str[i-1] == 'O'){
			dp[2][i] += dp[2][i-1]+dp[3][i-1]+dp[6][i-1]+dp[7][i-1];
			dp[3][i] += dp[2][i-1]+dp[3][i-1]+dp[6][i-1]+dp[7][i-1]+dp[1][i-1]+dp[5][i-1];
			dp[6][i] += dp[2][i-1]+dp[3][i-1]+dp[6][i-1]+dp[7][i-1]+dp[4][i-1]+dp[5][i-1];
			dp[7][i] += dp[2][i-1]+dp[3][i-1]+dp[6][i-1]+dp[7][i-1]+dp[1][i-1]+dp[4][i-1]+dp[5][i-1];
		} else{
			dp[1][i] += dp[1][i-1]+dp[3][i-1]+dp[5][i-1]+dp[7][i-1];
			dp[3][i] += dp[1][i-1]+dp[3][i-1]+dp[5][i-1]+dp[7][i-1]+dp[2][i-1]+dp[6][i-1];
			dp[5][i] += dp[1][i-1]+dp[3][i-1]+dp[5][i-1]+dp[7][i-1]+dp[4][i-1]+dp[6][i-1];
			dp[7][i] += dp[1][i-1]+dp[3][i-1]+dp[5][i-1]+dp[7][i-1]+dp[2][i-1]+dp[4][i-1]+dp[6][i-1];
		}
		rep(j,8) dp[j][i] %= 10007;
	}
	int ans = 0;
	rep(i,8) ans += dp[i][n];
	cout << ans%10007 << endl;
}

Measured memory_bytes: 1236
#include<bits/stdc++.h>
typedef long long ll;
#define sz(x) int(x.size())
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
int main(){
    string S;
    int ans = 0;
    cin >> S;
    for (int i = 0; i < S.length()/2; i++)
    {
        if(S[i] != S[S.length()-1-i]) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256