akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<int> vi;
typedef vector<long long int> vl;
typedef vector<vector<int>> vvi;
typedef vector<vector<long long int>> vvl;
typedef pair<int, int> pii;
typedef pair<long long int, long long int> pll;
typedef vector<pair<int, int>> vii;
typedef vector<pair<long long int, long long int>> vll;
#define fast() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define test() long long int t; cin >> t; cin.ignore(); while(t--) 
#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define mp make_pair
#define MOD 1000000007
#define SMOD 998244353
#define pq priority_queue
#define all(x) x.begin(),x.end()
#define SP(x) setprecision(x)
#define sp " "
#define inp(a) ll a;cin>>a;cin.ignore()
#define inps(a,b) ll a,b;cin>>a>>b;cin.ignore()
#define out(a) cout<<SP(20)<<a<<endl
#define outs(a,b) cout<<SP(20)<<a<<" "<<b<<endl
#define ins insert
#define er erase
#define lb lower_bound
#define ub upper_bound
#define inpa(a,n) ll a[n]; for(int i=0; i<n; i++){cin>>a[i];}
#define inpv(a,n) vl a; for(int i=0; i<n; i++){inp(x);a.pb(x);}
#define outa(a,n) for(int i=0;i<n;i++){cout<<a[i]<<" ";}cout<<endl;
#define outv(v) for(auto i:v){cout<<i<<" ";}cout<<endl;
set<char> vow = {'a','e','i','o','u','A','E','I','O','U'};
ll xpow(ll n, ll m){if(m==0){return 1;}else{ll x = xpow(n, m/2);if(m&1){return x*x*n;}else{return x*x;}}}
ll xmod(ll a, ll m){return (((a%m)+m)%m);}
ll xmodpow(ll n, ll m, ll y){if(m==0){return 1;}else{ll x = xmodpow(n, m/2, y);if(m&1){return xmod((xmod((xmod(x,y)*xmod(x,y)),y)*xmod(n,y)),y);}else{return xmod((xmod(x,y)*xmod(x,y)),y);}}}

int main(){
	fast();
	ld n, k;
	cin >> n >> k;
	ld ans = 0;
	if(n>=k){
		ans = (n-k+1)/n;
	}
	for(ld i=1; i<=min(k-1,n); i++){
		ld x = 1/n;
		ld y = i;
		while(y<k){
			x/=(ld)2;
			y*=2;
		}
		ans += x;
	}
	out(ans);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	if(abs(c-a)<=d)  cout<<"Yes";
	else{
		if(abs(b-a)<=d && abs(c-b)<=d)  cout<<"Yes";
		else  cout<<"No";
	}
}

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

kion = [abs(T - x * 0.006 - A) for x in H]
kion_dic = {}
for k, i in zip(kion, range(len(H))):
    kion_dic[k] = i
a = sorted(kion_dic)
print(kion_dic[a[0]]+1)

Measured memory_bytes: 3188
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
#include <functional> 
#define ff first 
#define endl "\n"
#define ss second 
#define li list<int>
#define vi vector<int>
#define ll long long int
#define pii pair<int,int>
#define vii vector<pair<int,int> >
#define mp make_pair
#define pb push_back
#define setbits(x) __builtin_popcountll(x)
#define custom  pair<int,pair<int,int> >
using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag,tree_order_statistics_node_update> pbds; 
#define mod 1000000007
ll power(int a,int n,int m){
    ll ans=1;
    while(n>0){
        if(n&1){
            ans=(ans*a)%m;
        }
        n=n>>1;
        a=((a%m)*(a%m))%m;
    }
    return ans;
}
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    int n;
    cin>>n;
    int k;
    cin>>k;
    int arr[n];
    for(int i=0;i<n;i++){
        cin>>arr[i];
    }
    ll dp[n];
    dp[0]=0;
    for(int i=1;i<n;i++){
        dp[i]=LLONG_MAX;
        for(int j=1;j<k+1;j++){
            
            if(j<=i){
                dp[i]=min(dp[i-j]+abs(arr[i-j]-arr[i]),dp[i]);
            }
        }
    }
    cout<<dp[n-1];
    return 0;
}

Measured memory_bytes: 4784
MOD=10**9+7
cnt=0; sum=0; prev=nil; can=true; h=Hash.new(0)
def gs() gets.chomp end
def gi() gets.to_i end
def gsmi() gets.chomp.split.map(&:to_i) end

def desc(ar) ar.sort{|x,y|y<=>x} end##
def min(a,b) a<=b ? a : b end
def max(a,b) a>=b ? a : b end
def sum(ar) ar.inject(:+) end

def C(a,b) b==0||a==b ? 1 : (b=a-b if a/2<b;(a-b+1..a).inject(:*)/(1..b).inject(:*)) end

def puts_yesno(can) puts(can ? 'Yes' : 'No') end
def putsend(s) puts s; exit end
def debug(k,v) puts "#{k}:#{v}" end
########### ( ˘ω˘ )ｽﾔｧ… ###########
n=gi
s=gs.chars
k=gi

tar=s[k-1]
n.times do |i|
  s[i]="*" if s[i]!=tar
end
puts s.join

Measured memory_bytes: 1788
#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() {
    string s;
    cin >> s;
    if (s == "ABC") puts("ARC");
    else puts("ABC");
    return 0;
}

Measured memory_bytes: 3624
#include<iostream>
#include<cstring>
#include<algorithm>
#include<cstdio>
using namespace std;
int main()
{
	string c[100]="0";
	int n=0,j=0;
	cin>>n>>j;
	for(int i=0;i<n;i++)
		cin>>c[i];
	sort(c,c+n);
	for(int i=0;i<n;i++) cout<<c[i];
	return 0; 
}


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

int main()
{
    string num;

    while(true){
        cin>>num;

        int sum=0;

        if(num.size()==1 && num[0]=='0')  break;

        for(int i=0;i<num.size();i++){
            sum += num[i] - '0';
        }
        cout<<sum<<endl;
    }
}


Measured memory_bytes: 3204
# ENV[Z = 'RUBY_THREAD_VM_STACK_SIZE'] || exec( { Z => '50000000' },'ruby',$0)
# readlines.map(&:chomp!).map { |e| e.split.map(&:to_i) }
h, w = gets.split.map(&:to_i)

all = h * w
if w == 1 || h == 1
  puts 1
  exit
end

if h.odd? && w.odd?
  puts all / 2 + 1
else
  puts all / 2
end


Measured memory_bytes: 1788
k=int(input())
s=input()

#if len(s)<=k:
    #  print(s)
    #else:
    #print(s+"...")





#########他人のコピー#########


if len(s)<=k:
      print(s)
else:
    print(s[:k] + '...')
    

#########他人のコピー#########

Measured memory_bytes: 8996
#include<iostream>
#include<cstring>
#include<cstdlib>
#include<cstdio> 
#include<algorithm>
#define ll long long 
using namespace std;
const int maxn=500010,inf=1e9;
int a,b,c,d,e,f;
double ans;
int ans1,ans2;
void read(int &k)
{
	int f=1;k=0;char c=getchar();
	while(c<'0'||c>'9')c=='-'&&(f=-1),c=getchar();
	while(c<='9'&&c>='0')k=k*10+c-'0',c=getchar();
	k*=f;
}
int main()
{
	read(a);read(b);read(c);read(d);read(e);read(f);
	if(a>b)swap(a,b);if(c>d)swap(c,d);
	for(int i=0;i<=f/a/100;i++)
	{
		for(int j=0;j<=f/b/100;j++)
		{
			int sum=i*a+b*j;
			if(sum*100>f)break;
			int mx=min(f-sum*100,sum*e);
			for(int k=0;k<=mx/c;k++)
			{
				for(int l=0;l<=mx/d;l++)
				{
					int sum2=k*c+l*d;
					if(sum2>mx)break;
					if(1.0*sum2/(1.0*(sum*100+sum2))-ans>1e-12||(ans1==0&&ans2==0))
					{
						ans=1.0*sum2/(sum*100+sum2);
						ans1=sum*100+sum2; 
						ans2=sum2;
					}
				}
			}
		}
	}
	printf("%d %d\n",ans1,ans2);
	return 0;
}

Measured memory_bytes: 256
def merge( tS, left, mid, right ):
	global cnt
	n1 = mid - left;
	n2 = right - mid;
	tL = tS[ left : mid ];
	tR = tS[ mid : right ];	
	tL.append( 1000000001 )
	tR.append( 1000000001 )
	i = j = 0
	for k in range( left, right ):
		cnt += 1
		if tL[i] <= tR[j]:
			tS[k] = tL[i]
			i += 1
		else:
			tS[k] = tR[j]
			j += 1


def mergeSort( tS, left, right ):
	if left+1 < right:
		mid = ( left+right )//2
		mergeSort( tS, left, mid )
		mergeSort( tS, mid, right )
		merge( tS, left, mid, right )

n = int( input() )
arrS = [ int( val ) for val in input().split( ' ' ) ]
cnt = 0
mergeSort( arrS, 0, n )
print( " ".join( map( str, arrS ) ) )
print( cnt )

Measured memory_bytes: 102236
using System;

namespace Sample101
{
    class Program
    {
        static void Main(string[] args)
        {
            string s = Console.ReadLine();
            int counter = 0;
            if (s[0] == '1') ++counter;
            if (s[1] == '1') ++counter;
            if (s[2] == '1') ++counter;
            Console.WriteLine(counter);
        }
    }
}

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

using namespace std;

#define MOD 1000000007
typedef long long int ll;

int dp[3001][3001]={0};
int prev[3001][3001];
int curr[3001][3001];

int main(){

	ios_base::sync_with_stdio(false);
	cin.tie(0);
        
	string a,b;
	cin>>a>>b;

	for(int i=1;i<=a.size();i++){
		for(int j=1;j<=b.size();j++){
			if(a[i-1]==b[j-1]){
				dp[i][j]=dp[i-1][j-1]+1;
			}
			else{
				dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
			}
		}
	}

	vector<char>ans;
	int i=a.size();
	int j=b.size();
		while(i&&j){
			if(a[i-1]==b[j-1]){
				ans.push_back(a[i-1]);
				i--;
				j--;
			}
			else{
				if(dp[i-1][j]>dp[i][j-1]){
					i--;
				}
				else{
					j--;
				}
			}
		}


	for(int i=ans.size()-1;i>=0;i--){
		cout<<ans[i];
	}
	cout<<endl;


	return 0;
}

Measured memory_bytes: 36224
#include <iostream>
#include <iomanip>
#include <fstream>
#include <sstream>
#include <string>
#include <cmath>
#include <cstdio>
#include <cctype>
#include <ctime>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <complex>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cwchar>
#include <cwctype>
#include <exception>
#include <locale>
#include <numeric>
#include <new>
#include <stdexcept>
#include <limits>
#include <valarray>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <list>
#include <utility>
#include <bitset>
#include <algorithm>
#include <functional>
#define rep(i, n) for(int i = 0; i < (int)(n); i ++)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i ++)
#define MP make_pair
using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
const int INF = 1e9 + 7;
char ch[100];
int main()
{
	scanf("%s", ch);
	int l = strlen(ch), ans = 0;
	if(l == 1) {
		printf("%s\n", ch);
		return 0;
	}
	for(int i = l - 1; i > 0; i --)
	if(ch[i] != '9') {
		ch[0] --;
		break;
	}
	printf("%d\n", ch[0] - '0' + (l - 1) * 9);
	return 0;
}

Measured memory_bytes: 256
#include <vector>
#include <iostream>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <cmath>

using namespace std;

template<typename T>
istream& operator >> (istream& is, vector<T>& v) {
    for (auto& x : v) {
        is >> x;
    }
    return is;
}

template<typename T>
ostream& operator << (ostream& os, const vector<T>& v) {
    for (auto& x : v) {
        os << x << " ";
    }
    os << "\n";
    return os;
}

bool check(int64_t n, int64_t s, int64_t b) {
    if (b < 2) return false;
    int64_t a = 0;
    while (n) {
        a += n % b;
        n /= b;
    }
    return a == s;
}

int main() {
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);

#ifdef _DEBUG
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    int64_t n, s;
    cin >> n >> s;

    int64_t sqrt_n = sqrt(double(n));
    int64_t min_b = -1;
    for (int64_t b = 2; b <= sqrt_n + 1; ++b) {
        if (check(n, s, b)) {
            if (min_b == -1 || min_b > b) min_b = b;
        }
    }
    {
        int64_t b = n + 1;
        if (check(n, s, b)) {
            if (min_b == -1 || min_b > b) min_b = b;
        }
    }
    if (n <= s) {
        cout << min_b;
        return 0;
    }
    int64_t a = n - s;
    int64_t sqrt_a = sqrt(double(a));
    for (int64_t i = 1; i <= sqrt_a + 1; ++i) {
        if (a % i != 0) continue;
        {
            int64_t b = i + 1;
            if (check(n, s, b)) {
                if (min_b == -1 || min_b > b) min_b = b;
            }
        }
        {
            int64_t b = a / i + 1;
            if (check(n, s, b)) {
                if (min_b == -1 || min_b > b) min_b = b;
            }
        }
    }
    cout << min_b;
}


Measured memory_bytes: 3604
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
using namespace std;
using namespace __gnu_pbds;
using ll = int64_t;
using ld = long double;
using ull = uint64_t;
using pl = pair<ll, ll>;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

ll n;

vector<pl> v, u;

struct Edge {
  ll w, from, to;
};

vector<Edge> edges;

bool cmp(Edge a, Edge b) {
  return a.w < b.w;
}


ll parent[111111], rang[111111];

int find_set (int v) {
	if (v == parent[v])
		return v;
	return parent[v] = find_set (parent[v]);
}
 
void union_sets (int a, int b) {
	a = find_set (a);
	b = find_set (b);
	if (a != b) {
		if (rang[a] < rang[b])
			swap (a, b);
		parent[b] = a;
		if (rang[a] == rang[b])
			++rang[a];
	}
}

int main() {
  ios::sync_with_stdio(0);
  cout.precision(10);

  for (int i = 0; i < 111111;i++) {
	  parent[i] = i;
  }

  cin >> n;
  v.resize(n);
  u.resize(n);

  for (int i = 0; i < n; i++) {
    cin >> v[i].first >> u[i].first;
    v[i].second = u[i].second = i;
  }

  ll anw = 0;

  sort(all(v));
  sort(all(u));

  for (int i = 1; i < n; i++) {
    ll vdist = v[i].first-v[i-1].first;
    ll udist = u[i].first-u[i-1].first;
    edges.push_back({vdist, v[i].second, v[i-1].second});
    edges.push_back({udist, u[i].second, u[i-1].second});
  }


  sort(all(edges), cmp);


  for (Edge e: edges) {
    if (find_set(e.from) != find_set(e.to)) {
      union_sets(e.from, e.to);
      anw += e.w;
    }
  }

 

  cout << anw << endl;
}

Measured memory_bytes: 12528
#include <iostream>
#include<bits/stdc++.h>
#define rep(k,i,n) for(int i=k;i<n;++i)
using namespace std;
int main(void){
    // Your code here!
    int N;
    cin>>N;
    rep(0,i,9){
        rep(i,j,9){
            if(N==(i+1)*(j+1)){
                cout<<"Yes"<<endl;
                return 0;
            }
        }
    }
    cout<<"No"<<endl;
}


Measured memory_bytes: 256
/*
	Name:
	Author: xiaruize
	Date:
*/

#include<bits/stdc++.h>
using namespace std;
#define ull unsigned long long
#define MOD 1000000007
#define ALL(a) (a).begin(), (a).end()
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define ll long long
#define form(i,j,n) for(int i=int(j);i<=int(n);i++)
#define pb push_back
#define mk make_pair
#define pii pair<int,int>
#define pis pair<int,string>
#define sec second

inline int read()
{
    char ch=getchar();
    int x=0,f=1;
    while(ch<'0'||ch>'9'){if(ch=='-') f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9') x=x*10+(ch^48),ch=getchar();
    return x*f;
}

int main()
{
 	ios::sync_with_stdio(false);
	cin.tie(0);
 	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	int x,y,z;
	cin>>x>>y>>z;
	cout<<z<<' '<<x<<' '<<y<<endl;
	return 0;
}

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

using namespace std;

using ll = long long;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int h, w;
    cin >> h >> w;
    vector<string> s(h);
    for (int i = 0; i < h; i++) {
        cin >> s[i];
    }

    vector<int> r, c;
    for (int i = 0; i < h; i++) {
        bool f = false;
        for (int j = 0; j < w; j++) {
            if (s[i][j] == '#') {
                f = true;
                break;
            }
        }

        if (f) {
            r.push_back(i);
        }
    }

    for (int j = 0; j < w; j++) {
        bool f = false;
        for (int i = 0; i < h; i++) {
            if (s[i][j] == '#') {
                f = true;
                break;
            }
        }

        if (f) {
            c.push_back(j);
        }
    }

    for (int i : r) {
        for (int j : c) {
            cout << s[i][j];
        }
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <list>
#include <set>
#include <numeric>

#include <map>
#include <math.h>
#include <iomanip>
#include <stack>
#include <queue>
#include <bitset>

#define INF 100100100

typedef long long int llint;

using namespace std;

typedef pair<int, int>Pii;

int main() {
	char a, b;
	cin >> a >> b;
	if (a == b)puts("H");
	else puts("D");
	return 0;
}

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

#define rep(i,n) for(int i = 0; i < (n); ++i)
#define ll long long
const ll mod = 1e9+7;
int inf = 1000000000; //10e9
 
int main() {

    int n;
    cin >> n;
    vector<int> d(n);
    rep(i,n) cin >> d[i];

    sort(d.begin(),d.end());
    int ans = d[n/2] - d[n/2-1];

    cout << ans << endl;

    return 0;

}

Measured memory_bytes: 3804
import sys
input=sys.stdin.readline
def main():
  n,m=map(int,input().split())
  a=[0 for i in range(m)]
  b=[0 for i in range(m)]
  c=[[] for i in range(m)]
  for i in range(m):
    a[i],b[i]=map(int,input().split())
    c[i]=list(map(int,input().split()))
  
  dp=[float("inf") for i in range(2**n)]
  dp[0]=0
  for i in range(m):
    now=0
    for j in c[i]:
      jj=1<<j-1
      now=now|jj
    for k in range(2**n):
      kk=k|now
      dp[kk]=min(dp[kk],dp[k]+a[i])
    

  if dp[-1]==float("inf"):
    print(-1)
  else:
    print(dp[-1])
    
if __name__ == '__main__':  
  main()
    

Measured memory_bytes: 3440
#include<bits/stdc++.h>
#define LL long long int 
#define LD long double
#define PI 3.14159265358979323846
#define MOD ((LL)1e9+7)
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
const LL N=1e5+10;
vector<LL>A(N),dp(N);
vector<bool>f(N);
LL n,k;


LL DP(LL I)
{
	if(f[I])return dp[I];
	
	if(I==1)dp[I]=0;
	else
	{
		dp[I]=1e18;
		for(LL j=1;j<=k && I-j>=1;j++)
		dp[I]=min(dp[I],DP(I-j)+abs(A[I]-A[I-j]));
	}
	f[I]=true;
	return dp[I];
	
}

int main()
{
	IOS
	cin>>n>>k;
	for(LL i=1;i<=n;i++)cin>>A[i];
	/*
	dp[1]=0;
	for(LL i=2;i<=n;i++)
	{
		LL d=1e18;
		for(LL j=1;j<=k && i-j>=1 ;j++)
		d=min(d,abs(A[i]-A[i-j])+dp[i-j]);
		dp[i]=d;
	}
	cout<<dp[n]<<endl;*/
	
	cout<<DP(n)<<endl;
		
	
	
}
			
				
			
	
	
	
			
		



Measured memory_bytes: 9600
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] abcd = br.readLine().split(" ");
        int a = Integer.parseInt(abcd[0]);
        int b = Integer.parseInt(abcd[1]);
        int c = Integer.parseInt(abcd[2]);
        int d = Integer.parseInt(abcd[3]);
        
        int ans = Math.min(b, d) - Math.max(a, c);
        System.out.println(Math.max(ans, 0));
    }
}


Measured memory_bytes: 21204
#pragma GCC optimize ("O3")
// #pragma GCC target ("avx")
#include<stdio.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<string.h>

#ifdef LOCAL
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define NDEBUG
#define eprintf(...) do {} while (0)
#endif
#include<cassert>

using namespace std;

typedef long long LL;
typedef vector<int> VI;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define EACH(i,c) for(__typeof((c).begin()) i=(c).begin(),i##_end=(c).end();i!=i##_end;++i)

template<class T> inline void amin(T &x, const T &y) { if (y<x) x=y; }
template<class T> inline void amax(T &x, const T &y) { if (x<y) x=y; }
template<class Iter> void rprintf(const char *fmt, Iter begin, Iter end) {
    for (bool sp=0; begin!=end; ++begin) { if (sp) putchar(' '); else sp = true; printf(fmt, *begin); }
    putchar('\n');
}

LL N, M;

void MAIN() {
    scanf("%lld%lld", &N, &M);
    LL ans = (N*M+1)/2;
    if (N == 1 || M == 1) ans = 1;
    printf("%lld\n", ans);

}

int main() {
    int TC = 1;
//    scanf("%d", &TC);
    REP (tc, TC) MAIN();
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <map>
#include <utility>
#include <cmath>

long long h, w;
int n;
std::map<std::pair<long long, long long>, long long> data;
long long ans[15];
int main()
{
	std::cin >> h >> w >> n;
	for (int i = 0; i < n; ++i) {
		long long a, b;
		std::cin >> a >> b;

		for (int j = -2; j <= 0; ++j)
			for (int k = -2; k <= 0; ++k) {
				auto nx = b + j, ny = a + k;
				if (nx <= 0 || nx > w || ny <= 0 || ny > h)
					continue;
				if (nx + 2 <= 0 || nx + 2 > w || ny + 2 <= 0 || ny + 2 > h)
					continue;
				++data[{nx, ny}];
			}
	}

	for (auto& d : data) {
		++ans[d.second];
	}

	ans[0] = (w - 2)*(h - 2) - data.size();
	for (int i = 0; i < 10; ++i)
		std::cout << ans[i] << std::endl;

	return 0;
}


Measured memory_bytes: 56448
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
#define tr(container, it) \
        for (auto it = container.begin(); it != container.end(); it++)
#define scontains(c, x) ((c).find(x) != (c).end())   //O(log n)
#define contains(c, x) (find((c).begin(),(c).end(),x) != (c).end()) //O(n)
#define pll pair<ll,ll>
#define pii pair<int,int>
#define mll map<ll,ll>
#define intv(x, a, b)((x)>=a && (x)<=b)
#define  rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define  _for(i, end) for (__typeof(end) i = 0; i < (end); i += 1)
#define all(x) (x).begin(),(x).end()
//#define len(array)  (sizeof(array)/sizeof((array)[0]))
#define what_is(x) cerr << #x << " is " << x << endl;
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
#define mod(x, m) ((((x) % (m)) + (m)) % (m))
const double PI = 2 * acos(.0);
const int INF = 0x3f3f3f3f;
const ll LLINF = 1000000000000000005LL;;
const ll MOD = (ll) (1e9) + 7;
void _mod(ll &x){x = mod(x, MOD);}
//const ll MOD = (ll) 998244353 ;
const double EPS = 1e-10;

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


//#define int ll

class CBackAndForth {
public:
        int sx,sy,tx,ty;
void solve(std::istream& cin, std::ostream& cout) {
    cin >> sx >> sy >> tx >> ty;
    int dx = tx -  sx, dy = ty - sy;
    _for(i,dy)cout << 'U';
    _for(i,dx)cout << 'R';
    _for(i,dy)cout << 'D';
    _for(i,dx)cout << 'L';
    cout << 'L';
    _for(i,dy+1)cout << 'U';
    _for(i,dx+1)cout << 'R';
    cout << 'D';
    cout << 'R';
    _for(i,dy+1)cout << 'D';
    _for(i,dx+1)cout << 'L';
    cout << 'U';

}
};


#undef int
int main() {
	CBackAndForth solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 256
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashSet;

public class Main {

	public static void main(String[] args) throws IOException {

		char c_buf[] = new char[128];
		InputStreamReader isr = new InputStreamReader(System.in);
		Checker checker = new Checker();
		
		while (!checker.isFull()) {
			isr.read(c_buf);
			if (!checker.add(c_buf)) {
				break;
			}
		}
		
		if (checker.isFull()) {
			System.out.println("None");
		} else {
			System.out.println(checker.getAnser());
		}
	}

}

class Checker {
	private final HashSet<Character> pre = new HashSet<>();

	public boolean add(char[] chars) {
		for (char c : chars) {
			if (c < 'a' || 'z' < c) {
				return false;
			}
			pre.add((Character) c);
		}
		return true;
	}

	public boolean isFull() {
		return pre.size() == 26;
	}

	public Character getAnser() {
		for (char c = 'a'; c <= 'z'; c++) {
			if (!pre.contains((Character) c)) {
				return (Character) c;
			}
		}
		return null;
	}
}


Measured memory_bytes: 23252
N = int(input())
A, B = [], []
for _ in range(N):
    a, b = list(map(int, input().split()))
    A.append(a)
    B.append(b)
A.sort()
B.sort()
if N%2 != 0:
    k = int(N/2)
    ans = B[k] - A[k] + 1
else:
    k = int(N/2)
    a, b = A[k]+A[k-1], B[k]+B[k-1]
    ans = b - a + 1
print(ans)


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

int main() {
	int N;	// 正整数の個数.
	cin >> N;
	int A[200];	// 正整数.
	for (int i = 0; i < N; i++) {
		cin >> A[i];
	}

	int answer = 0;
	while (true) {
		bool bOK = true;
		for (int i = 0; i < N; i++) {
			if (A[i] % 2 != 0) {
				bOK = false;
				break;
			}
		}
		if (!bOK) {
			break;
		}
		answer++;
		for (int i = 0; i < N; i++) {
			A[i] /= 2;
		}
	}
	cout << answer << endl;
}

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

int main() {
    int a, b;
    cin >> a >> b;
    if (a % 3 == 0 || b % 3 == 0 || (a + b) % 3 == 0) {
        cout << "Possible" << endl;
    } else {
        cout << "Impossible" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
#include <string>
#include <climits>
#include <iomanip>
#include <algorithm>
#include <queue>
#include <map>
#include <tuple>
#include <iostream>
#include <deque>
#include <array>
#include <set>
#include <functional>
#include <memory>


int main() {
	int n, l; std::cin >> n >> l;
	if (l + 1 - 1  > 0) {
		auto result = 0;
		for (auto i = 2; i <= n; ++i) {
			result += l + i - 1;
		}
		std::cout << result << std::endl;
	}
	else if (l + n - 1 < 0) {
		auto result = 0;
		for (auto i = 1; i < n; ++i) {
			result += l + i - 1;
		}
		std::cout << result << std::endl;
	}
	else {
		auto result = 0;
		for (auto i = 1; i <= n; ++i) {
			result += l + i - 1;
		}
		std::cout << result << std::endl;
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <ctype.h>
#include <math.h>
using namespace std;


int main(){
    int a,b;
    cin>>a>>b;
    if(a>=10||b>=10){
        cout<<-1<<endl;
    }
    else{
        cout<<a*b<<endl;
    }
}


Measured memory_bytes: 384
#include <string>
#include <iostream>

using namespace std;

const int dp[10] = { 1, 9, 36, 84, 126, 126, 84, 36, 9, 1 };

int solve(string S)
{
	int sum = 0;

	for (int i = 0; i < 10; i++)
	{
		sum += (S[i] - 48) * dp[i];
	}
	
	return sum % 10;
}

int main()
{
	string S;

	while (cin >> S)
	{
		cout << solve(S) << endl;
	}

	return 0;
}

Measured memory_bytes: 3160
#include <iostream>
#include <vector>

using namespace std;

int main()
{
	int n;
	cin >> n;
	vector<double> a(n);
	double tmp;
	int count = 0;
	for (int i = 0; i < n; i++)
	{
		cin >> a[i];
	}
	for (int i = 0; i < n; i++)
	{
		for (int j = n - 1; j > i; j--)
		{
			if (a[j - 1] > a[j])
			{
				tmp = a[j];
				a[j] = a[j - 1];
				a[j - 1] = tmp;
				count++;
			}
		}
	}
	for (int i = 0; i < n; i++)
	{
		cout << a[i];
		if (i == n - 1)
		{
			cout << endl;
		}
		else
		{
			cout << " ";
		}
	}
	cout << count << endl;
}


Measured memory_bytes: 3288
using System;

namespace AOJ.Volume1
{
    public class EyeTest
    {
        public static int Main()
        {
            int a_left = 0, a_right = 0;
            int b_left = 0, b_right = 0;
            int c_left = 0, c_right = 0;
            int d_left = 0, d_right = 0;

            while (true)
            {
                string input = Console.ReadLine();
                if (string.IsNullOrEmpty(input)) { break; }

                var left = double.Parse(input.Substring(0, input.IndexOf(' ')));
                var right = double.Parse(input.Substring(input.IndexOf(' ') + 1));
                if (left >= 1.1) { a_left++; }
                else if (left >= 0.6) { b_left++; }
                else if (left >= 0.2) { c_left++; }
                else { d_left++; }

                if (right >= 1.1) { a_right++; }
                else if (right >= 0.6) { b_right++; }
                else if (right >= 0.2) { c_right++; }
                else { d_right++; }
            }

            Console.WriteLine(string.Format("{0} {1}", a_left, a_right));
            Console.WriteLine(string.Format("{0} {1}", b_left, b_right));
            Console.WriteLine(string.Format("{0} {1}", c_left, c_right));
            Console.WriteLine(string.Format("{0} {1}", d_left, d_right));
            return 0;
        }
    }
}

Measured memory_bytes: 9208
import collections
import itertools

def getint(): return int(input())
def getints(): return list(map(int, input().split()))

grid = [getints() for i in range(3)]


def normalize(grid):
    if not grid:
        return
    line = grid[0]
    mx = min(line)
    for j in range(3):
        line[j] -= mx
    normalize(grid[1:])

normalize(grid)

ok = grid[0] == grid[1] and grid[1] == grid[2]

print("Yes" if ok else "No")


Measured memory_bytes: 3316
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
#define P pair<int,int>
#define PI 3.141592653589793
const int INF = 1001001001;
const ll MX = 1e18;

int  n,m,q;
vector<int> a, b, c, d;
int ans;

void dfs(vector<int> A) {
	if (A.size() == n+1) {
		int now = 0;
		rep(i, q) {
			if (A[b[i]] - A[a[i]] == c[i]) now += d[i];
		}
		ans = max(ans, now);
		return;
	}

	A.push_back(A.back());
	while (A.back() <= m) {
		dfs(A);
		A.back()++;
	}
	return;
}
int main() {
	cin >> n >> m >> q;
	a = b = c = d = vector<int>(q);
	rep(i, q) {
		cin >> a[i] >> b[i] >> c[i] >> d[i];
	}
	dfs(vector<int>(1, 1));
	cout << ans << endl;
}

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


const long long INF = 1LL << 60;

int main()
{
int a,b,c,ans;
cin >> a >> b >> c;
ans = a*b/2;
cout << ans << endl;

    return 0;
}


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

int main() {
	long long N;
	cin >> N;
	vector<string> S(N);
	for (long long i = 0; i < N; i++) {
		cin >> S[i];
	}

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



	long long count = 0;
	for (long j = 0; j < N; j++) {
			
		if (S[j] != S[j + 1]) {
			count++;
		}
	}

	cout << count;
	

	return 0;
}

Measured memory_bytes: 9516
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Convert;
using static System.Math;
using Pair = System.Tuple<int, int>;
using Edge = System.Tuple<int, int, long>;
//using Debug;
//using static System.Globalization.CultureInfo;

class Program
{
    static void Main(string[] args)
    {
        Solve();
        //WriteLine(Solve());
    }
    static int[] nm;
    static int[] ar;
    static int[] cost = new[] { 2, 5, 5, 4, 5, 6, 3, 7, 6 };
    static int[] dp;
    static void Solve()
    {
        nm = Input.ar;
        ar = Input.ar.OrderByDescending(v => v).ToArray();
        dp = Enumerable.Repeat(int.MinValue, nm[0] + 1).ToArray();
        dp[0] = 0;
        for (var i = 2; i <= nm[0]; i++)
            for (var j = 0; j < nm[1]; j++)
                if (i - cost[ar[j]-1] >= 0)
                    dp[i] = Max(dp[i], dp[i - cost[ar[j]-1]] + 1);
        WriteLine(dfs(nm[0]));
    }
    static string dfs(int num)
    {
        for (var i = 0; i < nm[1]; i++)
            if (num - cost[ar[i]-1] >= 0 && dp[num - cost[ar[i]-1]] == dp[num] - 1)
                return ar[i] + dfs(num - cost[ar[i]-1]);
        return "";
    }
}

public class Input
{
    public static string read => ReadLine();
    public  static int[] ar => Array.ConvertAll(read.Split(' '), int.Parse);
    public  static int num => ToInt32(read);
    public static long[] arL => Array.ConvertAll(read.Split(' '), long.Parse);
    public  static long numL => ToInt64(read);
    public static char[][] gred(int h) 
        => Enumerable.Repeat(0, h).Select(v => read.ToCharArray()).ToArray();
    public static int[][] ar2D(int num)
        => Enumerable.Repeat(0, num).Select(v => ar).ToArray();
    public static long[][] arL2D(int num)
        => Enumerable.Repeat(0, num).Select(v => arL).ToArray();
    public const long Inf = (long)1e18;
    public const double eps = 1e-6;
    public  const string Alfa = "abcdefghijklmnopqrstuvwxyz";
    public  const int MOD = 1000000007;
}


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

public class Main {

	public static void main(String args[]) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String str1[] = br.readLine().split("");
		String str2[] = br.readLine().split("");

		int n = str1.length;
		int m = str2.length;

		int dp[][] = new int[n + 1][m + 1];

		for (int i = 0; i < n; i++) {
			for (int j = 0; j < m; j++) {
				if (str1[i].equals(str2[j])) {
					dp[i + 1][j + 1] = Math.max(dp[i + 1][j + 1], dp[i][j] + 1);
				}
				dp[i + 1][j + 1] = Math.max(dp[i + 1][j + 1], dp[i + 1][j]);
				dp[i + 1][j + 1] = Math.max(dp[i + 1][j + 1], dp[i][j + 1]);
			}
		}

		String ans = "";
		int i = n;
		int j = m;
		while (i > 0 && j > 0) {
			if (dp[i][j] == dp[i - 1][j]) {
				--i;
			} else if (dp[i][j] == dp[i][j - 1]) {
				--j;
			} else {
				ans = str1[i - 1] + ans;
				--i;
				--j;
			}
		}

		System.out.println(ans);
	}
}


Measured memory_bytes: 85344
#include <vector>
#include <list>
#include <map>
#include <climits>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
#include <random>
#include <cctype>
#include <complex>
#include <regex>
#include <unordered_map>
#include <string>
#include <algorithm>
#include <cctype>
#include <cstdio>

using namespace std;
int main() {

    int A,B;
    cin>>A>>B;

    cout<<(A-B)+1<<endl;

}




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

typedef long long ll;
using namespace std;

int main() {
    int n, k, r, s, p;
    string t;
    cin >> n >> k >> r >> s >> p >> t;
    string hand = "";
    int score = 0;
    for (int i = 0; i < n; i++) {
        if (i < k) {
            if (t[i] == 'r') {
                hand += 'p';
                score += p;
            } else if (t[i] == 'p') {
                hand += 's';
                score += s;
            } else if (t[i] == 's') {
                hand += 'r';
                score += r;
            }
        } else {
            if (t[i] == 'r') {
                if (hand[i - k] == 'p') {
                    hand += '?';
                } else {
                    hand += 'p';
                    score += p;
                }
            } else if (t[i] == 'p') {
                if (hand[i - k] == 's') {
                    hand += '?';
                } else {
                    hand += 's';
                    score += s;
                }
            } else if (t[i] == 's') {
                if (hand[i - k] == 'r') {
                    hand += '?';
                } else {
                    hand += 'r';
                    score += r;
                }
            }
        }
    }
    cout << score;
    return 0;
} 


Measured memory_bytes: 512
#include <stdio.h>
#include <string.h>

int flag[10];
int cnt;

void foo(int n,int s,int sum,int start){
	int i;

	if(n == 0){
		if(sum == s){
			cnt++;
		}
	}else{
		for(i = start;i < 10;i++){
			if(flag[i] == 0){
				if(s - sum >= i){
					flag[i] = 1;
					foo(n-1,s,sum+i,i+1);
					flag[i] = 0;
				}
			}
		}
	}
}

int main(){
	int n,s;

	memset(flag,0,sizeof(flag));

	while(1){
		scanf("%d %d",&n,&s);
		if(!n && !s){
			break;
		}
		
		cnt = 0;
		foo(n,s,0,0);

		printf("%d\n",cnt);
	}

	return 0;
}

Measured memory_bytes: 600
typedef long long ll;
#include <bits/stdc++.h>

using namespace std;

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

ll n,m;
pair<ll,ll> edges[100];
int dist[100];

int main() {
    std::cin >> n>>m;
    for (int i = 0; i <m; i++) {
        std::cin >> edges[i].first >> edges[i].second;
    }
    ll result =0;
    for (int i = 0; i < m; i++) {
        Fill(dist,1);
        
        dist[edges[i].first]= 0;

        for (int asdf = 0; asdf < n; asdf++) {
            for (int k = 0; k < m; k++) {
                if(i==k)continue;
                dist[edges[k].first] = dist[edges[k].second] = min(dist[edges[k].first],dist[edges[k].second]);
                // std::cout << edges[k].first<< " "<<edges[k].second<<" " <<dist[edges[k].first] << std::endl;
            }
        }
        if(dist[edges[i].second]==1){
            result++;
        }
    }
    std::cout << result << std::endl;
}



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

using namespace std;

int main()
{
    long long int x;
    cin >> x;

    int a,b;
    bool flag = false;

    for( int i = -300; i <= 300;i++)
    {
        for(int j = -300; j <= 300; j++)
        {
            long long int a1 = i * i * i;
            a1 *= (long long int)(i*i);
            long long int b1 = ( j * j * j);
            b1 *= (long long int)( j * j);

            if(a1 - b1 == x)
            {
                a = i;b = j;
                flag = true;
                break;
            }
        }
        if(flag)
            break;
    }

    cout<<a<<" "<<b<<endl;

    return 0;
}

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

int main(){
  int A[3], N;
  N = 0;

  for (int i = 0; i < 3; i++) {
    scanf("%d", &A[i]);
  }
  std::sort(A, A + 3);
  for (int i = 0; i < 2; i++) {
    N += A[i+1] - A[i];
  }

  printf("%d", N);

  return 0;
}


Measured memory_bytes: 128
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

namespace AtCoder
{
	public class Program
	{
		static void Main(string[] args)
		{

			int n = int.Parse(Console.ReadLine());

			int[] monsters = Console.ReadLine().Split().Select(int.Parse).ToArray();

			int min = monsters.Where(p => p > 0).Min();
			while (true) {
				for (int i = 0; i < monsters.Length; i++) {
					if (monsters[i] != min) {
						monsters[i] = monsters[i] % min;
					}
				}
				int tmp = monsters.Where(p => p > 0).Min();
				if (min == tmp) {
					break;
				} else {
					min = tmp;
				}
			}
			Console.WriteLine(min);

		}
	}
}


Measured memory_bytes: 19808
#include <iostream>
#include <string>
#include <stdio.h>
#include <stdlib.h>

using namespace std;



int main() {
	int m, n, tmp, count = 0, total = 0;
	double border;
	int* a;

	cin >> n >> m;

	a = new int[n];

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

	border = (double)total / (4 * m);

	for (int i = 0; i < n; i++) {
		if (a[i] >= border) count++;
	}

	if (count >= m) printf("Yes\n");
	else printf("No\n");

	delete[] a;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
using pll = pair<ll,ll>;
using Graph = vector<vector<ll>>;
#define all(v) v.begin(), v.end()
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep2(i,l,r) for(ll i = (l); i <= (ll)(r); i++)
#define rep3(i,l,r) for(ll i = (l); i >= (ll)(r); i--)
#define dup(x,y) (((x)+(y)-1)/(y)) // x/yの除算の切り上げ
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int inf = 1001001001;
const ll INF = 1LL << 60;
const ll mod = 1000000007; //1000000007;
const ld pi = acos(-1);

// combination c(n+k);で二項係数テーブルをあらかじめ作成
// c(n,k)でnCkを呼び出す
// mint(25).pow(i)で25のi乗を呼び出す
struct mint {
  ll x; 
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }
  
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
};

int main() {
  ll k;
  string s;
  cin >> k >> s;
  ll n=s.size();
  combination c(n+k);
  mint ans=0;
  for(ll i=0; i<=k; i++){
    mint x=mint(26).pow(k-i);
    x*=mint(25).pow(i);
    x*=c(i+n-1,n-1);
    ans+=x;
  }
  cout << ans << endl;
}


Measured memory_bytes: 35572
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;

class Program
{
    static void Main(string[] args)
    {
        var SW = ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
        var (S, W) = (SW[0], SW[1]);

        var ans = (S <= W) ? "unsafe" : "safe";

        WriteLine(ans);
    }
}


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

int main() {
  int A;
  cin >> A;
  
  int H, K;
  H = A / 100;
  K = A - A /100 * 100;

  if (1 <= K && K <= 12){
      if (1 <= H && H <= 12){
          cout << "AMBIGUOUS" << endl;
      }
      else {
          cout << "YYMM" << endl;
      }
  }
  else if (K == 0){
      if (1 <= H && H <= 12){
          cout << "MMYY" << endl;
      }
      else {
          cout << "NA" << endl;
      }
  }
  else {
      if (1 <= H && H <= 12){
          cout << "MMYY" << endl;
      }
      else {
          cout << "NA" << endl;
      }
  }
}

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

S = [0] * (N+1)
for i in range(N) :
    S[i+1] = S[i] + A[i]

leftMiddle = 0
rightMiddle = 2

ans = float('inf')

for middle in range(2, N-1) :
    leftS = S[leftMiddle]
    rightS = S[middle] - leftS
    diff = abs(leftS - rightS)

    # 左側の更新
    for i in range(leftMiddle, middle) :
        leftS += A[i]
        rightS -= A[i]
        if diff > abs(leftS - rightS) :
            leftMiddle += 1
            diff = abs(leftS - rightS)
        else :
            break

    leftS = S[rightMiddle] - S[middle]
    rightS = S[-1] - S[rightMiddle]
    diff = abs(leftS - rightS)

    # 右側の更新
    for i in range(rightMiddle, N) :
        leftS += A[i]
        rightS -= A[i]
        if diff > abs(leftS - rightS) :
            rightMiddle += 1
            diff = abs(leftS - rightS)
        else :
            break

    B = S[leftMiddle]
    C = S[middle] - B
    D = S[rightMiddle] - S[middle]
    E = S[-1] - B - C - D

    diff = max(B, C, D, E) - min(B, C, D, E)
    ans = min(ans, diff)

print(ans)



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

// 総数を1000000007で割った余り
const long long mod = 1e9 + 7;

using ll  = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

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

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }

int func(long long N, vector<long long> A, vector<long long> B,
         vector<long long> C) {
    // cout << fixed << setprecision(8);

    ll sum = 0;
    rep(i, N) { sum += B[i]; }
    for (int i = 0; i < N - 1; i++) {
        if (A[i] == A[i + 1] - 1) {
            sum += C[A[i] - 1];
        }
    }
    cout << sum << endl;

    return 0;
}

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

    long long N;
    scanf("%lld", &N);
    vector<long long> A(N);
    for (int i = 0; i < N; i++) {
        scanf("%lld", &A[i]);
    }
    vector<long long> B(N);
    for (int i = 0; i < N; i++) {
        scanf("%lld", &B[i]);
    }
    vector<long long> C(N - 1);
    for (int i = 0; i < N - 1; i++) {
        scanf("%lld", &C[i]);
    }

    func(N, std::move(A), std::move(B), std::move(C));

    return 0;
}


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

using namespace std;

const long long INF = 1e18;
const int N = 1e5;
const int MOD = 1e9 + 7;

const double PI = acos(-1);


int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    string s;
    cin >> s;
    int ans = 0;
    for (int i = 0; i < s.size() / 2; i++)
        if (s[i] != s[s.size() - i - 1])
            ans++;
    cout << ans;
}

Measured memory_bytes: 256
# forしながらif、ifでないときはforしないので、計算量減
# 初期入力　　２０２０－０７２７　21：50
from collections import Counter
import sys
input = sys.stdin.readline  #文字列では使わない
N = int(input())
*S, =input().strip()
"""
c =Counter(S)
ans =combinations_count(N, 3) -len(c)
"""
count =0
x100=0
x10=0
x1=0
for i in range(10):
    if str(i) not in S:
        continue
    else:
        x100 =S.index(str(i)) +1
        for j in range(10):
            if str(j) not in S[x100:]:
                continue
            else:
                x10 =S[x100:].index(str(j)) +1
                for k in range(10):
                    if str(k) in S[x100 +x10:]:
                        x1 =S[x100+x10:].index(str(k)) +1
                        count +=1
                        #print("aa",i,j,k,"bb",x100,x100+x10,x100+x10+x1)

print(count)

Measured memory_bytes: 9704
import math


def lcm(a, b):
    return (a * b) // math.gcd(a, b)


def main():
    n = int(input())
    As = list(map(int, input().split()))

    lcm_num = lcm(As[0], As[1])
    for i in range(2, n):
        lcm_num = lcm(As[i], lcm_num)

    ans = 0
    for i in range(n):
        ans += (lcm_num-1) % As[i]
    print(ans)


if __name__ == "__main__":
    main()


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

int main(){ 
    int n; cin>>n;
    vector<int> v;
    rep(i,n){
        int tmp;cin>>tmp;
        v.push_back(tmp);
    }
    sort(v.begin(),v.end());
    rep(i,n-1){
        if(v[i]==v[i+1]){
            cout<<"NO"<<endl;
            return 0;
        }
    }
    cout<<"YES"<<endl;
    return 0;
}

Measured memory_bytes: 1400
/* COMPETITIVE PROGRAMMING C++ TEMPLATE */

#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <string>
#include <cmath>
#include <iostream>
#include <stack>
#include <queue>
#include <climits>
#include <iomanip>

#define all(x) x.begin(), x.end()
#define MOD 998244353
#define debug(x) cout << #x << " = " << x << "\n"

const long double PI = 3.141592653589793236L;

typedef long long int ll;
typedef long double ld;

using namespace std;
int gcd(int a, int b)
{
    if (b == 0)
    {
        return a;
    }
    return gcd(b, a % b);
}
void solve()
{
    //code here.
    ll n, d;
    cin >> n >> d;
    ll count = 0;
    vector<ll>a(2 * n);
    for (ll i = 0; i < 2 * n; i++)
    {
        cin >> a[i];
    }
    for (ll i = 0; i < 2 * n; i++)
    {
        ll x = (((a[i]) * (a[i])) + ((a[i + 1]) * (a[i + 1])));
        if (x <= d * d)
        {
            count++;
            //cout << "x=" << x << "  i=" << i << "   count=" << count << endl;
        }
        i++;
    }
    cout << count;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    ll T = 1;
    //cin >> T; // If only one test case then you can comment this line out.

    while (T--)
    {
        solve();
    }
    return 0;
}

Measured memory_bytes: 6364