akhauriyash/Code-Regression huggingface dataset:
#include <stdlib.h>
#include <iostream>
#include <algorithm>
#include <queue>
#define LL long long
using namespace std;
struct node
{
    LL l,r;
}a[100001];
bool cmp(node a,node b)
{
    if(a.r==b.r)
        return a.l<b.l;
    return a.r<b.r;
}
int main()
{
    LL N,M,i;
    scanf("%lld%lld",&N,&M);
    for(i=0;i<M;i++)
        scanf("%lld%lld",&a[i].l,&a[i].r);
    sort(a,a+M,cmp);
    int now=a[0].r,ans=1;
    for(i=1;i<M;i++)
    {
        if(a[i].l>=now)
        {
            now=a[i].r;
            ans++;
        }
    }
    printf("%d\n",ans);
    return 0;
}

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

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

  int sum = 0;
  for (int i = 0; i < N-1; i++) {
    for (int j = i + 1; j < N; j++) {
      sum += d[i]*d[j];
    }
  }
  cout << sum << endl;
}

Measured memory_bytes: 256
<?php
$cou = intval(fgets(STDIN));
$input = explode(' ', fgets(STDIN));

for ($i=0; $i < $cou; $i++) { 
	$nums[$i] = intval($input[$i]);
}

$min = min($nums);
$max = max($nums);
$sum = array_sum($nums);

echo "$min $max $sum\n";

Measured memory_bytes: 9816
#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=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define SORTR(x) sort(ALLR(x))
#define SORT(x) sort(ALL(x))
#define SUM(x) accumulate(ALL(A), 0)
#define EACH(i,x) for(typeof((x).begin()) i=(x).begin(); i!=(x).end(); ++i)
typedef vector<ll> VI;
typedef vector<VI> VVI;
typedef vector<char> VC;
typedef vector<VC> VVC;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template <class BidirectionalIterator>
bool next_partial_permutation(BidirectionalIterator first, BidirectionalIterator middle,BidirectionalIterator last){reverse(middle, last); return next_permutation(first , last);}


void Main()
{
	ll a,b;
	string S;
	cin>>a>>b;

	if((a>0&&b>0)||((a<0&&b<0)&&((b-a)%2!=0))) S="Positive";

	else if((a<0&&b<0)&&((b-a)%2==0))S="Negative";

	else S="Zero";

	cout << S << "\n";
	return;
}

int main()
{
	std::cin.tie(0);
	std::ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
	Main();
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
template <class T>
inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}

typedef long long ll;

int main() {
  ll N, K;
  cin >> N >> K;
  string S;
  cin >> S;

  vector<int> numbers;

  ll now = 1;
  ll count = 0;
  for (ll i = 0; i < N; i++) {
    if (S[i] == (char)('0' + now)) {
      count++;
    } else {
      numbers.push_back(count);
      now = 1 - now;
      count = 1;
    }
  }
  if (count != 0) {
    numbers.push_back(count);
  }

  // 1-0-1-0-1
  if (numbers.size() % 2 == 0) {
    numbers.push_back(0);
  }

  vector<ll> sum(numbers.size() + 1);
  for (ll i = 0; i < sum.size(); i++) {
    sum[i+1] = sum[i] + numbers[i];
  }

  ll ans = 0;
  ll add = 2 * K + 1;
  for (ll i = 0; i < numbers.size(); i += 2) {
    ll left = i;
    ll right = min(i + add, (ll)numbers.size());
    ll tmp = sum[right] - sum[left];

    ans = max(ans, tmp);
  }

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

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

int main() {
    string s;
    cin >> s;
    int ans = 0;
    int n = s.size();
    for (int i = 0, cur=0; i < n; ++i) {
        if(s[i] == 'R') {
            cur++;
            ans = max(ans, cur);
        } else {
            cur = 0;
        }
    }
    cout << ans << endl;
}



Measured memory_bytes: 3552
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <cmath>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <iostream>
#include <random>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include <fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <bitset>
using namespace std;

using ll = long long;
using vll = vector<long long>;
using pll = pair<long long, long long>;
#define rep(i,n) for(long long i(0);(i)<(n);(i)++)

const string YES = "Yes";
const string NO = "No";

void solve(long long N){
    ll S = 0, Nnew = N;
    while(N > 0){
        S += N %10;
        N /= 10;
    }
    if(Nnew % S == 0) 
        cout << YES << endl;
    else 
        cout << NO << endl;

}

int main(){
    long long N;
    scanf("%lld",&N);
    solve(N);
    return 0;
}


Measured memory_bytes: 256
#if 1
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <array>
#include <deque>
#include <algorithm>
#include <utility>
#include <cstdint>
#include <functional>
#include <iomanip>
#include <numeric>
#include <assert.h>
#include <bitset>
#include <list>

auto& in = std::cin;
auto& out = std::cout;
#define all(C) std::begin(C), std::end(C)

int32_t H,W;


template<typename T, typename U>
std::enable_if_t<std::rank<T>::value == 0> fill_all(T& arr, const U& v) {
	arr = v;
}
template<typename ARR, typename U>
std::enable_if_t<std::rank<ARR>::value != 0> fill_all(ARR& arr, const U& v) {
	for (auto& i : arr) {
		fill_all(i, v);
	}
}

char map[60][60];
int32_t D[55][55];

int main()
{
	using std::endl;
	in.sync_with_stdio(false);
	out.sync_with_stdio(false);
	in.tie(nullptr);
	out.tie(nullptr);

	in >> H>>W;
	for (size_t i = 0; i <= W+1; i++) {
		map[0][i] = '#';
		map[H+1][i] = '#';
	}
	int W_COUNT = 0;
	for (size_t i = 1; i <= H; i++)
	{
		map[i][0] = '#';
		in >> (map[i] + 1);
		W_COUNT += std::count_if(map[i] + 1, map[i] + 1 + W, [](char c) {return c == '.'; });
		map[i][W+1] = '#';
	}

	fill_all(D, 505050);
	std::queue<std::pair<int, int>> queue;
	queue.emplace(1, 1);
	D[1][1] = 1;
	while (!queue.empty())
	{
		auto top = queue.front(); queue.pop();

		int cost = D[top.first][top.second] + 1;
		const int diff[] = { 0,1,0,-1,0 };
		for (size_t i = 0; i < 4; i++)
		{
			std::pair<int, int> next = top;
			next.first += diff[i];
			next.second += diff[i+1];
			if (cost < D[next.first][next.second] && map[next.first][next.second]=='.') {

				queue.emplace(next);
				D[next.first][next.second] = cost;
			}
		}

	}

	if (D[H][W]== 505050) {
		out << -1 << endl;
	}
	else {
		out << W_COUNT- D[H][W] << endl;
	}

	return 0;
}
#endif


Measured memory_bytes: 256
q,h,s,d = gets.chomp.split(" ").map(&:to_i)
n = gets.to_i
ans = 0

min_1 = [q*4,h*2,s].min

ans += (n/2) * [q*8,h*4,s*2,d].min
ans += (n%2) * min_1

puts ans

Measured memory_bytes: 1788
#include <stdio.h>

int main() {
  int height, width, i, j, flag;
  scanf("%d %d", &height, &width);
  char str[height+1][width+1];
  int board[height][width];
  for(i = 0; i < height; i++) {
    scanf("%s", str[i]);
    for(j = 0; j < width; j++) board[i][j] = 0;
  }

  /*行の精査*/
  for(i = 0; i < height; i++) {
    flag = 0;
    for(j = 0; j < width; j++) {
      if(str[i][j] == '#') {
        flag++;
        break;
      }
    }
    if(flag == 1) {
      for(j = 0; j < width; j++) {
        board[i][j]++;
      }
    }
  }

  /*列の精査*/
  for(i = 0; i < width; i++) {
    flag = 0;
    for(j = 0; j < height; j++) {
      if(str[j][i] == '#') {
        flag++;
        break;
      }
    }
    if(flag == 1) {
      for(j = 0; j < height; j++) {
        board[j][i]++;
      }
    }
  }
  for(i = 0; i < height; i++) {
    flag = 0;
    for(j = 0; j < width; j++) {
      if(board[i][j] == 2) {
        printf("%c", str[i][j]);
        flag++;
      }
    }
    if(flag == 0) continue;
    printf("\n");
  }
  return 0;
}


Measured memory_bytes: 256
def main():
    # 嘘解法
    # 2 3 4
    # 2 2
    # ULRR
    # LUUU
    # はNo(Yesと出る)
    H, W, N = (int(i) for i in input().split())
    sr, sc = (int(i) for i in input().split())
    S = input()
    T = input()
    from collections import Counter
    S_C = Counter(S)
    if sc <= S_C['L']:
        move = 0
        for s, t in zip(S, T):
            if s == "L":
                move += 1
            if sc <= move:
                return print("NO")
            if t == "R":
                move -= 1
                if -move == W - sc + 1:
                    move += 1
    if W - sc + 1 <= S_C['R']:
        move = 0
        for s, t in zip(S, T):
            if s == "R":
                move += 1
            if W - sc + 1 <= move:
                return print("NO")
            if t == "L":
                move -= 1
                if -move == sc:
                    move += 1
    if sr <= S_C['U']:
        move = 0
        for s, t in zip(S, T):
            if s == "U":
                move += 1
            if sr <= move:
                return print("NO")
            if t == "D":
                move -= 1
                if -move == H - sr + 1:
                    move += 1
    if H - sr + 1 <= S_C['D']:
        move = 0
        for s, t in zip(S, T):
            if s == "D":
                move += 1
            if H - sr + 1 <= move:
                return print("NO")
            if t == "U":
                move -= 1
                if -move == sr:
                    move += 1
    print("YES")


if __name__ == '__main__':
    main()


Measured memory_bytes: 44748
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<stdio.h>
#include<cstring>
#include<functional>
#include<bits/stdc++.h>
#include<map>
#include<utility>

#define vec2c vector<vector<char>>
#define vec2i vector<vector<int>>
#define vecc vector<char>
#define vecs vector<string>
#define veci vector<int>
#define vecd vector<double>
#define vecl vector<long>
#define vecll vector<long long>
#define rep(i, n) for(int i=0; i < (int)(n); i++)
#define rrep(i, n) for(int i=(int)(n); i>=0;i--)
#define rep1e(i, n) for(int i=1; i <= (int)(n); i++)
#define rep1ne(i, n) for(int i=1; i < (int)(n); i++)

#define MAX 100010

using namespace std;

unsigned digit(unsigned num){
    unsigned digit=0;
    while(num!=0){
        num /= 10;
        digit++;
    }
    return digit;
}

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

int main() {

	int N;
	cin >> N;
	int B[N];
	rep(i, N-1) {
		cin >> B[i];
	}

	int ans = 0;

	rep(i, N) {
		if (i == 0) ans += B[i];
		else if (i == N - 1) ans += B[i-1];
		else {
			ans += min(B[i-1], B[i]);
		}
	}
	cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
	Scanner sc = new Scanner(System.in);
	
	void doIt() {
		sA();
	}
	
	void sA() {
		System.out.println((double)sc.nextInt() / sc.nextInt());
		
	}
	
	
	public static void main(String[] args) {
		new Main().doIt();
	}
}


Measured memory_bytes: 23252
// ====================================
//   author: M_sea
//   website: https://m-sea-blog.com/
// ====================================
#include <bits/stdc++.h>
#define file(x) freopen(#x".in","r",stdin); freopen(#x".out","w",stdout)
#define debug(...) fprintf(stderr,__VA_ARGS__)
using namespace std;
typedef long long ll;

int read() {
	int X=0,w=1; char c=getchar();
	while (c<'0'||c>'9') { if (c=='-') w=-1; c=getchar(); }
	while (c>='0'&&c<='9') X=X*10+c-'0',c=getchar();
	return X*w;
}

const int N=200000;
const int mod=1e9+7;
int qpow(int a,int b) { int c=1;
	for (;b;b>>=1,a=1ll*a*a%mod) if (b&1) c=1ll*c*a%mod;
	return c;
}

int n,k,fac[N],cnt=0,dp[N];

int main() {
	n=read(),k=read();
	for (int i=1;i*i<=n;++i) {
		if (n%i) continue;
		fac[++cnt]=i;
		if (i*i!=n) fac[++cnt]=n/i;
	}
	sort(fac+1,fac+cnt+1);
	for (int i=1;i<=cnt;++i) {
		dp[i]=qpow(k,(fac[i]+1)/2);
		for (int j=1;j<i;++j)
			if (fac[i]%fac[j]==0) dp[i]=(dp[i]-dp[j]+mod)%mod;
	}
	int ans=0;
	for (int i=1;i<=cnt;++i) {
		if (fac[i]&1) ans=(ans+1ll*dp[i]*fac[i])%mod;
		else ans=(ans+1ll*dp[i]*fac[i]/2)%mod;
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 3716
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int ll
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
inline int in() { int x; cin >> x; return x; }

vector<pair<int,int>> g[200005];
int ans[200005];

void dfs(int current, int parent=-1, int parent_color=0) {
  int color = 1;
  FOR(i,0,g[current].size()) {
    if (g[current][i].first==parent) continue;
    if (color==parent_color) color++;
    ans[g[current][i].second] = color;
    dfs(g[current][i].first, current, color);
    color++;
  }
}

void solve() {
  int n = in(), num;
  FOR(i,0,n-1) {
    int a = in()-1, b = in()-1;
    g[a].push_back({b,i});
    g[b].push_back({a,i});
    num = max(num, (int)g[a].size());
    num = max(num, (int)g[b].size());
  }
  cout << num << endl;
  dfs(0);
  FOR(i,0,n-1) cout << ans[i] << endl;
}

#undef int
int main() {
  solve();
  return 0;
}

Measured memory_bytes: 13056
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
typedef long long int ll;

int main()
{

	ios_base:: sync_with_stdio(false); cin.tie(0);
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	int ans=(c-a)*(d-b);
	cout<<ans<<endl;


	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>

using namespace std;

struct Stick {
  int p, q, r, b, w;
  bool operator<(Stick& other) {
    return w < other.w;
  }
};

Stick sticks[101];

void simplify_ratio(int& x, int& y) {
  int i = x, j = y;
  if (i < j) swap(i, j);
  while (j) {
    int t = j;
    j = i % j;
    i = t;
  }
  x /= i;
  y /= i;
}

int rec(int i) {
  Stick s = sticks[i];
  if (s.w) return s.w;
  int r = s.r ? rec(s.r) : 1, b = s.b ? rec(s.b) : 1, x = s.q * b, y = s.p * r;
  simplify_ratio(x, y);
  return sticks[i].w = r * x + b * y;
}

int main() {
  for (;;) {
    int n;
    cin >> n;
    if (!n) return 0;
    for (int i = 1; i <= n; i++) {
      Stick s;
      cin >> s.p >> s.q >> s.r >> s.b;
      s.w = 0;
      simplify_ratio(s.p, s.q);
      sticks[i] = s;
    }
    for (int i = 1; i <= n; i++)
      rec(i);
    cout << max_element(sticks+1, sticks+n+1)->w << endl;
  }
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long  n, m;
  cin >> n >> m;
  long long ans = 0;
  if (n > m/2) cout << m/2 << '\n';
  else {
    ans += n;
    m -= n*2;
    ans += m/4;
    cout << ans << '\n';
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdint>

int main() {
  constexpr std::int64_t kModulus = 1'000'000'007;
  int N;
  std::cin >> N;
  std::int64_t eight = 1, nine = 1, ten = 1;
  for (int i = 0; i < N; ++i) {
    eight = eight * 8 % kModulus;
    nine = nine * 9 % kModulus;
    ten = ten * 10 % kModulus;
  }
  std::cout << (ten + eight - nine * 2 + kModulus * 2) % kModulus << std::endl;
  return 0;
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
typedef long long ll;
typedef pair<int,int> P;

int main(){
    int n,x;
    cin >> n >> x;
    int l[n];
    rep(i,n)cin >> l[i];
    int d = 0;
    int ans = 1;
    rep(i,n){
        d += l[i];
        if(d<=x)ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <vector>
#include <set>

using namespace std;

int dfs(const vector<vector<size_t>> &g, size_t v, set<size_t> s) {
    s.insert(v);
    if (s.size() == g.size())
        return 1;

    int res=0;
    for (size_t e: g[v]) {
        if (s.count(e)) continue;
        res += dfs(g, e, s);
    }

    return res;
}

int main() {
    size_t N, M;
    scanf("%zu %zu", &N, &M);

    vector<vector<size_t>> g(N);
    for (size_t i=0; i<M; ++i) {
        size_t a, b;
        scanf("%zu %zu", &a, &b);
        --a, --b;
        g[a].emplace_back(b);
        g[b].emplace_back(a);
    }

    printf("%d\n", dfs(g, 0, {}));
    return 0;
}


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

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())

// {{{
template<typename T>
void printmatrix(vector<vector<T> > ar){
    for (int i = 0; i < (int)ar.size(); i++) {
        for (int j = 0; j < (int)ar[0].size(); j++) {
            cout << ar[i][j];
        }
        cout << endl;
    }
}

template<typename T>
void printvector(vector<T> vec){
    for (int i = 0; i < (int)vec.size(); i++) {
        cout << vec[i] << endl;
    }
}

template<typename T>
void unique(vector<T>& vec){
    sort(vec.begin(), vec.end());
    vec.erase(unique(vec.begin(), vec.end()), vec.end());
}

template<typename T>
vector<T> cumsum(vector<T> vec){
    vector<T> newvec((T)vec.size());
    int tmp = 0;
    for (int i = 0; i < (int)vec.size(); i++) {
        tmp += vec[i];
        newvec[i] = tmp;
    }

    return newvec;
}

template<typename T>
T digitsum(T x){
    T y=0;
    while(x){
        y += x % 10;
        x /= 10;
    }

    return y;
}
// }}}
/* vim:set foldmethod=marker: */

int main(int argc, char const* argv[])
{
    int n;
    cin >> n;

    int MIN=1001, MAX=-1;
    for (int i = 0; i < n; i++) {
        int a;
        cin >> a;
        MIN = min(MIN, a);
        MAX = max(MAX, a);
    }

    cout << MAX - MIN << endl;
    return 0;
}

// sortの仕方
// int a[N];
// array<int,N> ar;
// vector<int> v;
//
// sort(a, a+N); // 配列
// sort(ar.begin(), ar.end()); // array
// sort(v.begin(), v.end()); // vector 昇順
// sort(v.begin(), v.end(), greater<int>()); // 降順

// Template
// template <class T>
// T foomax(T x, T y){
//   if (x > y){
//     return x;
//   }else{
//     return y;
//   }
// }

// string を int に変換 stoi("1010")
// int を string に変換 to_string(1010)


Measured memory_bytes: 256
#include <iostream>
 #include <math.h>
 #include <iomanip>
 using namespace std;
 #define ll long long
 #define nl "\n"
#define f(i, a, b) for(ll i = a; i<b;i++)
 int arr[200001], ans[200001];
 int main(){

 ll n;
 cin>>n;
 f(i, 2, n+1)
 cin>>arr[i];
f(i, 2, n+1)
ans[arr[i]]++;
f(i, 1, n+1)
cout<<ans[i]<<nl;


return 0;
 }


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

int main()
{
	//AOJ_Circle Cross Stamps
	int inputValue;
	int flag = 0;
	int countOXStamp = 0;
	char inputString[100000];
	
	cin >> inputValue;
	cin >> inputString;

	while (flag < inputValue)
	{
		if ((inputString[flag] == 'O') && (inputString[flag + 1] == 'X'))
		{
			flag += 2;
			countOXStamp++;
		}
		else if ((inputString[flag] == 'X') && (inputString[flag + 1] == 'O'))
		{
			flag += 2;
			countOXStamp++;
		}
		else
		{
			flag++;
		}
		
	}

	cout << countOXStamp << endl;

	return 0;
}


Measured memory_bytes: 3184
import math

S=input()

if S[0:math.floor((len(S)/2))] == S[math.floor((len(S)/2))+1:len(S)]:
    p = S[0:math.floor((len(S)/2))]
    q = S[math.floor((len(S)/2))+1:len(S)]
    if p == p[len(p)::-1]:
        if q == q[len(q)::-1]:
            print('Yes')
        else:
            print('No')
    else:
        print('No')
else:
    print('No')            

Measured memory_bytes: 3064
#include<iostream>
using namespace std;
int main()
{
    int n, p[100], k = 0;
    cin >> n;
    for(int i = 0; i < n; i++)
    {
        cin >> p[i];
        if(p[i] != i + 1)
            k++;
    }
    if(k <= 2)
    {
        cout << "YES";
        return 0;
    }
    else
        cout << "NO";
    return 0;
}

Measured memory_bytes: 3584
//
// Created by Takaaki Hirano on 2018/09/05.
//
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <cmath>

using namespace std;
typedef long long ll;
#define INF int(1e9)
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; i--)
#define REPONE(i, n) for(int i = 1; i <= (int)(n); i++)
#define EACH(i, mp) for(auto i:mp)
#define FOR(i, m, n) for(int i = m;i < n;i++)


void solve() {
}

int main() {
    string S;
    cin >> S;
    int ans = 700;
    REP(i, 3)if (S[i] == 'o') ans += 100;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		sc.nextLine();
		String s = sc.nextLine();
		int k = sc.nextInt();
		sc.close();
		
		char c = s.charAt(k-1);
		

		for(int i=0;i<n;i++) {
			if(c != s.charAt(i)) {
				s = s.replace(s.charAt(i), '*');
			}
		}

		System.out.println(s);
	}

}


Measured memory_bytes: 22612
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<iostream>
#include<cstring>
#include<string>
#include<cmath>
#include<ctime>
#include<set>
#include<vector>
#include<map>
#include<queue>

#define N 300005
#define M 8000005

#define ls (t<<1)
#define rs ((t<<1)|1)
#define mid ((l+r)>>1)

#define mk make_pair
#define pb push_back
#define fi first
#define se second

using namespace std;

int i,j,m,n,p,k;
long long f[N];
int w,v;

int main()
{
		scanf("%d%d",&n,&m);
		for (;n--;)
		{
				scanf("%d%d",&w,&v);
				for (i=m-w;i>=0;--i)
					f[i+w]=max(f[i+w],f[i]+v);
		}
		printf("%lld\n",f[m]);
}

Measured memory_bytes: 1024
#include <stdio.h>
int main(void)
{
	for (;;)
	{
		int a[11][11];
		int i1, i2, m=0;
		int n;

		scanf("%d", &n);
		if (n==0)
		{
			//printf("\n");
			break;
		}

		for (i1=0;i1<n;i1++)
		{
			for (i2=0;i2<n;i2++)
			{
				scanf("%d", &a[i2][i1]);
			}
		}

		//?¨????
		for (i1=0;i1<n;i1++)
		{
			m=0;
			for (i2=0;i2<n;i2++)
			{
				m+=a[i2][i1];
				if (i2==n-1)
				{
					a[n][i1]=m;
				}
			}
		}

		//??????
		for (i1=0;i1<=n;i1++)
		{
			m=0;
			for (i2=0;i2<n;i2++)
			{
				m+=a[i1][i2];
				if (i2==n-1)
				{
					a[i1][n]=m;
				}
			}
		}

		//??¨???
		//printf("\n");
		for (i1=0;i1<=n;i1++)
		{
			for (i2=0;i2<=n;i2++)
			{
				printf("%5d", a[i2][i1]);
			}
		printf("\n");
		}
	}
	return 0;
}

Measured memory_bytes: 616
use std::io::Read;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();

    let answer = solve(&buf);

    println!("{}", answer);
}

fn solve(input: &str) -> String {
    let mut iterator = input.split_whitespace();

    let n: usize = iterator.next().unwrap().parse().unwrap();

    let mut vec: Vec<usize> = Vec::with_capacity(n);
    for _i in 0..n {
        vec.push(iterator.next().unwrap().parse().unwrap());
    }

    let mut count = 0;
    let mut flag = true;
    while flag {
        flag = false;
        for j in (1..n).rev() {
            if vec[j] < vec[j - 1] {
                let temp = vec[j];
                vec[j] = vec[j - 1];
                vec[j - 1] = temp;
                flag = true;
                count += 1;
            }
        }
    }

    let mut result = vec.iter()
        .map(|it| format!("{}", it))
        .collect::<Vec<String>>()
        .join(" ");
    result = format!("{}\n{}", result, count);

    return result;
}



Measured memory_bytes: 5040
#include <bits/stdc++.h>
#define rep(x, y) for(int x = 0; x < (y); x++)
#define REP(x, z, y) for(int x = (z); x < (y); x++)
#define all(x) x.begin(), x.end()
#define len(x) (sizeof(x) / sizeof(x[0]))
#define split_str(str, sp_word) istringstream stream(str); string res; for(int cnt = 0; getline(stream,res,sp_word); cnt++)
#define scanln(x) fgets(x, sizeof x, stdin)
#define down_queue(x) priority_queue<x>
#define up_queue(x) priority_queue<x, vector<x>, greater<x>>
#define i_str(x) atoi(x.c_str())
#define digit(x) ((int)log10((double)(x)) + 1)
#define mp(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define pf(x) push_front(x)
using namespace std;
const int MOD = 1000000007; 
typedef long long ll;
typedef string str;
  
int main(){
  int abc[3];
  cin >> abc[0] >> abc[1] >> abc[2];
  sort(abc,abc + 3);
  if(abc[0] == 5 && abc[1] == 5 && abc[2] == 7)puts("YES");
  else puts("NO");
  return 0;
}

Measured memory_bytes: 256
function main(arg) {
  var [S, W] = arg[0].split(' ').map(v => v - 0);
  if(S > W) {
  	console.log('safe')
  } else {
	console.log('unsafe')
  }
}

main(require("fs").readFileSync("/dev/stdin", "utf8").trim().split('\n'));


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

using ll = long long;
using ull = unsigned long long;
using st = string;
using db = double;
using vll = vector<long long>;
using vvll = vector<vll>;
using vchar = vector<char>;
#define rep(i, m, n) for (int i = (int)(m); i < (int)(n); i++)
#define vrep(i, vec) for(auto& i : vec)
#define vin(vec) for(auto& i : vec) cin >> i
#define all(v) v.begin(), v.end()
ll mod = 1000000007;

int main(){
  ll n, x;
  cin >> n >> x;
  vll a(n);
  vin(a);
  sort(all(a));
  ll rem =x;
  ll ans = 0;
  while(ans < n){
    rem -= a.at(ans);
    if(rem < 0) break;
    if(ans == n - 1 && rem != 0) break;
    ans++;
  }
  cout << ans << endl;
}

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

using namespace std;

int main()
{
    int x=0,n,i,a[101]={0};
    string s;
    cin>>n;
    cin>>s;

    a[0]=0;

    for(i=0; i<n; i++){
        if(s[i]=='D'){
            x-=1;
            a[i+1]=x;
        }
        else if(s[i]=='I'){
            x+=1;
            a[i+1]=x;
        }
    }
    sort(a,a+n+1);
    cout<<a[n];

    return 0;
}


Measured memory_bytes: 3592
import math
a,b,x = map(int,input().split())

all_v = a*a*b

if all_v == x:
    print(0)
elif all_v/2 >= x:
    print(90-math.degrees(math.atan(2*x/(a*b*b))))
else:
    print(90-math.degrees(math.atan(a*a*a/(2*(a*a*b-x)))))

Measured memory_bytes: 3060
// Let's bring the sky down :)
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int N = 3e5 + 5;
ll a[N];
ll dp[N];
int main()
{
    ios_base ::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    int n, k;
    cin >> n >> k;
    for(int i = 0; i < n; i++)
        cin >> a[i];
    dp[0] = 0;
    for(int i = 1; i <= k; i++){
        for(int j = 0; j < n; j++){
            int x = i - a[j];
            if(x >= 0)
                dp[i] |= (!dp[x]);
        }
    }
    if(dp[k])
        cout << "First";
    else cout << "Second";
return 0;
}


Measured memory_bytes: 3072
package main

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

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	const maxCapacity = 512 * 1024
	buf := make([]byte, maxCapacity)
	scanner.Buffer(buf, maxCapacity)

	var n, t, a, ans, best float64
	scanner.Scan()
	fmt.Sscan(scanner.Text(), &n)
	scanner.Scan()
	fmt.Sscan(scanner.Text(), &t, &a)

	var x int
	best = 10000000000.0
	scanner.Scan()
	for i, v := range strings.Split(scanner.Text(), " ") {
		x, _ = strconv.Atoi(v)
		if math.Abs(a-(t-float64(x)*0.006)) < best {
			best = math.Abs(a - (t - float64(x)*0.006))
			ans = float64(i)
		}
	}
	fmt.Println(ans + 1)
}


Measured memory_bytes: 1904
n = int(input())
a = list(map(int, input().split(' ')))
flg = True
b = 2
cnt=0
while flg:
    for i in range(n):
        if(a[i]%b!=0):
            flg=False
            break
    if not(flg):
        break
    b*=2
    cnt+=1
print(cnt)
#print(b)

Measured memory_bytes: 3064
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>

using namespace std;
typedef long long int ll;
const ll MOD = 1000000007;
char s1[60],s2[60];

int main()
{
    ll ans = 1;
    int flag,i;
    int n;

    while(scanf("%d",&n) != EOF)
    {
        scanf("%s%s",s1,s2);
        if(s1[0] == s2[0]) ans = 3,i = 1,flag = 1;
        else ans = 6,i = 2,flag = 0;
        for(;i < n;)
        {
            if(s1[i] != s2[i])
            {
                if(flag == 0)
                {
                    ans = ans*3%MOD;
                }
                else
                {
                    ans = ans*2%MOD;
                    flag = 0;
                }
                i += 2;
            }
            else
            {
                if(flag == 1) ans = ans*2%MOD;
                else
                {
                    flag = 1;
                }
                i++;
            }
        }
        printf("%lld\n",ans%MOD);
    }

    return 0;
}


Measured memory_bytes: 256
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#endif

#include <bits/stdc++.h>

using namespace std;

typedef long double ld;

#ifdef DEBUG
#define eprintf(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#else
#define eprintf(...) ;
#endif

#define sz(x) ((int) (x).size())
#define TASK "text"

const int inf = (int) 1.01e9;
const ld eps = 1e-9;
const ld pi = acos((ld) -1);

mt19937 mrand(random_device{} ()); 

int rnd(int x) {
  return mrand() % x;
}

void precalc() {
}

const int maxn = 505;
int n;
char c[maxn][maxn];

int read() {
  if (scanf("%d", &n) < 1) {
    return false;
  }
  for (int i = 0; i < n; i++) {
    scanf("%s", c[i]);
  }
  return true;
}

void solve() {
  {
    bool allw = true;
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < n; j++) {
        if (c[i][j] == '#') {
          allw = false;
        }
      }
    }
    if (allw) {
      printf("-1\n");
      return;
    }
  }
  int cols = 0;
  for (int i = 0; i < n; i++) {
    bool ok = true;
    for (int j = 0; j < n; j++) {
      if (c[j][i] == '.') {
        ok = false;
      }
    }
    if (!ok) {
      cols++;
    }
  }
  int res = inf;
  for (int row = 0; row < n; row++) {
    bool incol = false;
    for (int i = 0; i < n; i++) {
      if (c[i][row] == '#') {
        incol = true;
      }
    }
    int cur = 0;
    if (!incol) {
      cur++;
    }
    for (int i = 0; i < n; i++) {
      if (c[row][i] == '.') {
        cur++;
      }
    }
    res = min(res, cur);
  }
  res += cols;
  printf("%d\n", res);
}

int main() {
  precalc();
#ifdef DEBUG
  assert(freopen(TASK ".in", "r", stdin));
  assert(freopen(TASK ".out", "w", stdout));
#endif
  while (read()) {
    solve();
#ifdef DEBUG
    eprintf("Time %.2f\n", (double) clock() / CLOCKS_PER_SEC);
#endif
  }
  return 0;
}


Measured memory_bytes: 512
#include <stdio.h>

static const int MAX = 100;

void trace( unsigned short *p_dt, unsigned short arg_n ) {
	short i;
	for( i = 0; i < (arg_n - 1); i++ ) printf( "%d ", p_dt[i] );
	printf( "%d\n", p_dt[i] );
}

void insertionSort( unsigned short *p_dt, unsigned short arg_n ) {
	short i, j, v;
	trace( p_dt, arg_n );
	for ( i = 1; i < arg_n; i++ ) {
		v = p_dt[i];
		j = i - 1;
		while ( (j >= 0) && (p_dt[j] > v) ) p_dt[j + 1] = p_dt[j--];
		p_dt[j + 1] = v;
		trace( p_dt, arg_n );
	}
}

int main( void ) {
	short i;
	unsigned short n, dt[MAX];

	scanf( "%d", &n );
	for ( i = 0; i < n; i++ ) scanf( "%d", &dt[i] );

	insertionSort( dt, n );

	return 0;
}



Measured memory_bytes: 2120
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  vector<string>s(n);
  string ss = "";
  vector<bool>sumi(n,false);
  vector<int>topB;
  vector<int>bottomA;
  vector<int>doublle;
  int i,j;
  int tmp = 0;
  int first=-1;
  for(i=0;i<n;i++){
    tmp = 0;
    cin >> s[i];
    if(s[i][0]=='B')tmp+=1;
    if(s[i][s[i].length()-1]=='A')tmp += 2;
    if(tmp==1||tmp==3)topB.push_back(i);
    if(tmp==2||tmp==3)bottomA.push_back(i);
    if(tmp==3)doublle.push_back(i);
    if(tmp==2)first=i;
  }
  if(first!=-1){
    ss += s[first];
    sumi[first]=true;
  }

  for(i=0;i<doublle.size();i++){
    if(!sumi[doublle[i]]){
      sumi[doublle[i]]=true;
      ss += s[doublle[i]];
    }
  }
  i=0;
  j=0;
  if(ss==""&&!bottomA.empty()){
    ss = s[bottomA[0]];
    sumi[bottomA[0]]=true;
    j++;
  }
  while(i<topB.size()&&j<bottomA.size()){
    while(sumi[topB[i]]&&i<topB.size()-1)i++;
    while(sumi[bottomA[j]]&&j<bottomA.size()-1)j++;

    if(!sumi[topB[i]]){
      ss+=s[topB[i]];
      sumi[topB[i]]=true;
    }
    if(!sumi[bottomA[j]]){
      sumi[bottomA[j]]=true;
      ss+=s[bottomA[j]];
    }
    i++;
    j++;
  }
  for(i=0;i<n;i++){
    if(!sumi[i])ss+=s[i];
  }
  int ans = 0;
  for(i=0;i<ss.length()-1;i++){
    if(ss[i]=='A'&&ss[i+1]=='B')ans++;
  }
  cout << ans << endl;

}


Measured memory_bytes: 1152
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<map>
#define ll long long
using namespace std;
int n,m,q,cnt,ans;
map<int,bool> mp;
int main()
{
	int i,s,a,b,j,k;
	scanf("%d",&n);
	for(i=1;i<=n;i++)
	{
		scanf("%d",&a);
		if(!mp[a])mp[a]=1,ans++;
		else mp[a]=0,ans--;
	}
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 4992
#include <cstdio>
#include <cstring>
#include <string>
#include <cmath>
#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
typedef long long ll;
ll l, r, a, x, y, z, b,  i, j, k, n, m, num, ans;
ll row[10],col[10];
string s;
char str[10][10];
int main() {
	cin >> a >> b >> k;
	for (i = 0; i < a; i++) {
		for (j = 0; j < b; j++) {
			cin >> str[i][j];
		}
	}
	ans = 0;
	for (i = 0; i < pow(2,a); i++) {
		for (j = 0; j < pow(2,b); j++) {
			ll temi = i, temj = j;
			memset(row, 0, sizeof(row)); memset(col, 0, sizeof(col));
			for (ll h = 0; h < 6; h++) {
				ll tem = temi % 2;
				temi /= 2; 
				if (tem)
					row[h] = 1;
			}
			for (ll h = 0; h < 6; h++) {
				ll tem = temj % 2;
				temj /= 2;
				if (tem)
					col[h] = 1;
			}
			num = 0;
			for (x = 0; x < a; x++) {
				for (y = 0; y < b; y++) {
					if (row[x] == 1 || col[y] == 1)
						continue;
					if (str[x][y] == '#')
						num++;
				}
			}
			if (num == k)
				ans++;
		}
	}
	cout << ans;
	return 0;
}
/*
5
30 40 975
*/

Measured memory_bytes: 3304
import java.util.Scanner;
import java.util.Stack;
 
public class Main {
        public static void main(String[] args) {
                Scanner scn = new Scanner(System.in);
                Stack<Integer> stack = new Stack<Integer>();
                while (scn.hasNext()) {
                   int n = scn.nextInt();
                   if (n == 0) {
                       System.out.println(stack.pop());
                   } else {
                       stack.push(n);
                   }
            }
     }
}

Measured memory_bytes: 17208
n,k=[int(j)for j in input().split()]
a=[int(j)for j in input().split()]
if n<=k:
    print(*[n]*n)
    exit()
import copy
for _ in range(k):
    table=[0]*n
    for i in range(n):
        table[max(i-a[i],0)]+=1
        if i+a[i]+1<n:
            table[i+a[i]+1]-=1
    for i in range(1,n):
        table[i]+=table[i-1]
    a=copy.deepcopy(table)
    if a==[n]*n:
        break
print(*a)









Measured memory_bytes: 178504
n,x=input().split()
n=int(n)
x=int(x)

a=0
list=[]
for i in range(n):
	b=int(input())
	list.append(b)
	a=a+b
#print(a)
#print(min(list))
d=(x-a)//min(list)
print(n+d)


Measured memory_bytes: 3060
#include<iostream>
using namespace std;
int main(){
	double c1,c2,ave;
	cin >> c1;
	cin >> c2;
	if((c1-c2)>=180){
		c1 = c1-360;
	}
	else if((c2-c1)>=180){
		c2 = c2-360;
	}
		ave = (c1+c2)/2;
	if(ave<0)	ave=ave+360;
	cout << ave <<"\n";
	return 0;
}

Measured memory_bytes: 3288
#include<bits/stdc++.h>
using namespace std;
#define INF 1000000007

int main()
{
    int n;
    cin >> n;
    int h[n];
    for(int i=0;i<n;++i) cin >> h[i];

    int dp[n+1];
    for(int i=0;i<=n;++i) dp[i]=INF;
    dp[n]= 0;
    dp[n-1] = abs(h[n-1]-h[n-2]);
    for(int i=n-2;i>=1;--i)
    {
        dp[i] = min(dp[i+1] + abs(h[i]-h[i-1]),dp[i+2] + abs(h[i+1]-h[i-1]) );
    }
    cout << dp[1] << endl;

}

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

using namespace std;

using i64 = int64_t;
using P = pair<i64, i64>;

struct edge {
    i64 from, to, cost;
    edge(i64 from, i64 to) : from(from), to(to), cost(1) {}
    edge(i64 from, i64 to, i64 cost) : from(from), to(to), cost(cost) {}
};
using Graph = vector<vector<edge>>;

constexpr i64 INF = std::numeric_limits<i64>::max();
constexpr i64 SINF = std::numeric_limits<i64>::max() / 10;
const i64 dx[4] = { 0,1,0,-1 }, dy[4] = { -1,0,1,0 };
//const i64 dx[5] = {-1,0,0,0,1}, dy[5] = {0,-1,0,1,0};
//const i64 dx[8] = {-1,0,1,1,1,0,-1,-1}, dy[8] = {1,1,1,0,-1,-1,-1,0};
//const i64 dx[9] = {-1,0,1,1,1,0,-1,-1,0}, dy[9] = {1,1,1,0,-1,-1,-1,0,0};

#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)

// http://beet-aizu.hatenablog.com/entry/2018/04/08/145516
template<typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }

template<typename T, typename... Ts>
auto make_v(size_t a, Ts... ts) {
    return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}

template<typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T& t, const V& v) { t = v; }

template<typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T& t, const V& v) {
    for (auto& e : t) fill_v(e, v);
}

struct IoSetup {
    IoSetup() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(10);
        cerr << fixed << setprecision(10);
    }
} iosetup;

i64 solve(i64 n){
    if(n == 6174) return 0;
    ostringstream sout;
    sout << setfill('0') << std::setw(4) << n;
    string l = sout.str();
    string r = l;
    sort(l.begin(), l.end());
    sort(r.rbegin(), r.rend());
    i64 x = stoi(r) - stoi(l);
    if(x == 6174) return 1;
    else return solve(x) + 1;
}

int main(){
    while(true){
        i64 n;
        cin >> n;
        if(n == 0) break;
        if(n % 1111 == 0) cout << "NA" << endl;
        else cout << solve(n) << endl;
    }
}


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

int main()
{
  string s;
  int m,h;
  while (true) {
    cin >> s;
    if (s == "-") break;
    cin >> m;

    rep(i,m){
      cin >> h;
      string tmp;
      // tmp = s.substr(s.size()-h);
      tmp = s.substr(0, h);
      // s.erase(s.size()-h);
      s.erase(0, h);
      s = s+tmp;
    }
    cout << s << endl;
  }

  return 0;
}


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

if n%2==1:
    print(0)
else:
    i = 1
    cnt = 0
    n1 = n
    while n1 != 0:
        n1 = n
        n1 = n1//(2*(5**i))
        cnt += n1
        i += 1
    print(cnt)

Measured memory_bytes: 3060
N, K = map(int,input().split())
h = [int(i) for i in input().split()]

# DPテーブルを初期化
dp = [float("inf")]*N

# 初期状態
dp[0] = 0

# 足場iから足場(i+j)にジャンプする
for i in range(0,N):
    for j in range(1,K+1):
        if (i+j) >= N:
            break
        dp[i+j] = min(dp[i+j], dp[i]+abs(h[i]-h[i+j]))

print(dp[-1])


Measured memory_bytes: 55008
/*
    Author : Nishant Gupta 2.0
*/
#include<bits/stdc++.h>
using namespace std;

#define LL long long int
#define getcx getchar_unlocked
#define X first
#define Y second
#define PB push_back
#define MP make_pair
#define MAX 1000005
#define LOG_MAX 20
#define MOD 1000000007
#define INF 0x3f3f3f3f
#define INFL (LL(1e18))
#define chk(a) cerr << endl << #a << " : " << a << endl
#define chk2(a,b) cerr << endl << #a << " : " << a << "\t" << #b << " : " << b << endl
#define chk3(a,b,c) cerr << endl << #a << " : " << a << "\t" << #b << " : " << b << "\t" << #c << " : " << c << endl
#define chk4(a,b,c,d) cerr << endl << #a << " : " << a << "\t" << #b << " : " << b << "\t" << #c << " : " << c << "\t" << #d << " : " << d << endl
#define rep(i, a, n) for(i=a;i<n;i++)
#define rev(i, a, n) for(i=a;i>=n;i--)
#define in(x) scanf("%d", &x)
#define inl(x) scanf("%lld", &x)
#define in2(x, y) scanf("%d %d", &x, &y)
#define inl2(x, y) scanf("%lld %lld", &x, &y)
#define MSV(A,a) memset(A, a, sizeof(A))
#define rep_itr(itr, c) for(itr = (c).begin(); itr != (c).end(); itr++)
#define finish(x) {cout<<x<<'\n'; return;}
typedef pair<int, int> pi;
typedef pair<LL, LL> pl;
const char en = '\n';

LL fact[2*MAX];
void pre() {
	fact[0] = 1;
	for(int i=1;i<2*MAX;i++) fact[i] = (fact[i-1] * i) % MOD;	
}

LL power(LL base, LL exp, LL ans) {
	if(!exp) return ans % MOD;
	if(exp&1) ans = (ans * base) % MOD;
	return power((base * base) % MOD, exp>>1, ans);
}

LL nCr(LL n, LL r) {
	if(n < r) return 0;
	LL numerator = fact[n];
	LL denominator = (fact[n-r] * fact[r]) % MOD;
	return (numerator * power(denominator, MOD-2, 1)) % MOD;
}

void solve() {
	int k, n;
	in(k);
	string s;
	cin>>s;
	n = s.length();
	
	LL ans = 0;
	for(int i=0;i<=k;i++) {
		LL last_place = power(26, i, 1);
		LL rest_places = (power(25, k-i, 1) * nCr(k-i+n-1, n-1)) % MOD;
		ans = (ans + (last_place * rest_places) % MOD) % MOD;
	}
	cout<<ans<<en;
}

int main() {
	int t = 1;
	pre();
	//~cin>>t;
	while(t--) {
		solve();
	}
    return 0;
}


Measured memory_bytes: 21032
D = int(input())
c = list(map(int, input().split()))
s = []
for _ in range(D):
    s.append(list(map(int, input().split())))
t = [(int(input()) - 1) for _ in range(D)]

last = [0] * 26

S = 0
for dd in range(1, D + 1):
    S += s[dd - 1][t[dd - 1]]
    last[t[dd - 1]] = dd
    for i in range(26):
        S -= c[i] * (dd - last[i])
    print(S)


Measured memory_bytes: 9388
from bisect import bisect_left
def prime(n):
    a = [0] * (n + 1)
    a[0] = 1
    a[1] = 1
    i = 2
    while n // i >= i:
        if a[i] != 0:
            i += 1
            continue
        j = 2 * i
        while j <= n:
            a[j] = 1
            j += i
        i += 1
    return [i for i, ai in enumerate(a) if ai == 0]


x = int(input())
primes = prime(10**6)
p = bisect_left(primes, x)
print(primes[p])


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

int main() {
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  int l = 0, r = 1e9;
  while (r-l > 1) {
    int x = (l+r)/2;
    auto f = [&](int x) {
      ll now = 0;
      rep(i,n) now += (a[i]-1)/x;
      return now <= k;
    };
    if (f(x)) r = x; else l = x;
  }
  cout << r << endl;
  return 0;
}

Measured memory_bytes: 3940
#include<bits/stdc++.h>
#define LL long long
#define M(a,b) memset(a,b,sizeof a)
#define pb(x) push_back(x)
using namespace std;
const int maxn=2e3+9;
const int inf=0x3f3f3f3f;
const int mod=1e9+7;
int n,t,m;
int main()
{
    scanf("%d%d",&n,&m);
    printf("%d\n",(1<<m)*(1900*m+(n-m)*100));
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int main() {
  long long N, A[100001], B[100001], maxA = 0, key = 0;
  cin >> N;
  for(int i=0;i<N;i++){
    cin >> A[i] >> B[i];
    if(A[i] >= maxA){
      maxA = A[i];
      key = i;
    }
  }
  cout << maxA + B[key] << endl;
  return 0;
}


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

int n, value;

int main() {
  cin >> n;
  vector<int> v(n, 0);
  int value;
  rep (x, sqrt(n)+1) {
    rep (y, sqrt(n)+1) {
      rep (z, sqrt(n)+1) {
        if (x*y*z == 0) continue;
        value = x*x+y*y+z*z+x*y+y*z+z*x;
        if (value > n) continue;
        v[value-1]++;
      }
    }
  }
  rep (i, n) {
    cout << v[i] << endl;
  }
  return 0;
}


Measured memory_bytes: 3548
from copy import deepcopy
n = int(input())
S = [input() for i in range(n)]
dict_count = {}
for i in range(26):
    dict_count[97+i] = 0
def values_return(string):
    copy = deepcopy(dict_count)
    for e in string:
        copy[ord(e)] += 1
    return list(copy.values())
S_count = [values_return(e) for e in S]
common = []
for j in range(26):
    min_count = 51
    for i in range(len(S_count)):
        if S_count[i][j] < min_count:
            min_count = S_count[i][j]
    common.append(min_count)
ans = ""
for i in range(26):
    ans += chr(97+i) * common[i]
print(ans)

Measured memory_bytes: 3444
#include <iostream>

using namespace std;

int main() {
    int x, a, b;
    cin >> x >> a >> b;
    if (a >= b) {
        cout << "delicious\n";
    } else if (x >= abs(b - a)) {
        cout << "safe\n";
    } else {
        cout << "dangerous\n";
    }
}

Measured memory_bytes: 256
import os
import heapq
import sys,threading
import math
import bisect
import operator
from collections import defaultdict
sys.setrecursionlimit(10**5)
from io import BytesIO, IOBase
def gcd(a,b):
    if b==0:

        return a
    else:
        return gcd(b,a%b)
def power(x, p,m):
    res = 1
    while p:
        if p & 1:
            res = (res * x) % m
        x = (x * x) % m
        p >>= 1
    return res
def inar():
    return [int(k) for k in input().split()]

def lcm(num1,num2):
    return (num1*num2)//gcd(num1,num2)

def main():
    #t=int(input())
    t=1
    for _ in range(t):

        d,t,s=inar()
        if (t*s)>=d:
            print("Yes")
        else:
            print("No")

BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    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(b"\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()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

if __name__ == "__main__":
    main()
    #threadin.Thread(target=main).start()


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

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

	long long int ans = 0;
	for (int i = 0; i < N-1; i++) {
		for (int j = i + 1; j < N; j++) {
			ans += d[i] * d[j];
		}
	}

	cout << ans << endl;
}

Measured memory_bytes: 256
n = gets.to_i
l = Array.new(n) { gets.split.map(&:to_i) }
u, v, h = l.find { |_, _, h| h != 0 }
l.delete([u, v, h])

101.times do |i|
  101.times do |j|
    central_h = h + (i - u).abs + (j - v).abs
    next if l.any? { |x, y, bh| [central_h - (i - x).abs - (j - y).abs, 0].max != bh }

    puts [i, j, central_h].join(' ')
    exit
  end
end

Measured memory_bytes: 14292
#include<cassert>
#include<cctype>
#include<cerrno>
#include<cfloat>
#include<ciso646>
#include<climits>
#include<clocale>
#include<cmath>
#include<csetjmp>
#include<csignal>
#include<cstdarg>
#include<cstddef>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<algorithm>
#include<bitset>
#include<complex>
#include<deque>
#include<exception>
#include<fstream>
#include<functional>
#include<iomanip>
#include<ios>
#include<iosfwd>
#include<iostream>
#include<istream>
#include<iterator>
#include<limits>
#include<list>
#include<locale>
#include<map>
#include<memory>
#include<new>
#include<numeric>
#include<ostream>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<stdexcept>
#include<streambuf>
#include<string>
#include<typeinfo>
#include<utility>
#include<valarray>
using namespace std;

int n, len;
char s[100005];

int main()
{
	scanf("%d", &n);
	cin>>s;
	len=strlen(s);
	for(int i=0; i<len; i++)
	{
		if(i==n)
		{
			printf("...");
			return 0;
		}
		cout<<s[i];
	}
	
	return 0;
}


Measured memory_bytes: 3728