akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <tuple>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;

#define rep(i,n) for(int i = 0; i<n; ++i)
#define REP(i,n) for(int i = 1; i<=n; ++i)
#define all(x) begin(perm),end(perm)
#define showall(obj) for(auto x:obj)cout<<x<<endl;
typedef long long ll;
typedef pair<int,int> ip;
typedef pair<ll,ll> lp;
typedef vector<int> vint;
typedef vector<ll> vll;
const int inf = 100100100;
const ll INF = 1LL<<60;
const int MOD = (int)1e9 + 7;

int main(){
    int n;cin>>n;
    vll ans(n+1); ans[0]=2; ans[1]=1;
    for(int i=2; i<=n; ++i){
        ans[i] = ans[i-2]+ans[i-1];
    }
    cout<<ans[n]<<endl;
}


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

ll dp[20][2][10][10][10],z;

ll Stoi(string s){
  ll res=0;
  for(ll i=0;i<(int)s.size();i++)res=res*10+s[i]-'0';
  return res;
}

ll Pow(ll a,ll b){
  ll res=1;
  while(b--)res*=a;
  return res;
}

string n;

ll dfs(ll id,ll f,ll a,ll b,ll c){
  if(dp[id][f][a][b][c]!=-1)return dp[id][f][a][b][c];
  if(id==(int)n.size())return 0;
  ll r=9,res=0;
  if(!f)r=n[id]-'0';
  for(ll d=0;d<=r;d++){
    ll nf=f;
    if(d<r)nf=1;
    if(a==5&&b==1&&d==3){
      if(nf) res+=Pow(10,n.size()-id-1);
      else res+=Stoi(n.substr(id+1))+1;
    }
    else{
      res+=dfs(id+1,nf,b,c,d);
    }
  }
  return dp[id][f][a][b][c]=res;
}

int main(){
  cin>>n;
  memset(dp,-1,sizeof(dp));
  cout<<dfs(0,0,0,0,0)<<endl;
  return 0;
}


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

int main() {
  int N, M;
  cin >> N >> M;
  vector<int> P(M), Y(M);
  vector<vector<int>> yd(N);
  for (int i = 0; i < M; i++) {
    cin >> P.at(i) >> Y.at(i);
    yd.at(P.at(i) - 1).push_back(Y.at(i));
  }
  for (int i = 0; i < N; i++) sort(yd.at(i).begin(), yd.at(i).end());
  for (int i = 0; i < M; i++) {
    string ans1 = to_string(P.at(i));
    while (ans1.size() < 6) ans1 = "0" + ans1;
    string ans2 = to_string(lower_bound(
        yd.at(P.at(i) - 1).begin(), 
        yd.at(P.at(i) - 1).end(), 
        Y.at(i)) 
      - yd.at(P.at(i) - 1).begin() + 1);
    while (ans2.size() < 6) ans2 = "0" + ans2;
    cout << ans1 << ans2 << endl;
  }
}

Measured memory_bytes: 9336
#include <stdio.h>
#define min(p,q)((p)<(q)?(p):(q))

int main(){
	int n;
	scanf("%d",&n);
	int ans=2e9+10;
	for(int i=0;i<n;i++){
		int a,b;
		scanf("%d%d",&a,&b);
		ans=min(ans,a+b);
	}
	printf("%d",ans);
}

Measured memory_bytes: 128
#include<stdio.h>
int main()
{
  int a,b[10000],c,d,s,i;
  scanf("%d",&a);
  for(i=0;i<a;i++){
    scanf("%d",&b[i]);
  }
  d=a-1;
  for(i=d;i>=0;i--){
    if (i>0)printf("%d ",b[i]);
    else printf("%d",b[i]);
  }
  printf("\n");
  return 0;
}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
#define REP(i, n) for(int i=0; i<n; i++)

ll func(ll n){
    ll ret = 0;
    while(n > 0) {
        ret += n%10;
        n /= 10;
    }
    return ret;
}

double snk(ll n){
    return n/(double)func(n);
}

int main(){
    ll K;
    cin >> K;
    ll n = 0;
    for(int i = 1; i <= min(K,9LL); i++){
        cout << i << endl;
    }
    double sn = 1.0;
    n = 9;
    for(int i = 10; i <= K; i++){
        int keta = 0;
        ll tmp = n;
        while(tmp > 0){
            keta++;
            tmp /= 10;
        }
        if(n == pow(10, keta)-1){
            n++;
            keta++;
        }

        double msn = 1e53;
        ll mnn = -1;
        ll nn = n;
        while(nn <= pow(10,keta)-1){
            for(int j = 0; j < keta; j++){
                ll p = (nn/(ll)pow(10, j)) % 10;
                //printf("p : %d\n", p);
                if(p == 9) p = -1;
                for(int x = p+1; x <= 9; x++){
                    nn = nn + pow(10, j);
                    //printf("%lld, %lf\n", nn, snk(nn));
                    if(snk(nn) < msn){
                        msn = snk(nn);
                        mnn = nn;
                    }
                }
            }

        }

        sn = msn;
        n = mnn;
        cout << n << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<algorithm>

using namespace std;

#define int long long
#define rep(i,n) for(int i = 0; i < (n); i++)
#define INF ((long long)1e18)
#define MOD ((int)1e9+7)
#define endl "\n"

#define yn(f) ((f)?"Yes":"No")
#define YN(f) ((f)?"YES":"NO")

#define MAX

signed main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);
	
	while(true){
		int N, M, r, q;
		int t, n, m, s;
		int ts, te;
		
		vector<vector<pair<int,int>>> pc;
		
		cin>>N>>M;
		
		if(!N && !M) break;
		cin>>r;
		
		pc.resize(M+1);
		
		for(int i = 0; i < r; i++){
			cin>>t>>n>>m>>s;
			pc[m].push_back(make_pair(t, s));
		}
		for(int i = 1; i <= M; i++){
			pc[i].push_back(make_pair(INF,1));
		}
		cin>>q; 
		for(int i = 0; i < q; i++){
			int res = 0;
			
			cin>>ts>>te>>m;
			
			res = te - ts;
			// cout<<res<<endl;
			for(int j = 0, con = 0, x = 0; j < pc[m].size(); j++){
				if(!con && pc[m][j].second){
					res -= max(0ll, min(pc[m][j].first,te) - max(ts, x));
					// cout<<i<<" "<<max(0ll, min(pc[m][j].first,te) - max(ts, x))<<" "<<min(pc[m][j].first,te)<<" - "<<max(ts, x)<<endl;
				}
				// cout<<i<<" "<<j<<" "<<con<<" "<<pc[m][j].first<<endl;
				if(pc[m][j].second) con++;
				else con--;
				
				if(!con) x = pc[m][j].first;
			}
			
			cout<<res<<endl;
		}
	}
	
	
	return 0;
}


Measured memory_bytes: 3508
# Acceptance of input

import sys

file_input = sys.stdin

V, E = map(int, file_input.readline().split())

adj_mat = [[0] * V for i in range(V)]

for line in file_input:
    u, v, c = map(int, line.split())
    adj_mat[u][v] = c

# Ford???Fulkerson algorithm

import collections

# BFS for residual capacity network
def bfs(start, goal, parent):
    unvisited = [True] * V
    queue = collections.deque()
    queue.append(start)
    unvisited[start] = False
    while queue:
        u = queue.popleft()
        for v, r_capacity in enumerate(adj_mat[u]):
            if unvisited[v] and (r_capacity > 0):
                queue.append(v)
                unvisited[v] = False
                parent[v] = u
                if v == goal:
                    return not unvisited[goal]

def ford_fulkerson(source, sink):
    parent = [None] * V
    max_flow = 0
    while bfs(source, sink, parent):
        aug_path_flow = 10000
        v = sink
        while (v != source):
            aug_path_flow = min(aug_path_flow, adj_mat[parent[v]][v])
            v = parent[v]
        max_flow += aug_path_flow
        v = sink
        while (v != source):
            u = parent[v]
            adj_mat[u][v] -= aug_path_flow
            adj_mat[v][u] += aug_path_flow
            v = u
    return max_flow

# output
print(ford_fulkerson(0, V - 1))

Measured memory_bytes: 8180
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        // ABC159A - The Number of Even Pairs

        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int m = sc.nextInt();

        long ans = 0;
        if (n > 1) {
            int ans1 = 0;
            for (int i = n - 1; i > 0 ; i--) {
                ans1 += i;
            }
            ans += ans1;
        }
        if (m > 1) {
            int ans2 = 0;
            for (int i = m - 1; i > 0 ; i--) {
                ans2 += i;
            }
            ans += ans2;
        }

        System.out.println(ans);
    }
}


Measured memory_bytes: 23764
from sys import exit
from itertools import groupby

s=input()
x,y=map(int,input().split())

s=[[h, len(list(g))] for h, g in groupby(s)]
a,b=[],[]
turn=True
#初めまっすぐの場合
if s[0][0]=="F":
    x-=s[0][1]
    s.pop(0)
for i in s:
    if i[0]=="F":
        if turn:
            a.append(i[1])
        else:
            b.append(i[1])
    elif i[1]%2==1:
        turn=not turn
a.sort(reverse=True)
b.sort(reverse=True)
for i in a:
    x=abs(x)-abs(i)
if x!=0:
    print("No")
    exit()
for i in b:
    y=abs(y)-abs(i)
if y!=0:
    print("No")
    exit()
print("Yes")


Measured memory_bytes: 42204
#include <bits/stdc++.h>
#define maxn 200005
using namespace std;
typedef long long ll;
map<ll,ll> mp;
ll a[maxn];
vector<ll> v;

int main(){
	int n;
	cin >>n;
	ll sum=0,ans=0;
	for(int i=0;i<n;i++) cin >>a[i],mp[a[i]]++;
	for(auto x : mp){
		ll res=x.second;
		if(res>=2) sum+=res*(res-1)/2,v.push_back(res);
	}
	for(int i=0;i<n;i++){
		ll x=a[i];
		if(mp[x]>=2){
			ll res=mp[x];
			cout <<sum-res*(res-1)/2+(res-1)*(res-2)/2<<endl;
		}
		else 
		cout <<sum<<endl;
	}
}

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

struct Edge {
    int to;
    ll cost;
    Edge(int t, ll c) : to(t), cost(c) {}
};

vector<ll> Dijkstra(const vector<vector<Edge>>& g, int s) {
    ll INF = 1LL<<60;
    vector<ll> d(g.size(), INF);
    priority_queue<pair<ll, int>, vector<pair<ll, int>>, greater<>> q;
    d.at(s) = 0;
    q.emplace(d.at(s), s);
    while ( !q.empty() ) {
        auto p = q.top();
        q.pop();
        int v = p.second;
        if ( d.at(v) < p.first ) continue;
        for ( auto e : g[v]) {
            if ( d.at(e.to) > d.at(v) + e.cost ) {
                d.at(e.to) = d.at(v) + e.cost;
                q.emplace(d.at(e.to), e.to);
            }
        }
    }
    return d;
}

ll solve() {
    ll N, X, Y;
    cin >> N >> X >> Y;
    X--, Y--;
    vector<vector<Edge>> G(N);
    for ( int i = 0; i < N-1; i++ ) {
        G[i].push_back(Edge(i+1,1));
        G[i+1].push_back(Edge(i,1));
    }
    G[X].push_back(Edge(Y,1));
    G[Y].push_back(Edge(X,1));

    vector<vector<ll>> d(N);
    for ( int i = 0; i < N; i++ ) {
        d[i] = Dijkstra(G, i);
    }
    vector<int> c(N+1);
    for ( int i = 0; i < N; i++ ) {
        for ( int j = 0; j < N; j++ ) {
            if ( i == j ) continue;
            c[d[i][j]]++;
        }
    }
    for ( int i = 1; i < N; i++ ) {
        cout << c[i]/2 << "\n";
    }
    return 0;
}

int main() {
    solve();
    return 0;
}

Measured memory_bytes: 31744
import sys

input_methods=['clipboard','file','key']
using_method=0
input_method=input_methods[using_method]

IN=lambda : map(int, input().split())
mod=1000000007

#+++++

def can_set(al_max ,k,cc):
	a=al_max
	aa=((k//(cc+1))*cc) + (k%(cc+1))
	#pa((a,cc,aa))
	if a <= aa:
		return True
	return False

def main():
	k, t = IN()
	al = list(IN())
	al.sort(reverse=True)
	#pa(al)
	
	#if al[0] <= (k+1)//2:
	#	return 0
	#if al[0] == k:
	#	return k-1
	tt=sum(al)
	mm=al[0]
	nokori=tt-mm
	ret = max(0, tt - nokori*2-1)
	print(ret)
	
	

def main2():
	k, t = IN()
	al = list(IN())
	al.sort(reverse=True)
	ttt=[0]*k
	p=0
	for i, v in enumerate(al):
		for _ in range(v):
			ttt[p]=i
			p+=2
			if p >= k:
				p=1
	
	cc=0
	pre=-1
	for v in ttt:
		if pre == v:
			cc+=1
		else:
			pre=v
			
	return cc
	
	
	
	
#+++++
isTest=False

def pa(v):
	if isTest:
		print(v)
		
def input_clipboard():
	import clipboard
	input_text=clipboard.get()
	input_l=input_text.splitlines()
	for l in input_l:
		yield l

if __name__ == "__main__":
	if sys.platform =='ios':
		if input_method==input_methods[0]:
			ic=input_clipboard()
			input = lambda : ic.__next__()
		elif input_method==input_methods[1]:
			sys.stdin=open('inputFile.txt')
		else:
			pass
		isTest=True
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)

Measured memory_bytes: 38256
#include <bits/stdc++.h>
#define watch(x) cout <<(#x)<<" is "<<(x)<<endl
#define debug cout <<"hi"<<endl
using namespace std;
typedef long long ll;
const ll MOD=1e9+7;
int main(){
  int n,p; string s; cin >>n >>p >>s; ll ans=0;
  if(10%p==0){
    for(int i=0; i<n; i++) if((s[i]-'0')%p==0) ans+=i+1;
    cout <<ans;
  }
  else{
    int x=1,v=0; vector<ll>r(p,0);
    for(int i=1; i<=n; i++){
      v=(v+x*(s[n-i]-'0'))%p;
      r[v]++; x=(x*10)%p;
    }
    for(int i=0; i<p; i++) ans+=r[i]*(r[i]-1)/2;
    cout <<ans+r[0];
  }
return 0;}

Measured memory_bytes: 640
strstoints :: [String] -> [Integer]
strstoints xs =  map read xs

ints input = (strstoints (words input))

ord :: [Integer] -> String
ord ints@(a:b:[]) | a > b  = "a" ++ " > " ++ "b"
                  | a == b = "a" ++ " == " ++ "b"
                  | a < b  = "a" ++ " < " ++ "b"

ord3 :: [Integer] -> String
ord3 ints@(a:b:c:[]) | a < b && b < c = "Yes"
                     | otherwise      = "No"


main = do
  str <- getLine
  putStrLn $ ord3 $ ints str

Measured memory_bytes: 3644
include Math
require 'prime'

n = gets.to_i
root_prime = Prime.each(10000).to_a
c = 0

n.times {
  x = gets.to_i
  if (x <= 10000)
    c += 1 if (root_prime.include?(x))
    next
  end
  xs = sqrt(x).floor
  root_prime.each{ |rp|
    if (rp > xs)
      c += 1
      break
    end
    break if (x % rp == 0)
    c += 1 if (rp == root_prime.last) && (xs > rp)
  }
}
puts c

Measured memory_bytes: 9020
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
#include <tuple>
#define mkp make_pair
#define mkt make_tuple
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const ll MOD=1e9+7;

int main(){
  int N;
  cin>>N;
  vector<ll> A(N);
  rep(i,N) cin>>A[i];

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

  return 0;
}



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

using namespace std;

int main() {
//        freopen("input.txt", "r", stdin);
//        freopen("output.txt", "w", stdout);
        int a, b;
        scanf("%d%d", &a, &b);
        if (a >= 13) {
                printf("%d\n", b);
        }
        if (a >= 6 && a <= 12) {
                printf("%d\n", b / 2);
        }
        if (a < 6) {
                puts("0");
        }
        return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<stdio.h>
using namespace std;
int main(){
    int a,b,i,x=0,y=0,count={0};
    for(i=0;i<1000;i++){
    cin>>a>>b;
        if(a==0&&b==0){
            break;
        }
    if(a<=b){
        x=b;y=a;
    }else if(a>=b){
        x=a;y=b;
    }
    for(i=0;i<1000;i++){
        x=x%y;
        swap(x,y);
        count++;
        if(y==0){
            break;
        }
    }
    cout<<x<<" "<<count<<endl;
        count=0;
    }
    return 0;
}

Measured memory_bytes: 3092
H, W = map(int, input().split())
field = [list(input()) for _ in range(H)]

for y in range(H):
    for x in range(W):
        if field[y][x] == '#':
            flag = False
            for dy, dx in [(1, 0), (-1, 0), (0, 1), (0, -1)]:
                ny, nx = y + dy, x + dx
                if 0 <= nx < W and 0 <= ny < H:
                    if field[ny][nx] == '#':
                        flag = True
                else:
                    continue
            if flag is False:
                print('No')
                exit()
print('Yes')

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define M 1<<25
using namespace std;long long a[M],b[M],c[M],x[M],n,p,q,i,s,m;main() {cin>>n>>p>>q;c[0]=p*q;for(i=0;i<n;i++){cin>>b[i];a[i]=b[i]-(q-i)*p;s+=b[i];}sort(a,a+n);m=s;for(i=0;i<n;i++){s-=a[i];s+=2*i*p;m=max(s,m);}cout<<m<<endl;}

Measured memory_bytes: 10952
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>

using namespace std;

//----------------------- Print Function ----------------------//

inline void print() {
    cout << endl;
}
template <typename First, typename... Rest>
void print(const First &first, const Rest &... rest) {
    cout << first << ' ';
    print(rest...);
}

template <typename T>
void print(const vector<T> &v) {
    for (auto e : v) cout << e << ' ';
    cout << endl;
}

//------------------------- Libraries -------------------------//

//--------------------------- Solve ---------------------------//

void solve() {
    int N; cin >> N;
    vector<int> cnt(100000);
    for (int i = 0; i < N; i++) {
        int a; cin >> a;
        cnt[a]++;
    }

    int ans = 0;
    for (int i = 1; i < 100000 - 1; i++) {
        int tmp = cnt[i-1] + cnt[i] + cnt[i+1];
        ans = max(ans, tmp);
    }
    
    cout << ans << '\n';
}

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

    solve();

    return 0;
}

Measured memory_bytes: 3724
#ifndef LOCAL
#pragma GCC optimize "-O3"
#endif
#include <bits/stdc++.h>

typedef long long ll;
typedef long long llong;
typedef long double ld;
typedef unsigned long long ull;

using namespace std;

/*
ll pw(ll a, ll b) {
	ll ans = 1; while (b) {
		while (!(b & 1)) b >>= 1, a = (a * a) % MOD;
		ans = (ans * a) % MOD, --b;
	} return ans;
}
*/
const int MAXN = 120000;

int n;

vector<tuple<ll, int, int> > ed;
int p[MAXN];

int sz[MAXN];
ll dd[MAXN];

int get(int a) {
	if (p[a] == a)
		return a;
	return get(p[a]);
}

ll get2(int a) {
	if (p[a] == a)
		return dd[a];
	return dd[a] + get2(p[a]);
}

int main() {
	cin >> n;
	for (int i = 0; i < n - 1; ++i) {
		int a, b;
		ll c;
		cin >> a >> b >> c;
		--a, --b;
		ed.push_back(make_tuple(c, a, b));
	}
	sort(ed.begin(), ed.end());
	reverse(ed.begin(), ed.end());
	for (int i = 0; i < n; ++i) {
		p[i] = i, sz[i] = 1, dd[i] = 0;
	}
	for (int i = 0; i < ed.size(); ++i) {
		int a, b;
		ll c;
		tie(c, a, b) = ed[i];
		a = get(a);
		b = get(b);
		dd[a] += sz[b] * c;
		dd[b] += sz[a] * c;
		if (sz[a] > sz[b])
			swap(a, b);
		dd[a] -= dd[b];
		sz[b] += sz[a];
		p[a] = b;
	}
	for (int i = 0; i < n; ++i) {
		cout << get2(i) << "\n";
	}
	return 0;
}




Measured memory_bytes: 5104
#include<stdio.h>
#pragma GCC optimize("O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define rep(i,N) for(int i=0;i<(int)N;i++)
const char letters[]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
int diff[62];char pw[129],query[129];
static inline int ask(void){int x;printf("? %s\n",query);fflush(stdout);return !scanf("%d",&x)?-1:x;}
int main(void)
{
  int total=0,len=0;
  rep(i,62){rep(j,128){query[j]=letters[i];}query[128]=0;diff[i]=128-ask();total+=diff[i];}
  rep(i,62)
  {
    if(len==0){len=diff[i];rep(j,diff[i])pw[j]=letters[i];}
    else
    {
      for(int k=diff[i];k>=1;k--)
      {
        int l=0,r=len;
        while(l<r)
        {
          int mid=(l+r+1)/2;
          rep(j,mid)query[j]=pw[j];
          rep(j,k)query[mid+j]=letters[i];
          query[mid+k]=0;
          if(ask()==total-mid-k)l=mid;else r=mid-1;
        }
        len++;rep(j,len-l){pw[len-j]=pw[len-j-1];}pw[l]=letters[i];
      }
    }
  }
  pw[len]=0;return printf("! %s\n",pw),0;
}

Measured memory_bytes: 3808
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 1000000007;
#define dame { puts("-1"); return 0;}
#define yn {puts("YES");}else{puts("NO");}
  
int main() {
  int N, K;
  cin >> N >> K;
  vi h(N);
  rep(i,N) {
    cin >> h[i];
  }
  int ans = 0;
  rep(i,N) {
    if(h[i] >= K) {
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 640
/*
AUTHOR : Chandan Agrawal
College : Poornima College of Engg. jaipur, Raj
Mail : chandanagrawal23@gmail.com
*/

#include<bits/stdc++.h>
#include<stdio.h>
using namespace std;

#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define MAX 100050

#define ll long long
#define ld long double
#define lli long long int

#define pb emplace_back
#define INF 1000000000
#define mod 1000000007

// trignometric function always give value in Radians only
#define PI acos(-1) //3.1415926535897932384626433832795028
#define dsin(degree) sin(degree*(PI/180.0))
#define dcos(degree) cos(degree*(PI/180.0))
#define dtan(degree) tan(degree*(PI/180.0))

#define rsin(radian) sin(radian)
#define rcos(radian) cos(radian)
#define rtan(radian) tan(radian)

#define loop(i,n) for (lli i = 0; i < n; i++)
#define loopitr(xt,vec) for (auto xt : vec)
#define FOR(i,a,b) for (lli i = a; i < b; i+=1)
#define loop_rev(i,n) for (lli i = n-1; i >= 0; i--)
#define FOR_REV(i,a,b) for (lli i = a; i >= b; i--)
#define itr :: iterator it
#define WL(t) while(t --)

#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define sz(x) int(x.size())
#define F first
#define S second

#define mii map<lli,lli>
#define vi vector<lli>
#define vbool vector<bool>
#define seti set<lli>
#define pii pair<lli,lli>
#define pcc pair<char , char>

#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) (a/gcd(a,b))*b
#define abs(x) ((x < 0)?-(x):x)

#define endl '\n'

template <typename T>
void print(T x){cout<<x<<endl;}
template <typename T1, typename T2>
void print2(T1 x,T2 y){cout<<x<<" "<<y<<endl;}
template <typename T1, typename T2,typename T3>
void print3(T1 x, T2 y,T3 z){cout<<x<<" "<<y<<" "<<z<<endl;}

#define scanarr(a,n) for(lli i=0;i<n;i++)    cin>>a[i];
#define scanvector(a,n) for(lli i=0;i<n;i++){ lli x ; cin>>x; a.pb(x);}

#define printarr(a,n) for(lli i=0;i<n;i++)   cout<<a[i]<<" "; cout<<endl;
#define printvector(vec) for(auto xt : vec) cout<<xt<<" ";    cout<<"\n";

#define FD(N) fixed<<setprecision(N)

#define deb(x) cout<<#x<<" "<<x<<endl;

// chandan1,2
void chandan1(){int y=1;return;}
void chandan2(){
        loop(i,10){
        lli x=1;
    }
    return(chandan1());
}



int main(){
fastio
lli t=1;
//cin>>t;
chandan2();
while(t--) {
    lli n;
    string s;
    cin>>n;
    if(n>=400 and n<=599)
        print(8);
    if(n>=600 and n<=799)
        print(7);
    if(n>=800 and n<=999)
        print(6);
    if(n>=1000 and n<=1199)
        print(5);
    if(n>=1200 and n<=1399)
        print(4);
    if(n>=1400 and n<=1599)
        print(3);
    if(n>=1600 and n<=1799)
        print(2);
    if(n>=1800)
        print(1);
    
    
  }
return 0;
}


Measured memory_bytes: 3640
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define il inline
#define outy printf("Yes\n")
#define outn printf("No\n")
#define outf printf("First\n")
#define outs printf("Second\n")
#define FOR(a,b,c) for(int a=b;a<=c;a++)
#define FORD(a,b,c) for(int a=b;a>=c;a--)
#define FORL(a,b) for(int a=head[b];a;a=nxt[a])
#define in(a)  a=read()
#define in2(a,b)  a=read(),b=read()
#define in3(a,b,c)  a=read(),b=read(),c=read()
#define in4(a,b,c,d)  a=read(),b=read(),c=read(),d=read()
#define inl(a)  a=readl()
#define inl2(a,b)  a=readl(),b=readl()
#define inl3(a,b,c)  a=readl(),b=readl(),c=readl()
#define inl4(a,b,c,d)  a=readl(),b=readl(),c=readl(),d=readl()
#define out(a) printf("%d\n",a)
#define out2(a,b) printf("%d %d\n",a,b)
#define out3(a,b,c) printf("%d %d %d\n",a,b,c)
#define out4(a,b,c,d) printf("%d %d %d %d\n",a,b,c,d)
#define outl(a) printf("%lld\n",a)
#define outl2(a,b) printf("%lld %lld\n",a,b)
#define outl3(a,b,c) printf("%lld %lld %lld\n",a,b,c)
#define outl4(a,b,c,d) printf("%lld %lld %lld %lld\n",a,b,c,d)
#define clr(x,y) memset(x,y,sizeof(x))
inline int read(){
    char c;int s=0,t=1;
    while(!isdigit(c=getchar()))if(c=='-')t=-1;
    do{s=s*10+c-'0';}while(isdigit(c=getchar()));
    return s*t;
}
inline ll readl(){
    char c;ll s=0;int t=1;
    while(!isdigit(c=getchar()))if(c=='-')t=-1;
    do{s=s*10+c-'0';}while(isdigit(c=getchar()));
    return s*t;
}
/*------------------------------------------------------------*/
#define mod 1000000007
#define maxn 100010
#define inf 0x7fffffff
/*------------------------------------------------------------*/
int n,m;
int main(){
	string n;
	cin>>n;
	ll ans=0;
	FOR(i,0,n.length()-1)ans+=n[i]-'0';
	ll c=0;
	FOR(i,0,n.length()-1){
		c+=n[i]-'0';
		int l=n.length();
		ans=max(ans,c-1+(l-1-i)*9);
	}	
	outl(ans);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define se second
#define fi first
#define ld long double
#define mod 998244353

int main(void){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    setprecision(12);
    int n;
    cin>>n;
    vector<ld > arr(n);
    for(int i=0;i<n;i++) cin>>arr[i];
    sort(arr.begin(),arr.end());
    setprecision(12);
    ld sum=(arr[0]+arr[1])/2.0; 
    for(int i=2;i<n;i++){
        setprecision(12);
        sum=(sum+arr[i])/2.0;
    }
    cout<<setprecision(12)<<sum;
    return 0;
}


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

int main(){
  long long int n,A=0;
  cin>>n;
  vector<long long int> a(n);
  for (int i=0;i<n;i++){
    cin>>a.at(i);
  }
  sort(a.begin(),a.end());
  A=a[n/2]-a[(n/2)-1];
  cout<<A<<endl;
}

Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <algorithm>
#include <climits>
#include <map>
#include <cstdlib>
#include <cstdio>
#include <vector>
#include <climits>
using namespace std;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pi;
typedef long long int lli;


//int memo[1000010] = {0,0,1};
double PI = 3.14159265359;

lli MOD = 10e9+7;

int Prev[1010];
int cost[1010][1010];
int d[1010];
bool used[1010];
int V;

void dijikstra(int s){
    fill(d,d + V,1000*1000);
    fill(used, used + V,false);
    fill(Prev,Prev+V,-1);
    d[s] = 0;
    
    while(true){
        int v = -1;
        for(int u = 0; u < V; u++){
            if(!used[u] && (v == -1 || d[u] < d[v])) v = u;
        }
        
        //cout << v << endl;
        
        if( v == -1) break;
        
        used[v] = true;
        
        for(int u = 0; u < V; u++){
            if( d[u] > d[v] + cost[v][u]){
                d[u] = d[v] + cost[v][u];
                Prev[u] = v;
            }
        }
    }
    
}

map<pi,bool> used_flag; 

vector<int> get_path(int t){
    vector<int> path;
    for(; t != -1; t = Prev[t]) path.push_back(t);
    //for(int i = 0; i < V; i++) cout << Prev[i] << " ";
    //cout << endl;
    reverse(path.begin(),path.end());
    
    for(int i = 1; i < path.size(); i++){
        used_flag[pi(path[i-1],path[i])] = true;
        used_flag[pi(path[i],path[i-1])] = true;
    }
    
    return path;
}

int main(void){
    
    
    int N,M;
    cin >> N >> M;
    for(int i = 0; i < 1010; i++){
        for(int j = 0; j < 1010; j++)
            cost[i][j] = 1000*1000;
    }
    
    V = N;
    
    for(int i = 0; i < M; i++){
        int a,b,c;
        cin >> a >> b >> c;
        cost[a-1][b-1] = c;
        cost[b-1][a-1] = c;
    }
    
    for(int i = 0; i < N; i++){
        dijikstra(i);
        
        for(int j = 0; j < N; j++){
            if(i == j) continue;
            get_path(j);
        }
    }
    
    cout << (2*M - used_flag.size())/2 << endl;
}


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

using namespace std;

int main(){
    int sum = 0;
    int sum_to_10s = 0;
    int max_to_10s = 0;

    for(int i =0; i < 5;i++){
        int n;
        cin >> n;
        sum += n;
        //１の位で0を除いたものの１０秒までのカウント数を保存
        int quot = n%10;
        if(quot != 0){
            sum_to_10s += (10 - quot);
            if(10 - quot > max_to_10s)max_to_10s = 10 - quot;
        }
    }
    sum += sum_to_10s;;
    sum -= max_to_10s;
    cout << sum << endl;
    
    return 0;
}

Measured memory_bytes: 256
import std.algorithm;
import std.array;
import std.conv;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

immutable int limit = 51;

long transform (long m, int d)
{
	foreach (i; 0..limit)
	{
		if (m & (1L << i))
		{
			m |= 1L << (i % d);
		}
	}
	return m;
}

bool canTransform (long m, int b, int med)
{
	foreach_reverse (d; 1..med + 1)
	{
		m = transform (m, d);
	}
	return (m >> b) & 1;
}

long solve (int n, int [] a, int [] b)
{
	long res = 0;
	auto c = a.map !(x => 1L << x).array;
	foreach_reverse (d; 1..limit)
	{
		bool canSkip = true;
		foreach (i; 0..n)
		{
			if (!canTransform (c[i], b[i], d - 1))
			{
				canSkip = false;
			}
		}
		if (canSkip)
		{
			continue;
		}
		res += 1L << d;
		foreach (i; 0..n)
		{
			c[i] = transform (c[i], d);
		}
		debug {writefln ("%s %(%b %)", res, c);}
	}
	foreach (i; 0..n)
	{
		if (!canTransform (c[i], b[i], 0))
		{
			return -1;
		}
	}
	return res;
}

void main ()
{
	int n;
	while (readf (" %s", &n) > 0)
	{
		readln;
		auto a = readln.splitter.map !(to !(int)).array;
		auto b = readln.splitter.map !(to !(int)).array;
        	writeln (solve (n, a, b));
	}
}


Measured memory_bytes: 256
N,K,S = map(int,input().split())
Smax = 10**9

A = [S for _ in range(K)]
if S < Smax:
    A += [S+1 for _ in range(N-K)]
else:
    A += [S-1 for _ in range(N-K)]

for a in A[:-1]:
    print('{} '.format(a), end = "")
print('{}'.format(A[-1]))

Measured memory_bytes: 8840
def rotate(mat):
  mat2 = []
  for i in range(len(mat[0])):
    s = ""
    for k in range(len(mat)):
      s = s + mat[k][i]
    mat2.append(s)
  return mat2

H,W=map(int, input().split())
mat = []
for i in range(H):
  a = input()
  if "#" in a:
    mat.append(a)

for count in range(H+W):
  for i in range(len(mat)-1, -1, -1):
    if not "#" in mat[i]:
      del mat[i]
  mat = rotate(mat)
  for i in range(len(mat)-1, -1, -1):
    if not "#" in mat[i]:
      del mat[i]
  mat = rotate(mat)
  
for i in range(len(mat)):
  print(mat[i])


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

int main() {
  int A, B, C;
  cin >> A >> B >> C;
  for (int i = 0; i < B; i++) {
    if (i * A % B == C) {
      cout << "YES" << endl;
      return 0;
    }
  }
  cout << "NO" << endl;
  return 0;
}

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

int main() {
    string s,t;
    cin >> s >> t;
    t.pop_back();
    if(s == t) cout << "Yes" << endl;
    else cout << "No" << endl; 

    return 0;
}

Measured memory_bytes: 3628
import sys
from collections import defaultdict

sys.setrecursionlimit(10 ** 7)

N, D, A = map(int, input().split())
E = []
for _ in range(N):
    x, h = map(int, input().split())
    E.append((x, h))
    E.append((x+2*D, 0))

E = sorted(E, key=lambda x: (x[0], -x[1]))

for i in range(len(E)-1, -1, -1):
    x, h = E[i]
    if h != 0:
        xmax = x
        break

bomb = defaultdict(int)
damage = 0
ans = 0
for i in range(len(E)):
    x, h = E[i]

    if x > xmax:
        break

    # x+2D: damageをマイナス
    if h == 0:
        damage -= bomb[x]
        continue

    h -= damage

    if h <= 0:
        continue

    x = x + 2 * D
    cnt = -1 * (-h // A)
    damage += cnt * A
    bomb[x] = cnt * A
    ans += cnt

print(ans)


Measured memory_bytes: 107364
from sys import *

lis = {"A":1,"B":0,"C":0}
for s in stdin:
    d = map(str,s[:-1].split(","))
    lis[d[0]],lis[d[1]] = lis[d[1]],lis[d[0]]
for e in ["A","B","C"]:
    if lis[e]:
        print e

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

using namespace std;


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

	int n ,k;
	cin >> n >> k;

	vector<int> a(n);
	for(int i =0; i < n; ++i){
		cin >> a[i];
	}
	sort(a.begin(),a.end());
	vector<bool> game(2*k + 10,false);

	for(int i = 0;i < a[0]; ++i){
		for(int j = 0; j < n; ++j){
			game[i + a[j]] = true;
		}
	}
	for(int i = a[0]; i <= k; ++i){
		if(game[i] == false){
			for(int j = 0; j < n; ++j){
				game[i + a[j]] = true;
			}
		}
	}
	cout << (game[k] == true? "First" : "Second");


	return 0;
}

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

int main() {
  int H,W ;
  cin >> H >> W;
  
  vector<string> high(H);
  
  for(int i=0; i<W+2; i++){
    cout << '#' ;
  }
  cout << endl;
  
  for(int i=0; i<H; i++){
    cin >> high.at(i);
    cout << '#' << high.at(i) << '#' << endl;
  }
  
   for(int i=0; i<W+2; i++){
    cout << '#' ;
  }
  
  cout << endl;
  
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace  std;
int main() {
	long long int N, M, K;
	cin >> N >> M >> K;
	if (N > K) {
		cout << N - K << endl;
		cout << M <<endl ;
	}
	else if(N+M>K) {
		cout << 0 << endl;
		cout << M-K+N << endl;
	}
	else {
		cout << 0 << endl;
		cout << 0 << endl;
	}
	return 0;
}

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

int main() {
	cin.tie(0);
   	ios::sync_with_stdio(false);
   	int n, m, c;
    cin >> n >> m >> c;
    int b[20];
    int count = 0;
    rep(i, m){cin >> b[i];}
    rep(i, n){
        int sum = 0;
        rep(j, m){
            int a;cin >> a;
            sum += a * b[j];
        }
        if(sum + c > 0){
            count++;
        }
    }
    cout << count << endl;
	return 0;
}


Measured memory_bytes: 256
//WA => CARO!
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back 
#define fastcin ios::sync_with_stdio(false); cin.tie(NULL);
#define endl '\n'
#define MAX 505

int n;
int h[MAX][MAX];
int oc[MAX][MAX];

int x[4] = {0, 0, 1, -1};
int y[4] = {1, -1, 0, 0};

void dfs(int l, int c){
	for (int i=0; i<4; i++){
		if (l+x[i] < 0 or l+x[i] >= n or c+y[i] < 0 or c+y[i] >= n)
			continue;
		if (h[l+x[i]][c+y[i]] > h[l][c]+oc[l][c]){
			h[l+x[i]][c+y[i]] = h[l][c]+oc[l][c];
			dfs(l+x[i], c+y[i]);
		}
	}
}

tuple<int, int> coord(int k){
	k--;
	return {k/n, k%n};
}

signed main(){
	cin >> n;
	for (int i=0; i<n; i++){
		for (int j=0; j<n; j++){
			h[i][j]=min({i, j, n-1-i, n-1-j});
			oc[i][j]=1;
		}
	}
	vector<int> p(n*n);
	for (auto &x: p) cin >> x;
	int sum = 0;
	for (int i=0; i<n*n; i++){
		int l, c;
		tie(l, c) = coord(p[i]);
		oc[l][c] = 0;
		sum+=h[l][c];
		dfs(l, c);
	}
	cout << sum << endl;
}


Measured memory_bytes: 25636
#include<iostream>
#include<stdio.h>
using namespace std;

int main(){
	int num[100][100] = {{0}};
	int n;
	int i,j;

	while(cin >> n, n){

		for(i = 0; i < n; i++){
			for(j = 0; j < n; j++){
				cin >> num[i][j];
			}
		}

		for(i = 0; i < n; i++){
			for(j = 0; j < n; j++){
				num[i][n] += num[i][j];
				num[n][j] += num[i][j];
				num[n][n] += num[i][j];
			}
		}

		for(i = 0; i <= n; i++){
			for(j = 0; j <= n; j++){
				printf("%5d",num[i][j]);
				num[i][j] = 0; //テ・ツ按敕ヲツ慊淌・ツ個?
			}
			printf("\n");
		}

	}

}

Measured memory_bytes: 1204
#include <stdio.h>

int main(void)
{
    int a,b,c;
    int ans[1000] = {0};
    int i = 0;
    int j = 0;
    scanf("%d",&a);
    scanf("%d",&b);
    scanf("%d",&c);
    int A = a;
    while(1){
        ans[j] = A % b;
        if(ans[j] == c){
            //printf("a = %d ans[%d] = %d\n",a,j,ans[j] );
            printf("YES\n");
            break;
        }else if(j != 0 && ans[j] == ans[0]){
            //printf("a = %d ans[%d] = %d\n",a,j,ans[j] );
            printf("NO\n");
            break;
        }else{
            //printf("a = %d ans[%d] = %d\n",a,j,ans[j] );
            j++;
            A += a;
        }
    }
    /*for(i=0;ans[j] == c || (j > 0 && ans[j] == ans[0]);i++ ){
        ans[i] = b*a;

    }*/ 

    return 0;
}

Measured memory_bytes: 128
import java.util.Scanner;

public class Main {

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

		int sx = sc.nextInt();
		int sy = sc.nextInt();
		int tx = sc.nextInt();
		int ty = sc.nextInt();
		int dx = tx - sx;
		int dy = ty - sy;

		sc.close();

		StringBuilder sb1 = new StringBuilder();
		for(int i=0; i<dy; i++) {
			sb1.append('U');
		}
		for(int i=0; i<dx; i++) {
			sb1.append('R');
		}
		System.out.print(sb1.toString());

		StringBuilder sb2 = new StringBuilder();
		for(int i=0; i<dy; i++) {
			sb2.append('D');
		}
		for(int i=0; i<dx; i++) {
			sb2.append('L');
		}
		System.out.print(sb2.toString());

		System.out.print("LU");
		System.out.print(sb1.toString());
		System.out.print("RD");

		System.out.print("RD");
		System.out.print(sb2.toString());
		System.out.print("LU");
	}

}


Measured memory_bytes: 21972
#include <bits/stdc++.h>
#define IO_OP std::ios::sync_with_stdio(0); std::cin.tie(0);
#define F first
#define S second
#define V vector
#define PB push_back
#define MP make_pair
#define EB emplace_back
#define ALL(v) (v).begin(), (v).end()
#define debug(x) cerr << #x << " is " << x << endl
#define int ll

using namespace std;

typedef long long ll;
typedef pair<int, int> pi;
typedef V<int> vi;

const int INF = 1e9 + 7, M = 1e9 + 7;

signed main()
{
	IO_OP;
	
	int n, k;
	cin >> n >> k;
	int ans = 0;
	for(int i = k; i <= n + 1; i++) {
		int l = i * (i - 1) / 2;
		int r = n * (n + 1) / 2 - (n-i)*(n-i+1) / 2;
		ans += (r - l + 1) % M;
	}
	ans %= M;
	cout << ans << endl;
	
}





Measured memory_bytes: 3652
//Created by Kira

#include<bits/stdc++.h>
using namespace std;

#define IOS cin.sync_with_stdio(0);cin.tie(0); cout.tie(0);
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
#define pii pair<int,int> 
#define pb push_back
#define vi vector<int> 
using ll = long long;

const int mod = 1e9 + 7;

ll pwr(ll a, ll b);
    



int main(){
   IOS

    
    int n, m, x; cin>>n>>m>>x;

    vi c(n);
    vector<vi> a(n, vi(m));

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

    int tc = 0, ans = 1e9;
    vi cur(m, 0);
    bool flag = true;

    for(int mask = 0; mask < (1<<n); mask++){
       tc = 0;
       cur.assign(m, 0);
        for(int i = 0; i < n; i++){
            if(mask & (1<<i)){
                tc += c[i];
                for(int j = 0; j < m; j++){
                    cur[j] += a[i][j];
                }
            }
        }
        flag = true;

        for(int j = 0; j < m; j++){
            if(cur[j] < x){
                flag = false;
                break;
            }
        }

        if(flag){
            ans = min(ans, tc);
        }
    }

    if(ans == 1e9)cout<<-1<<"\n";
    else cout<<ans<<"\n";



}

ll pwr(ll a, ll b){
   a %= mod;	//Remove mod if not required
   ll res = 1;
   while(b > 0){
    if(b&1)
        res = res * a % mod;
        a = a * a % mod;
    b >>= 1;
    }

    return res;
}



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

int a[101];

int main() {
	int n; cin>>n;
	for (int i=0; i<n; i++) {
		cin>>a[i];
	}
	sort(a, a+n);
	cout<<a[n-1]-a[0]<<endl;
}

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

#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define spa << " " <<
#define lfs <<fixed<<setprecision(10)<<
#define test cout<<"test"<<endl;
#define fi first
#define se second
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define rep(i,n,m) for(ll i = n; i < (ll)(m); i++)
#define rrep(i,n,m) for(ll i = n - 1; i >= (ll)(m); i--)
typedef long long ll;
typedef long double ld;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const ll INF = 1e18;
using P = pair<ll, ll>;
template<typename T>
void chmin(T &a,T b){if(a>b)a=b;}
template<typename T>
void chmax(T &a,T b){if(a<b)a=b;}
void pmod(ll &a,ll b){a=(a+b)%MOD;}
void pmod(ll &a,ll b,ll c){a=(b+c)%MOD;}
void qmod(ll &a,ll b){a=(a*b)%MOD;}
void qmod(ll &a,ll b,ll c){a=(b*c)%MOD;}
ll median(ll a,ll b, ll c){return a+b+c-max({a,b,c})-min({a,b,c});}
void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
template<typename T1,typename T2>
void ans(bool x,T1 y,T2 z){if(x)cout<<y<<endl;else cout<<z<<endl;}  
template<typename T>
void debug(vector<vector<T>>v,ll h,ll w){for(ll i=0;i<h;i++)
{cout<<v[i][0];for(ll j=1;j<w;j++)cout spa v[i][j];cout<<endl;}};
void debug(vector<string>v,ll h,ll w){for(ll i=0;i<h;i++)
{for(ll j=0;j<w;j++)cout<<v[i][j];cout<<endl;}};
template<typename T>
void debug(vector<T>v,ll n){cout<<v[0];
for(ll i=1;i<n;i++)cout spa v[i];cout<<endl;};
template<typename T>
vector<vector<T>>vec(ll x, ll y, T w){
  vector<vector<T>>v(x,vector<T>(y,w));return v;}
ll gcd(ll x,ll y){ll r;while(y!=0&&(r=x%y)!=0){x=y;y=r;}return y==0?x:y;}
template<typename T>
void emp(map<T,ll>&m, T x){m.emplace(x,0).first->second++;}
vector<ll>dx={1,0,-1,0,1,1,-1,-1};
vector<ll>dy={0,1,0,-1,1,-1,1,-1};

int main(){
  cin.tie(NULL);
  ios_base::sync_with_stdio(false);
  ll res=0,res1=INF,res2=-INF,buf=0;
  bool judge = true;
  ll n;cin>>n;
  string s;cin>>s;
  ll q;cin>>q;
  vector<ll>k(q);
  rep(i,0,q)cin>>k[i];
  ll m=s.size();
  rep(i,0,q){
    ll mnum=0,cnum=0,ret=0;
    res=0;
    ll r=0;
    rep(j,0,m-2){
      if(j>r){
        mnum=0,cnum=0,ret=0,r=j;
      }
      if(s[j]=='D'){
        while(r<m&&r-j<k[i]){
          if(s[r]=='M'){
            mnum++;
          }
          else if(s[r]=='C'){
            ret+=mnum;
            cnum++;
          }
          r++;
        }
        //cout<<j spa mnum spa cnum spa ret spa res<<endl;
        res+=ret;
        //cout<<i spa j<<endl;
      }
      else if(s[j]=='M'){
        mnum--;
        ret-=cnum;
      }
      else if(s[j]=='C'){
        cnum--;
      }
    }
    cout<<res<<endl;
  }
  return 0;
}

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

using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
#define REP(i,n) for(ll i = 0;i < (ll)n;i++)
#define REPD(i,n) for(ll i = (ll)n - 1;i >= 0;i--)
#define ALL(x) (x).begin(),(x).end()
#define FILLl(n,first_dimension_size,value) fill((ll*)n,(ll*)(n+first_dimension_size),value)
#define FILL(n,first_dimension_size,value) fill((int*)n,(int*)(n+first_dimension_size),value)
#define INF (1 << 30)
#define MOD 1000000007
//int dy[4] = {-1,0,0,1};
//int dx[4] = {0,1,-1,0};


int main(){

  int n;
  cin >> n;
  vector<vector<ll>> v(2,vector<ll>(n/2));
  REP(i,n/2)cin >> v[0][i] >> v[1][i];
  vector<vector<int>> co(2,vector<int>(100100,0));
  REP(i,n/2){
    co[0][v[0][i]]++;
    co[1][v[1][i]]++;
  }
  ll c1 = 0,c2 = 0;
  ll o1 = 0,o2 = 0;
  ll res = n;
  REP(i,100100)if(c1 < co[0][i])c1 = co[0][i],o1 = i;
  res -= c1;
  REP(i,100100)if(c2 < co[1][i])c2 = co[1][i],o2 = i;
  ll count1 = 0,count2 = 0;
  res -= c2;
  if(o1 == o2){
    REP(i,100100){
      if(i == o1)continue;
      if(count1 < co[0][i])count1 = co[0][i];
    }
    REP(i,100100){
      if(i == o2)continue;
      if(count2 < co[1][i])count2 = co[1][i];
    }
    res = min(n-(c1+count2),n-(c2+count1));
  }
  cout << res << endl;


  

  return 0;
}


Measured memory_bytes: 2172
#include <iostream>
#include <cstring>
#include <string>    
#include <vector>
#include <queue>
#include <map>
#include <algorithm>
#include <cmath>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
ll p, q, r;
string str;

int main(){
	cin >> p >> q >> r;
	cout << p+q+r-max(p, max(q, r));
	return 0;
}

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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}

int nextInt() { int x; scanf("%d", &x); return x;}

const ll MOD = (ll)(1e9 + 7);
ll dp[55][55][2505];

int main2() {
  int N = nextInt();
  int K = nextInt();
  if (K % 2 == 1) {
    cout << 0 << endl;
    return 0;
  }
  K /= 2;

  CLR(dp, 0);
  dp[0][0][0] = 1;
  for (int i = 0; i < N; i++) {
    for (int j = 0; j <= N; j++) {
      for (int k = 0; k <= N*N/2; k++) {
        dp[i][j][k] %= MOD;
        {
          dp[i+1][j][k+j] += dp[i][j][k];
        }
        {
          dp[i+1][j][k+j] += (2 * j * dp[i][j][k]) % MOD;
        }
        {
          dp[i+1][j+1][k+j+1] += dp[i][j][k];
        }
        if (j > 0) {
          dp[i+1][j-1][k+j-1] += (dp[i][j][k] * j * j) % MOD;
        }
      }
    }
  }
  ll ans = dp[N][0][K] % MOD;
  cout << ans << endl;
  return 0;
}

int main() {

#ifdef LOCAL
  for (;!cin.eof();cin>>ws)
#endif
    main2();
  return 0;
}


Measured memory_bytes: 59392
#include <iostream>
#include <vector>
#include <map>
#include <string>
#include <utility>
#include <algorithm>
#include <bitset>
#include <numeric>
#include <cmath>
#include <tuple>
#include <queue>
#include <set>

using namespace std;

typedef long long ll;
const ll INF = 1LL<<60;

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


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

    int N, K;

    cin >> N >> K;

    vector<ll> t(N);
    vector<ll> d(N);

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

    vector<pair<ll, ll>> sushi;
    vector<vector<ll>> val(N+1);

    ll max_index = 0;

    for(int i = 0; i < N; i++){
        sushi.push_back(make_pair(d[i], t[i]));
    }

    sort(sushi.rbegin(), sushi.rend());

    for(auto s : sushi) val[s.second].push_back(s.first);

    for(ll i = 1; i <= N; ++i){
        sort(val[i].rbegin(), val[i].rend());
        if (val[i].size() > 0) ++max_index;//寿司の数を数える
    }

    ll res = 0;
    set<ll> index;
    priority_queue<ll, vector<ll>, greater<ll>> min_queue;
    priority_queue<ll, vector<ll>> max_queue;

    for(int i = 0; i < K; i++){
        res += sushi[i].first;
        if(index.find(sushi[i].second) != index.end()){
            min_queue.push(sushi[i].first);//2個以上存在するものに対して、
        }
        index.insert(sushi[i].second);
    }

    for(ll i = 1; i <= N; ++i){// 全種類について
        if(index.find(i) == index.end() && val[i].size() > 0){//インデックス集合に含まれていなくて、
        // その種類の寿司が存在したら
            max_queue.push(val[i][0]);//最大の寿司を追加
        }
    }

    ll ans = res + (ll)index.size() * (ll)index.size();
    ll cnt = index.size();

    max_index = min<ll>(max_index, cnt + min_queue.size());

    while(cnt < max_index){

        ll min_n = min_queue.top(); min_queue.pop();
        ll max_n = max_queue.top(); max_queue.pop();

        res -= min_n;
        res += max_n;

        ++cnt;

        ans = max(ans, res + cnt * cnt);

    }

    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 12144
using System;

namespace ABC127_b
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] array = Console.ReadLine().Split(' ');
            int a = int.Parse(array[0]);
            int b = int.Parse(array[1]);
            int c = int.Parse(array[2]);
            int d = c;
            
           
            for(int i = 0; i < 10; i++)
            {
                d = a * d - b;
                
                Console.WriteLine(d);
               
            }
           
            
        }
    }
}


Measured memory_bytes: 11092
#include <iostream>
#include <cmath>

using namespace std;

int main() {
  int A, B, C;
  cin >> A >> B >> C;
  float s = static_cast<float>(A + B + C) / 2.0f;
  float S = sqrt(s * (s-A) * (s-B) * (s-C));
  
  cout << static_cast<int>(S) << endl;
  
  return 0;
}

Measured memory_bytes: 256