akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
const int inf = 1e9 + 7;
const ll INF = 1e18;
#define abs(x) (x >= 0 ? x : -(x))
#define lb(v, x) (int)(lower_bound(all(v), x) - v.begin())
#define ub(v, x) (int)(upper_bound(all(v), x) - v.begin())
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template<typename T> T pow(T a, int b) { return b ? pow(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
const int mod = 1000000007;
ll modpow(ll a, int b) { return b ? modpow(a * a % mod, b / 2) * (b % 2 ? a : 1) % mod : 1; }
template<class T> ostream& operator<<(ostream& os, const vector<T>& vec) { rep(i, sz(vec)) { if (i) os << " "; os << vec[i]; } return os; }
template<class T, class U> ostream& operator<<(ostream& os, const pair<T, U>& p) { os << p.F << " " << p.S; return os; }
template<class T> inline void add(T &a, int b) { a += b; if (a >= mod) a -= mod; }



void solve();

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cout << fixed << setprecision(10);
    
    int T;
    // cin >> T;
    T = 1;
    
    while (T--) {
        solve();
    }
}



using P = complex<double>;
double dot(P a, P b) { return real(conj(a) * b); }
double cross(P a, P b) { return imag(conj(a) * b); }
const double eps = 1e-8;

double dist_p_p(P a, P b) {
    return sqrt(pow(a.real() - b.real(), 2) + pow(a.imag() - b.imag(), 2));
}
double dist_p_l(P p, P p0, P p1) {
    // ax + by + c = 0
    double x0 = p0.real(), y0 = p0.imag(), x1 = p1.real(), y1 = p1.imag();
    
    double a = y1 - y0;
    double b = x0 - x1;
    double c = y0 * (x1 - x0) - (y1 - y0) * x0;
    
    double d = abs(a * p.real() + b * p.imag() + c) / sqrt(a * a + b * b);
    return d;
}

pair<P, P> inter_c_c(P p, P p2, double r, double r2) {
    double d = dist_p_p(p, p2);
    
    // 中心どうしの角度
    double t = arg(p2 - p);
    // 2 円の交点と p の角度
    // 余弦定理
    double a = acos((r * r + d * d - r2 * r2) / (2 * r * d));
    
    P p3 = P(p.real() + r * cos(t + a), p.imag() + r * sin(t + a));
    P p4 = P(p.real() + r * cos(t - a), p.imag() + r * sin(t - a));
    return make_pair(p3, p4);
}


void solve() {
    double x[2], y[2], r[2];
    rep(i, 2) cin >> x[i] >> y[i] >> r[i];
    pair<P, P> p3 = inter_c_c(P(x[0], y[0]), P(x[1], y[1]), r[0], r[1]);
    if (p3.F.imag() > p3.S.imag()) swap(p3.F, p3.S);
    if (p3.F.real() > p3.S.real()) swap(p3.F, p3.S);
    cout << p3.F.real() << " " << p3.F.imag() << " " << p3.S.real() << " " << p3.S.imag() << endl;
}




Measured memory_bytes: 3676
#include <bits/stdc++.h> 
#define REP(i, b) for(int i = 0; i < (b); i++)
#define REPS(i, b) for(int i = 1; i <= (b); i++)
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define ALL(v) (v).begin(), (v).end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
using vd = vector<double>;
using vs = vector<string>;
using vb = vector<bool>;
using vp = vector<P>;
using vvi = vector<vi>;
using vvl = vector<vl>;
using vvb = vector<vb>;
const int INF = 1e9;
const int MOD = 1e9+7;

int N;
vb isAppear;
vi node;

int root(int x)
{
    if(node[x] == x) return x;
    return node[x] = root(node[x]);
}

void unite(int x, int y)
{
    int rx = root(x);
    int ry = root(y);
    node[rx] = ry;
}

signed main()
{
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    
    cin >> N;
    vi P(N); REP(i, N) cin >> P[i]; 
    isAppear.resize(N+1, false);
    node.resize(N+1);
    REPS(i, N) node[i] = i;
    REP(i, N)
    {
        isAppear[P[i]] = true;
        if(isAppear[P[i]-1]) unite(P[i]-1, P[i]);
    }
    vi count(N+1); REPS(i, N) count[root(node[i])]++;
    int ans = 0;
    REPS(i, N) ans = max(ans, count[i]);
    cout << N-ans << endl;
}

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

using namespace std;

const double PI = 3.14159265358979323846;
typedef long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
//typedef pair<ll, ll> P;
typedef pair<double, double> P;
const ll INF = 10e17;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
#define ret() return 0;

double equal(double a, double b) {
    return fabs(a - b) < DBL_EPSILON;
}

std::istream &operator>>(std::istream &in, set<string> &o) {
    string a;
    in >> a;
    o.insert(a);
    return in;
}

std::istream &operator>>(std::istream &in, queue<int> &o) {
    ll a;
    in >> a;
    o.push(a);
    return in;
}

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }

//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);
//const ll mod = 1e10;

typedef priority_queue<ll, vector<ll>, greater<ll> > PQ_ASK;

int main() {

    vector<int> v(60000, -1);
    rep(i, 50000) v[i] = double(i) * 1.08;
    int x;
    cin >> x;
    auto it = find(v.begin(), v.end(), x);
    bool b = it != v.end();
    if (b) {
        cout << distance(v.begin(), it) << endl;
    } else {
        cout << ":(" << endl;
    }

}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=1000000007;
#define INF 1LL<<30
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()

int dp[110][10010];

int main() {
    int n,W;
    cin>>n>>W;
    int v[n],w[n];
    rep(i,n) cin>>v[i]>>w[i];

    dp[0][0]=0;
    rep(i,n){
        for(int j=0;j<=W;j++){
            dp[i+1][j]=max(dp[i+1][j],dp[i][j]);
            if(j-w[i]>=0) dp[i+1][j]=max(dp[i+1][j],dp[i+1][j-w[i]]+v[i]);
        }
    }

    cout<<dp[n][W]<<endl;
}




Measured memory_bytes: 7016
import itertools

n = int(input())
p = tuple(map(int,input().split()))
q = tuple(map(int,input().split()))


#print(p)
seq = [i for i in range(1,n+1)]
l = list(itertools.permutations(seq))
l.sort()

a = l.index(tuple(p))
b = l.index(tuple(q))

#print(l[0],p)
print(abs(a-b))

Measured memory_bytes: 8052
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0;i < n;i++)
#define rev(i, n) for(int i = n;i >= 0;i--)
#define Rep(i, m, n) for(int i = m;i < n;i++)
#define repeatrev(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define INF 999999999
#define itn int
const int MAX = 510000;


using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;
typedef priority_queue<int> Pr;

int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};
map<ll int, bool> M;
set<ll> S;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll int n;
    cin >> n;
    ll ans = 0;
    rep(i, n){
        ll a;
        cin >> a;
        if(S.count(a) == 0){
            S.insert(a);
            ans ++;
        }else{
            S.erase(a);
            ans --;
        }

    }
    cout << ans << endl;

}

Measured memory_bytes: 4992
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x1 = sc.nextInt();
		int y1 = sc.nextInt();
		int x2 = sc.nextInt();
		int y2 = sc.nextInt();

		int x3;
		int y3;
		int x4;
		int y4;

		int diffX = x2-x1;
		int diffY = y2-y1;
		x3 = x2 - diffY;
		y3 = y2 + diffX;
		x4 = x3 - diffX;
		y4 = y3 - diffY;
		System.out.println(x3 + " " + y3 + " " + x4 + " " + y4);
	}
}


Measured memory_bytes: 22996
def main():
    cnt = 0
    for _ in range(m):
        x, y = map(int, input().split())
        unite(x, y)
    for i in range(1, n+1):
        if same(i, p[i-1]):
            cnt += 1
    print(cnt)

def root(x):
    if par[x] == x:
        return x
    par[x] = root(par[x])
    return par[x]

def unite(x, y):
    root_x = root(x)
    if root_x != root(y):
        par[root_x] = y

def same(x, y):
    return root(x) == root(y)

if __name__ == "__main__":
    n, m = map(int, input().split())
    par = list(range(n+1))
    p = list(map(int, input().split()))
    main()

Measured memory_bytes: 122164
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define Graph vector<vector<int>>
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1000000007;

int main(){
    int N, K;
    cin >> N >> K;
    vector<int> A;
    string S;
    cin >> S;
    S += ' ';
    int first = S[0] - '0', index = 0;

    while(index < N){
        int tmp = 1;
        while(S[index] == S[index + 1]){
            tmp++;
            index++;
        }
        A.push_back(tmp);
        index++;
    }

    vector<int> sum(A.size() + 1, 0);

    for(int i = 1; i <= A.size(); i++){
        sum[i] = sum[i - 1] + A[i - 1];
    }

    int ans = 0;
    if(first == 1){
        for(int i = 1; i <= A.size(); i += 2){
            int j = i + 2 * K;
            bool flag = false;
            if(j > A.size()){
                j = A.size();
                flag = true;
            }
            ans = max(ans, sum[j] - sum[i - 1]);
            if(flag) break;
        }
    } else {
        for(int i = 0; i <= A.size(); i += 2){
            int j = i + 2 * K;
            bool flag = false;
            if(j > A.size()){
                j = A.size();
                flag = true;
            }
            if(i == 0 ) ans = sum[j];
            else ans = max(ans, sum[j] - sum[i - 1]);
            if(flag) break;
        }
    }

    cout << ans << endl;



}

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

int main() {
  int N;
  string s;
  cin >> N >>s;
  int M = 0;
  int num = 0;
  for (int i = 0; i < N; i++) {
    if (s[i] == 'I') num++;
    else num--;
    M = max(M, num);
  }
  cout << M << endl;
}

Measured memory_bytes: 256
# coding: utf-8
from decimal import Decimal

# 標準入力 <int><int>
N, M = map(int, input().split())

# 標準入力 <int> list[]
n = list(map(int, input().split()))

n = sorted(n)
sosu = Decimal(str(sum(n)))
toku = Decimal("1") / Decimal(str((4 * M)))
border = sosu * toku

if n[M * -1] < border:
  print("No")
else:
  print("Yes")


Measured memory_bytes: 5576
#include <stdio.h>
#include <math.h>

int main()
{
    int a, b,s;
    int cnt = 0;
    while( scanf( "%d %d", &a, &b ) != EOF )
    {
	s = a + b;
	cnt = 0;
	do
	{
	    s /= 10;
	    cnt++;
	}
	while( s != 0 );

	printf( "%d\n", cnt );
    }
    return 0;
}

Measured memory_bytes: 600
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <bitset>
#include <string>
using namespace std;

const long long int INF = 1000000007;

int main(void)
{
    string s;
    cin >> s;

    int max = 0;
    int now = 0;
    for (int i = 0; i < 3; i++)
    {
        if (s[i] == 'R')
        {
            now++;
        }
        else
        {
            max = (max < now)? now : max;
            now = 0;
        }
        
    }
    max = (max < now)? now : max;
    
    cout << max << endl;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
using ll = long long;
int INF = 1000000009;
int main()
{
    int n,m;
    cin >> n >> m;
    cout << (n - 1) * (m - 1) << endl;
}

Measured memory_bytes: 256
#include <string>
#include <vector>
#include <map>
#include <list>
#include <iterator>
#include <set>
#include <queue>
#include <iostream>
#include <sstream>
#include <stack>
#include <deque>
#include <cmath>
#include <memory.h>
#include <ctime>
#include <cstdlib>
#include <cstdio>
#include <cctype>
#include <algorithm>
#include <utility>
#include <fstream>
#include <cassert>

using namespace std;

#define FOR(i, a, b) for(int i = a; i < b; ++i)
#define RFOR(i, b, a) for(int i = b - 1; i >= a; --i)
#define REP(i, N) FOR(i, 0, N)
#define RREP(i, N) RFOR(i, N, 0)

#define ALL(V) V.begin(), V.end()
#define SIZE(V) (int)V.size()
#define pb push_back
#define mp make_pair
#define EPS 1e-7
#define Pi 3.14159265358979
#define FILL(a,v) memset(a,v,sizeof(a))

using namespace std;


typedef long long Long;
typedef unsigned long long ULong;
typedef unsigned int Uint;
typedef unsigned char Uchar;
typedef vector <int> VI;
typedef pair <int, int> PII;



string s,t;

int n,m;

Long gcd(int a, int b) { if (a<b) swap(a,b); return b?gcd(b,a%b):a; }

Long check() {
    if (s[0] != t[0])
        return -1;

    FOR(i,1,n) {
        Long x = i;
        Long u = x*m;
        if (u%n != 0)
            continue;

        Long y = u/n;
        if (y >= m)
            continue;
        if (s[x] != t[y])
            return -1;
    }

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


int main() {
    ios_base::sync_with_stdio(false);


    cin >> n >> m >> s >> t;
    cout << check() << endl;


    return 0;
}

Measured memory_bytes: 640
#include <stdio.h>

int min(int a,int b){
  if(a<b){
    return a;
  }
  return b;
}

int main(){
  int A,B,C,X,Y;
  scanf("%d%d%d%d%d",&A,&B,&C,&X,&Y);
  if(2*C-A-B>0){
    printf("%d",A*X+B*Y);
    return 0;
  }
  if(X>=Y){
    printf("%d",2*C*Y+(X-Y)*min(2*C,A));
    return 0;
  }
  printf("%d",2*C*X+(Y-X)*min(2*C,B));
  return 0;
}


Measured memory_bytes: 128
# -*- coding: utf-8 -*-
"""
https://beta.atcoder.jp/contests/abc074/tasks/abc074_b


"""
import sys
from sys import stdin
input = stdin.readline


def main(args):
    N = int(input())
    K = int(input())
    balls = [int(x) for x in input().split()]

    total_step = 0
    for b in balls:
        step_a = 2 * b
        step_b = 2 * abs(K - b)
        step = min(step_a, step_b)
        total_step += step

    print(total_step)


if __name__ == '__main__':
    main(sys.argv[1:])
    


Measured memory_bytes: 3064
words = lambda t : list(map(t, input().split()))
n = int(input())

vs = [[] for i in range(n)]
for i in range(n-1):
    s,e = words(int)
    vs[s-1].append((e-1,i))

import queue
q = queue.Queue()
q.put(0)
color = [0] * (n-1)
color_par = [0] * (n)
color_par[0] = -1
while not q.empty():
    v = q.get()
    cur_c = 1
    for (c,i) in vs[v]:
        if color_par[v] == cur_c:
            cur_c +=1
        color[i] = cur_c
        color_par[c] = cur_c
        cur_c += 1
        q.put(c)

print(max(color))
for i in range(n-1):
    print(color[i])


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

#define xx first
#define yy second

const int N = 1e5 + 1;
const int oo = 2e9 + 1;

int dp[N], h[N];

void solve() {
    int n, k; cin >> n >> k;
    for (int i = 0; i < n; i++)
        cin >> h[i];
    fill(dp, dp + n, oo);
    dp[0] = 0;
    for (int i = 0; i < n; i++)
        for (int j = 1; j <= k && i - j >= 0; j++)
            dp[i] = min(dp[i], dp[i - j] + abs(h[i] - h[i - j]));
    cout << dp[n - 1] << '\n';
}
int main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    // int _; cin >> _; while (_--)
    solve();
    return 0;
}


Measured memory_bytes: 4376
/*
　　　  ∧＿∧　やあ
　　 （´・ω・｀)　　　　　/　　　　　ようこそ、バーボンハウスへ。
　　 ／∇y:::::＼　　　 [￣]　　　　　このテキーラはサービスだから、まず飲んで落ち着いて欲しい。
　　 |:⊃:|:::::|　　　|──|
￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣|　うん、「また」なんだ。済まない。
￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣|￣　  仏の顔もって言うしね、謝って許してもらおうとも思っていない。
￣￣￣￣￣￣￣￣￣￣￣￣￣￣／|
　　　　∇　∇　∇　∇　　　／.／|　　　でも、この提出を見たとき、君は、きっと言葉では言い表せない
　　　　┴　┴　┴　┴　／ ／　  |　　　「ときめき」みたいなものを感じてくれたと思う。
￣￣￣￣￣￣￣￣￣￣|／　　  |　　　殺伐としたコンテストの中で、そういう気持ちを忘れないで欲しい
￣￣￣￣￣￣￣￣￣￣　　　　 |　　　そう思って、この提出を投げたんだ。
　　　(⊆⊇)　(⊆⊇)　(⊆⊇)　　|
　    ||　　 ||　　||　　|　　　 じゃあ、判定を聞こうか。
　　.／|＼　／|＼ ／|＼
*/

#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <array>
#include <bitset>
#include <climits>
#include <cmath>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
#define fst first
#define snd second
#define ALL(obj) (obj).begin(),(obj).end()
#define debug(x) cerr << #x << " -> " << x << " (line:" << __LINE__ << ")" << '\n';
#define debugpair(x, y) cerr << "(" << #x << ", " << #y << ") -> (" << x << ", " << y << ") (line:" << __LINE__ << ")" << '\n';
typedef long long lint;
typedef priority_queue<lint> p_que;
typedef priority_queue<lint, vector<lint>, greater<lint>()> p_que_rev;
const lint INF = INT_MAX;
const lint LINF = LLONG_MAX;
const lint MOD = 1000000000 + 7;
const double EPS = 1e-9;
const double PI = acos(-1);
const lint di[]{0, -1, 0, 1, -1, -1, 1, 1};
const lint dj[]{1, 0, -1, 0, 1, -1, -1, 1};

int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    lint a, b;
    lint ans = 0;
    cin >> a >> b;
    vector<lint> pow(41, 1);
    for (int i=0; i<40; ++i){
        pow[i+1] = pow[i] * 2;
    }
    lint m;
    lint k = 1;
    for (int i=0; i<40; ++i){
        if(k <= b && b < k * 2){
            m = i;
            break;
        }
        else {
            k *= 2;
        }
    }
    //debug(m);
    vector<lint> count1(40, 0);
    vector<lint> count2(40, 0);
    for (int i=m; i>=0; --i){
        lint p = b / pow[i];
        count1[i] = (p / 2) * pow[i];
        if(p % 2 == 1){
            count1[i] += b % pow[i] + 1;
        }
        //debug(count1[i]);
    }
    a--;
    for (int i=m; i>=0; --i){
        lint p = a / pow[i];
        count2[i] += (p / 2) * pow[i];
        if(p % 2 == 1){
            count2[i] += a % pow[i] + 1;
        }
        //debug(count2[i]);
    }
    for (int i=0; i<40; ++i){
        if((count1[i] - count2[i]) % 2 == 1){
            ans += pow[i];
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
(eval-when (:compile-toplevel :load-toplevel :execute)
  (defparameter OPT
    #+swank '(optimize (speed 3) (safety 2))
    #-swank '(optimize (speed 3) (safety 0) (debug 0)))
  #+swank (progn (ql:quickload '(:cl-debug-print :fiveam))
                 (shadow :run)
                 (use-package :fiveam)))
#+swank (cl-syntax:use-syntax cl-debug-print:debug-print-syntax)

;; BEGIN_INSERTED_CONTENTS
(defun displace (vec &optional (start 0) end)
  "displaced subseq"
  (let ((end (or end (length vec))))
    (make-array (- end start)
                :element-type (array-element-type vec)
                :displaced-to vec
                :displaced-index-offset start)))

(defmacro define-int-types (&rest bits)
  `(progn
     ,@(mapcar (lambda (b) `(deftype ,(intern (format nil "UINT~A" b)) () '(unsigned-byte ,b))) bits)
     ,@(mapcar (lambda (b) `(deftype ,(intern (format nil "INT~A" b)) () '(signed-byte ,b))) bits)))
(define-int-types 2 4 7 8 15 16 31 32 62 63 64)

(defmacro println (obj &optional (stream '*standard-output*))
  `(let ((*read-default-float-format* 'double-float))
     (prog1 (princ ,obj ,stream) (terpri ,stream))))

(defconstant +mod+ 1000000007)

;; Hauptteil

(declaim (inline extract))
(defun extract (mask s)
  (let* ((len (length s))
         (red-len (logcount mask))
         (red-res (make-string red-len :element-type 'base-char))
         (blue-res (make-string (- len red-len) :element-type 'base-char)))
    (loop with red-i = 0
          with blue-i = 0
          for pos below len
          do (if (logbitp pos mask)
                 (progn (setf (aref red-res red-i) (aref s pos))
                        (incf red-i))
                 (progn (setf (aref blue-res blue-i) (aref s pos))
                        (incf blue-i))))
    (cons red-res blue-res)))

(defun main ()
  (declare #.OPT)
  (let* ((n (read))
         (s (read-line))
         (s1 (coerce (reverse (displace s 0 n)) 'simple-base-string))
         (s2 (coerce (displace s n (+ n n)) 'simple-base-string))
         (table (make-hash-table :test #'equalp :size #.(expt 2 18))))
    (declare ((integer 1 18) n))
    (dotimes (mask (expt 2 n))
      (let ((key (extract mask s1)))
        (multiple-value-bind (value presentp) (gethash key table)
          (if presentp
              (setf (gethash key table) (1+ (the uint32 value)))
              (setf (gethash key table) 1)))))
    (let ((res 0))
      (declare (fixnum res))
      (dotimes (mask (expt 2 n))
        (let* ((key (extract mask s2))
               (value (gethash key table)))
          (when value
            (incf res (the uint32 value)))))
      (println res))))

#-swank(main)


Measured memory_bytes: 80360
#include<iostream>
#include<vector>
#include<numeric>
#include<algorithm>
#include<iomanip>
#include<math.h>
using namespace std;
int main() {

	//C
	int n;
	cin >> n;
	long double x[8], y[8];
	int i;
	for (i = 0; i < n; i++) {
		cin >> x[i] >> y[i];
	}
	long double dis[8][8];
	long double discounter = 0;
	int j;
	for (i = 0; i < n; i++) {
		for (j = 0; j < n; j++) {
			dis[i][j] = (x[i] - x[j]) * (x[i] - x[j]) + (y[i] - y[j]) * (y[i] - y[j]);
			dis[i][j] = sqrt(dis[i][j]);
			discounter = discounter + dis[i][j];
		}
	}
	discounter = discounter / n;
	cout << fixed;
	cout << setprecision(10);
	cout << discounter << endl;
	return 0;



	/*
	vector<int> nums(n);
	iota(nums.begin(), nums.end(), 0);

	long double avepath = 0;
	do {
		for (i = 0; i < n - 1; i++) {
			avepath = avepath +		sqrt(dis[nums[i]][nums[i+1]])
		}
	} while (next_permutation(nums.begin(), nums.end()));
	/*
	
	//B
	/*int n;
	string s;
	cin >> n;
	cin >> s;
	int i;
	if (n % 2 == 1) {
		cout << "No" << endl;
		return 0;
	}
	for (i = 0; i < n / 2; i++) {
		if (s[i] != s[i + (n / 2)]) {
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
	return 0;*/
}

Measured memory_bytes: 384
import java.util.Scanner;
import java.util.List;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
	int a = sc.nextInt();
    int b = sc.nextInt();
    int c = sc.nextInt();
    if ( c >= a && c <= b) {
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }
  }
}

Measured memory_bytes: 21716
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)*}
    };
}

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)*}
    };
}

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, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

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

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

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

#[allow(unused_imports)]
use std::cmp::{min, max};

fn main() {
    input!{
        q: usize,
        qs: [(usize1, usize1, usize1, usize1); q]
    }
    'next: for i in 0..q {
        let a = min(qs[i].0, qs[i].2);
        let b = min(qs[i].1, qs[i].3);
        let c = max(qs[i].0, qs[i].2);
        let d = max(qs[i].1, qs[i].3);
        for i in (0..30).rev() {
            let r = 3usize.pow(i);
            if a / r % 3 == 1 && a / r == c / r && d / r - b / r >= 2 {
                println!("{}", d - b + min(a % r + c % r + 2, 2 * r - a % r - c % r));
                continue 'next;
            }
            if b / r % 3 == 1 && b / r == d / r && c / r - a / r >= 2 {
                println!("{}", c - a + min(b % r + d % r + 2, 2 * r - b % r - d % r));
                continue 'next;
            }
        }
        println!("{}", c + d - a - b);
    }
}


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

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) a.begin(),a.end()

int main(){
    int x,a,b;cin>>x>>a>>b;
    if(a>=b)cout<<"delicious"<<endl;
    else if(x>=b-a)cout<<"safe"<<endl;
    else cout<<"dangerous"<<endl;
    return 0;
}

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


#define f(i,a,b) for(int i=(int)(a);i<=(int)(b);i++)
#define char_f(i,a) for(int i=(int)(a);(char)s[i]!='\0';i++)
#define rf(i,a,b) for(int i=(int)(a);i>=(int)(b);i--)
#define llf(i,a,b) for(long long int i=(long long int)(a);i<=(long long int)(b);i++)
#define llrf(i,a,b) for(long long int i=(long long int)(a);i>=(long long int)(b);i--)



#define ll long long
#define fi first
#define se second
#define pb push_back
#define pob pop_back
#define mem(ara,x) memset((ara),x,sizeof(ara))
#define memn(ara) memset((ara),-1,sizeof(ara))
#define bb begin()
#define ee end()
#define em emplace
#define eb emplace_back





#define si set<int>
#define sd set<double>
#define sll set<long long int>
#define ss set<string>
#define sc set<char>

#define pii pair<int,int>
#define pli pair<long long int,int>
#define pil pair<int,long long int>
#define pll pair<long long int,long long int>
#define pci pair<char,int>
#define pic pair<int,char>
#define pcl pair<char,long long int>
#define plc pair<long long int,char>

#define pss pair<string,string>
#define pcc pair<char,char>

#define pis pair<int,string>
#define psi pair<string,int>
#define pls pair<long long int,string>
#define psl pair<string,long long int>
#define pdd pair<double,double>
#define pcs pair<char,string>
#define psc pair<string,char>



#define vi  vector<int>
#define vll vector<long long int>
#define vd vector<double>
#define vs vector<string>
#define vc vector<char>
#define vii vector<pii>



#define mod 1000000007
#define mx (1<<30)-1
#define llmx (1ll<<62)
#define n_size 100005
#define g_size 10000005
double PI=acos(-1);
#define eps 1e-9



///unsigned int uMAX=4294967295;
///unsigned ll int ullMAX=18446744073709551615;





int arr[g_size];



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

	int n,m,T,res;

	int maxi=-mx,mini=mx,count=0;

	int i,j,k;

	bool flag;

	string s1,s2;

	char s[100000];

	int ara[n_size],ara2[n_size];

	cin>>ara[0]>>ara[1]>>ara[2];

	sort(ara,ara+3);

	cout<<abs(ara[0]-ara[1])+abs(ara[1]-ara[2])<<endl;



}


Measured memory_bytes: 3664
#include<iostream>
#include<vector>

using namespace std;

int main(){

    int r,D;
    vector<int> x(11);

    cin >> r >> D >> x[0];

    for(int i=1;i<x.size();i++){
        x[i]=r*x[i-1]-D;
        cout << x[i] << endl;
    }

    return 0;
}

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



class Myon
{
    public Myon() { }
    public static int Main()
    {
        new Myon().calc();
        return 0;
    }


    Scanner cin;

    void calc()
    {
        cin = new Scanner();
        int N = cin.nextInt();
        int[] A = cin.ArrayInt(N, -1);
        int start = 0;
        Dictionary<int, int> dic = new Dictionary<int, int>();
        while(start != 1)
        {
            if (dic.ContainsKey(start))
            {
                Console.WriteLine(-1);
                return;
            }
            dic[start] = 1;
            start = A[start];
        }
        Console.WriteLine(dic.Count);
    }

}



class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }


    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}


Measured memory_bytes: 20692
S = input()
left = int(S[:2])
right = int(S[2:])
year_flag = [0, 0]

if left > 12 or left == 0:
    year_flag[0] += 1
if right > 12 or right == 0:
    year_flag[1] += 1

if sum(year_flag) == 2:
    print('NA')
elif sum(year_flag) == 0:
    print('AMBIGUOUS')
elif year_flag[0] == 1:
    print('YYMM')
else:
    print('MMYY')


Measured memory_bytes: 61964
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main() {
	// 入力
	int T, X;
	cin >> T >> X;
	cout << (T / (double)X);

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cmath>

using namespace std;

int main(void){
  char suffix = 'x';
  bool used[26];
  bool oneletter = false;
  string AI;
  string rep,tmp;
  int length;
  map<string,bool> pused;

  //èªgÁ½©Ç¤©
  memset(used, false, sizeof(used));

  printf("?x\n"); fflush(stdout);
  cin >> AI;
  while(1){
    rep = "";

    //I¹ð
    if(AI[0] != suffix || 
       AI.size() == 1 ||
       AI.size() == 2 && used[AI[1] - 'a'] ||
       AI.size() > 2){
      printf("!OUT\n"); fflush(stdout);
      break;
    }else{
      if(AI.size() == 1){
	oneletter = true;
      }else{
	used[AI[1] - 'a'] = true;
      }
    }
    if(AI[AI.size() - 1] != 'x'){
      rep += AI[AI.size() - 1];
    }else{
      rep += "xx";
    }
    rep += suffix;
    cout << "?" << rep << endl;
    fflush(stdout);
    cin >> AI;
  }
  
}

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

inline void ioThings() {
  ios::sync_with_stdio(0);
  cin.tie(0);
#ifdef LOCAL
  freopen("io\\in.txt", "r", stdin);
  freopen("io\\out.txt", "w", stdout);
#endif
}

using   ll        = long long;
#define debug(x)    cerr << #x << ": <" << (x) << ">\n"
#define dotc()      int tcs; if (cin >> tcs) for (int tc = 0; tc < tcs; tc++)
#define sz(x)       (int)x.size()
#define eb          emplace_back
#define pb          push_back
#define all(x)      x.begin(), x.end()
#define rall(x)     x.rbegin(), x.rend()
#define fi          first
#define se          second
#define mod         1000000007

using vi = vector<int>;

int main() {
  ioThings();

  string s; cin >> s;
  int size = sz(s);
  
  vector<int> a1(size), a2(size);
  for (int i = 0; i < size; i++) {
    a1[i] = s[i] - '0';
    a2[i] = 10 - a1[i];
    for (int j = i - 1; j >= 0; j--) {
      if (a2[j]) {
        a2[j]--;
        break;
      } else
        a2[j] = 9;
    }
  }

  // dp = pos, who's turn to pay -> accumulated notes
  vector<vi> dp(size + 1, vi(2, 1e9));
  dp[0][0] = 0;
  dp[0][1] = 1;
  for (int i = 0; i < size; i++) {
    dp[i + 1][0] = min(dp[i][0] + a1[i], dp[i][1] + a2[i] + 1);
    dp[i + 1][1] = min(dp[i][1] + a2[i], dp[i][0] + a1[i] + 1);
  }

  cout << min(dp[size][0], dp[size][1]);

  return 0;
}


Measured memory_bytes: 63772
#include <iostream>
#include <string>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <vector>
#include <bitset>
#include <functional>
#include <queue>
#include <utility>

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define dump(x)  cerr << #x << " = " << (x) << endl;
typedef long long LL;

using namespace std;

int main(void)
{
	int N;
	double x[11];
	string u[11];

	cin >> N;
	FOR(i, 0, N) {
		cin >> x[i] >> u[i];
	}

	double sum = 0;
	FOR(i, 0, N) {
		if (u[i] == "JPY") {
			sum += x[i];
		}
		else {
			sum += 380000.0 * x[i];
		}
	}

	cout << sum << endl;

	return 0;
}

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

using namespace std;

int main(){
	
  string s,t;
  bool f;
  cin>>s>>t;
  int len = s.size();
  for(int i=0;i<len;i++){
  	if(s[i] == t[i]){
    	f = true;
    }
    else{
    	f = false;break;
    }
  }
  
  if(f){
   cout<<"Yes\n";
  }
  else{
   cout<<"No\n";
  }

return 0;
}


Measured memory_bytes: 3620
s = gets.to_i
cnt = 4
if !(s == 1 || s == 2)
  while !(s == 4)
    if s%2 == 0
      s /= 2
      cnt += 1
    else
      s *= 3
      s += 1
      cnt += 1
    end
  end
end
puts cnt

Measured memory_bytes: 1788
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define dunk(n) cout << n << endl
#define all(v) v.begin(), v.end()


int main() {
    string s;
    int q;
    cin >> s >> q;
    
    deque<char> deq;
    for(auto x : s) deq.push_back(x);
    
    int t, f;
    char c;
    bool flip = false;
    
    rep(i,q){
        cin >> t;
        if(t == 1) flip = !flip;
        else{
            cin >> f >> c;
            if(flip) f = 3-f;
            if(f == 1) deq.push_front(c);
            else deq.push_back(c);
        }
    }
    
    if(flip) reverse(all(deq));
    string ans;
    for(char x : deq) ans += x;
    
    dunk(ans);
    
    return 0;
}



Measured memory_bytes: 1412
#include<iostream>
#include<string>
#include<algorithm>
#include<math.h>
#include<queue>
#include<set>
#include<map>
#include<random>
#include<functional>
#include<utility>

typedef long long ll;

#define rep(i,n) for(int i=0; i<n; i++)
#define pb push_back
#define P pair<int, int>
#define PLI pair<ll, int>
#define PLL pair<ll, ll>
#define VI vector<int>
#define VII vector<VI>

using namespace std;


int N, M;
VI p, sum;
int main() {
	while (cin >> N >> M, N)
	{
		p = VI(N+1);
		sum.clear();
		p[0] = 0;
		rep(i, N) cin >> p[i+1];

		sort(p.begin(), p.end());
		rep(i, N+1) {
			for (int j = i; j < N+1; j++) {
				if (p[i] + p[j] > M) break;
				sum.push_back(p[i] + p[j]);
			}
		}

		int ans = 0;
		sort(sum.begin(), sum.end());
		for (auto& it : sum) {
			if (it > M / 2) break;
			auto an = upper_bound(sum.begin(), sum.end(), M - it) - 1;
			int tmp = it + *an;
			ans = max(ans, tmp);
		}

		cout << ans << endl;
	}

	return 0;
}



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

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

int main() {
    ll n,p;cin>>n>>p;
    ll p1 = pow(p,1.0/n);
  //          cout<<p1<<endl;
  
    for(ll i=p1+100;i>=1;--i){
        ll tmp = pow(i,n);
        if(p%tmp==0){
            cout<<i<<endl;
            return 0;
        }
    }
    
	return 0;
}

Measured memory_bytes: 384
x,y,z,k = map(int,input().split())
lisa = list(map(int,input().split()))
lisb = list(map(int,input().split()))
lisc = list(map(int,input().split()))
lisa.sort(reverse=True)
lisb.sort(reverse=True)
lisc.sort(reverse=True)
an = []
ans = []
for num in lisb:
    for nu in lisa:
        an.append(num+nu)
an.sort(reverse=True)
an = an[:min(3001,x*y*z+1)]
for num in lisc:
    for nu in an:
        ans.append(num+nu)
ans.sort(reverse=True)
for i in range(k):
    print(ans[i])


Measured memory_bytes: 161272
#include <cstdio>
#define maxn 200005
using namespace std;

int cnt[maxn];

int main(int argc, char** argv)
{
	int n;
	scanf("%d", &n);
	for(int i=1; i<n; i++)
	{
		int x;
		scanf("%d", &x);
		cnt[--x] ++;
	}
	for(int i=0; i<n; i++) printf("%d\n", cnt[i]);
	return 0;
}

Measured memory_bytes: 2460
s=input()
if s=="SUN":
  print("7")
if s=="MON":
  print("6")
if s=="TUE":
  print("5")
if s=="WED":
  print("4")
if s=="THU":
  print("3")
if s=="FRI":
  print("2")
if s=="SAT":
  print("1")

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

static const int MAX_NUM = 25;
static const int NOELEM = -1;

struct stNode {
	int parent;
	int left;
	int right;
};

int SerchHight(stNode elem[], int key)
{
	int ret = 0;
	int h1 = 0;
	int h2 = 0;

	if (key != NOELEM) {
		h1 += SerchHight(elem, elem[key].left) + 1;
		h2 += SerchHight(elem, elem[key].right) + 1;
		ret = (h1 >= h2) ? h1 : h2;
	}

	return ret;
}

int main(void)
{
	int i;
	int num;
	int tmp;
	stNode elem[MAX_NUM];
	int key, left, right;

	scanf("%d", &num);
	for (i = 0; i < num; i++) {
		elem[i].parent = NOELEM;
		elem[i].left = NOELEM;
		elem[i].right = NOELEM;
	}

	for (i = 0; i < num; i++) {
		scanf("%d %d %d", &key, &left, &right);
		elem[key].left = left;
		elem[key].right = right;
		elem[left].parent = key;
		elem[right].parent = key;
	}

	for (i = 0; i < num; i++) {
		key = elem[i].parent;
		printf("node %d: parent = %d, ", i, key);
		if (key != NOELEM) {
			tmp = (elem[key].left != i) ? elem[key].left : elem[key].right;
			printf("sibling = %d, ", tmp);
		}
		else {
			printf("sibling = -1, ");
		}
		tmp = 0;
		if (elem[i].left != NOELEM) {
			++tmp;
		}
		if (elem[i].right != NOELEM) {
			++tmp;
		}
		printf("degree = %d, ", tmp);
		tmp = 0;
		while (key != NOELEM) {
			++tmp;
			key = elem[key].parent;
		}
		printf("depth = %d, ", tmp);
		tmp = SerchHight(elem, i);
		printf("height = %d, ", tmp - 1);
		if (elem[i].parent == NOELEM) {
			printf("root\n");
		}
		else if ((elem[i].left != NOELEM) || (elem[i].right != NOELEM)) {
			printf("internal node\n");
		}
		else {
			printf("leaf\n");
		}
	}

	return 0;
}

Measured memory_bytes: 3152
import heapq
N, M = map(int, input().split())
H = [[] for _ in range(M)]
for _ in range(N):
  A, B = map(int, input().split())
  if A <= M:
    H[A - 1].append(-B)
Q = []
cnt = 0
for d in range(M):
  for b in H[d]:
    heapq.heappush(Q, b)
  if Q:
    cnt -= heapq.heappop(Q)
print(cnt)

Measured memory_bytes: 17604
#include <stdio.h>

int main(void) {
  int i;
  int num;
  int a;
  int b;
  int remain;
  int div;
  int subtotal = 0;
  int total = 0;
  
  scanf("%d %d %d", &num, &a, &b);
  for(i = 1; i <= num; i++){
    div = i;
  	while(div > 0) {
      remain = div % 10;
      div = div / 10;
      subtotal = subtotal + remain; 
    }
    if(subtotal >= a && subtotal <= b) total = total + i;
    subtotal = 0;
  }
  printf("%d\n", total);
}

Measured memory_bytes: 128
import java.util.*;

class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        boolean bl = false;
        String s = sc.next();
        for(int i = 0; i < 3; i++){
            bl |= (s.charAt(i) == '7');
        }
        if(bl)System.out.println("Yes"); else System.out.println("No");
    }
}


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

#define N 100

int main(){
  int M[N][N];
  int n, u, k, v;

  cin >> n;

  for(int i=0; i<n; ++i){
    for(int j=0; j<n; ++j) M[i][j] = 0;
  }
  
  for(int i=0; i<n; ++i){
    cin >> u >> k;
    --u;
    for(int j=0; j<k; ++j){
      cin >> v;
      --v;
      M[u][v] = 1;
    }
  }

  for(int i=0; i<n; ++i){
    for(int j=0; j<n; ++j){
      if(j) cout << " ";
      cout << M[i][j];
    }
    cout << endl;
  }

  


  return 0;
}



Measured memory_bytes: 3132
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <vector>
using namespace std;
#define int long long
const int N=56;
int n,m;
int dp[N][N*N];//选用i张卡牌,卡牌之和为j的方案数
int a[N];
int sum;
int ans=0;
signed main()
{
	scanf("%lld%lld",&n,&m);
	for(int i=1; i<=n; i++)
		scanf("%lld",&a[i]),sum+=a[i];
	sort(a+1,a+n+1);
	dp[0][0]=1;
	for(int i=1; i<=n; i++)
		for(int j=i; j>=1; j--)
		{
			for(int k=sum; k>=a[i]; k--)
				dp[j][k]+=dp[j-1][k-a[i]];
		}
	for(int i=1; i<=n; i++)
		ans+=dp[i][i*m];
	printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 1280
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

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

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

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

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

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

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

fn main() {
    input!{
        a: f64,
        b: f64,
        x: f64,
    }
    if x <= 0.5 * a * a * b { println!("{}", (a * b.powi(2) / (2.0 * x)).atan().to_degrees()); }
    else { println!("{}", (2.0 * (a.powi(2) * b - x) / a.powi(3)).atan().to_degrees()); }
}


Measured memory_bytes: 4732
#include <iostream>
#include <cstdio>
#include <string>
using namespace std;

int main(){
	int ans=0;
	string s;
	while(cin >> s){
		bool flag=true;
		for(int i=0; i<s.size(); ++i){
			if(s[i] != s[s.size()-i-1]){
				flag=false;
				break;
			}
		}
		
		if(flag) ++ans;
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 1180
#include <iostream>
#include <string>
#include <list>
#include <algorithm>
#include <iterator>

using namespace std;

void show(int x);

int main()
{
	list<int> L;
	int q;
	cin >> q;
//	L.push_front(9);
	list<int>:: iterator it = L.begin();
	while (q--)
	{
		int cmd;
		cin >> cmd;
		if (cmd == 0)
		{
			int x;
			cin >> x;
		 	it = L.insert(it, x);
//			cout << *it << endl;
		}
		else if (cmd == 1)
		{
			int d;
			cin >> d;
//			if (d > 0)
//				while (d--)
//					it++;
//			else if (d < 0)
//				while (d++)
//					it--;
			
			advance(it, d);
		}
		else 
		{
			it = L.erase(it);
		}
		
	} 
	
	for_each(L.begin(), L.end(), show);
}



void show(int x)
{
	cout << x << endl;
}


Measured memory_bytes: 18564
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
const ll MOD = 1000000007;

int main(){
    string S;
    cin >> S;

    for(int i=0;i+1<S.size();i++){
        if(S[i] == 'A' && S[i+1] == 'C'){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<iostream>
#include<algorithm> 
#include<cstring>
#define ios ios::sync_with_stdio(false)
#define mem(arr) memset(arr,0,sizeof(arr))
using namespace std;
typedef long long ll;
const ll maxn = 1e6 + 10;
int main()
{
	int x;
	cin>>x;
	if(x == 0)
		cout<<1<<endl;
	else if(x == 1)
		cout<<0<<endl;
	return 0; 
}

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

int main() {
    string s; cin >> s;
    int ans = 1e9;
    rep(i, s.size() - 2) {
        int num = stoi(s.substr(i, 3));
        ans = min(ans, abs(753 - num));
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var N int
	fmt.Scanf("%d\n", &N)
	A := make([]int, N)
	am := make(map[int]int, N)
	for i := 0; i < N; i++ {
		var a int
		fmt.Scan(&a)
		A[i] = a
		am[a]++
	}
	var result int
	rm := make(map[int]int, len(am))
	for k, num := range am {
		if num < 2 {
			rm[k] = 0
			continue
		}
		if num == 2 {
			result += 1
			rm[k] = 1
			continue
		}
		r := 1
		for i := 0; i < num; i++ {
			if num-2 < i+1 {
				r = r * (i + 1)
			}
		}
		r = r / 2
		result += r
		rm[k] = r
	}
	for i := 0; i < N; i++ {
		v := A[i]
		sum := rm[v]
		num := am[v]
		if sum == 0 {
			fmt.Println(result)
		} else if sum == 1 {
			fmt.Println(result - 1)
		} else {
          fmt.Println(result - (sum - sum*(num-2)/num))
		}
	}
}


Measured memory_bytes: 18560
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <algorithm>

using namespace std;

typedef long long LL;

const int mod = 1e9+7;

long long n,a,b;

int qmi(int a,int k)
{
    int  res = 1;
    while (k)
    {
        if ( k & 1) res = (LL)res*a%mod;
        k>>=1;
        a = (LL)a*a%mod;
    }
    return res;
}


int c(LL a,LL b)
{
    if (a < b) return 0;
    
    int up = 1,down = 1;
    
    for (int i = a,j = b;j;i--,j--)
    {
        up = (LL)up*i%mod;
        down = (LL)down*j%mod;
    }
    return (LL)up*qmi(down,mod-2)%mod;
}


int main ()
{
    scanf("%lld%lld%lld",&n,&a,&b);
    
    long long res=qmi(2,n)-1-c(n,a)-c(n,b);
    
    while (res < 0)
    {
        res+=mod;
    }
    cout<<res<<endl;
    return 0;
}


Measured memory_bytes: 256