akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vvl = vector<vl>;
const ll INF = 1LL << 60;
const ll MOD = 1000000007;
template <class T>
bool chmax(T &a, const T &b) {
    return (a < b) ? (a = b, 1) : 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    return (b < a) ? (a = b, 1) : 0;
}

int main() {
    int n, k;
    cin >> n >> k;
    ll ret = k;
    for (int i = 0; i < n - 1; ++i) {
        ret *= k - 1;
    }
    cout << ret << "\n";
    return 0;
}

Measured memory_bytes: 256
import core.bitop, std.algorithm, std.ascii, std.bigint, std.conv, std.math,
    std.functional, std.numeric, std.range, std.stdio, std.string, std.random,
    std.typecons, std.container, std.format;

// dfmt off
T lread(T = long)(){return readln.chomp.to!T();}
T[] aryread(T = long)(){return readln.split.to!(T[])();}
void scan(TList...)(ref TList Args){auto line = readln.split();
foreach (i, T; TList){T val = line[i].to!(T);Args[i] = val;}}
alias sread = () => readln.chomp();enum MOD = 10 ^^ 9 + 7;
alias PQueue = BinaryHeap!(Array!long, "a<b");
// dfmt on

/// Number of k-combinations
T combination(T = long)(T n, T k)
{
    assert(0 <= k);
    assert(0 <= n);
    if (n < k)
        return 0;
    k = min(n - k, k);
    if (k == 0)
        return 1;
    if (k == 1)
        return n;
    return memoize!combination(n - 1, k - 1) + memoize!combination(n - 1, k);
}

void main()
{
    long A, B;
    scan(A, B);
    long t = 1;
    long ans;
    while (t < B)
    {
        t += A - 1;
        ans++;
    }
    writeln(ans);
}


Measured memory_bytes: 256
use proconio::{input, fastout};
use proconio::marker::{Chars};
use proconio::marker::Usize1;
use std::cmp::*;

macro_rules! debug {
      ($($a:expr),*) => {
          eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

#[fastout]
fn main() {
    input!{
        r: i64,
        g: i64,
    }

    println!("{}", r+(g-r)*2);

}


Measured memory_bytes: 2108
# coding: utf-8
# hello worldと表示する
#dpでできないかな？
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7

a,b,c,x,y=MI()
if a+b<=2*c:
    ans=a*x+b*y
else:
    if x>=y:
        if a>=2*c:
            ans=c*2*x
        else:
            ans=c*2*y+a*(x-y)
    elif x<y:
        if b>=2*c:
            ans=c*2*y
        else:
            ans=c*2*x+b*(y-x)
print(ans)

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

int main() {
    string s;
    cin >> s;

    int total = 700;
    if (s[0] == 'o') {
        total = total + 100;
    }
    if (s[1] == 'o') {
        total = total + 100;
    }
    if (s[2] == 'o') {
        total = total + 100;
    }
    cout << total << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
#include <queue>
#include <cmath>
#include <numeric>
#include <set>

using namespace std;
struct aaa{aaa(){cin.tie(nullptr); ios::sync_with_stdio(false); cout<<fixed<<setprecision(20);};}aaa;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v){o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}
#define debug(v) {cerr<<"\033[1;36m[debug]\033[m "<<#v<<" : "<<v<<endl;}

using int64 = long long;

int main() {
    int n;
    cin >> n;
    map<string, int64> mp;
    for (int i=0; i<n; i++) {
        string s;
        cin >> s;
        mp[s]++;
    }

    vector<string> s = {"AC", "WA", "TLE", "RE"};
    for (auto si : s) {
        cout << si << " x " << mp[si] << endl;
    }
}

Measured memory_bytes: 3224
#include <bits/stdc++.h>
#define rep(i, n) for(ll i = 0; i < n; i++)
#define repr(i, n) for(ll i = n; i >= 0; i--)
#define inf LLONG_MAX
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;


int main()
{
    ll n, k; cin >> n >> k;
    vector<double> p(n); rep(i, n) cin >> p[i];

    double max_sum = 0, sum = 0;
    rep(i, k - 1) {
        sum += (p[i] + 1) / 2;
    }

    for (int i = k - 1; i < n; i++) {
        sum += (p[i] + 1) / 2;
        max_sum = max(max_sum, sum);
        sum -= (p[i - k + 1] + 1) / 2;
    }
    printf("%.12lf\n", max_sum);
    return 0;
}

Measured memory_bytes: 1792
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>
#include <cstring>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define all(c) begin(c),end(c)

template<typename T1, typename T2>
inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }

template<typename T1, typename T2>
inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }

//改造
typedef long long int ll;
using namespace std;
#define INF (1 << 30) - 1
#define INFl (ll)5e15
#define DEBUG 0 //デバッグする時1にしてね
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007


//ここから編集する
class Solve {
public:
    void input() {

    }

    void solve() {
        input();
        int o = 0;
        int x = 0;
        string s;
        cin >> s;
        for (auto e : s) {
            if (e == 'o') o++;
            else x++;
        }
        int amari = 15 - (o + x);

        int tapi = amari + o;
        if (tapi >= 8) {
            cout << "YES" << endl;
        } else {
            cout << "NO" << endl;
        }

    }
};


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);

    Solve().solve();


    return 0;
}


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

using namespace std;

int main(){
    int a,b;
    string s,ans = "Yes";
    cin >> a >> b >> s;

    for(int i = 0;i < a+b+1;i++){
        if(i == a && s[i] == '-')continue;
        else if(i == a && s[i] != '-') ans = "No";
        else if(s[i] <= '/' || ':' <= s[i])ans = "No";
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
int main(){
  int i,j,n,len;
  scanf("%d",&n);
  char s[n+1][51],alpha[n+1][27];
  for(i=0;i<n;i++){
    scanf("%*c%s",s[i]);
    for(j=0;j<27;j++)
      alpha[i][j]=0;
  }
  for(i=0;i<n;i++){
    len=strlen(s[i]);
    for(j=0;j<len;j++){
      alpha[i][s[i][j]-'a']++;
    }
  }
  for(i=0;i<26;i++){
    alpha[n][i]=alpha[0][i];
    for(j=1;j<n;j++){
      if(alpha[n][i]>alpha[j][i])
        alpha[n][i]=alpha[j][i];
    }
  }
  for(i=0;i<26;i++){
    while(alpha[n][i]>0){
      printf("%c",'a'+i);
      alpha[n][i]--;
    }
  }
  puts("");
  return 0;
}

Measured memory_bytes: 1648
#include <algorithm>
#include <cassert>
#include <climits>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int X, Y;
  cin >> X >> Y;

  cout << X + Y / 2 << endl;
  return 0;
}

Measured memory_bytes: 256
// includes {{{
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<tuple>
#include<cmath>
#include<random>
#include<cassert>
#include<bitset>
#include<cstdlib>
// #include<deque>
// #include<multiset>
// #include<cstring>
// #include<bits/stdc++.h>
// }}}
using namespace std;
using ll = long long;

int main() {
  std::ios::sync_with_stdio(false), std::cin.tie(0);
  int n;
  cin >> n;
  int m = 1 << n;
  vector<int>a(m);
  map<int, int> st;
  for(int i = 0; i < m; i++) cin >> a[i], st[a[i]]++;
  vector<int> now;
  int x = prev(st.end())->first;

  now.push_back(x);

  auto erase = [&](int j) {
    st[j]--;
    if(st[j] == 0) st.erase(j);
  };
  erase(x);
  while(st.size()) {
    auto now2 = now;
    for(auto u : now) {
      auto ite = st.lower_bound(u);
      if(ite != st.begin()) {
        int y = prev(ite)->first;
        erase(y);
        now2.push_back(y);
      } else {
        cout << "No" << endl;
        return 0;
      }
    }
    now = now2;
  }
  assert(now.size() == m);
  cout << "Yes" << endl;
  return 0;
}


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

using namespace std;
using ll = long long;

void init();
void solve();

#define rep(i, a) for (int i = 0; i < (int) (a); i++)
#define reps(i, a, b) for (int i = (int) (a); i < (int) (b); i++)
#define rrep(i, a) for (int i = (int) a-1; i >= 0; i--)
#define rreps(i, a, b) for (int i = (int) (a)-1; i >= (int) (b); i--)
#define MP(a, b) make_pair((a), (b))
#define PB(a) push_back((a))
#define all(v) (v).begin(), (v).end()
#define PRINT(f) if((f)){cout << (TRUE__) << endl;}else{cout << FALSE__ << endl;}
#define TRUE__  "Yes"
#define FALSE__ "No"
#define PERM(v) next_permutation(all(v))
#define UNIQUE(v) sort(all(v));(v).erase(unique(all(v)), v.end())
#define CIN(type, x) type x;cin >> x

#ifdef LOCAL
#define lcout(a) cout << a
#define lcoutln(a) cout << a << endl
#define lcerr(a) cerr << a
#define lcerrln(a) cerr << a << endl
#else
#define lcout(a) 
#define lcoutln(a) 
#define lcerr(a) 
#define lcerrln(a) 
#endif
#define MOD 1000000007
#define PI 3.141592653589793238462643383

signed main()
{
	init();
	solve();
}

int N;
vector<int> v;
set<int> s;
set<int> sr;

void init()
{
	cin >> N;
	v.resize(N);
	rep(i, N) {
		int t;
		cin >> t;
		t--;
		v[t] = i;
	}
	s.insert(-1);
	s.insert(N);
	sr.insert(1);
	sr.insert(-N);
}

void solve()
{
	ll res = 0;
	rep(i, N) {
		ll l = v[i] + *(sr.upper_bound(-v[i]));
		ll r = *(s.upper_bound(v[i])) - v[i];
		res += l * r * (i + 1);
		s.insert(v[i]);
		sr.insert(-v[i]);
	}
	cout << res << endl;
}


Measured memory_bytes: 19840
#include <stdio.h>
int main()
{
    int a[1000];
    int p,n,i,k,j,temp,sum=0;
    scanf("%d%d",&n,&k);
    for(i=0;i<n;i++)
    {
        scanf("%d",&a[i]);
    }
    for(i=0;i<n;i++)
    {
        for(j=0;j<n;j++)
        {
            if(a[i]<a[j])
            {
                temp=a[i];
                a[i]=a[j];
                a[j]=temp;
            }
        }
    }
    for(i=0;i<k;i++)
    {
        sum+=a[i];
    }
    printf("%d\n",sum);
}


Measured memory_bytes: 1640
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<map>
#include<queue>
#include<string>
#include<numeric>
#include<sstream>
#include<cmath>
using namespace std;
int main(){

  int h, w;
  int x, y;
  cin >> h >> w >> y >> x;
  cout << (h-y) * (w-x) << endl;

  return 0;
}





Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define mp make_pair
#define pb push_back
#define pob pop_back
#define mod 1000000007
#define sr(a) sort(a.begin(),a.end())
#define ios ios_base::sync_with_stdio(false);cin.tie(NULL);
using namespace std;
int main()
{
  int n,k;
  cin>>n>>k;
  int a[n];
  for(int i=0;i<n;i++)
    cin>>a[i];
  ll dp[100001];
  dp[0]=0;
  dp[1]=abs(a[0]-a[1]);
  for(int i=2;i<n;i++)
    {
        dp[i]=INT_MAX;
        for(int j=i-1,jump=1;j>=0,jump<=k;j--,jump++)
            dp[i]=min(dp[i],abs(a[i]-a[j])+dp[j]);
    }
   cout<<dp[n-1]<<endl;
return 0;
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
#define REP(i,n) for(int i = 0; i < n; i++)
#define REPR(i,n) for(int i = n; i >= 0; i--)
#define FOR(i,m, n) for(int i = m-1; i < n; i++)
#define INF 2000000000
#define ALL(v) v.begin(), v.end()
#define chmax(x,y) (x = max(x,y))
#define chmin(x,y) (x = min(x,y))
#define FILL2D(A,c) fill(A[0], A[0] +sizeof(A)/sizeof(**A),c)
#define FILL3D(A,c) fill(A[0][0], A[0][0] +sizeof(A)/sizeof(***A),c)
//vector<vector<要素の型>> 変数名(要素数1, vector<要素の型>(要素数2, 初期値))
//vector<intなど> 変数名(要素数,初期値)
using namespace std;
typedef long long ll;
//gcd,lcmセット
ll gcd(ll a, ll b){
   if (a%b == 0) return b;
   else return gcd(b, a%b);
}
ll lcm(ll a, ll b){	
   return a*b/gcd(a, b);
}
int main(){
  ll a,b;
  cin>>a>>b;
    cout<<lcm(a,b)<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
string s;
bool pal(string s) {
	int n=s.size();
	for(int i=0;i<n;++i)
		if(s[i]!=s[n-i-1])
			return false;
	return true;
}
int main()
{
	cin>>s;
	int n=s.size();
	if(pal(s)&&pal(s.substr(0,(n-1)/2))&&pal(s.substr((n+3)/2-1))) printf("Yes");
	else printf("No");
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <string>
#define ft first
#define sc second
#define pt(sth) cout << sth << "\n"
#define chmax(a, b) (a)=max(a, b);
#define chmin(a, b) (a)=min(a, b);
#define moC(a, s, b) (a)=((a)s(b)+MOD)%MOD
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
static const ll INF=1e18;
static const ll MAX=101010;
static const ll MOD=1e9+7;


/*
 for(i=0; i<N; i++)
   cin >> a[i];
*/



int main(void) {
  ll i, j, k;
  
  double x[3], y[3];
  for(i=0; i<3; i++) cin >> x[i] >> y[i];
  
  double d[3];
  for(i=0; i<3; i++) {
    double tx=abs(x[i]-x[(i+1)%3]);
    double ty=abs(y[i]-y[(i+1)%3]);
    d[i]=sqrt(tx*tx+ty*ty);
  }
  
  double a=max({d[0], d[1], d[2]});
  double x0=x[0]-x[2], y0=y[0]-y[2];
  double x1=x[1]-x[2], y1=y[1]-y[2];
  double S=abs(x0*y1-x1*y0)/2;
  double r=S*2/(d[0]+d[1]+d[2]);
  double ans=r*a/(r*2+a);
  
  printf("%.12f\n", ans);
  
}





Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

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

    static class ABC115_b {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int N = in.nextInt();
            int P[] = new int[N];
            int Ph[] = new int[N];
            int Max = -1;
            int MaxIdx = 0;
            int ttl = 0;

            for (int i = 0; i < N; i++) {
                P[i] = in.nextInt();
                Ph[i] = P[i] / 2;
                if (Max < P[i]) {
                    Max = P[i];
                    MaxIdx = i;
                }

            }
            for (int i = 0; i < N; i++) {
                if (MaxIdx == i) {
                    ttl += Ph[i];
                } else {
                    ttl += P[i];
                }
            }
            out.println(ttl);
        }

    }
}



Measured memory_bytes: 21844
N = int(input())

S = input()

alp = "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ"

ans = ""

for i in S:

    for j in range(26):

        if alp[j] == i:
            ans += alp[j + N]

print (ans)


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

int main(){
	long a, b;
	while (cin >> a >> b){
		for (long i = 0; i < 7; i++){
			if (a + b >= pow(10, i) && a + b < pow(10, i + 1)){
				cout << (i + 1) << endl;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 1208
N, M = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(M)]

ab.reverse()
cnt = [0] * N
lst = [0]*N

class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n
        
    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            return self.find(self.parents[x])
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        
        if x == y: return
        if self.parents[x] > self.parents[y]:
            x, y = y, x
        self.parents[x] += self.parents[y]
        self.parents[y] = x
     
    def size(self, x):
        return -self.parents[self.find(x)]

uf = UnionFind(N)
cnt = N * (N - 1) // 2
ans = [cnt]
for a, b in ab:
    a -= 1
    b -= 1
    if uf.find(a) != uf.find(b):
        cnt -= uf.size(a) * uf.size(b)
        uf.union(a, b)
    ans.append(cnt)
ans.reverse()
print(*ans[1:], sep='\n')

Measured memory_bytes: 36596
#include<algorithm>/*{{{*/
#include<cctype>
#include<cassert>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<ctime>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<vector>
using namespace std;
typedef long long lld;
typedef long double lf;
typedef unsigned long long uld;
typedef pair<int,int> pii;
#define fi first
#define se second
#define pb push_back
#define mk make_pair
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define ROF(i,a,b) for(int i=(a);i>=(b);--i)
namespace RA{
    int r(int p){return 1ll*rand()*rand()%p;}
    int r(int L,int R){return r(R-L+1)+L;}
}/*}}}*/
/******************heading******************/
const int N=3005,INF=0x3f3f3f3f;

int n;
int a[N];
vector<int> g[N];

bool dfs(int u,int p=0){
    int min_au=INF;
    for(int v:g[u])if(v!=p){
        if(dfs(v,u));
        else min_au=min(min_au,a[v]);
    }
    if(min_au<a[u])return 1;//win
    return 0;//lose
}
int main(){
    scanf("%d",&n);
    FOR(i,1,n)scanf("%d",&a[i]);
    FOR(i,1,n-1){
        int x,y;
        scanf("%d%d",&x,&y);
        g[x].pb(y),g[y].pb(x);
    }
    FOR(i,1,n)if(dfs(i))printf("%d ",i);
    return 0;
}


Measured memory_bytes: 640
a,b= map(int,input().split())
ans = 0
for n in range(a,b+1):  
  n_str = str(n)    
  add = 1
  for i in range(2):
    if n_str[i] != n_str[-(1+i)]:
      add = 0
  ans += add

print(ans)  

Measured memory_bytes: 3060
#include<bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
using namespace std;

//ループマクロ
#define FOR(i , a , b)  for(int i = (a) ; i < (b) ; i++)
#define REP(i , n)      for(int i = 0 ; i < n ; i++)
#define REPR(i , n)     for(int i = n ; 0 <= i ; i--)

//入出力
#define SCOUT(x) cout << (x) << " "
#define VECCIN(x) for(auto& ele : (x) ) cin >> ele
#define VECOUT(x) for(auto& ele : (x) ) cout << ele << " "; cout << endl;

//その他
#define ALL(obj) (obj).begin() , (obj).end() 
#define P pair<int , int>
#define V vector<int>
#define M map<int, int>
#define S set<int>
#define PQ priority_queue<int>
#define PQG priority_queue<int , V , greater<int>>
int main(void) {

	ios::sync_with_stdio(false);	cin.tie(0);
	int H, W;  cin >> H >> W;
	char field[10][10];
	for(int i = 0 ; i < 10 ; i++)
	 for(int j = 0 ; j < 10 ; j++)
	  field[i][j] = 0;

	for(int i = 1 ; i <= H ; i++)
	 for(int j = 1 ; j <= W ; j++)
	  cin >> field[i][j];

	bool ans = true;
	for(int i = 1 ; i <= H ; i++){
	 for(int j = 1; j <= W ; j++){
	  if(field[i][j] == '#'){

		if(field[i][j - 1] == '#' && field[i - 1][j] == '#')
		 ans = false;

		if(field[i][j + 1] == '#' && field[i + 1][j] == '#')
		 ans = false;
	  }
	 }
	}

	if(ans) cout << "Possible" << endl;
	else    cout << "Impossible" << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdlib>
#include <string>
#include <cstring>
#include <cmath>
#include <climits>
#include <ctime>
#define endl '\n'
#define ll long long
#define mod 10007
#define NCONS 200001
//#define NCONS 100001
//#define NCONS 1001
//#define NCONS 10
#define MCONS 2001
#define LIMIT 1000000000
#define TRUE 1
#define FALSE 0

using namespace std;

int main(void)
{
    cin.tie(NULL); ios_base::sync_with_stdio(false);
    int n; cin >> n;
    vector<int> h(n, 0); for(int i = 0; i < n; i++) cin >> h[i];
    
    int ret = 0;
    int prev = -1;
    
    for(int i = 0; i < h.size(); i++)
    {
        if(prev <= h[i])
        {
            prev = h[i];
            ret += 1;
        }
    }
    
    cout << ret;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define pii pair<int, int>
#define nyan "(=^･ω･^=)"
#define read_input         freopen("in.txt","r", stdin)
#define print_output       freopen("out.txt","w", stdout)
typedef long long ll;
typedef long double ld;
using namespace std;

int main()
{
    int dp[20005], a[1005], b[1005];
    int h, n;
    cin >> h >> n;

    for(int i = 1; i <= n; i++)
        cin >> a[i] >> b[i];

    memset(dp, 63, sizeof dp);
    dp[0] = 0;

    for(int i = 1; i <= 10000+h; i++) {
        for(int j = 1; j <= n; j++)
            if(a[j] <= i) dp[i] = min(dp[i], dp[i - a[j]] + b[j]);
    }

    int mn = dp[20004];
    for(int i = h; i <= 20004; i++) mn = min(mn, dp[i]);
    cout << mn << endl;

    return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cmath>
#include <set>
#include <queue>
#include <vector>
#include <climits>
#include <sstream>
#include <iomanip>
using namespace std;


int main()
{
	int N, M;
	cin >> N >> M;
	vector<pair<int, pair<long long, int>>> list;
	vector<string> result(M);
	for (auto i = 0; i < M; ++i)
	{
		int P;
		long long Y;
		cin >> P >> Y;
		list.push_back(make_pair(P, make_pair(Y, i)));
	}

	sort(list.begin(), list.end());
	auto index = 0;
	stringstream ss;
	while(index < M)
	{
		vector<pair<long long, int>> plist;
		auto pair = list[index];
		auto p = pair.first;
		while (pair.first == p)
		{
			plist.push_back(pair.second);
			++index;
			if (index >= M)
			{
				break;
			}
			else
			{
				pair = list[index];
			}
		}

		sort(plist.begin(), plist.end());
		for (auto i = 0; i < plist.size(); ++i)
		{
			auto& temp = plist[i];
			ss << setw(6) << setfill('0') << p << setw(6) << setfill('0') << (i + 1);
			result[temp.second] = ss.str();
			ss.str("");
			ss.clear(stringstream::goodbit);
		}
	}

	for (auto i = 0; i < M; ++i)
	{
		cout << result[i] << endl;
	}

	return 0;
}


Measured memory_bytes: 10096
import sys
stdin = sys.stdin

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))

n, m, k = na()
for r in range(n+1):
    for c in range(m+1):
        s = n*m - r*c - (n-r)*(m-c)
        if k == s:
            print("Yes")
            quit()
print("No")

Measured memory_bytes: 3064
import math
import itertools
n = int(input())
x = [0] * n
y = [0] * n
for i in range(n):
    x[i], y[i] = map(int, input().split())

l = list(itertools.permutations(range(n)))
length = []
for perm in l:
    length.append(sum([math.sqrt((x[perm[i]]-x[perm[i+1]])**2+(y[perm[i]]-y[perm[i+1]])**2) for i in range(n-1)]))

print(sum(length)/math.factorial(n))

Measured memory_bytes: 9332
#include <bits/stdc++.h>
#define fi first
#define se second
#define pii pair<int,int>
#define pb push_back
#define mp make_pair
#define enter putchar('\n')
#define space putchar(' ')
//#define ivorysi
using namespace std;
typedef long long int64;
template<class T>
void read(T &res) {
	res = 0;T f = 1;char c = getchar();
	while(c < '0' || c > '9') {
		if(c == '-') f = -1;
		c = getchar();
	}
	while(c >= '0' && c <= '9') {
		res = res * 10 + c - '0';
		c = getchar();
	}
	res *= f;
}
template<class T>
void out(T x) {
	if(x < 0) {x = -x;putchar('-');}
	if(x >= 10) {
		out(x / 10);
	}
	putchar('0' + x % 10);
}
char s[100005];
int N;
int main() {
#ifdef ivorysi
	freopen("f1.in","r",stdin);
#endif
	scanf("%s",s + 1);
	N = strlen(s + 1);
	int p = 1,q = N;
	int ans = 0;
	while(p < q) {
		if(s[p] == s[q]) {++p;--q;}
		else {
			if(s[p] == 'x') {++p;++ans;}
			else if(s[q] == 'x') {--q;++ans;}
			else {puts("-1");return 0;}
		}
	}
	out(ans);enter;return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h> 
using namespace std;  
double volume(double s) 
{ 
	double l = s / 3; 

	s -= l; 
	double b = s / 2;  
	double h= s - b; 

	return l * b * h; 
} 
int main() 
{ 
	 double n;
	 cin>>n;
	 
	printf("%.12lf",volume(n)); 
} 


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <sstream>
#include <vector>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <algorithm>
#include <functional>

using namespace std;

#define REP(i,n) for((i)=0;(i)<(int)(n);(i)++)

int N,K;
int a[100010];

int main(){
  int i;

  while(1){
    scanf("%d %d",&N,&K);
    if(N == 0 && K == 0) break;

    REP(i,N) scanf("%d",&a[i]);

    int sum = 0, res = 0;
    REP(i,K){ sum += a[i]; res += a[i]; }
    while(i < N){
      sum += a[i];
      sum -= a[i-K];
      res = max(res,sum);
      i++;
    }

    printf("%d\n",res);
  }

  return 0;
}

Measured memory_bytes: 0
package main

import (
	"fmt"
	"math"
)

func main() {
	var a, b float64
	fmt.Scan(&a, &b)

	var x float64
	switch {
	case b < 10:
		x = a*10 + b
	case b < 100:
		x = a*100 + b
	default:
		x = a*1000 + b
	}

	if isInt(math.Sqrt(x)) {
		fmt.Println("Yes")
		return
	}
	fmt.Println("No")
}

func isInt(f float64) bool {
	// var i = int(f)
	return f == float64(int(f))
}


Measured memory_bytes: 512
#include <iostream>

using namespace std;

int main(){
	int A, B, a, b, c, count, cmp;
	cin >> A >> B;

	for(a = A/1000; a <= B/1000; a++){
		c = a/10 + (a%10)*10;
		for(b = 0; b <= 9; b++){
			cmp = (10*a + b)*100 + c;
			if(cmp < A) continue;
			if(cmp <= B){
				count++;
			}else{
				goto print;
			}
		}
	}

	print:
	cout << count << endl;
	return 0;
}

Measured memory_bytes: 256
def main():
    N = int(input())
    P = [0 for _ in range(N)]
    for i in range(N):
        P[i] = int(input())
    C = [1,1]
    Q = [0 for _ in range(N)]
    for i in range(N):
        Q[P[i]-1] = i
    for i in range(1,N):
        if Q[i-1]<Q[i]:
            C[0]+=1
            C[1] = max(C[1], C[0])
        else:
            C[0] = 1
    print(N-C[1])

if __name__ == '__main__':
    main()


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

int main() {
    int n; cin >> n;
    double v[n]; for (int i = 0; i < n; ++i) cin >> v[i];

    sort(v, v + n);
    double res = (v[0] + v[1]) / 2;
    for (int i = 2; i < n; ++i) {
        res = (res + v[i]) / 2;
    }

    cout << res << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define mod 1000000007
using namespace std;
int main(){
	int n,k;
	cin>>n>>k;
	vector<int>arr(n+1);
	for(int i=1;i<=n;i++)
		cin>>arr[i];
	vector<vector<long long>>dp(k+1,vector<long long>(n+1));
	for(int j=0;j<=n;j++)
		dp[0][j]=1;
	for(int i=1;i<=k;i++)
		dp[i][0]=1;
	for(int j=1;j<=n;j++){
		for(int i=1;i<=k;i++){
			if(arr[j]>=i){
				dp[i][j]=dp[i][j-1]%mod;
			}else{
				int min_val=i-arr[j]-1;
				int max_val=i;
				dp[i][j]=(dp[max_val][j-1]-dp[min_val][j-1])%mod;
			}
		}
		if(j<n){
			for(int i=1;i<=k;i++){
				dp[i][j]+=dp[i-1][j];
				// dp[i][j]%=mod;
			}
		}
	}
	cout<<dp[k][n];
	return 0;
}

Measured memory_bytes: 82304
#include <functional>
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
using namespace std;

int main() {

int n;
   
cin >> n;
  
int a[n];
//cout << n << endl;
  
for(int i = 0;i<n;i++){
     
   cin >> a[i];
    
}

 
   int num = 0;
  int ansnum = 0;
  while(1){
    
    
    
   if(num>=n){
     
     num=0;
     ansnum++;
   }
    // cout <<  a[num] << endl;
    
    if(a[num]%2!=0){
      
     break;
     
    }else{
    
      a[num] = a[num]/2;
    
    }
    
    num++;
    
  }

  
    cout << ansnum << endl;

   // cout << num+1 << endl;
  
  
  return 0;
}

Measured memory_bytes: 256
import java.util.*;
import java.io.*;
import java.awt.geom.*;
import java.math.*;

public class Main {

	static final Scanner in = new Scanner(System.in);
	static final PrintWriter out = new PrintWriter(System.out,false);

	static void solve() {

		BitSet ps = createIsPrimeBit(50100);

		while (in.hasNext()) {
			int n = in.nextInt();
			int m = n + 1;
			n--;
			while (n > 1 && !ps.get(n)) n--;
			while (!ps.get(m)) m++;
			out.println(n + " " + m);
		}
	}

	public static BitSet createIsPrimeBit(int n) {
		if (n < 2) return null;
		BitSet res = new BitSet();
		res.set(2,n,true);
		for (int i=2; i*i<n; i=res.nextSetBit(i+1)) {
			for (int j=i+i; j<n; j+=i) res.set(j,false);
		}
		return res;
	}

	public static void main(String[] args) {
		long start = System.currentTimeMillis();

		solve();
		out.flush();

		long end = System.currentTimeMillis();
		//trace(end-start + "ms");
		in.close();
		out.close();
	}

	static void trace(Object... o) { System.out.println(Arrays.deepToString(o));}
}

Measured memory_bytes: 26968
#include<cstdio>
int main()
{
	int x,a,b;
	scanf("%d%d%d",&x,&a,&b);
	b-=a;
	if(b<=0) printf("delicious\n");
	else if(b<=x) printf("safe\n");
	else printf("dangerous\n"); 
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <iomanip>
#include <cmath>
#include <vector>
#include <queue>
#include <limits>
#include <algorithm>
#include <string>
#include <cstring>
#include <map>

#include <inttypes.h>
using namespace std;

int main()
{
	int32_t H, W;
	scanf("%d%d", &H, &W);

	int32_t c[10][10];
	for (int32_t row = 0; row < 10; row++) {
		for (int32_t col = 0; col < 10; col++) {
			scanf("%d", &c[row][col]);
		}
	}

	int32_t A[200][200];
	for (int32_t row = 0; row < H; row++) {
		for (int32_t col = 0; col < W; col++) {
			scanf("%d", &A[row][col]);
		}
	}

	for (int32_t k = 0; k < 10; k++) {
		for (int32_t row = 0; row < 10; row++) {
			for (int32_t col = 0; col < 10; col++) {
				c[row][col] = min(c[row][col], c[row][k] + c[k][col]);
			}
		}
	}

	int32_t res = 0;
	for (int32_t row = 0; row < H; row++) {
		for (int32_t col = 0; col < W; col++) {
			if (A[row][col] == -1)
				continue;
			res += c[A[row][col]][1];
		}
	}

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

	return 0;
}


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

const long long mod = 1e9+7;



signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(20);
    
    ll n;
    cin>>n;
    ll a[n];
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    ll ans = 0;
    ll cnt[66]={};
    for(int i=0;i<n;i++){
        ll t = a[i];
        ll now = 0;
        while(t){
            if(t%2) cnt[now]++;
            t/=2;
            now++;
        }
    }
    for(int i=0;i<62;i++){
        ll k = n-cnt[i];
        ll ret = (1LL<<i)%mod;
        ret *= (k*cnt[i])%mod;
        ret %= mod;
        ans += ret;
        ans %= mod;
    }
    cout << ans << endl;
}

Measured memory_bytes: 2560
import numpy as np
import copy
N, A, B, C = map(int,input().split())
t = sorted([A,B,C])
A = t[0]
B = t[1]
C = t[2]
l = []
for i in range(N):
    l.append(int(input()))
dic = {}

def calc(ls):
    dic[tuple(ls)] = 0
    Asublist = [np.abs(i-A) for i in ls]
    res = min(Asublist)
    idx = Asublist.index(res)
    ls.remove(ls[idx])

    Bsublist = [np.abs(i-B) for i in ls]
    tmp = min(Bsublist)
    res += tmp
    idx = Bsublist.index(tmp)
    ls.remove(ls[idx])

    Csublist = [np.abs(i-C) for i in ls]
    tmp = min(Csublist)
    res += tmp
    idx = Csublist.index(tmp)
    ls.remove(ls[idx])

    return res + 10*(N - (len(ls)+3))

def rec(ls, num, maxcomb, minval):
    if num > maxcomb:
        return minval
    for i in range(0, len(ls)-1):
        for j in range(i+1, len(ls)):
            tmp = [ls[i]+ls[j]]
            tmp = tmp + [ls[k] for k in range(len(ls)) if k!=i and k!=j]
            if tuple(tmp) in dic.keys():
                continue
            tmp2 = calc(copy.deepcopy(tmp))
            if minval > tmp2:
                minval = tmp2
            if num < maxcomb:
                tmp3 = rec(copy.deepcopy(tmp), num+1, maxcomb, minval)
                if minval > tmp3:
                    minval = tmp3
    return minval
minval = rec(l, 1, N-3, calc(copy.deepcopy(l)))
print(minval)


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

typedef long long ll;

ll eval(ll a, ll b, ll d) {
	return b/d-(a-1)/d;
}

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	ll a,b,c,d; cin>>a>>b>>c>>d;
	cout<<(b-a+1)-(eval(a,b,c)+eval(a,b,d)-eval(a,b,c/__gcd(c,d)*d))<<"\n";
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <iterator>
#include <limits>
#include <set>

int main()
{
    std::set<int> tmp;
    int n{}, val{};
    std::cin >> n;
    for (int i = 0; i < n; i++) {
        std::cin >> val;
        if (tmp.find(val) != tmp.end()) {
            std::cout << "NO" << std::endl;
            return 0;
        }
        tmp.insert(val);
    }
    
    std::cout << "YES" << std::endl;
    return 0;
}


Measured memory_bytes: 9600
import math
arg = int(input())
# x, y, theta
where = [0, 0, 0]
counter = 0
while where != [0,0,0] or counter == 0:
  # walk
  math.sin(math.radians(30))
  where[0] += where[0]*math.sin(math.radians(where[2]))
  where[1] += where[1]*math.cos(math.radians(where[2]))
  where[2] = (where[2]+arg)%360
  #print(where)
  counter += 1

print(counter)

Measured memory_bytes: 62396
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstdlib>

using namespace std;

int main(){
  long long n;
  cin>>n;
  long long ans = 12;
  for(long long i = 1;i * i <= n;i++){
    int a,b;
    if(n % i == 0){
      a = i;
      b = n/i;
      long long tmp = max(to_string(a).size(),to_string(b).size());
      ans = min(tmp,ans);
    }
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vll = vector<long long>;
using vp = vector<pair<int, int>>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using vvll = vector<vector<long long>>;
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 (b<a) {a=b; return 1;} return 0;}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int a, b, c;
    cin >> a >> b >> c;
    cout << (b-a == c-b ? "YES" : "NO") << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <queue>
#include <set>
#include <stack>
using ll = long long;
using uint = unsigned int;
using graph = std::vector<std::vector<ll>>;
using wGraph = std::vector<std::vector<std::pair<ll,ll>>>;
#define rep(i,n) for (int i=0; i < int(n); i++)

using namespace std;
ll MOD7 = 1000000007;
ll MOD9 = 1000000009;
vector<ll> InputVec(ll N){
    vector<ll> A(N);
    for (int i = 0; i < N; ++i) {
        cin >> A[i];
    }
    return A;
}
void OutputVec(vector<ll> A){
    for (int i = 0; i < A.size(); ++i) {
        cout << A[i] << ",";
    }
    cout << endl;
}
vector<vector<ll>> InputVec2d(ll H,ll W){
    vector<vector<ll>> A(H);
    for (int yi = 0; yi < H; ++yi) {
        A[yi] = vector<ll>(W);
    }
    for (int yi = 0; yi < H; ++yi) {
        for (int xi = 0; xi < W; ++xi) {
            cin >> A[yi][xi];
        }
    }
    return A;
}
vector<vector<char>> InputVec2dStr(ll H,ll W){
    vector<vector<char>> A(H);
    for (int yi = 0; yi < H; ++yi) {
        A[yi] = vector<char>(W);
    }
    for (int yi = 0; yi < H; ++yi) {
        string S;
        cin >> S;
        for (int xi = 0; xi < W; ++xi) {
            A[yi][xi] = S[xi];
        }
    }
    return A;
}
void OutputVec2d(vector<vector<ll>> A){
    for (int yi = 0; yi < A.size(); ++yi) {
        for (int xi = 0; xi < A[yi].size(); ++xi) {
            cout << A[yi][xi] << ",";
        }
        cout << endl;
    }
}
graph InputGraph(ll N,ll M){
    graph G(N);
    for (int i = 0; i < M; ++i) {
        ll a,b;
        cin >> a >> b;
        a--;b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    return G;
}
graph InputDGraph(ll N,ll M){
    graph G(N);
    for (int i = 0; i < M; ++i) {
        ll a,b;
        cin >> a >> b;
        a--;b--;
        G[a].push_back(b);
    }
    return G;
}
void OutputGraph(graph G){
    for (int i = 0; i < G.size(); ++i) {
        cout << i << ":";
        for (int j = 0; j < G[i].size(); ++j) {
            cout << G[i][j]<< ",";
        }
        cout << endl;
    }
}
void OutputAnswerBool(bool b,bool isUpperCase = false){
    if(b){
        if(isUpperCase){
            cout << "YES" << endl;
        }else{
            cout << "Yes" << endl;
        }
    }else{
        if(isUpperCase){
            cout << "NO" << endl;
        }else{
            cout << "No" << endl;
        }
    }
}

int main() {
    ll N,A,B;
    cin >> N >> A >> B;
    if((B-A) % 2 == 0){
        cout << "Alice" << endl;
    }else{
        cout << "Borys" << endl;
    }
}


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


/* 
*    coder :: ATUL_PANDEY_2608
*        >>> INDIA <<<
*/
using namespace std;

// #define  part ..
#define listi vector<int >
#define listll vector<long long >
#define pii pair<int ,int >
#define pll pair<long long ,long long >
#define heap priority_queue<long long >
#define all(a) a.begin(),a.end()
#define pb(a) push_back(a)
#define mod 998244353
#define maxx 200006
#define ll long long
#define quick   ios_base::sync_with_stdio(NULL),cin.tie(0);
#define rep(i,a,b) for(int i=a;i<b;i++)
long long gcd(long long a, long long b) {
  while (b > 0) {
    long long t = a % b;
    a = b;
    b = t;
  }
  return a;
}
 
// #define test int t;cin>>t;while(t--)
// end of #define 

// define globals ...


long long ni() {
  int c = getchar();
  while (c < '0' || c > '9') c = getchar();
  long long ret = 0.0;
  while (c >= '0' && c <= '9') {
    ret = ret * 10 + c - '0';
    c = getchar();
  }
  return ret;
}





int Main ()
{

 
   ll r,c;
   cin>>r>>c;

   if(r==1 || c==1){
    cout<<1;
    return 0;
   }

   cout<<(r*c+1)/2;
   return 0;


}























// main function..
int main ()
{
  quick;

#ifndef ONLINE_JUDGE
  freopen ("input.txt", "r", stdin);
  freopen ("outt.txt", "w", stdout);
#endif

  Main ();


}


Measured memory_bytes: 3612
n = input()
if n[0] == n[1] == n[2]:
    ans = n
elif n[1] > n[0] or (n[1] == n[0] and n[2] > n[0]):
    ans = str(int(n[0])+1)*3
elif n[1] <= n[0] or n[2] < n[0]:
    ans = n[0]*3
print(ans)

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

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

    int a, b, t, qtd = 0;
    cin >> a >> b >> t;

    for(int i = a; i <= (t+0.5); i+=a){
        qtd+=b;
    }

    cout << qtd << endl;
    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
int main(){
    long double a,b,c;
    cin >> a >> b >> c;
    if(0<c-a-b){
        if(4*a*b<(c-a-b)*(c-a-b)){
            cout << "Yes" << endl;
        }else{
            cout << "No" << endl;
        }
    }else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
import sys
N=int(input())
a = [0] * N
b = [0] * N
for i in range(N):
    a[i], b[i] = map(int, input().split())
#print(a[1])
for i in range(N-2):
    if a[i]==b[i] and a[i+1]==b[i+1] and a[i+2]==b[i+2]:
        print("Yes")
        sys.exit()
print("No")

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

int main(){
	long long N, M, K, ans = 0;
	int j;
	cin >> N >> M >> K;

	vector<long long> A(N + 5), B(M + 5);
	A[0] = 0;
	B[0] = 0;
	for (int i = 0; i < N ; i++){
		cin >> A[i+1];
	}
	for (int i = 0; i < M ; i++){
		cin >> B[i+1];
	}
	for (int i = 1; i < N+1; i++){
		A[i] += A[i-1];
	}for (int i = 1; i < M+1; i++){

		B[i] += B[i-1];
	}
	j = M;
	for (int i = 0; i < N + 1; i++){
		if (A[i] > K)break;
		while ((A[i] + B[j])>K){
			j -= 1;
		}
		ans = max(ans, (long long)i + j);
	}

	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 6328
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define all(a) a.begin(), a.end()
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<ll,int> pli;
typedef pair<int,int> pii;
#define rep(i,a,b) for(ll i=a ; i<b ; i++)
#define qrep(que, ite) for(auto ite=begin(que) ; ite!=end(que) ; ite++)
const int max_n = 1e5;
const ll mod = 1e9+7;
const ll INF = 1e17;
const int inf = 1e5;
typedef long double ld;
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; }
ll gcd(ll a, ll b) { return a ? gcd(b%a, a) : b; }
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};
struct UnionFind {
    vector<int> par;

    UnionFind(int n) : par(n, -1) { }
    void init(int n) { par.assign(n, -1); }

    int root(int x) {
        if (par[x] < 0) return x;
        else return par[x] = root(par[x]);
    }

    bool issame(int x, int y) {
        return root(x) == root(y);
    }

    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (par[x] > par[y]) swap(x, y); // merge technique
        par[x] += par[y];
        par[y] = x;
        return true;
    }

    int size(int x) {
        return -par[root(x)];
    }
};
struct SegmentTree{
  int N;
  vector<int> node;
  public :
    void intit(vector<int>v){
      int sz = v.size();
      N=1;
      while(N<sz) N*=2;
      node.resize(N);
      for(int i=0 ; i<sz ; i++) node[i+N-1] = v[i];
      for(int i=N-2 ; i>=0 ; i--) node[i] = min(node[i*2+1], node[i*2+2]);
    }
    void update(int x, int val){
      x += N-1;
      node[x+N-1] = val;
      while(x>0){
        x = (x-1)/2;
        node[x] = min(node[x*2+1], node[x*2+2]);
      }
    }
    int getmin(int a, int b, int k, int l, int r){
      if(b<=l || r<=a) return inf;
      else if(a<=l && r<=b) return node[k];
      else{
        int vl = getmin(a, b, 2*k+1, l, (l+r)/2);
        int vr = getmin(a, b, 2*k+2, (l+r)/2, r);
        return min(vl, vr);
      }
    }
};
int main(){
  ll N,K; cin>>N>>K;
  vector<ll> v(N);
  rep(i,0,N){
    cin >> v[i];
    v[i]++;
  }
  vector<ll> v2(N+1, 0);
  rep(i,0,N) v2[i+1] = v2[i] + v[i];
  ll res = 0;
  for(ll i=0 ; i+K<=N ; i++){
    chmax(res, v2[i+K] - v2[i]);
  }
  printf("%.7f", (double)res/2);
  return 0;
}


Measured memory_bytes: 6344
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <climits>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
#include <random>
#include <cctype>
#include <complex>
#include <regex>

using namespace std;

double getT(double T, double x) {
    return T - x * 0.006;
}

int main() {

    int N;
    cin >> N;

    double T, A;
    cin >> T >> A;

    vector<double> H(N);
    for (int i = 0; i < N; i++) cin >> H[i];

    for (int i = 0; i < N; i++) H[i] = getT(T, H[i]);

    vector<pair<double, int>> HH;
    for (int i = 0; i < N; i++) HH.push_back(make_pair(H[i], i));

    sort(HH.begin(), HH.end(), [A](const pair<double, int> &a, const pair<double, int> &b) {
        double d1 = abs(A - a.first);
        double d2 = abs(A - b.first);
        return d1 < d2;
    });

    cout << HH.front().second + 1 << endl;

    return 0;
}














































Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<iomanip>
#include<vector>
#include<queue>
#include<deque>
#include<string>
#include<utility>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<set>
#include<map>
#include<bitset>
#include<stack>
#include<ctime>
#include<unordered_map>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,int> pli;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef vector<pli> vpli;
typedef vector<vi> mat;

inline ll read(){
	ll Hashimoto=0,Kanna=1;
	char I_Love=getchar();
	while(I_Love<'0'||I_Love>'9'){
		if(I_Love=='-')Kanna=-1;
		I_Love=getchar();
	}
	while(I_Love>='0'&&I_Love<='9'){
		Hashimoto=Hashimoto*10+I_Love-'0';
		I_Love=getchar();
	}
	return Hashimoto*Kanna;
}

#define I_Love_Hashimoto_Kanna main
#define fastio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define filein(s) freopen(s,"r",stdin);
#define fileout(s) freopen(s,"w",stdout);
#define file freopen("I_Love_Hashimoto_Kanna.out","w",stdout);
#define RE cout<<"I_Love_Hashimoto_Kanna"<<endl;
#define Tone(Kanna) cout<<Kanna<<endl;
#define Tall(Hashimoto,Kanna) for(int I_Love=0;I_Love<Kanna;I_Love++)cout<<Hashimoto[I_Love]<<(I_Love==Kanna-1?"\n":" ");
#define FOR(I_Love,Hashimoto,Kanna) for(int I_Love=Hashimoto;I_Love<Kanna;I_Love++)
#define MP(Hashimoto,Kanna) make_pair(Hashimoto,Kanna)
#define REV(Kanna) reverse(Kanna.begin(),Kanna.end());
#define SORT(Kanna) sort(Kanna.begin(),Kanna.end());
#define inf (int)1e9
#define linf (ll)1e18
#define mod (inf+7)

struct val{
	int cost,u,t;
};
inline bool operator<(val a,val b){
	return a.cost>b.cost;
}
priority_queue<val>q;
int n,m;
vi col[111111];
map<int,vi>g[111111];
map<int,int>dp[111111];

int I_Love_Hashimoto_Kanna() {
  fastio;
  n=read();
  m=read();
  FOR(i,0,m){
  	int a=read()-1,b=read()-1,c=read();
  	col[a].push_back(c);
		col[b].push_back(c);
		g[a][c].push_back(b);
		g[b][c].push_back(a);
	}
	q.push({0,0,0});
	dp[0][0]=0;
	while(!q.empty()){
		int cost=q.top().cost;
		int u=q.top().u;
		int t=q.top().t;
		q.pop();
		if(dp[u][t]!=cost)continue;
		if(dp[u].find(0)==dp[u].end()||dp[u][0]>cost){
			dp[u][0]=cost;
			q.push({cost,u,0});
		}
		if(t==0){
			FOR(i,0,col[u].size()){
				int cc=col[u][i];
				if(dp[u].find(cc)==dp[u].end()||dp[u][cc]>cost+1){
					dp[u][cc]=cost+1;
					q.push({cost+1,u,cc});
				}
			}
			continue;
		}
		FOR(i,0,g[u][t].size()){
			int to=g[u][t][i];
			if(dp[to].find(t)==dp[to].end()||dp[to][t]>cost){
				dp[to][t]=cost;
				q.push({cost,to,t});
			}
		}
	}
	int ans=inf;
	for(map<int,int>::iterator itr=dp[n-1].begin();itr!=dp[n-1].end();itr++){
		ans=min(ans,itr->second);
	}
	if(ans==inf)Tone(-1)
	else Tone(ans) 
	
  
  return 0;
}


Measured memory_bytes: 86124