akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
 
typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pair<int, int> > vii;
#define rrep(i, m, n) for(int (i)=(m); (i)<(n);  (i)++)
#define erep(i, m, n) for(int (i)=(m); (i)<=(n); (i)++)
#define  rep(i, n)    for(int (i)=0; (i)<(n);  (i)++)
#define rrev(i, m, n) for(int (i)=(n)-1; (i)>=(m); (i)--)
#define erev(i, m, n) for(int (i)=(n); (i)>=(m); (i)--)
#define  rev(i, n)    for(int (i)=(n)-1; (i)>=0; (i)--)
#define vrep(i, c)    for(__typeof((c).begin())i=(c).begin(); i!=(c).end(); i++)
#define  ALL(v)       (v).begin(), (v).end()
#define pb            push_back
template<class T, class S> inline pair<T, S> mp(T x, S y){ return make_pair(x, y); }
template<class T, class S> inline bool minup(T& m, S x){ return m>(T)x ? (m=(T)x, true) : false; }
template<class T, class S> inline bool maxup(T& m, S x){ return m<(T)x ? (m=(T)x, true) : false; }
 
static const int    INF = 1000000000;
static const ll     MOD = 1000000007LL;
static const double EPS = 1E-12;
 
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};
const int MAX_N = 30;
const int MAX_X = 30;
const int MAX_Y = 30;
int n, m;
int x[MAX_N], y[MAX_N];
map<char, int> hm;
char c;
int d;
bool flag[MAX_X+1][MAX_Y+1];
 
int main()
{
  hm['W'] = 0;
  hm['S'] = 1;
  hm['E'] = 2;
  hm['N'] = 3;
 
  while(cin >> n, n){
    int cnt = 0;
    int hx = 10;
    int hy = 10;
    erep(i, 0, MAX_X) erep(j, 0, MAX_Y) flag[i][j] = false;
 
    rep(i, n){
      cin >> x[i] >> y[i];
      flag[x[i]][y[i]] = true;
      cnt += 1;
    }
 
    cin >> m;
    rep(i, m){
      cin >> c >> d;
      rep(j, d){
        hx += dx[hm[c]];
        hy += dy[hm[c]];
        if(flag[hx][hy]){
          cnt -= 1;
          flag[hx][hy] = false;
        }
      }
    }
 
    puts(cnt == 0 ? "Yes" : "No");
  }
 
  return 0;
}

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); ++i)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using namespace std;
int main() {
  int n;
  cin>>n;
  vector<int>a(n);
  map<int,long>k;
  map<int,long>l;
  long ans=0;
  rep(i,n){
    cin>>a.at(i);
    k[a.at(i)+i]++;
    l[i-a.at(i)]++;
  }
  for(auto p:k){
    auto b=p.first;
    auto c=p.second;
    ans+=c*l[b];
  }
  
  
  cout<<ans<<endl;
}

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

int c[11][11]={0};
int a[203][203]={0};

void warshall_floyd() {
    for (int k = 0; k < 10; k++)
        for (int i = 0; i < 10; i++)
            for (int j = 0; j < 10; j++)
                c[i][j] = min(c[i][j], c[i][k] + c[k][j]);
}

int main(){
    int h, w;
    cin >> h >> w;
    for(int i=0;i<10;++i)
        for(int j=0;j<10;++j)
            cin >> c[i][j];
    for(int i=0;i<h;++i)
        for(int j=0;j<w;++j)
            cin >> a[i][j];

    warshall_floyd();
    int ans = 0;
    for(int i=0;i<h;++i){
        for(int j=0;j<w;++j){
            if(a[i][j] != -1)
                ans += c[a[i][j]][1];
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
long long mo = 1e9 + 7;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
template<class A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}cout << "\n";}
ld PI=3.14159265358979323846;
vector<ll> memo(100010);
vector<vector<ll>> G(100010);
map<Pll,ll> mp;
void dfs(ll v, ll c){
    if(memo[v])return;
    memo[v] = 1;
    ll j = 1;
    rep(i,G[v].size()){
        if(j == c)j++;
        if(memo[G[v][i]])continue;
        dfs(G[v][i], j);
        mp[Pll(v,G[v][i])] = j;
        mp[Pll(G[v][i],v)] = j;
        //CG[v][i] = -j;
        //CG[G[v][i]][v] = -j;
        j++;
    }
}

int main(){
    ll N;
    cin >> N;
    vector<ll> a(N-1),b(N-1);
    rep(i,N-1){
        cin >> a[i] >> b[i];
        a[i]--;b[i]--;
        G[a[i]].push_back(b[i]);
        G[b[i]].push_back(a[i]);
    }
    ll K = 0;
    rep(i,N){
        cmax(K, G[i].size());
    }
    cout << K << endl;
    //CG = G;
    dfs(0,0);
    rep(i,N-1){
        cout << mp[Pll(a[i],b[i])] << endl;
    }
}


Measured memory_bytes: 21760
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <bitset>

#define REP(i,k,n) for(int i=k;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)

using namespace std;

int main()
{
	double n;

	while(cin >> n)
	{
		if(n < 0) break;

		int up = (int)n;
		double down = n - up;

		if(0 <= up && up < 256 && down*16 == (int)(down*16))
		{
			int t = (int)(n*16);
			string s;
			rep(i,12)
			{
				if(i < 4)
				{
					if(t & (1 << i)) s += "1";
					else s += "0";
				}
				else
				{
					if(i == 4) s += ".";

					if(t & (1 << i)) s += "1";
					else s+= "0";
				}
			}

			reverse(s.begin(),s.end());
			cout << s << endl;
		}
		else cout << "NA" << endl;
	}
}

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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define pb push_back
#define rep(i, a, n) for(int i = (a); i < (n); i++)
#define dep(i, a, n) for(int i = (a); i >= (n); i--)
#define mod (ll)(1e9+7)
#define int ll

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

int s[100001];
int b[100001];

int find(int x) {
  return s[x] = s[x] == x ? x : find(s[x]);
}

bool unite(int x, int y) {
  x = find(x);
  y = find(y);
  if(x != y) {
    if(b[x] && b[y] && b[x] != b[y]) {
      return false;
    }
    if(b[x]) b[y] = b[x];
    s[x] = y;
  }
  return true;
}

bool bukatu(int x, int y) {
  if(b[find(x)] && b[find(x)] != y) {
    return false;
  }else {
    b[find(x)] = y;
    return true;
  }
}

int a[200001], c[200001], d[200001];

signed main() {
  int n, m, k;
  cin >> n >> m >> k;
  rep(i, 0, n + 1) s[i] = i;
  rep(i, 0, k) cin >> a[i] >> c[i] >> d[i];
  rep(i, 0, k) {
    if(a[i] == 1) {
      if(!unite(c[i], d[i])) {
        cout << i + 1 << endl;
        return 0;
      }
    }else {
      if(!bukatu(c[i], d[i])) {
        cout << i + 1 << endl;
        return 0;
      }
    }
  }
  cout << 0 << endl;
}



Measured memory_bytes: 9472
#include <iostream>
#include "bits/stdc++.h"
using namespace std;
#define print(x) cout<<x<<endl;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a) for(int i=0;i<a;i++)
#define debug int debug = 0;
#define RREP(i,a) for(int i=a-1;i>=0;i--)
#define rrep(i,a,b) for(int i=a-1;i>=b;i--)
#define printall(n,array) {for(int i=0;i<n;i++){cout<<array[i]<<" ";}cout<<endl;}
#define U() cout<<endl;
typedef long long ll;
typedef pair<int, int> Pi;
typedef pair<int, Pi> V;
typedef vector<ll> VE;
const ll mod = 1e9 + 7; //10^9+7

//最大公約数
ll gcd(ll m,ll n){
    if(n == 0)return m;
    return gcd(n, m % n);
}

//最小公倍数
ll lcm( ll m, ll n )
{
    if ( ( 0 == m ) || ( 0 == n ) )
        return 0;

    return ((m / gcd(m, n)) * n);
}


int main(){
    ll n;
    ll t[102];
    cin >> n;
    REP(i, n)cin >> t[i];
    sort(t, t + n);
    ll ans = t[0];
    rep(i, 1, n){
        ans = lcm(ans, t[i]);
    }
    print(ans);
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
    int a, b, c, n, count;
    scanf("%d %d %d", &a, &b, &c);
    n=a;
    count = 0;

    while(n <= b){
        if(c%n == 0) count++;
        n++;
    }
    printf("%d\n", count);
    
    return 0;
}


Measured memory_bytes: 2100
#include <bits/stdc++.h>
using namespace std;
#define null NULL
#define mp make_pair
#define pb(a) push_back(a)
#define sz(a) ((int)(a).size())
#define all(a) a.begin() , a.end()
#define fi first
#define se second
#define relaxMin(a , b) (a) = min((a),(b))
#define relaxMax(a , b) (a) = max((a),(b))
#define SQR(a) ((a)*(a))
#define PI 3.14159265358979323846
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef long long ll;

const int MAX = 110;

int h, w, n;
vi cnt;

int out[MAX][MAX];
vector<pii> ord;

int main(){
  scanf("%d%d%d", &h, &w, &n);
  cnt.resize(n);
  for(int& e : cnt) scanf("%d", &e);

  for(int j = 0;j < w;++j){
    if(j & 1){
      for(int i = 0;i < h;++i)
        ord.pb(mp(i, j));
    } else {
      for(int i = h - 1;i >= 0;--i)
        ord.pb(mp(i, j));
    }
  }

  for(int i = 0;i < n;++i){
    while(cnt[i]-- > 0){
      out[ord.back().fi][ord.back().se] = i + 1;
      ord.pop_back();
    }
  }

  for(int i = 0;i < h;++i)
    for(int j = 0;j < w;++j)
      printf("%d%c", out[i][j], j + 1 == w ? '\n' : ' ');

  return 0;
}


Measured memory_bytes: 640
package main

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

func main() {
	sc := NewScanner()
	S := sc.Next()
	fmt.Println(S[:3])

}

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) NextInt64() int64 {
	v, _ := strconv.ParseInt(s.Next(), 10, 64)
	return v
}

func (s *Scanner) NextFloat() float64 {
	v, _ := strconv.ParseFloat(s.Next(), 64)
	return v
}

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

	return result
}
func (s *Scanner) NextInt64Array() []int64 {
	s.pre()
	start := s.p
	result := []int64{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 64)
			result = append(result, v)
			start = s.p + 1
		}
	}
	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: 1756
#include<bits/stdc++.h>
using namespace std;

long long INF = 1e9;
int N, A, B, C;
vector<int> length(8);


int dfs(int v, int a, int b, int c) {
    if (v == N) {
        if (a == 0 || b == 0 || c == 0) return INF;
        return abs(a - A) + abs(b - B) + abs(c - C);
    }

    int rep = dfs(v + 1, a, b, c);

    if (a == 0) rep = min(rep, dfs(v + 1, a + length[v], b, c));
    else rep = min(rep, dfs(v + 1, a + length[v], b, c) + 10);

    if (b == 0) rep = min(rep, dfs(v + 1, a, b + length[v], c));
    else rep = min(rep, dfs(v + 1, a, b + length[v], c) + 10);

    if (c == 0) rep = min(rep, dfs(v + 1, a, b, c + length[v]));
    else rep = min(rep, dfs(v + 1, a, b, c + length[v]) + 10);
 
    return rep;
}
 
int main() {
    cin >> N >> A >> B >> C;
    for (int i = 0; i < N; i++) cin >> length[i];

    int ans = dfs(0,0,0,0);
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>
// *テンプレート*
#define int long long
#define rep(i, n) for (int i = 0; i < (n); i++)
#define P pair<int, int>
#define sz(x) x.size()
// aよりbの方が小さかったら、aの値をbの値に置き換える。(swapではない！)
template<class T> inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
// aよりbの方が大きかったら、aの値をbの値に置き換える。
template<class T> inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}

using namespace std;
typedef long long ll;
using Graph = vector<vector<int>>;
//最大公約数
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;
}
// 素数かどうか判定
bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}


const long long MOD = 1000000007;
const long long INF = 1LL << 60;
// *テンプレートここまで*

// pair -> vector<pair<int,int>> 
//		   AandB.push_back(make_pair(a[i],b[i]))




signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n; cin >> n;
	vector<int>a(n);
	rep(i, n)cin >> a[i];
	int ans = a[0];
	rep(i, n) {
		ans = gcd(ans, a[i]);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define fr(i,n) for(int i=0;i<(n);++i)
#define Fr(i,n) for(int i=1;i<=(n);++i)
#define ifr(i,n) for(int i=(n)-1;i>=0;--i)
#define iFr(i,n) for(int i=(n);i>0;--i)

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    istream& in(cin);
    ostream& out(cout);
    int a,b,c;
    in>>a>>b>>c;
    cout<<(a+b+c>21?"bust":"win")<<endl;
}

Measured memory_bytes: 256
//ΔARC099F
#include<iostream>
#include<cstdio>
#include<fstream>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<bitset>
#include<cmath>
#include<cstring>
#include<cstdlib>
using namespace std;
typedef long long LL;
typedef double DB;
const int N = 266666;
const int B = 19260817;
const int MO = 1e9+21;
const int M2 = 998244353;
int fpow(int x,int y,int mo){
	if(!y)
		return 1;
	LL z=fpow(x,y>>1,mo);
	z=z*z%mo;
	if(y&1)
		z=z*x%mo;
	return z;
}
int invB=fpow(B,MO-2,MO),invB2=fpow(B,M2-2,M2);
char ch[N];
int n,a[N],f[N],f2[N],g[N],g2[N];
map<LL,int> M;
int main()
{
	int i,x,x2,y,y2;
	LL ans=0;
	cin>>n;
	scanf("%s",ch+1);
	for(i=1;i<=n;i=i+1){
		if(ch[i]=='-')
			a[i]=0;
		if(ch[i]=='+')
			a[i]=1;
		if(ch[i]=='<')
			a[i]=2;
		if(ch[i]=='>')
			a[i]=3;
	}
	x=0;
	for(i=n;i;i=i-1){
		if(a[i]==0)
			x=(x-1+MO)%MO;
		if(a[i]==1)
			x=(x+1)%MO;
		if(a[i]==2)
			x=(LL)x*invB%MO;
		if(a[i]==3)
			x=(LL)x*B%MO;
		f[i]=x;
	}
	x=0;
	for(i=n;i;i=i-1){
		if(a[i]==0)
			x=(x-1+M2)%M2;
		if(a[i]==1)
			x=(x+1)%M2;
		if(a[i]==2)
			x=(LL)x*invB2%M2;
		if(a[i]==3)
			x=(LL)x*B%M2;
		f2[i]=x;
	}
	x=0,y=1;
	for(i=n;i;i=i-1){
		if(a[i]==0)
			x=(x+y)%MO;
		if(a[i]==1)
			x=(x-y+MO)%MO;
		if(a[i]==2)
			y=(LL)y*B%MO;
		if(a[i]==3)
			y=(LL)y*invB%MO;
		g[i]=x;
	}
	x=0,y2=1;
	for(i=n;i;i=i-1){
		if(a[i]==0)
			x=(x+y2)%M2;
		if(a[i]==1)
			x=(x-y2+M2)%M2;
		if(a[i]==2)
			y2=(LL)y2*B%M2;
		if(a[i]==3)
			y2=(LL)y2*invB2%M2;
		g2[i]=x;
	}
	for(i=0;i<=n;i=i+1)
		M[(LL)g[i]<<32|g2[i]]++;
	for(i=1;i<=n;i=i+1){
		M[(LL)g[i]<<32|g2[i]]--;
		x=(f[1]-f[i]+MO)%MO;
		x=(LL)x*y%MO;
		x2=(f2[1]-f2[i]+M2)%M2;
		x2=(LL)x2*y2%M2;
		ans+=M[(LL)x<<32|x2];
		if(a[i]==2)
			y=(LL)y*invB%MO;
		if(a[i]==3)
			y=(LL)y*B%MO;
		if(a[i]==3)
			y2=(LL)y2*B%M2;
		if(a[i]==2)
			y2=(LL)y2*invB2%M2;
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 36736
#include<iostream>
#include<stdio.h>
using namespace std;
int main()
{
    double a,b,f;
    int d,r,i,j;
    cin>>a>>b;
    d=a/b;
    i=a;
    j=b;
    r=i%j;
    f=a/b;
    printf("%d %d %.5lf\n",d,r,f);
    return 0;
}



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

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

typedef long long LL;
const LL mod=1000000007;
#define MAX 10000
#define NIL -1
const double PI  = acos(-1.0);
const int INF = 1e9 + 7;
//-------------------------------------------


vector <string> v;
vector <int> num;

int main(){

    cin.tie(0);
    ios::sync_with_stdio(false);

    string s;
    cin>> s;
    int k;
    cin >> k;

    REP( i, int(s.size()) ){
        for( int j = 1; j <= 5; j++){
            v.push_back( s.substr(i,j));
        }
    }

    // sort -> unique 重複なしで辞書順
    // uniqueはソートしてないと配列の末尾に重複した要素が格納されてしまう
    sort( v.begin(), v.end());
    unique(v.begin(), v.end());

    cout << v[k -1] << endl;

    return 0;
}


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

const int N = 200000+10;
double v[N];
double dp[N];
int n, k;

double t(double x){
	double tmp = (x*(1.0+x))/2.0;
	return tmp/x;
}

int main(){
	cin >> n >> k;
	for(int i=0; i < n; i++) cin >> v[i];
	for(int i=0; i < n; i++) v[i] = t(v[i]);

	dp[0] = 0.0;
	for(int i=0; i < n; i++) dp[i+1] = dp[i]+v[i];
	
	double max_ans = 0.0;
	for(int i=0; i+k <= n; i++) max_ans = max(max_ans, dp[i+k]-dp[i]);
	
	cout.precision(10);
	cout << fixed;
	cout << max_ans << endl;
}	


Measured memory_bytes: 3328
//By TheOneYouWant
#pragma GCC optimize ("-O2")
#include <bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define memreset(a) memset(a,0,sizeof(a))
#define testcase(t) int t;cin>>t;while(t--)
#define forstl(i,v) for(auto &i: v)
#define forn(i,e) for(int i=0;i<e;++i)
#define forsn(i,s,e) for(int i=s;i<e;++i)
#define rforn(i,s) for(int i=s;i>=0;--i)
#define rforsn(i,s,e) for(int i=s;i>=e;--i)
#define bitcount(a) __builtin_popcount(a) // set bits (add ll)
#define ln '\n'
#define getcurrtime() cerr<<"Time = "<<((double)clock()/CLOCKS_PER_SEC)<<endl
#define dbgarr(v,s,e) cerr<<#v<<" = "; forsn(i,s,e) cerr<<v[i]<<", "; cerr<<endl
#define inputfile freopen("input.txt", "r", stdin)
#define outputfile freopen("output.txt", "w", stdout)
#define dbg(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); \
stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) { cerr<<endl; }
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << "\t"; err(++it, args...);
}
template<typename T1,typename T2>
ostream& operator <<(ostream& c,pair<T1,T2> &v){
	c<<"("<<v.fi<<","<<v.se<<")"; return c;
}
template <template <class...> class TT, class ...T>
ostream& operator<<(ostream& out,TT<T...>& c){
    out<<"{ ";
    forstl(x,c) out<<x<<" ";
    out<<"}"; return out;
}
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll,ll> p64;
typedef pair<int,int> p32;
typedef pair<int,p32> p96;
typedef vector<ll> v64;
typedef vector<int> v32; 
typedef vector<v32> vv32;
typedef vector<v64> vv64;
typedef vector<p32> vp32;
typedef vector<p64> vp64;
typedef vector<vp32> vvp32;
typedef map<int,int> m32;
const int LIM=1e5+5,MOD=1e9+7;
const ld EPS = 1e-9;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int main(){
	fastio;

	ll n; cin>>n;

	ll max = sqrt(2*n)+2;

	ll ans[n+1] = {0};

	forsn(i,1,max){
		forsn(j,1,max){
			forsn(k,1,max){
				ll ch = (i+j)*(i+j) + (j+k)*(j+k) + (i+k)*(i+k);
				ch /= 2;
				if(ch <= n) ans[ch]++;
			}
		}
	}

	forsn(i,1,n+1) cout<<ans[i]<<ln;

	return 0;
}

Measured memory_bytes: 3696
#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long a;;
	long long b=0,sum=0,cnt=0;
	cin>>a;
	while(a>0)
	{
		if(cnt==0)
		{
			b++;
			sum+=b;
		}
		else
		{	b=b*2;
			sum+=b;
		}
		cnt++;
		a=a/2;
	}
	cout<<sum<<endl;
	return 0;
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define stoi stoll
using pii=pair<int,int>;
using vi = vector<int>;
using vvi = vector<vi>;
#define all(c) begin(c),end(c)
#define rall(c) rbegin(c),rend(c)
#define fore(x,c) for(auto &&x:c)
#define rep(i,a,n) for(int i=a,i##len=(int)(n);i<i##len;++i)
#define rrep(i, a, n) for(int i=(int)(n-1);i>=a;--i)
#define sz(c) ((int)c.size())
#define contains(c,x) (c.find(x)!=end(c))
#define inseg(l,x,r) ((l)<=(x)&&(x)<(r))
#define dump(...)
#define pb push_back
#define _ 0
const signed INF_=1001001001; const long long INF=1001001001001001001LL;
const int DX[9]={0,1,0,-1,1,1,-1,-1,0},DY[9]={-1,0,1,0,-1,1,1,-1,0};
template<class T> ostream& operator<<(ostream &os,const vector<T> &v) {
    for (auto i = begin(v); i != end(v); i++) os<<*i<<(i==end(v)-1?"":" ");return os;}
template<class T> istream& operator>>(istream &is,vector<T> &v) {
    for (auto i = begin(v); i != end(v); i++) is>>*i;return is;}
template<class T,class U> istream& operator>>(istream &is, pair<T,U> &p) {
    is>>p.first>>p.second;return is;}
template<class T, class U> bool chmax(T &a,const U &b){return a<b?a=b,1:0;}
template<class T, class U> bool chmin(T &a,const U &b){return a>b?a=b,1:0;}
template <class T> void psum(T& c) {partial_sum(begin(c), end(c), begin(c));}
template<class T> using heap=priority_queue<T,vector<T>,greater<T>>;
struct before_main_function {
    before_main_function() {
        cin.tie(nullptr); ios::sync_with_stdio(0);
        cout << setprecision(15) << fixed;
        // #define endl "\n"
    }
} before_main_function;
//------------------8<------------------------------------8<--------------------

signed main() {
    int W, H, x, y;
    cin >> W >> H >> x >> y;
    if ((W % 2 == 0 && W / 2 == x) && (H % 2 == 0 && H / 2 == y)) {
        cout << W * H / 2.0 << " " << 1 << endl;
    } else {
        cout << W * H / 2.0 << " " << 0 << endl;
    }
    return (0^_^0);
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    string s;
    cin>>s;
    ll sum=0,sum1=0;
    sum+=s[0]-'0';
    sum=sum*10+s[1]-'0';
    sum1+=s[2]-'0';
    sum1=sum1*10+s[3]-'0';
   // cout<<sum<<sum1<<endl;
    if((sum<=12&&sum>0)&&(sum1<=12&&sum1>0))
    {
        cout<<"AMBIGUOUS"<<endl;
    }
    else if((sum<=12&&sum>0))
    {
        cout<<"MMYY"<<endl;
    }
    else if((sum1<=12&&sum1>0))
    {
        cout<<"YYMM"<<endl;
    }
    else
    {
        cout<<"NA"<<endl;
    }
return 0;
}


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

int main()
{
    string s;
    cin >> s;
    vector<int> a(26,0);
    for(int i = 0; i < s.size(); i++) a[s[i]-'A']++;

    int cnt = 0;
    for(int i = 0; i < 26; i++) if(a[i] == 2) cnt++;

    if(cnt == 2) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
using namespace std;
long long n,m;//注意n,m的取值范围
int main()
{
    long long sum=0;
    long long ans=0;
    while(scanf("%lld%lld",&n,&m)!=EOF)
    {
        if(m>2*n)//m多于2*n，这样sum=m-n才会是正数
        {
            m/=2;//让多的减少去和少的匹配，因为过程中会出现n和m剩余的情况
           sum=m-n;
           ans=n+sum/2;
        }
        else//m>n,m<n这两种情况时m就决定了分配的个数，所以只用m就可以了
        {
            ans=m/2;
        }
        printf("%lld\n",ans);
    }
    return 0;
}

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

template<class T> inline bool chmin(T& a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}

template<class T> inline bool chmax(T& a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

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

    int n;
    cin >> n;

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

    vector<int> x(100010, 0);
    vector<int> y(100010, 0);

    rep(i, n) {
        if(i % 2 == 0) ++x[v[i]];
        else ++y[v[i]];
    }
    pair<int, int> x_max(-1, 0);
    pair<int, int> y_max(-1, 0);

    rep(i, 100010) {
        x_max.first = max(x_max.first, x[i]);
        y_max.first = max(y_max.first, y[i]);
        if(x_max.first == x[i]) x_max.second = i;
        if(y_max.first == y[i]) y_max.second = i;
    }

    sort(x.rbegin(), x.rend());
    sort(y.rbegin(), y.rend());

    int ans = 0;
    int size = n / 2;
    if(x_max.second != y_max.second) {
        ans = (size - x_max.first) + (size - y_max.first);
    }
    else {
        int cmp_x = x[1];
        int cmp_y = y[1];
        if(cmp_x > cmp_y) {
            ans = (size - y_max.first) + (size - cmp_x);
        }
        else {
            ans = (size - x_max.first) + (size - cmp_y);
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 4504
#include<bits/stdc++.h>
using namespace std;
#define ll unsigned long long
#define pb push_back
#define mk make_pair
#define REP(i,a,b) for(int i=a; i<=b; i++)
#define mod 1000000007
int main()
{
    ll n;
    cin>>n;
    string a;
    ll ac=0,wa=0,tle=0,re=0;
    for(int i =0 ;i < n ; i++)
    {
        cin>>a;
        if(a=="AC")ac+=1;
        if(a=="TLE")tle+=1;
        if(a=="RE")re+=1;
        if(a=="WA")wa+=1;
        
    }
    cout<<"AC x "<<ac;
    cout<<"\nWA x "<<wa;
    cout<<"\nTLE x "<<tle;
    cout<<"\nRE x "<<re;
}

Measured memory_bytes: 3596
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
  long long n;cin>>n;
  long long nw = 1;
  string s = "";
  while(n != 0){
    nw *= -2;
    if(n%nw){
      s.push_back('1');
      n = n-nw/-2;
    }else{
      s.push_back('0');
    }
    //cout << n << endl;
  }
  if(s==""){
    cout << 0 << endl;
  }else{
    reverse(s.begin(),s.end());
    cout << s << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n)  for (int i = 0; i < (int) (n); i++)
#define REP1(i, n) for (int i = 1; i <= (int) (n); i++)
#define all(x)     (x).begin(), (x).end()
#define SZ(x)      ((int) (x).size())
using ll = long long;
const ll mod = 1e9 + 7;

int main() {
  int n;
  cin >> n;
  bool ans = true;
  for (int i = 0; i < n; i++) {
	  int a;
	  cin >> a;
	  if (a % 2 == 0 && (a % 3 != 0 && a % 5 != 0)) {
		  ans = false;
		  break;
		}
	}
  if (ans) {
	  cout << "APPROVED" << endl;
	} else {
	  cout << "DENIED" << endl;
	}
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h> 
using namespace std;
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define sz(x) (int)(x).size()
typedef vector<int> vi;
// #define ll long long 
#define int long long
#define ld long double
#define fi first
#define se second
#define pb push_back
#define pii pair<int,int>
#define all(x) (x).begin(), (x).end()
const int MOD = 1e9+7;
int mpow(int a,int b,int p=MOD){a=a%p;int res=1;while(b>0){if(b&1)res=(res*a)%p;a=(a*a)%p;b=b>>1;}return res%p;}
const int N=1e5+2;
int fac[N];
int add(int a,int b)
{
      a+=b;
      if(a>=MOD) a-=MOD;
      return a;
}
int sub(int a,int b)
{
      a-=b;
      if(a<0) a+=MOD;
      return a;
}
int mul(int a,int b)
{     
      return ((long long)a*b)%MOD;
}
int rev(int a)
{
	return mpow(a,MOD-2);
}
int nck(int n,int k)
{
	if(k>n) return 0;
	int ans=fac[n];
	ans=mul(ans,rev(fac[k]));
	ans=mul(ans,rev(fac[n-k]));
	return ans;
}
int32_t main(){
      ios_base::sync_with_stdio(false);
      cin.tie(NULL);

      fac[0]=1;
      for(int i=1;i<N;i++) fac[i]=(fac[i-1]*i)%MOD;
      int n,k;
      cin>>n>>k;
      int ans1=0,ans2=0;
      int a[n];
      for(int i=0;i<n;i++)
      {
      	cin>>a[i];
      }
      // int ans=0;
      sort(a,a+n);
      for(int i=0;i<n;i++)
      {
      	int v=a[i];
      	int j=i;
      	while(j<n&&v==a[j]) j++;
      	int cnt=j-i;
      	// cout<<cnt<<" ";
      	for(int kk=1;kk<=cnt;kk++)
      	{
      		if(kk>k) continue;
      		ans1=add(ans1,mul(v,mul(nck(cnt,kk),nck(i,k-kk))));
      		// cout<<ans<<" ";
      		ans2=add(ans2,mul(v,mul(nck(cnt,kk),nck(n-j,k-kk))));
      		// cout<<mul(v,mul(nck(cnt,kk),nck(n-j,k-kk)))<<" ";
      		// cout<<ans<<" ";
      	}
      	// break;
      	// cout<<ans<<" ";
      	i=j-1;
      }
      // cout<<ans2<<" ";
      cout<<(ans1-ans2+MOD)%MOD;
} 
// I never lose. I either win or I learn

Measured memory_bytes: 1792
import sys
L=list(input())
c=len(L)
for i in range(c):
  if i%2==0:
    if L[i]!="R" and L[i]!="D" and L[i]!="U":
      print("No")
      sys.exit()
  else:
    if L[i]!="L" and L[i]!="D" and L[i]!="U":
      print("No")
      sys.exit()
print("Yes")

Measured memory_bytes: 3060
import java.util.*;

class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        List<Integer> answer = new ArrayList<Integer>();

        while(true){
            int n = sc.nextInt();
            int r = sc.nextInt();

            if(n == 0 && r == 0){
                break;
            }

            List<Integer> card = new ArrayList<Integer>();
            for(int i = n-1; i >= 0; i--){
                card.add(i+1);
            }

            for(int i = 0; i < r; i++){
                int p = sc.nextInt();
                int c = sc.nextInt();

                int[] tmp = new int[c];
                for(int j = 0; j < c; j++){
                    tmp[j] = card.get(p-1);
                    card.remove(p-1);
                }
                for(int j = tmp.length-1; j >= 0; j--){
                    card.add(0, tmp[j]);
                }
            }
            System.out.println(card.get(0));
        }
        // for(int i = 0; i < answer.size(); i++){
        //     System.out.println(answer.get(i));
        // }
    }
}

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

signed main(){
	int n,m,a[5000],b[200][5000],ma = 0,num[5010][5010] = {};
	cin >> n >> m;
	for(int i = 0;i < n - 1;i++) cin >> a[i];
	for(int i = 0;i < n;i++){
		for(int j = 0;j < m;j++) cin >> b[j][i];
	}
	for(int i = 0;i < m;i++){
		int l[5000],r[5000];
		stack<int> st;
		for(int j = 0;j < n;j++){
			while(!st.empty() && b[i][st.top()] < b[i][j]) st.pop();
			if(st.empty()) l[j] = 0;
			else l[j] = st.top() + 1;
			st.push(j);
		}
		while(!st.empty()) st.pop();
		for(int j = n - 1;j >= 0;j--){
			while(!st.empty() && b[i][st.top()] <= b[i][j]) st.pop();
			if(st.empty()) r[j] = n - 1;
			else r[j] = st.top() - 1;
			st.push(j);
		}
		for(int j = 0;j < n;j++){
			num[l[j]][j] += b[i][j];
			num[l[j]][r[j] + 1] -= b[i][j];
			num[j + 1][j] -= b[i][j];
			num[j + 1][r[j] + 1] += b[i][j];
		}
	}
	for(int i = 0;i < n;i++){
		for(int j = 0;j < n;j++){
			if(i && j) num[i][j] -= num[i - 1][j - 1];
			if(i) num[i][j] += num[i - 1][j];
			if(j) num[i][j] += num[i][j - 1];
		}
	}
	for(int i = 0;i < n;i++){
		int sum = 0;
		for(int j = i;j < n;j++){
			ma = max(ma,num[i][j] - sum);
			sum += a[j];
		}
	}
	cout << ma << endl;
	return 0;
}

Measured memory_bytes: 204288
import heapq
N, M = map(int, input().split())
value = [[] for _ in range(10 ** 5 + 1)]

for _ in range(N):
    a, b = map(int, input().split())
    value[a].append(-1 * b)

koho = value[1]
heapq.heapify(koho)

ans = 0
for i in range(1, M + 1):
    if len(koho) > 0:
        ans += -1 * heapq.heappop(koho)
    if i < M:
        for v in value[i + 1]:
            heapq.heappush(koho, v)

print(ans)
        

Measured memory_bytes: 71840
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
    ll a,b,c,d,e,i,j,k,l,n,m,x,y,t,p;
    cin>>n;
    string st;
    a=b=c=d=0;
    for(i=0;i<n;i++)
    {
        cin>>st;
        if(st=="AC")
        {
            a++;
        }
        else if(st=="WA")
        {
            b++;
        }
        else if(st=="TLE")
        {
            c++;
        }
        else if(st=="RE")
        {
            d++;
        }
    }
    printf("AC x %lld\n",a);
    printf("WA x %lld\n",b);
    printf("TLE x %ld\n",c);
    printf("RE x %lld\n",d);
}


Measured memory_bytes: 3724
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
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() {
  int N, K;
  cin >> N >> K;
  double ans = 0;
  double e = 0;
  vector<double> p(N);
  for (int i = 0; i < (int)N; ++i) cin >> p[i];

  for (int i = 0; i < (int)N; ++i) {
    e += (1.0 + p[i]) / 2;
    if (i >= K) e -= (1.0 + p[i - K]) / 2;
    chmax(ans, e);
  }

  printf("%.10lf\n", ans);
  return 0;
}


Measured memory_bytes: 1792
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
using namespace std;

#define MAXN ((int)2e5+5)
#define MOD ((int)1e9 + 7) 
#define ll long long
#define _ << " " <<
#define TRACE(x) cerr << #x << " = " << x << endl;
#define pb push_back
#define all(x) x.begin(), x.end()
#define endl "\n"

int n,m,t;
int k[MAXN];
int dp[(int)1e4+5][105][2];
// dp [idx][%D][tight]
string s;
int ct;

int add(int&a,int b)
{
	a+=b;
	if(a>MOD)
		a-=MOD;
	if(a<0)
		a+=MOD;
	return a;
}

int rec(int idx,int sum,int tight=true)
{
	if(dp[idx][sum][tight] != -1) return dp[idx][sum][tight];
	if(idx == s.size())
	{
		if((sum%m) == 0)
			return dp[idx][sum][tight] = 1;
		return dp[idx][sum][tight] = 0;
	}

	int res=0;
	if(tight)
	{
		for (int i = 0; i < k[idx]; ++i)
			add(res,rec(idx+1,(sum+i)%m,false));
		add(res,rec(idx+1,(sum+k[idx])%m,true));
	}
	else
	{
		for (int i = 0; i <= 9; ++i)
			add(res,rec(idx+1,(sum+i)%m,false));
	}
	return dp[idx][sum][tight] = res;
}

int main()
{
	ios_base::sync_with_stdio(false);cin.tie(0);
	// clock_t tStart = clock();
	cin >> s >> m;

	for (int i = 0; i <= (int)s.size(); ++i)
	{
		for (int j = 0; j < m; ++j)
		{
			dp[i][j][0] = -1; 
			dp[i][j][1] = -1; 
		}
	}

	for (int i = 0; i < (int)s.size(); ++i)
		k[i] = s[i] - '0';
	int a = rec(0,0,1);
	cout << a-1 << endl;//counts 0
	// printf("Time taken: %.6fs\n", (double)(clock() - tStart)/CLOCKS_PER_SEC);
	return 0;
}


Measured memory_bytes: 9600
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0;i<(n);i++) //リピート
using namespace std;
typedef long long ll; //long longをllとして簡略

int main(){
      int n;
      cin >> n;
      vector<int> p(n),q(n); //領域確保vectorで長さ調整
      rep(i,n) cin >> p[i];
      rep(i,n) cin >> q[i];
      vector<int> a(n);
      rep(i,n) a[i] = i+1; //?
 
      map<vector<int>, int> mp;
      do {
            mp[a] = mp.size();
      } while (next_permutation(a.begin(), a.end()));
 
      int ans = abs(mp[p] - mp[q]);
      cout << ans << endl; //シーout、アンサー、エンドライン
      return 0;
}

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

#define rep(i, a, b) for (int i = a; i < (b); i++)
#define int long long
#define DBG 1
using VI = vector<int>;
using VVI = vector<VI>;
void solve(int N) {
  VI w(N);
  rep(i, 0, N) { cin >> w[i]; }

  VVI dp(N + 1, VI(N + 1, 0));

  rep(d, 2, N + 1) {
    rep(i, 0, N) {
      int k = i + d;
      if (k > N)
        break;
      rep(p, i, k) { dp[i][k] = max(dp[i][k], dp[i][p] + dp[p][k]); }
      if (abs(w[i] - w[k - 1]) <= 1 and dp[i + 1][k - 1] == k - i - 2) {
        dp[i][k] = max(dp[i][k], dp[i + 1][k - 1] + 2);
      }
    }
  }
  cout << dp[0][N] << endl;
}

signed main(void) {
  while (1) {
    int n;
    cin >> n;
    if (n == 0)
      break;
    solve(n);
  }
}



Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define uli unsigned long long int
#define INF 99999999999
#define rep(i,m,n) for(lli i = m;i < n;i++)
#define rrep(i,m,n) for(lli i=m-1;i>=n;i--)
#define pb(n) push_back(n)
#define UE(N) N.erase(unique(N.begin(),N.end()),N.end());
#define Sort(n) sort(n.begin(), n.end())
#define Rev(n) reverse(n.begin(),n.end())
#define Out(S) cout << S << endl
#define NeOut(S) cout << S
#define HpOut(S) cout << setprecision(20) << S << endl
#define Vecpr(K,L1,L2,N) vector<pair<L1,L2>> K(N)
#define Vec(K,L,N,S) vector<L> K(N,S)
#define DV(K,L,N,M,R) vector<vector<L>> K(N, vector<L>(M,R))
#define pint pair<int,int>
#define Lower(v,X) lower_bound(v.begin(),v.end(),X)-v.begin();
#define mod 1000000007
#define MAX 5100000
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int main(){
   lli A,B,C,L,R,N,M,K,X=0,Y=0,W,H=INF,sum=0,num=0,flag=0;string S,T,O;
   cin >> N >> C >> K;
   Vec(P,lli,N,0);
   rep(i,0,N)cin >> P[i];
   Sort(P);
   num=P[0]+K;//num=6
   X=C-1;//X=2
   rep(i,1,N){
      if(P[i]>num||i>X){
         flag=0;
         sum++;
         num=P[i]+K;
         X=i+C-1;
      }
   }
   Out(sum+1);
}

Measured memory_bytes: 1024
s = list(input())
n = len(s)

from itertools import product
sign = ['+','']
signs = list(product(sign, repeat=(n-1)))
signs = list(list(_) for _ in signs)

S = []
for i in range(len(signs)):
    temp = [s[0]]
    s_copy = s[:]
    for j in range((n-1)*2):
        if j % 2 == 0:
            temp += [signs[i].pop(0)]
        else:
            temp += [s_copy.pop(1)]
    else:
        S += [temp]

x = 0
for k in range(len(signs)):
    x += eval(''.join(S[k]))

print(x)

Measured memory_bytes: 3316
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
  ll n;cin>>n;
  ll sum[n];
  ll a[n];
  ll e=100000000000000;
  for(ll i=0;i<n;i++){
    cin>>a[i];
    if(i==0)sum[0]=a[0];
    if(i>0)sum[i]=sum[i-1]+a[i];
  }
  for(ll num=1;num<n-2;num++){
    ll u=num;
    ll d=0;
    while(u-d>2){
      ll r=(2*u+d)/3;
      ll l=(u+2*d)/3;
      ll sar=sum[num]-sum[r];
      ll sal=sum[num]-sum[l];
      if(abs(sum[r]-sar)<=abs(sum[l]-sal)){
        d=l;
      }
      else{
        u=r;
      }
    }
    ll numm;
    ll mmi=100000000000000;
    for(ll i=d;i<=u;i++){
      ll sa=sum[num]-sum[i];
      if(abs(sum[i]-sa)<mmi){
        mmi=abs(sum[i]-sa);
        numm=i;
      }
    }
    u=n-1;
    d=num+1;
    while(u-d>2){
      ll r=(2*u+d)/3;
      ll l=(u+2*d)/3;
      ll sar=sum[n-1]-sum[r];
      ll sal=sum[n-1]-sum[l];
      if(abs(sum[r]-sum[num]-sar)<=abs(sum[l]-sum[num]-sal)){
        d=l;
      }
      else{
        u=r;
      }
    }
  ll nummm;
  ll mmmi=100000000000000;
  for(ll i=d;i<=u;i++){
    ll sa=sum[n-1]-sum[i];
    //cout<<sum[i]<<" "<<sa<<endl;
    if(abs(sum[i]-sum[num]-sa)<mmmi){
      mmmi=abs(sum[i]-sum[num]-sa);
      nummm=i;
    }
  }
  ll ans[4];
  //cout<<num<<" "<<numm<<" "<<nummm<<endl;
  ans[0]=sum[numm];
  ans[1]=sum[num]-sum[numm];
  ans[2]=sum[nummm]-sum[num];
  ans[3]=sum[n-1]-sum[nummm];
  sort(ans,ans+4);
  //for(ll i=0;i<4;i++)cout<<ans[i]<<" ";
  //cout<<""<<endl;
  e=min(e,ans[3]-ans[0]);
  }
  cout<<e<<endl;
}

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

int main() {
  long long N;
  long long B;
  string S="abcdefghijklmnopqrstuvwxyz";
  string A="";
  cin >> N;
  int count=0;
  while(N>0){
    B=N%26-1;
    if(B==-1) B=25;
    N=(N-1)/26;
    A+=S.at(B);
    count++;
    //cout << "B=" << B << "N=" << N << endl;
  }
  reverse(A.begin(), A.end());
  cout << A << endl;
  return 0;
}

Measured memory_bytes: 3600
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main() {
    long long n; 
    cin>>n ;
    long long a[n+1];
    for(int i =1; i <= n; i++){
        cin>>a[i];
    }
    int dp[n+1];
    dp[1] = 0; 
    for(int i =2; i<=n; i++){
    int op1 = abs(a[i] - a[i-1]) + dp[i-1];
    int op2 = (i==2) ? INT_MAX:abs(a[i] - a[i-2]) + dp[i-2];
    dp[i] = min(op1,op2);
    }
    cout<<dp[n]<<endl; 
}


Measured memory_bytes: 4784
//const int N = 305;
//int dist[N][N];
//ll _(){
//    int n;
//    cin >> n;
//    rep(i,1,n)
//        rep(j,1,n)
//            cin >> dist[i][j];
//    rep(k,1,n)
//        rep(i,1,n)
//            rep(j,1,n)
//                if(dist[i][j] > dist[i][k] + dist[k][j])
//                    return -1;
//    ll ans = 0;
//    rep(i,1,n)
//        rep(j,i+1,n){
//            bool found = false;
//            rep(k,1,n)
//                if(k != i && k != j)
//                    if(dist[i][j] == dist[i][k]+dist[k][j])
//                        found = true;
//            if(!found)
//                ans += dist[i][j];
//        }
//    return ans;
//}
#include <iomanip>
#include <vector>
#include <utility>
#include <iostream>
#include <string>
#define REP_INT(i,l,r) for(int i = l; i <= r; ++i)
#define GET_REP_MACRO(_1,_2,_3,_4,NAME,...) NAME
#define rep(...) GET_REP_MACRO(__VA_ARGS__,REP_ANY,REP_INT)(__VA_ARGS__)
#define all(v) (v).begin(), (v).end()
#define T1 template<typename T> static
using namespace std;
typedef long long ll;
T1 ostream& operator<<(ostream& stream, const vector<T>& t);
T1 istream& read(T, T, istream& = cin);
const int N = 305;
int dist[N][N];
ll _(){
    int n;
    cin >> n;
    rep(i,1,n)
        rep(j,1,n)
            cin >> dist[i][j];
    rep(k,1,n)
        rep(i,1,n)
            rep(j,1,n)
                if(dist[i][j] > dist[i][k] + dist[k][j])
                    return -1;
    ll ans = 0;
    rep(i,1,n)
        rep(j,i+1,n){
            bool found = false;
            rep(k,1,n)
                if(k != i && k != j)
                    if(dist[i][j] == dist[i][k]+dist[k][j])
                        found = true;
            if(!found)
                ans += dist[i][j];
        }
    return ans;
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(15);
        cout << _() << '\n';
}


Measured memory_bytes: 768
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int C = sc.nextInt();
		if ((A + B) >= C) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}


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

#define FIO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define ll long long
#define all(v) v.begin(),v.end()
#define mod %
#define pb push_back

const ll N = (ll)(100007);

int dist[N][2];
vector<int> adj[N];
vector<int> leaves;

void dfs(int i, int p, int ty) {
	cerr << i << " " << p << "\n";
	if(ty == 0) {
		if(adj[i].size() == 1 && adj[i][0] == p) {
			leaves.push_back(i);
		}
	}
	for(auto j : adj[i]) {
		if(j == p) continue;
		dist[j][ty] = dist[i][ty] + 1;
		dfs(j, i, ty);
	}
}

int main()
{
	FIO
	int n, u, v;
	cin >> n >> u >> v;
	int m = n-1;

	while(m--) {
		int x, y;
		cin >> x >> y;
		adj[x].pb(y);
		adj[y].pb(x);
	}

	// if(adj[u].size() == 1 && adj[u][0] == v) {
	// 	cout << 0 << "\n";
	// 	return 0;
	// }

	dfs(v, 0, 0);
	dfs(u, 0, 1);
	int mx = 0;
	for(auto i : leaves) {
		if(dist[i][0] > dist[i][1]) {
			mx = max(dist[i][0] - 1, mx);
		}
	}
	cout << mx << "\n";
	return 0;	
}

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

 

int main()
{ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string s;
     
    cin>>s;
    if(s[s.size()-1]=='s')
    {
    	cout<<s<<"es"<<endl;
    }
    else
    {
    	cout<<s<<"s"<<endl;
    }
	return 0;

}

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

#define finish(i) return cout << i, 0;

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

    int n, a, b, c, d;
    string s;
    cin >> n >> a >> b >> c >> d >> s;
    a--, b--, c--, d--;
    s[a] = 'a';
    s[b] = 'b';

    if (c < d) {
        while (b != d) {
            if (b + 1 <= d && s[b + 1] == '.')
                s[b] = '.', s[b + 1] = 'b', b++;
            else if (b + 2 <= d && s[b + 2] == '.')
                s[b] = '.', s[b + 2] = 'b', b += 2;
            else
                finish("No\n");
        }

        while (a != c) {
            if (a + 1 <= c && s[a + 1] == '.')
                s[a] = '.', s[a + 1] = 'a', a++;
            else if (a + 2 <= c && s[a + 2] == '.')
                s[a] = '.', s[a + 2] = 'a', a += 2;
            else
                finish("No\n");
        }
    } else {
        while (a != c || b != d) {
            if (a + 1 <= c && s[a + 1] == '.')
                s[a] = '.', s[a + 1] = 'a', a++;
            else if (a + 2 <= c && s[a + 2] == '.')
                s[a] = '.', s[a + 2] = 'a', a += 2;
            else if (b + 1 <= d && s[b + 1] == '.')
                s[b] = '.', s[b + 1] = 'b', b++;
            else if (b + 2 <= d && s[b + 2] == '.')
                s[b] = '.', s[b + 2] = 'b', b += 2;
            else
                finish("No\n");
        }
    }

    cout << "Yes\n";

    return 0;
}

Measured memory_bytes: 592
import java.util.Scanner;

public class Main {

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

		if (n % 2 == 1) {
			System.out.println("No");
			return;
		}
		int half = n / 2;
		String first = s.substring(0, half);
		String second = s.substring(half);
		System.out.println(first.equals(second) ? "Yes" : "No");
	}

}

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

int main() {
  char c; cin >> c;
  string vowel = "aeiou";
  string ans = "consonant";
  for (int i = 0; i < 5; i++) {
    if (vowel.at(i) == c) {
      ans = "vowel";
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
import java.io.PrintWriter
val pw = PrintWriter(System.out)

fun main(args : Array<String>) {
    func()
    pw.flush()
}

fun func() {
    val water = listOfInt()
    var restOfWater = water[2] - (water[0]-water[1])
    if (restOfWater < 0) {
        restOfWater = 0
    }
    println(restOfWater);
}

fun next() = readLine()!!
fun nextInt() = next().toInt()
fun listOfString() = next().split(" ")
fun listOfInt() = listOfString().map { it.toInt() }

fun println(value : Any) {
    pw.println(value)
}

Measured memory_bytes: 37564
[A,B,C,N]=[int(i) for i in input().split()]
X=[A,B,C]
X.sort()
[C,B,A]=X
cnt=0
for i in range(N//A+1):
  k=N-(i*A)
  for j in range(k//B+1):
    if (k-(B*j))%C==0:
    	cnt+=1
print(cnt)

Measured memory_bytes: 64804