akhauriyash/Code-Regression huggingface dataset:
import bisect

def binarySearch(lis, snum):
    a = bisect.bisect_left(lis, snum)
    if a == len(lis):
        return -1
    if not lis[a] == snum:
        return -1
    return a

n = int(input())
s = [int(_) for _ in input().split()]
q = int(input())
t = [int(_) for _ in input().split()]

ans = 0
for i in range(q):
    if binarySearch(s, t[i]) >= 0:
        ans += 1
    else:
        pass
print(ans)


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

int main() {
  int H, N;
  
  cin >> H >> N;
  
  int A[N], T;
  
  T=0;
  
  for (int i=0; i<N; i++){
    cin >> A[i];
    T += A[i];
  }

  if(T>=H){
    cout << "Yes" << endl;
  }
  else
  {
    cout << "No" << endl;
  }

}





Measured memory_bytes: 640
s = input()

if s == "SAT":
    print(1)
elif s == "SUN":
    print(7)
elif s == "MON":
    print(6)
elif s == "TUE":
    print(5)
elif s == "WED":
    print(4)
elif s == "THU":
    print(3)
elif s == "FRI":
    print(2)

Measured memory_bytes: 2940
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
using namespace std;

int a[3][6];
int main() {
	for (int b = 0; b < 3; b++) {
		for (int c = 0; c < 6; c++) {
			cin >> a[b][c];
		}
	}
	for (int d = 0; d < 3; d++) {
		int e = (a[d][3] - a[d][0]) * 3600 + (a[d][4] - a[d][1]) * 60 + (a[d][5] - a[d][2]);
		printf("%d %d %d\n", e / 3600, e % 3600 / 60, e % 3600 % 60);
	}
}

Measured memory_bytes: 3160
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <numeric>
#include <unordered_map>
#include <queue>
#include <sstream>
#include <cstring>
#include <iomanip>

using namespace std;

typedef long long ll;

const ll INF=1e13+7;

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;}
template <class T, class Y>T GCD(T a, Y b){if(a<b){int c=a;a=b;b=c;}if (a % b == 0){return b;}return GCD(b, a % b);}
#define rep(i,n) for(int i=0;i<(n);i++)

int main(){
    string S;
    cin>>S;
    int L=S.length(),countA=0,countB=0;
    for(int i=0;i<L;i++){
        if(i%2==0){
            if(S[i]=='0')countA++;
        }else{
            if(S[i]=='1')countA++;
        }
    }
    for(int i=0;i<L;i++){
        if(i%2==0){
            if(S[i]=='1')countB++;
        }else{
            if(S[i]=='0')countB++;
        }
    }
    cout<<min(countA,countB)<<endl;
    return 0;
}

//a=97,z=122

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

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

  vector<int> l(n);
  for (int i = 0; i < n; i++) cin >> l[i];

  sort(l.begin(), l.end());
  reverse(l.begin(), l.end());

  int ans = 0;
  for (int i = 0; i < n - 2; i++) {
    for (int j = i + 1; j < n - 1; j++) {
      for (int k = j + 1; k < n; k++) {
        if (l[i] < l[j] + l[k]) ans++;
      }
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

/**
 * @author author
 *
 */
public class Main {

  /**
   * @param args
   */
  public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);
    int N = Integer.parseInt(sc.next());
    int K = Integer.parseInt(sc.next());


    int[] h = new int[N];
    int count = 0;
    for (int i = 0; i < N; i++) {
      h[i] = Integer.parseInt(sc.next());
      if (h[i] >= K) {
        count++;
      }
    }

    System.out.println(count);

  }

}


Measured memory_bytes: 48720
n = int(input())

d = {}
for _ in range(n):
    s = ''.join(sorted(input()))
    if s not in d:
       d[s] = 0
    d[s] += 1

ans = 0
for n in d.values():
    ans += int(n * (n - 1) / 2)

print(ans) 

Measured memory_bytes: 62168
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <utility>
#include <functional>
#include <cstdlib>

int n,k;
int x[100003];
int main()
{
    scanf("%d%d", &n, &k);
    k--;
    for(int i=0;i<n;i++)
        scanf("%d", &x[i]);
    std::sort(x, x+n);
    int ans = 1e9;
    for(int i=0;i<n;i++)
    {
        if(i+k >= n) break;
        if(x[i+k] < 0) ans = std::min(ans, abs(x[i]));
        else if(x[i] > 0) ans = std::min(ans, x[i+k]);
        else ans = std::min(ans, abs(x[i])+x[i+k]+std::min(abs(x[i]), x[i+k]));
        //printf("%d\n", ansb);
    }
    printf("%d\n", ans);
}

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

#define lint long long

const lint INF = 1E9;
// #define P pair<lint, int>

int digit(int a){
    int ans = 0;
    while(a > 0){
        a /= 10;
        ans++;
    }
    return ans;
}

signed main() {
    lint N;
    cin >> N;

    int a, b;

    for(int i = 1; i < (int)sqrt(N) + 2; ++i){
        if(N % i == 0){
            a = N / i;
            b = i;
        }
    }

    cout << max(digit(a), digit(b)) << endl;
    
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<cctype>
#include<algorithm>
#define maxn 200005
#define LL long long
using namespace std;

int n,a[maxn],lj[maxn],rj[maxn];
LL sum[maxn];
LL ans=1ll<<60;

int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++) scanf("%d",&a[i]),sum[i]=sum[i-1]+a[i];
	for(int i=2,tmp=1;i<=n;i++) 
	{
		while(min(sum[tmp+1],sum[i]-sum[tmp+1]) > min(sum[tmp] , sum[i] - sum[tmp])) 
			tmp++;
		lj[i]=tmp;
	}
	
	for(int i=n-1,tmp=n-1;i>=1;i--)
	{
		while(min(sum[n]-sum[tmp-1],sum[tmp-1]-sum[i-1]) > min(sum[n] - sum[tmp] , sum[tmp] - sum[i-1])) tmp--;
		rj[i]=tmp;
	}
	
	for(int i=2;i<n-1;i++) 
	{
		LL a1=min(min(sum[lj[i]],sum[i]-sum[lj[i]]),min(sum[n]-sum[rj[i+1]],sum[rj[i+1]]-sum[i])),
		a2=max(max(sum[lj[i]],sum[i]-sum[lj[i]]),max(sum[n]-sum[rj[i+1]],sum[rj[i+1]]-sum[i]));
		ans=min(ans,a2-a1);
	}
	
	printf("%lld",ans);
}

Measured memory_bytes: 4096
#include <bits/stdc++.h>
#define INF INT_MAX
#define ll  long long
#define ull unsigned long long
#define rep(i,n) for(ll i=0; i<n; ++i)
#define FOR(i, s, e) for(ll i=s; i<e; ++i)
#define MOD 1000000007
using namespace std;
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() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int K, A, B;
  cin >> K >> A >> B;
  for(int i=A; i<=B; ++i) {
    if(i%K==0) {
      cout <<"OK"<<endl;
      return 0;
    }
  }
  cout<<"NG"<<endl;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll GCD(ll x,ll y){
    if(y == 0) return x;
    else return GCD(y,x%y);
}

int main() {
    int h,w;
    cin >> h >> w;
    
    string side;
    for(int i = 0;i < w+2;i++){
        side += "#";
    }
    
    for(int i = 0;i < h+2;++i){
        if(i == 0 || i == h+1){
            cout << side << endl;
        }else{
            string a;
            string ans = "";
            cin >> a;
            for(int j = 0;j < 3;++j){
                if(j == 0 || j == 2){
                    ans += "#";
                }else{
                    ans += a;
                }
            }
            cout << ans << endl;
        }
    }
}



Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>

void rotate_dice(char direction, int *dice)
{
	int dice2[7];
	
//printf("[%c]", direction);
	switch (direction){
	case 'N':
		dice2[3] = dice[3];
		dice2[4] = dice[4];
		dice2[1] = dice[2];
		dice2[2] = dice[6];
		dice2[6] = dice[5];
		dice2[5] = dice[1];
		break;
		
	case 'S':
		dice2[3] = dice[3];
		dice2[4] = dice[4];
		dice2[1] = dice[5];
		dice2[5] = dice[6];
		dice2[6] = dice[2];
		dice2[2] = dice[1];
		break;

	case 'W':
		dice2[2] = dice[2];
		dice2[5] = dice[5];
		dice2[1] = dice[3];
		dice2[3] = dice[6];
		dice2[6] = dice[4];
		dice2[4] = dice[1];
		break;

	case 'E':
		dice2[2] = dice[2];
		dice2[5] = dice[5];
		dice2[1] = dice[4];
		dice2[4] = dice[6];
		dice2[6] = dice[3];
		dice2[3] = dice[1];
		break;
	}
	
	memcpy(dice, dice2, sizeof(dice2));
}


int main(void)
{
	int dice[7];
	char q[101];
	int i;
	
	for (i = 1; i <= 6; i++){
		scanf("%d", &dice[i]);
	}
	
	scanf("%s", q);
	
	for (i = 0; i < strlen(q); i++){
		rotate_dice(q[i], dice);
//	printf("<%d>\n", dice[1]);
	}
	printf("%d\n", dice[1]);
	
	return (0);
}



Measured memory_bytes: 2100
#include <bits/stdc++.h>
using namespace std;
#define M 1000000007
#define U 998244353
#define N 1000005
#define int long long
#define sz(c) (int)c.size()
#define fr first
#define ll long long 
#define sc second
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define rep(i,a,n) for(int i=a ; i<n ; i++)
#define r0 return 0;
#define endl '\n'
#define INF (int)1e15

/* Debug Begins */ 
# define trace(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); \
  stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
string to_string(char c) { return "'" + string(1, c) + "'";}
string to_string(string s) { return '"' + s + '"';}
string to_string(bool f) { if(f) return "True"; else return "False";}
string to_string(const char* s) { return to_string((string) s);}
template<typename A> string to_string(A);
template<typename A, typename B> string to_string(pair<A, B> p){
  return "(" + to_string(p.first) + ": " + to_string(p.second) + ")";}
template<typename A> string to_string(A v) {bool f = false; string r = "{"; 
  for (auto x: v) {if (f) r += ", "; r += to_string(x); f = true;} return r += "}";}
template<typename A> string to_string(vector<vector<A>> v) {string r; 
  for (auto x: v) r += "\n" + to_string(x); return r;}
int Nerr;
template<typename A> string to_string(A *p) {return to_string(vector<A>(p, p + Nerr));}
void err(istream_iterator<string>) { cerr << endl; }
template<typename T,typename... Args> void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << to_string(a) << "; "; err(++it, args...); }
template<typename T> void kek(T ans) {cout << ans << endl; exit(0);}
#define Lu(...) [&] (auto &&u) { return __VA_ARGS__; }
#define Luv(...) [&] (auto &&u, auto &&v) { return __VA_ARGS__; }
/***************************************************************/



signed main()
{
	ios_base::sync_with_stdio(0);
	int TESTS=1;
	// cin>>TESTS;
	while(TESTS--)
	{   
		int x;
		cin >> x;
		cout << 8-(x-400)/200;
	}
}

Measured memory_bytes: 3576
#include <bits/stdc++.h>
using namespace std;
int main(){
  long count = 0;
  int N;
  cin >> N;
  for (int i=1;i<=N;i++){
    if (i%3 != 0){
      if (i%5 != 0){
        count += i;
      }
    }
  }
  cout << count << endl;
}

Measured memory_bytes: 3636
n = int(input())
w = [ input() for i in range(n) ]
#n = 9
#w = ['basic', 'c', 'cpp', 'php', 'python', 'nadesico', 'ocaml', 'lua', 'assembly']

a = set()
a.add(w[0])
ck = 0
for i in range(1,n):
  if w[i] in a:
    break
  else:
    a.add(w[i])
  
  if w[i][0] != w[i-1][-1]:
    break

else:
  ck = 1

print('Yes' if ck else 'No')

Measured memory_bytes: 9032
n = int(input())
a = list(map(int, input().split()))
b, c, d = 0, 0, 0
for i in a:
    if i % 4 == 0:
        b += 1
    elif i % 2 == 0:
        c += 1
    else:
        d += 1
if c >= 1:
    d += 1
if b + 1 >= d:
    print("Yes")
else:
    print("No") 

Measured memory_bytes: 14252
#include <cstdio>

int main()
{
  char s[101];
  scanf("%s", s);
  int i = 0;
  for (char *p = s; *p; ++p)
  {
    if (*p == "CF"[i])
    {
      if (++i == 2)
      {
        puts("Yes");
        return 0;
      }
    }
  }
  puts("No");
  return 0;
}

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

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

    if(S == "AAA" || S == "BBB"){
        cout << "No" << endl;
    } else {
        cout << "Yes" << endl;
    }

}


Measured memory_bytes: 256
//abc134_d.cpp
//Sat Jul 20 20:59:18 2019

#include <iostream>
#include <string>
#include <queue>
#include <map>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <math.h>
#include <set>
#define INTINF 2147483647
#define LLINF 9223372036854775807
using namespace std;
using ll=long long;
typedef pair<int,int> P;

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

	int last = n;
	if (n%2==1){
		last = n-1;
	}

	int ans = 0;
	vector<int> ansbox;

	int a[n];
	fill(a,a+n,0);
	int ball[n];
	fill(ball,ball+n,0);
	for (int i=0;i<n;i++){
		cin >> a[i];
	}

	for (int i=n-1;i>=0;i--){
		int temp = (i+1)*2;
		int total = 0;
		while (temp<=n){
			total += ball[temp-1];
			temp = temp+(i+1);
		}
		if (total%2!=a[i]){
			ans++;
			ansbox.push_back(i+1);
			ball[i]=1;
		}
//		cout << i+1 << " " << total << endl;
	}


	cout << ans << endl;
	if (ans != 0){
		for (int i=0;i<ansbox.size();i++){
			cout << ansbox[i] << " ";
		}
		printf("\n");
	}
}

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (ll i = a; i < b; i++)
#define REP(i,b) FOR(i,0,b)
#define RFOR(i,a,b) for (ll i = a-1; i >= b; i--)
#define RREP(i,a) RFOR(i,a,0)
#define REPALL(i,x) for (ll i = 0; i < x.size(); i++)
#define RREPALL(i,x) for (ll i = x.size()-1; i >= 0; i--)
#define REPITR(itr,x) for (auto itr = (x).begin(); itr != (x).end(); itr++)
#define ALL(x) (x).begin(), (x).end()
#define SORT(x) sort(ALL(x))
#define MIN_ELEMENT(x) min_element(ALL(x))
#define MAX_ELEMENT(x) max_element(ALL(x))
#define COUNT(x,num) count(ALL(x), num)
#define MEMSET(x,val) memset(x, val, sizeof(x))
#define MAX(a,b) a = max(a,b)
#define MIN(a,b) a = min(a,b)
#define debug(x) cerr<<__LINE__<<": "<<(#x)<<" = "<<(x)<<endl;
void YES(bool flag) {cout<<(flag ? "YES" : "NO")<<endl;}
void Yes(bool flag) {cout<<(flag ? "Yes" : "No")<<endl;}
void yes(bool flag) {cout<<(flag ? "yes" : "no")<<endl;}
#define e1 first
#define e2 second
#define nextline putchar('\n')
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> VI;
typedef vector<vector<int>> VVI;
typedef vector<ll> VLL;
typedef vector<vector<ll>> VVLL;
const int INF = 1e7;
const ll MOD = 1e9 + 7;
const double pi = 3.141592653589793;

VVI ans;

int main()
{
    int n, k, m, cnt;
    cin>>n>>k;
    ans.resize(n);
    cnt = (n - 1) * (n - 2) / 2;
    m = n - 1;

    if (cnt < k) {
        cout<<-1<<endl;
        return 0;
    }

    REP(i,n-1) {
        ans[0].push_back(i+1);
    }

    int idx = 1;
    while (cnt > k) {
        int l = ans[idx].size();
        if (ans[idx].empty() || ans[idx][l-1] < n - 1) {
            ans[idx].push_back(idx + l + 1);
        } else {
            idx++;
            ans[idx].push_back(idx + 1);
        }
        cnt--;
        m++;
    }

    cout<<m<<endl;
    REPALL(i,ans) {
        REPALL(j,ans[i]) {
            cout<<i+1<<" "<<ans[i][j]+1<<endl;
        }
    }

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
using ll = long long;
using namespace std;

int main(){
  int A,B,C; cin >> A >> B >> C;

  if(C >= A && C <= B){
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FIN ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

typedef long long ll;
typedef vector<ll> vll;
typedef map<ll, ll> mlll;

const ll N = 2000000;
ll sieveSize;
bitset<N + 10> bs;	
vll pr;

void sieve(ll upperbound) {
	sieveSize = upperbound + 1;
	bs.set();
	bs[0] = bs[1] = 0;
	for (ll i = 4; i <= sieveSize; i += 2) 
		bs[i] = 0;
	pr.push_back(2);
	for (ll i = 3; i <= sieveSize; i += 2) {
		if (bs[i]) {
			for (ll j = i * i; j <= sieveSize; j += i)
				bs[j] = 0;
			pr.push_back(i);
		}
	}
}

int main() {FIN
	
	ll n, i, c = 0;
	sieve(N);
	cin >> n;
	mlll div;
	for (i = 0; i < (ll)pr.size(); i++) {
		if (n < pr[i])
			break;
		while (n % pr[i] == 0) {
			div[pr[i]]++;
			n /= pr[i];
		}
	}
	if (n != 1)
		div[n]++;
	for (auto it = div.begin(); it != div.end(); it++) {
		i = 1;
		while (it->second >= i) {
			c++;
			it->second -= i;
			i += 1;
		}
	}
	cout << c << "\n";
	return 0;
}


Measured memory_bytes: 5504
import math
a,b,C=map(float,input().split())

S=0.5*a*b*math.sin(math.radians(C))

h=b*math.sin(math.radians(C))

c=math.sqrt(pow(a,2)+pow(b,2)-2*a*b*math.cos(math.radians(C)))

L=a+b+c



print(S)
print(L)
print(h)

Measured memory_bytes: 7736
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define rep1(i, n) for(ll i = 1; i < n+1; i++)
#define sort(A) sort(A.begin(),A.end())
#define reverse(A) reverse(A.begin(),A.end());
#define vecmin(A) *min_element(A.begin(),A.end());
#define vecmax(A) *max_element(A.begin(),A.end());
typedef long long ll;

int main(){
  ll n;
  cin >> n;
  vector<ll> a(n);
  rep(i,n) cin >> a[i];
  ll now = 0;
  ll ans1 = 0;
  rep(i,n){
    now += a[i];
    if(i%2 == 0){
      if(now <= 0){
        ans1 += 1 - now;
        now = 1;
      }
    }
    if(i%2 == 1){
      if(now >= 0){
        ans1 += now + 1;
        now = -1;
      }
    }
  }//i
  
  now = 0;
  ll ans2 = 0;
  rep(i,n){
    now += a[i];
    if(i%2 == 1){
      if(now <= 0){
        ans2 += 1 - now;
        now = 1;
      }
    }
    if(i%2 == 0){
      if(now >= 0){
        ans2 += now + 1;
        now = -1;
      }
    }
  }//i
  
  cout << min(ans1,ans2) << endl;
}


Measured memory_bytes: 1024
#include <stdio.h>
#include <string.h>

int main(void)
{
	char str[100];
	int l;
	
	scanf("%s", str);
	l = strlen(str);

	for (l = l - 1; l >= 0; l--){
		printf("%c", str[l]);
	}
	printf("\n");

	return (0);
}

Measured memory_bytes: 524
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
const int maxn=1e2+10;
int a[maxn];
int main()
{
    ios::sync_with_stdio(false);
    int n;
    cin>>n;
    for(int i=1;i<=n;i++){
        int b;
        cin>>b;
        if(b%2==0){
            if(b%3!=0&&b%5!=0){
                cout<<"DENIED";
                return 0;
            }
        }
    }
    cout<<"APPROVED";
    return 0;
}


Measured memory_bytes: 256
import sys
input=sys.stdin.readline

class UnionFind(object):
    def __init__(self, n=1):
        self.par = [i for i in range(n)]
        self.rank = [0 for _ in range(n)]
        self.size = [1 for _ in range(n)]

    def find(self, x):
        """
        x が属するグループを探索
        """
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]

    def union(self, x, y):
        """
        x と y のグループを結合
        """
        x = self.find(x)
        y = self.find(y)
        if x != y:
            if self.rank[x] < self.rank[y]:
                x, y = y, x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1
            self.par[y] = x
            self.size[x] += self.size[y]

    def is_same(self, x, y):
        """
        x と y が同じグループか否か
        """
        return self.find(x) == self.find(y)

    def get_size(self, x):
        """
        x が属するグループの要素数
        """
        x = self.find(x)
        return self.size[x]

n,m,k=map(int, input().split())

tk=UnionFind(n)

stk=[0 for _ in range(n)]
blk=[[] for _ in range(n)]

for _ in range(m):
    a,b=map(int, input().split())
    stk[a-1]+=1
    stk[b-1]+=1
    tk.union(a-1, b-1)

for _ in range(k):
    c,d=map(int, input().split())
    blk[c-1].append(d-1)
    blk[d-1].append(c-1)

for i in range(n):
    ans=tk.get_size(i)-1-stk[i]
    for j in blk[i]:
        if tk.is_same(i, j):
            ans-=1
    print(ans)

Measured memory_bytes: 27888
#pragma once
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <deque>
#include <numeric>
#include <iomanip>
#define M_PI acos(-1)
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 1000000007;
const int MAX_V = 201;
int now = 0;

const int MAX = 200000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
struct edge {
	int t;
	ll cost;
	edge(int _t, ll _cost) : t(_t)
		, cost(_cost) {
	}
};
bool isPrime(int n) {

	if (n == 1) return false;
	for (ll i = 2; i * i <= n; i++)
	{
		if (n % i == 0) return false;
	}
	return true;
}
int anyDigitSum(int n) {
	int res = 0;
	while (n > 0)
	{
		res += n % 10;
		n /= 10;
	}
	return res;
}

void Solve() {

	string s;
	cin >> s;
	string fes = "FESTIVAL";
	for (size_t i = 0; i < s.size() - fes.size(); i++)
	{
		cout << s[i];
	}
	cout << endl;
}
int main() {
	Solve();
	return 0;
}



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

constexpr int maxn = 2e5 + 10;
int n, q;
char s[maxn], t[maxn], d[maxn];
bool popl(int x) {
	for (int i = 0; i < q; i++) {
		if (s[x] == t[i])
			x += d[i];
		if (x < 0)
			return true;
		if (n <= x)
			return false;
	}
	return false;
}
bool popr(int x) {
	for (int i = 0; i < q; i++) {
		if (s[x] == t[i])
			x += d[i];
		if (x < 0)
			return false;
		if (n <= x)
			return true;
	}
	return false;
}

int main() {
	scanf("%d %d", &n, &q);
	scanf("%s", s);
	for (int i = 0; i < q; i++) {
		scanf("%s %s", t + i, d + i);
		d[i] = (d[i] == 'L') ? -1 : 1;
	}
	int cnt = n;
	int low = -1, upp = n, cen = (low + upp) / 2;
	while (2 <= upp - low) {
		if (popl(cen))
			low = cen;
		else
			upp = cen;
		cen = (low + upp) / 2;
	}
	cnt -= upp;
	low = -1, upp = n, cen = (low + upp) / 2;
	while (2 <= upp - low) {
		if (popr(cen))
			upp = cen;
		else
			low = cen;
		cen = (low + upp) / 2;
	}
	cnt -= n - upp;
	printf("%d\n", cnt);
}

Measured memory_bytes: 768
n = int(input())
s = list(input())

A_index = [i for i, x in enumerate(s) if x == 'A']

count = 0
for j in A_index :
  if j != n-1 and s[j+1] == 'B' :
    if j != n-2 and s[j+2] == 'C' :
      count += 1

print(count)


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

#define REP(i,s,n) for(int i=s; i<n; ++i)
#define rep(i,n) REP(i,0,n)
#define SORT(c) sort((c).begin(),(c).end())
#define IINF INT_MAX
#define LLINF LLONG_MAX

typedef long long ll;
typedef pair<int, int> ii;

/*
   class Node {
   public:
   int num;
   int index;
   bool operator<(const Node& b) const {
    if(num < b.num) return (num < b.num);
    else return index > b.index;
   }

   Node(){
    num=0; index=0;
   }
   Node(int n, int i) : num(n), index(i){
   }
   };
 */

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

int main(){

        int w, h;
        cin >> w >>h;
        priority_queue<pair<ll, bool>, vector<pair<ll, bool> >, greater<pair<ll, bool> > > pq;

        rep(i, w){
          ll buff;
          cin >>buff;
          pq.push(make_pair(buff, true));
        }

        rep(i, h){
          ll buff;
          cin >>buff;
          pq.push(make_pair(buff, false));
        }

        ll ans = 0;

        ll a = w + 1, b = h + 1;
        while(!pq.empty()){
          pair<ll, bool> tmp = pq.top();pq.pop();

          if(!tmp.second){
            ans += (a * tmp.first);
            b--;
          }
          else{
            ans += (b * tmp.first);
            a--;
          }
          //cout << "val:" << tmp.first << "\tpq:" << tmp.second << "\tans:" << ans <<  endl;
        }

        cout <<ans << endl;

        return 0;
}


Measured memory_bytes: 4464
#include<algorithm>
#include<stdio.h>
#include<vector>
#include<queue>

using namespace std;

int A[13] = { 0 };

bool solve(int a, int b,int c) {
	if (++c == 10)
		return true;
	else {
		bool r = false;
		if (a < A[c])
			r = solve(A[c], b, c);
		if (b < A[c] && r == false)
			r = solve(a,A[c], c);
		
		return r;
	}
}

int main(void) {
	A[10] = A[11] = A[12] = 100;
	int n = 0;
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < 10; j++)
			scanf("%d", &A[j]);
		if (solve(A[0], 0, 0))
			printf("YES\n");
		else
			printf("NO\n");
	}
}

Measured memory_bytes: 2556
#include <stdio.h>
#include<math.h>
using namespace std;

#define SIZE 1001

int main(){
	char buf[SIZE],longest[33],most_appear[33],tmp[33];
	fgets(buf,SIZE,stdin);
	int max_appear = -1,max_length = -1,tmp_length,tmp_count;

	for(int i=0,k=0;buf[i] != '\0';){	//?§????????????????
		tmp_length = 0;
		tmp_count = 0;
		for(k=i;buf[k] != '\0' && buf[k] != ' ';k++){
			tmp[0+(k-i)] = buf[k];
			tmp_length++;
		}
		if(max_length < tmp_length){ //??????????????´??°
			for(int p=0;p < tmp_length;p++){
				longest[p] = tmp[p];
				longest[p+1] = '\0';
			}
			max_length = tmp_length;
		}
		//??????????????????
		for(int p=0;buf[p] != '\0';){
			int t,match_count=0;
			for(t=0;buf[p+t] != '\0' && buf[p+t] != ' ' && t < tmp_length;t++){
				if(buf[p+t] == tmp[t] || buf[p+t] == tmp[t]-32 ||  buf[p+t] == tmp[t]+32){
					match_count++;
				}
			}
			if(match_count == tmp_length && buf[p+t] == ' ')tmp_count++;
			if(buf[p+t] != '\0'){
				p += (t+1);
			}else{
				break;
			}
		}
		if(max_appear < tmp_count){	//??????????????´??°
			for(int p=0;p < tmp_length;p++){
				most_appear[p] = tmp[p];
				most_appear[p+1] = '\0';
			}
			max_appear = tmp_count;
		}
		if(buf[k] != '\0'){
			i = k+1;
		}else{
			break;
		}
	}

	printf("%s %s\n",most_appear,longest);

    return 0;
}

Measured memory_bytes: 2508
#include <bits/stdc++.h>
#include <string.h>
#include <vector>
//s#define rep(i, n) for (int i = 0; i < (n); i++)
#define MAX 10000

using namespace std;

#define ll long long
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define rep(i,a,n) for(int i=a; i<n; i++)
#define r0 return 0
#define INF (int)1e15
#define MOD 1000000007

#define access(i) a[i/3][i%3]
//#define random_shuffle(r...)random_shuffle(r,[](int _){return my_rand()%_;})

 int main(){

 int64_t n,i,j,k,ans=0;
  vector<int64_t>z(5);
  cin>>n;

  string s;

  for(i=0;i<n;i++){

   cin>>s;
   if(s.at(0) == 'M') z.at(0)++;
   else if(s.at(0) == 'A') z.at(1)++;
   else if(s.at(0) == 'R') z.at(2)++;
   else if(s.at(0) == 'C') z.at(3)++;
   else if(s.at(0) == 'H') z.at(4)++;
  }



  for(i=0;i<3;i++){
      for(j= i+1;j<4;j++){
            for(k=j+1;k<5;k++){

             // cout<<i+1<<j+1<<k+1<<"  "<<char(z.at(i))<<z.at(j)<<z.at(k)<<endl;

                  ans += z.at(i)*z.at(j)*z.at(k);
            }
      }
  }

  cout<<ans<<endl;

 return 0;
 }


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

//template
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(a);i>(b);i--)
#define ALL(v) (v).begin(),(v).end()
typedef long long int ll;
const int inf = 0x3fffffff; const ll INF = 0x1fffffffffffffff; const double eps=1e-12;
void tostr(ll x,string& res){while(x)res+=('0'+(x%10)),x/=10; reverse(ALL(res)); return;}
template<class T> inline bool chmax(T& a,T b){ if(a<b){a=b;return 1;}return 0; }
template<class T> inline bool chmin(T& a,T b){ if(a>b){a=b;return 1;}return 0; }
//end



int main(){
   int a,b,c; scanf("%d%d%d",&a,&b,&c);
   ll k; scanf("%lld",&k);
   if(k&1)printf("%d\n",b-a); else printf("%d\n",a-b);
   return 0;
}

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

int main(){
    int K,A,B;
    cin >> K >> A >> B;
    int ans = 0;
    for(int i = 0; A+i <= B; i++) {
        if((A+i)%K == 0) {
            ans++;
        }
    }
    if(ans > 0) {
        cout << "OK" << endl;
    }
    else {
        cout << "NG" << endl;
    }
}


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

using namespace std;

int Count(string s)
{
    int best = 0, temp = 0;
    for (char c : s)
    {
        if (!(c == 'A' || c == 'T' || c == 'C' || c == 'G')) temp = 0;
        else temp++;
        best = max(best, temp);
    }
    return best;
}

int main()
{
    string s; cin >> s;
    int best = 0;
    for (int rmvst = 0; rmvst < (int)s.length(); rmvst++)
    {
        string substring = s.substr(rmvst);
        for (int rmvbk = 0; rmvbk < (int)substring.length(); rmvbk++)
        {
            string result = substring.substr(0, (int)substring.length() - rmvbk);
            best = max(best, Count(result));
        }
    }
    cout << best << "\n";
}

Measured memory_bytes: 3584
# https://onlinejudge.u-aizu.ac.jp/problems/DSL_1_A

n, q = list(map(int, input().split()))
parents = [-1 for _ in range(n)]


def root(i):
    if parents[i] == -1:
        return i
    else:
        parents[i] = root(parents[i])
        return parents[i]


def unite(x, y):
    if same(x, y):
        return

    x = root(x)
    y = root(y)
    parents[y] = x


def same(x, y):
    return root(x) == root(y)


for _ in range(q):
    com, x, y = list(map(int, input().split()))
    if com == 0:
        unite(x, y)
    elif com == 1:
        if same(x, y):
            print(1)
        else:
            print(0)
    else:
        raise Exception



Measured memory_bytes: 5780
#include <bits/stdc++.h>
#include <ios>
#include <iomanip>

using namespace std;

long long MOD = 1e9+7;
int MAX_INT = 1e9;

// 最大公約数
long long gcd(long long a, long long b){
  if(b == 0) return a;
  return gcd(b, a % b);
}
// 最小公倍数
long long lcm(long long a, long long b) {
  return a / gcd(a, b) * b;
}

// x^y%p
long long modpow(long long x, long long y, long long p=1) {
    long long res = 1;
    x = x % p;
    if (x == 0) return 0;
    while (y > 0) {
        if (y & 1) res = res * x % p;
        y = y>>1;
        x = x * x % p;
    }
    return res;
}

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

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

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

  long long median = A[N/2];

  long long ans = 0;
  for(int i = 0; i < N; i++) {
    ans += abs(A[i] - median);
  }

  cout << ans << endl;

    return 0;
}


Measured memory_bytes: 4772
#include <bits/stdc++.h>
using namespace std;
int main(){
	long long n; cin >> n;
	set<long long> good;
	auto take = [&](long long v){
		if(v == 0) return;
		if(n / v == (n%v)) good.insert(v);
	};
	for(long long i = 1; i*i <= n; i++){
		take(i - 1);
		take(n/i - 1);
	}
	long long sum = 0;
	for(auto i : good) sum += i;
	cout << sum << endl;
	return 0;
}


Measured memory_bytes: 384
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cassert>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <unordered_map>
#include <set>
#include <map>
#define INCANT cin.tie(0), cout.tie(0), ios::sync_with_stdio(0), cout << fixed << setprecision(20);
#define rep(i,n) for (int i=0; i<n;++i)
#define ALL(a)  (a).begin(),(a).end()
#define PI 3.14159265358979
typedef long long ll;
using namespace std;
const ll MOD = 1e9+7LL;
const int INF = 2e9;
ll t1,t2,a1,a2,b1,b2;

int main() {
  INCANT;
  cin >> t1 >> t2;
  cin >> a1 >> a2;
  cin >> b1 >> b2;
  ll diff1 = (b1-a1)*t1; // bがaに着けた差
  ll diff2 = (b2-a2)*t2;
  if (diff1+diff2==0) {
    cout << "infinity" << "\n";
    return 0;
  }
  if ((diff1>0 && diff1+diff2 >0) || (diff1<0 && diff1+diff2< 0)) {
    cout << 0 << "\n";
    return 0;
  }
  ll diff = abs(diff2)-abs(diff1);
  ll cnt = 1ll; // 初回から最初にt1+t2分経過するまでに1回カウントする
  cnt += 2*(abs(diff1)/abs(diff));
  if (abs(diff1)%diff==0) cnt--; // 最後に会う時は１サイクルのなかで1回しかない

  cout << cnt << "\n";
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    string s,t;cin>>s>>t;
    int n=t.size();
    int ans=1e9;
    int cnt=0;
    for(int i=0;i<s.size()-n+1;i++){
        cnt=0;
        for(int j=0;j<n;j++){
            if(s[i+j]!=t[j])cnt++;
        }
        ans=min(ans,cnt);
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e18;
int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int n, m;
	cin >> n >> m;
	vector<vector<pair<int, int> > > G;
	G.resize(n);
	for(int i = 0; i < m; ++i) {
		int l, r, c;
		cin >> l >> r >> c;
		--r;
		--l;
		G[l].emplace_back(r, c);
	}
	for(int i = n - 1; i > 0; --i) {
		G[i].emplace_back(i - 1, 0);
	}
	priority_queue<pair<long long, int>, vector<pair<long long, int> >, greater<pair<long long, int> > > q;
	vector<long long> d;
	d.resize(n, inf);
	d[0] = 0;
	q.emplace(0, 0);
	while(!q.empty()) {
		auto o = q.top();
		int u = o.second;
		q.pop();
		if(o.first > d[u]) {
			continue;
		}
		for(auto o : G[u]) {
			int v = o.first;
			int w = o.second;
			if(d[v] > d[u] + w) {
				d[v] = d[u] + w;
				q.emplace(d[v], v);
			}
		}
	}
	if(d[n - 1] == inf) {
		cout << -1 << '\n';
	} else {
		cout << d[n - 1] << '\n';
	}
	return 0;
}

Measured memory_bytes: 8056
A, B, C, X, Y = map(int, input().split())
if X >= Y:
    p1 = A * X + B * Y
    p2 = 2 * C * Y + A * (X - Y)
    p3 = 2 * C * X
    print(min(p1, p2, p3))
else:
    p1 = p1 = A * X + B * Y
    p2 = 2 * C * X + B * (Y - X)
    p3 = 2 * C * Y
    print(min(p1, p2, p3))

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

using namespace std;
typedef long long ll;
const ll INF = 2000000000;

int main() {

    ll n,k;
    cin>>n>>k;
    ll h[n];
    for(ll i=0; i<n; i++) 
    	cin>>h[i];

    ll dp[n+1];
    ll p= 0;
    dp[0] = 0;
    dp[1] = abs(h[1] - h[0]);
    //dp[2] = min(dp[1] + abs(h[2] - h[1]), abs(h[2] -h[0]));
    for(ll i=2; i<n; i++) {
    	dp[i] = INF;
    	for(ll j=i-1; j>=max((i-k),p); j--) {
    		dp[i] = min(dp[j] + abs(h[i] - h[j]), dp[i]);
    	}
    }

    cout<<dp[n-1]<<"\n";	

    return 0;
}

Measured memory_bytes: 5140
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (ll i = 0, i##_len = (n); i < i##_len; ++i)
#define repin(a, n)  \
    vector<ll> a(n); \
    rep(i, n) { cin >> a[i]; }
#define repins(a, n)     \
    vector<string> a(n); \
    rep(i, n) { cin >> a[i]; }
#define repind(a, n)     \
    vector<double> a(n); \
    rep(i, n) { cin >> a[i]; }
#define in(a) \
    ll a;     \
    cin >> a;
#define ins(a) \
    string a;  \
    cin >> a;
#define ind(a) \
    double a;  \
    cin >> a;
template <class T>
inline void out(T a) {
    cout << a << endl;
}
inline void out(double a) { printf("%.10f\n", a); }
#define all(x)        (x).begin(), (x).end()
#define rep2(i, a, b) for (ll i = (a); i < (b); ++i)
#define yes           out("Yes");
#define no            out("No");

int main() {
    in(a);
    out(a + a * a + a * a * a);
}

Measured memory_bytes: 3620
# coding:utf-8

import sys
import math
import time
#import numpy as np
import collections
from collections import deque
from collections import Counter
import queue
import copy
import bisect
import heapq
import itertools


#sys.setrecursionlimit(10**7)
#N, Q = map(int, input().split())
#G = [list(input()) for i in range(H)]
#INF = V * 10001
#A = [int(i) for i in input().split()]
#AB = [list(map(int, input().split())) for _ in range(K)]

H,W,K = map(int, input().split())
G = []
tate = [0]*W
yoko = [0]*H
for i in range(H):
  G.append(list(input()))

for i in range(W):
  for j in range(H):
    if(G[j][i]=="#"):
      tate[i]+=1
      yoko[j]+=1

su = sum(tate)
ans = su
ans2 = 0


for i in range(2**W):
  for j in range(2**H):
    temp = copy.deepcopy(G)
    for k in range(W):
      if((i>>k) & 1):
        for l in range(H):
          if(temp[l][k]=="#"):
            temp[l][k]="."
            ans-=1
    for m in range(H):
      if((j>>m) & 1):
        for o in range(W):
          if(temp[m][o]=="#"):
            temp[m][o]="."
            ans-=1
    if(ans==K):
      ans2 += 1
    ans = su
    #print(temp)



print(ans2)



Measured memory_bytes: 80484
N = int(input())
X = [list(map(int, input().split())) for i in range(N)]
X.sort(key=lambda x: x[0] + x[1], reverse=True)

ans = 0
for i, (a, b) in enumerate(X):
    if i % 2 == 0:
        ans += a
    else:
        ans -= b

print(ans)


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

public class Main {
	static int n;
	static int[] a;
	static long[][][] dp;

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		n = sc.nextInt();
		a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = sc.nextInt();
		}
		sc.close();

		dp = new long[2][n][n];
		for (int i = 0; i < 2; i++) {
			for (int j = 0; j < n; j++) {
				Arrays.fill(dp[i][j], Long.MIN_VALUE);
			}
		}
		System.out.println(dfs(0, 0, n - 1));
	}

	static long dfs(int t, int l, int r) {
		if (dp[t][l][r] != Long.MIN_VALUE) {
			return dp[t][l][r];
		}
		if (t == 0) {
			if (l == r) {
				return dp[t][l][r] = a[l];
			}
			long ret = Long.MIN_VALUE;
			ret = Math.max(ret, dfs(1, l + 1, r) + a[l]);
			ret = Math.max(ret, dfs(1, l, r - 1) + a[r]);
			return dp[t][l][r] = ret;
		} else {
			if (l == r) {
				return dp[t][l][r] = -a[l];
			}
			long ret = Long.MAX_VALUE;
			ret = Math.min(ret, dfs(0, l + 1, r) - a[l]);
			ret = Math.min(ret, dfs(0, l, r - 1) - a[r]);
			return dp[t][l][r] = ret;
		}
	}
}


Measured memory_bytes: 182144
#include <stdio.h>

int main(void)
{
  char str[20];
  char re;
  int i;
  int c = 0;

  scanf("%s", str);

  for(i = 0; str[i] != '\0'; i++)
    c++;

  for(i = 0; i < c/2; i++){
    re = str[i];
    str[i] = str[c-i-1];
    str[c-i-1] = re;
  }

  printf("%s\n", str);

  return 0;
}

Measured memory_bytes: 524
#include<bits/stdc++.h>
#define sqr(x) ((x)*(x))
#define ll long long
#define ull unsigned long long
#define ui unsigned int
#define ld long double
#define vi vector<int>
#define pii pair<int,int>
#define pb push_back
#define mp make_pair
#define debuge cerr<<"isok"<<endl
#define debug(x) cerr<<#x<<"="<<x<<endl
#define SS second
#define FF first
#define ls (k<<1)
#define rs (k<<1|1)
#define inf 0x3f3f3f3f
#define clr(a,x) memset(a,x,sizeof(a))
using namespace std;

const int N=100005,M=100005,mod=1e9+7;
template<class T> inline void gmin(T &x,const T &y){if(x>y) x=y;}
template<class T> inline void gmax(T &x,const T &y){if(x<y) x=y;}
inline void ch(int &x,int y){x+=y;if(x>=mod) x-=mod;}

int n,m,Q,d[N],v[N],c[N],ans[N];
bool vis[N][12];
vi g[N];

void dfs(int x,int d,int c){
	if(vis[x][d]) return;
	for(int i=1;i<=d;i++) vis[x][i]=1;
	if(!ans[x]) ans[x]=c;
	if(!d) return;
	for(int y:g[x])
		dfs(y,d-1,c);
}

int main(){
	scanf("%d%d",&n,&m);
	for(int i=1;i<=m;i++){
		int x,y;scanf("%d%d",&x,&y);
		g[x].pb(y);g[y].pb(x);
	}
	scanf("%d",&Q);
	for(int i=1;i<=Q;i++) scanf("%d%d%d",&v[i],&d[i],&c[i]);
	for(int i=Q;i;i--)
		dfs(v[i],d[i],c[i]);
	for(int i=1;i<=n;i++) printf("%d\n",ans[i]);
	return 0;
}


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

int main()
{
    /* ------- 宣言と入力 ------- */

    int N, K;

    cin >> N >> K;

    int p[N];

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

    /* ------- 計算 ------- */

    double p_ave[N];

    for (int i = 0; i < N; i++)
    {
        p_ave[i] = (double)(p[i] + 1) / 2;
    }

    double sum = 0;

    for (int i = 0; i < K; i++)
    {
        sum += p_ave[i];
    }
    double sum_max = sum;

    for (int i = 0; i < N - K; i++)
    {
        sum += p_ave[K + i];
        sum -= p_ave[i];

        if (sum > sum_max)
        {
            sum_max = sum;
        }
    }

    // cout << sum_max << endl;
    printf("%.12lf\n", sum_max);

    return 0;
}


Measured memory_bytes: 2560
n = int(input())
p = list(map(int, input().split()))

ans = 0
flag = 0
for i in range(1, n + 1):
    if p[i - 1] == i:
        if flag != 0:
            if i - 1 == flag:
                ans += 0
                flag = 0
            else:
                ans += 1
                flag = i
            continue
        flag = i
        ans += 1

print(ans)


Measured memory_bytes: 14004
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-8;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

const int M=2000000;
ll n,a[M],b[M];

int main(){
	cin>>n;
	ll g=0,cnt=0,res=0;
	for(int i=0;i<n;i++){
		int x;
		cin>>x;
		g^=x;
		if(g==0){
			cnt++;
			if(i==n-1){
				for(auto j:a) (res+=j)%=mod;
				(res+=1)%=mod;
			}
			ll t=a[g]+1;
			(a[g]+=t)%=mod;
		}
		else{
			ll t=(a[g]*cnt-b[g]+1+mod)%mod;
			(a[g]+=t)%=mod;
			(b[g]+=t*cnt)%=mod;
			if(i==n-1) res=t;
		}
	}
	cout<<res<<endl;
}

Measured memory_bytes: 20736
#include<bits/stdc++.h>
using namespace std;
///Welcome to Nasif's Code
#define bug printf("bug\n");
#define bug2(var) cout<<#var<<" "<<var<<endl;
#define co(q) cout<<q<<endl;
#define all(q) (q).begin(),(q).end()
typedef long long int ll;
typedef unsigned long long int ull;
const int MOD = (int)1e9+7;
const int MAX = 1e6;
#define pi acos(-1)
#define inf 1000000000000000LL
#define FastRead    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ll dp[2005][2005];
int a[2005],b[2005],n,m;
ll ADD(ll x,ll y)
{
    return (x+y)%MOD;
}
ll SUB(ll x,ll y)
{
    return ((x-y)+MOD)%MOD;
}
int main()
{
    FastRead
    //freopen("output.txt", "w", stdout);
    cin>>n>>m;
    for(int i=1; i<=n; i++)
        cin>>a[i];
    for(int i=1; i<=m; i++)
    {
        cin>>b[i];
    }
    dp[0][0]=0;
    for(int i=1; i<=n; i++)
        for(int j=1; j<=m; j++)
        {
            dp[i][j]=ADD(dp[i-1][j],dp[i][j-1]);
            if(a[i]!=b[j])
                dp[i][j]=SUB(dp[i][j],dp[i-1][j-1]);
            else
                dp[i][j]=ADD(dp[i][j],1);
        }
    cout<<(dp[n][m]+1)%MOD<<endl;





    return 0;
}


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

s_max =  max(s)
q = int(input())
t = [int(i) for i in input().split() if int(i) <= max(s)]

c = 0

for i in range(n):
  if len(t) < 1: break
  if t == c: break

  for j in range(len(t)):
    if s[i] == t[j]:
      c += 1
      t.pop(j)
      break

print(c)



Measured memory_bytes: 6556
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc =new Scanner(System.in);
		long N = sc.nextInt();
		long x = 0;
		int i;
		for(i = 0; i * i <= N; i++) {
			x = i * i;
		}
		System.out.println(x);
	}
}

Measured memory_bytes: 22868
#include <iostream>
#include <vector>

using namespace std;

struct UnionFind {
	vector<int> par;

	UnionFind(int N) : par(N) {
		for (int i = 0; i < N; i++) par[i] = i;
	}

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

	void unite(int x, int y) {
		int rx = root(x);
		int ry = root(y);
		if (rx == ry) return;
		par[rx] = ry;
	}

	bool same(int x, int y) {
		int rx = root(x);
		int ry = root(y);
		return rx == ry;
	}
};

int main() {
	int N, M;
	cin >> N >> M;

	vector<int> a(M), b(M);

	for (int i = 0; i < M; i++) {
		cin >> a[i] >> b[i];
		a[i]--;
		b[i]--;
	}

	int bridge = 0;

	for (int j = 0; j < M; j++) {
		UnionFind tree(N);
		bool ok = true;
		for (int i = 0; i < M; i++) {
			if (i != j) tree.unite(a[i], b[i]);
		}
		for (int i = 0; i < N - 1; i++) {
			if (tree.root(i) != tree.root(i + 1)) ok = false;
		}
		if (!ok) bridge++;
	}

	cout << bridge << endl;


	return 0;
}


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

void CountingSort(std::vector<int>& Input, std::vector<int>& Output, int Max);

int GetMax(std::vector<int>& Input);

void CountingSort(std::vector<int>& Input, std::vector<int>& Output, int Max)
{
    Output.clear();
    Output.resize(Input.size());
    std::vector<int> TempList;
    TempList.clear();
    
    for(int i = 0; i < Max + 1; i++){
        TempList.push_back(0);    
    }
    
    for(int i = 0; i < Input.size(); i++){
        TempList[Input[i]]++;
    }
    
    for(int i = 1; i < Max + 1; i++){
        TempList[i] = TempList[i] + TempList[i - 1];
    }

    for(int i = Input.size() - 1; i >= 0; i--){
        Output[TempList[Input[i]] - 1] = Input[i];
        TempList[Input[i]]--;
    }
}

int GetMax(std::vector<int>& Input)
{
    int Max;
    for(int i = 0; i < Input.size(); i++){
        if(i == 0){
            Max = Input[i];
        } else{
            if(Input[i] > Max)  Max = Input[i];
        }
    }
    return Max;
}

int main(void)
{
    int Num;
    std::cin >> Num;
    
    std::vector<int> List;
    List.clear();
    
    for(int i = 0; i < Num; i++){
        int Temp;
        std::cin >> Temp;
        List.push_back(Temp);
    }
    
    std::vector<int> Output;
    CountingSort(List, Output, GetMax(List));
    
    for(int i = 0; i < Output.size(); i++){
        if(i > 0)   std::cout << " ";
        cout << Output[i];
    }
    cout << endl;
    
}

Measured memory_bytes: 18508
n = int(input())
s = input()
alls = set(s)

ans = 0

k1s = set()
for i in range(n-2):
    if s[i] in k1s: continue
    k1s.add(s[i])
    k2s = set()
    for i2 in range(i+1, n-1):
        if s[i2] in k2s: continue
        k2s.add(s[i2])
        k3s = set()
        for i3 in range(i2+1, n):
            if s[i3] in k3s: continue
            k3s.add(s[i3])
            ans += 1

print(ans)


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

int main() {
  
  int N,K;
  cin >> N >> K;
  
  int M=1;
  for(int i=0; i<N; i++){
    if(M<K)
      M *=2;
    else
      M +=K;
  }
  cout << M << endl;
}

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

#define rep(i, s, n) for (Int i = s; i < (Int)(n); i++)
#define rrep(i, n, s) for (Int i = n - 1; i >= s; i--)
#define dump(x) cout << (x) << '\n'
#define Int int64_t
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).end()
 
double EPS = 1e-10;
Int INF = 1e18;
int inf = 1e9;
Int mod = 1e9+7;

int main() {
    Int a[3];
    rep(i, 0, 3) cin >> a[i];
    swap(a[0], a[1]);
    swap(a[0], a[2]);
    rep(i, 0, 3) cout << a[i] << " ";
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
#ABC132 = 2*2*3*11
n = int(input())
p = list(map(int,input().split()))
ans = 0
for i in range(1,n-1):
    if max(p[i-1],p[i],p[i+1]) == p[i]:
        ans += 0
    elif min(p[i-1],p[i],p[i+1]) == p[i]:
        ans += 0
    else:
        ans += 1
print(ans)

Measured memory_bytes: 3064
N = int(input())
H = list(map(int, input().split()))

i = 0
count = 0
m = 0

for i in range(0, N-1):
  if H[i] >= H[i+1]:
    count +=1
  else:
    m = max(m, count)
    count = 0
      
print(max(m, count))


Measured memory_bytes: 64104
#include<bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n ; i++)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define whole(f, x, ...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x) // decltypeで型取得、引数があればva_argsのところに入れる
using namespace std;
typedef long long ll; // long longをllでかけるようにした
const int INF = 1e9;
const double PI = 3.1415926535;
const int MOD = 1000000007; // 計算してからmodで割る ans = (ans * a) % mod
#define int long long
template <typename T = long long > T in () { T x; cin >> x; return(x);}
// int a = in() のように使うlong long以外の型の時はstirng s = in<string>()のように型を指定する

signed main(void){
    int a, n; cin >> a >> n;
    int ans = 1;
    int cnt = 0;
    while(a >= ans){
        ans *= n;
        cnt++;
    }

    cout << cnt << endl;
}

Measured memory_bytes: 256
# https://atcoder.jp/contests/abc127/tasks/abc127_c
# 脳死でimosで殴っても良い


class Imos1d:
    def __init__(self, N: int):
        '''
        [0]*N の配列に対して、区間の加算を管理する。
        '''
        self.ls = [0] * (N + 1)  # 配列外参照を防ぐため多くとっておく
        self.N = N

    def add(self, l, r, x):
        '''
        [l,r)の区間にxを足し込む O(1)
        '''
        self.ls[l] += x
        self.ls[min(r, self.N)] -= x  # 配列外参照は余分に作ったところにまとめておく(どうせ使わない)

    def get_result(self):
        '''
        O(N) かけて、区間の加算結果を取得する
        '''
        from itertools import accumulate
        return list(accumulate(self.ls[:-1]))


import sys
read = sys.stdin.readline


def read_ints():
    return list(map(int, read().split()))


N, M = read_ints()
imos = Imos1d(N)  # 各idカードはいくつのゲートを通ることができるのか
for _ in range(M):
    l, r = read_ints()
    imos.add(l - 1, r, 1)
print(sum([M == x for x in imos.get_result()]))


Measured memory_bytes: 8892