akhauriyash/Code-Regression huggingface dataset:
import numpy as np


def parse():
    n, k = map(int, input().split())
    p = list(map(int, input().split()))
    c = list(map(int, input().split()))
    pc = {i: (pi - 1, ci) for i, (pi, ci) in enumerate(zip(p, c))}
    return k, pc


def split_simple():
    k, pc = parse()
    lst = [[]]
    lst[0].append(pc.pop(0))
    while True:
        if not pc:
            break
        p, _ = lst[-1][-1]
        if p in pc:
            pcj = pc.pop(p)
            lst[-1].append(pcj)
        else:
            j = next(iter(pc.keys()))
            pcj = pc.pop(j)
            lst.append([pcj])
    return k, [np.array([ls[1] for ls in lst_], dtype=np.long) for lst_ in lst]


def inner(n, k, s, sim):
    # print(sim)
    # print(s)
    if sim.shape[1] == 1:
        return sim.max()
    if k < n or s <= 0:
        return sim.max()
    div = k // n
    mod = k % n
    # print(k, n, div, mod)
    if mod == 0:
        return max(s * div, s * (div - 1) + sim.max())
    try:
        return max(s * div + sim[:, :mod].max(), s * (div - 1) + sim[:, :mod].max())
    except ValueError:
        print(mod)
        print(sim)
        print(sim.shape)
        raise


def main():
    k, data_set = split_simple()
    result = min([d.min() for d in data_set])
    for data in data_set:
        n = data.size
        rep = np.repeat(data[None], 2, axis=0).flatten()
        # sim_ = np.array([[rep[i:i+p].sum()
        #                  for p in range(1, min(k, n) + 1)] for i in range(n)])
        sim = np.array([np.cumsum(rep[i:i+min(k, n)]) for i in range(n)])
        # print((sim == sim_).all())
        cand = inner(n, k, data.sum(), sim)
        result = max(result, cand)
    print(result)


if __name__ == "__main__":
    main()


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

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = mod * mod;
const int INF_N = 1e+9;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-12;
const ld pi = acos(-1.0);
//typedef vector<vector<ll>> mat;
typedef vector<int> vec;

//繰り返し二乗法
ll mod_pow(ll a, ll n, ll m) {
	ll res = 1;
	while (n) {
		if (n & 1)res = res * a%m;
		a = a * a%m; n >>= 1;
	}
	return res;
}

struct modint {
	ll n;
	modint() :n(0) { ; }
	modint(ll m) :n(m) {
		if (n >= mod)n %= mod;
		else if (n < 0)n = (n%mod + mod) % mod;
	}
	operator int() { return n; }
};
bool operator==(modint a, modint b) { return a.n == b.n; }
modint operator+=(modint &a, modint b) { a.n += b.n; if (a.n >= mod)a.n -= mod; return a; }
modint operator-=(modint &a, modint b) { a.n -= b.n; if (a.n < 0)a.n += mod; return a; }
modint operator*=(modint &a, modint b) { a.n = ((ll)a.n*b.n) % mod; return a; }
modint operator+(modint a, modint b) { return a += b; }
modint operator-(modint a, modint b) { return a -= b; }
modint operator*(modint a, modint b) { return a *= b; }
modint operator^(modint a, int n) {
	if (n == 0)return modint(1);
	modint res = (a*a) ^ (n / 2);
	if (n % 2)res = res * a;
	return res;
}

//逆元(Eucledean algorithm)
ll inv(ll a, ll p) {
	return (a == 1 ? 1 : (1 - p * inv(p%a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }

const int max_n = 1 << 18;
modint fact[max_n], factinv[max_n];
void init_f() {
	fact[0] = modint(1);
	for (int i = 0; i < max_n - 1; i++) {
		fact[i + 1] = fact[i] * modint(i + 1);
	}
	factinv[max_n - 1] = modint(1) / fact[max_n - 1];
	for (int i = max_n - 2; i >= 0; i--) {
		factinv[i] = factinv[i + 1] * modint(i + 1);
	}
}
modint comb(int a, int b) {
	if (a < 0 || b < 0 || a < b)return 0;
	return fact[a] * factinv[b] * factinv[a - b];
}
using mP = pair<modint, modint>;

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




void solve() {
    int N, M; cin >> N >> M;
    vector<vec> vv(100005);
    rep(i, N){
        int a, b; cin >> a >> b;
        vv[a].push_back(b);
    }

    int idx=1;
    priority_queue<int> pq;
    int res=0;
    rep1(i, M){
        while(idx <= i){
            rep(j, vv[idx].size()){
                pq.push(vv[idx][j]);
            }
            idx++;
        }
        if(!pq.empty()){
            res += pq.top(); pq.pop();
        }
    }

    cout << res << endl;
}

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  //cout << fixed << setprecision(10);
  //init_f();
  //init();
  //int t; cin >> t; rep(i, t)solve();
  solve();
//   stop
    return 0;
}


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

using namespace std;

typedef long long ll;

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

	int N;
	cin >> N;

	vector<vector<int>> F(N, vector<int>(10));
	rep(i, N) rep(j, 10) cin >> F[i][j];

	vector<vector<int>> P(N, vector<int>(11));
	rep(i, N) rep(j, 11) cin >> P[i][j];


	ll ans = -1 * 1e11;
	for(int i = 1; i < (1 << 10); i++){
		ll t = 0;
		for(int j = 0; j < N; j++){
			int c = 0;
			for(int k = 0; k < 10; k++){
				if((i >> k) & 1) c += F[j][k];
			}
			t += P[j][c];
		}

		// if(t > ans){
		// 	cout << i << "," << ans << "," << t << endl;
		// }
		ans = max(ans, t);
	}

	cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N = 2010;
int n,head[N],to[N*2],nex[N*2],x,y,tot,k,ans;
void link(int x,int y)
{
	nex[++tot]=head[x];
	to[head[x]=tot]=y;
}
int dfs(int now, int lim, int f)
{
	if(lim<0)
		return 0;
	int ans=1;
	for(int i=head[now]; i; i=nex[i])
		if(to[i]!=f)
			ans+=dfs(to[i],lim-1,now);
	return ans;
}
int main()
{
	scanf("%d%d",&n,&k);
	for(int i=1; i<n; i++)
	{
		scanf("%d%d",&x,&y);
		link(x,y);
		link(y,x);
	}
	for(int i=1; i<=n; i++)
	{
		if(k&1)
			for(int j=head[i];j;j=nex[j])
				ans=max(ans,dfs(i,k/2,to[j])+dfs(to[j],k/2,i));
		else
			ans=max(ans,dfs(i,k/2,0));
	}
	printf("%d",n - ans);
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a;
  int i,j;
  int sum_a = 0;
  int sum_b = 0;
  int max_vec;
  int vec_point;
  

  cin >> a ;
  
  vector <int>vec(a);
  vector <int>vec_big_order(a);
  for(i=0;i<a;i++){
    cin >> vec.at(i);
    }
  for(j=0;j<a;j++){
   max_vec = 0;
   vec_point = 0;
   for(i=0;i<a;i++){
    if(max_vec < vec.at(i)){
      vec_point = i;
      max_vec = vec.at(i);
      }
   }
    vec_big_order.at(j) = max_vec;
    vec.at(vec_point) = 0;
    }
  
  for(i=0;i<a;i+=2){
    sum_a = vec_big_order.at(i) + sum_a;
  }
  
    
  for(i=1;i<a;i+=2){
     sum_b = sum_b + vec_big_order.at(i);
   }
  

  cout << sum_a - sum_b <<endl;
  }


Measured memory_bytes: 3604
#include<bits/stdc++.h>
#include<ctype.h>
# define pb push_back
#define fst first
#define sec second
#define For(i,a,b) for(int i=a;i<b;i++)
#define ll long long int
#define ull unsigned long long int
#define mod 1000000007
#define fo(i,n) for(ll i=0;i<n;i++)
#define endl "\n"
#define rev(i,n) for(ll i=n-1;i>=0;i--)
#define fo1(i,n) for(ll i=1;i<=n;i++)
#define boolsize 1000001
#define pi pair<ll,ll>
#define vi vector<ll>
#define vii vector<pi>
using namespace std;
template<typename T>
void showvector(vector <T> v)
{
    for(T x:v)
        cout<<x<<" ";
    cout<<endl;

}
template<typename T>
void showvector1(vector <T> v)
{
    ll n=v.size();
    fo1(i,n-1)
        cout<<v[i]<<endl;

}
template<typename T>
void showset(set <T> s)
{
    for(T x: s)
        cout<<x<<" ";
    cout<<endl;
}
template<class T>
void showvectorpair(vector<T> v)
{
    for(auto it=v.begin();it!=v.end();it++)
        cout<<it->first<<" "<<it->second<<endl;
    cout<<endl;
}
template<typename T,typename P>
void showmap(map <T,P> m)
{
    for(auto it=m.begin();it!=m.end();it++)
        cout<<it->first<<" "<<it->second<<endl;
    cout<<endl;
}
template<typename T>
bool comp(T a,T b)
{
    return (a>b);
}
template<class T>
bool comppair(T a,T b)
{
    if(a.first==b.first)
        return(a.second>b.second);
    return (a.first>b.first);
}
bool sameparity(ll a,ll b)
{
    return (a%2==b%2);
}
bool difparity(ll a,ll b)
{
    return !(a%2==b%2);
}
bool isprime(ll x)
{   if(x<=1)
     return false;
    for(ll i=2;i<=sqrt(x);i++)
    {
        if(x%i==0)
            return false;
    }
    return true;
}
bool iseven(ll x)
{
    return !(x%2);
}
bool isodd(ll x)
{
    return (x%2);
}
/// check for test case before submitting
void vfun()
{
    ll n,k;
    cin>>n;
    vector <ll> v(n);
    fo(i,n)
    cin>>v[i];

}

int main()
{
    #ifndef ONLINE_JUDGE
    freopen("inputh.txt", "r", stdin);
    freopen("outputh.txt", "w", stdout);
    #endif
    ios_base::sync_with_stdio(0); ///cant use scanf, printf
    cin.tie(0);cout.tie(0); /// no longer auto flush cout before each cin, remove for interactive
    //cout << fixed << setprecision(11); /// no scientific output
    ll test=1;
    //cin>>test;
    while(test--)
    {
            ll n,k;
            cin>>n>>k;
            vi dp(n,INT_MAX),v(n);
            fo(i,n)
                cin>>v[i];
            dp[0]=0;
            fo(i,n)
            {
                ll j=i-1;
                while(j>=0 && j>=i-k)
                {
                    dp[i]=min(dp[i],dp[j]+abs(v[i]-v[j]));
                    j--;
                }
            }
           // showvector(dp);
            cout<<dp[n-1];

//         if(vfun())
//            cout<<"YES\n";
//         else
//            cout<<"NO\n";
    }
}
///before sub
/// check for value of zero and single input in array
///loop vars,1LL in mult, equal, one, bounds, int v ll, endl, finish taking inputs
/// check whether test cases are given or not





Measured memory_bytes: 4732
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vvl = vector<vl>;
const int INF = 1 << 28;
const ll MOD = 1'000'000'007;
template <class T>
bool chmax(T &a, const T &b) { return (a < b) ? (a = b, 1) : 0; }
template <class T>
bool chmin(T &a, const T &b) { return (b < a) ? (a = b, 1) : 0; }

int main() {
    ll n, a, b;
    cin >> n >> a >> b;
    if (n == 1) {
        cout << (a == b ? 1 : 0) << endl;
    } else if (b < a) {
        cout << 0 << endl;
    } else {
        n -= 2;
        ll nums = max(0LL, b - a);
        cout << n * nums + 1 << endl;
    }
    return 0;
}

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

int main() {
    int n, k, p; scanf("%d%d%d", &n, &k, &p);
    vector<vector<int>> dp(n + 2, vector<int>(k + 1)), cnk(n + 1, vector<int>(n + 1));
    for (int i = 0; i <= n; ++i) {
        cnk[i][0] = 1;
        for (int j = 1; j <= i; ++j) cnk[i][j] = (cnk[i - 1][j] + cnk[i - 1][j - 1]) % p;
    }
    dp[1][k] = 1;
    for (int j = k - 1; j >= 0; --j) {
        vector<int> ways(n + 1);
        ways[0] = 1;
        for (int r = 0; r <= n; ++r) {
            for (int g = 1; g <= n && r + g <= n; ++g) {
                ways[r + g] += 1LL * ways[r] * cnk[r + g - 1][r] % p * dp[g][j + 1] % p;
                ways[r + g] %= p;
            }
        }
        for (int i = 1; i <= n + 1; ++i) dp[i][j] = ways[i - 1];
        if (j > 0) {
            for (int i = 1; i <= n + 1; ++i) (dp[i][j] += dp[i][j + 1]) %= p;
        }
    }
    printf("%d\n", dp[n + 1][0]);
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  string t = "CODEFESTIVAL2016";
  int ans = 0;
  for (int i = 0; i < 16; i++) {
    if (s[i] != t[i]) ans++;
  }
  cout << ans << endl;
}

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

int presum(vector<int> v, int l, int r) {
	if(l > r)
		return 0;
 	int one = v[r];
 	int two = (l == 0) ? 0 : v[l-1];
 	return one - two;
}

int32_t main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	
	int n;
	string s;
	cin >> n >> s;
	
	vector<int> r(n), g(n), b(n);
	r[0] = s[0] == 'R';
	g[0] = s[0] == 'G';
	b[0] = s[0] == 'B';
	for(int i = 1; i < n; i++) {
		r[i] = r[i-1] + (s[i] == 'R');
		g[i] = g[i-1] + (s[i] == 'G');
		b[i] = b[i-1] + (s[i] == 'B');
	}
	long long tot = 0;
	for(int i = 0; i < n; i++) {
	 	for(int j = i + 1; j < n; j++) {
	 		if(s[i] == s[j])
	 			continue;
	 		char other = s[i]^s[j]^'R'^'G'^'B';
	 		if(other == 'R') {
	 			tot += presum(r, j+1, n-1);
			} else if(other == 'G') {
			    tot += presum(g, j+1, n-1);
			} else {
			  	tot += presum(b, j+1, n-1);
			}
			int k = 2*j - i;
			if(k < n and s[k] == other)
				tot--;
		//	cerr << tot << '\n';
	 	}	
	}

	cout << tot << '\n';
				
	return 0;
}


Measured memory_bytes: 3696
#include <iostream>
#include <stdio.h>
#include <string.h>
using namespace std;

const int MAXN = 1e2;
int a[MAXN], b[MAXN];

int main(void){
    int x, y;
    cin >> x >> y;
    a[1]=a[3]=a[5]=a[7]=a[8]=a[10]=a[12]=1;
    b[4]=b[6]=b[9]=b[11]=1;
    if(a[x]&&a[y]||b[x]&&b[y]) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

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

#define ll long long
#define pb push_back
#define N 1000000007
#define nmax 200001
#define pll pair<ll,ll>
#define fill_nums(A,n) for(ll i=0;i<n;i++) scanf("%lld",&A[i]);
#define fill_edges(adj,m) for(ll i=0;i<m;i++) {ll a, b; scanf("%lld %lld",&a,&b); adj[a-1].pb(b-1); adj[b-1].pb(a-1);}
#define fill_direct(adj,m) for(ll i=0;i<m;i++) {ll a, b; scanf("%lld %lld",&a,&b); adj[a-1].pb(b-1);}

ll extended_gcd(ll a, ll b, ll &x, ll &y) {
	if(a==0) {
		x = 0;
		y = 1;
		return b;
	}

	ll x1,y1;
	ll gcd = extended_gcd(b%a,a,x1,y1);

	x = y1 - (b/a)*x1;
	y = x1;

	return gcd;
}

vector<vector<vector<double>>> dp(301, vector<vector<double>>(301, vector<double>(301,-1)));

double solve(ll c1, ll c2, ll c3, ll n) {

	if(c1==0 && c2==0 && c3==0)
		return 0.0;

	if(dp[c1][c2][c3]!=-1)
		return dp[c1][c2][c3];

	double a1 = (c1>0) ? c1*solve(c1-1,c2,c3,n) : 0;
	double a2 = (c2>0) ? c2*solve(c1+1,c2-1,c3,n) : 0;
	double a3 = (c3>0) ? c3*solve(c1,c2+1,c3-1,n) : 0;
	// cout<<c1<<" "<<c2<<" "<<c3<<endl;
	// cout<<a1<<" "<<a2<<" "<<a3<<endl;

	dp[c1][c2][c3] =(n+a1+a2+a3)/(double)(c1+c2+c3);
	// cout<<dp[c1][c2][c3]<<endl;
	return dp[c1][c2][c3];
}

int main() {
    
   	ll n,c1=0,c2=0,c3=0;
   	cin>>n;

   	for(int i=0;i<n;i++){
   		int a;
   		cin>>a;
   		if(a==1) c1++;
   		else if(a==2) c2++;
   		else if(a==3) c3++;
   	}

   	cout<<fixed<<setprecision(10);
	cout<<solve(c1,c2,c3,n)<<endl;   	
	return 0;
}


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

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP0(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define RREP0(i, n) for (int i = (n)-1; i >= 0; --i)
#define REP1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define RREP1(i, n) for (int i = (n); i >= 1; --i)

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

const int INTINF = int(1e9) + 1;
const LL LLINF = LL(1e18) + 1;
long double eps = 1.0E-14;
#define pow10(n) int(1e##n + n)

void solve()
{
    int X, Y, Z;
    cin >> X >> Y >> Z;
    cout << Z << " " << X << " " << Y << endl;
}

int main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(20);
    solve();
    return 0;
}


Measured memory_bytes: 256
package main

import (
    "fmt"
)

func main(){
    var S, T, U string
    var A, B int
    fmt.Scan(&S, &T)
    fmt.Scan(&A, &B)
    fmt.Scan(&U)

    if U == S {
        A -= 1
    } else {
        B -= 1
    }

    fmt.Println(A, B)
    
}


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

int main(){
        int n;
        int p1 = 0;
        int p2 = 0;
        bool change = false;
        string haki;
        string in;
        string player1[1000];
        string player2[1000];
        cin >> n;
        getline(cin,haki);
        for(int i =0;i <n; i++){
                getline(cin,in);
                for(int q = 0; q < in.length();q++){
                        if(in[q] == 32){
                                change = true;
                        }else if(change == true){
                                player2[i] += in[q];
                        }else{
                                player1[i] += in[q];
                        }
                }
                change = false;
        }
        for(int i = 0; i < n; i++){
                int h =0;
                bool y = false;
                int k = player1[i].length() > player2[i].length()
                        ? player2[i].length():player1[i].length();
                for(h = 0; h < k; h++){
                        if(player1[i][h]>player2[i][h]){
                                p1 += 3;
                                break;
                        }else if(player1[i][h]<player2[i][h]){                                p2 += 3;
                                break;
                        }else{
                                y = true;
                        }
                }
                if(y == true){
                        if((97>player1[i][h]||player1[i][h] >122) &&
                            (97>player2[i][h]||player2[i][h] >122)){
                                p1++;
                                p2++;
                        }
                        else if(97 >player1[i][h]||player1[i][h] >122){
                                p2 += 3;
                        }else if(97 > player2[i][h]||player2[i][h] > 122){
                                p1 += 3;
                        }
                }

        }
        cout << p1 << " " <<p2 << endl;
}


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

int main()
{
	int ary[5];
	for (int i = 0; i < 5; i++) cin >> ary[i];
	for (int i = 0; i < 5; i++)
	{
		for (int j = i + 1; j < 5; j++)
		{
			if (ary[i] < ary[j]) swap(ary[i], ary[j]);
		}
	}
	for (int i = 0; i < 5; i++)
	{
		if (i != 0) cout << " ";
		cout << ary[i];
	}
	cout << endl;

	return 0;
}

Measured memory_bytes: 1164
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, N) for(int i = 0; i < N; i++)
#define rep2(i, N, a, b) for(int i = a; i < N; i += b)

int main(){
	int N, A, B;
	cin >> N >> A >> B;

	int ans = 0;
	rep(i, N + 1){
		string num = to_string(i);
		int sum = 0;
		rep(j, (int)(num.size())){
			sum += num.at(j) - '0';
		}
		// cout << sum << endl;
		if (A <= sum && sum <= B) ans += i;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
n = int(input())
a = list(map(int,input().split()))

a = sorted(a)
x1 = max(a)
x2 = min(a)
k = x1

for i in a:
    if  abs(x1/2 - i)< k:
        x2 = i
        k = abs(x1/2 - i)
    else:
        break

print(x1,x2)

Measured memory_bytes: 14060
#include <iostream>/*{{{*/
#include <bits/stdc++.h>
#define REP(i, x) for(int i = 0; i < (int)(x); i++)
#define REPS(i,x) for(int i = 1; i <= (int)(x); i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define RFOR(i, m, n) for(int i = m;i >= n;i--)
#define ALL(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define FILL(x,y) memset(x,y,sizeof(x))
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define PB(a) push_back(a)
#define debug(x) cerr << __LINE__ << ": " << #x << " -> " << x << '\n'
#define INF 999999999
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};/*}}}*/

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

  int n, a;
  cin >> n >> a;

  if (a>=(n%500)){
    puts("Yes");
  }
  else{
    puts("No");
  }

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//namespace mp = boost::multiprecision;

using namespace std;

const double PI = 3.14159265358979323846;
typedef long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
typedef pair<ll, ll> P;
const ll INF = 10e17;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
#define ret() return 0;

double equal(double a, double b) {
    return fabs(a - b) < DBL_EPSILON;
}

std::istream &operator>>(std::istream &in, set<int> &o) {
    int a;
    in >> a;
    o.insert(a);
    return in;
}

std::istream &operator>>(std::istream &in, queue<int> &o) {
    ll a;
    in >> a;
    o.push(a);
    return in;
}

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }

//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);
//const ll mod = 1e10;

typedef priority_queue<ll, vector<ll>, greater<ll> > PQ_ASK;


map<ll, int> factorize(ll n) {
    map<ll, int> res;

    for (ll i = 2; i * i <= n; i++) {
        if (n % i != 0) {
            continue;
        }
        res[i] = 0;
        while (n % i == 0) {
            n /= i;
            res[i]++;
        }
    }

    if (n != 1) res[n] = 1;
    return res;
}


ll comb(ll l, ll r) {
    map<ll, ll> factors;
    for (ll j = l; j > (l - r); j--) {
        auto fs = factorize(j);
        for (auto f : fs) {
            factors[f.first] += f.second;
        }
    }

    for (ll j = 1; j <= r; j++) {
        auto fs = factorize(j);
        for (auto f : fs) {
            factors[f.first] -= f.second;
        }
    }

    ll s = 1;

    for (auto e : factors) {

        for (int k = 0; k < e.second; k++) {
            s *= e.first;
        }
    }

    return s;
}

int main() {
    int n, a, b;
    cin >> n >> a >> b;

    vector<ll> v(n);
    rep(i, n) cin >> v[i];

    sort(v.rbegin(), v.rend());
    double ave = accumulate(v.begin(), v.begin() + a, 0.0) / a;

    ll mi = v[a - 1];
    ll ma = v.front();

    ll mic = count(v.begin(), v.end(), mi);
    ll mi_c = count(v.begin(), v.begin() + a, mi);
    ll ma_c = count(v.begin(), v.begin() + b, mi);

    if (ma != mi) {

        ll t = comb(mic, mi_c);

        cout << setprecision(20) << ave << endl << t << endl;
        ret();
    }


    ll ans = 0;
    for (int i = mi_c; i <= ma_c; i++) {
        ll now = comb(mic, i);
        ans += now;
    }
    cout << setprecision(20) << ave << endl << ans << endl;


}


Measured memory_bytes: 3796
#include "bits/stdc++.h"

#define REP(i, n ,N) for(int i = (n); i < (N); i++)
#define RREP(i, n ,N) for(int i = (N-1); i >= (n); i--)
#define p(s) cout<<(s)<<endl
#define p2(a, b) cout<<(a)<<" "<<(b)<<endl
using namespace std;
typedef long long ll;
ll mod = 1e9+7;
ll inf = 1e18;

int N, M, K;

struct UnionFind_QFW {
	vector<int> i2g;  // i2g[i]:アイテムiの所属するグループの番号
	/* アイテムの種類を変えたいときは下を変更 */
	vector<vector<int>> g2i; // g2i[g]:グループgに所属するアイテムたち

	UnionFind_QFW(int n) {
		i2g.resize(n);
		g2i.resize(n);
		for (int i = 0; i < n; i++) {
			i2g[i] = i;
			g2i[i].assign(1, i); // アイテムiを１つ割り当てる
		}
	}

	// 同じグループに所属しているか
	bool same(int ix, int iy) {
		return i2g[ix] == i2g[iy];
	}

	// xの所属するグループとyの所属するグループを結合
	void merge(int ix, int iy) {
		if (same(ix, iy)) return; // 同じグループなら何もしない

		// グループxのアイテム数 > グループyのアイテム数  となるように(※ 一般的なマージテク)
		if (g2i[i2g[ix]].size() < g2i[i2g[iy]].size()) {
			swap(ix, iy);
		}

		// gxの要素数 > gyの要素数
		int gx = i2g[ix];
		int gy = i2g[iy];
		for (int j : g2i[gy]) {
			i2g[j] = gx;
		}

		g2i[gx].insert(g2i[gx].end(), g2i[gy].begin(), g2i[gy].end()); // グループの結合
		g2i[gy].clear();
	}

	int group_size(int n){
		return g2i[i2g[n]].size();
	}
};
ll ans[100010];
int main(){
	cin >> N >> M >> K;
	UnionFind_QFW uf(N);
	REP(i,0,M){
		int A, B;
		cin >> A >> B;
		A--; B--;
		uf.merge(A, B);
		ans[A]--, ans[B]--;
	}
	REP(i,0,N){
		ans[i] += uf.group_size(i);
	}
	REP(i,0,K){
		int C, D;
		cin >> C >> D;
		C--; D--;
		if(uf.same(C, D)) ans[C]--, ans[D]--;
	}
	REP(i,0,N){
		if(i > 0) cout << " ";
		cout << ans[i] - 1;

	}
	cout << endl;

	return 0;
}

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

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; }

using ll = long long;
using P = pair<int,int>;
using graph = vector<vector<int>>;

const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const ll INF = 1LL<<60;
const ll mod = 1000000007LL;

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

ll pow(ll a, ll n, ll m) {
	ll ret = 1LL;
	for (; n > 0LL; n >>= 1LL, a = a * a % m) {
		if (n % 2LL == 1LL) {
			ret = ret * a % m;
		}
	}
	return ret;
}

int main() {
  string S;
  cin>>S;
  ll N = S.size();
  vector<int> v(N);
  int c = 1;
  reverse(S.begin(),S.end());
  rep(i,N){
    int t = S[i] - '0';
    if(i==0) v[i] = t;
    else v[i] = (v[i-1] + t*c)%2019;
    c = (c*10)%2019;
  }
  map<int,ll> m;
  rep(i,N) m[v[i]]++;
  m[0]++;
  ll ans = 0;
  for(auto x:m){
    ans += x.second*(x.second-1)/2;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 4372
# Template 1.0
import sys, re
from decimal import *
from collections import deque, defaultdict, Counter, OrderedDict
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, floor, trunc, log
from heapq import heappush, heappop, heapify, nlargest, nsmallest
def STR(): return list(input())
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def list2d(a, b, c): return [[c] * b for i in range(a)]
def sortListWithIndex(listOfTuples, idx):   return (sorted(listOfTuples, key=lambda x: x[idx]))
def sortDictWithVal(passedDic):
    temp = sorted(passedDic.items(), key=lambda kv: (kv[1], kv[0]))
    toret = {}
    for tup in temp:
        toret[tup[0]] = tup[1]
    return toret
def sortDictWithKey(passedDic):
    return dict(OrderedDict(sorted(passedDic.items())))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

s = input()
t = input()
ans = 0
for i in range(3):
    if(s[i]==t[i]):
        ans+=1
print(ans)

Measured memory_bytes: 76836
#include <iostream>
#include <iomanip>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <utility>
#include <string>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <numeric>

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;
typedef vector<s32> vs32;
typedef vector<u32> vu32;
typedef vector<s64> vs64;
typedef vector<u64> vu64;

const double PI=3.14159265358979323846;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

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

#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 1000000007ULL

#define IN(l, r, x) ((l) <= (x) && (x) < (r))

int n, k;
vector< vs32 > g;
vs64 d;
vector< bool > reached;

void dfs(int u, int p)
{
    if (reached[u]) return;
    reached[u] = true;

    int sub = 1;
    for (auto& v : g[u])
    {
        if (!reached[v]) { d[v] -= sub; ++sub; }
        if (!reached[v] && p != -1) --d[v];
        dfs(v, u);
    }
}

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

    cin >> n >> k;

    g.resize(n);
    int u, v;
    rep (i, n - 1)
    {
        cin >> u >> v;
        --u; --v;
        g[u].push_back(v);
        g[v].push_back(u);
    }

    d.resize(n, k);
    reached.resize(n, false);
    dfs(0, -1);

    s64 ans = 1;
    rep (i, n)
    {
        ans = (ans * d[i]) % MOD;
    }

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



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

int main(){
  int n;
  cin >> n;
  vector<vector<int> > v(n,vector<int>(26,0));
  for(int i=0;i<n;i++){
    string S;
    cin >> S;
    for(int j=0;j<S.size();j++){
      v.at(i).at(S.at(j)-'a')++;
    }
  }
  vector<int> ans(26);
  for(int i=0;i<26;i++){
    ans.at(i)=v.at(0).at(i);
    for(int j=1;j<n;j++){
      ans.at(i)=min(ans.at(i),v.at(j).at(i));
    }
    cout << string(ans.at(i),i+'a');
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 256
import math


def main():
    a, b, x = [int(x) for x in input().split()]
    area = x / a
    if area < a*b/2:
        theta = math.pi/2 - math.atan(2*area/b/b)
    else:
        theta = math.atan((2*b-2*area/a)/a)
    theta_deg = math.degrees(theta)
    print(theta_deg)


if __name__ == "__main__":
    main()


Measured memory_bytes: 3060
import fractions

N, X = list(map(int, input().split()))

x = list(map(int, input().split()))
d = 0
for i in range(N):
    if i == 0:
        d = abs(x[i] - X)
    else:
        d = fractions.gcd(d, abs(x[i] - X))

print(d)

Measured memory_bytes: 16240
use std::io::Read;

pub fn read_stdin() -> String {
    let mut s = String::new();
    ::std::io::stdin().read_to_string(&mut s).unwrap();
    s
}

pub trait Parse {
    fn to<T>(&mut self) -> T
    where
        T: std::str::FromStr;
}

impl<'a> Parse for std::str::SplitWhitespace<'a> {
    fn to<T>(&mut self) -> T
    where
        T: std::str::FromStr,
    {
        let word = self.next().unwrap();
        word.parse().ok().unwrap()
    }
}

fn main() {
    let source = read_stdin();
    let mut iter = source.split_whitespace();
    let n = iter.to();
    let mut v: Vec<i32> = (0..n).map(|_| iter.to()).collect();
    v.insert(0, 0);
    v.push(0);

    let sum: i32 = v.windows(2).map(|w| w[1] - w[0]).filter(|&x| x > 0).sum();

    println!("{}", sum);
}

Measured memory_bytes: 4352
#define y1 askjdkasldjlkasd
#include <bits/stdc++.h>
#undef y1

using namespace std;

#define pb push_back
#define mp make_pair
#define fi(a, b) for(int i=a; i<=b; i++)
#define fj(a, b) for(int j=a; j<=b; j++)
#define fo(a, b) for(int o=a; o<=b; o++)
#define fdi(a, b) for(int i=a; i>=b; i--)
#define fdj(a, b) for(int j=a; j>=b; j--)
#define fdo(a, b) for(int o=a; o>=b; o--)
#define sz(x) (int)x.size()

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef vector<ll> vll;

#ifdef LOCAL
#define err(...) fprintf(stderr, __VA_ARGS__)
#else
#define err(...) while (0)
#endif

double START_TIME;

void exit() {
#ifdef LOCAL	
	cerr << "TIME: " << setprecision(5) << fixed << (clock() - START_TIME) / CLOCKS_PER_SEC << endl;
#endif	
	exit(0);
}

template<typename A, typename B>
ostream& operator<<(ostream& os, pair<A, B> p) {
	os << "(" << p.first << ", " << p.second << ")";
	return os;
}

template<typename T>
ostream& operator<<(ostream& os, vector<T> v) {
	fi(0, sz(v) - 1) {
		os << v[i] << " ";
	}
	return os;
}

template<typename T>
ostream& operator<<(ostream& os, set<T> t) {
	for (auto z : t) {
		os << z << " ";
	}
	return os;
}

template<typename T1, typename T2>
ostream& operator<<(ostream& os, map<T1, T2> t) {
	cerr << endl;
	for (auto z : t) {
		os << "\t" << z.first << " -> " << z.second << endl;
	}
	return os;
}

#ifdef LOCAL
#define dbg(x) {cerr << __LINE__ << "\t" << #x << ": " << x << endl;}
#define dbg0(x, n) {cerr << __LINE__ << "\t" << #x << ": "; for (int ABC = 0; ABC < n; ABC++) cerr << x[ABC] << ' '; cerr << endl;}
#else
#define dbg(x) while(0){}
#define dbg0(x, n) while(0){}
#endif

#ifdef LOCAL
#define ass(x) if (!(x)) { cerr << __LINE__ << "\tassertion failed: " << #x << endl, abort(); }
#else
#define ass(x) assert(x)
#endif

///////////////////////////////////////////////////

const int MAX = 1e5 + 41;

int n;
int a[MAX];
int b[MAX];

void solve () {
	vpii va, vb;
	fi(0, n - 1) va.pb(mp(a[i], i)), vb.pb(mp(b[i], i));
	sort(va.begin(), va.end());
	sort(vb.begin(), vb.end());
	fi(0, n - 1) if (va[i].first > vb[i].first) {
		printf("No\n");
		exit();
	}
	vi pos(n);
	fi(0, n - 1) pos[i] = vb[i].second;
	vi u(n, 0);
//	dbg(pos);
	vector<vi> vc;
	vi nxt(n);
	fi(0, n - 1) {
		nxt[va[i].second] = pos[i];
	}
//	dbg(nxt);
	fi(0, n - 1) {
		if (u[i]) continue;
		int x = i;
		vi cyc;
		while (!u[x]) {
			u[x] = 1;
			cyc.pb(x);			
			x = nxt[x];
		}
		vc.pb(cyc);
	}	
//	dbg(sz(vc));
//	dbg(vc);
	if (sz(vc) > 1) {
		printf("Yes\n");
		exit();
	}
	bool f = false;
	fi(1, n - 1) {
		if (va[i].first <= vb[i - 1].first) {
			f = true;
			err("i = %d va = %d  vb = %d\n", i, va[i].first, vb[i].first);
		}
	}
	if (f) {
		printf("Yes\n");
	} else {
		printf("No\n");
	}
}

int main() {
#ifdef LOCAL
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	START_TIME = (double)clock();
#endif
	
	scanf("%d", &n);
	fi(0, n - 1) scanf("%d", &a[i]);
	fi(0, n - 1) scanf("%d", &b[i]);
	solve();

	exit();
	return 0;
}





Measured memory_bytes: 4716
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repp(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define repm(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define INF (1ll<<60)
#define all(x) (x).begin(),(x).end()
typedef long long lint;
const lint MOD =1000000007;
const lint MAX = 10000000;
using Graph =vector<vector<lint>>;

 
lint fac[MAX], finv[MAX], inv[MAX];

void COMinit() // 二項係数を求める時は前処理としてCOMinit()をする
{
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (lint i = 2; i < MAX; i++)
    {
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
 
// 二項係数計算
long long COM(lint n, lint k)
{
    if (n < k)
        return 0;
    if (n < 0 || k < 0)
        return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

lint primary(lint num)
{
    if (num < 2) return 0;
    else if (num == 2) return 1;
    else if (num % 2 == 0) return 0; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return 0;
        }
    }

    // 素数である
    return 1;
}
  

  int main(){
     lint N;
     cin>>N;
     lint a;
     lint b;
     lint P[N];
     lint Q[N];
     rep(i,N){
         cin>>P[i];
     }
      rep(i,N){
         cin>>Q[i];
     }
     vector<lint> x;
     vector<lint> y;
     vector<lint> z;
     rep(i,N){
         x.push_back(i+1);
         y.push_back(i+1);
        z.push_back(i+1);
     }
   
     lint h=1;
    lint count=0;
     while(next_permutation(x.begin(),x.end())){
         rep(i,N){
             if(x[i]!=P[i])break;
            count++;
         }
         if(count==N)a=h;
         h++;
         count=0;
     }
     h=1;
     count=0;
      while(next_permutation(y.begin(),y.end())){
         rep(i,N){
             if(y[i]!=Q[i])break;
            count++;
         }
         if(count==N)b=h;
         h++;
         count=0;
     }
     lint g=0;
     rep(i,N){
         if(z[i]==P[i])g++;
     }
     if(g==N)a=0;
     g=0;
     rep(i,N){
         if(z[i]==Q[i])g++;
     }
     if(g==N)b=0;

cout<<abs(a-b);
  }
  

Measured memory_bytes: 256
#include <iostream>
#include <fstream>

using namespace std;

int const NMAX = 1e6;
bool freq[1 + NMAX];

int main() {

  int n, m = 0, ans = 0;
  cin >> n;
  while(freq[m] == false){
    freq[m] = true;
    m = (m * 10 + 7) % n;
    ans++;
    if(m == 0){
      cout << ans;
      return 0;
    }
  }
  cout << -1;
  return 0;
}


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

int main() {
    int max;
    cin >> max;
    int num[max];
    unsigned long long sum[21][max];
    for(int j=0;j<max;j++){
        cin >> num[j];
    }
    for(int i=0;i<21;i++){
        sum[i][0]=0;
    }
    sum[num[0]][0]=1;

    for(int j=1;j<max-1;j++){
    	int addnum=num[j];
        for(int i=0;i<21;i++){
            if(i<addnum){sum[i][j]=sum[i+addnum][j-1];}
            else if(i>=21-addnum){sum[i][j]=sum[i-addnum][j-1];}
            else{sum[i][j]=sum[i+addnum][j-1]+sum[i-addnum][j-1];}
        }
    }
    cout << sum[num[max-1]][max-2] << endl;
    return 0;
}


Measured memory_bytes: 3100
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pi;
typedef vector<pi> vii;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n;
  cin>>n;
  ll arr[n];
  for(int i=0; i<n; ++i){
    cin>>arr[i];
  }
  sort(arr,arr+n);
  cout<<abs(arr[n-1]- arr[0])<<"\n";
  return 0;
}


Measured memory_bytes: 256
//ABC094_B

#include <iostream>
#include <vector>

using namespace std;

int main()
{
    int n, m, x;
    cin >> n >> m >> x;
    
    vector<int> v(m);
    for(int i = 0; i < m; i++) {
        cin >> v[i];
    }
    
    int ans1 = 0;
    int cnt = 0;
    for(int i = 0; i < x; i++) {
        if(v[cnt] == i) {
            ans1++;
            cnt++;
            
            if(cnt == v.size()) {
                cout << 0 << endl;
                return 0;
            }
        }
    }
    
    int ans2 = 0;
    for(int i = x; i < n; i++) {
        if(v[cnt] == i) {
            ans2++;
            cnt++;
            
            if(cnt == v.size()) {
                break;
            }
        }
    }
    
    cout << (ans1 < ans2 ? ans1 : ans2) << endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(){
  int A;
  scanf("%d", &A);
  int B;
  scanf("%d", &B);
  
  if(A==1 && B==3){
    printf("2");
  }
  else if(A==1 && B==2){
    printf("3");
  }
  else if(A==2 && B==3){
    printf("1");
  }
  else if(A==3 && B==1){
    printf("2");
  }
  else if(A==2 && B==1){
    printf("3");
  }
  else if(A==3 && B==2){
    printf("1");
  return 0;
  }
}

Measured memory_bytes: 1600
#include<stdio.h>
#include<iostream>
#include<vector>
#include <bits/stdc++.h>
#include <queue>
#include <algorithm>
#include <string>
#include <iomanip>

using namespace std;
typedef long long ll;

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

int main(){
  ll a,b,h,m; cin>>a>>b>>h>>m;
  // vector<ll> a(n);
  // rep(i,n){
  //   cin>>a[i];
  // }
  
  double s = (h*60+m)*0.5;
  double l = m*6;
  double an=abs(s-l);
  an=(an/360)*2*M_PI;
  double ans=sqrt(a*a+b*b - 2*a*b*cos(an));
  std::cout << std::fixed;
  cout<<std::setprecision(20)<<ans;


 

    
  
  
  return 0;
}

Measured memory_bytes: 4188
#include "bits/stdc++.h"
using namespace std;
const int N = 5e5 + 5;
int n , d;
int arr[N];
int dis[N];
long long ans[N];
void calc(int idx){
	if(abs(ans[idx + 1] - arr[idx]) > ans[idx + 1]){
		ans[idx] = ans[idx + 1];
	}
	else{
		ans[idx] = ans[idx + 1] + arr[idx];
		if(arr[idx] - ans[idx + 1] >= ans[idx + 1]){
			ans[idx] = min(ans[idx] , arr[idx] - ans[idx + 1]);
		}
	}
}
int main(){
	scanf("%d %d" , &n , &d);
	for(int i = 1 ; i <= n ; ++i){
		scanf("%d" , arr + i);
	}
	dis[0] = d;
	for(int i = 1 ; i <= n ; ++i){
		dis[i] = min(dis[i - 1] , abs(dis[i - 1] - arr[i]));
	}
	ans[n + 1] = 1;
	for(int i = n ; i >= 1 ; --i){
		calc(i);
	}
	int q;
	scanf("%d" , &q);	
	while(q--){
		int inp;
		scanf("%d" , &inp);
		if(dis[inp - 1] >= ans[inp + 1]){
			printf("YES\n");
		}
		else{
			printf("NO\n");
		}
	}
}


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

using ll = long long;

#define pb push_back
#define ff first
#define ss second
#define all(a) a.begin(), a.end()
#define sz(a) (int)(a.size())
#define clr(a, b) memset(a, b, sizeof(a))
#define REP(i, a, b) for(int i=(int)(a); i<(int)(b); ++i)
#define REPD(i, a, b) for(int i=(int)(a)-1; i>=(int)(b); --i)

template<typename T> inline bool chkmin(T &a, const T &b) { return a > b ? a = b, 1 : 0; }
template<typename T> inline bool chkmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; }

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string s, t;
    cin >> s >> t;
    int res = 0;
    REP(i, 0, sz(s)) {
    	if(s[i] != t[i]) ++res;
    }
    cout << res << "\n";
    return 0;
}


Measured memory_bytes: 3896
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0; (i)<(n); (i)++)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define ll long long
#define pii pair<int,int> 
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
const int INF = 1001001001;
//int 2×10の9乗
//vector<vector<int>> a(n, vector<int>(m));
  //rep(i,n) rep(j,m) cin >> a[i][j]; 
//cout << fixed << setprecision(10);
//int gcd(int x, int y){
  //if(y==0) return x;
  //return gcd(y, x%y);
//}
//sort小さい順(昇順)
//g++ code.cpp   ./a.out 
int main(){
  int n;
  cin >> n;
  for(int i=1; i<10; i++){
    for(int j=1; j<10; j++){
      if(i*j==n){
        Yes; return 0;
      }
    }
  }
  No;
}


Measured memory_bytes: 256
#import sys
MOD = 10 ** 9 + 7
INFI = 10**10
#input = sys.stdin.readline
import math
from collections import deque
import itertools
import heapq
#import bisect
from fractions import Fraction
import copy
from functools import lru_cache
from collections import defaultdict
import pprint

#oo=list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
# ko=list("abcdefghijklmnopqrstuvwxyz")

def sosuhante(n):
    for k in range(2, int(math.sqrt(n))+1):
        if n% k ==0:
            return False
    return True
def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

def kingaku(a,b,n):
    keta=len(str(n))
    return a*n+b*keta

def my_index(l, x, default=False):
    if x in l:
        return l.index(x)
    else:
        return default

#    h,w,a,b = map(int, input().split())
#    c = [[0 for j in range(n)] for i in range(n)]

def ret(a):
    c=[None]*(len(a)-1)
    if len(a)==1:
        return a[0]
    elif len(a)==0:
        return 0
    for i in range(1,len(a)):
        c[i-1]=abs(a[i]-a[i-1])
    return ret(c)

def soinsubunkai(n):
    a = []
    i = 1
    while i*i <= n:
        if n % i == 0 and i!=1:
            a.append(i)
            n=n//i

        if n% i !=0 or i==1:
            i += 1
    nokori=[n]
    return a + nokori


def main():
    n,m,k=map(int,input().split())
    aa=list(map(int,input().split()))
    bb=list(map(int,input().split()))
    a=[0]
    a.extend(aa)
    b=[0]
    b.extend(bb)
    maxcount=0
    totaltime=0
    maxa=0
    maxb=0
    for i in range(n+1):
        if totaltime+a[i]<=k:
            totaltime+=a[i]

        else:
            maxa=i-1
            break
        maxa = i
    totaltime=0
    maxb=0
    nowatotal=sum(a[0:maxa+1])
    nowbtotal=sum(b[0:maxb+1])
    for i in range(maxa,-1,-1):
#        nowbtotal = sum(b[0:maxb + 1])
        for j in range(maxb,m+1):
            nowcount=i+j
            if nowatotal+nowbtotal+b[j]<=k:
                maxcount=max(maxcount,nowcount)
                maxb+=1
            else:
                break
            nowbtotal+=b[j]
        nowatotal-=a[i]
    print(maxcount)

if __name__ == "__main__":

    main()

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

typedef long long ll;
string s,str[2];
int q;
int main(){
	//freopen("in.txt","r",stdin);
	cin>>s>>q;
	str[0]=str[1]="";
	int flag=0;
	int t,f;
	char c;
	while(q--){
		cin>>t;
		if(t==1){
			flag^=1;
		}else{
			cin>>f>>c;
			if(f==1){
				str[flag^0]+=c;
			}else{
				str[flag^1]+=c;
			}
		}
	}
	string ans="";
	if(flag==0){
		reverse(str[0].begin(),str[0].end());
		ans=str[0]+s+str[1];
	}else{
		reverse(str[1].begin(),str[1].end());
		reverse(s.begin(),s.end());
		ans=str[1]+s+str[0];
	}
	cout<<ans<<"\n";
	return 0;
}

Measured memory_bytes: 1348
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstring>
#include <cstdio>
#define LL long long
#define pb push_back
#define mp make_pair
#define INF 0x3f3f3f3f
#define Inf 1000000000000000000LL
#define F first
#define S second
using namespace std;
typedef pair<int,int>pii;
int a[4],b[4];
int du[10];
int ji;
int main(){
	for(int i=1;i<=3;i++)cin>>a[i]>>b[i],du[a[i]]++,du[b[i]]++;
	for(int i=1;i<=4;i++)if(du[i]%2==1)ji++;
	if(ji>2)puts("NO");
	else puts("YES");
	return 0;
}


Measured memory_bytes: 256
S=list(input())
max=0
for i in range(len(S)):
  leng=0
  if S[i]=="A" or S[i]=="G" or S[i]=="C" or S[i]=="T":
    leng+=1
    for j in range(i+1,len(S)):
      if S[j]=="A" or S[j]=="G" or S[j]=="C" or S[j]=="T":
        leng+=1
      else:
        break
  if max<leng:
    max=leng
print(max)

Measured memory_bytes: 3064
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    n = int(readline())
    s = int(readline())

    if s > n:
        print(-1)
        sys.exit()
    if s == n:
        print(n + 1)
        sys.exit()

    for i in range(2, n):
        k = i ** 2
        if k > n:
            break
        x = n
        cur = 0
        while x > 0:
            cur += x % i
            x = x // i

        if cur == s:
            print(i)
            sys.exit()

    ans = INF
    for i in range(1, n):
        k = i ** 2
        if k >= n:
            break
        if (n - s) % i == 0:
            b = (n-s) // i + 1
            p = n // b
            q = n % b
            if p + q == s:
                ans = min(ans,b)

    if ans == INF:
        print(-1)
    else:
        print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 72868
package main

import "fmt"

func main() {
	N := 0
	fmt.Scan(&N)
	dps := make([][][][]int64, N+1)
	for i := 3; i <= N; i++ {
		dps[i] = make([][][]int64, 4)
		for j := 0; j <= 3; j++ {
			dps[i][j] = make([][]int64, 4)
			for k := 0; k <= 3; k++ {
				dps[i][j][k] = make([]int64, 4)
				for l := 0; l <= 3; l++ {
					dps[i][j][k][l] = 0
				}
			}
		}
	}
	for i := 3; i <= N; i++ {
		for j := 0; j <= 3; j++ {
			for k := 0; k <= 3; k++ {
				for l := 0; l <= 3; l++ {
					if i == 3 {
						if j == 0 && k == 1 && l == 2 {
							dps[i][j][k][l] = 0
						} else if j == 1 && k == 0 && l == 2 {
							dps[i][j][k][l] = 0
						} else if j == 0 && k == 2 && l == 1 {
							dps[i][j][k][l] = 0
						} else {
							dps[i][j][k][l] = 1
						}
						continue
					}
					for m := 0; m <= 3; m++ {
						enable := true
						if m == 2 && k == 0 && l == 1 {
							enable = false
						} else if m == 2 && j == 0 && k == 1 {
							enable = false
						} else if m == 2 && j == 0 && l == 1 {
							enable = false
						} else if m == 2 && k == 1 && l == 0 {
							enable = false
						} else if m == 1 && k == 0 && l == 2 {
							enable = false
						}
						if enable {
							dps[i][k][l][m] += dps[i-1][j][k][l] % 1000000007
						}
					}
				}
			}
		}
	}

	ans := int64(0)
	for j := 0; j <= 3; j++ {
		for k := 0; k <= 3; k++ {
			for l := 0; l <= 3; l++ {
				ans += dps[N][j][k][l]
			}
		}
	}
	fmt.Println(ans % 1000000007)
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);  
    string s,X="ABC";
    cin>>s;
    if(s==X)
    cout<<"ARC";
    else
    cout<<"ABC";
    return 0;
}

Measured memory_bytes: 3652
#include<iostream>
using namespace std;
 
int main(){
    int r,c,i,j;
    cin >> r >> c;
    int a[r+1][c+1];
    for(i=0;i<r+1;i++){
        for(j=0;j<c+1;j++){
            a[i][j]=0;
        }
    }
    for(i=0;i<r;i++){
        for(j=0;j<c;j++){
            cin >> a[i][j];
        }
    }
    for(i=0;i<r;i++){
        for(j=0;j<c;j++){
            a[i][c]+=a[i][j];
        }
    }
    for(i=0;i<c;i++){
        for(j=0;j<r;j++){
            a[r][i]+=a[j][i];
        }
    }
    for(i=0;i<r;i++){
            a[r][c]+=a[i][c];
    }
     
    for(i=0;i<r+1;i++){
        for(j=0;j<c+1;j++){
            cout << a[i][j] ;
            if(j!=c) cout <<" ";
        }
        cout << endl;
    }
}

Measured memory_bytes: 3108