akhauriyash/Code-Regression huggingface dataset:
N = int(input())
ans = []
cnt = 0

for i1 in range(1,N+1,2):
  for i2 in range(1,i1+1):
    if (i1/i2)-(i1//i2) == 0:
      cnt=cnt+1
  ans.append(cnt)
  cnt = 0
print(ans.count(8))

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

using namespace std;
using ll=long long;
using ull=unsigned long long;
using pii=pair<int,int>;

#define INF LONG_MAX
#define MOD 1000000007
#define rng(a) a.begin(),a.end()
#define rrng(a) a.end(),a.begin()

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);

  int N;
  string s;
  cin>>N>>s;

  //s->0 w->1
  
  for(int z=0;z<=1;z++){
    for(int o=0;o<=1;o++){
      vector<bool>ans(N,1);
      ans[0]=z;
      ans[1]=o;
      for(int i=0;i<N;i++){
        if(i==0){
          if((s[i]=='o'&&!ans[i])||(s[i]=='x'&&ans[i]))ans[N-1]=ans[i+1];
          else if((s[i]=='x'&&!ans[i])||(s[i]=='o'&&ans[i]))ans[N-1]=!ans[i+1];
        }
        else if(i==N-2){
          if((s[i]=='o'&&!ans[i])||(s[i]=='x'&&ans[i])){
            if(ans[i-1]!=ans[i+1]){
              i=N;
            }
          }
          else if((s[i]=='x'&&!ans[i])||(s[i]=='o'&&ans[i])){
            if(ans[i-1]==ans[i+1]){
              i=N;
            }
          }
        }
        else if(i==N-1){
          if((s[i]=='o'&&!ans[i])||(s[i]=='x'&&ans[i])){
            if(ans[i-1]==ans[0]){
              for(auto it:ans){
                if(it)cout<<'W';
                else cout<<'S';
              }
              return 0;
            }
          }
          else if((s[i]=='x'&&!ans[i])||(s[i]=='o'&&ans[i])){
            if(ans[i-1]!=ans[0]){
              for(auto it:ans){
                if(it)cout<<'W';
                else cout<<'S';
              }
              return 0;
            }
          }
        }
        else{
          if((s[i]=='o'&&!ans[i])||(s[i]=='x'&&ans[i]))ans[i+1]=ans[i-1];
          else if((s[i]=='x'&&!ans[i])||(s[i]=='o'&&ans[i]))ans[i+1]=!ans[i-1];
        }
      }
    }
  }
  cout<<-1<<endl;
  return 0;
}


Measured memory_bytes: 592
#include <bits/stdc++.h>
#define MAXN 200000
using namespace std;

bool S[MAXN];
vector<int> P;

int main () {
  for (int x=2;x<MAXN;++x)
    if (!S[x]) {
      P.push_back(x);
      for (int y=x+x;y<MAXN;y+=x)
        S[y] = true;
    }
  int x;
  cin >> x;
  cout << *lower_bound(P.begin(), P.end(), x) << endl;
}


Measured memory_bytes: 640
#include <iostream>
#include <cstdio>
#include <cassert>
#include <algorithm>
#include <vector>
#include <string>
#include <numeric>
#include <cmath>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i,n) for(int i=n; i>-1; --i)
#define ALL(a) (a).begin(),(a).end()
#define FILL(a,x); REP(i,sizeof(a)){ (a)[i]=(x); }
#define CINA(a,n); REP(i,(n)){ cin >> (a)[i]; }
#define FILL2(a,n,m,x); REP(i,(n)){ REP(j,(m)){(a)[i][j]=(x);} }
#define CINA2(a,n,m); REP(i,(n)){ REP(j,(m)){cin >> (a)[i][j];} }
#define Liny "Yes\n"
#define Linn "No\n"
#define LINY "YES\n"
#define LINN "NO\n"
#define PI 3.141592653589793

//cout << setfill('0') << right << setw(4) << 12; // "0012"
int keta(ll x){ if(x<10){return 1;} else{return keta(x/10) + 1;}}
int keta_wa(ll x){ if(x<10){return x;} else{return keta_wa(x/10) + x%10;} }
int ctoi(char c){ return ( (c>='0' && c<='9')? c - '0': 0 );}
ll sum(ll a[],ll N){ return accumulate(a,a+N,0LL);}
ll gcd(ll a,ll b){if(a<b)swap(a,b); return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){if(a<b){swap(a,b);} return a/gcd(a,b)*b;}


int main(){
    int ans = 0;
    int N; cin>>N;
    REP(count,N){
        int a; cin>>a;
        bool ok = true;
        if(a%2==0 && a>2){ ok = false; continue;}
        for(int i=3;i<sqrt(a)+1;i+=2){
            if(a%i==0){ ok = false; break;}
        }
        if(ok){ ++ans;}
    }
    cout << ans <<endl;
}


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

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

    string ans = "yes";
    for (int i = 0; i < s.size(); ++i) {
        for (int j = i + 1; j < s.size(); ++j) {
            if (s[i] == s[j]) {
                ans = "no";
                break;
            }
        }
    }

    cout << ans << endl;
}



Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import sys
# ----------------------------------------------------------------
# Use Solve Function

def solve(lines):
    A = int(lines.pop(0))
    B = int(lines.pop(0))
    C = int(lines.pop(0))
    D = int(lines.pop(0))
    print(min(A,B) + min(C,D))
    
lines = [x.strip() for x in sys.stdin.readlines()]

#
# solve !!
#
solve(lines)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,(n)-1,0)
#define all(v) v.begin(), v.end()
#define endk '\n'
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;
const ld eps = 1e-10;
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;}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n; cin >> n;
  vector<ll> T(n), A(n);
  rep(i, n) cin >> T[i];
  rep(i, n) cin >> A[i];
  vector<ll> mn(n, 1), mx(n, longinf);
  rep(i, n) {
    if(i == 0 || T[i] > T[i-1]) {
      chmax(mn[i], T[i]);
      chmin(mx[i], T[i]);
    } else {
      chmin(mx[i], T[i]);
    }
  }
  rrep(i, n) {
    if(i == n-1 || A[i] > A[i+1]) {
      chmax(mn[i], A[i]);
      chmin(mx[i], A[i]);
    } else {
      chmin(mx[i], A[i]);
    }
  }
  ll ans = 1;
  rep(i, n) {
    if(mx[i] < mn[i]) ans = 0;
    else (ans *= mx[i]-mn[i]+1) %= mod;
  }
  cout << ans << endk;
  return 0;
}


Measured memory_bytes: 6368
<?php
  $n = trim( fgets(STDIN) );
  $b = explode(" ", trim(fgets(STDIN)));
  $a[] = $b[0];
  for($i=0; $i<count($b); $i++){
    if($i == count($b)-1){
      $a[] = $b[$i];
    }else{
      $a[] = min($b[$i+1],$b[$i]); 
    }
  }
  echo array_sum($a)."\n";
  

Measured memory_bytes: 4604
#include<bits/stdc++.h>
using namespace std;
int main(){
  vector <int> a;
  int b[300001]={};
  for(int i=2;i<=300000;i++)
    if(i%7==1||i%7==6)
      a.push_back(i),b[i]=1;

  for(int i=0;a[i]*a[i]<=300000;i++)
    if(b[a[i]])for(int j=0;a[i]*a[j]<=300000;j++)b[a[i]*a[j]]=0;

  while(1){
  int n;
  cin>>n;
  if(n==1)break;
  cout<<n<<':';
  for(int i=2;i<=n;i++)
    if(!(n%i)&&b[i])cout<<' '<<i;
  cout<<endl;
  }

  return 0;
}

Measured memory_bytes: 2764
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, a, b) for(int i = a; i < b; i++)
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  FastIO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
typedef long long ll;
using P = pair<int,int>;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }

vector<string> ans;

void dfs(int n, string s, char cMax){
    if (s.size() == n){
        ans.push_back(s);
        return;
    }else{
        for(char c = 'a'; c <= cMax+1; c++){
            dfs(n, s+c, max(c, cMax));
        }
    }
}

int main(){
    int n;
    cin >> n;
    dfs(n, "a", 'a');
    rep(i, ans.size()){
        cout << ans[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 7220
#include<iostream>
#include<algorithm>
#include<vector>
#include<utility>
using namespace std;
typedef pair <int,int> pii;
int main(){
  int n,m;
  while(cin>>n>>m,n){
    vector<pii> d(n);
      for(int i=0;i<n;i++)cin>>d[i].second>>d[i].first;
      sort(d.begin(),d.end(),greater<pii>());
    int ans=0;
    for(int i=0;i<n;i++){
      if(m>d[i].second){
	m-=d[i].second;
	continue;
      }else if(m!=0){
	d[i].second-=m;
	m=0;
      }
      ans+=d[i].second*d[i].first;
    }
    cout << ans << endl;
  }
  return 0;
}

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

int main(){
  string S;
  cin >> S;
  long long int answer = 0;
  for(int bit = 0; bit < (1 << (S.size()-1)); bit++){
    string buf = ""; //分割途中の数字を入れておくためのバッファ
    buf += S.at(0);
    for(int i = 0; i < (S.size() - 1); i++){ //iは+の個数　最大で文字数-1個
      if(bit & (1 << i)){ 
        answer += stoll(buf);
        buf = "";
      }
      buf += S.at(i+1);
    }
    answer += stoll(buf);
  }
  cout << answer << endl;
  return 0;
}

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

signed main() {
  int N,M;
  cin >> N >> M;
  if(N == 1){
	  if(M != 1){
		  cout << M-2 << endl;
		  return 0;
	  }
	  else{
		  cout << 1 << endl;
		  return 0;
	  }
  }
  else if(M == 1){
	  if(N != 1){
		  cout << N-2 << endl;
		  return 0;
	  }
	  else{
		  cout << 1 << endl;
		  return 0;
	  }
  }
  else{
  cout << (N-2)*(M-2) << endl;
}
}


Measured memory_bytes: 3548
#![allow(unused)]

use std::{cmp, collections, fmt, io, iter, ops, str};
use cmp::Ordering::{Equal, Greater, Less};
use collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, LinkedList, VecDeque};
use io::{Read, Write};

#[cfg(feature = "debug")]
macro_rules! debug {
    ($fmt: expr) => { eprintln!($fmt) };
    ($fmt: expr, $($args: tt)*) => { eprintln!($fmt, $($args)*) };
}

#[cfg(not(feature = "debug"))]
macro_rules! debug {
    ($fmt: expr) => {};
    ($fmt: expr, $($args: tt)*) => {};
}

macro_rules! vmax {
    ($x: expr, $y: expr) => { cmp::max($x, $y) };
    ($x: expr, $($args: expr),*) => { cmp::max($x, vmax!($($args),*)) };
}

macro_rules! vmin {
    ($x: expr, $y: expr) => { cmp::min($x, $y) };
    ($x: expr, $($args: expr),*) => { cmp::min($x, vmin!($($args),*)) };
}

fn read_line() -> String {
    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.trim().to_owned()
}

fn read_word() -> String {
    const CAPACITY: usize = 16;

    let mut stdin = io::stdin();
    let mut byte: [u8; 1] = [0];

    loop {
        let mut buf = Vec::with_capacity(CAPACITY);

        loop {
            let res = stdin.read(&mut byte);

            if res.unwrap_or(0) == 0 || byte[0] <= b' ' {
                break;
            } else {
                buf.push(byte[0]);
            }
        }

        if buf.len() > 0 {
            return String::from_utf8(buf).unwrap();
        }
    }
}

fn parse_line<T: str::FromStr>() -> T {
    read_line().parse().ok().unwrap()
}

fn parse_word<T: str::FromStr>() -> T {
    read_word().parse().ok().unwrap()
}

fn parse_vec<T: str::FromStr>() -> Vec<T> {
    read_line()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

fn flush() {
    io::stdout().flush();
}

fn main() {
    let c1 = read_line();
    let c2 = read_line();
    let c3 = read_line();

    let s = format!(
        "{}{}{}",
        c1.chars().nth(0).unwrap(),
        c2.chars().nth(1).unwrap(),
        c3.chars().nth(2).unwrap()
    );
    println!("{}", s);
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn test() {
        //
    }
}


Measured memory_bytes: 4352
import Control.Applicative
main = do
        n <- getLine
        xs <- map read.words<$>getLine :: IO ([Int])
        n <- getLine
        ys <- map read.words<$>getLine
        print $ countElems ys xs

linearSearch x [] = Nothing
linearSearch x (y:ys)
    | x == y = Just x
    | x /= y = linearSearch x ys

countElems xs ys = foldr (\x acc -> if p (f x) then 1+acc else acc) 0 xs
                                               where p = (/= Nothing)
                                                     f x = linearSearch x ys
--length.filter (/= Nothing) $ map (\x -> linearSearch x ys) xs

Measured memory_bytes: 5632
#include <bits/stdc++.h>
#define INF 5000000000000000000
#define ll long long
#define pll pair<ll, ll>
using namespace std;

int main() {
  ll N;
  cin >> N;
  vector<ll> A(N + 1);
  ll s = 0;
  for (ll i = 0; i <= N; ++i) {
    cin >> A.at(i);
    s += A.at(i);
  }
  ll cnt = 1;
  ll node = 1;
  ll ans = 0;
  for (ll i = 0; i <= N; ++i) {
    ans += node;
    if (node >= A.at(i)) {
      ll temp = min(s - cnt, node - A.at(i));
      cnt += temp;
      node = (node - A.at(i)) + temp;
    }
    else {
      cout << -1 << "\n";
      return 0;
    }
  }
  cout << ans << "\n";
}


Measured memory_bytes: 4060
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,ans = 0,j = 0;
  bool judge = false;
  cin >> N;
  vector<int> vec(N);
 
  for(int i = 0 ; i < N ; i++){
    cin >> vec.at(i);
  }
  
  while(j != 1){
    j = vec.at(j) -1;
    ans++;
    if(ans >= N){
      judge = true;
      cout << -1 << endl;
      break;
    }  
  }  
  if(!judge)
  cout << ans << endl;
  
}

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

int main() {
    int N, C; cin >> N >> C;
    int d[C][C];
    int count[3][C];
    memset(count, 0, sizeof(count));

    for (int i = 0; i < C; i++)
        for (int j = 0; j < C; j++)
            cin >> d[i][j];

    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
            int c; cin >> c;
            count[(i + j) % 3][c - 1]++;
        }
    }

    int ans = 1e9;
    for (int i = 0; i < C; i++) {
        for (int j = 0; j < C; j++) {
            if (i == j) continue;
            for (int k = 0; k < C; k++) {
                if ( i == k || j == k ) continue;

                int tmp = 0;
                for (int l = 0; l < C; l++)
                    tmp += d[l][i] * count[0][l];
                for (int l = 0; l < C; l++)
                    tmp += d[l][j] * count[1][l];
                for (int l = 0; l < C; l++)
                    tmp += d[l][k] * count[2][l];
                if (ans > tmp) ans = tmp;
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 384
import heapq
n, m = map(int, input().split())
G = [[] for i in range(n)]
for _ in range(m):
    a, b = map(int, input().split())
    G[a - 1].append(b - 1)
    G[b - 1].append(a - 1)
inf = 10**20
D = [inf for i in range(n)]
D[0] = 0
M = [None for i in range(n)]
Q = [(0, 0)]
heapq.heapify(Q)
while Q:
    _, x = heapq.heappop(Q)
    for y in G[x]:
        if D[x] + 1 < D[y]:
            D[y] = D[x] + 1
            M[y] = x
            heapq.heappush(Q, (D[y], y))
print('Yes')
for i in range(1, n):
    print(M[i] + 1)


Measured memory_bytes: 105952
#include <stdio.h>
int main(void){
    int x,y,z;
    for(;;){
        scanf("%d%d",&x,&y);
        if(x==0 && y==0)break;
        if(x>y){
            z=y;
            y=x;
            x=z;
            
        }
        printf("%d %d\n",x,y);
    }
    return 0;
}

Measured memory_bytes: 1852
#include<set>
#include<map>
#include<deque>
#include<queue>
#include<stack>
#include<cmath>
#include<ctime>
#include<bitset>
#include<string>
#include<vector>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<complex>
#include<iostream>
#include<algorithm>
#define ll long long
using namespace std;

const int maxn = 110000;

int n,m;
struct edge{int y,nex;}a[maxn<<1]; int len,fir[maxn];
inline void ins(const int x,const int y){a[++len]=(edge){y,fir[x]};fir[x]=len;}

int sg[maxn];

void dp(const int x,const int fa)
{
	sg[x]=0;
	for(int k=fir[x],y=a[k].y;k;k=a[k].nex,y=a[k].y) if(y!=fa)
	{
		dp(y,x); sg[x]^=(sg[y]+1);
	}
}

int main()
{
	scanf("%d",&n);
	for(int i=1;i<n;i++)
	{
		int x,y; scanf("%d%d",&x,&y);
		ins(x,y); ins(y,x);
	}
	
	dp(1,0);
	if(sg[1]) puts("Alice");
	else puts("Bob");
	
	return 0;
}


Measured memory_bytes: 7296
#include <stdio.h>

#include <math.h>



int main(){

    double x1, y1, x2, y2, distance;

    scanf("%lf %lf %lf %lf", &x1, &y1, &x2, &y2);

    distance=sqrt((pow(x2-x1, 2)+pow(y2-y1, 2)));

    printf("%f\n", distance);



    return 0;

}


Measured memory_bytes: 2720
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
inline ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
inline ll lcm(ll a, ll b) { return a / gcd(a, b)*b; }
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T>& V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> >& Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T>& mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }
template<typename T>vector<T> make_v(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>auto make_v(size_t a,Ts... ts){return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));}
template<typename T,typename V> typename enable_if<is_class<T>::value==0>::type fill_v(T &t,const V &v){t=v;}
template<typename T,typename V> typename enable_if<is_class<T>::value!=0>::type fill_v(T &t,const V &v){for(auto &e:t) fill_v(e,v);}
/*
 <url:https://atcoder.jp/contests/abc147/tasks/abc147_a>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */

template<class Type>
Type solve(Type res = Type()){
    ll x,y,z; cin >> x >> y >> z;
    if(x+y+z >= 22) return "bust";
    else return "win";
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    // solve(0);
    cout << fixed << setprecision(15) << solve<string>() << endl;
    return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import re

a, b = map(str, input().split())
pattern = r"^\d{" + a + "}-\d{" + b + "}$"
repattern = re.compile(pattern)

rematch = repattern.match(input())

if rematch == None:
    print('No')
else:
    print('Yes')


Measured memory_bytes: 3316
#include  <stdio.h>

int main() {
  int n,i,max,min;
  int MAX=200000;
  int R[MAX];
  i=0;
  while(1){
    scanf("%d",&n);
    if(2<=n&&n<=MAX){
      while(1){
	if(n==i) break;
	scanf("%d", &R[i]);
	if(1<=R[i]&&R[i]<=1000000000) i++;
      }
      break;
    }
  }

  max=-2000000000;
  min=R[0];
  
  for(i=1;i<n;i++){
    if(max<R[i]-min) max=R[i]-min;
    if(min>R[i]) min=R[i];
  }
    
  printf("%d\n",max);
   
  return 0;
}



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

#define whole(f, x, ...)                                 \
  ([&](decltype((x)) whole) {                            \
    return (f)(begin(whole), end(whole), ##__VA_ARGS__); \
  })(x)

using namespace std;
using ll = long long;

void solve() {
  int n;
  cin >> n;
  vector<ll> h(n);
  for (int i = 0; i < n; i++) {
    cin >> h[i];
  }

  ll old = h[n - 1];

  for (int i = n - 2; i >= 0; --i) {
    if (h[i] > old + 1) {
      cout << "No\n";
      return;
    }
    if (h[i] == old + 1) {
      continue;
    }
    old = h[i];
  }
  cout << "Yes\n";
}

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);

  solve();
  return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <queue>
#include <vector>
#include <algorithm>
#include <math.h>
#include <map>
#include <iomanip>
#include <queue>
#include <numeric>
#define repl(i, l, r) for (ll i = l; i < r; i++)
#define rep(i, n) repl(i, 0, n)

using namespace std;
using ll = long long;


int main() {

	ll N;

	cin >> N;

	ll k, v;
	vector<pair<ll, ll> > tasks;


	rep(i, N) {
		cin >> v >> k;
		tasks.emplace_back(k, v);
	}

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

	bool key = true;
	ll sum = 0;

	rep(i, N) {
		sum += tasks[i].second;
		if (tasks[i].first < sum) {
			key = false;
			break;
		}
	}

	if (key) {
		cout << "Yes";
	}
	else {
		cout << "No";
	}

	return 0;
}


Measured memory_bytes: 7420
import java.util.*;
import java.io.*;
public class Main {
    static PrintWriter pw  = new PrintWriter(new OutputStreamWriter(System.out));
     
    public static void main(String[] args) {
        MyScanner ms = new MyScanner();
        String T = ms.nextLine();
        String S = ms.nextLine();
        boolean game  = true;
        for(int i=0;i<T.length();i++){
            if(S.charAt(i)!=T.charAt(i))
            game = false;
        }
        pw.println(game?"Yes":"No");
        pw.flush();
    }
    public static class MyScanner {
        BufferedReader br;
        StringTokenizer st;
   
        public MyScanner() {
           br = new BufferedReader(new InputStreamReader(System.in));
        }
   
        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
   
        int nextInt() {
            return Integer.parseInt(next());
        }
   
        long nextLong() {
            return Long.parseLong(next());
        }
   
        double nextDouble() {
            return Double.parseDouble(next());
        }
   
        String nextLine(){
            String str = "";
        try {
           str = br.readLine();
        } catch (IOException e) {
           e.printStackTrace();
        }
        return str;
        }
  
     }
}

Measured memory_bytes: 32624
package main

import (
	"fmt"
	"strings"
)

func main() {
	var s string
	fmt.Scan(&s)
	ans := 100
	for v := 'a'; v <= 'z'; v++ {
		if strings.Contains(s, string(v)) {
			sum := fa(s, v)
			if sum < ans {
				ans = sum
			}
		}
	}
	fmt.Println(ans)
}

func fa(s string, v rune) int {
	sum := 0
	for len(s) != strings.Count(s, string(v)) {
		sum++
		temp := ""
		for i := 1; i < len(s); i++ {
			if rune(s[i]) == v || rune(s[i-1]) == v {
				temp += string(v)
			} else {
				temp += string(s[i])
			}
		}
		s = temp
	}
	return sum
}


Measured memory_bytes: 4864
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  char chr;
  cin>>chr;
  if(chr=='a'||chr=='e'||chr=='i'||chr=='o'||chr=='u'){
  cout<<"vowel"<<endl;
  }
  else {
  cout<<"consonant"<<endl;
  }
}

Measured memory_bytes: 256
import sys
from itertools import product

sys.setrecursionlimit(10000)

while True:
    W, H = map(int, input().split(' '))
    if W == 0 and H == 0:
        break

    m = tuple([list(map(int, input().split(' '))) for _ in range(H)])


    def dfs(y, x):
        if m[y][x] == 0:
            return False
        else:
            m[y][x] = 0

        for dy, dx in product((-1, 0, 1), repeat=2):
            ny = y + dy
            nx = x + dx
            if 0 <= ny < H and 0 <= nx < W and m[ny][nx] == 1:
                dfs(ny, nx)

        return True


    count = 0
    for i in range(H):
        for j in range(W):
            if m[i][j] == 1:
                count += int(dfs(i, j))

    print(count)



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

using namespace std;
typedef long long ll;

int main() {
    int n,a,b,c,d;
    cin >> n >> a >> b>>c>>d;
    a--;
    d--;
    c--;
    b--;
    string s;
    cin >> s;
    int masu[200001];
    for(int i=0; i<n; i++){
        if(s[i]=='.'){
            masu[i]=0;
        }else{
            masu[i]=1;
        }
    }
    for(int i=b; i<=d; i++){
        if(masu[i]==1 && masu[i-1]==1){
            cout << "No" << endl;
            return 0;
        }
    }
    for(int i=a; i<=c; i++){
        if(i!=0){
            if(masu[i]==1 && masu[i-1]==1){
                cout << "No" << endl;
                return 0;
            }
        }
    }
    if(c<d){
        cout << "Yes" << endl;
    }else{

        for(int i=b; i<=d; i++){
            if(masu[i]==0){
                if(masu[i-1]==0 && masu[i+1]==0){
                    cout << "Yes"<<endl;
                    return 0;
                }
            }
        }
        cout << "No" << endl;
    }




  return 0;
}


Measured memory_bytes: 1284
#6
h,w = map(int,input().split())

if h == 1 or w == 1:
    print(1)

else:
    a = (h+1) // 2 #奇数列の列数
    b = (w+1) // 2 #奇数列のマス目数
    c = h // 2 #偶数列の列数
    d = w // 2 #偶数列のマス目数
    
    print(a*b+c*d)


Measured memory_bytes: 2940
#include<iostream>
#include <algorithm>
#include <vector>
#include <deque>
#include <queue>
#include <set>

using namespace std;

int main()
{
    // 整数の入力
    long long  N,value;
    value = 0;
    string A,B,C;
    cin >> N;
    cin >> A >> B >> C;

    for (int i = 0;i< N;i++){
        if (A[i]== B[i] && B[i] == C[i]){
            value += 0;
        }else if(A[i]== B[i] || B[i]== C[i] || C[i]== A[i]){
            value += 1;
        }else{
            value += 2;
        }
    }
    cout << value << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <string>
#include <tuple>
#include <vector>
#include <map>
#include <unordered_map>
#include <list>
#include <set>
#include <stack>
#include <queue>
#include <cstdlib>
#include <algorithm>
#include <random>
#include <cassert>
using namespace std;
#define LL long long
#define MP(a, b) make_pair(a, b)
#define MMP(a, b, c) make_pair(make_pair(a, b), c)
#define MAX 1000000000
#undef INT_MIN
#undef INT_MAX
#define INT_MIN -2147483647
#define INT_MAX 2147483647
#define LL_MIN (LL)-9223372036854775807
#define LL_MAX (LL)9223372036854775807
#define PI 3.14159265359

int main(){
    iostream::sync_with_stdio(false);
    
    START:

    int n,m,h,k;
    cin >> n >> m >> h >> k;
    if(n == 0) return 0;
    int s[1000];
    for(int i=0; i<n; i++) cin >> s[i];
    vector<pair<int,int> > yoko;
    for(int i=0; i<m; i++){
        int a,b;
        cin >> a >> b;
        yoko.push_back(MP(b,a));
    }
    sort(yoko.begin(), yoko.end());

    for(int i=yoko.size()-1; i>=0; i--){
        swap(s[yoko[i].second-1], s[yoko[i].second]);
    }
    int now[1000];
    for(int i=0; i<n; i++) now[i] = i;
    int l[100000], r[100000];
    for(int i=0; i<yoko.size(); i++){
        l[i] = now[yoko[i].second-1];
        r[i] = now[yoko[i].second];
        swap(now[yoko[i].second-1], now[yoko[i].second]);
    }

    int def = 0;
    for(int i=0; i<k; i++) def += s[i];
    int ans = def;
    for(int i=0; i<yoko.size(); i++){
        if(l[i] < k && r[i] < k){

        }
        else if(l[i] < k){
            ans = min(ans, def-s[l[i]]+s[r[i]]);
        }
        else if(r[i] < k){
            ans = min(ans, def+s[l[i]]-s[r[i]]);
        }
        else{

        }
    }
    cout << ans << endl;

    goto START;

    return 0;
}



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

using namespace std;

int cnt[10000005];

int main() {
	int n;
	scanf("%d", &n);
	
	long long res = 0;
	for (int i = 1; i <= n; i++) {
		for (int j = 1; i * j <= n; j++)
			cnt[i * j]++;
		res = res + 1LL * i * cnt[i];
	}
	
	printf("%lld\n", res);
}


Measured memory_bytes: 42776
#include <stdio.h>

int main(){
  int num;
  scanf("%d",&num);
  
  int p[num],i,j,sum,tmp;
  
    for(i=0;i<num;i++){
    scanf("%d",&p[i]);
  }
  
  for(i=0;i<num-1;i++){
    for(j=i+1;j<num;j++){
      if(p[j]>p[i]){
        tmp = p[j];
        p[j]=p[i];
        p[i]=tmp;
      }
    }
  }
  
  sum = p[0]/2;
  for(i=1;i<num;i++){
    sum += p[i];
  }
  
  printf("%d\n",sum);
  return 0;
}


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

int main() {
	int n; cin >> n;
	vector<int> V(n);
	vector<int> C(n);

	for (int i = 0; i < n; i++)
	{
		cin >> V.at(i);
	}
	for (int i = 0; i < n; i++)
	{
		cin >> C.at(i);
	}
	
	int X = 0;int Y = 0;
	for (int i = 0; i < n; i++)
	{
		if (V.at(i) > C.at(i))
		{
			X += V.at(i);
			Y += C.at(i);
		}
	
	}
	
	cout << X - Y << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int a,b;
  scanf("%d",&a);
  scanf("%d",&b);
  if(a==1){
    a=a+13;
  }
  if(b==1){
    b=b+13;
  }
  if(a==b){
    printf("Draw\n");
  }else if(a>b){
    printf("Alice\n");
  }else{
    printf("Bob\n");
  }
}

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

int main()
{
	int a, b, d, r;
	double f;
	a = 0;
	b = 0;
	d = 0;
	r = 0;
	f = 0.0;
	cin >> a >> b;
	if ((a >= 1) && (a <= 1000000000) && (b >= 1) && (b <= 1000000000))
	{
		d = a / b;
		r = a % b;
		f = ((double)a) / ((double)b);  //intのa,bをdoubleにキャスト
		cout << d <<  " " << r << " " << fixed  << f << endl;  //fixedは桁数表示のため
	}
	return 0;
}


Measured memory_bytes: 3228
#include <iostream>
using namespace std;
typedef struct{
	int ih;
	int im;
	int is;
	int oh;
	int om;
	int os;
} Time;
Time n[3];
int ans[3];
int main(){
	for(int i=0;i<3;i++){
		cin >>n[i].ih>>n[i].im>>n[i].is>>n[i].oh>>n[i].om>>n[i].os;
	}
	for(int i=0;i<3;i++){
		ans[2]=n[i].oh*3600+n[i].om*60+n[i].os-
			n[i].ih*3600-n[i].im*60-n[i].is;
			ans[1]=ans[2]/60;
			ans[0]=ans[1]/60;
			ans[1]=ans[1]%60;
			ans[2]=ans[2]%60;
			cout << ans[0]<<" " <<ans[1] <<" " <<ans[2]<<endl;
	}
	return 0;
}

Measured memory_bytes: 2948
import java.util.Scanner;
import java.util.ArrayList;
import java.util.List;

public class Main{
  static int f1(int n){return n/2;}
  static int f2(int n){return 3*n+1;}


  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    List<Integer> list = new ArrayList<Integer>();
    int s = sc.nextInt();

    list.add(s);
    int i=1;
    do{
      list.add(s);
      if(s%2==0){
        s = f1(s);
      }else{
        s = f2(s);
      }
      i++;
    }while(!(list.contains(s)));
    System.out.println(i);

  }

}

Measured memory_bytes: 21972
object Main {
  def main(args: Array[String]): Unit = {
    solve
  }

  def solve(): Unit = {
    val sc = new java.util.Scanner(System.in)
    val a, b = sc.nextInt()

    var ans = 1
    var flg = false
    while (!flg && ans <= 10000) {
      val taxA = (ans * 0.08).toInt
      val taxB = (ans * 0.1).toInt
      if (taxA == a && taxB == b) {
        flg = true
      } else {
        ans += 1
      }
    }

    println(if (flg) ans else -1)
  }
}


Measured memory_bytes: 27440
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n,m,c;
  cin>>n>>m>>c;
  vector<int> B(m);
  for(int i=0;i<m;i++)cin>>B[i];
  int ans=0;
  for(int i=0;i<n;i++){
    int sum=0;
    for(int j=0;j<m;j++){
      int a;
      cin>>a;
      sum+=a*B[j];
    }
    if(sum+c>0)ans++;
  }
  cout<<ans<<endl;
}

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

bool check(vector<int>& condi,vector< vector<int> >& mp,vector<int> curr ){
  
  bool result = true;
  for(int i=0;i<condi.size();++i){
    bool isOdd = condi[i]==1;
    int ct = 0;
    for(int j=0;j<mp[i].size();++j){
      if(curr[mp[i][j]-1]==1){
        ct++;
      }
    }
    bool odd = (ct%2)==1;

    if(odd  != isOdd){
      result = false;
      break;
    }
  }
  
  /*
  for(auto i:mp){
    for(auto j:i){
      cout<<j<<" ";
    }
    cout<<endl;
  }
  for(auto i:curr){
    cout<<i<<" ";
  }
  cout<<endl;
  cout<<result<<endl;
  */
  
  return result;
}

void dfs(vector<int>& curr,int level,int& result,vector<int>& condi,vector< vector<int> >& mp){
  if(level==curr.size()){
    if(check(condi,mp,curr)){
      result ++;
    }
    return ;
  } else {
    dfs(curr,level+1,result,condi,mp);
    curr[level] = 1;
    dfs(curr,level+1,result,condi,mp);
    curr[level] = 0;
  }
}

int main(){
  int switchs,bulbs;
  cin>>switchs>>bulbs;
  vector< vector<int> > g(bulbs);
  for(int i=0;i<bulbs;++i){
    int num;cin>>num;
    for(int j=0;j<num;++j){
      int curr;cin>>curr;
      g[i].push_back(curr);
    }
  }
  
  
  vector<int> condi(bulbs);
  for(int i=0;i<bulbs;++i){
    cin>>condi[i];
  }
  //vector<int> curr(switchs,1);
  //check(condi,g,curr);
  
  int result = 0;
  vector<int> curr(switchs,0);
  dfs(curr,0,result,condi,g);
  
  cout<<result<<endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		while(true){

			int a = sc.nextInt();
			String op = sc.next();
			int b = sc.nextInt();

			if(op.equals("?"))break;

			int ans = 0;

			switch(op){
			case "+":
				ans = a+b;
				break;
			case "-":
				ans = a-b;
				break;
			case "*":
				ans = a*b;
				break;
			case "/":
				ans = a/b;
				break;
			}

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


Measured memory_bytes: 26392
#include <cstring>
#include <cstdio>

#define OUT return puts("No"),0

inline int readin(){
	int x=0,c;
	for (;(c=getchar())<'0'||c>'9';);
	for (;c>='0'&&c<='9';c=getchar()) x=(x<<1)+(x<<3)+c-48;
	return x;
}

char s[105][105];

int main(){
	int n=readin();
	for (int i=1;i<=n;i++) scanf("%s",s[i]);
	for (int i=2;i<=n;i++){
		if (s[i][0]!=s[i-1][strlen(s[i-1])-1]) OUT;
		for (int j=1;j<i;j++) {
			if (strlen(s[i])!=strlen(s[j])) continue;
			bool f=0;
			for (int k=0;k<strlen(s[i]);k++) if (s[i][k]!=s[j][k]){
				f=1;
				break;
			}
			if (!f) OUT;
		}
	}
	puts("Yes");
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define ull unsigned long long
#define ll long long
#define llmax LLONG_MAX   //ranges are defined in climits
#define llmin LLONG_MIN
#define imax INT_MAX
#define imin INT_MIN
#define pb push_back
int n,paths=0,ans=0;
void dfsRec(vector<int>adj[],int s, bool visited[])
{
  int count=0;
  for(int i=0;i<n;i++)
  {
    if(visited[i])  ++count;
  }
  if(count==n)  {++ans;return;}
  for(int u:adj[s])
  {
    if(!visited[u])
    {
      visited[u]=true;
      dfsRec(adj,u,visited);
      visited[u]=false;
    }
  }
  
}
int main()
{
  ios_base::sync_with_stdio(false);cin.tie(NULL);
  int m;cin>>n>>m;
  vector<int>adj[n];
  for(int j=0;j<m;j++)
  {
    int a,b;cin>>a>>b;
    adj[--a].pb(--b);
    adj[b].pb(a);
  }
  bool visited[n];
  for(int i=0;i<n;i++)  visited[i]=false;
  visited[0]=true;
  dfsRec(adj,0,visited);
  cout<<ans;
	return 0;
}


Measured memory_bytes: 3612
#include <algorithm>
#include <array>
#include <bitset>
#include <complex>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <queue>

using namespace std;

struct BoolName : numpunct<char> {
  string t, f;
  BoolName (string t = "Yes", string f = "No") : t(t), f(f) {}
  string do_truename() const {return t;}
  string do_falsename() const {return f;}
};

struct Initializer {
  Initializer() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(15) << boolalpha;
    cout.imbue(locale(cout.getloc(), new BoolName));
  }
} initializer;

template<typename T> istream& operator>>(istream &s, vector<T> &v) {
  for (T &t : v) s >> t;
  return s;
}

template<typename T> ostream& operator<<(ostream &s, const vector<T> &v) {
  for (const T &t : v) s << t << endl;
  return s;
}

int main() {
  int h, w;
  cin >> h >> w;
  vector<string> s(h);
  cin >> s;
  vector<vector<bool>> v(600, vector<bool>(600));
  for (int i = 0; i < h; ++i) {
    for (int j = 0; j < w; ++j) {
      if (s[i][j] == '#') v[i - j + w][i + j] = true;
    }
  }
  int64_t res = 0;
  for (int d = 2; d < 600; d += 2) {
    for (int i = 0; i < 600; ++i) {
      int c = 0;
      for (int j = 0; j < d; ++j) {
        if (i + d < 600 && v[i + d][j]) ++c;
        if (i - d >= 0 && v[i - d][j]) ++c;
      }
      for (int j = 0; j + d < 600; ++j) {
        if (i + d < 600 && v[i + d][j + d]) ++c;
        if (i - d >= 0 && v[i - d][j + d]) ++c;
        if (v[i][j] && v[i][j + d]) {
          res += c;
        }
        if (i + d < 600 && v[i + d][j]) --c;
        if (i - d >= 0 && v[i - d][j]) --c;
      }
    }
  }
  auto u = v;
  for (int i = 0; i < 600; ++i) {
    for (int j = 0; j < 600; ++j) {
      v[i][j] = u[j][i];
    }
  }
  for (int d = 2; d < 600; d += 2) {
    for (int i = 0; i < 600; ++i) {
      int c = 0;
      for (int j = 1; j < d - 1; ++j) {
        if (i + d < 600 && v[i + d][j]) ++c;
        if (i - d >= 0 && v[i - d][j]) ++c;
      }
      for (int j = 0; j + d < 600; ++j) {
        if (i + d < 600 && v[i + d][j + d - 1]) ++c;
        if (i - d >= 0 && v[i - d][j + d - 1]) ++c;
        if (v[i][j] && v[i][j + d]) {
          res += c;
        }
        if (i + d < 600 && v[i + d][j + 1]) --c;
        if (i - d >= 0 && v[i - d][j + 1]) --c;
      }
    }
  }
  cout << res << endl;
}



Measured memory_bytes: 512
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <memory>
#include <numeric>
#include <set>
#include <stack>
#include <string>
#include <vector>

#define INF 1000000000
#define MOD 1000000007
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
#define int long long

struct Setup {
    Setup() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(20);
    }
} SETUP;

signed main() {
    int N, M, C;
    cin >> N >> M >> C;
    vector<int> bs(M);
    for (auto &b : bs) {
        cin >> b;
    }
    vector<vector<int>> as(N, vector<int>(M));
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < M; j++) {
            cin >> as[i][j];
        }
    }

    int ans = 0;
    for (int i = 0; i < N; i++) {
        int sum = 0;
        for (int j = 0; j < M; j++) {
            sum += as[i][j] * bs[j];
        }

        if (sum + C > 0) {
            ans++;
        }
    }
    cout << ans << endl;
}


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

#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;

bool dp[100100];

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

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

cout << (dp[k] ? "First" : "Second") << endl;
return 0;
}

Measured memory_bytes: 384
var
	A,B,C,K:Longint;
begin
	read(A,B,C,K);
	while A>=B do begin
		dec(K);
		B:=B*2;
	end;
	while B>=C do begin
		dec(K);
		C:=C*2;
	end;
	if K<0 then writeln('No')else writeln('Yes');
end.

Measured memory_bytes: 1320
#include <cstdio>
#include <vector>
using namespace std;

int main(){
	int n;
	scanf("%d", &n);
	vector<int> point(n, 0);
	
	for (int i=0; i<n*(n-1)/2; i++){
		int a, b, c, d;
		scanf("%d %d %d %d", &a, &b, &c, &d);
		if (c > d){
			point[a-1] += 3;
		}else if (c == d){
			point[a-1]++;
			point[b-1]++;
		}else{
			point[b-1] += 3;
		}
	}

	for (int i=0; i<point.size(); i++){
		int rank = 1;
		for (int j=0; j<point.size(); j++){
			if ( point[i] < point[j] ){
				rank++;
			}
		}
		printf("%d\n", rank);
	}

	return 0;
}

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

#define LL long long
typedef pair<int, int> pii;

template< typename T > inline void read(T &x)
{
    static char _c;
    static bool _f;

    x = 0;
    _f = 0;
    _c = getchar();

    while(_c < '0' || '9' < _c) {if(_c == '-') _f = true; _c = getchar();}
    while('0' <= _c && _c <= '9') {x = (x << 1) + (x << 3) + (_c & 15); _c = getchar();}
    if(_f) x = -x;
}

template < typename T > inline void Min(T &x, T y) {if(y < x) x = y;}
template < typename T > inline void Max(T &x, T y) {if(x < y) x = y;}


#define lowbit(x) ((x) & -(x))
#define lson l,mid,id<<1
#define rson mid+1,r,id<<1|1
#define ls id<<1
#define rs id<<1|1
#define MID(l,r) ((l)+(((r)-(l))>>1))
#define fi first
#define se second
#define mk make_pair
#define pb push_back

const int INF = 0x3f3f3f3f;
const double pi = (double) acos(-1.0);
const double eps = (double) 1e-8;
//const int MOD = (int) 1e9 + 7;
const int MOD = (int) 998244353;
const int maxn = (int) 3e5 + 20;
const int maxm = (int) 1e6 + 20;

inline int sig(double x) {return x < -eps ? -1 : eps < x;}
LL fp(LL a, LL n, LL MOD)
{
    if(n < 0) a = fp(a, MOD - 2, MOD), n = -n;
    LL res = 1; for(; n; n >>= 1, a = a * a % MOD) if(n & 1) res = res * a % MOD; return res;
}

int n, x;
int a[maxn];

void work()
{
    cin >>n >>x;
    for(int i = 0; i < n; i++) cin >>a[i];

    int tot = 0, now = 0;
    for(int i = 0; i < x; i++) now += a[i];
    tot = now;
    for(int i = x; i < n; i++)
    {
        now += a[i] - a[i - x];
        tot = max(tot, now);
    }
    printf("%.12f\n", (tot + x * 1.0) / 2);
}


int main(int argc, char **argv)
{
#ifdef yukihana0416
freopen("in.txt", "r", stdin);
//freopen("out.txt", "w", stdout);
#endif // yukihana0416
//    get_prime();
    int tc = 1;
//    read(tc);
    for(int ca = 1; ca <= tc; ca++)
    {
//        printf("Case #%d: ", ca);
        work();
    }
    return 0;
}


Measured memory_bytes: 1024
#include <stdio.h>
#include <stdlib.h>
#include<iostream>
#include<string>
#include<cmath>
#include<map>
#include<vector>
#include<algorithm> 
using namespace std;


long long N, M, K, ans,num;

long long gcd(long long a, long long b) {
	if (a < b) {
		long long c;
		c = a;
		a = b;
		b = c;
	}
	if (a%b == 0)return b;
	return gcd(b, a%b);
}

string s;
int main(){
	cin >> N >> M;
	vector<long long> n,m;
	K = gcd(N, M);
	num = K;
	for (int i = 2; i <= sqrt(num); i++) {
		if(K%i == 0) {
			n.push_back(i);
			while (K%i == 0)K /= i;
		}
		if (K == 1)break;
	}
	if (K!=1)n.push_back(K);



	cout << n.size()+1 << endl;
	return 0;
}

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

// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const int mod = 1000000007;
struct mint {
  ll x;  // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod - a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const { return mint(*this) += a; }
  mint operator-(const mint a) const { return mint(*this) -= a; }
  mint operator*(const mint a) const { return mint(*this) *= a; }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod - 2); }
  mint& operator/=(const mint a) { return *this *= a.inv(); }
  mint operator/(const mint a) const { return mint(*this) /= a; }
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x; }
ostream& operator<<(ostream& os, const mint& a) { return os << a.x; }

int main() {
  int n;
  cin >> n;
  int zero = 0;
  map<pair<ll, ll>, P> mp;
  rep(i, n) {
    ll x, y;
    cin >> x >> y;
    if (x == 0 && y == 0) {
      zero++;
      continue;
    }
    ll g = gcd(x, y);
    x /= g;
    y /= g;
    if (y < 0) x = -x, y = -y;
    if (y == 0 && x < 0) x = -x, y = -y;
    bool rot90 = (x <= 0);
    if (rot90) {
      ll tmp = x;
      x = y;
      y = -tmp;
    }
    if (rot90)
      mp[{x, y}].first++;
    else
      mp[{x, y}].second++;
  }

  mint ans = 1;
  for (auto p : mp) {
    int s = p.second.first;
    int t = p.second.second;
    mint now = 1;
    now += mint(2).pow(s) - 1;
    now += mint(2).pow(t) - 1;
    ans *= now;
  }
  ans -= 1;

  ans += zero;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 16052
<?php

// list($hp, $k) = explode(" ", trim(fgets(STDIN)));
fscanf(STDIN,"%d", $n);

$hp = $n;
$num = 1;
$ans = 0;
while($hp > 0){
    $hp = intdiv($hp, 2);
    $ans += $num;
    $num *= 2;
    // var_dump($num);
}
// var_dump($hp);
echo $ans;

Measured memory_bytes: 4604
function calc(T,x,y,K)
	g(a,b,c,d)=T[c+1,d+1]-T[c+1,b]-T[a,d+1]+T[a,b]
	if x<=K
		if y<=K
			g(x,y,x+K-1,y+K-1)+g(1,1,x-1,y-1)+g(x+K,1,2K,y-1)+g(1,y+K,x-1,2K)+g(x+K,y+K,2K,2K)
		else
			g(x,y,x+K-1,2K)+g(x,1,x+K-1,y-K-1)+g(1,y-K,x-1,y-1)+g(x+K,y-K,2K,y-1)
		end
	else
		if y<=K
			calc(T,x-K,y+K,K)
		else
			calc(T,x-K,y-K,K)
		end
	end
end
function main()
	lines=readlines()
	N,K=map(x->parse(Int,x),split(shift!(lines)))
	sum=zeros(Int,2K+1,2K+1)
	for s=lines
		x,y,c=split(s)
		x=parse(Int,x)
		y=parse(Int,y)
		if c=="B"
			y+=K
		end
		x=mod1(x,2K)
		y=mod1(y,2K)
		"""
		if x<=K
			if y<=K
				sum[x+1,y+1]+=1
				sum[x+1+K,y+1+K]+=1
				sum[x+1,y+1+K]-=1
				sum[x+1+K,y+1]-=1
			else
				sum[x+1,y+1]+=1
				sum[x+1+K,y+1]-=1
				sum[x+1,1]+=1
				sum[x+1+K,1]-=1
				sum[x+1,y-K+1]-=1
				sum[x+1+K,y-K+1]+=1
			end
		else
			if y<=K
				sum[x+1,y+1]+=1
				sum[x+1,y+1+K]-=1
				sum[1,y+1]+=1
				sum[1,y+1+K]-=1
				sum[x-K+1,y+1]-=1
				sum[x-K+1,y+1+K]+=1
			else
				sum[x+1,y+1]+=1
				sum[1,y+1]+=1
				sum[x-K+1,y+1]-=1
				sum[x+1,1]+=1
				sum[x+1,y-K+1]-=1
				sum[1,1]+=1
				sum[1,y-K+1]-=1
				sum[x-K+1,1]-=1
				sum[x-K+1,y-K+1]+=1
			end
		end
		"""
		sum[x+1,y+1]+=1
	end
	for i=2:2K+1,j=2:2K+1
		sum[i,j]+=sum[i-1,j]+sum[i,j-1]-sum[i-1,j-1]
	end
	ans=0
	for i=1:2K,j=1:2K
		ans=max(ans,calc(sum,i,j,K))
	end
	println(ans)
end
main()


Measured memory_bytes: 180168
using System;
using static System.Console;

namespace abc178
{
    class Program
    {
        static int keyNum = (int)1e9 + 7;
        static void Main()
        {
            var n = int.Parse(ReadLine());
            var result = 0L + Pow(10, n, keyNum) + Pow(8, n, keyNum) - 2 * Pow(9, n, keyNum);
            result %= keyNum;
            if (result < 0)
            {
                result += keyNum;
            }
            WriteLine(result);
        }
        static int Pow(int n, int k, int keyNum)
        {
            var result = 1L;
            for (var i = 0; i < k; ++i)
            {
                result = result * n % keyNum;
            }
            return (int)result;
        }
    }
}


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

using namespace std;

int main(){
	int n;
	scanf("%d",&n);
	vector<int> v(n),c(n);
	for(int &i:v){
		scanf("%d",&i);
	}
	for(int &i:c){
		scanf("%d",&i);
	}
	int ans=0;
	for(int i=0;i<n;i++){
		if(v[i]-c[i]<=0){
			continue;
		}
		ans+=(v[i]-c[i]);
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 256