akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
using P = pair<ll, ll>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
#define ALL(obj) (obj).begin(), (obj).end()
#define MOD 1000000007
#define INF 1000000000

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

	ll N;
	ll ans = 0;

	cin >> N;

	vector<ll> sum(N);
	ll tmp;
	rep(i, N) {
		cin >> tmp;
		if (i == 0) sum[i] = tmp;
		else {
			sum[i] += sum[i - 1] + tmp;
		}
	}

	ll S1, S2;
	ll min = INF;
	rep(i, N) {
		S1 = sum[i];
		S2 = sum[N - 1] - sum[i];
		if (abs(S2 - S1) < min) {
			min = abs(S2 - S1);
		}
	}

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

Measured memory_bytes: 256
#include<iostream>
#include<vector>
using namespace std;
int main(int argc, char *argv[])
{
  const int BIG = 1000000;
  const int CMAX = 10000;
  for(;;) {
    int n;
    cin >> n;
    if(n == 0) break;
    vector<int> ps;
    for(int i = 0; i < n; i++) {
      int p; cin >> p; ps.push_back(p);
    }
    // shop : at most 100
    // change : at most 49900... too much?
    // # of 500 got so far : at most 100
    // value : minimum payment
    
    vector<vector<int>> dp(CMAX+1, vector<int>(101, BIG));
    vector<vector<int>> dpnew(CMAX+1, vector<int>(101, BIG));
    dpnew[0][0] = 0;
    int cmax = 0;
    for(int i = 0; i < n; i++) {
      const int ii = i + 1;
      for(int j = 0; j <= cmax; j++) { // not buying
        for(int k = 0; k <= i; k++) {
          dp[j][k] = dpnew[j][k];
        }
      }
      // buying
      const int p = ps[i] % 1000;
      if(p != 0 && p <= 500) { // got 500!
        for(int j = 0; j <= cmax; j++) {
          const int jj = min(j + 500 - p, CMAX);
          cmax = min(max(cmax, jj), CMAX);
          for(int k = 0; k <= i; k++) {
            const int kk = k + 1;
            dpnew[jj][kk] = min(dpnew[jj][kk], dp[j][k] + ps[i]);
          }
        }
      } else {
        // get 500 if possible!
        const int q = (p == 0 ? 1000 : p) - 500;
        for(int j = 0; j <= cmax; j++) {
          if(j >= q) {
            const int jj = j - q;
            for(int k = 0; k <= i; k++) {
              const int kk = k + 1;
              dpnew[jj][kk] = min(dpnew[jj][kk], dp[j][k] + ps[i]);
            }
          } else { // get change
            const int jj = j + 1000 - p;
            cmax = min(max(cmax, jj), CMAX);
            if( jj < 1000) {
              for(int k = 0; k <= i; k++) {
                const int kk = k;
                dpnew[jj][kk] = min(dpnew[jj][kk], dp[j][k] + ps[i]);
              }
            }
          }
        }
      }
    }
    for(int k = 100; k >= 0; k--) {
      int p = BIG;
      for(int j = 0; j <= cmax; j++) {
        p = min(p, dpnew[j][k]);
      }
      if(p != BIG) {
        cout << k << " " << p << endl;
        break;
      }
    }
  }
  return 0;
}



Measured memory_bytes: 11512
#include <cstdio>
#include <vector>
#include <cstdlib> // For exit(0)
using namespace std;

typedef long long LL;

vector<LL> v;
int k;

void dfs(int d)
{
	if(v.size() == d)
		if(--k == 0)
		{
			for(int x: v) putchar(x + '0');
			putchar('\n');
			exit(0);
		}
	else return;
	if(v.empty())
		for(int i=1; i<10; i++)
		{
			v.push_back(i);
			dfs(d);
			v.pop_back();
		}
	else for(int i=v.back()-1; i<v.back()+2; i++)
	{
		if(i < 0 || i > 9) continue;
		v.push_back(i);
		dfs(d);
		v.pop_back();
	}
}
 
int main(int argc, char** argv)
{
	scanf("%d", &k);
	for(LL d = 1; ; d++) dfs(d);
	return 0;
}

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

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

    lli n,i,j,k,x;
    cin>>n;
    lli dp[n+1][4],a[n+1][4];
    for(i=1;i<=n;++i)cin>>a[i][1]>>a[i][2]>>a[i][3];
    dp[1][1]=a[1][1];dp[1][2]=a[1][2];dp[1][3]=a[1][3];
    for(i=2;i<=n;++i)
    {
        dp[i][1]=a[i][1]+max(dp[i-1][2],dp[i-1][3]);
        dp[i][2]=a[i][2]+max(dp[i-1][1],dp[i-1][3]);
        dp[i][3]=a[i][3]+max(dp[i-1][2],dp[i-1][1]);
    }
    cout<<max(dp[n][1],max(dp[n][2],dp[n][3]));
}


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

int main(){
  string s,t;
  cin >> s >> t;
  
  int znb = s.size();
  int bbn = t.size();
  
  int count = 1000;
  
  for(int i = 0;i < znb - bbn + 1;i ++){
    int judge = 0;
    for(int j = 0;j < bbn;j ++){
      if(s[i + j] != t[j])judge ++;
    }
    if(judge < count)count = judge;
  }
  cout << count << endl;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
#define REP(i, n) for (int (i) = 0; (i) < (int)(n); i++) 
#define FOR(i, a, b) for(int (i) = a; (i) < (int)b; i++)
#define RREP(i, n) for(int (i)=((int)(n)-1); (i)>=0; i--)
#define RFOR(i, a, b) for(int (i) =((int)(b)-1); (i)>=(int)a; i--)
#define ALL(v) (v).begin(),(v).end()
#define MOD 1000000007
#define NIL -1
#define FI first
#define SE second
#define MP make_pair
#define PB push_back
#define SZ(x)  (int)x.size()
#define SP(x)  setprecision((int)x)


using namespace std ;
typedef long long ll;
using Graph = vector<vector<int>>;
typedef vector<int> vint;
typedef vector<vint> vvint;
typedef vector<string> vstr;
typedef pair<int, int> pii;
const int INF = 1e9;
const ll LINF = 1e18;
const double EPS = 1e-9;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
ll gcd(ll a, ll b) {return b ? gcd(b, a % b) : a;} //最大公約数
ll lcm(ll a, ll b) {return a / gcd(a, b) * b;} //最小公倍数

//-------------------------------------------------
// 

int solve(int ans,vint vec){
  int m = SZ(vec) ;
  
  if(m==0){
    return ans ;
  }
  else{
    int mini = INF ;
    REP(i,m){
      mini = min(mini,vec[i]) ;
    }
    ans += mini ;
    REP(i,m){
      vec[i] -=mini ;
    }
    int i=0 ;
    vint left ;
    vint right ;
    while(i<m+1){
      if(vec[i]!=0){
        left.PB(vec[i]) ;
        i++ ;
      }
      else{
        ans = solve(ans,left) ;
        i++ ;
        FOR(j,i,m){
          right.PB(vec[j]) ;
        }
        ans = solve(ans,right) ;
        break ;
      }
    }
    return ans ;
  }
}

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n ;
  cin >> n ;
  vint num(n+1,0) ;
  REP(i,n){
    cin >> num[i] ;
  }
  cout << solve(0,num) <<endl ;

  return 0 ;
}

Measured memory_bytes: 384
#include <stdio.h>

int main()
{
 int n, m=100000;
 scanf("%d", &n);
 while(n>0){
  m *= 1.05;
  if(m%1000!=0){
   m += 1000 - m%1000;
  }
  n--;
 }
 printf("%d\n", m);
 return(0);
}

Measured memory_bytes: 592
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <string>
#include <iomanip>
#include <map>
#include <set>
#include <cmath>
#include <cstdio>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define All(v) (v).begin(),(v).end()
typedef long long ll;

int main(){
    int N;cin >> N;
    vector<pair<int,int> > tasks(N);
    rep(i,N){
        int a,b;
        cin >> a >> b;
        tasks[i]=make_pair(b,a);
    }
    sort(All(tasks));
    int time=0;
    rep(i,N){
        time+=tasks[i].second;
        if(time>tasks[i].first){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}

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

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

int main() {
	int D, N;
	cin >> D >> N;
	if (N < 100) {
		cout << pow(100, D) * N;
	}
	else {
		cout << ll(pow(100, D)) * (N + 1);
	}
	return 0;
}

Measured memory_bytes: 256
fun main(args: Array<String>) {
    abc113b()
}

fun abc113b() {
    val n = readLine()!!.toInt()
    val (t, a) = readLine()!!.split(" ").map { it.toDouble() }
    val hList = readLine()!!.split(" ").mapIndexed { index, s -> Pair(index + 1, s.toDouble()) }

    val answer = hList.map { Pair(it.first, Math.abs(t - (it.second * 0.006) - a)) }
        .minBy { it.second }?.first

    println(answer)
}


Measured memory_bytes: 37904
#include<iostream>                                                              
                                                                                
using namespace std;                                                            
                                                                                
int main(void){                                                                 
  int a,b,x;                                                                    
  cin >> a>>b;                                                                  
  cout << ((b-a-1)*(b-a))/2 - a;                                                
  return 0;                                                                     
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main() {
	int a;
	int b;
	int c;
	int d;
	int e;
	std::cin >> a >> b;
	if ((a == 1 || a == 3 || a == 5 || a == 7 || a == 8 || a == 10 || a == 12) && (b == 1 || b == 3 || b == 5 || b == 7 || b == 8 || b == 10 || b == 12)) {
		cout << "Yes" << "\n";
	}
	else if ((a == 4 || a == 6 || a == 9 || a == 11) && (b == 4 || b == 6 || b == 9 || b == 11)) {
		cout << "Yes" << "\n";
	}
	else {
		cout << "No" << "\n";
	}
	std::cin >> e;
}

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

bool a[1000000005] = {0};

int main() 
{
	int n;
	cin >> n;
	for (int i = 1;i <= n;i++)
	{
		int b;
		cin >> b;
		if (a[b] == true)
		{
			cout << "NO" << endl;
			return 0;
		}
		a[b] = true;
	}
	cout << "YES" << endl;
    return 0;
}

Measured memory_bytes: 975360
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; ++i)
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<string> S(n);
  vector<int> cnt(26, INT_MAX);
  rep(i, n) cin >> S[i];
  rep(i, n) {
    for(int j=0; j<26; ++j) {
      int tmp = 0;
      for(char c:S[i]) {
        if(c-'a' == j) ++tmp;
      }
      cnt[j] = min(cnt[j], tmp);
    }
  }
  rep(i, 26) {
    rep(j, cnt[i]) {
      cout << (char)(i+'a');
    }
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 256
N, K = map(int, input().split())
mod = 10 ** 9 + 7

K = min(K, N - 1)

fact = [1]
facinv = [1]
for i in range(1, N + 1):
    fact.append(fact[-1]*i % mod)


def nCr(n, r):
    num = fact[n]
    div = fact[r] * fact[n - r] % mod
    return num * pow(div, mod - 2, mod) % mod


move = [0] * (N + 1)
move[0] = 1
for i in range(1, N + 1):
    x = nCr(N, i) * nCr(N - 1, N - i - 1) % mod
    move[i] = x

for i in range(1, N):
    move[i] = (move[i - 1] + move[i]) % mod

ans = move[K]
print(ans)


Measured memory_bytes: 18892
#include <vector>
#include <string>
#include <iostream>
#include <iomanip>
#include <queue>
#include <algorithm>
#include <functional>
#include <map>
#include <array>
#include <cmath>
#include <set>
#include <numeric>

using namespace std;

template <typename T>
using TABLE = vector<vector<T>>;

using LONG = long long;
using LVEC = vector<long long>;

#define FOR(_i, s, e) for(_i = s; _i < e; ++_i)
#define FOR_INV(_i, s, e) for(_i = e - 1; _i >= s; --_i)

long long PRIME = 1e9 + 7;
long long PRIME2 = 998244353;


using pos = std::pair<LONG, LONG>;


int main(){
    LONG N, M;
    cin >> N >> M;

    vector<pos> BA(N);
    LONG i;
    LONG A, B;

    FOR(i, 0, N){
        cin >> A >> B;
        BA[i].first = B;
        BA[i].second = A;
    }

    sort(BA.begin(), BA.end(), greater<pos>());


    std::set<LONG> days;
    FOR(i, 0, M){
        days.insert(i + 1);
    }

    LONG sum = 0;

    for(pos& d : BA){
        auto it = days.lower_bound(d.second);
        if(it == days.end()){
            continue;
        }

        sum += d.first;
        days.erase(it);
    }

    cout << sum << endl;

}



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

#define LL long long
#define ft first
//#define cp complex<double> 
#define sd second
#define mp(x,y) make_pair(x,y)
//#define int LL
#define db double
using namespace std;
const int N   = (2e5+233)*4;
const int mod = 200003;
const double Pi= acos(-1.0);
const int INF =numeric_limits<int >::max();
#define For(n) for (int i=1;i<=n;++i)
#define rep(i,n) for (int i=1;i<=n;++i)
#define repp(i,x,y) for (int i=x;i<=y;++i)

struct Com
{
    db x,y;
    Com(db x=0.0,db y=0.0) :x(x),y(y){}
    Com operator - (const Com &b) const {return Com(x-b.x,y-b.y);}
    Com operator + (const Com &b) const {return Com(x+b.x,y+b.y);}
    Com operator * (const Com &b) const {return Com(x*b.x-y*b.y,x*b.y+y*b.x);}
};

void read(int &x)
{
	x=0;
	char ch=getchar();
	int f=1;
	while (!isdigit(ch)) (ch=='-'?f=-1:0),ch=getchar();
	while ( isdigit(ch)) x=x*10+ch-'0',ch=getchar();
	x*=f;
}
int omg[N],id[N],A[N],cnt[N],n,rev[N];
Com a[N];
void FFT(Com*a,int n,int f)
{
	repp(i,0,n-1) if (i>rev[i]) swap(a[i],a[rev[i]]);
	for (int i=1;i<n;i<<=1)
	{
		Com wn=(Com){ cos(Pi/i),sin(Pi/i)} ,x,y;
		for (int j=0;j<n;j+=i<<1)
		{
			Com w=(Com){1,0};
			for (int k=0;k<i;++k,w=w*wn)
			  {
			  	x=a[j+k],y=a[i+j+k]*w;
			  	a[j+k]=x+y;
			  	a[i+j+k]=x-y;
			  }	
		}
		
	}
	if (f==1) return ;
	reverse(a+1,a+n);
	repp(i,0,n-1) a[i].x/=n;
}
LL c[N];
/*
3
1 2 3

*/
int cal (int x)
{
	return x>mod-1 ?x-mod+1:x;
}
signed main()
{
	
	for (int i=1,x=2;x!=1;omg[i]=x,++i,x=x*2%mod) ;
	omg[0]=1;id[1]=0;
	For(mod) id[omg[i]]= i;
	read(n);
	For(n) 
	{  
	    read(A[i]);
		if (A[i]==0) continue;
		++cnt[id[A[i]]];
	}
	
	int R=mod<<1,L=1,g=0;
	while (L<=R) L<<=1,++g;
	repp(i,0,L-1) rev[i]=rev[i>>1]>>1 | (i&1)<<g-1;
	repp(i,0,R) a[i]={cnt[i],0};
	FFT(a,L,1);
	repp(i,0,L-1) a[i]=a[i]*a[i];
	FFT(a,L,-1);
	//memset(c,0,sizeof(cnt));
	for (int i=mod-2;i>=0;--i) c[i]+=round(a[i].x);
	for (int i=mod<<1;i>=mod-1;--i) c[i-mod+1]+=round(a[i].x);
	For(n) if (A[i])--c[  id [A[i] ]*2%(mod-1)];
	LL ans=0;
	repp(i,0,mod) ans+=omg[i]*1ll*c[i]>>1;
	printf("%lld",ans);
	return 0;
}



Measured memory_bytes: 23296
#include <stdio.h>

int main(void)
{
    int a, b, c;

    scanf("%d %d", &a, &b);

    c = a * b;

    if(c % 2 == 0) {
      printf("Even\n");
    }
    else {
      printf("Odd\n");
    }

    return 0;
}


Measured memory_bytes: 128
from __future__ import division, print_function
import os
import sys
from __builtin__ import xrange as range
from cStringIO import StringIO
from future_builtins import ascii, filter, hex, map, oct, zip
from io import IOBase
import __pypy__

# region fastio
BUFSIZE = 8192
class FastI(IOBase):
    def __init__(self, file):
        self._fd = file.fileno()
        self._buffer = StringIO()
        self.newlines = 0

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count("\n") + (not b)
            ptr = self._buffer.tell()
            self._buffer.seek(0, 2), self._buffer.write(b), self._buffer.seek(ptr)
        self.newlines -= 1
        return self._buffer.readline()
class FastO(IOBase):
    def __init__(self, file):
        self._fd = file.fileno()
        self._buffer = __pypy__.builders.StringBuilder()
        self.write = lambda s: self._buffer.append(s)
    def flush(self):
        os.write(self._fd, self._buffer.build())
        self._buffer = __pypy__.builders.StringBuilder()
def print(*args, **kwargs):
    sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", "\n"))
    if kwargs.pop("flush", False):
        file.flush()
sys.stdin, sys.stdout = FastI(sys.stdin), FastO(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

Ri = lambda : [int(x) for x in sys.stdin.readline().split()]
ri = lambda : sys.stdin.readline().strip()

# from types import GeneratorType
# def bootstrap(func, stack=[]):
#     def wrapped_function(*args, **kwargs):
#         if stack:
#             return func(*args, **kwargs)
#         else:
#             call = func(*args, **kwargs)
#             while True:
#                 if type(call) is GeneratorType:
#                     stack.append(call)
#                     call = next(call)
#                 else:
#                     stack.pop()
#                     if not stack:
#                         break
#                     call = stack[-1].send(call)
#             return call
#     return wrapped_function

def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
INF = 10 ** 18
MOD = 10**9+7


a = Ri()
for i in range(len(a)):
    if a[i] == 0:
        print(i+1)
        break
























Measured memory_bytes: 85724
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		 Scanner sc = new Scanner(System.in);
		 double r = sc.nextDouble();
		 double pi = 3.141592653589;
		 String area = String.format("%.6f", 1.0*r*r*pi);
		 String circle = String.format("%.6f", r*2*pi);
		 System.out.println(area + " " + circle);
	}

}

Measured memory_bytes: 28228
//#pragma GCC optimize(2)
#include<set>    
#include<map>    
#include<stack>    
#include<ctime>    
#include<cstdio>    
#include<queue>    
#include<cmath>    
#include<vector>    
#include<cstring>   
#include<climits>    
#include<iostream>   
#include<algorithm>
using namespace std;
#define LL long long
#define ULL unsigned long long
LL read(){
    LL f=1,x=0;char c=getchar();
    while(c<'0'||'9'<c){if(c=='-')f=-1;c=getchar();}
    while('0'<=c&&c<='9'){x=x*10+c-'0';c=getchar();}
    return f*x;
}
#define INF (LL)(1e18)
#define MAXN 2000000
LL f[100],g[100][26],s0[MAXN+5][26],s1[MAXN+5][26],sum[26];
char S[MAXN+5];
int nxt[MAXN+5],siz=1;
void Climb(LL m,int s){
	int p=siz;
	while(p>1){
		if(f[p-1]<=m){//&&m<=f[p]
			m-=f[p-1];
			for(int c=0;c<26;c++)
				sum[c]+=s*g[p-1][c];
			p-=2;
		}
		else
			p--;
	}
	if(f==0){
		for(int c=0;c<26;c++)
			sum[c]+=s*s0[m][c];
	}
	else{
		for(int c=0;c<26;c++)
			sum[c]+=s*s1[m][c];
	}
	return ;
}
int main(){
	scanf("%s",S+1);
	int n=strlen(S+1)/2;
	f[0]=n;
	LL L=read(),R=read();
	for(int i=1;i<=n;i++){
		memcpy(s0[i],s0[i-1],sizeof(s0[i-1])),s0[i][S[i]-'a']++;
		memcpy(s1[i],s1[i-1],sizeof(s1[i-1])),s1[i][S[i]-'a']++;
		g[0][S[i]-'a']++,g[1][S[i]-'a']++;
	}
	for(int i=2,j=0;i<=n;i++){
		while(j!=0&&S[i]!=S[j+1])
			j=nxt[j];
		if(S[i]==S[j+1])
			j++;
		nxt[i]=j;
	}
	if(n%(n-nxt[n])==0){
		for(int c=0;c<26;c++)
			sum[c]=(R/n*s0[n][c]+s0[R%n][c])-((L-1)/n*s0[n][c]+s0[(L-1)%n][c]);
		for(int c=0;c<26;c++)
			printf("%lld",sum[c]),putchar(c==25?'\n':' ');
		return 0;
	}
	f[1]=f[0]+n-nxt[n];
	for(int i=1;i<=n-nxt[n];i++){
		memcpy(s1[i+n],s1[i+n-1],sizeof(s1[i+n-1])),s1[i+n][S[i]-'a']++;
		g[1][S[i]-'a']++;
	}
	while(f[siz]<=INF){
		++siz;
		f[siz]=f[siz-1]+f[siz-2];
		for(int c=0;c<26;c++)
			g[siz][c]=g[siz-1][c]+g[siz-2][c];
	}
	Climb(R,1),Climb(L-1,-1);
	for(int c=0;c<26;c++)
		printf("%lld",sum[c]),putchar(c==25?'\n':' ');
	return 0;
}


Measured memory_bytes: 68224
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
vector<int> cntd;
vector<int> sz;
vector<int> cntu;
vector<int> par;
vector<vector<int>> adj;
vector<int> fact;
vector<int> inv;
vector<int> ans;
const int MOD = 1e9 + 7;

void mul(int& a, int b){
  a = 1ll * a * b % MOD;
}

void add(int& a, int b){
  a += b;
  if(a >= MOD)
    a -= MOD;
}

ll pow1(ll n, ll p){
  ll r = 1, c = n;
  while(p){
    if(p & 1)
      (r *= c) %= MOD;
    p /= 2;
    (c *= c) %= MOD;
  }
  return r;
}

void dfs_d(int u, int p = -1){
  sz[u] = 1;
  cntd[u] = 1;
  par[u] = p;
  for(auto el : adj[u]){
    if(el == p)continue;
    dfs_d(el, u);
    sz[u] += sz[el];
    mul(cntd[u], cntd[el]);
    mul(cntd[u], inv[sz[el]]);
  }
  mul(cntd[u], fact[sz[u] - 1]);
}
  int n;

void dfs_u(int u, int p = -1){
  if(p == -1)
    cntu[u] = 1;
  else{
    cntu[u] = cntd[p];
    int szp = n - sz[u];
    mul(cntu[u], inv[sz[p] - 1]);
    mul(cntu[u], fact[n - sz[u] - 1]);
    mul(cntu[u], fact[sz[u]]);
    mul(cntu[u], pow1(cntd[u], MOD - 2));
    int szpp = n - sz[p];
    mul(cntu[u], cntu[p]);
    mul(cntu[u], inv[szpp]);
  }
  for(auto el : adj[u]){
    if(el == p)continue;
    dfs_u(el, u);
  }
}


int main()
{
//  freopen("in.txt", "r", stdin);
//  freopen("out.txt", "w", stdout);
  cin >> n;
  cntd.resize(n);
  sz.resize(n);
  cntu.resize(n);
  par.resize(n);
  adj.resize(n);
  fact.resize(n + 1);
  inv.resize(n + 1);
  ans.resize(n);
  fact[0] = inv[0] = 1;
  for(int i = 1;i <= n;i++){
    fact[i] = 1ll * fact[i - 1] * i % MOD;
    inv[i] = pow1(fact[i], MOD - 2);
  }
//  assert(1ll * fact[3] * inv[3] % MOD == 1);

  for(int i = 0;i < n - 1;i++){
    int u, v;
    scanf("%d %d", &u, &v);
    u--, v--;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  dfs_d(0);
  dfs_u(0);
//  for(int i = 0;i < n;i++)
//    cout << cntu[i] << endl;
  for(int i = 0;i < n;i++){
    int szp = n - sz[i];
    int res = cntu[i];
    mul(res, inv[szp]);
    for(auto el : adj[i]){
      if(el == par[i])continue;
      mul(res, cntd[el]);
      mul(res, inv[sz[el]]);
    }
    mul(res, fact[n - 1]);
    printf("%d\n", res);
  }
  return 0;
}


Measured memory_bytes: 19444
import sys
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return input()

def main():
    N = II()
    ans = 0
    for x in range(1, N + 1):
        m = N // x - 1
        if m <= x:
            break
        if N % x == 0:
            ans += m
    return ans

print(main())

Measured memory_bytes: 3064
def minus_one(list_):
    return [i-1 if i > 0 else 0 for i in list_]


N = int(input())
h_list = list(map(int,input().split()))
h_list.append(0)
end_flg = False
time = 0

while end_flg == False:
    for i in range(0,len(h_list)-1):
        if not h_list[i] == 0 and h_list[i+1] == 0:
            time += 1
    if all([i==0 for i in h_list]):
        end_flg = True
    h_list = minus_one(h_list)

print(time)

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

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

using namespace std;


int main(){
    string s;
    cin >> s;
    cout << s.substr(0, 4) << " " << s.substr(4) << endl;


    return 0;
}

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

void insert(priority_queue<int> &q, int k)
{
    q.push(k);
    return;
}

int extractMax(priority_queue<int> &q)
{
    if (q.empty())
    {
        return -1;
    }
    int max = q.top();
    q.pop();
    return max;
}

int main()
{
    string cmd;
    priority_queue<int> Q;

    while (cin >> cmd && cmd != "end")
    {
        if (cmd == "insert")
        {
            int k;
            cin >> k;
            insert(Q, k);
        }
        else if (cmd == "extract")
        {
            int result = extractMax(Q);
            printf("%d\n", result);
        }
    }
}


Measured memory_bytes: 7068
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stdio.h>
#include <cstring>
#include <queue>
#include <stack>
#include <functional>
#include <math.h>
#include <iomanip>
using namespace std;
#define Would
#define you
const int INF = 999999999;
const int MOD = 1e9 + 7;

int main() {
	int a, b, c, d, e, ans = 0, re;
	cin >> a >> b >> c >> d >> e;
	re = d;
	int mon = min(d, e)*min(a + b, c * 2);
	d -= min(re, e); e -= min(re, e);
	mon += d * min(a, 2 * c) + e * min(b, c * 2);
	cout << mon << endl;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(void){
  int N,i;
  long int sum;
  scanf("%d", &N);
  sum = 0;
  for(i=0;i<=N;i++){
    if(i%3!=0 && i%5!=0)
      sum += i;
  }
  printf("%ld", sum);
  return 0;
}


Measured memory_bytes: 1728
import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		TreeSet<Unit> set = new TreeSet<>();
		for (int i = 0; i < n; i++) {
		    set.add(new Unit(i, sc.nextInt()));
		}
		long[] ans = new long[n];
		while (set.size() > 1) {
		    Unit current = set.pollFirst();
		    Unit next = set.first();
		    if (current.value == next.value) {
		        set.pollFirst();
		        current.up(next.times);
		        set.add(current);
		    } else {
		        ans[current.idx] += current.remove(next.value);
		        set.add(current);
		    }
		}
		Unit last = set.pollFirst();
		ans[last.idx] += last.remove(0);
		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < n; i++) {
		    sb.append(ans[i]).append("\n");
		}
	    System.out.print(sb);
    }
    
    static class Unit implements Comparable<Unit> {
        int idx;
        int value;
        long times;
        
        public Unit(int idx, int value) {
            this.idx = idx;
            this.value = value;
            this.times = 1;
        }
        
        public void up(long x) {
            times += x;
        }
        
        public int compareTo(Unit another) {
            if (value == another.value) {
                return idx - another.idx;
            } else {
                return another.value - value;
            }
        }
        
        public int hashCode() {
            return idx;
        }
        
        public boolean equals(Object o) {
            return compareTo((Unit) o) == 0;
        }
        
        public long remove(int x) {
            long ans = (value - x) * times;
            value = x;
            return ans;
        }
        
        public String toString() {
            return idx + ":" + value;
        }
    }
}



Measured memory_bytes: 71036
using System;
using System.Collections.Generic;

class program
{
    static void Main()
    {
        int n;
        n = int.Parse(Console.ReadLine());
        call(n);
    }

    static void call (int n)
    {
        int i = 1;

        while (i <= n)
        {
            int x = i;

            if ((x%3 == 0) || (x%10 == 3))
            {
                Console.Write(" {0}", i);
                i++;
            }
            else
            {
                while(x != 0)
                {
                  
                    x /= 10;
                    if (x%10 == 3)
                    {
                        Console.Write(" {0}", i);
                        break;
                    }
                    
                }
                i++;
            }
        }

        Console.WriteLine();

    }
}

Measured memory_bytes: 9136
from sys import stdin, setrecursionlimit


def main():
    input = stdin.buffer.readline
    n, m, q = map(int, input().split())
    abcd = [list(map(int, input().split())) for _ in range(q)]

    arr = []

    def dfs(num, ai):
        if len(ai) == n:
            arr.append(ai)
        elif len(ai) < n:
            for i in range(num, m + 1):
                dfs(i, ai + [i])

    ans = 0

    dfs(1, [])

    for ai in arr:
        score = 0
        for a, b, c, d in abcd:
            if ai[b - 1] - ai[a - 1] == c:
                score += d
        if ans < score:
            ans = score

    print(ans)


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()


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

#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=ll(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=ll(b);i--)
#define FORA(i,I) for(const auto& i:I)
#define ALL(x) x.begin(),x.end() 
#define SIZE(x) ll(x.size()) 

#define MOD 1000000007

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

    if (N%1000 == 0) {
        cout << 0 << endl;
    }
    else {
        cout << 1000-N%1000 << endl;
    }

    return 0;
}


Measured memory_bytes: 3584
#include<bits/stdc++.h>
#define ll long long
#define pi 3.14159265358979323846
#define pb push_back
#define po pop_back()
#define mp make_pair
#define fi first
#define se second
#define hello ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define MOD 1000000007 
using namespace std;
/*bool isPowerofTwo(ll n){
	return n&(n-1)==0;
}*/
void solution(){
	ll n;
	cin>>n;
	string ans="";
  
    while (n > 0) { 
        ll rem = n % 26; 
          if (rem == 0) { 
            ans+='z';
            n = (n / 26) - 1; 
        } 
        else
        { 
            ans+= (rem - 1) + 'a'; 
            n = n / 26; 
        } 
    }  
  
    reverse(ans.begin(),ans.end()); 
    cout << ans << endl; 
}
int main()
{
	hello;
	/*int t;
	cin>>t;
	while(t--){
		solution();
		cout<<"\n";
	}*/
	solution();
	return 0;
}


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

using namespace std;

void Fastio(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}

int main()
{
    Fastio();
    int n,k; cin>>n>>k;
    long long arr[n];
    for(int i=0; i<n; i++){cin>>arr[i];}
    sort(arr,arr+n);
    long long res=0;
    for(int i=0; i<n-k; i++){res+=arr[i];}
    cout<<res<<'\n';

    return 0;
}


Measured memory_bytes: 1792
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define MOD 1000000007
#define INF (1<<30)
#define LINF (lint)(1LL<<56)
#define endl "\n"
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define Flag(x) (1<<(x))
#define Flagcount(x) __builtin_popcount(x)
#define pint pair<int,int>
#define pdouble pair<double,double>
#define plint pair<lint,lint>
typedef unsigned long long int ull;
typedef long long lint;

int main(void){
    lint K,X;
    cin >> K >> X;
    if(K*500>=X) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
//QWsin
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#define rep(i,x,y) for(int i=x;i<=y;++i)
#define out(i,u) for(int i=first[u];i!=-1;i=nxt[i])
#define repvc(i,vc) for(int i=0,Sz=vc.size();i<Sz;++i)
using namespace std;
inline int read()
{
	char ch=getchar();int ret=0,f=1;
	while(ch<'0' || ch>'9') {if(ch=='-')f=-1;ch=getchar();}
	for(;ch>='0' && ch<='9';ch=getchar()) ret=ret*10+ch-'0';
	return ret*f;
}

typedef long long ll;
const int INF=1<<30;

int main()
{
//	freopen("std.in","r",stdin);
	string t;cin>>t;
	rep(i,1,t.length())
		putchar('x');
	return 0;
}


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

int main(){
    int n, m, a, ans = 0;
    cin >> n >> m;
    for(int i = 0; i < m; i++){
        cin >> a;
        ans += a;
    }

    cout << (ans > n ? -1 : n - ans) << endl;
    return 0;
}

Measured memory_bytes: 3672
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace atcoder_procon_A
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] t_input = Console.ReadLine().Split().Select(i => int.Parse(i)).ToArray();

            int N = t_input[0];
            int K = t_input[1];

            string result = "YES";

            int total = N / 2;
            if (N % 2 != 0) total = total + 1;
            if (total < K) result = "NO";

            Console.WriteLine(result);
        }
    }
}


Measured memory_bytes: 13396
using System;

class B
{
	static void Main()
	{
		var h = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);

		var c = 0;
		var rM = h[3] / h[0];
		for (int r = 0; r <= rM; r++)
		{
			var n2 = h[3] - r * h[0];
			var gM = n2 / h[1];
			for (int g = 0; g <= gM; g++)
			{
				var n3 = n2 - g * h[1];
				if (n3 % h[2] == 0) c++;
			}
		}
		Console.WriteLine(c);
	}
}


Measured memory_bytes: 11220
#include<iostream>
#include<algorithm>
#include<queue>
using namespace std;
static const int MAX = 10000;
static const int INFTY = (1<<20);
static const int WHITE = 0;
static const int GRAY = 1;
static const int BLACK = 2;

int n;
vector<pair<int, int> > adj[MAX];  // 重み付き有向グラフの隣接リスト表現

void dijkstra() {
  priority_queue<pair<int, int> > PQ;
  int color[MAX];
  int d[MAX];
  for ( int i = 0; i < n; i++ ) {
    d[i] = INFTY;
    color[i] = WHITE;
  }

  d[0] = 0;
  PQ.push(make_pair(0, 0));
  color[0] = GRAY;

  while ( !PQ.empty() ) {
    pair<int, int> f = PQ.top(); PQ.pop();
    int u = f.second;

    color[u] = BLACK;

    // 最小値を取り出し、それが最短でなければ無視
    if ( d[u] < f.first * (-1) ) continue;

    for ( int j = 0; j < adj[u].size(); j++ ) {
      int v = adj[u][j].first;
      if ( color[v] == BLACK ) continue;
      if ( d[v] > d[u] + adj[u][j].second ) {
        d[v] = d[u] + adj[u][j].second;
        // priority_queue はデフォルトで大きい値を優先するため -1 を掛ける
        PQ.push(make_pair(d[v] * (-1), v));
        color[v] = GRAY;
      }
    }
  }

  for ( int i = 0; i < n; i++ )
    cout << i << " " << ( d[i] == INFTY ? -1 : d[i] ) << endl;
}

int main() {
  int k, u, v, c;

  cin >> n;
  for ( int i = 0; i < n; i++ ) {
    cin >> u >> k;
    for ( int j = 0; j < k; j++ ) {
      cin >> v >> c;
      adj[u].push_back(make_pair(v, c));
    }
  }

  dijkstra();

  return 0;
}


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

int main(){
  int N;cin >> N;
  int k=-1;
  for(int i=0;i*(i-1)<=2*N;i++){
    if(i*(i-1)==2*N){
      k=i;
    }
  }
  if(k<0){
    cout << "No" << endl;
    return 0;
  }
  cout << "Yes" << endl;
  vector<int> S(k-1);
  cout << k << endl << k-1;
  for(int i=0;i<k-1;i++){
    S[i] = i+1;
    cout << " " << S[i];
  }
  cout << endl;
  for(int i=0;i<k-1;i++){
    cout << k-1;
    for(int j=0;j<k-1;j++){
      if(j<i){
        S[j] ++;
      }else if(i<j){
        S[j] += k-2-i;
      }
      cout << " " << S[j];
    }
    cout << endl;
  }
}

Measured memory_bytes: 3548
#include <bits/stdc++.h>
#define ll unsigned long long int
#define pb push_back
using namespace std;
ll cnt,mini=1e9,maxi=-1;
ll n,m,k,x,a,b,c;
ll mini1=1e9,maxi1=-1,cnt1,cnt2,cnt3,ans,sum;
int main(){
ios_base::sync_with_stdio(0);
	// freopen (" .txt", "r", stdin);
	// freopen (" .txt", "w", stdout);
	cin>>n;
	if(n!=1 && n%2==1){
		cout<<n/2+1;
	return 0;
	}
	if(n==1){
		cout<<1;
	return 0;
	}
	cout<<n/2;
}
//     *    *  *  ****    *    *   *
//    *	*   * *   *      * *   *   *
//   *****  **    ****  *****  *****
//   *   *  * *      *  *   *      *
//   *   *  *  *  ****  *   *  *****
 
//   ****  ****  *       *
//   *      **   *      * *
//   ****   **   *     *****
//      *   **   *     *   *
//   ****  ****  ****  *   *


Measured memory_bytes: 256
import numpy as np
N, M = map(int, input().split())

A = np.array([[1 if i == "#" else 0 for i in input()] for _ in range(N)])
B = np.array([[1 if i == "#" else 0 for i in input()] for _ in range(M)])

if N == M:
    if np.all(A == B):
        print("Yes")
    else:
        print("No")
else:
    for i in range(N - M): # 横移動
        for j in range(N - M): # 縦移動
            if np.all(A[i: M + i, j: M + j]== B):
                print("Yes")
                exit()
    print("No")

Measured memory_bytes: 12424
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <algorithm>
#include <array>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

#define rep(i, n) for (int i = 0; i < (n); i++)
#define loop(i, a, n) for (int i = a; i < (n); i++)
#define all(in) in.begin(), in.end()
const int INF = 1e9;
const int MOD = 1e9 + 7;
int main() {
    int A, B, C, X;
    cin >> A >> B >> C >> X;
    int ans = 0;
    for (int i = 0; i <= A; i++) {
        for (int k = 0; k <= B; k++) {
            for (int j = 0; j <= C; j++) {
                int sum = 500 * i + 100 * k + 50 * j;
                if (sum == X) ans++;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef double db;
typedef long long ll;
typedef string str;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef set<int> si;
typedef pair<int,int> pii;
#define rep(i,a,b) for(int i=(a); i<(b); ++i)
#define per(i,a,b) for(int i=(b)-1; i>=(a); --i)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define S second
const int INF = 987654321;
const int MOD = (int)1e9+7;
const long double PI = (acos(-1));
const long double EPS = 0.0000000001;
int dy[4] = {-1, 0, 1, 1};
int dx[4] = {0, 1, 0, 1};

vi L;

int mysearch(int left, int right, int val) {
	if(left == right) {
		if(L[left] < val) {
			return left+1;
		} else {
			return left;
		}
	}

	int mid = (left+right)/2;
	if(L[mid]>=val) {
		return mysearch(left, mid, val);
	} else {
		return mysearch(mid+1, right, val);
	}
}

int main(void) {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	//freopen("in.txt", "r", stdin);
	int n;
	cin >> n;
	L.resize(n);
	rep(i,0,n) {
		cin >> L[i];
	}
	sort(all(L));

	int ret = 0;
	rep(i,0,n) rep(j,i+1,n) {
		int sum = L[i] + L[j];
		int pos = mysearch(0,n-1,sum);
		ret += max(pos-j-1,0);
	}
	cout << ret << endl;
	return 0;
}

Measured memory_bytes: 256
/**
 *    author:  otera    
**/
#include<iostream>
#include<string> 
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm> 
#include<functional>
#include<iomanip>
#include<queue>
#include<deque>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

//#define int long long
typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const int inf=1e9+7;
const ll INF=1LL<<60 ;
const ll mod=1e9+7 ;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define debug(x)  cerr << #x << " = " << (x) << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int n;
vector<vector<char>> a;

void solve() {
	cin >> n;
    a.assign(n, vector<char>(n));
    bool white = 1;
    rep(i, n) {
        rep(j, n) {
            cin >> a[i][j];
            if(a[i][j] == '#') white = 0;
        }
    }
    if(white) {
        cout << -1 << endl;
        return;
    }
    int ans = inf;
    rep(i, n) {
        int res = 0;
        bool ok = 1;
        rep(j, n) {
            if(a[i][j] == '.') {
                res += 2;
                rep(k, n) {
                    if(a[k][i] == '#') {
                        // res += 2;
                        break;
                    }
                    if(k == n - 1) ok = 0;
                }
            } else {
                bool ok1 = 0;
                rep(k, n) {
                    if(a[k][j] == '.') ok1 = 1;
                }
                if(ok1) ++ res;
            }
        }
        //cerr << i << " " << res << endl;
        if(ok) {
            chmin(ans, res);
        } else {
            chmin(ans, res + 1);
        }
    }
    cout << ans << endl;
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//int t; cin >> t; rep(i, t)solve();
	solve();
    return 0;
}

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

int main(){
  string s;
  vector<int> vec(125,0);
  cin >> s;
  rep(i,s.size())vec.at(s.at(i))++;
  sort(vec.begin(),vec.end());
  if(vec.at(vec.size()-1)>1) cout << "no" <<endl;
  else cout << "yes" << endl;

	return 0;
}


Measured memory_bytes: 256
use std::io;

fn main() {
    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    let mut iter = buf.split_whitespace();

    let d: i64 = iter.next().unwrap().parse().unwrap();
    let n: i64 = iter.next().unwrap().parse().unwrap();

    let base_num: i64 = 100i64.pow(d as u32);

    if n == 100 {
        println!("{}", base_num * n + base_num);
    } else {
        println!("{}", base_num * n);
    }
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    int n;
    string w[105];
    scanf("%d", &n);
    for (int i = 1; i <= n; ++i)
        cin >> w[i];
    for (int i = 2; i <= n; ++i)
        if (w[i].front() != w[i - 1].back())
        {
            puts("No");
            return 0;
        }
    sort(w + 1, w + n + 1);
    for (int i = 1; i < n; ++i)
        if (w[i] == w[i + 1])
        {
            puts("No");
            return 0;
        }
    puts("Yes");
}

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

using ll = long long;
using namespace std;

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

    string s, t;
    cin >> s;
    cin >> t;

    for(int i=s.size(); i>=0; i--){
        if(s[i] == t[0] or s[i] == '?'){
            bool match = true;
            for(int m=0; m<t.size(); m++){
                if(!(s[i+m] == t[m] or s[i+m] == '?')){
                    match = false;
                    break;
                }
            }

            if(match){
                for(int m=0; m<t.size(); m++){
                    s[i+m] = t[m];
                }
                for(int m=0; m<s.size(); m++){
                    if(s[m] == '?') s[m] = 'a';
                }
                cout << s << "\n";
                return 0;
            }
        }
    }

    cout << "UNRESTORABLE" << "\n";
    return 0;
}


Measured memory_bytes: 256
def f(A,B):
    m=0
    for i in range(len(A)):
        if m<A[i]+B[i]:
            m=A[i]+B[i]
    return m

N=int(input())
A=list(map(int,input().split()))
J=20

B=[[0 for _ in range(J)] for __ in range(N)]
for i in range(N):
    m=A[i]
    for j in range(J):
        B[i][j]=m%2
        m>>=1
B+=[[float("inf")]*J]

b=0
X=[0]*J
K=0

for a in range(N):
    while f(X,B[b])<=1:
        for k in range(J):
            X[k]+=B[b][k]
        b+=1

    K+=b-a

    for k in range(J):
        X[k]-=B[a][k]

print(K)

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

int main(){
  int N; cin >> N;
  string S; cin >> S;
  vector<long long> RGB(3, 0);
  rep(i, N) {
    if (S[i] == 'R') RGB[0]++;
    if (S[i] == 'G') RGB[1]++;
    if (S[i] == 'B') RGB[2]++;
  }

  long long all = RGB[0] * RGB[1] * RGB[2];

  long long out = 0;
  rep(k, 2000) {
    for (int i = 0; i + k + k < N; i++) {
      if (S[i] != S[i + k] and S[i + k] != S[i + k + k] and S[i + k + k] != S[i])
        out++;
    }
  }
  cout << all - out << endl;
}


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

using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i,n) for(int i=n; i>-1; --i)
#define ALL(a) (a).begin(),(a).end()
#define FILL(a,n,x); REP(i,(n)){ (a)[i]=(x); }
#define CINA(a,n); REP(i,(n)){ cin >> (a)[i]; }
#define FILL2(a,n,m,x); REP(i,(n)){ REP(j,(m)){(a)[i][j]=(x);} }
#define CINA2(a,n,m); REP(i,(n)){ REP(j,(m)){cin >> (a)[i][j];} }
#define Liny "Yes\n"
#define Linn "No\n"
#define LINY "YES\n"
#define LINN "NO\n"

//cout << setfill('0') << right << setw(4) << 12; // "0012"
int keta(ll x){ if(x<10){return 1;} else{return keta(x/10) + 1;}}
int keta_wa(ll x){ if(x<10){return x;} else{return keta_wa(x/10) + x%10;} }
int ctoi(char c){ return ( (c>='0' && c<='9')? c - '0': 0 );}
int __stoi(string s){ return atoi(s.c_str()); }
ll sum(ll a[],ll N){ return accumulate(a,a+N,0LL);}
ll gcd(ll a,ll b){if(a<b)swap(a,b); return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){if(a<b){swap(a,b);} return a/gcd(a,b)*b;}
template<class T> void chmax(T& a, T b){ if(a<b){a=b;} }
template<class T> void chmin(T& a, T b){ if(a>b){a=b;} }
template<class T> bool isIn(T a,vector<T> v){ for(T x:v){ if(a==x){return true;}} return false;}
string strReplace(string s,string target, string replacement){
  if (!target.empty()) {
      std::string::size_type pos = 0;
      while ((pos = s.find(target, pos)) != std::string::npos) {
        s.replace(pos, target.length(), replacement);
        pos += replacement.length();
      }
    }
    return s;
}
const ll MOD = 1e9+7;
#define pii pair<int,int>
#define pll pair<ll,ll>
#define MP make_pair

bool DEBUG = 0;

int main(){
  int H,W,K; cin>>H>>W>>K;
  string board[H]; CINA(board,H);
  ll ans = 0;
  REP(bits,pow(2,H)){
    ll temp = bits;
    string board_temp[H]; REP(i,H){ board_temp[i] = board[i];}
    REP(i,H){
      if(temp%2==0){
        REP(j,W){
          board_temp[i][j] = 'r';
        }
      }
      temp /= 2;
    }
    REP(cits,pow(2,W)){
      ll semp = cits;
      string board_semp[H]; REP(i,H){ board_semp[i] = board_temp[i];}
      REP(j,W){
        if(semp%2==0){
          REP(i,H){
            board_semp[i][j] = 'r';
          }
        }
        semp /= 2;
      }
      int count = 0;
      REP(i,H){
        REP(j,W){
          if(board_semp[i][j]=='#'){ ++count;}
        }
      }
      if(count==K){++ans;}
    }
  }
  cout << ans << "\n";
}

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

int main(int argc, char const *argv[])
{
	string n;
	cin>>n;
	if (n.size()==1)
	{
		cout<<n<<endl;
		return 0;
	}
	int ans=n[0]-'1';
	ans+=9*(n.size()-1);
	int f=1;
	for (int i = 1; i < n.size(); ++i)
	{
		if (n[i]!='9')
		{
			f=0;
		}
	}
	ans+=f;
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256