akhauriyash/Code-Regression huggingface dataset:
#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>

#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>
#include <regex>
#define REP(i,n) for(int i = 0; i < n; i++)
#define FOR(i,j,n) for(int i = j; i < n; i++)
#define RFOR(i,j,n) for(int i = j-1; i >= n; i--)
#define PREC(n) fixed << setprecision(n)
#define print_array(v) REP(__k, v.size()) { cout << v[__k]; if(__k != v.size()-1) cout << " "; else cout << endl; }
#define YesorNo(a) printf(a?"Yes\n":"No\n")
#define _LIBCPP_DEBUG 0
using namespace std;
int64_t MOD = 1000000007;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  string s;
  cin >> s;
  cout << "2018/01/" << s[8] << s[9] << endl;
  return 0;
}
//templete by private_yusuke

Measured memory_bytes: 256
// g++ -std=gnu++1y -O2 xxx.cpp

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

int main() {
    string a,b; cin>>a>>b;
    string c = a+b;
    int n = atoi(c.c_str());
    int m = (int)sqrt(n);
    if (m * m == n) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
N = int(input())
res = N
for i in range(N+1):
    count = 0
    t = i
    while t > 0:
        count += t % 6
        t //= 6
    t = N-i
    while t > 0:
        count += t % 9
        t //= 9
    res = (count if res > count else res)
print(res)

Measured memory_bytes: 3060
#include <cstdio>
#include <vector>
#include <algorithm>
#include <string>
#include <iostream>
#include <iomanip>
#include <map>
#include <cmath>
#include <bitset>
using namespace std;

typedef long long ll;
typedef pair<int,int> Pi;
const ll inf = 1e18 + 1;
const ll limit = 1e9;

int n,m,q;
int ans = 0;
int a[100];
int b[100];
int c[100];
int d[100];

int score(vector<int> s) {
    int res = 0;
    for (int i = 0; i < q; i++) {
        int pre = s[a[i]-1] - '0';
        int nex = s[b[i]-1] - '0';
        if (nex - pre == c[i]) res += d[i];
    }
    return res;
}

void dfs(vector<int> s) {
    if (s.size() == n) {
        ans = max(ans,score(s));
        return;
    }    
    int last = 1;
    if (s.size()) last = s[s.size()-1];
    for (int i = last; i <= m; i++) {
        s.push_back(i);
        dfs(s);
        s.pop_back();
    }
}

int main() {
    cin >> n >> m >> q;
    for (int i = 0; i < q; i++) cin >> a[i] >> b[i] >> c[i] >> d[i];
    vector<int> v;
    dfs(v);
    cout << ans << "\n";
}   
 

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

void solve(long long X, long long Y, long long Z){
    cout << Z << ' ' << X << ' ' << Y << '\n';
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    long long X;
    scanf("%lld",&X);
    long long Y;
    scanf("%lld",&Y);
    long long Z;
    scanf("%lld",&Z);
    solve(X, Y, Z);
    return 0;
}


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

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl




typedef long long ll;
const ll mod = 1e9+7;
const int maxn = 1e6 + 5;


int n;
int a[maxn];

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0);  cout.tie(0);
    cin>>n;
    for (int i=2; i<=n; i++) {
	int boss;
	cin>>boss;
	a[boss]++;
    }

    for (int i=1; i<=n; i++) {
	cout<<a[i]<<"\n";
    }
  

    return 0;
}


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

struct team{
    int t;
    int ac;
    int id;
    team():t(0),ac(0),id(0){}
    bool operator <(const team& a){
        if(ac != a.ac) return ac > a.ac;
        if(t != a.t) return t < a.t;
        return id > a.id;
    }
};

int main(){
    while(1){
        int m,t,p,r;
        cin >>m>>t>>p>>r;
        if(m==0) break;

        vector<vector<int> > wa(t, vector<int>(p,0));
        vector<team> info(t);
        for(int i=0; i<t; i++) info[i].id=i+1;
        for(int i=0; i<r; i++){
            int mi,ti,pi,ji;
            cin >>mi>>ti>>pi>>ji;
            ti--; pi--;
            if(ji==0){
                info[ti].ac++;
                info[ti].t += mi + wa[ti][pi]*20;
            }else{
                wa[ti][pi]++;
            }
        }
        sort(info.begin(), info.end());
        cout << info[0].id;
        for(int i=1; i<t; i++){
            if(info[i].ac==info[i-1].ac && info[i].t==info[i-1].t){
                cout << "=";
            }else{
                cout << ",";
            }
            cout << info[i].id;
        }
        cout << endl;
    }   
    return 0;
}

Measured memory_bytes: 3120
n = int(input())

count = 0
list_count = []
max_number = 0

for i in range(n):
    a = i + 1
    while a % 2 == 0:
        count += 1
        a /= 2
    list_count.append(count)
    if max(list_count) == count:
        max_number = i + 1
    count = 0

print(max_number)


Measured memory_bytes: 2940
#include<iostream>
#include<string>
#include<vector>
#include<memory>

template<class T>
struct node {
	T key;
	node* parent;
	std::unique_ptr<node<T>> left, right;
	bool valid_;


	bool nil()const {
		return !valid_;
	}
	bool valid()const {
		return valid_;
	}
	void validate() {
		valid_ = true;
	}
	node() :key{}
		, parent{ nullptr }
		, left{ nullptr }
		, right{ nullptr }
		, valid_{ false }
	{}

	template<class X>
	node(X&&t) :key{ t }
		, parent{ nullptr }
		, left{ nullptr }
		, right{ nullptr }
		, valid_{ false }
	{}

};



template<class T>
void inorder(const node<T>* const root) {
	if (root == nullptr)
		return;

	inorder(root->left.get());
	std::cout << " " << root->key;
	inorder(root->right.get());
}

template<class T>
void preorder(const node<T>* const root) {
	if (root == nullptr)
		return;

	std::cout << " " << root->key;
	preorder(root->left.get());
	preorder(root->right.get());
}


template<class T>
void print(const node<T>*const root) {
	inorder(root);
	std::cout << "\n";
	preorder(root);
	std::cout << "\n";
}


template<class T>
void insert(node<T>* root, const T&value_) {
	decltype(root) parent = nullptr;
	decltype(root) here = root;

	auto z = std::make_unique<node<T>>(value_);
	z->validate();

	//値が最も近い、有効なノード(parent)へ移動
	while (here != nullptr && here->valid()) {
		parent = here;
		//		std::cout << here->key << " ";

		if (z->key < here->key) {
			here = here->left.get();
			//			std::cout << "> ";
		}
		else {
			here = here->right.get();
			//			std::cout << "< ";
		}
		//		std::cout << value_ << "\n";
	}
	//zはparentの left か right になる
	z->parent = parent;


	auto& up
		= z->key < parent->key ?
		parent->left
		: parent->right;

	up = std::move(z);

}

template<class T>
auto find(node<T>* root, const T& value_)->node<T>* {
	if (root == nullptr)
		return nullptr;

	if (root->key == value_)
		return root;

	auto& child = value_ < root->key ? root->left : root->right;
	return find( child.get(), value_);

}

int main() {
	int n;
	std::cin >> n;

	//	std::vector<node<int>> tree;
	//	tree.emplace_back(node<int>{});
	std::unique_ptr<node<int>> root{ nullptr };


	for (int i{}; i < n; ++i) {
		std::string s;
		std::cin >> s;
		if (s == "insert") {
			int k;
			std::cin >> k;
			if (!root) {
				root = std::make_unique<node<int>>(k);
				root->validate();
			}
			else
				insert(root.get(), k);
		}
		else if (s == "find") {
			int k;
			std::cin >> k;
			std::cout <<  ( find(root.get(), k) ? "yes" : "no" ) << "\n";
		}
		else
			print(root.get());
	}

	return 0;
}


Measured memory_bytes: 21920
#include <bits/stdc++.h>
using namespace std;
using Graph= vector<vector<int>>;
constexpr int TBC= -1;

void BFS(const Graph &gph, int s, vector<int> *label){
  queue<pair<int,int>> bfs;
  for(auto to:gph.at(s)){
    bfs.push(make_pair(to, s));
  }

  while(!bfs.empty()){
    auto v_tmp= bfs.front();
    bfs.pop();

    int from,prev;
    tie(from, prev)= v_tmp;
    if(label->at(from) != TBC){ continue; }
    else{
      label->at(from)= prev;
      for(auto to:gph.at(from)){
        bfs.push(make_pair(to, from));
      }
    }
  }
}

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

  Graph gph(N);
  int v1,v2;
  for(int j=0; j<M; j++){
    cin >> v1 >> v2;
    v1--; v2--; // 1-indexed -> 0-indexed

    gph.at(v1).emplace_back(v2);
    gph.at(v2).emplace_back(v1);
  }
  vector<int> label(N, TBC);

  BFS(gph, 0, &label);

  cout << "Yes" << endl;
  for(int i=1; i<N; i++){
    cout << label.at(i)+ 1 << endl; // 0-indexed -> 1-indexed
  }
}

Measured memory_bytes: 12928
#include <iostream>
#include <math.h>

using namespace std;

bool is_prime(int num) {
  if (num == 2 || num == 3 || num == 5 || num == 7) return true;
  if (num % 2 == 0) return false;
  for (int i = 3; i * i <= num; i += 1)
    if (num % i == 0) return false;
  return true;
}


int main() {
  int N, num, count;

  count = 0;

  cin >> N;
  for (int i = 0; i < N; i ++) {
    cin >> num;
    if (is_prime(num)) count ++;

  }
  cout << count << endl;

  return 0;
}



Measured memory_bytes: 3100
#include<iostream>
#include<fstream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
#include<deque>
#include<set>
#include<map>
#include<bitset>
#include<ctime>
#include<queue>
using namespace std;
#define int long long
#define pii pair <int, int>
#define XX first
#define YY second

// constants:
const int mn = 200005;
const int mod = 1000000007;
const long long inf = 4444444444444444444;
const int sminf = 1111111111;
const bool is_multitest = 0;
const bool is_interactive = 0;

// i/o methods:
const bool input_from_file = 0;
const bool output_to_file = 0;
#define filename ""
#define in_extension "inp"
#define out_extension "out"

// data preprocessing: (e.g.: divisor generating, prime sieve)
void preprocess()
{
    
}

// global variables:
int n;
int A[mn], B[mn];
// main solution goes here:
void execute(int test_number)
{
    cin>>n;
    for (int i=1; i<=n+1; i++) cin>>A[i];
    for (int i=1; i<=n; i++) cin>>B[i];

    int ans = 0;
    for (int i=1; i<=n; i++) {
        int t = min(A[i], B[i]);
        ans+=t;
        B[i] -= t;
        t = max(0ll, min(A[i+1], B[i]));
        A[i+1] -= t;
        ans+=t;
    }

    cout<<ans;    
}
// REMEMBER TO CHOOSE TEST METHODS
// PLEASE REMOVE cout AND cerr DEBUG LINES BEFORE SUBMITTING PROBLEMS
// Solution by low_



















signed main()
{
#ifdef lowie
    if (!is_interactive)
    {
        freopen("test.inp", "r", stdin);
        freopen("test.out", "w", stdout);
    }
#else
    if (input_from_file) freopen(filename"."in_extension, "r", stdin);
    if (output_to_file) freopen(filename"."out_extension, "w", stdout);
#endif
    if (!is_interactive)
    {
        ios_base::sync_with_stdio(0);
        cin.tie(0);
        cout.tie(0);
    }

    preprocess();
    int ntest;
    if (is_multitest) cin >> ntest;
    else ntest = 1;

    for (int testno = 1; testno <= ntest; testno++)
    // use for instead of while to serve facebook hacker cup test format
    {
        execute(testno); // only start coding in this function, not in main
    }
}
// Template by low_
// Contact me via mail: ttuandung1803@gmail.com
// ...or codeforces: www.codeforces.com/profiles/low_
// ...or if you're interested in food: www.instagram.com/lowie.exe/

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


int main() {

    string s;
    cin >> s;
    rep(i,3) {
        if (s[i] == s[i+1]) {
            cout << "Bad" << endl;
            return 0;
        }
    }
    cout << "Good" << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <map>
#include <numeric>
#include <cmath>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <complex>
#include <string.h>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <iomanip>
#include <sys/time.h>
#include <tuple>
#include <random>
using namespace std;

#define endl '\n'
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define UNIQ(v) (v).erase(unique((v).begin(), (v).end()), (v).end())

typedef long long ll;
typedef long double ld;
typedef pair<ll, int> P;
typedef tuple<int, int, int> T;
typedef vector< vector<ld> > matrix;
struct pairhash {
public:
    template<typename T, typename U>
    size_t operator()(const pair<T, U> &x) const {
	size_t seed = hash<T>()(x.first);
	return hash<U>()(x.second) + 0x9e3779b9 + (seed<<6) + (seed>>2);
    }
};
const int inf = 1e9 + 9;
const ll mod = 1e9 + 7;
const double eps = 1e-8;
const double pi = acos(-1);

int n;
ll a[200100];

ll solve() {
    sort(a, a+n);
    if (n == 2) return a[1];
    if (n == 3) return a[1] + a[2];
    ll res = a[n-1];
    int cnt = 1;
    for (int i = n-2; i >= 0; i--) {
        for (int j = 0; j < 2; j++) {
            if (cnt+1<=n-1) {
                res += a[i];
                cnt++;
            }
        }
    }
    return res;
}

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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(15);

    input();
    cout << solve() << endl;
}


Measured memory_bytes: 5192
#include "bits/stdc++.h"
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a),i##_len=(b);i<i##_len;++i)
#define MSVC_UNKO(x) x
#define rep(...) MSVC_UNKO(_overload3(__VA_ARGS__,repi,_rep,_rep)(__VA_ARGS__))
#define all(c) c.begin(),c.end()
#define mp make_pair
#define write(x) cout<<(x)<<'\n'
using namespace std; typedef long long ll; template<class T>using vv = vector<vector<T>>;
template<class T>auto vvec(int n, int m, T v) { return vv<T>(n, vector<T>(m, v)); }
template<class T1, class T2>bool chmax(T1& a, const T2& b) { return a < b ? a = b, 1 : 0; }
template<class T1, class T2>bool chmin(T1& a, const T2& b) { return b < a ? a = b, 1 : 0; }
constexpr int INF = 1 << 29, MOD = int(1e9) + 7; constexpr ll LINF = 1LL << 60;
struct aaa { aaa() { cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(10); }; }aaaa;

int N;
vv<int> A;
vv<int> graph;
vector<int> indeg;
vector<bool> used;
vector<int> day;

void dfs(int v) {
    used[v] = true;

    for (int u : graph[v]) {
        indeg[u]--;
        day[u] = max(day[u], day[v] + 1);
        if (indeg[u] == 0 && !used[u]) {
            dfs(u);
        }
    }
}

int main() {
    cin >> N;
    A = vvec(N, N - 1, 0);
    rep(i, N) rep(j, N - 1) {
        cin >> A[i][j];
        A[i][j]--;
    }

    graph.resize(N * N + 1);
    indeg.resize(N * N + 1);
    rep(i, N) rep(j, N - 2) {
        int a = i, b = A[i][j], c = i, d = A[i][j + 1];
        if (a > b) swap(a, b);
        if (c > d) swap(c, d);

        graph[a * N + b].push_back(c * N + d);
        indeg[c * N + d]++;
    }
    rep(i, N) {
        int a = i, b = A[i][0];
        if (a > b) swap(a, b);
        graph[N * N].push_back(a * N + b);
        indeg[a * N + b]++;
    }

    used.resize(N * N + 1);
    day.resize(N * N + 1);
    dfs(N * N);

    int ans = 0;
    rep(i, N) rep(j, i + 1, N) {
        if (!used[i * N + j]) {
            write(-1);
            return 0;
        }

        ans = max(ans, day[i * N + j]);
    }

    write(ans);
}

Measured memory_bytes: 51328
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <queue>
#include <set>

#define rep(i,n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())

using namespace std;
typedef long long ll;

int main(int argc, const char * argv[]) {
    
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int a, b, q;
    cin >> a >> b >> q;
    vector<ll> s(a);
    vector<ll> t(b);
    vector<ll> x(q);
    
    rep(i, a) cin >> s[i];
    rep(i, b) cin >> t[i];
    rep(i, q) cin >> x[i];
    
    rep(i, q)
    {
        ll sl, sr, tl, tr;
        auto it = lower_bound(s.begin(), s.end(), x[i]);
        ll ps = *it;
        
        if (it == s.end()) sr = -1;
        else sr = *it - x[i];
        
        if (it == s.begin()) sl = -1;
        else
        {
            --it;
            sl = x[i] - *it;
        }
        
        
        
        it = lower_bound(t.begin(), t.end(), x[i]);
        ll pt = *it;
        
        if (it == t.end()) tr = -1;
        else tr = *it - x[i];
        
        if (it == t.begin()) tl = -1;
        else
        {
            --it;
            tl = x[i] - *it;
        }
        
        ll sltl = max(sl, tl);
        if (sl == -1 || tl == -1) sltl = std::numeric_limits<ll>::max();
        
        ll srtr = max(sr, tr);
        if (sr == -1 || tr == -1) srtr = std::numeric_limits<ll>::max();
        
        ll sltr = min(sl*2+tr, sl+tr*2);
        if (sl == -1 || tr == -1) sltr = std::numeric_limits<ll>::max();
        
        ll srtl = min(sr*2+tl, sr+tl*2);
        if (sr == -1 || tl == -1) srtl = std::numeric_limits<ll>::max();
        
        cout << min(min(sltl, srtr), min(sltr, srtl)) << endl;
    }
    
    
    
    return 0;
}

Measured memory_bytes: 3712
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
#include <algorithm> 
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
#define ll long long
#define rep(i,n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<"\n"
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES\n" : "NO\n"  )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n"  )
#define mp make_pair
#define sz(x) (ll)(x).size()
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvll = vector<vll>;
using vstr = vector<string>;
using vc = vector<char>;
using vvc = vector<vc>;
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; 
}
ll dx[4]={0,1,0,-1};
ll dy[4]={1,0,-1,0};
int main(){
  ll k;
  cin>>k;
  if(k%2==0){
    COUT(-1);
    return 0;
  }
  if(k%7==0) k/=7;
  ll ans=1;
  ll now=1;
  set<ll> s;
  while(1){
    now%=k;
    if(s.count(now)){
      COUT(-1);
      return 0;
    }
    s.insert(now);
    if(now==0) break;
    now*=10;
    now++;
    ans++;
  }
  COUT(ans);
}


Measured memory_bytes: 50456
w = str(input())

w_list = list(w)

str_list = [chr(i) for i in range(97, 97+26)]

count = 0

for char in str_list:
	if w_list.count(char)%2 == 0:
		count +=1
	else:
		print("No")
		break
	if count == 26:
		print("Yes")

Measured memory_bytes: 3060
# ANSHUL GAUTAM
# IIIT-D

from math import *
from copy import *
from string import *				# alpha = ascii_lowercase
from random import *				# l.sort(key=lambda l1:l1[0]-l1[1]) => ex: sort on the basis difference
from sys import stdin
from sys import maxsize
from operator import *				# d = sorted(d.items(), key=itemgetter(1))
from itertools import *
from collections import Counter		# d = dict(Counter(l))
from collections import defaultdict # d = defaultdict(list)

'''

'''

def solve(l):
	n = len(l)
	

l = list(map(int, stdin.readline().rstrip().split()))
s = list(set(l))
ans = "Yes"
if(len(s) != 2):
	ans = 'No'
print(ans)


Measured memory_bytes: 5228
use io::*;
use std::*;

fn solve(N: i64, A: i64, B: i64) {
    let rem = N % (A + B);
    let mul = N / (A + B);
    let res = mul * A + cmp::min(A, rem);
    println!("{}", res);
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
fn main() {
    let con = read_string();
    let mut scanner = Scanner::new(&con);
    let mut N: i64;
    N = scanner.next();
    let mut A: i64;
    A = scanner.next();
    let mut B: i64;
    B = scanner.next();
    // In order to avoid potential stack overflow, spawn a new thread.
    let stack_size = 104_857_600; // 100 MB
    let thd = std::thread::Builder::new().stack_size(stack_size);
    thd.spawn(move || solve(N, A, B)).unwrap().join().unwrap();
}

pub mod io {
    use std;
    use std::str::FromStr;

    pub struct Scanner<'a> {
        iter: std::str::SplitWhitespace<'a>,
    }

    impl<'a> Scanner<'a> {
        pub fn new(s: &'a str) -> Scanner<'a> {
            Scanner {
                iter: s.split_whitespace(),
            }
        }

        pub fn next<T: FromStr>(&mut self) -> T {
            let s = self.iter.next().unwrap();
            if let Ok(v) = s.parse::<T>() {
                v
            } else {
                panic!("Parse error")
            }
        }

        pub fn next_vec_len<T: FromStr>(&mut self) -> Vec<T> {
            let n: usize = self.next();
            self.next_vec(n)
        }

        pub fn next_vec<T: FromStr>(&mut self, n: usize) -> Vec<T> {
            (0..n).map(|_| self.next()).collect()
        }
    }

    pub fn read_string() -> String {
        use std::io::Read;

        let mut s = String::new();
        std::io::stdin().read_to_string(&mut s).unwrap();
        s
    }

    pub fn read_line() -> String {
        let mut s = String::new();
        std::io::stdin().read_line(&mut s).unwrap();
        s.trim_right().to_owned()
    }
}


Measured memory_bytes: 8572
import sys

l = raw_input().split()
N = int(l[0])
Q = int(l[1])
l = raw_input().split()
S = l[0]

L = [0]*Q
R = [0]*Q

ac = 'AC'

for i in range(Q):
    l = raw_input().split()
    L[i] = int(l[0])
    R[i] = int(l[1])

#print(N,Q,S,L,R)

def count(S, table):
    length = len(S)
    c = 0
    for i in range(length - 1):
        # print(S[i:i+2])
        if ac == S[length - i - 2:length - i]:
            c += 1
        table[i+1] = c

length_S = len(S)
table = [0]*length_S

count(S, table)
# print(table)

for i in range(Q):
    print(table[length_S - L[i]] - table[length_S - R[i]])


Measured memory_bytes: 15604
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<functional>
#include<math.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define pf(n) printf("%d\n",n)
#define pff(a,b) printf("%d  %d\n",a,b);
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = 1001001001;
const double PI = acos(-1);

int main() {
	int n, t, a;
	cin >> n >> t >> a;
	vector<int> h(n);
	rep(i, n) cin >> h[i];

	double mi = 1001001;
	int ans = 0;
	rep(i, n) {
		double tmp = abs(a - t + h[i] * 0.006);
		if (mi > tmp) {
			ans = i + 1;
			mi = tmp;
		}
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3596
N = int(input())
S = [input() for i in range(N)]
s = set()
p = None
for w in S:
    if w in s:
        print('No')
        exit()
    s.add(w)
    if p and p != w[0]:
        print('No')
        exit()
    p = w[-1]
print('Yes')


Measured memory_bytes: 2940
# https://atcoder.jp/contests/dp/tasks/dp_a

total_stones = int(input())

heights = list(int(i) for i in input().split())

# iterative solution
def find_height(heights, total_stones):
    if total_stones == 0:
        return 0
    min_costs = [0]*total_stones
    min_costs[0] = 0
    min_costs[1] = abs(heights[1]-heights[0])
    for index in range(2, total_stones):
        # this is the part where we get thrown off by indexing
        # it took 1 jump to get to this point
        small_jump = abs(heights[index] - heights[index - 1]) + min_costs[index - 1]
        # it took 2 jumps to get to this point
        big_jump = abs(heights[index] - heights[index - 2]) + min_costs[index - 2]
        min_costs[index] = min(small_jump, big_jump)
    return min_costs[total_stones - 1]

print(find_height(heights, total_stones))

Measured memory_bytes: 13924
//Ruthless Coding 
#include <bits/stdc++.h>

#define uni(x)      (x).resize(unique(all(x)) - (x).begin())
#define fprint(v)   for(auto x : v) cout << x << ' '
#define ALL(x)      (x).begin(), (x).end()
#define MP(x, y)    make_pair(x, y)
#define SZ(x)       int((x).size())
#define PB(x)       push_back(x)
#define ll          long long
#define S           second 
#define F           first
#define nl          '\n'

using namespace std;
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
mt19937_64 rnd;

const int N = 2e5 + 5;

int main() {
    ios_base::sync_with_stdio(0);cin.tie(0);
    ll n;
    cin >> n;
    cout << (n * (n - 1) / 2);
    return 0;
}
/*
    *** Most Impo.. -> check base case always
    1. Overflow Check (*, +)
    2. Index check (0 - based or 1 - based)
    3. Check for n = 1, 2, 3, 4....
    4. Corner Cases
*/

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


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


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


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


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


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


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

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



/*↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓*/
int main() {
  IOS;
  ll n,k;
  cin>>n>>k;
  vector<ll> v(n);
  rep(i,n) cin>>v[i];
  ll ans=mod;
  rep(i,n-k+1){
    ll tmp;
    tmp=abs(v[i+k-1]-v[i])+min(abs(v[i]),abs(v[i+k-1]));
    ans=min(ans,tmp);
  }
  cout<<ans<<endl;
  
  
  
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define SIZE 200005
#define INF 1000000005LL
#define MOD 1000000007
using namespace std;
typedef long long int ll;
typedef pair <int,int> P;
ll gcd(ll a,ll b){
    
    if(b==0){
        return a;
    }else{
        return gcd(b,a%b);
    }
}
const ll A = 1000010;
int main(){
    ll n;
    cin >> n;
    vector<ll> data(1000010);
    vector<ll> num(n);
    rep(i,0,n){
        ll a;
        cin >> a;
        num[i]=a;
        data[a]++;
    }
    bool pairwise = true;
    rep(i,2,A){
        int cnt = 0;
        for(int j = i;j<A;j+=i){
            cnt += data[j];
        }
        if(cnt>1) pairwise = false;
    }
    if(pairwise){
        cout<<"pairwise coprime"<<endl;
        return 0;

    }
    ll g = 0;
    rep(i,0,n){
        g = gcd(g,num[i]);
    }
    //cout<<g<<endl;
    if(g==1){
        cout<<"setwise coprime"<<endl;
    }else{
        cout<<"not coprime"<<endl;
    }

    


    return 0;
}


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

typedef long long int ll;
using namespace std;

const ll MOD = 1e9 + 7;

int bit_count(int x){
	if(x==0)return 0;
	return x%2 + bit_count(x/2);
}

int main()
{
	int n,m; cin>>n>>m;
	int c[12]={0}; int p[12];
	for(int i=0;i<m;i++){
		int k; cin>>k;
		while(k--){
			int t; cin>>t; --t;
			c[i] ^= (1<<t);
		}
		//cout<<c[i]<<endl;
	}
	for(int i=0;i<m;i++) cin>>p[i];

	int ans=0;
	for(int i=0;i<(1<<n);i++){
		int f=0;
		for(int j=0;j<m;j++){
			int t = i&c[j];
			t = bit_count(t);
			if(t%2 == p[j]%2) f++;
		}
		if(f == m) ans++;
	}

	cout<<ans;
}
















Measured memory_bytes: 256
#include "bits/stdc++.h"
#define in std::cin
#define out std::cout
#define rep(i,N) for(LL i=0;i<N;++i)
typedef long long int LL;

const LL mod = 1000000007;

std::map<LL, LL> decomposit_prime(LL n)
{
	LL d = 2;
	std::map<LL, LL>res;
	while (d*d <= n)
	{
		if (n%d == 0)
		{
			++res[d];
			n /= d;
		}
		else ++d;
	}
	++res[n];
	return res;
}

// ユークリッドの互除法
LL extgcd(LL a, LL b, LL &x, LL &y)
{
	LL g = a; x = 1; y = 0;
	if (b != 0)
	{
		g = extgcd(b, a%b, y, x);
		y -= (a / b)*x;
	}
	return g;
}

// 逆元
LL mod_inverse(LL a, LL m)
{
	LL x, y;
	extgcd(a, m, x, y);
	return (m + x % m) % m;
}

// 階乗
std::vector<LL>fact;
void mod_fact(LL n, LL m)
{
	fact.resize(n + 1);
	fact[0] = 1;
	for (LL i = 1; i <= n; ++i) fact[i] = fact[i - 1] * i%m;
}

// nCk mod p
LL mod_comb(LL n, LL k, LL m)
{
	if (n < k) return 0;
	return fact[n] * mod_inverse(fact[k] * fact[n - k] % m, m) % m;
}

int main()
{
	LL N, M;
	in >> N >> M;

	if (M == 1)
	{
		out << 1 << std::endl;
		return 0;
	}
	auto primes = decomposit_prime(M);
	mod_fact(N + 64, mod);
	LL ans = 1;
	for (auto p : primes)
	{
		LL res = mod_comb(N + p.second - 1, p.second, mod);
		ans *= res;
		ans %= mod;
	}

	out << ans << std::endl;
}


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

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define REP(i,k,n) for(int i = k; i < n; i++)
//#define sum(start, end) accumulate(start, end, 0)
#define mmax(start, end) *max_element(start, end)
#define mmin(start, end) *min_element(start, end)
#define pb push_back
#define ALL(x) (x).begin(), (x).end()

typedef long long ll;
typedef string str;

using namespace std;
template <class T = ll> T in() { T _in; cin >> _in; return (_in); }


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

    ll rgb = in()*100 + in()*10 + in();

    if (rgb%4 == 0)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;

    return 0;
}


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

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        while (true) {
            int r = in.nextInt(), c = in.nextInt();
            if (r == 0 && c == 0) {
                in.close();
                break;
            }
            BitSet[] bits = new BitSet[r];
            for (int i = 0; i < r; i++) {
                bits[i] = new BitSet(c);
                for (int j = 0; j < c; j++) {
                    int input = in.nextInt();
                    if (input == 1) bits[i].set(j);
                }
            }
            int perms = 1 << r;  // ?????°?????±???2^r????????¢
            int result = 0;
            for (int i = 0; i < perms; i++) {
                // ?????????????????¢
                for (int j = 0; j < r; j++) {
                    if ((i & (1 << j)) > 0) {
                        bits[j].flip(0, c);    // ?????¬
                    }
                }
                // ???????????°?????????????????¶?????¢????????¢?????°??????????????§?????????
                int possible = 0;
                for (int k = 0; k < c; k++) {
                    int up = 0;
                    for (int v = 0; v < r; v++) {
                        if (bits[v].get(k)) {
                            up++;
                        }
                    }
                    possible += Math.max(up, r - up);
                }
                result = Math.max(result, possible);
                for (int u = 0; u < r; u++) {
                    if ((i & (1 << u)) > 0) {
                        bits[u].flip(0, c);
                    }
                }
            }
            System.out.println(result);
        }
    }
}

Measured memory_bytes: 83700
#include<stdio.h>

int main(){
int i;
int x,y;
int swap;


for(i=0;i<3000;i++){
	scanf("%d %d",&x,&y);

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

return 0;
}


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

const ll MOD = 1000000007;

ll modpow(ll x, ll n){
    ll res = 1;
    ll mul = x;
    while(n){
        if(n % 2) res = res * mul % MOD;
        mul = mul * mul % MOD;
        n /= 2;
    }
    return res;
}

int main()
{
    ll n;
    cin >> n;
    ll x[100002];
    for(int i = 0; i < n; i++) cin >> x[i];
    ll ans = 0;
    ll r = 0;
    for(int i = 1; i < n; i++){
        r = (r + modpow(i, MOD - 2)) % MOD;
        ans = (ans + r * (x[i] - x[i - 1]) % MOD) % MOD;
    }
    for(int i = 1; i < n; i++) ans = (ans * i) % MOD;
    cout << ans << endl;
}

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

#define CodeTyper main
#define Bye return 0
#define ll long long

using namespace std;

void solve(){
    ll n, k, q; cin>>n>>k>>q;

    vector<ll> players(n, k);
    for (ll i=0; i<q; i++){
        ll e; cin>>e;
        players[e-1]++;
    }
    for (ll i=0; i<n; i++)
        cout<<(players[i]-q<=0 ? "No" : "Yes")<<endl;
}

int CodeTyper(){
    solve();
    Bye;
}

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

int main()
{
    ios_base::sync_with_stdio(false);	
    
    int n;
    cin >> n;
    long long ans = 0;
    for(int i = 0; i <= n; i++)
    {
		if(i%3==0 || i%5==0) continue;
		ans+=i;
	}
	cout << ans;
		
    return 0;
}



Measured memory_bytes: 3644
N = int(input())
moti = []
for n in range(N):
    moti.append(int(input()))
counter = 0

while True:
    max_moti = max(moti)
    number_moti = moti.count(max_moti) #最大モチの数
    
    for i in range(number_moti): 
        index = moti.index(max_moti)
        del moti[index]
    counter += 1
    if not moti:
        break

print(counter)

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

using ll=long long;
using int64=int64_t;
const int inf=100000000;

int in(){
  int a;
  cin >> a;
  return a;
}//int型関数の受け取り

void forin(int* x,int y){
  for (int i=0;i<y;i++){
    cin >> x[i];
  }
}//(x,y) int型配列x[y]の受け取り

int intpow(int x,int y){
  double a=x,b=y;
  return pow(a,b);
}//(x,y) xをy乗

int intfabs(int x){
  double a=x;
  return fabs(a);
}//(x) xの絶対値

int fact(int x){
  if (x == 1) return 1;
  return x*fact(x-1);
}//(x) x!

int fib(int x){
  if (x <= 2) return x;
  int a[x];
  a[0]=1;
  a[1]=2;
  for (int i=2;i<x;i++){
    a[i]=a[i-1]+a[i-2];
  }
  return a[x-1];
}//(x) フィボナッチ数列のx番目

int div1(ll x){
  return x%1000000007;
}

main(){
    int x=in(),y=in(),z=in();
    x-=z;
    cout << x/(y+z) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <stdlib.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,int> P;
typedef vector<pair<ll,ll>> vep;
const ll mod=998244353;
const ll INF=1e15;
const int BIG=1e7;
int ans[3][100001];

int main(){
    ll N,K; cin>>N>>K;
    if(2*K>N+1) cout<<-1<<endl;
    else{
        ll M=(N+1)/2;
        for(int i=0;i<M;i++){
            ans[0][i]=M+i;
            ans[1][i]=2*N+i;
            ans[2][i]=M+2*(N+i);
        }
        for(int i=0;i<N-M;i++){
            ans[0][M+i]=2*M+i;
            ans[1][M+i]=N+M+i;
            ans[2][M+i]=M+1+2*(N+i);
        }

        ll X=M-K;
        for(int i=0;i<N;i++){
            cout<<ans[0][i]-X<<' '<<ans[1][i]-X<<' '<<ans[2][i]-X<<endl;
        }
        
    }
}

Measured memory_bytes: 3456
<?php

// Your code here!
// 標準入力（STDIN）から1行読み込み（fgets）をしてinputに代入します
$input = fgets(STDIN);  // $input = "1 2 3 4 5"

// 取得した値を半角スペースで分解します（PHPのsplit的な関数） とりあえずこれで十分扱えます!
$input_array = explode(" ", $input); // $input_array = [ "1" , "2" , "3" , "4" , "5"]

$D = $input_array[0];
$T = $input_array[1];
$S = $input_array[2];

if($D <= $T * $S){
    echo 'Yes';
}else{
    echo 'No';
}


?>

Measured memory_bytes: 16140
import std;

alias sread = () => readln.chomp();
alias lread = () => readln.chomp.to!long();
alias aryread(T = long) = () => readln.split.to!(T[]);

void main()
{
    auto n = lread();
    auto x = new long[](10 ^^ 6 + 10);
    foreach (i; 1 .. 101)
    {
        foreach (j; 1 .. 101)
        {
            foreach (k; 1 .. 101)
            {
                long tmp = 0;
                tmp = i ^^ 2 + j ^^ 2 + k ^^ 2 + i * j + j * k + i * k;
                if (tmp <= 10 ^^ 4)
                {
                    x[tmp - 1] += 1;
                }
            }
        }
    }
    foreach (i; 0 .. n)
    {
        writeln(x[i]);
    }
}

void scan(L...)(ref L A)
{
    auto l = readln.split;
    foreach (i, T; L)
    {
        A[i] = l[i].to!T;
    }
}


Measured memory_bytes: 11304
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws IOException {
		// s, tを取得
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		String s_t = in.readLine();

		// 半角スペースで区切られたs, tを取得
		int spaceIndex = s_t.indexOf(" ");
		String s = s_t.substring(0, spaceIndex);
		String t = s_t.substring(spaceIndex + 1);

		// T, S の順に空白を空けずに連結して標準出力
		System.out.println(t + s);

	}

}


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

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

ll lcm(ll a, ll b)
{
  ll g = gcd(a, b);
  return (a / g) * b;
}

int main()
{
  int n;
  cin >> n;
  ll t, ans = 1LL;
  for (int i = 0; i < n; i++)
  {
    cin >> t;
    ans = lcm(ans, t);
  }

  cout << ans << endl;
}


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

namespace AtCorder
{
	public class Program
	{
		static void Main(string[] args)
		{
			var cin = new Scanner();
			int n = cin.Int();
			int k = cin.Int();
			var ms = new List<long>();
			var ps = new List<long>();
			for (int i = 0; i < n; i++) {
				long value = cin.Long();
				if (value == 0) {
					--k;
				} else if (value > 0) {
					ps.Add(value);
				} else {
					ms.Add(value);
				}
			}

			if (k <= 0) {
				Console.WriteLine(0);
				return;
			}

			long ans = 0;
			if (ms.Count == 0) {
				long[] pss = ps.OrderBy(x => x).ToArray();
				ans = pss[k - 1];
			} else if (ps.Count == 0) {
				long[] mss = ms.Select(x => Math.Abs(x)).OrderBy(x => x).ToArray();
				ans = mss[k - 1];
			} else {
				long[] mss = ms.Select(x => Math.Abs(x)).OrderBy(x => x).ToArray();
				long[] pss = ps.OrderBy(x => x).ToArray();

				int mn = mss.Length;
				int pn = pss.Length;

				long min = (mss[mn - 1] + pss[pn - 1]) * 2;
				for (int i = 0; i < mn; i++) {
					int remain = k - i - 1;
					if (remain > 0 && remain <= pn) {
						long temp = mss[i] * 2 + pss[remain - 1];
						min = Math.Min(temp, min);
					}
				}

				for (int i = 0; i < pn; i++) {
					int remain = k - i - 1;
					if (remain > 0 && remain <= mn) {
						long temp = pss[i] * 2 + mss[remain - 1];
						min = Math.Min(temp, min);
					}
				}

				if (pn >= k) {
					long temp = pss[k - 1];
					min = Math.Min(temp, min);
				}

				if (mn >= k) {
					long temp = mss[k - 1];
					min = Math.Min(temp, min);
				}

				ans = min;
			}

			Console.WriteLine(ans);
		}
	}

	public class Scanner
	{
		private readonly char[] delimiter_ = new char[] { ' ' };
		private string[] buf_;
		private int index_;

		public Scanner()
		{
			buf_ = new string[0];
			index_ = 0;
		}

		public string Next()
		{
			if (index_ < buf_.Length) {
				return buf_[index_++];
			}

			string st = Console.ReadLine();
			while (st == "") {
				st = Console.ReadLine();
			}

			buf_ = st.Split(delimiter_, StringSplitOptions.RemoveEmptyEntries);
			if (buf_.Length == 0) {
				return Next();
			}

			index_ = 0;
			return buf_[index_++];
		}

		public int Int() => int.Parse(Next());
		public long Long() => long.Parse(Next());
		public double Double() => double.Parse(Next());

		public int[] ArrayInt(int N, int add = 0)
		{
			int[] Array = new int[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Int() + add;
			}
			return Array;
		}

		public long[] ArrayLong(int N, long add = 0)
		{
			long[] Array = new long[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Long() + add;
			}
			return Array;
		}

		public double[] ArrayDouble(int N, double add = 0)
		{
			double[] Array = new double[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Double() + add;
			}
			return Array;
		}
	}
}

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

long long int answ(long long int x){
  if(x==1) return 1;
  if(x>1) return 2*answ(x/2)+1;
}
int main() {
    long long int n;
    cin>>n;
    vector<int> a(n+1);
    vector<int> ans(n+1);
    for(int i=1;i<n+1;i++) cin>>a[i];
    for(int i=1;i<n+1;i++){
        ans[a[i]]++;
    }
    
    for(int i=1;i<n+1;i++) cout<<ans[i]<<endl;

}

Measured memory_bytes: 4844
#include<iostream>
#include <iomanip>
using namespace std;
int main()
{
	int n, i, a = 0;
	cin >> n;
	for (i = 1; i <= n; i++) {
		if (i % 2 != 0)
			a = a + 1;
	}float b;
	b = float(a) / float(n);
	cout << fixed << showpoint;
	cout << setprecision(10);
	cout << b;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
        using namespace std;
   #define int long long
const int MAX = 510000;
const int MOD = 998244353;


     signed main(){
         cout << std::fixed << std::setprecision(15);
int T;
cin>>T;
for(int t=0;t<T;t++){
     int n;
     cin>>n;
     int a[n];
     string s;
     for(int i=0;i<n;i++)cin>>a[i];
     cin>>s;
     int ans=0;
     for(int i=n-1;i>=0;i--){
          if(s[i]=='1'){
               vector<int> v;
               int w[61]={};
               for(int j=n-1;j>i;j--)if(s[j]=='0'){
                    v.push_back(a[j]);
               }
               
               if(v.empty()){
                    ans=1;
                    break;
               }
               for(int j=60;j>=0;j--){
                    for(int k=0;k<v.size();k++){
                         if((1ll<<j)&v[k]){
                              swap(v[k],v[v.size()-1]);
                              break;
                         }
                    }
                    if((1ll<<j)&v[v.size()-1]){
                         for(int k=0;k<v.size()-1;k++)if((1ll<<j)&v[k])v[k]^=v[v.size()-1];
                         w[j]=v[v.size()-1];
                         v.pop_back();
                    }
                    if(v.empty())break;
               }
               //cerr<<v.size()<<' ';
               int ans2=0;
               for(int j=60;j>=0;j--){
                    if((ans2^a[i])&(1ll<<j)){
                         ans2^=w[j];
                    }
                    if((ans2^a[i])&(1ll<<j)){
                         ans=1;
                         break;
                    }
               }
             
          }
            if(ans==1)break;
     }
     cout<<ans<<endl;
}

 }

 


 






    





      

        


Measured memory_bytes: 3584
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <cmath>
#include <algorithm>
#include <utility>
#include <functional>
#define debug(x) cout << #x << " = " << x << endl
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,n) for(int i = 0; i < (n); i++)
#define repr(i,n) for(int i = (n); i > -1; i--)
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const double EPS = 1e-9;

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

  int d,n;
  cin>>d>>n;
  int cnt = 0;
  rep(i, 10000000) {
    if(i % (int)pow(100, d) == 0 && i % (int)pow(100, d + 1) != 0) {
      cnt++;
    }
    if(cnt == n) {
      cout << i << endl;
      return 0;
    }
  }

  return 0;
}


Measured memory_bytes: 256
N = int(input())
num = [int(i) for i in input().split()]
ans = num[0]*2-sum(num)
ans_true = abs(ans)
for i in range(1, N-1):
    ans += num[i]*2
    if abs(ans) < ans_true:
        ans_true = abs(ans)
print(ans_true)



Measured memory_bytes: 24832
package main

import "fmt"

func main() {
	var a, b, k int
	fmt.Scan(&a, &b, &k)

	if k <= a {
		fmt.Println(a-k, b)
	} else {
		fmt.Println(0, max(a+b-k, 0))
	}
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
  int i,j,a[5],ans=0,min=10;
 for(i=0;i<5;i++){
	cin>>a[i];
   if(a[i]%10!=0){
     ans+=((a[i]/10)+1)*10;
     if(a[i]%10<min){
       min=a[i]%10;
     }
   }else{
	ans+=(a[i]/10)*10;
   }
 }
  
  
  cout<<ans-10+min<<endl;
  
  
	
}
    

    


Measured memory_bytes: 256
import numpy as np
 
L=np.array(list(map(int,input().split())))
ans=0
 
while True:
    if L[0]==L[1] and L[1]==L[2]:
        break
    L=sorted(L-max(L))
    if L[1]<L[2]:
        L[0]+=1
        L[1]+=1
        ans+=1
    else:
        L[0]+=2
        ans+=1

print(ans)

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

int main() {
  int n;
  cin>>n;
  vector<string> a(n);
  for (int i=0;i<n;++i) {
    cin>>a[i];
    sort(a[i].begin(), a[i].end());
  }
  sort(a.begin(), a.end());
  vector<int> cut;
  for (int i=0;i<(n-1);++i) {
    if (a[i]!=a[i+1]) {
      cut.push_back(i);
    }
  }
  cut.push_back(n-1);
  int len=cut.size();
  long long int ans=0;
  long long int q=cut[0]+1;
  ans+=(q*(q-1)/2);
  for (int j=0;j<(len-1);++j) {
    long long int q=cut[j+1]-cut[j];
    ans+=(q*(q-1)/2);
  }  
  cout<<ans<<endl;
}



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

int main() {
    int H, W;
    while (true) {
        cin >> H >> W;
        if (H == 0 && W == 0) break;
        for (int i = 0; i < H; i++) {
            for (int j = 0; j < W; j++) {
                if (i == 0 || i == H - 1 || j == 0 || j == W - 1) {
                    cout << '#';
                } else {
                    cout << '.';
                }
            }
            cout << endl;
        }
        cout << endl;
    }
}

Measured memory_bytes: 1152
import numpy as np
n,m,c = list(map(int, input().split()))
b = np.array(list(map(int, input().split())))
a = np.array([list(map(int, input().split())) for _ in range(n)])
res = a * b
cnt = 0
for prog in res:
  if(sum(prog) + c > 0):
    cnt +=1
print(cnt)

Measured memory_bytes: 12424