akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repI(i, d, n) for (int i = (d); i < (n); ++i)
#define reps1(i, n) for (int i = 1; i < (n); ++i)
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

using ll = long long;
using P = pair<int, int>;
using Pl = pair<ll, ll>;
using M = map<int, int>;
using Ml = map<ll, ll>;
ll const INF = 1ll<<61;
double pi = 3.141592653589793238;

int main() {
  ll n;
  cin >> n;
  vector<ll> a(n+1);
  rep(i, n+1) cin >> a[i];

  vector<ll> node(n+1);

  node[0] = 1 - a[0];
  if (node[0] < 0) {
    cout << -1 << endl;
    return 0;
  }


  reps1(i, n) {
    node[i] = node[i-1] * 2 - a[i];
    chmin(node[i], INF);
    if (node[i] < 0) {
      cout << -1 << endl;
      return 0;
    }
  }

  /*
  bool flag = false;
  reps1(i, n) {
    if (node[i] != 0 && flag) {
      cout << -1 << endl;
      return 0;
    }
    if (node[i] == 0) flag = true;
  }


  flag = false;
  if (a[0] != 0) flag = true;
  reps1(i, n+1) {
    if (a[i] != 0 && flag) {
      cout << -1 << endl;
      return 0;
    }
  }
  */
  // rep(i, n) {
  //   cout << i << " " << node[i] << endl;
  // }
  // cout << "a" << endl;
  // cout << node[n-1] << " " << a[n] << endl;
  node[n] = 0;
  if (a[n] > 2 * node[n-1]) {
    cout << -1 << endl;
    return 0;
  }
  //cout << "a" << endl;
  /*
  rep(i, n+1) {
  cout << node[i] << endl;
}
*/

for(ll i = n-1; i >= 0; i--) {
  if (node[i] > node[i+1] + a[i+1]) {
    node[i] = node[i+1] + a[i+1];
  }
  //cout << i << " " << node[i] << endl;
  /*
  if (node[i+1] > node[i] * 2) {
  cout << -1 << endl;
  return 0;
}
*/


}
// ll ans = 0;
// rep(i, n+1) cout << node[i] << " ";
// cout << endl;
/*
rep(i, n) {
  ans += node[i];
  cout << i << " " << ans << endl;
}
*/

cout << accumulate(node.begin(), node.end(), 0ll) + accumulate(a.begin(), a.end(), 0ll) << endl;

return 0;
}


Measured memory_bytes: 4852
//48
#include<iostream>
#include<map>
#include<string>
#include<algorithm>

using namespace std;

string od(int x){
  if(x<26){
    return string(1,'a'+x);
  }else{
    string wc[]={"ld", "mb", "mp", "nc", "nd", "ng", "nt", "nw", "ps", "qu", "cw", "ts"};
    return wc[x-26];
  }
}

int main(){
  int n;
  cin>>n;
  cin.ignore();
  map<string,map<string,int> > m;
  while(n--){
    char l[60];
    cin.getline(l,60);
    string p;
    for(int i=0;l[i];){
      string c;
      string wc[]={"ld", "mb", "mp", "nc", "nd", "ng", "nt", "nw", "ps", "qu", "cw", "ts"};
      if(find(wc,wc+12,string(l+i,2))!=wc+12){
	c=string(l+i,2);
	i+=2;
      }else{
	c=l[i];
	i++;
      }
      if(p!=" "&&c!=" "){
	m[p][c]++;
      }
      p=c;
    }
  }
  for(int i=0;i<38;i++){
    string mf=string(1,'a');
    int c=0;
    for(int j=0;j<38;j++){
      if(m[od(i)][od(j)]>c){
	c=m[od(i)][od(j)];
	mf=od(j);
      }
    }
    cout<<od(i)<<' '<<mf<<' '<<c<<endl;
  }
  return 0;
}

Measured memory_bytes: 1384
#include <algorithm>
#include <bitset>
#include <cfloat>
#include <cmath>
#include <ctime>
#include <deque>
#include <iomanip>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <typeindex>
#include <typeinfo>
#include <vector>
#include <boost/dynamic_bitset.hpp>

#define DEBUG(x) cout << #x << ": " << x << endl
#define INFILE() freopen("input.txt", "r", stdin)

using namespace std;

using ll = long long;
using ull = unsigned long long;
using i_i = pair<int, int>;
using ll_i = pair<ll, int>;
using i_ll = pair<int, ll>;
using d_i = pair<double, int>;
using ll_ll = pair<ll, ll>;
using d_d = pair<double, double>;

static constexpr ll LL_MOD = 1000000009;
static constexpr int I_MOD = 1000000007;
static constexpr double EPS = numeric_limits<double>::epsilon();
static constexpr double PI = 3.14159265358979323846264338327950288;

template <class T> static void scan(vector<T> &v);
static void scan(vector<string> &v, bool isWord = true);
static boost::dynamic_bitset<> scan(char trueValue = 'o');

int main(int argc, char *argv[]) {
	// INFILE();
	string s;
	cin >> s;
	cout << s.rfind("Z") + 1 - s.find("A") << "\n";
  return 0;
}

template <class T> static void scan(vector<T> &v) {
  map<type_index, const char *const> m = {{typeid(int), "%d"},
                                          {typeid(ll), "%lld"},
                                          {typeid(double), "%lf"},
                                          {typeid(char), "%c"}};

  auto tFormat = m[typeid(T)];

  for (T &n : v) {
    scanf(tFormat, &n);
  }
}

static void scan(vector<string> &v, bool isWord) {
	if (isWord) {
		for (auto &n : v) {
			cin >> n;
		}
		return;
	}

  int i = 0, size = v.size();
  string s;
  getline(cin, s);

  if (s.size() != 0) {
    i++;
    v[0] = s;
  }

  for (; i < size; ++i) {
    getline(cin, v[i]);
  }
}

static boost::dynamic_bitset<> scan(char trueValue) {
	string s;
	getline(cin, s);

	if (s.size() == 0) {
		getline(cin, s);
	}

	for_each(begin(s), end(s), [trueValue](char &c) { c = (c == trueValue) ? '1' : '0'; });
	return boost::dynamic_bitset<>(string(rbegin(s), rend(s)));
}


Measured memory_bytes: 640
#include <iostream>

using namespace std;


int main(){
    
    int n, x, count=0;
    while(true){
        cin >> n >> x;
        if(n==0 && x==0){
            break;
        }else{
            for(int i=1; i<=n; i++){
                for(int j=i+1; j<=n; j++){
                    for(int k=j+1; k<=n; k++){
                        if(i+j+k==x){
                            count+=1;
                        }
                    }
                }
            }
        }
        cout << count << endl;
        count=0;
    }

    return 0;
}




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

int main(){
  while(1){
  int n;
  cin >> n;
  if(n == 0){
    break;
  }
  int ans=0;
  int sum=0;
  for(int i=1; i<=n; i++){
    sum+=i;
    if(sum%i == n%i && i != 1){
      ans++;
    }
    if(sum >= n){
      break;
    }
  }
  cout << ans << endl;
}
  return 0;
}



Measured memory_bytes: 3076
/*
これを入れて実行
g++ code.cpp
./a.out
 */

#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <cmath>
#include <tuple>
#include <iomanip>

using namespace std;
typedef long long ll;
typedef long double ld;

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

const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;

bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}

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

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

ll nCr(ll n, ll r){
    if(r == 0 || r == n){
        return 1;
    } else if(r == 1){
        return n;
    }
    return (nCr(n - 1, r) + nCr(n - 1, r - 1));
}

ll nPr(ll n, ll r){
    r = n - r;
    ll ret = 1;
    for (ll i = n; i >= r + 1; i--) ret *= i;
    return ret;
}

//-----------------------ここから-----------

bool comp(const string& f, const string& s){
    return f.size() < s.size();
}
int main(void){
    int n;
    cin >> n;
    
    cout << 800 * n  - n / 15 * 200 << endl;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
  int n;
  cin>>n;
  int a[n];
  for(int i=0;i<n;i++)
  {
    cin>>a[i];
  }
  int x=a[0],count=1;
  for(int i=1;i<n;i++)
  {
    if(x<=a[i])
    {
      count++;
      x=a[i];
    }
  }
  cout<<count;
  return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AtCoder
{
	public class Program
	{
		static void Main(string[] args)
		{
			int[] vs = Console.ReadLine().Split().Select(p => int.Parse(p)).ToArray();
			int N = vs[0];
			int K = vs[1];
			for (int i = 0; i < N; i++) {
				char c = (char)Console.Read();
				Console.Write(i + 1 == K ? char.ToLower(c) : c);
			}
			Console.WriteLine();
		}
	}
}


Measured memory_bytes: 13268
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <unordered_map>
#include <iomanip>
#include <cmath>
#include <tuple>
using namespace std;
using ll = long long;
#define rep(i, j, n) for(int i = j; i < (int)n; ++i)
#define rrep(i, j, n) for(int i = (int)n - 1; j <= i; --i)

constexpr ll MOD = 0x3b9aca07;
constexpr int INF = 0x3f3f3f3f;
constexpr ll INFL = 0x3f3f3f3f3f3f3f3fLL;

vector<int> zAlgorithm(const string & s) {
    int i = 1, j = 0, n = (int)s.size();
    vector<int> ret(n);
    ret[0] = n;
    while (i < n) {
        while (i + j < n && s[j] == s[i + j]) ++j;
        ret[i] = j; // ここでi番目先頭の場合の値は確定
        if (j == 0) { // jが進んでなかったら
            ++i; continue;
        }
        int k = 1;
        while (i + k < n && k + ret[k] < j) ret[i + k] = ret[k], ++k;
        i += k, j -= k;
    }
    return ret;
}

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

	int n; string s; cin >> n >> s;

    int ans = 0;
    rep(i, 0, n) {
        vector<int> z = zAlgorithm(s.substr(i, n - i));
        rep(j, 0, z.size()) {
            if (z[j] <= j) ans = max(ans, z[j]);
        }
    }
    cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3676
#include<iostream>
#include<math.h>
#include<algorithm>
#define ll long long int
#define FOR(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define REP(i,n) FOR(i,0,n)
#define REP1(i,n) FOR(i,1,n)

using namespace std;

int main(){
	int a, b;
    cin >> a >> b;
    if(b%a == 0) cout << a+b << endl;
    else cout << b-a << endl;
	return 0;
}


Measured memory_bytes: 256
import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.range, std.typecons;
import std.bigint, std.numeric, std.math, std.random;
import core.bitop;

string FMT_F = "%.10f";

static File _f;
void file_io(string fn) { _f = File(fn, "r"); }
static string[] s_rd;
T _RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
T _RD(T = long)(File f) { while(!s_rd.length) s_rd = f.readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
T[] _RDA(T = long)(T fix = 0) { auto r = readln.chomp.split.to!(T[]); r[] += fix; return r; }
T[] _RDA(T = long)(File f, T fix = 0) { auto r = f.readln.chomp.split.to!(T[]); r[] += fix; return r; }
T RD(T = long)() { if (_f.isOpen) return _RD!T(_f); else return _RD!T; }
T[] RDA(T = long)(T fix = 0) { if (_f.isOpen)  return _RDA!T(_f, fix); else return _RDA!T(fix); }

size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

void chmin(T)(ref T x, T y) { x = min(x, y); } void chmax(T)(ref T x, T y) { x = max(x, y); }
bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
T lcm(T)(T x, T y) { return x * (y / gcd(x, y)); }

long mod = 10^^9 + 7;
//long mod = 998_244_353;
//long mod = 1_000_003;
void moda(T)(ref T x, T y) { x = (x + y) % mod; }
void mods(T)(ref T x, T y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(T)(ref T x, T y) { x = (x * y) % mod; }
void modpow(T)(ref T x, T y) { if (!y) { x = 1; return; } auto t = x; x.modpow(y>>1); x.modm(x); if (y&1) x.modm(t); }
void modd(T)(ref T x, T y) { y.modpow(mod - 2); x.modm(y); }

T binarySearch(alias pred, T)(T ok, T ng)
{ 
	while (abs(ok-ng) > 1)
	{
		auto mid = (ok+ng)/2;
		if (unaryFun!pred(mid)) ok = mid;
		else ng = mid;
	}
	return ok;
}

void main()
{
	auto N = RD;
	auto M = RD;
	auto K = RD;
	auto A = RDA;
	auto B = RDA;

	auto c = new long[](M+1);
	foreach (i; 0..M)
		c[i+1] = c[i] + B[i];

	long ans;
	long tot;
	foreach (i; 0..N+1)
	{
		auto remain = K - tot;
		if (remain < 0) continue;
		bool f(long x)
		{
			return c[x] <= remain;
		}
		auto r = binarySearch!(f)(0, M+1);
		ans.chmax(i+r);

		if (i == N) continue;
		tot += A[i];
	}

	writeln(ans);
	stdout.flush;
	debug readln;
}


Measured memory_bytes: 21812
MOD = 10 ** 9 + 7


def prepare(n):
    global MOD
    modFacts = [0] * (n + 1)
    modFacts[0] = 1
    for i in range(n):
        modFacts[i + 1] = (modFacts[i] * (i + 1)) % MOD

    invs = [1] * (n + 1)
    invs[n] = pow(modFacts[n], MOD - 2, MOD)
    for i in range(n, 1, -1):
        invs[i - 1] = (invs[i] * i) % MOD

    return modFacts, invs


X, Y = map(int, input().split())
if (X + Y) % 3 == 0 and 2 * Y - X >= 0 and 2 * X - Y >= 0:
    p = (2 * Y - X) // 3
    q = (2 * X - Y) // 3
    n = p + q
    r = min(p, q)
    modFacts, invs = prepare(n)
    ans = (modFacts[n] * invs[n - r] * invs[r]) % MOD
else:
    ans = 0

print(ans)


Measured memory_bytes: 49008
#include<iostream>
#include<vector>
#include<set>
#include<queue>
#include<map>
#include<algorithm>
#include<cstring>
#include<string>
#include<cassert>
#include<cmath>
#include<climits>
#include<iomanip>
#include<stack>
#include<unordered_map>
#include<bitset>
#include<limits>
#include<complex>
#include<array>
#include<numeric>
#include<functional>

using namespace std;
#define ll long long
#define ull unsigned long long
#define rrep(i,m,n) for(ll (i)=(ll)(m);(i)>=(ll)(n);(i)--)
#define rep(i,m,n) for(ll (i)=(ll)(m);i<(ll)(n);i++)
#define REP(i,n) rep(i,0,n)
#define FOR(i,c) for(decltype((c).begin())i=(c).begin();i!=(c).end();++i)
#define all(hoge) (hoge).begin(),(hoge).end()
typedef pair<ll, ll> P;
constexpr ll MOD = 1000000007;
constexpr ll INF = 1LL << 61;
typedef vector<ll> Array;
typedef vector<Array> Matrix;

struct Edge {//グラフ
	ll to, cap, rev;
	Edge(ll _to, ll _cap, ll _rev) {
		to = _to; cap = _cap; rev = _rev;
	}
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;
void add_edge(Graph& G, ll from, ll to, ll cap, bool revFlag, ll revCap) {//最大フロー求める Ford-fulkerson
	G[from].push_back(Edge(to, cap, (ll)G[to].size()));
	if (revFlag)G[to].push_back(Edge(from, revCap, (ll)G[from].size() - 1));//最小カットの場合逆辺は0にする
}

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


	ll n;
	cin >> n;
	Graph g(n);
	Array c(n);
	REP(i, n)cin >> c[i], c[i]--;
	REP(i, n - 1) {
		ll a, b;
		cin >> a >> b;
		a--; b--;
		add_edge(g, a, b, 1, true, 1);
	}
	Matrix mat(n, Array(1, n));
	Array num(n, 0);

	auto dfs = [&](auto dfs,ll v, ll par)->ll {
		ll ret = 0;
		ll now = num[c[v]];
		REP(i, g[v].size()) {
			ll to = g[v][i].to;
			if (to == par)continue;
			mat[c[v]].push_back(0);
			num[c[v]] = mat[c[v]].size() - 1;
			ll tmp = dfs(dfs, to, v);
			mat[c[v]][num[c[v]]] += tmp;
			ret += tmp;

		}
		ret++;
		num[c[v]] = now;
		mat[c[v]][num[c[v]]] -= ret;
		return ret;
	};

	dfs(dfs, 0, -1);
	REP(i, n) {
		ll ans = n * (n + 1) / 2;
		REP(j, mat[i].size()) {
			ans -= mat[i][j] * (mat[i][j] + 1) / 2;
		}
		cout << ans << "\n";
	}

	return 0;
}


Measured memory_bytes: 67888
// In the name of Allah 
#include <bits/stdc++.h>
using namespace std;

const int mod = 1e9+7, MAX = 1e5+5;

int n, p[MAX], res;
pair<int, int> x[MAX], y[MAX];
vector<pair<int, pair<int, int> > > edge;

int fnd (int a) {
	return (p[a] == a ? a : p[a] = fnd(p[a]));
}

void uni (int a, int b) {
	p[fnd(b)] = fnd (a);
}

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);	
	cin >> n;
	for (int i = 0; i < n; i++) {
		int a, b;
		cin >> a >> b;
		x[i] = {a, i};
		y[i] = {b, i};
		p[i] = i;
	}
	sort (x, x+n); sort (y, y+n);
	for (int i = 0; i < n-1; i++) {
		edge.push_back( { x[i+1].first - x[i].first , {x[i].second, x[i+1].second}});
		edge.push_back( { y[i+1].first - y[i].first , {y[i].second, y[i+1].second}});
	}

	sort (edge.begin(), edge.end());
	for (int i = 0; i < 2*n-2; i++) {
		int a = edge[i].second.first, b = edge[i].second.second, w = edge[i].first;
		if ( fnd(a) != fnd(b) ) {
			res += w;
			uni (a, b);
			//cout << a << ' ' << b << endl;
		}
	}

	cout << res << endl;

	return 0;
}

Measured memory_bytes: 6900
//Har Har Mahadev
using namespace std;
#include <bits/stdc++.h>
#define booga cout << "booga" << endl
#define ll long long int
#define pb push_back
#define mp make_pair
#define debug(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " -> " << a << endl;
	err(++it, args...);
}

void testcase(){
	ll d,t,s;
	cin >> d >> t >> s;
	if(s*t >= d)cout << "Yes";
	else cout << "No";
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int t = 1;
	while(t--){
		testcase();
	}
	return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define FOR(i,a,b) for(int i=a; i<(int)(b); i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define CLR(a) memset((a), 0 ,sizeof(a))
#define PB push_back
#define MP make_pair
#define SP << " " <<
const int INF = 1001001001;
const ll LINF = 100100100100100100;
#define EPS (1e-10)
const long double PI  = acos(-1.0L);
typedef pair<int,int> PII;
typedef pair<ll,ll> PLL;
typedef pair<double,double> PDD;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
#define chmax(a,b) a = (((a)<(b))?(b):(a))
#define chmin(a,b) a = (((a)>(b))?(b):(a))

__attribute__((constructor))
void initial(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}

signed main(){
	string s; cin>>s;
	string t="YAKI";
	if(s.size()>=4){
		bool flg=true;
		rep(i,4) if(s[i]!=t[i]) flg=false;
		if(flg) return cout<<"Yes"<<endl,0;
	}
	cout<<"No"<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstring>
using namespace std;
char a[105];
int main()
{
	bool flag=false;
	cin>>a;
	int k=strlen(a);
	for(int i=0;i<k;i++)
	{
		if(a[i]=='C')
		{
			for(int j=i;j<k;j++)
			{
				if(a[j]=='F')
				{
					flag=true;
					break;
				}
			}
		}
	}
	if(flag==true) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
// Written By NewbieChd
#include <cstdio>
#include <cstring>
using namespace std;

const int maxN = 100003;
char s[maxN];

inline int work(int l, int r) {
    int i, j, o = 0;
    for (i = l; i <= r; i = j) {
        for (j = i; s[j] == s[i] && j <= r; ++j) {}
        o += (j - i) >> 1;
    }
    return o;
}

int main() {
    int n, k;
    long long ans;
    scanf("%s%d", s + 1, &k), n = strlen(s + 1);
    if (s[1] == s[n]) {
        int l = 1, r = n;
        while (s[l] == s[n])
            ++l;
        if (l > n) {
            printf("%lld\n", 1ll * n * k >> 1);
            return 0;
        }
        while (s[r] == s[1])
            --r;
        ans = 1ll * work(l, r) * k + 1ll * ((l - 1 + n - r) >> 1) * (k - 1)
            + ((l - 1) >> 1) + ((n - r) >> 1);
    }
    else
        ans = 1ll * work(1, n) * k;
    printf("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define ls ((rt) << 1)
#define rs ((rt) << 1 | 1)
#define mp(a, b) make_pair(a, b)
#define lowbit(x) ((x) & -(x))
typedef pair<int, int> pii;
typedef long long ll;
const ll mod = 1e9 + 7;
const int maxn = 1e5 + 10;
int n, m, k;
int fa[maxn], siz[maxn];
vector<int> E[maxn];
int getfa(int x) { return x == fa[x] ? x : fa[x] = getfa(fa[x]);}
int main()
{
	cin >> n >> m >> k;
	for(int i = 1; i <= n; ++i) fa[i] = i, siz[i] = 1;
	for(int i = 1; i <= m; ++i)
	{
		int u, v;
		cin >> u >> v;
		int fu = getfa(u), fv = getfa(v);
		E[u].push_back(v);
		E[v].push_back(u);
		if(fu != fv)
		{
			siz[fu] += siz[fv];
			fa[fv] = fu;
		}
	}
	for(int i = 1; i <= k; ++i)
	{
		int u, v;
		cin >> u >> v;
		int fu = getfa(u), fv = getfa(v);
		E[u].push_back(v);
		E[v].push_back(u);
	}
	for(int i = 1; i <= n; ++i)
	{
		int fi = getfa(i);
		int ret = siz[fi] - 1;
		for(auto v : E[i])
		{
			int fv = getfa(v);
			if(fv == fi)
				--ret;
		}
		printf("%d%c", ret, i == n ? '\n' : ' ');
	}
	return 0;
}

Measured memory_bytes: 8696
n = int(input())
txy = [list(map(int,input().split()))for _ in range(n)]
ok = True
time = 0
nx = 0
ny = 0
for i in range(n):
    t = txy[i][0]
    x = txy[i][1]
    y = txy[i][2]
    dist = abs(x-nx)+abs(y-ny)
    if not(t - time >= dist and (t- time )%2 == dist%2):
        ok = False
        break
    time=t
    nx = x
    ny = y
if ok:print('Yes')
else:print('No')
    

Measured memory_bytes: 27380
#include <bits/stdc++.h>
#define DEBUG if(0)
#define lli long long int
#define ldouble long double
using namespace std;

const int maxN = 2e6 + 1;
const lli mod = 1e9 + 7;
lli fat[maxN];
lli x, y;

lli modPow(lli x, lli y)
{
  lli ans = 1;
  while (y)
  {
    if (y & 1LL) ans = ans * x % mod;
    x = x * x % mod, y >>= 1LL;
  }
  return ans;
}

lli inv(lli num)
{
  return modPow(num, mod - 2);
}

lli choose(lli n, lli k)
{
  return fat[n] * inv(fat[k] * fat[n - k] % mod) % mod;
}

int main()
{
  fat[0] = 1;
  for (int i = 1; i < maxN; i ++)
    fat[i] = i * fat[i - 1] % mod;

  while (scanf("%lld %lld", &x, &y) != EOF)
  {
    if ((x + y) % 3 != 0) printf("0\n");
    else
    {
      lli n = x - 2*(2*x - y) / 3, m = (2*x - y) / 3;
      if (n < 0 || m < 0) printf("0\n");
      else printf("%lld\n", choose(n + m, n));
    }
  }
  return 0;
}

Measured memory_bytes: 15872
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
using namespace std;
 int main()
 {
     int n,m,t;
     int x;
     int num[1000];
     cin>>n>>m>>t;
     memset(num,0,sizeof(num));
     for(int i=0;i<m;i++){
        cin>>x;
        num[x]=1;
     }
     int q=0,w=0;
     for(int i=t;i>=0;i--) q+=num[i];
     for(int i=t;i<=n;i++) w+=num[i];
     cout<<min(q,w)<<endl;
     return 0;
 }


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

const int MAX = 100005;
int A[MAX*3];

int main() {
    int N;
    scanf("%d", &N);
    for (int i = 0; i < 3*N; i++) scanf("%d", &A[i]);

    priority_queue<int, vector<int>, greater<int>> X;
    priority_queue<int> Y;
    long long x, y;
    x = y = 0;
    for (int i = 0; i < N; i++) {
        X.push(A[i]);
        Y.push(A[3*N-1-i]);
        x += (long long)A[i];
        y += (long long)A[3*N-1-i];
    }
    long long P[MAX], Q[MAX];
    P[0] = x;
    Q[N] = y;
    for (int i = 0; i < N; i++) {
        X.push(A[N+i]);
        Y.push(A[2*N-1-i]);
        x += (long long)(A[N+i] - X.top());
        y += (long long)(A[2*N-1-i] - Y.top());
        P[i+1] = x;
        Q[N-1-i] = y;
        X.pop();
        Y.pop();
    }
    long long ans;
    ans = P[0] - Q[N];
    for (int i = 0; i <= N; i++) {
        ans = max(ans, P[i] - Q[i]);
    }
    printf("%lld\n", ans);
    return 0;
}

Measured memory_bytes: 3956
#include <stdio.h>
#include <iostream>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <limits>
#include <numeric>
#include <set>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;


int main()
{
	int a, b, t;
	cin >> a >> b >> t;

	cout << b * (t / a) << endl;

	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
char s[200005];
int sum[200005];

int main(){
	int n;
	scanf("%d",&n);
	scanf("%s",s+1);
	sum[0] = 0;
	for(int i = 1; i <= n; i++){
		sum[i] = sum[i-1];
		if(s[i]=='#') sum[i]++;
	}
	int ans = n;
	for(int i = 0; i <= n; i++){
		int need = sum[i]+(n-i-(sum[n]-sum[i]));
		//printf("i = %d, need = %d\n",i,need);
		ans = ans<need?ans:need;
	}
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 1152
import fractions as f
a, b, c, d = map(int, input().split())
a -= 1
cd = (c * d // f.gcd(c, d))
pa = a - (a // c) - (a // d) + (a // cd)
pb = b - (b // c) - (b // d) + (b // cd)
print(pb - pa)

Measured memory_bytes: 5048
#include<bits/stdc++.h>
using namespace std;
#define inf INT_MAX
#define INF LLONG_MAX
#define ll long long
#define ull unsigned long long
#define M (int)(1e9+7)
#define P pair<int,int>
#define FOR(i,m,n) for(int i=(int)m;i<(int)n;i++)
#define RFOR(i,m,n) for(int i=(int)m;i>=(int)n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
#define all(a) a.begin(),a.end()
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define F first
#define S second
#define PB push_back
#define EB emplace_back
#define int ll
#define vi vector<int>
#define IP pair<int,P>
#define PI pair<P,int>
#define PP pair<P,P>
#define Yes(f){cout<<(f?"Yes":"No")<<endl;}
#define YES(f){cout<<(f?"YES":"NO")<<endl;}
int Madd(int x,int y) {return (x+y)%M;}
int Msub(int x,int y) {return (x-y+M)%M;}
int Mmul(int x,int y) {return (x*y)%M;}


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

  int n;
  cin>>n;
  string s,t;
  cin>>s>>t;
  rep(i,n){
    cout<<s[i]<<t[i];
  }
  cout<<endl;


}

Measured memory_bytes: 256
n=int(input())
b=list(map(int,input().split()))
a=[0]*n
for i in range(n-2):
    if b[i]<=b[i+1]:
        a[i+1]=b[i]
    else:
        a[i+1]=b[i+1]
a[0]=b[0]
a[n-1]=b[n-2]
A=0
for i in range(n):
    A+=a[i]
print(A)

Measured memory_bytes: 61368
import java.util.*;

public class Main{
    public static void main(String args[]){
        boolean ans = true;
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        int ccnt = 0;
        char c = 'a';
        
        for(int i=0; i<s.length(); i++){
            c = s.charAt(i);
            if(i==0){
                if(c != 'A'){
                    ans = false;
                    break;
                 }
            }else if(i > 1 && i < s.length()-1){
                if(c == 'C' && ccnt == 0){
                    ans = true;
                    ccnt++;
                }else{
                    if(Character.isUpperCase(c)){
                        ans = false;
                        break;
                    }
                }
            }else{
                if(Character.isUpperCase(c)){
                    ans = false;
                    break;
                }
            }
            if(ccnt == 0){
                ans = false;
            }
        }

        System.out.println(ans?"AC":"WA");
    }
}

Measured memory_bytes: 21844
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long x = sc.nextLong();
		List<Long> list = new ArrayList<>();
		for (long i = 0; i < 200; i++) {
			list.add(i*i*i*i);
		}
		long max = 0;
		for (int i = 0; i < list.size(); i++) {
			if (x <= list.get(i)) {
				max = i;
				break;
			} else if (x == list.size()-1) {
				max = i;
				break;
			}
		}
		for (long i = (-1) * max; i <= max ; i++) {
			for (long j = (-1) * max; j <= max ; j++) {
				long cal = i*i*i*i*i - j*j*j*j*j;
				if ( cal == x) {
					System.out.println(i + " " + j);
					return;
				}
			}
		}

	}

}


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

using namespace std;
typedef long long ll;
typedef long int li;
typedef long double lb;
#define rep(i,j,n) for (ll i = j; i < (n); i++)
#define repr(i,j,n) for(ll i = j; i >= (n); i--)
#define all(x) (x).begin(),(x).end()
#define CLR(mat,f) memset(mat, f, sizeof(mat))
#define IN(a, b, x) (a<=x&&x<b)
#define out(ans) cout << ans << endl
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
typedef pair<ll,ll>P;
const ll mod=1e9+7;
const ll INF = 1LL<<60;

int main(){

  ll a,b,c;cin>>a>>b>>c;
  ll ab[a][b],bc[b][c];
  rep(i,0,a)rep(j,0,b)cin>>ab[i][j];
  rep(i,0,b)rep(j,0,c)cin>>bc[i][j];

  ll ans[a][c];
  rep(i,0,a){
    rep(j,0,c){
      ll sum=0;
      rep(k,0,b)sum+=ab[i][k]*bc[k][j];
      ans[i][j]=sum;
    }
  }

  rep(i,0,a){
    rep(j,0,c){
      if(j==c-1)out(ans[i][j]);
      else cout<<ans[i][j]<<" ";
    }
  }

  return 0;
}



Measured memory_bytes: 3324
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int tate1 = sc.nextInt();
		int yoko1 = sc.nextInt();
		int tate2 = sc.nextInt();
		int yoko2 = sc.nextInt();
		int a = tate1*yoko1;
		int b = tate2*yoko2;
		if(a<b) System.out.println(b);
		else System.out.println(a);
		sc.close();
	}
}


Measured memory_bytes: 23124
#include <stdio.h>
#include <string.h>
int main(void)
{
    char s[100],t[110];
    scanf("%s",s);
    scanf("%s",t);

    int flg=1;
    for(int i=0;*(s+i)!='\0';i++){
        if (*(s+i)!=*(t+i)){flg=0; break;}
    }
    if(flg){printf("Yes\n");}
    else{printf("No\n");}
    return 0;
}

Measured memory_bytes: 1648
//Zory-2020
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
// typedef __int128 ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define FR first
#define SE second
#define MP make_pair
#define PB push_back
#define vc vector
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define bin(x) (1ll<<(x))
#define fo(i,l,r) for(int i=(l),I=(r);i<=I;i++)
#define fd(i,r,l) for(int i=(r),I=(l);i>=I;i--)
#define mem(x,val) memset(x,val,sizeof x)
#define Swap(a,b,n) for(int I=0;I<=n;I++) swap(a[I],b[I])
#define PC __builtin_popcountll
#ifdef DEBUG
#define DD 1
#else
#define DD 0
#endif
#define Debug if(DD) printf("line %d\n",__LINE__)
#define deb(x) if(DD) cerr<<#x<<'='<<x<<endl
#define debug if(DD) printf
namespace mine
{
	ll qread()
	{
		ll ans=0,f=1;char c=getchar();
		while(c<'0' or c>'9') {if(c=='-')f=-1;c=getchar();}
		while('0'<=c and c<='9') ans=ans*10+c-'0',c=getchar();
		return ans*f;
	}
	void write(ll num){if(num<0) putchar('-'),num=-num;if(num>=10) write(num/10);putchar('0'+num%10);}
	void write1(ll num){write(num);putchar(' ');}
	void write2(ll num){write(num);putchar('\n');}
	template<typename T>inline bool chmax(T&a,const T&b){return a<b?a=b,1:0;}
	template<typename T>inline bool chmin(T&a,const T&b){return a>b?a=b,1:0;}
	ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}
	bool IN(ll x,ll l,ll r){return l<=x and x<=r;}
	void gg1(){write2(-1);exit(0);}
	void gg2(){puts("NO");exit(0);}
	
	const double eps=1e-8;
	const int INF=0x3f3f3f3f;
	const int MOD=1e9+7;
	int mm(const int x){return x>=MOD?x-MOD:x;}
	template<typename T> void add(T &x,const int &y){x=(x+y>=MOD?x+y-MOD:x+y);}
	ll qpower(ll x,ll e,int mod=MOD){ll ans=1;while(e){if(e&1)ans=ans*x%mod;x=x*x%mod;e>>=1;}return ans;}
	ll invm(ll x){return qpower(x,MOD-2);}
	const int M=5e6+10;
	ll fac[M],facinv[M];ll C(int n,int m){return n<0 or n<m?0:fac[n]*facinv[m]%MOD*facinv[n-m]%MOD;}
	void PRE()
	{
		fac[0]=1;fo(i,1,M-1) fac[i]=fac[i-1]*i%MOD;
		facinv[M-1]=invm(fac[M-1]);fd(i,M-1,1) facinv[i-1]=facinv[i]*i%MOD;
	}
	
	const int N=1e6+10;
	ll solve(int n,int wt)
	{
		//debug("solve(%d,%d)=%d\n",n,wt,C(n-1,n-wt-1));
		return C(n-1,n-wt-1)*C(n,wt)%MOD;
	}
	void main()
	{PRE();
		int n=qread(),k=min(qread(),n*1ll);
		ll ans=0;fo(wt,0,k) /*if(wt!=k-1)*/ add(ans,solve(n,wt));write(ans);
	}
};//变量重名！
signed main()
{
	#ifdef DEBUG
	//freopen("a.in","r",stdin);
	freopen("z.txt","r",stdin);
	#endif
	srand(time(0));
	mine::main();
	if(DD) cerr<<"\n---------------------Zory-------------------\nTime: " <<1.0*clock()/CLOCKS_PER_SEC<<"s";
}

Measured memory_bytes: 78336
#include <iostream>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <math.h>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <climits>
#include <bitset>
#include <list>
#include <map>
#include <set>

using namespace std;

typedef unsigned long long ull;
typedef long long ll;

int main(){
	string s;
	cin >> s;
	vector<int> c(26,-1);
	for(int i=0; i<s.length(); i++) c[s[i]-'a']=i;

	for(int i=0; i<26; i++){
		if(c[i]==-1){
			cout << s+(char)(i+'a') << endl;
			return 0;
		}
	}

	string t=s;
	if(next_permutation(t.begin(), t.end())){
		int i=0;
		for(; s[i]==t[i]; i++) cout << t[i];
		cout << t[i] << endl;
	}else cout << -1 << endl;
	return 0;
}

Measured memory_bytes: 256
#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() {
    ll N,K;
    cin>>N>>K;
    long double rate=0.0;
    for(int i=1;i<=N;i++){
      ll n=i;
      long double tmp=1.0/N;
      
      while(n<K){
        n*=2;
        tmp/=2;
        //cout<<n<<endl;
      }
      rate+=tmp;
    }
    
    cout<< fixed << setprecision(15) <<rate<<endl;
    return 0;
}

Measured memory_bytes: 3716
#include<stdio.h>

#define MAX 10000
#define NIL -1

typedef struct Node{
  int p, l, r;
}Node;

Node T[MAX];

int n;
int D[MAX], H[MAX];

int getDepth(int u){
  int d = 0;
  while(1){
    u = T[u].p;
    if ( u == NIL ) break;
    d++;
  }
  return d;
}

int getSibling(int u){
  if ( T[u].p == NIL ) return NIL;
  if ( T[T[u].p].l != u && T[T[u].p].l != NIL ) return T[T[u].p].l;
  if ( T[T[u].p].r != u && T[T[u].p].r != NIL ) return T[T[u].p].r;
  return NIL;
}

void print(int u){
  printf("node %d: ", u);

  printf("parent = %d, ", T[u].p);
  printf("sibling = %d, ", getSibling(u));
  int deg = 0;
  if ( T[u].l != NIL ) deg++;
  if ( T[u].r != NIL ) deg++;
  printf("degree = %d, ", deg);
  printf("depth = %d, ", D[u]);
  printf("height = %d, ", H[u]);

  if ( T[u].p == NIL ){
    printf("root\n");
  } else if ( T[u].l == NIL && T[u].r == NIL ){
    printf("leaf\n");
  } else {
    printf("internal node\n");
  }
}

main(){
  int i, v, l, r;
  scanf("%d", &n);

  for ( i = 0; i < n; i++ ) {
    T[i].p = NIL;
  }

  for ( i = 0; i < n; i++ ){
    scanf("%d %d %d", &v, &l, &r);
    T[v].l = l;
    T[v].r = r;
    if ( l != NIL ) T[l].p = v;
    if ( r != NIL ) T[r].p = v;
  }

  for ( i = 0; i < n; i++ ){
    D[i] = getDepth(i);
    H[i] = 0;
  }

  for ( i = 0; i < n; i++ ){
    if ( T[i].l == NIL && T[i].r == NIL ) { // is leaf
      H[i] = 0;
      int p = T[i].p;
      int c = 1;
      while(1){
	if ( p == NIL ) break;
	if ( H[p] < c ) H[p] = c;
	c++;
	p = T[p].p;
      }
    }
  }
  
  for ( i = 0; i < n; i++ ){
    print(i);
  }
  
  return 0;
}



Measured memory_bytes: 2104
//In The Name Of Allah
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define sz(x) (int)(x.size())
#define double long double 
#define x real()
#define y imag()
#define fi first
#define se second
#define pii pair<int, int>
 
signed main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
	int a, b, c;
	cin >> a >> b >> c;
	if (a + b + c < 22) cout << "win\n";
	else cout << "bust\n";
}
 

Measured memory_bytes: 256
import java.util.*;
    public class Main{
      public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
    	long h = sc.nextLong();
        long w = sc.nextLong();
        long s = h * w;
        
        if(s % 2 == 1){
          s += 1;
        }
        s /= 2;
        if(h == 1 || w == 1)
          s = 1;
        
        System.out.println(s);
      
      }
    }

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

#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>
#include<iomanip>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
#include<complex>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

//typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector< vector<int> > mat;

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

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

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

	int N;
	cin >> N;
	pii mi = mp(0, INF);
	int A, B;
	rep(i, 0, N)
	{
		cin >> A >> B;
		if (chmax(mi.first, A))
		{
			mi.second = B;
		}
	}

	cout << mi.first + mi.second << endl;
	
	return 0;
}

Measured memory_bytes: 3604
if __file__ == '/tmp/code.py':
	import sys
	sys.stdin = open('input.txt')

n = int(raw_input())

a, b = 0, 0
for _ in xrange(n):
	x, y = map(int, raw_input().split())

	k = 1
	if x < a:
		k = (a + x - 1) / x
	if y < b:
		k = max(k, (b + y - 1) / y)

	a, b = k * x, k * y

print a + b

Measured memory_bytes: 2696
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
using ll = long long;
using P = pair<int,int>;
using PP = pair<int,pair<int,int>>;
using T = tuple<string,int,int>;
const ll INF = 1LL<<60;

vector<vector<int>> g;
vector<int> ans;

void dfs(int now){
  ans[now] = 1;
  for(int v: g[now]){
    if(ans[v]) continue;
    dfs(v);
  }
}

int main(){
  int n,m; cin >> n >> m;
  g.resize(n);
  ans.resize(n, 0);
  for(int i = 0; i < m; i++){
    int x,y,z; cin >> x >> y >> z;
    x--; y--;
    g[x].push_back(y);
    g[y].push_back(x);
  }
  ll res = 0;
  for(int i = 0; i < n; i++){
    for(int v: g[i]){
      if(ans[v]) continue;
      res++;
      dfs(v);
    }
  }

  for(int i = 0; i < n; i++){
    if(!ans[i]) res++;
  }
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 9216
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"
using namespace std;

//#define int long long
#define DBG 1
#define dump(o) if(DBG){cerr<<#o<<" "<<o<<endl;}
#define dumpc(o) if(DBG){cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define each(it,c) for(auto it=(c).begin();it!=(c).end();it++)
#define all(c) c.begin(),c.end()
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9 + 7);
const double EPS = 1e-10;

signed main() {
	double q;
	while (cin >> q, q != -1) {
		double x = q / 2;
		while (abs(x*x*x - q) >= (1e-5)*q) {
			x = (x - (x*x*x - q) / (3 * x*x));
		}
		cout << fixed << setprecision(8) << x << endl;
	}
	return 0;
}

Measured memory_bytes: 3168
t = int(raw_input())

D = []
for i in range(0,4):
    base = [0,0,0,0,0,0,0,0,0,0,0,0,0] 
    D.append(base)
M = ['S','H','C','D']
for i in range(0,t):
    [m,v] = raw_input().split()
    v = int(v) - 1
    if m == 'S':
        D[0][v] = 1
    if m == 'H':
        D[1][v] = 1
    if m == 'C':
        D[2][v] = 1
    if m == 'D':
        D[3][v] = 1

for y in range(0,4):
    for x in range(0,13):
        if D[y][x] == 0:
            print M[y],x+1

Measured memory_bytes: 4252
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<utility>
#include<cmath>
#include<string>
#include<cstring>
#include<map>
#include<queue>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define prin(arg) std::cout<<arg<<"\n"
#define prin2(arg1,arg2) std::cout<<arg1<<" "<<arg2<<"\n"
#define fill(arg,n) std::memset(arg,n,sizeof(arg))
#define mp(a,b) std::make_pair(a,b)
using std::cin;
typedef long long ll;
typedef std::pair<int,int> pi;
typedef std::vector<int> vi;
typedef std::string str;
const int INF=1e+9;
const ll INFLL=1e+17;
const ll MOD=1e+9+7;
int N,M;
int a[30],b[30];
vi edge[8];
void add_edge(int from,int to){
  edge[from].push_back(to);
  edge[to].push_back(from);  
}
void dfs(int v,int S,int& x){
  if(S==(1<<N)-1) x++;
  rep(i,edge[v].size()){
    int w=edge[v][i];
    if(!((S>>w)&1)){ dfs(w,S|1<<w,x);}
  }
}
int main(){
  cin>>N>>M;
  rep(i,M){cin>>a[i]>>b[i];a[i]--;b[i]--;}
  rep(i,M) add_edge(a[i],b[i]);
  int res=0;
  dfs(0,1,res);
  prin(res);
  return 0;
}


Measured memory_bytes: 256
#include<algorithm>
#include<cstring>
#include<cctype>
#include<cstdio>
#include<cmath>
#define rep(i,x,y) for(int i=x; i<=y; ++i)

using namespace std;
const int N=10005,mod=1000000007;
int n,k,prm[N],c[N],a[N],tot;
typedef long long LL;
LL ret,ans;

LL getmi(LL a,LL x)
{
	LL rt=1;
	while(x)
	{
		if(x&1) rt=rt*a%mod;
		a=a*a%mod,x>>=1;
	}
	return rt;
}

void dfs2(int x,int d,int val)
{
	if(x>tot)
	{
		if(d&1) ret=(ret+d*getmi(k,(d/val+1)/2))%mod;
		else ret=(ret+d/2*getmi(k,(d/val+1)/2))%mod;
		return;
	}
	int nw=a[x]?prm[x]:1;
	rep(i,a[x],c[x]) dfs2(x+1,d*nw,val),nw*=prm[x];
}

void dfs1(int x,int mu,int val)
{
	if(x>tot)
	{
		ret=0,dfs2(1,1,val);
		ans=(ans+mu*ret)%mod;
		return;
	}
	a[x]=0,dfs1(x+1,mu,val);
	a[x]=1,dfs1(x+1,-mu,val*prm[x]);
}

int main()
{
	scanf("%d%d",&n,&k);
	int x=n,lim=sqrt(n);
	rep(i,2,lim) if(x%i==0)
	{
		prm[++tot]=i;
		while(x%i==0) x/=i,++c[tot];
	}
	if(x>1) prm[++tot]=x,c[tot]=1;
	dfs1(1,1,1);
	printf("%lld\n",(ans+mod)%mod);
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long ;
int main(){
    map<string,int> kotoba;
    bool ok=true;
    int n;
    cin >> n;
    char old,now;
    rep(i,n){
        string s;
        cin >> s;
        if(kotoba[s]>0){
            ok=false;
        }
        else kotoba[s]++;
        now = s[0];
        if(i!=0){
            if(old != now) ok=false;
        }
        old = s[s.size()-1];
    }
    if(ok) cout << "Yes" << endl;
    else cout << "No" << endl; 
}

Measured memory_bytes: 3656
#include <bits/stdc++.h>
#include <chrono>
#define watch(x) cout << (#x) << " is " << (x) << endl
#define eps 1e-9

typedef long long ll;

using namespace std;

const int mod = 1e9+7;
const int N = 1e5+5;
//int a[N];

int main()

{
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

    int n;
    double x, ans = 0;

    cin >> n;

    while (n--) {

        cin >> x;

        ans += 1/x;
    }

    ans = 1/ans;

    cout << fixed << setprecision(8) << ans;

    return 0;
}


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

#define mod      1e9+7;
#define INF      1e9+9;
#define ps(x,y)  fixed<<setprecision(y)<<x
# define PI 3.14159265358979323846264338327950 L
typedef long long ll;
typedef unsigned long long ull;
int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
#endif
	int n,x,t;
	cin>>n>>x>>t;
	int ans=n/x;
	if(n%x!=0)
		ans++;
	ans*=t;
	cout<<ans<<endl;
	return 0;
}

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

typedef struct {
	int KitamuraEri;
	int KugimiyaRie;
} AsumiKana;

int KatouEmiri(const void* TamuraYukari, const void* HanazawaKana) {
	int TomatuHaruka = ((const AsumiKana*)TamuraYukari)->KugimiyaRie;
	int IgutiYuka = ((const AsumiKana*)HanazawaKana)->KugimiyaRie;
	if (TomatuHaruka > IgutiYuka) return -1;
	if (TomatuHaruka < IgutiYuka) return 1;
	return 0;
}

int SakuraAyane, MinaseInori;
AsumiKana SatouSatomi[200000];

int main(void) {
	int UtidaMaaya;
	if (scanf("%d%d", &SakuraAyane, &MinaseInori) != 2) return 1;
	for (UtidaMaaya = 0; UtidaMaaya < SakuraAyane; UtidaMaaya++) {
		SatouSatomi[UtidaMaaya].KitamuraEri = UtidaMaaya + 1;
		SatouSatomi[UtidaMaaya].KugimiyaRie = -UtidaMaaya - 1;
	}
	for (UtidaMaaya = 0; UtidaMaaya < MinaseInori; UtidaMaaya++) {
		int TanedaRisa;
		if (scanf("%d", &TanedaRisa) != 1) return 1;
		SatouSatomi[TanedaRisa - 1].KugimiyaRie = UtidaMaaya;
	}
	qsort(SatouSatomi, SakuraAyane, sizeof(*SatouSatomi), KatouEmiri);
	for (UtidaMaaya = 0; UtidaMaaya < SakuraAyane; UtidaMaaya++) {
		printf("%d\n", SatouSatomi[UtidaMaaya].KitamuraEri);
	}
	return 0;
}

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

int main() {
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  int left = A + B;
  int right = C + D;
  if (left > right) {
    cout << "Left" << endl;
  }
  else if (left == right) {
    cout << "Balanced" << endl;
  }
  else {
    cout << "Right" << endl;
  }
}

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

using namespace std;

int main(){
  int n;
  cin >>n;
  vector<int> a(n);
  vector<int> b(n);
  vector<int> c(n-1);
  for(int i=0;i<n;i++){
    cin >> a[i];
  }
  for(int i=0;i<n;i++){
    cin >> b[i];
  }
  for(int i=0;i<n-1;i++){
    cin >> c[i];
  }
  int score=0;
  for(int i=0;i<n;i++){
    score += b[a[i]-1];
  }
  for(int i=0;i<n-1;i++){
    if(a[i]==a[i+1]-1){
    score += c[a[i]-1];
    }
  }
  cout << score << endl;
  
}


Measured memory_bytes: 256
// #include <bits/stdc++.h>
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#define fo(i, n) for (i = 0; i < n; i++)
#define PI 3.1415926535897932384626

// using namespace std;
// using std::array;
using std::cin;
using std::cout;
using std::endl;
// using std::map;
// using std::multimap;
// using std::multiset;
// using std::set;
using std::string;
using std::vector;

int32_t randint(int32_t l, int32_t u)
{
    return l + (rand() % u);
}

template <typename T>
void readarray(T *arr, size_t l)
{
    int32_t i;
    fo(i, l)
    {
        std::cin >> arr[i];
    }
}
template <typename T>
vector<T> readvector(size_t l)
{
    vector<T> vec;
    size_t i;
    T a;
    for (i = 0; i < l; i++)
    {
        cin >> a;
        vec.push_back(a);
    }
    return vec;
}
template <typename T>
void readmatrix(int32_t rows, int32_t columns, std::vector<std::vector<T>> &matrix)
{
    int32_t num;
    int32_t i, j;
    int32_t arr[columns];
    fo(i, rows)
    {
        matrix[i] = std::vector<int32_t>(columns);
        fo(j, columns)
        {
            cin >> num;
            matrix[i][j] = num;
        }
    }
}

template <typename T>
void printarray(T *arr, size_t l, std::string sep = " ")
{
    size_t i;
    fo(i, l)
    {
        if (i == l - 1)
        {
            std::cout << arr[i];
        }
        else
        {
            std::cout << arr[i] << sep;
        }
    }
    std::cout << std::endl;
}

template <typename T>
void printvector(std::vector<T> vec, std::string sep = " ")
{
    size_t i;
    for (i = 0; i < vec.size(); i++)
    {
        if (i == vec.size() - 1)
        {
            std::cout << vec[i];
        }
        else
        {
            std::cout << vec[i] << sep;
        }
    }
    std::cout << std::endl;
}
template <typename T>
void display(T x)
{
    cout << x << endl;
}
template <typename T, typename U>
void display(T x, U y)
{
    cout << x << " " << y << endl;
}
std::string solve()
{
    return "0";
}

int main()
{
    int32_t n_test_cases = 1;
    // cin >> n_test_cases;
    while (n_test_cases--)
    {
        int32_t i, j, k, a, b, c, l, m, n, x, t;
        cin >> n >> x >> t;
        display((int32_t)(ceil((double)n / x) * t));
    }
    return 0;
}

Measured memory_bytes: 3256
#include<iostream>
#include<utility>

int gcd(int x,int y){
    int z;
    if(x<y) std::swap(x,y);
    while(y>0){
        z=x%y;
        x=y;
        y=z;
    }
    return x;
}

int main(void){
    int x,y;
    std::cin>>x>>y;
    std::cout<<gcd(x,y)<<std::endl;
}


Measured memory_bytes: 3100