akhauriyash/Code-Regression huggingface dataset:
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
using namespace std;
#define Ma_PI 3.141592653589793
#define eps 0.00000001
#define LONG_INF 3000000000000000000
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define MOD 998244353
#define REP(i,n) for(long long i = 0;i < n;++i)    
#define seg_size 524288
double dot(complex<double> a, complex<double> b) {
	return a.real() * b.real() + a.imag() * b.imag();
}
double gyaku_dot(complex<double> a, complex<double> b) {
	return a.real() * b.imag() - a.imag() * b.real();
}
double leng(complex<double> a) {
	return sqrt(a.real() * a.real() + a.imag() * a.imag());
}
double angles(complex<double> a, complex<double> b) {
	double cosine = dot(a, b) / (leng(a) * leng(b));
	double sine = gyaku_dot(a, b) / (leng(a) * leng(b));
	double kaku = acos(cosine);
	if (sine <= 0) {
		kaku = 2 * Ma_PI - kaku;
	}
	return kaku;
}
vector<int> convex_hull(vector<complex<double>> a) {
	vector<int> ans;
	double now_minnest = a[0].real();
	int now_itr = 0;
	REP(i, a.size()) {
		if (now_minnest > a[i].real()) {
			now_minnest = a[i].real();
			now_itr = i;
		}
	}
	ans.push_back(now_itr);
	complex<double> ba(0, 1);
	while (true) {
		int now_go = 0;
		double now_min = 0;
		int starter = ans[ans.size() - 1];
		for (int i = 0; i < a.size(); ++i) {
			if (i != starter) {
				double goa = angles(ba, a[i] - a[starter]);
				if (goa > now_min) {
					now_min = goa;
					now_go = i;
				}
			}
		}
		if (now_go == ans[0]) break;
		ans.push_back(now_go);
		ba = complex<double>(a[now_go] - a[starter]);
	}
	return ans;
}
long long gcd(long long a, long long b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}
int main() {
	int n;
	cin >> n;
	string s;
	cin >> s;
	int ans = 0;
	int now = 0;
	REP(i, s.length()) {
		if (s[i] == 'I')now++;
		else now--;
		ans = max(ans, now);
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
n = gets.to_i
reds = []
blues = []
counter = 0

n.times.each do
  x, y = gets.chomp.split.map(&:to_i)
  reds.push(x: x, y: y)
end

n.times.each do
  x, y = gets.chomp.split.map(&:to_i)
  blues.push(x: x, y: y)
end

reds.sort_by! { |a| a[:x] }
blues.sort_by! { |a| a[:x] }

blues.each do |blue|
  candidates = reds.select { |red| red[:x] < blue[:x] }.sort_by { |a| a[:y] }.reverse
  candidates.each do |c|
    next unless c[:y] < blue[:y]
    counter += 1
    reds.delete c
    break
  end
end

puts counter

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

typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<P,ll> PLL;
typedef pair<P,P> PP;
typedef vector<ll> llVEC;
typedef vector<P> PVEC;
typedef priority_queue<P,PVEC,greater<P> > PPQ;
typedef priority_queue<ll, llVEC, greater<ll> > llPQ;

#define rep(i,a,n) for(ll i = a;i < n;i++)
#define rrep(i,a,n) for(ll i = n-1; i >= a;i--)
#define LINF (ll)1e18
#define INF (int)1e9
#define fs first
#define sc second

template<typename T>
ll sz(vector<T> &vec){ return (ll)vec.size(); }
ll sz(string &s) {return (ll)s.size(); }
ll gcd(ll a,ll b){ return ((!b) ?a :gcd(b, a%b)); }
ll lcm(ll a,ll b){ return a / gcd(a,b) * b; }
bool checkindex(ll i,ll n){ return (i < n && i >= 0); }

int main(){
    ll n;
    cin >> n;
    ll bsum = 0,rasum = 0,lasum = 0,temp = 0;
    priority_queue<ll,llVEC,greater<ll>> pq_r;
    priority_queue<ll,llVEC> pq_l;

    ll q,a,b;
    rep(i,0,n){
        cin >> q;
        if(q == 2){
            ll minx;
            if(pq_r.empty()){
                cout << pq_l.top() << " " << bsum << endl;
            }
            else if(pq_l.empty()){
                cout << pq_r.top() << " " << bsum << endl;
            }
            else if((ll)(pq_r.size()+pq_l.size()) % 2 == 0){
                minx = pq_l.top();
            }
            else if(pq_l.size() > pq_r.size()){
                minx = pq_l.top();
            }
            else{
                minx = pq_r.top();
            }

            //cout << bsum  << " " << lasum << " " << rasum << " " << ((ll)(pq_r.size()) - (ll)(pq_l.size())) << endl;
            if(!pq_r.empty() && !pq_l.empty()) cout << minx << " " << bsum - lasum + rasum + minx*((ll)(pq_l.size()) - (ll)(pq_r.size())) << endl;
        }
        else{
            cin >> a >> b;
            bsum += b;
            if(pq_l.empty() && pq_r.empty()){
                pq_r.push(a);
                rasum += a;
            }
            else if(pq_r.size() == pq_l.size()){
                if(pq_r.top() <= a){
                    pq_r.push(a);
                    rasum += a;
                }
                else{
                    pq_l.push(a);
                    lasum += a;
                }
            }
            else if(pq_l.size() > pq_r.size()){
                if(pq_l.top() > a){
                    rasum += pq_l.top();
                    lasum -= pq_l.top();
                    pq_r.push(pq_l.top());
                    pq_l.pop();
                    pq_l.push(a);
                    lasum += a;
                }
                else{
                    pq_r.push(a);
                    rasum += a;
                }
            }
            else{
                if(pq_r.top() < a){
                    lasum += pq_r.top();
                    rasum -= pq_r.top();
                    pq_l.push(pq_r.top());
                    pq_r.pop();
                    pq_r.push(a); 
                    rasum += a;
                }
                else{
                    pq_l.push(a);
                    lasum += a;
                }
            }
        }
    }
}


Measured memory_bytes: 4980
n = int(input())
a = list(map(int, input().split()))

# a = np.array(a)
# ans = []
# while a.min() != 9999999:
#     min_index = a.argmin()
#     ans.append(min_index+1)
#     a[min_index] = 9999999

# print(' '.join([str(_) for _ in ans]))

l = []
for i in range(n):
    l.append([i+1, a[i]])

sl = sorted(l, key=lambda x: x[1])
sl0 = [r[0] for r in sl]
print(' '.join([str(_) for _ in sl0]))


Measured memory_bytes: 105408
#include<cstdio>
#include<cstring>
char s[100005];
int left[100005], right[100005];
int depth[100005];
int end[100005], ban[100005];
int sum[100005];
int f[100005];
int total = -1;

void build(int u,int p,int n){
    ban[u] = 1;
    if(p==n) end[u] = 1;
    else{
        if(s[p+1]=='0'){
            if(!left[u]) left[u] = ++total;
            build(left[u],p+1,n);
        }
        else{
            if(!right[u]) right[u] = ++total;
            build(right[u],p+1,n);
        }
    }
}

void dfs(int u,int p,int n){
    if(end[u]) return ;
    if(p!=n){
        if(left[u]) dfs(left[u],p+1,n);
        else sum[p+1]++;
        if(right[u]) dfs(right[u],p+1,n);
        else sum[p+1]++;
    } 
}

long long sgFunction(long long u){
    long long res = 1;
    while(u%2==0) res *= 2, u /= 2;
    return res;
}


int main(){
    int n; long long L;
    scanf("%d%lld",&n,&L);
    int maxLen = -1;
    total = 0; int root = ++total;
    for(int i = 0; i < n; i++){
        scanf("%s",s+1);
        int len = strlen(s+1);
        if(len>maxLen) maxLen = len;
        build(root,0,len);
    }
    dfs(root,0,maxLen);
    long long ans = 0;
    for(int i = 1; i <= maxLen; i++){ 
        long long height = L-(long long)i+1;
        if(height>0 && sum[i]%2) ans ^= sgFunction(height);
    }
    if(ans!=0) printf("Alice\n");
    else printf("Bob\n");
    return 0;
}


Measured memory_bytes: 6312
#include <algorithm>
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <vector>

#define rep(i, n) for (int i = 0; i < n; i++)
#define display false //????????????????????¨??????????????¨???

std::vector<int> bubble_sort(std::vector<int> A) {
  int flag = 1;
  int key, count = 0;
  while (flag) {
    flag = 0;
    for (int j = A.size() - 1; j >= 1; j--) {
      if (A[j] < A[j - 1]) {
        key = A[j - 1];
        A[j - 1] = A[j];
        A[j] = key;
        flag = 1;
        count++;
      }
    }
  }
  for (int k = 0; k < A.size(); k++) {
    if (k > 0) {
      std::cout << " ";
    }
    std::cout << A[k];
  }
  std::cout << std::endl;
  std::cout << count << std::endl;
  return A;
}

int main() {
  int N;
  std::cin >> N;
  std::vector<int> A(N);
  rep(i, N) { std::cin >> A[i]; }
  std::vector<int> AA = bubble_sort(A);
  return 0;
}

Measured memory_bytes: 3124
macro_rules! get {
    ($t:ty) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
                    get!($t)
        ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
                    get!($($t),*)
        ).collect::<Vec<_>>()
    };
    ($t:ty |) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.split_whitespace()
                .map(|t| t.parse::<$t>().unwrap())
                .collect::<Vec<_>>()
        }
    };
    ($t:ty | $n:expr) => {
        (0..$n).map(|_| get!($t |)).collect::<Vec<_>>()
    };
}
macro_rules! tern {
    ($condition: expr, $_true: expr, $_false: expr) => {
        if $condition {
            $_true
        } else {
            $_false
        }
    };
}

fn main() {
    let (k, x) = get!(isize, isize);
    let left = x - k + 1;
    let right = x + k - 1;
    for i in left..(right+1) {
        print!("{} ", i);
    }
    println!();
}


Measured memory_bytes: 4352
#include <algorithm>
#include <cmath>
#include <iostream>
#include <numeric>
#include <string>
#include <vector>

int main() {
  uint32_t N = 0, K = 0;
  std::cin >> N >> K;

  std::vector<uint32_t> L(N);
  for (auto &&l_n : L) std::cin >> l_n;

  std::sort(L.begin(), L.end(), std::greater<uint32_t>());

  std::cout << std::accumulate(L.begin(), L.begin() + K, 0) << std::endl;

  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
	//freopen("in.txt","r",stdin);
	ll n;
	cin>>n;
	ll q,w;
	cin>>q>>w;
	ll x = 0;
	for(ll i=2;i<n;i++){
		ll tmp;
		cin>>tmp;
		x ^= tmp;
	}
	ll d = (q+w-x)  / 2;
	if(d<0 or d>q or (d&x) or (q+w-x)%2==1){
		cout<<-1<<endl;
		exit(0);
	}
	for(ll i=56;i>=0;i--){
		if(x>>i&1LL){
			if(d+(1LL<<i) <= q){
				d += (1LL<<i);
			}
		}
	}
	if(d==0) cout<<-1<<endl;
	else cout<<q-d<<endl;
	return 0;
}

Measured memory_bytes: 3628
package main

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

func main() {
	sc := NewScanner()

	a := sc.NextInt()
	b := sc.NextInt()
	k := sc.NextInt()

	if a > k {
		fmt.Printf("%v %v\n", a-k, b) // output for debug
		return
	}
	k -= a
	b -= k
	if b < 0 {
		b = 0
	}

	fmt.Printf("%v %v\n", 0, b) // output for debug
}

type Scanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewScanner() *Scanner {
	rdr := bufio.NewReaderSize(os.Stdin, 1000)
	return &Scanner{r: rdr}
}
func (s *Scanner) Next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *Scanner) NextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *Scanner) NextInt() int {
	v, _ := strconv.Atoi(s.Next())
	return v
}

func (s *Scanner) NextIntArray() []int {
	s.pre()
	start := s.p
	result := []int{}
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			v, _ := strconv.Atoi(string(s.buf[start:s.p]))
			result = append(result, v)
			start = s.p + 1
		}
	}
	v, _ := strconv.Atoi(string(s.buf[start:s.p]))
	result = append(result, v)

	return result
}

func (s *Scanner) NextMap() map[int]bool {
	s.pre()
	start := s.p
	mp := map[int]bool{}
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			v, _ := strconv.Atoi(string(s.buf[start:s.p]))
			mp[v] = true
			start = s.p + 1
		}
	}
	v, _ := strconv.Atoi(string(s.buf[start:s.p]))
	mp[v] = true

	return mp
}

func (s *Scanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *Scanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}


Measured memory_bytes: 640
#include <iostream>
int main(){
    int a;
    int b;
    int c;
    std::cin>>a>>b>>c;
    if (a<b && b<c && a<c){
        std::cout<<"Yes"<<std::endl;
    }
    else {
        std::cout<<"No"<<std::endl;
    }
  return 0;  
}


Measured memory_bytes: 3084
#include <iostream>
#define ll long long
#define MAXN 55
using namespace std;
ll a[MAXN];

int main() {
	ll k;
	cin>>k;
	for(int i=0;i<50;i++){
		a[i]=i+k/50;
	}
	int yu=k%50;
	for(int i=0;i<50;i++){
		if(i<yu){
			a[i]=a[i]+51-yu;
		}
		else {
			a[i]=a[i]-yu;
		}
	}
	cout<<"50"<<endl;
	for(int i=0;i<50;i++){
		cout<<a[i]<<" ";
	}
	return 0;
}


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

int main(){
  int N;
  cin >> N;
  if(N<1 || N>100){
    return 0;
  }
  // 同じ数が出現する可能性があるためmultisetとする。
  // 昇順にsortするため、greater<int>を指定する。
  multiset<int, greater<int>> A; 

  for(int i=0; i<N; ++i){
    int a;
    cin >> a;
    if(a<1 || a>100){
      return 0;
    }
    A.insert(a);
  }
  //for(auto a: A){
  //  cout << a << endl;
  //}
  int difference = 0;
  int counter = 0;
  for(auto a: A){
    difference += (counter++)%2?(-a):a;
  }
  cout << difference << endl; 
}

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

int main() {
  int a,flag=0;
  string b;
  cin >> a >> b;
  if(a%2==1) {
    cout << "No";
    return 0;
  }
  for(int i = 0;i<a/2;i++){
    if(b.at(i)!=b.at(i+a/2))flag=1;
  }
  if(flag) cout << "No";
  else cout << "Yes";
}


Measured memory_bytes: 3552
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>

int main(void){

  int i,N,pro=0;
  scanf("%d",&N);
  int v[N],c[N];
   for(i=0;i<N;i++)
     scanf("%d",&v[i]);
   for(i=0;i<N;i++)
     scanf("%d",&c[i]);
   
   for(i=0;i<N;i++){
     if(v[i]-c[i]>0)
       pro+=v[i]-c[i];
   }
     printf("%d\n",pro);
}

Measured memory_bytes: 128
#include <iostream>
#define N 10000
using namespace std;

int main()
{
  int a,c;
  while(1)
    {
      cin >> a >> c;
      if(a==0&&c==0) break;
      if(a<=c)   cout << a << " " << c << endl;
      else   cout << c << " " << a << endl;
    }
  return 0;
}

Measured memory_bytes: 3012
#include <iostream>
#include <vector>
#include<iomanip>
#include <algorithm>
#include <stack>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);i++)
#include <iostream>
static const int MAX = 510;
int H, W;
int d[MAX][MAX];
vector<pair<int, int>> f;
vector<pair<int, int>> t;

bool isOdd(int a) {
    return a%2 != 0;
}

int main(int argc, const char * argv[]) {
    int i,j;
    cin >> H >> W;
    
    for (i = 0; i < H; i++) {
        for (j = 0; j < W; j++) {
            d[i][j] = 0;
        }
    }
    
    for (i = 0; i < H; i++) {
        for (j = 0; j < W; j++) {
            cin >> d[i][j];
        }
    }
    
    int cnt = 0;
    
    for (i = 0; i < H - 1; i++) {
        for (j = 0; j < W; j++) {
            if(isOdd(d[i][j])) {
                cnt++;
                f.push_back(make_pair(i+1, j+1));
                t.push_back(make_pair(i+2, j+1));
                --d[i][j];
                ++d[i+1][j];
            }
        }
    }
    
    for (j = 0; j < W-1; j++) {
        if(isOdd(d[H-1][j])) {
            cnt++;
            f.push_back(make_pair(H, j+1));
            t.push_back(make_pair(H, j+2));
            --d[H-1][j];
            ++d[H-1][j+1];
        }
    }
    
    cout << cnt << endl;
    for (int i = 0; i < cnt; i++) {
        cout << f[i].first << " " << f[i].second << " " << t[i].first << " " << t[i].second << endl;
    }
    
    return 0;
}



Measured memory_bytes: 5228
//No matter how imaginary the dreams are, i over i is always real!
//#include <boost/multiprecision/cpp_int.hpp> 
#include "bits/stdc++.h"
#include "ext/pb_ds/assoc_container.hpp"
#include "ext/pb_ds/tree_policy.hpp"
typedef long long int ll;
typedef double db;
// __int128 s128;
// __uint128_t u128;
typedef unsigned long long u64;
#define int long long int
#define P 1000000007
#define Q 1000000006
#define sz(a) (ll)a.size()
#define lt(a) (ll)a.length()
#define pll pair<ll,ll>
#define f(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define bac(i,a,b) for(ll i=(ll)a;i>=(ll)b;i--)
#define mll map<ll,ll>
#define umll unordered_map<ll,ll>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(a) a.begin(),a.end()
#define F first
#define S second
#define teevra_gati ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define N 3000
#define PI 3.14159265359
#define inf LLONG_MAX
//using namespace boost::multiprecision; 
using namespace __gnu_pbds;
using namespace std;

void solve(){
    ll n,k;
    cin>>n>>k;
    vl a(n), dp(k+1,0);
    f(i,0,n) cin>>a[i];
    f(i,1,k+1){
        ll prod=1;
        f(j,0,n){
            if(i-a[j]>=0 && dp[i-a[j]]==0) prod = 0;
        }
        if(!prod) dp[i]=1;
    }
    if(dp[k]) cout<<"First";
    else cout<<"Second";
}
signed main() {
    teevra_gati
        
    solve();

    return 0;
}

Measured memory_bytes: 1024
#define __USE_MINGW_ANSI_STDIO 0
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <set>
using namespace std;


int sumdigit(int x){
   int sum = 0;
    while(x != 0){
        sum += x % 10;
        x /= 10;
    }
    return sum;
}
int main(){
   int h, w;
   cin >> h >> w;
   string board[50];

   for(int i = 0; i < h; ++i) cin >> board[i];
const int dx[8] = {1,0,-1,0,1,-1,-1,1};
const int dy[8]  ={0,1,0,-1,1,1,-1,-1};

for(int i = 0; i < h; ++i){
    for(int j = 0; j < w; ++j){
        if(board[i][j] == '#') continue;

        int num = 0;
        for(int d = 0; d < 8; ++d){
            const int ni = i + dy[d];
            const int nj = j + dx[d];
            
            if(ni < 0 || h <= ni) continue;
            if(nj < 0 || w <= nj) continue;
            if(board[ni][nj] == '#')num++;
        }

        board[i][j]  = char(num + '0');
    }
}

for(int i = 0; i < h; ++i) cout << board[i] << endl;
}



Measured memory_bytes: 384
#include <bits/stdc++.h>
namespace my_std {
using namespace std;
#define reg register
#define Rint register int
#define FOR(i, a, b) for (register int i = (a), ed_##i = (b); i <= ed_##i; ++i)
#define ROF(i, a, b) for (register int i = (a), ed_##i = (b); i >= ed_##i; --i)
typedef long long i64;
#define Templ(T) template <typename T>
inline int read() {
    reg int ans = 0, f = 1;
    reg char c = getchar();
    while (!isdigit(c)) f ^= (c == '-'), c = getchar();
    for (; isdigit(c); c = getchar()) ans = (ans << 1) + (ans << 3) + (c ^ 48);
    return f ? ans : -ans;
}
Templ(_Tp) inline int chkmin(_Tp &x, _Tp y) { return x > y ? x = y, 1 : 0; }
Templ(_Tp) inline int chkmax(_Tp &x, _Tp y) { return x < y ? x = y, 1 : 0; }
#define mod 998244353
inline void qmo(int &x) { x += (x >> 31) & mod; }
} // namespace my_std
using namespace my_std;

#define N 410
#define inf (1145141919)
int n, h[N];
int c[2][N][N], f[N][N][2];
int T;

inline void init(){
    n = read();
    FOR(i, 1, n) h[i] = read();
    f[0][0][0] = -inf;
    FOR(i, 0, n) c[0][i][0] = c[0][0][i] = 1;
    FOR(i, 1, n){
        qmo(c[0][i][1] = -mod + (c[0][i - 1][1] << 1));
        qmo(c[1][i][1] = c[0][i][1] - 1);
        FOR(j, 2, n){
            qmo(c[0][i][j] = (i64)c[0][i][1] * c[0][i][j - 1] % mod);
            qmo(c[1][i][j] = (i64)c[1][i][1] * c[1][i][j - 1] % mod);
        }
    }
}

inline int dp(int l, int r){
    if(l > r) return 0;
    static int tmp[N][2];

    reg const int id(++T), len(r - l + 1);
    reg int (*g)[2] = f[id];
    Rint mn(inf), num(0);
    FOR(i, l, r) chkmin(mn, h[i]);
    g[0][0] = 1;
    for(Rint L(l), R(l), siz(0); R <= r + 1; ++R)
        if(h[R] == mn || R == r + 1){
        reg int (*u)[2] = f[dp(L, R - 1)];
        if(u[0][0] == -inf){
            ++num, L = R + 1;
            continue;
        }
        memset(tmp, 0, sizeof(tmp));
        FOR(i, 0, siz) FOR(j, 0, R - L){
            FOR(x, 0, 1) FOR(y, 0, 1){
                qmo(tmp[i + j][x | y] += (i64)g[i][x] * u[j][y] % mod - mod);
            }
        }
        memcpy(g, tmp, sizeof(tmp));
        ++num, siz += R - L;
        L = R + 1;
    }//处理儿子
    FOR(o, 1, num - 1){
        memcpy(tmp, g, sizeof(tmp));
        FOR(j, 0, len - 1){
            qmo(tmp[j + 1][0] -= g[j][0]);
            qmo(tmp[j + 1][1] += g[j][0] - mod);
        }
        memcpy(g, tmp, sizeof(tmp));
    }//处理 num - 1 个最低的位置
    reg const int hgh(mn - max(h[l - 1], h[r + 1]));
    FOR(i, 0, len){
        qmo(g[i][0] = (i64)c[0][len - i][hgh] * g[i][0] % mod);
        qmo(g[i][1] = (i64)c[1][len - i][hgh] * g[i][1] % mod);
    }//乘容斥系数
    return id;
}

inline void get_ans(reg const int &t){
    Rint ans(0);
    FOR(i, 0, n){
        qmo(ans += f[t][i][0] - mod);
        qmo(ans += f[t][i][1] - mod);
    }
    printf("%d\n", ans);
}

int main() {
    init();
    get_ans(dp(1, n));
    return 0;
}

Measured memory_bytes: 6332
package main
import(
  "fmt"
)
func main(){
  var s string
  ans:=0
  temp:=0
  fmt.Scan(&s)
  for i:=0;i<len(s);i++{
    if s[i]=='A'||s[i]=='C'||s[i]=='G'||s[i]=='T'{
      temp++
    }else{
      if temp>ans{
        ans=temp
      }
      temp=0
    }
  }
  if temp>ans{
    ans=temp
  }
  fmt.Println(ans)
}


Measured memory_bytes: 512
#include <iostream>
using namespace std;
int main(){
    string r_str[100],b_str[100];
    int ans=0,cnt=0;
    int i,j;
    int N,M;
    cin>>N;
    for(i=0;i<N;i++)cin>>b_str[i];
    cin>>M;
    for(i=0;i<M;i++)cin>>r_str[i];
    
    for(i=0;i<N;i++){
        for(j=0;j<N;j++)if(b_str[i]==b_str[j])cnt++;
        for(j=0;j<M;j++)if(b_str[i]==r_str[j])cnt--;
        
    if(cnt>=ans)ans=cnt;
    cnt=0;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
 
int main()
{
    int e[101][101];
    int R, C, r, c;
    int s, total;
 
    scanf("%d%d", &R, &C);
    for (r = 1; r <= R; r++) {
        for (c= 1; c <= C; c++) scanf("%d", &e[r][c]);
    }
     
    for (r = 1; r <= R; r++) {
        s = 0;
        for (c = 1; c <= C; c++) s += e[r][c];
        e[r][0] = s;
    }
    total = 0;
    for (c = 1; c <= C; c++) {
        s = 0;
        for (r = 1; r <= R; r++) s += e[r][c];
        e[0][c] = s;
        total += s;
    }
    for (r = 1; r <= R; r++) {
        for (c = 1; c <= C; c++) printf("%d ", e[r][c]);
        printf("%d\n", e[r][0]);
    }
    for (c = 1; c <= C; c++) printf("%d ", e[0][c]);
    printf("%d\n", total);
    return 0;
}


Measured memory_bytes: 2068
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define int long long
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e18;

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<int> a(n), b(n);
    vector<P> d(n);
    rep(i, 0, n){
        cin >> a[i] >> b[i];
        d[i] = {b[i], a[i]};
    }
    sort(d.begin(), d.end());
    int now = 0;
    rep(i, 0, n){
        int nxt = now + d[i].second;
        if(nxt <= d[i].first){
            now = nxt;
        }else{
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
}

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

using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;

#define INF (1LL << 60)
#define MOD 1000000007
#define PI 3.14159265358979323846

#define REP(i,m,n) for(ll (i)=(m),(i_len)=(n);(i)<(i_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define PR(x) cout << (x) << endl
#define PS(x) cout << (x) << " "
#define SZ(x) ((ll)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define ASC(x) sort(ALL((x)))
#define DESC(x) sort(ALL((x)),greater<ll>())
#define REV(x) reverse(ALL((x)))
#define pb push_back

int main()
{
    ll N, K;
    cin >> N >> K;
    vec min(N+1, 0), max(N+1, 0);
    REP(i,1,N+1) {
        ll a;
        cin >> a;
        ++min[MAX(i-a,1)];
        ++max[MIN(i+a,N)];
    }

    /*REP(i,1,N+1) PS(min[i]);
    PR("");
    REP(i,1,N+1) PS(max[i]);
    PR("");*/

    vec A(N+1, 0);
    REP(i,0,K) {
        REP(j,1,N+1) A[j] = 0;
        REP(j,1,N+1) A[j] = A[j-1] + min[j] - max[j-1];
        REP(j,1,N+1) {
            min[j] = 0;
            max[j] = 0;
        }
        REP(j,1,N+1) {
            ++min[MAX(j-A[j],1)];
            ++max[MIN(j+A[j],N)];
        }
        if(A[1] == N && A[N] == N) break;
    }

    REP(j,1,N+1) PS(A[j]);
    
    return 0;
}

/*



*/

Measured memory_bytes: 8008
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double dd;
const int N = 2e5+5;
const double eps = 1e-8;
const int mod = 998244353;

string a[105];
int n,l;

int main(){
  // freopen("input.txt","r",stdin);
  cin>>n>>l;
  for(int i = 1;i <= n;i++) cin>>a[i];
  sort(a+1,a+1+n);
  for(int i = 1;i <= n;i++) cout<<a[i];
  cout<<endl;
  return 0;
}


Measured memory_bytes: 256
import java.io.*;
import java.util.*;
import java.util.function.*;

final class Solver {
	static final Solver INSTANCE = new Solver();

	void solve(Supplier<String> sc) {
		int N = Integer.parseInt(sc.get());
		int K = Integer.parseInt(sc.get());
		int[] A = new int[N];
		Arrays.setAll(A, $ -> Integer.parseInt(sc.get()));

		for (int t = 0; t < Math.min(K, 100); t++) {
			int[] range = new int[N + 2];
			for (int i = 0; i < N; i++) {
				var d = A[i];
				var from = i - d + 1;
				var to = i + d + 2;
				range[Math.max(0, from)]++;
				if (to <= N) range[to]--;
			}

			int[] B = new int[N + 2];
			B[0] = range[0];
			for (int i = 1; i < range.length; i++) {
				B[i] = B[i - 1] + range[i];
			}
			System.arraycopy(B, 1, A, 0, N);
		}

		StringJoiner joiner = new StringJoiner(" ");
		for (int i = 0; i < N; i++) {
			joiner.add(String.valueOf(A[i]));
		}
		System.out.println(joiner);
	}
}

class Main {
	public static void main(String... args) {
		System.setOut(new PrintStream(new BufferedOutputStream(System.out)));
		var reader = new BufferedReader(new InputStreamReader(System.in));
		Solver.INSTANCE.solve(new Supplier<>() {
			StringTokenizer line;

			public String get() {
				while (line == null || !line.hasMoreTokens()) try {
					line = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new UncheckedIOException(e);
				}
				return line.nextToken();
			}
		});
		System.out.flush();
	}
}

Measured memory_bytes: 65708
#include <bits/stdc++.h>
using namespace std;
int n, m, k, mod, dp[105][105][105][2], coef[105][105][105][2], C[105][105];
inline void Add(int &x, int y) {
	x += y;
	if (x >= mod) x -= mod;
}
inline int qp(int a, int b) {
	int res = 1;
	while (b) {
		if (b & 1) res = 1ll * res * a % mod;
		a = 1ll * a * a % mod;
		b >>= 1;
	}
	return res;
}
int main() {
	scanf("%d%d%d%d", &n, &m, &k, &mod);
	for (int i = C[0][0] = 1; i <= 100; i++) {
		for (int j = C[i][0] = 1; j <= i; j++) {
			C[i][j] = (C[i - 1][j - 1] + C[i - 1][j]) % mod;
		}
	}
	for (int i = 1; i <= k; i++) {
		for (int c = 0; c <= m; c++) {
			int tmp = 1ll * (qp(i, m - c) - qp(i - 1, m - c) + mod) * qp(k - i + 1, c) % mod;
			for (int r = 0, pw = 1; r <= n; r++, pw = 1ll * pw * tmp % mod) {
				coef[i][r][c][0] = pw;
			}
		}
		for (int r = 0; r <= n; r++) {
			int tmp = 1ll * (qp(k - i + 1, r) - qp(k - i, r) + mod) * qp(i, n - r) % mod;
			for (int c = 0, pw = 1; c <= m; c++, pw = 1ll * pw * tmp % mod) {
				coef[i][r][c][1] = pw;
			}
		}
	}
	dp[0][0][0][1] = 1;
	for (int i = 1; i <= k; i++) {
		for (int r = 0; r <= n; r++) {
			for (int c = 0; c <= m; c++) {
				if (dp[i - 1][r][c][1]) {
					int t = dp[i - 1][r][c][1];
					for (int l = 0; l <= n - r; l++) {
						Add(dp[i][r + l][c][0], 1ll * t * C[n - r][l] % mod * coef[i][l][c][0] % mod);
					}
				}
				if (dp[i][r][c][0]) {
					int t = dp[i][r][c][0];
					for (int l = 0; l <= m - c; l++) {
						Add(dp[i][r][c + l][1], 1ll * t * C[m - c][l] % mod * coef[i][r][l][1] % mod);
					}
				}
			}
		}
	}
	printf("%d\n", dp[k][n][m][1]);
	return 0;
}

Measured memory_bytes: 17920
#include <bits/stdc++.h> //JuniorMonster a.k.a Sho10
#define ll long long int
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#define all(a) (a).begin(), (a).end()
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define sz size
#define f first
#define s second
#define pb push_back
#define er erase
#define in insert
#define mp make_pair
#define pi pair
#define rc(s) return cout<<s,0
#define endl '\n'
#define mod 1000000007
#define PI 3.14159265359
#define CODE_START  ios_base::sync_with_stdio();cin.tie();cout.tie();
using namespace std;
ll n,m,ans=0,dist[21][21];
char a[21][21];
bool viz[21][21];
vector<pair<ll,ll> >v;
int32_t main(){
CODE_START;
cin>>n>>m;
for(ll i=0;i<n;i++)
    for(ll j=0;j<m;j++)
{
    cin>>a[i][j];
    if(a[i][j]=='.'){
        v.pb(mp(i,j));
    }
}
if(v.size()==n*m){
    cout<<n+m-2<<endl;
    return 0;
}
for(ll i=0;i<v.size();i++)
    for(ll j=i+1;j<v.size();j++)
{
    queue<ll>q1;
    queue<ll>q2;
    q1.push(v[i].f);
    q2.push(v[i].s);
    for(ll c=0;c<v.size();c++)
    {
        viz[v[c].f][v[c].s]=0;
    }
    dist[v[i].f][v[i].s]=0;
    while(!q1.empty()){
        ll x,y;
        x=q1.front();
        y=q2.front();
        viz[x][y]=1;
        if(x==v[j].f&&y==v[j].s){
            break;
        }
        if(x-1>=0&&a[x-1][y]=='.'&&viz[x-1][y]==0){
            q1.push(x-1);
            q2.push(y);
            dist[x-1][y]=dist[x][y]+1;
        } if(x+1<n&&a[x+1][y]=='.'&&viz[x+1][y]==0){
        q1.push(x+1);
        q2.push(y);
        dist[x+1][y]=dist[x][y]+1;
        } if(y-1>=0&&a[x][y-1]=='.'&&viz[x][y-1]==0){
        q1.push(x);
        q2.push(y-1);
        dist[x][y-1]=dist[x][y]+1;
        }if(y+1<m&&a[x][y+1]=='.'&&viz[x][y+1]==0){
        q1.push(x);
        q2.push(y+1);
        dist[x][y+1]=dist[x][y]+1;
    }
    q1.pop();
    q2.pop();
}
ans=max(ans,dist[v[j].f][v[j].s]);
}
cout<<ans<<endl;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Collections;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.IO;
using System.Reflection;
using static System.Math;
using System.Numerics;
static class Program{
	const int mod=(int)1e9+7;
	const double eps=1e-11;
	static void Main(){
		Sc sc=new Sc();
		var s=sc.Ia;
		var a=sc.Ia;
		long p=s[0]-a.Sum();
		Console.WriteLine("{0}",p<0?-1:p);
	}
}
public class Sc{
	public int I{get{return int.Parse(Console.ReadLine());}}
	public long L{get{return long.Parse(Console.ReadLine());}}
	public double D{get{return double.Parse(Console.ReadLine());}}
	public string S{get{return Console.ReadLine();}}
	public int[] Ia{get{return Array.ConvertAll(Console.ReadLine().Split(),int.Parse);}}
	public long[] La{get{return Array.ConvertAll(Console.ReadLine().Split(),long.Parse);}}
	public double[] Da{get{return Array.ConvertAll(Console.ReadLine().Split(),double.Parse);}}
	public string[] Sa{get{return Console.ReadLine().Split();}}
	public object[] Oa{get{return Console.ReadLine().Split();}}
	public int[] Ia2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),int.Parse);}}
	public int[] Ia3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),int.Parse);}
	public int[] Ia3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),int.Parse);}
	public long[] La2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),long.Parse);}}
	public long[] La3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),long.Parse);}
	public long[] La3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),long.Parse);}
	public double[] Da2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),double.Parse);}}
	public double[] Da3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),double.Parse);}
	public double[] Da3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),double.Parse);}
	public T[] Arr<T>(int n,Func<T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f();}return a;}
	public T[] Arr<T>(int n,Func<int,T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i);}return a;}
	public T[] Arr<T>(int n,Func<string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(Console.ReadLine().Split());}return a;}
	public T[] Arr<T>(int n,Func<int,string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i,Console.ReadLine().Split());}return a;}
}

Measured memory_bytes: 29052
#pragma GCC optimize("O3")
#include <atcoder/all>
using namespace atcoder;
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// using namespace __gnu_pbds;
// gp_hash_table<int, int> mapka;

using namespace std;
#define PB push_back
#define MP make_pair
#define LL long long
#define int LL
#define FOR(i,a,b) for(int i = (a); i <= (b); i++)
#define RE(i,n) FOR(i,1,n)
#define REP(i,n) FOR(i,0,(int)(n)-1)
#define R(i,n) REP(i,n)
#define VI vector<int>
#define PII pair<int,int>
#define LD long double
#define FI first
#define SE second
#define st FI
#define nd SE
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())

template<class C> void mini(C &a4, C b4) { a4 = min(a4, b4); }
template<class C> void maxi(C &a4, C b4) { a4 = max(a4, b4); }

template<class TH> void _dbg(const char *sdbg, TH h){ cerr<<sdbg<<'='<<h<<endl; }
template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) {
  while(*sdbg!=',')cerr<<*sdbg++;
  cerr<<'='<<h<<','; _dbg(sdbg+1, a...);
}

template<class T> ostream &operator<<(ostream& os, vector<T> V) {
  os << "["; for (auto vv : V) os << vv << ","; return os << "]";
}
template<class L, class R> ostream &operator<<(ostream &os, pair<L,R> P) {
  return os << "(" << P.st << "," << P.nd << ")";
}

#ifdef LOCAL
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define debug(...) (__VA_ARGS__)
#define cerr if(0)cout
#endif

using mint = modint998244353;

ostream& operator<<(ostream& out, mint m){
  out << m.val();
  return out;
}

struct node{
  mint sum,evinv;
  int sumzw;
};

node empty(){
  return {0,0,0};
}
int n,k;

node lacz(node a,node b){
  return { a.sum + b.sum, 
    a.evinv + b.evinv + a.sumzw * b.sum,
    a.sumzw + b.sumzw};
}
segtree<node, lacz, empty> tree;

int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout << fixed << setprecision(11);
  cerr << fixed << setprecision(6);
  cin >> n >> k;
  tree = {vector<node>(n,{0,0,1})};
  
  vector<int> p(n);
  R(i,n){
    cin >> p[i];
    p[i]--;
  }
  R(i,k)tree.set(p[i], {1,0,0});
  mint kinv = mint(1) / k;
  mint res = 0;
  mint mno = 1;
  R(i,n-k){
    res += tree.all_prod().evinv * kinv * mno;
    res += mint(k-1) / 2;
    mno *= (k-1) * kinv;
    tree.set(p[i+k], {1 / mno,0,0});
  } 
  res += mint(k) * (k - 1) / 4;
  cout << res << "\n";
}


Measured memory_bytes: 14568
#include<iostream>
#include<string>
#include<algorithm>
#include<functional>
#include<cstring>
#include<set>
#include<map>
#include<vector>
#include<cmath>
#include<queue>
#include<cstdio>
#include<cstdlib>
#define reep(n1,n2,n3) for(int n1=n3;n1<n2;n1++)
#define rep(n1,n2) reep(n1,n2,0)
#define pb push_back
#define mp make_pair
#define fr first
#define sc second
#define INF 1e9
using namespace std;
typedef long long int lint;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<pair<int,int> > vp;
typedef pair<int,int> pi;
typedef pair<int,pair<int,int> > pii;
typedef vector<string> vs;
const double PI  = acos(-1.0);
int main(){
    string subs;
    cin>>subs;
    int n,ret=0;
    cin>>n;
    rep(i,n){
        string str;
        cin>>str;
        str+=str;
        if(str.find(subs)!=-1)ret++;
    }
    cout<<ret<<endl;
}

Measured memory_bytes: 1212
#include <iostream>
#include <string>
#include <cstring>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <queue>
#include <stack>
#include <iomanip>
#include <fstream>
#include <unordered_set>

using namespace std;

#define REP(i, n) for(ll i = 0;i < n;i++)
#define REPR(i, n) for(ll i = n;i >= 0;i--)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
#define FORR(i, m, n) for(ll i = m;i >= n;i--)
#define REPO(i, n) for(ll i = 1;i <= n;i++)
#define ll long long
#define INF (ll)1 << 60
#define MINF (-1 * INF)
#define ALL(n) n.begin(),n.end()
#define MOD 1000000007
#define P pair<ll, ll>


map<string, ll> mp;
ll now = 0;

int main() {
	ll n;
	cin >> n;
	REP(i, n) {
		string s;
		cin >> s;
		mp[s]++;
		now = max(now, mp[s]);
	}
	for (auto& i : mp)
	{
		if (i.second == now)cout << i.first << endl;
	}
}



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

int main()
{
    long long n,w;
    cin>>n>>w;
    long long a[n],b[n],dp[n+1][w+1],ans=0;
    for(int i=0; i<n; i++)
        cin>>a[i]>>b[i];
    memset(dp,0,sizeof(dp));
    for(int i=1; i<=n; i++)
        for(int j=0; j<=w; j++)
        {
            if(j>=a[i-1]) dp[i][j]=max(dp[i-1][j],b[i-1]+dp[i-1][j-a[i-1]]);
            else dp[i][j]=dp[i-1][j];
        }
    for(int i=0; i<=w; i++)
        ans=max(ans,dp[n][i]);
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 79104
s=input()
t=input()

l=len(s)-len(t)
mindiff=float("inf")
for i in range(l+1):
  ss=s[i:i+len(t)]
  cnt=0
  for j,c in enumerate(t):
    if ss[j]!=c:
      cnt+=1
  mindiff=min(mindiff,cnt)
print(mindiff)
    
  

Measured memory_bytes: 9120
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#include <functional>
#include <ctime>
#include <cmath>
#include <limits>
#include <numeric>
#include <type_traits>
using namespace std;
using ll = long long;

unsigned euclidean_gcd(unsigned a, unsigned b) {
    if (a < b) return euclidean_gcd(b, a);
    unsigned r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}

class UnionFind {
public:
    vector <ll> par;
    vector <ll> siz;
    UnionFind(ll sz_) : par(sz_), siz(sz_, 1LL) {
        for (ll i = 0; i < sz_; ++i) par[i] = i;
    }
    void init(ll sz_) {
        par.resize(sz_);
        siz.assign(sz_, 1LL);
        for (ll i = 0; i < sz_; ++i) par[i] = i;
    }
    ll root(ll x) {
        while (par[x] != x) {
            x = par[x] = par[par[x]];
        }
        return x;
    }
    bool merge(ll x, ll y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        if (siz[x] < siz[y]) swap(x, y);
        siz[x] += siz[y];
        par[y] = x;
        return true;
    }

    bool issame(ll x, ll y) {
        return root(x) == root(y);
    }

    ll size(ll x) {
        return siz[root(x)];
    }
};

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

long long modinv(long long a, long long mod) {
    return modpow(a, mod - 2, mod);
}

int main() {
    ll a;
    cin >> a;
    ll ans = 1;
    vector<ll> z(a);
    for (int i = 0; i < a; i++) {
        cin >> z.at(i);
    }
    ll p=0;
    for (int i = 0; i < a; i++) {
        if (p != a) {
            while (z.at(p) >= 2 * p-2*i + 1) {
                p++;
                if (p == a)break;
            }
        }
        ll s = min(p - i + 1, a - i);
        ans *= s;
        ans %= 1000000007;
    }
    cout << ans << endl;
}

Measured memory_bytes: 1024
N, K = map(int, input().split())
num = list(map(int, input().split()))
 
# 各サイコロの期待値を出す
expect = []
for i in range(N):
  expect.append((1 + num[i]) / 2)
 
# 累積和を作る
cs = [0]
for i in range(N):
    cs.append(cs[i]+expect[i])

max = 0
for i in range(K, N+1): # 配列0番目に初期値0が増えてるので1足す
  if max < cs[i] - cs[i-K]:
    max = cs[i] - cs[i - K]
print(max)

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

// g++ -std=c++17 -O2 -Wall template.cpp -o template
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int d, n;
    cin >> d >> n;
    int base = pow(100, d);
    if (n != 100) {
        cout << base * (n) << endl;
    } else {
        cout << base * 101 << endl;
    }
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    // Solution
}


Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>

using namespace std;

const long MOD = 1000000007;
typedef pair<int, int> P;
typedef long long ll;

int main(){
    int H, W, D;
    cin >> H >> W >> D;

    int A[H][W];
    for(int i=0; i<H; i++){
        for(int j=0; j<W; j++){
            cin >> A[i][j];
        }
    }

    int Q;
    cin >> Q;
    int L[Q], R[Q];
    for(int i=0; i<Q; i++) cin >> L[i] >> R[i];

    map<int, P> m;
    for(int i=0; i<H; i++){
        for(int j=0; j<W; j++){
            m[A[i][j]] = P(i, j);
        }
    }

    int sum[H*W+1];
    fill(sum, sum+H*W+1, -1);
    for(int i=1; i<=H*W; i++){
        if(sum[i] != -1) continue;
        sum[i] = 0;
        // cout << "---- " << i << endl;
        for(int j=i+D; j<=H*W; j+=D){
            P now = m[j];
            P prev = m[j-D];
            sum[j] = sum[j-D] + abs(now.first-prev.first) + abs(now.second-prev.second);
            // cout << "prev " << prev.first << " " << prev.second << endl;
            // cout << "now " << now.first << " " << now.second << endl;
        }
    }

    for(int i=0; i<Q; i++){
        if(sum[L[i]] == 0) cout << sum[R[i]] << endl;
        else cout << sum[R[i]] - sum[L[i]] << endl;
    }

    return 0;
}


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

using namespace std;
const int N=1e5+5;

bool cmp(pair<int,pair<int,int> > x,pair<int,pair<int,int> > y)
{
    return x.second.second<y.second.second;
}

int main()
{
    int n,m;
    pair<int,pair<int,int> > a[N];
    cin >> n >> m;
    for(int i=0;i<m;i++) cin >> a[i].first >> a[i].second.first,a[i].second.second=i;
    sort(a,a+m);
    int t=2;
    a[0].second.first=1;
    for(int i=1;i<m;i++)
    {
        if(a[i].first!=a[i-1].first) t=1;
        a[i].second.first=t++;
    }
    sort(a,a+m,cmp);
    for(int i=0;i<m;i++) printf("%06d%06d\n",a[i].first,a[i].second.first);
    return 0;
}


Measured memory_bytes: 2688
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vl = vector<ll>;
using vvl = vector<vl>;
using pl = pair<ll, ll>;
const ll INF = ll(1e18);
const ll mod = ll(1e9 + 7);
const double pi = acos(-1);
#define rep0(i,n) for(ll (i) = 0; (i) < (n); ++(i))
#define rrep0(i,n) for(ll (i) = (n) - 1; (i) >= 0; --(i))
#define rep1(i,n) for(ll (i) = 1; (i) <= (n); ++(i))
#define rrep1(i,n) for(ll (i) = (n); (i) >= 1; --(i))
#define nfor(i,a,b) for(ll (i) = (a); (i) < (b); ++(i))
#define rnfor(i,a,b) for(ll (i) = (b) - 1; (i) >= (a); --(i))
#define pf(x) cout << (x) << endl
#define all(x) (x).begin(),(x).end()
#define yes pf("Yes")
#define no pf("No")
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; }
const int dx[8]={1,0,-1,0,1,1,-1,-1};
const int dy[8]={0,1,0,-1,1,-1,1,-1};

ll gcd(ll a,ll b){
    if(a < b)swap(a, b);
    if(b == 0) return a;
    return gcd(b,a%b);
}

ll lcm(ll a,ll b){
    ll g = gcd(a,b);
    return a / g * b;
}

ll factorial(ll n){
    ll ans = 1;
    rep1(i, n){
        ans *= i;
        ans %= mod;
    }
    return ans;
}

ll power(ll a, ll b){
    ll ans = 1;
    a %= mod;
    while(b) {
        if(b & 1LL) ans = ans * a % mod;
        a = a * a % mod;
        b >>= 1;
    }
    return ans % mod;
}

vector<ll> FactorialInv, Factorial;

void init_combination(ll MAX){
    Factorial.resize(MAX + 1);
    FactorialInv.resize(MAX + 1);
    Factorial[0] = 1;
    for(int i = 1; i <= MAX; i++){
        Factorial[i] = Factorial[i - 1] * i % mod;
    }
    FactorialInv[MAX] = power(Factorial[MAX], mod - 2);
    for(ll i = MAX - 1; i >= 0; i--) {
        FactorialInv[i] = FactorialInv[i+1] * (i+1) % mod;
    }
}

ll combination(ll a, ll b){
    if((a == b) || (b == 0)){
        return 1;
    }
    if(a < b) return 0;
    if(b < 0) return 0;
    ll ans = Factorial[a] * FactorialInv[b] % mod;
    ans = ans * FactorialInv[a - b] % mod;
    return ans;
}


//modの値の確認をすること
int main(){
    ll n;
    cin >> n;
    vector<ll> a(26);
    rep0(i, 26)cin >> a[i];
    rep0(i, n){
        ll ans = 0,m = 0;
        rep0(i, 26){
            ll s;
            cin >> s;
            if(chmax(m, s))ans = i + 1;
        }
        pf(ans);
    }
    return 0;
}


Measured memory_bytes: 3640
D = int(input())
C = list(map(int, input().split()))
S = list(list(map(int, input().split())) for i in range(D))

manzoku = 0
yasumi= [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]

for day in range(D):
  yasumi = list(map(lambda x: x + 1, yasumi))
  zouka = 0
  for t in range(26):
    if zouka < S[day][t] + C[t] * yasumi[t]:
      zouka = S[day][t] + C[t] * yasumi[t]
      best = t
  manzoku += zouka
  yasumi[best] = 0
  print(best + 1)

Measured memory_bytes: 9524
#include<iostream>
#include<stdlib.h>
  
using namespace std;
  
struct Node{
  int key;
  Node* next;
  Node* prev;
};
  
struct List{
  Node* nil;
  
  void init(){
    nil=(Node*)malloc(sizeof(Node));
    nil->next=nil;
    nil->prev=nil;
    nil->key=0;
  }
  
  Node* find(int key){
    for(Node* i=nil->next;i!=nil;i=i->next){
      if(i->key==key)return i;
    }
    return nil;
  }
  
  void insert(Node *x){
    x->next=nil->next;
    nil->next->prev=x;
    nil->next=x;
    x->prev=nil;
  }
   
  void add(int x){
    Node* p = (Node*)malloc(sizeof(Node));
    p->key=x;
    insert(p);
  }
    
  void delete_x(int key){
    Node* x=find(key);
    if(x==nil)return;
    x->prev->next=x->next;
    x->next->prev=x->prev;
    free(x);
  }
    
  void deleteFirst(){
    Node* x = nil->next;
    x->prev->next=x->next;
    x->next->prev=x->prev;
    free(x);
  }
    
  void deleteLast(){
    Node* x = nil->prev;
    x->prev->next=x->next;
    x->next->prev=x->prev;
    free(x);  
  }
  
  void output(){
    int flg=0;
    for(Node* i=nil->next;i!=nil;i=i->next){
      if(flg)cout<<' ';
      cout<<i->key;
      flg=1;
    }
    cout<<endl;
  }
};
  
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  List list;
  list.init();
  int n,x;
  string str;
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>str;
    if(str=="insert"){
      cin>>x;
      list.add(x);
    }else if(str=="delete"){
      cin>>x;
      list.delete_x(x);
    }else if(str=="deleteFirst"){
      list.deleteFirst();
    }else {
      list.deleteLast();
    }
  }
  //cout<<'-'<<endl;
  list.output();
}


Measured memory_bytes: 34364