akhauriyash/Code-Regression huggingface dataset:
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cwchar>
#include <cwctype>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <codecvt>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep2(i, n) for(int i = 1; i <= (int)(n); i++)
using namespace std;
typedef int64_t ll;
typedef long double ld;
const ll INF=(1LL<<62);
const double inf=pow(10,10);
const ld pi=acosl(1);
const ll mod = 1000000007;
const int dx[4]={0,1,0,-1};
const int dy[4]={1,0,-1,0};
const int ddx[8]={1,0,-1,-1,-1,0,1,1};
const int ddy[8]={1,1,1,0,-1,-1,-1,0};

int main(){
    ll H,W;cin>>H>>W;
    char map[H][W];
    vector<pair<ll,ll>>black;
    rep(i,H)rep(j,W){
        cin>>map[i][j];
        if(map[i][j]=='#')black.push_back(make_pair(i,j));
    }

    queue<pair<ll,pair<ll,ll>>>que;
    vector<vector<bool>>use(H,vector<bool>(W,false));
    for(auto&&i:black){
        ll x=i.first;
        ll y=i.second;
        que.push(make_pair(0,make_pair(x,y)));
        use[x][y]=true;
    }

    ll ans=0;

    while(!que.empty()){
        ll d=que.front().first;
        ll x=que.front().second.first;
        ll y=que.front().second.second;
        que.pop();
        ans=max(ans,d);
        rep(k,4){
            ll nx=x+dx[k];
            ll ny=y+dy[k];
            if(nx<0||H<=nx||ny<0||W<=ny)continue;
            if(map[nx][ny]!='.')continue;
            map[nx][ny]='#';
            que.push(make_pair(d+1,make_pair(nx,ny)));
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 41956
import math
a=int(input())
ans=0
for i in range(1,int(math.sqrt(a)),1):
  if a%i==0 and not i==1:
    cnt=0
    while a%i==0:
      cnt+=1
      a=a/i
    ans+=(math.sqrt(2*cnt+0.25)-0.5)//1
if not a==1:
  print(int(ans+1))
else:
  print(int(ans))

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

int main() {
	int k,s;
	int count=0;
	cin>>k>>s;
	for(int i=0;i<=k;i++){
		for(int j=0;j<=k;j++){
			if(s-i-j>=0&&s-i-j<=k)count+=1;
		}
	}
	cout<<count;
	// your code goes here
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;

int a[88][88], b[88][88];
bool dp[88][88][160*160 + 1];

int main() {
    int h, w;
    cin >> h >> w;

    rep(i, h) {
        rep(j, w) {
            cin >> a[i][j];
        }
    }
    rep(i, h) {
        rep(j, w) {
            cin >> b[i][j];
        }
    }

    const int m = 160*80;
    
    dp[0][0][m + a[0][0] - b[0][0]] = 1;
    dp[0][0][m + b[0][0] - a[0][0]] = 1;
    rep(i, h) {
        rep(j, w) {
            rep(k, 2*m+1) {
                if(!dp[i][j][k]) {
                    continue;
                } 
                if(i+1 < h) {
                    if(k + a[i+1][j] <= 2*m) {
                        dp[i+1][j][k + a[i+1][j] - b[i+1][j]] = 1;
                    }
                    if(k - b[i+1][j] >= 0) {
                        dp[i+1][j][k + b[i+1][j] - a[i+1][j]] = 1;
                    }
                }
                if(j+1 < w) {
                    if(k + a[i][j+1] <= 2*m) {
                        dp[i][j+1][k + a[i][j+1] - b[i][j+1]] = 1;
                    }
                    if(k - b[i][j+1] >= 0) {
                        dp[i][j+1][k + b[i][j+1] - a[i][j+1]] = 1;
                    }
                }
            }
        }
    }

    int ans = m;
    rep(k, 2*m+1) {
        if(dp[h-1][w-1][k]) {
            chmin(ans, (int)abs(k - m));
        }
    }

    out(ans);
    re0;
}

Measured memory_bytes: 175232
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

// c++11
#include <array>
#include <tuple>
#include <unordered_map>
#include <unordered_set>

#define mp make_pair
#define mt make_tuple
#define rep(i, n) for (int i = 0; i < (n); i++)

using namespace std;

using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;

const int INF = 1 << 29;
const double EPS = 1e-9;
const ll MOD = 1000000007;

const int dx[] = {1, 0, -1, 0}, dy[] = {0, -1, 0, 1};
int T;
int N,D;
int check(int val1, int val2){
    for (int i = 6; i >= 0; i--){
        int b1 = (val1 >> i) & 1;
        int b2 = (val2 >> i) & 1;
        if (b1 < b2){
            return true;
        }
        if (b1 > b2){
            return false;
        }
    }
    return true;
}
void solve(){
    cin >> N >> D;
    int sum = D;

    priority_queue<int, vector<int>, greater<int>> cookies;
    cookies.emplace(D);
    int res = D;
    while (N--){
        if (N <= 0)break;
        int tmp = 0;
        // cout << "res = " << res << endl;
        for (int i = 0; i < 7; i++){
            if ((res & (1 << i))){//bit 1
            //pass
            }else{
                tmp |= 1 << i;
            }
        }
        sum -= res;
        sum += tmp + (tmp ^ res);
        res = min(tmp, tmp ^ res);
    }

    cout << sum << endl;
}
int main() {
    cin >> T;
    for (int i = 0; i < T; i++){
        solve();
    }

   return 0;
 }


Measured memory_bytes: 504
#!/usr/bin/env python3
import sys
import collections
from collections import deque


def solve(N: int, X: int, Y: int):
    seen = [[False] * N] * N
    X -= 1
    Y -= 1
    cnt = []
    for i in range(N):
        for j in range(N):
            if i == j:
                continue
            if seen[i][j]:
                continue
            seen[j][i] = True
            cnt.append(min(abs(j - i), abs(X - i) + 1 + abs(j - Y)))
    counter = collections.Counter(cnt)
    keys = counter.keys()
    for i in range(N):
        if i not in keys:
            print(0)
            continue
        print(counter[i])
    return


def solve2(N: int, X: int, Y: int):
    # BFS
    X -= 1
    Y -= 1
    G = [[] for _ in range(N)]
    for i in range(N):
        if not i == N - 1:
            G[i].append(i+1)
            G[i+1].append(i)
        if i == X:
            G[i].append(Y)
            G[Y].append(i)
        if i == Y:
            G[i].append(X)
            G[X].append(i)
    G = [list(set(x)) for x in G]
    q = deque([])
    ans = [0] * N
    # 各頂点をスタート地点として、他の点への移動にかかる最短距離を求めて集計する
    for i in range(N):
        dist = [-1] * N
        dist[i] = 0
        q.append(i)
        while(len(q) > 0):
            v = q.pop()
            for nv in G[v]:
                if not dist[nv] == -1:
                    continue
                dist[nv] = dist[v] + 1
                q.appendleft(nv)
        for d in dist:
            ans[d] += 1
    for i in range(N):
        ans[i] //= 2
    for i in range(1, N):
        print(ans[i])
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    X = int(next(tokens))  # type: int
    Y = int(next(tokens))  # type: int
    solve2(N, X, Y)

if __name__ == '__main__':
    main()


Measured memory_bytes: 4204
#include<iostream>
#include<vector>
#define N 505
using namespace std;

int h,w,a[N][N];
struct Node{
    int a,b,c,d;
};
vector<Node> q;

int main(){
    cin >> h >> w;
    for(int i=1;i<=h;++i){
        for(int j=1;j<=w;++j)
            cin >> a[i][j];
        // 右端の列以外について操作を記録
        for(int j=1;j<w;++j){
            // ビット積を取って奇数判定
            if(a[i][j] & 1){
                a[i][j+1]++;
                q.push_back((Node){i,j,i,j+1});
            }
        }
    }
    // 右端の列かつ下端の行以外について操作を記録
    for(int i=1;i<h;++i){
        if(a[i][w] & 1){
            a[i+1][w]++;
            q.push_back((Node){i,w,i+1,w});
        }
    }

    cout << q.size() << endl;
    for(int i=0;i<q.size();++i)
        cout << q[i].a << " " << q[i].b << " " << q[i].c << " " << q[i].d << endl;
    
    return 0;
}

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

const ll LINF = 1e18;
const int INF = 1e9;
const ll MOD = 1000000007;

int main(){

    int d;
    cin >> d;

    if(d == 25) cout << "Christmas" << endl;
    else if(d == 24) cout << "Christmas Eve" << endl;
    else if(d == 23) cout << "Christmas Eve Eve" << endl;
    else if(d == 22) cout << "Christmas Eve Eve Eve" << endl;
    
    return 0;
}

Measured memory_bytes: 256
n = int(input())
t_point = 0
h_point = 0
for i in range(n):
    t, h = map(str, input().split(" "))
    if t < h:
        h_point += 3
    elif t == h:
        t_point += 1
        h_point += 1
    elif t > h:
        t_point +=3
print(t_point, h_point)


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

const int N = 300 + 10;

typedef long long LL;
int h, w, a[N][N], d;
int f[N * N][20];

struct Node {
    int r, c;
};

Node node[N * N];

int dist(int i, int j) {
    return abs(node[i].r - node[j].r) + abs(node[i].c - node[j].c);
}

int main() {
    std::ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin >> h >> w >> d;
    for(int i = 0; i < h; i++)
        for(int j = 0; j < w; j++) {
            cin >> a[i][j];
            node[a[i][j]].r = i;
            node[a[i][j]].c = j;
        }
    for(int i = 0; i < h; i++)
        for(int j = 0; j < w; j++) {
            int cur = a[i][j];
            f[cur][0] = -1;
            if(cur + d <= w * h) f[cur][0] = dist(cur, cur + d);
            //cout << a[i][j] << ' ' << f[cur][0] << endl;
        }

    for(int pw = 1; pw <= 17; pw++)
        for(int i = 0; i < h; i++)
            for(int j = 0; j < w; j++) {
                int cur = a[i][j];
                f[cur][pw] = -1;
                if((1ll << pw) * d + cur <= w * h) {
                    int rhs = (1 << (pw - 1)) * d + cur;
                    f[cur][pw] = f[cur][pw - 1] + f[rhs][pw - 1];
                }
            }

    int Q;
    cin >> Q;
    while(Q--) {
        int l, r;
        cin >> l >> r;
        int cnt = (r - l) / d, ans = 0, t = l;
        for(int pw = 17; pw >= 0; pw--)
            if((1 << pw) <= cnt) {
                ans += f[t][pw];
                t += (1 << pw) * d;
                cnt -= (1 << pw);
            }
        cout << ans << '\n';
    }
    return 0;
}

Measured memory_bytes: 9600
#include <iostream>
#include <vector>
#include <map>

using namespace std;
using ll = long long;
using ld = long double;

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

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

    int prev = a[0];
    int count = 0;
    for (int i = 1; i < N; ++i) {
        if(a[i] == prev){
            if(i == N-1){
                a[i]++;
            } else{
                int next = a[i+1];
                if(a[i] + 1 != next){
                    a[i]++;
                }else{
                    a[i]+=2;
                }
            }
            count++;
        }
        prev = a[i];
    }
    cout << count << endl;




    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <math.h>
#include <string>
#include <functional> 
#include <vector>
#include <numeric>
#include <stack>
#include <queue>
#include <utility>
#include <map>
#include <set>
#include <cstdlib>
typedef long long ll;
#define fi first
#define se second
#define SORT(a) sort(a.begin(),a.end())
#define REP(i,n) for (int i = 0;i < (n) ; i++) 
#define MP(a,b) make_pair(a,b)
 
using namespace std;

int dx[4] = {1,0,-1,0};
int dy[4] = {0,1,0,-1};
const int INF = 100000000; 
int h,w;
char maze[60][60];//迷路
int sx,sy,gx,gy;//スタート、ゴールの座標
int d[60][60];//最短距離の配列

int bfs(){
    queue<pair<int,int>> q;
    REP(i,h) REP(j,w) d[i][j] = INF;
    q.push(pair<int,int>(sx,sy));
    d[sx][sy] = 0;

    while(q.size()){
        pair<int,int> p = q.front();
        q.pop();
        if(p.fi == gx && p.se == gy) break;

        REP(i,4){
            int nx = p.fi + dx[i],ny = p.se + dy[i];
            if(0<=nx && nx<h && 0<=ny && ny< w &&  maze[nx][ny] != '#' && d[nx][ny] == INF){
                q.push(pair<int,int>(nx,ny));
                d[nx][ny] = d[p.fi][p.se] + 1;
            }
        }
    }
    REP(i,h){
        REP(j,w) cerr << d[i][j] << " ";
        cerr << endl;
    }
    return d[gx][gy];
}
 
int main(){

    int cnt = 0;
    cin >> h >> w;
    REP(i,h) REP(j,w){
        cin >> maze[i][j];
        if(maze[i][j] == '.') cnt++;
    }
    sx = sy = 0;
    gx = h-1,gy = w-1;

    int res = bfs();
    if(res == INF)cout << -1;
    else cout << cnt - res -1;

}

Measured memory_bytes: 256
#include <iostream>
#include <iostream>
#include <vector>
#include <numeric>
#include <algorithm>
#include <string>
#include <array>
	using namespace std;
int main(){
	
	int S;
	cin >> S;
	string answer;
	int l = S / 100;
	int r = S % 100;
	if (l<=12 && l>=1)
	{
		if (r <= 12 && r>=1) answer = "AMBIGUOUS";
		else answer = "MMYY";
	}
	else {
		if (r <= 12 && r >= 1) answer = "YYMM";
		else answer = "NA";
	}

	cout << answer;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cmath>
#include <functional>
#include <numeric>
#include <iomanip>
#define fi first
#define se second
#define fcout(n) cout<<fixed<<setprecision((n))
#define cinl(str) getline(cin,(str))
using namespace std;
bool value(int y,int x,int R,int C){return 0<=y&&y<R&&0<=x&&x<C;}
typedef pair<int,int> pii;
typedef long long ll;
typedef vector<int> vi;
typedef vector<long long > vll;
typedef vector< vi > vvi;
double pie=acos(-1);
int INF=1000000007;
int dx[4] = { 0,-1,0,1 };
int dy[4] = { -1,0,1,0 };


int main() {
	long long n,m;
	long long x[100005];
	long long ans=0;
	cin>>n>>m;
	for(int i=0;i<m;i++){
		cin>>x[i];
	}
	if(n>=m){
		cout<<0<<endl;
	}else{
		sort(x,x+m);
		for(int i=0;i<m-1;i++){
			x[i]=x[i+1]-x[i];
		}
		x[m-1]=0;
		sort(x,x+(m-1));
		for(int i=0;i<m-n;i++){
			ans+=x[i];
		}
		cout<<ans<<endl;
	}

}

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

int a[100005], b[100005], c[100005];
ll pref[100005], suff[100005];

int main(){
    int n; cin >> n;
    for(int i = 1; i <= n; i++)
        cin >> a[i];
    for(int i = 1; i <= n; i++)
        cin >> b[i];
    for(int i = 1; i <= n; i++)
        cin >> c[i];
    
    sort(a+1, a+n+1);
    sort(c+1, c+n+1); reverse(c+1, c+n+1);
    
    multiset<int> ms;
    multiset<int> mm;
    for(int i = 1; i <= n; i++)
        ms.insert(a[i]);
    for(int i = 1; i <= n; i++)
        mm.insert(-c[i]);
    
    for(int i = 1; i <= n; i++){
        int x = b[i];
        int val = *ms.begin();
        pref[i] = pref[i-1];
        if(x > val){
            pref[i] += x-val;
            
            ms.erase(ms.begin());
            ms.insert(x);
        }
    }
    
    for(int i = n; i >= 1; i--){
        int x = b[i];
        int val = *mm.begin(); val *= -1;
        suff[i] = suff[i+1];
        if(x < val){
            suff[i] += val-x;
            mm.erase(mm.begin());
            mm.insert(-x);
        }
    }
    
    // for(int i = 1; i <= n; i++)
    //     cout << "pref[" << i << "] = " << pref[i] << endl;
    // for(int i = 1; i <= n; i++)
    //     cout << "suff[" << i << "] = " << suff[i] << endl;
    ll sumesq = 0, sumdir = 0;
    ll res = -1e18;
    for(int i = 1; i <= n; i++)
        sumesq += a[i];
    for(int i = 1; i <= n; i++)
        sumdir += c[i];
    for(int i = 0; i <= n; i++)
        res = max(res, sumesq + pref[i] - sumdir + suff[i+1]);
    cout << res << endl;
	return 0;
}

Measured memory_bytes: 12416
#include<stdio.h>
int main()
{
    int i=0;
    char a[4],b[4],c[4],d[3];
    scanf("%s",&a);
    scanf("%s",&b);
    scanf("%s",&c);
        d[i]=a[i];
        d[i+1]=b[i+1];
        d[i+2]=c[i+2];
        printf("%s\n",d);

}

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


int main(){
  int num = 0 , count = 0 , h = 0 , hh = 0 , m = 0 , n = 0 , k = 0 , s = 0;

  cin >> num;
  
  for( int i = 0; i < num; i++ ){
    cin >> count;
    for( int j = 0; j < count; j++ ){
      cin >> h;
      if( j == 0 ) s = h;
      else   s = hh;
      hh = h;
      m = hh - s;
      if( m <= 0 && -n >= m ){
	n = -m;
	//	cout << n << endl;
      }else if( m >= 0 && k <= m){
	k = m;

      }
      
    }
    cout << k << " " << n << endl;
    m =0;
    n = 0;
    k = 0;
    s =0;
    hh = 0;
    h = 0;
    

  }
  
  return 0;
}

Measured memory_bytes: 1160
N,M = map(int,input().split())
H = [int(x) for x in input().split()]
A = [0 for x in range(M)]
B = [0 for x in range(M)]
C = []
flag = True
for i in range(M) :
    A[i],B[i] = map(int,input().split())
    C.append([A[i],B[i]])
G = [1 for x in range(N)]

for i in range(M) :
    if H[C[i][0]-1] < H[C[i][1]-1] :
        G[C[i][0]-1] = 0
    elif H[C[i][0]-1] == H[C[i][1]-1] :
        G[C[i][0]-1] = 0
        G[C[i][1]-1] = 0
    else :
        G[C[i][1]-1] = 0
    
print(sum(G))

Measured memory_bytes: 30504
#include <iostream>

using namespace std;

int main() {
  int k, x, y;
  int n;
  cin >> n >> k >> x >> y;
  long long acc = 0;
  for (int i = 1; i <= n; i++) {
    if (i <= k) {
      acc += x;
    } else {
      acc += y;
    }
  }
  cout << acc << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define de(x) cout<<#x<<"="<<x<<endl
#define dd(x) cout<<#x<<"="<<x<<" "
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define repd(i,a,b) for(int i=a;i>=(b);--i)
#define repp(i,a,b,t) for(int i=a;i<(b);i+=t)
#define mt(a,b) memset(a,b,sizeof(a))
#define fi first
#define se second
#define mp(u,v) make_pair(u,v)
#define sz(a) (int)a.size()
#define pb push_back
#define PI acos(-1.0)
#define qc std::ios::sync_with_stdio(false)
#define all(a) a.begin(),a.end()
using namespace std;
typedef vector<int> vi;
typedef long long ll;
typedef double db;
typedef pair<int,int> pii;

const int mod = 1e9+7;
const int N = 2e6+6;
const int M = 2e6+6;
const double eps = 1e-6;
const int inf = 0x3f3f3f3f;

bool eq(const db &a, const db &b) { return fabs(a - b) < eps; }
bool ls(const db &a, const db &b) { return a + eps < b; }
bool le(const db &a, const db &b) { return eq(a, b) || ls(a, b); }
ll gcd(ll a,ll b) { return a==0?b:gcd(b%a,a); };
ll lcm(ll a,ll b) { return a/gcd(a,b)*b; }
ll kpow(ll a,ll b) {ll res=1;a%=mod; if(b<0) return 1; for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll read(){
    ll x=0,f=1;char ch=getchar();
    while (ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while (ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}
//inv[1]=1;
//for(int i=2;i<=n;i++) inv[i]=(mod-mod/i)*inv[mod%i]%mod;
int n;
ll k;
ll a[N], f[N];
bool ok(ll x) {
    ll _k = k;
    rep(i, 0, n) {
        ll A = a[i], F = f[n-1-i];
        if(A * F > x) {
            ll d = x / F;
            ll nd = A - d;
            if(nd > _k) return false;
            _k -= nd;
        }
    }
    return true;
}
int main() {
    scanf("%d%lld",&n, &k);
    rep(i, 0, n) scanf("%lld",a+i);
    rep(i, 0, n) scanf("%lld",f+i);
    sort(a, a + n); sort(f, f + n);
    //rep(i, 0, n) dd(i),dd(a[i]),de(f[i]);
    ll l = 0, r = 4e18;
    //de(r);
    while(l + 1 < r) {
        ll mid = l + r >> 1;
        //dd(l);dd(r);de(mid);
        if(ok(mid)) r = mid;
        else l = mid;
    }
    //dd(l);de(r);
    if(ok(l)) printf("%lld\n",l);
    else printf("%lld\n",r);
    return 0;
}


Measured memory_bytes: 5888
N,K=map(int,input().split())

ans=0
for b in range(K+1,N+1):
    # p*b-1<N<=(p+1)*b and p*b+K+q<=N<p*b+K+q+1
    p = (N+1)//b
    q = N-p*b-K

    ans+=p*(b-K)
    if q>=0:
        ans+=q+1
    if K==0:
        ans-=1

print(ans)


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

using namespace std;

#define int long long
// #define double long double
#define FOR(i, a, b) for(ll i = (a); i < (b); ++i)
#define FORR(i, a, b) for(ll i = (a); i > (b); --i)
#define REP(i, n) for(ll i = 0; i < (n); ++i)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOREACH(x, a) for(auto &(x) : (a))
#define VECCIN(x)                                                              \
    for(auto &youso_ : (x)) cin >> youso_
#define bitcnt __builtin_popcount
#define SZ(x) ((ll)(x).size())
#define fi first
#define se second
#define All(a) (a).begin(), (a).end()
#define rAll(a) (a).rbegin(), (a).rend()
template <typename T = long long> inline T IN() {
    T x;
    cin >> x;
    return (x);
}
inline void CIN() {}
template <class Head, class... Tail>
inline void CIN(Head &&head, Tail &&... tail) {
    cin >> head;
    CIN(move(tail)...);
}
#define CCIN(...)                                                              \
    char __VA_ARGS__;                                                          \
    CIN(__VA_ARGS__)
#define DCIN(...)                                                              \
    double __VA_ARGS__;                                                        \
    CIN(__VA_ARGS__)
#define LCIN(...)                                                              \
    ll __VA_ARGS__;                                                            \
    CIN(__VA_ARGS__)
#define SCIN(...)                                                              \
    string __VA_ARGS__;                                                        \
    CIN(__VA_ARGS__)
#define Printv(v)                                                              \
    {                                                                          \
        REP(x, v.size()) { cout << v[x] << (x == v.size() - 1 ? "\n" : " "); } \
    }
template <typename T = string> inline void eputs(T s) {
    cout << s << "\n";
    exit(0);
}
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
    std::fill((T *)array, (T *)(array + N), val);
}
template <typename T> using PQG = priority_queue<T, vector<T>, greater<T>>;
template <typename T> using PQ = priority_queue<T>;

typedef long long ll;
typedef pair<ll, ll> PL;
typedef vector<PL> VPL;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef vector<double> VD;

#define uni int;

const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;
const ll dx[] = {1, 0, -1, 0};
const ll dy[] = {0, 1, 0, -1};
#define PI 3.141592653589793238

ll cnt[100001];

signed main() {
    LCIN(N);
    VL A(N);
    VECCIN(A);
    REP(i, N) cnt[A[i]] = 1;
    ll k = accumulate(cnt, cnt + 100001, 0LL);
    cout << (k % 2 ? k : k - 1) << "\n";
}


Measured memory_bytes: 1792
def main():
  N=int(input())
  A=list(map(int,input().split()))
  A.sort(reverse=True)
  ans=1
  if A[-1]!=0:
    for a in A:
      ans*=a
      if ans > 10**18:
        ans=-1
        break
  else:ans=0
  print(ans)
if __name__ == '__main__':
  main()



Measured memory_bytes: 21792
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vb = vector<bool>;
using vs = vector<string>;
using msi = map<string, int>;
using mii = map<int, int>;
using psi = pair<string, int>;
using pii = pair<int, int>;
using vlai = valarray<int>;
#define rep(i,n) for(int i=0;i<n;i++)
#define range(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define INF 1E9
#define LINF 1E18*5
#define EPS 1E-9
#define MOD 1000000007
#define PI 3.1415926535897932384

template<class S, class T>ostream& operator<<(ostream&os, pair<S, T>p) { os << "[" << p.first << ", " << p.second << "]"; return os; };
template<class S>auto&operator<<(ostream&os, vector<S>t) { bool a = 1; for (auto s : t) { os << (a ? "" : " ") << s; a = 0; } return os; }

//int dx[]={1,1,1,0,-1,-1,-1,0},dy[8]={1,0,-1,-1,-1,0,1,1,1};
//
constexpr ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }

int main() {
	ll n, m;
	ll ans = 1;
	vl s, t;
	cin >> n >> m;
	for (int i = 2; i <= sqrt(m) + 1; i++) {
		if (m%i == 0) {
			s.push_back(i);
			ll count = 0;
			while (m%i == 0) {
				count++;
				m /= i;
			}
			t.push_back(count);
		}
	}
	if (m != 1) {
		s.push_back(m); t.push_back(1);
	}
	rep(i,s.size()) {
		ll tgt = min(t[i], n - 1);
		vl tmp;
		rep(j, tgt) {
			tmp.push_back(n - 1 + t[i] - j);
		}
		/*
		rep(j, tgt) {
			rep(k, tmp.size()) {
				if (tmp[k] % (tgt - j) == 0) {
					tmp[k] /= (tgt - j);
					k += tmp.size();
				}
			}
		}
		*/
		vl re;
		rep(j, tmp.size()) {
			re.push_back(tgt - j);
		}
		rep(j, tmp.size()) {
			ans *= tmp[j];
			rep(k, re.size()) {
				if (ans % re[k] == 0) {
					ans /= re[k];
					re[k] = MOD;
				}
			}
			ans %= MOD;
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Gosu_Hiroo
 */

#include <iostream>
#include <fstream>

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

typedef long long ll;
#define tr(container, it) \
        for (auto it = container.begin(); it != container.end(); it++)
#define scontains(c, x) ((c).find(x) != (c).end())   //O(log n)
#define contains(c, x) (find((c).begin(),(c).end(),x) != (c).end()) //O(n)
#define pll pair<ll,ll>
#define pii pair<int,int>
#define mll map<ll,ll>
#define intv(x, a, b)((x)>=a && (x)<=b)
#define  rep(i, _begin, _end) for (__typeof(_end) end = _end, begin = _begin,  i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define  _for(i, end) for (__typeof(end) i = 0, _len = (end); i < (_len); i += 1)
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define F first
#define S second
#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev
#define what_is(x) cerr << #x << " is " << x << endl;
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
#define mod(x, m) ((((x) % (m)) + (m)) % (m))
#define bit(n) (1LL<<(n))
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define readint ({int t;cin >> t;t;})
const double PI = 2 * acos(.0);
const int INF = 0x3f3f3f3f;
const ll LLINF = 1000000000000000005LL;;
const ll MOD = (ll) (1e9) + 7;
void _mod(ll &x){x = mod(x, MOD);}
//const ll MOD = (ll) 998244353 ;
const double EPS = 1e-10;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
    std::fill((T *) array, (T *) (array + N), val);
}


//#define int ll

class C4N {
public:
    ll N;
void solve(std::istream& cin, std::ostream& cout){
    cin >> N;
    rep(a,1,3555ll)rep(b,1,3564ll){
        ll up = a*b*N, down = (4*a*b - (a+b)*N);
        if(down > 0 && up % down == 0){
            cout << a << " " << b << " " << up / down << endl;
            return;
        }
    }
}


};


#undef int
int main() {


	C4N solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	in.tie(0); ios::sync_with_stdio(0); out<<fixed<<setprecision(20);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
using namespace std;
int main (){
	double r , a , c;
	cin>> r;
	a = 3.1415926535897932384626433832795028841971693993751058209749445*r*r;
	c = 3.1415926535897932384626433832795028841971693993751058209749445*r*2;
	cout<< fixed << setprecision(5);
	cout<< a << " "<< c<< endl;
	
	return 0;
}


Measured memory_bytes: 3292
#include <iostream>
#include <cstring>
#include<vector>
#include <algorithm>
#include<cstdlib>
#include<set>
#include<math.h>
#include<iomanip>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define rep(i,n) for(ll i=0;i<n;i++)

int main()
{
	 long double a, b, h, m;
	cin >> a >> b >> h >> m;
	 long double p, q, r;
	p = 30 * h + m / 2;
	q = 6 * m;
	if (q < p) r = p - q;
	else r = q - p;
  
	if (180 < r) r = 360 - r;
  
  r*=3.141592653589/180;
 

	 long double ans;
	ans = sqrt(a * a + b * b - 2 * a * b * cos(r));
	cout << setprecision(10)<< ans << "\n";

	return 0;
}

Measured memory_bytes: 4180
#include <iostream>
#include <algorithm>
#include <limits.h>
#include <string>
using namespace std;

int main(void){
    int a, b, k;
    cin >> a >> b >> k;
    
    for (int i = 1; i <= k/2; i++) {
        b += a/2;
        a /= 2;
        
        a += b/2;
        b /= 2;
        
    }
    if (k % 2 == 1) {
        b += a/2;
        a /= 2;
    }
    
    cout << a << " " << b ;
    
    return 0;
}


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

ll dp[1005][1005];
string arr[1005];
ll n, m, i, j, mod = (int)1e9+7;

ll recur(int i, int j)
{
    if(i == n-1 && j == m-1)
        return dp[i][j] = arr[i][j] == '.'? 1: 0;
    if(i == n-1)
    {
        if(arr[i][j] == '#') return 0;
        return dp[i][j] = recur(i, j+1) % mod;
    }
    if(j == m-1)
    {
        if(arr[i][j] == '#') return dp[i][j] = 0;
        return dp[i][j] = recur(i+1, j) % mod;
    }
    if(arr[i][j] == '#') return dp[i][j] = 0;
    if(dp[i][j] != -1)
        return dp[i][j];
    return dp[i][j] = (recur(i+1, j) + recur(i, j+1)) % mod;
}

int main()
{
    cin >> n >> m;
    memset(dp, -1, sizeof(ll)*1005*1005);
    for(i = 0; i < n; i++)
        cin >> arr[i];
    cout << recur(0, 0) % mod;
	return 0;
}


Measured memory_bytes: 9216
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		long n = Long.parseLong(br.readLine());

		if (n % 2 != 0) {
			System.out.println("0");
		} else {
			long count = 0;
			n /= 2;
			while (n > 0) {
				count += n / 5;
				n /= 5;
			}

			System.out.println(count);
		}
	}
}

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

int f(int x) {
    int res = 0;
    while (x) {
        res += x % 10;
        x/=10;
    }
    return res;
}

main() {
    int n;
    cin >> n;
    int ans = 1000;
    rep(a, 1, n) {
        int b = n - a;
        ans = min(ans, f(a) + f(b));
    }
    cout << ans << '\n';
}

Measured memory_bytes: 256
#include <cmath>
#include <queue>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
typedef long long ll;
inline void read(int &x){
    x=0;char ch;bool flag = false;
    while(ch=getchar(),ch<'!');if(ch == '-') ch=getchar(),flag = true;
    while(x=10*x+ch-'0',ch=getchar(),ch>'!');if(flag) x=-x;
}
#define rg register int
#define rep(i,a,b) for(rg i=(a);i<=(b);++i)
#define per(i,a,b) for(rg i=(a);i>=(b);--i)
const ll maxn = 100010;
int h[maxn],A,B,n;
inline bool check(int mid){
    double tmp = A - B;
    ll cnt = 0;
    rep(i,1,n){
	double x = h[i] - 1.0*mid*B;
	if(x > 0) cnt += ceil(x/tmp);
    }
    //printf("%d\n",cnt);
    return cnt <= mid;
}
int main(){
    read(n);
    read(A);read(B);
    rep(i,1,n) read(h[i]);
    int l = 1,r = 1000000000,ans = -1;
    while(l <= r){
	int mid = l+r >> 1;
	if(check(mid)) ans = mid,r = mid-1;
	else l = mid+1;
    }printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 512
'use strict'

const main = arg => {
    var input = arg.trim().split("\n");
    var configInfo = input[0].split(" ").map(str => parseInt(str, 10));
    const rowNum = configInfo[0];
    const columnNum = configInfo[1];
    const datasheet = input.slice(1, 1 + rowNum);
    const result = [];

    datasheet.forEach(data => {
        const nums = data.split(" ").map(str => parseInt(str, 10));
        const sum = nums.reduce((a, b) => a + b);
        nums.push(sum);
        result.push(nums);
    })

    result.push([...Array(columnNum+1)].map(obj => 0));
    for(var i=0;i<columnNum+1;i++){
        for(var j=0;j<rowNum;j++){
            result[rowNum][i] += result[j][i];
        }
    }

    const finalResult = result.map(row => row.join(" ")).join("\n");
    console.log(finalResult);
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));


Measured memory_bytes: 17492
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<int ,P> P3;
typedef pair<P ,P> PP;
const ll MOD = ll(1e9+7);
const int IINF = INT_MAX;
const ll LLINF = LLONG_MAX;
const int MAX_N = int(1e5 + 5);
const double EPS = 1e-6;
const int di[] = {0, 1, 0, -1}, dj[] = {1, 0, -1, 0};
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define SORT(v) sort((v).begin(), (v).end())
#define SORTR(v) sort((v).rbegin(), (v).rend())
#define ALL(v) (v).begin(), (v).end()

int main() {
    int w, x = 1, sum = 0;
    string ans = "";
    cin >> w;
    while(abs(w-x) > x/2) x *= 3;
    while(x>0){
        int c, mi = IINF;
        for(int i=-1;i<=1;i++){
            if(abs(w - (sum+x*i)) < mi){
                mi = abs(w - (sum+x*i));
                c = i;
            }
        }
        if(c==1){
            ans.push_back('+');
        }
        else if(c==0){
            ans.push_back('0');
        }
        else{
            ans.push_back('-');
        }
        sum += x*c;
        x /= 3;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3152
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <climits>
#include <sstream>
#include <iterator>
#include <sstream>
#include <iomanip>
#include <istream>
#include <cstring>
#include <cstdio>
#include <cstdlib>
using namespace std;

int main()
{
    string a, b, c;
    cin >> a >> b >> c;
    
    if(a.back() == b[0] && b.back() == c[0]) cout << "YES" << endl;
    else    cout << "NO" << endl;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {

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

		int n = 0;
		int avg = 0;
		int sum = 0;
		while(sc.hasNext()){
			String s = sc.next();
			int i=0;
			while(s.substring(i,i+1).compareTo(",")!=0)i++;		
			int a = Integer.valueOf(s.substring(0,i));
			int b = Integer.valueOf(s.substring(i+1,s.length()));
			sum += a*b;
			avg += b;
			n++;
		}
		double m = (double)avg/n;
		avg = (int)(m+0.5);
		System.out.println(sum);
		System.out.println(avg);
	}
}

Measured memory_bytes: 17124
import java.util.*;
import java.util.TreeMap;
import java.util.Map;
import java.util.HashMap;
import java.util.ArrayList;
import java.util.Collections;

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();
        int D = sc.nextInt();

        int a;
        int c;

        if(A%D==0){
            a = A / D;
        }
        else{
            a = A / D + 1;
        }
        if(C%B==0){
            c = C / B;
        }
        else{
            c = C / B + 1;
        }

        if(c<=a){
            System.out.println("Yes");
        }
        else{
            System.out.println("No");
        }
    }
}

Measured memory_bytes: 35820
#include <cstdio>
#include <string>

int main(){
	int n, m;
	char a[100001], b[100001];
	while(scanf("%d", &n), n != 0){
		char f;
		for(int i = 0;i < n;i++){
			scanf(" %c %c", &a[i], &b[i]);
		}
		scanf("%d", &m);
		for(int i = 0;i < m;i++){
			scanf(" %c", &f);
			int flag = 1;
			for(int j = 0;a[j] != '\0' && flag == 1;j++){
				if(a[j] == f){
					printf("%c", b[j]);
					flag = 0;
				}
			}
			if(flag == 1)printf("%c", f);
		}
		printf("\n");
	}
	
	return 0;
}

Measured memory_bytes: 2504
#include <bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define RFOR(i, a, b) for (int i = (a); i >= (b); i--)
#define LFOR(i, a, b) for (long long int i = (a); i <= (b); i++)
#define LRFOR(i, a, b) for (long long int i = (a); i >= (b); i--)
#define MOD 1000000007
#define INF 1000000000           // 2000000000
#define LINF 1000000000000000000 // 9000000000000000000
#define DINF 1000000000000000.0
#define PI 3.14159265358979

//.size()はunsigned int　0-1をするとオーバーフローする

using namespace std;
typedef long long int ll;
typedef pair<long long int, long long int> P;

int dy[5] = {-1, 0, 1, 0, 0};
int dx[5] = {0, -1, 0, 1, 0};

int main(void) {
    int r;

    cin>>r;

    cout<<3*r*r<<endl;

}


Measured memory_bytes: 256
/* while(!cin.eof()) */
 
#include<bits/stdc++.h>
using namespace std; 
#define int long long 
#define mod 998244353
#define MAXI (int)(1e17+100)
#define N 200005

int n, in[N];


// Driver code to test above functions
int32_t main()
{
    
 
    
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);

    vector<int> v{1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};

    int n;
    cin >> n;
    cout << v[n-1];

    return 0;
    
}  




Measured memory_bytes: 256
package main 
import "fmt"


func main(){
  var S string
  fmt.Scan(&S)
  flag:=0
  
  for pos,run := range S {
    if pos % 2 == 1 && string([]rune{run}) == "R" {
      flag=1
    } else if pos % 2 == 0 && string([]rune{run}) == "L" {
      flag=1
    }
  }
  if flag == 0 {
    fmt.Println("Yes")
  } else {
  	fmt.Println("No")
  }
  
}




Measured memory_bytes: 512
#include <algorithm>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <deque>
#include <iostream>
#include <iterator>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <ratio>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

using ll = long long;
using ull = unsigned long long;
template<class T> using v = vector<T>;
template<class T, class U> using p = pair<T, U>;

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

template<class T> T read() { T x{}; cin >> x; return x; }
template<class T> v<T> read(int N){ v<T> x(N); REP(i, N) cin >> x[i]; return x; }

template<class T>
void write(const T &x){ cout << x << endl; }
void write(double x){ printf("%.15f\n", x); }

const ull MOD = 1000'000'007;

const ll NMAX = (ll)1e5 + 10;
ll dp[NMAX] = {};

int main(){
    ll N = read<ll>();
    auto h = read<ll>(N);
    
    dp[0] = 0;
    dp[1] = abs(h[0] - h[1]);
    for(ll i = 2; i < N; ++i)
    {
        dp[i] = min(dp[i-2] + abs(h[i] - h[i-2]), dp[i-1] + abs(h[i] - h[i-1]));
    }
    write(dp[N-1]);
}



Measured memory_bytes: 1792
#include <iostream>
#include <numeric>
#include <cmath>
#include <limits>
#include <stdio.h>
#include <iomanip>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;
using ll = long long;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
ll Max(ll(a), ll(b), ll(c)) {
	return max(max(a, b), c);
}
ll Min(ll(a), ll(b), ll(c)) {
	return min(min(a, b), c);
}





int main() {
	ll N,mod=1e9+7;
	string S;
	cin >> N>>S;
	vector<ll> L(26);
	rep(i, N) {
		ll c = S.at(i) - 'a';
		L.at(c)++;
	}
	ll an = 1;
	rep(i, 26) {
		an *= (L.at(i) + 1);
		an %= mod;
	}
	cout << (an-1+mod)%mod << endl;
}

Measured memory_bytes: 3748
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const int MOD = 1e9+7;


int main(){
  
  int n; cin>>n;
  ll x1,y1; cin>>x1>>y1;
  ll xpymax,xpymin,xmymax,xmymin;
  xpymax = x1+y1;
  xpymin = x1+y1;
  xmymax = x1-y1;
  xmymin = x1-y1;
  for(int i=1; i<n; i++){
    ll x,y; cin>>x>>y;
    xpymax = max(xpymax,x+y);
    xpymin = min(xpymin,x+y);
    xmymax = max(xmymax,x-y);
    xmymin = min(xmymin,x-y);
  }
  cout<<max(xpymax-xpymin,xmymax-xmymin)<<endl;
  
  
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace std;
using namespace __gnu_pbds; 
#define gc getchar_unlocked
#define fo(i,n) for(int i=0;i<n;i++)
#define Fo(i,k,n) for(int i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define ll long long int
#define s(x)	cin>>x
#define p(x)	cout<<x<<"\n"
#define goog(x, y)  cout<<"Case #"<<x<<": "<<y<<"\n"
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
#define INF 100000000000
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
typedef pair<int, int>	pii;
typedef pair<ll, ll>	pl;
typedef vector<int>		vi;
typedef vector<ll>		vl;
typedef vector<pii>		vpi;
typedef vector<pl>		vpl;
typedef vector<vi>		vvi;
typedef vector<vl>		vvl;
typedef long double ld;

mt19937_64 rang(chrono::high_resolution_clock::now().time_since_epoch().count());
int rng(int lim) {
	uniform_int_distribution<int> uid(0,lim-1);
	return uid(rang);
}
int mpow(int base, int exp); 
void ipgraph(int n, int m);
void dfs(int u, int par);
int gcd(int a, int b) ;

const int mod = 1'000'000'007;
const int N = 3e5, M = N;
//=======================

vi g[N];
int a[N];

void solve() {
    ll n;cin>>n;
    ll prim=1000000007;
    if(n==1) p(0);
    else
    {   ll res1=1,res2=1,res3=1;
        fo(i,n)
        res1=(res1*10)%mod;
        fo(i,n)
        res2=(res2*8)%mod;
        //res1=(res1-res2)%mod;
        fo(i,n)
        res3=(res3*9)%mod;
        res1=(res1+res2-(2*res3))%mod;
        p((res1+mod)%mod);
        
    }
    
}

int main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    srand(chrono::high_resolution_clock::now().time_since_epoch().count());

    int t = 1;
    //cin >> t;
    while(t--) {
      solve();
    }

    return 0;
}

int mpow(int base, int exp) {
  base %= mod;
  int result = 1;
  while (exp > 0) {
    if (exp & 1) result = ((ll)result * base) % mod;
    base = ((ll)base * base) % mod;
    exp >>= 1;
  }
  return result;
}

void ipgraph(int n, int m){
	int i, u, v;
	while(m--){
		cin>>u>>v;
    //u--, v--;
		g[u].pb(v);
		g[v].pb(u);
	}
}

void dfs(int u, int par){
	for(int v:g[u]){
		if (v == par) continue;
		dfs(v, u);
	}
}

int gcd(int a, int b) 
{ 
    if (a == 0) 
        return b; 
    return gcd(b % a, a); 
} 

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

using namespace std;

int main() {
  string a;
  int l;
  while(cin >> a >> l && (a!="0" || l)){
    vector<pair<int,int> > uni;
    int ans=-1;
    uni.push_back(make_pair(stoi(a),0));
    int b,c,i;
    for(i=1;uni.size()==i;++i){
      while(a.length()!=l) a='0'+a;
      sort(a.begin(),a.end());
      b=stoi(a);
      reverse(a.begin(),a.end());
      c=stoi(a);
      a=to_string(c-b);
      for(int j=0;j<uni.size();++j)
	if(c-b==uni[j].first) ans=j;
      if(ans!=-1) break;
      uni.push_back(make_pair(c-b,i));
    }
    cout << ans << " " << a << " " << i-ans << endl;
  }
  
  return 0;
}



Measured memory_bytes: 3268
package main

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

const VMAX = 10e4

var s = bufio.NewScanner(os.Stdin)

func main() {
	s.Split(bufio.ScanWords)
	n := nextInt()
	a := make([]int, n)
	for i := range a {
		a[i] = nextInt()
	}
	fmt.Println(trimBracket(fmt.Sprint(countingSort(a))))
}

func nextInt() int {
	s.Scan()
	n, _ := strconv.Atoi(s.Text())
	return n
}

func countingSort(A []int) []int {
	C := make([]int, VMAX+1)
	for _, v := range A {
		C[v]++
	}
	for j := 1; j <= VMAX; j++ {
		C[j] = C[j] + C[j-1]
	}
	B := make([]int, len(A))
	for _, v := range A {
		B[C[v]-1] = v
		C[v]--
	}
	return B
}

func trimBracket(s string) string {
	return strings.Trim(s, "[]")
}



Measured memory_bytes: 69396
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
#include <random>
using namespace std;
typedef long long int ll;

int h,w,d;
char fi[110][110];

bool check(int s,int t){
	if(s+d>h)return false;
	for(int i=0;i<d;i++){
		if(fi[i+s][t]=='#')return false;
	}
	return true;
}

bool check2(int s,int t){
	if(t+d>w)return false;
	for(int i=0;i<d;i++){
		if(fi[s][t+i]=='#')return false;
	}
	return true;
}


int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cin >> h >> w >> d;
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			cin >> fi[i][j];
		}
	}
	int ans=0;
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			if(check(i,j))ans++;
			if(check2(i,j))ans++;
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 3152
#include <bits/stdc++.h>
#define REP(i, n) for (long i = 0; i < n; i++)
#define _GLIBCXX_DEBUG
using namespace std;
using ll = long long;
using Pi = pair<int, int>;
using Pl = pair<ll, ll>;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vector<ll> flag(N + 1);
    vector<ll> Ai(N + 1);
    vector<ll> table(N + 1);
    REP(x, N + 1)
    {
        table.at(x) = (x * (x - 1)) / 2;
    }

    REP(i, N)
    {
        cin >> Ai.at(i);
        flag.at(Ai.at(i))++;
    }

    ll ans = 0;
    REP(j, N + 1)
    {
        ans += table.at(flag.at(j));
    }

    REP(k, N)
    {
        ll tmp = ans - flag.at(Ai.at(k)) + 1;
        cout << tmp << "\n";
    }
}

Measured memory_bytes: 7296