akhauriyash/Code-Regression huggingface dataset:
# -*- coding: utf-8 -*-
import itertools
import sys
import math
from functools import lru_cache

# 1整数
# n = int(input())

# 空白区切り2変数
from queue import Queue
from operator import mul
from functools import reduce
from queue import Queue
from operator import mul
from functools import reduce
from functools import lru_cache

input = sys.stdin.readline

# N個整数
# a, b, c = list(map(int, input().split()))

# 1整数
n = int(input())

# 空白区切りリスト整数
b = list(map(int, input().split()))

# 空白区切り文字列
# t, d = input().split()

ret = 0

for i in range(n):
    flag = True
    for j in range(i):
        if b[j] > b[i]:
            flag = False
    if flag == True:
        ret += 1
print(ret)


Measured memory_bytes: 4312
def main():
    N, K = map(int, input().split())

    if K == 0:
        return N * N

    count = 0
    for b in range(K+1, N+1):
        count += (N-K+1)//b * (b-K) + min(b-K, (N-K+1) % b)
    return count

if __name__ == '__main__':
    print(main())


Measured memory_bytes: 2940
// Aoj 0033: Ball
#include<bits/stdc++.h>
#define mset(x,y) memset(x,y,sizeof(x))
using namespace std;

const int N=110,M=20010;
int h[N],to[M],nexp[M],p=1;
inline void init_list(){mset(h,0),mset(nexp,0),p=1;}
inline void ins(int a,int b){
    nexp[p]=h[a],h[a]=p,to[p]=b,p++;
}
int arr[N];
int col[N];
bool imp;
void dfs(int x,int ncol){
    col[x]=ncol;
    for(int u=h[x];u;u=nexp[u]){
        if(col[to[u]] == col[x]) imp=1;
        if(imp) return;
        if(!col[to[u]]) dfs(to[u],ncol^1);
    }
}

int main(){
    ios::sync_with_stdio(false);
    int t;
    cin>>t;
    while(t--){
        for(int i=0;i<10;i++) cin>>arr[i];
        init_list();
        for(int i=0;i<10;i++)
        for(int j=i+1;j<10;j++)
            if(arr[i]>arr[j]) ins(i,j),ins(j,i);
        mset(col,0), imp=0;
        for(int i=0;i<10;i++)
            if(!col[i]) dfs(i,2);
        if(imp) cout<<"NO"<<endl;
        else cout<<"YES"<<endl;
    }
    return 0;
}

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

int main(void){
	int N;
	int ave = 0;
	cin >> N;
	int X[N];
	for(int i = 0; i < N; ++i){
		cin >> X[i];
		ave += X[i];
	}
	ave /= N;
	int ans1 = 0;
	for(int i = 0; i < N; ++i){
		ans1 += (X[i] - ave) * (X[i] - ave);
	}
	++ave;
	int ans2 = 0;
	for(int i = 0; i < N; ++i){
		ans2 += (X[i] - ave) * (X[i] - ave);
	}
	int ans = min(ans1, ans2);
	cout << ans << endl;
	
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
using namespace std;
#define rep(i,x) for(int i = 0; i < (int)(x); i++)
#define pb push_back
#define mp make_pair
#define debug(x) cerr << #x << ": " << (x) << "\n";
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<vector<ll>>> vvvl;
const ll MOD = 1e9+7;
const int n_max = 1e5+10;

void print(vector<Pll> vec){
    ll n = vec.size();
    rep(i,n){
        cout << vec[i].first << " " << vec[i].second << "\n";
    }
    return ;
}

void print(vector<ll> vec){
    ll n = vec.size();
    rep(i,n)cout << vec[i] << " ";
    cout << "\n";
    return ;
}
int main(){
    ll n; cin >> n;
    vector<ll> a(n);
    rep(i,n){
        cin >> a[i];
    }
    Pll ma = {0,a[0]};
    rep(i,n)if(abs(a[i]) > abs(ma.second))ma = Pll(i,a[i]);
    vector<Pll> res;
    rep(i,n){
        if(i == ma.first)continue;
        res.emplace_back(Pll(ma.first+1, i+1));
        a[i] += ma.second;
    }
    if(ma.second > 0){
        rep(i,n-1){
            if(a[i] > a[i+1]){
                a[i+1] += a[i];
                res.emplace_back(Pll(i+1, i+2));
            }
        }
    }
    else if(ma.second < 0){
        for(int i = n-1;0 < i; --i){
            if(a[i] < a[i-1]){
                a[i-1] += a[i];
                res.emplace_back(Pll(i+1,i));
            }
        }
    }

    cout << res.size() << endl;
    print(res);
    // print(a);
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<cmath>
#include<math.h>
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<complex>
#include<queue>
#include<set>

#define rep(i,n) for(int i=0; i<n; i++)
#define rep1(i,n) for(int i=1; i<n+1; i++)
#define repr(i,n) for(int i=n-1; i>=0; i--)
#define repr1(i,n) for(int i=n; i>0; i--)

typedef long long ll;

using namespace std;
int INF = 1000000000;
int a[200005][2];
set<int> st;
vector<int> p[200005];



int main(){
  ll n,k;


  cin >> n >> k;


  rep(i,n) {
    int tmp;
    cin >> tmp;
    a[i][0] = tmp;
    a[i][1] = p[tmp].size();
    p[tmp].push_back(i);
  }

  int t = a[0][0];
  int cnt = 0;
  int pos = 0;
  while(pos != n){
    t = a[pos][0];
    int bom = 0;
    if (p[t].size() == a[pos][1]+1) {
      cnt++;
      bom = p[t][0];

      }
    else{bom = p[t][a[pos][1]+1];
    }
    pos = bom+1;
  }

  cnt++;

  k = k%cnt;
  cnt = 0;





  if (k == 0){
    return 0;
  }
  pos = 0;
  while(cnt < k-1){
    t = a[pos][0];
    int bom = 0;
    if (p[t].size() == a[pos][1]+1) {
      cnt++;
      bom = p[t][0];

      }
    else{bom = p[t][a[pos][1]+1];
    }
    pos = bom+1;
  }

  vector<int> ans;

  while(pos < n){
    t = a[pos][0];
    if (p[t].size() == a[pos][1]+1) {
      ans.push_back(a[pos][0]);
      pos++;
    }
    else{
      pos = p[t][a[pos][1]+1]+1;
    }
  }

for (const auto& e : ans) {
  cout << e << ' ';
}






  return 0;

}


Measured memory_bytes: 14968
#include <iostream>
#include<cmath>
#include<string>
#include<algorithm>
#include<ctime>
#include<functional>
#include<vector>
#include<stack>
#include<queue>
#include<deque>
#include<list>
#include<map>
#include<set>
#include<tuple>
#include<cassert>
#include<bitset>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cctype>
#include<iomanip>
#include<climits>
#include<typeinfo>
#include<utility>
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,n) for(ll i=0;i<n;i++)
#define For(i,m,n) for(int i=m;i<n;i++)
#define FOR(i,m,n) for(ll i=m;i<n;i++)
double pi = 3.141592653589793238;
using ll = long long;
using namespace std;

ll LGCD(ll x, ll y) { if (x % y == 0) return y;else return LGCD(y, x % y); }
ll LLCM(ll x, ll y) { return x * y / LGCD(x, y); }

int GCD(int x, int y) { if (x % y == 0) return y;else return GCD(y, x % y); }
int LCM(int x, int y) { return x * y / GCD(x, y); }
ll dpcombination[10000][10000];

ll modi = 1000000007;
ll combination(ll n, ll r) {
	if (n == r) { return dpcombination[n][n] = 1; }
	else if (r == 0) { return dpcombination[n][0] = 1; }
	else if (r == 1) { return dpcombination[n][1] = n; }
	else if (dpcombination[n][r]) { return dpcombination[n][r]; }
	else { return dpcombination[n][r] = combination(n - 1, r - 1) % modi + combination(n - 1, r) % modi; }
}

void clockman(int time1) {

	cout << 1.0*(clock() - time1) / CLOCKS_PER_SEC << endl;
	return;
}
//cout << fixed << setprecision(10)



int main() {


	int x,n;
	cin >> x >> n;
	vector<int>p(n);
	vector<int>q(101);
	
	for (int i = 0;i < n;i++) {
		cin >> p[i];
		q[p[i]] = 1;
	}
	for (int i = 0;i <= 50;i++) {
		if (q[x - i] == 0) { cout << x - i << endl;return 0; }
		if (q[x + i] == 0) { cout << x + i << endl;return 0; }

	}
	
	
	return 0;
}


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

typedef long long LL;

const int N = 3010, mod = 1e9 + 7;

LL power(LL a, LL b)
{
	LL c = 1;
	for (; b; a = a * a % mod, b >>= 1)
		if (b & 1) c = c * a % mod;
	return c;
}

int n, q, x, y, a[N];

LL inv2 = power(2, mod - 2);
LL f[N][N], g[N][N];

int main()
{
	scanf("%d %d", &n, &q);
	for (int i = 1; i <= n; ++ i)
		scanf("%d", &a[i]);
	for (int i = 1; i <= n; ++ i)
		for (int j = 1; j <= n; ++ j)
			f[i][j] = a[i] > a[j];
	for (int i = 1; i <= q; ++ i)
	{
		scanf("%d %d", &x, &y);
		for (int j = 1; j <= n; ++ j)
		{
			g[x][j] = (f[y][j] * inv2 + f[x][j] * inv2) % mod;
			g[j][x] = (f[j][y] * inv2 + f[j][x] * inv2) % mod;
			
			g[y][j] = (f[x][j] * inv2 + f[y][j] * inv2) % mod;
			g[j][y] = (f[j][x] * inv2 + f[j][y] * inv2) % mod;
		}
		g[x][y] = (f[x][y] * inv2 + f[y][x] * inv2) % mod;
		g[y][x] = (f[y][x] * inv2 + f[x][y] * inv2) % mod;
		for (int j = 1; j <= n; ++ j)
		{
			f[x][j] = g[x][j], f[j][x] = g[j][x];
			f[y][j] = g[y][j], f[j][y] = g[j][y];
		}
	}
	LL ans = 0;
	for (int i = 1; i < n; ++ i)
		for (int j = i + 1; j <= n; ++ j)
			(ans += f[i][j]) %= mod;
	printf("%lld\n", ans * power(2, q) % mod);
}

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

int main() {
  ll N;
  cin >> N;
  if (N <= 1) {
    cout << 0 << endl;
  } else {
    ll result = 1;
    ll mod = 1000000007;
    for (int i = 0; i < N; ++i) {
      result *= 10;
      result %= mod;
    }
    ll dif2 = 1;
    for (int i = 0; i < N; ++i) {
      dif2 *= 9;
      dif2 %= mod;
    }
    dif2 *= 2;
    dif2 %= mod;
    ll dif1 = 1;
    for (int i = 0; i < N; ++i) {
      dif1 *= 8;
      dif1 %= mod;
    }
    result -= dif2 - dif1;
    if (result < 0) {
      result += mod;
    }
    cout << result << endl;
  }
}


Measured memory_bytes: 3584
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

struct ConvexHullTrick{
    vector<PL> ls;    // a*x + b;

    ll get(int k, ll x){
        return ls[k].first * x + ls[k].second;
    }

    bool check(PL l1, PL l2, PL l3){  // l2 can be min ?
        return (l2.first - l1.first) * (l3.second - l2.second)
                 >= (l2.second - l1.second) * (l3.first - l2.first);
    }

    void add(ll a, ll b){   // a must be decreasing
        PL l(a, b);
        while (ls.size() >= 2 && check(ls[ls.size()-2], ls[ls.size()-1], l)) ls.pop_back();
        ls.push_back(l);
    }

    ll query(ll x){ // get min at x
        int lo = -1, hi = ls.size()-1;
        while (hi - lo > 1){
            int mi = (lo + hi) / 2;
            (get(mi, x) >= get(mi + 1, x) ? lo : hi) = mi;
        }
        return get(hi, x);
    }
};

int main() {
    ll n, c;
    cin >> n >> c;
    VL h(n);
    REP(i,n) h[i] = in();
    VL dp(n);
    ConvexHullTrick cht;
    cht.add(-2 * h[0], h[0] * h[0]);
    FOR(i,1,n-1){
        dp[i] = cht.query(h[i]) + h[i] * h[i] + c;
        cht.add(-2 * h[i], h[i] * h[i] + dp[i]);
    }
    cout << dp[n - 1] << endl;
    return 0;
}


Measured memory_bytes: 9328
#include <bits/stdc++.h>
#include <map>
#include <algorithm> 
#include <vector> 
#include <string.h> 
#include <math.h> 
#include <stdio.h> 
#include <stdlib.h> 
#include <chrono> 
#include <thread> 
#include <iomanip>
#include <typeinfo>
 
//define
#define trav(i,v)   for(auto i: v)
#define rep(i,n)    for(int i=0;i<n;i++)
#define repu(i,k,n) for(int i=k;i<=n;i++)
#define repd(i,k,n) for(int i=k;i>=n;i--)
#define se second
#define fi first
#define pb push_back
#define mp make_pair
#define all(v)  v.begin(), v.end()
#define itn int 

//typedef
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
typedef std::pair<int, int> pii;
typedef std::vector<int> vi;
typedef std::vector< pii > vii;
typedef std::vector< ll > vll;
typedef std::vector< std::pair < pii, int > > vpp;
 
const long long MOD = 1000000007;
// const long long MOD = 998244353;
const long long inf = 1e18;
 
using namespace std;

ll modpow(ll x,ll n){
    ll res=1;
    while(n>0){
        if(n&1) res=res*x%MOD;
        x=x*x%MOD;
        n>>=1;
    }
    return res;
}
 
ll power(ll x, ll n)
{
    ll res=1;
    while(n>0){
        if(n&1) res=res*x;
        x=x*x;
        n>>=1;
    }
    return res;
}

void solve()
{
    int n, k;
    cin>>n>>k;
    vll v(n+1);
    repu(i,1,n)
    {
        cin>>v[i];
    }
    repu(i,k+1,n)
    {
        if(v[i]>v[i-k])
            cout<<"Yes\n";
        else
            cout<<"No\n";
    }
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    int t = 1, tt=1;
    // cin>>t;
    while(tt<=t)
    {
        // cout<<"Case #"<<tt<<": ";
        solve();
        tt++;
    }
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
}   

Measured memory_bytes: 4764
use std::io::Read;

fn run() {
    let mut s = String::new();
    std::io::stdin().read_to_string(&mut s).unwrap();
    let it = s.trim().split_whitespace();
    let a: Vec<usize> = it.map(|s| s.parse().unwrap()).collect();
    let _n = a[0];
    let m = a[1];
    let a = &a[2..];
    let sum = a.iter().fold(0, |s, a| s + *a);
    let mut cnt = 0;
    for a in a.iter() {
        if sum <= 4 * m * a {
            cnt += 1;
        }
    }
    if cnt >= m {
        println!("Yes");
    } else {
        println!("No");
    }
}

fn main() {
    run();
}

Measured memory_bytes: 4352
n, k = gets.split.map(&:to_i)
x = gets.split.map(&:to_i)
p = Array.new(n + 1)
p[0] = 0
(1..n).each{|i| p[i] = p[i - 1] + x[i - 1]}
puts (Array.new(n - k + 1){|i| p[i + k] - p[i]}.max + k) / 2.0

Measured memory_bytes: 19204
#include <bits/stdc++.h>
using namespace std;
int main() {
	double num;
	while(cin>>num,num>=0){
	    string str;
		for(int i=7;i>-5;i--){
			str+=int(num/pow(2,i))+'0';
			if(num/pow(2,i)>=1)num-=pow(2,i);
			if(i==0)str+='.';
		}
		if(num/pow(2,-5)>0)cout<<"NA"<<endl;
		else cout<<str<<endl;
	}
}

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


int main(){
  ll a,b,c,k;
  cin>>a>>b>>c>>k;
  int res=0;
  while(a>=b&&res<=10){
    b*=2;
    res++;
  }
  while(b>=c&&res<=10){
    c*=2;
    res++;
  }
  if(res<=k) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}

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

signed main() {
  int h,w,a,b;
  cin>>h>>w>>a>>b;
  for(int i=0;i<b;i++){
    for(int j=0;j<a;j++)cout<<0;
    for(int j=a;j<w;j++)cout<<1;
    cout<<endl;
  }
  for(int i=b;i<h;i++){
    for(int j=0;j<a;j++)cout<<1;
    for(int j=a;j<w;j++)cout<<0;
    cout<<endl;
  }
  
  return 0;
}


Measured memory_bytes: 1280
#include<stdio.h>

int main(){
  int N,M,k;
  int is[10][10]={0},ps[10]={0},sum,flag,asum = 0,iss;
  scanf("%d %d",&N,&M);
  for(int i = 0;i < M;i++){
    scanf("%d",&k);
    for(int j = 0;j < k;j++){
      scanf("%d",&iss);
      is[i][iss-1]=1;
    }
  }for(int i = 0;i < M;i++){
    scanf("%d",&ps[i]);
  }
  for(int i = 0;i < (1<<N);i++){
    flag = 1;
    for(int j = 0;j < M;j++){
      sum=ps[j];
      for(int k = 0;k < N;k++){
        if((i&(1<<k))*is[j][k]>0){sum = 1-sum;}
      }if(sum==1){flag = 0;break;}
    }
    asum += flag;
  }
  printf("%d\n",asum);return 0;
}

Measured memory_bytes: 128
A,B,C,D,E,F = map(int, input().split())

x = []
for i in range(0,F+1,A*100):
    for j in range(0,F+1,B*100):
        water = i + j
        if water > F:
            break
        x.append(water)

y = []
for i in range(0,F+1,C):
    for j in range(0,F+1,D):
        sugar = i + j
        if sugar > F:
            break
        y.append(sugar)

x = sorted(set(x))[1::]
y = sorted(set(y))

n = 0
WS = S = 0
for w in x:
    for s in y:
        if w + s > F:
            break
        if w * E//100 >= s:
            m = 100 * s / (w + s)
            if m >= n:
                n = m
                WS, S = w + s , s

print(WS,S)

Measured memory_bytes: 18392
#include <iostream>

using namespace std;

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

    int info[4][3][10];
    for(int i = 0; i < 4; i++){
        for(int j = 0; j < 3; j++){
            for(int k = 0; k < 10; k++)
                info[i][j][k] = 0;
        }
    }

    int b, f, r, v;
    for(int i = 0; i < n; i++){
        cin >> b >> f >> r >> v;
        info[b - 1][f - 1][r - 1] += v;
    }

    for(int i = 0; i < 4; i++){
        for(int j = 0; j < 3; j++){
            for(int k = 0; k < 10; k++){
                cout << " " << info[i][j][k];
            }
            cout << endl;
        }
        if(i < 3)
            cout << "####################" << endl;
    }

    return 0;
}


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

int main(){
  int A,B,AB,X,Y;
  cin >> A >> B >> AB >> X >> Y;
  int dif = abs(X-Y);
  int C,D,E;
  if(X>Y){
    C = A;
    D = Y;
    E = X;
  }else{
    C = B;
    D = X;
    E = Y;
  }
  cout << min(A*X+B*Y,min(AB*D*2+dif*C,AB*E*2)) << endl;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.*;
import java.util.*;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Collections;
import java.util.Arrays;

public class Main {
	public static void main(final String[] args){
    
    final Scanner sc = new Scanner(System.in);
    final int a = sc.nextInt();
    //final List<Integer> list = new ArrayList<>();
    int b = sc.nextInt();

    System.out.println(a * b);
    




    

    



    
  

    


    


    

    
    
    



    





}
}

Measured memory_bytes: 35684
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>

using namespace std;

typedef long long int ll;
typedef pair<ll, ll> P;
#define INF 10000000000000
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep1(i, n) for(ll i = 1; i < (ll)(n); i++)
#define repN_1(i, n) for(ll i = 0; i < (ll)(n - 1); i++)
#define repM(i, n) for(ll i = (ll)(n - 1); i >= 0; i--)
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }

int main()
{
	cout << fixed << setprecision(18);
	ll n, h;
	cin >> n >> h;

	vector<ll> a(n), b(n);

	rep(i, n) 
		cin >> a[i] >> b[i];

	sort(a.begin(), a.end(), greater<>());
	sort(b.begin(), b.end());


	ll ans = 0;
	while (h > 0) {
		if (!b.empty() && b.back() > a[0]) {
			h -= b.back();
			b.pop_back();
			ans++;
		}
		else {
			ll t = (h + a[0] - 1) / a[0];
			ans += t;
			break;
		}
	}


	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 1920
// luogu-judger-enable-o2
#include <iostream>
using namespace std;
int a,b;
int main()
{
	cin>>a>>b;
	if((int)((a+b)/1.0/2*10)%10==0)
	cout<<(a+b)/2;
	if((int)((a+b)/1.0/2*10)%10!=0)
	cout<<(a+b)/2+1;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(),v.end()
#define puts(i) cout << i << endl
#define INF INT_MAX
#define INFL LLONG_MAX
typedef long long ll;
using namespace std;
int main(){
  ll x; cin >> x;
  ll ans = (x/11)*2;
  if(x%11>6) ans += 2;
  else if(x%11) ans++;

  cout << ans << endl;
}

Measured memory_bytes: 3604
#include<bits/stdc++.h>
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
int main(){
string s;
cin>>s;
bool contained[4]={false,false,false,false};
rep(i,s.size()){
  if (s[i]=='N') contained[0]=true;
  if (s[i]=='E') contained[1]=true;
  if (s[i]=='W') contained[2]=true;
  if (s[i]=='S') contained[3]=true;
}
if (contained[0]^contained[3]||contained[1]^contained[2]) cout<<"No"<<endl;
else cout<<"Yes"<<endl;
return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define l_ength size
const int inf = (1<<30);
const int mod = 1000000007;
using ll = long long;
using namespace std;

vector<int> v[26];

int main(){
	string s, t; cin >> s >> t;
	int ns = s.l_ength();
	int nt = t.l_ength();
	for( int k = 0; k < 26; ++k ){
		for( int i = 0; i < ns; ++i ){
			if( (int)s[i] == 'a'+k ){
				v[k].push_back(i);
			}
		}
	}
	/*
	for( int k = 0; k < 26; ++k ){
		cout << (char)('a'+k) << ": ";
		for( int c : v[k] ){
			cout << c << ' ';
		}
		cout << endl;
	}
	*/
	ll ans = 0;
	int prev = -1;
	for( int i = 0; i < nt; ++i ){
		if( v[t[i]-'a'].empty() ){
			cout << -1 << endl;
			return 0;
		}
		auto itr = upper_bound( v[t[i]-'a'].begin(), v[t[i]-'a'].end(), prev );
		if( itr == v[t[i]-'a'].end() ){
			itr = upper_bound( v[t[i]-'a'].begin(), v[t[i]-'a'].end(), -1 );
			ans += ns;
		}
		// cout << i << ' ' << prev << ' ' << *itr << endl;
		prev = *itr;
		if( i == nt-1 ) ans += (prev+1);
	}
	cout << ans << endl;
	return 0;
}

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

int main(){
	while(1){
		int n;
		cin >> n;
		if(n==0)break;

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

		int dif = 1000001;
		for(int i=0;i<n-1;i++){
			for(int j=i+1;j<n;j++){
				int d = abs(a[i]-a[j]);
				if(d<dif)dif=d;
			}
		}

		cout << dif << endl;
	}

	return 0;
}

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

int main() {
  int N;
  cin >> N;
  ll ans = 0;
  
  for(ll i=1; i<N; i++){
    for(ll j=1; j<N; j++){
      if(N<=i*j) break;
      if(N!=i*j) ++ans;
    }
  }
  
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define printYes() cout << "Yes" << endl;
#define printNo() cout << "No" << endl;
#define printVector(v) rep(i, v.size()) cout << v[i] << endl;

int main()
{
  int N, x;
  cin >> N >> x;
  vector<int> a(N);
  long long sum_candy = 0;
  rep(i, N)
  {
    cin >> a[i];
    sum_candy += a[i];
  }

  rep(i, N - 1)
  {
    int candy_num = max(a[i] + a[i + 1] - x, 0);
    if (a[i + 1] >= candy_num)
    {
      a[i + 1] -= candy_num;
      candy_num = 0;
    }
    else
    {
      candy_num -= a[i + 1];
      a[i + 1] = 0;
      a[i] -= candy_num;
    }
  }

  rep(i, N)
  {
    sum_candy -= a[i];
  }
  cout << sum_candy << endl;
  return 0;
}

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

#define Bye return 0
#define ll long long

void solve(){
    int n; cin>>n;

    int pay = 800*n;
    int pay_back = 200*(n/15);

    cout<<pay-pay_back<<endl;
}

int main(){
    solve();
    Bye;
}

Measured memory_bytes: 3632
//#include <bits/stdc++.h>
#include <iostream>
#include <vector>
using namespace std;
#define fast_io() ios_base::sync_with_stdio(false); cin.tie(0);

int main()
{

    int n;
    cin >> n;
    string s;
    cin >> s;
    if(n % 2 != 0) {cout << "No\n";
      return 0;}

      bool fg = 1;

    for (size_t i = 0; i < n; i++) {
       int ap = i + n/2;

       if(ap >=n ) break;


       if(s[i] != s[ap]) fg = 0;
    }

    if(fg) cout << "Yes\n";
    else cout << "No\n";
}

// g++ -std=c++11


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define sz(x) (int)(x).size()
#define S second
#define F first
#define all(x) (x).begin(), (x).end()


using namespace std;

const bool dbg_flg = 1;
#define debug(x) if (dbg_flg) cerr << #x << ' ' << x << '\n'
#define debug_pair(x) if (dbg_flg) cerr << #x << ' ' << x.F << ' ' << x.S << '\n'
 
const int inf = 1e9 + 7;
const int MAXN = 1e6 + 5;

ll n, k, s;

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

	for (int i = 1; i <= k; i++) {
		cout << s << ' ';
	}

	for (int i = k + 1; i <= n; i++) {
		if (s > 1) cout << s - 1 << ' ';
		else cout << s + 1 << ' ';
	}

	return 0;
}

Measured memory_bytes: 1280
import numpy as np
N,M=map(int,input().split())
Xm = list(map(int,input().split()))
if N>=M:
  print(0)
else:
  Xm.sort()
  list1 = np.array(Xm[0:M-1])
  list2 = np.array(Xm[1:M])
  diff = (list2-list1).tolist()
  if N==1:
    print(sum(diff))
  else:
    diff.sort()
    while (N>1):
      N=N-1
      diff.pop()
    print(sum(diff))


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

class Main{
	static int N;
	static double [] p;
	static double [][] memo;

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		N = sc.nextInt();

		p = new double[N];

		memo = new double[N][(N / 2) + 1];
		for(int i = 0; i < N; i++) {
			p[i] = sc.nextDouble();
			Arrays.fill(memo[i], -1);
		}

		System.out.printf("%.10f\n",1 - dp(0,(N / 2)));
		sc.close();
	}

	static double dp(int i, int n) {
		if(i == N && n >= 0) {
			return 1;
		}
		if(n < 0) {
			return 0;
		}
		if(memo[i][n] != -1) {
			return memo[i][n];
		}
		memo[i][n] = (dp(i + 1, n) * (1 - p[i])) + (dp(i + 1, n - 1) * p[i]);
		return memo[i][n];
	}
}


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

int main() {
  vector<int> w, k;
  int w_max = 0;
  int k_max = 0;

  for(int i = 0; i < 10; i++) {
    int W;
    cin >> W;
    w.push_back(W);
  }

  for(int i = 0; i < 10; i++) {
    int K;
    cin >> K;
    k.push_back(K);
  }

  sort(w.begin(), w.end(), greater<int>());
  sort(k.begin(), k.end(), greater<int>());

  for(int i = 0; i < 3; i++) {
    w_max += w[i];
    k_max += k[i];
  }

  cout << w_max	<< ' ' << k_max << endl;

  return 0;
}



Measured memory_bytes: 3156
#include <bits/stdc++.h>
#include <string>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <numeric>
using namespace std;

int abs(int num){
   if (num > 0)
      return num;
   else
      return -num;
}

int main(){
  string S;
  int N;
  cin >> N;
  cin >> S;
  int ans = 0;
  for(int i = 0;i<S.size()-2;i++){
    if(S.at(i) == 'A' && S.at(i+1) == 'B' && S.at(i+2)=='C'){
      ans++;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<functional>
#include<utility>
#include<stack>
#include<queue>
#include<cmath>
#include<list>
#include<cstdint>
#include<vector>
#include<map>
#define rep(i,rept)	for(ll i = 0; i<rept;i++)
typedef long long ll;
using namespace std;
long long int a = 0, b = 0, c = 0,d=0, x = 0, y = 0, z = 0,n=0,m=0, maxy = -1, mini = 9999, counter = 0, s = 0, endp = 0, checker = 0;
std::vector <char> vec{}, vecsec{}, vecth{};
long long int iremono[1001][1001];
long long int iremono2[1001];
std::vector<unsigned long long int>kinds{}, ans{}, kaku{};
char moji, moji2;
bool okada = false, okada2 = false;
std::string output, output2, input, one, two;
char rev[100001];
unsigned long long int kakunou2[101][101] = {};
unsigned long long int M, A, R, C, H;

int ctoi(const char c) {
	if ('0' <= c && c <= '9') return (c - '0');
	return -1;
}
unsigned long long int LCM(unsigned long long int a, unsigned long long int b) {
	unsigned long long int i, j;
	i = a; j = b;
	while (true) {

		c = i % j;
		i = j;
		if (c != 0) {

			j = c;

		}
		else {
			break;
		}
	}
	return j * (a / j) * (b / j);
}
int kaizyo(int k) {
	int sum = 1;
	for (int i = 1; i <= k; ++i)
	{
		sum *= i;
	}
	return sum;
}
int main()
{
	cin >> n;
	rep(i, n) {
		cin >> x;
		vec.push_back(x);
	}

	std::sort(vec.begin(), vec.end(), std::greater<int>());
	if (n % 2 == 1) {
		vec.push_back(0);
		n++;
	}
	for (int i = 0; i < n; i ++) {
		if (i % 2 == 0) {
			a += vec[i];
		}
		else {
			b += vec[i];
		}
	}
	cout << a - b << endl;
}

Measured memory_bytes: 256
using System.Collections.Generic;
using System.Linq;

public class Hello
{
    public static void Main()
    {
        hoge();
        System.Console.ReadLine();
    }

    public static void hoge()
    {
        var n = System.Console.ReadLine().Split(' ').Select(long.Parse).First();
        var a = System.Console.ReadLine().Split(' ').Select(long.Parse).ToArray();

        //集計
        var lst = a.GroupBy(x => x).ToList();

        var dic = new Dictionary<long, long>();
        // n-1個の組み合わせのdict
        var dic2 = new Dictionary<long, long>();

        long sumall = 0;
        foreach(var g in lst)
        {
            var k1 = kumi((long)g.Count());
            var k2 = kumi((long)g.Count() - 1);
            dic.Add(g.Key,k1);
            dic2.Add(g.Key, k2);
            sumall += k1;
        }

        foreach(var num in a)
        {
            var sum = dic2[num] + sumall - dic[num];
            System.Console.WriteLine(sum);
        }
    }

    public static long kumi(long n)
    {
        return n * (n - 1) / 2;
    }
}

Measured memory_bytes: 63568
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,c=0,m=0;
    string s;
    cin>>n;
    cin>>s;
    for(int i=0;i<n;i++)
    {
        if(s[i]=='I')
            c++;
        else if(s[i]=='D')
            c--;
        if(c>m)
            m=c;
    }
    cout<<m<<endl;
}


Measured memory_bytes: 256
def main():
    x1,y1,x2,y2 = map(int,input().split())
    diffx = x2 - x1
    diffy = y2 - y1
    x3 = x2 - diffy
    y3 = y2 + diffx
    x4 = x3 - diffx
    y4 = y3 - diffy
    print(x3,y3,x4,y4)
    
if __name__ == "__main__":
    main()

Measured memory_bytes: 9176
import Data.List
main = do
  [n,h,w] <- map read . words <$> getLine :: IO [Int]
  [a,b] <- transpose . map (map read . words) . lines <$> getContents
  let ans = filter (== True) $ zipWith (\x y -> x >= h && y >= w) a b
  print $ length ans

Measured memory_bytes: 2556
#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

#A
def A():
    n,a,b = LI()
    print(min(a*n,b))
    return

#B
def B():
    n,d = LI()
    x = LIR(n)
    f = defaultdict(lambda : 0)
    for i in range(1000000):
        f[i*i] = 1
    ans = 0
    for i in range(n):
        for j in range(i+1,n):
            s = 0
            for k in range(d):
                s += (x[i][k]-x[j][k])**2
            if f[s]:
                ans += 1
    print(ans)
    return

#C
def C():
    l,r = LI()
    if r-l > 2019:
        print(0)
        quit()
    ans = float("inf")
    for i in range(l,r+1):
        for j in range(i+1,r+1):
            if i*j%2019 < ans:
                ans = i*j%2019
    print(ans)
    return

#D
def D():
    n = I()
    a = LI()
    for i in range(n):
        a[i] *= 2
    x = a[0]
    for i in range(1,n):
        if i%2:
            x -= a[i]
        else:
            x += a[i]
    b = [x//2]
    for i in range(n-1):
        b.append(abs(b[-1]-a[i]))
    print(*b)
    return

#E
def E():
    n,k = LI()
    v = [[] for i in range(n)]
    for i in range(n-1):
        a,b = LI()
        a -= 1
        b -= 1
        v[a].append(b)
        v[b].append(a)
    if k == 1:
        if n == 1:
            print(1)
            quit()
        else:
            print(0)
            quit()
    if k == 2:
        print(2)
        quit()
    d = [0]*n
    v.append([])
    v.append([])
    q = deque([0])
    bfs = [1]*n
    bfs[0] = 0
    f = [0]*n
    while q:
        x= q.popleft()
        for y in v[x]:
            if bfs[y]:
                bfs[y] = 0
                q.append(y)
    ans = 1
    q = deque([0])
    dp = [None]*n
    dp[0] = k
    bfs = [1]*n
    bfs[0] = 0
    while q:
        x = q.popleft()
        m = len(v[x])
        for y in v[x]:
            if bfs[y]:
                bfs[y] = 0
                dp[y] = k-m
                m -= 1
                q.append(y)
    for i in dp:
        ans *= i
        ans %= mod
    print(ans)
    return

#F
def F():
    n,q = LI()
    v = [[] for i in range(n)]
    for i in range(n-1):
        a,b,c,d = LI()
        a -= 1
        b -= 1
        c -= 1
        v[a].append((b,c,d))
        v[b].append((a,c,d))

    return


#Solve
if __name__ == "__main__":
    E()


Measured memory_bytes: 71984
#include<bits/stdc++.h>
using namespace std;
#define Accepted return 0;
int main()
{
    int n,a,b,maxx,i,ans;
    cin>>n;maxx=0;
    for(i=1;i<=n;i++)
    {
        cin>>a>>b;
        if (a>maxx)
        {
            maxx=a;
            ans=a+b;
        }
    }
    cout<<ans<<endl;
    Accepted
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <vector>
using namespace std;
int a[10000];
bool A(int n){
	while (n!=0){
		if (a[n%10]==1){
			return false;
		}
		n/=10;
	}
	return true;
}
int main(){
	int n,k;
	cin>>n>>k;
	
	for (int i=1;i<=k;i++){
		int x;
		cin>>x;
		a[x]=1;
	}
	for (int i=n;;i++){
		if (A(i)){
			cout<<i;
			return 0;
		}
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <math.h>
using namespace std;
int main(){
  int X,N;
  cin>>X>>N;
  int p[100];
  for(int i=0;i<N;i++){
    cin>>p[i];
  }
  int answer=0;
  for(int i=1;i<=101;i++){
    if(abs(X-answer)>abs(X-i)){
      int judge=0;
      for(int j=0;j<N;j++){
        if(p[j]==i) judge++;
      }
      if(judge==0) answer=i;
    }
  }
  cout<<answer<<endl;
  
  return 0;
}

Measured memory_bytes: 3164
#include<iostream>
#include<bitset>
using namespace std;
#define L_SIZE 10010
bitset<L_SIZE> list;

void make_list(){
  for(int i=2;i<list.size();i++){
    list[i]=1;
  }
  list[0]=list[1]=0;

  for(int i=2;i*i<list.size();i++){
    if(list[i]==1){
      for(int j=i*2;j<list.size();j+=i){
        list[j]=0;
      }
    }
  }
}

int main(){
  make_list();
  int n;
  while(cin>>n){
    n++;
    int ans=0;
    for(int i=1;i<n;i++){
      if(list[i]&&list[n-i]){
	ans++;
      }
    }
    cout<<ans<<endl;
  }
}

Measured memory_bytes: 1164
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();

        sc.nextLine();

        String[] vStr = sc.nextLine().split(" ");

        double[] v = new double[n];
        for (int i = 0; i < n; i++) {
            v[i] = Double.parseDouble(vStr[i]);
        }

        Arrays.sort(v);

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

        System.out.println(ans);

        return;
    }
}

Measured memory_bytes: 21844
import java.util.*;

public class Main {
  public static void main (String[] args) {
    Scanner sc = new Scanner(System.in);

    int n = sc.nextInt();
    String s = sc.next();
    
    char[] m = s.toCharArray();
    int cnt = m.length;

    int ans = 1;
    for (int i = 0; i < cnt-1; i++) {
      if (m[i] != m[i+1]) ans++;
    }
    
    System.out.println(ans);
  }
}


Measured memory_bytes: 27604
#include "bits/stdc++.h"

using namespace std;

typedef pair<int, int> P;
#define int long long
#define ll long long
#define mod 1000000007
#define INF (1LL<<60)

signed main(){

	int N, M;
	cin >> N >> M;

	vector<vector<int>> g;
	g.assign(N + 1, vector<int>());

	// 入り管理用
	vector<vector<int>> gg;
	gg.assign(N + 1, vector<int>());

	vector<int> h;	// 入次数用
	h.assign(N + 1, 0);

	for (int i = 1; i <= N - 1 + M; i++){
		int a, b;
		cin >> a >> b;
		g[a].push_back(b);
		h[b]++;

		gg[b].push_back(a);
	}

	for (int i = 1; i <= N; i++){
		sort(gg[i].begin(), gg[i].end());
	}

	// 入次数が0の頂点の集合
	stack<int> st;
	for (int i = 1; i <= N; i++){
		if (h[i] == 0) st.push(i);
	}

	// ソート後
	vector<int> vsort;
	//stがなくなるまでループ
	while (st.size()) {
		//stの集合のから一つ取り出す
		int i = st.top(); st.pop();
		vsort.push_back(i);
		for (auto& j : g[i]) {
			//隣接する頂点の入次数をマイナス1
			h[j]--;
			//これによって入次数が0になればstに追加
			if (h[j] == 0) st.push(j);
		}
	}


	vector<int> ans;
	ans.assign(N + 1, 0);

	for (int i = 0; i < N; i++){
		//vsort[i]に入る辺が複数あれば一番短いのだけを残す
		if (gg[vsort[i]].size() >= 2){
			// 現在の頂点の複数の親についてforして、vsortの中で後ろの方に出てくるものを残す
			int m = 0;
			for (int j = 0; j < gg[vsort[i]].size(); j++){
				auto k = find(vsort.begin(), vsort.end(), gg[vsort[i]][j]);
				int s = k - vsort.begin();
//				cout << vsort[i] << " " << *k << endl;
//				cout << m << endl;
				m = max(m, s );
			}
			ans[vsort[i]] = vsort[m];
		}
		else if (gg[vsort[i]].size() ==1){
			ans[vsort[i]] = gg[vsort[i]][0];
		}
	}

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

	return 0;
}

Measured memory_bytes: 16076
#include <iostream>
using namespace std;
int main(){
	for(int n,a,v=-1;cin>>n;cout<<a<<' '<<v<<endl)
		for(int i=0;i<n;i++){
			int x,y; cin>>x>>y;
			if(v<y||v==y&&a>x)
				a=x,v=y;
		}
	return 0;
}

Measured memory_bytes: 1164
/* package codechef; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
public class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		Scanner s=new Scanner(System.in);
		int n=s.nextInt();
		int w=s.nextInt();
		int[]wt=new int[n];
		long[]val=new long[n];
		for(int i=0;i<n;i++){
		    wt[i]=s.nextInt();
		    val[i]=s.nextLong();
		}
		long[][]dp=new long[n+1][w+1];
		for(int i=1;i<=n;i++){
		    for(int j=1;j<=w;j++){
		        if(wt[i-1]<=j){
		            dp[i][j]=Math.max(val[i-1]+dp[i-1][j-wt[i-1]],dp[i-1][j]);
		        }
		        else dp[i][j]=dp[i-1][j];
		    }
		}
	    System.out.println(dp[n][w]);
	}
}


Measured memory_bytes: 138044
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.util.stream.IntStream;

public class Main {
    public static void main(final String[] args) {
        final FastScanner scanner = new FastScanner(System.in);
        final String s = scanner.next();
        if (s.length() < 4) {
            System.out.println(0);
            return;
        }

        final int[] array = new int[s.length()];
        array[s.length() - 1] = s.charAt(s.length() - 1) - '0';
        int tmp = 10;
        for (int i = s.length() - 2; i >= 0; i--) {
            array[i] = ((s.charAt(i) - '0') * tmp + array[i + 1]) % 2019;
            tmp *= 10;
            tmp %= 2019;
        }

        final int[] counts = new int[2020];
        counts[0]++;
        long answer = 0;
        for (int i = s.length() - 1; i - 4 >= 0; i--) {
            answer += counts[array[i - 4]];
            counts[array[i]]++;
        }

        System.out.println(answer);
    }

    private static class FastScanner {
        private final BufferedReader reader;
        private StringTokenizer tokenizer;

        FastScanner(final InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
            tokenizer = null;
        }

        String next() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        String nextLine() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    return reader.readLine();
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }

            return tokenizer.nextToken("\n");
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }
    }
}
    

Measured memory_bytes: 37220
import java.util.*;
import java.io.*;

public class Main {

	public static void main (String[] args) {
	   InputReader in = new InputReader(System.in);
	   int n = in.readInt();
	   int a[] = new int[n]; 
	   int b[] = new int[n]; 
	   int asum[] = new int[n]; 
	   for(int i = 0; i<n; i++) {
		   a[i] = in.readInt();
		   if(i == 0) {
			   asum[i] = a[i]; 
			   continue;
		   }
		   asum[i] = asum[i-1] + a[i]; 
	   }
	   for(int i = 0; i<n; i++) {
		   b[i] = in.readInt();
	   }
	   int max = 0; 
	  for(int i = 0; i<n; i++) {
		  int sum = 0;
		 for(int j = i; j<n; j++) {
			 sum += b[j]; 
		 }
		max = Math.max(max, sum+asum[i]);
	  }
	  System.out.println(max);
	}
}

class InputReader {

	private InputStream stream;
	private byte[] buf = new byte[1024];
	private int curChar;
	private int numChars;
	private SpaceCharFilter filter;

	public InputReader(InputStream stream) {
		this.stream = stream;
	}

	public int read() {
		if (numChars == -1)
			throw new InputMismatchException();
		if (curChar >= numChars) {
			curChar = 0;
			try {
				numChars = stream.read(buf);
			} catch (IOException e) {
				throw new InputMismatchException();
			}
			if (numChars <= 0)
				return -1;
		}
		return buf[curChar++];
	}

	public int readInt() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		int res = 0;
		do {
			if (c < '0' || c > '9')
				throw new InputMismatchException();
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}

	public String readString() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		StringBuilder res = new StringBuilder();
		do {
			res.appendCodePoint(c);
			c = read();
		} while (!isSpaceChar(c));
		return res.toString();
	}

	public long readLong() {
		int c = read();
		while (isSpaceChar(c)) {
			c = read();
		}
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		long res = 0;
		do {
			if (c < '0' || c > '9') {
				throw new InputMismatchException();
			}
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}
	
	public boolean isSpaceChar(int c) {
		if (filter != null)
			return filter.isSpaceChar(c);
		return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
	}

	public String next() {
		return readString();
	}

	public interface SpaceCharFilter {
		public boolean isSpaceChar(int ch);
	}
}


Measured memory_bytes: 22996
#include <algorithm>
#include <array>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <sstream>
#include <unordered_map>
#include <vector>


#define INF 4000000000000000000LL
#define MOD 1000000007
#define ALL(x) std::begin(x), std::end(x)


int main(int argc, char** argv)
{
  std::cin.tie(0);
  std::ios_base::sync_with_stdio(0);

  std::cout << std::fixed << std::setprecision(6);
  std::cerr << std::fixed << std::setprecision(6);

  int N, A, x[55];

  std::cin >> N >> A;

  for (int i = 0; i < N; i ++)
    std::cin >> x[i];

  std::vector<std::vector<std::vector<long long>>> dp(2, std::vector<std::vector<long long>>(3333, std::vector<long long>(55, 0)));

  std::vector<std::vector<long long>> &curr = dp[0], &next = dp[1];

  long long c = 0;

  curr[0][0] = 1;

  for (int i = 0; i < N; i ++) {
    for (auto& j : next)
      std::fill(ALL(j), 0);

    for (int j = 0; j < 3333; j ++)
      for (int k = 0; k < 55; k ++) {
        if (curr[j][k]) {
          next[j       ][k    ] += curr[j][k];
          next[j + x[i]][k + 1] += curr[j][k];
          
          if (j + x[i] == A * (k + 1))
            c += curr[j][k];
        }
      }
    
    std::swap(curr, next);
  }

  std::cout << c << std::endl;

  return 0;
}


Measured memory_bytes: 4992
using System;
using System.Linq;

public class Program
{

    public void Solve()
    {
        var sc = new Scanner();
        int n = sc.NextInt();
        int k = sc.NextInt();
        int[] h = sc.IntArray();
        int ans = h.Count(i => i >= k);
        Console.WriteLine(ans);
    }

    public static void Main(string[] args)
    {
        new Program().Solve();
    }
}

class Scanner
{
    public Scanner()
    {
        _pos = 0;
        _line = new string[0];
    }

    const char Separator = ' ';
    private int _pos;
    private string[] _line;

    #region スペース区切りで取得

    public string Next()
    {
        if (_pos >= _line.Length)
        {
            _line = Console.ReadLine().Split(Separator);
            _pos = 0;
        }

        return _line[_pos++];
    }

    public int NextInt()
    {
        return int.Parse(Next());
    }

    public long NextLong()
    {
        return long.Parse(Next());
    }

    public double NextDouble()
    {
        return double.Parse(Next());
    }

    #endregion

    #region 型変換

    private int[] ToIntArray(string[] array)
    {
        var result = new int[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = int.Parse(array[i]);
        }

        return result;
    }

    private long[] ToLongArray(string[] array)
    {
        var result = new long[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = long.Parse(array[i]);
        }

        return result;
    }

    private double[] ToDoubleArray(string[] array)
    {
        var result = new double[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = double.Parse(array[i]);
        }

        return result;
    }

    #endregion

    #region 配列取得

    public string[] Array()
    {
        if (_pos >= _line.Length)
            _line = Console.ReadLine().Split(Separator);

        _pos = _line.Length;
        return _line;
    }

    public int[] IntArray()
    {
        return ToIntArray(Array());
    }

    public long[] LongArray()
    {
        return ToLongArray(Array());
    }

    public double[] DoubleArray()
    {
        return ToDoubleArray(Array());
    }

    #endregion
}

Measured memory_bytes: 16096
#include <bits/stdc++.h>
using namespace std;
#define ll int64_t
#define ALL(a)  (a).begin(),(a).end()
 
const ll mod = 1000000007;
const ll LINF = 1e13;
const ll LLINF = 1e18;
const ll ALPHABET = 26;
 
template <class T>
void Swap(T& r, T& l) {
  T tmp = r;
  r = l;
  l = tmp;
}
 
template<typename T>
istream& operator >> (istream& is, vector<T>& vec) {
  for (T& x : vec) is >> x; //for(int i=0; i<vec.size(); i++) is >> x[i]; とかでもいい
  return is;
}


int main(){
    ll a,b;
    cin >>a;
    bool ans = false;

    for (ll i = 1; i < 10; i++){
      for (ll j = 1; j < 10; j++){
        if (i*j == a)ans = true;
      }
    }
    

    cout << (ans? "Yes":"No");


}


Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		
		double maxP = -1;
		int mWater = 0, mSolt = 0;
		
		for(int i=0;i*100*A <= F;i++){
			for(int j=0;j*100*B <= F; j++){
				int water = i * 100 * A + j * 100 * B;
				if(water > F) break;
				int maxSolt = (i*A + j*B) * E;
				for(int k=0;k*C <= maxSolt;k++){
					for(int l=0;l*D <= maxSolt;l++){
						int solt = k*C + l*D;
						if(solt > maxSolt) break;
						if(solt + water > F) break;
						if(maxP < (solt / (double)(water + solt))){
							mWater = water;
							mSolt = solt;
							maxP = (solt / (double)(water + solt));
						}
					
					}
				}
			}
		}
		Console.WriteLine("{0} {1}",mSolt+mWater ,mSolt);
		
		
		
		
		
		
	}
	int A,B,C,D,E,F;
	public Sol(){
		var d = ria();
		A = d[0]; B = d[1]; C = d[2]; D = d[3]; E = d[4]; F  = d[5];
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


Measured memory_bytes: 13140