akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main() {
    ll N, K; cin >> N >> K;
    string s; cin >> s;
    if(s[K - 1] == 'A') s[K - 1] = 'a';
    if(s[K - 1] == 'B') s[K - 1] = 'b';
    if(s[K - 1] == 'C') s[K - 1] = 'c';
    cout << s << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;
 
int main(){
  int h,w,k,ans;
  ans=0;
  cin >> h >> w >> k;
  vector<string> v;
  rep(i,h){
    string s;
    cin >> s;
    v.push_back(s);
  }
  for(int i=0; i<(1<<h); i++){
    for(int j=0; j<(1<<w); j++){
      int chk=0;
      for(int m=0; m<h;m++){
        if(i>>m&1){
          for(int n=0; n<w; n++){
            if(j>>n&1 && v[m][n]=='#'){
              chk++;
            }
          }
        }
      }
      if(chk==k){
        ans++;
      }
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3636
#pragma GCC optimize ("O3")

#include <bits/stdc++.h>

#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define bcnt __builtin_popcountll

using namespace std;

#ifdef LOCAL
#include<prettyprint.hpp>
#define debug(...)  cerr << "[" << #__VA_ARGS__ << "]: ", d_err(__VA_ARGS__);
#else
#define debug(...) 83;
#endif

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<ll,ll> Pll;
typedef pair<int,int> Pin;

ll INF = 1e16;
int inf = 1e8;
ll MOD = 1e9+7;

template<typename T>
ostream& operator << (ostream& os, const vector<T>& vec) {
    os << "{ ";
    REP(i, vec.size()) {
        os << vec[i] << " ";
    }
    os << "}";

    return os;
}

void d_err() {
    cerr << endl;
}

template <typename H, typename... T>
void d_err(H h, T... t) {
    cerr << h << " ";
    d_err(t...);
}

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    
    int N, M, R;
    cin >> N >> M >> R;

    vector<int> r(R);
    REP(i, R) {
        cin >> r[i];
        --r[i];
    }
    sort(r.begin(), r.end());

    ll C[N][N];
    REP(i, N) REP(j, N) C[i][j] = inf;
    REP(i, N) C[i][i] = 0;

    REP(i, M) {
        ll a, b, c;
        cin >> a >> b >> c;
        --a; --b;
        C[a][b] = c;
        C[b][a] = c;
    }

    REP(k, N) REP(i, N) REP(j, N) {
        C[i][j] = min(C[i][k] + C[k][j], C[i][j]);
    }

    ll res = INF;
    do {
        ll d = 0;
        REP(i, R-1) {
            d += C[r[i]][r[i+1]];
        }
        res = min(res, d);

    } while(next_permutation(r.begin(), r.end()));
    
    cout << fixed << setprecision(20);
    cout << res << endl;

}


Measured memory_bytes: 640
import collections,itertools,sys
def S(): return sys.stdin.readline().rstrip()
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
H,W = LI()
s = [S() for _ in range(H)]
black_count = 0
for i,j in itertools.product(range(H),range(W)):
    if s[i][j]=='#':
        black_count += 1
dhdw = [[-1,0],[1,0],[0,-1],[0,1]]
min_dist = [[-1]*W for _ in range(H)]
seen = [[0]*W for _ in range(H)]
queue = collections.deque() #位置[行,列]を入れておく
def bfs():
    seen[0][0] = 1
    queue.append([0,0])
    min_dist[0][0] = 1
    while queue:
        qh,qw = queue.popleft()
        for dh,dw in dhdw:
            nh,nw = qh+dh,qw+dw
            if not(0<=nh<=H-1) or not(0<=nw<=W-1) or seen[nh][nw] or s[nh][nw]=='#':
                continue
            seen[nh][nw] = 1
            queue.append([nh,nw])
            min_dist[nh][nw] = min_dist[qh][qw]+1
bfs()
if min_dist[H-1][W-1]!=-1:
    print(H*W-black_count-min_dist[H-1][W-1])
else:
    print(-1)


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

using namespace std;

using ll = long long;

struct LCA {
    using Graph = vector< vector<int> >;

    const Graph& g;
    const int LOGV;
    const int root;

    vector< vector<int> > parent;
    vector<int> depth;

    LCA(const Graph& g, int root = 0) : g(g), LOGV(32 - __builtin_clz(g.size())), root(root) {
        int V = g.size();
        parent.resize(LOGV, vector<int>(V));
        depth.resize(V);

        dfs(root, -1, 0);
        for (int k = 0; k + 1 < LOGV; k++) {
            for (int v = 0; v < V; v++) {
                if (parent[k][v] < 0) parent[k + 1][v] = -1;
                else parent[k + 1][v] = parent[k][parent[k][v]];
            }
        }
    }

    void dfs(int v, int p, int d) {
        parent[0][v] = p;
        depth[v] = d;
        for (int i : g[v]) {
            if (i != p) dfs(i, v, d + 1);
        }
    }

    int operator()(int u, int v) const {
        if (depth[u] > depth[v]) swap(u, v);
        for (int k = 0; k < LOGV; k++) {
            if ((depth[v] - depth[u]) >> k & 1) {
                v = parent[k][v];
            }
        }
        if (u == v) return u;
        for (int k = LOGV - 1; k >= 0; k--) {
            if (parent[k][u] != parent[k][v]) {
                u = parent[k][u];
                v = parent[k][v];
            }
        }
        return parent[0][u];
    }
};

void dfs(int cur, int par, const vector< vector<int> >& g, vector<int>& ps, vector<int>& d) {
    ps[cur] = par;
    for (int nex : g[cur]) {
        if (nex == par) continue;
        d[nex] = d[cur] + 1;
        dfs(nex, cur, g, ps, d);
    }
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n, u, v;
    cin >> n >> u >> v;
    --u; --v;

    vector< vector<int> > g(n);
    for (int i = 1; i < n; ++i) {
        int a, b;
        cin >> a >> b;
        --a; --b;
        g[a].push_back(b);
        g[b].push_back(a);
    }

    vector<int> ps(n, -1), d(n, 0);
    dfs(u, -1, g, ps, d);
    int root = v;
    for (int i = 0; i < d[v] / 2; ++i) {
        root = ps[root];
    }

    LCA lca(g, root);
    auto calc = [&](int a, int b) {
        return lca.depth[a] + lca.depth[b] - lca.depth[lca(a, b)] * 2;
    };

    int ans = 0;
    for (int i = 0; i < n; ++i) {
        if (lca(i, u) == root) {
            ans = max(ans, d[u] / 2);
        } else {
            int du = calc(i, u), dv = calc(i, v);
            if (du <= dv) {
                // cerr << i << " " << du << " " << du + max(dv - du - 1, 0) << endl;
                ans = max(ans, du + max(dv - du - 1, 0));
            } else {
                assert(false);
            }
        }
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 18688
#include<stdio.h>
#define MAX 100000

 typedef struct {
  int parent;
  int left;
  int right;
}Tree;

Tree a[MAX];

int getDepth(int);

int main(){
  int i,j,n;
  int num,deg,child,k = 0;

  scanf("%d",&n);

  for(i=0;i<n;i++){
    a[i].parent = -1;
    a[i].left = -1;
    a[i].right = -1;
  }

  for(i=0;i<n;i++){
    scanf("%d%d",&num,&deg);

    for(j=0;j<deg;j++){
      scanf("%d",&child);
      if(j==0) a[num].left=child;
      else a[k].right=child;
      k=child;
      a[child].parent=num;
    }
  }

  for(i = 0; i < n; i++){
    printf("node %d: parent = %d, depth = %d",i,a[i].parent,getDepth(i));

    if(getDepth(i) == 0){
      printf(", root, [");
    }
    else if(a[i].left == -1){
      printf(", leaf, [");
    }
    else{
      printf(", internal node, [");
    }

    j=a[i].left;

    while(j != -1){
      printf("%d", j);
      j = a[j].right;

      if(j != -1){
    printf(", ");
      }
    }
    printf("]\n");
  }

  return 0;
}
int getDepth(int num){
  int depth = 0;

  while(a[num].parent != -1){
    num = a[num].parent;
    depth++;
  }
return depth;
}

Measured memory_bytes: 1784
#include <cassert>
#include <algorithm>
#include <cctype>
#include <complex>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <ctime>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <sstream>
#include <tuple>
#include <typeinfo>
#include <unordered_set>
#include <unordered_map>
#include <vector>
using namespace std;

#define REP2(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define REPD(i, n) for(int i = (int)(n) - 1; i >= 0; i--)
#define REP(i, n) REP2(i, 0, n)
#define ALL(c) (c).begin(), (c).end()
#define PB(e) push_back(e)
#define FOREACH(i, c) for(auto i = (c).begin(); i != (c).end(); ++i)
#define MP(a, b) make_pair(a, b)
#define BIT(n, m) (((n) >> (m)) & 1)

typedef long long ll;

template <typename S, typename T> ostream &operator<<(ostream &out, const pair<S, T> &p) {
  out << "(" << p.first << ", " << p.second << ")";
  return out;
}

template <typename T> ostream &operator<<(ostream &out, const vector<T> &v) {
  out << "[";
  REP(i, v.size()){
    if (i > 0) out << ", ";
    out << v[i];
  }
  out << "]";
  return out;
}

int main(int argc, char *argv[])
{
  int N;
  cin >> N;
  string A, B, C;
  cin >> A >> B >> C;
  int res = 0;
  REP(i, N) {
    if (A[i] == B[i] && B[i] == C[i]) {
      
    } else if (A[i] == B[i] || B[i] == C[i] || C[i] == A[i]) {
      res++;
    } else {
      res += 2;
    }
  }
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#include<vector>
using namespace std;

class Node{
    public:
    int location;
    int p, l, r;
    Node() {}
};

class Point {
public:
    int id, x, y;
    Point() {}
    Point(int id, int x, int y):id(id), x(x), y(y) {}
    bool operator < (const Point &p) const {
        return id < p.id;
    }
    
    void print() {
        printf("%d\n", id);
    }
};

static const int MAX = 1000000;
static const int NIL = -1;

int N;
Point P[MAX];
Node T[MAX];
int np;

bool lessX(const Point &p1, const Point &p2) {return p1.x < p2.x;}
bool lessY(const Point &p1, const Point &p2) {return p1.y < p2.y;}

int makeKDTree(int l, int r, int depth) {
    if (!(l < r)) return NIL;
    int mid = (l + r) / 2;
    int t = np++;
    if (depth % 2 == 0){
        sort(P+l, P+r, lessX);
    }
    else {
        sort(P+l, P+r, lessY);
    }
    T[t].location = mid;
    T[t].l = makeKDTree(l, mid, depth + 1);
    T[t].r = makeKDTree(mid+1, r, depth + 1);

    return t;
}

void find(int v, int sx, int tx, int sy, int ty, int depth, vector<Point> &ans){
    int x = P[T[v].location].x;
    int y = P[T[v].location].y;

    if (sx <= x && x <= tx && sy <= y && y <= ty){
        ans.push_back(P[T[v].location]);
    }

    if (depth % 2 == 0) {
        if (T[v].l != NIL){
            if (sx <= x) find(T[v].l, sx, tx, sy, ty, depth + 1, ans);
        }
        if (T[v].r != NIL){
            if (x <= tx) find(T[v].r, sx, tx, sy, ty, depth + 1, ans);
        }
    }
    else {
        if (T[v].l != NIL){
            if (sy <= y) find(T[v].l, sx, tx, sy, ty, depth + 1, ans);
        }
        if (T[v].r != NIL){
            if (y <= ty) find(T[v].r, sx, tx, sy, ty, depth + 1, ans);
        }
    }
}

int main(){
    int x, y;
    scanf("%d", &N);
    for (int i = 0; i < N; i++){
        scanf("%d %d", &x, &y);
        P[i] = Point(i, x, y);
        T[i].l = T[i].r = T[i].p = NIL;
    }

    np = 0;

    int root = makeKDTree(0,N,0);

    int q;
    scanf("%d", &q);
    int sx, tx, sy, ty;
    vector<Point> ans;
    for (int i=0; i < q; i++){
        scanf("%d %d %d %d", &sx, &tx, &sy, &ty);
        ans.clear();
        find(root, sx, tx, sy, ty, 0, ans);
        sort(ans.begin(), ans.end());
        for (int j = 0; j < ans.size(); j++)
        {
            ans[j].print();
        }
        printf("\n");
    }
    return 0;
}


Measured memory_bytes: 15960
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = s; i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << '\n';
#define CFYN(n) cout << ( (n) ? "YES":"NO") << '\n';
#define OUT(n) cout << (n) << '\n';
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
constexpr int MOD = 1000000007;

int mod(const ll &x){
    return x > 0 ? x % MOD : (x+MOD) % MOD;
}

int modm(const ll &x,const ll &m){
    return (x % MOD) * (m % MOD) % MOD;
}

int modpow(ll x, ll p) {
    int ret = 1;
    while(p > 0) {
        if (p & 1) ret = modm(ret,x);
        x = modm(x,x);
        p >>= 1;
    }
    return ret;
}

// x * modinv(d)
int modd(ll x,ll d) {
    return modm(x,modpow(d,MOD-2));
}

int main(void)
{
    IOS
    int n; cin >> n;
    vector<int> t(n), a(n);
    REP(i,n) cin >> t[i];
    REP(i,n) cin >> a[i];

    int ans = 1;
    if (t[n-1] != a[0]) {
        ans = 0;
    } else {
        REP(i,n) {
            if(i != 0 && t[i] > t[i-1]) {
                if (t[i] > a[i]) {
                    ans = 0;
                    break;
                }
            } 
            if(i != n-1 && a[i+1] < a[i]) {
                if (t[i] < a[i]) {
                    ans = 0;
                    break;
                }
            }
            int m = 0;
            if (i == 0 || i == n-1 || t[i] > t[i-1] || a[i+1] < a[i]) {
                m = 1;
            } else {
                m = min(t[i],a[i]);
            }
            ans = modm(ans,m);
        }
    }

    cout << ans << '\n';

    return 0;
}

Measured memory_bytes: 1024
#include <iostream>

using namespace std;

int map[5][5];

bool isRec(int y, int x, int h, int w)
{
    for (int i = 0; i < h; ++i)
        for (int j = 0; j < w; ++j)
            if (map[y + i][x + j] == 0)
                return false;
    return true;
}

int Check()
{
    int ans = 0;
    for (int h = 5; h >= 1; --h)
        for (int w = 5; w >= 1; --w)
            for (int i = 0; i + h <= 5; ++i)
                for (int j = 0; j + w <= 5; ++j)
                    if (isRec(i, j, h, w))
                        ans = max(ans, h * w);
    return ans;
}

int main()
{
    int testcase;

    cin >> testcase;
    while (testcase--) {
        // Input
        for (int i = 0; i < 5; ++i)
            for (int j = 0; j < 5; ++j)
                cin >> map[i][j];

        cout << Check() << endl;
    }

    return 0;
}

Measured memory_bytes: 1160
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(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 llong long long
#define pb(a) push_back(a)
#define INF 999999999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

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

#define int long long

int n;
vector<int> v;
vector<int> pos(200010, 0);

bool ch(int x){
  int l, r=l=0, sum=0;
  while(l<n){
    while(sum<x && (r+1)%n!=l){
      sum+=v[r];
      r=(r+1)%n;
    }

    if((r+1)%n==l) return false;
    pos[l]=r;
    sum-=v[l];
    l++;
  }

  REP(i, n){
    int l1=pos[i]-i, l2=pos[pos[i]]-pos[i], l3=pos[pos[pos[i]]]-pos[pos[i]];

    if(l1<0) l1+=n;
    if(l2<0) l2+=n;
    if(l3<0) l3+=n;
    if(l1+l2+l3<=n) return true;
  }
  
  return false;
}

int32_t main(){
  scanf("%lld", &n);
  int sum=0;
  REP(i, n){
    int m;
    scanf("%lld", &m);
    v.push_back(m);
    sum+=m;
  }

  int l=0, r=INF;
  int mid;
  while(l+1<r){
    mid=(l+r)/2;
    if(ch(mid)) l=mid;
    else r=mid;
  }

  printf("%lld\n", l);
}

Measured memory_bytes: 3628
#include <iostream>
#include <vector>
#include <string>

int main(){
  int N;
  std::cin>>N;
  std::vector<double> x(N);
  std::vector<std::string> u(N);
  for(int i = 0 ; i < N ; i++ ){
    std::cin>>x[i]>>u[i];
  }
  double result = 0;

  for(int i = 0 ; i < N ; i++ ){
    if(u[i]=="JPY"){
      result += x[i];
    }
    if(u[i]=="BTC"){
      result += x[i] * 380000.0;
    }
  }
  std::cout<<result<<std::endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define pi acos(-1)
#define ll long long
#define pii pair<ll,ll>
#define debug(a) cout<<a<<'\n'
#define maxn 200009 /// I wanna be the wind
#define MOD 1000000007
#define F first
#define S second
#define rep(i, a, b) for(ll i = a; i < (b); ++i)
#define per(i, b, a) for(ll i = b-1; i>=a ; i--)
#define trav(a, x) for(auto& a : x)
#define allin(a , x) for(auto a : x)
#define all(x) begin(x), end(x)
#define sz(x) (ll)(x).size()
using namespace std;
const ll INF = 1e17 + 9;
ll vet[maxn],segt[4*maxn];
void build(ll id ,ll l,ll r){
    if(l==r)segt[id]=vet[l];
    else{
        ll mid=(l+r)>>1;
        build(id<<1,l,mid);
        build(id<<1|1,mid+1,r);
        segt[id]=segt[id<<1]+segt[id<<1|1];
    }
}
void update(ll id,ll l,ll r,ll pos,ll val){
    if(l==r){
        segt[id]=val;
    }
    else{
        ll mid=(l+r)>>1;
        if(pos<=mid)update(id<<1,l,mid,pos,val);
        else update(id<<1|1,mid+1,r,pos,val);
        segt[id] = max(segt[id<<1],segt[id<<1|1]);
    }
}
ll query(ll id,ll l,ll r,ll x,ll y){
    if(x<=l && r<=y)return segt[id];
    else if(l>y || r<x)return 0;
    else{
        ll mid=(l+r)>>1;
        return max(query(id<<1,l,mid,x,y),query(id<<1|1,mid+1,r,x,y));
    }
}
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n;
    cin>>n;
    vector<ll> h(n),b(n);
    rep(i,0,n){
        cin>>h[i];
    }
    rep(i,0,n){
        cin>>b[i];
    }
    ll dp[maxn];
    memset(dp,0,sizeof dp);
    rep(i,0,n){
        dp[i] = b[i];
    }
    rep(i,0,n){
        dp[i] = max(query(1,1,n,1,h[i]-1)+b[i],dp[i]);
        update(1,1,n,h[i],dp[i]);
    }
    ll ans=0;
    rep(i,0,n+2){
        ans=max(ans,dp[i]);
    }
    cout<<ans<<'\n';
    return 0;  
}   

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

int main(){
	
	int s[3][3];
	int f[3][3];
	int w[3][3];
	
	for(int i=0;i<3;i++){
		for(int j=0;j<3;j++)
			cin>>s[i][j];
		for(int j=0;j<3;j++)
			cin>>f[i][j];
		if(f[i][2]-s[i][2]<0){
			if(f[i][1]==0){
				f[i][0]--;
				f[i][1]+=59;
				f[i][2]+=60;
			}
			else{
				f[i][1]--;
				f[i][2]+=60;
			}
		}
			w[i][2]=f[i][2]-s[i][2];
		if(f[i][1]-s[i][1]<0){
			f[i][0]--;
			f[i][1]+=60;
	}
		w[i][1]=f[i][1]-s[i][1];
		w[i][0]=f[i][0]-s[i][0];
	}
	for(int i=0;i<3;i++){
			cout<<w[i][0];
		for(int j=1;j<3;j++){
			cout<<" "<<w[i][j];
		}
		cout<<endl;
	}
	
}

Measured memory_bytes: 1160
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<map>
using namespace std;

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

int main() {
	int n;
	cin >> n;
	cout << n / 3 << endl;
	return 0;
}

Measured memory_bytes: 256
n = input()

a = 9*(len(n)-1)

b = 0
for i in n:
	b += int(i)

c = 0
for i in range(len(n)):
	if i == 0:
		c += int(n[i])-1
	else:
		c += 9
print (max(a,b,c))

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
long long m=1e9 + 7;
long long mod=1e9+7;

long long power(long long x, long long y) 
{ 
    if (y == 0) 
        return 1; 
    long long p = power(x, y/2) % m; 
    p = (p * p) % m; 
  
    return (y%2 == 0)? p : (x * p) % m; 
} 

long long modInverse(long long a) 
{ 
    return power(a, m-2);
}

int main()
{
  	int n;
  	cin>>n;
  	
  	long long sum_sq=0;
  	long long sum=0;
  
  	long long a;
  	for(int i=0;i<n;i++)
    {
      	cin>>a;
      	sum=(sum+a)%mod;
      	sum_sq = (sum_sq + a*a%m)%m;
    }
  	sum=(sum*sum)%mod;
  	sum=(sum-sum_sq + mod)%mod;
  
  	cout<<sum*modInverse(2)%m<<endl;
  
  	return 0;
}

Measured memory_bytes: 3600
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")
    };
}

use std::collections::VecDeque;

fn bfs(n: usize, es: Vec<Vec<usize>>) -> usize {
    let mut q = VecDeque::new();
    let mut res = 0;
    let mut visited = vec![false; n];
    visited[0] = true;
    let depth = 1;
    q.push_back((0, visited, depth));
    while let Some((i, visited, depth)) = q.pop_front() {
        for &next in es[i].iter() {
            if visited[next] {
                continue;
            }
            if depth + 1== n {
                res += 1;
                continue;
            }
            let mut visited = visited.clone();
            visited[next] = true;
            q.push_back((next, visited, depth + 1));
        }
    }
    res
}


fn solve(n: usize, edges: Vec<(usize, usize)>) -> usize {
    let mut es = vec![Vec::new(); n];
    for e in edges {
        let (from, to) = (e.0, e.1);
        if from == 0 {
            es[0].push(to);
        } else {
            es[from].push(to);
            es[to].push(from);
        }
    }
    bfs(n, es)
}

fn main() {
    input!{
        n: usize,
        m: usize,
        edges: [(usize1, usize1); m],
    }
    println!{"{}", solve(n, edges)};
}


Measured memory_bytes: 4352
package main

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

type MyScanner struct {
	sc *bufio.Scanner
}

type MyWriter struct {
	stdout io.Writer
}

type MyPut interface{}

func getScanner(fp io.Reader) *bufio.Scanner {
	sc := bufio.NewScanner(fp)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 500001), 500000)
	return sc
}

func getHugeScanner(fp io.Reader, size int) *bufio.Scanner {
	sc := bufio.NewScanner(fp)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, size), size)
	return sc
}

func (mysc *MyScanner)String() string {
	mysc.sc.Scan()
	return mysc.sc.Text()
}

func (mysc *MyScanner)Int() int {
	i, _ := strconv.Atoi(mysc.String())
	return i
}

func (mysc *MyScanner)Int64() int64 {
	i, _ := strconv.ParseInt(mysc.String(), 10, 64)
	return i
}

func (mysc *MyScanner)Float64() float64 {
	i, _ := strconv.ParseFloat(mysc.String(), 64)
	return i
}

func (mw MyWriter)Puts(v MyPut) {
	_, _ = fmt.Fprintf(mw.stdout, "%v\n", v)
}

func Solve(stdin io.Reader, stdout io.Writer) {
	sc := MyScanner{getScanner(stdin)}
	mw := MyWriter{stdout}

	n := sc.Int()

	ans := 0
	for i := 2; i < n; i++ {
		ans += i
	}

	if n > 1 {
		ans++
	}

	mw.Puts(ans)
}

func main() {
	Solve(os.Stdin, os.Stdout)
	return
}

Measured memory_bytes: 640
while(True):
    n=int(input())
    if(n==0):
        break
    val=list(map(int, input().split()))
    sum=0
    for i in val:
        sum+=i
    mean=sum/n
    disp=0
    for i in val:
        disp+=(i-mean)**2
    disp=disp/n
    print(disp**0.5)
    




Measured memory_bytes: 5660
using System;

namespace AtCoder{
    public static class AtCoder{
        public static void Main(){
            var input = Console.ReadLine().Split(' ');
            int x = int.Parse(input[0]);
            int n = int.Parse(input[1]);

            var line = Console.ReadLine().Split(' ');
            var nums = new int[102];
            for(int i = 0; i < n; i++){
                nums[int.Parse(line[i])] = 1;
            }

            for(int i = 0; i <= 101; i++){
                if((x - i >= 0) && (nums[x - i] == 0)){
                    Console.WriteLine(x - i);
                    return;
                }
                if((x + i <= 101) && (nums[x + i] == 0)){
                    Console.WriteLine(x + i);
                    return;
                }
            }
            Console.WriteLine("0");
        }
    }
}

Measured memory_bytes: 27544
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
constexpr int inf=1e9+7;
constexpr ll longinf=1LL<<60 ;
constexpr ll mod=1e9+7 ;


vector<ll> inv,fact,invfact;
void mod_build(int n=101010){
    fact.resize(n+1);
    inv.resize(n+1);
    invfact.resize(n+1);
    fact[0]=inv[0]=invfact[0]=1;
    inv[1]=1;
    rep(i,n){
        fact[i+1]=fact[i]*(i+1)%mod;
        if(i>0)inv[i+1]=mod-inv[mod%(i+1)]*(mod/(i+1))%mod;
        invfact[i+1]=invfact[i]*inv[i+1]%mod;
    }
}
ll perm(int n,int k){
    if(n<0||k<0||k>n)return 0;
    return fact[n]*invfact[n-k]%mod;
}
ll comb(int n,int k){
    if(n<0||k<0||k>n)return 0;
    return (fact[n]*invfact[n-k]%mod)*invfact[k]%mod;
}
ll powmod(ll n,ll k){
    k%=mod-1;
    if(k<0)k+=mod-1;
    ll ret=1;
    while(k){
        if(k&1)ret=ret*n%mod;
        n=n*n%mod;
        k>>=1;
    }
    return ret;
}
int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n;
    cin>>n;
    ll ans = powmod(10,n) - 2 * powmod(9,n) + powmod(8,n);
    while(ans<0)ans += mod;
    cout<<ans%mod<<endl; 
    return 0;
}

Measured memory_bytes: 3652
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>

using namespace std;

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

int gcd(int m, int n) {
  while (n > 0) {
    int r = m % n;
    m = n;
    n = r;
  }

  return m;
}

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

    vector<int> x;
    x.push_back(X);

    int y;
    REP(0, i, N) {
        cin >> y;
        x.push_back(y);
    }

    sort(x.begin(), x.end());

    set<int> d;
    REP(1, i, N + 1) {
        d.insert(x[i] - x[i - 1]);
    }

    // for (set<int>::iterator it = d.begin(); it != d.end(); ++it) {
    //     cout << *it << endl;
    // }

    int ans = *(d.begin());
    if (d.size() != 1) {
        for (set<int>::iterator it = d.begin(); it != d.end(); ++it) {
            ans = gcd(ans, *it);
        }
    }

    cout << ans << endl;

    return 0;
}


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

#define rep(i, a) for (int i = 0; i < (a); i++ )

 
typedef pair<int,int> P;
typedef long long ll;
 
const int INF = 1001001001;
const int MOD = 1000000007;
const double PI=acos(-1);

int main(){
    int N,A,B,C;
    cin >> N >> A >> B >> C;
    vector<int> L(N,0);
    rep(i,N) {
        cin >> L[i];
    }
    sort(L.begin(),L.end());
    int ans = INF;
    int tmp = 0;
    do {
        for (int i1=0; i1<N+1-3; i1++) {
            for (int i2=i1+1; i2<N+1-2; i2++) {
                for (int i3=i2+1; i3<N+1-1; i3++) {
                    for (int i4=i3+1; i4<N+1; i4++) {
                        int a,b,c;
                        a = b = c = 0;
                        tmp = 0;
                        for (int i=i1; i<i2; i++) {
                            a+=L[i];
                        }
                        for (int i=i2; i<i3; i++) {
                            b+=L[i];
                        }
                        for (int i=i3; i<i4; i++) {
                            c+=L[i];
                        }
                        tmp += abs(A-a);
                        tmp += abs(B-b);
                        tmp += abs(C-c);
                        tmp += 10*(i2-i1-1 + i3-i2-1+ i4-i3-1);
                        ans = min(ans,tmp);
                    }
                }
            }
        }
    } while(std::next_permutation(L.begin(),L.end()));
    cout << ans << endl;
}


Measured memory_bytes: 3596
#include<stdio.h>

int main()
{
	int h,m,sec;

	scanf("%d",&sec);

	h = sec / 3600;
	sec = sec % 3600;

	m = sec / 60;
	sec = sec % 60;



	printf("%d:%d:%d\n",h,m,sec);

	return 0;
}

Measured memory_bytes: 592
#include <bits/stdc++.h>
using namespace std;
#define sd(x) scanf("%d", &x)
#define sz(v) (int) v.size()
#define pr(v) For(i, 0, sz(v)) {cout<<v[i]<<" ";} cout<<endl;
#define slld(x) scanf("%lld", &x)
#define all(x) x.begin(), x.end()
#define For(i, st, en) for(ll i=st; i<en; i++)
#define tr(x) for(auto it=x.begin(); it!=x.end(); it++)
#define fast std::ios::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
#define ll long long
#define int long long
#define mp make_pair
#define F first
#define S second
typedef pair<int, int> pii;
typedef vector<int> vi;
#define MOD 1000000007
#define INF 1000000000000000007LL

const int N = 100005;
 
// it's swapnil07 ;)
 
#ifdef SWAPNIL07
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cout << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
int begtime = clock();
#define end_routine() cout << "\n\nTime elapsed: " << (clock() - begtime)*1000/CLOCKS_PER_SEC << " ms\n\n";
#else
#define endl '\n'
#define trace(...)
#define end_routine()
#endif


signed main()
{
    fast
    #ifdef SWAPNIL07
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
    #endif
    int n, m; cin>>n>>m;
    int ct=0;
    int arr[n];
    int tot = 0;
    For(i, 0, n){
        cin>>arr[i];
        tot+=arr[i];
        arr[i]=arr[i]*4LL*m;
    }
    int x = tot;
    For(i, 0, n){
        if(arr[i]>=x)
            ct++;
    }
    if(ct >= m){
        cout<<"Yes";
    }
    else{
        cout<<"No";
    }
    return 0;
}




Measured memory_bytes: 256
#include <bits/stdc++.h> 
using namespace std; 
#define flash ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define debug(x) cerr << " - " << #x << ": " << x << endl;
#define debugs(x, y) cerr << " - " << #x << ": " << x << " " << #y << ": " << y << endl;
#define all(x) (x).begin(),(x).end()
#define sz(x) (ll)x.size()
#define ll long long
#define INF 1000000000
#define pb push_back
#define ve vector<ll>
#define dos pair<ll,ll>
#define vedos vector<dos>
#define rand mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
struct greateri
{
    template<class T>
    bool operator()(T const &a, T const &b) const { return a > b; }
};
int main()
{
  //flash;
	int n;
	cin>>n;
	cout<<pow(n,3);
  return 0;
}
//code the AC sol !
// BS/queue/map


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

// 基本テンプレート
#pragma region MACRO
#define P(x) cout << (x) << endl
#define p(x) cout << (x)
#define PED cout << "\n"
#define rep(i,n) for(int i=0; i<(int)n; ++i)
#define REP(i,x,n) for(int i=x; i<(int)n; ++i)
#define repi(i,n) for(int i=0; i<=(int)n; ++i)
#define REPI(i,x,n) for(int i=x; i<=(int)n; ++i)
#define ILP while(true)
#define FOR(i,c) for(__typeof((c).begin())!=(c).begin(); i!=(c).end(); ++i)
#define ALL(c) (c).begin(), (c).end()
#define mp make_pair
#pragma endregion

// 型
#pragma region TYPE_DEF
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<string, string> pss;
typedef pair<string, int> psi;
typedef pair<int, string> pis;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long> vl;
typedef vector<long long> vll;
typedef vector<string> vs;
#pragma endregion

// Effective std
#pragma region ESTD
template<typename C, typename T> int count(C& c, T t) { return count(ALL(c), t); }
template<typename C, typename F> int count_if(C& c, F f) { return count_if(ALL(c), f); }
template<typename C, typename T> void erase(C& c, T t) { remove(ALL(c), t), c.end(); }
template<typename C> void remove(vector<C>& c, unsigned int index) { c.erase(c.begin()+index); }
template<typename C, typename T, typename U> void replace(C& c, T t, U u) { replace(ALL(c), t, u); }
template<typename C, typename F, typename U> void replace_if(C& c, F f, U u) { (ALL(c), f, u); }
template<typename C> void reverse(C& c) { reverse(ALL(c)); }
template<typename C> void sort(C& c) { sort(ALL(c)); }
template<typename C, typename Pred> void sort(C& c, Pred p) { sort(ALL(c), p); }
#pragma endregion

// 定数
#pragma region CONST_VAL
constexpr int PI = (2*acos(0.0));
constexpr int EPS = (1e-9);
constexpr int MOD = (int)(1e9+7);
constexpr int INF = 100000000;
#pragma endregion

// 文字列分割
vector<long long> split(const string &input, char delimiter) {
    istringstream stream(input);
    string field;
    vector<long long> result;

    while (getline(stream, field, delimiter))
        result.push_back(stoll(field));

    return result;
}

int main()
{
    string s;
    cin >> s;
    const int N = s.size() - 1;
    ll ans = 0;
    for(int i=0; i<1<<N; ++i) {
        string sp = s;
        int n = 0;
        for(int j=0; j<N; ++j) {
            if ((i&(1<<j))!=0) {
                sp.insert(j+n+1, "+");
                n++;
            }
        }
        vll v = split(sp, '+');
        for(auto iter=v.begin(); iter!=v.end(); iter++) ans += *iter;
    }
    P(ans);
    return 0;
}

Measured memory_bytes: 256
//fifer a tak luboin
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>

typedef long long ll;

#define pb push_back
#define endl "\n"

// using namespace __gnu_pbds;
using namespace std;
// template <typename T> using ordered_set =  tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; 

char c[10][10];
int main() {
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); 
    // freopen("input.in.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    int n;
    cin >> n;
    vector <ll> a(n);
    for (int i = 0; i < n; i++) cin >> a[i];

    sort(a.begin(), a.end());
    reverse(a.begin(), a.end());
    int k = n;
    k -= 2;
    int cnt = 0;
    int ptr = 1;
    ll sum = a[0];
    while (k--) {
        sum += a[ptr];
        cnt++;
        if (cnt == 2) ptr++, cnt = 0;
        // cout << ptr << endl;
    }
    cout << sum << endl;
    return 0;  
}


Measured memory_bytes: 4764
#include <bits/stdc++.h>
using namespace std;
long long a[3001],f[3001][3001];
int main()
{
        long long i,j,n;
        scanf("%lld",&n);
        for(i=1;i<=n;i++)
        {
                scanf("%lld",&a[i]);
                if(n%2==0)
                        f[i][i]=-a[i];
                else
                        f[i][i]=a[i];
        }
        for(j=1;j<=n-1;j++)
        {
                for(i=1;i+j<=n;i++)
                {
                        if((j%2)!=(n%2))
                                f[i][i+j]=max(a[i]+f[i+1][i+j],a[i+j]+f[i][i+j-1]);
                        else
                                f[i][i+j]=min(-a[i]+f[i+1][i+j],-a[i+j]+f[i][i+j-1]);
                }
        }
        printf("%lld",f[1][n]);
        return 0;
}


Measured memory_bytes: 70016
import sys, os, math, bisect, itertools, collections, heapq, queue, copy, array

# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
# from decimal import Decimal
# from collections import defaultdict, deque

sys.setrecursionlimit(10000000)

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: (x * y) // math.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N = ii()
    visited = [-1] * N
    G = [[False] * N for _ in range(N)]
    for n in range(N):
        u, k, *V = il()
        for v in V:
            G[n][v - 1] = True

    que = queue.Queue()
    que.put(0)
    visited[0] = 0
    while not que.empty():
        now = que.get()
        for n in range(N):
            if G[now][n] and visited[n] == -1:
                visited[n] = visited[now] + 1
                que.put(n)

    for n in range(N):
        print(n + 1, visited[n])


if __name__ == '__main__':
    main()



Measured memory_bytes: 7196
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false), cin.tie(0)
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, a, b) for (int i = a; i < b; i++)
#define ALL(x) (x).begin(), (x).end()
#define dump(x) cout << (x) << endl
#define LMAX 9223372036854775807LL
#define LMIN -9223372036854775807LL
using ll = int64_t;
template<typename T>
using vec = vector<T>;
using P = pair<ll, ll>;
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
	fill((T *)array, (T *)(array + N), val);
}

const ll INF = 1e16;
const ll MOD = 1e9 + 7;
//int dx[4] = {1,0,-1,0};
//int dy[4] = {0,1,0,-1};
//ll pas[51][52];

signed main(){
	IOS;
	string s;
	cin >> s;
    ll a[26] = {};
    ll n = s.size();
    REP(i, n){
        a[s[i] - 'a']++;
    }
    ll ans = n * (n - 1) / 2;
    REP(i,26){
		ans -= a[i] * (a[i] - 1) / 2;
    }
	ans++;
    dump(ans);
}

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

// M A F I A - M A F I A - M A F I A - M A F I A - M A F I A - M A F I A //

#define int                                       long long
#define lop(i,s,e)                                for(int i=s;i<(int)e;i++)
#define rlop(i,e,s)                               for(int i=e;i>=s;i--)
#define prvec(v)                                  lop(R15,0,v.size())cout << v[R15] <<" "; cout << endl;
#define prarr(arr,s1,e1)                          lop(R15,s1,e1)cout << arr[R15] << " "; cout << endl;

#define endl                                      '\n'
#define ff                                        first
#define ss                                        second
#define pii                                       pair<int,int>

#define pb                                        push_back
#define all(v)                                    v.begin(),v.end()

// M A F I A - M A F I A - M A F I A - M A F I A - M A F I A - M A F I A //

const int N = 3e6 + 7, M = 1000000007, inf = INT_MAX;
const long long INF = LLONG_MAX;



void solve()
{
      string s, t;
      cin >> s >> t;

      int n1 = s.size(), n2 = t.size();
      int ans = inf;


      lop(i, 0, n1)
      {

            if ( i + n2 > n1 ) continue;

            int cnt = 0;
            lop(k, 0, n2)
            {
                  if ( s[i + k] != t[k] )cnt++;
            }

            ans = min(ans, cnt);
      }

      cout << ans << endl;

}

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

      int test = 1;
      // cin >> test;
      while (test--)solve();


}





















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

using namespace std;

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

  vector<bool> vec(X + 1);
  vec[1] = true;

  for (int i = 2; i <= X; i++) {
    int v = i * i;
    while (v <= X) {
      vec[v] = true;
      v *= i;
    }
  }

  for (int i = X; i > 0; i--) {
    if (vec[i]) {
      cout << i << endl;
      return 0;
    }
  }
}

Measured memory_bytes: 764
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <functional>
#include <limits.h>
#include <set>
#include <map>
using namespace std;

#define ll long long
#define ull unsigned long long
#define rep(i,N) for (int i=0;i<N;i++)
#define loop(i,N,M) for(int i=N;i<M;i++)

//変数
ll N;

namespace mod {

	ll MOD = 1000000007;

	ll add(ll x, ll y) {
		return (x + y) % MOD;
	}

	ll sub(ll x, ll y) {
		return (x + MOD - (y % MOD)) % MOD;
	}

	ll mul(ll x, ll y) {
		return ((x % MOD) * (y % MOD)) % MOD;
	}

	ll power(ll x, ll y) {
		if (y == 0) {
			return 1;
		}
		else if (y == 1) {
			return x % MOD;
		}
		else if (y % 2 == 0) {
			ll pow = power(x, y / 2);
			return (pow * pow) % MOD;
		}
		else {
			ll pow = power(x, y / 2);
			return (((pow * pow) % MOD) * x) % MOD;
		}
	}

	ll div(ll x, ll y) {
		return mul(x, power(y, MOD - 2));
	}

	//階乗x~y
	ll fact(ll x, ll y) {
		if (x == y) {
			return x;
		}
		else {
			return mul(x, fact(x - 1, y));
		}
	}

	//組み合わせ nCr
	ll conbi(ll n, ll r) {
		return div(fact(n, n - r + 1), fact(r, 1));
	}

	//順列 nPr
	ll perm(ll n, ll r) {
		return fact(n, n - r + 1);
	}

	//重複組合せ nHr
	ll homo(ll n, ll r) {
		return conbi((n + r - 1), r);
	}
}

//解法
void solve() {

	if (N == 1) {
		cout << "1";
		return;
	}

	map<ll, ll> mp;

	for (ll num = 2; num <= N; num++) {

		ll num2 = num;
		for (ll i = 2; num2!=1; i++) {
			if (num2%i == 0) {
				mp[i]++;
				num2 = num2 / i;
				i--;
			}
		}

	}

	ll ans = 1;

	for (auto itr = mp.begin(); itr != mp.end();++itr) {
		ans = mod::mul(ans,(itr->second + 1));
	}

	cout << ans;

	return;
}

int main() {
	//入力
	cin >> N;
	solve();
	cout << endl;
	return 0;
}


Measured memory_bytes: 256
n = int(input())

a = n//1.08
#print(a)
#print(a*1.08,int(a*1.08//1))
#print((a+1)*1.08,int((a+1)*1.08//1))
if int(a*1.08//1) == n:
	print(int(a))
elif int((a+1)*1.08//1) == n:
	print(int(a+1))
else:
	print(":(")

Measured memory_bytes: 3060
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Competitive
{
    internal class Solution
    {
        public int[] A;
        public void Run()
        {
            A = Input.ReadIntArray();
            Array.Sort(A);

            int ret = A[0] + A[1] + 10 * A[2];
            Console.WriteLine(ret);
        }
    }

    // libs ----------
    

    // common ----------

    internal static class Input
    {
        public static string ReadString()
        {
            string line = Console.ReadLine();
            return line;
        }

        public static int ReadInt()
        {
            string line = Console.ReadLine();
            return int.Parse(line);
        }

        public static int[] ReadIntArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(int.Parse).ToArray();            
        }

        public static long ReadLong()
        {
            string line = Console.ReadLine();
            return long.Parse(line);
        }

        public static long[] ReadLongArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(long.Parse).ToArray();
        }

        public static double[] ReadDoubleArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(double.Parse).ToArray();
        }
    }
    
    internal class Program
    {
        public static void Main(string[] args)
        {
            var s = new Solution();
            s.Run();
        }
    }
}

Measured memory_bytes: 13268
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  #空白あり

N = I()
a = LI()
b = LI()

if N == 1:
    print(0,a[0]^b[0])
    exit()

A = [a[i] ^ a[i+1] for i in range(N-1)]
A = A + [a[N-1] ^ a[0]] + A
B = [b[i] ^ b[i+1] for i in range(N-1)]

# Aの長さN-1の連続部分列の中で、Bと一致するものは存在するか
# Rolling Hash


def f(mod,base):
    x = pow(base,N-1,mod)  # x = base**(N-1)

    d = 0  # Bのhash値
    for i in range(N-1):
        d *= base
        d += B[i]
        d %= mod

    c = 0  # Aの左N-1文字のhash値
    for i in range(N-1):
        c *= base
        c += A[i]
        c %= mod

    for i in range(N):
        if c == d:
            print(i,a[i] ^ b[0])
        c *= base
        c -= A[i]*x
        c += A[i+N-1]
        c %= mod


f(10**9+7,1234)


Measured memory_bytes: 139888
import java.util.*;

class Main{
	static public void main(String[] args){
		int[] num=new int[3];
		Scanner sc=new Scanner(System.in);
		for(int i=0;i<3;i++){
			int a=sc.nextInt();
			num[i]=a;
		}
		int nn;
		nn=num[0];
		num[0]=num[1];
		num[1]=nn;
		
		nn=num[0];
		num[0]=num[2];
		num[2]=nn;
		
		for(int r:num)
			System.out.printf(r+" ");
	}
}

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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"
#define PI 3.14159265358979
#define MOD 1000000007 // = 10^9 + 7

using namespace std;
using ll = long long;

void solve()
{
	int low_digit = 0;
	int high_digit = 0;
	int log10 = 1;
	int mod = 10;

	int perm[6] = { 0, 2, 22, 222, 2222, 22222 };
	int ans[200003] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, };

	for(int i = 10; i <= 200000; ++i)
	{
		if      (i >= 100000) { log10 = 5; mod = 100000; }
		else if (i >= 10000)  { log10 = 4; mod = 10000; }
		else if (i >= 1000)   { log10 = 3; mod = 1000; }
		else if (i >= 100)    { log10 = 2; mod = 100; }
		else                  { log10 = 1; mod = 10; }
		
		low_digit = i % 10;
		high_digit = i / mod;

		if (low_digit == 0)
		{
			ans[i] = 0;
			continue;
		}
		if (high_digit > low_digit)
		{
			ans[i] = perm[log10];
		}
		else if (high_digit < low_digit)
		{
			ans[i] = perm[log10 - 1];
		}
		else // low_digit == high_digit
		{
			ans[i] = perm[log10 - 1] + ( (i / 10) % (mod / 10) ) * 2 + 3;
		}
	}

	int n;
	cin >> n;

	for(int i = 0; i < n; ++i)
	{
		ans[i + 1] = ans[i] + ans[i + 1];
	}

	cout << ans[n];


}

int main()
{
	fastio;
	solve();

	return 0;
}

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

int main(void){
  int n,m,b;
  while(cin>>n>>m>>b,n+m+b){
    // n m b

    // n is width
    // m in input
    // b is selected number
  
    vector<int> ary(n); // line 
    vector<pair<int,pair<int,int> > > in;
    // h q p
    int h,q,p;
    for(int i = 0 ; i < m ; i ++){
      cin>>h>>q>>p;
      h = h * -1;
      --p;--q;
      in.push_back(make_pair(h,make_pair(q,p)));
    }
    sort(in.begin(),in.end());
  
    for(int i = 0 ; i < n ; i ++)ary[i] = i + 1;
    //cout<<endl;
    for(int i = 0 ; i < m ; i ++){
      swap(ary[in[i].second.first],ary[in[i].second.second]);
    
    
    }
    for(int i = 0 ; i < n ; i ++)
      if(ary[i] == b)cout<<i+1<<endl;
  
  }
}

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

int main(){
    string S,T;
    cin >> S >> T;
    int cnt = 0;
    for(int i = 0; i < S.size(); i++) {
        if(S[i] == T[i]) {
            cnt++;
        }
    }
    if(cnt == S.size()){
        cout << "Yes" <<endl;
    }
    else {
        cout << "No" <<endl;
    }
}

Measured memory_bytes: 3592
N = int(input())
for i in range(6):
  if 10**i<=N and N<10**(i+1):
    n = i+1 #桁数
    
ans = 0
if n%2==0:
  for i in range(1,n):
    if i%2!=0:
      ans += 10**i-10**(i-1)
else:
  for i in range(1,n+1):
    if i%2!=0 and i!=n:
      ans += 10**i-10**(i-1)
    elif i==n:
      ans += N - 10**(n-1)+1
print(ans)

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

int main() {
    long long X;
    long long ans = 0, money = 100;
    cin >> X;
    while(money < X) {
        money += money / 100;
        ans += 1;
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
#define rep2(i,m,n) for (int i = (int)(m); i < (int)(n); i++)
#define rep(i,n) rep2(i,0,n)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define pb push_back
#define bg begin()
#define ed end()
#define fi first()
#define se second()
using namespace std;
using ll = long long;
using vint = vector<int>;
using pint = pair<int,int>;
using vpint = vector<pint>;
template <typename T>
T sq(T x){
  return x * x;
}
ll mod = 1e9 + 7;

signed main (){
  int x,a,b;cin >> x >> a >> b;
  if(abs(x -a)>abs(x-b)){
cout << "B" << endl;
  }else{
cout << "A" << endl;
  }
    return 0;
}


Measured memory_bytes: 3612