akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define reprrev(i,a,b) for(int i=b-1;i>=a;i--) // [a, b)
#define reprev(i,n) reprrev(i,0,n)
typedef long long ll;
typedef unsigned long long ull;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
    sizeは(int)とキャストしよう
    cin.tie(0);
    ios::sync_with_stdio(false);<- これら、printfとかと併用しない方が良さそう

*/

const ll mod = 1e9+7;

void chmod(ll &M){
    if(M >= mod) M %= mod;
    else if(M < 0){
        M += (abs(M)/mod + 1)*mod;
        M %= mod;
    }
}

ll modpow(ll x, ll n){
    if(n==0) return 1;
    ll res=modpow(x, n/2);

    if(n%2==0) return res*res%mod;
    else return res*res%mod*x%mod;
}

int getl(int i, int N) { return i==0? N-1:i-1; };
int getr(int i, int N) { return i==N-1? 0:i+1; };


// 線分 ab の偏角 返り値は[-π, π]
double argument(const pair<double, double> &a, const pair<double, double> &b){
    double ax=a.first, ay=a.second, bx=b.first, by=b.second;
    return atan2(by-ay, bx-ax);
}

/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */

const ll inf = 1LL<<60;
int N;
vector<pair<int, ll>> adj[100005];
int Q, K;
vector<int> x(100005, 0), y(100005, 0);

vector<ll> dist(100005, inf);

void input(){
    cin >> N;
    rep(i, N-1){
        int a, b, c; cin >> a >> b >> c;
        --a; --b;
        adj[a].push_back(make_pair(b, c));
        adj[b].push_back(make_pair(a, c));
    }
    cin >> Q >> K;
    --K;
    rep(i, Q){
        cin >> x[i] >> y[i];
        --x[i]; --y[i];
    }
}

void Dijkstra(){
    priority_queue<pair<ll, int>, vector<pair<ll, int>>, greater<pair<ll, int>>> pq;
    pq.push(make_pair(0, K));
    dist[K] = 0;

    while(!pq.empty()){
        auto p = pq.top(); pq.pop();
        int now = p.second;
        ll d = p.first;
        if(dist[now] < d) continue;
        for(auto edge : adj[now]){
            int to = edge.first;
            if(dist[to] > dist[now] + edge.second){
                dist[to] = dist[now] + edge.second;
                pq.push(make_pair(dist[to], to));
            }
        }
    }
}

void solve(){
    Dijkstra();

    rep(i, Q) cout << dist[x[i]] + dist[y[i]] << endl;
}

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

    input();
    solve();
    
    return 0;
}

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

int main(){
	int n;
	cin>>n;
	vector<int> a(n);
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	
	int ans=100000000;
	
	for(int i=-100;i<=100;i++){
		int sum=0;
		for(int j=0;j<n;j++){
			sum+=(a[j]-i)*(a[j]-i);
		}
		ans=min(ans,sum);
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
//AUTHOR - NAVEEN KUMAR(@naveen19991124)
#include<bits/stdc++.h>
//#include<boost/multiprecision/cpp_int.hpp>
//#inlcude<boost/multiprecision/cpp_dec_float.hpp>
#define ll long long
#define ld long double
#define F first
#define S second
#define mem(v) memset(v,0,sizeof(v))
#define all(v) v.begin(), v.end()
#define srt(v) sort(all(v))
#define rsrt(v) sort(v.rbegin(),v.rend())
#define pb push_back
#define f(a) for(ll i = 0;i<a;i++)
#define rep(i,a,b) for(ll i = a;i<b;i++)
#define rrep(i,a,b) for(ll i = a;i>b;i--)
#define vll vector<ll>
#define mp make_pair
#define dbg1(a) cout<<a<<"\n";
#define dbg2(a,b) cout<<a<<" "<<b<<"\n";
#define hell 1000000007
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
using namespace std:: chrono;
//using boost :: multiprecision :: cpp_int;
//using boost :: multiprecision :: cpp_dec_float_50;
//using boost :: multiprecision :: cpp_dec_float_100;
ll power(ll a, ll n) {ll p = 1;while (n > 0) {if(n%2) {p = p * a;} n >>= 1; a *= a;} return p;}
ll power(ll a, ll n, ll mod) {ll p = 1;while (n > 0) {if(n%2) {p = p * a; p %= mod;} n >>= 1;
a *= a; a %= mod;} return p % mod;}
ll modInverse(ll a, ll m) { ll m0 = m; ll y = 0, x = 1; 
if (m == 1) {return 0;} 
while (a > 1) { ll q = a / m; ll t = m;  m = a % m, a = t; t = y; y = x - q * y; x = t; } 
if (x < 0) {x += m0;} return x; } 
inline ll add(ll a, ll b) { return (((a >= hell) ? a % hell : a) + ((b >= hell) ? b % hell : b) + hell) % hell; }
inline ll subt(ll a, ll b) { return (a - b + hell) % hell; }
inline ll mult(ll a, ll b) { return (1ll * ((a >= hell) ? a % hell : a) * ((b >= hell) ? b % hell : b)) % hell; }
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a * (b / gcd(a, b)); }
ll mylog(ll n,ll b)
{ll i = 1;ll ans = 0;
while(1)
{if(i>n/b){break;} i = i*b;ans++;}return ans;
}
bool compare(const pair<ll,ll> &a,const pair<ll,ll> &b){
if (a.first == b.first)
{return a.second<b.second;} 
return a.first<b.first;
}
bool comparerev(const pair<ll,ll> &a,const pair<ll,ll> &b){
if(a.first == b.first)
{return a.second>b.second;}
return a.first>b.first;
}
int main()
{
	fast
	ll t = 1;
	//cin>>t;
	while(t--){
	string s;
	cin>>s;
	if(s == "ABC")
	{
		cout<<"ARC\n";
	}
	else
	{
		cout<<"ABC\n";
	}
	
	} 
	return 0;
}

Measured memory_bytes: 3660
value = input().split(' ')
vacation = int(value[0])
homework = int(value[1])
daysInt = []

daysStr = input().split(' ')
for i in range(0, homework):
    daysInt.append(int(daysStr[i]))

sumDays = sum(daysInt)

if sumDays > vacation:
    print('-1')
else:
    print(vacation-sumDays)

Measured memory_bytes: 68132
#include <bits/stdc++.h>
using namespace std;
int main()
{
int N,M;
cin >> N>>M;
vector<int>A(M);

for (int i = 0; i < M; i++)
{
    cin >>A.at(i);
}

int sum=0;

for (int ai :A) sum += ai;

if(N-sum>=0){
cout << N-sum  << endl;

} else{
cout << -1  << endl;

}



}


Measured memory_bytes: 3628
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>
#include<cmath>
#include<cstdio>
#include<tuple>
#include<bitset>

using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define ALL(x) x.begin(),x.end()
#define ll long long
typedef pair<int,int> P;
const int inf=1000000007;
const int MOD=1000000007;
signed main(){
  string s;cin>>s;
  int n=s.size();
  vector<vector<int>> dp(2,vector<int>(n,0));
  dp[0][0]=1;dp[1][0]=2;
  rep1(i,n-1){
    if(s[i]=='0'){
      dp[0][i]=dp[0][i-1]*3;
      dp[1][i]=dp[1][i-1];
    }
    else{
      dp[0][i]=dp[0][i-1]*3+dp[1][i-1];
      dp[1][i]=dp[1][i-1]*2;
    }
    dp[0][i]%=MOD;
    dp[1][i]%=MOD;
  }
  cout<<(dp[0][n-1]+dp[1][n-1])%MOD<<"\n";
  return 0;
}


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

using i64 = int64_t;

int dp[3003][3003]={0};

string s, t;

string restore(int i, int j){
    if(i <= 0 || j <= 0)return "";
    if(s[i-1] == t[j-1])return restore(i-1, j-1) + s[i-1];
    if(dp[i][j] == dp[i-1][j])return restore(i-1, j);
    return restore(i, j-1);
}

int main(){
    cin >> s >> t;
    for(int i=1;i<=(int)s.size();++i){
        for(int j=1;j<=(int)t.size();++j){
            if(s[i-1] == t[j-1]){
                dp[i][j] = dp[i-1][j-1]+1;
            }else{
                dp[i][j] = max(dp[i-1][j], dp[i][j-1]);
            }
        }
    }

    cout << restore((int)s.size(), (int)t.size()) << endl;

    return 0;
}


Measured memory_bytes: 35968
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <functional>
#include <utility>
#include <tuple>
#include <cctype>
#define INF 0x3f3f3f3f
#define MOD 1000000007
#define PI 4*atan(1.0)
#define mp make_pair
#define mt make_tuple
#define pb push_back
typedef long long ll;
typedef long double ld;
using namespace std;
int dx[4]={0,0,-1,1};
int dy[4]={-1,1,0,0};
const int SIZE=100050;
//int arr[SIZE]={};
//ここまでテンプレ
int main(){
	bool done[SIZE]={};
	int A[SIZE]={};
	int N;
	cin>>N;
	for(int i=1;i<=N;i++){
		cin>>A[i];
	}
	int next=1,ans=0;
	while(1){
		if(next==2){
			cout<<ans<<endl;
			break;
		}
		else if(done[next]==1){
			cout<<-1<<endl;
			return 0;
		}
		ans++;
		done[next]=1;
		//cout<<next<<endl;
		next=A[next];
	}
	return 0;
}

Measured memory_bytes: 768
#include <bits/stdc++.h>
#include <cstring>
#include <limits>
using namespace std;
#define ll long long int
#define lli long long int
#define fw(i, s, e) for (ll i = s; i < e; ++i)
#define fe(i, s, e) for (ll i = s; i <= e; ++i)
#define fb(i, e, s) for (ll i = e; i >= s; --i)
#define L(T)  \
    ll T;     \
    cin >> T; \
    while (T--)
#define FASTIO                   \
    ios::sync_with_stdio(false); \
    cin.tie(nullptr);            \
    cout.tie(nullptr);
#define mem(a, i) memset(a, i, sizeof(a))
#define ld long double
#define endl "\n"
#define in(P) \
    ll P;     \
    cin >> P;
int main()
{
    FASTIO
    // L(T)
    {
    }
    in(a);
    in(b);
    in(c);
    in(k);
    ll c1, c2, c3;
    c1 = c2 = c3 = 0;
    // while (a <= k)
    // {
    //     a = a * 2;
    //     c1++;
    // }
    while (b <= a)
    {
        b = b * 2;
        c2++;
    }
    while (c <= b)
    {
        c = c * 2;
        c2++;
    }
    if (c2 <= k)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }

    return 0;
}

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

int main(){
	int n;
	string s;
	cin >> n;
	cin>> s;
	int ans = 0;
	
	for(int i=0;i<n-1;i++){
		if(s[i+1] == s[i]){}
		else{ans += 1;}		
	}
	ans += 1;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 512
H,W,N = map(int,input().split())
sr,sc = map(int,input().split())
S = input()
T = input()

S_d = {"L":0,"R":0,"U":0,"D":0}
M_d = {"L":0,"R":0,"U":0,"D":0}

reverse_d = {"L":"R","R":"L","U":"D","D":"U"}

S_d[S[0]] += 1
M_d[S[0]] += 1

if ((sr == 1 and S[0] == "U") or
        (sr == H and S[0] == "D") or
        (sc == 1 and S[0] == "L") or
        (sc == W and S[0] == "R")):
    print("NO")
else:
    for i in range(N-1):
        M_d[reverse_d[T[i]]] = max(0,M_d[reverse_d[T[i]]]-1)
        S_d[reverse_d[T[i]]] = S_d[reverse_d[T[i]]] - 1
        M_d[S[i+1]] += 1
        S_d[S[i+1]] += 1
        if (M_d["U"] >= H or M_d["D"] >= H or M_d["L"] >= W or M_d["R"] >= W):
            print("NO")
            break
        if (S_d["U"]>=sr or S_d["D"]>= H+1-sr or S_d["L"]>=sc or S_d["R"]>=W+1-sc):
            print("NO")
            break
    else:
        print("YES")

Measured memory_bytes: 43376
#include <bits/stdc++.h>
#define rep(i,a,b) for(ll i=ll(a);i<ll(b);i++)
#define irep(i,a,b) for(ll i=ll(a);i>=ll(b);i--)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define pb push_back
#define mp make_pair
#define F .first
#define S .second 
#define pll pair<ll,ll>
using ll=long long;
using ld=long double;
const ll INF = 1LL<<60;
const ll mod=1e9+7;
using namespace std;
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }

ll a[220000];
int main(){
    ll x,k,d,ans=0;
    cin>>x>>k>>d;
    ll p=labs(x)%d;
    ll q=labs(x)/d;
    if(q>k)cout<<labs(x)-d*k;
    else {
        if((k-q)%2==0)cout<<p;
        else cout<<labs(p-d);
    }
}




Measured memory_bytes: 3636
import math
from functools import reduce
from collections import deque
import sys
sys.setrecursionlimit(10**7)

def s(generator, splitter, mapper):
    return [ mapper(s) for s in generator().split(splitter) ]

# スペース区切りの入力を読み込んで数値リストにして返します。
def get_nums_l():
    return [ int(s) for s in input().split(" ")]

# 改行区切りの入力をn行読み込んで数値リストにして返します。
def get_nums_n(n):
    return [ int(input()) for _ in range(n)]

n = int(input())
hhh = get_nums_l()

cant = []

prev = 9999999999999999999
for i,h in enumerate(hhh):
    if prev < h:
        cant.append(i-1)
    prev = h
cant.append(n-1)


prev = -1
max_ = 0
for c in cant:
    move = c - prev - 1
    if max_ < move:
        max_ = move
    prev = c

print(max_)

Measured memory_bytes: 63708
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i,n) for(int i=0, i##_len=(int)(n); i<i##_len; i++)
#define reps(i,n) for(int i=1 , i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;i--)
#define rreps(i,n) for(int i=((int)(n));i>0;i--)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define solve(a) ((a)?"Yes":"No")
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long , long long> P;
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;}
const long long INFLL = 1LL<<62;
const int INF = 1<<30;
const double PI=acos(-1);
ll func(int & id, int terget, vector<vector<int>> & path, int &n){
    clog<<terget<<" -> ";
    int crid=id|(1<<terget);
    clog<<"\""<<crid<<"\" ";
    ll crans=0;
    if(crid==(1LL<<n)-1LL){
      //  clog<<terget<<" "<<1<<endl;
      clog<<"("<<terget<<")"<<" => "<<1<<endl;
        return 1LL;
    }
    for(auto itr=path[terget].begin();itr!=path[terget].end();itr++){
        if(!(crid&(1<<*itr))){
            crans+=func(crid,*itr,path,n);
        }
    }
    clog << "(" << terget << ")" << " => " << crans << endl;
    return crans;
}
 int main(){
    int n,m;
    ll ans=0LL;
    cin >>n>>m;
  
    vector<vector<int>>path(n);
    int bef1,bef2;
    int id=0;
    rep(i,m){
        cin>>bef1>>bef2;
        bef1--;
        bef2--;
        path[bef1].pb(bef2);
        path[bef2].pb(bef1);
    }
    ans=func(id,0,path,n);
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<stdlib.h>
#include<stdio.h>
#include<string.h>
#include<math.h>
#include<algorithm>
#include<functional>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#define lowbit(a) ((a)&(-(a)))
using namespace std;

void file(bool opt)
{
	if (opt&&fopen("in.txt", "r"))
	{
		freopen("in.txt", "r", stdin);
		freopen("out.txt", "w", stdout);
	}
}

struct node {
	int sum=0;
	int s[15];
	int p;
}b[15];

bool vis[15];

int main()
{
	int n, m;
	cin >> n >> m;
	for (int i = 1; i <= m; i++)
	{
		cin >> b[i].sum;
		for (int j = 1; j <= b[i].sum; j++)
			cin >> b[i].s[j];
		sort(b[i].s + 1, b[i].s + 1 + b[i].sum);
	}
	for (int i = 1; i <= m; i++)
		cin >> b[i].p;

	int ans = 0;
	int up = (1 << n)-1;
	for (int sta = 0; sta <= up; sta++)
	{
		for (int i = 1; i <= n; i++)
			vis[i] = sta & (1 << (i - 1));
	/*	for (int i = 1; i <= n; i++)
			printf("%d", vis[i]);
		printf("\n");*/

		bool flag = 1;
		for (int i = 1; i <= m&&flag; i++)
		{
			int sum = 0;
			for (int j = 1; j <= b[i].sum; j++)
				sum += vis[b[i].s[j]];
			if (sum % 2 != b[i].p)flag = 0;
		}
		if (flag)ans++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<tuple>
#include<map>
#include<queue>
#include<math.h>
#include<numeric>
#include<iomanip>
#define rep(i, n) rep2(i,0,n)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define PI acos(-1);
typedef long long ll;
using namespace std;
const int MOD = 1000000007;
//scanf("%d", &a); '\n';

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin >> n;
	vector<pair<int, int>> y(n);
	rep(i, n) {
		int a, b;
		cin >> a >> b;
		y[i] = make_pair(b, a);
	}
	sort(y.begin(), y.end());
	ll sum = 0;
	rep(i, n) {
		sum += y[i].second;
		if(sum>y[i].first) { cout << "No"; return 0; }
	}
	cout << "Yes";
}



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

#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define ll long long
using namespace std;

int main() {
  int h , n;
  vector<int> a(100000);
  int count = 0;
  cin >> h >> n;
  rep (i, n) {
    cin >> a.at(i);
    count += a.at(i);
  }
  if (h - count <= 0) {
    cout << "Yes" << endl;
  }
  if (h - count > 0) {
    cout << "No" << endl;
  }


  return 0;
}

Measured memory_bytes: 640
#include<iostream>
#include<algorithm>
#include <numeric>
using namespace std;
int main(void){
  int n, tmp;
  cin>>n;
  int a[n];
  fill(a, a+n, -100000);
  cin >> a[0];
  a[1] = a[0];
  for(int i=1;i<n-1;i++) {
     cin >> tmp;
     if(a[i] > tmp) a[i] = tmp;
     a[i+1] = tmp;
  }
  cout << accumulate(a, a + n, 0) << endl;
}

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

int kaijou(int x){
  if(x==0){
    return 1;
  }
  else{
    return x*kaijou(x-1);
  }
}

int main(){
  int n;
  cin >> n;
  vector<int>a(n);
  for(int i=0;i<n;i++){
    cin >> a.at(i);
  }
  vector<int>b(n);
  for(int i=0;i<n;i++){
    cin >> b.at(i);
  }
  int a_dic=0;
  int b_dic=0;
  vector<int>a_used(1);
  vector<int>b_used(1);
  
  for(int i=0;i<n-1;i++){
    for(int c:a_used){
      if(c<a.at(i)){
        a.at(i)--;
      }
      else{
        continue;
      }
    }
    for(int c:b_used){
      if(c<b.at(i)){
        b.at(i)--;
      }
      else{
        continue;
      }
    }
    
    a_dic += (a.at(i)-1)*kaijou(n-i-1);
    a_used.push_back(a.at(i));
    b_dic += (b.at(i)-1)*kaijou(n-i-1);
    b_used.push_back(b.at(i));
  }
  
  if(a_dic > b_dic){
    cout << a_dic - b_dic << endl;
  }
  else{
    cout << b_dic - a_dic << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>     // [PRIMES]               1777 ~2^10.80  
using namespace std;                     //                       10333 ~2^13.33
using ll=long long;                      // seq 1 128 | factor   100333 ~2^16.61
using vl=vector<ll>;                     //   | grep -v ' .* '  1300111 ~2^20.31
using vvl=vector<vl>;                    //                    10300777 ~2^23.30
using vb=vector<bool>;                   //                   100400999 ~2^26.58
using vs=vector<string>;                 //                  1300400999 ~2^30.28
using pll=pair<ll,ll>;                   //                 10200500333 ~2^33.25
const ll oo =0x3f3f3f3f3f3f3f3fLL;       //                100200400777 ~2^36.54
const double eps=1e-9;                   //               1200300700111 ~2^40.13
#define sz(c) ll((c).size())             //              10200300500777 ~2^43.21
#define all(c) begin(c),end(c)           //             100200300400777 ~2^46.51
#define mp make_pair                     //            1200300400600999 ~2^50.09
#define mt make_tuple                    //           10200300400600111 ~2^53.18
#define pb push_back                     //          100200300400600333 ~2^56.48
#define eb emplace_back                  //         1200300400500800999 ~2^60.06
#define xx first
#define yy second
#define FOR(i,a,b) for(ll i=(a); i<(b); i++)
#define FORD(i,a,b) for(ll i=ll(b)-1;i>=(a);i--)
#define TR(X) ({if(1) cerr << "TR: " << (#X) << " = " << (X) << endl; })

using namespace std;

ll n, k, q;

int main(){
	cin.sync_with_stdio(0);

	cin >> n >> k >> q;
	ll sums[n];
	FOR(i, 0, n) sums[i] = k - q;
	
	FOR(i, 0, q) {
		int next; cin >> next;
		next--;
		sums[next]++;
	}
	
	FOR(i, 0, n) {
		if(sums[i] > 0) cout << "Yes" << endl;
		else cout << "No" << endl;
	}
	
	
	return 0;
}

Measured memory_bytes: 1408
#pragma GCC optimize("O3")
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
typedef pair<ll,ll> P;
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
const ll inf=(1e18);
const ll mod=1000000007;
//ios_base::sync_with_stdio(false);
//cin.tie(NULL);
ll gcd(ll a,ll b) {return b ? gcd(b,a%b):a;}
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
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 (a>b) { a=b; return 1; } return 0; }
map<int,ll> mp;
int main(){
mp[3]= 100000;
mp[2]=200000;
mp[1]=300000;
int x,y;
cin>>x>>y;
cout<<mp[x]+mp[y]+(x==1&&y==1?400000:0)<<endl;
}


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

int main() {
  int N;
  cin >> N;
  long long S;
  cin >> S;
  long long mi = 1<<30;
  for (int i = 0; i < N; ++i) {
    long long a;
    cin >> a;
    S -= a;
    mi = min(mi, a);
  }
  cout << N + S / mi << endl;
}

Measured memory_bytes: 3628
#include<iostream>
#include<sstream>
#include<ios>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<list>
#include<queue>
#include<cstdlib>
#include<cmath>
#include<queue>
#include<deque>
#include<map>
#include<string>
#include<numeric>
#include<set>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep2(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep_inv(i, n, m) for(int i = (int)(n); i > (int)(m); i--)
using namespace std;
using vi = vector<int>;
using vl = vector<long>;
using vc = vector<char>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<long>>;
using vvc = vector<vector<char>>;
using pii = pair<int, int>;
using pll = pair<long, long>;
using vpii = vector<pii>;
using vpll = vector<pll>;

double distance(pll v1, pll v2){
  long x = v1.first - v2.first;
  long y = v1.second - v2.second;

  double ret = sqrt((double)(x*x) + (double)(y*y));

  return ret;  
}

int main(){
  long N;
  cin >> N;

  vpll xy(N);
  rep(i, N) cin >> xy[i].first >> xy[i].second;

  double dist = 0.0;
  double ans = 0.0;

  rep(i, N){
    rep2(j, i+1, N){
      dist = distance(xy[i], xy[j]);
      ans += 2.0 * dist / (double)(N);
    }
  }

  cout << setprecision(10) << ans << endl;
  
  return 0;
}

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

int main(){
    ll n;
    cin>>n;
    vector<tuple<string, ll, int>> list;
    ll score;
    string city;
    rep(i,n){
        cin>>city>>score;
        list.emplace_back(city, score*(-1), i+1);
    }

    sort(begin(list), end(list));
    rep(i,n){
        // cout<<get<0>(list[i])<<","<<get<1>(list[i])*(-1)<<","<<get<2>(list[i])<<endl;
        cout<<get<2>(list[i])<<endl;
    }

}


Measured memory_bytes: 3624
#include <iostream>
#include <algorithm>
#include <array>
#include <bitset>
#include <cstring>
#include <deque>
#include <math.h>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <queue>
#include <vector>

#define FOR(i, a, b) for(int (i) = (a); (i) < (b); ++(i))
#define rFOR(i, a, b) for(int (i) = (b); (i) >= (a); --(i))
#define REP(i, n) FOR(i, 0, n)
#define rREP(i, n) rFOR(i, 0, (n-1))
#define SORT(A) std::sort((A).begin(), (A).end())
#define ALL(A) (A).begin(), (A).end()
// 座標圧縮 (for vector) : ソートしてから使うのが一般的 ; SORT(A) => COORDINATE_COMPRESSION(A)
#define COORDINATE_COMPRESSION(A) (A).erase(unique((A).begin(),(A).end()),(A).end())

using lli = long long int;
using pii = std::pair<int, int>;

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

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


// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

constexpr int mod = 1e9 + 7;

using LLi = long long int;
// 累乗の余りを求める関数
    inline LLi power_mod(LLi a, LLi n, LLi mod_number___ = mod){
        LLi res = 1LL, waiting = a;
        while(n != 0LL){ if((n & 1LL) != 0LL){ res *= waiting; res %= mod_number___;}
            waiting *= waiting; waiting %= mod_number___; n >>= 1; }
        return res;
    }
    // Z/pZ上の逆元を求める関数 (フェルマーの小定理)
    inline LLi inverse_mod(LLi a, LLi mod_number___ = mod){
        return power_mod(a, mod_number___-2);
    }


std::vector<int> In;
std::vector<std::vector<int>> Edge;
std::vector<std::vector<int>> A;
std::vector<int> Depth;

int main(void){
    int n; scanf("%d", &n);
    Edge.resize(n);
    REP(i, n-1){
        int a, b; scanf("%d%d", &a, &b); a--; b--;
        Edge[a].push_back(b);
        Edge[b].push_back(a);
    }
    In.resize(n); REP(i, n) In[i] = Edge[i].size();
    std::queue<int> Q;
    Depth.assign(n, -1);
    Depth[0] = 0; Q.push(0);
    while(not Q.empty()){
        int v = Q.front(); Q.pop();
        for(int nv : Edge[v]) if(Depth[nv] == -1){
            Depth[nv] = Depth[v] + 1; Q.push(nv);
        }
    }

    A.resize(n);
    REP(i, n){
        bool flag = true;
        for(int v : Edge[i]) if(Depth[v] > Depth[i]){flag = false; break;}
        if(flag) Q.push(i); 
    }
    while(not Q.empty()){
        int v = Q.front(); Q.pop();
        if(v == 0) continue;
        int sum = 1; for(int x : A[v]) sum += x;
        for(int nv : Edge[v]) if(Depth[nv] < Depth[v]){
            In[nv]--; A[nv].push_back(sum);
            if(In[nv] == 1) Q.push(nv);
        }
    }

    lli inv_twon = inverse_mod(power_mod(2, n));
    lli inv_two = inverse_mod(2);

    lli res = (n * inv_two) % mod;

    REP(i, n){
        lli val = 1;
        int k = n - 1;
        for(int x : A[i]){
            (val += power_mod(2, x) + mod - 1) %= mod;
            k -= x;
        }
        (val += power_mod(2, k) + mod - 1) %= mod;
        (val *= inv_twon) %= mod;
        (res += mod - val) %= mod;
    }
    printf("%lld\n", res);

    return 0;
}

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

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

    int ans;
    if (n < 105) ans = 0;
    else if (n < 135) ans = 1;
    else if (n < 165) ans = 2;
    else if (n < 189) ans = 3;
    else if (n < 195) ans = 4;
    else ans = 5;

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

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
using namespace std;
int main()
{
    int N,K;
    cin >> N >> K;
    vector<int> Sunuke(N + 1,0);
    
    int DK;
    int A;

    for(int x = 0;x < K;++x)
    {
        cin >> DK;
        for(int c = 0;c < DK;++c)
        {
            cin >> A;
            Sunuke[A] = 1;
        }
    }

    int Ans = 0;
    for(int x = 1;x <= N;++x)
    {   
        if(Sunuke[x] == 0)
            Ans++;
    }
    cout << Ans << endl;

}

Measured memory_bytes: 3572
#include<bits/stdc++.h>
#include<chrono>
#pragma GCC optimize("Ofast")
using namespace std;
using namespace chrono;
#define all(a) a.begin(), a.end()
#define sz(x) (int(x.size()))
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, ll> pil;
typedef vector<string> vs;
template<class T1, class T2>
istream &operator>>(istream &in, pair<T1, T2> &P){
	in >> P.first >> P.second;
	return in;
}
template<class T1, class T2>
ostream &operator<<(ostream &out, pair<T1, T2> &P){
	out << "(" << P.first << ", " << P.second << ")";
	return out;
}
template<class T>
istream &operator>>(istream &in, vector<T> &arr){
	for(auto &x: arr) in >> x;
	return in;
}
template<class T>
ostream &operator<<(ostream &out, vector<T> &arr){
	for(auto &x: arr) out << x << ' '; cout << "\n";
	return out;
}

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n;
	cin >> n;
	vi a(n);
	cin >> a;
	a[0] --;
	for(int i = 1; i < n; i ++){
		if(a[i - 1] > a[i]){
			cout << "No";
			return 0;
		}
		if(a[i - 1] < a[i]){
			a[i] --;
		}
	}
	cout << "Yes";
	return 0;
}

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

int main() {
    int n, ans=0;
    cin >> n;
    vector<vector<pair<int, int>>> c(n);
    rep(i,n){
        int a;
        cin >> a;
        for(int j=0; j<a; ++j){
            int x,y;
            cin >> x >> y;
            --x;
            c[i].push_back(make_pair(x,y));
        }
    }
    for (int bit = 1; bit < (1 << n); ++bit) {
        bool ok = true;
        int pr = 0;
        for (int i = 0; i < n; ++i) {
        if ((bit >> i) & 1) {
            ++pr;
            for (int j = 0; j < c[i].size(); ++j) {
            int x = c[i][j].first;
            int y = c[i][j].second;
            ok = ok && (((bit >> x) & 1) == y);
            }
        }
        }
        if (ok) {
        ans = max(ans, pr);
        }
    }
    cout << ans << "\n";
    return 0;
}

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

void solve() {
	long long x;
	cin >> x;
	for (long long b = -200; b <= 200; b++) {
		long long a5 = b * b * b * b * b + x;
		long long l = 1, r = 200;
		while (l < r) {
			long long m = (l + r) / 2;
			if (m * m * m * m * m < a5) {
				l = m + 1;
			} else {
				r = m;
			}
		}
		if (l * l * l * l * l == a5) {
			cout << l << " " << b << "\n";
			return;
		}
	}
}

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

Measured memory_bytes: 3644
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#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>
#include <climits>

#define int long long
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(a) (a).begin(), (a).end()
#define SZ(a) (signed)((a).size())
#define EACH(i, c) for (typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define SORT(c) sort((c).begin(), (c).end())

using namespace std;

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;

const int MOD = 1000000007;

#define dump(x) cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")"  << " " << __FILE__ << endl;

signed main(void) {
    ios::sync_with_stdio(false);
    cout.setf(ios::fixed, ios::floatfield);
    cout.precision(10);
    cin.tie(0);

    int n,m;
    cin >> n;
    VI t(n);
    REP(i,n){
        cin >> t[i];
    }
    cin >> m;
    VI p(m),x(m);
    REP(i,m){
        cin >> p[i] >> x[i];
        p[i]--;
    }

    int sum = accumulate(ALL(t),0);
    REP(i,m){
        cout << sum + x[i] - t[p[i]] << endl;
    }
    return 0;
}


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

typedef long long ll;
typedef pair <int , int> pii;

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

inline int pw(int x , int y){
   int ret = 1;
   for( ; y ; y /= 2){
      if(y & 1)
         ret = 1ll * ret * x % mod;
      x = 1ll * x * x % mod;
   }
   return ret;
}

int fac[N] , dp[N] , pd[N];

inline int c(int x , int y){
   return 1ll * fac[y] * pw(fac[x] , mod - 2) % mod * pw(fac[y - x] , mod - 2) % mod;
}

int32_t main(){
   ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
   fac[0] = 1;
   for(int i = 1 ; i < N ; i++)
      fac[i] = 1ll * fac[i - 1] * i % mod;
   int n , m;
   cin >> n >> m;
   int ans = 0;
   for(int i = 0 ; i <= n ; i++){
      int val = 1ll * c(i , m) * c(i , n) % mod * fac[i] % mod * c(n - i , m - i) % mod * fac[n - i] % mod * c(n - i , m - i) % mod * fac[n - i] % mod;
      if(i % 2 == 0)
         (ans += val) %= mod;
      else
         ans = (ans - val + mod) % mod;
   }
   cout << ans;
   return 0;
}


Measured memory_bytes: 5584
#include <iostream>
#include <iomanip>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
#include <map>
#define rep(i,n) for(int i=0; i<n; i++)
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
const ll mod=1e9+7;

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

	cout << 2*N*M_PI << endl;

	return 0;
}

Measured memory_bytes: 3788
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define sz(x) (int)(x).size()
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<double> vd;
typedef pair<double,double> PD;
typedef pair<int,P> ed;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 1000000007;
const double eps = 1e-10;
  
int main() {
  string s;
  cin >> s;
  if(s[0] == '9' || s[1] == '9') {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define pb push_back

using namespace std;

ll n;
vector<ll> p;
vector<ll> pos;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin>>n;
    p.resize(n);
    pos.resize(n+1);
    for(ll i=0; i<n; ++i) {
        cin>>p[i];
        pos[p[i]] = i;
    }
    multiset<ll> used;
    used.insert(-1);
    used.insert(-1);
    used.insert(n);
    used.insert(n);
    ll ans = 0;
    for(int i=n; i>0; --i) {
        used.insert(pos[i]);
        auto it = used.find(pos[i]);
        it--;
        ll b = *it;
        it--;
        ll a = *it;
        it++;it++;it++;
        ll x = *it;
        ++it;
        ll y = *it;
        ans += ((x-pos[i])*(b-a) + (y-x)*(pos[i]-b))*i;
    }
    cout<<ans<<endl;
}

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

using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please

int N;
int C[200001];
int E[400001];
int next[400001];
int H[200001];
void dfs(int p, int prev, int c) {
	C[p] = c + C[p];
	for (int i = H[p]; i; i = next[i]) {
		if (E[i] != prev) dfs(E[i], p, C[p]);
	}
}

const int cm = 1 << 17;
char cn[cm], * ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	int A = 0;
	if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}

const int dm = 1 << 21;
char dn[dm], * di = dn;
inline void putint(int X) {
	if (X == 0) {
		*di++ = '0';
		*di++ = '\n';
		return;
	}
	int keta = 0;
	char C[10];
	while (X) {
		*(C + keta) = '0' + X % 10;
		X /= 10;
		keta++;
	}
	for (int i = keta - 1; i >= 0; i--)* di++ = (*(C + i));
	*di++ = ' ';
}

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


	int N = getint(), Q = getint();
	int k = 1;
	rep(i, N - 1) {
		int a = getint(), b = getint();
		E[k] = b;
		next[k] = H[a];
		H[a] = k++;
		E[k] = a;
		next[k] = H[b];
		H[b] = k++;
	}
	rep(i, Q) {
		int p = getint(), x = getint();
		C[p] += x;
	}
	dfs(1, 0, 0);

	rep1(i, N) putint(C[i]);

	fwrite(dn, 1, di - dn, stdout);

	Would you please return 0;
}

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

typedef long long int ll;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
#define all(x) (x).begin(), (x).end()
#define endl "\n"
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define ar array
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
const ll mod = 1e9 + 7;
const ll inf = 2e9 + 5;
double PI = 3.14159265358979323846;

void solve() {

    ll n;
    cin >> n;
    ll a[n];
    // min so far = 0;
    ll msf = 0;
    ll stool = 0;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        if( i and a[i] < msf){
            stool+=(msf-a[i]);
        }else{
            msf = a[i];
        }
    }
    cout << stool << endl;

}

int32_t main()
{
    IOS
    // int T; cin >> T; while (T--)
    solve();
    return 0;
}


Measured memory_bytes: 5168
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <cmath>
#include <iomanip>
using namespace std;
#define REP(i,n) for (int i=0;i<(n);++i)
#define rep(i,a,b) for(int i=a;i<(b);++i)
template<class T> inline bool chmin(T &a, T b){ if(a > b) { a = b; return true;} return false;}
template<class T> inline bool chmax(T &a, T b){ if(a < b) { a = b; return true;} return false;}
using ll = long long;
constexpr long long INF = 1LL << 62;
constexpr int MOD = 1e9 + 7;
constexpr double EPS = 1e-10;

ll dp[1010][1010];

int main() {
    cin.tie(0); ios_base::sync_with_stdio(false);
    int N, K; cin >> N >> K;

    dp[0][0] = 1;
    for(int i=1; i <= K; ++i) {
        for(int j = 0; j <= N; ++j) {
            if(j - i >= 0) {
                dp[i][j] = (dp[i-1][j] + dp[i][j-i]) % MOD;
            } else {
                dp[i][j] = dp[i-1][j] % MOD;
            }
        }
    }

    cout << (N >= K ? dp[K][N-K] : 0) << '\n';
    return 0;
}


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

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    int a[n];
    for (int i = 0; i < n; i++) cin >> a[i];
    int b[100000] = {0};
    for (int i = 0; i < n; i++) {
        b[a[i]]++;
    }
    int res = 0;
    for (int i = 0; i < 99998; i++) {
        res = max(res, accumulate(b + i, b + i + 3, 0));
    }
    cout << res << "\n";
    return 0;
}

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

  int N ;
  int ans = 0 ;
  cin >> N ;
  vector<int> A(N) ;
  rep(i,N) cin >> A.at(i) ;
  for(int i = N -1 ; i > 0 ; i-- ){
	if( A.at(i) >= A.at(i-1) ) continue ;
    else A.at(i-1)-- ;
  }
  rep(i,N-1){
	if( A.at(i) > A.at(i+1) ){
    cout << "No" << endl;
    return 0 ;
    }
  }
  cout << "Yes" << endl;
}

Measured memory_bytes: 640
import sys
def rs(): return sys.stdin.readline().rstrip()
def ri(): return int(sys.stdin.readline())
def ria(): return list(map(int, sys.stdin.readline().split()))
def ws(s): sys.stdout.write(s + '\n')
def wi(n): sys.stdout.write(str(n) + '\n')
def wia(a): sys.stdout.write(' '.join([str(x) for x in a]) + '\n')


def main():
    a, v = ria()
    b, w = ria()
    t = ri()

    if a == b:
        ws('YES')
        return

    if v <= w:
        ws('NO')
        return

    tt = abs(b - a) / (v - w)
    if tt <= t:
        ws('YES')
    else:
        ws('NO')


if __name__ == '__main__':
    main()


Measured memory_bytes: 61816
require 'pp'

n = gets.chomp!.to_i
w_n = []
n.times do |_|
    w_n << gets.chomp!
end

tail = w_n[0][0]
ok = true
w_n.each do |w|
    if tail != w[0]
        ok = false
        break
    end

    tail = w[-1]
end

if ok && w_n.length == w_n.uniq.length
    puts "Yes"
else
    puts "No"
end


Measured memory_bytes: 2044
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		List<Integer> b = getF(m);
		long mod = 1000000007;
		long ans = 1;
		for (Integer i : b) {
			//System.out.println(i);
			ans = (ans * Tohop(n + i - 1, n-1, mod)) % mod;
		}
		System.out.println(ans);

	}

	static long pow(long a, long b, long MOD) {
		long x = 1, y = a;
		while (b > 0) {
			if (b % 2 == 1) {
				x = (x * y);
				if (x > MOD)
					x %= MOD;
			}
			y = (y * y);
			if (y > MOD)
				y %= MOD;
			b /= 2;
		}
		return x;
	}

	static long InverseEuler(long n, long MOD) {
		return pow(n, MOD - 2, MOD);
	}

	static long Tohop(long n, long m, long MOD) {
		long f = 1;
		long f2 = 1;
		for (long i=m+1;i<=n;i++){
			f = (f*i)% MOD;
			f2 = (f2*(i-m)) % MOD;
		}
		return (f * InverseEuler(f2, MOD)) % MOD;
	}


	private static List<Integer> getF(int m) {
		List<Integer> b = new ArrayList<>();
		int i = 2;
		int c = 0;
		while (i <= m) {
			if (m % i == 0) {
				m /= i;
				c++;
			} else {
				if (c != 0)
					b.add(c);
				c = 0;
				i++;
			}
		}
		if (c != 0)
			b.add(c);
		if (m > 1)
			b.add(1);
		return b;
	}

}


Measured memory_bytes: 21844
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
using namespace std;



int main() {
	int h,w;
	cin >> h >> w;
	vector<string> a(h);
	for (int i = 0; i < h; i++) {
		cin >> a.at(i);
	}
	vector<bool> row(h, false);
	vector<bool> col(w, false);
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			if (a[i][j] == '#') {
				row[i] = true;
				col[j] = true;
			}
		}
	}
	for (int i = 0; i < h; i++) {
		if (row[i]) {
			for (int j = 0; j < w; j++) {
				if (col[j]) {
					cout << a[i][j];
				}
			}
			cout << endl;
		}
	}
 }










Measured memory_bytes: 256
#include <cstdio>
#include <stack>
using namespace std;

int n;
stack<int> st;

int main() {
  while (1) {
    if (scanf("%d", &n) != 1) break;
    if (n == 0) {
      printf("%d\n", st.top());
      st.pop();
    } else {
      st.push(n);
    }
  }
}

Measured memory_bytes: 2692
package main

import (
	"bufio"
	"fmt"
	"os"
)

var (
	readerSize = 100000
	rdr        = bufio.NewReaderSize(os.Stdin, readerSize)
	ts         = []string{"dream", "dreamer", "erase", "eraser"}
	s          = ""
)

func main() {
	s = readLine()
	if len(s) == 0 {
		fmt.Println("NO")
		return
	}

	if rec(0) {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}

func rec(i int) bool {
	if i == len(s) {
		return true
	}
	for _, t := range ts {
		if len(s[i:]) >= len(t) && s[i:i+len(t)] == t {
			if rec(i + len(t)) {
				return true
			}
		}
	}
	return false
}

func readLine() string {
	buf := make([]byte, 0, readerSize)
	for {
		l, p, e := rdr.ReadLine()
		pnc(e)
		buf = append(buf, l...)
		if !p {
			break
		}
	}
	return string(buf)
}

func pnc(err error) {
	if err != nil {
		panic(err)
	}
}


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

int gcd(int, int);

int main(void)
{
  int n, x, y, d, i;
  scanf("%d", &n);
  scanf("%d", &x);
  scanf("%d", &y);
  d = abs(y - x);
  for(i = 1; i < n;  i++){
    scanf("%d", &y);
    d = gcd( abs(y - x), d);
  }
  printf("%d\n", d);
  
  return 0;
}

int gcd(int x, int y){
  int a, b, r;
  
  if(x > y){
    a = x;
    b = y;
  }else{
    a = y;
    b = x;
  }
  
  r = a % b;
  while(r != 0){
    a = b;
    b = r;
    r = a % b;
  }
  
  return b;
}

Measured memory_bytes: 128
from statistics import median

n = int(input())
x_min = []
x_max = []
for _ in range(n):
    a, b = map(int, input().split())
    x_min.append(min(a, b))
    x_max.append(max(a, b))

print(int((median(x_max)-median(x_min))*2)+1 if n % 2 == 0 else median(x_max)-median(x_min)+1)


Measured memory_bytes: 28848
#include<bits/stdc++.h>
    using namespace std;
	#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
	#define pb push_back
	#define mp make_pair
	#define all(v) v.begin(),v.end()
	typedef long long ll;
	#define lim 20000000000007LL

	int main()
	{
		fast
		int t=1;
		// cin>>t;
		while(t--)
		{
			string s;
			cin>>s;
			if(s.length()<6){cout<<"No";return 0;}
			if((s[2]==s[3])&&(s[4]==s[5]))cout<<"Yes";
			else cout<<"No";

		}
	}

			

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

#define N 200

int h, w;
int c[10][10];
int a[N][N];

int main()
{
	int ans = 0;

	cin >> h >> w;
	for( int i = 0; i < 10; i++ ) {
		for( int j = 0; j < 10; j++ ) {
			cin >> c[i][j];
		}
	}
	for( int i = 0; i < h; i++ ) {
		for( int j = 0; j < w; j++ ) {
			cin >> a[i][j];
		}
	}

	for( int k = 0; k < 10; k++ ) {
		for( int i = 0; i < 10; i++ ) {
			for( int j = 0; j < 10; j++ ) {
				if( c[i][j] > c[i][k] + c[k][j] ) {
					c[i][j] = c[i][k] + c[k][j];
				}
			}
		}
	}
	for( int i = 0; i < h; i++ ) {
		for( int j = 0; j < w; j++ ) {
			if( a[i][j] >= 0 ) {
				ans += c[a[i][j]][1];
			}
		}
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 384
/**
 * Author RDP
 * 
**/
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
#include <bitset>
#define endl '\n'
#define bp(x) __builtin_popcount(x)
#define zf(x) __builtin_clz(x)
#define zl(x) __builtin_ctz(x)
#define par(x) __bultin_parity(x)
#define FAST_IO ios::sync_with_stdio(0); std::cin.tie(0);
typedef long long ll;
using namespace std;

void test_case()
{
    FAST_IO
    int a,b,c;
    cin >> a >> b >>c;
    swap(a, b);
    swap(a, c);
    printf("%d %d %d",a,b,c);
    return ;
}
int main()
{
    FAST_IO
    test_case();
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long a[100009];
int k;
int main(){
    cin>>k;
    int i;
    for(i=1;i<=9;i++){
        a[i]=i;
    }
    int temp=1;
    while(k>=i){
        if(a[temp]%10==0){
            a[i++]= a[temp]*10;
            a[i++]= a[temp]*10+1; 
        }
        else if(a[temp]%10==9){
            a[i++]=a[temp]*10+8;
            a[i++]=a[temp]*10+9;
        }
        else{
            a[i++]=a[temp]*10+a[temp]%10-1;
            a[i++]=a[temp]*10+a[temp]%10;
            a[i++]=a[temp]*10+a[temp]%10+1;
        }
        temp++;
    }
    cout<<a[k];
}

Measured memory_bytes: 4388
#include<bits/stdc++.h>
using namespace std;
typedef pair<double, int> P;
typedef pair<int, int> Point;
typedef pair<Point, Point> Segment; // (frm, to)
const double eps = 1e-9;
 
double norm(Point a) {
    return sqrt(a.first * a.first + a.second * a.second);
}
Point getv(Point frm, Point to) {
    return Point(to.first - frm.first, to.second - frm.second);
}
Point getv(Segment a) {
    return getv(a.first, a.second);
}
double dist(Point a, Point b) {
    return norm(getv(a, b));
}
double getlen(Segment a) {
    return dist(a.first, a.second);
}
 
int cross(Point v, Point w) {
    return v.first * w.second - v.second * w.first;
}
bool iscross(Segment a, Segment b) {
    return (cross(getv(a), getv(a.first, b.first)) > 0) != (cross(getv(a), getv(a.first, b.second)) > 0) && (cross(getv(b), getv(b.first, a.first)) > 0) != (cross(getv(b), getv(b.first, a.second)) > 0);
}
 
 
 
vector<double> dijkstra(int s, vector<vector<P>> edge) {
    int n = edge.size();
    vector<double> dist(n, 1e16);
    priority_queue<P, vector<P>, greater<P>> q;
    dist[s] = 0;
    q.push(P(0, s));
    while (!q.empty()) {
        P p = q.top();
        q.pop();
        for (auto& e : edge[p.second]) {
            if (dist[e.second] > p.first + e.first) {
                dist[e.second] = p.first + e.first;
                q.push(P(p.first + e.first, e.second));
            }
        }
    }
    return dist;
}
 
 
 
int main() {
    int na, nb;
    cin >> na >> nb;
    vector<P> a(na);
    vector<P> b(nb);
    for (int i = 0; i < na; ++i)
        cin >> a[i].first >> a[i].second;
    for (int i = 0; i < nb; ++i)
        cin >> b[i].first >> b[i].second;
 
    Segment sa = Segment(a[0], a[1]);
    Segment sb = Segment(b[0], b[1]);
    vector<vector<P>> eda(na);
    vector<vector<P>> edb(nb);
    for (int i = 0; i < na; ++i) {
        for (int j = i + 1; j < na; ++j) {
            if (!iscross(Segment(a[i], a[j]), sb)) {
                eda[i].push_back(P(dist(a[i], a[j]), j));
                eda[j].push_back(P(dist(a[i], a[j]), i));
            }
        }
    }
    for (int i = 0; i < nb; ++i) {
        for (int j = i + 1; j < nb; ++j) {
            if (!iscross(Segment(b[i], b[j]), sa)) {
                edb[i].push_back(P(dist(b[i], b[j]), j));
                edb[j].push_back(P(dist(b[i], b[j]), i));
            }
        }
    }
    double ans = min(getlen(sa) + dijkstra(0, edb)[1], getlen(sb) + dijkstra(0, eda)[1]);
    if (ans > 1e15)
        puts("-1");
    else
        printf("%.16lf\n", ans);
 
    return 0;
}

Measured memory_bytes: 64584