akhauriyash/Code-Regression huggingface dataset:
# ac
import sys
import numpy as np
from numba import njit

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

@njit('(i8[::1],)', cache=True)
def update(a):
    n = len(a)
    b = np.zeros_like(a)       # aと同じ形状の配列を生成(https://deepage.net/features/numpy-zeros.html)
    for i, x in enumerate(a):  # enumerateはindex, valueを返す
        l = max(0, i - x)      # lampの照らす範囲の下限（左側）
        r = min(n - 1, i + x)  # lampの上限（右側）
        b[l] += 1              # 以下imos法
        if r + 1 < n:          # r+1はx=nの時（最後のサイクル）r+1=nでindexの指定に失敗するから弾く（indexは0~n-1）
            b[r + 1] -= 1
    b = np.cumsum(b)           # bの要素の累積和（フィボナッチ数列みたいな）（imos法の締め）
    return b


n, k = map(int, readline().split())
a = np.array(read().split(), np.int64)

k = min(k, 41)                 # 今回の制限範囲のnなら41回も試行すればaの値が全て上限に達するのでそれ以上の試行は不要（解説PDF）
for _ in range(k):
    a = update(a)
print(' '.join(map(str, a)))   # joinメソッドはstrを''で区切って連結する

Measured memory_bytes: 124392
n = int(input())
b = list(map(int,input().split()))
a = [0]*n
ans = 0

a[0] = b[0]
a[n-1] = b[n-2]
for i in range(1,n-1):
  a[i]=min(b[i-1],b[i])
for j in range(n):
  ans += a[j]

print(ans)

Measured memory_bytes: 9092
using System;
using System.Linq;
class Program {
    static void Main (string[] args) {
        // 整数の入力
        int N = int.Parse (Console.ReadLine ());
        int[] numbers = new int[N];
        for (int i = 0; i < N; i++) {
            numbers[i] = int.Parse (Console.ReadLine ());
        }
        int max1 = numbers.Max ();
        int max2 = 0;
        bool flag = false;
        for (int i = 0; i < N; i++) {
            if (numbers[i] == max1) {
                int tmp = numbers[i];
                numbers[i] = 0;
                if (!flag) {
                    max2 = numbers.Max ();
                    flag = true;
                }
                Console.WriteLine (max2);
                numbers[i] = tmp;
            } else {
                Console.WriteLine (max1);
            }
        }
    }
}

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

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);

  int a,b;
  cin >> a >> b;

  cout << a * b << '\n';
}

Measured memory_bytes: 3648
#include <stdio.h>
int main(void)
{
	int a, b, c, d;
	scanf("%d %d %d", &a, &b, &c);
	if (a > b)
	{
		d = a;
		a = b;
		b = d;
	}
	if (b > c)
	{
		d = b;
		b = c;
		c = d;
	}
	if (a > b)
	{
		d = a;
		a = b;
		b = d;
	}
	printf("%d %d %d\n", a, b, c);
	return 0;
}


Measured memory_bytes: 2108
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <array>
#include <vector>
#include <functional>
#include <unordered_map> 
#include <map> 
#include <numeric>
#include <limits>
#include <utility>
#include <queue>
#include <random>
#include <bitset>
using namespace std;
typedef long long LL;

int main(void) {
	LL n, i, j, ma, ans;
	cin >> n;
	vector<LL> a(n);

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

	for (i = 0; ; i++) {

		for (j = 0; j < n; j++) {
			if (a[j] % 2 == 0) {
				a[j] /= 2;
			} else {
				cout << i << endl;
				return 0;
			}
		}

	}


	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int dx[]={-1,1,0,0};
int dy[]={0,0,-1,1};
vector<long long int> adj[200001];
bool vis[200001];
#define ull unsigned long long int
#define ll long long int
#define MAX 1000000007
//1e9+7
#define pll pair<ll,ll>
#define pii pair<int,int>
int C[501][5001];
ll ans=0;
ll sizes[200001];
pair<ll,pll> arr[200001];
bool cycle[200001];
bool ok=true;
ll level[200001];
ll kid[200001];
ll fa[200001];


void dfs(ll node,ll lev){
    vis[node]=true;
    level[node]=lev;
    for(ll i=0;i<adj[node].size();i++){
        if(!vis[adj[node][i]]){
            dfs(adj[node][i],lev+1);
            kid[node]+=kid[adj[node][i]]+1;
        }

    }
    return;
}


double area(double x1, double y1, double x2, double y2, double x3, double y3)
{
   return abs((x1*(y2-y3) + x2*(y3-y1)+ x3*(y1-y2))/2.0);
}

/* A function to check whether point P(x, y) lies inside the triangle formed
   by A(x1, y1), B(x2, y2) and C(x3, y3) */
bool isInside(double x1, double y1, double x2, double y2, double x3, double y3, double x, double y)
{
   /* Calculate area of triangle ABC */
   double A = area (x1, y1, x2, y2, x3, y3);

   /* Calculate area of triangle PBC */
   double A1 = area (x, y, x2, y2, x3, y3);

   /* Calculate area of triangle PAC */
   double A2 = area (x1, y1, x, y, x3, y3);

   /* Calculate area of triangle PAB */
   double A3 = area (x1, y1, x2, y2, x, y);

   /* Check if sum of A1, A2 and A3 is same as A */
   return (A == A1 + A2 + A3);
}

string to_binary(ll i){
    if(i==0) return("0");
    string ans="";
    string a="01";
    while(i){
        ans=a[i%2]+ans;
        i/=2;
    }
    return(ans);
}
ll max_F(ll l,ll r,ll x){

    return(0);

}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string s,t;
    cin>>s>>t;
    int n=s.size();
    bool ok=true;
    for(int i=0;i<n;i++) if(s[i]!=t[i]) ok=false;
    if(ok) cout<<"Yes";
    else cout<<"No";
    return(0);
}

Measured memory_bytes: 8328
using System;
using System.Collections;
using System.Linq;

namespace ConsoleApp1
{
    class Program
    {
        public class Card {
            public string suit;
            public int value;
            public override string ToString()
            {
                return suit + " " + value;
            }
        }
        public static void Main()
        {
            int n = int.Parse(Console.ReadLine());
            Card[] A = new Card[n];
            for (int i = 0; i < n; i++)
            {
                string[] t = Console.ReadLine().Split(' ');
                A[i] = new Card { suit = t[0], value = int.Parse(t[1]) };
            }
            Card[] A1 = ((Card[]) A.Clone()).OrderBy(x => x.value).ToArray();
            Quicksort(A, 0, n - 1);
            for(int i = 0; i < n; i++) { 
                if(A[i] != A1[i])
                {
                    Console.WriteLine("Not stable");
                    break;
                }
                else if(i == n - 1)
                {
                    Console.WriteLine("Stable");
                }
            }

            Console.WriteLine(string.Join<Card>("\n", A));
        }
        public static int Partition(Card[] A, int p, int r)
        {
            Card temp, x = A[r]; 
            int i = p - 1;
            for(int j = p; j < r; j++)
            {
                if(A[j].value <= x.value)
                {
                    temp = A[++i];
                    A[i] = A[j];
                    A[j] = temp;
                }
            }
            temp = A[++i];
            A[i] = A[r];
            A[r] = temp;
            return i;
        }
        public static void Quicksort(Card[] A, int p, int r) {
            if (p < r) {
                int q = Partition(A, p, r);
                Quicksort(A, p, q - 1);
                Quicksort(A, q + 1, r);
            }
        }
    }
}



Measured memory_bytes: 37248
#include <iostream>
int main() {
    long n, min, max, sum = 0;
    bool first = true;
    std::cin >> n; // skip
    while (std::cin >> n) {
        if (first) {
            first = false;
            min = max = n;
            sum += n;
            continue;
        }
        if (n < min) {
            min = n;
        }
        if (n > max) {
            max = n;
        }
        sum += n;
    }
    std::cout << min << ' ' << max << ' ' << sum << std::endl;
}



Measured memory_bytes: 3096
import sys
a=sys.stdin.readline()
res=[i for i in a.split()]
r1,r2=float(res[0]),float(res[1])
v1,v2=r1.is_integer(),r2.is_integer()
if v1==v2==True:
    N,D=int(r1),int(r2)
    if 1<=(N and D)<=20:
        w=2*D+1
        print(int((N+w-1)//w))

Measured memory_bytes: 9108
import collections
N=int(input())
L=list(map(int,input().split()))
ANS=[0,0]
c = collections.Counter(L).most_common()
    
for k,v in c:
  if v <= 1:
    break
  if v >= 4:
    ANS.append(k)
    ANS.append(k)
  else:
    ANS.append(k)

Z=sorted(ANS)
print(Z[-1]*Z[-2])

Measured memory_bytes: 21540
#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<unordered_map>
#include<queue>
#include<stack>
#include<vector>

using namespace std;

int main(){
    long long sum = 0;
    long long n = 0;
    cin>>n;

    for(int i = 1; i <= n; ++i){
        for(int j = 1;j <= n; ++j){
            for(int k = 1; k <= n; ++k){
                sum += __gcd(i,__gcd(j,k));
            }
        }
    }

    cout<<sum<<endl;
    return 0;
}


Measured memory_bytes: 3644
import numpy as np
def resolver(N):
    N -= 1
    digits = "abcdefghijklmnopqrstuvwxyz"
    i = 1
    while True:
        if N < 26**i:
            break
        N -= 26**i
        i += 1
    
    number = []
    for _ in range(i):
        tmp = N % 26 
        number.append(tmp)
        N //= 26

    ans = "".join([digits[i] for i in reversed(number)])
    return ans

def test():
    for i in range(1,100):
        ans = resolver(i)
        print(f"\ri={i:03} {ans}", end="")
    print()

def main():

    #test()

    N = int(input())
    
    ans = resolver(N)

    print(ans)



if __name__ == '__main__':
    main()

Measured memory_bytes: 27056
#define DEBUG 0

/**
 * File    : C.cpp
 * Author  : Kazune Takahashi
 * Created : 2019-6-1 22:49:57
 * Powered by Visual Studio Code
 */

#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <string>
#include <complex>
#include <tuple>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <random>
#include <chrono>
#include <cctype>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
using namespace std;

typedef long long ll;

/*
void Yes()
{
  cout << "Yes" << endl;
  exit(0);
}

void No()
{
  cout << "No" << endl;
  exit(0);
}
*/

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

// const ll MOD = 1000000007;

const int MAX_SIZE = 1000010;
const long long MOD = 1000000007;

long long inv[MAX_SIZE];
long long fact[MAX_SIZE];
long long factinv[MAX_SIZE];

void init()
{
  inv[1] = 1;
  for (int i = 2; i < MAX_SIZE; i++)
  {
    inv[i] = ((MOD - inv[MOD % i]) * (MOD / i)) % MOD;
  }
  fact[0] = factinv[0] = 1;
  for (int i = 1; i < MAX_SIZE; i++)
  {
    fact[i] = (i * fact[i - 1]) % MOD;
    factinv[i] = (inv[i] * factinv[i - 1]) % MOD;
  }
}

long long C(int n, int k)
{
  if (n >= 0 && k >= 0 && n - k >= 0)
  {
    return ((fact[n] * factinv[k]) % MOD * factinv[n - k]) % MOD;
  }
  return 0;
}

long long power(long long x, long long n)
{
  if (n == 0)
  {
    return 1;
  }
  else if (n % 2 == 1)
  {
    return (x * power(x, n - 1)) % MOD;
  }
  else
  {
    long long half = power(x, n / 2);
    return (half * half) % MOD;
  }
}

long long gcd(long long x, long long y)
{
  return y ? gcd(y, x % y) : x;
}

ll N, A, B, K;
ll ans = 0;

int main()
{
  init();
  cin >> N >> A >> B >> K;
  ll X = (A * inv[A + B]) % MOD;
  ll Y = (B * inv[A + B]) % MOD;
#if DEBUG == 1
  cerr << "X = " << X << ", Y = " << Y << endl;
#endif
  for (auto n = 0; n < N; n++)
  {
    ans += (((((power(X, N) * power(Y, n)) % MOD) * C(N + n - 1, n)) % MOD) * (N + n)) % MOD;
    ans %= MOD;
    ans += (((((power(Y, N) * power(X, n)) % MOD) * C(N + n - 1, n)) % MOD) * (N + n)) % MOD;
    ans %= MOD;
  }
  if (K > 0)
  {
    ans *= (100 * inv[A + B]) % MOD;
    ans %= MOD;
  }
  cout << ans << endl;
}

Measured memory_bytes: 23680
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define INF 1e12

#define PB push_back
#define PF push_front
#define fi first
#define se second
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vpi vector<pii>
#define vll vector<ll>
#define vpl vector<pll>
#define vvi vector<vector<int>>
#define vvl vector<vector<ll>>
#define MX(x) *max_element(all(x))
#define MN(x) *min_element(all(x))
#define ios ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define pr_d(x) cout << fixed << setprecision(15) << x << endl
#define ud(c, x) distance(c.begin(), upper_bound(all(c), x))
#define ld(c, x) distance(c.begin(), lower_bound(all(c), x))
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define rep3(i, n) for (int i = (n - 1); i >= 0; --i)
#define rep4(i, a, b) for (int i = (a); i > (b); --i)
#define pb push_back
#define out(x) cout << x << "\n"
bool odd(int i) { return i % 2; }

#define all(v) v.begin(), v.end()
#define size(x) int(x.size())

int gcd(int a, int b) { return __gcd(a, b); }
int lcm(int a, int b) { return a * (b / gcd(a, b)); }
void Yes_No(bool f) {
  if (f)
    printf("YES\n");
  else
    printf("NO\n");
}

void deb_p(pii p) { printf("pair = %d %d\n", p.fi, p.se); }
void deb_i(int i) { printf("i = %d\n", i); }
void deb_v(vector<int> v) {
  printf("v = ");
  for (auto i : v) printf("%d ", i);
  printf("\n");
}
template <typename T>
bool chmax(T& a, const T& b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <typename T>
bool chmin(T& a, const T& b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
//-------------------ここから回答する-----------------------

void solve(void) {
  int a, b, c;
  cin >> a >> b >> c;
  Yes_No(b - a == c - b);
}
int main(void) { solve(); }


Measured memory_bytes: 3544
#include <algorithm>
#include <cassert>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <utility>
#include <vector>

using namespace std;
using ll = long long;

constexpr ll infl = 10000000000000007LL;
constexpr int inf = 1000000007;

int main() {
    int m, k; cin >> m >> k;

    if (k >= (1 << m)) {
        cout << -1 << endl;
    }
    else if (m == 1 && k == 1) {
        cout << -1 << endl;
    }
    else if (m == 1 && k == 0) {
        cout << "0 0 1 1" << endl;
    }
    else {
        cout << k;
        for (int i = 0; i < 1 << m; ++i) {
            if (i != k) cout << ' ' << i;
        }
        cout << ' ' << k;
        for (int i = (1 << m) - 1; i >= 0; --i) {
            if (i != k) cout << ' ' << i;
        }
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 1792
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;
int main()
{
	string s;
	ll ans,last;
	cin>>s;
	ans=s.size();
	last=s[0];
	//cout<<n<<a<<b;
	for(ll i=1;i<s.size();i++){
		if(s[i]!=last){
			ll t=s.size();
			ans=min(ans,max(i,t-i));
			last=s[i];
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using vec=vector<ll>;
#define For(i,a,b) for(i=a;i<(ll)b;i++)
#define rep(i,N) For(i,0,N)
#define pb push_back
#define print(v) cout<<v<<endl
const ll mod=1000000007;
template<class T> inline bool chmax(T& a,T b){bool x=a<b;if(x)a=b;return x;} 

void startupcpp(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(15);
}

ll modinv(ll a) {
  ll b=mod,u=1,v=0,t;
  while(b){
    t=a/b;
    a-=t*b; swap(a,b);
    u-=t*v; swap(u,v);
  }
  return (u+mod)%mod;
}

ll moddevide(ll a,ll b){return (a*modinv(b))%mod;}

ll modpow(ll a,ll n){
  ll res=1;
  while(n){
    if(n&1)res=res*a%mod;
    a=a*a%mod;
    n>>=1;
  }
  return res;
}
vec primefactorization(ll N){
  ll i=2;
  vec res;
  while(i*i<=N){
    while(!(N%i)){
      res.pb(i);
      N/=i;
    }
    i++;
  }
  if(N-1)res.pb(N);
  return res;
}
int main(){
  startupcpp();
  ll t,N,ans=0;
  cin>>N;
  map<ll,ll> amp;
  while(N--){
    map<ll,ll> mp;
    cin>>t;
    vec v=primefactorization(t);
    for(auto x:v)mp[x]++;
    for(auto x:mp)chmax(amp[x.first],x.second);
    ans+=modinv(t);
  }
  ans%=mod;
  for(auto x:amp){
    ans=ans*modpow(x.first,x.second)%mod;
  }
  print(ans);
  return 0;
}

Measured memory_bytes: 896
#include <bits/stdc++.h>
typedef long long int ll;
using namespace std;
int main() {
    int x, y;
    cin >> x >> y;
    if ((y % 2 == 0) && (y >= 2 * x) && (4 * x >= y)){
        cout << "Yes";
    }
    else {
        cout << "No";
    }
    return 0;
}

Measured memory_bytes: 3648
#include "bits/stdc++.h"
using namespace std;
const int N = 16;
const long long inf = 1e15 + 15;
int n , k;
int arr[N];
long long solve(int pos , int len , int done){
	if(done >= k){
		return 0;
	}
	if(pos > n){
		return inf;
	}
	long long res = inf;
	res = min(res , solve(pos + 1 , max(len , arr[pos]) , done));
	int nlen = max(arr[pos] , len + 1);
	res = min(res , solve(pos + 1 , nlen , done + 1) + nlen - arr[pos]);
	return res;
}
int main(){
	scanf("%d %d" , &n , &k);
	for(int i = 1 ; i <= n ; ++i){
		scanf("%d" , arr + i);
	}
	printf("%lld\n" , solve(2 , arr[1] , 1));
}

Measured memory_bytes: 256
N = gets.to_i
A = gets.split.map &:to_i
B = gets.split.map(&:to_i).reduce(:+)
C = gets.split.map &:to_i
p B + (0...N-1).reduce(0){ |a,i| a + (A[i+1] == A[i]+1 ? C[A[i]-1] : 0) }

Measured memory_bytes: 1788
#include<bits/stdc++.h>
using namespace std;
const int maxn=200010;
int n,a[maxn],b[maxn];
vector<int> ans;
int main()
{
	cin>>n;
	for(int i=1;i<=n;i++)
		cin>>a[i];
	for(int i=n;i>=1;i--)
	{
		int yi=0;
		for(int j=2*i;j<=n;j+=i)
			yi^=b[j];
		yi^=a[i];
		if(yi==1)
		{
			b[i]=1;
			ans.push_back(i);
		}
	}
	cout<<ans.size()<<endl;
	for(int i=ans.size()-1;i>=0;i--)
		cout<<ans[i]<<" ";
	return 0;
}

Measured memory_bytes: 2936
#pragma region
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <list>
#include <iomanip>
#include <cstdint>
#include <bitset>

using namespace std;
typedef long long ll;
//#define rep(i, s, e) for (int(i) = (s); (i) < (e); ++(i))
#define rep(i, e) for (int(i) = 0; (i) < (e); ++(i))
#define rrep(i, s) for (int(i) = (s) - 1; (i) >= 0; --(i))
#define all(x) x.begin(),x.end()

#pragma region UnionFind
struct UnionFind
{
	vector<int> par;

	UnionFind(int n) : par(n, -1) {}
	void init(int n) { par.assign(n, -1); }

	int root(int x)
	{
		if (par[x] < 0) return x;
		else return par[x] = root(par[x]);
	}

	bool issame(int x, int y)
	{
		return root(x) == root(y);
	}

	bool merge(int x, int y)
	{
		x = root(x); y = root(y);
		if (x == y) return false;
		if (par[x] > par[y]) swap(x, y);
		par[x] += par[y];
		par[y] = x;
		return true;
	}

	int size(int x)
	{
		return -par[root(x)];
	}
};
#pragma endregion
#pragma region GCD
int gcd(int a, int b)
{
	if (a%b == 0)return b;
	return gcd(b, a%b);
}
#pragma endregion
#pragma region chmin
template<class T> inline bool chmin(T& a, T b)
{
	if (a > b)
	{
		a = b;
		return true;
	}
	return false;
}
#pragma endregion
#pragma region chmax
template<class T> inline bool chmax(T& a, T b)
{
	if (a < b)
	{
		a = b;
		return true;
	}
	return false;
}
#pragma endregion
#pragma endregion


int main()
{
	int n; cin >> n;
	string s; cin >> s;
	vector<vector<int>> dp(n + 1, vector<int>(n + 1));
	rep(i, n)rep(j, n)
	{
		if (s[i] == s[j])dp[i + 1][j + 1] = dp[i][j] + 1;
	}
	int mx = 0;
	rep(i, n)for (int j = i + 1; j < n; ++j)
	{
		chmax(mx, min(j - i, dp[i + 1][j + 1]));
	}
	cout << mx << endl;
}

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

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define REP(i, a, b) for (int i = (int)a; i < (int)b; ++i)
#define each(i,c) for(__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define all(v) v.begin(), v.end()
#define mset(a, n) memset(a, n, sizeof(a))

typedef long long ll;

const int INF = 1000000000;
const int MOD = 1000000007;

int main () {
    double a, b; cin >> a >> b;
    cout << ceil((a+b)/2) << endl;
}



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

int main(){
int n,h[100000],cost[100000];
cin >> n;
for (int i=0;i<n;i++){
  cin >> h[i];
}
cost[0]=0;
cost[1]=abs(h[1]-h[0]);
for (int i=2;i<n;i++){
    cost[i]=min(abs(h[i]-h[i-1])+cost[i-1],abs(h[i]-h[i-2])+cost[i-2]);
}
cout << cost[n-1] << endl;
return 0;
}


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

const int MOD = 1e9 + 7;

int main(){

    cin.tie(0);
    ios::sync_with_stdio(0);

    int n;
    string s;
    
    cin >> n >> s;
    
    vector<ll> a(26,1);
    
    rep(i,n){
        a[s[i] - 'a']++;
    }
    
    ll ans = 1;
    rep(i,26){
        ans = ans * a[i] % MOD;
    }
    
    cout << ans - 1 << endl;
    
    
}


Measured memory_bytes: 512
// 1908
#include<bits/stdc++.h>
#define fast ios::sync_with_stdio(false);cin.tie(NULL)
using namespace std;
#define int long long
#define MOD 1000000007
typedef vector<int> vi;
typedef pair<int,int> pi;
#define inf 1e18
#define For(i,a,b) for (int i = a; i < b; i++)
#define Rep(i,a,b) for (int i = a; i <= b; i++)
#define ps(x,y) fixed << setprecision(y) << x 
#define pb push_back 
#define mp make_pair 
 
int32_t main()
{
    fast;
    int w, a, b, v1 = 0, v2 = 0; cin >> w >> a >> b;
    v1 = b - a - w;
    v2 = a - b - w;
    if(v1 <= 0 and v2 <= 0) cout << 0;
    else {
        cout << max(v1, v2);
    }

    
    
    
    return 0;
}

Measured memory_bytes: 3500
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
using namespace std;
string a,b,c;
int main() {
  cin>>a>>b>>c;
  int cur=0;
  int i=0, j = 0, k = 0;
  while(i<a.size() || j<b.size() || k<c.size()) {
  	if (cur==0) {
      if (i >= a.size()) {
      	cout<<"A"<<endl;
        break;
      } else {
      	if (a[i] == 'b') cur=1;
        if (a[i] == 'c') cur=2;
      }
      i++;
    } else if (cur==1) {
      if (j >= b.size()) {
      	cout<<"B"<<endl;
        break;
      } else {
      	if (b[j] == 'a') cur=0;
        if (b[j] == 'c') cur=2;
      }
      j++;
    } else {
      if (k >= c.size()) {
      	cout<<"C"<<endl;
        break;
      } else {
      	if (c[k] == 'a') cur=0;
        if (c[k] == 'b') cur=1;
      }
      k++;
    }
  }
  return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Collections;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.IO;
using System.Reflection;
using static System.Math;
using System.Numerics;
static class Program{
	const int mod=(int)1e9+7;
	static void Main(){
		Sc sc=new Sc();
		//int n=sc.I;
		int[] s=sc.Ia;
		if(s[1]==1){Console.WriteLine("{0}",0);}
		else{Console.WriteLine("{0}",s[0]-s[1]);}
	}
}

public class Sc{
	public int I{get{return int.Parse(Console.ReadLine());}}
	public long L{get{return long.Parse(Console.ReadLine());}}
	public double D{get{return double.Parse(Console.ReadLine());}}
	public string S{get{return Console.ReadLine();}}
	public int[] Ia{get{return Array.ConvertAll(Console.ReadLine().Split(),int.Parse);}}
	public long[] La{get{return Array.ConvertAll(Console.ReadLine().Split(),long.Parse);}}
	public double[] Da{get{return Array.ConvertAll(Console.ReadLine().Split(),double.Parse);}}
	public string[] Sa{get{return Console.ReadLine().Split();}}
	public object[] Oa{get{return Console.ReadLine().Split();}}
	public int[] Ia2(int b){return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),int.Parse);}
	public int[] Ia3(int a,int b){return Array.ConvertAll(((a!=0?b.ToString()+" ":"")+Console.ReadLine()).Split(),int.Parse);}
	public int[] Ia3(int a,int b,int c,int d){return Array.ConvertAll(((a!=0?b.ToString()+" ":"")+Console.ReadLine()+(c!=0?" "+d.ToString():"")).Split(),int.Parse);}
	public long[] La2(int b){return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),long.Parse);}
	public long[] La3(int a,int b){return Array.ConvertAll(((a!=0?b.ToString()+" ":"")+Console.ReadLine()).Split(),long.Parse);}
	public long[] La3(int a,int b,int c,int d){return Array.ConvertAll(((a!=0?b.ToString()+" ":"")+Console.ReadLine()+(c!=0?" "+d.ToString():"")).Split(),long.Parse);}
	public T[] Arr<T>(int n,Func<T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f();}return a;}
	public T[] Arr<T>(int n,Func<int,T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i);}return a;}
	public T[] Arr<T>(int n,Func<string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(Console.ReadLine().Split());}return a;}
	public T[] Arr<T>(int n,Func<int,string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i,Console.ReadLine().Split());}return a;}
}

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

public class Main {
	public static void main(String[] args) {
		BufferedReader stdReader = new BufferedReader(new InputStreamReader(System.in));

		try {
			System.out.println((stdReader.readLine().toUpperCase()));
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}

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

static const ll MAX = 1e18;

int main(){
    ll N;
    cin>>N;
    vector<ll> A(N);
    for(int i=0; i<N; i++) cin>>A[i];

    double sum = 0;
    bool zero = false;
    bool check = false;

    for(int i=0; i<N; i++){
        sum += log10(A[i]);
        if(A[i] == 0) zero = true;
        if(sum > (double)18){
            check = true;
        }
    }

    if(zero){
        cout<<"0"<<endl;
    }

    else{
        if(!check){
            ll ans = 1;
            for(int i=0; i<N; i++) ans *= A[i];
            if(ans > MAX){
                cout<<"-1"<<endl;
            }
            else cout<<ans<<endl;
        }
        else cout<<"-1"<<endl;
    }

    return 0;
}

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

int main() {
  int N;
  cin >> N;
  
  int sum = 0;
  
  for (int i = 0; i < N; i++) {
    int l, r;
    cin >> l >> r;
    
    sum += (r - l + 1);
  }
  
  cout << sum << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <functional>
#include <bitset>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> P;
typedef vector<P> vpl;
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(ll i=(a); i<(b); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const int inf = 1<<30;
const ll linf = 1LL<<62;
const int MAX = 510000;
ll dy[8] = {0,1,0,-1,1,-1,1,-1};
ll dx[8] = {1,0,-1,0,1,-1,-1,1};
const double pi = acos(-1);
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
template<typename T1,typename T2> inline void print2(T1 a, T2 b){cout << a << " " << b << endl;}
template<typename T1,typename T2,typename T3> inline void print3(T1 a, T2 b, T3 c){
	cout << a << " " << b << " " << c << endl;
}
const int mod = 1e9 + 7;

int main(){
	ll n; cin >> n;
	string s; cin >> s;
	ll ans = 0;
	rep(i,n-2){
		if(s.substr(i,3)=="ABC") ans++;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
N=int(input())
import numpy as np
a=np.array(input().split(),dtype=int)
asum=np.cumsum(a)
half=asum.max()//2
isodd=(asum.max()%2==1)
import bisect
p=bisect.bisect_left(asum,half)
if abs(half-asum[p])>abs(half-asum[p-1]):
  p=p-1
longer=asum[p]
shorter=asum.max()-asum[p]
print(abs(longer-shorter))


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

int main()
{
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string a,b;
    cin>>a>>b;
    string s = a+b;
    int x = stoi(s);
    int ans = sqrt(x);
    if(ans*ans==x)
    cout<<"Yes"<<"\n";
    else
    cout<<"No"<<"\n";
    
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = (0); i < (n); ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define DEBUG(val) cout << #val << " : " << val << endl
#define MOD 1000000007

int main() {
  ll n, k;
  cin >> n >> k;
  int a[n];
  REP(i, n) {
    int x;
    cin >> x;
    a[i] = x - 1;
  }
  int next_town = a[0];
  int dist = 0;
  map<int, int> memory;
  map<int, int> memory_dist;
  while (memory[next_town] == 0) {
    memory[next_town] = 1;
    memory_dist[next_town] = dist + 1;
    dist++;
    next_town = a[next_town];
  }
  int one_to_loop_start = memory_dist[next_town];
  int loop_dist = dist - one_to_loop_start + 1;
  int start = 0;
  if (k > 3000000) {
    k -= one_to_loop_start;
    while (k > 3000000) {
      k %= loop_dist;
    }
    start = next_town;
  }

  while (k != 0) {
    start = a[start];
    k--;
  }
  cout << (start + 1) << endl;
}

Measured memory_bytes: 22812
#include <iostream>
#include <algorithm>
#include <math.h>
#include <string.h>
#include <cstdio>
#include <vector>
#include <set>
#include <cassert>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <sstream>
#include <functional>
#include <iomanip>
//#include <windows.h>  //Should be deleted when using AtCoder&POJ
using namespace std;

#define ll long long

#define pii pair<int,int>
/**==Info==
*Program:2
*Problem:Small Mutilple
*Date:2017-11-18
*Algorithm:Dijkstra
*Stats:Unknown*/

bool debug=false;
template<typename T> struct pq_small{
	priority_queue<T,vector<T>,greater<T> > pq;
	void push(T x){
		pq.push(x);
	}

	void pop(){
		pq.pop();
	}

	int size(){
		return pq.size();
	}

	bool empty(){
		return pq.empty();
	}

	T top(){
		return pq.top();
	}
};

bool visit[205][100005];

int main(int argc,char* argv[]){
	int k;
	cin>>k;
	pq_small<pii> pq; //{The sum of numbers,the mod>
	pq.push(make_pair(1,1));
	int mn=1e9;
	
	while(!pq.empty()){
		pii last=pq.top();
		//cout<<last.first<<" "<<last.second<<endl;
		pq.pop();
		if(last.first>mn) continue;
		if(visit[last.first][last.second]) continue;
		visit[last.first][last.second]=true;
		if(last.second==0){
			mn=min(mn,last.first);
		}
		//x10
		if(!visit[last.first][last.second*10%k]){
			pq.push(make_pair(last.first,last.second*10%k)); 
		}
		//+1
		if(!visit[last.first+1][(last.second+1)%k]){
			pq.push(make_pair(last.first+1,(last.second+1)%k));
		}
	}
	
	cout<<mn;
	return 0;
}


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

#ifndef LOCAL_
#define fprintf if( false ) fprintf
#endif // LOCAL_
#define dump() fprintf(stderr, "#%s.%d\n", __func__, __LINE__);
#define dumpl(x1) fprintf(stderr, "#%s.%d (%s) = (%ld)\n", __func__, __LINE__, #x1, x1);
#define dumpll(x1, x2) fprintf(stderr, "#%s.%d (%s, %s) = (%ld, %ld)\n", __func__, __LINE__, #x1, #x2, x1, x2);
#define dumplll(x1, x2, x3) fprintf(stderr, "#%s.%d (%s, %s, %s) = (%ld, %ld, %ld)\n", __func__, __LINE__, #x1, #x2, #x3, x1, x2, x3);
#define dumpd(x1) fprintf(stderr, "#%s.%d (%s) = (%lf)\n", __func__, __LINE__, #x1, x1);
#define dumpdd(x1, x2) fprintf(stderr, "#%s.%d (%s, %s) = (%lf, %lf)\n", __func__, __LINE__, #x1, #x2, x1, x2);
#define loop for(;;)
typedef int64_t Int;
typedef std::vector<Int> LI;
const double pi = 3.14159265358979323846264338;
const Int mod = 1000000007;

template<typename T> void scan1(T& x) { fprintf(stderr, "unknown type\n"); }
template<> void scan1(Int& x) { if( scanf("%" PRId64, &x) < 0 ) exit(0); }
template<> void scan1(std::string& x) { if( not ( std::cin >> x ) ) exit(0); }
template<> void scan1(LI& xs) { for(Int &x : xs) scan1(x); }
void scan() {}
template<typename Head, typename... Tail>
void scan(Head& x, Tail&... xs) {
  scan1(x); scan(xs...);
}

template<typename T>
struct Maybe {
   T x;
   bool valid;
   Maybe() : valid(false) {}
   Maybe(T x_) : x(x_), valid(true) {}
   operator T() const {
      assert( valid );
      return x;
   }
};

struct Solver {
   Solver() { fprintf(stderr, "--------Solver begin--------\n"); }
   ~Solver() { fprintf(stderr, "--------Solver end--------\n"); }
   std::vector<Int> xs, ys;
   Int n, m;
   void solve() {
      scan(n, m);
      xs.resize(n), ys.resize(n);
      for(Int i = 0; i < n; ++i) {
         scan(xs[i], ys[i]);
      }
      printf("%ld\n", f(31, 0));
   }
   Int f(Int i, Int x) {
      if( i < 0 ) {
         Int mask = x;
         Int t = 0;
         for(Int k = 0; k < n; ++k) {
            if( ( xs[k] & (~mask) ) == 0 ) t += ys[k];
         }
         return t;
      }
      if( m & (1LL << i) ) {
         Int mask = x | ((1LL << i) - 1);
         Int t = 0;
         for(Int k = 0; k < n; ++k) {
            if( ( xs[k] & (~mask) ) == 0 ) t += ys[k];
         }
         return std::max(t, f(i-1, x|(1LL << i)));
      }
      else {
         return f(i-1, x);
      }
   }
};

int main() {
   loop std::unique_ptr<Solver>(new Solver())->solve();
}




Measured memory_bytes: 1792
#include"bits/stdc++.h"
using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
using ll = long long;


int main() {
	ll n,k,a,b;
	cin >> n >> k;
	vector<ll>arr;
	map<ll, ll>mp;
	ll cnt = 0;
	rep(i, n) {
		cin >> a >> b;
		mp[a] += b;
	}
	for(auto itr:mp){
		cnt += itr.second;
		//cout << itr.first << " " << itr.second << endl;
		if (cnt >= k) {
			cout << itr.first << endl;
			break;
		}
	}

	return 0;
}


Measured memory_bytes: 4224
//abc173_e.cpp
//Sun Jul  5 20:55:33 2020

#include <iostream>
#include <string>
#include <queue>
#include <map>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <math.h>
#include <set>
#define INTINF 2147483647
#define LLINF 9223372036854775807
#define MOD 1000000007
#define rep(i,n) for (int i=0;i<(n);++i)

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

// auto mod int
struct mint {
	ll x; // typedef long long ll;
	mint(ll x=0):x((x%MOD+MOD)%MOD){}
	mint operator-() const { return mint(-x);}
	mint& operator+=(const mint a) {
		if ((x += a.x) >= MOD) x -= MOD;
		return *this;
	}
	mint& operator-=(const mint a) {
		if ((x += MOD-a.x) >= MOD) x -= MOD;
		return *this;
	}
	mint& operator*=(const mint a) { (x *= a.x) %= MOD; return *this;}
	mint operator+(const mint a) const { return mint(*this) += a;}
	mint operator-(const mint a) const { return mint(*this) -= a;}
	mint operator*(const mint a) const { return mint(*this) *= a;}
	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t>>1);
		a *= a;
		if (t&1) a *= *this;
		return a;
	}

	// for prime mod
	mint inv() const { return pow(MOD-2);}
	mint& operator/=(const mint a) { return *this *= a.inv();}
	mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

int main(){
	ll n,k;
	cin >> n >> k;

	vector<ll> plus;
	vector<ll> minus;
	ll a[n];
	rep(i,n){
		cin >> a[i];
		if (a[i]>=0){
			plus.push_back(a[i]);
		}else {
			minus.push_back(a[i]);
		}
	}

	sort(plus.rbegin(),plus.rend());
	sort(minus.begin(),minus.end());

	if (k==n){
		mint ans = 1;
		rep(i,n){
			ans *= a[i];
		}
		cout << ans << endl;
		return 0;
	}

	if (plus.size()==0 && k%2==1){
		sort(minus.rbegin(),minus.rend());
		mint ans = 1;
		for (int i=0;i<k;i++){
			ans *= minus[i];
		}
		cout << ans << endl;
		return 0;
	}else {
		int cpi = 0;
		int cmi = 0;
		mint ans = 1;
		if (k%2==1){
			ans *= plus[0];
			cpi = 1;
			k--;
		}

		vector<ll> niko;
		for (int i=cpi;i<plus.size();i=i+2){
			niko.push_back(plus[i]*plus[i+1]);
		}
		for (int i=0;i<minus.size();i=i+2){
			niko.push_back(minus[i]*minus[i+1]);
		}

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

		rep(i,k/2){
			ans *= niko[i];
		}

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

//	printf("%.4f\n",ans);
}

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

int main() {
  int A,B;
  string S;
  cin >> A >> B >> S;
  bool ans=true;
  for(int i=0;i<A;i++){
    if((S[i]-'0')<0 || (S[i]-'9')>0)ans=false;
  }
  if(S[A]!='-')ans=false;
  for(int i=A+1;i<S.length();i++){
    if((S[i]-'0')<0 || (S[i]-'9')>0)ans=false;
  }
  if(ans)cout << "Yes";
  else cout << "No";
}




Measured memory_bytes: 256
#include <stdio.h>

int main(){
    int a,b,result=03;
    char op;
    while(1){
        scanf("%d %c %d",&a,&op,&b);
        if(op=='?')break;
        if(op=='+'){
            result=a+b;
        }
        else if(op=='-'){
            result=a-b;
        }
        else if(op=='*'){
            result=a*b;
        }
        else if(op=='/'){
            result=a/b;
        }
        printf("%d\n",result);
    }
    
    return 0;
}

Measured memory_bytes: 1852
import sys
n=int(input())
d=list(map(int,input().split()))
num_d=[0 for i in range(n)]
num_d[0]=1
if d[0]!=0:
  print(0)
  sys.exit()
for i in range(1,len(d)):
  if d[i]==0:
    print(0)
    sys.exit()
  num_d[d[i]]+=1
max_d=0
ans=1
for i in range(1,n):
  if num_d[i]!=0:
    if max_d!=i-1:
      print(0)
      sys.exit()
    max_d=i
    ans*=num_d[i-1]**num_d[i]
    ans%=998244353
print(ans)


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

typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<P,ll> PLL;
typedef pair<P,P> PP;
typedef vector<ll> VECLL;
typedef vector<P> VECP;
typedef priority_queue<P,VECP,greater<P> > PQP;
typedef priority_queue<ll, VECLL, greater<ll> > PQll;

#define rep(i,a,n) for(ll i = a;i < n;i++)   
#define rrep(i,a,n) for(ll i = n; i >= a;i--)
#define index_check(i,n) if(i > n-1 || i < 0) continue; 
#define LINF (ll)1e18
#define INF (int)1e9
#define fs first
#define sc second


int main(){
    ll h,w,m;
    cin >> h >> w >> m;
    P cnth[h],cntw[w];
    rep(i,0,h) cnth[i] = P(0,i);
    rep(i,0,w) cntw[i] = P(0,i);

    map<P,ll> mapp;
    rep(i,0,m){
        ll x,y;
        cin >> y >> x;
        x--;y--;
        mapp[P(y,x)] = true;
        (cnth[y].first)++;
        (cntw[x].first)++;
    }

    sort(cnth,cnth+h,greater<P>());
    sort(cntw,cntw+w,greater<P>());

    ll index_h = 0;
    rep(i,0,h-1){
        if(cnth[i].fs != cnth[i+1].fs) break;
        index_h++;
    }

    ll index_w = 0;
    rep(i,0,w-1){
        if(cntw[i].fs != cntw[i+1].fs) break;
        index_w++;
    }

    rep(i,0,index_h+1){
        rep(j,0,index_w+1){
            if(mapp.count(P(cnth[i].sc,cntw[j].sc)) == 0){
                cout << cnth[i].fs + cntw[j].fs << endl;
                return 0;
            }
        }
    }
    cout << cnth[index_h].fs + cntw[index_w].fs - 1 << endl;
}



Measured memory_bytes: 31748
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;

int main(){

    ll N, Y;
    cin >> N >> Y;
    for(ll x = 0; x <= N; x++){
        for(ll y = 0; x + y <= N; y++){
            ll z = N - x - y;
            if(z < 0)continue;
            if(x * 10000 + y * 5000 + z * 1000 == Y){
                cout << x << " " << y << " " << z << endl;
                return 0;
            }
        }
    }
    cout << "-1 -1 -1" << endl;

    return 0;
}

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

void main() {
  int n = readln.chomp.to!int;
  int[] a = readln.chomp.split.to!(int[]);
  int m1,
      m2,
      m4;
  bool flag;

  foreach (ai; a) {
    if (ai % 4 == 0) {
      m4++;
    } else if (ai % 2 == 0) {
      m2++;
    } else {
      m1++;
    }
  }

  if (m2) {
    flag = (m1 <= m4);
  } else {
    flag = (m1 <= m4 + 1);
  }

  writeln(flag ? "Yes" : "No");
}


Measured memory_bytes: 4404
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<cstdlib>
#include<tuple>
#include<iomanip>
#include<stack>
#include<map>
#include<queue>
#include<set>
#define int long long
using namespace std;
const int INF = 1e10;
const int ZERO = 0;

signed main() {
    int H,W;
    cin >> H >> W;
    vector<vector<char>> vec(H,vector<char>(W));
    for(int i = 0;i < H;i++) {
        for(int j = 0;j < W;j++) {
            cin >> vec.at(i).at(j);
        }
    }
    vector<bool> A(H);
    vector<bool> B(W);
    for(int i = 0; i < H;i++) {
        bool C = false;
        for(int j = 0;j < W;j++) {
            if(vec.at(i).at(j) == '#') {
                C = true;
            }
        }
        if(C == true) {
            A.at(i) = true;
        }
    }
    for(int i = 0;i < W;i++) {
        bool C = false;
        for(int j = 0;j < H;j++) {
            if(vec.at(j).at(i) == '#') {
                C = true;
            }
        }
        if(C == true) {
            B.at(i) = true;
        }
    }
    for(int i = 0;i < H;i++) {
        for(int j = 0;j < W;j++) {
            if(A.at(i) == true && B.at(j) == true) {
                cout << vec.at(i).at(j);
            }
          	if(j == W - 1 && A.at(i) == true) {
            cout << endl;
        	}
        }
    }
}

Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0;i < (int)(n);i++)
using ll = long long;
const ll MOD=1000000007;
//const ll MOD=998244353;
const long long INF = 1LL << 60;
const double pi=acos(-1.0);

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



int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  // cout << fixed << setprecision(15);

  ll N; cin>>N;
  vector<ll> b(N); rep(i,N) cin>>b[i];
  
  vector<ll> vec(N);
  rep(i,N){
    ll sz=N-i; int judge=1;
    for(int j=sz;j>=1;j--){
      if(b[j-1]==j){
        //cout<<j<<endl;
        b.erase(b.begin()+j-1); 
        judge=0;
        vec[i]=j;
        break;
      }
    }
    if(judge) {cout<<-1<<endl; return 0;}
  }
  
  reverse(vec.begin(),vec.end());
  for(auto v:vec) cout<<v<<endl;
  return 0;
}

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

int ri() {
	int n;
	scanf("%d", &n);
	return n;
}
std::random_device rnd_dev;
std::mt19937 rnd(rnd_dev() ^ time(NULL));

std::vector<int> init(int n, const std::vector<int> &c, const std::vector<std::vector<int> > &val) {
	(void) val;
	double par[26];
	for (int i = 0; i < 26; i++) par[i] = std::sqrt(c[i]);
	double sum = std::accumulate(par, par + 26, 0.0);
	int times[26];
	double acc = 0;
	for (int i = 0; i < 26; i++) {
		acc += par[i];
		times[i] = (acc + 0.00001) / sum * n;
	}
	for (int i = 25; i--; ) times[i + 1] -= times[i];
	// for (auto &i : times) i--;
	//for (auto i : times) std::cerr << i << std::endl;
	std::vector<int> res;
	for (int i = 0; i < 26; i++) for (int j = 0; j < times[i]; j++) res.push_back(i);
	std::shuffle(res.begin(), res.end(), rnd);
	assert(res.size() == n);
	return res;
}


std::vector<int> solve(int n, const std::vector<int> &c, const std::vector<std::vector<int> > &val) {
	auto score = [&] (const std::vector<int> &all) {
		int last[26];
		for (auto &i : last) i = -1;
		int res = 0;
		for (int i = 0; i < n; i++) {
			int cur = all[i];
			last[cur] = i;
			for (int j = 0; j < 26; j++) res -= c[j] * (i - last[j]);
			res += val[i][cur];
		}
		return res;
	};
	clock_t start = clock();
	
	auto r26 = init(n, c, val);
	
	std::vector<int> cur = r26;
	int cur_score = score(cur);
	int best_score = -1000000000;
	std::vector<int> best;
	
	while (1) {
		clock_t cur_time = clock();
		if (cur_time - start > 1.95 * CLOCKS_PER_SEC) break;
		int r0 = std::uniform_int_distribution<>(0, n - 1)(rnd);
		int r1 = std::uniform_int_distribution<>(0, n - 1)(rnd);
		std::swap(cur[r0], cur[r1]);
		double threshold = 1.95 - (double) (cur_time - start) / CLOCKS_PER_SEC;
		// std::cerr << threshold << std::endl;
		int new_score = score(cur);
		if (new_score > best_score * (1 - threshold * 0.001)) cur_score = new_score;
		else std::swap(cur[r0], cur[r1]);
		if (best_score < cur_score) best_score = cur_score, best = cur;
	}
	
	return best;
}

void input() {
	int n = ri();
	std::vector<int> c(26);
	for (auto &i : c) i = ri();
	std::vector<std::vector<int> > val(n, std::vector<int>(26));
	for (auto &i : val) for (auto &j : i) j = ri();
	for (auto i : solve(n, c, val)) printf("%d\n", i + 1);
}

void random_test() {
	int n = 365;
	std::vector<int> c(26);
	for (auto &i : c) i = std::uniform_int_distribution<>(0, 100)(rnd);
	std::vector<std::vector<int> > val(n, std::vector<int>(26));
	for (auto &i : val) for (auto &j : i) j = std::uniform_int_distribution<>(0, 20000)(rnd);
	
	auto res = solve(n, c, val);
	
	
	int last[26];
	for (auto &i : last) i = -1;
	int score = 0;
	for (int i = 0; i < n; i++) {
		last[res[i]] = i;
		for (int j = 0; j < 26; j++) score -= c[j] * (i - last[j]);
		score += val[i][res[i]];
	}
	printf("%d\n", score);
}

int main() {
#	ifdef LOCAL
	random_test();
#	else
	input();
#	endif
	return 0;
}



Measured memory_bytes: 3912
// #define _CRT_SECURE_NO_WARNINGS
// #define _USE_MATH_DEFINES	// M_PI=3.1415...
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <locale>
#include <cctype>
#include <sstream>
#include <iomanip>	// 20桁出力 cout << setprecision(20) << double;
#include <queue>
#include <bitset>	// bitset<8> bs1(131uL); // 10000011 bs1[0]は1 01stringからビット集合生成可
using namespace std;

typedef long long LL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<LL> VL;
typedef map<int, int> MAPII;
typedef multimap<int, char, greater<int> > MuMAPIC;
typedef vector<pair<int, int> > VPII;
typedef multimap<int, string, greater<int> > MuMIS;
typedef pair<int, int> P;
typedef pair<int, pair<P, P> > PP;

#define INF 999999999999999997;
#define MP make_pair
#define FAST_IO  cin.tie(0); ios::sync_with_stdio(false);
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define FORL(i,a,b) for(LL i=(a);i<(b);i++)
#define FOR_REV(i,a,b) for(int i=(a);i>=(b);i--)
//for gcc (未test)
// #define FOREACH_IT(it,c) for(typeof(c)::iterator it=(c).begin(); it!=(c).end(); ++it)
//for Visual Studio
#define foreach_it(type,it,c) for(type::iterator it=c.begin(),c_end=c.end();it!=c_end;++it)
#define FOR_ITR(d) for(auto itr=d.begin(),d_end=d.end();itr!=d_end;++itr)	// C++11
// for Debug.
#define DUMP_VVI(b) FOR(i,0,b.size()){FOR(j,0,b[i].size())printf("%d ",b[i][j]);puts("");}
#define D_OUT(str,value) if(dbgF){cout<<str<<" : "<<value<<endl;}
// 入力をpush_back(d)やarray[d]に使う時に1行で書ける
// int INPUT_INT() {int d;cin>>d;return d;}
template<class T>T IN() { T d; cin >> d; return d; }
// 最大公約数（Greatest Common Divisor）
LL gcd(LL a, LL b) { return (b > 0) ? gcd(b, a%b) : a; }
// 最小公倍数（Least Common Multiple）
LL lcm(LL a, LL b) { return a / gcd(a, b) * b; }
// Y年はうるう年か否か
bool uruu(LL Y) { return (((Y % 4 == 0 && Y % 100 != 0) || Y % 400 == 0) ? true : false); }

int dx[4] = { 0,1,0,-1 };
int dy[4] = { 1,0,-1,0 };
int dxx[8] = { 0,1,1,1,0,-1,-1,-1 };
int dyy[8] = { 1,1,0,-1,-1,-1,0,1 };

// vector注意
// vec[i][j]の形に入力を入れるとき、vecは初期化してある必要がある.

// ------------------- include, typedef, define END. -------------------


int main() {
	FAST_IO;
	// for D_OUT(str, value)  ... cout<< str <<" : "<< value <<endl;
	bool dbgF = true;

	//コードはここから書く.
	LL N;
	cin >> N;
	LL ketawa = 0;
	string ns = to_string(N);
	FOR(i, 0, ns.length())
		ketawa += ns[i] - '0';
	
	cout << (N%ketawa == 0 ? "Yes" : "No") << endl;

	return 0;
}


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

const ll INF = 1001001001;


int main(){
  string s,t;
  cin>>s>>t;
  int a,b;
  cin>>a>>b;
  string u; cin>>u;
  if(s==u){
    cout<<a-1<<" "<<b<<endl;
  }else{
    cout<<a<<" "<<b-1<<endl;
  }
}

Measured memory_bytes: 256