akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize ("O3")
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <vector>
#include <set>
#include <map>
#include <cstring>
#include <stack>
#include <unordered_map>
#define lld long long int
#define dbg1(vari1) cerr<<#vari1<<" = "<<(vari1)<<endl;
#define dbg2(vari1,vari2) cerr<<#vari1<<" = "<<(vari1)<<" "<<#vari2<<" = "<<(vari2)<<endl;
#define dbg3(vari1,vari2,vari3) cerr<<#vari1<<" = "<<(vari1)<<" "<<#vari2<<" = "<<(vari2)<<" "<<#vari3<<" = "<<(vari3)<<endl;
using namespace std;
int mod = (int)1e9+7;
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n,m;
	cin >> n >> m;
	vector <string> grid(n);
	for(int i=0;i<n;i++)
	{
		cin >> grid[i];
	}
	vector <vector<int>> dp(n,vector <int> (m,0));
	dp[0][0]=1;
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<m;j++)
		{
			if(i==0&&j==0)
				continue;
			if(grid[i][j]=='#')
				continue;
			if(j>0)
				dp[i][j]=(dp[i][j]%mod+dp[i][j-1]%mod)%mod;
			if(i>0)
				dp[i][j]=(dp[i][j]%mod+dp[i-1][j]%mod)%mod;
		}
	}
	cout << dp[n-1][m-1];
}

Measured memory_bytes: 5248
#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <iomanip>
#include <vector>
#include <cstring>
#include <queue>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
using uld = unsigned long long;
const ll mod = 1e9+7;
const int dx[4] = {0,1,0,-1};
const int dy[4] = {1,0,-1,0};
template<class T> inline bool chmax(T &a,T& b){if(a < b){a = b; return true;} else return false;}
template<class T> inline bool chmin(T &a,T& b){if(a > b){a = b; return true;} else return false;}
int main(){
    int a,b,t;
    cin >> a >> b >> t;
    cout << b*(t/a) << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <sstream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <queue>
using namespace std;

int main() {
    long N;
    cin >> N;
    vector<string> s(N);
    for (long i=0; i<N; i++) {
        cin >> s[i];
    }
    
    long long AB=0;
    long long _A=0;
    long long B_=0;
    long long B_A=0;
    for (long i=0; i<N; i++) {
        for (long j=0; j<s[i].size()-1; j++) {
            if (s[i][j]=='A'&&s[i][j+1]=='B') {
                AB++;
            }
        }
        if (s[i][0]=='B') {
            B_++;
        }
        if (s[i][s[i].size()-1]=='A') {
            _A++;
        }
        if (s[i][0]=='B'&&s[i][s[i].size()-1]=='A') {
            B_A++;
        }
    }
    
    long long ans=0;
    if (_A==B_&&B_==B_A) {
        if(B_A==0){
            ans=AB;
        }
        else{
            ans=AB+B_A-1;
        }
    }
    else{
        if (_A<B_) {
            ans=AB+_A;
        }
        else{
            ans=AB+B_;
        }
    }
    
    //cout << AB << endl << _A << endl << B_ << endl << B_A << endl;
    cout << ans << endl;
}


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

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N,K;cin>>N>>K;
  int ans;
  while(N/K){
    N=N/K;
    ans++;
  }
  ans++;
  cout << ans <<endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <cstdint>
#include <cstdio>
#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 pb push_back
#define MP(a, b) make_pair((a), (b))
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const int INF = 1 << 30;
const ll LINF = 1LL << 60;
const int MOD = 1e9 + 7;

int main() {
    int N;
    cin >> N;
    vector<int> A(N);
    rep(i, N) { cin >> A[i]; }
    int res = 0;
    rep(i, N) {
        if(i % 2 == 0 && A[i] % 2 == 1)
            res++;
    }
    cout << res << endl;
    return 0;
}

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

using namespace std;

int main () {
        int n, count = 0;
        cin >> n;
        int arr[n], temp[n];

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

        sort(arr, arr + n);

        for (int i = 0; i < n; ++i) {
                if (arr[i] != temp[i]) {
                        count++;
                }
        }

        if (count < 3) cout << "YES\n";
        else cout << "NO\n";
}


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

using namespace std;

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

typedef long long ll;
//No change above here

const ll maxi = (2 * 1e5 + 3);
ll mod = (1e9 + 7);

//function for power
ll power(ll x, ll n) {
	ll res = 1;
	x %= mod;
	while (n) {
		if (n & 1)
			res = (res * x) % mod;
		x = (x * x) % mod;
		n >>= 1;
	}
	return res;
}

ll dir[4][2] = { {1, 0}, {-1, 0}, {0, 1}, {0, -1} };

ll p, q;
bool valid(ll i, ll j) { return i >= 1 && i <= p && j >= 1 && j <= q; }

//declare needed things here

int main()
{
	IOS;
	ll n ,k;
	cin >> n;
	ll mul = 26,count=0;
	string ans;
	while (n > 0)
	{
		ll x = n % 26;
		if (!x)
			x = 26;
		char c = 'a' + x - 1;
		ans += c;
		if (n%26==0)
			--n;
		n /= 26;
	}
	reverse(ans.begin(), ans.end());
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3652
#include <stdio.h>
#include <iostream>
#include <stack>
#include <vector>
#include <utility>
#include <list>
#include <algorithm>
using namespace std;

#define N 5000000

class Hash
{
  private:
    list<string> *a;

    unsigned long long getChar(char ch)
    {
        switch (ch)
        {
        case 'A':
            return 1;
        case 'C':
            return 2;
        case 'G':
            return 3;
        case 'T':
            return 4;
        default:
            return 0;
        }
    }

    unsigned long long getKey(string str)
    {
        unsigned long long x = 0;
        for (unsigned int i = 0; i < str.length(); i++)
        {
            x += getChar(str[i]);
            x *= 5;
        }
        return x % N;
    }

  public:
    Hash()
    {
        a = new list<string>[N];
    }

    void insert(string str)
    {
        a[getKey(str)].push_back(str);
    }

    bool find(string str)
    {
        unsigned long long key = getKey(str);
        list<string>::iterator itr = a[key].begin();
        for (; itr != a[key].end(); itr++)
            if (str == *itr)
                return true;
        return false;
    }
};

int main()
{
    Hash H;
    int n;
    cin >> n;
    string str;
    for (int i = 0; i < n; i++)
    {
        //cout << i << "\n";
        cin >> str;
        if (str[0] == 'i')
        {
            cin >> str;
            H.insert(str);
        }
        else if (str[0] == 'f')
        {
            cin >> str;
            if (H.find(str))
                cout << "yes\n";
            else
                cout << "no\n";
        }
    }
}


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

#define debug(s) cout << s << endl
#define debug1(s, t) cout << s << " " << t << endl
#define debug2(s, t, u) cout << s << " " << t << " " << u << endl
#define printvec(v)       \
    for (auto &&i : v)    \
        cout << i << " "; \
    cout << endl
#define rep(n, i) for (int i = 0; i < n; i++)

using namespace std;
using i64 = long long;

int main()
{
    string s;
    cin >> s;

    string ans;
    if(s.back() == 's')
    {
        s.push_back('e');
        s.push_back('s');
    }
    else
    {
        s.push_back('s');
    }
    
    cout << s << endl;

    return 0;
}

Measured memory_bytes: 3620
class UnionFind(n: Int) {
    private val parent = IntArray(n, {-1})
    private val rank = IntArray(n, {0})
    private val size = IntArray(n, {1})
    private var numTree = n
    
    fun find(x: Int): Int {
        if (parent[x] == -1) {
            return x
        } else {
            parent[x] = find(parent[x])
            return parent[x]
        }
    }
    
    fun isSame(x: Int, y: Int): Boolean {
        return find(x) == find(y)
    }
    
    fun getSize(): Int {
        return numTree
    }
    
    fun sizeOf(x: Int): Int {
        return size[find(x)]
    }
    
    fun rankOf(x: Int): Int {
        return rank[find(x)]
    }
    
    fun unite(x: Int, y: Int) {
        val parentX = find(x)
        val parentY = find(y)
        
        if (parentX == parentY) {
            return
        }
        
        numTree--
        
        if (rank[parentX] < rank[parentY]) {
            parent[parentX] = parentY
            size[parentY] += size[parentX]
        } else {
            parent[parentY] = parentX
            size[parentX] += size[parentY]
            if (rank[parentX] == rank[parentY]) {
                rank[parentX]++
            }
        }
    }
}

fun main(args: Array<String>) {
    val (N, M) = readInputLine().split(" ").map { it.toInt() }
    
    val unionFind = UnionFind(N)
    
    for (i in 1..M) {
        val (X, Y, Z) = readInputLine().split(" ").map { it.toInt() - 1 }
        unionFind.unite(X, Y)
    }

    println(unionFind.getSize())
}

fun readInputLine(): String {
    return readLine()!!
}


Measured memory_bytes: 58276
#include<stdio.h>

int main(){
   int a,b,x;
   scanf("%d %d", &a, &b);
   x = b + (100*(10-a));
   if(a >= 10){
      printf("%d\n", b);
   }else{
      printf("%d\n", x);
   }
   return 0;
}


Measured memory_bytes: 1732
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
    int n;
    string s;
    cin>>n>>s;

    vector<int> l(n);
    l[0]=0;
    for(int i=1;i<n;i++){
        l[i] = l[i-1];
        if(s[i-1] == 'W') l[i]++;
    }

    vector<int> r(n);
    r[n-1]=0;
    for(int i=n-1;i>=0;i--){
        r[i] = r[i+1];
        if(s[i+1] == 'E') r[i]++;
    }

    int min = l[0]+r[0];
    for(int i=1;i<n;i++){
        int tmp = l[i]+r[i];
        if(tmp < min) min = tmp;
    }

    cout << min << endl;
}


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

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

    vector<bool> visited(1e6, false);
    queue<int> q;
    q.push(0);
    while (!q.empty())
    {
        int next = q.front();
        q.pop();
        if (next == X)
        {
            cout << 1 << endl;
            return 0;
        }
        if (visited[next])
        {
            continue;
        }
        visited[next] = true;
        for (int i = 100; i <= 105; i++)
        {
            if (next + i <= X)
            {
                q.push(next + i);
            }
        }
    }
    cout << 0 << endl;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
using ull=unsigned long long;
using ar=array<ull,26>;
#define rep(i,n) for(int i=0;i<n;i++)
#define range(i,a,n) for(int i=a;i<n;i++)
int main(){
	string s1,s2;
	ar ht; ht[0]=1;
	rep(i,25) ht[i+1]=ht[i]*10007;
	
	while(cin>>s1>>s2){
		if(s1.size()>s2.size()) swap(s1,s2);
		int n1=s1.size(), n2=s2.size();
		unordered_set<ull> list1;
		vector<ull> p1,p2;
		for(auto c:s1)p1.push_back(ht[c-'a']);
		for(auto c:s2)p2.push_back(ht[c-'a']);
		
		for(int l=n1;l>=1;l--){
			list1.clear();
			ull tmp=0;
			rep(i,n1) {
				tmp+=p1[i];
				if(i>=l) tmp-=p1[i-l];
				if(i>=l-1) list1.insert(tmp);
			}
			tmp=0;
			rep(i,n2){
				tmp+=p2[i];
				if(i>=l) tmp-=p2[i-l];
				if(i>=l-1) {
					if(list1.find(tmp) != list1.end()){
						cout<<l<<endl;
						goto end;
					}
				}
			}
		}
		cout<<0<<endl;
		end: ;
	}
	return 0;
}



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

const long long mod = 1e9 + 7;

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

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

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }

const string YES = "Yes";
const string NO = "No";

int main(){
    int n;
    cin >> n;
    int k = 1;
    while (k*(k-1)/2 <= n) {
        if (k*(k-1)/2 == n) break;
        ++k;
    }
    if (k*(k-1)/2 > n) cout << NO << endl;
    else {
        vector<vi> s(k);
        int val = 1;
        for (int i=0; i<k; ++i) for (int j=i+1; j<k; ++j) {
            s[i].pb(val); s[j].pb(val);
            ++val;
        }
        cout << YES << endl;
        cout << k << endl;
        rep(i, k) {
            printf("%d ", k-1);
            rep(j, k-1) printf("%d%c", s[i][j], (j<k-2?' ':'\n'));
        }
    }
    return 0;
}


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

int main() {
  int N,L;
  cin>>N>>L;
  vector<string> S(N);
  for(int i=0;i<N;i++){
    cin>>S.at(i);
  }
  sort(S.begin(),S.end());
  for(int i=0;i<N;i++){
    cout<<S.at(i);
  }
  cout<<endl;
}

Measured memory_bytes: 3628
#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,k;
    cin>>n>>k;
    vector<int> a(n);
    rep(i,n) cin>>a[i];
    int ng=0,ok=1e9;
    while(ok-ng>1){
        int x=(ok+ng)/2;
        auto f=[&](int x){
            ll now=0;
            rep(i,n)now+=(a[i]-1)/x;
            return now<=k;
        };
        if (f(x)) ok=x;
        else ng=x;
    }
    cout<<ok<<endl;
    return 0;
}

Measured memory_bytes: 4040
#include <bits/stdc++.h>
using namespace std;
int main(){
int n;
cin >> n;
int a[n],b[n],c[n-1];
int ans = 0;
for(int i = 1 ; i <= n ; i++)
    cin >> a[i];
    for(int i = 1 ; i <= n ; i++)
    cin >> b[i];
    for(int i = 1 ; i <= n-1 ; i++)
    cin >> c[i];
 //ans = b[a[1]];

 for(int i = 1 ; i <= n ; i++){
    int x = a[i];
    if(a[i] == a[i-1]+1)
        ans = ans + b[a[i]] + c[a[i-1]];
    else
        ans = ans + b[a[i]];
 }
cout << ans << endl;
return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <algorithm>
#include <unordered_map>
#include <cmath>

#define rep(i, a, b) for (ll i = a; i < b; i++)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> pll;
typedef unordered_map<string, ll> u_map;

// input
void input() {}
template <class Head, class... Tail>
void input(Head &&a, Tail &&... b)
{
    cin >> a;
    input(forward<Tail>(b)...);
}

template <class V>
void input(vector<V> &v)
{
    for_each(v.begin(), v.end(), [](auto &i) { input(i); });
}

// output
template <class V>
void output(vector<V> &v)
{
    for_each(v.begin(), v.end(), [](auto &x) { cout << x << " "; });
    cout << endl;
}

// math functions
ll mpow(ll a, ll n, ll p)
{
    ll x = 1;
    while (n > 0)
    {
        if (n & 1)
        {
            x = a * x % p;
        }
        a = a * a % p;
        n >>= 1;
    }

    return x;
}

ll mfact(ll n, ll p)
{
    ll res = 1;
    for (ll i = 2; i <= n; i++)
    {
        res = res * i % p;
    }
    return res;
}

ll mcomb(ll n, ll r, ll p)
{
    if (n == 0 && r == 0)
    {
        return 1;
    }
    if (n < r || n < 0 || r < 0)
    {
        return 0;
    }

    ll a = mfact(n, p);
    ll b = mfact(n - r, p);
    ll c = mfact(r, p);
    return (((a * mpow(b, p - 2, p)) % p) * mpow(c, p - 2, p)) % p;
}

ll gcd(ll a, ll b)
{
    if (a < b)
    {
        a ^= b;
        b ^= a;
        a ^= b;
    }
    return b ? gcd(b, a % b) : a;
}

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

int main()
{
    int H, A;
    input(H, A);

    cout << ceil(H / (double)A) << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define speedio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
using namespace std;
// #include <ext/pb_ds/assoc_container.hpp>
// using namespace __gnu_pbds;

typedef long long       ll;
typedef long double     ld;

typedef vector<int>     vi;
typedef vector<bool>    vb;
typedef vector<ll>      vll;
typedef vector<vi>      vvi;
typedef vector<vll>     vvll;
typedef vector<string>  vs;

typedef pair<int, int>  pii;
typedef pair<ll, int>   pli;
typedef pair<ll, ll>    pll;
typedef vector< pii >   vpi;
typedef vector< pll >   vpll;

// typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> oset;

#define pb           push_back
#define mod          1000000007
#define INF          1e17
#define mini         INT_MIN
#define maxo         INT_MAX
#define eb           emplace_back
#define ff           first
#define ss           second
#define re           return 
#define endl         "\n" 

#define all(c)       c.begin(),c.end()
#define be           begin()
#define en           end()
#define sz(x)        (ll)x.size()
#define mem(a,val)   memset(a,val,sizeof(a))
#define mk(x,y)      make_pair(x,y)
#define mid(l,r)     ((l)+((r)-(l))/2) 

#define fo(i,a,b)    for(ll i = (ll)(a); i <= (ll)(b); i++)
#define rf(i,a,b)    for(ll i = (ll)(a); i >= (ll)(b); i--)
#define read(a,n)    for(int i=0;i<n;i++)cin>>a[i];
#define show(a,n)    for(int i=0;i<n;i++)cout<<a[i]<<' ';cout<<endl;
#define p2(n)        (1LL << (n))
#define deb(x) cout <<#x << " = " << x << " | " << "LINE: "<<__LINE__<< endl;
template<typename... T> void rd(T&... args) { ((cin >> args), ...); }
template<typename... T> void pp(T... args) { ((cout << args << " "), ...); cout<<"\n"; }

void add(ll &x, ll y){ x += y; if(x>=mod) x %= mod; if(x<0) x = x%mod + mod; }

//============== *** START OF CODE ***

ll dist(ll x1,ll y1){
    return x1*x1+y1*y1;
}


void solve()
{
    ll n,d;
    rd(n,d);
    ll c = 0;
    fo(i,1,n){
        ll x,y;rd(x,y);
        if(dist(x,y)<=d*d)c++;
    }   
    cout<<c<<endl;
    
}


void prep(){}

//=============== *** END OF CODE ***

int main(){
    speedio; cout<<fixed<<setprecision(12);

// #ifndef ONLINE_JUDGE
//     freopen("input.txt", "r", stdin);
//     freopen("output.txt", "w", stdout);
// #endif

    prep();
    int t = 1;
    // cin >> t;
    while(t--)
        solve();

    return 0;
}

Measured memory_bytes: 3640
N = int(input())
A = []
L = [[] for _ in range(N)]
for i in range(N):
    a = int(input())
    A.append(a)
    for _ in range(a):
        x,y = map(int, input().split())
        L[i].append((x, y))
        
ans = 0
for i in range(2**N, 2**(N+1)):
    f = 0
    b = bin(i)
    human = [0]*N
    for j in range(3, len(b)):
        if b[j] == "1":
            human[j-3] = 1
    for j in range(N):
        if human[j] == 0:
            continue
        for k in range(A[j]):
            if human[L[j][k][0]-1] != L[j][k][1]:
                f = 1
                break
    if f == 0:
        ans = max(ans, sum(human))
        
print(ans)

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

int main()
{
    char s[101][101],tmp[101][101];
    int n,l,i,j;

    cin>>n>>l;
    for(i=0;i<n;i++)
        cin>>s[i];
    for(i=0;i<n-1;i++)
        for(j=i+1;j<n;j++)
        if(strcmp(s[i],s[j])>0)
        {
        strcpy(tmp[i],s[i]);
        strcpy(s[i],s[j]);
        strcpy(s[j],tmp[i]);
        }
   for(i=0;i<n;i++)
            cout<<s[i];
   return 0;
}


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

template <typename T> inline void rd(T& x) {
	int si = 1; char c = getchar(); x = 0;
	while(!isdigit(c)) si = c == '-' ? -1 : si, c = getchar();
	while(isdigit(c)) x = x * 10 + c - 48, c = getchar();
	x *= si;
}
template <typename T, typename... Args>
inline void rd(T& x, Args&... args) { rd(x); rd(args...); }

#define fi first
#define se second

typedef long long ll;
typedef double ff;
typedef std::pair<int, int> pii;

const int kN = 1e5 + 5;

int a[kN], dg[kN], fa[kN]; ll f[kN]; std::vector <int> E[kN];

void Dfs(int cur) {
	if(dg[cur] == 1) return;
	ll s = 0, mx = 0;
	for(auto x : E[cur])
		if(x != fa[cur]) {
			fa[x] = cur; Dfs(x); s += f[x];
			mx = std::max(mx, f[x]);
		}
	f[cur] = 2 * a[cur] - s;
	if(f[cur] < 0 || f[cur] > a[cur] || mx > a[cur]) {
		printf("NO"); exit(0);
	}
}

int main() {
	int n; rd(n);
	for(int i = 1; i <= n; ++i) rd(a[i]);
	if(n == 2) { printf(a[1] == a[2] ? "YES" : "NO"); return 0; }
	for(int i = 1; i < n; ++i) {
		int u, v; rd(u, v);
		E[v].push_back(u);
		E[u].push_back(v);
		++dg[u]; ++dg[v];
	}
	int rt;
	for(int i = 1; i <= n; ++i) {
		if(dg[i] != 1) rt = i;
		else f[i] = a[i];
	}
	Dfs(rt);
	printf(!f[rt] ? "YES" : "NO");
	return 0;
}

Measured memory_bytes: 14848
#include <iostream>
#define MAX_N 100000
using namespace std;

int d[MAX_N];
int n;

void solve()
{
    int sum = 0;
    int sum_sq = 0;
    int ans;

    for (int i = 0; i < n; i++)
    {
        sum += d[i];
        sum_sq += d[i] * d[i];
    }

    ans = (sum * sum - sum_sq) / 2;

    cout << ans;
}

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

    solve();
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define bg begin()
#define ed end()
#define all(x) x.bg,x.ed
#define pb push_back
#define pf push_front
#define eb emplace_back
using namespace std;
typedef long long ll;
template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(b<a)a=b;}
template<class t> using vc=vector<t>;
template<class t> using vvc=vc<vc<t>>;
using pi=pair<int,int>;
using vi=vc<int>;
void yes(){ cout << "Yes" << endl; }
void no(){ cout << "No" << endl; }
int SIZE(string s){return (int)s.size();}
const long long INF = 1LL << 60;

int main(){
    cout << fixed << setprecision(20);
    ll x; cin >> x;
    ll ans = x / 11 * 2;
    if(x % 11 != 0) ans++;
    if(x % 11 > 6) ans++;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
#include <map>
#include <functional>
#include <queue>
#include <stack>
#include <string.h>
#include <list>
using namespace std;
typedef long long ll;
#define all(a)  (a).begin(), (a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define rep(i,n) for(int i = 0; i < n; i++)
#define repR(i,n) for(int i = n-1; i >= 0; i--)
#define FOR(i,m,n) for(int i = m; i < n; i++)
#define PB push_back
#define MP make_pair
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))


int main() {
    int h,w; string res = "Yes";
    cin >> h >> w;
    char c[h*w];
    rep(i,h*w) cin >> c[i];

    int dx4[] = {-1,0,1,0};
    int dy4[] = {0,1,0,-1};

    rep(i,h)rep(j,w){
        if(c[j + i*w] == '.')continue;
        bool f = false;
        rep(d,4){
            int dy = i + dy4[d];
            int dx = j + dx4[d];
            if(!(0<=dy<h) || !(0<=dx<w))continue;
            if(c[dx + dy*w] == '#'){
                f = true;
                break;
            }
        }
        if(!f){
            res = "No";
            break;
        }
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
main(){
  double weight[100];
  int i=0;
  while(~scanf("%lf",&weight[i])){
      if(weight[i]<=48)
	printf("light fly\n");
      else if(weight[i]<=51)
	printf("fly\n");
      else if(weight[i]<=54)
	printf("bantam\n");
      else if(weight[i]<=57)
	printf("feather\n");
      else if(weight[i]<=60)
	printf("light\n");
      else if(weight[i]<=64)
	printf("light welter\n");
      else if(weight[i]<=69)
	printf("welter\n");
      else if(weight[i]<=75)
	printf("light middle\n");
      else if(weight[i]<=81)
	printf("middle\n");
      else if(weight[i]<=91)
	printf("light heavy\n");
      else
	printf("heavy\n"); 
      i++;
  }
    return 0;
}

Measured memory_bytes: 608
#include<bits/stdc++.h>
using namespace std;
#define int            int64_t
#define double         long double
#define nitro          ios_base::sync_with_stdio(false);cin.tie(0);
#define vi             vector<int64_t>
#define pub            push_back
#define puf            push_front
#define pob            pop_back
#define pof            pop_front
#define PI             3.1415926535897932384626433832795
#define read(a)        for(auto& x : a) cin>> x
#define endl           '\n'
#define gap            ' '
#define min3(a,b,c)    min(a, min(b, c))
#define max3(a,b,c)    max(a, max(b, c))
#define MOD            1000000007
//freopen("input.txt","r",stdin);
//freopen("output.txt","w",stdout);
int32_t main()
{
    nitro
    int n,best=0,x=0;cin>>n;
    string s;cin>>s;
    for(char c:s){
    	if(c=='I') x++;
    	else x--;
    	best=max(best,x);
    }
    cout<<best;
    return 0;
}
    

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

int main() {
  int N;
  cin >> N;
  vector<vector<int>> A(2,vector<int>(N));
  for(int i=0;i<2;i++){
    for(int j=0;j<N;j++){
      cin >> A.at(i).at(j);
    }
  }
  int max_sum=0;
  for(int i=0;i<N;i++){
    int sum=0;
    for(int j=0;j<i+1;j++){
      sum+=A.at(0).at(j);
    }
    for(int j=i;j<N;j++){
      sum+=A.at(1).at(j);
    }
    max_sum=max(max_sum,sum);
  }
  cout << max_sum << endl;
}

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

using namespace std;

typedef long long ll;
typedef vector<ll> vl;
typedef long double ld;
typedef vector<ld> vd;
typedef bool bl;
typedef vector<bl> vb;
typedef vector<vl> mt;
typedef unordered_map<ll,unordered_map<ll,ll>> graph;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
typedef vector<string> vs;
typedef vector<vs> table;


const ll e5 = 1 << 20;
const ll mod = 1000000007;
const ll e3 = 1 << 13;
const ll INF = 1ll << 50;

const string pros = "YES";
const string cons = "NO";

mt dp;
string s;

int main(){
  cin >> s;
  reverse(s.begin(),s.end());
  dp = mt(13,vl(s.size()+1));
  dp[0][0] = 1;
  ll x = 1;
  for(ll i = 0;i < s.size();i++){
    if(s[i] == '?'){
      for(ll j = 0;j < 13;j++){
        ll y = 0;
        for(ll k = 0;k < 10;k++){
          dp[(j+y)%13][i+1] += dp[j][i];
          dp[(j+y)%13][i+1] %= mod;
          y += x;
        }
      }
    }else{
      for(ll j = 0;j < 13;j++){
        ll y = x*(s[i]-'0');
        dp[(j+y)%13][i+1] += dp[j][i];
        dp[(j+y)%13][i+1] %= mod;
      }
    }
    x *= 10;
    x %= 13;

  }
  // for(ll i = 0;i < 13;i++){
  //   for(ll j = 0;j <= s.size();j++){
  //     cerr << dp[i][j] << " ";
  //   }
  //   cerr << endl;
  // }
  cout << dp[5][s.size()]%mod << endl;

}


Measured memory_bytes: 11392
#include <stdio.h>

int main(int argc, char *argv[])
{
  int a = 0;
  int b = 0;

  scanf("%d %d", &a, &b);

  if (a % 2 == 0 || b % 2 == 0) {
    printf("No\n");
  } else {
    printf("Yes\n");
  }

  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <bitset>
#include <queue>
#include <stack>
#include <string>
#include <ctime>
#include <stdio.h>
#include <string.h>

using namespace std;

#define re return
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int) (x).size())
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repm(i, n) for (int i = 1; i <= (n); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define vi vector<int>
#define vl vector<long>
#define vll vector<ll>
#define vvi vector<vi>
#define pii pair<int,int>
#define vpii vector< pair<int,int> >
#define ll long long
#define ld long double 
#define str string
// freopen("firesafe.in", "r", stdin);
// freopen("firesafe.out", "w", stdout);

//map<ll,ll>mmap;
int main(){
   int a,b,c;
   cin>>a>>b>>c;
   int val=a*100+b*10+c;
   if(val%4==0){
    cout<<"YES"<<endl;
   }else{
    cout<<"NO"<<endl;
   }
    
}

Measured memory_bytes: 384
#include<bits/stdc++.h> 
using namespace std;
inline int read(void)
{
	int x = 0,f = 1; char ch = getchar();
	while(!isdigit(ch)){f = ch == '-' ? -1 : 1; ch = getchar();}
	while(isdigit(ch)){x = (x << 3) + (x << 1) + ch - '0'; ch = getchar();}
	return x * f;
}
int ab(int x){return x>0?x:-x;}
const int inf=0x3f3f3f3f,maxn=200010;

int n,A[maxn],B[maxn],cx[40][maxn],dx[maxn],ans=0;

signed main(signed argc, char *argv[])
{
	n=read();
	for(int i=1; i<=n; i++)A[i]=read();
	for(int i=1; i<=n; i++)B[i]=read();
	for(int k=0; k<28; k++) {
		if(!k)for(int i=1; i<=n; i++)cx[k][i]=((1<<k)&B[i]);
		else
			for(int i=1; i<=n; i++)cx[k][i]=cx[k-1][i]^((1<<k)&B[i]);
	}
	for(int k=0; k<28; k++)sort(cx[k]+1,cx[k]+n+1); //
	for(int k=1; k<=28; k++) {
		for(int i=1; i<=n; i++) {
			dx[i]^=(1<<(k-1))&A[i];
			int x=lower_bound(cx[k-1]+1,cx[k-1]+n+1,((1<<k)-dx[i]))-cx[k-1];
			ans^=(((n-x+1)%2)<<k);
		}
	}
	int a,b,c,d;
	for(int k=0; k<=28; k++) {
		a=b=c=d=0;
		for(int i=1; i<=n; i++)if((1<<k)&A[i])b++;
			else a++;
		for(int i=1; i<=n; i++)if((1<<k)&B[i])d++;
			else c++;
		ans^=(((1LL*a*d%2+1LL*b*c%2)%2)<<k);
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 27648
#include <bits/stdc++.h>
#define REP(i, a, n) for (ll i = ((ll) a); i < ((ll) n); i++)
using namespace std;
typedef long long ll;

int main(void) {
  vector<ll> cnt(4);
  REP(i, 0, 3) {
    ll A, B;
    cin >> A >> B;
    A--;
    B--;
    cnt[A]++;
    cnt[B]++;
  }

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

  cout << (cnt[0] == 1 && cnt[1] == 1 && cnt[2] == 2 && cnt[2] == 2 ? "YES" : "NO") << endl;
}

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

using namespace std;

#define INF 100000000
#define YJ 1145141919
#define INF_INT_MAX 2147483647
#define INF_LL 9223372036854775
#define INF_LL_MAX 9223372036854775807
#define EPS 1e-10
#define MOD 1000000007
#define MOD9 998244353
#define Pi acos(-1)
#define LL long long
#define ULL unsigned long long
#define LD long double

#define int long long

using II = pair<int, int>;

int gcd(int a, int b) { return b != 0 ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a * b / gcd(a, b); }
int extgcd(int a, int b, int &x, int &y) { int g = a; x = 1; y = 0; if (b != 0) g = extgcd(b, a % b, y, x), y -= (a / b) * x; return g; }

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(a)  begin((a)), end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())

const int MAX_N = 100005;
int N;
int A[MAX_N];
multiset<int> S;

signed main()
{
  cin >> N;
  REP(n,N) {
    cin >> A[n];
    auto it = S.lower_bound(A[n]);
    if(it != S.begin()) {
      it--;
      S.erase(it);
    }
    S.insert(A[n]);
  } 

  cout << S.size() << endl;

  return 0;
}


Measured memory_bytes: 5760
#include<bits/stdc++.h>
#define mod 1000000007
#define ll long long int
#define ar array
#define mp make_pair
using namespace std;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	int k,s;
	cin>>k>>s;
	ll ans = 0;
	for(int i=0;i<=k ;i++)
		for(int j =0; j<=k; j++)
		{
			int y = s-i-j;
			if(y<=k && y>=0) ans++;
		}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
bool di,p;
int n,ls,x;
long long ans;
vector<int>v;
int main()
{
    scanf("%d",&n);
    n*=3;
    for(int i=1;i<=n;i++)
    {
    	scanf("%d",&x);
    	v.push_back(x);	
	}
	sort(v.begin(),v.end());
	int r=(n/3);
	for(int i=n-2;;i-=2)
	{
		ans+=v[i];
		//printf("%d\n",v[i]);
		r--;
		if(r==0)break;
	}
	printf("%lld",ans);
}


Measured memory_bytes: 2420
#include<bits/stdc++.h>
using namespace std;
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    int N=5;
    
    vector<int> A(N);
    for (int i = 0; i<N; ++i) cin >> A[i];
    for (int i = 0; i<N; ++i) {
        if (A[i]==0) cout << i+1;
    }
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define PA pair<ll,ll>
#define FOR(I,A,B) for(ll I = int(A); I < int(B); ++I)
#define FORR(I,A,B) for(ll I = int((B)-1); I >= int(A); --I)
#define TO(x,t,f) ((x)?(t):(f))
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin()) //xi>=v  x is sorted
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin()) //xi>v  x is sorted
#define NUM(x,v) (POSU(x,v)-POSL(x,v))  //x is sorted
#define REV(x) (reverse(x.begin(),x.end())) //reverse
ll gcd(ll a,ll b){if(a<b)swap(a,b);if(a%b==0)return b;return gcd(b,a%b);}
ll lcm(ll a,ll b){ll c=gcd(a,b);return ((a/c)*(b/c)*c);}//saisyo kobaisu
#define NEXTP(x) next_permutation(x.begin(),x.end())
const ll INF=1e16+7;
const ll MOD=1e9+7;

struct topolodical{
	//0-indexed   <---important
	//ans.size()==v -> heiro nasi
	ll v,e,numsort;
	vector<vector<ll> > g;
	vector<bool> used;
	vector<ll> ans;
	topolodical(ll a,ll b){
		v=a;e=b;
		used.resize(v);
		g.resize(v);
	}
	void make_edgedir(ll s,ll t){//s->t
		g[s].push_back(t);
	}
	void dfs(ll u){
		if(used[u]) return;
		used[u] = true;
		for(auto& i:g[u])dfs(i);
		ans.push_back(u);
	}
	void tsort(){
		for(ll i=0;i<v;++i)dfs(i);
		reverse(ans.begin(),ans.end());
	}
	void calcnumsort(){
		vector<ll> dp,a;
		dp.resize(1<<v,0);
		a.resize(v);
		FOR(i,0,v){
			FOR(j,0,g[i].size()){
				ll x = i,y = g[i][j];
				a[y] |= 1<<x;
			}
		}
		dp[0]=1;
		for(ll i=1; i < (1<<v); i++){
			for(ll j=0;j<v;j++){
				if((i & 1<<j) && ((i | a[j])==i)){
					dp[i] += dp[i-(1<<j)];
				}
			}
		}
		numsort=dp[(1<<v)-1];
	}
};

int main(){
	ll v,e,f,t;
	cin >> v >> e;
	topolodical tp(v,e);
	FOR(i,0,e){
		cin >> f >> t;
		tp.make_edgedir(f,t);
	}
	tp.tsort();
	for(auto x:tp.ans){
		cout << x << endl;
	}
}


Measured memory_bytes: 4072
#include<iostream>
#include<cmath>
using namespace std;
int main(){
	int arr[5];
	int a,k;
	for(int i=0;i<5;i++){
		cin>>arr[i];
		if(arr[i]==0){
			k=i;
		}
	}
	if(k==0){
		cout<<arr[1]-1;
	}
	else if(k==4){
		cout<<arr[3]+1;
	}
	else{
		cout<<arr[k+1]-1;
	}
}

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

#define MOD 1000000007


int main(){
    int A,B,C,K;
    cin >> A >> B >> C >> K;
    int ans = 0;
    ans += min(A,K);
    if(K>(A+B)) {
        cout << ans - min(K-A-B,C) << endl;
    }else {
        cout << ans << endl;
    }

    
    return 0;
}

Measured memory_bytes: 3556
#include <stdio.h>

#define N 1000

int main(){
  int A[N];
  int i,j,n,v,k;
  scanf("%d",&n);
  
  for(i = 0;i < n;i++)scanf("%d ",&A[i]);
  for(k = 0;k < n-1;k++)printf("%d ",A[k]);
  printf("%d\n",A[n-1]);
  for(i = 1;i < n;i++){
    v = A[i];
    j = i-1;
    while(j >= 0 && A[j] > v){
      A[j+1] = A[j];
      j--;
    }
    A[j+1] = v;
    for(k = 0;k < n-1;k++)printf("%d ",A[k]);
    printf("%d\n",A[n-1]);
  }
  return 0;
}


Measured memory_bytes: 2128
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,x,t;
        cin>>n>>x>>t;
            if(n%x==0)
            {
                cout<<(n/x)*t<<endl;
            }
            else
            {
                cout<<((n/x)+1)*t<<endl;
            }
        
}

Measured memory_bytes: 3596
#include<bits/stdc++.h>
#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define print(x) cout << (x) << endl;
#define printa(x, n) for(ll i = 0; i < n; i++) {cout << (x[i]) << " ";} cout << endl;
using namespace std;
using ll = long long;

int main(void) {
    map<int, int> mp;
    int n;
    cin >> n;

    bool ok = false;
    rep (i, n) {
        int a;
        cin >> a;
        mp[a]++;
        if (mp[a] >= 2) ok = true;
    }
    
    cout << (!ok ? "YES" : "NO") << endl;
    return 0;
}

Measured memory_bytes: 9600
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <queue>
#include <stack>

using namespace std;

typedef int itn;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<vector<int>> VVI;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef map<int, int> M;
typedef pair<int, int> P;
typedef stack<int> S;
typedef queue<int> Q;

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

    int n, k;
    cin >> n >> k;
    cout << n-k+1 << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define all(a) a.begin(), a.end()
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<ll,int> pli;
typedef pair<int,int> pii;
#define rep(i,a,b) for(ll i=a ; i<b ; i++)
#define qrep(que, ite) for(auto ite=begin(que) ; ite!=end(que) ; ite++)
const int max_n = 1e5;
const ll mod = 1e9+7;
const ll INF = 1LL<<60;
const int inf = 1e5;
//typedef long double ld;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};
ll mo = 998244353;
ll gcd(ll a, ll b) { return a ? gcd(b%a, a) : b; }
int main(){
  ll n,k; cin >> n >> k;
  vector<ll> v(n);
  rep(i,0,n){
    cin >> v[i];
  }
  ll ans = 0;
  rep(i,0,n){
    ll m=0, al=0;
    rep(j,i,n-1){
      if(v[i]>v[j+1]) m++;
    }
    rep(j,0,n){
      if(v[i]>v[j]) al++;
    }
    ans += k*m % mod;
    ans %= mod;
    ans += ((k-1) * k)/2 % mod * al % mod;
    ans %= mod;
  }
  cout << ans << endl;
  return 0;
}


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

using namespace std;

int main() {

    char S[100001];
    scanf("%s", S);
    int end = (int)strlen(S);
    end--; // zero origin

    bool match = false;
    while (true) {
        if (end == -1) {
            match = true;
            break;
        }

        char c = S[end];
        if (c != 'r') {
            char dream1 = S[end - 4];
            char dream2 = S[end - 3];
            char dream3 = S[end - 2];
            char dream4 = S[end - 1];
            char dream5 = S[end];
            if (dream1 == 'd'
                && dream2 == 'r'
                && dream3 == 'e'
                && dream4 == 'a'
                && dream5 == 'm') {
                end -= 5;
                continue;
            }

            char erase1 = S[end - 4];
            char erase2 = S[end - 3];
            char erase3 = S[end - 2];
            char erase4 = S[end - 1];
            char erase5 = S[end];
            if (erase1 == 'e'
                && erase2 == 'r'
                && erase3 == 'a'
                && erase4 == 's'
                && erase5 == 'e') {
                end -= 5;
                continue;
            } else {
                break;
            }
        } else {
            c = S[end - 1];
            if (c == 'e') {
                char dreamer1 = S[end - 6];
                char dreamer2 = S[end - 5];
                char dreamer3 = S[end - 4];
                char dreamer4 = S[end - 3];
                char dreamer5 = S[end - 2];
                char dreamer6 = S[end - 1];
                char dreamer7 = S[end];
                if (dreamer1 == 'd'
                    && dreamer2 == 'r'
                    && dreamer3 == 'e'
                    && dreamer4 == 'a'
                    && dreamer5 == 'm'
                    && dreamer6 == 'e'
                    && dreamer7 == 'r') {
                    end -= 7;
                    continue;
                }

                char eraser1 = S[end - 5];
                char eraser2 = S[end - 4];
                char eraser3 = S[end - 3];
                char eraser4 = S[end - 2];
                char eraser5 = S[end - 1];
                char eraser6 = S[end];
                if (eraser1 == 'e'
                    && eraser2 == 'r'
                    && eraser3 == 'a'
                    && eraser4 == 's'
                    && eraser5 == 'e'
                    && eraser6 == 'r') {
                    end -= 6;
                    continue;
                } else {
                    break;
                }
            } else {
                break;
            }
        }
    }

    if (match) {
        printf("YES\n");
    } else {
        printf("NO\n");
    }

    return 0;
}


Measured memory_bytes: 256
N=int(input())
A=list(map(int, input().split()))
B=list(map(int, input().split()))
C=list(map(int, input().split()))

C=[0]+C
S=sum(B)

for m in range(N-1):
  if A[m+1]-A[m]==1:
    S=S+C[A[m]]
  
print(S)

Measured memory_bytes: 3060
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep2(i,a,b) for(int i=(a);i<(b);++i)

template<class T> inline void chmin(T& a, T b) {if (a > b) a = b;}
template<class T> inline void chmax(T& a, T b) {if (a < b) a = b;}

//vector出力
template <class T>ostream &operator<<(ostream &o,const vector<T>&v){
  o<<"{";
  for(int i=0;i<(int)v.size();i++) o << (i>0?", ":"") << v[i];
  o<<"}";
  return o;
}



int main() {
  ll N,A,B,res;
  cin >> N >> A >> B;
  if (abs(A-B)%2==0) res=abs(A-B)/2;
  else {
    ll t1,t2;
    t1 = (max(A,B)-min(A,B))/2+min(A,B);
    t2 = ((N-min(A,B))-(N-max(A,B)+1))/2+N-max(A,B)+1;
    res = min(t1,t2);
  }
  cout << res << endl;
}

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

namespace ALDS1_3_C {
    class Program {
        static void Main(string[] args) {
            int n = int.Parse(Console.ReadLine());
            LinkedList<int> ll = new LinkedList<int>();
            for(int i = 0; i < n; i++) {
                string[] input = Console.ReadLine().Split(' ');
                switch (input[0]) {
                    case "insert":
                        ll.AddFirst(int.Parse(input[1]));
                        break;
                    case "delete":
                        ll.Remove(int.Parse(input[1]));
                        break;
                    case "deleteFirst":
                        ll.RemoveFirst();
                        break;
                    case "deleteLast":
                        ll.RemoveLast();
                        break;
                }
            }

            StringBuilder sb = new StringBuilder();
            LinkedListNode<int> node = ll.First;
            while (node != null) {
                sb.AppendFormat(" {0}", node.Value);
                node = node.Next;
            }
            Console.WriteLine(sb.ToString().TrimStart());
        }
    }
}

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

int main() {
  int H, W;
  cin >> H >> W;
  
  vector<vector<char>> before(H, vector<char>(W));
  rep(i, H)
    rep(j, W)
      cin >> before.at(i).at(j);
  
  vector<int> tate(H, 0);
  vector<int> yoko(W, 0);
  
  rep(i, H) {
    rep(j, W) {
      if (before.at(i).at(j) == '#') {
        break;
      }
      if (j == W -1)
        tate.at(i) = 1;
    }
  }
  
  rep(j, W) {
    rep(i, H) {
      if (before.at(i).at(j) == '#') {
        break;
      }
      if (i == H -1)
        yoko.at(j) = 1;
    }
  }
  
  rep(i, H) {
    if (tate.at(i) == 1) 
      continue;
    
    rep(j, W) {
      if (yoko.at(j) == 1)
        continue;
      
      cout << before.at(i).at(j);
    } 
    cout << endl;
    
  }
}

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

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

#define sf scanf
#define pf printf
#define pb push_back
#define mp make_pair
#define PI ( acos(-1.0) )
#define mod 1000000007LL
#define IN freopen("strings.in","r",stdin)
#define OUT freopen("strings.out","w",stdout)
#define FOR(i,a,b) for(i=a ; i<=b ; i++)
#define DBG pf("Hi\n")
#define INF 1000000000
#define i64 long long int
#define eps (1e-8)
#define xx first
#define yy second
#define ln 17
#define off 2

using namespace __gnu_pbds;
using namespace std ;

typedef pair<int, int> pi ;
typedef tree< pi, null_type, less<pi>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

char s[505][505] ;

int main()
{
    int n ;
    scanf("%d",&n) ;

    for(int i=0 ; i<n ; i++) scanf("%s",s[i]) ;

    bool Empty = 1 ;

    for(int i=0 ; i<n ; i++)
    {
        for(int j=0 ; j<n ; j++)
        {
            if(s[i][j]=='#') Empty = 0 ;
        }
    }

    if( Empty )
    {
        printf("-1\n") ;
        return 0 ;
    }

    int ans = 0 ;

    for(int j=0 ; j<n ; j++)
    {
        int full = 1 ;
        for(int i=0 ; i<n ; i++)
        {
            if( s[i][j] == '.' ) full = 0 ;
        }
        if( !full ) ans++ ;
    }

    if(ans==0)
    {
        printf("0\n") ;
        return 0 ;
    }

    int ans2 = n+1 ;

    for(int i=0 ; i<n ; i++)
    {
        int ret = 0 ;
        for(int j=0 ; j<n ; j++) if( s[i][j] =='.' ) ret++ ;
        int emptyCol = 1 ;
        for(int j=0 ; j<n ; j++) if( s[j][i]=='#' ) emptyCol = 0 ;
        if( emptyCol ) ret++ ;
        ans2 = min(ans2,ret) ;
    }

    printf("%d\n" ,ans + ans2 ) ;

    return 0 ;
}


Measured memory_bytes: 512
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<list>
#include<iomanip>
#include<cmath>
#include<cstring>
#include<functional>
using namespace std;
using ll = long long;

int main(){
  int x, a;
  cin >> x >> a;
  if( x < a ) cout << 0;
  else cout << 10;
  return 0;
}



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

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int a = sc.nextInt();
		int b = sc.nextInt();
		int ans = 0;
		if(a+w < b) ans = b - (a+w);
		else if(b+w < a)ans = a - (b+w);
		else ans = 0;
		System.out.println(ans);
	}
	
}

Measured memory_bytes: 23124
def b_two_anagrams(S, T):
    s = ''.join(sorted(S))
    t = ''.join(sorted(T, reverse=True))
    if s<t:
        return 'Yes'
    else:
        return 'No'
  
S = input()
T = input()
print(b_two_anagrams(S, T))

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

using ll = long long;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define ddrep(i, n) for (int i = n; i > 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define ssrep(i, s, t) for (int i = s; i <= t; ++i)

#define rng(a) a.begin(), a.end()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second

#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))

using pi = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using ld = long double;

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "{";
  rep(i, (int)v.size()) {
    if (i)
      os << ",";
    os << v[i];
  }
  os << "}";
  return os;
}

template <typename T, size_t S> void printArray(const T (&array)[S]) {
  for (auto val : array)
    std::cout << val << ", ";
  std::cout << "\n";
}

const int mod = 1e9 + 7;
const int inf = 1e9 + 5;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << std::setprecision(10);

  string s; std::cin >> s;
  int ans = 0;
  map<char, int> cnt;
  rep(i, s.size()) {
    cnt[s[i]]++;
    while (s[i] == s[i+1])
      cnt[s[i]]++, i++;
    int mi = min(cnt['0'], cnt['1']);
    ans += mi*2, cnt['0']-=mi, cnt['1']-=mi;
  }
  std::cout << ans << "\n";
}


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

using namespace std;

int main(void) {
	int i = 0, n, ans = 999;
	string s;
	cin >> s;
	for (; i < s.size() - 2; i++) {
		n = (s[i] - '0') * 100 + (s[i + 1] - '0') * 10 + (s[i + 2] - '0');
		ans = min(ans, abs(n - 753));
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 256