akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define MAXN 1000000
using namespace std;
int L[11];


int main() {
	int n, sum=0;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>L[i];
		sum+=L[i];
	}
	sort(L,L+n);
	//printf("%d %d\n", L[n-1], sum-L[n-1]);
	printf("%s\n", L[n-1] < (sum-L[n-1])  ? "Yes":"No");;
}

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

#define all(x) (x).begin(), (x).end()

typedef long long ll;
typedef pair<int,int> PII;
typedef pair<long long,long long> PLL;


int main(){
	int n,k;
	cin>>n>>k;

	long long total=0,total2=0;

	if(k%2==0){
		for (int i = 1; i <= n ; ++i){
			if(i%k==0)total++;
			if(i%k==k/2)total2++;
		}
	}else{
		for (int i = 1; i <= n ; ++i){
			if(i%k==0)
				total++;
		}
	}
	ll ans=pow(total,3)+pow(total2,3);
	cout<<ans<<endl;

}


Measured memory_bytes: 256
import java.util.*;

class Main{
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    int n=sc.nextInt();
    long k=sc.nextLong();
    Pair[] ps=new Pair[n];
    for(int i=0;i<n;i++){
      ps[i]=new Pair(sc.nextInt(),sc.nextInt());
    }
    Arrays.sort(ps,(s1,s2)->s1.a-s2.a);
    long c=0;
    int ans=0;
    for(int i=0;i<n;i++){
      if(c<k&&k<=c+ps[i].b){
        ans=ps[i].a;
        break;
      }
      c+=ps[i].b;
    }
    System.out.println(ans);
  }
  static class Pair{
    int a;
    int b;
    Pair(int a,int b){
      this.a=a;
      this.b=b;
    }
  }
}

Measured memory_bytes: 89176
SENTINEL = float('inf')


def main():
    n = int(input())
    A = list(map(int, input().split(' ')))

    result = merge_sort(A, n, 0, n)
    print(result)


def bubble_sort(array, n):
    count = 0
    for i in range(n):
        for j in range(n-1, i, -1):
            if array[j] < array[j-1]:
                count += 1
                array[j], array[j-1] = array[j-1], array[j]
    return count


def merge_sort(A, n, left, right):
    if left+1 < right:
        mid = (left+right) // 2
        v1 = merge_sort(A, n, left, mid)
        v2 = merge_sort(A, n, mid, right)
        v3 = merge(A, n, left, mid, right)
        return v1+v2+v3
    return 0


def merge(A, n, left, mid, right):
    L = A[left:mid]
    R = A[mid:right]
    L.append(SENTINEL)
    R.append(SENTINEL)
    i = j = 0
    count = 0
    for k in range(left, right):
        if L[i] <= R[j]:
            A[k] = L[i]
            i += 1
        else:
            A[k] = R[j]
            j += 1
            count += mid + j - k - 1
    return count


if __name__ == '__main__':
    main()



Measured memory_bytes: 27492
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
#define boost ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define rando mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define fi first
#define se second
#define debug(x) cerr << " - " << #x << ": " << x << endl;
#define debugs(x, y) cerr << " - " << #x << ": " << x << " " << #y << ": " << y << endl;
#define debugii(x) cerr << " - " << #x << ": " << x.fi<<","<<x.se << endl;
#define sep() cerr << "--------------------" << endl;
#define all(x) (x).begin(),(x).end()
#define sz(x) (ll)x.size()
#define ld long double
#define ll long long
#define int ll
#define ii pair<int,int>
#define v vector<int>
#define vii vector<ii>
#define vv vector<vector<int> >
#define mp make_pair
#define INF 1000000000
#define pb push_back
#define EPS 1e-9
const int MOD = 1000000007,N=2200; // 998244353
v pr;
bitset<2200> isprime;
map<int,int> mymap,R;
void fac(int nb){
	int t=1,r=1,NB=nb;
	for (int i = 0; pr[i]*pr[i]*pr[i] <= nb; i++)
	{
		int c=0;
		while(!(nb%pr[i]))nb/=pr[i],c++;
		c%=3;
		if(c==1)t*=pr[i],r*=pr[i]*pr[i];
		if(c==2)t*=pr[i]*pr[i],r*=pr[i];
	}
	if(nb>1){
		int k=sqrt(nb);
		if((k*k)==nb)t*=nb,r*=k;
		else t*=nb,r*=nb*nb;
	}
	R[t]=r;
	mymap[t]++;
}
int32_t main(){
	boost;
	//freopen(".in","r",stdin);
	isprime.set();
	isprime[0]=isprime[1]=0;
	for (int i = 2; i*i <= N; ++i)
		if(isprime[i]){
			for (int j = i*i; j <= N; j+=i)
				isprime[j]=0;
		}
	for (int i = 2; i <= N; ++i)
		if(isprime[i])pr.pb(i);
	int n,s,ans=0;
	cin>>n;
	for (int i = 0; i < n; ++i)
	{
		cin>>s;
		fac(s);
	}
	for(auto it:mymap){
		if(it.fi==1||!it.se)continue;
		if(mymap.count(R[it.fi])){
			ans+=max(it.se,mymap[R[it.fi]]);
			mymap[R[it.fi]]=0;
		}
		else ans+=it.se;
		mymap[it.fi]=0;
	}
	ans+=(mymap[1]>0);
	cout<<ans;
	return 0;
}
//long long
//array bounds
//special cases
//binary search

Measured memory_bytes: 12800
#include<bits/stdc++.h>
using namespace std;
int main() {
	string S;
	cin >> S;
	bool flag = true;
	if (S[0] != 'A')flag = false;
	int cnt = 0;
	for (int i = 2; i < S.size() - 1; i++) {
		if (S[i] == 'C') cnt++;
	}
	if (cnt != 1)flag = false;
  	cnt=0;
	for (int i = 0; i < S.size(); i++) {
		for (char c = 'A'; c <= 'Z'; c++) {
			if (S[i] == c)cnt++;
		}
	}
	if (cnt != 2)flag = false;
	if (flag)cout << "AC" << endl;
	else cout << "WA" << endl;

}

Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
#include <deque>
using namespace std;

int N; char S[5050], T[5050];

int main()
{
	scanf ("%d %s %s",&N,S,T);
	deque<int> s, t;

	for (int i=1;i<N;i++) if (S[i-1] == S[i]) s.push_back(i);
	for (int i=1;i<N;i++) if (T[i-1] == T[i]) t.push_back(i);

	long long ans = 1e18;
	for (int mk=-N;mk<=N;mk++) if ((S[0] - '0' + mk % 2 + 2 + T[0] - '0') % 2 == 0){
		auto p = s, q = t;
		if (mk < 0) for (int k=0;k<-mk;k++) p.push_front(-1);
		if (mk > 0) for (int k=0;k<mk;k++) q.push_front(-1);
		while (p.size() < q.size()) p.push_back(-2);
		while (q.size() < p.size()) q.push_back(-2);

		long long sum = 0;
		for (int i=0;i<p.size();i++){
			if (p[i] == -1 && q[i] == -1);
			else if (p[i] == -2 && q[i] == -2);
			else if (p[i] == -1 && q[i] == -2) sum += N;
			else if (p[i] == -2 && q[i] == -1) sum += N;
			else if (p[i] == -1) sum += q[i];
			else if (q[i] == -1) sum += p[i];
			else if (p[i] == -2) sum += N - q[i];
			else if (q[i] == -2) sum += N - p[i];
			else sum += abs(p[i] - q[i]);
		}

		if (ans > sum)
			ans = sum;
	}

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

	return 0;
}

Measured memory_bytes: 384
#include <iostream>

using namespace std;

int main()
{
    int n;
    cin>>n;
    while(n>=10)
        n-=10;
    if(n==2||n==4||n==5||n==7||n==9)
        cout<<"hon"<<endl;
    else if(n==1||n==6||n==8||n==4||n==0)
        cout<<"pon"<<endl;
    else if(n==3)
        cout<<"bon"<<endl;
    return 0;
}


Measured memory_bytes: 3616
#include <bits/stdc++.h>
#include<vector>
using namespace std;
#define rep(i, n)        for(int i=0; i<(int)(n); ++i)
int main() {
  int a,b,c,d,e,f=10,g=0;
  cin>>a>>b>>c>>d>>e;
  if(a%10!=0){
    f=min(f,a%10);
    g+=(a/10+1)*10;
  }
  else g+=a;
    if(b%10!=0){
    f=min(f,b%10);
    g+=(b/10+1)*10;
  }
  else g+=b;
    if(c%10!=0){
    f=min(f,c%10);
    g+=(c/10+1)*10;
  }
  else g+=c;
    if(d%10!=0){
    f=min(f,d%10);
    g+=(d/10+1)*10;
  }
  else g+=d;
    if(e%10!=0){
    f=min(f,e%10);
    g+=(e/10+1)*10;
  }
  else g+=e;
  cout<<g+f-10;
}

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

using namespace std;

int main(void){

    string a, b;
    string sq;
    cin >> a >> b;
    sq = a + b;
    double ans = sqrt(atoi(sq.c_str()));

    if(ans == floor(ans) && ans == ceil(ans)) cout << "Yes" << endl;
    else cout << "No" << endl;


    return 0;
}

Measured memory_bytes: 384
#pragma GCC optimize(2)
#pragma GCC optimize(3)
#include<bits/stdc++.h>
using namespace std;
#define rint register int
#define rep(i,l,r) for(rint i=l;i<=r;i++)
#define per(i,l,r) for(rint i=l;i>=r;i--)
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pb push_back
#define fir first
#define sec second
#define mset(s,t) memset(s,t,sizeof(s))
template<typename T1,typename T2>void ckmin(T1 &a,T2 b){if(a>b)a=b;}
template<typename T1,typename T2>void ckmax(T1 &a,T2 b){if(a<b)a=b;}
template<typename T>T gcd(T a,T b){return b?gcd(b,a%b):a;}
int read(){
  int x=0,f=0;
  char ch=getchar();
  while(!isdigit(ch))f|=ch=='-',ch=getchar();
  while(isdigit(ch))x=10*x+ch-'0',ch=getchar();
  return f?-x:x;
}
const int N=200005;
int a[N],b[N];
int n;
int main(){
  n=read();
  for(int i=1;i<=n;i++){
    int x=read(),y=read();
    a[i]=x+y;
    b[i]=x-y;
  }
  sort(a+1,a+n+1);
  sort(b+1,b+n+1);
  printf("%d\n",max(a[n]-a[1],b[n]-b[1]));
}

Measured memory_bytes: 5256
n = int(input())
lst = [int(i) for i in input().split()]

dp = [1e7]*n
dp[0] = 0
dp[1] = abs(lst[1]-lst[0])

for i in range(2, len(lst)):
    dp[i] = min(dp[i-1]+abs(lst[i]-lst[i-1]), dp[i-2]+abs(lst[i]-lst[i-2]))

print(dp[-1])

Measured memory_bytes: 13980
# coding: utf-8
import re
import math
import itertools
from copy import deepcopy
import fractions
import random
#from functools import lru_cached
from heapq import heappop,heappush
import time
import os
import sys
import datetime
readline=readline = sys.stdin.readline
sys.setrecursionlimit(2000)
#import numpy as np
alphabet="abcdefghijklmnopqrstuvwxyz"
mod=int(10**9+7)
inf=int(10**20)
def yn(b):
    if b:
        print("yes")
    else:
        print("no")
def Yn(b):
    if b:
        print("Yes")
    else:
        print("No")
def YN(b):
    if b:
        print("YES")
    else:
        print("NO")
class union_find():
    def __init__(self,n):
        self.n=n
        self.P=[a for a in range(N)]
        self.rank=[0]*n
 
    def find(self,x):
        if(x!=self.P[x]):self.P[x]=self.find(self.P[x])
        return self.P[x]
 
    def same(self,x,y):
        return self.find(x)==self.find(y)
 
    def link(self,x,y):
        if self.rank[x]<self.rank[y]:
            self.P[x]=y
        elif self.rank[y]<self.rank[x]:
            self.P[y]=x
        else:
            self.P[x]=y
            self.rank[y]+=1
 
    def unite(self,x,y):
        self.link(self.find(x),self.find(y))
 
    def size(self):
        S=set()
        for a in range(self.n):
            S.add(self.find(a))
        return len(S)
def bin_(num,size):
    A=[0]*size
    for a in range(size):
        if (num>>(size-a-1))&1==1:
            A[a]=1
        else:
            A[a]=0
    return A
def fac_list(n,mod_=0):
    A=[1]*(n+1)
    for a in range(2,len(A)):
        A[a]=A[a-1]*a
        if(mod>0):A[a]%=mod_
    return A
def comb(n,r,mod,fac):
    if(n-r<0):return 0
    return (fac[n]*pow(fac[n-r],mod-2,mod)*pow(fac[r],mod-2,mod))%mod
def next_comb(num,size):
    x=num&(-num)
    y=num+x
    z=num&(~y)
    z//=x
    z=z>>1
    num=(y|z)
    if(num>=(1<<size)):return False
    else:
        return num
def get_primes(n,type="int"):
    A=[True]*(n+1)
    A[0]=False
    A[1]=False
    for a in range(2,n+1):
        if A[a]:
            for b in range(a*2,n+1,a):
                A[b]=False
    if(type=="bool"):return A
    B=[]
    for a in range(n+1):
        if(A[a]):B.append(a)
    return B
def is_prime(num):
    if(num<=2):return False
    i=2
    while i*i<=num:
       if(num%i==0):return False
       i+=1
    return True
def join(A,c=" "):
    n=len(A)
    A=list(map(str,A))
    s=""
    for a in range(n):
        s+=A[a]
        if(a<n-1):s+=c
    return s
#main
k=int(input())
A=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(A[k-1])


Measured memory_bytes: 8160
n = int(input())
h = list(map(int, input().split())) + [10**10]

ans = 0
cand = 0
x = h[0]
for i in range(1, n+1):
    if x >= h[i]:
        cand += 1
    else:
        ans = max(ans, cand)
        cand = 0
    # print(i, cand)

    x = h[i]

print(ans)


Measured memory_bytes: 14252
import Control.Applicative

import Data.List
    (isInfixOf)

type Problem = (String, String)

type Result = Bool

solve :: Problem -> Result

solve (s, p)
    = isInfixOf p (s ++ s)

output :: Result -> String

output bool
    = if bool then "Yes" else "No"
    
input :: IO Problem

input
    = do
        s <- getLine
        p <- getLine
        return (s, p)

main :: IO ()

main
    = putStrLn.output =<< solve <$> input

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

#include<bits/stdc++.h>

using namespace std;

void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

#define SPEED ios_base::sync_with_stdio(false);cin.tie(nullptr)
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

using ll = long long;
using ull = unsigned long long;
using P = pair<ll, ll>;

constexpr long double PI = 3.14159265358979323846264338327950288L;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

class DZabuton {
public:
    void solve(istream& cin, ostream& cout) {
      SPEED;
      int n; cin >> n;
      vector<P> vec(n);
      rep(i, n) {
        cin >> vec[i].first >> vec[i].second;
      }
      sort(all(vec), [](P a, P b){ return a.first+a.second < b.first+b.second; });
      vector<vector<ll>> dp(n+1, vector<ll>(n+1, LLONG_MAX/2));
      dp[0][0] = 0;
      rep(i, n) {
        for(int j=0; j<=n; j++) {
          chmin(dp[i+1][j], dp[i][j]);
          if (j+1 <= n && vec[i].first >= dp[i][j]) {
            chmin(dp[i+1][j+1], dp[i][j] + vec[i].second);
          }
        }
      }

      int ret = 0;
      for(int i=1; i<=n; i++) {
        if (dp[n][i] != LLONG_MAX/2) {
          ret = i;
        }
      }
      cout << ret << endl;


    }
};

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

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

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

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

int main() {
    ll n;
    cin >> n;
    ll x = 26;
    for (int i = 1; i <= 100; ++i) {
        if(n <= x){
            n--;
            string ans;
            for (int j = 0; j < i; ++j) {
                ans += 'a'+n%26;
                n /= 26;
            }
            reverse(ans.begin(),ans.end());
            cout << ans << "\n";
            return 0;
        }
        n -= x;
        x *= 26;
    }
    return 0;
}

Measured memory_bytes: 3624
package main

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

const (
	maxBufsize = 1000000
)

func inputs(lines int, rdr *bufio.Reader) []string {
	var strSlice []string

	//rdr := bufio.NewReaderSize(os.Stdin, maxBufsize)

	for i := 0; i < lines; i++ {

		line := ReadLine(rdr)
		strSlice = append(strSlice, line)

	}

	return strSlice
}

// ReadLine is to read long line
func ReadLine(rdr *bufio.Reader) string {
	buf := make([]byte, 0, maxBufsize)
	for {
		l, p, e := rdr.ReadLine()

		if e != nil {
			panic(e)
		}
		buf = append(buf, l...)
		if !p {
			break
		}
	}

	return string(buf)
}

//DivideConvertInt is to divide and convert
func DivideConvertInt(line string, num int) []int {
	tmp := strings.Split(line, " ")

	intSlice := make([]int, num)

	for i := 0; i < num; i++ {
		intTmp, _ := strconv.Atoi(tmp[i])
		intSlice[i] = intTmp
	}

	return intSlice
}

func main() {
	rdr := bufio.NewReaderSize(os.Stdin, maxBufsize)
	lines := inputs(2, rdr)

	S := lines[0]
	T := lines[1]

	runeS := []rune(S)
	runeT := []rune(T)

	for i := range runeS {
		if runeS[i] != runeT[i] {
			fmt.Println("No")
			return
		}
	}

	fmt.Println("Yes")
}


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

#define M_PI       3.14159265358979323846   // pi

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> VI;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> t3;
typedef tuple<ll, ll, ll, ll> t4;

#define rep(a,n) for(ll a = 0;a < n;a++)
#define repi(a,b,n) for(ll a = b;a < n;a++)

static const ll INF = 1e15;

const ll mod = 1000000007;

ll upper(const string & s) {
	ll u = 0;
	for (auto c : s) {
		u = max(u, (ll)(c - 'a'));
	}
	return u + 1;
}

int main(void)
{
	ll n;
	cin >> n;

	vector<string> ss[10];
	ss[0].push_back("a");
	for (ll i = 1; i < n; i++)
	{
		for (auto p : ss[i - 1]) {
			ll u = upper(p);
			for (ll j = 0; j <= u; j++) {
				string c = p;
				c.append(1, (char)('a' + j));
				ss[i].emplace_back(c);
			}
		}
	}
	sort(ss[n - 1].begin(), ss[n - 1].end());
	for (auto s : ss[n - 1]) {
		cout << s << endl;
	}
		
	return 0;
}


Measured memory_bytes: 9588
#include <bits/stdc++.h>
#include <set>
using namespace std;
#define rep(i,n) for(int i; i<(int)(n); i++)

int main() {
  int N;
  cin >> N;
  set<char>st;
  rep(i, N) {
    char h;
    cin >> h;
    st.insert(h);
  }
  if (st.size() == 3) cout << "Three" << endl;
  else if(st.size() == 4) cout << "Four" << endl;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
 
using namespace std;
 
int main(){
    int N,T;
   cin >>N>>T; pair<int,int> tt[N];int a=300000;
   for( int i=0;i<N;i++){
       int a,b;
   cin >> a>>b;
   tt[i]=make_pair(a,b);
   }
    for( int i=0;i<N;i++){
   if(get<1>(tt[i])<=T)a=min(a,get<0>(tt[i]));
   }
   
   if(a==300000)cout <<"TLE";
   else cout <<a;

}


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

int gcd(int a, int b){
    if( b == 0 ){
        return a;
    } else if (a == 0){
        return b;
    } else {
        return gcd(b, a % b);
    }
}
int main(){
    int n;
    cin>>n;
    int a[n];
    for(int i = 0;i<n;i++){
        cin>>a[i];
    }
    int ans = a[0];
    for(int i = 0; i < n;i++){
        ans = gcd(ans, a[i]);
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 640
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

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

/*----------macros----------*/

//output================
#define endl '\n'
#define fcout cout << fixed << setprecision(15)

//typedef===============
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<ll, ll> Pll;

//const number==========
constexpr ll INF9   = (ll)1e9 + 1;
constexpr ll INF18  = (ll)1e18 + 1;
constexpr ll MOD    = 1000000007;
constexpr ld PI     = 3.141592653589793L;

//member================
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second

//others================
#define all(x)          (x).begin(), (x).end()
#define rall(x)         (x).rbegin(), (x).rend()
#define rep(i, n)       for(int i = 0; (i) < (int)(n); (i)++)
#define rrep(i, n)      for(int i = n - 1; (i) >= 0 ; (i)--)
#define For(i, a, b)    for(int i = (a); (i) < (int)(b) ; (i)++)
#define CtoI(c)         int((c)) - int('0')

//functions=============
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

//vector<int> dx = {1, 0, -1, 0}, dy = {0, 1, 0, -1};
//vector<int> dx2 = { 1,1,0,-1,-1,-1,0,1 }, dy2 = { 0,1,1,1,0,-1,-1,-1 };



/*--------additional--------*/



/*----------main------------*/

int main() {
/*----------fastio----------*/
    std::cin.tie(nullptr);
    std::cout.tie(nullptr);
    std::ios::sync_with_stdio(false);
/*----------solve-----------*/

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

    double sum = 0;
    rep(i, k)
        sum += (p[i] + 1) / 2.0;

    double ans = sum;
    For(i, k, n){
        sum = sum + (p[i] + 1) / 2.0 - (p[i - k] + 1) / 2.0;
        chmax(ans, sum);
    }

    fcout << ans << endl;

return 0;
}

Measured memory_bytes: 3984
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}void pr(){ln;}
template<class A,class...B>void pr(const A &a,const B&...b){cout<<a<<(sizeof...(b)?" ":"");pr(b...);}
template<class A>void PR(A a,ll n){rep(i,n)cout<<(i?" ":"")<<a[i];ln;}
const ll MAX=1e9+7,MAXL=1LL<<61,dx[8]={-1,0,1,0,-1,-1,1,1},dy[8]={0,1,0,-1,-1,1,1,-1};
typedef pair<ll,ll> P;

void Main() {
  string s;
  R s;
  int x=0;
  rep(i,s.size()) {
    x+=s[i]-'0';
    x%=9;
  }
  if(x) pr("No");
  else pr("Yes");
}

int main(){ios::sync_with_stdio(0);cin.tie(0);Main();return 0;}


Measured memory_bytes: 3784
# import sys
# input = sys.stdin.buffer.readline

def main():
    n = int(input())
    s = [input() for i in range(n)]

    ac = 0
    wa = 0
    tle = 0
    re = 0

    for e in s:
        if e == "AC":
            ac += 1
        elif e == "WA":
            wa += 1
        elif e == "TLE":
            tle += 1
        else:
            re += 1

    # for i in range(len(s)):
    #     if s[i].strip().decode() == "AC":
    #         ac += 1
    #     elif s[i].strip().decode() == "WA":
    #         wa += 1
    #     elif s[i].strip().decode() == "TLE":
    #         tle += 1
    #     else:
    #         re += 1

    print("AC x {}".format(str(ac)))
    print("WA x {}".format(str(wa)))
    print("TLE x {}".format(str(tle)))
    print("RE x {}".format(str(re)))

if __name__ == '__main__':
    main()

Measured memory_bytes: 16296
#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include <map>
#include <string>
#include <utility>
#include <algorithm>
#include <iostream>
#include <functional>
#include <cmath>

#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;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999

using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

int calc(char op, int a, int b){
  int r;

  if(op == '+'){
    r = a+b;
  }else if(op == '-'){
    r = a-b;
  }

  return r;

}

int main(){
  int X;
  int A,B,C,D;
  int tmp;
  scanf("%d",&X);
  A = X / 1000;
  B = (X % 1000) / 100;
  C = (X % 100) / 10;
  D = X % 10;
  char op[3] = {'+','-','\0'};
  char op1,op2,op3;

  REP(i,2){
    op1 = op[i];
    REP(j,2){
      op2 = op[j];
      REP(k,2){
        op3 = op[k];
        tmp = calc(op1,A,B);
        tmp = calc(op2,tmp,C);
        tmp = calc(op3,tmp,D);
        if(tmp==7){
          printf("%d%c%d%c%d%c%d=7\n",A,op1,B,op2,C,op3,D);
          return 0;
        }
      }
    }

  }

  
  

	return 0;
}


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

// Shrotening
#define fst first
#define snd second
#define pb push_back

// Loop
#define FOR(i,a,b) for(auto i=(a);i<(b);++i)
#define RFOR(i,a,b) for(auto i=(a);i>=(b);--i)

#define REP(i,a) for(long i=0;i<(a);++i)
#define RREP(i,a) for(long i=(a);i>=0;--i)

#define EACH(i,a) for(auto (i)=(a).begin(),_END=(a).end();i!=_END;++i)
#define REACH(i,a) for(auto (i)=(a).rbegin(),_END=(a).rend();i!=_END;++i)

//Algorithm
#define ALL(a) (a).begin(), a.end()
#define RALL(a) (a).rbegin(), a.rend()
#define EXIST(a,x) ((a).find(x)!=(a).end())
#define SORT(a) std::sort((a).begin(), (a).end())
#define UNIQUE(a) std::sort((a).begin(), a.end()), a.erase(std::unique((a).begin(), a.end()), a.end());
#define SUM(a) std::accumulate((a).begin(), (a).end(), 0);

//Setting
#define OPT std::cin.tie(0);std::ios::sync_with_stdio(false);

//debug message
bool debug = true;
#define MSG(s)   if(debug){std::cout << s << std::endl;}
#define DEBUG(x) if(debug){std::cout << "debug(" << #x << "): " << x << std::endl;}

//alias
typedef long long LL;
typedef std::vector<char> VC;
typedef std::vector<int>  VI;
typedef std::vector<long> VL;
typedef std::vector<long long> VLL;

typedef std::vector< VC > VC2;
typedef std::vector< VI > VI2;
typedef std::vector< VL > VL2;
typedef std::vector< VLL > VLL2;

typedef std::pair<int,int> PII;

int main() {
    int A, B, X;
    std::cin >> A >> B >> X;

    if(X < A) {
        std::cout << "NO" << std::endl;
        return 0;
    }

    if(B >= X - A) {
        std::cout << "YES" << std::endl;
    } else {
        std::cout << "NO" << std::endl;
    }
}

Measured memory_bytes: 256
r, g, b, n = map(int, input().split())
l = [r,g,b]
l.sort()
l.reverse()
ans = 0
for i in range(int(n/l[0])+1):
    cnt = n
    cnt = cnt - (l[0] * i)
    for j in range(int(cnt/l[1])+1):
        cnt_j = cnt
        cnt_j = cnt_j - (l[1] * j)
        if cnt_j % l[2] == 0:
            ans += 1
print(ans)

Measured memory_bytes: 3064
#include <algorithm>
#include <iostream> //入出力
#include <stdio.h>
#include <map>
#include <set>
#include <string>
#include <math.h> //算術演算子
#include <vector>
#include <cstdlib>
#include <queue>
#include <stack>
#include <list>
#include <iomanip> //小数点以下を表示させる(setprecision())
//#include <bits/stdc++.h>
using namespace std;
typedef long long ll; //64bit型

#define debug(x) cerr << x << " " \
                      << "(L:" << __LINE__ << ")" << '\n'
#define PRINT(V)                                   \
        {                                          \
                for (int i = 0; i < V.size(); i++) \
                {                                  \
                        cout << V[i] << " ";       \
                }                                  \
                cout << endl;                      \
        }

int gcd(int a, int b)
{
        return b ? gcd(b, a % b) : a;
}

int main()
{
        //input->compute->output//
        int A, B, C, K;
        cin >> A >> B >> C >> K;
        int cnt = 0;
        cout << A + B + C - max({A, B, C}) + max({A, B, C}) * (1 << K) << endl;

        return 0;
}


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

int main(){
  int n,l;
  cin>>n>>l;
  vector<string> s(n);
  REP(i,n) cin>>s.at(i);
  sort(s.begin(), s.end());
  REP(i,n) cout<<s.at(i);
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**6)

def main():
	n, k = map(int, input().split())
	lst = list(input().split())
	for i in range(n, 1000000):
		flg = True
		for j in str(i):
			if j in lst:
				flg = False
		if flg:
			print(i)
			return

main()

Measured memory_bytes: 2940
#pragma region kyomukyomupurin

/**
 *    author  : 𝒌𝒚𝒐𝒎𝒖𝒌𝒚𝒐𝒎𝒖𝒑𝒖𝒓𝒊𝒏
 *    created : 2020-05-20 16:18:49
 **/

#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <chrono>
#include <cmath>
#include <complex>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;

using int64 = long long;

template <class T>
using binary_heap = std::priority_queue<T, std::vector<T>, std::greater<T>>;

template <class T, class U>
std::ostream& operator<<(std::ostream& os, const std::pair<T, U>& p) {
  return os << '(' << p.first << ", " << p.second << ')';
}

template <class T>
std::ostream& operator<<(std::ostream& os, const std::vector<T>& vec) {
  int n = 0;
  for (auto e : vec) os << (n++ ? ", " : "{") << e;
  return os << (n ? "}" : "{}");
}

template <class T>
std::ostream& operator<<(std::ostream& os, const std::set<T>& st) {
  int n = 0;
  for (auto e : st) os << (n++ ? ", " : "{") << e;
  return os << (n ? "}" : "{}");
}

template <class T, class U>
std::ostream& operator<<(std::ostream& os, const std::map<T, U>& mp) {
  int n = 0;
  for (auto e : mp) os << (n++ ? ", " : "{") << e;
  return os << (n ? "}" : "{}");
}

template <class T>
std::istream& operator>>(std::istream& is, std::vector<T>& vec) {
  for (T& e : vec) is >> e;
  return is;
}

#define all(_) begin(_), end(_)
#define rall(_) rbegin(_), rend(_)

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]: ", debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif

void debug_out() { std::cerr << '\n'; }

template <class Head, class... Tail>
void debug_out(Head&& head, Tail&&... tail) {
  std::cerr << head;
  if (sizeof...(Tail) != 0) std::cerr << ", ";
  debug_out(std::forward<Tail>(tail)...);
}

#pragma endregion kyomukyomupurin

#include <complex>

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

  double a, b, h, m; cin >> a >> b >> h >> m;

  auto to_radian = [](double arg) -> double {
    return arg * acos(-1.0) / 180;
  };

  complex<double> p1 = polar(b, to_radian(m * 6));
  complex<double> p2 = polar(a, to_radian(h * 30 + m / 2));

  cout << setprecision(17) << fixed << abs(p1 - p2) << endl;

  return 0;
}

Measured memory_bytes: 4100
#include "bits/stdc++.h"
using namespace std;

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

    sort(V.begin(), V.end());
    long long divide = pow(2, N - 1);
    double sum = V[0] / divide;
    for (int i = 1; i < N; i++) {
        divide = pow(2, N - i);
        sum += V[i] / divide; 
    }
    cout << sum << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
namespace xxx{
using namespace std;
#define FAST_IO ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define CaseT int T;cin >> T;for(int cas=1;cas<=T;cas++)
#define TCase int T;scanf("%d",&T);for(int cas=1;cas<=T;cas++)
#define clr(a,b) memset(a,b,sizeof(a))
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define _1s __builtin_popcountll
#define sqr(x) ((x)*(x))
#define upd(a,b) (a%b?a/b+1:a/b)
#define random(a,b) ((a)+rand()%((b)-(a)+1))
#define fst first
#define sec second
#define MAIN int main
#define GG exit(0)
#define bug cout << "!!!" << endl;
#define bugc(x) cout << "! " << (x) << endl;
typedef unsigned int ui;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const double EPS = 1e-8;
const double PI = acos(-1.0);
const int INF = 0x3f3f3f3f;
const int MOD = 1e9+7;

inline ll rd(){
    ll x=0,f=1;char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}
 
}using namespace xxx;
const int N = 1e5+20;

struct node{
	int cnt, val;
};

int n, x;
int a[2][N];

void cal(int a[], node& mx, node& tx){
	int cnt[N];
	mx = tx = node({0,0});
	memset(cnt, 0, sizeof cnt);
	for(int i=0;i<n/2;i++){
		cnt[a[i]]++;
	}
	int p = max_element(cnt,cnt+N) - cnt;
	mx = node({cnt[p], p});
	cnt[p] = 0;
	p = max_element(cnt,cnt+N) - cnt;
	tx = node({cnt[p], p});
}

int main(){
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		scanf("%d",&x);
		if(i&1) a[0][i/2] = x;
		else a[1][i/2] = x;
	}
	node mx1, tx1, mx2, tx2;
	cal(a[0], mx1, tx1);
	cal(a[1], mx2, tx2);
	if(mx1.val != mx2.val)
		printf("%d\n",n - mx1.cnt - mx2.cnt);
	else
		printf("%d\n",n - max(mx1.cnt + tx1.cnt, mx2.cnt + tx2.cnt));
	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include<math.h>
#include<list>
#include <algorithm>
#include<vector>
#include<math.h>
#include<map>
using namespace std;
using ll = long long;
using vll = vector<long long>;

#define in(x) cin >> x
#define out(x) cout << x
#define outn(x) cout << x << '\n'
#define outs(x) cout << x << ' '
#define rep(i,s,e) for(long i=s;i<e;i++)
#define repeq(i,s,e) for(long i=s;i<=e;i++)


int main() {
	ll a, b;
	vector<ll> vec;
	in(a);
	in(b);

	vec.push_back(a + b);
	vec.push_back(a - b);
	vec.push_back(a * b);

	sort(vec.begin(), vec.end(),greater<ll>());
	outn(vec[0]);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#ifdef HIRO
#define d(f_, ...) printf((f_), ##__VA_ARGS__)
#else
#define d(f_, ...)
#endif

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<long long, long long> pllll;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector< pair<int, int> > vii;
typedef vector< pair<long long, long long> > vllll;
typedef map<int, int> mii;
typedef map<long long, long long> mllll;
typedef queue<int> qi;
typedef queue< pair<int, int> > qp;
#define mp make_pair
#define pi 3.14159265358979323846
#define MAX max_element
#define MIN min_element
#define all(v) v.begin(), v.end()
#define gt(T) greater<T>()
#define sum(v) accumulate(v.begin(), v.end(), 0ll)
#define uni(v) do{ \
  sort(v.begin(), v.end()); \
  decltype(v)::iterator result = unique(v.begin(), v.end()); \
  v.erase(result, v.end()); \
}while(0)
#define fi(init, n) for(int i = init; i < n; ++i)
#define fj(init, n) for(int j = init; j < n; ++j)
#define fk(init, n) for(int k = init; k < n; ++k)
#define zero(x) memset(x, 0, sizeof(x))
#define negative(x) memset(x, ~0, sizeof(x))
#define bitsum(x) __builtin_popcount(x)
const ll MOD = 998244353;
const int INF = 1e9;
const int di[] = { 0, 1, 0, -1 };
const int dj[] = { 1, 0, -1, 0 };

template<typename T>
T gcd(T a, T b) {
	return b ? gcd(b, a % b) : a;
}
template<typename T>
T lcm(T a, T b) {
	return a / gcd(a, b) * b;
}
template<typename T>
int finder(vector<T> vec, T number) {
	auto itr = find(vec.begin(), vec.end(), number);
	size_t index = distance(vec.begin(), itr);
	if (index != vec.size()) return 1;
	else return 0;
}
ll frac(ll n){
	if (n == 0) return 1;
	return (n * frac(n - 1)) % MOD;
}
template<class T> inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template<class T> inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}

int main(int argc, char** argv) {
#ifdef HIRO
  string quiz(argv[1]);
  string id(argv[2]);
  string filename("input/" + quiz + "/" + id + ".txt");
  ifstream fin(filename);
  if (fin.peek() == ifstream::traits_type::eof()) {
    cout << "No input.";
    return 0;
  }
  ifstream cin(filename);
  std::cin.rdbuf(cin.rdbuf());
#endif
  // for example: 0 3 2 1 2 2 1
  // dis 1: 2
  //     2: 3
  //     3: 1
  //
  //        O
  //       / \            .
  //      O   O  1^2 = 1
  //    / | \             .
  //   O  O  O   2^3 = 8
  //  /
  // O           3^1 = 3
  //
  // 1 * 8 * 3 = 24
  ll ans = 1;
  ll n;
  cin >> n;
  int x;
  int arr[n];
  zero(arr);
  cin >> x;
  if(x != 0) {
    cout << "0\n";
    return 0;
  }
  arr[x]++;
  fi(1, n) {
    cin >> x;
    arr[x]++;
  }
  if(arr[0] > 1) {
    cout << "0\n";
    return 0;
  }
  fi(1, n) {
    fj(0, arr[i]) {
      (ans *= arr[i - 1]) %= MOD;
    }
  }
  
  cout << ans << endl;
  return 0;
}



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

///******************************** C o n t a i n e r ********************************///

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;

///*********************************** C o n s t ***********************************///

const int       N=1e6+3;
const double    PI = acos(-1);
const ll        MOD=1000000007;                 ///1e9+7
ll dx[] = {+1, 0, -1, 0, +1, +1, -1, -1};
ll dy[] = {0, +1, 0, -1, +1, -1, +1, -1};



#define pb push_back
#define F first
#define S second
#define forn(i,n) for(i=0;i<n;i++)
#define rforn(i,n) for(i=n-1;i>=0;i--)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define sz(x) x.size()
#define el <<'\n'
#define gap ' '
#define print(a) {for(auto x:a)cout<<x<<" ";cout<<endl;}
#define mem(a,b) memset(a, b, sizeof(a))
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))
#define sqr(a) (a)*(a)

#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define file() freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define fraction() cout.unsetf(ios::floatfield); cout.precision(10); cout.setf(ios::fixed,ios::floatfield);

///*********************************** F u n c t i o n ***********************************///

ll powmod(ll a,ll b){ll p=MOD;a%=p;if(!a) return 0;ll pr=1;while(b>0){if(b&1){pr*=a;pr%=p;--b;}a*=a;a%=p;b/=2;}return pr;}
bool isPrime(ll n){ if(n<=1)return false;if(n<=3)return true;if(n%2==0 or n%3==0)return false;for(ll i=5;i*i<=n;i+=6){if(n%i==0 or n%(i+2)==0)return false;}return true;}
void seive(bool a[]){ll mx=sqrt(N),ii,jj;for(ii=3;ii<=mx;ii+=2)if(!a[ii])for(jj=ii*ii;jj<=N;jj+=2*ii)a[jj]=true;}
void numofdiv(ll a[]){ll mx=sqrt(N),ii,jj;for(ii=1;ii<=mx;ii++){for(jj=ii*ii;jj<=N;jj+=ii){if(jj==ii*ii) a[jj]++; else a[jj]+=2;}}}
void sumofdiv(ll a[]){ll mx=sqrt(N),ii,jj;for(ii=1;ii<=mx;ii++){for(jj=ii*ii;jj<=N;jj+=ii){if(jj==ii*ii) a[jj]+=ii; else a[jj]+=ii+jj/ii;}}}

///**************************************************** C o d e ****************************************************///
///-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=///

 int main()
 { ll k,i;
 string s="ACL",t="";
 cin>>k;
 for(i=0;i<k;i++)t+=s;
 cout<<t<<endl;


 return 0;


}


///Thanking you by Roxy






Measured memory_bytes: 3532
#include <bits/stdc++.h>
using namespace std;
template<class t> inline t read(t &x){
	char c=getchar();bool f=0;x=0;
	while(!isdigit(c)) f|=c=='-',c=getchar();
	while(isdigit(c)) x=(x<<1)+(x<<3)+(c^48),c=getchar();
	if(f) x=-x;return x;
}
template<class t> inline void write(t x){
	if(x<0) putchar('-'),write(-x);
	else{if(x>9) write(x/10);putchar('0'+x%10);}
}

#define int long long



int n,ans;


signed main(){
	read(n);
	ans+=n/500*1000;
	n%=500;
	ans+=n/5*5;
	write(ans);
}


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

bool judgeZeroToNine(int n);
bool judgeCorr(int n[]);

int main(){
	int a[4], b[4];
	while(cin >> a[0] >> a[1] >> a[2] >> a[3]){
		while(!(judgeZeroToNine(a[0])&&judgeZeroToNine(a[1])&&
				judgeZeroToNine(a[2])&&judgeZeroToNine(a[3]))){
			cout << "wrong value\n";
			cin >> a[0] >> a[1] >> a[2] >> a[3];
		}
		cin >> b[0] >> b[1] >> b[2] >> b[3];
		while(!(judgeZeroToNine(b[0])&&judgeZeroToNine(b[1])&&
				judgeZeroToNine(b[2])&&judgeZeroToNine(b[3]))){
			cout << "wrong value\n";
			cin >> b[0] >> b[1] >> b[2] >> b[3];
		}
		
		int hit = 0, blow = 0;
		for(int i = 0;i < 4; i++){
			for(int j = 0;j < 4;j++){
				if(a[i] == b[j])
					blow++;
			}
			if(a[i] == b[i]){
				blow--;
				hit++;
			}
		}
		cout << hit << " " << blow << "\n";
	}
    return 0;
}

bool judgeZeroToNine(int n){
	if((n >= 0)&&(n <= 9))
		return true;
	else
		return false;
}

bool judgeCorr(int n[4]){
	for(int i = 0;i < 3;i++){
		for(int j = i + 1;j < 4;j++){
			if(n[i] == n[j])
				return true;
		}
	return false;
	}
}

Measured memory_bytes: 1160
#include <iostream>
#include <unordered_set>
#include <cstdint>
#include <vector>
#include <sstream>
#include <string>
#include <climits>
#include <set>
#include <algorithm>
#include <math.h>
#include <iomanip>
#include <numeric>
#include <map>
using namespace std;

int main()
{
	string s, t;
	cin >> s >> t;
	int cnt = 0;
	for (int i = 0; i < 3; i++)
		if (s[i] == t[i])
			cnt++;
	cout << cnt;
}

Measured memory_bytes: 3624
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<set>
#include<unordered_set>
#include<cassert>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef unordered_set<ll> uset;
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=0;i<=n;i++)
#define chmin(a,b) a=min(a,b)
#define chmax(a,b) a=max(a,b)
#define all(x) x.begin(),x.end()
#pragma gcc optimize("O3")
#pragma gcc optimize("unroll-loops")
#pragma gcc target("avx2,see4")
#define M 210
int n;
bool thedge(ll a,ll b){//頂点aと頂点bの間に辺があるか
	string s="";
	rep(i,n)s+="0";
	s[a]=s[b]='1';
	cout<<"? "<<s<<"\n"<<flush;
	ll res;
	cin>>res;
	return res==1;
}
int thedge_set(set<ll> S,ll x){//独立集合Sのいずれかと頂点xの間に辺があるか
	S.insert(x);
	string s="";
	rep(i,n)s+="0";
	for(auto t:S)s[t]='1';
	cout<<"? "<<s<<"\n"<<flush;
	ll res;
	cin>>res;
	return res;
}

vector<ll> FANS_A,FANS_B;//FANS_A[i]とFANS_B[i]の間に辺がある
void dfs(ll x,set<ll> S,ll score){//xとSの間の辺を探す(一つはある）
	if(S.size()==1){
		FANS_A.push_back(x);
		FANS_B.push_back(*S.begin());
		return;
	}
	set<ll> L,R;
	bool flag=0;
	for(auto s:S){
		if(flag)L.insert(s);
		else R.insert(s);
		flag=flag^1;
	}
	ll vl=thedge_set(L,x);
	if(vl)dfs(x,L,vl);
	if(score==1&&vl==1)return;
	ll vr;
	if(score==1)vr=1;
	else vr=thedge_set(R,x);
	if(vr)dfs(x,R,vr);
}
int main(){
	cin>>n;
	vector<ll> v[M];//v[d]:=0を根として深さdの頂点のidの集合
	{//2000~4500回でv[]を求める
		v[0].push_back(0);
		set<ll> cand;//まだ決まっていないもの
		for(int i=1;i<n;i++)cand.insert(i);
		for(ll d=0;d<M;d++){
			if(cand.size()==0)break;
			set<ll> cur;
			for(auto x:v[d])cur.insert(x);
			for(auto x:cand){
				if(thedge_set(cur,x)){
					v[d+1].push_back(x);
				}
			}
			for(auto x:v[d+1])cand.erase(x);
		}
	}
	{//dとd+1の間の辺を求める
		for(ll d=0;d<M;d++){
			if(v[d+1].size()==0)break;
			set<ll> A,B;
			for(auto x:v[d])A.insert(x);
			for(auto x:v[d+1])B.insert(x);
			if(A>B)swap(A,B);
			//|A|<=|B|、Aの要素に対して、辺がある方を探す
			for(auto x:A){
				ll val=thedge_set(B,x);
				if(val)dfs(x,B,val);
			}
		}
	}
	cout<<"!";
	for(int i=0;i<n-1;i++){
		cout<<" ("<<FANS_A[i]<<","<<FANS_B[i]<<")";
	}
	cout<<"\n"<<flush;
}


Measured memory_bytes: 852
#include<bits/stdc++.h>
using namespace std;
const int maxn=2e5+5;
inline int read()
{
	char c=getchar();int t=0,f=1;
	while(!isdigit(c)){if(c=='-')f=-1;c=getchar();}
	while(isdigit(c)){t=(t<<3)+(t<<1)+(c^48);c=getchar();}
	return t*f;
}
int n,ans[maxn],cnt,sum[maxn],sum1[maxn],sum2[maxn],tot;
char s[maxn];
int main()
{
	n=read();
	scanf("%s",s+1);
	int tmp=1;
	for(int i=2;i<=n;i++){
		if(s[i]!=s[i-1]){
			ans[++cnt]=tmp;
			tmp=1;
			if(cnt&1)sum1[++tot]=sum1[tot-1]+ans[cnt];
			else sum2[tot]=sum2[tot-1]+ans[cnt];
		}
		else tmp++;
	}
	ans[++cnt]=tmp;
	if(cnt&1)sum1[++tot]=sum1[tot-1]+ans[cnt];
	else sum2[tot]=sum2[tot-1]+ans[cnt];
	if(s[1]=='#'){
		int alfa=0x3f3f3f3f;
		for(int i=1;i<=tot+1;i++){
			alfa=min(alfa,sum2[tot-(cnt&1)]-sum2[i-1]+sum1[i-1]);
		}
		if(alfa==0x3f3f3f3f)alfa=0;
		printf("%d\n",alfa);
	}
	else{
		int alfa=0x3f3f3f3f;
		for(int i=1;i<=tot-(cnt&1);i++){
			alfa=min(alfa,sum1[tot]-sum1[i]+sum2[i-1]);
		//	printf("%d\n",sum1[tot]-sum1[i]+sum2[i-1]);
		}
		if(alfa==0x3f3f3f3f)alfa=0;
		printf("%d\n",alfa);
	}
	return 0;
}
/*
11
.#.....#.#.
*/

Measured memory_bytes: 2048
#include <stdio.h>
#include <stdlib.h>
int main(void){
  int days;
  int num;
  int sum;
  int day;
  
  scanf("%d %d",&days,&num);
  sum = 0;
  for(int i = 0; i < num; i++){
    scanf("%d",&day);
    sum += day;
  }
  if(days - sum >= 0){
    printf("%d\n",(days - sum));
  }else{
    printf("-1\n");
  }
  return 0;
  }

Measured memory_bytes: 1712
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;


public class Main {
	static int count2(int i , ArrayList<Integer> pos1 , ArrayList<Integer> pos2){
		int v = Collections.binarySearch(pos1, i);
		if(v < 0){
			v = - v - 1;
		}
		if(v >= pos1.size()){
			return 0;
		}
		int ret = 0;
		for(int j = v ; j < pos1.size() ; ++j){
			int pj = pos1.get(j);
			int k = 2 * pj - i;
			int o = Collections.binarySearch(pos2, k) < 0 ? 0 : 1;
			int v2 = Collections.binarySearch(pos2, pj);
			v2 = - v2 - 1;
			if(v2 < pos2.size()){
				ret += pos2.size() - v2 - o;
			}
		}
		return ret;
	}
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		String s = sc.next();
		ArrayList<Integer> bpos = new ArrayList<Integer>();
		ArrayList<Integer> rpos = new ArrayList<Integer>();
		ArrayList<Integer> gpos = new ArrayList<Integer>();
		for(int i = 0 ; i < N ; ++i){
			if(s.charAt(i) == 'B'){
				bpos.add(i);
			}else if(s.charAt(i) == 'R'){
				rpos.add(i);
			}else{
				gpos.add(i);
			}
		}
//		System.out.println(bpos.size()+" "+rpos.size()+" "+gpos.size());
		long ret = 0;
		for(int i = 0 ; i < N ; ++i){
			char ci = s.charAt(i);
			if(ci == 'R'){
				ret += count2(i , gpos, bpos);
				ret += count2(i , bpos, gpos);				
			}else if(ci == 'G'){
				ret += count2(i , rpos, bpos);
				ret += count2(i , bpos, rpos);								
			}else{
				ret += count2(i , gpos, rpos);
				ret += count2(i , rpos, gpos);												
			}
		}
		System.out.println(ret);
	}
}


Measured memory_bytes: 44724
N, x = list(map(int, input().split()))
A = sorted(list(map(int, input().split())))

def func():
    cummulative_sum = 0
    for index, value in enumerate(A):
        cummulative_sum += value
        if cummulative_sum > x:
            return index

    if cummulative_sum != x:
        return len(A) - 1
    else:
        return len(A)

ans = func()

print(ans)

Measured memory_bytes: 3060
#define rep(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define rrep(i,n) for(ll i##_len=(n) ,i=i##_len-1;i>=0;--i)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define fe(vec,lambda) std::for_each(vec.begin(), vec.end(), lambda );
#define printd(val) std::cout<< #val" = " <<val<<"\n";
#define printv(val) std::for_each(val.begin(),val.end(),[](auto x){cout<<x<<"\n";});
#define lim 1000000007ll
#include<bits/stdc++.h>
using ll = long long;
using pii = std::pair<ll,ll>;
using namespace std;
template<class T>T chmin(T& a,T b){if(a>b){a^=b;b^=a;a^=b;return 1;}return 0;}
template<class T>T chmax(T& b,T a){if(a>b){a^=b;b^=a;a^=b;return 1;}return 0;}
template <class T> T gcd(T a, T b){if (a < b) {a ^= b;b ^= a;a ^= b;} return b ? gcd(b, a % b) : a;}
template <class T> T lcm(T a, T b){return a * b / gcd(a, b);}
inline bool operator<(const pii &lhs,const pii &rhs){return(lhs.second<rhs.second);}
template<class T> vector<pair<T,T>> duplicator(const vector<T>& input){vector<pair<T,T>> out(input.size()-1);rep(i,input.size()-1){out[i].first =input[i  ];out[i].second=input[i+1];}return(out);}
vector<char> String_to_vector_char(const string& input){vector<char> out(input.size());rep(i,input.size()){out[i]=input[i];}return out;}
void YesNo(bool flag){ cout<<(flag? "Yes":"No");}

ll a,b,c,d,n,x;
vector<ll>v[3];
map<ll,ll>m;
string s,s2;
void input(){
    cin>>s;
}
void src(){
    YesNo(s[0]=='9' or s[1]=='9');
}

int main(int argc,char* argv[]){
    ios::sync_with_stdio(false);
 //   ifstream in( argv[1] ); cin.rdbuf(in.rdbuf());
    input();
    src();    
    return 0;
}

Measured memory_bytes: 256
a = []
for c in input().split():
    if c == '+':
        y = a.pop(); x = a.pop()
        a.append(x+y)
    elif c == '-':
        y = a.pop(); x = a.pop()
        a.append(x-y)
    elif c == '*':
        y = a.pop(); x = a.pop()
        a.append(x * y)
    else:
        a.append(int(c))
print(a[0])



Measured memory_bytes: 5600
N = int(input())
b = list(map(int, input().split()))
judge = "Y"
for i in range(N):
    if b[i] > i + 1:
        judge = "N"
        break

if judge == "N":
    print(-1)
else:
    X = []
    for i in range(N):
        for j in range(N - i):
            if b[N - 1 - i - j] == N -  i - j:
                X.append(N - i - j)
                del b[N - 1 - i - j]
                break
    for i in range(N):
        print(X[-1 - i])

Measured memory_bytes: 3064