akhauriyash/Code-Regression huggingface dataset:
//code by lynmisakura.wish to be accepted!
/****************************/
#include<iostream>
#include<iomanip>
#include<math.h>
#include<vector>
#include<string>
#include<stack>
#include<queue>
#include<map>
#include<algorithm>
#include<bitset>
#include <climits>
#include<set>
#include<bitset>
using namespace std;
/***************************/
typedef long long ll;
typedef pair<int,int> pi;
typedef vector<pair<int,int>> vpi;

const long long INF = 1LL << 55;

#define itn int
#define endl '\n'
#define pb push_back
#define mp make_pair
#define ss second
#define ff first
#define mins(x,y) x = min(x,y)
#define maxs(x,y) x = max(x,y)
#define all(x) (x).begin(),(x).end()
#define Rep(n) for(int i = 0;i < n;i++)
#define rep(i,n) for(int i = 0;i < n;i++)
#define rrep(i,n) for(int i = n - 1;i >= 0;i--)
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )
 
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll qp(ll a, ll b) { ll ans = 1; do { if (b & 1)ans = 1ll * ans*a; a = 1ll * a*a; } while (b >>= 1); return ans; }
ll qp(ll a, ll b, int mo) { ll ans = 1; do { if (b & 1)ans = 1ll * ans*a%mo; a = 1ll * a*a%mo; } while (b >>= 1); return ans; }
 
#define _GLIBCXX_DEBUG
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

//mint
const int mod = 998244353;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x(x%mod){}
  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 {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }
 
  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};

/******************************************/


/*****************************************/

int main(void){
   cin.tie(0);
   ios::sync_with_stdio(false);
   
   int a,b;cin >> a >> b;
   if(b == 1){
       cout << 0 << endl;
       return 0;
   }
   cout << 1 + (max(0,b-a) + a-2)/(a-1) << endl;
   return 0;
}


Measured memory_bytes: 256
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <cstdlib>
#include <iomanip>
#define rep(i,x) for(ll i=0;i<x;i++)
#define all(a) (a).begin(),(a).end()
using namespace std;
using ld = long double;
using ll = long long;
const ll INF = 10010010010;
typedef pair<ll, ll> P;
using graph = vector<vector<ll>>;
const ll mod = 1000000007;
ll gcd(ll a, ll b) {//a>b
    if (a < b)swap(a, b);
    if (a % b == 0) return b;
    else return gcd(b, a % b);
}/*フィボナッチテンプレ
ll memo[50];
ll fibo(ll n) {
    if (memo[n] != 0)return memo[n];
    if (n <= 1)return memo[n] = n;
    else return memo[n] = fibo(n - 1) + fibo(n - 2);
}
*/
bool isp(ll n) {
    bool res = true;
    for (ll i = 2; i * i <= n; i++) {
        if (n % i == 0) {
            res = false;
            break;
        }
    }
    return res;
}
int main() {
    ll N;
    cin >> N;
    ll ans = 1;
    for (ll i = 2; i <= N; i++) {
        ll M = N;
        ll cnt = 0;
        if (isp(i)) {
            while (M) {
                M /= i;
                cnt += M;
            }
            ans = ans * (cnt + 1) % mod;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long 
using namespace std;
int main(){
	string s;
	cin>>s;
	ll ans=0,res=0;
	for(ll i=0;i<s.length();i++){
		if(s[i]=='R'){
			ans++;
			res=max(res,ans);
		}
		else{
			ans=0;
		}

	}
	cout<<res<<endl;
}

Measured memory_bytes: 3624
function Main(input) {
	input = input.split("\n");
	//文字列から10進数に変換するときはparseIntを使います
	var x = parseInt(input[0], 10);
	//出力
	console.log('%d', x == 0 ? 1 : 0);
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 29612
n,m=map(int,input().split())
b_list=[True]*(n+1)
for i in range(m):
    a=int(input())
    b_list[a]=False
dp=[0]*(n+1)
dp[0]=1
Mod=10**9+7
for i in range(1,n+1):
    if b_list[i]:
        if i>=2:
            if b_list[i-2]:
                dp[i]=(dp[i]+dp[i-2])%Mod
            if b_list[i-1]:
                dp[i]=(dp[i]+dp[i-1])%Mod
            if not b_list[i-2] and not b_list[i-1]:
                b_list[i]=False
        else:
            dp[i]=dp[0]
    else:
        pass
print(dp[n])


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


int main(){
	int R,G,B,N;
	cin>>R>>G>>B>>N;
	
	int ans = 0;
	
	for(int i=0;i<=3000;i++){
		for(int j=0;j<=3000;j++){
			int x = N-i*R-j*G;
			if(x>=0&&x%B==0){
				ans++;
			}
		}
	}
	
	cout<<ans<<endl;
	
	
	
	return 0;
}


Measured memory_bytes: 256
<?php
// D
fscanf(STDIN, '%d', $n);
$a = array_map('intval', explode(' ', trim(fgets(STDIN))));
for ($i = 0; $i < $n; $i++) {
    if (isset($cnt[$a[$i]])) {
        $cnt[$a[$i]]++;
    } else {
        $cnt[$a[$i]] = 1;
    }
}
$kumi_sum = 0;
foreach ($cnt as $i => $v) {
    $kumi[$i] = $v * ($v - 1) / 2;
    $kumi_sum += $kumi[$i];
}
for ($i = 0; $i < $n; $i++) {
    $ans = $kumi_sum - ($cnt[$a[$i]] - 1);
    echo $ans . PHP_EOL;
}

Measured memory_bytes: 29808
#include<bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)
#define REP2(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(v) (v).begin(),(v).end()
#define INF 2e9
typedef long long ll;

int main()
{
    int n;
    cin>>n;
    vector<int> a(n);
    int c4=0,c2=0,c1=0;
    REP(i,n){
        cin>>a[i];
        if(a[i]%4==0) c4++;
        else if(a[i]%2==0) c2++;
        else c1++;
    }

    bool f=0;
    if(c4>=n/2) f=1;
    else if(c4>=c1) f=1;

    cout<<(f? "Yes":"No")<<endl;
    
	return 0; 
}

Measured memory_bytes: 640
#include <iostream>
#include <numeric>
#include <vector>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <iomanip>
using namespace std;
using ll=long long;
const ll MOD=1000003;
const ll LINF=0x1fffffffffffffff;
const int INF=0x3fffffff;
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define rrep(i,a,b) for(ll i=b-1;i>=a;i--)
#define range(i) (i).begin(),(i).end()
#define rrange(i) (i).rbegin(),(i).rend()
inline ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
inline constexpr int intpow(ll a,ll b){
    if(b==0) return 1;
    ll ans=intpow(a,b/2);
    return ans*ans%MOD*(b&1?a:1)%MOD;
}
inline constexpr int modf(ll n){
    ll ans=1;
    rep(i,0,n) {ans=ans*(n-i)%MOD;}
    return ans;
}
inline long double median(vector<ll> v){
    ll size=v.size();
    sort(v.begin(),v.end());
    if (size % 2 == 1) return v[(size - 1) / 2];
    else return v[(size / 2) - 1] ;
}
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;}
template<class T,class L>ostream& operator << (ostream& os, pair<T,L>& p){os << p.first << " " << p.second;return os;}

int main(){
  ll n,k;
  cin>>n>>k;
  if(k==1) cout<<0;
  else cout<<n-k;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

void solve()
{
	int X, Y;
	cin >> X >> Y;
	if (X % Y == 0)
	{
		cout << -1 << endl;
	}
	else
	{
		cout << X << endl;
	}
}

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

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <functional>
#include <cmath>
#include <complex>
#include <cctype>
#include <cassert>
#include <sstream>
 
using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
 
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
 
typedef long long ll;
typedef complex<double> P;
typedef complex<double> Vec;
typedef pair<int, int> pii;
typedef pair<int, pii> p;
 
#define INF (1<<29)
#define INFL (1ll<<60)
#define EPS (1e-10)
#define PI (acos(-1))
const ll MOD = 1000000007ll;

int main() {
	ll n, m;
	cin >> n >> m;
	ll cnt = (n * 2 + m) / 4;
	
	ll ans = cnt;
	chmin(ans, (m - (cnt - n) * 2) / 2);
	chmin(ans, m / 2);
	
	cout << ans << endl;
	return 0;
}


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

template <class T> using V = vector<T>;

using ll = long long;
using db = double;
using st = string;
using ch = char;
using vll = V<ll>;
using vpll =V<pair<ll,ll>>;
using vst = V<st>;
using vdb = V<db>;
using vch = V<ch>;


#define FOR(i,a,b) for(ll i=(a);i<(ll)(b);i++)
#define rFOR(i,a,b) for(ll i=(b);i>(ll)(a);i--)
#define oFOR(i,a,b) for(ll i=(a);i<(ll)(b);i+=2)
#define bgn begin()
#define en end()
#define SORT(a) sort((a).bgn,(a).en)
#define REV(a) reverse((a).bgn,(a).en)
#define M(a,b) max(a,b)
#define rM(a,b) min(a,b)
#define fi first
#define se second
#define sz size()
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) __lcm(a,b)
#define co(a) cout<<a<<endl;
#define ci(a) cin>>a;



int main() {
  ll n;
    ci(n);
  co(800*n-200*(n/15))
}


Measured memory_bytes: 256
x, y, a, b, c = map(int, input().split())
p = sorted(list(map(int, input().split())), reverse=True)
q = sorted(list(map(int, input().split())), reverse=True)
r = sorted(list(map(int, input().split())), reverse=True)
all = []
for i in range(x):
    all.append(p[i])
for i in range(y):
    all.append(q[i])
for i in range(c):
    all.append(r[i])
all = sorted(all, reverse=True)
res = 0
for i in range(x + y):
    res += all[i]
print(res)

Measured memory_bytes: 22720
#include<iostream>
#include<string>
using namespace std;
int main(void){
	double res_d=0;
	int res_i=0;
	int N;
		cin >> N;
	
	for(int i=0;i<N;i++){
		string h;
		double b;
			cin >> b >> h;
		if(h=="JPY")
			res_i+=(int) b;
		else
			res_d+=b;
	}
	cout << (double) (res_i+res_d*380000.0) << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>

using namespace std;

int n, k;
vector<int> e[2001];
int d[2001][2001];
vector<int> eA, eB;

void dfs(int cur, int from, int root, int curDist)
{
	d[root][cur] = curDist;
	for (int i = 0; i < e[cur].size(); ++i)
	{
		int t = e[cur][i];
		if (t != from)
			dfs(t, cur, root, curDist + 1);
	}
}

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

	cin >> n >> k;

	for (int i = 1; i < n; ++i)
	{
		int a, b;
		cin >> a >> b;
		e[a].push_back(b);
		e[b].push_back(a);
		eA.push_back(a);
		eB.push_back(b);
	}

	for (int i = 1; i <= n; ++i)
		dfs(i, -1, i, 0);

	int bestAns = 0;
	for (int i = 1; i <= n; ++i)
	{
		int cnt = 0;
		for (int j = 1; j <= n; ++j)
			if (2 * d[i][j] <= k)
				cnt++;
		bestAns = max(bestAns, cnt);
	}
	for (int i = 0; i < eA.size(); ++i)
	{
		int a = eA[i];
		int b = eB[i];
		int cnt = 0;
		for (int j = 1; j <= n; ++j)
			if (2 * min(d[j][a], d[j][b]) + 1 <= k)
				cnt++;

		bestAns = max(bestAns, cnt);
	}

	cout << n - bestAns << endl;

	return 0;
}

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

#define rep(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define rng(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define all(x) (x).begin(),(x).end()
#define cAll(x) (x).cbegin(),(x).cend()
#define COUT(x) cout << x << endl
//#define int long long

template<typename T> constexpr auto square(T x) { return (x) * (x); }

typedef long long LL;
typedef unsigned long long ULL;
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<PII> VP;

const int MOD = 1000000007;
const int INF = INT_MAX;

signed main()
{
	int N;
	cin >> N;

	vector<string> s(N);

	for (auto& str : s) {
		cin >> str;
		sort(all(str));
	}

	sort(all(s));
	
	ULL ans = 0;
	ULL add = 1;

	rep(i, N-1) {
		if (s[i] == s[i + 1]) {
			ans += add;
			add++;
		}
		else {
			add = 1;
		}
	}

	COUT(ans);

	return 0;
}


Measured memory_bytes: 7296
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using VI = vector<int>;
using VL = vector<ll>;
template<class T> using PQ = priority_queue<T, vector<T>, greater<T>>;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);++(i))
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);++(i))
#define rFOR(i,a,n) for(int (i)=(n)-1;(i)>=(a);--(i))
#define erFOR(i,a,n) for(int (i)=(n);(i)>=(a);--(i))
#define each(i, a) for(auto &i : a)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
#define out(y,x) ((y) < 0 || h <= (y) || (x) < 0 || w <= (x))
#define line cout << "------------------------\n" 
#define ENDL(i,n) ((i) == (n) - 1 ? "\n" : " ")
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
const long double pi = acos(-1);
const long double eps = 1e-10;
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; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T>inline istream& operator>>(istream& is, vector<T>& v) { for (auto& elemnt : v)is >> elemnt; return is; }
template<class T, class U>inline istream& operator>>(istream& is, pair<T, U>& p) { is >> p.first >> p.second; return is; }
template<class T>inline vector<T> vec(size_t a) { return vector<T>(a); }
template<class T>inline vector<T> defvec(T def, size_t a) { return vector<T>(a, def); }
template<class T, class... Ts>inline auto vec(size_t a, Ts... ts) { return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...)); }
template<class T, class... Ts>inline auto defvec(T def, size_t a, Ts... ts) { return vector<decltype(defvec<T>(def, ts...))>(a, defvec<T>(def, ts...)); }

int main() {
    int n; cin >> n;
    VI a(n); cin >> a;
    int ans = 0;
    FOR(i, 0, n - 1)if (a[i] < a[i + 1])++ans;
    cout << ans << "\n";
}



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

int main(){

    int a;
    cin>>a;
    for(int i = 1; i<=9; i++){
        if((a/i)*i==a && a/i>0 && a/i<10){
            cout<<"Yes";
            return 0;
        }
    }
    cout<<"No";
    return 0;
}

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

using namespace std;

void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

#define rep(i,n) for(int i=0; i<(int)(n); i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

using ll = long long;
using P = pair<ll, ll>;

//constexpr ll mod = 998244353;
constexpr ll mod = 1e9+7;
const double PI = acos(-1.0);
mt19937_64 engine(chrono::steady_clock::now().time_since_epoch().count());

// Mod int library

unordered_map<ll, ll> minvmap;
ll minv(ll a, ll m) {
  auto k = a; auto p = minvmap[a]; if (p != 0) return p;
  ll b = m, u = 1, v = 0;
  while (b) { ll t = a/b; swap(a -= t*b, b); swap(u -= t*v, v); }
  p = (u%m+m)%m; minvmap[k] = p; return p;
}
struct mint {
    ll x;
    mint():x(0){}
    mint(ll x):x((x%mod+mod)%mod){}
    mint& fix() { x = (x%mod+mod)%mod; return *this;}
    mint operator-() const { return mint(0) - *this;}
    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){ (x*=minv(a.x, mod))%=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 operator/(const mint& a)const{ return mint(*this) /= a;}
    bool operator<(const mint& a)const{ return x < a.x;}
    bool operator==(const mint& a)const{ return x == a.x;}
};
istream& operator>>(istream&i,mint&a){i>>a.x;return i;}
ostream& operator<<(ostream&o,const mint&a){o<<a.x;return o;}


int MAXN = 200000;
// factorial
vector<mint> fact(MAXN+1);
void init() {
  fact[0] = 1;
  for(int i=1; i<=MAXN; i++) fact[i] = fact[i-1]*i;
}

// nCr
mint comb(int n, int r) {
  if (n < r || n < 0 || r < 0) return 0;
  return fact[n]/(fact[r]*fact[n-r]);
}

signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);

  int n, a, b, c; cin >> n >> a >> b >> c;
  init();

  mint aab = mint(a)/mint(a+b);
  mint bab = mint(b)/mint(a+b);

  vector<mint> aa(n+1,1);
  vector<mint> bb(n+1,1);
  rep(i, n) {
    aa[i+1] *= aa[i]*aab;
    bb[i+1] *= bb[i]*bab;
  }

  mint ans = 0;
  mint now = 0;
  rep(i, n) {
    mint tmp = n+i;
    tmp *= comb(n-1+i, i);
    tmp *= bb[i];
    now += tmp;
  }
  ans += now*aa[n];
  now = 0;
  rep(i, n) {
    mint tmp = n+i;
    tmp *= comb(n-1+i, i);
    tmp *= aa[i];
    now += tmp;
  }
  ans += now*bb[n];

  ans *= 100;
  ans /= a+b;
  cout << ans << endl;
  //debug(ans.x, (ans/2).x, (ans*2).x);

}

Measured memory_bytes: 7460
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}
 
template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
 
const ll mod = 998244353;
ll N;
string X;
vector<ll> divisors;
vector<ll> ans;
 
ll g(string X) {
    ll tmp = 0;
    for(int i = 0; i < X.size(); i++) {
        tmp *= 2;
        if(X[i] == '1') tmp++;
        tmp %= mod;
    }
    return tmp;
}
 
int main() {
    cin >> N >> X;
    for(ll i = 1; i * i <= N; i++) {
        if(N % i != 0) continue;
        int j = N / i;
        if(j&1) divisors.push_back(i);
        if(i&1) divisors.push_back(j);
    }
    sort(divisors.begin(), divisors.end());
    divisors.erase(unique(divisors.begin(), divisors.end()), divisors.end());
    ans.resize(divisors.size());
    ll sum = 0;
    for(int i = 0; i < divisors.size(); i++) {
        ans[i] = g(X.substr(0, divisors[i]));
        string T = X.substr(0, divisors[i]);
        string rev = T;
        for(auto &c : rev) {
            if(c == '1') c = '0';
            else c = '1';
        }
        for(int j = 1; ; j++) {
            if(T.size() == X.size()) break;
            if(j & 1) T += rev;
            else T += X.substr(0, divisors[i]);
        }
        //cerr << i << " " << divisors[i] << " " << T << endl;
        if(T <= X) ans[i]++;
        for(int j = 0; j < i; j++) {
            if(divisors[i] % divisors[j] == 0) ans[i] -= ans[j];
            ans[i] += mod;
            ans[i] %= mod;
        }
        //cerr << i << " " << divisors[i] << " " << ans[i] << endl;
        sum += divisors[i] * 2 * ans[i];
        sum %= mod;
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 1076
import java.util.*;

public class Main {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        String line = sc.nextLine();
        while(!line.equals("-1 -1 -1")){
            String[] str = line.split(" ");
            String ret = "F";
            int m = Integer.parseInt(str[0]);
            int f = Integer.parseInt(str[1]);
            int r = Integer.parseInt(str[2]);
            int mf = m+f;
            if(m*f < 0){
                
            }else{
                if(mf<30){
                    
                }else if(mf<50){
                    ret = 50<=r ? "C":"D";
                }else if(mf<65){
                    ret = "C";
                }else if(mf<80){
                    ret = "B";
                }else{
                    ret = "A";
                }
            }
            System.out.println(ret);
            line = sc.nextLine();
        }
        
    }
}


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

int main(){
    int N;cin >> N;
    map<int,ll> mp;
    vector<ll> r;
    rep(i,N){
        ll b;
        cin >> b;
        mp[b]++;
        if(mp[b]==1)r.push_back(b);
    }
    sort(All(r));
    if(mp.size()>3){
        cout << "No" << endl;
    }else if(mp.size()==1){
        if(r[0]==0)cout << "Yes" << endl;
        else cout << "No" << endl;
    }else if(mp.size()==2){
        if(r[0]==0&&2*mp[r[0]]==mp[r[1]])cout << "Yes" << endl;
        else cout << "No" << endl;
    }else if(mp.size()==3){
        if((r[0]^r[1])==r[2]&&mp[r[0]]==mp[r[1]]&&mp[r[1]]==mp[r[2]])cout << "Yes" << endl;
        else cout << "No" << endl;
    }
    return 0;
}

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

using i8   = int8_t;
using u8   = uint8_t;
using i16  = int16_t;
using u16  = uint16_t;
using i32  = int32_t;
using u32  = uint32_t;
using i64  = int64_t;
using u64  = uint64_t;
using i128 = __int128_t;
using u128 = __uint128_t;

using f32  = float;
using f64  = double;
using f80  = __float80;
using f128 = __float128;
// }}}

constexpr i64 INF = 1'010'000'000'000'000'000LL;

constexpr i64 MOD = 1'000'000'007LL;

constexpr f64 EPS = 1e-12;

constexpr f64 PI = 3.14159265358979323846;

// {{{ util
#define FOR(i, start, end) for(i64 i = (start), i##_end=(end); i < i##_end; ++i)
#define REP(i, n) FOR(i, 0, n)

#define ALL(f,c,...) (([&](decltype((c)) cc) { return (f)(begin(cc), end(cc), ## __VA_ARGS__); })(c))

template<typename T, typename U>
bool chmax(T& xmax, const U& x) {
    if(xmax < x) {
        xmax = x;
        return true;
    }
    else {
        return false;
    }
}

template<typename T, typename U>
bool chmin(T& xmin, const U& x) {
    if(x < xmin) {
        xmin = x;
        return true;
    }
    else {
        return false;
    }
}

template<typename T>
void RD(T& x) {
    cin >> x;
#ifdef PROCON_LOCAL
    assert(cin);
#endif
}

template<typename T>
void RD(vector<T>& v, int n) {
    v.reserve(n);
    REP(_, n) {
        T e; RD(e);
        v.emplace_back(e);
    }
}

template<typename T>
ostream& operator<<(ostream& out, const vector<T>& v) {
    for(auto first = begin(v), it = first; it != end(v); ++it) {
        if(it != first)
            out << ' ';
        out << *it;
    }
    return out;
}

template<typename T1, typename T2>
ostream& operator<<(ostream& out, const pair<T1,T2>& p) {
    return out << '(' << p.first << ',' << p.second << ')';
}

template<typename T>
void PRINT(const T& x) {
    cout << x;
}

template<typename T>
void PRINTLN(const T& x) {
    PRINT(x);
    cout << '\n';
}

template<typename T>
void DBG_IMPL(i64 line, const char* expr, const T& value) {
#ifdef PROCON_LOCAL
    cerr << "[LINE " << line << "]: ";
    cerr << expr << " = " << value << "\n";
#endif
}

#define DBG(expr) DBG_IMPL(__LINE__, #expr, (expr))
// }}}

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

i64 N;

void solve() {
    f80 ans = 0.0;
    REP(_, N) {
        f80 x; string u; RD(x); RD(u);
        if(u == "JPY") {
            ans += x;
        }
        else {
            ans += 380000.0 * x;
        }
    }

    PRINTLN(ans);
}

signed main() {
    cout << fixed << setprecision(15);

    RD(N);

    solve();

    return 0;
}


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

using db = double;
using ll = long long;
using vi = vector <int>;
#define op operator
#define pb push_back

int main() {
	cout << fixed << setprecision(9);
	ios :: sync_with_stdio(0);

	int ans = 0;
	for(string s; getline(cin, s); ) {
		s += ' '; string t = "";
		for(char c : s)
			if(isdigit(c))
				t += c;
			else if(t.size()) {
				ans += stoi(t);
				t = "";
			}
	}
	cout << ans << '\n';

	return 0;
}

Measured memory_bytes: 3200
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin >> n;
    int a[n];
    for(int i = 0; i < n; i++)
        cin >> a[i];
    int turn = 0,ans = 0;
    while(1){
        ans++;
        if(a[turn] == 2){
            cout << ans << endl;
            break;
        }
        if(a[turn] == 0){
            cout << -1 << endl;
            break;
        }
        int kari = turn;
        turn = a[kari] - 1;
        a[kari] = 0;
    }
}

Measured memory_bytes: 640
#include <iostream> 

using namespace std;


int main(){
    int a, b, c, k;
    cin >> a >> b >> c >> k;
    for(int i; i < k; i++){
         if(b <= a && c <= a){
            a = a * 2;
        }else if(a <= b && c <= b){
            b = b * 2;
        } else {
            c = c * 2;
        }
    }
    cout << a + b + c << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;
template<class T> bool chmin(T& a,T b){if(a>b) {a = b; return true;} return false;}
template<class T> bool chmax(T& a,T b){if(a<b) {a = b; return true;} return false;}
#define all(x) (x).begin(),(x).end()
#define debug(x)  cerr << #x << " = " << (x) << endl;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vec<int> A(N),B(N);
    for(int i=0;i<N;i++) cin >> A[i] >> B[i];
    auto ok = [&](int i){
        return A[i]==B[i];
    };
    for(int i=0;i+2<N;i++){
        if(ok(i) && ok(i+1) && ok(i+2)){
            cout << "Yes\n";
            return 0;
        }
    }
    cout << "No\n";
}

Measured memory_bytes: 3640
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int N = Integer.parseInt(in.nextLine());
		Map<String, Integer> blueWords = new HashMap<>();
		for (int i = 0; i < N; ++i) {
			String word = in.nextLine();
			if (blueWords.containsKey(word)) {
				blueWords.put(word, blueWords.get(word) + 1);
			} else {
				blueWords.put(word, 1);
			}
		}
		int M = Integer.parseInt(in.nextLine());
		Map<String, Integer> redWords = new HashMap<>();
		for (int i = 0; i < M; ++i) {
			String word = in.nextLine();
			if (redWords.containsKey(word)) {
				redWords.put(word, redWords.get(word) + 1);
			} else {
				redWords.put(word, 1);
			}
		}
		in.close();
		Set<String> b = new HashSet<>();
		b.addAll(blueWords.keySet());
		b.removeAll(redWords.keySet());
		int maxVal = Integer.MIN_VALUE;
		for (String blueWord : blueWords.keySet()) {
			if (!redWords.containsKey(blueWord)) {
				maxVal = Math.max(maxVal, blueWords.get(blueWord));
			} else {
				maxVal = Math.max(maxVal, blueWords.get(blueWord) - redWords.get(blueWord));
			}
		}
		System.out.println(Math.max(maxVal, 0));
	}
}

Measured memory_bytes: 21204
#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def S(): return input().rstrip()
def LS(): return S().split()
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = 1e10

#solve
def solve():
    s = S()
    print(s[:4], s[4:])
    return


#main
if __name__ == '__main__':
    solve()


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

int main() {
  int N ; 
  string S ; 
  int T = 0 ; 
  
  cin >> N ; 
  cin >> S ; 
  
  for (int i = 0 ; i < S.size()-2 ; i++){
    if(S.at(i) == 'A' && S.at(i+1) == 'B' && S.at(i+2) == 'C' ){
      T++ ;
    }
  }
  
  
  cout << T << endl ; 
  
}


Measured memory_bytes: 3564
#include<bits/stdc++.h>
#define LL long long
#define pb push_back
#define mp make_pair
#define pii pair<int,int>
using namespace std;
inline int read(){
	int v=0,f=1;
	char c=getchar();
	while (c<'0' || c>'9'){
		if (c=='-') f=-1;
		c=getchar();
	}
	while (c>='0' && c<='9'){
		v=v*10+c-'0';
		c=getchar();
	}
	return v*f;
}
const int Maxn=200005;
const LL mod1=998244353;
const LL mod2=1e9+9;
const LL bas1=1145141;
const LL bas2=1919810;
LL pw1[Maxn],pw2[Maxn];
int n,k,p[Maxn];
int siz[Maxn*4];
struct Ht{
	LL A,B;
	int l;
	Ht(LL _A,LL _B,int _l){
		A=_A,B=_B,l=_l;
	}
	Ht(){
		A=B=l=0;
	}
	Ht operator +(Ht h){
		return Ht((A*pw1[h.l]+h.A)%mod1,(B*pw2[h.l]+h.B)%mod2,l+h.l);
	}
	LL Gval(){
		return A*mod2+B;
	}
};
Ht tree[Maxn*4];
Ht pre[Maxn],suf[Maxn];
void modify(int p,int l,int r,int pos,int val){
	if (l==r){
		if (val==0){
			tree[p]=Ht(0,0,0);
		}
		else{
			tree[p]=Ht(val,val,1);
		}
		return;
	}
	int mid=l+r>>1;
	if (pos<=mid){
		modify(p*2,l,mid,pos,val);
	}
	else{
		modify(p*2+1,mid+1,r,pos,val);
	}
	tree[p]=tree[p*2]+tree[p*2+1];
}
int main(){
	pw1[0]=pw2[0]=1;
	for (int i=1;i<Maxn;i++){
		pw1[i]=pw1[i-1]*bas1%mod1;
		pw2[i]=pw2[i-1]*bas2%mod2;
	}
	scanf("%d%d",&n,&k);
	for (int i=1;i<=n;i++){
		scanf("%d",&p[i]);p[i]++;
	}
	for (int i=1;i<=n;i++){
		pre[i]=pre[i-1]+Ht(p[i],p[i],1);
	}
	for (int i=n;i>=1;i--){
		suf[i]=Ht(p[i],p[i],1)+suf[i+1];
	}
	for (int i=1;i<=k;i++){
		modify(1,1,n,p[i],p[i]);
	}
	set<LL> S;
	S.insert((tree[1]+suf[k+1]).Gval());
	//cout<<tree[1].A<<' '<<tree[1].B<<endl;
	for (int i=k+1;i<=n;i++){
		modify(1,1,n,p[i-k],0);
		//cout<<tree[1].A<<' '<<tree[1].B<<endl;
		modify(1,1,n,p[i],p[i]);
		S.insert((pre[i-k]+tree[1]+suf[i+1]).Gval());
		//cout<<tree[1].A<<' '<<tree[1].B<<endl;
	}
	printf("%d\n",S.size());
	return 0;
}

Measured memory_bytes: 42752
#include<bits/stdc++.h>
using namespace std;
int main(){
	while(1){
		string s;cin>>s;
		reverse(s.begin(),s.end());
		//cout<<s<<endl;
		long long len=s.length();
		for(int i=0;i<len;i++){//cout<<i<<endl;
			if(s.substr(i,7)=="remaerd"){i+=6;if(i>=len-1){break;}}
			else if(s.substr(i,5)=="maerd"){i+=4;if(i>=len-1){break;}}
			else if(s.substr(i,5)=="esare"){i+=4;if(i>=len-1){break;}}
			else if(s.substr(i,6)=="resare"){i+=5;if(i>=len-1){break;}}
			else{cout<<"NO"<<endl;return 0;}
		}
cout<<"YES"<<endl;return 0;
	}
}


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

using namespace std;

int main(){
    int r,D,x;
    cin >> r >> D >> x;

    int ans = x;

    for(int i = 0; i < 10; i++){
        ans = r*ans -D;
        cout << ans << endl;
    }
    
    
    return 0;
}

    

Measured memory_bytes: 256
"use strict";
var input = require("fs").readFileSync("/dev/stdin", "utf8");
var cin = input.trim().split(/ |\n/), cid = 0;

function main() {
    let N = +cin.shift();
    let K = BigInt(cin[0]);
    let A = cin.map(i => +i);
    let visit = [];
    let p = 1;
    let offset = 0;
    let interval = 0;
    let map = Array(N);
    for (let i = 0; i < N; i++) {
        visit.push(p);
        map[p] = 1;
        let next = A[p];
        if (map[next]) {
            offset = visit.indexOf(next);
            interval = visit.length - offset;
            break;
        }
        p = next;
    }
    //  console.log(visit)
    // console.log({interval,offset})
    let ans;
    if (K <= offset) {
        ans = visit[K];
    } else {
        let O = BigInt(offset);
        let I = BigInt(interval);
        ans = visit[O + (K - O) % I];
    }
    console.log(ans);
}
main();


Measured memory_bytes: 57308
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <set>
using namespace std;
typedef long long LL;
const int MaxN = 1e5;
const int Inf = 1 << 30;

int main()
{
	int N;
	while(~scanf("%d",&N)){
		printf("%d\n",800 * N - N / 15 * 200);
	}
    return 0;
}

Measured memory_bytes: 128
n, m, l = map(int, input().split())
A = [[0 for i in range(m)] for j in range(n)]
B = [[0 for i in range(l)] for j in range(m)]
C = [[0 for i in range(l)] for j in range(n)]
for i in range(n):
    A[i] = list(map(int, input().split()))
for j in range(m):
    B[j] = list(map(int, input().split()))
for x in range(n):
    for y in range(l):
        for z in range(m):
            C[x][y] += A[x][z] * B[z][y]
        if y == l - 1 :
            print(C[x][y], end="")
        else:
            print(C[x][y], end=" ")
    print()


Measured memory_bytes: 7068
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
const int INF=1e9;
const double eps=1e-9;
const int maxn=2e5+10;
char str[maxn];
int cnt[30];
typedef long long ll;
inline ll read(){
	ll x=0,flag=1;
	char ch=getchar();
	while(!isdigit(ch) && ch!='-')ch=getchar();
	if(ch=='-')flag=-1,ch=getchar();
	while(isdigit(ch))x=(x<<3)+(x<<1)+ch-'0',ch=getchar();
	return x*flag;
}
int main(){
	int i,j,k,m,n;
	scanf("%s",str);
	int len=strlen(str);
	for(i=0;i<len;i++)
		cnt[str[i]-'a']++;
	ll ans=1ll*len*(len-1)/2+1;
	for(i=0;i<=25;i++)
		ans-=1ll*cnt[i]*(cnt[i]-1)/2;
	printf("%lld\n",ans);
	return 0;
}


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

int main() {
  int n, x; cin >> n >> x;
  if (x==1 || x==2*n-1) {
    cout << "No" << endl;
  } else {
  cout << "Yes" << endl;
    for (int i = 0; i < 2*n-1; i++) {
      printf("%d\n",(x-n+2*n+i-1)%(2*n-1)+1);
    }
  }
  return 0;
}


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

struct UnionFind {
    vector<ll> d;
    UnionFind(ll n = 0) : d(n,-1) {}
    ll find(ll x) {
        if (d[x] < 0) return x;
        return d[x] = find(d[x]);
    }
    bool unite(ll x, ll y) {
        x = find(x); y = find(y);
        if (x == y) return false;
        if (d[x] > d[y]) swap(x,y);
        d[x] += d[y];
        d[y] = x;
        return true;
    }
    bool same(ll x, ll y) { return find(x) == find(y); }
    ll size(ll x) { return -d[find(x)]; }
};


int main() {
    ll n, m;
    cin >> n >> m;
    vector<ll> a(m), b(m);
    for (ll i = 0; i < m; ++i) {
        cin >> a[i] >> b[i];
        --a[i]; --b[i];
    }
    UnionFind uf(n);
    vector<ll> ans;
    ll now = n * (n - 1) / 2;
    for (ll i = m - 1; i >= 0; --i) {
        ans.emplace_back(now);
        ll x = a[i], y = b[i];
        if (!uf.same(x, y)) {
            now -= uf.size(x) * uf.size(y);
        }
        uf.unite(x, y);
    }
    reverse(ans.begin(), ans.end());
    for (ll i : ans) cout << i << endl;
}


Measured memory_bytes: 4596
#include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;
const int MAXN = 3010;
const int MAXH = 100010, MAXW = 100010;
const int MOD = 1000000007;
int h, w, n;
struct node{
	int x, y;
}a[MAXN];
int fac[MAXH+MAXW], inv[MAXH+MAXW], f[MAXN+1];
inline int mul(int a, int b){return 1ll*a*b%MOD;}
inline int add(int a, int b){return (a+=b)>=MOD?a-MOD:a;}
inline int sub(int a, int b){return (a-=b)<0?a+MOD:a;}
inline int pw(int x, int p){int res=1;for(;p;p>>=1,x=mul(x,x))if(p&1)res=mul(res,x);return res;}
inline int C(int n, int m){return mul(fac[n], mul(inv[m], inv[n-m]));}
inline void prepare()
{
	fac[0] = 1;
	for(int i=1;i<=h+w;i++)
		fac[i] = mul(fac[i-1], i);
	inv[h+w] = pw(fac[h+w], MOD-2);
	for(int i=h+w;i>=1;i--)
		inv[i-1] = mul(inv[i], i);
}
inline bool cmp(node p, node q){return p.x!=q.x?p.x<q.x:p.y<q.y;}
int main()
{
	scanf("%d%d%d",&h,&w,&n);
	for(int i=1;i<=n;i++)
		scanf("%d%d",&a[i].x,&a[i].y);
	a[++n].x = h; a[n].y = w;
	prepare();
	sort(a+1, a+n+1, cmp);
	for(int i=1;i<=n;i++)
	{
		f[i] = C(a[i].x+a[i].y-2, a[i].x-1);
		for(int j=1;j<i;j++)
			if(a[j].x<=a[i].x&&a[j].y<=a[i].y)
				f[i] = sub(f[i], mul(f[j], C(a[i].x+a[i].y-a[j].x-a[j].y, a[i].x-a[j].x)));
	}
	printf("%d\n",f[n]);
	return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define IOS                                                                    \
  ios::sync_with_stdio(0);                                                     \
  cin.tie(0);                                                                  \
  cout.tie(0)
#define pb push_back
#define ff first
#define ss second
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
using vi = vector<int>;
using pii = pair<ll, ll>;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fLL;
ll MOD = 998244353;
ll bpow(ll b, ll p, ll m = 1000000007LL) {
  ll rt = 1;
  for (; p; p >>= 1, b = b * b % m)
    if (p & 1)
      rt = rt * b % m;
  return rt;
}
ll dp[3005][3005];
ll a, b, c, d;
ll solve(ll r, ll c) {
  if (r < a || c < b)
    return 0;
  if (dp[r][c] != -1)
    return dp[r][c] % MOD;
  return dp[r][c] = (solve(r - 1, c) * c % MOD + solve(r, c - 1) * r % MOD -
                     solve(r - 1, c - 1) * (r * c - r - c + 1) % MOD + MOD) %
                    MOD;
}
int main() {
  IOS;
  cin >> a >> b >> c >> d;
  for (int i = 0; i < 3005; i++)
    for (int j = 0; j < 3005; j++)
      dp[i][j] = -1;
  dp[a][b] = 1;
  cout << solve(c, d) << endl;
}

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

int main()
{
  int a,b;
  cin >> a >> b;
  cout << a * a - b << endl;
  
  return 0;
}


Measured memory_bytes: 3648
p = 10**9+7
def pow(x,m):
    if m==0:
        return 1
    if m==1:
        return x
    if m%2==0:
        return (pow(x,m//2)**2)%p
    else:
        return (x*(pow(x,(m-1)//2)**2)%p)%p
N,M = map(int,input().split())
A = [1 for _ in range(N+100)]
for i in range(2,N+100):
    A[i] = (A[i-1]*i)%p
B = [1 for _ in range(N+100)]
B[N+100-1] = pow(A[N+100-1],p-2)
for i in range(N+100-2,1,-1):
    B[i] = (B[i+1]*(i+1))%p
P = [1 for _ in range(10**5)]
P[0]=0
P[1]=0
for i in range(2,int((10**5)**0.5)+1):
    for j in range(i*i,10**5,i):
        P[j] = 0
Q = []
for i in range(2,10**5):
    if P[i]==1:
        Q.append(i)

C = {q:0 for q in Q}
for q in Q:
    if M%q==0:
        while M%q==0:
            M = M//q
            C[q] += 1
if M>1:
    C[M] = 1
    Q.append(M)
prod = 1
for q in Q:
    k = C[q]
    a = A[k+N-1]
    a = (a*B[N-1])%p
    a = (a*B[k])%p
    prod = (prod*a)%p
print(prod)

Measured memory_bytes: 95240
import java.util.Comparator;
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scn = new Scanner(System.in);
		int N = scn.nextInt();
		int M = scn.nextInt();
		PriorityQueue<Long> PQ = new PriorityQueue<Long>(new MyComp());
		for(int i = 0;i < N;i++) {
			PQ.add(scn.nextLong());
		}

		for(int i = 0;i < M;i++) {
			long a = PQ.poll()/2;
			PQ.add(a);
		}
		long ans = 0;
		while(!PQ.isEmpty()) {
			ans += PQ.poll();
		}
		System.out.println(ans);
	}

}

class MyComp implements Comparator<Long>{

	@Override
	public int compare(Long o1, Long o2) {
		if(o1 > o2) {
			return -1;
		}
		if(o1 < o2) {
			return 1;
		}
		return 0;
	}

}


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

bool check(int n){
  double rn=sqrt(n);
  if(rn==(int)rn)return true;
  else return false;
}

int main(){
  int n;
  cin >> n;
  rep(i,n){
    if(check(n-i)){
      cout << n-i << endl;
      return 0;
    }
  }
  cout << 1 << endl;
}

Measured memory_bytes: 3528
A, B = map(int, input().split())
def f(x):
    chk = x % 4
    if chk == 0:
        return x
    if chk == 1:
        return 1
    if chk == 2:
        return x + 1
    if chk == 3:
        return 0

if A != 0:
    A -= 1
print(f(A) ^ f(B))

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
const ll N = 3e5 + 5; 
const ll MAX = 3e5 + 5; 
const ll M = 1e6 + 5;

int main(){
    ll r,d,x;
    ll sum = 0;
    cin>>r>>d>>x;

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

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

int main() {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    int ab = a + b;
    int cd = c + d;
    if (ab > cd){
        cout << "Left" << endl;
    }
    else if (ab < cd){
        cout << "Right" << endl;
    }
    else {
        cout << "Balanced" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
///Welcome to Nasif's Code
#define bug printf("bug\n");
#define bug2(var) cout<<#var<<" "<<var<<endl;
#define co(q) cout<<q<<endl;
#define all(q) (q).begin(),(q).end()
typedef long long int ll;
typedef unsigned long long int ull;
const int MOD = (int)1e9+7;
const int MAX = 1e6;
#define pi acos(-1)
#define inf 1000000000000000LL
#define FastRead    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int main()
{
    FastRead
    //freopen("output.txt", "w", stdout);
    int cnt=0,ans=1,n;
    cin>>n;
    for(int i=1;i<=n;i++){
     int div=0,t=i;
     while(t%2==0){
        t/=2;
        div++;
     }
     if(div>cnt){
        cnt=div;
        ans=i;
     }
    }
    cout<<ans<<endl;
    return 0;
}


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

int main(){

  int tmpi[7] = {1, 5, 10, 50, 100, 500, 1000};
  int ans;
  string tmpc = "IVXLCDM";
  char s[111];

  while(scanf("%s", s) != EOF){

    ans = 0;

    for(int i = 0; i < strlen(s); i++){

      int n1 = tmpi[tmpc.find(s[i])], n2 = tmpi[tmpc.find(s[i+1])];
      if(i+1 >= strlen(s)) n2 = 0;

      if(n1 < n2){
	ans += (n2 - n1);
	i++;
      }
      else ans += n1;

    }

    cout << ans << endl;

  }
  
  return 0;

}

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

using namespace std;

typedef long long ll;

template <typename T> void cmin(T &x, const T &y)
{
	if(y < x) x = y;
}

template <typename T> void cmax(T &x, const T &y)
{
	if(y > x) x = y;
}

template <typename T> void read(T &x)
{
	x = 0; char c = getchar(); bool f = 0;
	while(!isdigit(c) && c!='-') c = getchar();
	if(c == '-') f = 1, c = getchar();
	while(isdigit(c)) x = x*10+c-'0', c = getchar();
	if(f) x = -x;
}

ll pw10[19], D, ans;
int bit[19];

void dfs(int l, int r, ll d, ll way)
{
	if(l > r)
	{
		if(d == -D) ans += way;
	}
	else
	{
		if(l == r) dfs(l+1, r-1, d, way*10);
		else
		{
			for(int i=-9; i<=9; i++)
			{
				ll base = d+i*pw10[r]-i*pw10[l];
				ll upb = base + pw10[r];
				ll lob = base - pw10[r];
				if(lob<=-D && -D<=upb) bit[l] = i, dfs(l+1, r-1, base, way*(10-abs(i)-(i<=0&&l==0)));
			}
		}
	}
}

int main()
{
	read(D);
	pw10[0] = 1;
	for(int i=1; i<=18; i++) pw10[i] = pw10[i-1] * 10;
	for(int i=1; i<=18; i++) dfs(0, i, 0, 1);
	printf("%lld\n", ans);
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
int main(void) {
    double r;
    double menseki, enshu;
    scanf("%lf", &r);

    menseki = M_PI * r * r;
    enshu =  2 * M_PI * r;
    printf("%lf %lf\n", menseki, enshu);
    
    return 0;
}

Measured memory_bytes: 648
#include<complex>
#include<cmath>
#include<iostream>
#include<cstdio>
using namespace std;
typedef complex<double> xy_t;
xy_t P[110];
double z;
int n=0;
double x,y;
double sum=0.0;
double menseki(xy_t a,xy_t b, xy_t c){
    return a.real()*(b.imag()-c.imag())+b.real()*(c.imag()-a.imag())+c.real()*(a.imag()-b.imag());
}
int main(){
    while (scanf("%lf,%lf", &x, &y) != EOF) {
        P[n++]=xy_t(x,y);
    }
    for(int i=0;i+2<n;i++){
        xy_t a=P[0],b=P[i+1],c=P[i+2];
        sum+=menseki(a,b,c)/2;
    }
    printf("%.6f\n",abs(sum));
    return 0;
}




Measured memory_bytes: 3160
#include <bits/stdc++.h>
#include <fstream>
using namespace std;
#define rep(i, a, b) for (ll i = (a); i < (b); i++)
#define rep2(r, aa, bb) for (ll r = (aa)-1; r >= (bb); r--)
#define be(x) (x.begin(), x.end())
#define pb(t) push_back(t)
#define ll long long
int main()
{
    int n;
    cin >> n;
    vector<int> A(n);
    vector<int> dp(n, INT_MAX);
    rep(i, 0, n) cin >>
        A[i];
    dp[0] = 0;
    rep(i, 0, n)
    {
        // cout<<"dp["<<i<<"] is "<<dp[i]<<endl;
        if(i<=n-2)
        dp[i+1] = min(dp[i+1], dp[i]+abs(A[i]-A[i+1]));
        if(i<=n-3)
        dp[i+2] = min(dp[i+2], dp[i]+abs(A[i]-A[i+2]));
    }
    cout<<dp[n-1];
}

Measured memory_bytes: 1024
n = int(input())
h = list(map(int,input().split()))
dp = [0]*n
dp[1] = abs(h[0]-h[1])
for i in range(2,n):
    dp[i] = min(dp[i-2]+abs(h[i-2]-h[i]), dp[i-1]+abs(h[i-1]-h[i]))
print(dp[-1])

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

#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define repd(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define forr(i,a,b) for(ll i=(a);i<=(b);i++)
#define ford(i,a,b) for(ll i=(a);i>=(b);i--)
#define all(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define size(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))
#define INF 1000000000000 //10^12
#define MOD 10000007 //10^9+7
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define MAXR 100000 //10^5:最大のrange(素数列挙などで使用)



int main(void) {
    int NN,ans=0,j,K,Q,i;
    cin >> NN;
    cin >> K;
    cin >> Q;
    int N[NN];
    rep(i,NN){
       N[i] = K-Q;
    }
    int s[Q];
    rep(i,Q){
       cin >> s[i];
    }

       for (i=0;i<Q;++i){
           N[s[i]-1]++;
    }
           for (i=0;i<NN;++i){
               if(N[i]<=0){
                    cout << "No" << "\n";
               }
               else{
                   cout << "Yes" << "\n";
               }
    }

  return 0;
}

Measured memory_bytes: 1408
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;

string days[7] = {"SUN","MON","TUE","WED","THU","FRI","SAT"};

int main() {
    string s;
    cin >> s;

    rep(i, 7) {
        if(s == days[i]) {
            cout << 7 - i << endl;
        }
    }

    return 0;
}

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

int main(){
    int h,w;
    
    cin >> h >> w;
    
    while(h!=0 && w!=0){
        for(int i = 0;i < h;i++){
            for(int j = 0;j < w;j++){
                if(i%2==1 && j%2==1)        cout << "#";
                else if (i%2==1 && j%2==0)  cout << ".";
                else if (i%2==0 && j%2==1)  cout << ".";
                else if (i%2==0 && j%2==0)  cout << "#";
            }
            cout << "\n";
        }
        cout << "\n";
        cin >> h >> w;
    }
    return 0;
}


Measured memory_bytes: 3100