akhauriyash/Code-Regression huggingface dataset:
import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.container;

void main()
{
	foreach (line; stdin.byLine) {
		auto x = line.chomp.array;
		auto field = new int[](9);

		foreach (i, e; x) {
			if (e == 'o') field[i] = 1;
			else if (e == 'x') field[i] = -1;
			else field[i] = 0;
		}

		int res;
		foreach (i; 0..3) {
			auto a = field[i*3] + field[i*3+1] + field[i*3+2];
			auto b = field[i] + field[i+3] + field[i+6];
			if (a == 3 || b == 3) res = 1;
			else if (a == -3 || b == -3) res = -1;
		}

		auto a = field[0] + field[4] + field[8];
		auto b = field[2] + field[4] + field[6];
		if (a == 3 || b == 3) res = 1;
		else if (a == -3 || b == -3) res = -1;

		if (res == 1) writeln("o");
		else if (res == -1) writeln("x");
		else writeln("d");
	}
}

Measured memory_bytes: 1108
#include<bits/stdc++.h>
using namespace std;
#define w(t) int t;cin>>t;while(t--)
#define pb   push_back
#define mk   make_pair
#define u_s  unordered_set
#define endl "\n"
#define prDouble(x) cout<<fixed<<setprecision(10)<<x
#define ll long long int
#define ipair pair<int,int>
#define all(x) (x).begin(), (x).end()

const int mod=pow(10,9)+7;

bool compare(pair<int,int>p1,pair<int,int>p2){
    return p1.second<p2.first;
}
/*
  ll C(ll n,ll k){
  
  if(k>n)return 0;
  
  ll ans=1;

  if(k>n-k)
    k=n-k;
  for(ll i=1;i<=k;i++)
    ans*=(n-i+1),ans/=i;

  return ans;
  }
  unsigned long long fact(long long a)
  {
  unsigned long long res=1;
  for(long long i=a;i>0;i--)
    res*=i;
  return res;
  }
  unsigned long long comb(long long a,long long b)
  {
  if((a-b)<b) b=a-b;
  if(a<=19) return fact(a)/(fact(a-b)*fact(b));
  if(a==b||b==0) return 1;
  if(b==1) return a;
  return comb(a-1,b-1)+comb(a-1,b);
  }
*/

struct item{
  ll wt,val;
};

void solve(vector<item>&A,ll n,ll W){
     
    ll dp[n+1][W+1];
    
    memset(dp,0,sizeof dp);

    dp[1][A[1].wt]=A[1].val;

    for(ll i=2;i<=n;i++){

        for(ll w=0;w<=W;w++){

            dp[i][w]=dp[i-1][w];

            if(A[i].wt>w)continue;

            dp[i][w]=max( A[i].val+dp[i-1][w-A[i].wt],dp[i][w]);
        }
    }

    cout<<*max_element(dp[n],dp[n]+W+1);
} 
int main(){

    ios_base::sync_with_stdio(false); 
    cin.tie(nullptr); 
    cout.tie(nullptr);
    
    ll n,w; cin>>n>>w;
    
    vector<item>A(n+1);

    for(int i=1;i<=n;i++)cin>>A[i].wt>>A[i].val;

    solve(A,n,w);

    return 0;  
    
}


Measured memory_bytes: 82464
#include <stdio.h>
#include <limits.h>
void matrixChainOrder(int);
int min(int ,int);
int p[105];
int m[105][105];
int main()
{
	int n,i,trash;
	scanf("%d",&n);
	scanf("%d%d",&p[0],&p[1]);
	for(i=2;i<=n;i++) scanf("%d%d",&trash,&p[i]);
	//for(i=0;i<n;i++)	printf("%d\n",p[i]);
	matrixChainOrder(n);
	return 0;
}

void matrixChainOrder(int n)
{
	int i,j,k,l,q;
	for(i=1;i<=n;i++) m[i][i] = 0;
	//for(i=0;i<n;i++)	printf("mm %d\n",m[i][i]);
	for(l=2;l<=n;l++) 
	{
	for(i=1;i<=n-l+1;i++) 
		{
		j = i+l-1;
		m[i][j] = INT_MAX;
		for(k=i;k<=j-1;k++) 
			{
			q = m[i][k] + m[k+1][j] + p[i-1] * p[k] * p[j];
			m[i][j] = min(m[i][j],q);
			//printf("ans %d %d  %d\n",i,j,m[i][j]);
			}
		}
	}
	printf("%d\n",m[1][n]);
}

int min(int p,int q)
{
if(p < q) return p;
return q;
}

Measured memory_bytes: 640
#include<iostream>
#include<algorithm>

using namespace std;

int main()
{
	int n,S;cin>>n>>S;
	int a[100000];
	for(int i=0;i<n;i++)cin>>a[i];
	int ans=n+1;
	for(int s=0,t=0,sum=0;;ans=min(ans,t-s),sum-=a[s++])
	{
		while(t<n&&sum<S)sum+=a[t++];
		if(sum<S)break;
	}
	if(ans>n)cout<<0<<endl;
	else cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3472
#include <bits/stdc++.h>
#define x first
#define y second
#define y1 WHO_DEFINE_Y1_IN_HEADER
#define all(v) v.begin(), v.end()
using namespace std;

typedef long long ll;
typedef pair<ll, ll> p;

int main(){
	ios_base::sync_with_stdio(0); cin.tie(0);
	priority_queue<ll> pq;
	int n, m; cin >> n >> m;
	for(int i=1; i<=n; i++){
		ll t; cin >> t; pq.push(t);
	}
	
	for(int i=0; i<m; i++){
		ll t = pq.top(); pq.pop();
		pq.push(t/2);
	}
	ll ans = 0;
	while(pq.size()){
		ans += pq.top(); pq.pop();
	}
	cout << ans;
}

Measured memory_bytes: 1400
#!/usr/bin/env ruby

require 'set'

class Hash
  def push(key, value)
    self[key] = [] if self[key] == nil
    self[key].push(value)
  end
end

class Array
  def lower_bound(value)
    left = -1;
    right = self.length;
    while left + 1 < right
      mid = left + (right - left) / 2;
      if self[mid] >= value
        right = mid
      else
        left = mid
      end
    end
    right
  end

  def unique
    res = [self.first]
    each_cons(2) do |a, b|
      if a != b
        res.push(b)
      end
    end
    res
  end
end

def get_ints
  gets.chomp.split.map(&:to_i)
end

def get_ints_minus_one
  get_ints.map { |x| x - 1 }
end

def get_int
  gets.chomp.to_i
end

S = gets.chomp

puts S.split('').to_set.length == 3 ? 'Yes' : 'No'


Measured memory_bytes: 14376
import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
from collections import defaultdict
def main():
    s = tuple(map(int, input()))
    lens = len(s)

    d1 = defaultdict(int)
    ss = 0
    k = 1
    num10 = 1
    while k <= lens:
        ss += (int(s[-k]) * num10) % 2019
        ss = ss % 2019
        d1[ss] += 1
        k += 1
        num10 = (num10 * 10) % 2019
    r = d1[0]
    for v in d1.values():
        r += v * (v - 1) // 2
    print(r)

if __name__ == '__main__':
    main()

Measured memory_bytes: 87652
defmodule Main do
  def main do
    n = IO.gets("") |> String.trim() |> String.to_integer()
    s = IO.gets("") |> String.trim()

    if String.length(s) <= n do
      IO.puts(s)
    else
      target = String.slice(s, 0..(n - 1))
      IO.puts(target <> "...")
    end
  end
end

Measured memory_bytes: 31288
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.util.NoSuchElementException;

public class Main {
    private static PrintWriter out;
    private static FastScanner in;

  	private static void solve(){
        int n = in.nextInt();
        if(n == 3 || n == 5 || n == 7)
            out.println("YES");
        else
            out.println("NO");
    }


	public static void main(String[] args){
        out = new PrintWriter(System.out);
        in = new FastScanner(System.in);
        solve();
        out.flush();
    }


    private static class FastScanner {
        private InputStream in;
        private byte[] buffer = new byte[1024];
        private int bufPointer, bufLength;

        public FastScanner(InputStream in) {
            this.in = in;
        }

        private int readByte() {
            if(bufLength == -1)
                throw new InputMismatchException();
            if (bufPointer >= bufLength) {
                bufPointer = 0;
                try {
                    bufLength = in.read(buffer);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (bufLength <= 0)
                    return -1;
            }
            return buffer[bufPointer++];
        }

        private static boolean isPrintableChar(int c) {
            return (c >= 33 && c <= 126);
        }

        private static boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public String next() {
            StringBuilder sb = new StringBuilder();
            int b = readByte();
            while(!isPrintableChar(b))
                b = readByte();
            while(isPrintableChar(b)){
                sb.appendCodePoint(b);
                b = readByte();
            }
            return sb.toString();
        }

        public long nextLong(){
            long n = 0;

            int b = readByte();
            while(isSpaceChar(b))
                b = readByte();

            boolean minus = (b == '-');
            if (minus)
                b = readByte();

            while(b >= '0' && b <= '9'){
                n *= 10;
                n += b - '0';
                b = readByte();
            }

            if (!isSpaceChar(b))
                throw new NumberFormatException();

            return minus ? -n : n;
        }

        public int nextInt(){
            int n = 0;

            int b = readByte();
            while(isSpaceChar(b))
                b = readByte();

            boolean minus = (b == '-');
            if (minus)
                b = readByte();

            while(b >= '0' && b <= '9'){
                n *= 10;
                n += b - '0';
                b = readByte();
            }

            if (!isSpaceChar(b))
                throw new NumberFormatException();

            return minus ? -n : n;
        }

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


}


Measured memory_bytes: 21204
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,a) for(int i=0;i<(a);i++)
const ll MOD=1000000007;
// const ll MOD=998244353;

int main(){
  ll N,A,B; cin>>N>>A>>B;
  ll ans=LLONG_MAX;
  if((B-A)%2==0) ans=min(ans,(B-A)/2);
  else{
    ans=min(ans,A+(B-A-1)/2);
    ans=min(ans,N-B+1+(N-(A+N-B+1))/2);
  }
  ans=min(ans,B-1);
  ans=min(ans,N-A);
  
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdint.h>
#include <tuple>
#include <utility>
#include <vector>
 
using namespace std;
 
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
static const double EPS = 1e-12;
static const double PI = acos(-1.0);
static const ll MOD = 1000000007;
 
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(a) (a).begin(), (a).end()
#define DEBUG(x) cout << #x << ": " << x << endl

int main() {
  long long R;
  scanf("%lld", &R);
  printf("%0.20f", 2 * PI * (double)R);
  return 0;
}

Measured memory_bytes: 3168
t = input()
# ansl = [t[0]]
# for i in range(len(t)-1):
#     # if t[i]+t[i+1] == ['PD', 'DD', 'D?', 'P?']:
#     if t[i]+t[i+1] in ['PD', 'DD']:
#         ansl.append(t[i+1])
#         t[i+1] = 'D'

#     elif t[i]+t[i+1] in ['D?']:
#         ansl.append('D')
#         t[i+1] = 'D'
#     elif t[i]+t[i+1] in ['P?']:
#         ansl.append('D')
#         t[i+1] = 'D'

#     else:
#         ansl.append(t[i+1])
# print(''.join(ansl))
t = t.replace('?', 'D')
print(t)


Measured memory_bytes: 63336
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using std::cerr;
using std::cin;
using std::cout;
using std::endl;

std::multiset<int64_t> left, right;
int64_t result = 0;

void Update() {
  int64_t a, b;
  cin >> a >> b;
  result += b;
  int64_t leftmax  = *(--left.end());
  int64_t rightmin = *(right.begin());
  if (left.empty()) {
    left.insert(a);
    right.insert(a);
  } else if (a < leftmax) {
    left.insert(a);
    left.insert(a);
    left.erase(--(left.end()));
    right.insert(leftmax);
  } else if (rightmin < a) {
    right.insert(a);
    right.insert(a);
    right.erase(right.begin());
    left.insert(rightmin);
  } else {
    left.insert(a);
    right.insert(a);
  }
  if (left.size() == 1 || (leftmax <= a && a <= rightmin)) {
    result += 0;
  } else if (rightmin < a) {
    result += (a - rightmin);
  } else {
    result += (leftmax - a);
  }
}
void Solve() {
  cout << *(--left.end()) << " " << result << endl;
}

int main(void) {
  cout << std::fixed << std::setprecision(10);
  cin.tie(0);
  std::ios::sync_with_stdio(false);
  int q;
  cin >> q;
  for (int i = 0; i < q; i++) {
    int num;
    cin >> num;
    if (num == 1) {
      Update();
    } else {
      Solve();
    }
  }

  return 0;
}


Measured memory_bytes: 19072
#include <stdio.h>
#include <stdlib.h>

int main(void){
	int n;
	long sum = 0, in;
	scanf("%d", &n);
	long *a = malloc(sizeof(long) * n);
	for(int i = 0; i < n; i++){
		scanf("%ld", a + i);
		if(i % 2 == 0)sum += a[i];
		else sum -= a[i];
	}
	sum /= 2;
	for(int i = 0; i < n; i++){
		printf("%ld ", sum * 2);
		sum = a[i] - sum;
	}
	return 0;
}


Measured memory_bytes: 2916
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
int n, ans;
string s;
int main(){
	cin >> n >> s;
	s += '%';
	rep(i,n) if(s[i] != s[i+1]) ans++;
	printf("%d\n", ans);
}

Measured memory_bytes: 512
#include <map>
#include <set>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstring>
#include <iomanip>
#include <utility>
#include <iostream>
#include <algorithm>

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

int n, x[N];

int main() {

	ios_base::sync_with_stdio(0);
	cin.tie(NULL);

	cin >> n;

	for (int i = 1; i <= n; i++) {
		cin >> x[i];
	}

	int place = 1;
	ll ans = 1;
	ll mod = 1e9 + 7;

	for (int i = 1; i <= n; i++) {
		if (x[i] >= 2 * (i - place) + 1) continue;
		ans *= ll(i - place + 1);
		ans %= mod;
		place++;
	}

	while (place <= n) {
		ans *= ll(n - place + 1);
		ans %= mod;
		place++;
	}

	cout << ans << endl;
	//system("pause");
	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i, N) for (int i = 0; i < N; i++)
using namespace std;
int main()
{
    int N, X, sum = 0;
    cin >> N >> X;
    vector<int> m(N);
    rep(i, N)
    {
        cin >> m[i];
        sum += m[i];
    }
    if (X == sum)
    {
        cout << N << endl;
        return 0;
    }
    sort(m.begin(), m.end());
    cout << (X - sum) / m[0] + N << endl;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<algorithm>
#include<queue>
#include<vector>
#include<set>
#include<set>
#include<map>
#include<ctime>
#include<iostream>
using namespace std;
const int maxn = 1e5 + 10;
int vis[maxn];
int main()
{
	int a,b,c,d,e;
	for( int i = 10000 ; i <= 99999 ; i++ ){
		vis[i] = 0;
		a = i / 10000;
		b = (i / 1000) % 10;
		c = (i / 100) % 10;
		d = (i / 10 ) % 10;
		e = i % 10;
		if( a == e )
			if( b == d )
				vis[i] = 1;
	}
	int A,B;
	while( ~scanf(" %d %d",&A,&B) ){
		int sum = 0;
		for( int i = A; i <= B ; i++ ){
			if( vis[i] == 1 )
				sum += 1;
		}
		printf("%d\n",sum);
	}
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<(n);++i)
#define sayyes cout<<"Yes"<<endl;
#define sayno cout<<"No"<<endl;
#define vv(a,b) vector< vector<int> > v(a,vector<int>(b,0));
using namespace std;
typedef long long ll;
typedef int itn;
typedef pair<int,int>P;
const int mod =1e9+7;

int main()
{
    int n;
    cin>>n;
    vector<ll> a(n);
    rep(i,n)
    {
        cin>>a[i];
    }
    sort(a.begin(),a.end());
    ll mx=a[n-1];
    int pos=upper_bound(a.begin(),a.end(),mx/2)-a.begin();
    //cout<<pos<<"ps"<<endl;
    int ans;
    if((double)a[pos]-(double)mx/2.0>=(double)mx/2.0-(double)a[pos-1])ans=pos-1;else ans=pos;
    cout<<a[n-1]<<" "<<a[ans];

}


Measured memory_bytes: 1024
# include "cstdio"
# include "iostream"

using namespace std;

const int maxm=1e2+10;
const long long Mod=1e9+7;

int N;
long long K;

struct Matrix{
	long long A[maxm][maxm];
	void Init(){
		register int i,j;
		for(i=1;i<=N;i++){
			for(j=1;j<=N;j++){
				A[i][j]=0;
			}
		}
		return;
	}
	void Prep(){
		register int i,j;
		for(i=1;i<=N;i++){
			for(j=1;j<=N;j++){
				A[i][j]=(i==j);
			}
		}
		return;
	}
	inline Matrix operator *(const Matrix x)const{
		register int i,j,k;
		register Matrix Result;
		Result.Init();
		for(i=1;i<=N;i++){
			for(j=1;j<=N;j++){
				for(k=1;k<=N;k++){
					Result.A[i][j]=(Result.A[i][j]+A[i][k]*x.A[k][j])%Mod;
				}
			}
		}
		return Result;
	}
}G,Ans;

int main(){
	register int i,j;
	register long long Result=0;
	scanf("%d%lld",&N,&K);
	Ans.Prep();
	for(i=1;i<=N;i++){
		for(j=1;j<=N;j++){
			scanf("%lld",&G.A[i][j]);
		}
	}
	while(K){
		if(K&1) Ans=Ans*G;
		G=G*G;
		K>>=1;
	}
	for(i=1;i<=N;i++){
		for(j=1;j<=N;j++){
			Result+=Ans.A[i][j];
		}
	}
	Result=(Result+Mod)%Mod;
	printf("%lld",Result);
	return 0;
}

Measured memory_bytes: 768
#include"bits/stdc++.h"
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
const long long mod = 100000;
const long long inf = 1ll << 61;
typedef pair<int, int> P;
typedef pair<int,P> PP;
typedef pair<int,PP> PPP;
struct edge { int to;  int cost; };

signed main() {
	int h, w; cin >> h >> w;
	int a, b; cin >> a >> b;
	cout <<h*w- a*w - b*h + a*b << endl;
	}

Measured memory_bytes: 384
N = int(input())
P = [0]*N
#B = [0]*N
for i in range(N):
  P[i] = list(map(int, input().split()))
  
P.sort(key=lambda x: x[1])
t = 0
ans = 'Yes'
for p in P:
  t += p[0]
  if t > p[1]:
    ans = 'No'
print(ans)

Measured memory_bytes: 53716
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int INF = 1e10;
const int MOD = 1e9 + 7;
#define dump(x) cout << #x << " = " << (x) << endl;
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define FORR(i, a, b) for (int i = (a); i <= (b); ++i)
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define P pair<int, int>
#define V vector<int>
#define itn int
#define tin int
#define tni int
bool dbg = false;
int N, K, A[600];
int a[600];
int SUM;
V v;
void solve()
{
    FOR(i, 0, N)
    {
        SUM += A[i];
    }
    for (int i = 1; i * i <= SUM; ++i) {
        if (SUM % i == 0) {
            v.push_back(i);
            if (i * i != SUM) {
                v.push_back(SUM / i);
            }
        }
    }
    int ans = 0;
    FOR(z, 0, (int)v.size())
    {
        int t = v[z];
        //dump(t);
        int SUM = 0;
        FOR(i, 0, N)
        {
            a[i] = A[i] % t;
            //dump(a[i]);
        }
        sort(a, a + N);
        int I = -1;
        FOR(i, 0, N)
        {
            if (SUM + a[i] <= K) {
                SUM += a[i];
                I = i;
            } else {
                break;
            }
        }
        //dump(I);
        SUM = 0;
        bool flag = true;
        FOR(i, I + 1, N)
        {
            SUM += t - a[i];
        }
        if (SUM <= K) {
            ans = max(ans, t);
        }
    }
    cout << ans << endl;
}

signed main()
{
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cin >> N >> K;
    FOR(i, 0, N)
    {
        cin >> A[i];
    }
    solve();
    return 0;
}


Measured memory_bytes: 256
#pragma GCC optimze("Ofast")
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define mod 1000000007
#define md 998244353
#define trace(...)
#define ll long long int
#define ld long double
#define fi first
#define se second
#define fr(i,a,b) for(ll i=a;i<=b;i++)
#define frr(i,b,a) for(ll i=b;i>=a;i--)
#define mem(a) memset(a, 0, sizeof(a))
#define vpi std::vector<pair<int,int>>
#define pii pair<int,int>
#define pb push_back
#define sall(v) sort(v.begin(),v.end())
#define all(v) (v.begin(),v.end())
#define minf -10000000
#define vi vector<int>
const ll infl=0x3f3f3f3f3f3f3f3fLL;
const int infi=0x3f3f3f3f;
typedef tree<pii, null_type, less<pii>, rb_tree_tag, tree_order_statistics_node_update> oset;
auto clk=clock();
mt19937_64 rang(chrono::high_resolution_clock::now().time_since_epoch().count());
int rng(int lim) {
    uniform_int_distribution<int> uid(0,lim-1);
    return uid(rang);
}
ll power(ll x, ll y,ll p) { 
    ll res = 1;      
    x = x % p;  
    while (y > 0) {  
        if (y & 1) 
            res = (res*x) % p;  
        y = y>>1; 
        x = (x*x) % p;   
    } 
    return res; 
}
ll power(ll x, ll y) { 
    ll res = 1;       
    while (y > 0) {    
        if (y & 1) 
            res = (res*x) ;  
        y = y>>1; 
        x = (x*x);   
    } 
    return res; 
}
 
ll max3(ll a,ll b,ll c){
    return max(a,max(b,c));
}
ll min3(ll a,ll b,ll c){
    return min(a,min(b,c));
}
bool isPrime(ll n) { // Corner cases 
    if (n <= 1) 
        return false; 
    if (n <= 3) 
        return true; 
    if (n % 2 == 0 || n % 3 == 0) 
        return false; 
    for (ll i = 5; i * i <= n; i = i + 6) 
        if (n % i == 0 || n % (i + 2) == 0) 
            return false; 
    return true; 
}

void solve(){
    ll n,x,y;cin>>n>>x>>y;
    ll arr[n+1][n+1];
    fr(i,0,n)fr(j,0,n)arr[i][j]=0ll;
    fr(i,1,n){
        fr(j,1,n){
            arr[i][j]=min3(abs(i-j),abs(x-i)+abs(y-j)+1,abs(x-j)+abs(y-i)+1);
        }
    }
    ll ans[n];
    fr(i,0,n-1)ans[i]=0ll;
    fr(i,1,n)fr(j,i+1,n)ans[arr[i][j]]++;
    fr(i,1,n-1)cout<<ans[i]<<endl;
    return;
}

int main(){
    ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    srand(chrono::high_resolution_clock::now().time_since_epoch().count());
    cout<<fixed<<setprecision(8);
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    #endif
    int t;
    // cin>>t;
    t=1;
    while(t--){
        solve();
    }
    #ifndef ONLINE_JUDGE
    cout<<endl<<endl<<endl<<endl<<"Time elapsed: "<<(double)(clock()-clk)/CLOCKS_PER_SEC<<endl;
    #endif
    return 0;
}

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

using namespace std;
using ll = long long;

const int MOD = 1e9 + 7;

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

    ll n, k;
    cin >> n >> k;

    vector<ll> a(n + 1), dp1(k + 1, 0), dp2(k + 1, 0);
    for(int i = 1; i <= n; i += 1)
        cin >> a[ i ];

    dp1[ 0 ] = 1;
    for(int i = 1; i <= n; i += 1) {
        dp2 = dp1;
        for(int j = 1; j <= k; j += 1) {
            dp1[ j ] = dp2[ j ] + dp1[ j - 1 ];
            if( j - a[ i ] - 1 >= 0 ) dp1[ j ] -= dp2[ j - a[ i ] - 1];
            dp1[ j ] = (dp1[ j ] % MOD + MOD) % MOD;
        }
    }
    cout << dp1[ k ] << '\n';
    return 0;
}


Measured memory_bytes: 1792
/*
        FFFFFFFFFFFFFFFFFFFFFF
        F::::::::::::::::::::F
        F::::::::::::::::::::F
        FF::::::FFFFFFFFF::::F
          F:::::F       FFFFFF
          F:::::F
          F::::::FFFFFFFFFF
          F:::::::::::::::F
          F:::::::::::::::F
          F::::::FFFFFFFFFF
          F:::::F
          F:::::F
        FF:::::::FF
        F::::::::FF
        F::::::::FF
        FFFFFFFFFFF
*/
#include <bits/stdc++.h>
using namespace std;
#define debug(...) cout<<__FUNCTION__<<":"<<__LINE__<<": ";debugger(#__VA_ARGS__, __VA_ARGS__);
template<typename arg>
void debugger(const char* varname, arg&& var) { cout<<varname<<" = "<<var<<endl; }
template<typename arg, typename... args>
void debugger(const char* varnames, arg&& var, args&&... vars) {
    const char* comma = strchr(varnames + 1, ',');
    cout.write(varnames, comma - varnames)<<" = "<<var<<" | ";
    int sz = 1; if(isspace(comma[sz])) sz++;
    debugger(comma + sz, vars...);
}
#define forr(i, s, n) for(ll i=(ll)(s); i<(ll)(n); ++i)
#define forn(i, n) forr(i, 0, n)
#define eb(n) emplace_back(n)
#define endl '\n'
#define fst first
#define snd second
using ll = long long;
using ii = pair<ll,ll>;
using vi = vector<ll>;
extern const int INF = INT_MAX - 5;
extern const ll LINF = LLONG_MAX - 5;
extern const int MOD = 1e9 + 7;
extern const int N = 2e5 + 200;

int main() {
    string s;
    cin>>s;
    map<char, int> mp;
    for(char i : s) {
        mp[i]++;
    }
    if(mp.size() == 2) puts("Yes");
    else puts("No");
    return 0;
}


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

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

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

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

    int a1 = 1 << 30, i1 = -1;
    for (int i = 0; i < n; i++) {
        int t = abs(s - a[i] * n);
        if (t < a1) {
            a1 = t;
            i1 = i;
        }
    }

    cout << i1 << endl;

    return 0;
}

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

#define int ll
#define rep(i,n) for(int i=0,i##_cond=(n);i<i##_cond;++i)
using ll  = long long;
using vi  = vector<int>;
using pii = pair<int,int>;
constexpr ll inf = 1ll<<61;

int n;
vi a(3);
vi l;

int f(int k, vector<pii> &tmp){
  if(k == n){
    if(tmp[0].second * tmp[1].second * tmp[2].second == 0) return inf;
    int res = 0;
    rep(i,3){
      res += 10 * (tmp[i].second - 1);
      res += abs(tmp[i].first - a[i]);
    }
    return res;
  }else{
    int res = inf;
    rep(i,4){
      tmp[i].first += l[k];
      tmp[i].second++;
      res = min(res, f(k+1, tmp));
      tmp[i].first -= l[k];
      tmp[i].second--;
    }
    return res;
  }
}

signed main(){
  cin >> n;
  rep(i,3) cin >> a[i];
  l.resize(n); rep(i,n) cin >> l[i];

  vector<pii> tmp(4);
  cout << f(0, tmp) << endl;
}

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

using namespace std;

typedef long long LL;
typedef pair<int , int> P2;
typedef pair<pair<int , int> , int> P3;
typedef pair<pair<int , int> , pair<int , int> > P4;
#define PB(a) push_back(a)
#define MP(a , b) make_pair((a) , (b))
#define M3P(a , b , c) make_pair(make_pair((a) , (b)) , (c))
#define M4P(a , b , c , d) make_pair(make_pair((a) , (b)) , make_pair((c) , (d)))
#define repp(i,a,b) for(int i = (int)(a) ; i < (int)(b) ; ++i)
#define repm(i,a,b) for(int i = (int)(a) ; i > (int)(b) ; --i)



int main(){
	int N; cin >> N;
	bool b = 0;
	repp(i,0,N){
		int a; cin >> a;
		if(a&1) b = 1;
	}
	cout << (b?"first":"second") << endl;
	return 0;
}


Measured memory_bytes: 256
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        a: i64,
        b: i64,
        t: i64,
    }

    let ans = t / a * b;

    println!("{}", ans);
}


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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define VIN(v) for(auto&elem_: (v) )cin>>elem_
#define VOUT(v, sep) for(_loop_int idx=0; idx<(_loop_int)v.size(); idx++) {cout<<v[idx]; if(idx<(_loop_int)v.size()-1) cout<<sep;} cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG2(x,y) cout<<#x<<": "<<x<<" "<<#y<<": "<<y<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(debugidx,v.size())cout<<" "<<v[debugidx];cout<<endl
#define DEBUG_ARR(v,n) cout<<#v<<":";REP(debugidx,n)cout<<" "<<v[debugidx];cout<<endl

const ll MOD = 1000000007ll;
const int IINF = numeric_limits<int>::max()/2-1;
const ll LINF = numeric_limits<ll>::max()/2-1;

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



int main() {
    ios::sync_with_stdio(false); cin.tie(0);
    string s;
    cin>>s;
    int n = s.size();
    vector<vl> dp(n+1,vl(13,0));
    dp[0][0]=1;

    REP(i,n){
        vi elem;
        if(s[i]=='?'){
            elem = {0,1,2,3,4,5,6,7,8,9};
        }else{
            elem = {s[i]-'0'};
        }

        REP(j,13){
            for(auto e:elem){
                dp[i+1][(j*10 + e) % 13] += dp[i][j];
                dp[i+1][(j*10 + e) % 13] %= MOD;
            }
        }
    }

    
    cout << dp[n][5] << endl;
    return 0;
}

Measured memory_bytes: 16644
#include<iostream>
#include<string>
#include<vector>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;

int main() {
	int X, Y, Z = 0;
	int K, S = 0;
	cin >> K >> S;
	int count = 0;
	rep(i, K+1) {
		X = i;
		rep(j, K+1) {
			Y = j;
			Z = S - X - Y;
			if (Z <= K && Z>=0) {
				count++;
			}
		}
	}
	cout << count << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int N;
    cin >> N;
    double v[N];
    for (int i = 0; i < N; i++)
    {
        cin >> v[i];
    }
    sort(v, v + N);
    for (int i = 0; i < N - 1; i++)
    {
        v[i + 1] = (v[i + 1] + v[i]) / 2;
    }
    cout << setprecision(10) << fixed << v[N - 1] << endl;
}

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

int main() {
  int n, ff, rr;
  cin >> n;
  ff = n / 100;
  rr = n % 100;
  if (1<=ff&&ff<13) {
    if (1<=rr&&rr<13) {
      cout << "AMBIGUOUS" << endl;
    }
    else cout << "MMYY" << endl;
  }
  else {
    if (1<=rr&&rr<13) {
      printf("YYMM\n");
    }
    else printf("NA\n");
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <map>

using namespace std;

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

    map<int, int> studentNumberByNumOfStudents;

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

    auto itr = studentNumberByNumOfStudents.begin();
    cout << itr->second;
    itr++;

    for (; itr != studentNumberByNumOfStudents.end(); itr++) {
        cout << " " << itr->second;
    }

    cout << endl;

    return 0;
}

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

#define ll long long
#define INF 99999999
#define rep(i,n) for(int i=0,temp=(int)(n);i<temp;++i) //vec.size()がnの時等の高速化
#define all(x) (x).begin(),(x).end()
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define vint vector<int>
#define vvint vector<vector<int>>

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 gcd(int a,int b){return b?gcd(b,a%b):a;}

int main(){
  int a,b,c; cin >> a >> b >> c;
  int ans=0;
  if(a>c || c==0) {ans=b+c; cout << ans << endl; return 0;}
  while(a>0){
    c--;a--;ans++;
  }
  if(b>c){ans+=b+c; cout << ans << endl; return 0;}
  while(b>0){
    c--;b--;ans+=2;
  }
  if(c>0)ans++;

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <tuple>
#include <sstream>
#include <vector>
#include <cmath>
#include <ctime>
#include <bitset>
#include <cassert>
#include <cstdio>
#include <queue>
#include <set>
#include <map>
#include <fstream>
#include <cstdlib>
#include <string>
#include <cstring>
#include <algorithm>
#include <numeric>

#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)

using namespace std;

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<i64, i64> pi64;
typedef double ld;

template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.precision(10);
    cout << fixed;
#ifdef LOCAL_DEFINE
    freopen("input.txt", "rt", stdin);
#endif

    int n, a, b;
    cin >> n >> a >> b;
    cout << ((b - a) % 2 ? "Borys" : "Alice") << '\n';

#ifdef LOCAL_DEFINE
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
    return 0;
}


Measured memory_bytes: 892
#include <bits/stdc++.h>
const int mmax = 2e6;
using namespace std;
long long n, m, ans;
bool vis[mmax];
vector <int> adj[mmax];
void dfs(int u)
{
    vis[u] = 1;
    for (int v : adj[u])
        if (!vis[v]) dfs(v);
}
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    //freopen("test.inp", "r", stdin);
    cin >> n >> m;
    for (int i = 1; i <= m; i++)
    {
        int u, v;
        cin >> u >> v;
        adj[u].push_back(v);
        adj[v].push_back(u);
    }
    for (int i = 1; i <= n; i++)
        if (!vis[i])
        {
            dfs(i);
            ans++;
        }
    cout << --ans;
    return 0;
}


Measured memory_bytes: 54220
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
//#include <intrin.h>

#define fore(i,a,b) for(int i = a; i < (b); i++)
#define fr(i,a,b) for(int i = a - 1; i >= b; i--)
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define N 300005
#define inf (ll)2e18
#define EPS 1e-12
#define mod 1000000007LL
#define __builtin_popcount(x) __popcnt(x)

using namespace std;

typedef long long ll;

inline void solve()
{
	ll x;
	cin >> x;
	for (ll i = -150; i <= 150; i++) {
		for (ll j = -150; j <= 150; j++) {
			if (i * i * i * i * i - j * j * j * j * j == x) {
				cout << i << ' ' << j;
				return;
			}
		}
	}
}

int main()
{
	fast;
#if defined(_DEBUG)
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	int q = 1;
	//cin >> q;
	fore(t, 0, q)
	{
		solve();
		cout << '\n';
	}
}

Measured memory_bytes: 3648
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
typedef long long ll;
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repe(i,n) for (int i = 0; i <= (n); ++i)
#define repe1(i,n) for (int i = 0; i <= (n); ++i)
#define all(x) (x).begin(),(x).end()
#define pb(x) push_back(x)
#define eb(k,v) emplace_back(k,v)
#define ct(res) cout << res << "\n";
#define vi vector<int>
#define vl vector<ll>
using namespace std;
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 INF = 1e9;
const ll MOD = 1000000007;
using Graph = vector<vector<int>>;


void recursive_comb(int *indexes, int s, int rest, std::function<void(int *)> f) {
  if (rest == 0) {
    f(indexes);
  } else {
    if (s < 0) return;
    recursive_comb(indexes, s - 1, rest, f);
    indexes[rest - 1] = s;
    recursive_comb(indexes, s - 1, rest - 1, f);
  }
}

// nCkの組み合わせに対して処理を実行する
void foreach_comb(int n, int k, std::function<void(int *)> f) {
  int indexes[k];
  recursive_comb(indexes, n - 1, k, f);
}

ll modPow(ll x, ll n) {
    if(n==0) return 1;
    ll res = modPow(x*x%MOD, n/2);
    if(n&1) res=res*x%MOD;
    return res;
}
ll mul(ll l, ll r) {
    ll ret =1;
    for(int i=0; i<l-r+1; ++i) {
        ret*=i+r;
        ret%=MOD;
    }
    return ret;
}
ll com(ll n, ll k) {
    ll ret1 = mul(n,n-k+1);
    ll ret2 = mul(k,1);
    ll ret3 = modPow(ret2, MOD-2);
    return ret1*ret3%MOD;
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int a,b,k; cin >> a >> b>> k;
    int ans = 0;
    vi tmp;
    for(int i=1; i<=min(a,b); ++i) {
      if (a%i==0 && b%i==0) {
        tmp.pb(i);
      }
    }
    sort(all(tmp),greater<int>());
    ct(tmp[k-1]);
}



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

int table[]={0,1,2,3,5,7,8,9};

void solve(int n){
	if(n >= 8){
		solve(n/8);
	}
	cout << table[n%8];
}



int main(){
	int n;
	while(cin >> n,n){
		solve(n);
		cout << endl;
	}
}

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

public class Main {
    static Set<Integer> primes = new HashSet<>();
    static{
        for(int i=2; i<=1000; i++){
            if(isprime(i))
                primes.add(i);
        }
    }
    private static void solver(InputReader sc, PrintWriter out) throws Exception {
        int  n = sc.nextInt();
        long sum=0;
        for(int i=1; i<=n; i++){
            if(i%3!=0 && i%5!=0)
                sum += i;
        }
        out.println(sum);
    }
    private static boolean isprime(int x){
        if(x==2)
            return true;
        int sqs = (int)Math.sqrt(x);
        for(int i=2; i<=sqs; i++){
            if(x%i==0)
                return false;
        }
        return true;
    }

    private static int gcd (int a, int b) {
        if (b == 0)
            return a;
        else
            return gcd (b, a % b);
    }
    private static long helper(long x){
        long ans = (x * (x-1))/2;
        return ans;
    }
    public static void main(String[] args) throws Exception {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        solver(in,out);
        out.close();
    }
    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

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

        public int nextInt() {
            return Integer.parseInt(next());
        }
        public long nextLong() {
            return Long.parseLong(next());
        }
        public int[] readIntArray(int n){
            int arr[] = new int[n];
            for(int i=0;i<n;i++) arr[i] = nextInt();
            return arr;
        }
    }
}
class Pair {
    int x;
    long y;

    Pair(int x, long y) {
        this.x = x;
        this.y = y;
    }

    @Override
    public boolean equals(Object o) {
        Pair pair = (Pair) o;
        return this.x < pair.x && this.y==pair.y;
    }

    @Override
    public int hashCode() {
        return Objects.hash(x, y);
    }
}

Measured memory_bytes: 33044
import java.util.Scanner

object Main extends App {

  val sc = new Scanner(System.in)

  val n, k = sc.nextInt()

  val ar = (for {
    _ <- 0 until n
  } yield sc.nextInt())
    .sorted

  val ans = (for {
    idx <- 0 until  n - k + 1
  } yield ar(idx + k - 1) - ar(idx))
    .min

  println(ans)
}


Measured memory_bytes: 61832
#include <stdio.h>

int main(void)
{
	int n, k, a[100000], i;
	scanf("%d%d", &n, &k);
	for (i = 0; i < n; i++) scanf("%d", &a[i]);
	printf("%d", (n - 2) / (k - 1) + 1);
	return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
const int SZ=3+4;
char sj[SZ]={};
int main(){
	long long i;
	long long ans=0;
	long long zd=0;
	for (i=1;i<=3;i++){
		cin >> sj[i];
		if (sj[i]=='R'){
			ans++;
		} else {
			if (ans>zd){
				zd=ans;
			}
			ans=0;
		}
	}
	if (ans>zd){
		zd=ans;
	}
	cout << zd << "\n";
	return 0;
}

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

#define ll long long int
#define pb push_back
#define eb emplace_back
#define xx first
#define yy second
#define INF 0x3f3f3f3f
#define show(x) cerr<<#x<<" : "<<x<<'\n';
#define yogeshk972() cerr<<"\nTime Taken : "<<(float)(clock()-time_p)/CLOCKS_PER_SEC<<"\n";
clock_t time_p=clock();
 
using namespace std;
const int N=3e3+10, mod=1e9+7;
int dp[N][N],dp1[N][N];

int main(){
	ios_base::sync_with_stdio(0);	cin.tie(0);
	int n,t;
	cin>>n>>t;
	
	int a[n],b[n];
	for(int i=0;i<n;i++)cin>>a[i]>>b[i];
	
	for(int j=a[0];j<=t;j++) dp[0][j]=b[0];
	for(int i=1;i<n;i++){
		for(int j=0;j<=t;j++){
			if( j<a[i] ) dp[i][j]=dp[i-1][j];
			else dp[i][j]=max(dp[i-1][j],dp[i-1][j-a[i]]+b[i]);
		}
	}
	
	for(int j=a[n-1];j<=t;j++)dp1[n-1][j]=b[n-1];
	for(int i=n-2;i>=0;i--){
		for(int j=0;j<t;j++){
			if(j<a[i]) dp1[i][j]=dp1[i+1][j];
			else dp1[i][j]=max(dp1[i+1][j],dp1[i+1][j-a[i]]+b[i]);
		}
	}
	
	
	int res=max(dp[n-2][t-1]+b[n-1],dp1[1][t-1]+b[0]);
	for(int i=1;i<n-1;i++){
		for(int j=0;j<t;j++){
			res=max(res, dp[i-1][j]+dp1[i+1][t-1-j] + b[i] );
		}
	}
	cout<<res;
};



Measured memory_bytes: 70912
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define Max(a, b) (a > b ? a : b)
#define Min(a, b) (a < b ? a : b)
#define ii pair<int, int>
#define fi first
#define se second
const int MAX = 200020; //2 * 10^5
const int MOD = 1000000007; //10^9 + 7
const int OO = 0x3f3f3f3f; // 0x3f3f3f3f;

string s;
int k, c, n;

vector<int> solve()
{
	vector<int> buc, ans;
	for(int i = 0; i < n; i++)
		if(s[i] == 'o')
			buc.push_back(i);
	
	ans.push_back(buc[0]);
	while(ans.size() != k)
	{
		auto it = lower_bound(buc.begin(), buc.end(), ans.back() + c + 1);
		ans.push_back(*it);
	}
	return ans;
}

int32_t main()
{
	cin >> n >> k >> c >> s;
	
	vector<int> ida = solve();
	reverse(s.begin(), s.end());
	vector<int> volta = solve();
	
	for(int i = 0; i < k; i++)
		if(ida[i] == n - volta[k - i - 1] - 1)
			cout << ida[i] + 1 << '\n';
	
	return 0;
}

Measured memory_bytes: 8408
n,m = map(int,input().split())
pys = []
for i in range(m):
    pys.append([i+1])
    pys[i][len(pys[i]):len(pys[i])] = list(map(int,input().split()))

ms = []
for _ in range(n+1):
    ms.append([])

for py in pys:
    ms[py[1]].append(py)

for sm in ms:
    sm.sort(key=lambda x : x[2])
    for i in range(len(sm)):
        sm[i].append(i+1)


res = []
for _ in range(m+1):
    res.append([])

for m in ms:
    for shi in m:
        res[shi[0]]=[shi[1],shi[3]]

for i in range(1,len(res)):
    print(str(res[i][0]).zfill(6)+str(res[i][1]).zfill(6))

Measured memory_bytes: 91480
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"

using namespace std;

const long long int MOD = 1000000007;
//const int MOD = 998244353;

long long int N, M, K, H, W, L, R;
//int N, M, K, H, W, L, R;

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

	cin >> N;
	string s;
	cin >> s;
	vector<int>num(26);
	for (auto i : s)num[i - 'a']++;
	long long int ans = 1;
	for (auto i : num) {
		ans *= (1 + i);
		ans %= MOD;
	}
	ans--;
	ans += MOD;
	ans %= MOD;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 512
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n;
	cin >> n;
	vector<ll> a(5);
	ll mi = 1e18;
	rep(i,5){
		cin >> a[i];
		chmin(mi, a[i]);
	}
	ll ans = (n + mi - 1) / mi + 4;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
def main():
    n = int(input())
    ai = input().split(' ')
    bi = input().split(' ')

    count = 0
    for i in range(n):
        a0 = int(ai[i])
        b0 = int(bi[i])
        if b0 <= a0:
            count += b0
            continue
        else:
            count += a0
            a1 = int(ai[i+1])
            count += min(b0 - a0, a1)
            ai[i + 1] = str(max(a1 - (b0 - a0), 0))
    print(count)


if __name__ == '__main__':
    main()


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

/* 大文字を小文字に変換 */
char tolower(char c) {return (c + 0x20);}
/* 小文字を大文字に変換 */
char toupr(char c) {return (c - 0x20);}

// if('A'<=s[i] && s[i]<='Z') s[i] += 'a'-'A';

/*
string s = "abcdefg"
s.substr(4) "efg"
s.substr(0,3) "abc"
s.substr(2,4) "cdef"

// イテレータ要素のインデックス
distance(A.begin(), itr);
*/

const int mod = 1000000007;

int main()
{
    int N; cin >> N;
    int A[N];
    rep(i,N) cin >> A[i];
    int Hat[N+1];
    rep(i,N+1){
        if(i == 0) Hat[i] = 3;
        else Hat[i] = 0;
    }
    ll ans = 1;
    rep(i,N){
        ans *= Hat[A[i]];
        ans %= mod;
        --Hat[A[i]];
        ++Hat[A[i]+1];
    }
    cout << ans << endl;
}

Measured memory_bytes: 4380
package main

import (
	"fmt"
	"sort"
)

func main() {
	var N, L int
	var ans string
	fmt.Scan(&N, &L)
	Sn := make([]string, N)
	for i := range Sn {
		fmt.Scan(&Sn[i])
	}
	sort.Strings(Sn)
	for _, s := range Sn {
		ans += s
	}
	fmt.Println(ans)
}


Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const ll MOD = 1000000007;
const ll INF = 1061109567;
const double EPS = 1e-10;
int main(){

    int N;
    cin>>N;
    int a;
    int sum=0;
    for(int i=0;i<N;i++){
        cin>>a;
        sum+=a-1;
    }
    cout<<sum<<endl;
    return 0;
}


Measured memory_bytes: 3628
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 1000000000000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;



#define SIZE 13

int N,M,X;
int POW[SIZE],a[SIZE];
int b[SIZE][SIZE],c[SIZE];


int main(){

	POW[0] = 1;
	for(int i = 1; i < SIZE; i++){

		POW[i] = POW[i-1]*2;
	}

	scanf("%d %d %d",&N,&M,&X);

	for(int i = 0; i < N; i++){

		scanf("%d",&a[i]);

		for(int k = 0; k < M; k++){

			scanf("%d",&b[i][k]);
		}
	}
	
	int ans = BIG_NUM;
	bool FLG;

	for(int state = 0; state < POW[N]; state++){

		for(int i = 0; i < M; i++){

			c[i] = 0;
		}

		int sum = 0;

		for(int loop = 0; loop < N; loop++){
			if(state & POW[loop]){

				sum += a[loop];

				for(int k = 0; k < M; k++){

					c[k] += b[loop][k];
				}
			}
		}

		FLG = true;
		for(int i = 0; i < M; i++){
			if(c[i] < X){
				FLG = false;
				break;
			}
		}
		if(FLG){

			ans = min(ans,sum);
		}
	}

	if(ans == BIG_NUM){

		printf("-1\n");

	}else{

		printf("%d\n",ans);
	}

	return 0;
}


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

using namespace std;

int main() {
    int n;
    cin >> n;
    vector<long long> v(3*n);
    for (int i = 0; i < n * 3; ++i)
        cin >> v[i];
    sort(v.begin(), v.end());
    long long sum = 0;
    for (int i = n; i < 3 * n; i += 2)
        sum += v[i];
    cout << sum << endl;
}

Measured memory_bytes: 2560
#include <iostream>
#include <string>
using namespace std;
#define rep(i,n) for (int i = 0;i < (int)(n);i++)

int main() {
    string s, t;
    cin >> s;
    cin >> t;

    int cnt = 0;
    rep(i, s.size()) {
        if (s[i] != t[i]) cnt++;
    }
    
    cout << cnt << endl;
}

Measured memory_bytes: 3928