akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

#ifndef ONLINE_JUDGE
    #define gc getchar
    #define pc putchar
#else
    #define gc getchar_unlocked
    #define pc putchar_unlocked
#endif

using namespace std;

#define vi vector<int>
#define si set<int>
#define vs vector<string>
#define pii pair<int,int>
#define vpi vector<pii>
#define pri priority_queue<int>
#define rev_pri priority_queue<int,vector<int>,greater<int> >
#define mpi map<int,int>
#define i64 long long int
#define endl '\n'
#define pi acos(-1)
#define all(v) v.begin(),v.end()
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define inf INT_MAX/2
#define infll LLONG_MAX/3
#define For(i,n) for(int i=0;i<n;i++)
#define Fre(i,a,b) for(int i = a; i < b; i++)
#define sf(n) scanf("%d", &n)
#define sff(a,b) scanf("%d %d", &a, &b)
#define sfff(a,b,c) scanf("%d %d %d", &a, &b, &c)
#define pfn(n) printf("%d\n", n)
#define pfs(n) printf("%d ", n)
#define eps 1e-8
#define ff first
#define ss second
#define mem(a,b) memset(a,b,sizeof(a))
#define READ freopen("in.txt", "r", stdin)
#define WRITE freopen("out.txt", "w", stdout)
#define sz size()
#define dbg(i) printf("yo %d\n", i)
#define foreach(i,c) for(__typeof((c).begin()) i = (c).begin(); i != (c).end(); i++)
#define sqr(a) (a) * (a)
#define clr clear()
#define CASE(a) printf("Case %d: ",a)

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


//i64 gcd(i64 a,i64 b){if(!b)return a;return gcd(b,a%b);}

//inline void fastRead(int *a){register char c=0;while(c<33)c=gc();*a=0;while(c>33){*a=*a*10+c-'0';c=gc();}}

//inline void fastWrite(int a){char snum[20];int i=0;do{snum[i++]=a%10+48;a=a/10;}while(a!=0);i=i-1;while(i>=0)pc(snum[i--]);pc('\n');}

//i64 bigmod(i64 num,i64 n){if(n==0)return 1;i64 x=bigmod(num,n/2);x=x*x%mod;if(n%2==1)x=x*num%mod;return x;}

//i64 modinverse(i64 num){return bigmod(num,mod-2)%mod;}

//i64 po(i64 a,i64 b){i64 ans=1;while(b--)ans *= a;return ans;}

//i64 ncr(i64 n,i64 r){if(n==r)return 1;if(r==1)return n;if(dp[n][r]!=-1)return dp[n][r];return dp[n][r]=ncr(n-1,r)+ncr(n-1,r-1);}


// bit manipulations

//bool checkbit(int mask,int bit){return mask & (1<<bit);}

//int setbit(int mask,int bit){ return mask  (1<<bit) ; }

//int clearbit(int mask,int bit){return mask & ~(1<<bit);}

//int togglebit(int mask,int bit){return mask ^ (1<<bit);}



int main()
{


        string s;
        cin >> s;
        string ss = s;
        reverse(all(ss));
        if(s==ss)
                puts("Yes");
        else
                puts("No");












        return 0;
}



Measured memory_bytes: 256
#include <stdio.h>
#include <string>
#include <stdlib.h>
#include <iostream>
#include <vector>
#include <string.h>
#include <algorithm>
#include <map>
using namespace std;
const int maxn = 1e6+7;
int n = 0, q = 0;

struct Query{
	int id, l, r;
	bool operator< (Query a) const{
		return r < a.r;
	}
}query[maxn];



int v[maxn], sum[maxn], ans[maxn];

int lowbit(int x){
	return x & (-x);
}

void change(int i, int a){
	while(i <= n){
		sum[i] += a;
		i += lowbit(i);
	}
}

int getsum(int i){
	int sum_t = 0;
	while(i > 0){
		sum_t += sum[i];
		i -= lowbit(i);
	}
	return sum_t;
}

int main() {

	scanf("%d", &n);scanf("%d", &q);
		memset(v, 0, sizeof(v));
		memset(sum, 0, sizeof(sum));
		memset(ans, 0, sizeof(ans));

		int t = 0;
		for(int i = 1; i <= n; i++){
			scanf("%d", &v[i]);
		}

		for(int i = 1; i <= q; i++){
			scanf("%d%d", &query[i].l, &query[i].r);
			query[i].id = i;
		}
		sort(query + 1, query + q + 1);

		int pre = 1;
		map<int, int> mymap;
		for(int i = 1; i <= q; i++){
			for(int j = pre; j <= query[i].r; j++){
				//已存在
				if(mymap[v[j]]){
					change(mymap[v[j]], -1);
				}
				mymap[v[j]] = j;
				change(j, 1);
			}
			pre = query[i].r + 1;
			ans[query[i].id] = getsum(query[i].r) - getsum(query[i].l - 1);
		}

		for(int i = 1; i <= q; i++){
			cout << ans[i] << endl;
		}

	return 0;
}


Measured memory_bytes: 44760
using System;
using System.Text;
using System.Collections.Generic;
using System.Collections;
using System.Linq;
using E = System.Linq.Enumerable;
class Program
{
    static char[] abc = "abcdefghijklmnopqrstuvwxyz".ToCharArray();
    static long mod = 1000000007;
    static void Main(string[] args)
    {
        var N = long.Parse(Console.ReadLine());
        var A = Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray();
        //var S = Console.ReadLine();
        long ans = 1;
        long now = A[0];
        var man = 0;

        for (int i = 1; i < N; i++)
        {
            if(man == 0)
            {
                if(now < A[i])
                {
                    man = 1;
                }else if(now > A[i])
                {
                    man = -1;
                }
            }else if(man == 1)
            {
                if(now > A[i])
                {
                    man = 0;
                    ans++;
                }
            }
            else
            {
                if (now < A[i])
                {
                    man = 0;
                    ans++;
                }
            }

            now = A[i];
        }

        Console.WriteLine(ans);

    }
        

    
}


Measured memory_bytes: 38172
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <iomanip>
 
using namespace std;

int main(){
	string s;
    cin>>s;
    int i=0,c=0;
    while(s[i]!='\0'){
        if(s[i]=='1'){
            c++;
        }
        i++;
    }
   
    cout<<c<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<cstring> 
using namespace std;
int dp[100010][3],a[100010][3],n;
int main(){
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>a[i][0]>>a[i][1]>>a[i][2];
	}
	dp[1][0]=a[1][0];
	dp[1][1]=a[1][1];
	dp[1][2]=a[1][2];
	for(int i=2;i<=n;i++){
		dp[i][0]=max(dp[i-1][1]+a[i][0],dp[i-1][2]+a[i][0]);
		dp[i][1]=max(dp[i-1][0]+a[i][1],dp[i-1][2]+a[i][1]);
		dp[i][2]=max(dp[i-1][1]+a[i][2],dp[i-1][0]+a[i][2]);
		//cout<<dp[i][0]<<" "<<dp[i][1]<<" "<<dp[i][2]<<endl;
	}
	cout<<max(dp[n][0],max(dp[n][1],dp[n][2]));
}
//https://atcoder.jp/contests/dp/tasks/dp_c

Measured memory_bytes: 2560
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <array>
#include <set>
#include <map>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cstdint>
#include <cassert>
#include <random>

using namespace std;
using i64 = int64_t;
using i32 = int32_t;
template<class T, class U> void init_n(vector<T>& v, size_t n, U x) 
{ v = vector<T>(n, x); }
template<class T> void init_n(vector<T>& v, size_t n) { init_n(v, n, T()); }
template<class T> void read_n(vector<T>& v, size_t n, size_t o = 0) 
{ v = vector<T>(n+o); for (size_t i=o; i<n+o; ++i) cin >> v[i]; }
template<class T> void read_n(T a[], size_t n, size_t o = 0)
{ for (size_t i=o; i<n+o; ++i) cin >> a[i]; }
template<class T> T gabs(const T& x) { return max(x, -x); }
#define abs gabs

const i64 mod = 998244353;
i64 fact_memo[10000001];
i64 fact(i64 x) {
  if (x == 0) return 1;
  if (fact_memo[x]) return fact_memo[x];
  return fact_memo[x] = x * fact(x - 1) % mod;
}
i64 ipow(i64 a, i64 b) {
  return (b & 1 ? a : 1) * (b > 1 ? ipow(a * a % mod, b >> 1) : 1) % mod;
}
i64 inv(i64 x) {
  return ipow(x, mod - 2);
}
i64 fact_inv(i64 x) {
  return inv(fact(x));
}
i64 perm(i64 a, i64 b) {
  return fact(a) * fact_inv(a - b) % mod;
}
i64 conb(i64 a, i64 b) {
  return perm(a, b) * fact_inv(b) % mod;
}
i64 n;
int main() {
  cin >> n;
  fact_memo[0] = 1;
  for (i64 i = 1; i <= n; ++i) {
    fact_memo[i] = fact_memo[i - 1] * i % mod;
  }
  i64 sum = ipow(3, n), sub = 0;
  for (i64 i = n / 2 + 1; i <= n; ++i) {
    (sub += conb(n, i) * ipow(2, n - i) % mod) %= mod;
  }
  i64 ans = (sum - 2 * sub + 2 * mod) % mod;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 78336
#include <bits/stdc++.h>
 
using namespace std;
 
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define fileio freopen("in.in", "r", stdin),freopen("out.out", "w", stdout);
#define ll long long int
#define FF first
#define SS second
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define pll pair<long long int,long long int>
#define sd(x) scanf("%d",&x)
#define slld(x) scanf("%lld",&x)
#define pd(x) printf("%d\n",x)
#define plld(x) printf("%lld\n",x)
#define pss printf
#define MOD 1000000007
#define INF 1e18
#define eps 0.00001
#define endl '\n'
#define debug(n1) cout<<n1<<endl

int n;
string s;
ll ans=0;
int val[500005];

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

    n=s.length();
    int i=0,j=0;

    while(i<n&&j<n)
    {
        while(j<n&&s[i]==s[j])
            j++;
        if(s[i]=='>')
        {
            for(int h=j;h>=i;h--)
                val[h]=max(val[h],j-h);
        }
        else
        {
            for(int h=i;h<=j;h++)
                val[h]=max(val[h],h-i);
        }
        i=j;
    }

    for(int i=0;i<=n;i++)
        ans+=val[i];

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

Measured memory_bytes: 2844
import math

while True:
	n = int(raw_input())
	if n==0:
	    break
	nums = [int(x) for x in raw_input().split(" ")]
	average = sum(nums) / float(n)

	a2 = sum([math.pow(x-average, 2.0) for x in nums]) / n
	print math.sqrt(a2)

Measured memory_bytes: 4444
#include<stdio.h>

#define N 100000

int main(){
  int hp;
  int a;
  int b[N],i;
  if(scanf("%d%d",&hp,&a)!=2) return 1;
  
  for(i=0;i<a;i++){
  	if(scanf("%d",&b[i])!=1) return -1;
  }
  
  for(i=0;i<a;i++){
  	hp-=b[i];
  }
  
  if(hp<=0) printf("Yes");
  else printf("No");
return 0;
}

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

int main(){
    int N;
    cin >> N;
    vector<int> L(2*N);
    for (int i = 0; i < 2*N; i++) cin >> L[i];
    sort(L.begin(), L.end());
    reverse(L.begin(), L.end());
    int ans = 0;
    for (int i = 1; i < 2*N; i+=2) ans += L[i];
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define FOR(i, a, b) for (int i = a; i <= b; i++)
#define ROF(i, a, b) for (int i = a; i >= b; i--)
using namespace std;

using pii = pair<int, int>; using vpii = vector<pii>;
using vi = vector<int>; using vvi = vector<vi>;
using ll = long long;
using pll = pair<ll, ll>; using vpll = vector<pll>;
using vll = vector<ll>; using vvll = vector<vll>;

int main() {
    int l, r, d; cin >> l >> r >> d;
    int ans = 0;
    FOR(i, l, r) if (i % d == 0) ans++;
    cout << ans << endl;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define itn int
#define gI gi
#define int long long

using namespace std;

typedef long long ll;

inline int gi()
{
	int f = 1, x = 0; char c = getchar();
	while (c < '0' || c > '9') {if (c == '-') f = -1; c = getchar();}
	while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
	return f * x;
}

inline ll gl()
{
	ll f = 1, x = 0; char c = getchar();
	while (c < '0' || c > '9') {if (c == '-') f = -1; c = getchar();}
	while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
	return f * x;
}

int n, m, k;

signed main()
{
	//freopen(".in", "r", stdin);
	//freopen(".out", "w", stdout);
	n = gi(), m = gi(), k = gi();
	if (n <= k) 
	{
		k = k - n, printf("0 ");
		printf("%lld\n", max(1ll * 0, m - k));
	}
	else 
	{
		printf("%lld %lld\n", n - k, m);
	}
	return 0;
}



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

const int MAX_N = 100010;
typedef unsigned long long ull;
typedef long long ll;
const ull mod = 1000000000 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)
typedef vector<int> edge;
typedef vector<edge> graph;
bool visited[MAX_N];
list<int> lst;

void search(graph &G, int now, bool mode){
    REP(i, G[now].size()){
        if(!visited[G[now][i]]){
            visited[G[now][i]] = true;
            if(mode){
                lst.push_back(G[now][i]);
            }else{
                lst.push_front(G[now][i]);
            }
            search(G, G[now][i], mode);
            break;
        }
    }
}

int main(){
    int N, M, s, t;
    cin >> N >> M;
    graph G(N);
    REP(i, M){
        cin >> s >> t;
        G[s-1].push_back(t-1);
        G[t-1].push_back(s-1);
    }
    REP(i, MAX_N) visited[i] = false;
    lst.push_back(0);
    visited[0] = true;
    search(G, 0, true);
    search(G, 0, false);
    cout << lst.size() << endl;
    for(list<int>::iterator itr=lst.begin();itr!=lst.end();itr++){
        cout << *itr + 1 << " ";
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 9472
#include<iostream>
#include<vector>
#include<algorithm>

using namespace std;

int main(){
    int Alice_sum = 0;
    int Bob_sum = 0;

    int N; cin >> N;

    vector<int> v(N);

    for(int i = 0; i < N; i++) cin >> v.at(i);
    
    sort(v.begin(), v.end(),greater<int>()); //降順にしてる

    for(int i = 0; i < N; i++){
        if(i%2 == 0)    Alice_sum += v.at(i);
        else Bob_sum += v.at(i);
    }

    cout << (Alice_sum - Bob_sum) << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
	ll n;
	cin>>n;
	ll value=n/1000;
	if(n%1000==0)
	{
		cout<<0<<endl;
	}
	else if(n<1000)
	{
		cout<<1000-n<<endl;
	}
	else
	{
	
		ll value2=((value+1)*1000)-n;
		cout<<value2<<endl;
	}
	
}

Measured memory_bytes: 3624
n = int(input())
h = list(map(int, input().split()))
dp = [float("inf") for i in range(n)]
dp[0] = 0
dp[1] = dp[0] + (h[1] - h[0])
for i in range(1, n):
    dp[i] = min(dp[i - 2] + (abs(h[i] - h[i - 2])), dp[i - 1] + (abs(h[i] - h[i - 1])))
print(dp[n - 1])

Measured memory_bytes: 13980
/* by Natsu Kinmoe */
#include <bits/stdc++.h>
using namespace std;

#define loop(i,n) for(int i=0;i<(n);i++)
#define pool(i,n) for(int i=(n)-1;i>=0;i--)
#define cont(i,n) for(int i=1;i<=(n);i++)
#define tnoc(i,n) for(int i=(n);i>=1;i--)
#define circ(i,a,b) for(int i=(a);i<=(b);i++)
#define cric(i,a,b) for(int i=(b);i>=(a);i--)
#define sub(i,a) for(int i=a;i;i=((i-1)&(a)))
#define subs(i,a) for(int i=a;i>=0;i=(!i?-1:((i-1)&(a))))
#define subt(i,a) for(int i=((a-1)&a);i;i=((i-1)&(a)))
#define subst(i,a) for(int i=((a-1)&a);i>=0;i=(!i?-1:((i-1)&(a))))
#define range(i,a,b,c) for(int i=(a);((c)>0?i<=(b):i>=(b));i+=(c))
#define foreach(it,v) for(__typeof((v).begin()) it=(v).begin(),_e_D_=(v).end();it!=_e_D_;it++)
#define parse(i,s) for(int i=0;s[i];i++)

#define pub push_back
#define pob pop_back
#define puf push_front
#define pof pop_front
#define mak make_pair

#define y0 y0O0OO00OO0OO0OO0OOO00OO0OO0O0O000OO0
#define y1 y1II11II11III11I1III11II111IIII1II1I1
#define ws WSrAkIoi2333wSraKIoIWSraKiOi
#define left left_jTjTJtJtIoiiOiioIAuaU66666jtIOIau
#define hash whYusEthiSnamE_caNyoUusEothERnaMesliKeHSH

#define Mask(a) (1ll<<(a))
#define Maskx(a,x) ((a)<<(x))
#define Full(a) ((1ll<<(a))-1)
#define Bit(a,x) (((a)>>(x))&1)
#define all(a) (a).begin(),(a).end()
#define SZ(a) ((int)((a).size()))

typedef long long ll;
typedef long double lf;

const int Inf=0x3f3f3f3f;
const ll INF=0x3f3f3f3f3f3f3f3fll;
const lf inF=11451419198101145141919810.1145141919810;
const lf pi=acosl(-1);
/* Source code starts here */

int n,m;
int a[200005],qzh[200005];

int main(){
	scanf("%d%d",&n,&m);
	if(m>=100){
		cont(i,n)printf("%d%c",n," \n"[i==n]);
		return 0;
	}
	cont(i,n)scanf("%d",a+i);
	while(m--){
		memset(qzh,0,sizeof(qzh));
		cont(i,n){
			int bg=max(i-a[i],1);
			int en=min(i+a[i],n);
			qzh[bg]++;qzh[en+1]--;
		}
		cont(i,n)qzh[i]+=qzh[i-1];
		memcpy(a,qzh,sizeof(a));
	}
	cont(i,n)printf("%d%c",a[i]," \n"[i==n]);
	return 0;
}

Measured memory_bytes: 5384
#pragma GCC optimize("O3")
            #pragma comment(linker, "/stack:200000000")
            #pragma GCC optimize("unroll-loops")
             
            #include <algorithm>
            #include <bitset>
            #include <cassert>
            #include <chrono>
            #include <cmath>
            #include <complex>
            #include <cstdio>
            #include <cstdlib>
            #include <cstring>
            #include <ctime>
            #include <deque>
            #include <functional>
            #include <iomanip>
            #include <iostream>
            #include <iterator>
            #include <limits>
            #include <climits>
            #include <list>
            #include <map>
            #include <numeric>
            #include <queue>
            #include <random>
            #include <ratio>
            #include <set>
            #include <sstream>
            #include <stack>
            #include <string>
            #include <unordered_map>
            #include <unordered_set>
            #include <utility>
            #include <vector>
            using namespace std;
             
            typedef long long ll;
            typedef long double ld;
            #define int ll
            #define double ld
            #define pb push_back
            #define mp make_pair
            #define REP(i,n) for (int i = 0; i < n; i++)
            #define loop(i,n) for (int i = 0; i < n; i++)
            #define FOR(i,a,b) for (int i = a; i < b; i++)
            #define REPD(i,n) for (int i = n-1; i >= 0; i--)
            #define FORD(i,a,b) for (int i = a; i >= b; i--)
            #define remax(a,b) a = max(a,b)
            #define remin(a,b) a = min(a,b)
            #define mem(a, b) memset(a, b, sizeof a)
            #define append push_back
            #define all(v) v.begin(),v.end()
            #define F first
            #define S second
            #define print(x) cout << (x) << endl
            #define PRECISION(x) cout << fixed << setprecision(x)
            #define FAST_IO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
            
            const double PI=acos(-1);
            const int MOD = 1000000007;
            const int FMOD = 998244353;
            const double eps = 1e-9;
             
            mt19937 RNG(chrono::steady_clock::now().time_since_epoch().count()); 
 
 vector<int> v[200000];
signed main(){

	int n,k;
	cin>>n>>k;
	int a[n+1];
	FOR(i,1,n+1)
	cin>>a[i];
	int ans=0;
	map<int,int> mp1,mp2;
	loop(i,k)
	{
		int x,y;
		cin>>x>>y;
		v[x].pb(y);
		v[y].pb(x);
	}
	for(int i=1;i<=n;i++)
	{
	    if(v[i].empty())
	    {
	        ans++;
	        continue;
	    }
	    int f=0;
	    for(auto x:v[i])
	    {
	        if(a[i]<=a[x])
	        {
	            f=1;
	            break;
	        }
	    }
	    if(!f)
	    ans++;
	}
	cout<<ans;
}
			

Measured memory_bytes: 12600
#include <cmath>
#include <vector>
#include <iomanip>
#include <iostream>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <string>
#include <algorithm>
#include <limits>
#include <list>
#include <stack>

using namespace std;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef long long ll;
typedef pair<int, int> PII;
typedef vector<PII> VP;
typedef vector<ll> VL;
typedef vector<VL> VVL;

int main() {
	ios::sync_with_stdio(false);
	string s;
	int n;
	cin >> s;
	n = s.size();
	int sol = n;
	int scnt = 0;
	for (int i = 0; i < n; ++i) {
		if (s[i] == 'S') ++scnt;
		else if (s[i] == 'T' && scnt) {
			--scnt;
			sol -= 2;
		}
	}
	cout << sol;
}

Measured memory_bytes: 720
# -*- coding: utf-8 -*-

###
# main
if(__name__ == '__main__'):
    # input
    x = int(input())

    n500 = x // 500
    n5 = (x-500*n500) // 5

    ans = n500 * 1000 + n5 * 5

    print(ans)
# else:
    # do nothing


Measured memory_bytes: 2940
import sys


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

# N = int(input())
# A = [int(x) for x in input().split()]
# a, b, c = map(int, input().split())
# name1 = str(input())
# alph = {"A": 1, "B": 2, "C": 3, "D": 4, "E": 5}


n = int(input())
a = n % 10
b = (n//10) % 10
c = ((n//10)//10) % 10
d = ((n//10)//10)//10
if 3*d == b+c+d or a+b+c == 3*a:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 3060
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<map>
#include<set>
#include<queue>
#include<cstdio>
#include<climits>
#include<cmath>
#include<cstring>
#include<string>
#include<sstream>
#include<complex>

#define f first
#define s second
#define mp make_pair

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++)
#define ALL(c) (c).begin(), (c).end()

using namespace std;

typedef unsigned int uint;
typedef long long ll;
typedef complex<double> P;

#define MAX 1010

bool isSep(char c){
  return c == ' ' || c == ',' || c == '.' || c == '\n';
}

char buff[1200];
char tang[1000][7];

int main(){
  int cnt = 0, pos = 0;
  set<string> s;
  fgets(buff, sizeof(buff), stdin);
  for(char *p = buff; *p; p++){
    if(isSep(*p)){
      if(pos > 2 && pos < 7){
	tang[cnt][pos] = '\0';
	if(s.find(tang[cnt]) == s.end() || true){
	  s.insert(tang[cnt]);
	  cnt++;
	}
      }
      pos = 0;
    }else{
      if(pos < 7){
	tang[cnt][pos] = *p;
	pos++;
      }
    }
  }
  REP(i, cnt)
    printf("%s%c",tang[i],(i==cnt-1?'\n':' '));
  return 0;
}

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

int main() {
  int N;
  cin >> N;
  vector<int> vec(N);
  for (int i = 0; i < N; i++) {
    cin >> vec.at(i);
  }

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

  int diff = vec[N / 2] - vec[N / 2 - 1];

  cout << diff << endl;
}

Measured memory_bytes: 3800
import java.util.Scanner;

class Main
{
	public static void main(String args[])
	{
		Scanner sc = new Scanner(System.in);
		while (true)
		{
			int n = sc.nextInt();
			if (n == 0) break;
			long total = 0;
			for (int i = 0; i < n; i++)
			{
				int b = sc.nextInt() + sc.nextInt() + sc.nextInt();
				int w = sc.nextInt();
				if (b <= 60 && w <= 2)
				{
					total += 600;
				}
				else if (b <= 80 && w <= 5)
				{
					total += 800;
				}
				else if (b <= 100 && w <= 10)
				{
					total += 1000;
				}
				else if (b <= 120 && w <= 15)
				{
					total += 1200;
				}
				else if (b <= 140 && w <= 20)
				{
					total += 1400;
				}
				else if (b <= 160 && w <= 25)
				{
					total += 1600;
				}
			}
			System.out.println(total);
		}
	}
}

Measured memory_bytes: 12000
#include<stdio.h>
int main (void)
{
  int i=1,n=10000,x=0;
  while(i<=n){
    scanf("%d",&x);
    if(x==0)break;
    printf("Case %d: %d\n",i,x);
    x=0;
    i++;
  }
  return 0;
}

Measured memory_bytes: 596
import scala.io.StdIn._

/**
 * ABC110B
 */
object Main extends App {

  val Seq(_, _, x, y) = readLine().split(" ").toSeq.map(_.toInt)
  val xs = readLine().split(" ").toSeq.map(_.toInt)
  val ys = readLine().split(" ").toSeq.map(_.toInt)

  val isok = (xmax: Int, ymin: Int) => {
    if (x >= y) false
    else if (xmax >= ymin) false
    else if (xmax >= y) false
    else if (x >= ymin) false
    else true
  }

  val ans = if (isok(xs.max, ys.min)) "No War" else "War"

  println(ans)

}



    

Measured memory_bytes: 25416
s = input()
n = int(input())

rev = 0
sh = ''
for i in range(n):
    q = input().split()
    if q[0] == '1':
        rev = (rev + 1) % 2
    else:
        head = int(q[1]) % 2
        if head ^ rev:
            sh += q[2]
            # print('sh', sh)
        else:
            s += q[2]
            # print('s', s)
ans = sh[::-1] + s
print(ans[::-1]) if rev else print(ans)

Measured memory_bytes: 10240
#include <stdio.h>
int main(void)
{
int value,sum;
char num;
while(1){
scanf("%c",&num);
if (num != '\n')
{
value = num - '0';
sum += value;
}else if (sum != 0){
printf("%d\n",sum);
sum = 0;
}else{
break;
}
}
/*sumが0の時に、printfなし、ループ脱出
それ以外の時は、printfして、sumの値を0に
初期化して、ループ継続
num == '\n'の時にsumの数値チェック
それ以外の時は、sumに数字を数値化し、加える*/ 
return 0;
}
                       


Measured memory_bytes: 2056
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <cmath>
#include <deque>
#include <iterator>
#include <map>
#include <queue>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
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;}

const ll MOD = 1000000007;
const ll HIGHINF = (ll)1e18;

const ll MAX2 = 40;

int main() {
  ll n, k; cin >> n >> k;
  vll a(n); REP(i, n) cin >> a[i];
  vll bit(MAX2, 0);
  REP(i, n) {
    ll atmp = a[i];
    ll j = 0;
    while (atmp > 0) {
      bit[j] += (atmp&1);
      atmp >>= 1; j++;
    }
  }
  ll x = 0;
  for (ll i=MAX2-1; i>=0; i--) {
    if (bit[i] < n-bit[i]) x += (1LL<<i);
    if (x > k) x -= (1LL<<i);
  }
  ll ans = 0;
  REP(i, n) ans += a[i]^x;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1024
class Bridge:
    def __init__(self, nodeA, nodeB):
        self.edges = [Edge(nodeA, self), Edge(nodeB, self)]
        nodeA.addEdge(self.edges[1])
        nodeB.addEdge(self.edges[0])
        self.dir = True
        self.vec = None
    def __repr__(self):
        return str((self.vec, self.dir))

class Edge:
    def __init__(self, node, bridge):
        self.bridge = bridge
        self.node = node
    def another(self):
        return self.bridge.edges[1 if self.bridge.edges[0] == self else 0]

class Node:
    def __init__(self, id):
        self.id = id
        self.edges = []
        self.parent = None
        self.judge = True
    def addEdge(self, edge):
        self.edges.append(edge)
    def __repr__(self):
        return str((self.id, None if self.parent is None else self.parent.node.id, self.judge))

N, M = map(int, input().split())

nodes = [Node(i) for i in range(N+1)]
bridges = []
for A, B in (map(int, input().split()) for _ in range(M)):
    bridges.append(Bridge(nodes[A], nodes[B]))

s = [nodes[1]]
idx = 0
while len(s) > 0:
    cur = s.pop()

    isleaf = True
    for nxt in cur.edges:
        if nxt.bridge.vec is None:
            cur.judge ^= True
            nxt.bridge.vec = (cur.id, nxt.node.id)
            if nxt.node.parent is None:
                isleaf = False
                nxt.node.parent = nxt.another()
                s.append(nxt.node)

    if isleaf:
        if len(s) > 0 and s[-1].parent is not None:
            nl = s[-1].parent.node
        else:
            nl = nodes[1]
        while cur.parent is not None and cur != nl:
            if not cur.judge:
                cur.judge ^= True
                cur.parent.node.judge ^= True
                cur.parent.bridge.dir ^= True
            cur = cur.parent.node
  
if nodes[1].judge:
    for br in bridges:
        if br.dir:
            print("{} {}".format(br.vec[0], br.vec[1]))
        else:
            print("{} {}".format(br.vec[1], br.vec[0]))
else:
    print("-1")


Measured memory_bytes: 113568
#include "bits/stdc++.h"
#define lint long long

using namespace std;

int main() {
	int n;
	int an[110];
	memset(an, 0, 110);
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> an[i];
	}
	int mincost = 2 << 29;
	for (int i = -100; i <= 100; i++) {
		int sum = 0;
		for (int j = 0; j < n; j++) {
			sum += pow(abs(an[j] - i),2);
		}
		mincost = min(mincost, sum);
	}
	cout << mincost << endl;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		//String s = sc.next();
		//String t = sc.next();
		//String g = sc.next();
		long n = sc.nextLong();
		//long m = sc.nextLong();
		//long k = sc.nextLong();
		//long l = sc.nextLong();
		String buff="Christmas";
		long count=0;
		long[] array=new long[3];

		for(long i=n;i<25;i++) {
			buff+=" Eve";
		}
		Arrays.sort(array);
		/*if(n==3||n==5||n==7) {
			System.out.println("YES");
		}else {
			System.out.println("NO");
		}*/
		System.out.println(buff);
		//System.out.println(Math.abs(array[2]-array[1])+Math.abs(array[1]-array[0]));
	}
}




Measured memory_bytes: 19924
#include<bits/stdc++.h>
using namespace std;
 
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL); 
 
#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define mp make_pair
#define in insert
#define ld long double
 
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...) 1
#endif
template<class T> ostream& operator<<(ostream &os, vector<T> V) {os << "[ "; for(auto v : V) os << v << " "; return os << "]";}
template<class L, class R> ostream& operator<<(ostream &os, pair<L,R> P) {return os << "(" << P.first << "," << P.second << ")";}
 
typedef long long int ll;
 
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
const ll mod =1e9+7;
const ll maxn =200001;
ll power(ll x, ll n) {
    ll res = 1;
    for (; n > 0; n >>= 1) {
    if (n & 1) res = (res * x) % mod;
    x = (x * x) % mod;
    }
    return res;
}

int main()
{
  IOS
  ll h,n;
  cin>>h>>n;
  ll sum=0;
  for(ll i=0;i<n;i++)
  {
    ll x;
    cin>>x;
    sum+=x;
  }
  if(sum>=h)
  {
    cout<<"Yes"<<endl;
  }
  else
  {
    cout<<"No"<<endl;
  }
  
}

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

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

	vector<int32_t> rev(N);
	for (int32_t i = 0; i < N; i++) {
		int32_t A;
		scanf("%d", &A);
		rev[A - 1] = i + 1;
	}
	for (int32_t i = 0; i < N; i++) {
		printf("%d", rev[i]);
		if (i < N - 1)
			printf(" ");
	}
	printf("\n");

	return 0;
}


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

#define ull unsigned long long
#define endl '\n'
#define ll long long
const int N = 1e6 + 5;
int main(){
        ios_base::sync_with_stdio(false);
        cin.tie(0);
        cout.tie(0);
        if (fopen(".INP", "r")){
                freopen(".INP", "r", stdin);
                freopen(".OUT", "w", stdout);
        }
        ll n;
        cin >> n;
        ll ans = 0;
        ans += (n / 500) * 1000;
        ans += ((n % 500) / 5) * 5;
        cout << ans;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define ll long long
#define pii pair<int, int>
using namespace std;

long long n, y;

int main(){
    #ifdef DEBUG
       freopen("input.txt", "r", stdin);
    #endif // DEBUG
    cin >> n >> y;
    for(long long i = 0; i <= n; ++i){
        for(long long j = 0; j <= n; ++j){
            if(y - 10000ll * i - 5000ll * j >= 0 && (y - 10000ll * i - 5000ll * j) % 1000ll == 0 && n - i - j == (y - 10000ll * i - 5000ll * j) / 1000ll && i + j + (y - 10000ll * i - 5000ll * j) / 1000ll == n){
                cout << i << ' ' << j << ' ' << n - i - j << endl;
                return 0;
            }
        }
    }
    cout << "-1 -1 -1" << endl;
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define REP(i,a,n) for(int i = (a); i < (n); ++i)
#define debug_vp(v,N) for(int i=0;i<N;i++) { cout << v[i].first << " " << v[i].second << endl; } cout << endl;
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

void Main()
{
	int N, M; cin >> N >> M;
	vector<P> AB;
	rep(i,N) {
		int a, b; cin >> a >> b;
		AB.push_back(make_pair(a, b));
	}
	sort(AB.begin(), AB.end());
	priority_queue<int> pq;
	int res = 0;
	int idx = 0;
	REP(i,1,M + 1) {
		while (idx < N && AB[idx].first <= i) {
			pq.push(AB[idx].second);
			++idx;
		}
		if (!pq.empty()) {
			res += pq.top(); pq.pop();
		}
	}
	cout << res << endl;
}

int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
}


Measured memory_bytes: 1908
#include <bits/stdc++.h>
 
using namespace std;
typedef long long ll;
typedef vector<int> VI;
ll mm=1000000000;ll MM=mm+7;
#define rep(i, n) for(int i=0;i<n;i++)
#define PI 3.141592653589793

int main(){
   string s;
   cin >> s;
   int n=s.size();
   set<char> chk;
   bool c=true;
   rep(i,n){
      if(chk.count(s.at(i))){
         c=false;
         break;
      }
      else{
         chk.insert(s.at(i));
      }
   }
   if(c)cout <<"yes" << endl;
   else cout << "no" << endl;
}


Measured memory_bytes: 256
/*
 * main.c
 *
 *  Created on: 2020/02/22
 *      Author: family
 */

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define MAX(a,b) (a > b ? a : b)
#define MIN(a,b) (a > b ? b : a)
typedef long long int ll;
typedef unsigned long long int ull;

int sort_inc(const void *a, const void *b) { return (*(int*)a - *(int*)b);}
int sort_dec(const void* a, const void* b) { return (*(int*)b - *(int*)a);}
int sort_dec_ll(const void *a, const void *b) {
    ll da = *(ll*)a, db = *(ll*)b;    int val = 0;
    if(da > db) { val = -1; }
    else if (da == db) { val = 0; }
    else { val = 1; }
    return val;
}
int sort_inc_ll(const void *a, const void *b) {
    ll da = *(ll*)a, db = *(ll*)b;    int val = 0;
    if(da > db) { val = 1; }
    else if (da == db) { val = 0; }
    else { val = -1; }
    return val;
}
int sort_dic(const void *a, const void *b) {
    char *pa = (char *)a;    char *pb = (char *)b;    int i = 0, val = 0, N = 10;
    for (i = 0; i < N; i++) {
    	char da = pa[i], db = pb[i];
    	if (da == db) continue;
  		if (da > db) val = 1; else val = -1;
        break;
    }
    return val;
}


int main()
{
	int L = 0;
	double l = 0.0, ans = 0.0;
	scanf("%d", &L);
	l = (double)L;
	ans = l/3.0;
	printf("%.9f\n", ans*ans*ans);
    return 0;
}


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

int main()
{
	int64_t n;
	cin >> n;

	for (int64_t x = 1; x <= n; x++)
	{
		if (int64_t(x * 1.08) == n)
		{
			cout << x << endl;
			return 0;
		}
	}

	cout << ":(" << endl;

	return 0;
}

Measured memory_bytes: 256
import bisect
import copy
import heapq
import math
import sys
from collections import *
from itertools import accumulate, combinations, permutations, product
# from math import gcd
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

n,q=map(int,input().split())
stx=[list(map(int,input().split())) for i in range(n)]
d=[int(input()) for i in range(q)]

stx.sort(key=lambda x: x[2])

ans=[-1]*q
skip=[-1]*q

for i in range(n):
    s,t,x=stx[i]
    left=bisect.bisect_left(d, s-x)
    right=bisect.bisect_left(d, t-x)

    while left<right:
        if skip[left]==-1:
            ans[left]=x
            skip[left]=right
            left+=1

        else:
            left=skip[left]
    
print("\n".join(map(str,ans)))

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

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

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

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

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


//ここから編集する
class Solve {
public:
    Int N;
    vector<Int> A, B;

    Int func(Int n) {
        if (n == 0) {
            return A[0] + B[N - 1];
        }
        return A[n] + B[N - 1] - B[n - 1];
    }

    void solve() {
        cin >> N;
        A.resize(N);
        B.resize(N);
        for (int i = 0; i < N; ++i) {
            cin >> A[i];
        }

        for (int i = 0; i < N; ++i) {
            cin >> B[i];
        }

        for (int i = 1; i < N; ++i) {
            A[i] += A[i - 1];
        }

        for (int i = 1; i < N; ++i) {
            B[i] += B[i - 1];
        }

        Int ans = 0;
        for (int i = 0; i < N; ++i) {
            chmax(ans, func(i));
        }

        cout << ans << endl;


    }
};


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

    Solve().solve();


    return 0;
}


Measured memory_bytes: 888
using static System.Math;
using static System.Console;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System;

namespace AtCoder
{
    class Program
    {
        private static long mod = 1000000007;
        static void Main(string[] args)
        {
            var line = ReadLine().Split(' ').Select(value => int.Parse(value)).ToArray();
            var h = line[0];
            var w = line[1];
            var k = line[2];
            //var n = long.Parse(ReadLine());

            var field = new List<string>();
            for(var i = 0; i < h; i++)
            {
                field.Add(ReadLine());
            }

            var answer = 0;

            for(var i = 0; i < (1 << h); i++)
            {
                for(var j = 0; j < (1 << w); j++)
                {
                    var count = 0;

                    for(var row = 0; row < h; row++)
                    {
                        if(((i >> row) & 1) == 1)
                        {
                            continue;
                        }
                        for (var col = 0; col < w; col++)
                        {
                            if(((j >> col) & 1) == 1)
                            {
                                continue;
                            }

                            if(field[row][col] == '#')
                            {
                                count++;
                            }
                        }
                    }

                    if(count == k)
                    {
                        answer++;
                    }
                }
            }

            WriteLine(answer);
        }
    }
}


Measured memory_bytes: 19000
#include<iostream>
#include<iomanip>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<string>
#include<utility>
#include<numeric>
#include<algorithm>
#include<cmath>
#include<climits>

//エイリアス
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;

class Stream{
public:
    Stream(){

    }
    //配列以外の入力を受け取る
    void read(){

    }
    template<typename First, typename... Rest>
    void read(First& first, Rest&... rest){
        cin >> first;
        read(rest...);
    }
    template<typename T>
    vector<T> read_vec(size_t n){
        vector<T> tmp(n);
        for(size_t i = 0; i < n; i++){
            cin >> tmp[i];
        }
        return tmp;
    }
    //配列を区切って出力する
    template<typename T>
    void write_vec(vector<T>& v, char divider){
        for(size_t i = 0; i < v.size(); i++){
            cout << v[i] << divider;
        }
    }
};



int main(){
    Stream io;
    
    int N;
    io.read(N);

    ll ans = 0;
    for(ll i = 1; i <= N; i++){
        ans += ((N / i) + 1) * i * (N / i) / 2;
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 3604
#include <bits/stdc++.h> 
#define FOR(i,a,b) for(int i=(a);i<=(b);++i) 
#define RFOR(i,a,b) for(int i=(a);i>=(b);--i) 
#define REP(i,n) for(int i=0;i<(n);++i)
#define RREP(i,n) for(int i=(n);i>0;--i)
#define CI cin>> 
#define CO cout<<
#define EN <<endl 
template<typename T>
constexpr auto all(T x) { return (x).begin(),(x).end(); }
using namespace std;
template <typename T> istream& operator >> (istream& is, vector<T>& vec) { for (T& x : vec) is >> x; 	return is; }
using ll = long long;

int main() {
	string s; CI s;
	if (s.length() == 1) { CO  '0' EN; return 0; }
	CO 2*min(count(s.cbegin(), s.cend(), '0'),count(s.cbegin(),s.cend(),'1'));

	return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
vector<long long> pre;
int main(){
	long long int n, read, mini = LONG_LONG_MAX;
	cin >> n >> read;
	pre.push_back(read);
	for(int i = 1; i < n; ++i){
		cin >> read;
		pre.push_back(read + pre.back());
	}
	for(int i = 0; i < n-1; ++i){
		long long a = pre[i], b = pre[n-1] - pre[i];
		mini = min(abs(a - b), mini);
	}
	cout << mini << '\n';
	return 0;
}

Measured memory_bytes: 2420
#include <bits/stdc++.h>
using  namespace std;
typedef long long ll;
#define RAP(i, n) for(ll i=0;i<(n);i++)
#define FOR(i, a, b) for(ll i=(a);i<(b);i++)
int main(){
    ll n, k;
  	double p, ans;
    cin >> n >> k;
    double P[n];
    cin >> p;
    P[0] = (1+p)/2;
    for(ll i=1;i<n;i++){
        cin >> p;
        P[i] = P[i-1]+(1+p)/2;
    }
    ans = P[k-1];
    FOR(i, k, n){
        ans = max(ans, P[i]-P[i-k]);
    }

    cout << fixed << setprecision(12) <<ans << endl;
    return 0;
 
}


Measured memory_bytes: 1792
/*
 * Author       : YangDavid
 * Created Time : 2020.05.30 20:01:55
 */

#include<bits/stdc++.h>
#define rep(i, n) for(int i = 1; i <= n; ++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
int main() {
    int a, b, c, d, e;
    cin >> a >> b >> c >> d >> e;
    cout << (c*60+d-a*60-b-e) << endl;

    return 0;
}



Measured memory_bytes: 3620
<?php
  $N = trim(fgets(STDIN));
  $S = trim(fgets(STDIN));
  $K = trim(fgets(STDIN)) - 1;

  for($i = 0; $i < strlen($S); $i++){
    if($S[$i] == $S[$K]){
      echo $S[$i];
    }else{
     echo "*";
    }
  }

?>

Measured memory_bytes: 3828
//https://atcoder.jp/contests/dp/tasks/dp_z
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
#ifdef BTK
#define DEBUG if(1)
#else
#define CIN_ONLY if(1)
struct cww {cww() {CIN_ONLY{ios::sync_with_stdio(false); cin.tie(0);}}}star;
#define DEBUG if(0)
#endif
#define ALL(v) (v).begin(),(v).end()
#define REC(ret, ...) std::function<ret (__VA_ARGS__)>
template <typename T>inline bool chmin(T &l, T r){bool a = l>r; if (a)l = r; return a;}
template <typename T>inline bool chmax(T &l, T r){bool a = l<r; if (a)l = r; return a;}
template <typename T>istream& operator>>(istream &is, vector<T> &v){for (auto &it : v)is >> it;return is;}
class range {private: struct I { int x; int operator*() { return x; }bool operator!=(I& lhs) { return x<lhs.x; }void operator++() { ++x; } }; I i, n;public:range(int n) :i({ 0 }), n({ n }) {}range(int i, int n) :i({ i }), n({ n }) {}I& begin() { return i; }I& end() { return n; }};



const LL INF = 1e17;


namespace CHT{
using TYPE=LL;
#define A first
#define B second
#define SIZE 1000000
    pair<TYPE,TYPE> mem[SIZE];
    template<typename T>
    inline bool is_minimam(T a1,T b1,T a2,T b2,T a3,T b3){return (a2-a1)*(b3-b2)>=(b2-b1)*(a3-a2);}
    template<typename T>
    inline bool is_maximam(T a1,T b1,T a2,T b2,T a3,T b3){return is_minimam(-a1,-b1,-a2,-b2,-a3,-b3);}
    template<typename T>
    inline bool check(pair<T,T> L1,pair<T,T> L2,pair<T,T> L3){
        return is_minimam(L1.A,L1.B,L2.A,L2.B,L3.A,L3.B);
    }
    template<typename T>
    inline T calc(pair<T,T> L,T now){
        return L.A*now+L.B;
    }
};
template<typename T>
ostream& operator<<(ostream& os,pair<T,T> t){
    os <<"("<< t.first << " "<<t.second << ")";
    return os;
}
#define mp(a,b) std::make_pair(a,b)
template<typename T>
class convex_hull_trick{
    pair<T,T> *deque;
    int s,t;
public:
    convex_hull_trick(pair<T,T> *mem):deque(mem),s(0),t(0){}
    convex_hull_trick():convex_hull_trick(CHT::mem){}
    void add(T a,T b){
        auto L=mp(a,b);
        while(s+1<t&&CHT::check(deque[t-2],deque[t-1],L))t--;
        deque[t++]=L;
    }
    T get(T now){
        while(s+1<t&&CHT::calc(deque[s],now)>=CHT::calc(deque[s+1],now))s++;
        return CHT::calc(deque[s],now);
    }
    void pop(){
        while(s+1<t&&CHT::calc(deque[s])>=CHT::calc(deque[s+1]))s++;
    }
};

int N;
LL C;
LL h[212345];
LL dp[212345];
int main(){
    cin>>N>>C;
    for(int i:range(N))cin>>h[i];
    dp[0]=0;
    convex_hull_trick<LL> deq;
    deq.add(-2*h[0],h[0]*h[0]+dp[0]);
    for(int i:range(1,N)){
        dp[i]=h[i]*h[i]+C+deq.get(h[i]);
        deq.add(-2*h[i],h[i]*h[i]+dp[i]);
    }
    cout<<*max_element(dp,dp+N)<<endl;
    return 0;
}

Measured memory_bytes: 8320
#include<iostream>
#include<vector>
#include <cmath>
#include <map>
#include <algorithm>
#include <string.h>
using namespace std;
int main(void){
  string S ;
  cin >> S ;

  while(S.size() > 0 ){
     S = string(S.begin(), S.end() - 2);

   if (S.substr(0, S.size() / 2) == S.substr(S.size() / 2, S.size())) {
            std::cout << S.size() << std::endl;
            return 0;
        }
    }
 
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
//型に気を付けよう
//a=0x61=97 '0'=0x30=48
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long  ll;
typedef long double  ld;
typedef string str;
typedef pair<int,int> pairii;
typedef vector<int> veci;
const double pi=3.1415926535;
const ll  mod=1000000007;
//桁数指定　cout << fixed << setprecision(2)

ll sim( int x/*current score*/,vector<veci> s/*sid*/,veci &cc,veci c,int t,int l);

int main(){
  
  ll x=0;
  int d;cin>>d;
  veci c(26);
  rep(i,26)cin>>c[i];
  vector<veci> s(d);
  rep(j,d){
    rep(k,26){
      int tmp;
      cin>>tmp;
      s[j].push_back(tmp);
    }
  }
  
  
  veci cc(26,0);
  veci cb(26,0);
  
  rep(cn,d){
    int mem=0;
    rep(i,26){
      ll ma=INT_MIN;
      int cur=sim(x,s,cc,c,i,cn);
      if(ma<cur){mem=i;ma=cur;}
      cc=cb;
  }
    x=sim(x,s,cc,c,mem,cn);
    cb=cc;
    cout<<mem<<endl;
  }
  return 0;
}
  
  ll sim( int x/*current score*/,vector<veci> s/*sid*/,veci &cc,veci c,int t,int l) {
   rep(ss,26)cc[ss]++;
    cc[t]=0;
    x+=s[l][t];
    rep(st,26)x-=cc[st]*c[st];
  return x;
}

Measured memory_bytes: 3744
INTEGER N,A,B,X,ANS
CHARACTER(20) S
READ*,N,A,B
ANS=0
DO I=1,N
  X=0
  WRITE(S,"(I0)") I
  DO J=1,LEN_TRIM(S)
    X=X+ICHAR(S(J:J))-ICHAR("0")
  END DO
  IF( A<=X .AND. X<=B)ANS=ANS+I
END DO
PRINT"(I0)",ANS
END

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

int main() {
    int n;
    cin >> n; 
    vector <int> v(n);
    for(int i = 0; i < n; i++){
        cin >> v[i];
    }
    ll ans =  numeric_limits<int>::max();
    ll sum;
    for(int i = -100; i <= 100; i++){
        sum = 0;
        for(int j = 0; j < n; j++){
            sum += (i-v[j])*(i-v[j]);
        }
        ans = min(sum,ans);
    } 
    cout << ans;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
using vll = vector<ll>;
const ll INF = 1e18;
#define print(x) cout << (x) << endl;
#define rep(i,n) for(ll i = 0; i < (n); i++)
#define SORT(x) sort(x.begin(),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
#define fi first
#define se second

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    ll ans = 0;
    vector<ll> A(N),B(N),C(N),numB(N),sumnumB(N);
    rep(i,N) cin >> A.at(i);
    rep(i,N) cin >> B.at(i);
    rep(i,N) cin >> C.at(i);
    SORT(A);
    SORT(B);
    SORT(C);
    rep(i,N) {
        numB.at(i) = N - POSU(C, B.at(i));
    }
    sumnumB.at(N-1) = numB.at(N-1);
    for (int i = N-1; i >= 1; i--) {
        sumnumB.at(i-1) = sumnumB.at(i) + numB.at(i-1);
        // cout << sumnumB.at(i) << endl;;
    }
    sumnumB.push_back(0); 
    // cout << endl;
    rep(i,N) {
        ans += sumnumB.at(POSU(B, A.at(i)));
        // cout << sumnumB.at(POSU(B, A.at(i))) << endl;
    }
    cout << ans << endl;
}

Measured memory_bytes: 4992