akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <boost/range/adaptors.hpp>
#include <boost/multiprecision/cpp_int.hpp>

using namespace std;
using ll = long long;
using ld = long double;
using ml = boost::multiprecision::cpp_int;

namespace NyaGadget
{
	/*** DFSライブラリ***/

#define fori(i, ...) if(ll i = -1) for(__VA_ARGS__) if(i++, true)
#define each(i, e, v) fori(i, auto& e: v)

	struct DFSnode
	{	// DFS NODE
		ll r = 0;  // root node
		ll s = 0;  // self node
	};

	struct DepthFirstSearchSample
	{	// これはテスト構造体なので、新しく定義すること。
		vector<ll> ans;
	};

	void DepthFirstSearchTest(DFSnode n, DepthFirstSearchSample& v)
	{	// これはDFS::Runの第三引数Updateの一例なので、新しく定義すること。
		v.ans[n.s] = v.ans[n.r] + 1;
	}

	struct DFS
	{
		using Edge = vector<ll>;
		vector<Edge> graph;

		DFS(ll size) { graph.resize(size); }
		vector<ll>& operator [](int n) { return graph[n]; }

		/**
		@brief 辺を追加する関数
		@note
		 頂点v1とv2を結ぶ辺を追加する。
		**/
		void CreateEdge(ll v1, ll v2)
		{	// 後戻りも出来るようにv1->v2とv2->v1の両方の辺を追加する
			graph[v1].push_back(v2);
			graph[v2].push_back(v1);
		}

		/**
		@brief 実行関数
		@param snode 開始ノード
		@param v 各ノード処理に必要な変数
		@param Update ノード毎の処理を定義した関数
		@note
		 大抵の場合、開始ノードは{0, 0}で良い。
		 Updateの処理に根と自身の頂点index情報が必要なので第一引数はDFSnodeにする。
		 頂点index情報以外で必要な変数はvで渡し、Updateの第二引数と変数vは同じ型にする。
		**/
		template <class T> void
		Run(DFSnode snode, T& v, function<void(DFSnode, T&)> Update)
		{
			Update(snode, v);

			each(i, e, graph[snode.s])
			{	// 後戻りしないようにする
				if (e == snode.r)
					continue;

				Run<T>({snode.s, e}, v, Update);
			}
		}
	};

#undef fori
#undef each

}

#define all(collection) (collection).begin(), (collection).end()              // begin to end
#define divc(a, b) ceil((ld) a / (ld) b);                                     // div ceiling
#define rep(i, begin, end) for (ll i = begin; i < end; i++)                   // repeat
#define repr(i, begin, end) for (ll i = begin; end < i; i--)                  // repeat reverse
#define size(collection) ((ll) (collection).size())                           // collection size
#define sum(begin, end) accumulate(all(begin, end), 0LL)                      // accumulate 
/********** const value **********/
#define llong_max 9223372036854775807                                         // 9 * 10^18
#define mod 1000000007                                                        // 1e9 + 7
#define pi 3.14159265                                                         // 3.14 ...
/********** for each macro **********/
#define fori(i, ...) if(ll i = -1) for(__VA_ARGS__) if(i++, true)
#define each(i, e, v) fori(i, auto& e: v)
#define forir(i, ...) if(ll i = size(v)) for(__VA_ARGS__) if(i--, true)
#define eachr(i, e, v) forir(i, auto& e: boost::adaptors::reverse(v))

using namespace NyaGadget;

struct DFSV
{
	vector<ll> ans;
	vector<ll> memo;
};

void DFSF(DFSnode n, DFSV& v)
{
	v.ans[n.s] = v.ans[n.r] + v.memo[n.s];
}

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

	ll x = n / 1.08;



	if ((ll)((double)x * 1.08) != (ll)n && (ll)((double)(x + 1) * 1.08) != (ll)n)
		cout << ":(";
	else
	{
		if ((ll)((double)(x + 1) * 1.08) == (ll)n)
			cout << x + 1;
		else
			cout << x;
	}

	return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner reader = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
		int A, B, x;
		A = reader.nextInt();
		B = reader.nextInt();
		x = A + B;
		if((x & 1) == 0)
			System.out.println(x/2);
		else
			System.out.println("IMPOSSIBLE");
	}

}


Measured memory_bytes: 21844
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<array>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<functional>
#include<limits>
#include<list>
#include<map>
#include<numeric>
#include<set>
#include<stack>
#include<string>
#include<sstream>
#include<queue>
#include<vector>
using namespace std;

using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;

#define dump(o) { cerr << #o << " " << o << endl; }
#define dumpc(o) { cerr << #o; for (auto &e : (o)) cerr << " " << e; cerr << endl; }
#define MOD 1000000007
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL

signed main() {
	int N; cin >> N;
	vector<int> a(N);
	int sum = 0;
	for (int i = 0; i < N; i++) {
		cin >> a[i];
		sum += a[i];
	}
	int ave = sum / N;
	int ans = INF;
	int tmp = 0;
	for (int i = 0; i < N; i++) {
		tmp += (a[i] - ave)*(a[i] - ave);
	}
	ans = min(ans, tmp); tmp = 0;
	for (int i = 0; i < N; i++) {
		tmp += (a[i] - ave + 1)*(a[i] - ave + 1);
	}
	ans = min(ans, tmp); tmp = 0;
	for (int i = 0; i < N; i++) {
		tmp += (a[i] - ave - 1)*(a[i] - ave - 1);
	}
	ans = min(ans, tmp); tmp = 0;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<queue>
#include<vector>
#include<stack>
#include<math.h>
#include<stdint.h>
#include<memory.h>
#include<deque>
#include<string.h>
#include<stdio.h>
#include<algorithm>
#include<bitset>
int main(){
    char s[20];
    scanf("%s",s);
    if('a'<=s[0]&&s[0]<='z')printf("a");
    else printf("A");
}



Measured memory_bytes: 1616
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double db;
typedef pair<int,int> pii;
const int N=10000;
const db pi=acos(-1.0);
#define lowbit(x) (x)&(-x)
#define sqr(x) (x)*(x)
#define rep(i,a,b) for (register int i=a;i<=b;i++)
#define per(i,a,b) for (register int i=a;i>=b;i--)
#define fir first
#define sec second
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define maxd 998244353
#define eps 1e-8
#define iter multiset<int>::iterator
int m,n,goal[(1<<18)+5],now[(1<<18)+5];
multiset<int> s;

int read()
{
    int x=0,f=1;char ch=getchar();
    while ((ch<'0') || (ch>'9')) {if (ch=='-') f=-1;ch=getchar();}
    while ((ch>='0') && (ch<='9')) {x=x*10+(ch-'0');ch=getchar();}
    return x*f;
}

int main()
{
	m=read();n=(1<<m);
	rep(i,1,n) goal[i]=read();
	rep(i,1,n) s.insert(goal[i]);
	iter tmp=s.end();tmp--;now[1]=*tmp;s.erase(tmp);
	int len=1;
	//cout << goal[1] << endl;
	rep(i,1,m)
	{
		int pre=len;
		rep(j,1,pre)
		{
			iter it=s.lower_bound(now[j]);
			if (it==s.begin())
			{
				puts("No");
				return 0;
			}
			else
			{
				it--;int tmp=*it;
				s.erase(it);
				now[++len]=tmp;
			}
		}
		sort(goal+1,goal+1+len);
		reverse(goal+1,goal+1+len);
		//rep(j,1,len) cout << now[j] << " ";cout << endl;
	}
	puts("Yes");
	return 0;
}

Measured memory_bytes: 14592
//code by parshuram_84
#include <bits/stdc++.h>
#define floop(i,a,n) for (int i=a;i<n;i++)
#define pii pair<int,int>
#define pll pair<long long,long long>
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);cout.precision(dbl::max_digits10);
#define pb push_back
#define mod 1000000007 //998244353
#define ll long long
#define vi vector<int>
#define vll vector<long long>
#define vvl vector<vector<long long> >
#define vp vector<pair<long long,long long>>
#define vpp vector<pair<pair<long long,long long>,long long>>
#define mp make_pair
#define all(c) c.begin(),c.end()
#define tr(container, it) \
for(typeof(container.begin()) it = container.begin();it != container.end(); it++)
typedef std::numeric_limits< double > dbl;
using namespace std;
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
ll ncr(ll n,ll r) { ll p=1,k=1; if(n-r<r) r=n-r; if(r!=0) {while(r!=0) {p*=n; k*=r; ll temp=gcd(p,k); p/=temp; k/=temp; n--; r--;} } else p=1; return p;}
ll pm(ll x,ll n) {ll result=1; while(n>0){if(n%2==1) result=((result%mod)*(x%mod))%mod; x=((x%mod)*(x%mod))%mod; n/=2;} return result;}
ll p(ll x,ll n) {ll result=1; while(n>0){if(n%2==1) result=result*x; x=x*x; n/=2;} return result;}
ll factorial[300000+1];
void fact(ll n) { factorial[0]=1; factorial[1]=1; floop(i,2,n+1) factorial[i] = (i * factorial[i-1]%mod) % mod; }


int32_t main() {
	IOS;
	ll t,i,j,k,n,x,y,z;
	string s;
	cin>>n;z=0;
	fact(2000);
	for(i=1;i<=n/3;i++)
	{
		x=n-3*i+i-1;
		y=(factorial[x]*pm(factorial[i-1],mod-2))%mod;
		y=(y*pm(factorial[x-i+1],mod-2))%mod;
		z+=y;
		z%=mod;
	}
	cout<<z;
	return 0;
}

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

//#define DEBUG

using namespace std;

template <class T>
void print_vect(std::vector<T> v){
    for(int i = 0 ; i < v .size(); i++) cout << v[i] << " ";
    cout << endl;
}


void func_to_create(){
    double A, B, H, M;
    cin >> A >> B >> H >> M;
    double alpha1, alpha2;
    alpha1 = ( H + M / 60.0 ) * 2 * M_PI / 12;
    alpha2 = M / 60.0 * 2 * M_PI;
    double alpha = alpha1 - alpha2;

    double length = (A * A + B * B - 2 * A * B * cos(alpha));
    length = sqrt(length);
    printf("%.15lf\n", length);

}
int main()
{
    //making data IO Fast
    // std::ios_base::sync_with_stdio(false);
    // std::cin.tie(NULL);
    /****************************/

    #ifdef DEBUG
    int TEST_CASES = 2;
    while(TEST_CASES--){
    #endif // DEBBUG

    func_to_create();

    #ifdef DEBUG
    }
    #endif // DEBUG
    
    return 0;
}


Measured memory_bytes: 4248
#include<iostream>

#define MAXN 100000
#define MAXQ 50000

using namespace std;

int n,q;
int S[MAXN+1],T[MAXQ+1];
int cnt=0;

bool binarySearch( int lo, int hi, int num )
{
	bool res=false;
	int mi;
	
	while( lo <= hi ) {
		mi=(lo+hi)/2;
		if( num < S[mi] ) {
			hi=mi-1;
		} else if( S[mi] < num ) {
			lo=mi+1;
		} else {
			res=true;
			break;
		}
	}
	

	return res;
}

int main()
{
	cin>>n;
	for( int i=0; i<n; i++ ) {
		cin>>S[i];
	}

	cin>>q;
	for( int i=0; i<q; i++ ) {
		cin>>T[i];
		cnt += binarySearch( 0, n, T[i] );
	}
	cout<<cnt<<endl;
	
    return 0;
}

Measured memory_bytes: 1744
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define ll          long long
#define pb          push_back
#define eb 			emplace_back
#define mp 			make_pair
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define vii         vector<pii>
#define mi          map<ll,ll>
#define mii         map<pii,ll>
#define all(a)      (a).begin(),(a).end()
#define fi          first
#define si          second
#define sz(x)       (ll)x.size()
#define endl        '\n'
#define checkbit(n, b) ((n >> b) & 1)
#define mod        1000000007
#define inf        1000000000000000000
#define puts(n)		cout<<n;
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define setbits(x) __builtin_popcount(x)
#define mset(m,v) memset(m,v,sizeof(m))
using namespace std;
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	ll x;
	cin>>x;
	for(ll i=1;i<=360;i++){
		if( (x*i)%360 == 0) {
			cout<<i;
			return 0;
		}
	}
	
	return 0;
}

Measured memory_bytes: 3604
n = int(input())
s1 = list(input())
s2 = list(input())

MOD = 1000000007
if s1[0] == s2[0]:
    ans = 3
    vertical = True
    i = 1
else:
    ans = 6
    vertical = False
    i = 2
while i < n:
    if s1[i] == s2[i]:
        if vertical:
            ans *= 2
        vertical = True
        i += 1
    else:
        if vertical:
            ans *= 2
        else:
            ans *= 3
        vertical = False
        i += 2
    ans %= MOD
print(ans)

Measured memory_bytes: 38384
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define repone(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define Rep(j,n) for(int j=0;j<(int)(n);++j)
#define Repo(j,o,n) for(int j=o;j<(int)(n);++j)
#define Repone(j,n) for(int j=1;j<(int)(n);++j)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define int long long
#define pb(a) push_back(a)
#define eraser(v,i) (v).erase(v.begin()+(i))
#define pbpair(a,b) push_back(make_pair(a,b))
#define MOD 1000000007
#define MODB 998244353
#define INF 9223372036854775807
bool compare_by_b(pair<int, int> a, pair<int, int> b) {
    if(a.second != b.second){
        return a.second < b.second;
    }else{
        return a.first < b.first;
    }
}
signed main()
{
  int x=0,y=0,z=0,w=0,n=0,m=0;
std::cin >> x;
std::vector<int> v(100003);
rep(i,x){
  std::cin >> y;
  v[y]++;
  v[y+1]++;
  v[y+2]++;
}
sort(rall(v));
std::cout << v[0] << '\n';
}

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

int gcd(int x,int y);
int lcm(int x,int y);

int main(){
  int a,b;
  while(scanf("%d %d",&a,&b) != EOF)
    {
      cout << gcd(a,b) <<" "<<lcm(a,b)<<endl;
    }
  return 0;
}

int gcd(int x,int y){
  int z;
  while(y != 0){
  z = x%y; 
  x = y;
  y = z;
  }
  return x;
}

int lcm(int x,int y){

  return x/gcd(x,y)*y;

}

Measured memory_bytes: 1208
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int X = stdIn.nextInt();
		int Y = stdIn.nextInt();
		int sum = 0;
		
		if(X == 1)sum+=300000;
		else if(X == 2)sum+=200000;
		else if(X == 3)sum+=100000;
		
		if(Y == 1)sum+=300000;
		else if(Y == 2)sum+=200000;
		else if(Y == 3)sum+=100000;
		
		if(X == 1 && Y == 1)sum+=400000;
		
		System.out.println(sum);

	}

}

Measured memory_bytes: 23124
n = int(input())
a = list(map(int,input().split()))
even = []
odd = []
b = []
for i in range(n):
    if (i+1) % 2 == 0:
        even.append(i+1)
    else:
        odd.append(i+1)
if n%2 == 0:
    even.reverse()
    for x in even:
        b.append(x)
    for x in odd:
        b.append(x)
else:
    odd.reverse()
    for x in odd:
        b.append(x)
    for x in even:
        b.append(x)
ans = ""
for x in b:
    ans += str(a[x-1]) + " "
print(ans[:-1])

Measured memory_bytes: 29624
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
const int mod = 1e9+7;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;
int main(){
    cout << fixed << setprecision(10);
    int n;
    cin >> n;
    vector<ll> v(n);
    rep(i,n) cin >> v[i];
    ll ans = 0;
    ll now = 0;
    for(int i=0;i<n-1;i++){
        int j = i;
        now = 0;
        while(j+1<n){
            if(v[j+1]<=v[j]) now++;
            else break;
            j++;
        }
        ans = max(now,ans);
        i = j;
    }
    cout << ans << endl;
    return 0;
}

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

const int maxn=100010;

int color[maxn];///记录连通块序号
//bool vis[maxn];///记录是否访问
vector<int> G[maxn];
int n,m,q;

void DFS(int u,int id){
    color[u]=id;
    for(int i=0;i<G[u].size();i++){
        int v=G[u][i];
        if(color[v]==-1){
            color[v]=id;
            DFS(v,id);
        }
    }
    return ;

}

int main(){
    int u,v;
    memset(color,-1,sizeof(color));
 //   memset(vis,0,sizeof(vis));
    scanf("%d%d",&n,&m);
    for(int i=0;i<m;i++){
        scanf("%d%d",&u,&v);
        G[u].push_back(v);
        G[v].push_back(u);
    }
    int id=1;
    for(int i=0;i<n;i++){
        if(color[i]==-1)
            DFS(i,id++);
    }
    scanf("%d",&q);
    for(int i=0;i<q;i++){
        scanf("%d%d",&u,&v);
        if(color[u]==color[v])
            printf("yes\n");
        else
            printf("no\n");
    }
    /*
    for(int i=0;i<n;i++){
        printf("%d:%d\n",i,color[i]);
    }

    for(int i=0;i<q;i++){
        scanf("%d%d",&u,&v);

    }
    */
}


Measured memory_bytes: 12192
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector<ll>;
#define all(x) (x).begin(), (x).end()
#define fsp(x) cout << fixed << setprecision(x)
const ll inf = LLONG_MAX;
const long double pi = acos(-1);
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}

//最大公約数
long long mygcd(long long a, long long b) {
  if (a < b) std::swap(a, b);
  long long r = a % b;
  while (r) {
    a = b;
    b = r;
    r = a % b;
  }
  return b;
}

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

	ll n;
	string s;
	cin >> n >> s;

	ll r = 0, g = 0, b = 0;
	for (ll i = 0; i < n; i++) {
		if (s[i] == 'R') r++;
		else if (s[i] == 'G') g++;
		else b++;
	}
	ll ans = r * g * b;

	for (ll i = 1; 2 * i < n; i++) {
		for (ll j = 0; j + 2 * i < n; j++) {
			if (s[j] != s[j + i] && s[j] != s[j + 2 * i] && s[j + i] != s[j + 2 * i]) ans--;
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 3632
H,W=map(int,input().split())
C=[list(map(int,input().split())) for i in range(10)]
cost=[float('inf')]*10
cost[1]=0
check={1,}
while len(check)>0:
    now=check.pop()
    for i in range(10):
        if cost[i]>cost[now]+C[i][now]:
            cost[i]=cost[now]+C[i][now]
            check|={i,}
cost.append(0)
ans=0
for h in range(H):
    for a in map(int,input().split()):
        ans+=cost[a]
print(ans)

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

int main(){
    using namespace std;
    unsigned long N, Q;
    cin >> N >> Q;
    vector<unsigned long> c(N);
    for(auto&& i : c){
        cin >> i;
        --i;
    }
    vector<tuple<unsigned long, unsigned long, unsigned long>> queries(Q);
    {
        unsigned long cnt{0};
        for(auto&& [i, l, r] : queries){
            cin >> l >> r;
            --l;
            i = cnt++;
        }
    }
    constexpr unsigned long B{1700};
    sort(begin(queries), end(queries), [&B](const auto& lhs, const auto& rhs){
        const auto& [i, li, ri] = lhs;
        const auto& [j, lj, rj] = rhs;
        return li / B == lj / B ? (li / B) & 1 ? ri > rj : ri < rj : li < lj;
    });
    unsigned long nl{0}, nr{0}, now{0};
    vector<unsigned long> cnt(N), ans(Q);
    for(const auto& [i, l, r] : queries){
        while(nr < r)now += !cnt[c[nr++]]++;
        while(nr > r)now -= !--cnt[c[--nr]];
        while(nl < l)now -= !--cnt[c[nl++]];
        while(nl > l)now += !cnt[c[--nl]]++;
        ans[i] = now;
    }
    for(const auto& i : ans)cout << i << endl;
    return 0;
}

Measured memory_bytes: 27144
#include <iostream>
#include <string>

using namespace std;

int main()
{
   string str;
   int q;
   
   cin >> str;
   cin >> q;
   
   for(int i = 0; i < q; i++)
   {
       string order;
       cin >> order;
       
       if(order == "print")
       {
           int a, b;
           cin >> a >> b;
           cout << str.substr(a, b - a + 1) << endl;
       }
       else if(order == "reverse")
       {
           int a, b;
           cin >> a >> b;
           string x = str.substr(a, b - a + 1);
           
           int n = x.size();
           
           for(int i = 0; i < n; i++)
           {
               str[a + i] = x[n - i - 1];
           }
       }
       else if( order == "replace")
       {
           int a, b;
           string y;
           cin >> a >> b;
           cin >> y;
           str.replace(a, b - a + 1, y);
           }
   }
   
   return 0;
}


Measured memory_bytes: 3200
import java.util.*;
import static java.lang.Math.*;
import java.math.BigInteger;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		// 入力
		int r = sc.nextInt();
		
		// 計算
		String result = "ABC";
		if(r >= 1200) result = "ARC";
		if(r >= 2800) result = "AGC";
		
		// 出力
		System.out.println(result);
	}
}


Measured memory_bytes: 21716
from collections import deque,defaultdict
n=int(input())
routes=[tuple(map(int,input().split())) for i in range(n-1)]

edges=defaultdict(list)
for v1,v2,dist in routes:
  edges[v1-1].append([v2-1,dist])
  edges[v2-1].append([v1-1,dist])
#print(edges)

ans=[0]*n
q=deque([0])
while q:
  v=q.popleft()
  #print(v)
  if ans[v]==0:
    color=[1,0]
  else:
    color=[0,1]
  #print(edges)
  for edge in edges[v]:
    v2=edge[0]
    dist=edge[1]
    edges[v2].remove([v,dist])
    q.append(v2)
    if dist%2==1:
      ans[v2]=color[0]
    else:
      ans[v2]=color[1]
      
print(*ans,sep='\n')        

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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main() {
    //cout.precision(10);
    int n;
    cin >> n;
    string w[200];
    for(int i = 1; i <= n; i++){
        cin >> w[i];
    }
    for(int i = 1; i <= n; i++){
        for(int j = i + 1; j <= n; j++){
            if(w[i] == w[j]){
                cout << "No" << endl;
                return 0;
            }
        }
    }
    for(int i = 1; i < n; i++){
        if(w[i].back() != w[i + 1][0]){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}

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

int main() {
string s;
  cin >> s;
  if(s.at(0) == '1') s.at(0) = '9';
  else s.at(0) = '1';
  if(s.at(1) == '1') s.at(1) = '9';
  else s.at(1) = '1';
  if(s.at(2) == '1') s.at(2) = '9';
  else s.at(2) = '1';
  cout << s << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const long long INF = 100000000000;
typedef pair<int,int> P;
typedef long long ll;
using Graph = vector<vector<ll>>;

#define MOD 1000000000 + 7
#define PI 3.14159265359
//2の累乗数かどうか
bool hantei(int N) {
	bool flag = false;
	while (1) {
		if (N % 2 == 0) N /= 2;
	}
	if (N == 1) flag = true;

	return flag;
}
vector<ll> divisor(ll n){
	vector<ll> res;//約数を格納する列
	for(ll i= 1;i*i <= n;i++){
		if(n % i == 0){
		   res.push_back(i);
		   if(i != n/i) res.push_back(n/i);
		 }
	}
	return res;
}

int main() {
	ll N, K;
	cin >> N >> K;

	ll ans = 0;
	for (ll i = K; i <= N + 1; i++) {
		ans += i * (2*N + 1 - i) / 2 - i * (i - 1) / 2 + 1;
		ans %= MOD;
	}
	ans %= MOD;
	cout << ans << endl;
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll INF = 100000000;
#define rep1(i, n) for (ll i=0; i<(n); i++) 
#define rep2(i, k, n) for (ll i=k; i<(n); i++)
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; }


int main() {
    ll h, w, m, a, b;
    cin >> h >> w >> m;
    vector<ll> l(h, 0), r(w, 0); //横列, 縦列
    map<P, ll> t;
    rep1(i, m){
        cin >> a >> b;
        a--;
        b--;
        l[a]++;
        r[b]++;
        P p = make_pair(a, b);
        t[p]++;
    }
    ll max_l = *max_element(l.begin(), l.end());
    ll max_r = *max_element(r.begin(), r.end());
    vector<ll> ndx_l, ndx_r; //横列, 縦列
    rep1(i, h) if (l[i] == max_l) ndx_l.push_back(i);
    rep1(i, w) if (r[i] == max_r) ndx_r.push_back(i);
    ll ans = max_l + max_r - 1;
    for (auto x: ndx_l){
        for (auto y: ndx_r){
            P p = make_pair(x, y);
            if (t[p]==0){
                ans = max_l + max_r;
                cout << ans << endl;
                return 0;
            }
        }
    } 
    cout << ans << endl;
    //printf("%.12f", ans);
}

Measured memory_bytes: 35092
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const ll INF = (ll)1<<19;

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

    int a, b, c, x;
    cin >> a >> b >> c >> x;

    int ans = 0;
    for (int i = 0; i <= a; i++) {
        for (int j = 0; j <= b; j++) {
            for (int k = 0; k <= c; k++) {
                int sum = 500*i+100*j+50*k;
                if (sum == x) ans++;
            }
        }
    }

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <cmath>
#include <algorithm>
using namespace std;
const int Inf=1e9;
int n;
int a[122];
int main() {
while(~scanf("%d", &n)) {
for(int i=1; i <= n; i++) scanf("%d", &a[i]);
int max = -Inf;
int min = Inf;
for(int i=1; i<=n; i++) {
if(a[i] > max) max = a[i];
if(a[i] < min) min = a[i];
}
printf("%d\n", max-min);
}
}

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

int main()
{
    int h, w;

    while (true)
    {
        cin >> h >> w;
        
        if(h == 0 && w == 0){
            break;
        }
        for (int i = 1; i <= h; i++)
        {
            for (int j = 1; j <= w; j++)
            {
                if(i % 2 != 0)
                {
                    if(j % 2 == 0){
                        cout << ".";
                    }
                    else
                    {
                        cout << "#";
                    }
                }
                else{
                    if(j % 2 != 0){
                        cout << ".";
                    }
                    else{
                        cout << "#";
                    }
                }
            }
            cout << endl;
        }
        cout << endl;
    }

    return 0;
}


Measured memory_bytes: 3104
package main

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

func main() {
	io := newIo()
	defer io.Flush()
	k := io.NextInt()
	t := io.NextInt()
	maxCake := 0
	for i := 0; i < t; i++ {
		n := io.NextInt()
		if n > maxCake {
			maxCake = n
		}
	}
	if k-maxCake >= maxCake {
		fmt.Println(0)
		return
	}
	if k&1 == 1 {
		cakes := maxCake - (k / 2) - 1
		fmt.Println(2 * cakes)
		return
	} else {
		cakes := maxCake - (k / 2)
		fmt.Println(2*cakes - 1)
		return
	}
}

type io struct {
	reader    *bufio.Reader
	writer    *bufio.Writer
	tokens    []string
	nextToken int
}

func newIo() *io {
	return &io{
		reader: bufio.NewReader(os.Stdin),
		writer: bufio.NewWriter(os.Stdout),
	}
}

func (io *io) Flush() {
	err := io.writer.Flush()
	if err != nil {
		panic(err)
	}
}

func (io *io) NextLine() string {
	var buffer []byte
	for {
		line, isPrefix, err := io.reader.ReadLine()
		if err != nil {
			panic(err)
		}
		buffer = append(buffer, line...)
		if !isPrefix {
			break
		}
	}
	return string(buffer)
}

func (io *io) Next() string {
	for io.nextToken >= len(io.tokens) {
		line := io.NextLine()
		io.tokens = strings.Fields(line)
		io.nextToken = 0
	}
	r := io.tokens[io.nextToken]
	io.nextToken++
	return r
}

func (io *io) NextInt() int {
	i, err := strconv.Atoi(io.Next())
	if err != nil {
		panic(err)
	}
	return i
}

func (io *io) NextFloat() float64 {
	i, err := strconv.ParseFloat(io.Next(), 64)
	if err != nil {
		panic(err)
	}
	return i
}

func (io *io) PrintLn(a ...interface{}) {
	fmt.Fprintln(io.writer, a...)
}

func (io *io) Printf(format string, a ...interface{}) {
	fmt.Fprintf(io.writer, format, a...)
}

func (io *io) PrintIntLn(a []int) {
	b := []interface{}{}
	for _, x := range a {
		b = append(b, x)
	}
	io.PrintLn(b...)
}

func (io *io) PrintStringLn(a []string) {
	b := []interface{}{}
	for _, x := range a {
		b = append(b, x)
	}
	io.PrintLn(b...)
}

func log(name string, value interface{}) {
	fmt.Fprintf(os.Stderr, "%s=%+v\n", name, value)
}


Measured memory_bytes: 640
import sys

input = sys.stdin.readline

n = int(input())
a_list = list(map(int, input().split()))
x_list = []

s = sum(a_list)
x = s - 2 * sum(a_list[1::2])
x_list.append(x)
before = x
for i in range(n-1):
    x = 2 * a_list[i] - before
    x_list.append(x)
    before = x
print(' '.join(map(str, x_list)))


Measured memory_bytes: 19056
#pragma GCC optimize("Ofast")
#include "bits/stdc++.h"

using namespace std;

typedef long int li;
typedef long double ld;
typedef long long ll;
typedef pair<ll, bool> pt;

#define fi first
#define se second
#define lson ((p<<1))
#define rson ((p<<1)+1)
#define mid ((L+R)>>1)
#define dump(x) cout << #x << " = " << x << endl
#define fastIO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);

li n;

int main() {
    fastIO;
    cin >> n;
    cout << fixed << setprecision(9) << ld((n+1)/2)/ld(n);

}


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

typedef long long int ll;
ll MOD = 1000000007;
ll INFL = 1ll << 60;
ll INF = 1 << 28;

// ====================================================================

int main() {
  int n;
  cin >> n;
  vector<int> v(n);
  for (int i = 0; i < n; i++) { cin >> v[i]; }

  sort(v.rbegin(), v.rend());
  int ans = 0, d = 0;
  for (int i = 1; i < n; i++) {
    if (ans < min(v[0] - v[i], v[i])) {
      ans = min(v[0] - v[i], v[i]);
      d = v[i];
    }
  }

  cout << v[0] << " " << d << endl;
}


Measured memory_bytes: 640
//
//  main.cpp
//  CoderTest
//
//  Created by yuya on 2019/05/20.
//  Copyright © 2019 yuya. All rights reserved.
//

#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair <int,int> P;


int main(){
    
    double W,H,x,y;
    cin >> W >> H >> x >> y;
    
    if(x==W/2 && y==H/2){
        cout << setprecision(12) << W*H/2 << " " << 1 << endl;
    } else {
        cout << setprecision(12) << W*H/2 << " " << 0 << endl;
    }
    
    return 0;
}


Measured memory_bytes: 256
#pragma comment(linker, "/STACK:512000000")
#define _CRT_SECURE_NO_WARNINGS
//#include "testlib.h"
#include <bits/stdc++.h>
using namespace std;

#define all(a) a.begin(), a.end()
typedef long long li;
typedef long double ld;
void solve(bool);
void precalc();
clock_t start;
int main() {
#ifdef AIM
  freopen("/home/alexandero/ClionProjects/ACM/input.txt", "r", stdin);
  //freopen("/home/alexandero/ClionProjects/ACM/output.txt", "w", stdout);
  //freopen("out.txt", "w", stdout);
#else
  //freopen("input.txt", "r", stdin);
  //freopen("output.txt", "w", stdout);
#endif
  start = clock();
  int t = 1;
  cout.sync_with_stdio(0);
  cin.tie(0);
  precalc();
  cout.precision(10);
  cout << fixed;
  //cin >> t;
  int testNum = 1;
  while (t--) {
    //cout << "Case #" << testNum++ << ": ";
    //cerr << testNum << endl;
    solve(true);
    //cerr << testNum - 1 << endl;
  }
  cout.flush();
#ifdef AIM1
  while (true) {
      solve(false);
  }
#endif

#ifdef AIM
  cerr << "\n\n time: " << (clock() - start) / 1.0 / CLOCKS_PER_SEC << "\n\n";
#endif

  return 0;
}

//BE CAREFUL: IS INT REALLY INT?

template<typename T>
T binpow(T q, T w, T mod) {
  if (!w)
    return 1 % mod;
  if (w & 1)
    return q * 1LL * binpow(q, w - 1, mod) % mod;
  return binpow(q * 1LL * q % mod, w / 2, mod);
}

template<typename T>
T gcd(T q, T w) {
  while (w) {
    q %= w;
    swap(q, w);
  }
  return q;
}
template<typename T>
T lcm(T q, T w) {
  return q / gcd(q, w) * w;
}

void precalc() {

}

template<typename T>
void relax_min(T& cur, T val) {
  cur = min(cur, val);
}

template<typename T>
void relax_max(T& cur, T val) {
  cur = max(cur, val);
}

#define int li
//const int mod = 1000000007;

struct Edge {
  int to, wei;
};

int n;
vector<vector<Edge>> g;
vector<int> cnt;
int center = -1;
vector<int> dist;

void dfs(int v, int p, int d) {
  cnt[v] = 1;
  dist[v] = d;
  bool is_good = true;
  for (auto e : g[v]) {
    if (e.to == p) {
      continue;
    }
    dfs(e.to, v, d + e.wei);
    cnt[v] += cnt[e.to];
    if (cnt[e.to] > n / 2) {
      is_good = false;
    }
  }
  if (n - cnt[v] > n / 2) {
    is_good = false;
  }
  if (is_good) {
    center = v;
  }
}

void solve(bool read) {
  cin >> n;
  g.resize(n);
  cnt.assign(n, 0);
  dist.assign(n, 0);
  for (int i = 1; i < n; ++i) {
    int a, b, c;
    cin >> a >> b >> c;
    --a; --b;
    g[a].push_back({b, c});
    g[b].push_back({a, c});
  }
  dfs(0, 0, 0);

  dfs(center, center, 0);
  int res = 0;
  for (int i = 0; i < n; ++i) {
    res += 2 * dist[i];
  }
  int min_edge = (int)1e9;
  for (auto e : g[center]) {
    if (cnt[e.to] == n / 2 && n % 2 == 0) {
      min_edge = e.wei;
      break;
    }
    relax_min(min_edge, e.wei);
  }
  res -= min_edge;

  cout << res << endl;

}

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

#define make_it_fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

#define mp make_pair
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define ll long long
#define ld long double
#define endl "\n"
#define ff first
#define ss second
#define imn INT_MIN
#define imx INT_MAX

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

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}

template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}

void _print() {cerr << "]\n";}

template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}

#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...) 20
#endif

ll power(ll a,ll b,ll m=1e9+7)
{
    a%=m;
    if(b==1)
    return a;
    if(b==0)
    return 1LL;
    ll ret=power(a,b/2);
    ret=(ret*ret)%m;
    if(b&1)
    ret=(ret*a)%m;
    return ret;
}

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

void solve()
{
    ll n,i;
    cin>>n;
    vector<ll> v1,v2;
    for(i=0;i<n;i++)
    {
        ll u,v;
        cin>>u>>v;
        v1.pb(u+v);
        v2.pb(u-v);
    }
    sort(all(v1));
    sort(all(v2));
    ll x=v1.back()-v1[0];
    ll y=v2.back()-v2[0];
    cout<<max(x,y)<<endl;
}

int main()
{
    make_it_fast;
    int TEST_CASES=1;
    // cin>>TEST_CASES;
    while(TEST_CASES--)
    {
        solve();
    }
    return 0;
}


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

int main(){
  int n,m;
  cin >> n >> m;
  vector<int> h(n);
  rep(i,n) cin >> h.at(i);
  
  vector<int> good(n,1);
  rep(i,m){
    int a,b;
    cin >> a >> b;
    if(h.at(a-1) < h.at(b-1)) good.at(a-1) = 0;
    if(h.at(b-1) < h.at(a-1)) good.at(b-1) = 0;
    if(h.at(a-1) == h.at(b-1)) {good.at(a-1)=good.at(b-1)=0;}
  }
  
  int ans;
  rep(i,n) ans += good.at(i);
  cout << ans << endl;
   
}

Measured memory_bytes: 4052
#include <bits/stdc++.h>
#define ALL(a)  (a).begin(),(a).end()
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
template <typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template <typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
const int INT_INF = 1 << 30;
const double PI = acos(-1.0);
#define MOD 1000000007LL
#define endl "\n"

int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll N;
  cin >> N;
  vll A(N);
  for(int i = 0; i < N; i++){
    cin >> A.at(i);
  }
  if(A.at(0) != 0){
    cout << -1 << endl;
    return 0;
  }
  ll ans = 0LL;
  for(int i = N-1; i >= 0; i--){
    if(i == N-1){
      ans += A.at(i);
    }
    else{
      if(A.at(i+1) - A.at(i) >= 2){
        cout << -1 << endl;
        return 0;
      }
      else if(A.at(i+1) - A.at(i) == 1) continue;
      else ans += A.at(i);
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 1792
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

static const double EPS = 1e-8;
static const double PI = 4.0 * atan(1.0);
static const double PI2 = 8.0 * atan(1.0);

#define REP(i,n)	for(int i=0;i<(int)n;++i)
#define ALL(c)		(c).begin(),(c).end()
#define CLEAR(v)	memset(v,0,sizeof(v))
#define MP(a,b)		make_pair((a),(b))
#define ABS(a)		((a)>0?(a):-(a))
#define FOR(i,s,n)	for(int i=s;i<(int)n;++i)

int main(int argc, char **argv) {
	string S;
	cin >> S;
	int s = 0;
	REP(i, S.length()) if (S[i] == 'p') --s;
	s += S.length() / 2;
	cout << s << endl;
	return 0;
}


Measured memory_bytes: 512
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define ft first
#define sd second
#define fr(i,n) for(int i=0;i<(n);++i)
#define Fr(i,n) for(int i=1;i<=(n);++i)
#define ifr(i,n) for(int i=(n)-1;i>=0;--i)
#define iFr(i,n) for(int i=(n);i>0;--i)

template <class U>
inline void e1(vector<vector<int>>& v,int n,int s,vector<U>& d,U inf){
    d.resize(n,inf);
    vector<bool> vis(n);
    queue<pair<U,int>> q;
    q.emplace(0,s);
    while(!q.empty()){
        pair<U,int> p=q.front();q.pop();
        U D=p.first;
        int i=p.second;
        if(vis[i]) continue;
        vis[i]=1;
        for(auto j:v[i]){
            if(vis[j]) continue;
            if(d[j]<=D+1) continue;
            d[j]=D+1;
            q.emplace(D+1,j);
        }
    }
}

class EHopscotchAddict {
public:
    void solve(istream& in, ostream& out) {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        int n,m,u,v,s,t;
        in>>n>>m;
        vector<vector<int>> e(3*n);
        fr(i,m){
            in>>u>>v;
            e[--u].emplace_back(--v+n);
            e[u+n].emplace_back(v+2*n);
            e[u+2*n].emplace_back(v);
        }
        in>>s>>t;
        vector<int> d;
        e1(e,3*n,--s,d,INT_MAX);
        if(d[--t]!=INT_MAX) out<<d[t]/3<<endl;
        else out<<-1<<endl;
    }
};

int main() {
    EHopscotchAddict solver;
    std::istream& in(std::cin);
    std::ostream& out(std::cout);
    solver.solve(in, out);
    return 0;
}

Measured memory_bytes: 17920
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <iomanip>
#include <vector>
#include <string.h>
#include <string>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <math.h>
#include <algorithm>
#include <numeric>

using namespace std;

// マクロ&定数 ============================================================
typedef unsigned int uint;
typedef long long ll;
//typedef pair<int, int> P;

typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<bool> vbool;
typedef vector<string> vstring;

typedef vector<pair<int, int>> vpint;
typedef vector<pair<ll, ll>> vpll;
typedef vector<pair<double, double>> vpdouble;

typedef vector<vector<int>> vvint;
typedef vector<vector<ll>> vvll;
typedef vector<vector<double>> vvdouble;
typedef vector<vector<bool>> vvbool;

const int c_YET = -1;
//const int INF = 1e9 + 1;
const ll LLINF = 1e17 + 1;
const int DX[9] = { 0,0,1,-1, 1, 1, -1, -1, 0 }; // 4;４近傍
const int DY[9] = { 1,-1,0,0, 1, -1, 1, -1, 0 }; // 8:８近傍 9:(0,0)を含む
const ll MOD = 1e9 + 7; //10^9 + 7
const ll MAX = 1e9;
const double PI = 3.14159265358979323846264338327950288;
//========================================================================



int main() {

	//==================================
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(30);
	//==================================


	string S;
	cin >> S;
	ll size = S.length();

	for (int i = 0; i < size; i++) {
		cout << "x";
	}




}


Measured memory_bytes: 256
N=int(input())
pre_t,pre_x,pre_y=0,0,0
reachable=True
for _ in range(N):
  t,x,y=map(int,input().split())
  dist=abs(x-pre_x)+abs(y-pre_y)
  time=t-pre_t
  if dist<=time:
    if dist%2==time%2:
      pre_t,pre_x,pre_y=t,x,y
    else:
      reachable=False
      break
  else:
    reachable=False
    break
  pass
if reachable:print('Yes')
else: print('No')

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define modulo 1000000007
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 100000000


int main(){

	int N,Q;
	cin>>N>>Q;
	
	vector<vector<int>> E(N,vector<int>(0));
	for(int i=0;i<N-1;i++){
		int a,b;
		cin>>a>>b;
		a--;b--;
		E[a].push_back(b);
		E[b].push_back(a);
	}
	
	vector<int> ans(N,0);
	
	for(int i=0;i<Q;i++){
		int p,v;
		cin>>p>>v;
		p--;
		ans[p] += v;
	}
	
	queue<int> q;
	q.push(0);
	vector<bool> visited(N,false);
	
	while(q.size()!=0){
		int from = q.front();
		q.pop();
		visited[from]=true;
		for(int i=0;i<E[from].size();i++){
			int to = E[from][i];
			if(visited[to])continue;
			ans[to] += ans[from];
			q.push(to);
		}
	}
	
	for(int i=0;i<N;i++){
		if(i!=0)cout<<' ';
		cout<<ans[i];
	}
	cout<<endl;
	
	return 0;
}


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

   typedef long long ll;
   typedef pair<ll, ll> Pii;
   typedef vector<ll> Vi;
   typedef vector<Vi> VVi;

   const double EPS = (1e-7);
   const ll INF =(1e13);
   const double PI = (acos(-1));
   const ll MOD = ll(1e9) + 7;

   #define REP(i, n) for(ll i = 0; i < (ll)(n); i++)
   #define REPR(i, n) for(ll i = n; i > -1; i--)
   #define FOR(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++)
   #define ALL(x) (x).begin(),(x).end()
   #define SORT(x) sort((x).begin(), (x).end())
   #define RSORT(x) sort((x).rbegin(), (x).rend())
   #define REVERSE(x) reverse((x).begin(), (x).end())
   #define SZ(x) ((ll)(x).size())
   #define pb push_back
   #define mp make_pair

   //chmax(a, b): a>bならaをbで更新　更新したときにtrueを返す
   //chmin(a, b): a<bならaをbで更新　更新したときにtrueを返す
   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; }

   #define dump(x) cerr<< #x << "= " << (x) << endl;

   ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
   ll pow(ll a, ll b){if (b == 0) return 1; else if (b % 2 == 0) return pow(a * a, b / 2); else return pow(a * a, b / 2) * a;}
   ll pow(ll a, ll b, ll m){if (b == 0) return 1; else if (a == 0) return 0; else if (b % 2 == 0) return (pow((a * a) % m, b / 2, m) % m); else return (pow((a * a) % m, b / 2, m) * a) % m;}
   ll residue(ll a, ll m){return ((a % m) + m) % m;};

   ll dx[4]={1,0,-1,0};
   ll dy[4]={0,1,0,-1};

int main(){
  ll n; cin >> n;
  string s; cin >> s;
  ll k; cin >> k;
  char c = s[k - 1];
  REP(i, s.size()){
    if(s[i] != c) s[i] = '*';
  }
  cout << s << endl;
}


Measured memory_bytes: 256
def candy():
    s = input()
    slist = s.split(' ')

    a = int(slist[0])
    b = int(slist[1])
    c = int(slist[2])

    if (a + b) == c or (a + c) == b or (b + c) == a:
        print('Yes')
    else:
        print('No')

candy()

Measured memory_bytes: 9056
#include <iostream>
#include <vector>
#include <algorithm>
#include <ctype.h>
#include <math.h>
using namespace std;


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


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

#define N 200010
typedef long long LL;
const int mod = 1e9 + 7; 
const double EPS = 1e-12;

int n, m, a[1 << 18], f[1 << 18], g[1 << 18];

void update(int mask, int v)
{
	if (v > f[mask]) g[mask] = f[mask], f[mask] = v;
	else if (v > g[mask]) g[mask] = v;
}

int main()
{ 
    //freopen("in.txt", "r", stdin);
   	
   	//0010
   	scanf("%d", &n);
	m = 1 << n;
	for (int i = 0; i < m; ++i)
	{	
		scanf("%d", &a[i]);
		int t = (m - 1) ^ i;
		//cout << i << " " << t << endl;
		for (int tt = t; ; tt = (tt - 1) & t)
		{
			update(tt, a[i]);
			if (tt == 0) break;
		}
	} 
	for (int k = 2; k <= m; ++k)
	{
		int lim = 0, res = 0;
		for (int j = n; j >= 0; --j)
		{
		 	if (k & (1 << j))
	        {
	        	int t = (lim | (1 << j)) & (m - 1);
	        	res = max(res, f[t] + g[t]);
		    }
		    else lim |= 1 << j;
		}
		printf("%d\n", res);
	}
	
    
    
    
	return 0;
}

Measured memory_bytes: 6144
#include <iostream>
#include <math.h>
#include <string>
#include <stdio.h>
#include <algorithm>
#include <queue>
#include <stack>
#include <functional>
#include <iomanip>
//#include <boost/integer/common_factor_rt.hpp> // gcd, lcm
//#include <bits/stdc++.h>

using namespace std;

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

int main()
{
	int k;
	cin >> k;
	int sum = 0;
	for (int i = 1; i <= k; i++)
	{
		for (int j = 1; j <= k; j++)
		{
			for (int l = 1; l <= k; l++)
			{
				sum+=gcd(i, gcd(j,l));
			}
		}
	}
	cout << sum << endl;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vll = vector<long long>;
using vp = vector<pair<int, int>>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using vvll = vector<vector<long long>>;
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 (b<a) {a=b; return 1;} return 0;}

template<typename T>
struct BIT {
    int n, p;
    vector<T> d;
    BIT(int n=0) : n(n), d(n+1) {
        p = 1;
        while (p < n) p *= 2;
    }
    void add(int i, T x=1) {
        for (i++; i <= n; i += i&-i) d[i] += x;
    }
    //[0, i)
    T sum(int i) {
        T res = 0;
        for (; i; i -= i&-i) res += d[i];
        return res;
    }
    //[a, b)
    T sum(int l, int r) { return sum(r) - sum(l);} 
    // v0 + v1 + v2 + ... + vx　>= w となる最小のxを求める
    int lower_bound(T w) {
        if (w <= 0) return 0;
        int x = 0;
        for (int i = p; i; i /= 2) {
            if (i+x <= n && d[i+x] < w) {
                w -= d[i+x];
                x += i;
            }
        }
        return x;
    }
};

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int n; ll k;
    cin >> n >> k;
    vi a(n);
    rep(i, n) cin >> a[i];
    vll sm(n+1);
    rep(i, n) sm[i+1] = sm[i] + a[i];
    vll b(n+1);
    rep(i, n+1) b[i] = sm[i] - k * i;
    {   // compress
        map<ll, int> mp;
        rep(i, n+1) mp[b[i]] = 0;
        int j = 0;
        for (auto&& p : mp) p.second = j++;
        rep(i, n+1) b[i] = mp[b[i]];
    }
    BIT<int> bit(2e5+1);
    ll ans = 0;
    for (int i = n; i >= 0; --i) {
        ans += bit.sum(b[i], 2e5+1);
        bit.add(b[i]);
    }
    cout << ans << endl;
}

Measured memory_bytes: 16640
#include <iostream>
using namespace std;
int n, al1[26], al2[26], resp;
string s;
int main(void){
    // Your code here!
    cin >> n >> s;
    for (int i = 0; i < n; i++) {
        int res = 0;
        fill(al1, al1 + 26, 0);
        fill(al2, al2 + 26, 0);
        for (int j = 0; j < i; j++) {
            al1[s[j] - 'a'] = 1;
        }
        for (int j = i; j < n; j++) {
            al2[s[j] - 'a'] = 1;
        }
        for (int j = 0; j < 26; j++) {
            if (al1[j] == 1 && al2[j] == 1) res++;
        }
        resp = max(resp, res);
    }
    cout << resp << endl;
}


Measured memory_bytes: 256
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric;

void main()
{
    auto N = readln.chomp.to!int;
    auto hs = readln.split.to!(int[]);

    int solve(int[] lr) {
        if (lr.empty) return 0;

        auto m = int.max;
        foreach (n; lr) m = min(m, n);

        int r = m;
        size_t i;
        foreach (j, ref n; lr) {
            n -= m;
            if (!n) {
                r += solve(lr[i..j]);
                i = j+1;
            }
        }
        return r + (lr[$-1] == 0 ? 0 : solve(lr[i..$]));
    }
    writeln(solve(hs));
}

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

int main() {
    int n;
    cin >> n;
    int x = n/100;
    if (x*111 < n) cout << (x+1)*111 << endl;
    else cout << x*111 << endl;
    
}

Measured memory_bytes: 256