akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
using namespace std;
int main()
{
	int n;
	cin >> n;
	n = n % 10;
	if (n == 3) {
		cout << "bon" << endl;
	}
	else if (n == 1 || n == 6 || n == 8 || n == 0) {
		cout << "pon" << endl;
	}
	else {
		cout << "hon" << endl;
	}
	return 0;
}


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

long long int a[100], p[100];

long long int func(long long int n, long long int x){
  if(n==0) {
      if(x>0) return 1;
      else return 0;
  }else if(1 < x && x <= 1 + a[n-1]){
    return func(n-1, x-1);

  }else if(x == 2 + a[n-1]){
    return p[n-1] + 1;

  }else if(2+a[n-1] < x && x <= 2+2*a[n-1]){
    return p[n-1] + 1 + func(n-1, x-2-a[n-1]);

  }else if(x == 3+2*a[n-1]){
    return 2*p[n-1] + 1;
  }
}

int main() {
  long long int n, x;
  long long int ans;
  cin >> n >> x;
  a[0] = p[0] = 1;
  for(int i=1; i<=n; i++){
    a[i] = 2*a[i-1]+3;
    p[i] = 2*p[i-1]+1;
  }
  ans = func(n, x);
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>

struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};

typedef struct node * Node;
#define NIL NULL

Node root;

Node treeMinimum(Node x){

  while(x->left!=NIL){
    x = x->left;
  }
  return x;

}

Node treeSearch(Node u, int k){
  while(u!=NIL && k!=u->key){
  if(k<u->key){
    u = u->left;
  }
  else {
    u = u->right;
  }
  }
  return u;
}

Node treeSuccessor(Node x){

  Node y;

  if(x->right!=NIL){
  return  treeMinimum(x->right);
  }

  y = x->parent;

    while(y!=NIL && x==y->right){
      x = y;
      y = y->parent;
    }
    return y;
}

void treeDelete(Node z){

  Node y; 
  Node x;

  if(z->left==NIL || z->right==NIL){
    y = z;
  }
  else {
    y = treeSuccessor(z);
  }

  if(y->left!=NIL){
    x = y->left;
  }
  else {
    x = y->right;
  }

  if(x!=NIL){
    x->parent = y->parent;
  }
  if(y->parent==NIL){
    root= x;
  }
  else if(y==y->parent->left){
    y->parent->left = x;
  }
  else {
    y->parent->right = x;
  }

  if(y!=z){
    z->key = y->key;
  }
} 

void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;

  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;

  while(x!=NIL){
    y=x;
    if(z->key < x->key){
      x = x->left;
    }
    else{
      x = x->right;
    }
  }
    z->parent = y;

    if(y==NIL){
      root=z;
    }
    else if(z->key < y->key){
      y->left = z;
    }
    else {
      y->right = z;
    }
  
}

void inorder(Node u){

  if(u != NIL){
    inorder(u->left);
    printf(" %d",u->key);
    inorder(u->right);
  }


}
void preorder(Node u){
 
  if(u!=NIL){
    printf(" %d",u->key);
    preorder(u->left);
    preorder(u->right);
  }  
}


int main(){

  int n,i,x;
  char com[20];

  scanf("%d",&n);

  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
     if ( com[0] == 'f' ){
      scanf("%d", &x);
       Node t = treeSearch(root, x);
      
      if ( t != NIL ) printf("yes\n");
      else printf("no\n");
      } 
     if ( com[0] == 'i' ){
    scanf("%d", &x);
      insert(x);
    } else if ( com[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    } else if ( com[0] == 'd' ){
      scanf("%d", &x);
      treeDelete(treeSearch(root, x));
      }
  }

  return 0;
}

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

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

    int N;
    cin >> N;
    vector<int> a;
    a.resize(N, 0);
    for(int i = 0; i < N; i++){
        cin >> a[i];
    }

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

    int ans = abs(a[0] - a[a.size() - 1]);

    cout << ans << "\n";

    return 0;
}


Measured memory_bytes: 256
n,m=map(int,input().split())
k=[list(map(int,input().split())) for _ in range(n)]
for i in range(n):
    k[i].pop(0)
res = 0
for i in range(1,m+1):
    flag = 1
    for j in range(n):
        if not i in k[j]:
            flag = 0
            break
    res += flag

print(res)

Measured memory_bytes: 38384
n,k = map(int,input().split())
h = list(map(int,input().split()))

dp = [1000000000 for i in range(n)]
dp[0] = 0

for i in range(n):
    for j in range(k+1):
        if i+j<n:
            dp[i + j] = min(dp[i] + abs(h[i] - h[i + j]), dp[i + j])
print(dp[n-1])

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

int main(){
    int a, b, k;
    cin >> a >> b >> k;
    vector<int> v;
    for (int i = 1; i <= a; i++)
    {
        if(a%i==0)
        {
            if(b%i==0)
            {
                v.push_back(i);
            }
        }
    }
    sort(v.rbegin(), v.rend());
    cout << v[k - 1] << endl;
    return 0;
}

Measured memory_bytes: 256
// C++ includes used for precompiling -*- C++ -*-

// Copyright (C) 2003-2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library.  This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.

// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.

// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
// <http://www.gnu.org/licenses/>.

/** @file stdc++.h
 *  This is an implementation file for a precompiled header.
 */

// 17.4.1.2 Headers

// C
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#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>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
// #include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif

using namespace std;
typedef long long ll;

int main()
{

  ll r, d, x;
  cin >> r >> d >> x;

  for (ll i = 0; i < 10; i++)
  {
    x = r * x - d;
    cout << x << endl;
  }

  return 0;
}

Measured memory_bytes: 256
//                                 Alisher_2211
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        # include <bits/stdc++.h>
# define  long          long long
# define  all(vc)       vc.begin(),vc.end()
# define  allr(vc)      vc.rbegin(),vc.rend()
# define  pb            push_back
# define  fi            first 
# define  se            second
# define  pi            pair <long, long>    
# define  lcm(a, b)     (a * b) / __gcd(a, b)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        using namespace std;
const long N = 100100;
void read(){freopen("input.txt" , "r" , stdin );freopen("output.txt", "w" , stdout );}
long dp[N][2];
string s;
void solve(){
    long a, b, c;
    cin >> a >> b >> c;
    long h = c % b;
    long ans = 0;
    for (int i = a; i < 100000; i += a){
        //ans += i;
        if( i % b == h ){
            cout << "YES";
            return;
        }
    }
    cout << "NO";
}
int32_t main(){
ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); 
        long T = 1;
        //cin >> T;
        while( T-- ){
            solve();
            cout<<'\n';
        }
cerr << "\nTime elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
}

Measured memory_bytes: 3792
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Math;
using static ConsoleApplication.Utils;

namespace ConsoleApplication
{
    public class Program
    {
        public static void Main(string[] args)
        {
            var hw = ReadInts().ToArray();
            var c = ReadLines(hw[0]);
            c.Select(s => $"{s}\n{s}").ForEach(WriteLine);
        }
    }

    public static class Utils
    {
        #region Extensions for IO

        public static int ReadInt()
            => ReadLine().ToInt();

        public static IEnumerable<int> ReadInts()
            => ReadStrings().Select(int.Parse);

        public static IEnumerable<int> ReadInts(int count)
            => ReadLines(count).Select(int.Parse);

        public static long ReadLong()
            => ReadLine().ToLong();

        public static IEnumerable<long> ReadLongs()
            => ReadStrings().Select(long.Parse);

        public static ulong ReadUlong()
            => ReadLine().ToUlong();

        public static IEnumerable<ulong> ReadUlongs()
            => ReadStrings().Select(ulong.Parse);


        public static IEnumerable<string> ReadStrings()
            => ReadLine().Split(' ');

        public static IEnumerable<string> ReadLines(int n)
        {
            foreach (var i in Enumerable.Range(0, n))
            {
                yield return ReadLine();
            }
        }

        #endregion

        #region Extensions of int

        public static bool IsOdd(this int n)
            => !n.IsEven();

        public static bool IsEven(this int n)
            => n % 2 == 0;

        public static bool CanDivideWith(this int n, int divisor)
            => n % divisor == 0;

        #endregion

        #region Extensions of string

        public static int ToInt(this string str)
            => int.Parse(str);

        public static long ToLong(this string str)
            => long.Parse(str);

        public static ulong ToUlong(this string str)
            => ulong.Parse(str);

        public static double ToDouble(this string str)
            => double.Parse(str);

        public static bool IsNullOrEmpty(this string str)
            => string.IsNullOrEmpty(str);

        #endregion

        public static TSource Min<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector)
            where TKey : IComparable
            => source.OrderBy(keySelector).First();

        public static TSource Max<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector)
            where TKey : IComparable
            => source.OrderByDescending(keySelector).First();

        public static void ForEach<T>(this IEnumerable<T> source, Action<T> action)
        {
            foreach (var item in source)
            {
                action(item);
            }
        }

        public static IEnumerable<T> Peek<T>(this IEnumerable<T> source, Action<T> action)
        {
            foreach (var item in source)
            {
                action(item);
            }
            return source;
        }
    }
}


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

typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vp;
const int inf = 1e9;
const ll INF = 1e18;
const db eps = 1e-10;

#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define ep emplace
#define mem(a) memset(a, 0, sizeof(a))
#define copy(a, b) memcpy(a, b, sizeof(b))
#define PA cout << "pass\n"
#define lowbit(x) (x & -x)
#define all(x) x.begin(), x.end()
#define TM cout << db(clock()) / CLOCKS_PER_SEC << '\n'

mt19937 mrand(chrono::high_resolution_clock::now().time_since_epoch().count());

template<class T>inline void upmin(T &x, T y) {x = x > y ? y : x;}
template<class T>inline void upmax(T &x, T y) {x = x < y ? y : x;}

template <class A, class B>
string to_string(pair<A, B> p);

template <class A, class B, class C>
string to_string(tuple<A, B, C> p);

template <class A, class B, class C, class D>
string to_string(tuple<A, B, C, D> p);

string to_string(const string& s) {
    return '"' + s + '"';
}

string to_string(const char* s) {
    return to_string((string) s);
}

string to_string(bool b) {
    return (b ? "true" : "false");
}

string to_string(vector<bool> v) {
    bool first = true;
    string res = "{";
    for (int i = 0; i < static_cast<int>(v.size()); i++) {
        if (!first) {
            res += ", ";
        }
        first = false;
        res += to_string(v[i]);
    }
    res += "}";
    return res;
}

template <size_t N>
string to_string(bitset<N> v) {
    string res = "";
    for (size_t i = 0; i < N; i++) {
        res += static_cast<char>('0' + v[i]);
    }
    return res;
}

template <class A>
string to_string(A v) {
    bool first = true;
    string res = "{";
    for (const auto &x : v) {
        if (!first) {
            res += ", ";
        }
        first = false;
        res += to_string(x);
    }
    res += "}";
    return res;
}

template <class A, class B>
string to_string(pair<A, B> p) {
    return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <class A, class B, class C>
string to_string(tuple<A, B, C> p) {
    return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}

template <class A, class B, class C, class D>
string to_string(tuple<A, B, C, D> p) {
    return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}

void debug(){cerr << endl;}
template<class T, class... U>
void debug(const T& h,const U&... t){
    cerr << to_string(h) << ' ';
    debug(t...);
}

string s;

int main(){
    ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
    cout << fixed << setprecision(10);
    cin >> s;
    if(s.size() % 2){
        cout << "No\n";
        return 0;
    }
    for(int i = 0; i < s.size(); i++){
        if(i % 2 && s[i] != 'i'){
            cout << "No\n";
            return 0;
        }
        if(i % 2 == 0 && s[i] != 'h'){
            cout << "No\n";
            return 0;
        }
    }
    cout << "Yes\n";
    return 0;
}

Measured memory_bytes: 256
N,M = map(int,input().split())
A = list(map(int,input().split()))

sum_A = sum(A)
A.sort(reverse=True)
x = sum_A/(4*M)
count = 0
for i in range(N):
    if A[i] >= x:
        count += 1
if count >= M:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 38384
#include <bits/stdc++.h>
using namespace std;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ll long long
#define ld long double
#define all(a) (a).begin(),(a).end()
#define mk make_pair
ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=100000000000000000;


int main() {
    int n,m,ans=inf;
    cin >> n >> m;
    vector<int> a(pow(2,n),inf);
    a[0]=0;
    rep(i,m){
        int aa,b;
        cin >> aa >> b;
        int w=0;
        rep(j,b){
            int c;
            cin >> c;
            w+=pow(2,c-1);
        }
        rep(j,pow(2,n)){
            if (a[j]==inf) continue;
            if ((j|w)==pow(2,n)-1) ans=min(ans,a[j]+aa);
            else{
                a[j|w]=min(a[j|w],a[j]+aa);
            }
        }
    }
    if (ans==inf) cout << -1 << endl;
    else cout << ans << endl;
}


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

#define MAX(X,Y) ((X)>(Y)?(X):(Y))

int main(void){
  int ans,n,v[100],c[100];
  
  cin >> n;
  ans = 0;
  for (int i=0; i<n; i++){
    cin >> v[i];
  }
  for (int i=0; i<n; i++){
    cin >> c[i];
    ans += MAX(v[i]-c[i],0);
  }
  cout << ans << endl;
  return 0;
}

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

int main() {
	int n,count=0;
	char a[100001];
	cin>>n;
	a[0]='[';
	for(int i=1;i<=n;i++) {
	   cin>>a[i];
	   if(a[i] == a[i-1])
	    continue;
		count++;	
	}
	  cout<<count;
	  return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define ll long long
#define loop(i,a,b) for(int i=a;i<b;i++)
#define pb(x) push_back(x)
#define F first
#define S second
#define mp(x,y) make_pair(x,y)
using namespace std;

const int N=1e5+7;
int a[3][N];
int dp[3][N];


void solve(){
	int n;
	cin>>n;
	loop(i,0,n){
		cin>>a[0][i]>>a[1][i]>>a[2][i];
	}
	loop(i,0,3){
		dp[i][0]=a[i][0];
	}
	loop(i,1,n){
		dp[0][i]=max(dp[0][i-1],max(dp[1][i-1],dp[2][i-1])+a[0][i]);
		dp[1][i]=max(dp[1][i-1],max(dp[2][i-1],dp[0][i-1])+a[1][i]);
		dp[2][i]=max(dp[2][i-1],max(dp[1][i-1],dp[0][i-1])+a[2][i]);
	}
	int ans=max(dp[0][n-1],dp[1][n-1]);
	ans=max(dp[2][n-1],ans);
	cout<<ans<<endl;
	return;           
}      


int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
//    freopen("input.txt","r",stdin);
	int t=1;
	while(t--){
		solve();
	}
	return 0;
}



Measured memory_bytes: 2560
#include<algorithm>//sort(all(変数),greater<型名>())　で降順に
#include<bits/stdc++.h>
#include<cmath>//切り上げceil(値)
#include<deque>
#include<iomanip>//setprecision(数字)
#include<iostream>
#include<list>
#include<map>
#include<numeric> //xとyの最大公約数は__gcd(x,y),xとyの最小公倍数は(x*y)/__gcd
#include<queue>//priority_queue<型名> 変数：優先度付きキュー　最大値の探索が早い
#include<set>
#include<stack>
#include<string>
#include<vector>
#define rep0(i,n)  for(ll i=0; i<n; i++)
#define rrep0(i,n) for(ll i=n-1; 0<=i; i--)
#define vll vector<ll>
#define vi vector<int>
#define all(x) (x).begin(),(x).end()
#define INF 1e18
using ll = long long;
using namespace std;
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; }

int main(){
  int n;  cin >> n;
  rep0(i,1e5){
    int cnt = i*1.08;
    if(cnt == n){
      cout << i;
      return 0;
    }
  }
  cout << ":(";
}


Measured memory_bytes: 256
c=[list(map(int,input().split()))for _ in range(3)]
a=c[0].copy()
b=[0]*3
for i in range(1,3):b[i]=c[i][0]-a[0]
ans="Yes"
for i in range(3):
  for j in range(3):
    if a[j]+b[i]!=c[i][j]:ans="No"
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
struct P
{
    long long x,y;
}H[200000];
int main()
{
    long long n,m;
    cin>>n>>m;
    H[1].x=1;
    H[1].y=1;
    for(int i=2;i<=n;i++)
    {
        H[i].x=0;
        H[i].y=1;
    }
    int ans=1;
    for(int i=1;i<=m;i++)
    {
        int v,u;
        cin>>v>>u;
        if(H[v].y==0)continue;
        if(H[v].x==1)
        {
            if(H[v].y==1)
            {
                H[v].x=0;
            }
            H[u].x=1;
        }
        H[v].y--;
        H[u].y++;
    }
    int num=0;
    for(int i=1;i<=n;i++)
    {
        if(H[i].x&&H[i].y)
        {
            num++;
        }
    }
    cout<<num<<endl;
    return 0;
}


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

#define DEBUG(x) cout<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cout<<#v<<":";for(int i=0;i<v.size();i++) cout<<" "<<v[i]; cout<<endl

typedef long long ll;
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
const int inf = 1000000001;
const ll INF = 1e18 * 2;
#define MOD 1000000007
#define mod 1000000009
#define pi 3.14159265358979323846
#define Sp(p) cout<<setprecision(15)<< fixed<<p<<endl;
int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };

int main() {
	char c;
	cin >> c;
	if (c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o') {
		cout << "vowel" << endl;
	}
	else {
		cout << "consonant" << endl;
	}
}

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

int main() {
    int N;
    cin >> N;
    map<int, int> cnt;
    for (int i = 0; i < N; i++) {
        int a;
        cin >> a;
        cnt[a]++;
    }

    int res = 0;
    for (auto it = cnt.begin(); it != cnt.end(); it++) {
        pair<int, int> p = *it;
        if (p.second % 2 != 0) {
            res++;
        }
    }
    cout << res << endl;
    return 0;
}

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

int main(){
    int n;
    cin >> n;
    
    if(n==1) cout << "Hello World" << endl;
    else if(n==2){
        int a, b;
        cin >> a >> b;
        cout << a+b << endl;
    }
    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define MAX_N 100000
#define MAX_M 100000
#define vec vector<int>
#define vecst vector<string>
#define vecch vector<char>
#define vecf vector<float>
#define vecvec vector<vector<int>>
using ll=int long long;
const int INF = 1e9;
#define PI 3.141592653589793
// cout << setprecision(15) << std::fixed;

int main(){
  ll a,b,x;
  ll ans;
  cin>>a>>b>>x;
  ans=b/x;
  if(a-1<0){
    ans++;
  }
  else{
    ans-=(a-1)/x;
  }
  cout<<ans<<endl;
}



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

def f(n):
  t_n, x_n, y_n = 0, 0, 0
  for i in range(n):
    t, x, y = map(int, input().split())
    t_d = abs(t_n - t)
    x_d = abs(x_n - x)
    y_d = abs(y_n - y)
    if not x_d+y_d <= t_d or (x_d+y_d)%2 == 0 and not t_d%2 == 0 or not (x_d+y_d)%2 == 0 and t_d%2 == 0:
      return "No"
    t_n, x_n, y_n = t, x, y
  
  return "Yes"

print(f(n))

Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<iomanip>
#define sqr(x) (x)*(x)
using namespace std;
int n,a,b;
int main()
{
	cin>>n>>a>>b;
	while (a<b)
	{
		a++;
		if (a==b)
		{
			cout<<"Borys";
			return 0;
		}
		b--;
		if (a==b)
		{
			cout<<"Alice";
			return 0;
		}
	}
	while (a>b)
	{
		a--;
		if (a==b)
		{
			cout<<"Borys";
			return 0;
		}
		b++;
		if (a==b)
		{
			cout<<"Alice";
			return 0;
		}
	}
	cout<<"Borys";
	return 0;
}

Measured memory_bytes: 256
//abc179_d.cpp
//Sat Sep 19 21:08:03 2020

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

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


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

	ll s[n+10];
	fill(s,s+n+10,0);
	ll sum[n+10];
	fill(sum,sum+n+10,0);
	vector<P> a;
	rep(i,k){
		int l,r;
		cin >> l >> r;
		a.push_back(P(l,r));
	}

	s[1] = 1;
	for (int i=1;i<=n;i++){
		rep(j,a.size()){
			ll l=max(i-a[j].second,1);
			ll r=max(i-a[j].first,0);
			s[i] = (s[i]+sum[r]-sum[l-1]+MOD)%MOD;
		}
		sum[i] = (sum[i-1]+s[i])%MOD;
	}

	cout << s[n] << endl;
//	printf("%.4f\n",ans);
}


Measured memory_bytes: 6716
#include <bits/stdc++.h>
#define rep( i, n, m ) for(int i = ( n ); i < ( m ); i++)
using namespace std;
typedef long long int ll;
const int k_mod = 1e9 + 7;

int main() {
	int n, m;
	cin >> n >> m;
	n++;
	ll* dp = new ll[ n ]();
	dp[ 0 ] = 0;
	rep( i, 0, m ){
		static int pre = -1;
		int broken;
		cin >> broken;
		if (broken - pre == 1){
			printf( "0\n" );
			return 0;
		}
		dp[ broken ] = -1;
		pre = broken;
	}
	if (dp[ 1 ] != -1)
		dp[ 1 ] = 1;
	if (dp[ 2 ] != -1)
		dp[ 2 ] = 1;
	rep( i, 0, n - 1 ){
		if (dp[ i ] == -1)
			continue;
		if (dp[ i + 1 ] != -1){
			dp[ i + 1 ] += dp[ i ];
			dp[ i + 1 ] %= k_mod;
		}
		if (dp[ i + 2 ] != -1){
			dp[ i + 2 ] += dp[ i ];
			dp[ i + 2 ] %= k_mod;
		}
	}
	printf( "%lld\n", dp[ n - 1 ] );
}


Measured memory_bytes: 1024
#include <cstdio>
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
#include <cmath>
#include <iomanip>
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;i++)

using namespace std;
ll intpow(ll N, ll P){
    if(P==0) return 1;
    if(P%2==0){
        ll t = intpow(N, P/2);
        return t*t;
    }
    return N * intpow(N, P-1);
}
ll gcd(ll n,ll m){
    n = max(n,m);
    m = min(n,m);
    if(n%m == 0)return m;
    return gcd(m,n%m);
}
ll lcm(ll n,ll m){
    return n*m/gcd(n,m);
}
int main(){
    string s,s1,s2;cin>>s;
    s1 = "";
    s2 = "";
    int q;cin >> q;
    int sw=0;
    rep(i,q){
        int qu;cin>>qu;
        if(qu==1)sw++;
        else{
            int f;char c;cin>>f>>c;
            if(sw%2 == 0){
                if(f == 1)s1 = s1+c;
                if(f == 2)s2 = s2+c;
            }
            if(sw%2 == 1){
                if(f == 1)s2 = s2+c;
                if(f == 2)s1 = s1+c;
            }
        }
    }
    if(sw%2 == 0){
      reverse(s1.begin(),s1.end());
       cout << s1+s+s2 << endl;
    }
    else{
        reverse(s.begin(),s.end());
      reverse(s2.begin(),s2.end());
        cout << s2+s+s1  <<endl;
    }
}

Measured memory_bytes: 1620
from collections import deque
from heapq import heapify, heappush, heappop
from copy import deepcopy
N, K = map(int, input().split())
D = deque(map(int, input().split()))
ans = 0

for r in range(1, min(N, K)+1):
    for a in range(0, r+1):
        total = 0
        V = deepcopy(D)
        bag = []
        heapify(bag)
        minus = 0
        b = r-a
        for i in range(a):
            stone = V.popleft()
            total += stone
            heappush(bag, stone)
            if stone < 0:
                minus += 1
        for i in range(b):
            stone = V.pop()
            total += stone
            heappush(bag, stone)
            if stone < 0:
                minus += 1
        for i in range(minus):
            if i == (K-r):
                break
            total -= heappop(bag)
        ans = max(total, ans)

print(ans)

Measured memory_bytes: 59484
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.*;

public class Main {

    //private static Object InputStream;

    public static void main(String args[]) throws IOException {
        // Object input;
       Scanner scan=new Scanner(System.in);
       int K=scan.nextInt();
        int A=scan.nextInt();
        int B=scan.nextInt();
        boolean t=true;
      for(int i=A;i<=B;i++){
          if(i%K==0){
              t=false;
              break;
          }
      }
        if(t){
            System.out.println("NG");
        }
        else{
            System.out.println("OK");
        }
    }

}


Measured memory_bytes: 35776
n, c, k = map(int, input().split())
t = [int(input()) for i in range(n)]
t.sort()
ans = 1
cur = t[0]
cnt = 0
for i in t:
    if i > cur + k or cnt == c:
        ans += 1
        cnt = 1
        cur = i
    else:
        cnt += 1
print(ans)

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

using namespace std;

#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define REV(i,n) for(ll (i) = (n) - 1;(i) >= 0;--i)
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {REP(WW,n)cerr << v[WW] << ' ';cerr << endl << endl;}
#define SHOW2d(v,WW,HH) {REP(W_,WW){REP(H_,HH)cerr << v[W_][H_] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 998244353

typedef long long ll;
typedef pair<ll,ll> P;

vector<vector<P>> v(111111);
ll d[111111];
ll c[222222];
ll color[111111];
ll used[111111];

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

	ll n, m;cin >> n >> m;
	REP(i, n)cin >> d[i];
	REP(i, m){
		ll a, b;cin >> a >> b;
		a--;b--;
		v[a].EB(b, i);
		v[b].EB(a, i);
	}

	queue<ll> q;
	REP(i, n){
		REP(j, v[i].size()){
			int aite = v[i][j].FI;
			int edge_id = v[i][j].SE;
			if(d[i] == d[aite]){
				if(color[i] != 0 && color[aite] != 0)continue;
				if(color[i] == 0){
					if(color[aite] != 0)color[i] = -color[aite];
					else color[i] = 1;
				}
				if(color[aite] == 0)color[aite] = -color[i];
				q.push(i);
				q.push(aite);
				c[edge_id] = d[i];
			}
		}
	}

	while(!q.empty()){
		int id = q.front();q.pop();
		//cout << "id " << id << endl;
		if(used[id])continue;
		used[id] = true;
		REP(i, v[id].size()){
			int aite = v[id][i].FI;
			int edge_id = v[id][i].SE;
			//cout << " " << aite << endl;
			if(used[aite])continue;
			if(d[aite] <= d[id])continue;
			if(color[aite] != 0)continue;
			color[aite] = color[id];
			c[edge_id] = d[aite] - d[id];
			q.push(aite);
		}
	}

	REP(i, n){
		if(!used[i]){
			cout << -1 << endl;
			return 0;
		}
	}

	REP(i, n)cout << (color[i] == 1 ? 'B' : 'W');cout << endl;
	REP(i, m)cout << (c[i] == 0 ? INF : c[i]) << endl;

	return 0;
}


Measured memory_bytes: 19712
#include<bits/stdc++.h>
using namespace std;
signed main(){
  string s;
  int b=0,c=0;
  cin>>s;
  for(int i=0;i<s.size();i++){
    if(s[i]=='C'){
      b=1;
    }
    if(s[i]=='F'&& b==1){
      c=1;
      break;
    }
  }
  if(c==1){
      cout<<"Yes\n";
  }else{
    cout<<"No\n";
  }
}


Measured memory_bytes: 256
#include <algorithm>　　　 //STL通用算法
#include <bitset>　　　　　//STL位集容器
#include <cctype>
#include <cerrno>
#include <clocale>
#include <cmath>
#include <complex>　　　　 //复数类
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>　　　　　 //STL双端队列容器
#include <exception>　　　 //异常处理类
#include <fstream>
#include <functional>　　　//STL定义运算函数（代替运算符）
#include <limits>
#include <list>　　　　　　//STL线性列表容器
#include <map>　　　　　　 //STL 映射容器
#include <iomanip>
#include <ios>　　　　　　//基本输入／输出支持
#include<iosfwd>　　　　　//输入／输出系统使用的前置声明
#include <iostream>
#include <istream>　　　　 //基本输入流
#include <ostream>　　　　 //基本输出流
#include <queue>　　　　　 //STL队列容器
#include <set>　　　　　　 //STL 集合容器
#include <sstream>　　　　//基于字符串的流
#include <stack>　　　　　 //STL堆栈容器　　　　
#include <stdexcept>　　　 //标准异常类
#include <streambuf>　　　//底层输入／输出支持
#include <string>　　　　　//字符串类
#include <utility>　　　　 //STL通用模板类
#include <vector>　　　　　//STL动态数组容器
#include <cwchar>
#include <cwctype>
#define ll long long
using namespace std;
//priority_queue<int,vector<int>,less<int> >q;
int dx[]= {-1,1,0,0,-1,-1,1,1};
int dy[]= {0,0,-1,1,-1,1,1,-1};
const int maxn = 1000+66;
const ll mod=1e9+7;
const ll inf=0x3f3f3f3f3f3f3f3fLL;
int n,m;
int main()
{
    int a;
    string s;
    cin>>a>>s;
    if(a>=3200)cout<<s<<endl;
    else cout<<"red"<<endl;
}

Measured memory_bytes: 256
S = input()
T = ''
count = len(S)
while True:
    if S[0:count].rfind('dream') == count-5 and count-5 != -1:
        T = 'dream' + T
        count = count - 5
    elif S[0:count].rfind('dreamer') == count-7 and count-7 != -1:
        T = 'dreamer' + T
        count = count - 7
    elif S[0:count].rfind('erase') == count-5 and count-5 != -1:
        T = 'erase' + T
        count = count - 5
    elif S[0:count].rfind('eraser') == count-6 and count-6 != -1:
        T = 'eraser' + T
        count = count - 6
    else:
        break
if S == T:
    print('YES')
else:
    print('NO')

Measured memory_bytes: 3452
#include<iostream>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<cstdio>
using namespace std;
long long a,b,ans=65,n;
long long Read() {
	long long x=0,f=1;
	char c=getchar();
	while(c<'0'||c>'9') {
		if(c=='-')f=-1;
		c=getchar();
	}
	while(c>='0'&&c<='9')x=x*10+c-'0',c=getchar();
	return x*f;
}
int main() {
	int x=Read(),y=Read();
	if(x%y)cout<<x;
	else cout<<-1;
	cout<<endl;
	return 0;
}

Measured memory_bytes: 256
N,M=map(int,input().split())
A = [list(map(int, input().split())) for i in range(N)]
C= [list(map(int, input().split())) for i in range(M)]

for i in A:
    ans=[abs(i[0]-j[0])+abs(i[1]-j[1]) for j in C]
    ans_min=min(ans)
    print(ans.index(ans_min)+1)

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <stack>
#include <queue>
#include <utility>
#include <map>
#include <set>
#include <functional>
#include <deque>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const int MOD = 1000000007;

int main(){
    int n,x,y;
    cin >> n >> x >> y;
    x--,y--;

    vector<vector<int>> e(n);

    e[x].push_back(y);
    e[y].push_back(x);

    for(int i = 0;i < n-1;i++){
        e[i].push_back(i+1);
        e[i+1].push_back(i);
    }
    
    map<int,int> mp;


    for(int i = 0;i < n;i++){
        vector<int> d(n,100000000);
        d[i] = 0;
        queue<int> q;
        
        q.push(i);

        while(q.size()){
            int v = q.front();
            q.pop();

            for(int next:e[v]){
                if(d[next] > d[v]+1){
                    d[next] = d[v]+1;
                    q.push(next);
                }
            }
        }

        for(int i = 0;i < n;i++){
            mp[d[i]]++;
        }
    }

    vector<int> ans(n-1);

    for(auto p:mp){
       if(p.first != 0)ans[p.first-1] = p.second/2;
    }

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


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

int main() {
    int N, M;
    cin >> N >> M;
    vector<int> nums(N, 1), can(N, 0);
    can[0] = 1;
    for (int i = 0; i < M; ++i) {
        int a, b; cin >> a >> b; --a, --b;
        if (can[a]) can[b] = 1;
        if (nums[a] == 1) can[a] = 0;
        nums[a]--;
        nums[b]++;
    }
    int res = 0;
    for (int i = 0; i < N; ++i) if (can[i] && nums[i]) ++res;
    cout << res << endl;
}


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

int main(){
    string s;
    cin >> s;
    sort(s.begin(), s.end());
    if(s[0]==s[1]&& s[1]!=s[2]&& s[2]==s[3] ){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
#define int long long
#define gmax(x,y) x=max(x,y)
#define gmin(x,y) x=min(x,y)
#define F first
#define S second
#define P pair
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define rep(i,a,b) for(int i=a;i<b;i++)
#define V vector
#define RE return
#define ALL(a) a.begin(),a.end()
#define MP make_pair
#define PB emplace_back
#define PF emplace_front
#define FILL(a,b) memset(a,b,sizeof(a))
#define lwb lower_bound
#define upb upper_bound
using namespace std;
int cnt[2019];
signed main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	string s;
	int ans=0;
	cin>>s;
	reverse(ALL(s));
	cnt[0]=1;
	int t=0,p=1;
	rep(i,0,s.size()){
		t=(t+p*(s[i]-'0'))%2019;
		p=p*10%2019;
		ans+=cnt[t];
		cnt[t]++;
	}
	cout<<ans;
	RE 0;
}




Measured memory_bytes: 3800
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#define dlog(str) cout << "====" << str << endl;
#else
#define dlog(str)
#endif
#define INF 999999999
#define MOD 1000000007
#define REP(i, n) for(int i = 0, i##_l = (n); i < i##_l; i++)
#define FOR(i, s, e) for(int i = s, i##_l = (e); i < i##_l; i++)
#define LLI long long int
#define _min(a,b) ((a<b)?a:b)
#define _max(a,b) ((a<b)?b:a)
#define chmax(a, b) a = _max(a, b)
#define chmin(a, b) a = _min(a, b)
#define bit(a, shift) ((a>>shift)&1))
#define pm(a) ((a)?1:-1)
#define SORT(v) sort(v.begin(),v.end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
// int 2.14E±9    lli 9.2E±18    double 1.7E±380


int main() {
	cout << fixed << setprecision(10);
	LLI n, m;
	cin >> n >> m;

	if (n == 1 || m == 1) {
		int a = _max(n, m);
		cout << _max(a - 2, 1);
	}
	else {

		cout << _max(n - 2, 0) * _max(m - 2, 0);
	}

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<string>
using namespace std;
int main(){
	string s;
	cin>>s;
	int n=s.size();
	int m=n/2,ans=0;
	for(int i=0;i<m;i++){
		int j=n-1-i;
		if(s[i]!=s[j])
			ans++;
	}
	cout<<ans<<endl;
	return 0;
}

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

using namespace std;
using ll = long long;
ll gcd(ll a, ll b);
int main(){
cin.tie(0);
ll n,result=1,temp=1,ttemp=1;
cin>>n;
if(n==1)cout<<0;
else if(n==2)cout<<2;
else{
for(ll i=1;i<=n;i++){
    result*=10;
    result%=1000000007;
}
for(ll i=1;i<=n;i++){
    temp*=8;
    temp%=1000000007;
}
for(ll i=1;i<=n;i++){
    ttemp*=9;
    ttemp%=1000000007;
}
ttemp*=2;
ttemp%=1000000007;
result=result-ttemp;
result%=1000000007;
result+=temp;
result%=1000000007;
if(result<0)result+=1000000007;
cout<<result;
}
return 0;
}






ll gcd(ll a, ll b){

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

}

Measured memory_bytes: 3608
#include<iostream>
#include<stdio.h>
//#include <bits/stdc++.h>
#include<vector>
#include<float.h>
#include<iomanip>
#include<algorithm>
#include<string>
#include<cstring>
#include<math.h>
#include<cmath>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include <cassert>
#include <cmath>
#include<cstdint>

#define INF 1e9
#define rep(i,n)for(int i=0;(i)<(int)(n);i++)
#define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
#define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
#define vec(type,n) vector<type>(n)
#define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))
#define ALL(a)  (a).begin(),(a).end()

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

vector<int>bitSearch(int bit,int n){
    vector<int>S;
    rep(i,n)if(bit&(1<<i))S.push_back(i);
    return S;
}

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

ll res;
ll solve(ll n,ll x){
    if(x<=0 || n<=0)return res;
    if(n==1){
        return min((int)(x-1),3);
    }
    if(x<pow(2,n+1)-1){
        return solve(n-1,x-1);
    }
    else if(x==pow(2,n+1)-1){
        //res += pow(2,n);
        return pow(2,n);
    }
    else {
        //res += pow(2,n);
        return pow(2,n)+solve(n-1,x-pow(2,n+1)+1);
    }
}
int main(){
    ll n,x;cin>>n>>x;
    cout<<solve(n,x)<<endl;
}

Measured memory_bytes: 256
MOD = 1000000007

def conv(a,b)
  if a < b
    0
  else
    if b > a/2
      b = a - b
    end
    ans = 1
    div = 1
    b.times do |i|
      ans *= a - i
      ans %= MOD
      div *= (i+1)
      div %= MOD
    end
    ans = ans * pow(div, MOD-2)
    ans % MOD
  end
end

def pow(x,n)
  if n == 0
    1
  elsif n % 2 == 0
    pow(x*x%MOD, n/2) % MOD
  else
    x * pow(x, n-1) % MOD
  end
end

n,k = gets.chomp.split(" ").map(&:to_i)
for i in 1..k
  puts (conv(n-k+1,i) * conv(k-1,i-1)) % MOD
end

Measured memory_bytes: 14320
"use strict"
function Main(input){
  input=input.trim().split(/\s+/);
  var N=input.shift()-0;
  input=input.join("").replace(/\s+/g,"").split("");
  var alphabet=("abcdefghijklmnopqrstuvwxyz").split("");
  var counter=alphabet.map(x=>0);
  var j=0;
  for(let i=0;i<N;i++){
    j=alphabet.indexOf(input[i]);
    counter[j]++;
  }
  var M=Math.pow(10,9)+7;
  var reducer=(acc,cur)=>acc*(cur+1)%M;
  var ans=counter.reduce(reducer,1)-1;
  if(ans<0)ans=M;
  console.log(ans);
}

Main(require("fs").readFileSync("/dev/stdin","utf8"));

Measured memory_bytes: 22168
n,m=map(int,input().split())
a=[]
k=[]
for _ in range(m):
  a.append(list(map(int,input().split()))[0])
  k.append(sum(2**(int(i)-1)for i in input().split()))
inf=float('inf')
dp=2**n*[inf]
dp[0]=0
for i in range(2**n):
  for j in range(m):
    dp[i|k[j]]=min(dp[i|k[j]],dp[i]+a[j])
print(dp[-1]if inf!=dp[-1]else-1)

Measured memory_bytes: 45552
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<iomanip>
#include<set>
#include<queue>

using namespace std;

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

	int l=0;
	int r=n;

	for(int i=0;i<m;i++)
	{
		int ll,rr;
		cin >> ll >> rr;
		ll--;

		l=max(l,ll);
		r=min(r,rr);
	}


	cout << max(0,r-l) << endl;




}


Measured memory_bytes: 256
#include <fstream>
#include <numeric>
#include <unordered_set>
#include <sstream>
#include <cassert>
#include <tuple>
#include <iomanip>
#include <random>
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <chrono>
#include <stack>
#include <string>
#include <bitset>
#include <unordered_map>
#include <cstdio>
#include <limits>
#include <vector>
#include <climits>
#include <cstring>
#include <cstdlib>
using namespace std;
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x.size())
#define pb push_back
#define pii pair <int, int>
#define print(x) for(auto it : x) cout << it << ' ';
#define endl "\n" // TODO: remove
#define int long long

const int N = (int)(2e6) + 322;
const int inf = (int)(2e18);
const int mod = (int)(1e9) + 7; // check modulo


int fact[N], inv[N];

inline int mult(int a, int b) {
    return 1ll * a * b % mod;
}

inline int binpow(int a, int n) {
    int res = 1;
    while (n) {
        if (n & 1) {
            res = mult(res, a);
        }
        a = mult(a, a);
        n >>= 1;
    }
    return res;
}

inline int add(int a, int b) {
    if (a + b >= mod) return a + b - mod;
    else return a + b;
}

inline int sub(int a, int b) {
    if (a - b < 0) return a - b + mod;
    else return a - b;
}

inline int getinv(int a) {
    return binpow(a, mod - 2);
}

inline int divide(int a, int b) {
    return mult(a, getinv(b));
}

inline int C(int n, int k) {
    if (n < k) return 0;
    return mult(fact[n], mult(inv[k], inv[n - k]));
}

void init(int lim) {
    fact[0] = 1;
    inv[0] = 1;
    for(int i = 1; i < lim; ++i) {
        fact[i] = fact[i - 1] * i % mod;
        inv[i] = binpow(fact[i], mod - 2);
    }
}


void solve(int test) {
    init(N);
    int k; cin >> k;
    string s; cin >> s;
    int n = sz(s);
    k += n;
    int all = binpow(26, k);
    for(int i = 0; i < n; ++i) {
        all = sub(all, mult(C(k, i), binpow(25, k - i)));
    }
    cout << all;
}

signed main () {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int test = 1;// cin >> test;
    for(int tt = 1; tt <= test; ++tt) {
        solve(tt);
    }


    return 0;
}

Measured memory_bytes: 35492
#include <bits/stdc++.h>
typedef long long ll;
#define REP(i,n) for(int i=0;i<n;i++)
#define ALL(x) (x).begin(),(x).end()
using namespace std;

//素因数分解
vector<pair<ll,int>> factorize(ll n){
    vector<pair<ll,int>>res;
    for(ll i=2;i*i<=n;i++){
        if(n%i)continue;
        res.emplace_back(i,0);
        while (n%i == 0)
        {
        n /= i;
        res.back().second++;
        }
        
    }
    if(n != 1) res.emplace_back(n,1);
    return res;
}

void trace(int A[],int N){
    REP(i,N){
        if(i>0)printf(" ");
        printf("%d",A[i]);
    }
    printf("\n");
}


int main(){
    int A,B,C;
    cin >> A >> B;
    bool ans = false;
    for(int i=1;i<=3;i++){
        int d = A*B*i;
        if(d%2 != 0)ans = true;
    }
    if(ans)cout << "Yes" <<endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,i;
	cin>>n;
	i=n%10;
	if(i==0||i==1||i==6||i==8)
	{
		cout<<"pon";
	}
	else if(i==3)
	{
		cout<<"bon";
	}
	else
	{
		cout<<"hon";
	}
	return 0;
}

Measured memory_bytes: 3624
n = gets.chomp.to_i
    s = gets.chomp
    az = 'ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ'

    for i in 0..(s.length-1)
        s[i] = az[az.index(s[i])+n]
    end

    puts s


Measured memory_bytes: 3836
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define rep(i,n) for(ll i=0;i<n;i++)
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define fi first
#define se second

template<typename T> inline bool chmax(T &a, T b){if(a<b){a=b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if(a>b){a=b;return true;}return false;}
template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){int len=d.size();rep(i,len){s<<d[i];if(i<len-1) s<<" ";}return s;}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){int len=d.size();rep(i,len){s<<d[i]<<endl;}return s;}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){s<<"{"<<endl;for(auto itr=m.begin();itr!=m.end();++itr){s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;}s<<"}"<<endl;return s;}

const ll mod=1e9+7;
const ll inf=1e17;
const int INF=1e9;
const double PI=acos(-1);
const double EPS=1e-10;

int main(){
	cin.tie(0);ios::sync_with_stdio(false);
	int x,y,z;
	cin>>x>>y>>z;
	swap(x,y);
	swap(x,z);
	cout<<x<<' '<<y<<' '<<z<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
#define int long long
signed main() {
	int d, n, m; cin >> n >> m >> d;
	double dp = (n - d)*2;
	if (d == 0)dp = n;
	dp /= n * n;
	printf("%.10f\n", dp*(m - 1));
}

Measured memory_bytes: 256