akhauriyash/Code-Regression huggingface dataset:
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif




#define int long long
#define rng(i,l,r) for(size_t i=(l);i<(r);++i)
#define rep(i,n) rng(i,0,n)
#define gnr(i,l,r) for(size_t i=(r)-1;i>=(l);i--)
#define per(i,b) gnr(i,0,b)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()

using namespace std;
//using ll = long long;


const int MOD = 1000000007;
const int INF = 1e18;

const int dx4[4] = {1, 0, -1, 0};
const int dy4[4] = {0, 1, 0, -1};
const int dx8[8] = {1,1,0,-1,-1,-1,0,1};
const int dy8[8] = {0,1,1,1,0,-1,-1,-1};

const double pi = acos(-1);



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


using Graph = vector<vector<int>>;



void solve(){
    
    // remove the bottom 3 lines when you submit this code.
    std::ifstream in("sample.txt");
    std::cin.rdbuf(in.rdbuf());

    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n,m; cin >> n >> m;
    vector<bool> oks(100010,true);
    vector<int>  ans(100010,0);
    rep(i,m){
        int a; cin >> a;
        oks[a] = false;
    }
    
    for (int now = 0; now < 100010; now++) {
        if(now==0) ans[now] = ((oks[now])?1:0);
        if(now==1) ans[now] = ((oks[now])?1:0);
        if(now>=2){
            if(oks[now]==false) continue;
            ans[now] = ((oks[now-1])?ans[now-1]:0) + ((oks[now-2])?ans[now-2]:0);
            ans[now] %= MOD;
        }
    }
    
    cout << ans[n] << endl;
    
    
}



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



Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#define rep(i,a,b) for(int (i)=(a);i<(b);i++)
#define INF 1000000000
#define MAX_N 100005
using namespace std;

int main(){
    char a,b;
    cin>>a>>b;
    if(a==b)cout<<'H'<<endl;
    else cout<<'D'<<endl;
    return 0;
}


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

public class Main{

	private static String FOUR = "Four";
	private static String THREE = "Three";
	
	public static void main(String[] args) {
		try(Scanner sc = new Scanner(System.in)){
			String number = sc.nextLine();
			List<String> arares = Arrays.asList(sc.nextLine().split(" "));
			for(String mark : arares) {
				if(isYellow(mark)) {
					System.out.println(FOUR);
					return;
				};
			}
			System.out.println(THREE);
		}
	}
	
	private static boolean isYellow(String mark) {
		return mark.equals(HinaArareKind.YELLOW.getMark());
	}
	
	private enum HinaArareKind {
		PINK("P"),WHITE("W"),GREEN("G"),YELLOW("Y");
		
		private String mark;
		
		private HinaArareKind(String mark) {
			this.mark = mark;
		}
		
		private String getMark() {
			return mark;
		}
	}
}

Measured memory_bytes: 21844
PROGRAM ATCODER

implicit none
integer(16) :: n,i,s_n,ans=0

read*, n

s_n = ceiling(sqrt(real(n,8)),16)

do i = 1, s_n, 1
  if ( mod(n,i) == 0 ) then
    if ( i /= 1 ) then
      if ( mod(n,i-1) == n/(i-1) ) then
        ans = ans + (i-1)
      end if
    end if
    if ( n/i /= 1 ) then
      if ( mod(n,n/i-1) == n/(n/i-1) ) then
        ans = ans + (n/i-1)
      end if
    end if
  end if
end do

print'(i0)', ans

END PROGRAM ATCODER

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

using namespace std;

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int a, b, c, k;
	cin>>a>>b>>c>>k;
	int w = 0;
	w+=min(k, a);
	k-=min(k, a);
	//w+=min(k, b);
	k-=min(k, b);
	w-=min(k, c);
	cout<<w;
}


Measured memory_bytes: 3652
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;

int main(){
   int A, B, Q;
   std::cin >> A >> B >> Q;
   ll s[A], t[B];
   for(int i=0; i<A; ++i)
      std::cin >> s[i];
   for(int i=0; i<B; ++i)
      std::cin >> t[i];

   for(int i=0; i<Q; ++i){
      ll x;
      std::cin >> x;
      ll *ps = std::lower_bound(s,s+A,x);
      ll *pt = std::lower_bound(t,t+B,x);
      ll ps0 = (ps==s+A) ? s[A-1] : *ps;
      ll pt0 = (pt==t+B) ? t[B-1] : *pt;
      ll ps1 = (ps==s) ? s[0] : ps[-1];
      ll pt1 = (pt==t) ? t[0] : pt[-1];

      ll ans = std::min({abs(x-ps0) + abs(ps0-pt0),
			 abs(x-ps0) + abs(ps0-pt1),
			 abs(x-ps1) + abs(ps1-pt0),
			 abs(x-ps1) + abs(ps1-pt1),
			 abs(x-pt0) + abs(pt0-ps0),
			 abs(x-pt0) + abs(pt0-ps1),
			 abs(x-pt1) + abs(pt1-ps0),
			 abs(x-pt1) + abs(pt1-ps1)});
      std::cout << ans << std::endl;
   }

   return 0;
}


Measured memory_bytes: 2816
from math import sqrt
from bisect import bisect_left


def sieve(x):
    """
    Sieve of Eratosthenes
    :param x: max value
    :return: list of primes
    """

    primes = []
    li = list(range(2, x + 1))

    while li[0] <= sqrt(x):
        p = li[0]
        primes.append(p)
        li = [e for e in li if e % p != 0]

    primes += li
    return primes


x = int(input())

primes = sieve(10 ** 6)

i = bisect_left(primes, x)
ans = primes[i]
print(ans)


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

typedef long long ll;
typedef long double ld;

int in[100005];
int low[100005];
int res;
vector <int> graf[100005];

int cnt;
bool visited[100005];

void dfs(int v, int prnt){
    low[v] = in[v] = ++cnt;
    visited[v] = 1;
    for(auto c : graf[v]){
        if(c == prnt) continue;
        if(visited[c]){
            low[v] = min(low[v], in[c]);
            continue;
        }
        dfs(c, v);
        low[v] = min(low[v], low[c]);
    }
    if(!prnt) return;
    if(low[v] > in[prnt]){
        res++;
    }
}

int main(){
    ios_base::sync_with_stdio(false);
    cout.precision(10);
    cout<<fixed;

    int n, m;
    cin >> n >> m;
    for(int i=1; i<=m; i++){
        int a, b;
        cin >> a >> b;
        graf[a].push_back(b);
        graf[b].push_back(a);
    }
    dfs(1, 0);
    cout << res;
    return 0;
}


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

using ll = long long;
using Pi = pair<int, int>;
using Pl = pair<ll, ll>;
using vint = vector<int>;
using vll = vector<ll>;
using uint = unsigned int;
using ull = unsigned long long;

template<typename T> using uset = unordered_set<T>;
template<typename T1, typename T2> using umap = unordered_map<T1, T2>;

constexpr ll LLINF = 1LL << 60;
constexpr int dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
constexpr int dx[] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr char el = '\n';
constexpr int mod = 1000000007;

template<typename T> T gcd(T a, T b) { return (b ? gcd(b, a % b) : a); }
template<typename T> T lcm(T a, T b) { return (a / gcd(a, b) * b); }
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }

template<typename T>
ostream& operator <<(ostream &os, vector<T> &v) {
	for (auto &u : v) os << u << el;
	return (os);
}

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

template<typename T1, typename T2>
istream& operator >>(istream &is, pair<T1, T2> &p) {
	is >> p.first >> p.second;
	return (is);
}

const int INF = numeric_limits<int>::max();

template<typename T>
struct SegmentTree {

	T id;
	function <T(T, T)> op;
	vector<T> dat;
	int size;

	SegmentTree(int n, T id, function <T(T, T)> op) : id(id), op(op) {
		size = 1;
		while (size < n) size <<= 1;
		dat.assign(size * 2 + 10, id);
	}

	void update(int k, T x) {
		k += size, dat[k] = x;
		while (k > 1) k >>= 1, dat[k] = op(dat[k << 1], dat[(k << 1) | 1]);
	}

	void merge(int k, T x) { update(k, op(x, dat[k + size])); }
	//[a, b)
	T query(int a, int b) {
		T tl = id, tr = id;
		for (int l = a + size, r = b + size; l < r; l >>= 1, r >>= 1) {
			if (l & 1) tl = op(tl, dat[l++]);
			if (r & 1) tr = op(tr, dat[--r]);
		}
		return (op(tl, tr));
	}
};


int main()
{
	int N; cin >> N;
	vint pos(N+1);

	SegmentTree<int> seg1(N, INF, [](int a, int b) { return (min(a, b)); } );
	SegmentTree<int> seg2(N, INF, [](int a, int b) { return (min(a, b)); } );

	auto inspect = [&](int l, int r) {
		int val1 = (l&1?seg2:seg1).query(l, r);
		int val2 = (l&1?seg1:seg2).query(pos[val1], r);
		return (Pi(val1, val2));
	};

	for (int i = 0; i < N; i++) {
		int A;
		cin >> A;
		(i&1?seg2:seg1).update(i, A);
		pos[A] = i;
	}

	priority_queue<pair<Pi, Pi>, vector<pair<Pi, Pi>>, greater<pair<Pi, Pi>>> que;
	que.emplace(inspect(0, N), Pi(0, N));

	vint ans;

	while (!que.empty()) {
		Pi value, range;
		int l, r;
		tie(value, range) = que.top(); que.pop();	
		tie(l, r) = range;
		ans.push_back(value.first); ans.push_back(value.second);
		int posl = pos[value.first], posr = pos[value.second];

		if (l + 1 < posl) que.emplace(inspect(l, posl), Pi(l, posl));
		if (posl + 2 < posr) que.emplace(inspect(posl + 1, posr), Pi(posl + 1, posr));
		if (posr + 2 < r) que.emplace(inspect(posr + 1, r), Pi(posr + 1, r));
	}
	cout << ans[0];
	for (int i = 1; i < N; i++) cout << " " << ans[i];
	cout << endl;

	return (0);
}

Measured memory_bytes: 7924
#include <bits/stdc++.h>
#define int long long
#define double long double
using namespace std;
const int MOD = 1000000007;
const int INF = 1e18;
using Graph = vector<vector<int>>;

signed main() {
  int X, Y, Z, K;
  cin >> X >> Y >> Z >> K;
  vector<int> A(X);
  vector<int> B(Y);
  vector<int> C(Z);
  for( int i = 0; i < X; i++ ) cin >> A[i];
  for( int i = 0; i < Y; i++ ) cin >> B[i];
  for( int i = 0; i < Z; i++ ) cin >> C[i];
  sort(A.rbegin(), A.rend());
  sort(B.rbegin(), B.rend());
  sort(C.rbegin(), C.rend());

  vector<int> kouho;
  for( int x = 0; x < X; x++ ){
    for( int y = 0; y < Y; y++ ){
      kouho.emplace_back(A[x]+B[y]);
    }
  }

  sort(kouho.rbegin(), kouho.rend());
  vector<int> ans;
  int ksize = (int)kouho.size();
  for( int i = 0; i < min(ksize, 3000LL); i++ ){
    for( int z = 0; z < Z; z++ ){
      ans.emplace_back(kouho[i]+C[z]);
    }
  }

  sort(ans.rbegin(), ans.rend());
  for( int i = 0; i < K; i++ ) cout << ans[i] << endl;

}


Measured memory_bytes: 44104
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,x,n) for(int i=(x);i<(n);i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define mp make_pair
#define fir first
#define sec second
#define ub upper_bound
#define lb lower_bound
#define int long long
using namespace std;
const int MOD=1000000007;
const int INF=1000000009;


signed main(){
  string s,t;
  cin>>s;
  s.erase(s.begin()+s.size()-8,s.end());
  cout<<s<<endl;
  return 0;
}


Measured memory_bytes: 256
import sys
input = lambda: sys.stdin.readline().rstrip()

S = input()

if len(S) == 1:
    goal_1 = '1'
    goal_2 = '0'

elif len(S) % 2 == 1:
    goal_1 = "10" * (len(S) // 2) + "1"
    goal_2 = "01" * (len(S) // 2) + "0"

else:
    goal_1 = "10" * (len(S) // 2)
    goal_2 = "01" * (len(S) // 2)

ans_1 = 0
ans_2 = 0
for i in range(len(S)):
    if S[i] != goal_1[i]:
        ans_1 += 1
    if S[i] != goal_2[i]:
        ans_2 += 1

print(min(ans_1, ans_2))

Measured memory_bytes: 3316
#include "bits/stdc++.h"

#define REP(i,n) for(ll i=0;i<n;++i)
#define RREP(i,n) for(ll i=n-1;i>=0;--i)
#define FOR(i,m,n) for(ll i=m;i<n;++i)
#define RFOR(i,m,n) for(ll i=n-1;i>=m;--i)
#define ALL(v) (v).begin(),(v).end()
#define PB(a) push_back(a)
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());
#define DUMP(v) REP(aa, (v).size()) { cout << v[a]; if (a != v.size() - 1)cout << " "; else cout << endl; }
#define INF 1000000001ll
#define MOD 1000000007ll
#define EPS 1e-9

const int dx[8] = { 1,1,0,-1,-1,-1,0,1 };
const int dy[8] = { 0,1,1,1,0,-1,-1,-1 };


using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
ll max(ll a, int b) { return max(a, ll(b)); }
ll max(int a, ll b) { return max(ll(a), b); }
ll min(ll a, int b) { return min(a, ll(b)); }
ll min(int a, ll b) { return min(ll(a), b); }
///(?´????????`)(?´????????`)(?´????????`)(?´????????`)(?´????????`)(?´????????`)///
void bfs(vector<string> &v, vector<vector<pii>> &b, int x, int y) {

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

	while (1) {
		int w, h;
		cin >> w >> h;
		if (!w)break;
		vector<string> v(h);
		REP(i, h)cin >> v[i];
		vector<vector<pii>> b(h, vector<pii>(w, pii(0, 0)));
		REP(i, h) {
			REP(j, w) {
				if (v[i][j] == 'W') {
					queue<pii> q;
					q.push(make_pair(i, j));
					while (!q.empty()) {
						pii p = q.front(); q.pop();
						int s = p.first, t = p.second;
						REP(k, 4) {
							int ni = s + dy[2 * k];
							int nj = t + dx[2 * k];
							if (ni >= 0 && nj >= 0 && ni < h&&nj < w&&b[ni][nj].first == 0 && v[ni][nj] == '.') {
								q.push(make_pair(ni, nj));
								b[ni][nj].first = 1;
							}
						}
					}
				}
				else if (v[i][j] == 'B') {
					queue<pii> q;
					q.push(make_pair(i, j));
					while (!q.empty()) {
						pii p = q.front(); q.pop();
						int s = p.first, t = p.second;
						REP(k, 4) {
							int ni = s + dy[2 * k];
							int nj = t + dx[2 * k];
							if (ni>=0&& nj >= 0 && ni < h&&nj < w&&b[ni][nj].second == 0 && v[ni][nj] == '.') {
								q.push(make_pair(ni, nj));
								b[ni][nj].second = 1;
							}
						}
					}
				}
			}
		}
		int cntb = 0, cntw = 0;
		REP(i, h) {
			REP(j, w) {
				if (v[i][j] == '.') {
					if (b[i][j] == make_pair(0, 1))cntb++;
					else if (b[i][j] == make_pair(1, 0))cntw++;
				}
			}
		}
		cout << cntb << " " << cntw << endl;
	}
	return 0;
}

Measured memory_bytes: 3224
def solve():
    N, M = map(int, input().split())

    # N分の二次元配列を用意する
    piys = [[] for _ in range(N)]
    # 各県を添え字として市を格納していく
    for i in range(M):
        p, y = map(int, input().split())
        piys[p-1].append((y, i))

    ans = [None]*M
    # enumrateで添字付きで県、市の配列を見る
    # p = index, iys = 市となる
    for p, iys in enumerate(piys):
        iys.sort()
        # enumrateで添字付きで市の配列を見る
        # k = 誕生順, y = 経過時間、i = 元のpiysの順序となる
        for k, (y, i) in enumerate(iys):
            pref = str(p+1)
            born = str(k+1)
            # 左を０埋めする
            ans[i] = pref.rjust(6, "0")+born.rjust(6, "0")

    for i in ans:
        print(i)


if __name__ == "__main__":
    solve()


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

int main(){
	int N, i;
	scanf("%d", &N);
	int *a = (int *)malloc(sizeof(int) * 2 * N);
	for(i = 1; i < 2 * N; i++){
		scanf("%d", &a[i]);
	}
	int l = 0, h, r = 2 * N, A, B, C, D, f;
	while(r - l > 1){
		h = (l + r) / 2;
		f = -1;
		for(i = 1; i < N; i++){
			A = (a[N - i] >= h ? 1 : 0);
			B = (a[N - i + 1] >= h ? 1 : 0);
			C = (a[N + i - 1] >= h ? 1 : 0);
			D = (a[N + i] >= h ? 1 : 0);
			if(A == B){
				if(A == 1){
					f = 1;
				}
				else{
					f = 0;
				}
				break;
			}
			if(C == D){
				if(C == 1){
					f = 1;
				}
				else{
					f = 0;
				}
				break;
			}
		}
		if(f == -1){
			if(a[1] >= h){
				f = 1;
			}
			else{
				f = 0;
			}
		}
		if(f == 1){
			l = h;
		}
		else{
			r = h;
		}
	}
	printf("%d\n", l);
	return 0;
}

Measured memory_bytes: 1024
N, W = map(int, input().strip().split())
 
values = []
weights = []
 
for _ in range(N):
    w, v = map(int, input().strip().split())
    weights.append(w)
    values.append(v)
    
dp = [0]*(W+1)
for i in range(N):
    for w in range(W, weights[i] - 1, -1):
        dp[w] = max(dp[w], values[i] + dp[w - weights[i]])
print(dp[W])

Measured memory_bytes: 41708
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <math.h>
#include <cassert>
#define rep(i,n) for(int i = 0; i < n; ++i )
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main() {
  string s;
  cin >> s;
  auto f = [](string s){
    int n = s.size();
    rep(i,n/2) if(s[i]!=s[n-1-i]) return false;
    return true;
  };
  int n = s.size();
  bool ans = f(s) 
          && f(s.substr(0,(n-1)/2)) 
          && f(s.substr((n+1)/2,(n-1)/2));
  cout << (ans?"Yes":"No") << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define LL long long 
#define ULL unsigned long long 

const int N = 2e5+11;
const int M = 1e6+11;
const int mod = 1e9+7;
const int inf = 0x3f3f3f3f;
const LL inff = 0x3f3f3f3f3f3f3f3f;


/*-----------------------------------------*/

int a[N];
int cnt[N];
int main(){
	int n;scanf("%d",&n);
	for(int i=1;i<=n;i++) {
		scanf("%d",&a[i]);
		cnt[a[i]]++;
	}
	LL ans=1;
 	for(int i=1;i<=n;i++){
 		if(!cnt[i]) continue;
 		int x,y; x=y=0;
 		
 		int t=(n+1+i)/2; if((n+1+i)%2==0)  x=1;
 		int tt=(n+1-i)/2; if((n+1-i)%2 ==0 ) y=1;
 	
 	 	if(x==0 || y==0) {
 	 		if(cnt[i]>1) {
 	 			ans=0;break;
			}else {
				ans*=1;
			}	
		}else {
			//	printf("%d %d %d \n",i,t,tt);
			if(tt==t) {
				if(cnt[i]>1) {
 	 				ans=0;break;
				}else {
					ans*=1;
				}
			}else {
				if(cnt[i]>2) {
					ans=0;break;
				}else {
					ans=ans*2%mod;
				}
			}
		}
	}
	
	if((n&1) && cnt[0]>1) ans=0;
	else if(n%2==0 && cnt[0]>0) ans=0;
	
	printf("%lld\n",ans);
	return 0;
}


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

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
  
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    string s;
    cin>>s;
    if(s[0]=='7' or s[1]=='7' or s[2]=='7') cout<<"Yes\n";
    else cout<<"No\n";
	return 0;
}

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

int main()
{
    char s[10];
    cin>>s;
    for(int i=0;i<3;i++){
        if(s[i]=='7') {
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    cout<<"No"<<endl;
    return 0;
}


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

using namespace std;
typedef long long ll;

#define MOD (long long)(1e9+7)
#define REP(i,n) for(ll i = 0; i < n; i++)
#define REP1(i,n) for(ll i = 1; i <= n; i++)

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

void solve()
{
  string s; cin >> s;
  ll n; n = s.size();
  vector<ll> cnt(n);
  vector<ll> rsw(n);
  char oldc = 'x';
  ll rc = 0;
  ll lc = 0;
  REP(i, n) {
    if(s[i] == 'R') {
      rc ++;
      rsw[i] = rc;
    } else {
      rc = 0;
    }

    if(s[n-1-i] == 'L') {
      lc ++;
      rsw[n-1-i] = lc;
    } else {
      lc = 0;
    }
  }
  
  REP(i, n) {
   // cout << rsw [i] << " " ;
    cnt[i] = 0;
  }
  cout << endl;

  REP(i, n-1) {
    if(s[i] == 'R' && s[i + 1] == 'L') {
      cnt[i] = rsw[i] / 2 + rsw[i] % 2 + rsw[i + 1] / 2;
      cnt[i + 1] = rsw[i] / 2 + rsw[i + 1] / 2 + rsw[i + 1] % 2;
    }
  }

  REP(i, n) {
    cout << cnt[i] << " " ;
  }
  cout << endl;
  

}


int main(void)
{
  // ll t; cin >> t; REP(i, t)
  solve();
}


Measured memory_bytes: 2176
#include <cstdio>
#include <string>
#include <algorithm>
using namespace std;
int main() {
    int n, t, sum = 0;
    scanf("%d", &n);
    for (int i = 0; i < n; i++) {
        scanf("%d", &t);
        if (!(t & 1)) sum++;
    }
    printf("%d\n", sum);
    return 0;
}



Measured memory_bytes: 2756
#include<algorithm>     //sort,二分探索,など
#include<bitset>        //固定長bit集合
#include<cmath>         //pow,logなど
#include<complex>       //複素数
#include<deque>         //両端アクセスのキュー
#include<fstream>       //ファイルストリーム（標準入力変更用）
#include<functional>    //sortのgreater
#include<iomanip>       //setprecision(浮動小数点の出力の誤差)
#include<iostream>      //入出力
#include<iterator>      //集合演算(積集合,和集合,差集合など)
#include<map>           //map(辞書)
#include<numeric>       //iota(整数列の生成),gcdとlcm(c++17)
#include<queue>         //キュー
#include<set>           //集合
#include<stack>         //スタック
#include<string>        //文字列
#include<unordered_map> //イテレータあるけど順序保持しないmap
#include<unordered_set> //イテレータあるけど順序保持しないset
#include<utility>       //pair
#include<vector>        //可変長配列

//名前
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef map<string, int> msi;
typedef map<string, ll> msll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pllll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvll;
typedef vector<vector<string>> vvs;
typedef vector<vector<bool>> vvb;

//定数
const ll MOD = 1000000007;
const ll INF = 1000000000000000000;

//マクロ
#define rep(i,n) for(int i=0;i<n;i++)
#define reps(i,s,e) for(int i=s;i<e;i++)
#define repse(i,s,e) for(int i=s;i<=e;i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define in(x1) cin >> x1
#define in2(x1, x2) cin >> x1 >> x2
#define in3(x1, x2, x3) cin >> x1 >> x2 >> x3
#define outl(x) cout << x << endl
#define out2l(x, y) cout << x << " " << y << endl 

//よく使う関数
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

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

    //標準入力をファイルに変更
    //std::ifstream in("input.txt");
    //std::cin.rdbuf(in.rdbuf());
    int N, X;
    in2(N, X);

    vi L(N);
    rep(i, N) in(L[i]);

    vi D(N + 1);
    rep(i, N) D[i + 1] = D[i] + L[i];

    int count = 0;
    rep(i, D.size())
    {
        if (D[i] <= X) count++;
    }

    outl(count);

    return 0;
}

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

int main(){
  int H, W; cin >> H >> W;
  vector<vector<char>> A(H, vector<char>(W));
  queue<vector<int>> que;
  for (int i=0; i<H; i++){
    for (int j=0; j<W; j++){
      cin >> A[i][j];
      if (A[i][j]=='#'){
        vector<int> h{i,j,0};
        que.push(h);
      }
    }
  }
  int t = 0;
  while(!que.empty()){
    auto k = que.front();
    que.pop();
    t = max(t, k[2]);
    int x = k[0], y = k[1];
    if (x>0&&A[x-1][y]=='.'){
      A[x-1][y] = '#';
      vector<int> hoge{x-1,y,k[2]+1};
      que.push(hoge);
    }
    if (x<H-1&&A[x+1][y]=='.'){
      A[x+1][y] = '#';
      vector<int> hoge{x+1,y,k[2]+1};
      que.push(hoge);
    }
    if (y>0&&A[x][y-1]=='.'){
      A[x][y-1] = '#';
      vector<int> hoge{x,y-1,k[2]+1};
      que.push(hoge);
    }
    if (y<W-1&&A[x][y+1]=='.'){
      A[x][y+1] = '#';
      vector<int> hoge{x,y+1,k[2]+1};
      que.push(hoge);
    }
  }
  cout << t << endl;
}


Measured memory_bytes: 56756
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <numeric>
#include <stdio.h>
#include <stack>
#include <queue>
#include <cstdio>
#include <cmath>
#include <iterator>
#include <map>
#include <fstream>
#include <functional>
#include <list>
#include <iomanip>
#include <cctype>
#include <math.h>
#include <utility>
#include <numeric>

#define REP(i,first,end) for(int i = first; i < end; i++)
#define rep(i,end) for(int i = 0; i < end; i++)

typedef long long ll;
#define mod =1000000007;

using namespace std;

int main() {
    cin.tie(0); ios::sync_with_stdio(false);
    int H,W,h,w;
    cin >> H >> W >> h >> w;
    
    cout << H*W - h*W - w*H + w*h << endl;
    
}
    





Measured memory_bytes: 256
package main

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

var sc = bufio.NewScanner(os.Stdin)

func main() {
	scanInit()

	n := nextInt()
	l := make([]int, n)
	for i := 0; i < n; i++ {
		l[i] = nextInt()
	}
	if n <= 2 {
		fmt.Println(0)
		return
	}
	sort.Ints(l)

	cnt := 0
	for i := 0; i < n-2; i++ {
		for j := i + 1; j < n-1; j++ {
			if l[i] == l[j] {
				continue
			}
			for k := j + 1; k < n; k++ {
				if l[j] == l[k] {
					continue
				}
				if l[i]+l[j] > l[k] {
					cnt++
				}
			}
		}
	}
	fmt.Println(cnt)

}

// ---- readfunc
func scanInit() {
	const cap = 200 * 1024 // default=64*1024
	var buf = make([]byte, cap)
	sc.Buffer(buf, cap)
	sc.Split(bufio.ScanWords)
	return
}
func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}
func nextStr() string {
	sc.Scan()
	return sc.Text()
}


Measured memory_bytes: 1792
from collections import Counter
n,p=map(int,input().split())
A=list(map(int,input()))
def U(x):
    return int(A[x:])
if p in [2,5]:
    keta=0
    ans=0
    for i in range(n):
        keta+=1
        if int(A[i])%p==0:
            ans+=keta
    print(ans)
    exit()
    
acc = [0 for i in range(n)] 
cur = A[-1] % p
acc[-1] = cur
k = 1
for i in range(n-2, -1, -1):
    cur += pow(10, k, p) * A[i]
    cur %= p
    acc[i] = cur
    k += 1
acc = acc + [0]
 
C = Counter(acc)
ans = 0
for v in C.values():
    ans += v * (v-1) // 2
print(ans)

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

vector<int> v[100010];
int n,id[100010],l,r,mid,ans,siz[100010];
long long dis[100010],t;

bool cmp(int x,int y) {return dis[x]>dis[y];}

long long dfs(int x)
{
	long long ans=0;
	for (int i=0,sz=v[x].size(); i<sz; i++) ans+=dfs(v[x][i])+siz[v[x][i]];
	return ans;
}

int main()
{
	scanf("%d",&n);
	for (int i=1; i<=n; i++) scanf("%lld",&dis[i]),id[i]=i;
	sort(id+1,id+1+n,cmp);
	for (int i=1; i<=n; i++) siz[i]=1;
	for (int I=1,i; I<n; I++)
	{
		i=id[I],t=dis[i]-n+2*siz[i],l=I+1,r=n,ans=-1;
		while (l<=r) {mid=(l+r)>>1; if (dis[id[mid]]<=t) r=mid-1,ans=mid; else l=mid+1;}
		if (ans==-1||dis[id[ans]]!=t) return puts("-1"),0;
		v[id[ans]].push_back(i),siz[id[ans]]+=siz[i];
	}
	if (dfs(id[n])!=dis[id[n]]) return puts("-1"),0;
	for (int i=1; i<=n; i++)
		for (int j=0,sz=v[i].size(); j<sz; j++) printf("%d %d\n",i,v[i][j]);
	return 0;
}

Measured memory_bytes: 10752
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <queue>
#include <string>
#include <set>
#include <map>
#define REP(i,n) for(ll i = 0; i < (ll)n; i++)
#define INF 1000000000000000
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;

struct inv_num{
  vector<ll>bit;
  ll n;
  void init(ll _n){
    n = _n;
    bit.resize(2*n);
  }
  ll sum(ll i){
    ll s = 0;
    while(i>0){
      s+=bit[i];
      i-=i&-i;
    }
    return s;
  }
  void add(ll i, ll x){
    while(i<=n){
      bit[i]+=x;
      i+=i&-i;
    }
  }
  ll ans(ll* list, ll n){
    init(n);
    ll res = 0;
    REP(j,n){
      res+=j-sum(list[j]);
      add(list[j],1);
    }
    return res;
  }
};

int main(){
  str s;
  cin >> s;
  ll n = s.length();
  int abc = 'z'-'a'+1;
  ll char_cnt[abc];
  fill(char_cnt,char_cnt+abc,0);
  ll odd_cnt = 0;
  REP(i,n){
    char_cnt[s[i]-'a']++;
  }
  REP(j,abc){
    if(char_cnt[j]%2==1) odd_cnt++;
  }
  if(odd_cnt>1){
    cout << -1 << endl;
    return 0;
  }
  vector<ll> char_pos[abc];
  ll char_itr[abc];
  fill(char_itr,char_itr+abc,0);
  ll pos_list[n];
  ll pos = 1;
  REP(i,n){
    int ch = s[i]-'a';
    if(char_itr[ch]>=(char_cnt[ch]+1)/2){
      pos_list[i] = n+1-char_pos[ch].back();
      char_pos[ch].pop_back();
    }else if(char_cnt[ch]%2==1&&char_itr[ch]==(char_cnt[ch]-1)/2){
      pos_list[i] = (n+1)/2;
      char_itr[ch]++;
    }else{
      pos_list[i] = pos;
      char_pos[ch].push_back(pos);
      char_itr[ch]++;
      pos++;
    }
    //cout << pos_list[i] << endl;
  }
  //cout << endl;
  inv_num inv;
  cout << inv.ans(pos_list,n) << endl;
  return 0;
}


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

typedef struct task {
    long time;
    long deadline;
}
task;

int compare(const void *a, const void *b) {
    long task_a = ((task *) a) -> deadline;
    long task_b = ((task *) b) -> deadline;
    
    if (task_a > task_b)
        return 1;
    else if (task_a < task_b)
        return -1;
    else
        return 0;
}

int main() {
    int n, i;
    task tasks[200000];
    i = 0;
    long sum = 0;

    scanf("%d", &n);
    
    for (int i = 0; i < n; i++) {
        scanf("%ld %ld", &tasks[i].time, &tasks[i].deadline);
    }

    qsort(tasks, n, sizeof(task), compare);
    
    for (i = 0; i < n; i++) {
        if (sum + tasks[i].time <= tasks[i].deadline) {
            sum += tasks[i].time;
        } else {
            break;
        }
    }

    printf("%s\n", (i == n) ? "Yes" : "No");
}

Measured memory_bytes: 6396
D = 10 ** 9 + 7

def li():
    return [int(x) for x in input().split()]

N = int(input())

total = pow(10, N, D)
A = total - pow(9, N, D)
B = total - pow(9, N, D)
C = total - pow(8, N, D)

ans = (A + B - C) % D
print(ans)

Measured memory_bytes: 61852
#define _CRT_SECURE_NO_WARNINGS
#define lp(i,n) for(int i=0;i<n;i++)
#define atcoder(x)int TAKAHASIKUN[x] 
#include<bits/stdc++.h>

using namespace std;
int main() {
	int a, b;
	cin >> a >> b;
	if (a % 2 == 0 || b % 2 == 0)
		cout << "No" << endl;
	else
		cout << "Yes" << endl;
}


Measured memory_bytes: 256
import heapq

n, m = map(int, input().split())
que = []
for _ in range(n):
    a, b = map(int, input().split())
    que.append((-b, a))
que.sort(key=lambda x: x[1], reverse=True)

def solve(que, m):
    ans = 0
    h = []
    heapq.heapify(h)
    for i in range(1, m + 1):
        while len(que) != 0 and que[-1][1] <= i:
            tmp = que.pop()
            heapq.heappush(h, tmp)
        if len(h) == 0: continue
        tmp = heapq.heappop(h)
        ans -= tmp[0]
    return ans

print(solve(que, m))

Measured memory_bytes: 24256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define all(ppp) ppp.begin(),ppp.end()
#define out(ppp) cout<<(ppp)<<endl
#define out1(ppp) cout<<(ppp) 
#define MAX_CHAR 256

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define REP(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
#define pb push_back
#define lint ll
typedef long double ld;
typedef complex<ld> cd;
ll MOD;
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
typedef vector<vpi> vvpi;

typedef set<pi> spi;

const int INF=INT_MAX;

vector<vector<lint>> matmul(const vector<vector<lint>> &A, const vector<vector<lint>> &B, lint mod=MOD){
    int H = A.size(), W = B[0].size(), K = B.size();
    vector<vector<lint>> C(H, vector<lint>(W));
    REP(i, H) REP(j, W) REP(k, K) (C[i][j] += A[i][k] * B[k][j]) %= mod;
    return C;
}
vector<vector<lint>> matpower(vector<vector<lint>> X, lint n, lint mod=MOD){
    vector<vector<lint>> res(X.size(), vector<lint>(X.size()));
    REP(i, res.size()) res[i][i] = 1;
    while (n)
    {
        if (n & 1) res = matmul(res, X, mod);
        X = matmul(X, X, mod); n >>= 1;
    }
    return res;
}
lint power(lint x, lint n){
    lint ans = 1;
    while (n>0)
    {
        if (n & 1) (ans *= x) %= MOD;
        (x *= x) %= MOD;
       n >>= 1;
    }
   return ans;
}

ll sol(ll len,ll A,ll B,ll amari){
    if(!len){
        return amari;
    }
    ll d=to_string(A).length();
    ll m=1;
    F0R(i,d){
        m*=10;
    }
    ll n_term=min((m-1-A)/B+1,len);
    vector<vector<ll>> trans{{power(10,d),0,0},{1,1,0},{0,B,1}};
    trans=matpower(trans,n_term);
    amari=(trans[0][0]*(amari%MOD)%MOD+trans[1][0]*(A%MOD)%MOD+1*trans[2][0]%MOD)%MOD;
    return sol(len-n_term,A+B*n_term,B,amari);
    
}




void solve(){
    ll l,A,B;
    cin>>l>>A>>B>>MOD;
    ll ret=sol(l,A,B,0);
    out(ret);
}

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

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

int main() {

  int N, A;
  string res;
  cin  >> N >> A;
  
  if(N % 500 <= A){
    res = "Yes";
  }
  
  else{
    res = "No";
  }
  
  cout << res << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    long long res = 0;
    map<string,long long> mt;
    cin >> n;
    while(n--){
        string s;
        cin>>s;
        sort(s.begin(),s.end());
        res += mt[s];
        mt[s]++;
    }
    cout << res;
    return 0;
}

Measured memory_bytes: 11136
#include<iostream>
#include<string>
#include<map>
#include<set>
#define ll long long int
#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;

int main(){
    string s,t;
    cin >> s >> t;
    int n=(int)(s.size());
    int m=(int)(t.size());
    int flg = 0;
    rep(i,n){
        if(s[i] != t[i]){
            flg=1;
        }
    }
    if(m!=(n+1)){
        flg=1;
    }
    if(flg==0){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 3596
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <iostream>
#include <fstream>
#include <cstdlib>
#include <stack>
#include <queue>

using namespace std;
#define Fill(a, b) memset(a, b, sizeof(a))
#define Debug(x) cout << #x << "=" << (x) << endl;
typedef long long LL;
const LL inf = 1LL << 61;
const LL mod = 1000000007;
#define DEBUG
#ifdef DEBUG
#endif

int main()
{
    std::ios::sync_with_stdio(false);
    string str;
    cin >> str;
    cout << str.substr(0,str.size()-8) << endl;






















    return 0;
}


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

int main(){
  long count=0;
  int N,M;
  cin>>N>>M;
  vector<vector<int>>menu(N,vector<int>(M));
  rep(i,N){
    int K; cin>>K;
    rep(j,K){
      int a; cin>>a;
      menu[i][a-1] =1;
    }
  }
    rep(i,M){
      int counter=0;
      rep(j,N){
        counter+=menu[j][i];
      }
      if(counter==N){
        count++;
      }
    }
  cout<<count;
}


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

int main(){
	int n;
	int v[20];
	int c[20];
	int x, y, z;

	x = 0, y = 0, z = 0;

	scanf("%d",&n);
	for(int i = 0; i < n; i++){
		scanf("%d",&v[i]);
	}

	for(int i = 0; i < n; i++){
		scanf("%d",&c[i]);
	}

	for(int i = 0; i < n; i++){
		if (v[i] > c[i]){
			x = x + v[i];
			y = y + c[i];
		}
	}


	if ((x-y) >= 0){
		z = x-y;
	}
	printf("%d\n", z);

	return 0;
}






Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <utility>
#include <tuple>
#include <algorithm>
#include <numeric>
#include <cstdio>
#include <cmath>
#define rep(i, n) for(int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int main() {
  string S, prev;
  cin >> S;
  prev = S[0];
  int ans = 1;
  string next;
  for (int i=1; i<S.size(); i++) {
    next += S[i];
    if (next != prev) {
      ans++;
      prev = next;
      next = "";
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 640
#include <algorithm>
#include <cstdio>
const int N=200005,mo=1000000007;
int id[N],l[N],r[N],f[N],sum[N];
struct info{int x,v;}p[N];
bool cmp2(info a,info b){return a.x<b.x;}
bool cmp(int a,int b){return p[a].v<p[b].v;}
int main(){
	int n;
	scanf("%d\n",&n);
	for (int i=1;i<=n;i++) scanf("%d%d\n",&p[i].x,&p[i].v);
	std::sort(p+1,p+n+1,cmp2);
	for (int i=1;i<=n;i++) id[i]=i;
	std::sort(id+1,id+n+1,cmp);
	for (int i=1;i<=n;i++) l[id[i]]=r[id[i]]=i;
	for (int i=2;i<=n;i++) r[i]=std::max(r[i],r[i-1]);
	for (int i=n-1;i;i--) l[i]=std::min(l[i],l[i+1]);
	f[0]=sum[0]=1;
	for (int i=1,j=1;i<=n;i++){
		sum[i]=sum[i-1];
		for (;j<=n && r[j]==i;j++){
			int x=sum[i];
			if (l[j]>1) x=(x-sum[l[j]-2]+mo)%mo;
			(f[i]+=x)%=mo;
			(sum[i]+=x)%=mo;
		}
	}
	printf("%d\n",f[n]);
}

Measured memory_bytes: 5632
a=input()
if a[0]==a[1] and a[2]==a[3] and a[0]!=a[2]:
  print('Yes')
elif a[0]==a[2] and a[1]==a[3] and a[0]!=a[1]:
  print('Yes')
elif a[0]==a[3] and a[1]==a[2] and a[0]!=a[1]:
  print('Yes')  
else:
  print('No')


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

int main() {
  int n; cin >> n;
  int n2 = (n * 100 + 108 - 1) / 108;
  if ((int)(n2 * 1.08) == n) cout << n2;
  else cout << ":(";
  return 0;
}

Measured memory_bytes: 256
fun intList() = readLine()?.split(" ")?.map(String::toInt) ?: TODO()
fun main(args: Array<String>) {
    val n = readLine()?.toInt() ?: return
    val a = intList()
    val m = (1e9 + 7).toLong()
    val map = hashMapOf<Int, Int>()
    a.forEach {
        map[it] = map.getOrDefault(it, 0) + 1
    }
    val zero = map.getOrDefault(0, 0)
    if (n % 2 == 1 && zero != 1) {
        println("0")
        return
    } else if (n % 2 == 0 && zero != 0) {
        println("0")
        return
    }
    map.remove(0)
    var t = 1L
    map.values.forEach {
        if (it != 2) {
            println("0")
            return
        } else {
            t = t * 2 % m
        }
    }
    println(t.toString())
}

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

using namespace std;

const int Nmax = 2e5 + 5, Mod = 1e9 + 7;
typedef long long ll;
typedef pair<int,int> Pair;

int add(int x, int y) {x+=y; return x<Mod ? x : x-Mod;}
int inm(int x, int y) {return (ll) x*y % Mod;}
void addto(int &x, int y) {x+=y; if(x>=Mod) x-=Mod;}
void inmto(int &x, int y) {x = (ll) x*y%Mod;}

int power(int a, int b)
{
    if(!b) return 1;
    if(b&1) return inm(a, power(inm(a,a), b/2));
    return power(inm(a,a), b/2);
}

int main()
{
    // freopen("input", "r", stdin);
    cin.sync_with_stdio(false);

    int n, a, b;
    cin >> n >> a >> b;
    if((b-a)%2 == 0) cout << "Alice\n";
        else cout << "Borys\n";

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include <boost/multiprecision/cpp_int.hpp>
//typedef boost::multiprecision::cpp_int ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E17;

#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
///////////////////////////////////////



int main(){fastio
    
    string s;cin>>s;
    ll n=s.size();
    ll c=0;
    rep(i,0,n-1){
        if(s[i]=='x'){
            c++;
        }
    }
    if(c>=8){
        cout<<"NO"<<endl;
    }else{
        cout<<"YES"<<endl;
    }
    
    return 0;
}


Measured memory_bytes: 764
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <utility>
#include <algorithm>
#include <cstdio>
#include <iomanip>
#include <queue>
#include <deque>
#include <stack>
#include <fstream>
#include <cmath>
#include <random>

#define ll int64_t
#define Rep(i, n) for (ll i = 0; i < n; i++)
using namespace std;
typedef vector<ll> vec;
typedef vector<vec> mat;

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

    ll N, A, B;
    cin >> N >> A >> B;
    ll ans;
    if (abs(A-B) % 2 == 0) {
        ans = abs(A-B) / 2;
    } else {
        ans = min(N-B, A-1) + (B-A-1) / 2 + 1;
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
using namespace std;

int N;
vector<vector<pair<int, int>>> G;
vector<int> ans;

void dfs(int s){
    for(auto p : G[s]){
        int t = p.first;
        int c = p.second;
        if(ans[t] != -1) continue;
        if(c == 0) ans[t] = ans[s];
        else ans[t] = 1 - ans[s];
        dfs(t);
    }
}

int main(){
    cin >> N;
    G.resize(N);
    ans.resize(N, -1);

    for(int i=0; i<N-1; i++){
        int u, v, w;
        cin >> u >> v >> w;
        u--; v--;
        w = w % 2;
        G[u].push_back(make_pair(v, w));
        G[v].push_back(make_pair(u, w));
    }

    ans[0] = 0;
    dfs(0);

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

    return 0;
}

Measured memory_bytes: 8192
def myAnswer(N:int,P:list) -> int:
   total = 0
   MIN = 10**10
   for i in range(N):
      MIN = min(MIN,P[i])
      if(MIN>= P[i]):
         total+=1
   return total

def modelAnswer():
   tmp=1
def main():
   N = int(input())
   P = list(map(int,input().split()))
   print(myAnswer(N,P[:]))

if __name__ == '__main__':
   main()

Measured memory_bytes: 24744
#include "bits/stdc++.h"
using namespace std;
int main(){
    int n,i,sum = 0;
    cin >> n;
    vector<int> l(n);
    for(i=0;i<n;i++) cin >> l.at(i);
    sort(l.begin(),l.end());
    for(i=0;i<n-1;i++) sum += l.at(i);
    if(sum > l.at(n-1)) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

class Solver {
    void solve(Scanner in) {
        int N = in.nextInt();
        System.out.println(N * (N - 1L) / 2L);
    }
}

class Main {
    public static void main(String... args) {
        Scanner in = new Scanner(System.in);

        new Solver().solve(in);

        in.close();
    }
}


Measured memory_bytes: 21844
import numpy as np
from pprint import pprint
W, H, N = map(int, input().split())
area = np.ones((H, W))
# pprint(area[1][:3])
for _ in range(N):
    x, y, a = map(int, input().split())
    y = H - y
    if a == 1:
        for i in range(H):
            area[i][:x] = 0
    elif a == 2:
        for i in range(H):
            area[i][x:] = 0
    elif a == 3:
        for i in range(y, H):
            area[i] = 0
    elif a == 4:
        for i in range(y):
            area[i] = 0
pprint(int(area.sum()))

Measured memory_bytes: 27172
#include "bits/stdc++.h"
#include <math.h>
#include <time.h>
using namespace std;
const long long mod = 1000000007;
#define dump(x)                             \
    if (dbg) {                              \
        cout << #x << " = " << (x) << endl; \
    }
bool dbg = false;
//---------------------------------------------------------------------------------------------------
/*ここからいじる*/
//---------------------------------------------------------------------------------------------------
void solve(){
    long long a, b, k, ta, ao;
    cin >> a >> b >> k;
    ta = 0;
    ao = 0;
    if(k > a){
        ta = 0;
        k -= a;
        if(k > b){
            ao = 0;
        }
        else{
            ao = b - k;
        }
    }
    else{
        ta = a - k;
        ao = b;
    }
    cout << ta << " " << ao << endl;
}

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



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

using namespace std;

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

#define int ll

const ll mod = 1e9 + 7;

ll cir[5000][5000];
ll sum[5000][5000];
int num[5000];

int n;
ll k;
int p[5000];
ll c[5000];

ll solver1(){
	

	for(int s=0;s<n;s++){
		int t = p[s];
		int u = 0;
		cir[s][u] = c[t];
		u++;
		while(t!=s){
			t = p[t];
			cir[s][u] = c[t];
			u++;
		}
		num[s] = u;
	}

	for(int i=0;i<n;i++) sum[i][0] = 0ll;
	
	
	for(int i=0;i<n;i++){
		for(int j=1;j<=num[i];j++){
			sum[i][j] = sum[i][j-1] + cir[i][j-1];
		}
	}

	//for(int i=0;i<n;i++) cout << sum[i][num[i]] << endl;

	ll ans = -1e18;
	
	for(int i=0;i<n;i++){
		/*
		for(int j=1;j<=min(k,num[i]);j++){
			int num2 = (k-j)/num[i];
			ans = max( num2 * max(0ll,sum[i][num[i]]) + sum[i][j], ans);
		}
		*/
		int cnt = 0;
		ll path = 0;
		int v = i;

		ll cycle_sum = 0;
        int cycle_cnt = 0;

        while (true) {
            cycle_cnt++;
            cycle_sum += c[v];
            v = p[v];
            if (v == i) break;
        }

		while(true){
			cnt++;
            path += c[v];

            if (cnt > k) break;

            int num2 = (k - cnt) / num[i];
            ll score = path + max(0ll, cycle_sum) * num2;
			ans = max(ans, score);

			v = p[v];

            if (v==i) break;
		}
	}

	return ans;
}

main(){
	cin >> n >> k;
	for(int i=0;i<n;i++){
		cin >> p[i];
		p[i]--;
	}
	for(int i=0;i<n;i++) cin >> c[i];

	printf("%lld\n", solver1());
	

	return 0;
}


Measured memory_bytes: 394484
#include <stdio.h>

int main(){
	int m,l,r,sum=0;
	scanf("%d %d %d", &m,&l,&r);
	for(int i=1;i<=m;i++){
		int dSum = 0;
		int temp = i;
		while (temp != 0){
			dSum = dSum + temp % 10;
			temp /= 10;
		}
		if(dSum >= l && dSum <=r){
			sum+=i;
		}
	}
	printf("%d\n", sum);
	
	return 0;
}

Measured memory_bytes: 1732
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)

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


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

using namespace std;

int main() {
    long long X, Y, Z, K;
    cin >> X >> Y >> Z >> K;
    long long A[X], B[Y], C[Z];

    for (int i = 0; i < X; i++) cin >> A[i];
    for (int i = 0; i < Y; i++) cin >> B[i];
    for (int i = 0; i < Z; i++) cin >> C[i];

    sort(A, A + X, greater<long long>());
    sort(B, B + Y, greater<long long>());
    sort(C, C + Z, greater<long long>());

    vector<long long> ans;
    for (int x = 0; x < X; x++) {
        for (int y = 0; y < Y; y++) {
            for (int z = 0; z < Z; z++) {
                ans.push_back(A[x]+B[y]+C[z]);
                if (x * y * z > K) break;
            }
        }
    }
    sort(ans.begin(), ans.end(), greater<long long>());

    for (int i = 0; i < K; i++) {
        cout << ans[i] << endl;
    }

    return 0;
}


Measured memory_bytes: 35044
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr
N = int(input())
if N == 1:
    print(0)
else:
    result = 0
    for i in range(len(factorization(N))):
        tempnumber = factorization(N)[i][1]
        plusnumber = 1
        while tempnumber > 0:
            result += 1
            plusnumber += 1
            tempnumber -= plusnumber
    print(result)

Measured memory_bytes: 9500