akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int64 i = 0;i < (n);i++)
#define FOR(i, a, b) for(int64 i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-10;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value!=0>::type
fill_v(U &u,const V... v){u=U(v...);}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value==0>::type
fill_v(U &u,const V... v){
  for(auto &e:u) fill_v<T>(e,v...);
}

string s;

bool ok (int64 a, int64 b) {
  if (s[a] == '#' || s[b] == '#') return 0;
  FOR(i, a, b-1) {
    if (s[i] == '#' && s[i+1] == '#') return 0;
  }
  return 1;
}

int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);
  int64 N, A, B, C, D;
  cin >> N >> A >> B >> C >> D; A--; B--; C--; D--;
  cin >> s;
  if (A > B) { swap(A, B); swap(C, D); }
  if (A < B && C < D) {
    if (ok(A, C) && ok(B, D)) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  } else {
    bool f = 0;
    FOR(i, B, D+1) {
      if (i > 0 && i+1 < N) {
        f |= s[i-1] == '.' && s[i] == '.' && s[i+1] == '.';
      }
    }
    if (ok(A, C) && ok(B, D) && f) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  }
}

Measured memory_bytes: 592
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <functional>
#include <climits>
#include <cstring>
#include <cmath>
#include <numeric>
#include <iomanip>

using namespace std;

#define int long long

#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 rrep(i, n) for (int i=(int)n-1;i>=0;--i)
#define rrep1(i, n) for (int i=n;i>=1;--i)
#define range(i, l, r) for (int i=l;i<(int)r;++i)
#define rrange(i, l, r) for (int i=(int)r-1;i>=(int)l;--i)
#define unless(a) if(!(a))
#define all(a) begin(a),end(a)
#define fst first
#define scd second
#define PB emplace_back
#define PPB pop_back

using vi=vector<int>;
using pii=pair<int, int>;

bool chmin(int&a,int b){return a>b?(a=b,true):false;}
bool chmax(int&a,int b){return a<b?(a=b,true):false;}
int read(){int a;scanf("%lld",&a);return a;}
constexpr int TEN(int n){return n==0?1:10*TEN(n-1);}

int N, M;

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

	if (N % 2) {
		int l = 1, r = N;

		rep(_, M) {
			printf("%lld %lld\n", l, r);
			l++;
			r--;
		}
	} else {
		int l = 1, r = N;
		int cur = 1;
		while (cur * 2 * 2 <= N and M > 0) {
			printf("%lld %lld\n", l, r);
			l++;
			r--;
			cur++;
			M--;
		}
		r--;
		rep(i, M) {
			printf("%lld %lld\n", l, r);
			l++;
			r--;
		}
	}
}



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

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    string str;
    while(getline(cin, str)) {
        for(int i=0; i<25; i++) {
            if(str.find("the")!=string::npos) break;
            if(str.find("this")!=string::npos) break;
            if(str.find("that")!=string::npos) break;
            for(int i=0, l=str.length(); i<l; i++) {
                if(str[i]=='z') str[i]='a';
                else if(islower(str[i])) ++str[i];
            }
        }
        cout<<str<<'\n';
    }
    return 0;
}

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

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

    int A;
    cin >> A;

    int B;
    cin >> B;

    if(N*A <= B){
        cout << N*A << endl;
    }

    else{
        cout << B << endl;
    }
}

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

int main(void)
{
	int T;
	cin >> T;

	for(int i = 1, a, b, c; i <= T; i++){
		cin >> a >> b >> c;

		if(a * a + b * b == c * c || b * b + c * c == a * a || c * c + a * a == b * b)
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
	}

	return 0;
}

Measured memory_bytes: 3000
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<long long, long long>;
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
constexpr long long INF = 1001001001LL;
constexpr long long LINF = 1001001001001001001;
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define rept(i, j, n) for(int i=(j); i<(n); i++)
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; cin >> n;
    map<ll, ll> A, B;//数keyがvalue個ある
    rep(i, n){
        int index = i+1;
        ll a; cin >> a;
        A[index + a]++;
        B[index - a]++;
    }
    ll res = 0;
    for(auto mp: A){
        ll a = mp.second;
        ll b = B[mp.first];
        res += a*b;
    }
    cout << res << ln;
}

Measured memory_bytes: 37748
//ProblemB.cpp
 
#include <iostream>
 
static std::istream & ip = std::cin;
static std::ostream & op = std::cout;
 
#if OJ_MYPC
#include <ojio.h>
#endif
 
#ifndef OPENOJIO
#define OPENOJIO
#endif
 
#if 1 || DEFINE
/***************************************************************/
typedef unsigned long long u64;
typedef long long s64;
 
typedef unsigned uint;
 
#define ABS(x) ((x) > 0 ? (x) : -(x))
 
#define MIN(x, y) ((x) < (y) ? (x) : (y))
#define MAX(x, y) ((x) > (y) ? (x) : (y))
 
#define MIN3(x, y, z) MIN(x, MIN(y, z))
#define MAX3(x, y, z) MAX(x, MAX(y, z))
 
#define FillZero(arr) memset(arr, 0, sizeof(arr));
 
/***************************************************************/
#endif //1 || DEFINE
 
#include <string>
#include <vector>
#include <map>
#include <set>
#include <bitset>
#include <queue>
#include <stack>
#include <utility>
#include <algorithm>
#include <iomanip>
#include <cstring>
#include <cmath>
#include <cstdio>
 
//001
//op << setfill('0') << setw(3) << setiosflags(ios::right) << 1;
 
//op << fixed << setprecision(20);
 
using namespace std;
 
//ProblemB.cpp
 
int main(int argc, char* argv[])
{
	OPENOJIO;
 
	int n;
	vector<s64> cards;
 
	ip >> n;
	cards.resize(n);
 
	s64 rst = 0; s64 pre = 0;
	for (int i = 0; i < n; ++i) {
		ip >> cards[i];
 
		s64 t = cards[i] + pre;
		rst += t / 2;
 
		if(cards[i] > 0) pre = t % 2;
		else pre = 0;
	}
 
	op << rst << endl;
	return 0;
}
/***************************************************************/

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

int main(){
  string A;
  cin >> A;
  if(A.at(5)=='0'){
    if(A.at(6)=='1'||A.at(6)=='2'||A.at(6)=='3'||A.at(6)=='4'){
      cout << "Heisei" << endl;
    }
    else{
      cout << "TBD" << endl;
    }
  }
  else{
    cout << "TBD" << endl;
  }
}

Measured memory_bytes: 3596
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <map>
#include <cstdio>
#include <string>
#include <cstdlib>
#include <cstring>
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
const long double EPS = 1e-9;
const ll mod = 1e9 + 7;
const ll INF = 1e9;

#define rep(i, n) for(ll i = 0; i < n ; i++ )
#define For(i, a, b) for(ll i = (a); i < (b) ; i++ )
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()

const ll MAX_N = 100000;

int main(void){
    ll N;
    ll bin[30];
    string answer;

    cin >> N;
    rep(i, 30) bin[i] = 0;
    rep(i, N){
        ll a;
        cin >> a;
        ll cnt = 0;
        while (cnt < 30){
            if (a % 2 == 1) bin[cnt] ++;
            a /= 2;
            cnt ++;
        }
    }
    answer = "Yes";
    rep(i, 30) if (bin[i] % 2 == 1) answer = "No"; 

    cout << answer << endl;

    return 0;
} 

Measured memory_bytes: 256
// copied by Nurstan Duisengaliev
// skatal
#include <bits/stdc++.h>
 
#define ll long long
#define all(x) x.begin(), x.end()
#define in insert
#define mp make_pair
#define F first
#define S second
#define ppf pop_front
#define pb push_back
#define ppb pop_back
#define pf push_front
#define pii pair <int, int>
#define boost() ios_base::sync_with_stdio(0), cin.tie(0)
#define sz(x) (int)x.size()
#define int ll 
using namespace std;
 
const int N = (int)2e5 + 123;
const int mod = (int)1e9 + 7;
const ll INF = (ll)1e18 + 7;
int a[N];
void solve () {
	int n, k;
	cin >> n >> k;
	for (int i = 1; i <= n; i ++) {
		cin >> a[i];
	}
	if (k >= n) {
		cout << 0;
		return;
	}
	sort (a + 1, a + n + 1);
	int sum = 0;
	for (int i = 1; i <= n - k; i ++) {	
		sum += a[i];	              	
	}
	cout << sum;
}
 
main () {
//	freopen (".in", "r", stdin);
//	freopen (".out", "w", stdout);
	boost ();
	int TT = 1;
//  cin >> TT;
	while (TT --) {
		solve ();
	}
	return 0;	
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
 
#define loop(n, i) for(int i=0;i<n;i++)

using namespace std;

int less_than(string a, string b)
{
    int d = a.length() - b.length();
    if (d) return d < 0;
    return a < b;
}

int main()
{
    while (1) {
        int w, h; cin >> w >> h;
        if (!w) break;
        vector<string> rows(h+1);
        loop (h, i) cin >> rows[i];

        string dp[80][80];
        fill(dp[0], dp[79]+80, "");

        for (int i = h-1; i >= 0; i--) {
            for (int j = w-1; j >= 0; j--) {
                if (rows[i][j] < 'A') {
                    dp[i][j] = rows[i][j] + max(dp[i+1][j], dp[i][j+1], less_than);
                }
            }
        }

        string ans = "";
        loop (h, i) loop (w, j) {
            if (rows[i][j] < 'A' && rows[i][j] != '0') {
                ans = max(ans, dp[i][j], less_than);
            }
        }
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 1380
#include <bits/stdc++.h>
using namespace std;
int main(){
  
  int N;
  cin >> N;
  
  string S;
  cin >> S;
  
  int num;
  
  if(N % 2 == 0){
    for(int i = 0;i < N / 2;++i){
      num = i + N / 2;
      if(!(S[i] == S[num])){
        cout << "No" << endl;
        return 0;
      }
    }
  }
  else{
    cout << "No" << endl;
    return 0;
  }
    
    cout << "Yes" << endl;
    
  
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
static const ll INF = 1<<21;
static const ll MOD = 1e9 + 7;

bool pairCompare(const pair<int, int>& firstElof, const pair<int, int>& secondElof) {
    return firstElof.first > secondElof.first;
}

int main(void) {
    int N, K;
    cin >> N >> K;

    double p=0;
    int cnt;
    for(int i=1;i<=N;i++) {
        float d = 1.0;
        cnt=0;
        while(d<(((double)K)/i)) {
            d *= 2.0;
            cnt++;
        }
        p += 1.0/((double)N)/d;
    }
    cout << setprecision(10) << p << endl;

    return (0);
}


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        Integer N = input.nextInt();
        Integer[] org = new Integer[N];
        Arrays.fill(org, 0);
        for (int i = 1; i < N; i++) {
            org[input.nextInt()-1]++;
        }
        for (int num : org) {
            System.out.println(num);
        }
    }
}


Measured memory_bytes: 60092
import java.util.Scanner;
public class Main
{
	public static void main( String args[] )
	{
		Scanner input = new Scanner(System.in);
		int[][][] bd = new int[4][3][10];
		int n = input.nextInt();
		int a, b, c, d;
		for(int i = 0; i < n; i++)
		{
			a = input.nextInt();
			b = input.nextInt();
			c = input.nextInt();
			d = input.nextInt();
			bd[a-1][b-1][c-1] += d;
		}
		for(int i = 0; i < 4; i++)
		{
			for(int j = 0; j < 3; j++)
			{
				for(int k = 0; k < 10; k++)
				{
					System.out.print(" " + bd[i][j][k]);
				}
				System.out.println();
			}
			if(i < 3)
				System.out.println("####################");
		}
	}
}

Measured memory_bytes: 30128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef map<int,int> mii;
typedef map<ll,ll> mll;
typedef vector<pii> vii;
typedef vector<pll> vll;
#define fi first
#define se second
#define pi 3.141592653589793
#define mod 1e9 + 7
#define pb push_back
#define all(v) v.begin(),v.end()
#define rall(v) v.begin(), v.end(), greater<ll>()
#define tc int t;cin>>t;while(t--)
#define pqmax priority_queue<int>
#define pqmin priority_queue<int,vi,greater<int>>
#define fast_io ios_base::sync_with_stdio(0), cin.tie(NULL)
#define tc_g int tt;cin>>tt;for(int ti=1;ti<=tt;ti++)
#define case_g "Case #"<<ti<<": "
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_multiset;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
typedef tree<int, int, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_map;
using namespace std;
int main() {
    string ss;
    cin >> ss;
    if(ss == "ARC") cout << "ABC";
    else cout << "ARC";
}


Measured memory_bytes: 3564
#include <bits/stdc++.h>
#define LL long long
using namespace std;
const LL Maxn = 300000 + 100;
LL N;
LL A[Maxn];
inline int cmp(LL x, LL y)
{
	return x > y;
}
int main()
{
	scanf("%lld", &N);
	N *= 3;
	for (LL i = 1; i <= N; ++i)
		scanf("%lld", &A[i]);
	sort(A + 1, A + N + 1, cmp);
	LL Cnt = 0;
	LL Ans = 0;
	for (LL i = 2; i <= N; i += 2)
	{
		if (Cnt == (N / 3))break;
		Ans += A[i];
		++ Cnt;
	}
	printf("%lld\n", Ans);
	return 0;
}

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

#define GET_MACRO(a, b, c, d, NAME, ...) NAME
#define REP(...) GET_MACRO(__VA_ARGS__, REP4, REP3, REP2)(__VA_ARGS__)
#define REP2(i, a) REP3(i, 0, a)
#define REP3(i, a, b) REP4(i, a, b, 1)
#define REP4(i, a, b, s) for (int i = (a); i < (int)(b); i += (s))
#define REPR(...) GET_MACRO(__VA_ARGS__, REPR4, REPR3, REPR2)(__VA_ARGS__)
#define REPR2(i, a) REPR3(i, 0, a)
#define REPR3(i, a, b) REPR4(i, a, b, 1)
#define REPR4(i, a, b, s) for (int i = (b)-1; i >= (int)(a); i -= (s))
#define ALL(c) (c).begin(), (c).end()
#define DUMP(x) (std::cerr << #x << ':' << ' ' << x << '\n')
#define TMPL_T template <typename T>
#define TMPL_TU template <typename T, typename U>
#define mut auto
#define let const auto

using Int = long long;
// clang-format off
namespace extio {
std::string delimiter=" ",pdelimiter=" ";
std::string bracket_b="",bracket_e="";
void chdelim(const std::string&s){delimiter=s;}
void chpdelim(const std::string&s){pdelimiter=s;}
void chbracket(const std::string&b,const std::string&e){bracket_b=b,bracket_e=e;}
TMPL_T  void pcont(std::ostream&os,const T&x){int c=0;for(const auto&a:x){if(c++)os<<delimiter;os<<a;}}
TMPL_TU void ppair(std::ostream&os,const std::pair<T,U>&p){os<<bracket_b<<p.first<<pdelimiter<<p.second<<bracket_e;}
}
namespace std {
TMPL_T ostream& operator<<(ostream&os,const vector<T>&x){extio::pcont(os,x);return os;}
TMPL_T ostream& operator<<(ostream&os,const set<T>&x){extio::pcont(os,x);return os;}
TMPL_T ostream& operator<<(ostream&os,const multiset<T>&x){extio::pcont(os,x);return os;}
TMPL_T ostream& operator<<(ostream&os,const deque<T>&x){extio::pcont(os,x);return os;}
TMPL_TU ostream& operator<<(ostream&os,const map<T,U>&x){extio::pcont(os,x);return os;}
TMPL_TU ostream& operator<<(ostream&os,const pair<T,U>&x){extio::ppair(os,x);return os;}
}
TMPL_TU inline bool chmax(T&x,U a){return x<a&&(x=a,1);}
TMPL_TU inline bool chmin(T&x,U a){return a<x&&(x=a,1);}

inline int in(){int x;std::cin>>x;return x;}

struct Initializer_ {
  Initializer_(){
    std::cin.tie(0);
    std::ios::sync_with_stdio(0);
    std::cout << std::setprecision(10);
    std::cerr << std::setprecision(10);
  }
} precalc;
// clang-format on
// }}}

using namespace std;

int dp[20200];

signed main() {
  int N = in(), W = in();
  REP(i, N) {
    int v = in(), w = in();
    REPR(j, 0, W) chmax(dp[j + w], dp[j] + v);
  }
  cout << max_element(dp, dp + W + 1)[0] << endl;

  return 0;
}

Measured memory_bytes: 3240
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		
		int s = sc.nextInt();
		int[] nums = new int[1000000];
		
		nums[0] = s;
		
		for(int i=1; i<nums.length; i++) {
			if(nums[i-1]%2==0) {
				nums[i] = nums[i-1]/2;
			}else {
				nums[i] = 3*nums[i-1] + 1;
			}
		}
		for(int i=0; i<nums.length; i++) {
			int tmp = nums[i];
			for(int j=i+1; j<nums.length; j++) {
				if(nums[i] == nums[j]) {
					System.out.println(j+1);
					return;
				}
			}
		}
	}
}


Measured memory_bytes: 26068
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>
  
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
  
using namespace std;
  
typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;
  
const int INF=1<<29;
const double EPS=1e-9;
  
const int dx[]={1,0,-1,0,1,1,-1,-1},dy[]={0,-1,0,1,1,-1,-1,1};


int main() {
  string X;
  cin >> X;
  vector<char> S;
  int N = X.size();
  S.push_back(X[0]);
  for (int i = 1; i < N; i++) {
    S.push_back(X[i]);
    while(S.size() >= 2 && S[S.size() - 1] == 'T' && S[S.size() - 2] == 'S') {
      S.pop_back();
      S.pop_back();
    }
  }
  cout << S.size() << endl;

  return 0;
}

Measured memory_bytes: 772
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n)     for(int i = 0; i < (int)(n); i++)
#define rep2(i, m, n) for(int i = m; i < (int)(n); i++)
#define rep3(i, m, n) for(int i = m; i <= (int)(n); i++)
#define MOD 1000000007
#define Graph vector<vector<int>>
typedef pair<int, int> PII;
typedef long long int ll;

ll dp[100010][3];
ll a[100010][3];

int main(){
  int N;
  cin >> N;
  rep(i,N) cin >> a[i][0] >> a[i][1] >> a[i][2];

  dp[0][0] = 0;
  dp[0][1] = 0;
  dp[0][2] = 0;
  rep(i,N){
    dp[i+1][0] = max(dp[i][1]+a[i][0],dp[i][2]+a[i][0]);
    dp[i+1][1] = max(dp[i][0]+a[i][1],dp[i][2]+a[i][1]);
    dp[i+1][2] = max(dp[i][0]+a[i][2],dp[i][1]+a[i][2]);
  }

  ll ans = max(dp[N][0],max(dp[N][1],dp[N][2]));
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 4992
import heapq
import math
I = list(map(int,input().split()))
N = I[0]
M = I[1]
A = list(map(lambda x:-x,map(int,input().split())))
heapq.heapify(A)
for i in range(M):
    num = heapq.heappop(A)
    num = math.ceil(num / 2)
    heapq.heappush(A,num)

print(-sum(A))

Measured memory_bytes: 14532
#include <bits/stdc++.h>
using namespace std;
#define mod 998244353
#define MOD 1000000007
#define inf 0x3f3f3f3f
#define linf 0x3f3f3f3f3f3f3f3fll
typedef long long ll;
typedef pair<int,int> pii;
typedef unsigned long long ull;
const int maxn=2e5+10;
int p[maxn],n,k;
int pre[maxn],nxt[maxn];
int bad[maxn],sum[maxn];
deque<pii > dq;
set<pii > st;
int main()
{
	scanf("%d%d",&n,&k);
	for(int i=0;i<n;i++)
		scanf("%d",&p[i]);
	for(int i=0;i+1<n;i++)
	{
		bad[i]=p[i]>p[i+1];
		sum[i+1]=sum[i]+bad[i];
	}
	for(int i=0;i<n;i++)
		pre[i]==1,nxt[i]=n;
		
	for(int i=0;i<n;i++)
	{
		while(!dq.empty()&&dq.back().first<p[i])dq.pop_back();
		if(!dq.empty())pre[i]=dq.back().second;
		dq.push_back(make_pair(p[i],i));
	}
	
	
	dq.clear();
	for(int i=n-1;i>=0;i--)
	{
		while(!dq.empty()&&dq.front().first>p[i])dq.pop_front();
		if(!dq.empty())nxt[i]=dq.front().second;
		dq.push_front(make_pair(p[i],i));
	}
	
	dq.clear();
	int ans=n-k+1;
	bool no=0;
	for(int i=0;i+k-1<n;i++)
	{
		if(sum[i+k-1]-sum[i]==0)
		{
			no=1;
			ans--;
			continue;
		}
		int j=i+k;
		if(j<n&&nxt[i]>=j&&pre[j]<=i)ans--;
	}
	printf("%d\n",ans+no);
	return 0;
}


Measured memory_bytes: 4096
#include <iostream>
#include <vector>
#include <algorithm>

namespace Mylib{
    using namespace std;
    
    void LotteryCheck(vector<int>& vBin,vector<bool>& vChe,int x){
        auto result=find(vBin.begin(),vBin.end(),x);
        if(result!=vBin.end()){
            *result=-1;
            vChe[distance(vBin.begin(),result)]=true;
        }
    }
    
    bool BingoCheck(vector<bool>& v){
        if(v[0]&&v[1]&&v[2])return true;
        if(v[3]&&v[4]&&v[5])return true;
        if(v[6]&&v[7]&&v[8])return true;
        
        if(v[0]&&v[3]&&v[6])return true;
        if(v[1]&&v[4]&&v[7])return true;
        if(v[2]&&v[5]&&v[8])return true;
        if(v[0]&&v[4]&&v[8])return true;
        if(v[2]&&v[4]&&v[6])return true;
        
        return false;
    }
    
}
int main(void){
    using namespace std;
    vector<int> bingocard;
    vector<bool> checkcard;
    int tempInt,N;
    for(int i=0;i<9;i++){
        //ビンゴ設定
        cin >> tempInt;
        bingocard.push_back(tempInt);
        checkcard.push_back(false);
    }
    cin >> N;//抽選回数
    
    for(int i=0;i<N;i++){
        cin >> tempInt;
        Mylib::LotteryCheck(bingocard,checkcard,tempInt);
        Mylib::BingoCheck(checkcard);
    }
    if(Mylib::BingoCheck(checkcard)){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    
    return 0;
}

Measured memory_bytes: 256
import sys
import math
from fractions import gcd
# import queue
# from collections import Counter
# from itertools import accumulate
# from functools import reduce

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

def combination_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def permutations_count(n, r):
    return math.factorial(n) // math.factorial(n - r)

big_prime = 1000000007

"""
# 標準入力取得
## 文字列
 =  sys.stdin.readline().rstrip()
 =  list(sys.stdin.readline().rstrip())

## 数値
 =  int(sys.stdin.readline())
 =  map(int, sys.stdin.readline().split())
 =  list(map(int, sys.stdin.readline().split()))
 =  [list(map(int,list(sys.stdin.readline().split()))) for i in range(N)]
"""

M, D =  map(int, sys.stdin.readline().split())

if D < 10:
    print(0)
    exit()

cnt = 0

for m in range(1, M + 1):
    for i in range(10, D + 1):
        Ds = str(i)
        D10 = int(Ds[0])
        D1 = int(Ds[1])
        if m == D10 * D1:
            if D1 >= 2 and D10 >= 2:
                cnt += 1

print(cnt)

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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}


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

const int MAX_N = 2005;

ll dp[MAX_N][MAX_N];

int main2() {
  CLR(dp, 0);

  int N = nextInt();
  vector<pair<ll, int>> P(N);
  REP(i, N) P[i] = { nextInt(), i };

  sort(ALL(P));
  reverse(ALL(P));

  for (int L = 0; L <= N; L++) {
    for (int i = 0; i <= L; i++) {
      int j = L - i;
      {
        ll a = P[i + j].first;
        int fromIndex = P[i + j].second;
        int toIndex = i;
        chmax(dp[i+1][j], dp[i][j] + abs(fromIndex - toIndex) * a);
      }
      {
        ll a = P[i + j].first;
        int fromIndex = P[i + j].second;
        int toIndex = N - 1 - j;
        chmax(dp[i][j+1], dp[i][j] + abs(fromIndex - toIndex) * a);
      }
    }
  }

  ll ans = 0;
  REP(i, N+1) chmax(ans, dp[i][N-i]);
  cout << ans << endl;

  return 0;
}

int main() {

#ifdef LOCAL
  for (;!cin.eof();cin>>ws)
#endif
    main2();
  return 0;
}

Measured memory_bytes: 35112
a = gets.to_i
dp = Array.new
dp << 0
(1..(100010)).each do |n|
  dp[n] =  100000
  dp[n] =  dp[n - 1] + 1 < dp[n] ? dp[n - 1] + 1 : dp[n]
  power = 1
  while(power <= n)
    dp[n] = dp[n - power] + 1 < dp[n] ? dp[n - power] + 1 : dp[n]
    power *= 6
  end
  power = 1
  while(power <= n)
    dp[n] = dp[n - power] + 1 < dp[n] ? dp[n - power] + 1 : dp[n]
    power *= 9
  end
end

puts dp[a]

Measured memory_bytes: 2632
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <climits>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <algorithm>
#include <numeric>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define sz(x) ((int)(x).size())
#define sq(x) ((x)*(x))
#define fi first
#define sec second
#define SORT(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define repn(i,a,n) for(int (i)=(a);(i)<(int)(n);(i)++)
#define EQ(a,b) (abs((a)-(b))<eps)
int a[5]={5,7,5,7,7};
int solve(){
	int n;
	cin >> n;
	if(!n)return 1;
	vector<int> len(n);
	for(int i=0;i<n;i++){
		string s;
		cin >> s;
		len[i]=(int)s.size();
	}
	for(int i=0;i<n;i++){
		vector<int> b(5,0);
		int id = 0;
		for(int j=i;j<n;j++){
			b[id]+=len[j];
			if(b[id]>a[id])break;
			if(b[id]==a[id])id++;
			if(id==5)break;
		}
		if(id==5){
			printf("%d\n",i+1);
			return 0;
		}
	}
}
int main(){
	while(!solve()){}
	return 0;
}

Measured memory_bytes: 3208
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
#define mod 998244353 //((int)1e9+7)
#define lim 1000000000000000007
#define lim1 18446744073709551615  //Unsigned
#define sq(a) ((a)*(a))
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define mms(v,i) memset(v,i,sizeof(v))
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define REP(i,a,b) for (int i = a; i <= b; i++)
#define REPN(i,a,b) for (int i = a; i >= b; i--)
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef pair<int,int> pi;
typedef pair<ll,ll> PL;
typedef pair<ll,int> PLI;
typedef pair<int,ll> PIL;
typedef pair<int,pair<int,int> > pii;
typedef pair<double,double> pdd;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
ll power(ll a,ll b) {
   ll res=1;
   while(b){
      if(b%2==1) res=(res*a)%mod;
      a=(a*a)%mod;
      b>>=1;
   }
   return res;
}
ll gcdll(ll a,ll b) {
    if (b==0) return a;
    return gcdll(b,a%b);
}
int gcd(int a,int b) {
    if (b==0) return a;
    return gcd(b,a%b);
}

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

const int N = (int)2e5+5;
const int M = (int)3e3+5;
const int Q = 301;
const int logN = 19;

void solve() {
    ll n, x; int m;
    cin>>n>>x>>m;
    vector<ll> temp;
    unordered_map<ll,int> mp;
    ll sum = 0;
    REP(i,1,n) {
        sum = (sum+x);
        temp.pb(x);
        mp[x] = i-1;
        x = (x*x)%m;
        if(mp.count(x)){
            n -= i;
            ll tsum = 0;
            REP(k,mp[x],temp.size()-1) {
                tsum += temp[k];
            }
            int cnt = temp.size()-mp[x];
            sum += (n/cnt)*tsum;
            n %= cnt;
            REP(i,1,n) {
                sum += temp[mp[x]+i-1];
            }
            break;
        }
    }
    cout<<sum;
}
int main() {
    //freopen("output.txt","r",stdin);
    //freopen("output.txt","w",stdout);

    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    int T=1;
    //cin>>T;
    REP(TC,1,T) {
        //cout<<"Case #"<<TC<<": ";
        solve();
        cout<<"\n";
    }
}


Measured memory_bytes: 5660
# AOJ 0266: Aka-beko and 40 Thieves
# Python3 2018.6.26 bal4u

e = ((1, 2), (-1, 3), (1, -3), (4, 5), (5, 2), (2, 1))

while True:
	p = input()
	if p[0] == '#': break
	s, ans = 0, True;
	for i in p:
		s = e[s][int(i)]
		if s < 0:
			ans = False
			break
	if ans and s != 5: ans = False
	print("Yes" if ans else "No")


Measured memory_bytes: 5600
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<queue>
#include <cmath>
#include<algorithm>
#include<stack>
#include<map>
#include<ctime>
#define rep(i,n) for (int i=0;i<n;i++)
//#include <bits/stdc++.h>
using namespace std;

int main(){
    long int N;
    cin>>N;
    vector<long int> a(N),b(N),c(N);
    for (int i=0;i<N;i++) cin>>a[i]>>b[i]>>c[i];
    vector<vector<long int> > dp(N,vector<long int>(3));
    dp[0][0]=a[0];
    dp[0][1]=b[0];
    dp[0][2]=c[0];
    for (int i=1;i<N;i++){
        dp[i][0]=max(dp[i-1][1],dp[i-1][2])+a[i];
        dp[i][1]=max(dp[i-1][0],dp[i-1][2])+b[i];
        dp[i][2]=max(dp[i-1][1],dp[i-1][0])+c[i];
    }
    cout<<max({dp[N-1][0],dp[N-1][1],dp[N-1][2]});
    
    return 0;
}

Measured memory_bytes: 8064
// AOJ ITP1_10_B Triangle
// 2018.4.28 bal4u
 
#include <stdio.h>
#include <math.h>
 
#define PI 3.141592653589793
 
int main()
{
    double a, b, c, s, C;
    double S, L, h; 
     
    scanf("%lf%lf%lf", &a, &b, &C);
    c = sqrt(a*a + b*b - 2*a*b*cos(C*PI/180));
    L = a+b+c;
    s = L/2;
    S = sqrt(s*(s-a)*(s-b)*(s-c));
    h = 2*S/a;
    printf("%.8lf\n%.8lf\n%.8lf\n", S, L, h);
    return 0;
}


Measured memory_bytes: 2132
h,w,m = map(int,input().split())
row = [0]*(h+1)
col = [0]*(w+1)
bombs = set([])
for i in range(m):
  a,b = map(int,input().split())
  row[a] += 1
  col[b] += 1
  bombs.add((a,b))
r,c = max(row),max(col)
rcnt,ccnt = 0,0
for v in row:
  if v==r:
    rcnt += 1
for v in col:
  if v==c:
    ccnt += 1
doubled = 0
for i,j in bombs:
  if row[i]==r and col[j]==c:
    doubled += 1
if doubled==rcnt*ccnt:
  print(r+c-1)
else:
  print(r+c)

Measured memory_bytes: 60132
//OM
#include <cmath>
#include <cstdio>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <list>
#include <stack>
#include <queue>
#include <utility>
#include <sstream>
#include <algorithm>
using  namespace  std;

#define  x first
#define  y second
#define  pb push_back
#define  mp make_pair
#define  PI (acos(-1.0))
#define  mem(a,b) memset(a,b,sizeof(a))
#define  Sort(x) sort(x.begin(),x.end())
#define  FOR(i, b, e) for(int i = b; i <= (int)(e); i++)
#define  FORR(i, b, e) for(int i = b; i >=(int)(e); i--)
#define  FORI(i, s) for (__typeof ((s).end ()) i = (s).begin (); i != (s).end (); ++i)
#define  pr(x) cout<<x<<"\n"
#define  prs(x) cout<<x<<" "
#define  pr2(x,y) cout<<x<<" "<<y<<"\n"
#define  pr3(x,y,z) cout<<x<<" "<<y<<" "<<z<<"\n"
#define  ppr(a) cout<<a.x<<" "<<a.y<<"\n"

typedef  long long ll;
typedef  pair <int, int> pii;
typedef  pair <double , double> pdd;
typedef  vector <int> vi;
typedef  vector <pii> vpii;

//int dx[]={1,0,-1,0};int dy[]={0,1,0,-1}; //4 Direction
//int dx[]={1,1,0,-1,-1,-1,0,1};
//int dy[]={0,1,1,1,0,-1,-1,-1};//8 direction

#define  EPS 1e-9
#define  MAX 100007

int main()
{
    int T,n,a,b;
    scanf("%d",&a);
    scanf("%d",&b);
    if(a>0&&b>0)printf("Positive\n");
    else if(a<0&&b<0)
    {
        if((abs(a)-abs(b)+1)%2==0)printf("Positive\n");
            else printf("Negative\n");
    }
    else printf("Zero");
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <functional>
#include <map>
#include <set>

using namespace std;

typedef long long i64;
typedef i64 int_t;
typedef vector<int_t> vi;
typedef vector<vi> vvi;

typedef pair<int_t, int_t> pi;

#define tr(c, i) for(auto i = (c).begin(); i != (c).end(); i++)
#define pb push_back
#define sz(a) int((a).size())
#define all(c) (c).begin(), (c).end()
#define REP(s, e, i) for(i=(s); i < (e); ++i)

int main(int argc, char *argv[]) {
  i64 H, A;
  cin >> H >> A;
  i64 ans = H / A;
  if(H % A != 0)
    ++ans;
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
S=input()
flag=0
for i in range(len(S)):
  now=S[i]
  if i%2==1 and (now=="L" or now=="U" or now=="D"):
    continue
  elif i%2==0 and (now=="R" or now=="U" or now=="D"):
    continue
  else:
    print("No")
    flag=1
    break
if flag==0:
  print("Yes")


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

using namespace std;

using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
double eps = 0.0000001;

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  unsigned long long a, b, c;
  cin >> a >> b >> c;
  unsigned long long right = c - a - b;
  if (c < a + b) {
    cout << "No" << endl;
    return 0;
  }
  unsigned long long left = 4 * a * b;
  if (left < right * right)
    cout << "Yes" << endl;
  else cout << "No" << endl;

  return 0;
}


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

struct Edge {
  int to;
};

typedef vector<vector<Edge> > Graph;

int dfsA(const Graph &g, int v, int pre, int &times, vector<int> &num,
         vector<int> &ap) {
  int res = num[v] = times++;
  bool flag = false;
  int c = 0;
  for(int i = 0; i < g[v].size(); ++i) {
    int nv = g[v][i].to;
    int t;
    if(num[nv] == -1) {
      t = dfsA(g, nv, v, times, num, ap);
      ++c;
      if(~pre && t >= num[v]) {
        flag = true;
      }
    } else {
      t = num[nv];
    }
    if(nv != pre) {
      res = min(res, t);
    }
  }
  if(pre == -1 && c > 1) flag = true;
  if(flag) ap.push_back(v);
  return res;
}

vector<int> getArticulationPoint(const Graph &g) {
  vector<int> res;
  int n = g.size();
  int times = 0;
  vector<int> num(n, -1);
  for(int i = 0; i < n; ++i) {
    if(num[i] == -1) {
      dfsA(g, i, -1, times, num, res);
    }
  }
  return res;
}

int main() {
  int N, M;
  cin >> N >> M;
  Graph G(N);
  for(int i = 0; i < M; ++i) {
    int s, t;
    cin >> s >> t;
    G[s].push_back((Edge){t});
    G[t].push_back((Edge){s});
  }
  vector<int> ap = getArticulationPoint(G);
  sort(ap.begin(), ap.end());
  for(int i = 0; i < ap.size(); ++i) {
    cout << ap[i] << endl;
  }
  return 0;
}

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

int main(){
 string s,t,u;
  int a,b;
  cin>>s>>t;
  cin>>a>>b;
  cin>>u;
  if(u==s){
    cout<<a-1<<" "<<b<<endl;
  }
  else{
    cout<<a<<" "<<b-1<<endl;
  }
  return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define dump(x) cout << x << endl
#define answer(x) cout << (x) << endl
typedef int64_t Int;

using namespace std;
using Graph = vector<vector<Int>>;

const double pi = M_PI;
const Int MOD = 1000000007;

int main() {
    int n;
    cin >> n;
    list<int> list;
    for (int i = 0; i < n; i++) {
        int b;
        cin >> b;
        list.push_back(b);
    }

    int count = 1;
    for (auto itr = list.begin(); itr != list.end();) {
        if (*itr != count) {
            itr = list.erase(itr);
        } else {
            count++;
            ++itr;
        }
    }

    int ans = n - list.size();
    if (list.empty()) {
        ans = -1;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 6528
#define _GLIBCXX_DEBUG
#include<cmath>
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
vector<int> arr;
stack<int> st;
queue<int> qu;
queue<pair<int,int> > qu2;
priority_queue<int> pq;
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define rep2(i,n) for(int i=1; i<=(int)(n); i++)
#define mins(x,y) x=min(x,y)
#define maxs(x,y) x=max(x,y)
typedef set<int> set_t;
typedef set<string> set_g;
typedef complex<double> xy_t;
static const int NIL = -1;

int P[10010];
void init(int n){
    for(int i=0;i<n;++i)P[i]=i;
}
int root(int a) {
    if(P[a]==a)return a;
    return (P[a]=root(P[a]));
}
bool is_same_set(int a,int b){
    return root(a) == root(b);//代表元を求める
}
void unite(int a,int b){
    P[root(a)]=root(b);
}//対set,グラフ？

double dot_product(xy_t a, xy_t b) { return (conj(a)*b).real(); }//内積
double cross_product(xy_t a, xy_t b) { return (conj(a)*b).imag(); }//外積
xy_t projection(xy_t p, xy_t b) { return b*dot_product(p,b)/norm(b); }//投影
//対図形

#define mod 1000000007
#define INF 100000007
ll f[2001];
//int n,k とかしておく

ll pw(ll x, ll y){//euclidの互除法より
    ll a= 1;
    while(y){
        if(y&1){//奇数なら
            a = a*x%mod;
        }
        x = x*x%mod;
        y /= 2;
    }
    return a;
}

ll modinv(ll x){//逆元を求める
    return pw(x, mod - 2 );
}

ll comb(int n,int r){
    if(n<r){
        return 0;
    }
    return f[n] * modinv(f[r])%mod*modinv(f[n-r])%mod;
}//対combination

const double inf = 1e10;

struct D{
    vector<double> l,r;
    D():l(3,inf),r(3,-inf){}//l,rの初期化？l={inf,inf,inf},r={-inf,-inf,-inf}?
    void add(double x,int v){
        ++v;
        mins(l[v],x);
        maxs(r[v],x);
    }
    double get(double t){
        double nl = inf, nr = -inf;
        rep(i,3){
            mins(nl,l[i]+i*t);
            maxs(nr,r[i]+i*t);
        }
        return nr-nl;
    }
    vector<double> events(){
        vector<double> ts;
        rep(i,3){
            rep(j,i){//i>j
                double t=(l[j]-l[i])/(i-j);//端の大小が入れ替わる時刻
                if(t>0)ts.push_back(t);
            }
            rep(j,i){
                double t=(r[j]-r[i])/(i-j);
                if(t>0)ts.push_back(t);
            }
        }
        return ts;
    }
};//struct definition

int main(){
    int n;
    cin >> n;
    D xd, yd;
    rep(i,n){
        int x,y;
        char d;
        cin >> x>>y>>d;
        if(d=='L')xd.add(x,-1),yd.add(y,0);//xd l={xかinf,inf,inf},r={xか-inf,-inf,-inf}
        if(d=='R')xd.add(x,1),yd.add(y,0);//xd l={inf,inf,xかinf},r={-inf,-inf,-infかx}
        if(d=='U')xd.add(x,0),yd.add(y,1);
        if(d=='D')xd.add(x,0),yd.add(y,-1);
        //xd l={最小のLのx,最小の動かないx,最小のRのx} r={最大のLのx,最大の動かないx,最大のRのx}
        //yd l={最小のLのy,最小の動かないy,最小のRのy} r={最大のLのy,最大の動かないy,最大のRのy}
    }
    vector<double> ts;
    ts.push_back(0);
    ts.push_back(inf);
    {
        auto nts=xd.events();
        ts.insert(ts.end(),nts.begin(),nts.end());
    }
    {
        auto nts=yd.events();
        ts.insert(ts.end(),nts.begin(),nts.end());
    }
    sort(ts.begin(),ts.end());
    double ans=1e18;
    for(double t:ts){
        double now=xd.get(t)*yd.get(t);
        mins(ans,now);
    }
    printf("%.10f\n",ans);
    return 0;
}



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

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

Measured memory_bytes: 256
import java.math.BigDecimal

fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    var jpy = 0
    var btc = BigDecimal.ZERO
    repeat(n) {
        val s = readLine()!!.split(' ')
        if (s[1] == "BTC") {
            btc = btc.add(BigDecimal(s[0]))
        } else {
            jpy += s[0].toInt()
        }
    }
    println(btc.multiply(BigDecimal(380000)).add(BigDecimal(jpy)).toPlainString())
}


Measured memory_bytes: 38432
/*Bismillahir Rahmanir Rahim*/
#include<bits/stdc++.h>
using namespace std;
#define     ll        long long
#define     N         1e9+9
#define     PI        acos(-1.0)
#define     pb        push_back
#define     mp        make_pair
#define     ff        first
#define     ss        second
#define     gt        getchar()
#define     MOD       1000000007
#define     All(v1)   v1.begin(),v1.end()
#define     DBG(a)    cout<< #a <<" --> "<<(a)<<endl
ll arr[2000007],brr[200007],crr[200007];
char att[1000],m;
string g,h,v,x;
int main()
{
    ll a,c,d,e,f,i,j,k,t;
    float l,b;
    cin>>a;
    b=(float)a/3;
    l=(b*b*b);
    printf("%0.12f\n",l);
    return 0;
}


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

int main()
{
	string s, t;
	cin >> s >> t;
	int ans = 0;
	for(int i = 0; i < (int)s.size(); ++i){
		ans += s[i] != t[i];
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3920
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define countof(array) (sizeof(array) / sizeof(array[0]))
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = (n)-1; i >= 0; --i)
#define rep2(i,n) for(int i = 1; i <= (n); ++i)
#define rrep2(i,n) for(int i = (n); i > 0; --i)
#define srep(i,s,n) for(int i = s; i < (n); ++i)
#define rsrep(i,s,n) for(int i = (n)-1; i >= s; --i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define aall(a) (a), (a)+countof(a)//for array sorting
#define raall(a) (a), (a)+countof(a), greater<>()
#define show(x) cout<<#x<<" = "<<(x)<<endl;
#define vfind(v, a) find(all(v), a) != v.end()
#define yn(f) { if (f) puts("YES"); else puts("NO"); }
#define yns(f) { if (f) puts("Yes"); else puts("No"); }
#define show_ary(...) { cout<<#__VA_ARGS__<<" = "; for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define show_pair(...) cout<<#__VA_ARGS__<<" = "<<endl; for (const auto& x : (__VA_ARGS__)) { cout<<"  "<<x.fi<<" : "<<x.se<<endl; }
#define out_ary(...) { int n = (__VA_ARGS__).size(); rep(i, n) printf("%d%s", (__VA_ARGS__)[i], i != n-1 ? " " : "\n"); }
#define argmax(v) distance((v).begin(), max_element(all(v)))
#define argmin(v) distance((v).begin(), min_element(all(v)))
#define vmax(v) *max_element(all(v))
#define vmin(v) *min_element(all(v))
typedef long long int ll;
typedef pair<int, int> P;
typedef vector<P> vpair;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<string> vstr;
typedef vector<bool> vbool;
typedef vector<vint> vvint;
typedef vector<vll> vvll;
typedef vector<vstr> vvstr;
typedef vector<vbool> vvbool;
const ll LINF = 2000000000000000000ll;
const int INF = 1000000100;
const ll MOD = 1e9+7;


int main() {
    int n;
    cin >> n;
    vint a(n);
    rep(i, n) {
        cin >> a[i];
        --a[i];
    }

    vbool c(n, true);
    int id = 0;
    rep(i, n) {
        id = a[id];
        if (id == 1) {
            cout << i+1 << endl;
            return 0;
        }
    }

    puts("-1");
    return 0;
}

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

int main()
{
    string s;
    int i, n, j, ans=0, k=0;
    cin >> s;
    n = s.size();
    for(i=0; i<n; i++)
    {
        if(s[i]=='R')
        {
            k+=90;
            if(k==360)
            {
                ans++;
                k=0;
            }
        }
        else
        {
            k-=90;
            if(k==-360)
                k=0;
        }
       // cout << k << endl;
    }
    cout << ans << endl;
}



Measured memory_bytes: 3224
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <numeric>
#include <algorithm>
#include <stack>
#include <map>
using namespace std;
string S;
int n;
int main() {
    cin >> n;
    long long cnt=0;
    for(int i=0; i<n; ++i){
        long long a; cin >> a;
        while(a%2==0){
            if(a%2==0) cnt++;
            a/=2;
        }
    }
    cout << cnt << endl;
    return 0;
}

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

#define REP(i,p,n) for(ll i=p;i<ll(n);++i)
#define rep(i,n) REP(i,0,n)

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

const ll MAXN = 1002;
ll C[MAXN][MAXN];

int main()
{
    ll H, W;
    cin >> H >> W;

    ll CH, CW, DH, DW;
    cin >> CH >> CW >> DH >> DW;
    --CH;
    --CW;
    --DH;
    --DW;

    vector<string> S(H);
    rep (i, H) { cin >> S[i]; }

    rep (x, MAXN) rep (y, MAXN) { C[x][y] = MAXN * MAXN; }

    using Node = tuple<ll, ll, ll>;
    priority_queue<Node, vector<Node>, greater<Node> > Q;

    const auto insert = [&](ll xx, ll yy, ll newCost)
    {
        if (xx < 0 || W <= xx) { return; }
        if (yy < 0 || H <= yy) { return; }
        if (S[yy][xx] == '#') { return; }
        if (C[yy][xx] <= newCost) { return; }

        C[yy][xx] = newCost;
        Q.emplace(newCost, xx, yy);
    };

    insert(CW, CH, 0);

    ll ans = -1;

    while (!Q.empty())
    {
        const auto node = Q.top();
        Q.pop();

        const auto cost = get<0>(node);
        const auto cx = get<1>(node);
        const auto cy = get<2>(node);

        if (cx == DW && cy == DH) { ans = cost; break; }

        insert(cx - 1, cy, cost);
        insert(cx + 1, cy, cost);
        insert(cx, cy - 1, cost);
        insert(cx, cy + 1, cost);

        for (ll dx=-2;dx<=2;++dx)
        for (ll dy=-2;dy<=2;++dy)
        {
            insert(cx + dx, cy + dy, cost + 1);
        }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 13536
#include<bits/stdc++.h>
using namespace std;
int main(){
    int w,h,x,y;
    cin>>w>>h>>x>>y;
    double m=(double)w/2*h;
    printf("%.12lf ",m);
    if(x*2==w&&y*2==h)
        puts("1");
    else puts("0");
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(i64 (i) = (s);(i) < (e);(i)++)
#define all(x) x.begin(),x.end()
#define let auto const

template<typename... Types>
struct dynarr: std::vector<Types...> {
  using std::vector<Types...>::vector;
  using size_type = typename std::vector<Types...>::size_type;
  auto&& operator[](size_type i) { return this->at(i); }
  auto&& operator[](size_type i) const { return this->at(i); }
};

int main() {
  i64 N, M;
  cin >> N >> M;
  vector<i64> L, R;
  vector<pair<i64, i64>> vec;
  rep(i,0,N) {
    i64 a, b;
    cin >> a >> b;
    L.push_back(a);
    R.push_back(b);
    vec.push_back({ a, 1 });
    vec.push_back({ b, 2 });
  }
  i64 cnt = 0;
  i64 MAX = 1;
  sort(all(vec));
  for(auto x: vec) {
    if(x.second == 1) {
      cnt++;
    }
    else {
      cnt--;
    }
    MAX = max(MAX, cnt);
  }

  if(MAX % 2 == 0) {
    // left maximum
    i64 LM = 0;
    for(auto x: vec) {
      if(x.second == 1) {
        cnt++;
      }
      else {
        cnt--;
      }
      if(cnt == MAX) {
        LM = x.first;
        break;
      }
    }
    cout << (MAX - 1) * M + (M - LM) << endl;
  }
  else {
    reverse(all(vec));
    // right minimum
    i64 Rm = M;
    for(auto x: vec) {
      if(x.second == 2) {
        cnt++;
      }
      else {
        cnt--;
      }
      if(cnt == MAX) {
        Rm = x.first;
        break;
      }
    }
    cout << (MAX - 1) * M + Rm << endl;
  }
}



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

typedef long long ll;
ll a[200005];
ll l[200005]={0},r[200005]={0};

int main()
{
	ll n,k;
	cin>>n>>k;
	for(ll i=1;i<=n;i++){
		cin>>a[i];
	}
	ll sum=0;
	while(k--){
		memset(l,0,sizeof(l));
		memset(r,0,sizeof(r));
		for(ll i=1;i<=n;i++){
			l[max(1ll,i-a[i])]++;
			r[min(n,i+a[i])]++;
		}
		ll sum=0;
		bool flag=true;
		for(ll i=1;i<=n;i++){
			a[i]=sum+l[i];
			if(a[i]!=n){
				flag=false;
			}
			sum=sum+l[i]-r[i];
		}
		if(flag){
			break;
		}
	}
	for(ll i=1;i<=n;i++){
		if(i>1){
			cout<<" ";
		} 
		cout<<a[i];
	}
	cout<<endl;
	return 0;
}

Measured memory_bytes: 8240
n = int(input())
a = list(map(int, input().split()))
d = [0]*n
for i in range(n):
  if i+a[i] < n: d[i+a[i]] += 1
ans = 0
for i in range(n):
  if i-a[i] >= 0: ans += d[i-a[i]]
print(ans)

Measured memory_bytes: 32376
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
int main()
{
    long double a, b, c;
    cin >> a >> b >> c;
    if((a + b + 2 * (long double)sqrt(b * a)) < c)
            puts("Yes");
    else
        puts("No");
    return 0;
}


Measured memory_bytes: 256