akhauriyash/Code-Regression huggingface dataset:
//int a = stoi(c); 文字列をintへ
//小文字から大文字
//transform(a.begin(), a.end(), a.begin(), ::toupper);
//数値計算 個数以外はdouble
//map<キー,値> p は辞書。p[キー] = 値
//map 全探索
//auto begin = p.begin(), end = p.end();
//for (auto it = begin; it != end; it++) {}
//mapのキー：it->first mapのバリュー：it->second
//大文字判定 isupper(文字) 小文字判定 islower(文字)
//do{}while(next_permutation(ALL(配列)))
//小文字に対応する文字コード：S[i] - 'a'
//文字コード→小文字：(char)(数字+'a')
//グラフの距離:隣接行列で扱う
//bool型　初期値はTrue
//島渡りの問題：中間ノードに着目
//背反な事象にちゃんとわける
//チェックリストはマップを使う
//数が大きい時の比較はstring型で行う
//全て0になったか調べたい->0になるたびにcntする
//例外処理は最初にする
//x = p^m + q^n...の約数の個数:(n+1)*(m+1)....
//N!のどの素因数で何回割れるか
//⇔1~Nまでの数がそれぞれどの素因数で何回割り切れるかの和
//パズルの問題->一般化して全探索
//数が大きい時のせぐふぉはコードテストで試してみる
//stack<ll> s;
//s.push(要素);s.top();s.pop();
//queue<ll> q;
//q.push(要素);q.front();q.pop();
//同じ作業繰り返す系の問題：収束先を見つける
//関係性は隣接行列で記録
//過半数：N/2.0で判定
//ある量からある量を引く系の問題：端から定義してやる
#include <bits/stdc++.h>
#define rep(i,N) for(int i = 0; i < N;i++)
#define ALL(a) (a).begin(),(a).end()
#define ll long long int
using namespace std;

//円周率
const double PI = 3.14159265358979323846;
//割るやつ
const ll MOD = (pow(10, 9) + 7);

// K進数でのNの桁数
ll dig(ll N, ll K) {
	ll dig = 0;
	while (N) {
		dig++;
		N /= K;
	}
	return dig;
}
// a,bの最大公約数
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a%b);
}

//a,bの最小公倍数
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}

//階乗計算
ll f(ll n) {
	if (n == 0 || n == 1) return 1;
	else return (n * f(n - 1));
}

//Nのd桁目の数
ll dignum(ll N, ll d) {
	ll x = pow(10, d);
	N %= x;
	ll y = pow(10, d - 1);
	N /= y;
	return N;
}

//Nをdで何回割れるか
ll divcnt(ll N, ll d) {
	ll ans = 0;
	while (1) {
		if (N%d == 0) {
			ans++;
			N /= d;
		}
		else break;
	}

	return ans;
}

//素数判定
bool prime(ll num) {
	if (num < 2) return false;
	else if (num == 2) return true;
	else if (num % 2 == 0) return false;
	double sqrtNum = sqrt(num);
	for (int i = 3; i <= sqrtNum; i += 2) {
		if (num % i == 0) return false;
	}
	return true;
}

//フィボナッチ数列
vector<ll> memo(pow(10, 6) + 1);
ll fibo(ll n) {
	if (n == 1) return 1;
	else if (n == 2) return 1;
	else if (memo[n] != 0) return memo[n];
	else return memo[n] = fibo(n - 1) + f(n - 2);
}

int main() {
	ll X, Y, Z; cin >> X >> Y >> Z;

	cout << Z << " " << X << " " << Y << endl;
}

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

using namespace std;

int main() {
    string s;
    cin >> s;
    if (s == "Sunny")
        cout << "Cloudy" << endl;
    else if (s == "Cloudy") {
        cout << "Rainy" << endl;
    } else {
        cout << "Sunny" << endl;
    }
    return 0;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define IO(i, o) freopen(i, "r", stdin), freopen(o, "w", stdout)

using namespace std;
int N, K, T;

int main(void){
	//IO("test.in", "test.out");
	scanf("%d%d", &N, &K);
	for(int i = 0; i < N; i++){
		int b;
		scanf("%d", &b);
		T += 2 * min(K - b, b);
	}
	printf("%d\n", T);
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <queue>
#include <unordered_set>
using namespace std;
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; }

int main() {
	int N, W;
	cin >> N >> W;
	vector<int> w(N), v(N);
	for (int i = 0; i < N; i++) cin >> w[i] >> v[i];
	vector<vector<long long>> dp(N + 1, vector<long long>(W + 1));
	for (int i = 1; i <= N; i++) {
		for (int j = 0; j <= W; j++) {
			if (j + w[i - 1] <= W) {
				dp[i][j] = max(dp[i - 1][j], dp[i - 1][j + w[i - 1]] + v[i - 1]);
			}
			else dp[i][j] = dp[i - 1][j];
		}
	}
	cout << dp[N][0] << endl;
}

Measured memory_bytes: 83172
#!/usr/bin/env python3
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys
import collections
from decimal import Decimal # 10進数で考慮できる

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

d = collections.deque()
def LI(): return list(map(int, sys.stdin.readline().split()))

N = int(input())
T = []
for i in range(N):
    T.append(int(input()))

def LCM(T):
    lcm = 1
    for t in T:
        lcm = lcm * t // math.gcd(t, lcm)
    return lcm

print(LCM(T))


Measured memory_bytes: 10932
/***************************************************
 * Problem Name : A.cpp
 * Problem Link :
 * OJ           :
 * Verdict      : Trying
 * Date         : 2020-04-19
 * Problem Type :
 * Author Name  : Saikat Sharma
 * University   : CSE, MBSTU
 ***************************************************/
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <climits>
#include <cstring>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <list>
#include <unordered_map>
#include <unordered_set>
#include <cstdlib>
#include <deque>
#include <stack>
#include <bitset>
#include <cassert>
#include <map>
#include <set>
#include <cassert>
#include <iomanip>
#include <random>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef unsigned long long ull;

#define __FastIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define __FileRead freopen ("input.txt", "r", stdin)
#define __FileWrite freopen ("output.txt", "w", stdout)
#define SET(a,v) memset(a,v,sizeof(a))
#define SZ(v) (int)v.size()
#define pii pair<int,int>
#define pil pair <int, ll>
#define pli pair <ll, int>
#define pll pair <ll, ll>
#define debug cout <<"######\n"
#define debug1(x) cout <<"### " << x << " ###\n"
#define debug2(x,y) cout <<"# " << x <<" : "<< y <<" #\n"
#define nl cout << "\n";
#define sp cout << " ";
#define sl(n) scanf("%lld", &n)
#define sf(n) scanf("%lf", &n)
#define si(n) scanf("%d", &n)
#define ss(n) scanf("%s", n)
#define pf(n) scanf("%d", n)
#define pfl(n) scanf("%lld", n)
#define all(v) v.begin(), v.end()
#define rall(v) v.begin(), v.end()
#define srt(v) sort(v.begin(), v.end())
#define r_srt(v) sort(v.rbegin(), v.rend())
#define rev(v) reverse(v.rbegin(), v.rend())
#define Sqr(x) ((x)*(x))
#define Mod(x, m) ((((x) % (m)) + (m)) % (m))
#define max3(a, b, c) max(a, max(b, c))
#define min3(a, b, c) min(a, min(b, c))
#define pb push_back
#define mk make_pair
#define MAX 100005
#define INF 1000000009
#define MOD 1000000007

template<class T>
using min_heap = priority_queue<T, std::vector<T>, std::greater<T>>;
template<typename T>
using ordered_set  = tree<T, null_type, less<T>, rb_tree_tag,
      tree_order_statistics_node_update>;

template <typename T> string toString ( T Number ) {
    stringstream ss;
    ss << Number;
    return ss.str();
}
template<typename T> int toInt (T str) {
    stringstream ss;
    ss << str;
    int num;
    ss >> num;
    return num;
}
ll lcm ( ll a, ll b ) {
    return ( a / __gcd ( a, b ) ) * b;
}
/************************************ Code Start Here ******************************************************/
ll fun(ll n){
	return (n*(n+1LL))/2LL;
}
int main () {
    __FastIO;
    //~ cout << setprecision (10) << fixed;
    int n, m;
    cin >> n >> m;
    cout << fun(n-1) + fun(m-1) << "\n";
    return 0;
}


Measured memory_bytes: 256
object Main extends App {
  val v = readLine match {
    case "SUN" => 0
    case "MON" => 1
    case "TUE" => 2
    case "WED" => 3
    case "THU" => 4
    case "FRI" => 5
    case "SAT" => 6
    case _ => 999999
  }
  
  println(7-v)
}

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

#define PI acos(-1)
#define all(a) a.begin(), a.end()
#define full(a, n) a, a + n
#define ma(type, size) (type *)malloc(sizeof(type) * size)
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define MT make_tuple
#define f0(i, n) for (i = 0; i < (n); i++)
#define f1(i, n) for (i = 1; i < (n); i++)
#define f1n(i, n) for (i = 1; i <= (n); i++)
#define fab(i, a, b) for (i = (a); i <= (b); i++)
#define fr(i, b, a) for (i = (b); i >= (a); i--)

using namespace std;

/*
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
typedef tree<int,null_type,less<int>,rb_tree_tag,
	tree_order_statistics_node_update> indexed_set;
//*/
typedef long long int ll;
typedef long int lo;

typedef vector<ll> vll;
typedef pair<ll, ll> pll;
typedef tuple<ll, ll, ll> tll;

//* utility function
inline bool compare(ll i, ll j)
{
    return i < j;
}
//*/

//* function prototypes
template< typename T>
T gcd(T a, T b);
template< typename T>
T modpow(T number, T power, T mod_value);
//*/

//int row, column;
//int dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
//int dy[8] = {0, -1, -1, -1, 0, 1, 1, 1};
//int dx[4] = {1,  0, -1, 0};
//int dy[4] = {0, -1,  0, 1};
//ll p2[63] = {1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144, 524288, 1048576, 2097152, 4194304, 8388608, 16777216, 33554432, 67108864, 134217728, 268435456, 536870912, 1073741824, 2147483648, 4294967296, 8589934592, 17179869184, 34359738368, 68719476736, 137438953472, 274877906944, 549755813888, 1099511627776, 2199023255552, 4398046511104, 8796093022208, 17592186044416, 35184372088832, 70368744177664, 140737488355328, 281474976710656, 562949953421312, 1125899906842624, 2251799813685248, 4503599627370496, 9007199254740992, 18014398509481984, 36028797018963968, 72057594037927936, 144115188075855872, 288230376151711744, 576460752303423488, 1152921504606846976, 2305843009213693952, 4611686018427387904};
#ifdef DEBUG
#endif // DEBUG

int main()
{
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    ll number_of_test_case = 1, test_case;
    //cin >> number_of_test_case;
    for (test_case = 1; test_case <= number_of_test_case; test_case++)
    {
        ll i, j, n;

        cin >> n;
        ll arr[n];
        f0(i, n)cin >> arr[i];

        ll ans = 0;
        f0(i, n)
        {
            for (j = i+1; j < n; j++)ans += arr[i]*arr[j];
        }
        cout << ans << endl;
    	//cout << "Test #" << test_case << ": ";
    	//cout << "Case " << test_case << ": ";
    }
    return 0;
}


template< typename T>
T gcd(T a, T b)
{
    if (b == 0)
        return a;
    return gcd(b, a%b);
}
template< typename T>
T modpow(T number, T power, T mod_value)
{
    if (power == 0)
        return 1%mod_value;
    ll u = modpow(number,power/2,mod_value);
    u = (u*u)%mod_value;
    if (power%2 == 1)
        u = (u*number)%mod_value;
    return u;
}


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

const char wall = '#';
vector<vector<char>> fields;
vector<vector<bool>> used;
vector<vector<ll>> dist;
const int dx[4] = {0, -1, 0, 1};
const int dy[4] = {1, 0, -1, 0};

vector<ll> A;
// vectorのリサイズ
// A.resize(N);

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

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

  ll n, k;
  cin >> n >> k;
  vector<ll> h(n);
  rep(i, n) cin >> h[i];
  ll ans = 0;
  rep(i, n) {
    if (h[i] >= k) ans++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define FOR(i, a, b) for (ll i = a; i <= (ll)(b); i++)
//xにはvectorなどのコンテナ
#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 MIN(x) *min_element(ALL(x))   //最小値を求める
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define inf 2147483647    //int値の最大値
#define MOD 1000000007    //10^9+7:合同式の法
#define MAXR 100000       //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first      //pairの一つ目の要素
#define S second     //pairの二つ目の要素

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;
}
int gcd(int a, int b)
{
    if (b == 0)
        return a;
    else
        return gcd(b, a % b);
}
int lcm(int a, int b)
{
    return a * b / gcd(a, b);
}
int main()
{
    int n;
    cin >> n;
    map<string, int> ma;
    ma["AC"] = 0;
    ma["WA"] = 0;
    ma["TLE"] = 0;
    ma["RE"] = 0;
    rep(i, n)
    {
        string s;
        cin >> s;
        ma[s]++;
    }
    cout << "AC"
         << " "
         << "x"
         << " " << ma["AC"] << endl;
    cout << "WA"
         << " "
         << "x"
         << " " << ma["WA"] << endl;
    cout << "TLE"
         << " "
         << "x"
         << " " << ma["TLE"] << endl;
    cout << "RE"
         << " "
         << "x"
         << " " << ma["RE"] << endl;
    return 0;
}


Measured memory_bytes: 3636
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <deque>
using namespace std;

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

const ll mod=1000000007;

ll per(ll a){
  if(a==0 || a==1)return 1;
  return a*per(a-1)%mod; 
}

ll pow(ll a, ll r){
  if(r==0)return 1;
  else if(r==1)return a;
  ll temp;
  temp=pow(a,r/2);
  temp=temp*temp%mod;
  return temp*((r%2==0)?1:a)%mod;
}

int main(){
  ll n,m,N,M;
  ll inv[100010]={};
  ll seq[100010]={};
  cin>>n;
  for(ll i=1;i<=n+1;i++){
    int temp;
    scanf("%d",&temp);
    if(seq[temp]>0){
      m=n-i+seq[temp];
    }else{
      seq[temp]=i;
    }
  }
  N=per(n+1);
  M=per(m);
  inv[n+1]=pow(N,mod-2);
  for(ll i=n;i>=0;i--){
    inv[(int)i]=inv[(int)i+1]*(i+1)%mod;
  }
  for(ll i=1;i<=n+1;i++){
    ll ans=(N*inv[i]%mod)*inv[n+1-i]%mod;
    if(i<=m+1)ans-= (M*inv[i-1]%mod)*inv[m+1-i]%mod;
    if(ans<0)ans+=mod;
    printf("%lld\n",ans);
  }
  return 0;
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
#define int long long
const int mod=1000000007;
const int inf=mod*mod;
using namespace std;
int maxa(int a,int b)
{
	if (b>a)
		return b;
	else 
		return a;
}
int dp[2][1100000];
int KnapSack(int v[], int wt[], int n, int W) 
{ 
    for(int i=1; i<1100000; i++)
    	dp[0][i]=inf;
    for(int i=1; i<=n; i++)
    {
    	int t=i%2;
    	for(int j=0; j<1100000; j++)
    		dp[t][j]=inf;
    	for(int j=0; j<1100000; j++)
    	{
    		dp[t][j]=min(dp[t][j],dp[!t][j]);
    		if (j-v[i-1]>=0)
    			dp[t][j]=min(dp[t][j],dp[!t][j-v[i-1]]+wt[i-1]);
    	}
    }
    int ans=0;
    for(int i=0; i<1100000; i++)
    {
    	if(dp[n%2][i]<=W)
    		ans=i;
    }
    
    return ans;
}
signed main()
{
	int n,m;
	cin>>n>>m;
	int w[n],v[n];
	for (int i = 0; i < n; ++i)
	{
		cin>>w[i]>>v[i];
	}
	int ans=KnapSack(v,w,n,m);
	cout<<ans;
}

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

typedef long long int lli;
typedef unsigned long long int ulli;
typedef pair<int,int> pii;
typedef priority_queue< int, vector< int >, greater< int > >  minHeap;

#define ones(x) __builtin_popcount(x)
#define onesl(x) __builtin_popcountl(x)
#define onesll(x) __builtin_popcountll(x)

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define scn(n) scanf("%d",&n)
#define scnll(n) scanf("%lld",&n)
#define scn2(n,m) scanf("%d%d",&n,&m)
#define scn3(n,m,w) scanf("%d%d%d",&n,&m,&w)
#define scn2ll(n,m) scanf("%lld%lld",&n,&m)
#define atoz(v) v.begin(),v.end()
#define ratoz(v) v.rbegin(),v.rend()
#define Fill(a,v) memset(a,v,sizeof(a))
#define fi first
#define se second
#define inf 1e9
#define pi acos(-1.0)
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define mod 1000000007
#define FastIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define bug(x) cerr << __LINE__ << " says: " << #x << " = " << (x) << "\n"

int Set(int N,int pos)
{
    return N=N | (1<<pos);
}
int reset(int N,int pos)
{
    return N = N & ~(1<<pos);
}
bool check(int N,int pos)
{
    return (bool)(N & (1<<pos));
}

inline int addmod(lli x,lli y)
{
    return (x%mod + y%mod)%mod;
}
inline int submod(lli x,lli y)
{
    return (x%mod - y%mod + mod)%mod;
}
inline int mulmod(lli x,lli y)
{
    return (x%mod * y%mod)%mod;
}


inline int nextSubMask(int i, int mask)
{
    return (i-1)&mask;   /// returns next  submask
}

template<typename T>
void we_r_done(T mssg)
{
    cout<<mssg;
    exit(0);
}


int main()
{
    ///freopen("output.txt","w",stdout);
 //  freopen("input.txt","r",stdin);
    FastIO;

    int n,k;

    while(cin>>n){
        n *= 3;
        lli a[n+1] ;

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

        sort(a+1,a+n+1);
        lli ans = 0;
        for(int lo=1, hi=n ; (lo+1)<hi; lo++ , hi--){

            ans += a[--hi];
        }
        cout<<ans<<endl;
    }

    return 0;
}

///sin and cos expect input in radians not degrees. so use , sin(degrees * pi / 180)
///using bs = bitset<MX>; // how many distinct number can be form?
///sort(atoz(v), [](const data x, const data y){return (x.a==y.a?x.b>y.b : x.a<y.a);});


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

// int/long:		-2,147,483,648 - 2,147,483,648 (-2^31 <= int < 2^31)
// long/long long:	-9,223,372,036,854,775,808 - 9,223,372,036,854,775,807 (-2^63 <= long < 2^63)

#define	INF (1<<29)
//536,870,912

// lower_bound(A.begin(), A.end(), N)
// upper_bound(...

// A.erase(unique(A.begin(), A.end()), A.end())

// bit: &/and, |/or, ^/xor, ~/not

// getline(cin, String)

// Graph
// Warshall-Floyd: Distance between each node, N^3
// Dijkstra: Distance from the start node, N^2
// DFS(Depth-First Search)

#define	MOD 1000000007

int	main() {
	string A, B;
	cin >>A >>B;
	if (A.size()==B.size()) {
		if (A==B)
			cout <<"EQUAL" <<endl;
		else if (A>B)
			cout <<"GREATER" <<endl;
		else
			cout <<"LESS" <<endl;
	} else if (A.size()>B.size())
		cout <<"GREATER" <<endl;
	else
		cout <<"LESS" <<endl;
	return 0;
}



Measured memory_bytes: 256
n, x = map(int, input().split())
X = list(map(int, input().split()))
X.sort(reverse=True)
D = []

for i in range(len(X)):
    dist = abs(x - X[i])
    D.append(dist)

def gcd(i, j):
    while j != 0:
        i, j = j, i % j
    return i

for i in range(len(D) - 1):
    D[i + 1] = gcd(D[i], D[i + 1])

print(D[-1])

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

int main(){
  int N;
  cin >> N;
  long long int A[N];
  int count=0;
  long long int min=1000000005;
  long long int sum=0;
  for(int i=0;i<N;i++){
    cin >> A[i];
    if (A[i]<0) {
      count++;
      A[i]*=-1;
    }
    if(min>A[i]){
      min = A[i];
    }
    sum+=A[i];
  }
  if (count%2==1){
    sum-=2*min;
  }
  cout << sum << endl;
}


Measured memory_bytes: 1024
n=gets.to_i
h=Hash.new(0)
require 'prime'
2.upto(n) do |i|
  g=Prime.prime_division(i)
  g.each do |e|
    h[e[0]]+=e[1]
  end
end
c=1
h.each do |e|
  c*=e[1]+1
  c%=10**9+7
end
p c

Measured memory_bytes: 2172
#include <iostream>
#include <cstdio>
#include <cstring>
#include <queue>
#include <stack>
#include <fstream>
#include <vector>
#include <map>
#include <set>
#include <cmath>
#include <algorithm>
#include <functional>
#define inf 0x3f3f3f3f
#define inff -30000000
using namespace std;
typedef long long ll;
const int MAXN=1e5+10;
const int MAX=2000+10;
ll gcd(ll a,ll b){
    return (!b)?a:gcd(b,a%b);
}
int main(){
    #ifdef SIYU
    freopen("in.txt","r",stdin);
    #endif // SIYU
    ll a,b;
    while(cin>>a>>b){
        ll ans=gcd(a,b);
        cout<<ans<<" "<<a/ans*b<<endl;
    }
    return 0;
}

Measured memory_bytes: 3056
import itertools
N = int(input())
A = [int(x) for x in input().split()]
cumsum = list(itertools.accumulate(A))
ans = float("INF")
for i in range(N):
  ans = min(ans,abs(cumsum[i]-(cumsum[-1]-cumsum[i])))
print(ans)
    
  

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

using namespace std;

typedef long long ll;
const int mod = (int) 1e9 + 7;

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

int mul(int a, int b) {
  return a * (ll) b % mod;
}

int pw(int a, int b) {
  int r = 1;
  while (b) {
    if (b & 1) {
      r = mul(r, a);
    }
    a = mul(a, a);
    b /= 2;
  }
  return r;
}

int dv(int a, int b) {
  return mul(a, pw(b, mod - 2));
}

const int N = 200000 + 7;
int n, m, a, b, fact[N], inv[N];

int comb(int n, int k) {
  return mul(fact[n], mul(inv[k], inv[n - k]));
}

int ways(int a, int b) {
  return comb(a + b - 2, a - 1);
}

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

  fact[0] = 1;
  for (int i = 1; i < N; i++) {
    fact[i] = mul(fact[i - 1], i);
  }
  inv[N - 1] = dv(1, fact[N - 1]);
  for (int i = N - 2; i >= 0; i--) {
    inv[i] = mul(inv[i + 1], i + 1);
  }
  cin >> n >> m >> a >> b;
  int ans = 0;
  for (int r = 1; r <= n - a; r++) {
    int now = mul(ways(b, r), ways(m - b, n - r + 1));
    ans = add(ans, now);
  }
  cout << ans << "\n";
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){return o<<"("<<p.fs<<","<<p.sc<<")";}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){o<<"sz = "<<vc.size()<<endl<<"[";for(const T& v:vc) o<<v<<",";o<<"]";return o;}

int H,W;
string s[40];

int sumb[41][41];

int inf = 1e9;

int dp[41][41][41][41];
bool done[41][41][41][41];

int count_block(int lx,int ly,int rx,int ry){
	return sumb[rx][ry] - sumb[lx][ry] - sumb[rx][ly] + sumb[lx][ly];
}

int calc(int lx,int ly,int rx,int ry){
	if(lx==0&&ly==0&&rx==H&&ry==W) return 0;
	if(done[lx][ly][rx][ry]) return dp[lx][ly][rx][ry];
//	printf("calc %d,%d,%d,%d\n",lx,ly,rx,ry);
	int& val = dp[lx][ly][rx][ry];
	val = inf;

	for(int X=rx;X<=H;X++) for(int Y=ry;Y<=W;Y++){
		if(X==rx && Y==ry) continue;
		chmin(val,calc(lx,ly,X,Y)+count_block(lx,ry,rx,Y)+count_block(rx,ly,X,ry));
	}
	for(int X=0;X<=lx;X++) for(int Y=ry;Y<=W;Y++){
		if(X==lx && Y==ry) continue;
		chmin(val,calc(X,ly,rx,Y)+count_block(X,ly,lx,ry)+count_block(lx,ry,rx,Y));
	}
	for(int X=rx;X<=H;X++) for(int Y=0;Y<=ly;Y++){
		if(X==rx && Y==ly) continue;
		chmin(val,calc(lx,Y,X,ry)+count_block(lx,Y,rx,ly)+count_block(rx,ly,X,ry));
	}
	for(int X=0;X<=lx;X++) for(int Y=0;Y<=ly;Y++){
		if(X==lx && Y==ly) continue;
		chmin(val,calc(X,Y,rx,ry)+count_block(X,ly,lx,ry)+count_block(lx,Y,rx,ly));
	}

	done[lx][ly][rx][ry] = 1;
	return val;
}

int main(){
	cin>>H>>W;
	rep(i,H) cin>>s[i];
	rep(i,H) rep(j,W) sumb[i+1][j+1] = (s[i][j]=='#');
	rep(i,H+1) rep(j,W) sumb[i][j+1] += sumb[i][j];
	rep(i,H) rep(j,W+1) sumb[i+1][j] += sumb[i][j];

	int ans = 1e9;

	int sx=-1,sy=-1;
	rep(i,H) rep(j,W) if(s[i][j]=='P') sx=i,sy=j;

	rep(lx,H) rep(ly,W) for(int rx=lx+1;rx<=H;rx++) for(int ry=ly+1;ry<=W;ry++){
		if(lx<=sx&&sx<rx && ly<=sy&&sy<ry){
			int mn = inf;
			chmin(mn, count_block(lx,ly,sx+1,sy+1));
			chmin(mn, count_block(lx,sy,sx+1,ry));
			chmin(mn, count_block(sx,ly,rx,sy+1));
			chmin(mn, count_block(sx,sy,rx,ry));
			chmin(ans,calc(lx,ly,rx,ry)+mn);
		}
	}
	cout<<ans<<endl;

}


Measured memory_bytes: 11904
while True:
    m, f, r = map(int, input().split())
    if m == -1 and f == -1 and r == -1:
        break

    if m == -1 or f == -1:
        print("F")
    elif m + f >= 80:
        print("A")
    elif m + f >= 65:
        print("B")
    elif m + f >= 50:
        print("C")
    elif m + f >= 30:
        if r < 50:
            print("D")
        else:
            print("C")
    else:
        print("F")


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

int N;
vector<int> A,B,C;

int main(){
    cin>>N;
    for(int i=0; i<3; i++){
        for(int j=0; j<N; j++){
            int t;
            cin>>t;
            if(i==0)A.push_back(t);
            else if(i==1)B.push_back(t);
            else C.push_back(t);
        }
    }
    sort(A.begin(),A.end());
    sort(C.begin(),C.end());
    long long ans=0;
    for(int i=0; i<N; i++){
        //B[y]<C[z],A[x]<B[y]を満たすx,zの数
        ans+=(lower_bound(A.begin(),A.end(),B[i])-A.begin())*(C.end()-(upper_bound(C.begin(),C.end(),B[i])));
    }
    cout<<ans<<endl;
    
    return 0;
}

Measured memory_bytes: 1784
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include<iostream>
#include<cmath>
#include<numeric>
#include<functional>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<queue>
#include<iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<n;i++)
#define ll long long
#define INF 2147483647
using namespace std;
using Graph=vector<vector<int>>;

int main(){
  int n,m;
  cin>>n>>m;
  Graph G(n);
  rep(i,m){
    int a,b;
    cin>>a>>b;
    G[a-1].push_back(b-1);
    G[b-1].push_back(a-1);
  }
  vector<int> milestone(n,INF);
  queue<int> que;
  milestone[0]=0;
  que.push(0);
  while(!que.empty()){
    int v=que.front();
    que.pop();
    for(int nv:G[v]){
      if(milestone[nv]!=INF) continue;
      milestone[nv]=v;
      que.push(nv);
    }
  }
  cout<<"Yes"<<"\n";
  for(int i=1;i<=n-1;i++){
    cout<<milestone[i]+1<<"\n";
  }
}


Measured memory_bytes: 10228
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;

typedef long long llt;

const int MaxN = 100 + 5, MaxK = 100000 + 5;
const llt Mod = 1e9 + 7;

int N, K;
int A[MaxN];
llt dp[MaxN][MaxK], pre[MaxN][MaxK];

void init() {
  scanf("%d %d", &N, &K);
  for (int i = 1; i <= N; ++i) scanf("%d", &A[i]);
}

void solve() {
  dp[0][0] = 1; pre[0][0] = 1;
  for (int i = 1; i <= K; ++i) pre[0][i] = pre[0][i - 1] + dp[0][i];

  // dp[i][j] 表示到前 i 个人分配 j 个糖果的方案数
  for (int i = 1; i <= N; ++i) {
    for (int j = 0; j <= K; ++j) {
      dp[i][j] = pre[i - 1][j] - pre[i - 1][max(0, j - A[i] - 1)];
      if (j - A[i] <=0) dp[i][j] += pre[i - 1][0];
      dp[i][j] = (dp[i][j] % Mod + Mod) % Mod;
      // printf("dp[%d][%d] = %lld\n", i, j, dp[i][j]);
    }

    pre[i][0] = dp[i][0];
    for (int j = 1; j <= K; ++j)
      pre[i][j] = (pre[i][j - 1] + dp[i][j]) % Mod;
  }

  printf("%lld\n", dp[N][K]);
}

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

Measured memory_bytes: 160000
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;
const int inf = 1e9;
const ll INF = 1e18;
const double pi = 3.14159265358979323846;
#define rep(i,n) for(int i=0;i<n;i++)

int main(){
	int h,w;cin>>h>>w;
	char grid[h][w];
	rep(i,h) rep(j,w) cin>>grid[i][j];

	rep(i,w){
		int cnt=0;
		rep(j,h) {
			if(grid[j][i]=='.') cnt++;
		}
		if(cnt==h){
			rep(j,h) grid[j][i]='2';
		}
	}
	rep(i,h){
		int cnt=0;
		rep(j,w) {
			if(grid[i][j]=='.'||grid[i][j]=='2') cnt++;
		}
		if(cnt==w){
			rep(j,w) grid[i][j]='1';
		}
	}
/*	
	rep(i,h){
		rep(j,w) cout<<grid[i][j];
		cout<<"\n";
	}
*/
	rep(i,h){
		int chk=0;
		rep(j,w){
			if(grid[i][j]=='1') {
				chk=1;
				break;
			}
			else if(grid[i][j]=='2'){
				chk=2;
				continue;
			}
			else cout<<grid[i][j];
		}
		if(chk==1&&i!=h-1) continue;
		else cout<<"\n";
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
//const ll MOD = 1e9 + 7;
//const ll MOD = 998244353;
//const ll MOD = ;
ll mod(ll A, ll M) {return (A % M + M) % M;}
const ll INF = 1LL << 60;
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;}
ll divceil(ll A, ll B) {return (A + (B - 1)) / B;}
ll myctoi(char C) {return C - '0';}
char myitoc(ll N) {return '0' + N;}
#define FINALANS(A) {cout << (A) << '\n'; exit(0);}

int main()
{
  string S, T;
  cin >> S >> T;
  cout << T << S << endl;
}

Measured memory_bytes: 256
import scala.io.StdIn.readInt

object Main {
  def sieve(n:Int) = {
    val primes = Array.tabulate(n+1) { _ % 2 }
    primes(1) = 0
    primes(2) = 1

    for( i <- 3 to Math.sqrt(n).toInt by 2 )
      if(primes(i) == 1)
        (i*i to n by i*2).foreach { primes(_) = 0 }
    primes
  }

  def main(args:Array[String]) = {
    val p = sieve(50000)
    var n = 0
    while( { n = readInt; n} != 0 ) {
      var cnt = 0
      if(p(n-2) == 1) cnt = 1
      else if(n%2==0) {
        for(i<- 3 to n/2 by 2)
          if(p(i) ==1 && p(n-i) ==1)
            cnt += 1
      }
      println(cnt)
    }
  }
}

Measured memory_bytes: 50788
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int num = sc.nextInt();

		List<Integer> priceList = new ArrayList<>();

		for (int i = 0; i < num; i++) {
			priceList.add(sc.nextInt());
		}
		sc.close();

		Collections.sort(priceList);

		int total = 0;

		for (int i = 0; i < priceList.size(); i++) {

			if (i == priceList.size() - 1) {
				total += priceList.get(i) / 2;
			} else {
				total += priceList.get(i);
			}
		}

		System.out.println(total);
	}

}


Measured memory_bytes: 21588
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned ll
#define uint ungigned
#define db double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pli pair<ll,int>
#define vi vector<int>
#define vpi vector<pii >
#define IT iterator
 
#define PB push_back
#define MK make_pair
#define LB lower_bound
#define UB upper_bound
#define y1 wzpakking 
#define fi first
#define se second
#define BG begin
#define ED end
 
#define For(i,j,k) for (int i=(int)(j);i<=(int)(k);i++)
#define Rep(i,j,k) for (int i=(int)(j);i>=(int)(k);i--)
#define UPD(x,y) (((x)+=(y))>=mo?(x)-=mo:233)
#define CLR(a,v) memset(a,v,sizeof(a))
#define CPY(a,b) memcpy(a,b,sizeof(a))
#define sqr(x) (1ll*x*x)
 
#define LS3 k*2,l,mid
#define RS3 k*2+1,mid+1,r
#define LS5 k*2,l,mid,x,y
#define RS5 k*2+1,mid+1,r,x,y
#define GET pushdown(k);int mid=(l+r)/2
#define INF (1<<29)
using namespace std;
const int N=505;
char s[N];
int n,cnt[N];
ll ans;
int a[N][N],sum[N][N];
int l[N][N],r[N][N];
int tl[N][N],tr[N][N];
void recalc(int i){
	For(j,1,n) sum[i][j]=sum[i][j-1]+a[i][j];
}
int S(int i,int l,int r){
	return sum[i][r]-(l?sum[i][l-1]:0);
}
int main(){
	scanf("%d",&n);
	For(i,1,n){
		scanf("%s",s+1);
		For(j,1,n) a[i][j]=(s[j]=='#'?0:s[j]-48);
		recalc(i);
	}
	For(i,1,n) For(j,1,n)
		l[i][j]=n+1,r[i][j]=0;
	Rep(x,n,1){
		For(i,1,n) For(j,1,n)
			tl[i][j]=n+1,tr[i][j]=0;
		For(y,x,n)
			if (y==x){
				Rep(j,n,1) if(a[y][j]){
					tl[y][j]=j;
					tr[y][j]=max(j,j==n?0:tr[y][j+1]);
					ans+=1ll*a[y][j]*S(y,tl[y][j]+1,tr[y][j]);
				}
			}
			else{
				Rep(j,n,1) if (a[x][j]){
					tl[y][j]=min(l[y][j],j==n?n+1:tl[y][j+1]);
					tr[y][j]=max(r[y][j],j==n?0:tr[y][j+1]);
				}
				For(j,1,n) cnt[j]=0;
				For(j,1,n) if (tl[y][j]<=tr[y][j]){
					++cnt[tl[y][j]];
					--cnt[tr[y][j]+1];
				}
				For(j,1,n){
					cnt[j]+=cnt[j-1];
					if (!cnt[j]&&a[y][j])
						a[y][j]=0,recalc(y);
				}
				For(j,1,n)
					if (tl[y][j]<=tr[y][j])
						ans+=1ll*a[x][j]*S(y,tl[y][j],tr[y][j]);
			}
		For(i,1,n) For(j,1,n)
			l[i][j]=tl[i][j],r[i][j]=tr[i][j];
	}
	printf("%lld",ans);
}

Measured memory_bytes: 6144
import math
from itertools import permutations
n = int(input())
xy = [list(map(int, input().split())) for _ in range(n)]
junnretu = [i for i in range(n)]
junnretu = list(permutations(junnretu))
ans = 0


def distance(a, b):
    return ((a[0]-b[0])**2 + (a[1]-b[1])**2)**0.5


dis_sum = 0
for i in range(math.factorial(n)):
    for j in range(n-1):
        dis_sum += distance(xy[junnretu[i][j]], xy[junnretu[i][j+1]])


ans = dis_sum / math.factorial(n)
print(ans)

Measured memory_bytes: 46704
#include<bits/stdc++.h>
#define pb push_back
using namespace std;
typedef vector<int> vi; 
const int M=1e5+5;
vi topol,adj[M],mol[M];
int st[M],ft[M],mark[M],ptr,flag[M];
void pfs(int v){
	mark[v]=1;
	for(int e:adj[v]) if(st[e]==v && !mark[ft[e]]){
		pfs(ft[e]);
	}
	topol.pb(v);
}
void dfs(int v){
	flag[v]=ptr,mol[ptr].pb(v);
	for(int e:adj[v]) if(st[e]==v && !flag[ft[e]]){
		dfs(ft[e]);
	}
}
int32_t main()
{
	int n,m; scanf("%d%d",&n,&m);
	for(int i=0;i<m;i++){
		scanf("%d%d",st+i,ft+i);
		adj[st[i]].pb(i),adj[ft[i]].pb(i);
	}
	for(int i=0;i<n;i++) if(!mark[i]) pfs(i);
 	for(int i=0;i<m;i++) swap(st[i],ft[i]);
	for(int i=n-1;~i;i--) if(!flag[topol[i]]) ++ptr,dfs(topol[i]);
	int q; scanf("%d",&q);
	while(q--){
		int u,v; scanf("%d%d",&u,&v);
		printf("%d\n",(flag[u]==flag[v]?1:0));
	}
/*
	for(int i=1;i<=ptr;i++){
		for(int v:mol[i]) printf("%d ",u);
		printf("\n");
	}
*/
	return 0;
}



Measured memory_bytes: 8824
# include<cstdio>
# include<iostream>
# include<algorithm>
# include<cmath>
# include<cstring>
# include<string>
using namespace std;
typedef long long ll;
int main()
{
    string p;
    cin>>p;
    cout<<2018;
    for(int i=4;i<p.length();i++) cout<<p[i];
    cout<<endl;
    return 0;
}


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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  string S;
  cin >> S;
 
  int cnt1 = 0;
  int cnt2 = 0;
  char c1 = '0';
  char c2 = '1';
  for (int i = 0; i < S.length(); i++) {
    if (S[i] != c1) {
      cnt1++;
    }
    if (S[i] != c2) {
      cnt2++;
    }
    char t = c1;
    c1 = c2;
    c2 = t;
  }
  cout << min(cnt1, cnt2) << "\n";
  return 0;
}

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

long long int x[52]={0}, y[52]={0};

int main(){
    int n, k;
    cin >> n >> k;
    for(int i=0;i<n;++i){
        cin >> x[i] >> y[i];
    }

    long long int ans = LLONG_MAX;
    if(k == 2){
        for(int i=0;i<n;++i){
            for(int j=i+1;j<n;++j){
                long long int area = (max(x[i],x[j]) - min(x[i], x[j])) * (max(y[i],y[j]) - min(y[i],y[j]));
                ans = min(ans, area);
            }
        }
    }else if(k == 3){
        for(int i=0;i<n;++i){
            for(int j=i+1;j<n;++j){
                for(int l=j+1;l<n;++l){
                    long long int area = (max(x[i],max(x[j],x[l])) - min(x[i], min(x[j],x[l]))) * (max(y[i],max(y[j],y[l])) - min(y[i],min(y[j],y[l])));
                    ans = min(ans, area);
                }
            }
        }
    }else{
        for(int i=0;i<n;++i){
            for(int j=i+1;j<n;++j){
                for(int l=j+1;l<n;++l){
                    for(int s=l+1;s<n;++s){
                        long long int left = min(x[i], min(x[j], min(x[l],x[s])));
                        long long int right = max(x[i], max(x[j], max(x[l],x[s])));
                        long long int bottom = min(y[i], min(y[j], min(y[l],y[s])));
                        long long int top = max(y[i], max(y[j], max(y[l],y[s])));
                        int cnt = 0;
                        for(int m=0;m<n;++m){
                            if(x[m] >= left && x[m] <= right && y[m] >= bottom && y[m] <= top)cnt++;
                        }
                        if(cnt >= k){
                            long long int area = (right - left) * (top - bottom);
                            ans = min(ans, area);
                        }
                    }
                }
            }
        }
    }

    cout << ans << endl;

    return 0;
}


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

const int MAXn = 3e5 + 10;

int n, x, a[MAXn];
bool flag[MAXn];
int main() {
	cin >> n >> x;
	
	if (n == 1) {
		if (x == 2)
			cout << "Yes\n1\n2\n3";
		else
			cout << "No";
		return 0;
	}
	
	if (2 * n - 1 == x || x == 1)
		return cout << "No",0;
	
	if (x == 2) {
		int mx = 2 * n - 1;
		a[n - 1] = 1;
		a[n - 2] = mx;
		a[n] = 2;
		a[n + 1] = mx - 1;
		for (auto i: {1, 2, mx - 1, mx})
			flag[i] = true;
		int cnt = 3;
		while (flag[cnt])
			cnt++;
		for (int i = 0; i < 2 * n - 1; i++)
			if (a[i] == 0) {
				a[i] = cnt;
				cnt++;
				while (flag[cnt])
					cnt++;
			}
	} else {
		int mx = 2 * n - 1;
		a[n - 1] = x;
		a[n - 2] = 1;
		a[n] = mx;
		a[n + 1] = 2;
		for (auto i: {1, 2, x, mx})
			flag[i] = true;
		int cnt = 3;
		while (flag[cnt])
			cnt++;
		for (int i = 0; i < 2 * n - 1; i++)
			if (a[i] == 0) {
				a[i] = cnt;
				cnt++;
				while (flag[cnt])
					cnt++;
			}
	}
	
	cout << "Yes" << endl;
	for (int i = 0; i < 2 * n - 1; i++)
		cout << a[i] << endl;
}

Measured memory_bytes: 2304
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  
  int x;
  
  cin >> x;
  
  if(x == 0){
    
    cout << "1" << endl;}
 else if(x == 1){
   
   cout << "0" << endl;}
  
  
  
  
  
  
  
  
}

Measured memory_bytes: 3628
use std::io::{self, Write};
use parse::ParseNext;
use std::cmp::{max, min};

fn main() {
    let stdin = io::stdin();
    let mut r = read::Reader::new(io::BufReader::new(stdin));
    let mut i = r.read_line().unwrap().split_whitespace();
    let (k, x): (i32, i32) = (i.parse_next().unwrap(), i.parse_next().unwrap());
    let d = k - 1;
    let (start, end) = (max(x - d, -1000000), min(x + d, 1000000));
    let stdout = io::stdout();
    let mut w = io::BufWriter::new(stdout.lock());
    for i in start..end {
        write!(w, "{} ", i).unwrap();
    }
    writeln!(w, "{}", end).unwrap();
}

/// 文字列のパースの補助モジュール.
pub mod parse {
    use std::error;
    use std::fmt;
    use std::str::FromStr;

    #[derive(Eq, PartialEq, Copy, Clone, Hash, Debug)]
    pub enum Error<E> {
        GetNextError,
        ParseErr(E),
    }

    impl<E: fmt::Display> fmt::Display for Error<E> {
        #[inline]
        fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
            match self {
                &Error::GetNextError => f.write_str("Iterator has no next element"),
                &Error::ParseErr(ref e) => write!(f, "{}", e)
            }
        }
    }

    impl<E: error::Error> error::Error for Error<E> {
        #[inline]
        fn description(&self) -> &str {
            match self {
                &Error::GetNextError => "Iterator error",
                &Error::ParseErr(ref e) => e.description()
            }
        }
    }

    pub trait ParseNext: Iterator {
        fn parse_next<F: FromStr>(&mut self) -> Result<F, Error<F::Err>>;
    }

    impl<'a, S: AsRef<str>, I: Iterator<Item=S>> ParseNext for I {
        fn parse_next<F: FromStr>(&mut self) -> Result<F, Error<F::Err>> {
            if let Some(s) = self.next() {
                match s.as_ref().parse() {
                    Ok(x) => Ok(x),
                    Err(e) => Err(Error::ParseErr(e))
                }
            } else {
                Err(Error::GetNextError)
            }
        }
    }
}

/// 標準入力読み取りモジュール.
pub mod read {
    use std::io::{BufRead, Result};

    pub struct Reader<R> {
        buf: String,
        inner: R,
    }

    impl<R> Reader<R> {
        #[inline]
        pub fn new(inner: R) -> Self {
            Reader { buf: String::new(), inner: inner }
        }
    }

    impl<R: BufRead> Reader<R> {
        #[inline]
        pub fn read_line(&mut self) -> Result<&str> {
            self.buf.clear();
            self.inner.read_line(&mut self.buf)?;
            Ok(&self.buf)
        }
    }
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define endl "\n"
#define ll long long int
#define pii pair<int,int>
#define pll pair<long long, long long>
#define mod 1000000007
#define inf 1000000000000000001;
#define all(c) c.begin(),c.end()
#define mp(x,y) make_pair(x,y)
#define mem(a,val) memset(a,val,sizeof(a))
#define eb emplace_back
#define f first
#define s second
#define MAXN 1000007
#define fr(i, s, e, st) for(ll (i) = (s); (i) < (e); (i) += (st))
#define fre(i, s, e, st) for(ll (i) = (s); (i) <= (e); (i) += (st))
#define fastio ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);cout<<fixed;cout<<setprecision(10);
 
using namespace std;
int main()
{
    fastio;
    int T = 1;
    while(T--){
        ll a, b, k;
        cin>>a>>b>>k;
        if(a>=k){ 
            a-=k;
            cout<<a<<" "<<b;
        }
        else
        {
            b-=k-a;
            if(b<0)b=0;
            cout<<0<<" "<<b;
        }
    }                                               
    return 0;
}

Measured memory_bytes: 256
h, w, K = map(int, input().split())
c = [input() for _ in range(h)]
ans = 0
for i in range(2**h):
    dh = [(i >> j) & 1 for j in range(h)]
    for k in range(2**w):
        dw = [(k >> j) & 1 for j in range(w)]
        res = 0
        for nh in range(h):
            for nw in range(w):
                if dh[nh]==0 and dw[nw]==0:
                    if c[nh][nw]=="#":
                        res += 1
        if res == K: 
            ans += 1

print(ans)

Measured memory_bytes: 9216
# coding: utf-8
import sys
#from operator import itemgetter
sysread = sys.stdin.buffer.readline
read = sys.stdin.buffer.read
#from heapq import heappop, heappush
from collections import defaultdict
sys.setrecursionlimit(10**7)
import math
#from itertools import product, accumulate, combinations, product
#import bisect# lower_bound etc
#import numpy as np
#from copy import deepcopy
#from collections import deque


def run():
    A, B, C, K = map(int, read().split())
    k1 = math.ceil(math.log2(A/B))
    if math.ceil(math.log2(A / B)) == math.log2(A / B):
        k1 += 1
    if k1 < 0:
        k1 = 0
    B *= 2 ** k1
    k2 = math.ceil(math.log2(B/C))
    if math.ceil(math.log2(B/C)) == math.log2(B/C):
        k2 += 1
    if k2 < 0:
        k2 = 0

    #print(k1, k2, [A,B,C])
    if K >= k1 + k2:
        print('Yes')
    else:
        print('No')



if __name__ == "__main__":
    run()

Measured memory_bytes: 9584
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=1e5+10;
int a[maxn];
int main()
{
    int m,n;
    cin>>n;
    cin>>m;
    int k=-1;
    int f=0;
    if(n>m)
        int f=0;
    swap(n,m);
    int ans=0;
    int temp=(m-n)/2;
    if(abs(temp-n)==abs(temp-m))
    {
        f=1,ans=temp;
    }
    temp=(m+n)/2;
    if(abs(temp-n)==abs(temp-m))
    {
        f=1,ans=temp;
    }

    if(f==1)
        cout<<ans<<endl;
    else
        puts("IMPOSSIBLE");

    return 0;
}


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

#define PI 3.1415926535897932
#define MOD 1000000007
#define INF 1e9

#define REP(i, n) for(int i = 0; i < (n); i++)
#define REP1(i, n) for(int i = 1; i <= (n); i++)
#define ALL(v) (v).begin(), (v).end()
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO  cout << "NO"  << endl
#define No  cout << "No"  << endl

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef vector<bool> vb;


void solve()
{
    int N; cin >> N;
    vi P(N); REP(i, N) cin >> P[i];
    int ans = 0;
    int m = INF;
    REP(i, N)
    {
        if(m > P[i])
        {
            ans++;
            m = P[i];
        }
    }
    cout << ans << endl;
}
    
int main() 
{
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    solve();

    return 0;
}

Measured memory_bytes: 1024
#include<stdio.h>
#include<math.h>
int main()
{
    int h1,m1,h2,m2,k;
    scanf("%d%d%d%d%d",&h1,&m1,&h2,&m2,&k);
    printf("%d",(h2-h1)*60+m2-m1-k);
    return 0;
}

Measured memory_bytes: 1732
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <array>
#include <bitset>
#include <assert.h>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

int main() {
    int n;
    cin >> n;
    
    VI a(n), b(n);
    REP(i,n) a[i] = in(), a[i]--;
    REP(i,n) b[i] = in(), b[i]--;

    VI p(n);

    set<int> st;
    REP(i,n) st.insert(i);

    REP(i,n){
        p[a[i]] = b[i];
        st.erase(b[i]);
    }

    if (st.empty()){
        cout << "Yes" << endl;
        return 0;
    }

    cout << "No" << endl;

    REP(i,n){
        if (i > 0) cout << " ";
        cout << 1;
    }
    cout << endl;
    REP(i,n){
        if (i > 0) cout << " ";
        if (st.count(a[i])) cout << 2;
        else cout << 1;
    }
    cout << endl;

    return 0;
}


Measured memory_bytes: 8712
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cstdint>
#include <cstdlib>
#include <cmath>
#include <complex>
#include <chrono>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>
#include <random>
#include <utility>
#include <limits>
#include <list>
#include <type_traits>

/* template start */
 
#define rep(i, a, b) for (long long i = (a); (i) < (b); (i)++)
#define all(i) i.begin(), i.end()

#ifdef LOCAL
#define debug(...) std::cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif

void debug_out(){std::cerr<<std::endl;}

template<typename Head,typename... Tail>
void debug_out(Head h,Tail... t){
  std::cerr<<" "<<h;
  if(sizeof...(t)>0)std::cout<<" :";
  debug_out(t...);
}
 
template <typename T1, typename T2>
std::ostream& operator<<(std::ostream& os, std::pair<T1, T2> pa) {
  return os << pa.first << " " << pa.second;
}
 
template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
  for (std::size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
  return os;
}
 
template<typename T1,typename T2>
inline bool chmax(T1& a,T2 b){return a<b && (a=b,true);}
 
template<typename T1,typename T2>
inline bool chmin(T1& a,T2 b){return a>b && (a=b,true);}

template<typename Num>
constexpr Num mypow(Num a, long long b) {
  if(b==0)return 1;
  if (a==0)return 0;
  Num x = 1;
  while (b > 0) {
    if(b & 1)x*=a;
    a*=a;
    b >>= 1;
  }
  return x;
}

/* template end */

using ll = long long;

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

  ll n;
  std::cin>>n;

  std::vector<ll> a(n);
  for(auto&& e:a)std::cin>>e;

  ll sum=0;
  rep(i,0,n)sum^=a[i];

  rep(i,0,n){
    std::cout<<(sum^a[i])<<" ";
  }

  std::cout<<"\n";

  return 0;
}

Measured memory_bytes: 4780
from collections import deque
H, W = map(int, input().split())

def bfs(y, x):
  q = deque([[y, x]])
  while q:
    y,x = q.popleft()

    for a, b in zip([1,0,-1,0], [0,1,0,-1]):
      if 0 <= y+a < H and 0 <= x+b < W:
        if maze[y+a][x+b] == "." and visted[y+a][x+b] == -1:
          visted[y+a][x+b] = visted[y][x] + 1
          q.append([y+a, x+b])
  return 0

maze = []
dots=[]
for h in range(H):
  maze.append(input())
  for w in range(W):
    if maze[-1][w] == ".":
      dots.append([h, w])

ans=0
for i in range(len(dots)):
  sy = dots[i][0]
  sx = dots[i][1]
  visted = [[-1] * W for _ in range(H)]
  visted[sy][sx]=0
  bfs(sy, sx)
  for g in dots[i+1:]:
    gy = g[0]
    gx = g[1]
    ans = max(ans, visted[gy][gx])

print(ans)

Measured memory_bytes: 3444