akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <random>
#include <chrono>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long int
#define ld long double
#define ull unsigned ll
#define pb push_back
#define popb pop_back
#define mt make_tuple
#define eb emplace_back
#define mp make_pair
#define ff first
#define ss second
#define pii pair <int,int>
#define piii pair <pii,int>
#define piiii pair <pii,pii>
#define pll pair <ll,ll>
#define plll pair <pair <ll, ll>, ll>
#define rep0(i,n) for(ll i=0;i<(ll)n;i++)
#define rep1(i,n) for(ll i=1;i<=(ll)n;i++)
#define rep(i,x,y) for(ll i=(ll)x;i<=(ll)y;i++)
#define reprev(i,n) for(ll i=(ll)n;i>=0;i--)
#define all(c) c.begin(),c.end()
#define print(a) rep0(i,a.size()) cout << a[i] << " "
#define hi() cout << "\nHello, I am error. Can you find me? :):):)\n"
#define Randomize mt19937 rng(chrono::steady_clock::now().time_since_eppoch().count())
 
using namespace __gnu_pbds;
using namespace std;
using ordered_set =  tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>;

// FOR DEBUGGING
vector<string> vec_splitter(string s) {
	s += ',';
	vector<string> res;
	while(!s.empty()) {
		res.push_back(s.substr(0, s.find(',')));
		s = s.substr(s.find(',') + 1);
	}
	return res;
}

void debug_out(
vector<string> __attribute__ ((unused)) args,
__attribute__ ((unused)) int idx, 
__attribute__ ((unused)) int LINE_NUM) { cerr << endl; } 
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
	if(idx > 0) cerr << ", ";
	else cerr << "Line(" << LINE_NUM << ") ";
	stringstream ss; ss << H;
	cerr << args[idx] << " = " << ss.str();
	debug_out(args, idx + 1, LINE_NUM, T...);
}

#ifndef XOX
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
#else
#define debug(...) 42
#endif

const int mod = 1e9+7;
const long double pi = acos(-1);
const ll INF = 1e15;

ll power(ll x, ll y){
	x %= mod;
	ll ans = 1;
	while(y){
		if(y&1) ans = (ans*x)%mod;
		y /= 2;
		x = (x*x)%mod;
	}
	return ans;
}

void solve(){

	ll n;
	cin >> n;
	ll ans = 0;
	rep1(i,n){
		ll tmp = n/i;
		tmp *= (i + (n-n%i));
		tmp /= 2;
		ans += tmp;
	}
	cout << ans;

	return;
}

int main(){

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

	int TC = 1,t = 0;
	// cin >> TC;
	while(t++ < TC){
		// cout << "Case #" << t << ": ";
		solve();
		// cout << "\n";
	}

	cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";

	return 0; 
}

Measured memory_bytes: 3832
N = gets.to_i
S, P= N.times.map{ gets.strip.split }.transpose
P.map!(&:to_i)

result = []
for var in  S.uniq.sort do
    foo = P.select{ |x| S[P.index(x)] == var }.sort.reverse
    foo.each{ |y| result.push(y) }
end

result.each do |z|
    puts P.index(z) + 1
end

Measured memory_bytes: 1788
#include <bits/stdc++.h>
#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 Graph vector<vecctor<ll>>
#define pairs vector<pair<ll,ll>>
#define pb push_back



using namespace std;
using ll = long long;
const ll INF = 1e18;
const double PI = acos(-1);

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

const ll mod = 1e9+7;
const ll inf = 1e6;




int main(void)
{
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
    ll n;
    cin >> n;
    vector<vector<ll>>g(n);
    vector<ll>col(n);
    vector<pair<ll,ll>>inp(n-1);
    rep(i,n-1){
        ll a,b;
        cin >> a >> b;
        --a;--b;
        ll tmp = max(a,b);
        a = min(a,b);
        b = tmp;
        g[a].pb(b);
        g[b].pb(a);
        inp[i] = make_pair(a,b);
    }
    queue<ll>que;
    map<pair<ll,ll>,ll>ans;
    vector<ll>done(n,false);
    que.push(0);
    ll k_ans = 0;
    while(!que.empty()){
        ll x = que.front();que.pop();
        done[x] = true;
        ll num = 1;
        for(ll k : g[x]){
            if(done[k])continue;
            if(col[x] == num)++num;
            col[k] = num;
            que.push(k);
            ll a = max(x,k);
            ll b = min(x,k);
            ans[make_pair(b,a)] = num;
            k_ans = max(k_ans,num);
            ++num;
        }

    }

    cout << k_ans << endl;
    rep(i,n-1){
        cout << ans[inp[i]] << endl;
        //cerr << "ペアの方は:" << inp[i].first << "and" << inp[i].second << endl;
    }
    //cerr << ans[make_pair(0,1)] << endl;

    return 0;
}


Measured memory_bytes: 18676
N=int(input())
A=[]
for i in range(N):
    A.append(i+1)
s=1
while 3*s<=N:
    A[3*s-1]=0
    s=s+1
s=1
while 5*s<=N:
    A[5*s-1]=0
    s=s+1
sum=0
for i in range(N):
    sum+=A[i]
print(sum)

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

using namespace std;

#define debug(n) cerr << #n << ':' << n << endl;
#define dline    cerr << __LINE__ << endl;

using ll = long long;
template<class T, class U> using P = pair<T,U>;
template<class T> using Heap = priority_queue<T>;
template<class T> using heaP = priority_queue<T,vector<T>,greater<T>>;
template<class T,class U> using umap = unordered_map<T,U>;
template<class T> using uset = unordered_set<T>;

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

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

template<class T, size_t N, class U>
void Fill(T (&a)[N], const U&v){
    fill((U*)a,(U*)(a+N),v);
}

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

template<long long mod>
class modint{
private:
  long long num;
  long long extgcd(long long a, long long b, long long&x, long long&y)const {
    long long d = a;
    if(b != 0){d = extgcd(b, a%b, y, x);  y -= (a/b) * x;}
    else{x = 1; y = 0;}
    return d;
  }
  long long modinverse()const{
    long long x, y;
    extgcd(num, mod, x, y);
    return (mod + x%mod)%mod;
  }
public:
  modint():num(0){}
  modint(const long long x):num((x < 0?(x+mod):x)%mod ){}
  friend modint operator+(const modint&a, const modint&b)
  {    return modint(a.num + b.num);  }
  friend modint operator-(const modint&a, const modint&b)
  {    return modint(a.num - b.num);  }
  friend modint operator*(const modint&a, const modint&b)
  {    return modint(a.num * b.num);  }
  friend modint operator/(const modint&a, const modint&b)
  {    return modint(a*b.modinverse());  }
  friend ostream& operator<<(ostream&os, const modint&a){
    os << a.num;
    return os;
  }
};

int main(){
  int n; cin >> n;
  vector<int> d(n);
  vector<int> cnt(n,0);
  int maxn = 0;
  for(int i = 0; i < n; ++i){
    int x; cin >> x;
    if((x == 0 && i != 0) || (x != 0 && i == 0)){
      cout << 0 << endl;
      return 0;      
    }
    ChangeMax(maxn,x);
    cnt[x]++;
  }
  modint<998244353> sum(1);

  for(int i = 1; i <= maxn; ++i){
    modint<998244353> y(1);
    for(int j = 0; j < cnt[i]; ++j){
      y = y*cnt[i-1];
    }
    sum = sum*y;
  }
  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 1024
package main

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

func main() {
	sc := NewScanner()
	a := sc.NextInt()
	b := sc.NextInt()
	c := sc.NextInt()


	if tt(a,b,c) {
		fmt.Println("Yes")

	} else {
		fmt.Println("No")

	}
}

func tt(a int, b int, c int) bool {
	if a == b && b == c && c == a{
		return true
	} else {
		return false
	}
}
// ===============================================

// *** int
func (s *Scanner) NextInt() int {
	v, _ := strconv.Atoi(s.Next())
	return v
}

// *** int64
func (s *Scanner) NextInt64() int64 {
	v, _ := strconv.ParseInt(s.Next(), 10, 64)
	return v
}

// **** float
func (s *Scanner) NextFloat() float64 {
	v, _ := strconv.ParseFloat(s.Next(), 64)
	return v
}

// *** []int 一行読み取って
func (s *Scanner) NextIntArray() []int {
	s.pre()
	start := s.p
	result := []int{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 0)
			result = append(result, int(v))
			start = s.p + 1
		}
	}

	return result
}

// *** string 一行読み読み取って
func (s *Scanner) NextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}

// ======================================================
type Scanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewScanner() *Scanner {
	rdr := bufio.NewReaderSize(os.Stdin, 1000)
	return &Scanner{r: rdr}
}

func (s *Scanner) Next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}

func (s *Scanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}

func (s *Scanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}


Measured memory_bytes: 640
N,M = map(int,input().split())
red = {}
ball = {}
ans = 1
for i in range(N):
    red[i+1] = 0
    ball[i+1] = 1
red[1] = 1
for i in range(M):
    x,y = map(int,input().split())
    if red[x]:
        if ball[x] == 1:
            red[x] -= 1
            ball[x] -= 1
            if red[y] == 0:
                red[y] += 1
                ball[y] += 1
            else:
                ball[y] += 1
                ans -= 1
        else:
            if red[y] == 0:
                ball[x] -= 1
                red[y] += 1
                ball[y] += 1
                ans += 1
            else:
                ball[x] -= 1
                ball[y] += 1
    else:
        ball[x] -= 1
        ball[y] += 1
            
print(ans)


Measured memory_bytes: 24212
#include <algorithm>
#include <bitset>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <stack>
#include <string>
#include <utility>
#include <vector>

#define repd(i, a, b) for (ll i = (a); i < (b); i++)
#define rep(i, n) repd(i, 0, n)
typedef long long ll;

using namespace std;

template <typename T> void output(T, int);
template <typename T> T max(T, T);
int gcd(int a, int b);

int main() {
    // source
    int n, m;
    cin >> n >> m;
    int l[m], r[m];
    rep(i, m) { cin >> l[i] >> r[i]; }
    int l_ans = l[0], r_ans = r[0];

    rep(i, m) {
        l_ans = std::max(l_ans, l[i]);
        r_ans = std::min(r_ans, r[i]);
    }

    int ans = std::max(0, r_ans - l_ans + 1);
    cout << ans << endl;
    return 0;
}

template <typename T> void output(T a, int precision) {
    if (precision > 0) {
        cout << setprecision(precision) << a << "\n";
    } else {
        cout << a << "\n";
    }
}

template <typename T> T max(T a, T b) {

    if (a > b) {
        return a;
    } else {
        return b;
    }
}

template <typename T> T min(T a, T b) {

    if (a < b) {
        return a;
    } else {
        return b;
    }
}

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


Measured memory_bytes: 1024
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <functional>
#include <utility>
#include <tuple>
#include <cctype>
#include <bitset>
#include <complex>
#include <cmath>
#include <array>
using namespace std;
#define INF 0x3f3f3f3f
#define INFLL 0x3f3f3f3f3f3f3f3fLL
#define MOD 1000000007
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pint;
typedef pair<ll,ll> pll;
typedef tuple<int,int,int> tint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<ull> vull;
typedef vector<pint> vpint;
int dx[8]={0,0,-1,1,1,1,-1,-1};
int dy[8]={-1,1,0,0,1,-1,1,-1};
const int SIZE=100050;
//ここまでテンプレ
int main(){
	string S;
	cin>>S;
	int N=S.length();
	//0番目を足しとく
	S='0'+S;
	//1番目は1
	if(S[1]!='1'){
		cout<<-1<<endl;
		return 0;
	}
	//N番目は0
	if(S[N]!='0'){
		cout<<-1<<endl;
		return 0;
	}
	//対称性
	for(int i=0;i<=N;i++){
		if(S[i]!=S[N-i]){
			cout<<-1<<endl;
			return 0;
		}
	}
	//cout<<S<<endl;
	//0が出たら最後の1につける
	cout<<1<<" "<<2<<endl;
	int las=2;
	for(int i=2;i<N;i++){
		cout<<las<<" "<<i+1<<endl;
		if(S[i]=='1')
			las=i+1;
	}
	return 0;
}

Measured memory_bytes: 1660
//بِسْمِ ٱللَّٰهِ ٱلرَّحْمَٰنِ ٱلرَّحِيمِ
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef double db;

#define endl "\n"

const int MOD = 1000000007;


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

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


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

typedef long long ll;

const ll MOD = 1000000007ll;

int occ[100005], arr[100005], n, O;

ll ex(ll a, ll b)
{
	if (!b) return 1;
	ll z = ex(a, b/2); z *= z; z %= MOD;
	if (b&1) { z *= a; z %= MOD; }
	return z;
}

int main()
{
	scanf("%d", &n); n++;
	for (int i = 1;i <= n;i++) occ[i] = -1;
	for (int i = 0;i < n;i++)
	{
		scanf("%d", arr+i);
		if (occ[arr[i]] == -1) occ[arr[i]] = i;
		else O = occ[arr[i]]+n-i-1;
	}
	ll x = n, y = 1;
	for (int i = 1;i <= n;i++)
	{
		if (i <= O+1) printf("%lld\n", (x-y+MOD)%MOD);
		else printf("%lld\n", x);
		x *= (n-i); x %= MOD; x *= ex(i+1, MOD-2); x %= MOD;
		y *= (O-i+1); y %= MOD; y *= ex(i, MOD-2); y %= MOD;
	}
	return 0;
}


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

#define fastio 			ios::sync_with_stdio(0);	cin.tie(0); cout.tie(0);  cout<<fixed;  cout<<setprecision(12);
#define randomINT 		mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define	newl 			cout<<"\n"
#define DISP(as)		for(auto it : as) cout<<it<<" ";newl;
#define all(x)         	(x).begin(),(x).end()
#define mset(x,val)    	memset(x,val,sizeof(x))
#define newl           	cout<<"\n"
#define pb             	push_back
#define mp             	make_pair
#define f 				first
#define s 				second
#define dline          cerr<<"///REACHED///\n";
#define deb1(x)        cerr<<#x<<" = "<<x<<'\n';
#define deb2(x,y)      cerr<<'['<<#x<<','<<#y<<"] = "<<'['<<x<<','<<y<<']'<<'\n';
#define deb3(x,y,z)    cerr<<'['<<#x<<','<<#y<<','<<#z<<"] = "<<'['<<x<<','<<y<<','<<z<<']'<<'\n';

typedef long long 				ll;
typedef long double 			ld;
typedef vector<ll> 				vll;
typedef pair<ll , ll> 			pll;
typedef pair<ld, ld> 			pld;
typedef unordered_map<ll, ll> 	um;
typedef vector<pll> 			vpll;

const ll 	MAX5 	= 	1e+5 + 7;
const ll 	MAX7 	= 	1e+7 + 7;
const ll 	MAXN 	= 	MAX7;
const ll   	INF   	=  	0x7f7f7f7f7f7f7f7f;
const int  	INFi 	=  	0x7f7f7f7f;
const ll 	MOD		=  	1e+9 + 7;

/*vll adj[MAXN];ll visit[MAXN]={};
int dx8[]={0,1,1,1,0,-1,-1,-1}, dy8[]={1,1,0,-1,-1,-1,0,1};
int dx4[]={0,1,0,-1}, dy4[]={1,0,-1,0};
*/
// <------------- Declare Variables Here ------------> //

ll T = 1;
ll n, x, k, m, r;
string s;


// <------------- Implement Functions Here ----------> //



// <------------- Start of main() -------------------> //

void MAIN() {
	cin>> n>> k;
	vll a(n);
	for(ll i=0;i<n;i++) {
		cin >>a[i];
	}
	sort(all(a));
	reverse(all(a));

	ll i=0;
	while(i<n && k) {
		a[i] = 0;
		k--;i++;
	}

	ll sum = 0;
	for(auto it : a) sum += it;
		cout<<sum;
}

int main() {
	fastio; randomINT;
	//cin >> T;
	while (T--) {
		MAIN();
	}
	return 0;
}


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

namespace AtCoder_061A
{
    class Program
    {
        static void Main(string[] args)
        {
            int a, b, c;

            var word = Console.ReadLine().Split();

            a = int.Parse(word[0]);
            b = int.Parse(word[1]);
            c = int.Parse(word[2]);

            if (a <= c && c <= b)
                Console.WriteLine("Yes");

            else Console.WriteLine("No");

            Console.ReadKey();
            
        }
    }
}

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

using namespace std;

#define int long long
#define ar array



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

    int n, k;
    cin >> n >> k;
    vector<int> arr(n);
    vector<int> dp(n);
    for(int i = 0;i < (int)n; i++){
      cin >> arr[i];
      dp[i] = arr[i];
    }    
    int var = 0;
    for(int i = k;i < (int)n; i++){
        /*if(i){
            if(i < k)
                dp[i] = (dp[i]+dp[i-1]);
            else{
                dp[i] = (dp[i]+dp[i-1]) -dp[var];
                var++;
            }    
        }
        cout << dp[i] << " ";*/
        if(arr[i] > arr[var]){
            cout << "Yes\n";
        }else{
            cout << "No\n";
        }
        var++;
    }    
    //cout << "\n";
    /*for(int i = k;i < (int)n; i++){
        if(dp[i] > dp[i-1]){
            cout << "Yes\n";
        }else{
            cout << "No\n";
        }
    }*/
    return 0;
}


Measured memory_bytes: 6364
#include <iostream>

using namespace std;
int main(){
    int a,b,c,k;
    cin >> a >> b >> c >> k;
    int ans = 0;
    ans += min(a,k);
    k -= min(a,k);
    if(k==0){
        cout << ans << endl;
        return 0;
    }
    k -= min(b,k);
    if(k==0){
        cout << ans << endl;
        return 0;
    }
    cout << ans - k << endl;
}

Measured memory_bytes: 3588
#include <bits/stdc++.h>
using namespace std;
int main(){
  vector<int> a(3);
  cin>>a[0]>>a[1]>>a[2];
  sort(a.begin(),a.end());
  int n;
  cin>>n;
  int i;
  for(i=0;i<n;i++)
  a[2]*=2;
  int s=0;
  for(i=0;i<3;i++)
    s+=a[i];
  cout<<s;
  return 0;
}
    

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
 
typedef pair<int, int> p;
 
int main() {
	cin.tie(0);
    ios::sync_with_stdio(false);

    int N, L;
    cin >> N >> L;

    vector<string> S(N);

    for(int i = 0; i < N; i++) cin >> S[i];

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

    for(int i = 0; i < N; i++) cout << S[i];
    cout << endl;
}

Measured memory_bytes: 3636
require 'prime'
class Prime
    def each_divisor(n, &block)
        pf = prime_division(n)
        num = -> { pf.inject(1) { |prod, (_, exp)| prod * exp.succ } }
        Enumerator.new(num) { |y| __each_divisor__(1, pf, &y.method(:<<)) }
                  .tap { |enum| enum.each(&block) }
    end
    private def __each_divisor__(d, ary, &block)
        return yield(d) if ary.empty?

        ary = ary.dup
        prime, exp = ary.pop
        0.upto(exp) { __each_divisor__(d, ary, &block); d *= prime }
    end
end
a=gets.to_i
r=Math.sqrt(a)
prime = Prime.instance
p=prime.each_divisor(a).to_a.sort
x=p.bsearch{|i| i>r or ((i-r).abs/i.abs)<=Float::EPSILON && ((r-i).abs/r.abs)<=Float::EPSILON}
y=a/x
puts x+y-2


Measured memory_bytes: 2552
#>>>>>,+[->+>[>>+<<-]>>+<<,+]>>-<<
#<-<[-]>>>>[<<<+>>>>++++[<<<++++[>++++++++<-]>>>-]<-]
#<[<<->+>[-]]<<[-<+>-]<
#[<<[>[<<]>->[>>]<<<-]>[<<]>
#[>+<[-]]>-[>>+<<-]>>[>>]<<->[<<+>>-]>>[<<+>>-]<<<<-]
#>>[<<<<[-]>->>>-<<]>>+<---------<
#<[>>[+>>]>[<---------<+>>>>]<<<<<-]
#>[<++++++[>++++++++<-]>.[-]]
#++++++[>++++++++<-]>+++++++++.[-]++++++++++
bf Main.sh

Measured memory_bytes: 688
import sys
input = sys.stdin.buffer.readline

def main():
	K,M = map(int,input().split())
	
	def factorize(n):
		fct = []  # prime factor
		b, e = 2, 0  # base, exponent
		while b * b <= n:
			while n % b == 0:
				n = n // b
				e = e + 1
			if e > 0:
				fct.append((b, e))
			b, e = b + 1, 0
		if n > 1:
			fct.append((n, 1))
		return fct
	
	N = 10**6
	MOD = 10**9+7
	fac = [0]*(N+1)
	fac[0],fac[1] = 1,1
	invfac = [0]*(N+1)
	invfac[0],invfac[1] = 1,1

	for i in range(2,N+1):
		fac[i] = (fac[i-1]*i)%MOD

	invfac[-1] = pow(fac[-1],MOD-2,MOD)
	for i in range(N,0,-1):
		invfac[i-1] = (invfac[i]*i)%MOD

	def coef(x,y):
		num = ((fac[x]*invfac[y])%MOD)*invfac[x-y]%MOD
		return num
	
	fl = factorize(M)
	
	ans = 1
	for pr,cnt in fl:
	    ans *= coef(K+cnt-1,K-1)
	    ans %= MOD
	
	print(ans)
	
if __name__ == "__main__":
	main()


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

int main()
{
    int a[2][120];
    int b[120];
    int n,i,j,m,s,max;
    scanf("%d",&n);
    for(i=0;i<2;i++)
        for(j=0;j<n;j++)
    {
        scanf("%d",&a[i][j]);
    }
    for(i=0;i<=101;i++)
          b[i]=0;
          i=0;
    for(s=0,m=0;m<n;i++)
    {
       b[s]=b[s]+a[0][i];
       if(i==m)
       {
           for(i=i;i<n;i++)
           {
               b[s]=b[s]+a[1][i];
           }
           s++;
           m++;
           i=-1;
       }
    }
    max=b[0];
    for(i=0;i<s;i++)
    {
        if(b[i]>max)
            max=b[i];
    }
    printf("%d\n",max);
    return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<cassert>
#include<cctype>
#include<cerrno>
#include<cfloat>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<math.h>
#include<queue>
#include<deque>
#include<stack>
#include<cstdio>
#include<utility>
#include<set>
#include<list>
#include<cmath>
#include<stdio.h>
#include<string.h>
#include<iomanip>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<bitset>
#include<functional>
#include<iterator>
#include<complex>
#include<fstream>
#include<random>
#include<ctype.h>
#include<stdio.h>
using namespace std;
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define REP(i, n) FOR(i, 0, n - 1)
#define NREP(i, n) FOR(i, 1, n)
using ll = long long;
using pii = pair<int, int>;
using PII = pair<ll, ll>;
using piii = pair<pii, pii>;
using Pi = pair<int, pii>;
using Graph = vector<vector<int>>;
const int dx[4] = { 0, -1, 1, 0 };
const int dy[4] = { -1, 0, 0, 1 };
bool check(int x, int y) {
	if (0 <= x && x<55 && 0 <= y && y<55)return true;
	else return false;
}
const ll INF = 1e9 + 7;
int gcd(int x, int y) {
	if (x < y)swap(x, y);
	if (y == 0)return x;
	return gcd(y, x%y);
}
void mul(ll a, ll b) {
	a = a * b % INF;
}
using Graph = vector<vector<int>>;

//iの逆元mod inf
long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
const double PI = 3.14159265358979323846;
const int MAX = 510000;
ll fac[MAX], finv[MAX], inv[MAX];
//テーブルをつくる前処理
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;//mod pにおける1,2,,,nの逆元
	for (int i = 2; i < MAX; ++i) {
		fac[i] = fac[i - 1] * i%INF;
		inv[i] = INF - inv[INF%i] * (INF / i) % INF;
		finv[i] = finv[i - 1] * inv[i] % INF;
	}
}

ll COM(int n, int k) {
	if (n < k)return 0;
	if (n < 0 || k < 0)return 0;
	return fac[n] * (finv[k] * finv[n - k] % INF) % INF;
}
double Euclidean_distance(double x1, double y1, double x2, double y2) {
	return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
}

//素因数分解
map<int, int>prime_factor(int n) {
	map<int, int>res;
	for (int i = 2; i*i <= n; ++i) {
		while (n%i == 0) {
			++res[i];
			n /= i;
		}
	}
	if (n != 1)res[n] = 1;
	return res;
}


ll powmod(ll a, ll k, ll mod) {
	ll ap = a, ans = 1;
	while (k) {
		if (k & 1) {
			ans *= ap;
			ans %= mod;
		}
		ap = ap * ap;
		ap %= mod;
		k >>= 1;
	}
	return ans;
}
ll invi(ll a, ll mod) {
	return powmod(a, mod - 2, mod);
}
#define PI 3.14159265358979323846  // 円周率
//逆元Aを足したときのmodで割った余りは
//+=invi(A)
//Yで割ることはY^(10^9+7)-2を掛けることは同値
///////////////////////////////////////

ll a[200010];
int main() {
	ll n; cin >> n;
	vector<ll>sum;
	sum.push_back(0);
	REP(i, n)cin >> a[i];
	REP(i, n) {
		sum.push_back((sum[i] + a[i])%INF);
	}
	ll ans = 0;
	REP(i, n) {
		ll x = ((sum[n] - sum[i + 1] + INF) % INF)*a[i];
		x %= INF;
		ans += x;
	}
	ans %= INF;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 6956
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    boolean flag = false;
    Scanner sc = new Scanner(System.in);
    while (flag == false) {
      int a = sc.nextInt();
      String op = sc.next();
      int b = sc.nextInt();
      switch (op) {
      case "+":
        System.out.println(a+b);
        break;
      case "-":
        System.out.println(a-b);
        break;
      case "*":
        System.out.println(a*b);
        break;
      case "/":
        System.out.println(a/b);
        break;
      case "?":
        flag = true;
        break;
      }
    }
  }
}



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

int n, m, x;
vector<int> a;

bool IsFeeStation(int pos)
{
	if (pos == 0 || pos == x || pos == n)
	{
		return false;
	}
	for (int i = 0; i < a.size(); i++)
	{
		if (pos == a[i])
		{
			return true;
		}
	}
	return false;
}

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

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

	int cost[2] = { 0, 0};
	int pos = x;
	while (pos != n)
	{
		pos++;
		if (IsFeeStation(pos))
		{
			cost[0]++;
		}
	}
	int cost2 = 0;
	pos = x;
	while (pos != 0)
	{
		pos--;
		if (IsFeeStation(pos))
		{
			cost[1]++;
		}
	}

	cout << (cost[0] > cost[1] ? cost[1] : cost[0]) << endl;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define mod 998244353
#define MOD 1000000007
#define inf 0x3f3f3f3f
#define linf 0x3f3f3f3f3f3f3f3fll
typedef long long ll;
typedef pair<int,int> pii;
typedef unsigned long long ull;
const int maxn=2e5+10;
int n,k;
int A[maxn],B[maxn];
inline bool all()
{
	for(int i=0;i<n;i++)if(A[i]!=n)return 0;
	return 1;
}
struct BIT
{
	int bit[maxn];
	void add(int x,int v)
	{
		x++;
		while(x<maxn)
		{
			bit[x]+=v;
			x+=x&-x;
		}
	}
	int sum(int x)
	{
		x++;
		int ret=0;
		while(x>0)
		{
			ret+=bit[x];
			x-=x&-x;
		}
		return ret;
	}
}tree;
int main()
{
	scanf("%d%d",&n,&k);
//	n=2e5,k=2e5;
	for(int i=0;i<n;i++)
	{
		scanf("%d",&A[i]);
	//	A[i]=0;
	}
	int cnt=0;
	while(k--)
	{
		cnt++;
		for(int i=0;i<n;i++)
		{
			B[i]=tree.sum(n-i);
		//	cout<<n-i-A[i]<<" "<<n-i<<endl;
			tree.add(max(0,n-i-A[i]),1);
		}
		for(int i=0;i<n;i++)
		{
			tree.add(max(0,n-i-A[i]),-1);
		}
		for(int i=n-1;i>=0;i--)
		{
			B[i]+=tree.sum(i);
			tree.add(max(0,i-A[i]),1);
		}
		for(int i=0;i<n;i++)
		{
			tree.add(max(0,i-A[i]),-1);
			B[i]++;
		}
		for(int i=0;i<n;i++)A[i]=B[i];
		if(all())break;
//		cout<<A[0]<<" "<<A[1]<<endl;
	}
//	cout<<cnt<<endl;
//	system("pause");
	for(int i=0;i<n;i++)
	{
		printf("%d ",A[i]);
	}
	return 0;
}

Measured memory_bytes: 6156
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <cstdlib>
#include <climits>

using namespace std;

typedef unsigned long long ull;
typedef long long ll;

ull N;
ull A[300000];

int main (int argc, char const *argv[])
{
  cin >> N;
  for(int i=0;i<3*N;++i) cin >> A[i];
  sort(A,A+3*N);
  ull ans = 0;
  for(int i=N;i<3*N;i+=2) ans+=A[i];
  cout << ans << endl;
  return 0;
}


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

using namespace std;

int main(){
	long long int N;
	cin >> N;
	vector<long long int>A(N);
	long long int sum = 0;
	for( int i = 0; i < N; i++ ){
		cin >> A[i];
		A[i] -= i;
		sum += A[i];
	}
	sum /= N;
	sum -= 100;
	long long int ans = 1LL << 60;
	long long int idxmin = ( 1LL << 40 )*-1, idxmax = ( 1LL << 40 );
	while( idxmin + 2 < idxmax ){
		long long int idx = ( idxmin + idxmax ) / 2;
		long long int memo = 0;
		for( int i = 0; i < N; i++ ){
			memo += abs(A[i] - ( sum + idx ));
		}
		ans = min(memo, ans);
		auto memomemo = memo;
		idx++;
		for( int i = 0; i < N; i++ ){
			memo -= abs(A[i] - ( sum + idx ));
		}
		ans = min(abs(memomemo - memo), ans);
		if( memo > 0 ){
			idxmin = idx;
		} else{
			idxmax = idx;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 1792
/*Function Template*/
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
const int mod = 1000000007;
#define rep(i, n) for(ll i = 0; i < (n); i++)
#define ALL(a)  (a).begin(),(a).end()
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);


ll Len(ll n) {
  ll s=0;
  while(n!=0) s++, n/=10;
  return s;
}


ll Sint(ll n) {
  ll m=0,s=0,a=n;
  while(a!=0) s++, a/=10;
  for(ll i=s-1;i>=0;i--) m+=n/((ll)pow(10,i))-(n/((ll)pow(10,i+1)))*10;
  return m;
}


ll Svec(vector<ll> v){
  ll n=0;
  for(ll i=0;i<v.size();i++) n+=v[i];
  return n;
}


ll GCD(ll a,ll b){
  ll r,tmp;
/*自然数 a > b を確認・入替*/
  if(a<b){
    tmp=a,a=b,b=tmp;
  }
/*ユークリッドの互除法*/
  r=a%b;
  while(r!=0){
    a=b,b=r,r=a%b;
  }
  return b;
}


ll LCM(ll a,ll b){
  ll c=a,d=b,r,tmp;
/*自然数 a > b を確認・入替*/
  if(a<b){
    tmp=a,a=b,b=tmp;
  }
/*ユークリッドの互除法*/
  r=a%b;
  while(r!=0){
    a=b,b=r,r=a%b;
  }
  return c/b*d;
}


ll Factorial(ll n){
  ll m=1;
  while(n>=1) m*=n,n--;
  return m;
}

vector<pair<char,ll>> runlength(string s,vector<pair<char,ll>> p){
  ll x=1;
  if(s.size()==1){
    p.push_back(pair<char,ll>(s[0],1));
    return p;
  }
  for(ll i=0;i<s.size()-1;i++){
    if(s[i]==s[i+1]){
      x++;
      if(i==s.size()-2){
        p.push_back(pair<char,ll>(s[i],x));
      }
    }else{
      p.push_back(pair<char,ll>(s[i],x));
      x=1;
      if(i==s.size()-2){
        p.push_back(pair<char,ll>(s[s.size()-1],x));
      }
    }
  }
  return p;
}



/*↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓*/
int main() {
  IOS;
  ll n;
  cin>>n;
  vector<ll> v(n);
  vector<char> w;
  rep(i,n) cin>>v[i];
  rep(i,n){
    if(i+1==v[i]){
      w.push_back('x');
    }else{
      w.push_back('o');
    }
  }
  ll ans=0;
  string s="";
  rep(i,n){
    s+=w[i];
  }
  /*文字列を種類ごと区切って配列にする*/
  vector<string> vec;
  ll cnt=0,start;
  bool flag=true;
  for(long long int i=0;i<s.size();i++){
    if(flag){
      start=i;
      flag=false;
    }
    if(s[i]==s[i+1]){
      cnt++;
    }else{
      vec.push_back(s.substr(start,cnt+1));
      cnt=0;
      flag=true;
    }
  }
  rep(i,vec.size()){
    if(vec[i][0]=='x'){
      ans+=(vec[i].size()+1)/2;
    }
  }
  cout<<ans<<endl;
 
}

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

using namespace std;

typedef long long ll;
typedef pair< ll, ll > pll;
typedef pair< int, int > pii;

const double pi = 3.14159265358979323846;

#define MOD 1000000007LL
#define PS(p) cout << setprecision(15) << fixed << p << endl;
#define UNIQUE(v) v.erase(std::unique(v.begin(), v.end()), v.end());
#define ALL(c) c.begin(), c.end()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define MT make_tuple
#define TG0 get< 0 >
#define TG1 get< 1 >
#define TG2 get< 2 >
#define F first
#define S second
#define VL vector< ll >

// to_string(123)
// atoi("123"); atoi(s.c_str());
// "abc".size()
// s.find('+') == string::npos
bool skipW[100];

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

  ll H, W;
  cin >> H >> W;

  string hw[H];
  for (ll h = 0; h < H; h++) {
    cin >> hw[h];
  }

  for (ll w = 0; w < W; w++) {
    bool allWhite = true;
    for (ll h = 0; h < H; h++) {
      if (hw[h][w] == '#') {
        allWhite = false;
        break;
      }
    }

    if (allWhite) {
      skipW[w] = true;
    }
  }

  for (ll h = 0; h < H; h++) {
    if (hw[h] == string(W, '.')) {
      // nothing
    } else {
      for (ll w = 0; w < W; w++) {
        if (!skipW[w]) {
          cout << hw[h][w];
        }
      }
      cout << endl;
    }
  }

  return 0;
}


Measured memory_bytes: 256
//A.cpp
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <queue>
#include <stack>
#include <math.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
ll gcd(ll a,ll b){return b!=0?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
const ll mod=1e9+7;

int main(){
  int a,p;
  cin >> a >> p;
  int ans = (3*a + p)/2;
  printf("%d\n", ans);
  return 0;
}


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

int main()
{
    int k;
    cin >> k;
    int l = 0;
    int a[10]{0};
    a[1] = 1;
    while(k--){
        int i;
        for(i = 0; i < l; i++){
            if(a[i] <= a[i + 1] && a[i] != 9) break;
        }
        if(i == l && a[i] == 9){
            i++;
            l = i;
            a[l] = 1;
        }
        else a[i]++;
        for(int j = i - 1; j >= 0; j--) a[j] = max(0, a[j + 1] - 1);
    }
    for(int i = l; i >= 0; i--) cout << a[i];
    cout << endl;
}


Measured memory_bytes: 256
import math as m


a, b, x = map(int, input().split())

if x == b * a**2:
    print(0)

elif x >= b * a**2 / 2:
    y = 2 * (b - x / (a**2))
    print(90 - m.atan(a / y) * 180 / m.pi)
else:
    y = 2 * x / (a * b)
    print(90 - m.atan(y / b) * 180 / m.pi)

Measured memory_bytes: 62488
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
static class Program{
	const int mod=1000000007;
	static void Main(){
		Sc sc=new Sc();
		int n=sc.I;
		int[] a=sc.Ia;
		int lb=0,ub=a.Max()+1,mid=0;
		while(ub-lb>1){
			mid=(ub+lb)/2;
			int[] b=new int[n+1];
			Bit bit=new Bit(n*2+2);
			long p=0,m=((long)n*(n+1))/2;
			bit.Ud(n+1,1);
			for(int i = 0;i<n;i++) {
				b[i+1]=b[i]+(a[i]>=mid?1:-1);
				p+=bit.Get(b[i+1]+n+1);
				bit.Ud(b[i+1]+n+1,1);
			}
			if(p*2<m){ub=mid;}
			else{lb=mid;}
		}
		Console.WriteLine("{0}",lb);
	}
}
public class Bit{
	private int n;
	private long[] bit;
	public Bit(int n){
		this.n=n;
		bit=new long[n+1];
	}
	public void Ud(int a,long p){while(a<=n){bit[a]+=p;a+=a&-a;}}
	public long Get(int n){
		long a=0;
		while(n>0){a+=bit[n];n-=n&-n;}
		return a;
	}
	public long Get2(int m,int n){
		long a=0,b=0;
		while(n>m){a+=bit[n];n-=n&-n;}
		if(n==m){return a;}
		while(n!=m){b+=bit[m];m-=m&-m;}
		return a-b;
	}
	public void Clear(){bit=new long[n+1];}
}

public class Sc{
	public int I{get{return int.Parse(Console.ReadLine());}}
	public long L{get{return long.Parse(Console.ReadLine());}}
	public double D{get{return double.Parse(Console.ReadLine());}}
	public string S{get{return Console.ReadLine();}}
	public int[] Ia{get{return Array.ConvertAll(Console.ReadLine().Split(),int.Parse);}}
	public int[] Ia2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),int.Parse);}}
	public long[] La{get{return Array.ConvertAll(Console.ReadLine().Split(),long.Parse);}}
	public long[] La2{get{return Array.ConvertAll(("0 "+Console.ReadLine()).Split(),long.Parse);}}
	public double[] Da{get{return Array.ConvertAll(Console.ReadLine().Split(),double.Parse);}}
	public string[] Sa{get{return Console.ReadLine().Split();}}
}

Measured memory_bytes: 33436
#include <stdio.h>

int main() {
    int a = 0, b = 0, c = 0;

    scanf("%d %d %d", &a, &b, &c);
    if(a < b && b < c) {
        printf("Yes\n");
    } else {
       printf("No\n");
   }
   return 0;
}


Measured memory_bytes: 2080
import java.util.Scanner;

public class Main {
	  
	public static void main(String args[]) {
		    Scanner scanner = new Scanner(System.in);
		    
		    String a = scanner.next();
		    String b = scanner.next();
		    String c = scanner.next();
		    
		    
		    if(a.substring(a.length()-1).equals(b.substring(0, 1)) 
		    		&&
		    	b.substring(b.length()-1).equals(c.substring(0, 1))) 
		    {
		    	System.out.println("YES");
		    }
		    else
		    {
		    	System.out.println("NO");
		    }	
		    
		    scanner.close(); }
		  }

Measured memory_bytes: 22868
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;

void main_()
{
    ll N;
    cin >> N;
    vector<ll> As;
    As.reserve(N);
    copy_n(istream_iterator<ll>(cin), N, back_inserter(As));

    priority_queue<ll, vector<ll>, greater<ll>> pq(greater<ll>(), move(As));

    auto c1 = pq.top();
    pq.pop();

    ll ans = 1;
    while (!pq.empty()) {
        auto c2 = pq.top();
        pq.pop();
        if (min(c1, c2) * 2 < max(c1, c2)) {
            ans = 1;
        } else {
            ans++;
        }
        pq.push(c1 + c2);
        c1 = pq.top();
        pq.pop();
    }

    cout << ans << endl;
}
int main()
{
    cin.tie(nullptr);
    cout.tie(nullptr);
    ios_base::sync_with_stdio(false);
    main_();
    return 0;
}


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

int main() {
  int k, s;
  cin >> k >> s;
  int cnt = 0;
  for (int i = 0; i <= k; i++) {
    for (int j = 0; j <= k; j++) {
      if (0 <= s - i - j and s - i - j <= k) {
        cnt++;
      }
    }
  }
  cout << cnt << endl;
}

Measured memory_bytes: 256
// Problem : B - Magic 2
// Contest : AtCoder - M-SOLUTIONS Programming Contest 2020
// URL : https://atcoder.jp/contests/m-solutions2020/tasks/m_solutions2020_b
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
#define ll long long
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL)
#define fr(i,a,b) for(int i=a;i<b;i++)
#define frr(i,a,b) for(int i=a;i>=b;i--)
//vector
#define pb push_back
#define vi vector<int>
#define vl vector<ll>
#define pp pop_back
//pair
#define pi pair<int ,int >
#define mk make_pair
#define ff first
#define ss second
//set
#define si set<int>
#define sit set<int>::iterator 
using namespace std;
int main()
{
fast;
int r,b,g;cin>>r>>b>>g;
int k;cin>>k;
while(k>0 && b<=r)
{
	k--;
	b*=2;
}
while(k>0 && g<=b )
{
	k--;
	g*=2;
}
if(b>r && g>b) cout<<"Yes";
else cout<<"No";
return 0;
}

Measured memory_bytes: 3636
# coding: utf-8
# Your code here!
MOD=10**9+7

def matmul(A,B,M): # A,B: 行列
    I,J,K = len(A), len(B[0]), len(B)  
    res = [[0] * J for _ in range(I)]
    for i in range(I):
        for k in range(K):
            for j in range(J):
                res[i][j] += A[i][k]*B[k][j]
                res[i][j] %= M
    return res

def matpow(A,p,M): #A^p mod M
    if p % 2:
        return matmul(A, matpow(A,p-1,M), M)
    elif p > 0:
        b = matpow(A, p//2, M)
        return matmul(b, b, M)
    else:
        return [[1 if i == j else 0 for j in range(len(A))] for i in range(len(A))]

#########################################################################################
#EDPC-R 

#########################################################################################

n,k = [int(i) for i in input().split()]
A = [[int(i) for i in input().split()] for _ in range(n)]

ans = matpow(A,k,MOD)
print(sum(sum(r) % MOD for r in ans) % MOD)


Measured memory_bytes: 44028
#include <bits/stdc++.h>
using namespace std;
#define SC               scanf
#define PF               printf
#define ull              unsigned long long
#define ld               long double
#define D                double
#define F                first
#define S                second
#define pb               push_back
#define pf               push_front
#define MP               make_pair
#define sort_a(a)        sort(a.begin(),a.end());
#define sort_d(a)        sort(a.rbegin(),a.rend());
#define READ(f)          freopen(f, "r", stdin)
#define WRITE(f)         freopen(f, "w", stdout)
#define rev(s)           reverse(s.begin(),s.end())
#define it(it,mp)        for(auto it=mp.begin() ; it!=mp.end() ; it++)
#define IOS              ios_base :: sync_with_stdio(false); cin.tie(NULL);
const int N = 1e5 + 5;
const int inf = 1e9 + 1;
const double eps = 1e-15;
const double EPS = 1e-9;
const double PI = acos(-1.0);
typedef long long int                   ll;
typedef pair<int,int>                   PII;

int main()
{
    IOS
    // READ(0test.txt);
    //WRITE(0out.txt) ;
    ll n, m,a, b,cnt=0;
    cin >> n >> m ;
    ll arr[n+5], k=m ;
    memset(arr,0,sizeof arr);
    for(int i=0 ; i< m ; i++)
    {
        cin >> a >> b ;
        arr[a-1]++;
        arr[b]--;
    }
    if(arr[0]>=m)cnt++;
    for(int i=1;  i< n ; i++){
        arr[i] +=arr[i-1];
        if(arr[i]>=m)cnt++;
    }
    cout<<cnt;

}





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


int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    long long x,k,d; cin >> x >> k >> d;
    x = (long long)fabs(x);
	long long tmp = min(k, x / d);
	k -= tmp, x -= tmp * d;
	if (k % 2)x -= d;
    cout << (long long)fabs(x) << endl;
    return 0;
}


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

#define rep(i, a, b) for (int i = a; i < (int)(b); ++i)
#define rrep(i, a, b) for (int i = b - 1; i >= (int)(a); --i)

using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;

constexpr int MOD = 1000000007;

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

    int h, n;
    cin >> h >> n;

    vector<pair<int, int>> ab(n);

    rep(i, 0, n) {
        int a, b;
        cin >> a >> b;
        ab[i] = make_pair(a, b);
    }

    vi dp(h + 1, INT_MAX);
    dp[0] = 0;
    rep(i, 1, h + 1) {
        rep(j, 0, n) {
            dp[i] = min(dp[i], dp[max(0, i - ab[j].first)] + ab[j].second);
        }
    }

    cout << dp[h] << endl;

    return 0;
}

Measured memory_bytes: 256
# dwacon5th-prelimsA - Thumbnail
def main():
    N = int(input())
    A = tuple(map(int, input().split()))
    avg = sum(A) / N
    D = sorted((abs(avg - a), i) for i, a in enumerate(A))
    print(D[0][1])


if __name__ == "__main__":
    main()

Measured memory_bytes: 3060
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque, OrderedDict
from copy import deepcopy
from functools import lru_cache, reduce
from math import ceil, floor

import heapq
import itertools
import operator


def get_int():
    return int(input())


def get_str():
    return input().strip()


def get_int_list():
    return [int(i) for i in input().split()]


def get_char_list():
    return list(input().strip())


def main():
    n = get_int()
    ls = get_int_list()
    ls.sort()
    max_ = ls.pop(-1)
    if max_ < sum(ls):
        print("Yes")
    else:
        print('No')


if __name__ == '__main__':
    main()


Measured memory_bytes: 38384
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
  string S,T;
  int N,M,X=0,minX=1000;
  cin >> S >> T;
  N=S.size() -T.size()+1;
  M=T.size();
  for(int i=0;i<N;i++){
    for(int j=0;j<M;j++){
      if(S[i+j]!=T[j]){
        X++;
      }
    }
    minX = min(minX,X);
    X=0;
  }
  cout << minX;
}

Measured memory_bytes: 3588
#include <bits/stdc++.h>
using namespace std;
     
int main() {
  int W, a, b;
  cin >> W >> a >> b;
  
  if(b + W < a){
    cout << a - b - W << endl;
    return 0;
  }
  
  if(a + W < b){
    cout << b - a - W << endl;
    return 0;
  }
  
  cout << 0 << endl;
}

Measured memory_bytes: 256
n = gets.chomp.to_i
t, a = gets.chomp.split.map(&:to_i)
arr = gets.chomp.split.map(&:to_i)
sa = 10 ** 8
ind = 0
arr.length.times do |i|
	temp = (a - (t - arr[i] * 0.006)).abs
	if sa > temp
		sa = temp
		ind = i
	end
end
puts ind + 1



Measured memory_bytes: 14288
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <cmath>

using namespace std;

int main(void)
{
    long long A, B, C, D;
    cin >> A >> B >> C >> D;
    int flag = 0;
    while (true)
    {

        if (C > 0)
        {
            C -= B;
            if (C <= 0)
            {
                flag = 1;
                break;
            }
        }
        if (A > 0)
        {
            A -= D;
            if (A <= 0)
            {
                flag = 2;
                break;
            }
        }
    }
    if (flag == 1)
        cout << "Yes\n";
    else if (flag == 2)
        cout << "No\n";
}


Measured memory_bytes: 3576
#include <iostream>
#include <string>
using namespace std;
int main(){
	string n;
	int a;
	cin>>n;
	for(int i=0;i<n.size();++i){
		a+=(n[i]-48);
	}
	if(a==1){
		cout<<10;
		return 0;
	}
	cout<<a;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define ALL(x) (x).begin(), (x).end()
#define REP(i ,n) for(int i = 0; i < (int)(n); i++)
#define pb push_back
typedef vector<int>vint;
typedef vector<ll>vll;
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

int main()
{
  int N;
  cin >> N;
  map<string,int> M;
  REP(i,N){
    string key;
    cin >> key;
    M[key]++;
  }
  int vm = 0;
  for(auto m : M){
    vm = max(vm,m.second);
  }
  for(auto m : M){
    if(vm == m.second){
      cout << m.first << endl;
    }
  }
  
}


Measured memory_bytes: 25216
#include <iostream>
using namespace std;
int main(void){
    
    int N;
    string S;
    
    cin >> N;
    cin >> S;
    
    
    for(int i = 0; i < S.size(); i++){
        int ascii_No = (int)S[i];
        if(ascii_No + N > 90)
            cout << (char)(ascii_No+N-26);
        else
            cout << (char)(ascii_No+N);
    }
    
    cout << endl;
    
}


Measured memory_bytes: 256
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));
    	int[] tmp = new int[6];
    	int i = 0;
    	for (String str = br.readLine(); str != null; str = br.readLine()) {
    		tmp[i++] = Integer.parseInt(str);
    	}
    	final int A = tmp[0];
    	final int E = tmp[4];
    	final int K = tmp[5];
    	
    	boolean communicationAvailable = false;
    	
    	if (E - A <= K) {
    		communicationAvailable = true;
    	}
    	
    	if (communicationAvailable) {
    		System.out.println("Yay!");
    	} else {
    		System.out.println(":(");
    	}
    }
}


Measured memory_bytes: 22612
import sys
from bisect import bisect

def solve():
    input = sys.stdin.readline
    N = int(input())
    A = [int(i) + 1 for i in range(40)]
    B = [0] * 41
    for i, a in enumerate(A):
        B[i+1] = B[i] + a
    count = 0
    k = N
    for i in range(2, N+1):
        if i ** 2 > N: break
        if N % i == 0:
            d = 0
            while k % i == 0:
                d += 1
                k //= i
            count += bisect(B, d) - 1
    if k > 1: count += 1
    print(count)

    return 0

if __name__ == "__main__":
    solve()

Measured memory_bytes: 9228
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int N, x;
    cin >> N >> x;
    int a[N];
    long long sum = 0;
    for (int i = 0; i < N; i++)
    {
        cin >> a[i];
        sum += a[i];
    }
    sort(a, a + N);
    int k = 0;
    if (x > sum)
        cout << N - 1 << endl;
    else if (x == sum)
        cout << N << endl;
    else
    {
        while (x > 0)
        {
            x -= a[k];
            if (x == 0)
                cout << k + 1 << endl;
            if (x < 0)
                cout << k << endl;
            k++;
        }
    }
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define r(x) read(x)
#define rrr(x,y,z) read(x);read(y);read(z)
#define FOR(i,l,r) for(int i=l;i<=r;i++)
using namespace std;
typedef long long LL;
typedef pair<int,int> pt;
const int N=2e5+5;
const int M=2e3+5;
const int INF=0x7fffffff;
const int mod=1e9+7;
const double eps=1e-8;
const double pi=acos(-1);
LL n,m;
double f[N];
double sum[N];
template<class T>
inline void read(T &x)
{
    char c; x=1;
    while((c=getchar())<'0'||c>'9') if(c=='-') x=-1;
    T res=c-'0';
    while((c=getchar())>='0'&&c<='9') res=res*10+c-'0';
    x*=res;
}
int main()
{
    r(n); r(m);
    FOR(i,1,n){
        r(f[i]);
        sum[i]=sum[i-1]+(f[i]+1)/2;
    }
    double ans=0;
    FOR(i,1,n-m+1){
        ans=max(ans,sum[i+m-1]-sum[i-1]);
    }
    printf("%.8f\n",ans);
    return 0;
}

Measured memory_bytes: 3328