akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <string>

using namespace std;

int main(){

  vector<int> S(13,0);
  vector<int> H(13,0);
  vector<int> C(13,0);
  vector<int> D(13,0);

  int n;
  cin >> n;

  for(int i = 0; i < n; i++){
    int m;
    string s;
    cin >> s >> m;
    if(s == "S") S[m - 1] = m;
    if(s == "H") H[m - 1] = m;
    if(s == "C") C[m - 1] = m;
    if(s == "D") D[m - 1] = m;
  }

  for(int i = 0; i < 13; i++){
    if(S[i] == 0){
      cout << "S" << " " << i + 1 << endl;
    }
  }

  for(int i = 0; i < 13; i++){
    if(H[i] == 0){
      cout << "H" << " " << i + 1 << endl;
    }
  }

  for(int i = 0; i < 13; i++){
    if(C[i] == 0){
      cout << "C" << " " << i + 1 << endl;
    }
  }

  for(int i = 0; i < 13; i++){
    if(D[i] == 0){
      cout << "D" << " " << i + 1 << endl;
    }
  }
}
//  int n, m;
//  string s;
//  int cards[4][13];
//  cin >> n;
//  for(int i = 0; i < n; i++){
//    cin >> s >> m;
//    if(s == "S") cards[0][m-1] = 1;
//    else if(s == "H") cards[1][m-1] = 1;
//    else if(s == "C") cards[2][m-1] = 1;
//    else if(s == "D") cards[3][m-1] = 1;
//  }
//
//  cout << cards[0][11];
//
//  for(int j = 0; j < 4; j++){
//    for(int k = 0; k < 13; k++){
//      if(cards[j][k] == 0 && j == 0) cout << "S "<< k + 1;
//      else if(cards[j][k] == 0 && j == 1) cout << "H " << k + 1;
//      else if(cards[j][k] == 0 && j == 2) cout << "C " << k + 1;
//      else if(cards[j][k] == 0 && j == 3) cout << "D " << k + 1;
//    }
//  }
//
//  cout << endl;



Measured memory_bytes: 3140
#include<iostream>
#include<string>
#include<cmath>
//#include<array>
#include<algorithm>
//#include<deque>
#include<vector>
//#include<utility>
#include<set>
//#include<map>
//#include<list>

using namespace std;
using LLI = long long int;
vector<int>dir_x = {0,0,1,1,1,-1,-1,-1};
vector<int>dir_y = {1,-1,1,0,-1,1,0,-1};
vector<int>dir_x2 = {0,0,1,-1};
vector<int>dir_y2 = {1,-1,0,0};

//class UnionFind {
//public:
//	vector<int>data;
//	UnionFind(int size) :data(size, -1) {};
//	bool unionset(int x, int y) {
//		x = root(x), y = root(y);
//		if (x != y) {
//			if (data[y] < data[x]) {
//				swap(x, y);
//			}
//			data[x] += data[y];
//			data[y] = x;
//		}
//		return x != y;
//	}
//	bool findset(int x, int y) {
//		return root(x) == root(y);
//	}
//	int root(int x) {
//		return data[x] < 0 ? x : data[x] = root(data[x]);
//	}
//	int size(int x) {
//		return -data[root(x)];
//	}
//};

LLI gcd(LLI x, LLI y) {
	LLI tmp, r;
	if (x < y) {
		tmp = x;
		x = y;
		y = tmp;
	}
	r = x % y;
	while (r != 0) {
		x = y;
		y = r;
		r = x % y;
	}
	return y;
}
LLI lcm(LLI x,LLI y) {
	return x / gcd(x,y) * y;
}

//vector<vector<int>>sub;
//int dfs(int id) {
//	if (sub[id].size() == 0) {
//		return 1;
//	}
//	int minP = (int)1e9;
//	int maxP = 0;
//	for (int i : sub[id]) {
//		int P = dfs(i);
//		minP = min(minP, P);
//		maxP = max(maxP, P);
//	}
//	return minP + maxP + 1;
//}

//const int n_max = 8;
//array<array<bool, n_max>, n_max>graph;
//int dfs(int v,int N,array<bool,n_max>visited) {
//	int ret = 0;
//	bool all_visited = true;
//	for (int i = 0; i < N;i++) {
//		if (visited[i] == false) {
//			all_visited = false;
//		}
//	}	
//	if (all_visited) {
//		return 1;
//	}
//	for (int i = 0; i < N;i++) {
//		if (graph[v][i] == false) {
//			continue;
//		}
//		if (visited[i] == true) {
//			continue;
//		}
//		visited[i] = true;
//		ret += dfs(i,N,visited);
//		visited[i] = false;
//	}
//	return ret;
//}

//long nCr(int n,int r) {
//	long ans = 1;
//	for (int i = n; i > n - r;i--) {
//		ans = ans * i;
//	}
//	for (int i = 1; i < r + 1;i++) {
//		ans = ans / i;
//	}
//	return ans;
//}

int main(void) {
	LLI N,res = 1,T;
	cin >> N;
	for (int i = 0; i < N;i++) {
		cin >> T;
		res = lcm(res,T);
	}
	cout << res << endl;
}

Measured memory_bytes: 256
/*
 
*/ 
// #pragma GCC optimize("Ofast")
// #pragma GCC target("avx,avx2,fma")
#include <iostream>
#include <iomanip>
#include <sstream>
#include <fstream>
#include <string>
#include <cstring>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <queue>
#include <stack>
#include <deque>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <utility>
 
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
 
#define LSOne(S) (S & (-S))
#define EPS 1e-9
 
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pd;
typedef tree<pi, null_type, less<pi>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

int main()
{
    std::ios::sync_with_stdio(false);
    cin.tie(0); // FOR QUERY PROBLEM DON'T FORGET TO UNCOMMENT THIS
    int n, x, t;
    cin >> n >> x >> t;
    int d = n/x;
    if(x * d < n) ++d;
    cout << (d*t) << "\n";
    return 0;
}
 
/*
 
*/  

Measured memory_bytes: 3688
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <math.h>
#define MOD 1000000007
typedef long long ll;
using namespace std;
int INF=1000000;
int n,m;

int main(){
  cin>>n>>m;
  int w[n+1][n+1];
  int r[n+1][n+1];
  for(int i=1;i<=n;i++){
    for(int j=1;j<=n;j++){
    w[i][j]=INF;
    r[i][j]=INF;
  }
}
  for(int i=1;i<=m;i++){
    int a,b,c;
    cin>>a>>b>>c;
    w[a][b]=c;
    w[b][a]=c;
    r[a][b]=c;
    r[b][a]=c;
  }

  for(int k=1;k<=n;k++){
    for(int i=1;i<=n;i++){
      for(int j=1;j<=n;j++){
        if(w[i][j]>w[i][k]+w[k][j]) w[i][j]=w[i][k]+w[k][j];
      }
    }
  }

  int ans=0;
  for(int i=1;i<=n;i++){
    for(int j=1;j<=n;j++){
      if(r[i][j]==INF) continue;
      if(r[i][j]>w[i][j]) ans++;
    }
  }
  cout<<ans/2<<endl;
  return 0;
}


Measured memory_bytes: 384
int main(){
  int a, b, c;
  int shoji, result;
  scanf("%d%d%d", &a, &b, &c);

  shoji = a + b;
  result = c - shoji;

  /* Yes (if reslut is negative) */
  if (result <= 0){
      printf("Yes");
  } else {
      printf("No");
  }

  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
//----***やべーやつら***----
using namespace std;
#define int long long

//----***型定義***----
using ll = long long;
using P = pair<int,int>;

//----***Like a Pythonista***----
#define REP(ii,jj,nn) for (ll ii=jj;ii<(nn);ii++)
#define RREP(ii,nn,jj) for (ll ii = nn; jj<ii;ii--)
#define each(i,...) for (auto&& i:__VA_ARGS__)
#define ALL(vec) (vec).begin(),(vec).end()
#define sum(...) accumulate(ALL(__VA_ARGS__),0LL)
#define dsum(...) accumulate(ALL(__VA_ARGS__),0.0)
#define vec(type,name,...) vector<type> name(__VA_ARGS__)
template<class T> inline auto max(const T& a){ return *max_element(ALL(a)); }
template<class T> inline auto min(const T& a){ return *min_element(ALL(a)); }
inline ll gcd(ll a,ll b){if(b == 0) return a;return  gcd(b,a%b);}
inline ll lcm(ll a,ll b){ll g = gcd(a,b);return a / g * b;}

//----***定数***----
#define MOD 1000000007
#define INF 100000000000000000
#define EPS 1e-9
const vector<vector<int>> DXY={{-1,0},{1,0},{0,-1},{0,1}};

//----***パーツ***----
#define fr first
#define se second
#define pb push_back

//----***入出力***---
#define print(out) cout<< out  << "\n";
#define debug(var)  do{std::cerr << #var << " ↓ "<<"\n";view(var);}while(0);
#define dbg cerr<<"🥺🥺🥺🥺🥺🥺"<<endl;
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }

//----***初期時読み込み***----
struct initial{initial(){cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(15);};}initial_;

signed main(){
  int N,a;cin>>N;
  vector<int> array(N,INF);
  REP(i,0,N){
    cin>>a;
    *lower_bound(ALL(array),a)=a;
  }
  int ans =lower_bound(ALL(array),INF)-array.begin();
  print(ans)

  

}



Measured memory_bytes: 3644
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std;
using ll = long long;
using ld = long double;
#define endl "\n"
//#define int long long
#define ALL(x) begin(x),end(x)
#define resort(v) sort((v).rbegin(), (v).rend())
#define _CRT_SECURE_NO_WARNINGS
#define rep(i, n) for (int i = 0; i < n; i++)
#define _GLIBCXX_DEBUG
const int MOD = 1e9 + 7;
//const int INF = 1e18 + 9;
constexpr long double pi = 3.141592653589793238462643383279;
int fact(int i) {
    if (i == 0) return 1;
    return ((fact(i - 1)) * i) % MOD;
}
int gcd(int a, int b) {
    if (b == 0) return a;
    return gcd(b, a % b);
}
int lcm(int a, int b) {
    return a * b / gcd(a, b);
}
int keta(int n) {
    if (n == 0) return 1;
    int count = 0;
    while (n != 0) {
        n /= 10;
        count++;
    }
    return count;
}
int ketasum(int n) {
    int sum = 0;
    while (n != 0) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}
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;
}
char toSmall(char c) { // 大文字を小文字へ
    return (c + 0x20);
}
char toLarge(char c) { // 小文字を大文字へ
    return (c - 0x20);
}
float myPower(int a, int n) { // aのn乗の計算
    float x = 1;
    while (n > 0) { // 全てのbitが捨てられるまで
        if (n & 1) { // 一番右のbitが１のとき
            x *= a;
        }
        a *= a;
        n >>= 1; // bit全体を右に1つシフトして一番右を捨てる
    }
    return x;
}
bool is_prime(const unsigned n) {
    switch (n) {
    case 0: // fall-through
    case 1: return false;
    case 2: // fall-through
    case 3: return true;
    } // n > 3 が保証された
    if (n % 2 == 0 || n % 3 == 0) return false;
    // n は 2 と 3 のいずれの倍数でもないことが保証された
    // これより n は (6の倍数)-1 か (6の倍数)+1 である
    // 6の倍数前後の数を使って試し割りをする
    for (unsigned i = 5; i * i <= n; i += 6) {
        if (n % i == 0) return false; // (6の倍数)-1
        if (n % (i + 2) == 0) return false; // (6の倍数)+1
    }
    return true;
}

/*signed*/int main(void) {
    int a[33] = { 1,1,1,2,1,2,1,5,2,2,1,5,1,2,1,14,1,5,1,5,2,2,1,15,2,2,5,4,1,4,1,51 };
    int k;
    cin >> k;
    cout << a[k - 1] << endl;
}

Measured memory_bytes: 3616
#include <iostream>

using namespace std;

int main(void) {
	int S;
	cin >> S;
	int h = S/(60*60);
	S -= h*(60*60);
	int m = S/60;
	S -= m*60;
	cout << h << ":";
	cout << m << ":";
	cout << S << endl;
	return 0;
}



Measured memory_bytes: 3104
#include <bits/stdc++.h>
using namespace std;
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
#define REP(i,n) for(ll i=0;i<n;i++)
#define FOR(i,n1,n2) for(ll i=n1;i<n2;i++)
#define bFOR(i,n1,n2) for(ll i=n1;i>=n2;i--)
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

typedef long long int ll;
typedef pair<ll,ll> Pi;
typedef tuple<ll,ll,ll> Tu;
const int INF=(ll)(1LL<<30)-1;
const double INFd=100000000000.0;
const double PI=3.14151926535;
const ll INFl=(ll)9223372036854775807/2;
const int MAX=10000;
const ll MOD=(ll)1e9+7;
const ll tMOD=(ll)998244353;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a, b)*b;}
int dx[4]={0,-1,0,1},dy[4]={-1,0,1,0};
int mdx[8]={0,1,0,-1,1,1,-1,-1},mdy[8]={-1,0,1,0,1,-1,1,-1};


template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

int n,m;
string s;
stack<int> s1;
int main(){
	cin>>n>>m>>s;
	int now=n;
	while(now!=0){
		for(int t=m;t>=0;t--){
			if(now-t<=0){
				s1.push(now);
				goto A;
			}
			if(t==0){
				cout<<-1<<endl;
				return 0;
			}
			if(s[now-t]=='1')continue;
			now-=t;
			s1.push(t);
			break;
		}
	}
	A:;
	while(s1.size()){
		cout<<s1.top()<<" ";
		s1.pop();
	}
	cout<<endl;
}

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

vector<ll> par(1e5 + 5, -1);
vector<vector<ll>> friends(1e5 + 5, vector<ll>());
vector<vector<ll>> blocks(1e5 + 5, vector<ll>());

ll root(ll x) {
  if (par[x] == x) {
    return x;
  } else {
    return par[x] = root(par[x]);
  }
}

bool same(ll x, ll y) {
  return root(x) == root(y);
}

void unite(ll x, ll y) {
  x = root(x);
  y = root(y);
  if (x == y) return;
  par[x] = y;
}

int main() {
  ll n, m, k;
  cin >> n >> m >> k;

  for (ll i = 0; i < n; i++) {
    par[i] = i;
  }

  ll a, b;
  for (ll i = 0; i < m; i++) {
    cin >> a >> b;
    a--; b--;
    unite(a, b);
    friends[a].push_back(b);
    friends[b].push_back(a);
  }

  ll c, d;
  for (ll i = 0; i < k; i++) {
    cin >> c >> d;
    c--; d--;
    blocks[c].push_back(d);
    blocks[d].push_back(c);
  }

  map<ll, ll> total;
  for (ll i = 0; i < n; i++) {
    total[root(i)]++;
  }

  for (ll i = 0; i < n; i++) {
    ll ans = total[root(i)] - 1;
    ans -= friends[i].size();
    for (auto b : blocks[i]) {
      if (root(b) == root(i)) ans--;
    }
    cout << ans << " ";
  }
  cout << endl;
}


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

#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define endl '\n'

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, int> pdi;

const ll INF = 1e18;
const int MAXN = 2e5 + 5;
const int MOD = 20200429;

int N, C, K, dp[MAXN], cnt[MAXN], D[MAXN], chk[MAXN];
char A[MAXN];

set<int> V[MAXN];

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

	cin >> N >> K >> C;
	cin >> A+1;

	int st;
	for(st=1; st<=N; st++) {
		if(A[st] == 'o') break;
	}
	dp[st] = 1; V[1].insert(st);
	for(int i=st+1; i<=N; i++) {
		dp[i] = dp[i-1];
		if(A[i] == 'o') {
			if(i-C-1 > 0 && dp[i-C-1]+1 >= dp[i]) dp[i] = dp[i-C-1]+1;
			V[dp[i]].insert(i);
		}
	}

	if(dp[N] != K) return 0;

	for(int i=dp[N]-1; i>=1; i--) {
		int r = (*V[i+1].rbegin()) - C - 1;
		auto it = V[i].upper_bound(r);
		while(it != V[i].end()) V[i].erase(it++);
	}

	for(int i=1; i<=dp[N]; i++) {
		if(V[i].size() == 1) cout << *V[i].begin() << endl;
	}
}

Measured memory_bytes: 23552
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;
ll strtoint(string str);
int main(){
	fast;
	ll n,k,d;
	cin>>n>>k;
	set<ll> ss;
	while(k--){
		cin>>d;
		while(d--){
			ll tmp;
			cin>>tmp;
			ss.insert(tmp);
		}
	}
	cout<<n-ss.size()<<'\n';
	return 0;
}
ll strtoint(string str){
	ll x=0;
	stringstream ss;
	ss<<str;
	ss>>x;
	return x;
}

Measured memory_bytes: 3652
//

fun main() {
    abc174d()
}

fun abc174d() {
    val n = readLine()!!.toInt()
    val s = readLine()!!
    var count = 0
    var leftWhite = 0
    var rightRed = s.count { it == 'R' }
    var i = 0
    if (rightRed == 0) {
        println(0)
        return
    }
    while (i < n) {
        if (s[i] == 'W') {
            leftWhite ++
        } else {
            rightRed--
        }
        if (leftWhite > 0 && rightRed > 0) {
            leftWhite--
            rightRed--
            count++
        } else if (leftWhite > 0) {
            leftWhite--
            count++
        }
        i++
        if (leftWhite + rightRed == 0) break
    }
    println(count)
}


Measured memory_bytes: 38460
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#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 < int(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
const long long INFLL = 1LL << 60;
const int INFINT = 1 << 30;
const long long MOD = 1e9 + 7;

template <class T> void vecout(T V) {
    auto t = V.begin();
    while(t != V.end()) {
        cout << *t++;
        if(t != V.end()) cout << " ";
    }
    cout << endl;
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, q, a, b, c;
    cin >> n >> q;
    vector<int> v[n];
    rep(i, q) {
        cin >> a >> b;
        if(a == 0) {
            cin >> c;
            v[b].push_back(c);
        } else if(a == 1) {
            vecout(v[b]);
        } else {
            // if(v[b].size() > 0)
            v[b].clear();
        }
    }
}



Measured memory_bytes: 6848
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int ll
inline ll read(){
	ll res=0,f=1;
	char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-f;ch=getchar();}
	while(ch>='0'&&ch<='9'){res=(res<<3)+(res<<1)+ch-'0';ch=getchar();}
	return res*f;
}
void write(ll x){
	if(x<0) putchar('-'),x=-x;
	if(x>9) write(x/10);
	putchar(x%10|'0');
}


signed main(){
	int n=read();
	double ans=0;
	if(n%2==1) ans=(double)(n/2+1)/n;
	else ans=0.5;
	printf("%.6lf",ans);
}


Measured memory_bytes: 256
#pragma region header
#include <bits/stdc++.h>
#define int long long
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
#define rev(i, n) for(int i = (int)(n - 1); i >= 0; i--)
#define rev1(i, n) for(int i = (int)(n); i > 0; i--)
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define resort(v) sort((v).rbegin(), (v).rend())
#define vi vector<int>
#define vvi vector<vector<int>>
#define vc vector<char>
#define vvc vector<vector<char>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
using ll = long long;
using P = pair<int, int>;
/* ----------------よく使う数字や配列----------------- */
int dx[] = {1,0,-1,0};
int dy[] = {0,1,0,-1};
constexpr ll mod = 1e9+7;
constexpr int inf = INT32_MAX/2;
constexpr ll INF = LLONG_MAX/2;
constexpr long double eps = DBL_EPSILON;
constexpr long double pi = 3.141592653589793238462643383279;
/* ----------------------end----------------------- */

/* --------------------テンプレート------------------ */
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;
}
/* ----------------------end----------------------- */

/* --------------------ライブラリ-------------------- */
ll fact(int i) {       //階乗
    if (i == 0) return 1;
    return (fact(i - 1)) * i % mod;
}
ll gcd(ll a, ll b) {        //最大公約数
    if(b == 0) return a;
    return gcd(b, a % b); 
}
ll lcm(ll a, ll b) {      //最小公倍数
    return a * b / gcd(a, b);
}
int keta(ll n) {        //桁数を求める
    if(n == 0) return 1;
    int count = 0;
    while(n != 0) {
        n /= 10;
        count++;
    }
    return count;
}
ll ketasum(ll n) {    //各桁の和
    ll sum = 0;
    while(n != 0) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}
/* ----------------------end----------------------- */
#pragma endregion
signed main() {
    int a,v;cin >> a >> v;
    int b,w;cin >> b >> w;
    int t;cin >> t;
    int s = v-w;
    if(abs(a-b)<=s*t) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}

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

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

        int N = sc.nextInt();
        int M = sc.nextInt();
        int[] A = new int[M];
        for (int i = 0; i < A.length; ++i) {
            A[i] = sc.nextInt();
        }

        System.out.println(solve(N, A));

        sc.close();
    }

    static int solve(int N, int[] A) {
        int total = Arrays.stream(A).sum();

        return (total <= N) ? (N - total) : -1;
    }
}

Measured memory_bytes: 46508
import java.io.*;
import java.util.*;

public class Main{
    public static void main(String[] args)throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));     
        String str;

        int[] num = new int[26];
        
        while((str = br.readLine()) !=null){
            for(int i=0;i<str.length();i++){
                char cc = str.charAt(i);
                cc = Character.toLowerCase(cc);
                //System.out.println(cc);
                char x = 'a';
                for(int j=0;j<26;j++){
                    if( x == cc){
                        num[j] +=1;
                    }
                    x++;
                }
            }
        }
        
        char x = 'a';
        for(int i=0;i<26;i++){
            System.out.println(x + " : " + num[i]);
            x++;
        }                    
    }
}

Measured memory_bytes: 24308
/*
TEMPLATE
by.YXH_XianYu
   2018.7.21
*/
#include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdio>
#include<cmath>
#define LLI long long
#define DBL double
#define CHR char
#define BOL bool
#define REG register
#define rep(i, j, k) for(int i = j, lim = k; i <= lim; i++)
#define req(i, j, k) for(int i = j, lim = k; i >= lim; i--)
#define MXN 105

int a[4];

int main() {
	//freopen("TEMPLATE.in", "r", stdin);
	//freopen("TEMPLATE.out", "w", stdout);
	
	scanf("%d %d %d", &a[1], &a[2], &a[3]);
	std::sort(a+1, a+4);
	int ans = abs(a[1]-a[2]) + abs(a[2]-a[3]);
	printf("%d\n", ans);
	


	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <numeric>
#include <functional>
using namespace std;

#define Rep(b, e, i) for(int i = b; i <= e; i++)
#define Repr(e, b, i) for(int i = e; i >= b; i--)
#define rep(n, i) Rep(0, n-1, i)
#define repr(n, i) Repr(n-1, 0, i)
#define all(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
#define uniq(x) (x).erase(unique(all(x)),(x).end())

typedef long long ll;
typedef pair<ll, ll> llP;
typedef pair<int, int> intP;
typedef std::priority_queue<int> IntPrioQueue; //Z->A
typedef std::priority_queue<int, std::vector<int>, std::greater<int> > IntReversePrioQueue; //A->Z

int n[3];
void solve(void){
    rep(3, i) cin >> n[i];
    sort(n, n+3);
    n[2] -= n[0]; n[1] -= n[0];
    n[0] = 0;
    int ans = 0;
    if (n[1]%2!=0) {
        n[1]--; ans++;
    }
    if (n[2]%2!=0) {
        n[2]--; ans++;
    }
    ans += (n[2]-n[1])/2 + (n[2]-n[0])/2;
    cout << ans << '\n';
}

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


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
????????????????????????????????? ??§?????§  
??????????????? ??§?????§ ???????´<_??? ?????? Welcome to My Coding Space!
???????????? ??? ?´_???`??????/??? ???i     
?????????????????????????????? ???  |???|     
????????? /?????? /??£??£??£??£/??????|  
??? ???_(__??????/???    ???/ .| .|????????????  
??? ????????????/????????????/??????u??????  
---------------------------------------------------------------------------------------------------*/





typedef long long ll;
int N, D, T[101010], F[101010];
//--------------------------------------------------------------------------------------------------
void _main() {
    cin >> N >> D;
    rep(i, 0, N) cin >> T[i] >> F[i];

    ll ans = 0;
    int t = 0, f = 1, h = 0;
    rep(i, 0, N) {
        int d = abs(f - F[i]);
        int dd = f - 1 + F[i] - 1;

        if (t + dd <= T[i]) {
            ans += 1LL * (f - 1) * h;
            t = T[i];
            f = F[i];
            h = 1;
            continue;
        }

        if (t + d <= T[i]) {
            ans += 1LL * (T[i] - t) * h;
            t = T[i];
            f = F[i];
            h++;
            if (D < h) {
                printf("-1\n");
                return;
            }
            continue;
        }

        printf("-1\n");
        return;
    }
    ans += 1LL * (f - 1) * h;
    cout << ans << endl;
}

Measured memory_bytes: 3952
n, a, b = map(int, input().split())

ans = 0
cnt = 0
for i in range(a, n+1):
    res = 0
    num = i
    while num > 0:
        res += num % 10
        num //= 10

    if res >= a and res <= b:
        ans += i

print(ans)

Measured memory_bytes: 9032
N,K = map(int, input().split())
A = [int(a) for a in input().split()]

S = [0]*(N+1)
for i in range(N):
    S[i+1] = (S[i] + A[i]) % K
    
for i in range(N+1):
    S[i] = (S[i] - i) % K
    
dic = {}
for i in range(min(K, N+1)):
    if S[i] in dic:
        dic[S[i]] += 1
    else:
        dic[S[i]] = 1
        

ans = 0
for key in dic:
    ans += dic[key]*(dic[key]-1)//2
    
if K < N+1:
    for i in range(K, N+1):
        dic[S[i-K]] -= 1
        if S[i] in dic:
            ans += dic[S[i]]
            dic[S[i]] += 1
        else:
            dic[S[i]] = 1
            
print(ans)

Measured memory_bytes: 111308
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1e9+7;
int find(vector<int>& ds,int i) {
	while(ds[i]!=i) {
		i = ds[i];
	}
	return i;
}
void combine(vector<int>& ds,vector<int>& p,int u,int v) {
	int x = find(ds,u);
	int y = find(ds,v);
	if(x!=y) {
		ds[x] = min(x,y);
		ds[y] = min(x,y);
		p[min(x,y)] += p[max(x,y)];
	}
}
void solve() {
	int n,m;
	cin>>n>>m;
	vector<int> ds(n+1,0),p(n+1,0);
	for(int i=0;i<=n;i++) {
		ds[i] = i;
		p[i] = 1;
	}
	while(m--) {
		int u,v;
		cin>>u>>v;
		combine(ds,p,u,v);	
	}
	m = p[1];
	for(int i=2;i<=n;i++) {
		m = max(m,p[i]);
	}
	cout<<m;
}
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int test = 1;
	while(test--) {
		solve();
	}
}


Measured memory_bytes: 4780
#include <stdio.h>

int main()
{
    int a, b, c;
    int i, cnt;
    
    while(scanf("%d %d", &a, &b) != EOF){
        c = a + b;
        cnt = 0;
        while(c){
            c /= 10;
            cnt++;
        }
        printf("%d\n", cnt);
    }
    
    return 0;
}

Measured memory_bytes: 600
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <map>
#include <string>
#include <queue>
#include <stack>
#include <math.h>
#include <cmath>
#include <numeric>
#include <iomanip>


#define log(x) cout<<x<<endl
#define pb push_back
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
typedef long long lint;
using namespace std;


// <<fixed<<setprecision(6)<<


int gcd(lint x, lint y){
  return y==0 ? x:gcd(y,x % y);
}


int combi(int n, int r){
  int num = 1;
  for(int i = 1; i <= r; i++){
    num = num * (n - i + 1) / i;
  }
  return num;
}

int stringcount(string s, char c) {
  return count(s.cbegin(), s.cend(), c);
}

bool isPrime(int x){
  int i;
  if(x < 2)return 0;
  else if(x == 2) return 1;
  if(x%2 == 0) return 0;
  for(i = 3; i*i <= x; i += 2) if(x%i == 0) return 0;
  return 1;
}

int binary(vector<int> a,lint key) {
  lint left = 0;
  lint right = a.size();
  while(left<right){
    lint mid = (left+right)/2;
    if(a[mid] == key){
      return 1;
    }
    else if(key<a[mid]){
      right = mid;
    }
    else{
      left = mid+1;
    }
  }
  return 0;
}



int main(){
  pair<int,int> ne;
  cin>>ne.first>>ne.second;
  bool isyes=false;
  int n;
  cin>>n;
  vector<pair<int,int> > l(n+1);
  l[0]=ne;
  for(int i=1;i<=n;i++){
    int a,b;
    cin>>a>>b;
    l[i].first=a;
    l[i].second=b;
  }
  sort(all(l));
  stack<int> sta;
  for(int i=0;i<(n+1);i++){
    if(sta.empty()==true||sta.top()<=l[i].first){
      sta.push(l[i].first);
      sta.push(l[i].second);
    }
    else{
      isyes=true;
      break;
    }
  }
  if(isyes){
    cout<<"1"<<endl;
  }
  else{
    cout<<"0"<<endl;
  }
}



Measured memory_bytes: 3104
using System;

namespace AOJ.Volume3
{
    public class FishingCompetition
    {
        public static int Main()
        {
            var input = Console.ReadLine().Split(' ');
            int hiroshi_iwana = int.Parse(input[0]);
            int hiroshi_yamame = int.Parse(input[1]);

            input = Console.ReadLine().Split(' ');
            int ken_iwana = int.Parse(input[0]);
            int ken_yamame = int.Parse(input[1]);

            input = Console.ReadLine().Split(' ');
            int a = int.Parse(input[0]);
            int b = int.Parse(input[1]);
            int c = int.Parse(input[2]);
            int d = int.Parse(input[3]);

            // ?¨????
            int h = (hiroshi_iwana * a) + (hiroshi_yamame * b) + (hiroshi_iwana / 10) * c + (hiroshi_yamame / 20) * d;
            int k = (ken_iwana * a) + (ken_yamame * b) + (ken_iwana / 10) * c + (ken_yamame / 20) * d;

            if (h == k) { Console.WriteLine("even"); }
            else { Console.WriteLine(h > k ? "hiroshi" : "kenjiro"); }

            return 0;
        }
    }
}

Measured memory_bytes: 8840
from itertools import groupby

N = int(input())
H = list(map(int, input().split(" ")))

l = H
count = 0
for i in range(max(H), 0, -1):
    count += sum(key for key, _ in groupby(l, key=lambda x: x==i))
    l = [l_i-1 if l_i == i else l_i for l_i in l]
    # print(l)

print(count)

Measured memory_bytes: 3064
#include <stdio.h>

int sum1to2(int* a,int x,int y){
  int ans=0;
  for(int i=x;i<=y;i++){
    ans+=a[i];
  }
  return ans;
}
int main(){
  int N;
  scanf("%d",&N);
  int lt[N];
  int lv[N+1];
  for(int i=0;i<N;i++){
    scanf("%d",&(lt[i]));
  }
  for(int i=0;i<N;i++){
    scanf("%d",&(lv[i]));
  }
  lv[N]=0;
  double x=0;
  double v=0;
  double pv=0;
  double t;
  double dt=0.5;
  int flag=0;
  for(int i=0;i<N;i++){
    t=0;
    	if(v>lv[i]){
	  v=(double)lv[i];
	  }
    while(t<lt[i]){
      flag=0;
      pv=v;
      for(int j=i;j<N;j++){
	if(sum1to2(lt,i,j)-t<=v-lv[j+1]){
	  flag=1;
	}
      }
      if(flag==1){//残り時間で下げられる速度が下げなきゃいけない速度より小さい
	v-=1*dt;
      }else if(v<lv[i]){
	v+=1*dt;
	if(v>lv[i]){
	  v=(double)lv[i];
	  }
      }
      x+=(v+pv)/2.0*dt;
      t+=dt;
    }
  }
  printf("%f",x);
  return 0;
}


Measured memory_bytes: 128
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
	public static void main(String[] args) {
		FastScanner sc = new FastScanner(System.in);
		int n = sc.nextInt();
		int[] a = new int[n];
		int all = 0, b = 0;
		for(int i = 0; i < n; i++) {
			a[i] = sc.nextInt();
			all += Math.abs(a[i] - b);
			b = a[i];
		}
		all += Math.abs(a[n-1]);
		int be = 0;
		for(int i = 0; i < n-1; i++) {
			int now = all - (Math.abs(a[i]-be)) - (Math.abs(a[i+1]-a[i]))+Math.abs(a[i+1]-be);
			System.out.println(now);
			be = a[i];
		}
		System.out.println(all - Math.abs(a[n-1])-Math.abs(a[n-1]-a[n-2])+Math.abs(a[n-2]));
	}

	static class FastScanner {
		private BufferedReader reader = null;
	    private StringTokenizer tokenizer = null;
	    public FastScanner(InputStream in) {
	        reader = new BufferedReader(new InputStreamReader(in));
	        tokenizer = null;
	    }

	    public String next() {
	        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
	            try {
	                tokenizer = new StringTokenizer(reader.readLine());
	            } catch (IOException e) {
	                throw new RuntimeException(e);
	            }
	        }
	        return tokenizer.nextToken();
	    }

	    public String nextLine() {
	        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
	            try {
	                return reader.readLine();
	            } catch (IOException e) {
	                throw new RuntimeException(e);
	            }
	        }

	        return tokenizer.nextToken("\n");
	    }

	    public long nextLong() {
	        return Long.parseLong(next());
	    }

	    public int nextInt() {
	        return Integer.parseInt(next());
	    }

	    public double nextDouble() {
	         return Double.parseDouble(next());
	     }

	    public int[] nextIntArray(int n) {
	        int[] a = new int[n];
	        for (int i = 0; i < n; i++)
	            a[i] = nextInt();
	        return a;
	    }

	    public long[] nextLongArray(int n) {
	        long[] a = new long[n];
	        for (int i = 0; i < n; i++)
	            a[i] = nextLong();
	        return a;
	    }
	}
}


Measured memory_bytes: 55140
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <functional>

using namespace std;
typedef long long llong;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<llong, llong> pll;
typedef pair<ld, ld> pdd;

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    int n;
    int C[201] = {};
    cin >> n;
    for (int i = 1; i <= n; ++i) {
        int A;
        cin >> A;
        A += 100;
        for (int j = 0; j <= 200; ++j) {
            C[j] += (A - j) * (A - j);
        }
    }
    int ans = 1e9;
    for (int i = 0; i <= 200; ++i) ans = min(ans, C[i]);
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 256
#include <vector>
#include <iostream>
#include <string>

using namespace std;

int main()
{
  int A, B;
  cin >> A >> B;
  int ans = 0;

  if(12 < A)ans = B;
  if(6 <= A && A <= 12)ans = B / 2;
  if(A == 0)ans = 0;

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pii;
const ll inf  = 1e9+5;
typedef pair<int, bool> pib;

int main() {
  int n; cin >> n;
  int k; cin >> k;
  vector<int> heights (n);
  for (int i = 0; i < n; i++){
      cin >> heights[i];
  }
  vector<int> dp (n, inf);
  dp[0] = 0;
  for (int i = 0; i < n; i++){
        for (int j = i +1; j <= i + k; j++){
            if (j < n){
                dp[j] = min(dp [j], dp [i] + abs(heights[j] - heights[i]));
            }
        }
  }
  cout << dp[n-1];
}



Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <queue>

#include <map>
#include <set>
#include <string>
#include <algorithm>
#include <functional>
#include <iterator>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n)-1; i >= 0; i--)
#define INF 1 << 29
#define ALEN(ARR) (sizeof(ARR) / sizeof((ARR)[0]))
#define MP make_pair
#define mp make_pair
#define pb push_back
#define PB push_back

#if DEBUG
#define _DEBUG(x) cout << #x << ": " << x << endl
#define _DDEBUG(x, y) cout << #x << ": " << x << ", " << #y << ": " << y << endl
#else
#define _DEBUG(x) ;
#define _DDEBUG(x, y) ;
#endif

#define ll long long
#define ull unsigned long long
#define MOD 1000000007

/** FOR VECTOR DEBUG */
template <typename T>
ostream &operator<<(ostream &out, const vector<T> &v)
{
    if (!v.empty())
    {
        out << '[';
        copy(v.begin(), v.end(), ostream_iterator<T>(out, ", "));
        out << "\b\b]";
    }
    return out;
}

/* template end */

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

    int c, g;
    cin >> c >> g;
    int pc[c], pp[c];
    int ans = 0;
    REP(i, c)
    {
        cin >> pc[i] >> pp[i];
        ans += pc[i];
    }

    for (int j = 0; j < pow(2, c); j++)
    {
        ll tsum = 0;
        ll tans = 0;
        for (int k = 0; k < c; k++)
        {
            if ((j >> k) & 1)
            {
                tsum += ((k + 1) * 100) * pc[k] + pp[k];
                tans += pc[k];
            }
        }
        if (tsum < g)
        {
            continue;
        }

        for (int k = 0; k < c; k++)
        {
            int ttsum = tsum;
            int ttans = tans;
            if ((j >> k) & 1)
            {
                ttsum -= (((k + 1) * 100) * pc[k] + pp[k]);
                ttans -= pc[k];
            }
            for (int l = 0; l <= pc[k]; l++)
            {
                int ts = ttsum + l * ((k + 1) * 100);
                int ta = ttans + l;
                if (l == pc[k])
                {
                    ts += pp[k];
                }
                if (ts >= g)
                {
                    ans = min(ta, ans);
                    break;
                }
            }
        }
    }

#if DEBUG
    cout << "** RESULT **" << endl; // debug
#endif
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define PI 3.14159265358979323846
#define MAXINF (1e18L)
#define INF (1e9L)
#define EPS (1e-9)
#define MOD ((ll)(1e9+7))
#define REP(i, n) for(int i=0;i<int(n);++i)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define ALL(v) v.begin(),v.end()
#define FIND(v,x) (binary_search(ALL(v),(x)))
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(ALL(v));reverse(ALL(v))
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
#define YES(n) cout<<((n)?"YES":"NO")<<endl
#define pb push_back
#define fi first
#define se second
using namespace std;
template<class A>void pr(A a){cout << (a) << endl;}
template<class A,class B>void pr(A a,B b){cout << a << " "  ;pr(b);}
template<class A,class B,class C>void pr(A a,B b,C c){cout << a << " " ;pr(b,c);}
template<class A,class B,class C,class D>void pr(A a,B b,C c,D d){cout << a << " " ;pr(b,c,d);}
template<class T> void pr_vec(vector<T> &v, char ep=' '){int n=v.size();REP(ni,n){cout<<v[ni];if(ni!=n-1)cout<<ep;}cout<<endl;};
template<class T> inline bool chmin(T& a, T b){return a>b ? a=b, true : false;}
template<class T> inline bool chmax(T& a, T b){return a<b ? a=b, true : false;}
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll,ll> pll;

int main(void)
{
    long double a,b;
    cin >> a >> b;
    // ll bu = (ll)(b);
    // double bi = b-(double)bu;
    // pr((ll)((ll)a*bu+(ll)(a*bi)));
    printf("%lld\n", (ll)(a*b));
}

Measured memory_bytes: 3796
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007;
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;

ll fac[200007],finv[200007],inv[200007];
void cominit(){
    fac[0]=fac[1]=1;
    finv[0]=finv[1]=1;
    inv[1]=1;
    for(int i=2;i<200007;i++){
        fac[i]=fac[i-1]*i%mod;
        inv[i]=mod-inv[mod%i]*(mod/i)%mod;
        finv[i]=finv[i-1]*inv[i]%mod;
    }
}

vector<vector<ll> > g(200000);
ll pa[200000];
ll dpinline[200000],dpinnum[200000],dpoutnum[200000],dpoutline[200000];
void dfs1(ll now,ll p){
	pa[now]=p;
	dpinline[now]=0;
	dpinnum[now]=1;
	for(auto& to:g[now]){
		if(to==p)continue;
		dfs1(to,now);
		dpinline[now]+=dpinline[to];
		dpinnum[now]*=finv[dpinline[to]];
		dpinnum[now]%=mod;
		dpinnum[now]*=dpinnum[to];
		dpinnum[now]%=mod;
	}
	dpinnum[now]*=fac[dpinline[now]];
	dpinnum[now]%=mod;
	dpinline[now]++;
}
void dfs2(ll now,ll p){
	vector <ll> v1,v2,v3,v4;
	for(auto& to:g[now]){
		if(to==p)v1.pb(1),v2.pb(1);
		else v1.pb((dpinnum[to]*finv[dpinline[to]])%mod),v2.pb((dpinnum[to]*finv[dpinline[to]])%mod);
		if(to==p)v3.pb(0),v4.pb(0);
		else v3.pb(dpinline[to]),v4.pb(dpinline[to]);
	}
	int niko=v1.size();
	for(int i=1;i<niko;i++) v1[i]=(v1[i-1]*v1[i])%mod;
	for(int i=niko-2;i>=0;i--) v2[i]=(v2[i+1]*v2[i])%mod;
	for(int i=1;i<niko;i++) v3[i]+=v3[i-1];
	for(int i=niko-2;i>=0;i--) v4[i]+=v4[i+1];
	for(int i=0;i<g[now].size();i++){
		int to=g[now][i];
		if(to==p) continue;
		ll ret=1LL,line=0LL;
		if(i>0) ret=(ret*v1[i-1])%mod,line+=v3[i-1];
		if(i<niko-1) ret=(ret*v2[i+1])%mod,line+=v4[i+1];
		ret=(ret*dpoutnum[now])%mod;
		ret=(ret*finv[dpoutline[now]])%mod;
		line+=dpoutline[now];
		ret=(ret*fac[line])%mod;
	    line++;
	    dpoutline[to]=line;
		dpoutnum[to]=ret;
		dfs2(to,now);
	}
}

int main(){
	cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    cominit();
	ll n;
	cin>>n;
	ll a,b;
	for(int i=1;i<n;i++){
		cin>>a>>b;
		a--,b--;
		g[a].pb(b);
		g[b].pb(a);
	}

	dfs1(0,-1);
	dpoutnum[0]=1;
	dpoutline[0]=0;
	dfs2(0,-1);
	for(int i=0;i<n;i++){
		ll line=dpoutline[i];
		ll ans=(dpoutnum[i]*finv[dpoutline[i]])%mod;
		for(auto& to:g[i]){
			if(to==pa[i])continue;
			line+=dpinline[to];
			ans=(ans*dpinnum[to])%mod;
			ans=(ans*finv[dpinline[to]])%mod;
		}
		ans=(ans*fac[line])%mod;
		cout <<ans<<endl;
	}
	return 0;
}


Measured memory_bytes: 35456
#include <bits/stdc++.h>
  using namespace std;
 
int main(){
  vector<int> A(3);
  cin>>A.at(0)>>A.at(1)>>A.at(2);
  sort(A.begin(),A.end());
  reverse(A.begin(),A.end());
  cout<<A.at(0)*10+A.at(1)+A.at(2)<<endl;
}

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

int main() {

    std::vector<int> A;
    std::vector<int> B;
    std::vector<int> C;

    int X, Y, Z;

    std::cin >> X >> Y >> Z;

    A.push_back(Z);
    B.push_back(X);
    C.push_back(Y);

    std::cout << A[0] << " " << B[0] << " " << C[0] << "\n";
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>

using namespace std;

int main(){
	string n;
	string s = "CODEFESTIVAL2016";
	cin >> n; 
	int c = 0;
	for(int i =0;i<n.size();i++){
		if(s[i] != n[i])c++;
	}
	cout << c <<endl;

	return 0;
}

Measured memory_bytes: 256
main :: IO ()
main = do
    s <- getLine
    let ans = maximum . fst $ foldr (\c (i:is, b) ->
            if c == 'R' then if b then ((i+1:is), True)
                                  else ((1:i:is), True)
                        else (i:is, False))
            ([0], False) s
    print ans


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

using namespace std;
using LL = long long;
const int N = 1024;
const int INF = INT32_MAX - 1;
const double EPS = 1E-9;

int a[N];
int n, m;

int main() {
    ios_base::sync_with_stdio(false);

#ifdef CF_DEBUG
    freopen("../cf/input.txt","r",stdin);
#endif
    string s;
    cin >> s;
    if(s == "AAA" || s== "BBB"){
        cout<<"No";
    }else{
        cout<<"Yes";
    }
    return 0;
}

Measured memory_bytes: 256
N, x = map(int, input().split())
a = sorted(list(map(int, input().split())))
i = 0
while x >= a[i] and i < N - 1:
	x -= a[i]
	i += 1
if x < a[i]:
	print(i)
	exit()
if i == N - 1:
	if x == a[i]:
		print(i + 1)
	else:
		print(i)


Measured memory_bytes: 3060
//hitachi2020_c.cpp
//Sun Mar  8 20:53:12 2020

#include <iostream>
#include <string>
#include <queue>
#include <map>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <math.h>
#include <set>
#define INTINF 2147483647
#define LLINF 9223372036854775807
#define MOD 1000000007

using namespace std;
using ll=long long;
typedef pair<int,int> P;

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

	vector<int> node[n];
	for (int i=0;i<n-1;i++){
		int a,b;
		cin >> a >> b;
		a--;b--;
		node[a].push_back(b);
		node[b].push_back(a);
	}

	int height[n];
	fill(height,height+n,-1);
	height[0] = 0;
	int heighttotal[2];
	fill(heighttotal,heighttotal+2,0);
	heighttotal[0] = 1;
	queue<int> q;
	q.push(0);
	while (q.size()){
		int temp = q.front();q.pop();
		for (int i=0;i<node[temp].size();i++){
			int childcand = node[temp][i];
			if (height[childcand]==-1){
				height[childcand] = height[temp]+1;
				heighttotal[height[childcand]%2]++;
				q.push(childcand);
			}
		}
	}

	int amari0=n/3;

	int ans[n];
	fill(ans,ans+n,-1);
	int cur1 = 1;
	int cur2 = 2;
	int cur0 = 3;
	if (heighttotal[0]>amari0 && heighttotal[1]>amari0){
		for (int i=0;i<n;i++){
			if(height[i]%2==0){
				if (cur1<=n){
					ans[i]=cur1;
					cur1 = cur1+3;
				}else {
					ans[i]=cur0;
					cur0 = cur0+3;
				}
			}else {
				if (cur2<=n){
					ans[i]=cur2;
					cur2 = cur2+3;
				}else {
					ans[i]=cur0;
					cur0 = cur0+3;
				}
			}
		}
	}else if (heighttotal[0]<=n/3){
		for (int i=0;i<n;i++){
			if(height[i]%2==0){
				ans[i]=cur0;
				cur0 = cur0+3;
			}else {
				if (cur2<=n){
					ans[i]=cur2;
					cur2 = cur2+3;
				}else if (cur1<=n){
					ans[i]=cur1;
					cur1 = cur1+3;
				}else {
					ans[i]=cur0;
					cur0 = cur0+3;
				}
			}
		}
	}else{
		for (int i=0;i<n;i++){
			if(height[i]%2==1){
				ans[i]=cur0;
				cur0 = cur0+3;
			}else {
				if (cur2<=n){
					ans[i]=cur2;
					cur2 = cur2+3;
				}else if (cur1<=n){
					ans[i]=cur1;
					cur1 = cur1+3;
				}else {
					ans[i]=cur0;
					cur0 = cur0+3;
				}
			}
		}
	}

	for (int i=0;i<n;i++){
		cout << ans[i] << " ";
	}
	printf("\n");

}

Measured memory_bytes: 15220
using System;

class Search
{
    public bool BinarySeach(int[] a, int n, int key) {
        int left = 0, right = n;
        while (left < right) {
            int mid = (left + right) / 2;
            if (a[mid] == key) {
                return true;
            }
            if (a[mid] > key) {
                right = mid;
            } else {
                left = mid+1;
            }
        }
        return false;
    }
}

class A
{
    public static void Main() {
        int n, q, count = 0;
        int[] s;
        Search search = new Search();
        s = new int[100001];
        n = int.Parse(Console.ReadLine());
        string[] data = Console.ReadLine().Split(' ');
        for (int i = 0; i < n; i++) {
            s[i] = int.Parse(data[i]);
        }
        q = int.Parse(Console.ReadLine());
        string[] data2 = Console.ReadLine().Split(' ');
        for (int i = 0; i < q; i++) {
            if (search.BinarySeach(s, n, int.Parse(data2[i]))) {
                count++;
            }
        }
        Console.WriteLine(count);
    }
}


Measured memory_bytes: 19976
#include <bits/stdc++.h>
using namespace std;
typedef int int__;
#define int long long
#define pb push_back
#define pi pair<int,int>
#define vpi vector<pi>
#define vi vector<int>
#define vvi vector<vi>
#define fi first
#define se second
#define forn(i, n)for(int i=0;i<int__(n);i++) 
#define sz(a)int__(a.size())
template <class A, class B> ostream& operator << (ostream& out, const pair<A, B> &a){return out << "(" << a.first << ", " << a.second << ")";}
template<class A>ostream& operator<<(ostream& out,const vector<A>&v){out<<"[";forn(i,sz(v)){if(i)out<<", ";out<<v[i];}return out<<"]";}
const int MAX = 1e9 + 100;
#define fast ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
int Mod(int x){const int mm=2019;x%=mm;if(x<0)x+=mm;return x;}
int Pow(int x,int n){if(n==0)return 1;int t=Pow(x,n/2);t=Mod(t*t);if(n&1)t=Mod(t*x);return t;}
#define watch(x) cout << #x << " : " << x << endl;
int gcd(int a,int b){if(b==0)return a;return gcd(b,a%b);}
#define all(x) x.begin(), x.end()

int pow(int x){
	return x*x*x*x*x;
}

int__ main() {
	fast;
	int x; cin >> x;

	for(int i=-500;i<=500;i++) {
		for(int j=-500;j<=500;j++) {
			if((pow(i) - pow(j)) == x) {
				cout << i << " " << j; return 0;
			}
		}
	}
	
}

Measured memory_bytes: 3664
using System;
using System.Linq;
using System.Collections.Generic;

namespace AOJ2
{
    class Program
    {
        static void Main(string[] args)
        {
            List<int[,]> resultList = new List<int[,]>();

            while (true)
            {
                int n = int.Parse(Console.ReadLine());
                if (n == 0)
                {
                    break;
                }

                int[,] mas = new int[n + 1, n + 1];

                for (int i = 0; i < n; i++)
                {
                    int[] rows = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
                    int sum = 0;
                    for (int j = 0; j < n; j++)
                    {
                        mas[i, j] = rows[j];
                        sum += rows[j];
                        mas[n, j] += rows[j];
                    }

                    mas[i, n] = sum;
                    mas[n, n] += sum;
                }

                resultList.Add(mas);
            }

            foreach (int[,] m in resultList)
            {
                for (int i = 0; i < m.GetLength(0); i++)
                {
                    for (int j = 0; j < m.GetLength(1); j++)
                    {
                        Console.Write(string.Format("{0,5}", m[i, j]));
                        if (j == m.GetLength(1) - 1)
                        {
                            Console.WriteLine();
                        }
                    }
                }
            }

        }

    }
}

Measured memory_bytes: 6236