akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <cmath>
#include <string>
#include <sstream>
#include <iomanip>
#include <complex>
using namespace std;

#define ll long long
#define vvi vector< vector<int> >
#define vi vector<int>
#define All(X) X.begin(),X.end()
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back
#define pii pair<int,int>
#define mp make_pair
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 main(){
	int a[3];
	REP(i,3) cin >> a[i];/*cin >> a[0] >> a[1] >> a[2]*/
	//sort(a,a+3);
	if(a[1]>a[2]) swap(a[1],a[2]);/*??\?????????*/
	if(a[0]>a[1]) swap(a[0],a[1]);
	if(a[1]>a[2]) swap(a[1],a[2]);
	cout << a[0] << " " << a[1] << " " << a[2] << endl;
}

Measured memory_bytes: 1164
#include <stdio.h>

int main(void) 
{
    int n, a, b, c, d, cnt;

    while (scanf("%d", &n) != EOF) {
        cnt = 0;
        for (a=0; a<=9; a++) {
            for (b=0; b<=9; b++) {
                for (c=0; c<=9; c++) {
                    for (d=0; d<=9; d++) {
                        if (a+b+c+d == n) {
                            cnt++;
                            break;
                        }
                    }
                }
            }
        }
        printf("%d\n", cnt);
    }
    return 0;
}


Measured memory_bytes: 2028
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops")
 
#include <iostream>
#include <stdlib.h>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <assert.h>
#include <memory.h>
#include <time.h>
#include <bitset>
 
#define uint unsigned int
#define ll long long
#define ull unsigned long long
#define ld long double
#define rep(i, l, r) for (int i = (l); i < (r); i++)
#define repb(i, r, l) for (int i = (r); i > (l); i--)
#define sz(a) (int)a.size()
#define fi first
#define se second
#define mp(a, b) make_pair(a, b)
#define mt(a,b,c) make_tuple(a,b,c)
#define rank qwertyuio
#define next dfghjk
#define plus fsghsf
#define minus ytryr
#define pb push_back
using namespace std;
 
inline bool setmin(int &x, int y) { return (y < x) ? x = y, 1 : 0; }
inline bool setmax(int &x, int y) { return (y > x) ? x = y, 1 : 0; }
inline bool setmin(ll &x, ll y) { return (y < x) ? x = y, 1 : 0; }
inline bool setmax(ll &x, ll y) { return (y > x) ? x = y, 1 : 0; }
 
const int N = 100000;
const int inf = (int)1e9 + 1;
const ll big = (ll)1e18 + 1;
const int P = 239;
const int P1 = 31;
const int P2 = 57;
const int MOD = (int)1e9 + 7;
const int MOD1 = (int)1e9 + 9;
const int MOD2 = 998244353;
const ld eps = 1e-12;
const double pi = atan2(0, -1);
const int ABC = 26;
#define ent '\n'

bool sortbysec(const pair<int,int> &a, 
              const pair<int,int> &b) 
{ 
    return (a.second < b.second); 
} 
int main()
{
    //freopen("a.in", "r", stdin);
    //freopen("a.out", "w", stdout);
    
    int N;
    cin>>N;
    int t=N*25/27;
    int a=t*1.08;
    int b=(t+1)*1.08;
    if(a==N){
        cout<<t;
    }
    else if(b==N){
        cout<<t+1;
    }
    else{
        cout<<":(";
    }






        
    


    return 0;
}

Measured memory_bytes: 256
from collections import Counter
def resolve():
    N = int(input())
    A = list(map(int,input().split()))

    B= set(A)

    A.sort()
    dpt = [True]*(A[-1]+1)
    for i in A:
        if dpt[i]==False:
            continue
        for j in range(i*2,A[-1]+1,i):
            dpt[j] = False
    co = Counter(A)
    c=0
    for i,v in dict(co).items():
        if dpt[i] and v==1:
            c+=1
    print(c)
resolve()


Measured memory_bytes: 155660
import sys
from math import ceil

def input():
    return sys.stdin.readline().strip()

def check(k):
    tmp = list(h)
    for i in range(N):
        tmp[i] -= B*k
    
    flag = False
    for i in tmp:
        if i > 0:
            flag = True
            break
    if not flag:
        return True

    lf = 0
    for i in tmp:
        if i > 0:
            lf += ceil(i/(A-B))

    if lf <= k:
        return True
    else:
        return False

N,A,B = map(int,input().split())
h = tuple(int(input()) for _ in range(N))

left = -1
right = 1e9

while abs(left-right) > 1:

    mid = (left+right)//2
    if check(mid):
        right = mid
    else:
        left = mid

print(int(right))

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

#define INF_LL (ll)1e18
#define INF (int)1e9
#define REP(i, n) for(int i = 0;i < (n);i++)
#define FOR(i, a, b) for(int i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second
using ll = long long;
using PII = pair<int, int>;
using PLL = pair<ll, ll>;

const double eps = 1e-10;

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

const int DIRECTED = 0;
const int UNDIRECTED = 1;

template<int isUNDIRECTED=0>
class Graph{
protected:
	struct Edge{
		int u, v, id; // from, to, 何番目の辺か
		ll c; // cost
		Edge(int u, int v, ll c=0, int id=0):u(u), v(v), c(c), id(id){}
	};

	int V, E; // 頂点数、辺数
	vector<vector<Edge>> G;
	vector<Edge> Es;

public:
	Graph(){}
	Graph(int V):V(V){
		G.resize(V);
	}

	void add_edge(int u, int v, ll c=0, int id=0){
		G[u].emplace_back(u, v, c, id);
		if(isUNDIRECTED) G[v].emplace_back(v, u, c, id);
		Es.emplace_back(u, v, c, id);
		E++;
	}

	vector<Edge>& operator[](int k){
		return G[k];
	}
};

template<int isUNDIRECTED>
class Lowlink : public Graph<isUNDIRECTED>{
	vector<int> ord, low;
	vector<int> articulation;
	vector<pair<int, int>> bridge;
	Graph<DIRECTED> dfsg;
public:
	Lowlink(){}
	Lowlink(int V):Graph<isUNDIRECTED>(V), dfsg(V){};

	void build(){
		ord.resize(this->V, -1);
		low.resize(this->V, -1);
		int k = 0;
		
		function<void(int, int)> dfs = [&, this](int v, int p){
			ord[v] = k++;
			low[v] = ord[v];
			bool isArt = 0; // 関節点か
			int cnt = 0;

			for(auto e : this->G[v]){
				if(e.v == p) continue;
				if(ord[e.v] == -1){
					cnt++;
					dfs(e.v, v);
					low[v] = min(low[v], low[e.v]);
					if(ord[v] < low[e.v]) bridge.emplace_back(e.u, e.v);
					if(~p && ord[v] <= low[e.v]) isArt = 1;
				}else{
					low[v] = min(low[v], ord[e.v]);
				}
			}
			if(p==-1 && cnt > 1) isArt = 1;
			if(isArt) articulation.push_back(v);
		};
		for(int i = 0;i < this->V;i++)
			if(ord[i] == -1) dfs(i, -1);
	}

	vector<pair<int, int>>& getBridge(){
		return bridge;
	}
	
	vector<int>& getArticulation(){
		return articulation;
	}
};

int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int V, E;
	cin >> V >> E;
	Lowlink<UNDIRECTED> low(V);
	REP(i, E){
		int s, t;
		cin >> s >> t;
		low.add_edge(s, t);
	}
	low.build();
	vector<int> art = low.getArticulation();
	sort(all(art));
	REP(i, art.size()){
		cout << art[i] << endl;
	}
}



Measured memory_bytes: 9196
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using ll = long long;
using VL = vector<ll>;
using VVL = vector<vector<ll>>;
using P = pair<ll, ll>;

// chmin, chmax関数
template<typename T, typename U, typename Comp=less<>>
bool chmax(T& xmax, const U& x, Comp comp={}) {
    if(comp(xmax, x)) {
        xmax = x;
        return true;
    }
    return false;
}
template<typename T, typename U, typename Comp=less<>>
bool chmin(T& xmin, const U& x, Comp comp={}) {
    if(comp(x, xmin)) {
        xmin = x;
        return true;
    }
    return false;
}

// Yes-Noを出力する問題で楽をする
void Ans(bool f){
    if(f) cout << "Yes" << endl;
    else cout << "No" << endl;
}

//---------------------------

int main(){
    int k;
    cin >> k;
    int odd = (k+1)/2, even = k/2;
    cout << odd*even << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <string>
#include <queue>
#include <tuple>
#include <cmath>
#include <bitset>
#include <cctype>
#include <set>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using ll = long long;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<typename T>
vector<T> table(int n, T v) { return vector<T>(n, v); }

template <class... Args>
auto table(int n, Args... args) {
    auto val = table(args...);
    return vector<decltype(val)>(n, move(val));
}
const ll INF = (1ll<<31)-1;
const ll MOD = 1000000007;
typedef pair<ll,ll> P;
const ll MAX = 200005;
int nx[4] = {0,-1,0,1};
int ny[4] = {1,0,-1,0};
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a,b,c,x;
    cin >> a >> b >> c >> x;
    int cnt = 0;
    rep(i,a+1){
        rep(j,b+1){
            rep(k,c+1){
                if (500*i+100*j+50*k == x) cnt++;
            }
        }
    }
    PRINT(cnt);
}


Measured memory_bytes: 256
// {{{
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdint>
#include <cstdio>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;
// }}}

using ll = long long;

int main() {
    int N, a[10101];
    cin >> N;
    for (int i = 0; i < N; ++i) cin >> a[i];

    int ans = 0;
    for (int i = 0; i < N; ++i) {
        while (a[i] % 2 == 0) {
            ++ans;
            a[i] /= 2;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
s = gets.chomp.to_i
a = gets.chomp.split(" ").map(&:to_i)
card = Array.new(a.max + 1)
card.fill(0)
a.each do |d|
  card[d] += 1
end
c = 0
(1..(card.size - 1)).each do |i|
  c += card[i]-1 if(card[i] > 0)
end
count = 0
(1..(card.size - 1)).each do |i|
  count += 1 if(card[i] > 0)
end
puts (c%2 == 0)? count : (count - 1)

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


#define INF 1000000000000

signed main()
 {
string s;
cin>>s;
int n=s.size();
int sum=0;
for (int bit=0; bit<(1<<n-1); bit++){
  int tmp=0;
  rep(i,n){
    tmp=tmp*10+(s[i]-'0');
    if(bit&(1<<i) && i<=n-1){
      sum+=tmp;
      tmp=0;
    }
  }
  sum+=tmp;
}
cout<<sum;
}


Measured memory_bytes: 256
function Main(input) {
  input = input.trim()
  input = input.split(" ");
if(input[1].slice( 0,1 )==input[0].slice( -1 )&&input[2].slice( 0,1 )==input[1].slice( -1 )){
  console.log("YES");
}else{
  console.log("NO");
}}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 7372
fun min(a:Int,b:Int) = if(a<b) a else b
fun main(args: Array<String>) {
    val (H,W)=readLine()!!.split(" ").map { it.toInt() }
    val s = Array(H){readLine()!!}
    val c = Array(H){Array(W){0}}

    c[0][0] = 0
    for(w in 1 until W){
        c[0][w] = c[0][w-1]
        if(s[0][w-1]!=s[0][w])c[0][w] += 1
    }
    for(h in 1 until H){
        c[h][0] = c[h-1][0]
        if(s[h][0]!=s[h-1][0])c[h][0] += 1

        for(w in 1 until W){
            var a = c[h][w-1]
            if(s[h][w-1]!=s[h][w])a += 1
            var b = c[h-1][w]
            if(s[h-1][w]!=s[h][w])b += 1
            c[h][w] += min(a,b)
        }
    }
    var result=c[H-1][W-1]/2
    if(s[0][0]=='#' || s[H-1][W-1]=='#')result+=1
    println(result)
}

Measured memory_bytes: 36232
let N = stdin.ReadLine() |> int
let p = stdin.ReadLine().Split() |> Array.map int

let rec resolver s n =
    if n = N then s
    elif p.[n] <> n + 1 then resolver (s + 1) (n + 1)
    else resolver s (n + 1)

if resolver 0 0 < 3 then "YES"
else "NO"
|> stdout.WriteLine


Measured memory_bytes: 13268
while 1:
    a,op,b = map(str,raw_input().split())
    a,b = int(a),int(b)
    if op == "?":break
    if op == "+":
        print a + b
    if op == "-":
        print a - b
    if op == "*":
        print a * b
    if op == "/":
        print a / b

Measured memory_bytes: 6408
#!/usr/bin/env python3
#%% for atcoder uniittest use
import sys
input= lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(10**9)
def pin(type=int):return map(type,input().split())
def tupin(t=int):return tuple(pin(t))
def lispin(t=int):return list(pin(t))
#%%code

from collections import Counter
def resolve():
    S=input()
    c=Counter(S)
    #print(c)
    print((c["g"]-c["p"])//2)
#%%submit!
resolve()

Measured memory_bytes: 39408
#include <bits/stdc++.h>
#include <ext/rope>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#define int long long
#define pb push_back
#define x first
#define y second
#define mk(a,b) make_pair(a,b)
#define rr return 0
#define sqr(a) ((a)*(a))
#define all(a) (a).begin(), (a).end()
#define sz(a) (int)(a).size()

using namespace std;
using namespace __gnu_cxx;
using namespace __gnu_pbds;

using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

template<class value, class cmp = less<value> >
using ordered_set = tree<value, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
template<class value, class cmp = less_equal<value> >
using ordered_multiset = tree<value, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
template<class key, class value, class cmp = less<key> >
using ordered_map = tree<key, value, cmp, rb_tree_tag, tree_order_statistics_node_update>;

/// find_by_order()
/// order_of_key()
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
inline int randll(int l = INT_MIN, int r = INT_MAX) {
    return uniform_int_distribution<int>(l, r)(rng);
}
const int INF = 1e9, MOD = 1e9 + 7; /// think
const ll LINF = 1e18;


const int dx[] = {0, 0, 1, -1}, dy[] = {1, -1, 0, 0};
inline bool inside (int x, int y, int n, int m) {
    return 0 <= x && 0 <= y && x < n && y < m;
}

template<class T> bool umin (T &a, T b) {return a > b ? (a = b, true) : false; }
template<class T> bool umax (T &a, T b) {return a < b ? (a = b, true) : false; }


main()
{
    ios::sync_with_stdio(0);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n;
    ll m;
    cin >> n >> m;
    vector <int> a(n);
    for (auto &i : a) cin >> i;
    ll ans = 0;
    sort(all(a));
    int l = 0, r = 2e5 + 11;
    while (l < r) {
        int mid = (l + r) >> 1;
        ll cnt = 0; /// > mid
        for (int i = 0, j = n - 1; i < n; i++) {
            while (j >= 0 && a[i] + a[j] > mid) {
                --j;
            }
            cnt += n - 1 - j;
        }
        if (cnt < m) r = mid;
        else l = mid + 1;
    }
//    cout << r << '\n';
    ll pref = 0;
    ll cnt = 0; /// > mid
    for (int i = 0, j = n - 1; i < n; i++) {
        while (j >= 0 && a[i] + a[j] > r) {
            pref += a[j];
            --j;
        }
        ans += pref + a[i] * (n - 1ll - j);
        cnt += n - 1 - j;
    }
    ans += (m - cnt) * r;
    cout << ans << '\n';
}


Measured memory_bytes: 3720
#include <bits/stdc++.h>
#define ll long long int
#define pb push_back
#define mp make_pair
#define INF 10000000001
#define MOD 1000000007
using namespace std;


int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ll n;
  cin>>n;
  ll sum=0;
  ll ar[n];
  for(ll i=0;i<n;i++)
  {
    cin>>ar[i];
    sum+=ar[i];
  }
  ll dp[n][n];
  for(int x=0;x<n;x++)
  {
    for(int i=0,j=x;j<n;j++,i++)
    {
      ll a,b,c;
      if(i+2>j)
        a=0;
      else
        a=dp[i+2][j];

      if(i+1>j-1)
        b=0;
      else
        b=dp[i+1][j-1];

      if(i>j-2)
        c=0;
      else
        c=dp[i][j-2];

      dp[i][j]=max(ar[i]+min(a,b),ar[j]+min(b,c));
    }
  }
  ll z=sum-dp[0][n-1];
  cout<<dp[0][n-1]-z;

}


Measured memory_bytes: 70528
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <climits>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <functional>
#include <set>
#include <numeric>
#include <stack>
#include <utility>
#include <time.h>
#include <iterator>
//#include "util.h"

using namespace std;
typedef unsigned uint;
typedef long long lint;
typedef unsigned long long ulint;


//呪文
template <typename _KTy, typename _Ty> ostream& operator << (ostream& ostr, const pair<_KTy, _Ty>& m) { cout << "{" << m.first << ", " << m.second << "}"; return ostr; }
template <typename _KTy, typename _Ty> ostream& operator << (ostream& ostr, const map<_KTy, _Ty>& m) { if (m.empty()) { cout << "{ }"; return ostr; } cout << "{" << *m.begin(); for (auto itr = ++m.begin(); itr != m.end(); itr++) { cout << ", " << *itr; } cout << "}"; return ostr; }
template <typename _Ty> ostream& operator << (ostream& ostr, const vector<_Ty>& v) { if (v.empty()) { cout << "{ }"; return ostr; }	cout << "{" << v.front(); for (auto itr = ++v.begin(); itr != v.end(); itr++) { cout << ", " << *itr; }	cout << "}"; return ostr; }
template <typename _Ty> ostream& operator << (ostream& ostr, const set<_Ty>& s) { if (s.empty()) { cout << "{ }"; return ostr; } cout << "{" << *(s.begin()); for (auto itr = ++s.begin(); itr != s.end(); itr++) { cout << ", " << *itr; }	cout << "}"; return ostr; }
//template <typename T> void print(T* v, int N) { if (N == 0) cout << "{ }"; cout << "{" << v[0]; for (int p = 1; p < N; p++) cout << ", " << v[p]; cout << "}"; }
#define PI 3.14159265358979323846
#define EPS 1e-8
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define all(x) (x).begin(), (x).end()
	


int main() {
	int a[3];
	cin >> a[0] >> a[1] >> a[2];
	sort(a, a + 3);
	if (a[0] == 5 && a[1] == 5 && a[2] == 7)
		cout << "YES";
	else
		cout << "NO";
	cout << endl;
	return 0;
}


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

int main() {
  int A, B, N, K, a, b;
  cin >> A >> B;
  if (A > B){
    N = A;
  }
  else {
    N = B;
  }
  for (int i = 0; i < N; i++){
    a = A - i;
    b = B - i;
    if (a < 0){
      a *= -1;
    }
    if (b < 0){
      b *= -1;
    }
    if (a == b){
      K = i;
    }
  }
  if (K > 0){
    cout << K << endl;
  }
  else {
    cout << "IMPOSSIBLE" << endl;
  }
}


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

int main(){
  char eng;
  cin>>eng;
  if(eng=='a'){
    cout<<"vowel"<<endl;
  }
  else if(eng=='e'){
    cout<<"vowel"<<endl;
  }
  else if(eng=='i'){
    cout<<"vowel"<<endl;
  }
  else if(eng=='o'){
    cout<<"vowel"<<endl;
  }
  else if(eng=='u'){
    cout<<"vowel"<<endl;
  }
  else{
    cout<<"consonant"<<endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <sstream>
#include <algorithm>
#include <math.h>
#include <map>
#include <iomanip>
#include <vector>
#include <queue>
#include <set>

#define PI 3.14159265359

#define INF 1000000;

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

typedef long long ll;

using namespace std;


/*
class ElectronicPetEasy
{
public:
	string isDifficult(int st1, int p1, int t1, int st2, int p2, int t2)
	{
		
	}
};
*/

//  文字列を置換する
std::string Replace( std::string String1, std::string String2, std::string String3 )
{
    std::string::size_type  Pos( String1.find( String2 ) );

    while( Pos != std::string::npos )
    {
        String1.replace( Pos, String2.length(), String3 );
        Pos = String1.find( String2, Pos + String3.length() );
    }

    return String1;
}


int main()
{
	string inp;
	
	getline(cin, inp);
	inp = Replace(inp, "apple", "aaaaa");
	inp = Replace(inp, "peach", "ppppp");
	inp = Replace(inp, "aaaaa", "peach");
	inp = Replace(inp, "ppppp", "apple");
	
	cout << inp << endl;
	
	return 0;
}

Measured memory_bytes: 1192
#include <bits/stdc++.h>
// statics
using namespace std;
using int64 = long long;
using PAIR = pair<int64, int64>;
constexpr int INF = 1 << 30;
constexpr int64 LINF = 1LL << 60;
constexpr int MOD = 1e9 + 7;
constexpr int MAX_N = 3e5 + 1;

// init/input
#define int int64
#define INIT ios::sync_with_stdio(false);cin.tie(0);
#define VAR(type, ...) type __VA_ARGS__;MACRO_VAR_Scan(__VA_ARGS__);
template<typename T> void MACRO_VAR_Scan(T &t) {cin>>t;}
template<typename First, typename...Rest> void MACRO_VAR_Scan(First &first, Rest&...rest) {cin>>first;MACRO_VAR_Scan(rest...);}
#define VEC(type, c, n) vector<type> c(n);for(auto &&i:c)cin>>i;

// out
#define OUT(dist) cout<<(dist);
#define FOUT(n, dist) cout<<fixed<<setprecision(n)<<(dist);
#define SP cout<<" ";
#define BR cout<<endl;
#define zero(n) cout<<setfill('0')<<right<<setw(n)
#define debug(x) cerr<<#x<<":"<< (x);BR;

// utility
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define EACH(i, a) for(auto &&i:(a))
#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)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}

signed main() {
  INIT;

  VAR(int,n,l);
  vector<int> t(n);
  int sm = 0;
  REP(i,n){
    t[i] = l+i;
    sm += t[i];
  }
 


  int ans = 0, mn=0;
  REP(i,n){
    if (abs(t[i]) < abs(t[mn])) {
      mn = i;
    }
  }
  ans = sm - t[mn];
  OUT(ans)BR;

  
  
  return 0;
}


Measured memory_bytes: 256
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 = Integer.parseInt(sc.next());
		long[] a = new long[n];
		for (int i = 0 ; i < n; i++)
			a[i] = Long.parseLong(sc.next());
		Arrays.sort(a);
		int ans = 0;
		for (int i = 0; i < n;) {
			int index = i;
			while (i < n && a[index] == a[i])
				i++;
			if ((i - index) % 2 != 0)
				ans++;
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 50456
#include<stdio.h>
#include<math.h>

typedef struct{
  double x;
  double y;
}Point;

void koch(int, Point, Point);
// Point getPoint(Point, Point, double);

int main(){
  int n;
  Point p1 = {0.0, 0.0};
  Point p2 = {100.0,  0.0};

  scanf("%d",&n);

  printf("%.8f %.8f\n", p1.x, p1.y);
  koch(n, p1, p2);
  printf("%.8f %.8f\n", p2.x, p2.y);

  return  0;
}

void koch(int n, Point p1, Point p2){
  Point s, t, u;
  // double x_len = (p2.x - p1.x) / 3.0;
  // double y_len = (p2.y - p1.y) / 3.0;
  // double len = sqrt(pow(x_len,2) + pow(y_len,2));

  if(n == 0)
  return;

  // s.x = p1.x + x_len;
  // s.y = p1.y + y_len;
  // t.x = p1.x + x_len * 2;
  // t.y = p1.y + y_len * 2;
  // u = getPoint(s, t, len);

  s.x = (2*p1.x + 1*p2.x)/3;
  s.y = (2*p1.y + 1*p2.y)/3;
  t.x = (1*p1.x + 2*p2.x)/3;
  t.y = (1*p1.y + 2*p2.y)/3;
  u.x = (t.x-s.x)*cos(M_PI/3) - (t.y-s.y)*sin(M_PI/3) + s.x;
  u.y = (t.x-s.x)*sin(M_PI/3) + (t.y-s.y)*cos(M_PI/3) + s.y;

  koch(n-1, p1, s);
  printf("%.8f %.8f\n", s.x, s.y);
  koch(n-1, s, u);
  printf("%.8f %.8f\n", u.x, u.y);
  koch(n-1, u, t);
  printf("%.8f %.8f\n", t.x, t.y);
  koch(n-1, t, p2);
}

// Point getPoint(Point s, Point t, double len){
//   Point u;
//
//   if(s.x < t.x){
//     if(s.y == t.y){
//       u.x = s.x + (t.x - s.x)/2.0;
//       u.y = s.y + sin(M_PI/3) * len;
//     }
//     else if(s.y < t.y){
//       u.x = t.x -  len;
//       u.y = t.y;
//     }
//     else if(s.y > t.y){
//       u.x = s.x + len;
//       u.y = s.y;
//     }
//   }
//   else if(s.x > t.x){
//     if(s.y == t.y){
//       u.x = s.x - (s.x - t.x)/2.0;
//       u.y = s.y - sin(M_PI/3) * len;
//     }
//     else if(s.y < t.y){
//       u.x = s.x - len;
//       u.y = s.y;
//     }
//     else if(s.y > t.y){
//       u.x = t.x + len;
//       u.y = t.y;
//     }
//   }
//
//   return u;
// }



Measured memory_bytes: 2104
#include "bits/stdc++.h"
using namespace std;
#define int long long
#define double long double
#define low lower_bound
#define upp upper_bound
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define Rep(i,n) for (int i = (int)(n); i >= 0; i--)
#define all(vec) vec.begin(),vec.end()
#define rever(vec) reverse(all(vec));
#define cend cout << endl;
#define prique(T) priority_queue<T,vector<T>,greater<T>>
#define prique2(T) priority_queue<T>
struct edge { int to, cost; };
using P = pair<int, int>;
using PP = pair<P, int>;
const int mod2 = 998244353;
const int mod = 1e9 + 7, inf = 1e16;

int modpow(int x, int n) {
	int ans = 1;
	while (n > 0) {
		if (n & 1) {
			ans *= x;
			if (mod <= ans) ans %= mod;
		}
		x *= x;
		if (mod <= x) x %= mod;
		n >>= 1;
	}
	return ans;
}

int fact_memo[114514];
int fact(int n) {
	int ans = 1;
	if (fact_memo[n]) return fact_memo[n];
	rep(i, n) {
		ans *= (i + 1);
		if (mod <= ans) ans %= mod;
		fact_memo[i + 1] = ans;
	}
	return (ans + mod) % mod;
}

int comb(int n, int r) {
	if (n < r) return 0;
	if (n - r < r) r = n - r;
	return (fact(n) * modpow(fact(n - r), mod - 2) % mod * modpow(fact(r), mod - 2) + mod) % mod;
}

int perm(int n, int r) {
	if (n < r) return 0;
	if (n - r < r) r = n - r;
	return (fact(n) * modpow(fact(n - r), mod - 2) % mod + mod) % 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);
}

bool pri(int p) {
	for (int i = 2; i * i <= p; i++) if (p % i == 0) return false;
	return p > 1;
}

map<int, int>factring(int n) {
	map<int, int>ans;
	for (int i = 2; i * i <= n; i++) {
		while (n % i == 0) {
			n /= i;
			ans[i]++;
		}
	}
	if (n != 1) ans[n]++;
	return ans;
}

P operator+(const P& a, const P& b) {
	return P(a.first + b.first, a.second + b.second);
}
P operator-(const P& a, const P& b) {
	return P(a.first - b.first, a.second - b.second);
}

int n, q;
int mp[200020];
int cnt[200020];
vector<int>v[200020];
queue<P>que;
bool used[200020];
signed main() {
	scanf("%lld %lld", &n, &q);
	rep(i, n - 1) {
		int a, b;
		scanf("%lld %lld", &a, &b);
		a--; b--;
		v[a].push_back(b);
		v[b].push_back(a);
	}
	rep(i, q) {
		int p, x;
		scanf("%lld %lld", &p, &x);
		p--;
		cnt[p] += x;
	}
	que.push(P(0, cnt[0]));
	mp[0] = cnt[0];
	used[0] = true;
	while (!que.empty()) {
		P p = que.front(); que.pop();
		vector<int> k = v[p.first];
		rep(i, k.size()) {
			if (used[k[i]]) continue;
			mp[k[i]] = p.second + cnt[k[i]];
			que.push(P(k[i], mp[k[i]]));
			used[k[i]] = true;
		}
	}
	rep(i, n) {
		printf("%lld ", mp[i]);
	}
	printf("\n");
}


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

class Main{
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        int m=sc.nextInt();
        long k=sc.nextLong();
        sc.close();
        if(k>=(1<<m)){
            System.out.println(-1);
            return;
        }
        StringBuilder sb=new StringBuilder();
        if(k==0){
            for(int i=0;i<(1<<m);i++){
                for(int j=0;j<2;j++) sb.append(i+" ");
            }
            System.out.println(sb);
            return;
        }
        if(m==1){
            System.out.println(-1);
            return;
        }
        long[] ans=new long[1<<(m+1)];
        int el=0;
        for(int i=0;i<(1<<m);i++){
            if(i==(1<<m)-1){
                ans[(1<<m)-1]=k;
                ans[(1<<(m+1))-1]=k;
            }
            else{
                ans[i]=el;
                ans[(1<<(m+1))-2-i]=el;
                el++;
                if(el==k) el++;
            }
        }
        for(long a:ans) sb.append(a+" ");
        System.out.println(sb);
    }
}

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

#include <ext/pb_ds/assoc_container.hpp> //required
#include <ext/pb_ds/tree_policy.hpp> //required

using namespace __gnu_pbds; 
using namespace std;

template <typename T> using ordered_set =  tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; 
typedef long long  ll;
typedef vector<ll> VL;
typedef vector<int> VI;
typedef pair<ll,ll> PLL;
typedef pair<int,int> PII;
#define pb push_back

#define F first
#define S second
#define ALL(a) a.begin(),a.end()
#define fr(i,x,y) for(ll i=x;i<y;i++)
#define frr(i,x,y) for(ll i=x-1;i>=y;i--)
#define inf 10000000000000000
const ll mod=998244353;
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}

void solve()
{
    ll n;
    cin>>n;
    map<string,ll> mp;
    fr(i,0,n)
    {
        string str;
        cin>>str;
        mp[str]=1;
    }
    cout<<mp.size()<<endl;
}
int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    ll t=1;
    //cin>>t;
    while(t--)
    {
    	solve();
    }
	return 0;
}

Measured memory_bytes: 19204
n=int(input())
s=[input() for i in range(n)]
m,a,r,c,h=0,0,0,0,0
for i in range(len(s)):
    x=s[i][0]
    if x=="M":m+=1
    elif x=="A":a+=1
    elif x=="R":r+=1
    elif x=="C":c+=1
    elif x=="H":h+=1
print(m*a*r+m*a*c+m*a*h+m*r*c+m*r*h+m*c*h+a*r*c+a*r*h+a*c*h+r*c*h)


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

public class Main {
	public static void main(String[] args) {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    
		String x = "";
		try {
			x = in.readLine();
		} catch (NumberFormatException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		int time = Integer.parseInt(x);
		
		int s = time % 60;
		time = time / 60;
		int m = time % 60;
		int h = time / 60;
		
		System.out.println(h + ":" + m + ":" + s);
	}
}

Measured memory_bytes: 24488
A,B,M=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
nooff=sorted(a)[0]+sorted(b)[0]
withoff=[]
for i in range(M):
  x,y,c=map(int,input().split())
  off=a[x-1]+b[y-1]-c
  withoff.append(off)
print(min(sorted(withoff)[0],nooff))

Measured memory_bytes: 24752
#include <iostream>

using namespace std;

int N;
string s;
int main(void) {
	while (cin >> N && N) {
		cin >> s;
		int i;
		for (i = 0; i < N - 1; i++) {
			if (s[i] == 'x' && s[i+1] == 'x') break;
		}
		cout << i + 1 << endl;
	}
}

Measured memory_bytes: 3280
#include<bits/stdc++.h>
using namespace std;
void solve() {
	int n;
	cin >> n;
	if (n >= 30) {
		cout << "Yes";
	}
	else {
		cout << "No";
	}
}
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	solve();
}

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

using namespace std;
using ll = long long;

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

  int a, b, c, d;
  cin >> a >> b >> c >> d;
  int turn = 1;

  while (a > 0 && c > 0) {
    if (turn == 1) {
      c -= b;
    } else {
      a -= d;
    }
    turn *= -1;
  }
  if (c <= 0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }

  return 0;
}


Measured memory_bytes: 3664
#include <stdio.h>

int main(){
    int N, Q;
    int n = 0;
    int l, r;
    scanf("%d %d", &N, &Q);
    char s[N];
    int t[N];
    scanf("%s", s);
    t[0]=0;
    for ( int i = 0; i < N-1 ; i++ ){
        if (s[i]=='A' && s[i+1] =='C'){
            n++;
        }
        t[i+1]=n;
    } 
    for ( int i = 0; i < Q ; i++ ){
        scanf("%d %d", &l, &r);
        printf("%d\n", t[r-1] - t[l-1]);
    }
}


Measured memory_bytes: 1280
/*
                                Author: Ankit Kaul
**********************Code Belongs to Respective Author Only************************************
*/
 
/*#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")*/
 
#include <bits/stdc++.h>
 
#define endl       '\n'
#define PI          3.141592653589
#define jaldi       ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define M           1000000007
#define int         long long int
#define inf         INT_MAX
#define pb          emplace_back
#define pf          emplace_front
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define rall(a)     (a).rbegin(),(a).rend()
using namespace std;
 
int gcd(int a,int b) { return b == 0 ? a : gcd(b, a % b); }
int power(int x,int n){
    int result=1;
    while(n>0)
    {
        if(n % 2 ==1)
            result=(result * x) % M;
        x=(x*x)% M;
        n=n/2;
    }
    return result % M;
}
int factorial(int n) 
{ 
    if (n == 0) 
    return 1; 
    return n * factorial(n - 1); 
} 
signed main()
{   jaldi
	int n,i;
	cin>>n;
	int a[n],b[n];
	for(i=0;i<n;i++)
	cin>>a[i]>>b[i];
	double sum=0,s=0;
	int f=factorial(n);
	double g=factorial(n-1);
	g*=2;
	for(i=0;i<n-1;i++)
	{	for(int j=i+1;j<n;j++)
		{	s=(double)sqrt(abs(power((a[i]-a[j]),2)+power((b[i]-b[j]),2)));				
			sum+=(double)s;
		}		
	}
	sum=(sum*2)/(n);
	cout<<fixed<<setprecision(7)<<sum;
}

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

typedef struct parttime{
  int day;
  int money;
}pt;

int cmp_day(const void *x, const void *y) {
  int xd = ((pt *)x)->day, yd = ((pt *)y)->day;
  if (xd == yd) return ((pt *)y)->money - ((pt *)x)->money;
  return xd - yd;
}

void msort(pt *A, pt *B, int left, int right) {
  if (left != 0) {
    int i=0, j=left, k=0;
    while (i<left && j<right+left) {
      if (A[i].money > A[j].money) {
        B[k++] = A[i++];
      } else {
        B[k++] = A[j++];
      }
    }
    if (i == left) {
    while (j < right+left) {
        B[k++] = A[j++];
      }
    } else {
      while (i < left) {
        B[k++] = A[i++];
      }
    }
    for (int l = 0; l < k; l++) {
      A[l] = B[l];
    }
  }
}

int main() {
  int n, m, ans = 0;
  scanf("%d%d", &n, &m);
  pt c[n], b[n]; int d[100001];
  for (size_t i = 0; i < n; i++) {
    scanf("%d%d", &(c+i)->day, &(c+i)->money);
  }
  qsort(c, n, sizeof(pt), cmp_day);
  for (int i=0; i<m+1; i++) d[i] = 0;
  for (int i=0; i<n; i++) {
    if (c[i].day > m) break;
    d[c[i].day] = i+1;
  }
  for (int i=1; i<m+1; i++) if (d[i] == 0) d[i] = d[i-1];
  int j=0;
  for (int i=1; i<m+1; i++) {
    if (j>=d[i]) continue;
    if (d[i] != d[i-1]) msort(c+j, b, d[i-1]-j, d[i]-d[i-1]);
    ans += c[j].money;
    j++;
  }
  printf("%d\n", ans);
  return 0;
}


Measured memory_bytes: 2164
program tenquestionfour
 implicit none
 integer A, B, C, X, i, j, k, res
 read(*,*) A
 read(*,*) B
 read(*,*) C
 read(*,*) X
 ! read(*,*) A, B, C, X でよい
 res = 0
 do i=0,A
  do j=0,B
   do k=0,C
   if ((500*i + 100*j + 50*k).eq.X) res = res + 1
   if ((500*i + 100*j + 50*k).gt.x) exit 
   end do
   if ((500*i + 100*j).gt.x) exit
  end do
  if ((500*i).gt.x) exit
 end do
 write(*,*) res
end program

Measured memory_bytes: 256
#include <stdio.h>
#define N 200

int check(long a[], int n)
{
	for (int i = 0; i < n; i++){
		if (a[i] % 2 == 1) return 1;
	}
	return 0;
}

int main(void)
{
	long a[N];
	int n, i, cnt;
	cnt = 0;
	scanf("%d", &n);
	for (i = 0; i < n; i++){ scanf("%ld", &a[i]); }
	while (!check(a, n)){
		for (i = 0; i < n; i++){
				a[i] /= 2;
			}
		cnt++;
	}
	printf("%d\n", cnt);
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;


int main(int argc, const char * argv[]) {

    int a,b,c;
    cin >> a >> b >> c;
    
    if(c >= a && c <= b){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    
    return 0;
}


Measured memory_bytes: 256
// https://atcoder.jp/contests/dp/tasks/dp_a
#include <bits/stdc++.h>
using namespace std;

int main() {
  int N;
  cin >> N;
  int arr[N], ans[N] = {0};

  for (int i = 0; i < N; ++i)
    cin >> arr[i];

  ans[1] = abs(arr[1]-arr[0]);
  
  for (int i = 2; i < N; ++i)
    ans[i] = min(ans[i - 2] + abs(arr[i - 2] - arr[i]),
                 ans[i - 1] + abs(arr[i - 1] - arr[i]));

  cout << ans[N-1] << endl; 
}


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

int main(){

  int N, M;
  cin >> N >> M;
  int a[M], b[M], c[N+1];
  for(int i=0; i<M; i++){
    cin >> a[i] >> b[i];
  }

  for(int i=1; i<N+1; i++){
    c[i] = 0;
  }

  for(int i=0; i<M; i++){
    c[a[i]]++;
    c[b[i]]++;
  }

  for(int i=1; i<N+1; i++){
    cout << c[i] << endl;
  }
  return 0;

}


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

public static class P {
    public static void Main() {
        char c=Console.ReadLine()[0];
        char ans='$';
        if(c=='A')ans='T';
        if(c=='T')ans='A';
        if(c=='C')ans='G';
        if(c=='G')ans='C';
        Console.WriteLine(ans);
    }
}


Measured memory_bytes: 11092
#include<bits/stdc++.h>
#define mo 1000000007
#define pi 3.1415926535898 
using namespace std;
long long read(){
    long long xx=0,flagg=1;
    char ch=getchar();
    while((ch<'0'||ch>'9')&&ch!='-')
        ch=getchar();
    if(ch=='-'){
        flagg=-1;
        ch=getchar();
    }
    while(ch>='0'&&ch<='9'){
        xx=xx*10+ch-'0';
        ch=getchar();
    }
    return xx*flagg;
}
void pus(long long xx,long long flagg){
    if(xx<0){
        putchar('-');
        xx=-xx;
    }
    if(xx>=10)
        pus(xx/10,0);
    putchar(xx%10+'0');
    if(flagg==1)
        putchar(' ');
    if(flagg==2)
        putchar('\n');
    return;
}
long long ksm(long long u,long long v){
	long long o=1;
	while(v){
		if(v&1)
			o=o*u%mo;
		u=u*u%mo;
		v>>=1;
	}
	return o;
}
int n,i,a[100005];
int gcd(int u,int v){
	if(v==0) return u;
	return gcd(v,u%v);
}
int ss(int v){//0->先手必胜
	int sum=0,flag=0;
	for(i=1;i<=n;i++){
		sum+=a[i]-1;
		if(a[i]==1)
			flag=1;
	}
	if(flag==1){
		if(sum&1)
			return v;
		else
			return v^1;
	}
	sum=0;
	for(i=1;i<=n;i++)
		if((a[i]&1)==0)
			sum++;
	if(sum&1)
		return v;
	else if(n-sum>1)
		return v^1;
	for(i=1;i<=n;i++)
		if(a[i]&1){
			a[i]--;
			break;
		}
	flag=a[1];
	for(i=2;i<=n;i++)
		flag=gcd(flag,a[i]);
	for(i=1;i<=n;i++)
		a[i]/=flag;
	return ss(v^1);
}
int main(){
    //freopen(".in","r",stdin);
    //freopen(".out","w",stdout);
   	n=read();
   	for(i=1;i<=n;i++)
   		a[i]=read();
   	if(ss(0)==0)
   		printf("First\n");
   	else
   		printf("Second\n");
    return 0;
}

Measured memory_bytes: 640
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(1000000)

def solve(N: int, u: "List[int]", v: "List[int]", w: "List[int]"):
    col = [-1 for _ in range(N+1)]
    G = [[] for _ in range(N+1)]
    for i in range(N-1):
        G[u[i]].append((v[i], w[i]))
        G[v[i]].append((u[i], w[i]))

    def dfs(p, c, cnt):
        if cnt == N:
            return
        for np, dis in G[p]:
            if col[np] == -1:
                cnt += 1
                if dis%2 == 0:
                    col[np] = c
                    dfs(np, c, cnt)
                else:
                    nc = 1 - c
                    col[np] = nc
                    dfs(np, nc, cnt)

    col[1] = 0
    dfs(1, 0, 0)
    for elem in col[1:]:
        print(elem)


    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    u = [int()] * (N-1)  # type: "List[int]" 
    v = [int()] * (N-1)  # type: "List[int]" 
    w = [int()] * (N-1)  # type: "List[int]" 
    for i in range(N-1):
        u[i] = int(next(tokens))
        v[i] = int(next(tokens))
        w[i] = int(next(tokens))
    solve(N, u, v, w)

if __name__ == '__main__':
    main()


Measured memory_bytes: 94108
#include <iostream>
#include <cstdio>
#include <fstream>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <limits.h>
#include <math.h>
#include <functional>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <float.h>
#include <random>

#define repeat(i,n) for (int i = 0; (i) < (n); ++ (i))
#define debug(x) cerr << #x << ": " << x << '\n'
#define debugArray(x,n) for(long long hoge = 0; (hoge) < (n); ++ (hoge)) cerr << #x << "[" << hoge << "]: " << x[hoge] << '\n'
#define debugArrayP(x,n) for(long long hoge = 0; (hoge) < (n); ++ (hoge)) cerr << #x << "[" << hoge << "]: " << x[hoge].first<< " " << x[hoge].second << '\n'

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> Pii;
typedef vector<int> vint;
typedef vector<ll> vll;
const ll INF = LLONG_MAX/2;
const ll MOD = 1e9+7;

int N;
double dp[310][310][310];
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin>>N;
  for(int i=1;i<=N;i++){
    for(int j=0;j<=i;j++){
      for(int k=0;k<=j;k++){
        dp[i][j][k] += N;
        dp[i][j][k] += dp[i-1][j][k]*(i-j);
        if(j>0)dp[i][j][k] += dp[i][j-1][k]*(j-k);
        if(k>0)dp[i][j][k] += dp[i][j][k-1]*k;
        dp[i][j][k] /= i;
        //debug(dp[i][j][k]);
      }
    }
  }
  int cnt[3]={0,0,0};
  repeat(i,N){
    int a;cin>>a;
    switch(a){
      case 3:cnt[2]++;
      case 2:cnt[1]++;
      case 1:cnt[0]++;
    }
  }
  printf("%.10lf\n",dp[cnt[0]][cnt[1]][cnt[2]]);
  return 0;
}


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

int main(){
    int D,G,ans=1e9;
    cin >> D >> G;
    vector<int> p(D),c(D);

    for (int i=0;i<D;++i){
        cin >> p[i] >> c[i];
    }

    for (int mask=0;mask < (1<<D);++mask){
        int s = 0,num=0,rest_max=-1;
        for (int i=0;i<D;++i){
            if(mask >> i & 1) {s+=100*(i+1)*p[i]+c[i];
            num += p[i];}
            else{
                rest_max = i;
            }
        }
        if (s<G){
            int s1 = 100*(rest_max+1);
            int need = (G - s + s1 - 1) / s1;
            if(need >= p[rest_max]){
                continue;
            }
            num += need;
        }
        ans = min(ans,num);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

/**
 * https://abc051.contest.atcoder.jp/tasks/abc051_b
 */
public class Main {

	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		int K = sc.nextInt();
		int S = sc.nextInt();
		sc.close();
		
		long ans = 0;
		for(int x=0; x<=K; x++){
			for(int y=0; y<=K; y++){
				int z = S-(x+y);
				if(z>=0 && z<=K) ans++;
			}
		}
		
		System.out.println(ans);

	}

}

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

    class Program
    {
        static void Main(string[] args)
        {
            string line1 = Console.ReadLine();
            string line2 = Console.ReadLine();
            string line3 = Console.ReadLine();
            string line4 = Console.ReadLine();

            int N = int.Parse(line1);
            List<int> A = new List<int>(line2.Split(' ').Select((arg) => int.Parse(arg)));
            List<int> B = new List<int>(line3.Split(' ').Select((arg) => int.Parse(arg)));
            List<int> C = new List<int>(line4.Split(' ').Select((arg) => int.Parse(arg)));

            int point = 0;

            for(int i = 0; i < A.Count; i++)
            {
                point += B[A[i] - 1];
                if (i > 0)
                {
                    if (A[i] - A[i - 1] == 1)
                    {
                        point += C[A[i - 1] - 1];
                    }
                }
            }

            // List<int> Nums = new List<int>(line1.Split(' ').Select((arg) => int.Parse(arg)));

            Console.Write(point);

        }
    }


Measured memory_bytes: 13268
#include <iostream>
#include <sstream>
#include <stack>
using namespace std;
int main( void )
{
	while ( cin.eof() == false )
	{
		stack <double> s;

		string input;
		getline( cin, input );
		if ( cin.eof() ) break;

		string token;
		istringstream is( input );
		while ( is >> token )
		{
			istringstream is2( token );
			istringstream is3( token );
			int n;
			char c;
			if ( is2 >> n )
			{
				s.push( n );
			}
			else if ( is3 >> c )
			{
				double n1 = s.top();
				s.pop();
				double n2 = s.top();
				s.pop();
				double n3 = 0.0;

				if ( c == '+' )
				{
					n3 = n2 + n1;
				}
				else if ( c == '-' )
				{
					n3 = n2 - n1;
				}
				else if ( c == '*' )
				{
					n3 = n2 * n1;
				}
				else if ( c == '/' )
				{
					n3 = n2 / n1;
				}

				s.push( n3 );
			}
		}

		double answer = 0.0;
		if ( s.empty() == false )
		{
			answer = s.top();
		}
		cout.setf( ios::fixed );
		cout.precision( 6 );
		cout << answer << endl;
	}
	return 0;
}

Measured memory_bytes: 0
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<queue>
#include<map>
#define rep(index,num) for(int index=0;index<num;index++)
#define rep1(index,num) for(int index=1;index<=num;index++)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-15
typedef long long ll;
using namespace std;
typedef pair<int,int> pint;
typedef vector<int> vint;
int INF=2e+9+1;
int main(){
	string S;
	scan(S);
	int N=S.size();
	int K;
	if(N%2) K=(N+1)/2;
	else K=N/2+1;
	char samemoji=S[N-K];
	while(K<=N){
		if(S[N-K]==samemoji&&S[K-1]==samemoji){
			if(K<N) K++;
			else break;
		}
		else{
			K--;
			break;
		}
	}
	prin(K);

	return 0;
}


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

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

    std::vector<int> v(N);
    for (int i = 0; i < N; i++) {
        std::cin >> v[i];
    }

    std::sort(v.begin(), v.end());

    double sum = (v[0] + v[1]) / 2.0;
    for (int i = 2; i < N; i++) {
        sum = (sum + v[i]) / 2.0;
    }

    std::cout << sum << std::endl;

    return 0;
}

Measured memory_bytes: 3764
(defparameter mod-number 1000000007)

(defun unfold (p f g seed &optional (tail-gen (lambda () '())))
  (if (p seed)
      (tail-gen seed)
	  (cons (f seed)
	        (unfold p f g (g seed) tail-gen))))
  
(defun iota (c &optional (s 0) (step 1) (acc nil))
  (if (zerop c)
      (reverse acc)
      (iota (1- c) (+ s step) step (cons s acc))))
 
(defun sum (list &optional (init 0))
  (reduce #'+ list :initial-value init))
 
(defmacro debug-print (x)
  `(let ((y ,x))
    (format t "~A: ~A~%" ',x y)
	y))

(defparameter a (read))
(defparameter b (read))

(format t "~A~%"
        (cond 
          ((>= a 13) b)
          ((>= a 6) (/ b 2))
          (t 0)))



Measured memory_bytes: 12776
N = int(input())

# 各位の値を足し算する処理
def sum_each_digit(n):
    total = 0
    while n > 0:
        total += n % 10
        n //= 10
    return total


if N % sum_each_digit(N) == 0:
    result = 'Yes'
else:
    result = 'No'

print(result)


Measured memory_bytes: 2940
x=[1,3,5,7,8,10,12]
y=[4,6,9,11]
z=[2]

a,b=map(int,input().split())

if (a in x and b in x) or (a in y and b in y) or (a in z and b in z):
    print("Yes")
else:
    print("No")


Measured memory_bytes: 3064
#include <bits/stdc++.h>
 
using namespace std;
typedef long long ll;
typedef vector<int> VI;
ll mm=1000000000;ll MM=mm+7;
#define rep(i, n) for(int i=0;i<n;i++)
#define PI 3.141592653589793
 

int main(){
    string s;
    cin >> s;
    int n=s.size();
    if(s.at(n-1)=='s'){
        cout << s << "es" << endl;
    }
    else{
        cout << s << 's' << endl;
     }
}


Measured memory_bytes: 3628