akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <functional>
#include <list>
#include <numeric>
#include <math.h>
#include <cstdlib>
#include <queue>
#include <iterator>
#include <limits>
#include <string>
#include <sstream>
#include <iomanip>
#include <bitset>
#include <mutex>
#include <condition_variable>
#include <atomic>
#include <stack>
#include <memory>
#include <deque>
#include <string_view>
#include <random>
#include <chrono>
#include <cstring>

using namespace std;

static int my_speed_up = []() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); return 0; }();
using ll = long long; using ull = unsigned long long;
template<class T> using v = vector<T>;
template<class T> using vv = vector<vector<T>>;
template<class T> using vvv = vector<vector<vector<T>>>;
template<class T> using vvvv = vector<vector<vector<vector<T>>>>;
#define for_b(i, b) for (int i = 0; i < (b); ++i)
#define for_ab(i, a, b) for (int i = a; i < (b); ++i)
#define what_is(x) cout << #x << " = " << x << endl;
#define what_are(x,y) cout << #x << " = " << x << ", " << #y << " = " << y << endl;
#define pad(x) for_b(i, x) cout << "  ";
#define show_1d(___x) cout << #___x << " = "; for (auto& ___num : ___x) cout << ___num << ", "; cout << endl;
#define show_2d(___x) cout << #___x << endl; for (auto& ___row : ___x) { for (auto ___num : ___row) cout << ___num << ", "; cout << endl; }
#define show_3d(___x) cout << #___x << endl; for (auto& ___row : ___x) { for (auto& ___row2 : ___row) { for (auto ___num : ___row2) cout << ___num << ", "; cout << endl; }cout << endl; }


int main()
{
    int n, k;
    cin >> n >> k;
    
    auto cmp = [](const pair<double,int>& a, const pair<double,int>& b) { return a.first < b.first; };
    std::priority_queue<pair<double,int>, std::vector<pair<double,int>>, decltype(cmp)> tb(cmp);
    
    double avg = 0;
    vv<int> logs (n, v<int>(2));
    for_b(i,n)
    {
        cin >> logs[i][0];
        logs[i][1] = 1;
        
        avg += logs[i][0];
        tb.push(make_pair(logs[i][0] , i));
    }
    avg /= double(n+k);
    
    for_b(i,k)
    {
        int idx = tb.top().second;
        tb.pop();
        
        int take = double(logs[idx][0]) / avg;
        take -= logs[idx][1];
        take = max(take, 1);
        i += take - 1;
        logs[idx][1] += take;
        tb.push( make_pair(double(logs[idx][0]) / double(logs[idx][1]) , idx ) );
    }
    
    int res_idx = tb.top().second;
    
    double res = double(logs[res_idx][0]) / double(logs[res_idx][1]);
    int resi = res;
    if (resi < res) ++resi;
    
    cout << resi << endl;
    

    
    return 0;
}

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

ll f(ll n) {
    ll ans = 0;
    for (int i = 0; i < MAX; ++i) {
        ll val = (1LL<<i)*((n+1)/(1LL<<(i+1))) + max(0LL, (n+1)%(1LL<<(i+1)) - (1LL<<i));
        if (val&1) ans |= (1LL<<i);
    }
    return ans;
}

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

    ll a, b;
    cin >> a >> b;
    cout << (f(b)^f(a-1)) << "\n";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using Int = int64_t;
using UInt = uint64_t;
using C = std::complex<double>;
#define rep(i, n) for(Int i = 0; i < (Int)(n); ++i)
#define guard(x) if( not (x) ) continue;

int main() {
   Int v, e;
   std::cin >> v >> e;
   std::vector<Int> ss(e), ts(e), ds(e);
   rep(i, e) std::cin >> ss[i] >> ts[i] >> ds[i];
   std::vector<std::vector<Int>> xss(v, std::vector<Int>(v));
   std::vector<std::vector<bool>> yss(v, std::vector<bool>(v));
   rep(i, v) yss[i][i] = true;
   rep(i, e) {
      Int s = ss[i], t = ts[i], d = ds[i];
      xss[s][t] = d;
      yss[s][t] = true;
   }
   for(Int k = 0; k < v; ++k) {
      for(Int i = 0; i < v; ++i) {
         for(Int j = 0; j < v; ++j) {
            guard( yss[i][k] and yss[k][j] );
            Int t = xss[i][k] + xss[k][j];
            if( not yss[i][j] or xss[i][j] > t ) {
               xss[i][j] = t;
               yss[i][j] = true;
            }
         }
      }
   }
   for(Int i = 0; i < v; ++i) {
      if( xss[i][i] < 0 ) {
         puts("NEGATIVE CYCLE");
         return 0;
      }
   }
   for(Int i = 0; i < v; ++i) {
      for(Int k = 0; k < v; ++k) {
         printf("%s", yss[i][k]?std::to_string(xss[i][k]).c_str():"INF");
         putchar(k==v-1?'\n':' ');
      }
   }
}

Measured memory_bytes: 3440
import numpy as np
N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))
s = np.sum(B)
for i in range(N-1):
    if A[i]+1 == A[i+1]:
        s += C[A[i]-1]
print(s)

Measured memory_bytes: 12396
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;

#define MOD 1000000007

int main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  cout << (d == 1) << endl;
  return 0;
}

Measured memory_bytes: 3644
#include <iostream>
#include<string>
#include<map>
#include<queue>
#include<algorithm>
using namespace std;
map<string,int> dp;
int direction[]={1,-1,4,-4};
//分别代表右移、左移、下移、上移
void bfs()
{
    queue<string> que;
    que.push("01234567");
    dp["01234567"]=0;
    while(!que.empty()){
        string now=que.front();
        que.pop();
        //p是字符串中0的位置
        int p=0;
        for(int i=0;i<8;i++){
            if(now[i]=='0'){
                p=i;
                break;
            }
        }
        for(int i=0;i<4;i++){
            int n=p+direction[i];
            if(n>=0&&n<8&&!(p==3&&i==0)&&!(p==4&&i==1)){
                //右上角不能向右移、左下角不能向左移
                string next=now;
                swap(next[p],next[n]);
                if(dp.find(next)==dp.end()){
                    //用find函数来定位数据出现位置，它返回的一个迭代器，
                    //当数据出现时，它返回数据所在位置的迭代器，
                    //如果map中没有要查找的数据，它返回的迭代器等于end函数返回的迭代器
                    dp[next]=dp[now]+1;
                    que.push(next);
                }
            }
        }
    }
}
int main()
{
    bfs();
    string s;
    while(getline(cin,s)){
       s.erase(remove(s.begin(),s.end(),' '),s.end());
       cout<<dp[s]<<endl;
    }
    return 0;
}



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

int main(){
  int N,sum;
  cin >> N;
  for(;N>0;N--){
    int a,b,c;
    cin >> a >> b;
    c = b - a + 1;
    sum += c;
  }
  cout << sum << endl;
}
    


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define FIO ios_base::sync_with_stdio (false) ;cin.tie(NULL);
#define tc  int t;cin>>t;for(int i=0;i<t;i++)
#define ll long long int
#define forn(i,n) for(int i=0;i<n;i++)
#define forn1(i,a,b) for(int i=a;i<=b;i++)
#define pb push_back
#define um(a,b) unordered_map<a,b>
#define vv(a) vector<a>
#define pp(a,b) pair<a,b>
ll power(ll a,ll b,ll mod){  ll ans=1;  while(b>0){
  if(b&1){ ans=(ans*a)%mod;} a=(a*a)%mod;  b=b/2; } return ans;}

int main(){
FIO

ll n;
cin>>n;
ll ans=(1000-n%1000)%1000;
cout<<ans<<endl;


}

Measured memory_bytes: 3648
n=int(input())
from collections import deque
kouho=["3","5","7"]
d=deque()
d.extend(kouho)
res=0
kk=0
while kk<=n:
  k=d.popleft()
  for x in kouho:
    a=k
    d.append(k+x)
  if not "3" in k:
    continue
  elif not "5" in k:
    continue
  elif not "7" in k:
    continue
  kk=int(k)
  if kk<=n:
    res+=1
  
  
print(res)
    

Measured memory_bytes: 7540
var n:longint;
x,i,m1,m11,m22,m2:longint;
a,b:array[0..100001]of integer;
begin 
	read(n);
	a[0]:=0;b[0]:=0;//a ou
	m1:=0;m2:=0;
	for i:=1 to n do 
	begin 
		read(x);
		if i mod 2=0 then 
		begin 
			inc(a[x]);
			if (a[x]>a[m1]) and (x<>m1) then begin m11:=m1;m1:=x;end
			else if (a[x]>a[m11]) and (x<>m11) and (x<>m1) then m11:=x;
		end
		else begin 
			inc(b[x]);
			if (b[x]>b[m2]) and (x<>m2) then begin m22:=m2;m2:=x;end
			else if (b[x]>b[m22]) and (x<>m22) and (x<>m2) then m22:=x;
		end;
	end;
	if m1=m2 then 
	begin 
		if a[m11]+b[m2]>a[m1]+b[m22] then write(n-a[m11]-b[m2])
			else write(n-a[m1]-b[m22]);
		exit;
	end;       
	write(n-a[m1]-b[m2]);
end.

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

#define REP(i, s,  n) for(int i = s;i < (n);i++)
#define VSORT(v) sort(v.begin(), v.end());
#define int64 long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;

typedef pair<int, int> P;
typedef pair<int, P> PP;

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

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

int N;
string S;
int w[300001], e[300001];

signed main(){
	cin >> N;
	cin >> S;
	
	w[0] = 0;
	e[0] = 0;
	REP(i, 0, N+1) {
		if(S[i] == 'E') {
			e[i+1] = e[i] + 1;
			w[i+1] = w[i];
		} else {
			e[i+1] = e[i];
			w[i+1] = w[i] + 1;
		}
	}
	int ans = INF;
	REP(i, 0, N+1) {
		ans = min(ans, w[i] + e[N] - e[i+1]);
	}
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 3076
#include<iostream>
#include<time.h>
#include<stdlib.h>

using namespace std;

int main(){
    int N = 0; int K = 0;
    cin >> N;
    cin >> K;
    int cnt = 0;
    for(int i = 0; i < N; i++){
        int a = 0;
        cin >> a;
        if(a >= K) cnt++;   
    }
    cout << cnt;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#include <functional>
#include <ctime>
#include <cmath>
#include <limits>
#include <numeric>
#include <type_traits>
using namespace std;
using ll = long long;

unsigned euclidean_gcd(unsigned a, unsigned b) {
    if (a < b) return euclidean_gcd(b, a);
    unsigned r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}

class UnionFind {
public:
    vector <ll> par;
    vector <ll> siz;
    UnionFind(ll sz_) : par(sz_), siz(sz_, 1LL) {
        for (ll i = 0; i < sz_; ++i) par[i] = i;
    }
    void init(ll sz_) {
        par.resize(sz_);
        siz.assign(sz_, 1LL);
        for (ll i = 0; i < sz_; ++i) par[i] = i;
    }
    ll root(ll x) {
        while (par[x] != x) {
            x = par[x] = par[par[x]];
        }
        return x;
    }
    bool merge(ll x, ll y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        if (siz[x] < siz[y]) swap(x, y);
        siz[x] += siz[y];
        par[y] = x;
        return true;
    }

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

    ll size(ll x) {
        return siz[root(x)];
    }
};

int main() {
    long long a,b;
    cin >> a >> b;
    if (b - a >= 2019)cout << 0 << endl;
    else {
        a %= 2019;
        b %= 2019;
        if (a >= b)b += 2019;
        int h = 100000;
        for (int i = a; i < b+1; i++) {
            for (int j = i + 1; j < b+1; j++) {
                h = min(i * j % 2019, h);
            }
        }
        cout << h << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fill(x,c) memset(x,c,sizeof(x))
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define FORS(I, S) for (int I = 0; S[I]; ++I)
#define MP make_pair
#define PB push_back
using namespace std;
typedef long long ll;
int a[200010];
int t,n;
int MOD = 1e9+7;
const int SIZE = 1e6+10;
int main(){
	cin>>n;
	REP(I,n){
		cin>>a[I];
	}
	for(int i=1;i<n-1;i++){
		if((a[i]>a[i-1]&&a[i]<a[i+1])||(a[i]<a[i-1]&&a[i]>a[i+1])){
			t++;
		}
	} 
	cout<<t;
	return 0;
}




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

int main() {
  int n;
  ll t;
  cin >> n >> t;
  ll a[n];
  rep(i, n) cin >> a[i];
  
  ll res = 0;
  
  ll start = 0;
  
  for(int i = 1; i < n;  ++i){
    if(a[i] > a[i-1] + t){
      res += (a[i-1] - start + t);
      start = a[i];
    }
  }
  res += (a[n-1] - start + t);
  
  cout << res << endl;

  return 0;
}

Measured memory_bytes: 1792
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10**9)
INF = 10**9
mod = 10**9+7

def era(n):
    primes = [0, 1] * (n // 2 + 1)
    if n % 2 == 0:
        primes.pop()
    primes[1] = 0
    primes[2] = 1
    for p in range(3, n + 1, 2):
        if primes[p]:
            for q in range(p * p, n + 1, 2 * p):
                primes[q] = 0
    return primes

Q = i()
primes = []
l1 = era(100000)
for l in range(len(l1)):
    if l1[l] == 1:
        primes.append(l)
l2 = []
for l in primes:
    if (l+1)//2 in primes:
        l2.append(l)
for i in range(Q):
    l,r = I()
    print(bisect.bisect_right(l2,r)-bisect.bisect_left(l2,l))

Measured memory_bytes: 10900
from re import search
def myAnswer(N:int,A:int,B:int,C:int,D:int,S:str) -> str:
   if (search(r'##',S[A-1:max(C,D)])): return "No"
   if(C > D):
      return "Yes" if (search(r'\.\.\.',S[B - 2:D+1])) else "No"
   return "Yes"

def modelAnswer():
   return
def main():
   N,A,B,C,D = map(int,input().split())
   S = input()
   print(myAnswer(N,A,B,C,D,S))
if __name__ == '__main__':
   main()

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

using namespace std;

using ll = long long;

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

    int N;
    cin >> N;
    ll A[N];
    for (int i = 0; i < N; ++i) {
        cin >> A[i];
    }
    ll lgcds[N];
    ll rgcds[N];
    lgcds[0] = rgcds[N - 2] = A[N - 1];
    lgcds[1] = rgcds[N - 1] = A[0];
    for (int i = 1; i <= N - 2; ++i) {
        lgcds[i + 1] = __gcd(lgcds[i], A[i]);
        rgcds[N - i - 2] = __gcd(rgcds[N - i - 1], A[N - i - 1]);
    }
    ll max_gcd = 1;
    for (int i = 0; i < N; ++i) {
        ll gcd = __gcd(lgcds[i], rgcds[i]);
        max_gcd = max(max_gcd, gcd);
    }

    cout << max_gcd << '\n';

    return 0;
}


Measured memory_bytes: 2560
#include<iostream>
#include<iomanip>

int main()
{
    int a, b, c, d, r;
    double f;

    std::cin >> a >> b;

    d = a / b;
    r = a % b;
    f = (double(a) / double(b));

    std::cout << d << " " << r << " " << std::fixed << f << std::endl;

    return 0;
}


Measured memory_bytes: 3292
#include <iostream>
using namespace std;
int main(void){
  string s,a;
  getline(cin,s);
  for(int i=0;i<s.size();++i){
    if('a'<=s[i]&&s[i]<='z')a+=toupper(s[i]);
    else a+=tolower(s[i]);
  }
  cout<<a<<endl;
  return 0;
}

Measured memory_bytes: 1180
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <functional>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include<complex>
#include <cassert>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repd(i, n) for (int i = n; i > 0; i--)
#define mod 1000000007
#define MOD 998244353
#define inf 1e20
typedef long long int ll;
typedef pair<ll, ll> pr;
typedef complex<double> com;


int main(){
	int n, k;
	cin >> n >> k;
	cout << (ll)(k * pow(k-1, n- 1)) << endl;
	return 0;
}
//Ctrl+Aを使わない

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int maxValue = -1999999999;
		int min = sc.nextInt();
		for(int i = 1; i < n; i++) {
			int nowNum = sc.nextInt();
			int maxValueCandidate = nowNum - min;
			if (maxValue < maxValueCandidate) {
				maxValue = maxValueCandidate;
			}
			if(min > nowNum) {
				min = nowNum;
			}
		}
		sc.close();
		System.out.println(maxValue);
	}
}

Measured memory_bytes: 99108
S = gets.chomp

ans = Array.new(S.size, 0)

c = 0
l = 0
0.step(S.size) do |i|
  s = S[i]
  n = S[i+1]
  c += 1
  if s != n
    if s == ?R
      ans[i] = c
      l = i+1
    else
      ans[l] = c
    end
    c = 0
  end
end
i = 0
while i < ans.size
  if ans[i] == 0
    i += 1
  else
    n = (ans[i] + ans[i+1]) / 2
    if (ans[i]-ans[i+1]).abs.odd?
      a = ans[i] < ans[i+1] ? [n, n+1] : [n+1, n]
      if (ans[i] < ans[i+1] && ans[i+1].even?) || (ans[i] > ans[i+1] && ans[i].even?)
        a.reverse!
      end
      ans[i], ans[i+1] = *a
    else
      ans[i] = n
      ans[i+1] = n
    end
    i += 2
  end
end
puts ans


Measured memory_bytes: 2940
#include <iostream>
#include <vector>
#include <cstdio>
#include <string>

using namespace std;

int main(void) {
  string str, fes = "CODEFESTIVAL2016";
  cin >> str;
  int sum = 0;
  for(int i = 0; i < fes.size(); i++) {
    if(str[i] != fes[i]) sum++;
  }

  cout << sum << endl;



  return 0;
}



Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define ll long long                                    // long long省略
#define pb push_back                                    // push_back省略
#define mp make_pair                                    // make_pair省略
#define fi first                                        // first省略
#define se second                                       // second省略
#define itn int                                         // int誤字保険
#define count cout                                      // cout誤字保険
#define vecotr vector                                   // vector誤字保険
#define ednl endl                                       // endl誤字保険
#define opt() cin.tie(0); ios::sync_with_stdio(false)   // 入出力速度改善

#define rep(i,l,r) for(ll i=(l);i<(r);i++)               // 範囲[l, r)で刻み1のfor文(順方向)
#define repp(i,l,r,k) for(ll i=(l);i<(r);i+=(k))         // 範囲[l, r)で刻みkのfor文(順方向)
#define rrep(i,l,r) for(ll i=(r-1);i>=(l);i--)           // 範囲[l, r)で刻み1のfor文(逆方向)
#define rrepp(i,l,r,k) for(ll i=(r-1);i>=(l);i-=(k))     // 範囲[l, r)で刻みkのfor文(逆方向)
#define all(x) (x).begin(), (x).end()                   // vectorのポインタ位置指定用
#define max(p,q)((p)>(q)?(p):(q))                       // max拡張
#define min(p,q)((p)<(q)?(p):(q))                       // min拡張
#define bit(n,m)(((n)>>(m))&1)                          // 変数nのm番目のbitを取り出す

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

int dy[]={0, 1, 0, -1};                                 // 4方向近傍
int dx[]={1, 0, -1, 0};                                 // 4方向近傍

#define INF ((1LL<<62)-(1LL<<31))
//#define MOD 998244353
#define MOD 1000000007
#define invp(a,p) pom(a,p-2,p)

////////////////////////////////////////////////////////////////////////////////////////
bool cmp(pair<ll,ll> p1, pair<ll,ll> p2){
    return p1.fi < p2.fi;
}
int main(){
    ll n,m;cin>>n>>m;
    vector<pair<ll,ll>> p;
    rep(i,0,m){
        ll a,b;cin>>a>>b;
        a--;b--;
        p.pb(mp(a,b));
    }
    sort(all(p),cmp);

    ll lb = p[0].fi, ub = p[0].se, res = 1;
    rep(i,0,m){
        if(ub <= p[i].fi){
            res++;
            lb = p[i].fi;
            ub = p[i].se;
        }else{
            ub = min(ub, p[i].se);
        }
    }
    cout << res << endl;
}


Measured memory_bytes: 2548
N=int(input())
s=input()
t=input()

for i in range(N):
    F=0
    for j in range(i,N):
        if s[j]==t[j-i]:
            continue
        else:
            F=1
            break
    if F==0:
        print(len(s[:i]+t))
        exit()
print(2*N)


Measured memory_bytes: 9120
var s,t,v,w1,w2:ansistring;
    a:array[1..4] of ansistring=('dreamer','eraser','dream','erase');
    i,j,k:longint;
begin
  readln(s);
  t:='';
  v:=s;
  
  while (length(s)<>0) do begin
  w1:=s;
  w2:=s;
  //writeln(s);
      
      if (pos('dreamer',s)=1) then begin
        delete(w1,pos(a[1],w1),length(a[1]));
        delete(w2,pos(a[3],w2),length(a[3]));
        if (pos(a[2],w2)=1) or (pos(a[4],w2)=1) then begin
          t:=t+a[3];
          delete(s,1,length(a[3]));
        end
        else begin
          t:=t+a[1];
          delete(s,1,length(a[1]));
        end;
      end
      else if (pos('eraser',s)=1) then begin
        t:=t+a[2];
        delete(s,1,length(a[2]));
      end
      else if (pos('dream',s)=1) then begin
        t:=t+a[3];
        delete(s,1,length(a[3]));
      end
      else if (pos('erase',s)=1) then begin
        t:=t+a[4];
        delete(s,1,length(a[4]));
      end
      else begin
        writeln('NO');
        exit;
      end;
      
  end;
  if (v<>t) then writeln('NO')
  else writeln('YES');
end.
  

Measured memory_bytes: 1368
package main

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

/*
merge(A, left, mid, right)
  n1 = mid - left;
  n2 = right - mid;
  L[0...n1], R[0...n2] を生成
  for i = 0 to n1-1
    L[i] = A[left + i]
  for i = 0 to n2-1
    R[i] = A[mid + i]
  L[n1] = INFTY
  R[n2] = INFTY
  i = 0
  j = 0
  for k = left to right-1
    if L[i] <= R[j]
      A[k] = L[i]
      i = i + 1
    else
      A[k] = R[j]
	  j = j + 1
*/

const inf = int(1e9) + 1

var total int

func merge(a []int, left, mid, right int) {
	n1 := mid - left
	n2 := right - mid
	L := make([]int, n1+1)
	R := make([]int, n2+1)
	for i := 0; i < n1; i++ {
		L[i] = a[left+i]
	}
	for i := 0; i < n2; i++ {
		R[i] = a[mid+i]
	}
	L[n1] = inf
	R[n2] = inf
	var i, j, k int
	for k = left; k < right; k++ {
		total++
		if L[i] <= R[j] {
			a[k] = L[i]
			i = i + 1
		} else {
			a[k] = R[j]
			j = j + 1
		}
	}
}

func mergeSort(a []int, left, right int) {
	if left+1 < right {
		mid := (left + right) / 2
		mergeSort(a, left, mid)
		mergeSort(a, mid, right)
		merge(a, left, mid, right)
	}
}

func nextInt(sc *bufio.Scanner) int {
	sc.Scan()
	v, _ := strconv.Atoi(sc.Text())
	return v
}

func main() {
	var N int
	fmt.Scan(&N)
	A := make([]int, N)
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	for i := 0; i < N; i++ {
		A[i] = nextInt(sc)
	}
	// fmt.Println("N", N, "A", A)
	wtr := bufio.NewWriter(os.Stdout)
	mergeSort(A, 0, len(A))
	for i := 0; i < len(A); i++ {
		fmt.Fprintf(wtr, "%d", A[i])
		if i != len(A)-1 {
			fmt.Fprintf(wtr, " ")
		}
	}
	fmt.Fprintln(wtr)
	fmt.Fprintln(wtr, total)
	wtr.Flush()
}



Measured memory_bytes: 15008
#define rep(i,n) for (int i=0;i<n;i++)
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
double pi=acos(-1);


int main(){
  
  int N,M;
  
  cin >> N >> M;
  
  vector<vector<int>> G(N+1);
  
  
  rep(i,M){
    int a,b;
    cin >> a >> b;
    G.at(a).push_back(b);
    G.at(b).push_back(a);
    
    
  }

  queue<int> q;
  q.push(1);
  
  vector<bool> torf(N,false);
  vector<int> sign(N);
  
  while(!q.empty()){
    for(int i:G.at(q.front())){
      
      if(torf.at(i-1)==true)
        continue;
      
      torf.at(i-1)=true;
      q.push(i);
      sign.at(i-1)=q.front();
      
      
    }
    q.pop();
  }
  
  bool torf2=true;
  rep(i,N){
    if(torf.at(i)==false)
      torf2=false;
  }
  
  if(torf2==false)
    cout << "No" << endl;
  else{
   	 cout << "Yes" << endl;
    
    	for(int i=1;i<N;i++)
      		cout << sign.at(i) << endl;
    
  }
    
 
  
}

Measured memory_bytes: 10076
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
using namespace std;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef long long ll;

template<class T> inline void read(T &x){
	int f=0;x=0;char ch=getchar();
	for(;!isdigit(ch);ch=getchar())f|=(ch=='-');
	for(;isdigit(ch);ch=getchar())x=x*10+ch-'0';
	if(f)x=-x;
}

const int N=105;
vector<int> b;
int ans[N],n;

int main(){
	read(n);
	b.resize(n+1);
	rep(i,1,n)read(b[i]);
	per(i,n,1){
		int k=0;
		per(j,i,1)
			if(b[j]==j){k=j;break;}
		if(!k){
			puts("-1");
			return 0;
		}
		ans[i]=k;
		b.erase(b.begin()+k);
	}
	rep(i,1,n)printf("%d\n",ans[i]);

	return 0;
}

Measured memory_bytes: 256
let () =
  let n = read_int () in
  let ans = ref min_int in
  let m = ref (read_int ()) in
  for _ = 1 to n - 1 do
    let r = read_int () in
    if !ans < (r - !m) then ans := r - !m;
    if r < !m then m := r;
  done;
  Printf.printf "%d\n" !ans

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

High = [1]
for i in range(998):
    High.append(High[-1] + i+2)

A = []
for h1, h2 in zip(High, High[1:]):
    A.append(h2 - h1)
    if h2 - h1 == b - a:
        print(h1-a)
        exit()


Measured memory_bytes: 38384
#include <bits/stdc++.h>
#include <boost/range/adaptor/reversed.hpp>
#include <boost/range/irange.hpp>

using namespace std;
using namespace boost;
using namespace boost::adaptors;

main() {
    string a;
    cin >> a;

    constexpr int64_t M = 'z' - 'a' + 1;

    vector<vector<int64_t>> idxs(a.size() + 1, vector<int64_t>(M, -1));
    for (auto i : irange(0uL, a.size())) {
        for (auto c : irange('a' + 0, 'z' + 1)) {
            if (a[i] == c) {
                idxs[i + 1][c - 'a'] = i;
            } else {
                idxs[i + 1][c - 'a'] = idxs[i][c - 'a'];
            }
        }
    }

    vector<vector<int64_t>> idxs2(a.size() + 1, vector<int64_t>(M, -1));
    int64_t cur = a.size();
    for (auto i : irange(1uL, a.size() + 1)) {
        int64_t m = a.size();
        for (auto c : irange(0L, M)) {
            auto idx = idxs[cur][c];
            if (idx == -1) {
                string s;
                s += c + 'a';

                auto ch = c;
                int64_t idx3 = -1;
                for (auto j : irange(1uL, i) | reversed) {
                    for (auto d : irange(0L, M)) {
                        if (idxs[idxs2[j][d]][ch] == idx3) {
                            s += d + 'a';
                            ch = d;
                            idx3 = idxs2[j][d];
                            break;
                        }
                    }
                }

                cout << s << endl;
                return 0;
            }

            if (idx < m) {
                m = idx;
            }

            idxs2[i][c] = idx;
        }

        cur = m;
    }
}

Measured memory_bytes: 97284
import { readFileSync } from "fs";

const read = () =>
  readFileSync(0, "utf8")
    .split("\n")
    .map((line) => line.split(" "));

const main = (input: string[][]) => {
  const bag = input[1];

  return new Set(bag).size === 3 ? "Three" : "Four";
};

console.log(main(read()));


Measured memory_bytes: 29620
def main():
    N = int(input())
    A = [int(i) for i in input().split()]
    avg1 = sum(A)//N
    avg2 = avg1 + 1
    ans1 = 0
    ans2 = 0
    for a in A:
        ans1 += (a - avg1)**2
        ans2 += (a - avg2)**2
    print(min(ans1,ans2))

if __name__ == '__main__':
    main()

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

using namespace std;
using type = long;

bool check(const vector<type>& A)
{
    type N = A.size();
    if (N % 2 == 0) {
        for (type i = 0; i < N; ++i) {
            if (i % 2 == 0 and A[i] != 0) return false;
            if (i % 2 == 1 and A[i] != 2) return false;
        }
    } else {
        if (A[0] != 1) return false;
        for (type i = 1; i < N; ++i) {
            if (i % 2 == 0 and A[i] != 2) return false;
            if (i % 2 == 1 and A[i] != 0) return false;
        }
    }
    return true;
}

int main()
{
    type N;
    cin >> N;
    vector<type> A(N, 0);
    for (type i = 0; i < N; ++i) {
        type Ai;
        cin >> Ai;
        ++A[Ai];
    }
    type ans = 0;
    if (check(A)) {
        ans = 1;
        for (type i = 0; i < N/2; ++i) {
            ans *= 2;
            ans %= 1000000007;
        }
    }
    cout << ans << endl;
    return 0;
}

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

// ====================================================================
template<typename T>void write(T x) {if (x < 0) {putchar('-'); x = -x;} char buf[20], *p = buf; do {*p++ = '0' + x % 10; x /= 10;} while (x); do {putchar(*--p);} while (p > buf);}
template<typename T>void read(T &x) {char c; while (c = getchar(), c <= ' '); bool sign = c == '-'; if (sign)c = getchar(); x = c - '0'; while (c = getchar(), c >= '0' && c <= '9') {x = (x << 3) + (x << 1) + (c - '0');} if (sign)x = -x;}
// ====================================================================

const int MAX = 1e6 + 1;
int cnt[MAX];
int ans[MAX];

signed main() {
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(NULL);

    int n;
    read(n);

    int max = 0;
    int g = 0;

    for (int _ = 0; _ < n; _++) {
        int i;
        read(i);

        ++cnt[i];
        max = std::max(max, i);
        g = std::gcd(g, i);
    }

    if (g != 1) {
        puts("not coprime");
        return 0;
    }

    for (int i = 1; i <= max; i++) {
        for (int j = i; j <= max; j += i) {
            ans[i] += cnt[j];
        }
    }

    for (int i = 2; i <= max; i++) {
        if (ans[i] > 1) {
            puts("setwise coprime");
            return 0;
        }
    }

    puts("pairwise coprime");

    return 0;
}



Measured memory_bytes: 11460
#include <algorithm>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for(int i = 0; (i) < (n); (i)++)
#define FOR(i, m, n) for(int i = (m); (i) < (n); (i)++)
#define All(v) (v).begin(), (v).end()
#define MP make_pair
#define pb push_back
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1 << 30;
const ll LINF = 1LL << 61;
const int MOD = 1e9 + 7;

int main() {
    ll N;
    cin >> N;
    ll res = 1;
    for(int i = 1; i <= N; i++) {
        res = (res * i) % MOD;
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<algorithm>
#include<cmath>
#include<queue>
#include<vector>
#include<stack>
using namespace std;

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

int main() {
	int len;
	string s;
	cin >> len >> s;
	//int len = s.length();

	int a = 0;
	REP(i, len) {
		if (s[i] == 'x') a++;

		if (s[i] == 'o')a = 0;
		if (a == 2) {
			cout << i << endl;
			return 0;
		}
	}

	cout << len << endl;
	return 0;
}

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

int main(){

  string S;
  cin>>S;
  
  int N=S.size();
  
  for(int i=N-2;i>0;i-=2){

    string s=S.substr(0,i);
    if(s.substr(0,i/2)==s.substr(i/2,i/2)){cout<<i<<endl;return 0;}
    
  }
  
  

}

Measured memory_bytes: 256
def main():
    N = input().strip()
    stack = []
    for s in N:
        if len(stack)==0:
            stack.append(s)
        elif stack[-1]=="S" and s=="T":
            stack.pop()
        else:
            stack.append(s)
    print(len(stack))


if __name__ == "__main__":
    main()

Measured memory_bytes: 5096
#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef long double D;
typedef complex<D> P;
#define F first
#define S second
const ll MOD=1000000007;
//const ll MOD=998244353;

template<typename T,typename U>istream & operator >> (istream &i,pair<T,U> &A){i>>A.F>>A.S; return i;}
template<typename T>istream & operator >> (istream &i,vector<T> &A){for(auto &I:A){i>>I;} return i;}
template<typename T,typename U>ostream & operator << (ostream &o,const pair<T,U> &A){o<<A.F<<" "<<A.S; return o;}
template<typename T>ostream & operator << (ostream &o,const vector<T> &A){ll i=A.size(); for(auto &I:A){o<<I<<(--i?" ":"");} return o;}



int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll N;
  cin>>N;
  for(ll i=0;i<1000000;i++){
    if(i*108/100==N){cout<<i<<endl; return 0;}
  }
  cout<<":("<<endl;

  return 0;
}


Measured memory_bytes: 256
/// awoooooo

# include <bits/stdc++.h>
# define sz(x) (int)((x).size())

using namespace std;

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

const int N = (int)2e5 + 5;
const int inf = (int)1e9 + 7;

int n, a, b, c, d;

int main(){
  cin >> n >> a >> b >> c >> d;
  int diff = b - a;
  for(int i = 0; i < n; ++i){
    int j = (n - i - 1);
    ll L = i * 1ll * -d + c * 1ll * j;
    ll R = i * 1ll * -c + d * 1ll * j;
    if(L <= diff && diff <= R){
      cout << "YES\n";
      return 0;
    }
  }
  cout << "NO\n";
  return 0;
}


Measured memory_bytes: 256
k = int(input())
dp = [0] * 100000
count = 0
result = []

def u(n, r, now):
    global count
    if r < 0 or r > 9:
        return 0
    if n == 1 and r == 0:
        return 0
    if n == 1 and r >= 1 and r <= 9: # Match!
        count += 1
        result.append(int(now))
        return 1
    return u(n - 1, r - 1, str(r - 1) + now) + u(n - 1, r, str(r) + now) + u(n - 1, r + 1, str(r + 1) + now)

def a(n):
    result = 0
    for i in range(10):
        result += u(n, i, str(i))
    return result

for i in range(1, 11):
    a(i)

result.sort()
print(result[k - 1])
'''
for i in range(1, 1000):
    print(result[i - 1])
'''

Measured memory_bytes: 62680
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(ll i=(n)-1;i>=0;i--)
#define range(i,a,n) for(ll i=(a);i<(n);i++)
#define LINF ((ll)1ll<<62)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI (3.1415926535897932384)

int dx[]={1,0,-1,0,1,-1,-1,1},dy[]={0,1,0,-1,1,1,-1,-1};
template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class S>S sum(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
int sgn(const double&r){return (r>EPS)-(r<-EPS);} // a>0  : sgn(a)>0
int sgn(const double&a,const double&b){return sgn(a-b);} // b<=c : sgn(b,c)<=0

template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>void tf(bool b,S t,T f){if(b)puta(t);else puta(f);}
void YN(bool b){tf(b,"YES","NO");}
void Yn(bool b){tf(b,"Yes","No");}
void yn(bool b){tf(b,"yes","no");}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1;for(auto s:t){os<<(a?"":" ")<<s;a=0;}return os;}
template<class S>auto&operator>>(istream&is,vector<S>&t){for(S&a:t)cin>>a;return is;}

/*他のライブラリを入れる場所*/

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    ll n,r;
    cin>>n>>r;
    if(n>10){
        puta(r);
        return 0;
    }else{
        ll rate=r+100*(10-n);
        puta(rate);
        return 0;
    }


}

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

#define ll long long int
#define INFTY (1<<21)

using namespace std;

int main(void){
    cin.sync_with_stdio(false);
    int N;
    cin>>N;
    switch(N){
        case 7:
        case 5:
        case 3:
            cout<<"YES"<<endl;
            break;
        default:
            cout<<"NO"<<endl;
            break;
    }
    return 0;
}

Measured memory_bytes: 256
# coding: utf-8
import time
import re
import math
import fractions

def main():
    K,S=map(int,input().split())
    count=0
    for x in range(0,K+1):
        for y in range(0,K+1):
            if S-x-y<=K and S-x-y>=0:
                count+=1
    print(count)
start=time.time()
main()
#print("処理速度 {}sec".format(time.time()-start))
#A=list(map(int,input().split()))
#A,B,C=map(int,input().split())
#n=int(input())



Measured memory_bytes: 5556
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
//#include <math.h>
#include <algorithm>
#include <vector>

typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))

using namespace std;

#define MOD 1000000007


int main(int argc, char* argv[])
{
    long n;
    scanf("%ld", &n );

    vector<long> a(n);
    vector<long> b(n);
    vector<ll> d(n);

    long i;
    for(i=0; i<n; i++) {
        scanf("%ld", &(a[i]));
    }
    for(i=0; i<n; i++) {
        scanf("%ld", &(b[i]));
        d[i] = b[i]-a[i];
    }

    sort( d.begin(), d.end() );

    long count = 0;
    ll sum = 0;
    for(i=0; i<n; i++) {
        if(d[i]>0) {
            count ++;
            sum += d[i];
        }
    }

    if(sum>0) {
        for(i=0; i<n; i++) {
            if(d[i]<0) {
                count ++;
                sum += d[i];
            }
            if(sum <= 0)
                break;
        }
        if(i==n) {
            printf("-1\n");
            return 0;
        }
    }
    printf("%ld\n", count);

    return 0;
}


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

using namespace std;

using int64 = long long;

struct LCNode {
  using LP = LCNode *;

  using data_t = int;
  using lazy_t = int;

  LP l, r, p;
  int idx, sz;
  bool rev;
  data_t key, sum;
  lazy_t lazy;

  void init_node(int idx, const data_t &v) {
    this->sz = 1;
    this->idx = idx;
    this->lazy = 0; // <-
    this->key = this->sum = v;
  }

  void update() {
    sz = 1;
    sum = key;
    if(l) {
      sz += l->sz;
      // <- sum += l->sum
    }
    if(r) {
      sz += r->sz;
      // <- sum += r->sum

    }
  }

  void propagate(const lazy_t &v) {
    // <- lazy+=v, key+=v, sum+=v
  }

  void toggle() {
    swap(l, r);
    rev ^= true;
    // <-
  }

  bool is_root() {
    return !p || (p->l != this && p->r != this);
  }

  void push() {
    if(lazy) { // <-
      if(l) l->propagate(lazy);
      if(r) r->propagate(lazy);
      lazy = 0; // <-
    }
    if(rev) {
      if(l) l->toggle();
      if(r) r->toggle();
      rev = false;
    }
  }

  void rotr() {
    LP x = p, y = x->p;
    if((x->l = r)) r->p = x;
    r = x, x->p = this;
    x->update(), update();
    if((p = y)) {
      if(y->l == x) y->l = this;
      if(y->r == x) y->r = this;
      y->update();
    }
  }

  void rotl() {
    LP x = p, y = x->p;
    if((x->r = l)) l->p = x;
    l = x, x->p = this;
    x->update(), update();
    if((p = y)) {
      if(y->l == x) y->l = this;
      if(y->r == x) y->r = this;
      y->update();
    }
  }

  void splay() {
    push();
    while(!is_root()) {
      LP q = p;
      if(q->is_root()) {
        q->push(), push();
        if(q->l == this) this->rotr();
        else this->rotl();
      } else {
        LP r = q->p;
        r->push(), q->push(), push();
        if(r->l == q) {
          if(q->l == this) q->rotr(), rotr();
          else rotl(), rotr();
        } else {
          if(q->r == this) q->rotl(), rotl();
          else rotr(), rotl();
        }
      }
    }
  }

  LP expose() {
    LP rp = nullptr;
    for(LP cur = this; cur; cur = cur->p) {
      cur->splay();
      cur->r = rp;
      cur->update();
      rp = cur;
    }
    splay();
    return rp;
  }

  void link(LP parent) {
    expose();
    parent->expose();
    p = parent;
    parent->r = this;
  }

  void cut() {
    expose();
    LP parent = l;
    l = nullptr;
    parent->p = nullptr;
  }

  void evert() {
    expose();
    toggle();
    push();
  }

  LP lca(LP v) {
    expose();
    return v->expose();
  }

  void set_propagate(const lazy_t &x) {
    expose();
    propagate(x);
    push();
  }
};

int main() {
  int N;
  scanf("%d", &N);
  vector< LCNode * > uku(N);
  for(int i = 0; i < N; i++) {
    uku[i] = new LCNode();
    uku[i]->init_node(i, 0);
  }
  for(int i = 0; i < N; i++) {
    int K;
    scanf("%d", &K);
    while(K--) {
      int T;
      scanf("%d", &T);
      uku[T]->link(uku[i]);
    }
  }
  int Q;
  scanf("%d", &Q);
  while(Q--) {
    int U, V;
    scanf("%d %d", &U, &V);
    printf("%d\n", uku[V]->lca(uku[U])->idx);
  }
}


Measured memory_bytes: 9968
#include <iostream>
#include <algorithm>
#include <cstring>

using namespace std;

int alpha[30];

int main(){
	string s;
	cin>>s;
	for(int i=0;i<s.size();i++){
		for(int j=0;j<27;j++){
			if((s[i]-'a')==j)alpha[j]++;
		}
	}
	for(int j=0;j<27;j++){
		if(alpha[j]%2!=0){
			cout<<"No"<<endl;
			return 0;
		}

	}
	cout<<"Yes"<<endl;
	return 0;
}

Measured memory_bytes: 256
fun main() {
    val n = nextLong()
    println(
        if (n % 2 == 0L) {
            n
        } else {
            2 * n
        }
    )
}

// # Utils
// ## Input
fun next() = readLine()!!
fun nextInt() = next().toInt()
fun nextLong() = next().toLong()
fun nextDouble() = next().toDouble()
fun nextList() = next().split(" ")
fun nextIntList() = next().split(" ").map(String::toInt)
fun nextLongList() = next().split(" ").map(String::toLong)
fun nextDoubleList() = next().split(" ").map(String::toDouble)

// ## Array
inline fun <reified T> sizedArray(size: Int, default: T) = Array(size) { default }
inline fun <reified T> sized2DArray(row: Int, column: Int, default: T) = Array(row) { Array(column) { default } }

// ## mod^-1
//    [NOTE] CANNOT use this for 0, mod, 2mod, 3mod ...(return wrong value)
fun modinv(num: Long, mod: Long): Long {
    var a = num
    var b = mod
    var u = 1L
    var v = 0L
    while (b > 0) {
        val t = a.div(b)
        a -= t * b
        a = b.also { b = a } // swap a and b
        u -= t * v
        u = v.also { v = u } // swap u and v
    }
    u %= mod
    if (u < 0) u += mod
    return u
}

fun gcd(x: Int, y: Int): Int {
    fun innerGcd(x: Int, y: Int): Int {
        return if (x % y == 0) y else innerGcd(y, x % y)
    }
    return if (x >= y) innerGcd(x, y) else innerGcd(y, x)
}

fun gcd(x: Long, y: Long): Long {
    fun innerGcd(x: Long, y: Long): Long {
        return if (x % y == 0L) y else innerGcd(y, x % y)
    }
    return if (x >= y) innerGcd(x, y) else innerGcd(y, x)
}

// classes
class UnionFindTree(val size: Int) {
    private val r = sizedArray(size, -1)
    fun root(x: Int): Int {
        if (r[x] < 0) return x
        return root(r[x])
    }

    fun unite(x: Int, y: Int) {
        var rx = root(x)
        var ry = root(y)
        if (rx == ry) return
        if (r[rx] > r[ry]) {
            rx = ry.also { ry = rx }
        }
        r[rx] += r[ry]
        r[ry] = rx
    }

    fun size(x: Int) = -r[root(x)]

    override fun toString(): String {
        return r.joinToString(separator = ", ")
    }
}

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

using namespace std;

#define all(v)				((v).begin()), ((v).end())
#define allr(v)				((v).rbegin()), ((v).rend())
#define sz(v)				((int)((v).size()))
#define rep(i, v)		for(int i=0;i<sz(v);++i)
#define lp(i, n)		for(int i=0;i<(int)(n);++i)
#define lpi(i, j, n)	for(int i=(j);i<(int)(n);++i)
#define lpd(i, j, n)	for(int i=(j);i>=(int)(n);--i)
#define ll long long
#define pb					push_back
#define fIO ios_base::sync_with_stdio(0);cin.tie(0);

const ll oo = 1e7;
const double pi = 3.1415926535897;


const double EPS = (1e-7);
int dcmp(double x, double y) {	return fabs(x-y) <= EPS ? 0 : x < y ? -1 : 1;	}


typedef vector<int>                vi;
typedef vector<pair<int,int>>      vii;
typedef vector<ll>                 vll;
typedef vector<double>             vd;
typedef vector< vi >               vvi;
typedef vector< vd >               vvd;
typedef vector<string>             vs;

/**
    * PLEASEEE READDD PROBLEEEM CARFULLY ****
    * Always check for OVERFLOW ll vs int
    * Always check for array bounds
    * Check for function return
    * READ OUTPUT SECTION AGAIN!!!
**/

struct edge{
    int from,to,w;
    edge(int uu,int vv,int ww):from(uu),to(vv),w(ww){}

    bool operator < (const edge &rhs) const{
        return w > rhs.w;
    }
};

const int N = 205;

int main(){
   /* string s1,s2;
    cin >> s1 >> s2;
    int ans = 0;
    for(int i = 0;i<s1.length();i++){
        ans += s1[i] == s2[i];
    }
    cout <<ans;*/
    /*int a,b;
    cin >> a >> b;
    if(b == 1)
        return cout << 0,0;
    int ans = 1,sockets = a;
    while(sockets < b){
        ans++;
        sockets += a-1;
    }
    cout << ans;
    */
    int n;
    cin >>n;
    int arr[n];
    lp(i,n)cin >> arr[i];
    int maxi = 0;
    int idx = 1;
    while(idx<n){
        int ans = 0;
        int f  = 1;
        while(idx < n && arr[idx] <= arr[idx-1]){
                ans++;idx++;
                f = 0;
        }
        if(f)idx++;
        //cout << idx<<endl;
        maxi = max(ans,maxi);
    }
    cout << maxi;
}











Measured memory_bytes: 640
#include <bits/stdc++.h>
#define Int int64_t

using namespace std;

int main() {
	int N;
	cin >> N;
	vector<string> s(N);
	vector<int> t(N);
	for (int i = 0; i < N; ++i) { cin >> s[i] >> t[i]; }
	string x;
	cin >> x;

	int ans = 0;
	for (int i = 0; i < N; ++i) {
		if (s[i] != x) { continue; }
		for (int j = i + 1; j < N; ++j) {
			ans += t[j];
		}
		break;
	}
	cout << ans << endl;
	
	return 0;
}


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

int main(){

    int n;

    cin >> n;

    vector<int> p(n);
    vector<int> q(n);

    vector<int> x(n);


    for(int i = 0;i < n+1 ;i++){
        x[i]= i+1;
    }

    for (size_t i = 0; i < n; i++)
    {
        cin >> p[i];
    }

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

    do
    {
        if(equal(x.cbegin(),x.cend(),p.cbegin()))a=c;
        if(equal(x.cbegin(),x.cend(),q.cbegin()))b=c;
        c++;
    } while (next_permutation(x.begin(),x.end()));
    
    cout << abs(a-b) << endl;

    return 0;
}

Measured memory_bytes: 256
#line 1 "main_f.cpp"
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cstdint>
#include <cstdlib>
#include <cmath>
#include <complex>
#include <chrono>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>
#include <random>
#include <utility>
#include <limits>
#include <list>
#include <type_traits>

/* template start */

using i64=std::int_fast64_t;
using u64=std::uint_fast64_t;
 
#define rep(i, a, b) for (i64 i = (a); (i) < (b); (i)++)
#define all(i) i.begin(), i.end()

#ifdef LOCAL
#define debug(...) std::cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif

void debug_out(){std::cerr<<std::endl;}

template<typename Head,typename... Tail>
void debug_out(Head h,Tail... t){
  std::cerr<<" "<<h;
  if(sizeof...(t)>0)std::cout<<" :";
  debug_out(t...);
}
 
template <typename T1, typename T2>
std::ostream& operator<<(std::ostream& os, std::pair<T1, T2> pa) {
  return os << pa.first << " " << pa.second;
}
 
template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
  for (std::size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
  return os;
}
 
template<typename T1,typename T2>
inline bool chmax(T1& a,T2 b){return a<b && (a=b,true);}
 
template<typename T1,typename T2>
inline bool chmin(T1& a,T2 b){return a>b && (a=b,true);}

template<typename Num>
constexpr Num mypow(Num a, u64 b,Num id=1) {
  if(b==0)return id;
  Num x = id;
  while (b > 0) {
    if(b & 1)x*=a;
    a*=a;
    b >>= 1;
  }
  return x;
}

/* template end */

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

  i64 n;
  std::cin>>n;

  i64 ans=0;

  rep(i,1,n+1)ans+=i*(n+1-i);

  rep(i,0,n-1){
    i64 u,v;
    std::cin>>u>>v;
    if(u>v)std::swap(u,v);
    v--;
    ans-=u*(n-v);
  }

  std::cout<<ans<<"\n";
  
  return 0;
}


Measured memory_bytes: 3632