akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int n;
vector<int> graph[500000];
int marked[500000];

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >> n;
    if (n == 2)
    {
        cout << 1 << " " << 2;
        return 0;
    }
    for (int i = 0; i + 1 < n; i++)
    {
        int v, u;
        cin >> v >> u;
        graph[v].push_back(u);
        graph[u].push_back(v);
    }
    for (int i = 1; i <= n; i++)
    {
        if (graph[i].size() >= 2) marked[i] = 1;
    }
    vector<int> ee;
    for (int i = 1; i <= n; i++)
    {
        if (marked[i] == 1)
        {
            int c = 0;
            for (auto u : graph[i])
            {
                if (marked[u]) c++;
            }
            if (c > 2)
            {
                cout << -1;
                return 0;
            }
            if (c <= 1)
            {
                ee.push_back(i);
            }
        }
    }
    if (ee.size() > 2)
    {
        cout << -1;
        return 0;
    }
    int v, u;
    if (ee.size() == 1)
    {
        v = graph[ee[0]][0];
        u = graph[ee[0]][1];
    }
    else
    {
        for (int i = 0; i < graph[ee[0]].size(); i++)
        {
            if (marked[graph[ee[0]][i]] == 0)
                v = graph[ee[0]][i];
        }
        for (int i = 0; i < graph[ee[1]].size(); i++)
        {
            if (marked[graph[ee[1]][i]] == 0)
                u = graph[ee[1]][i];
        }
    }
    vector<int> path = {v, ee[0]};
    for (int i = 1; i < path.size(); i++)
    {
        int x = path[i];
        for (auto u : graph[x])
        {
            if (marked[u] == 1 && path[i - 1] != u)
            {
                path.push_back(u);
                break;
            }
        }
    }
    path.push_back(u);
    vector<int> szz;
    for (int i = 0; i < path.size(); i++)
    {
        if (i == 0 || i + 1 == path.size())
        {
            szz.push_back(graph[path[i]].size() - 1);
        }
        else
        {
            szz.push_back(graph[path[i]].size() - 2);
        }
    }
    //for (auto e : szz) cout << e << " "; cout << endl;
    vector<int> p1, p2;
    int k = 0;
    for (int i = 0; i < szz.size(); i++)
    {
        for (int j = 0; j < szz[i]; j++)
        {
            p1.push_back(k + j + 1);
        }
        p1.push_back(k);
        k = k + szz[i] + 1;
    }
    reverse(szz.begin(), szz.end());
    k = 0;
    for (int i = 0; i < szz.size(); i++)
    {
        for (int j = 0; j < szz[i]; j++)
        {
            p2.push_back(k + j + 1);
        }
        p2.push_back(k);
        k = k + szz[i] + 1;
    }
    if (p1 < p2)
    {
        for (int i = 0; i < p1.size(); i++) cout << p1[i] + 1 << " ";
        return 0;
    }
    else
    {
        for (int i = 0; i < p2.size(); i++) cout << p2[i] + 1 << " ";
        return 0;
    }
}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
using P = pair<ll, ll>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep1(i, n) for(ll i=1;i<=(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
#define ALL(obj) (obj).begin(), (obj).end()
#define MOD 1000000007
#define INF 1000000000

ll dp[100001];

void solve_abc099_d() {
	ll N, C;
	int ans = 0;
	cin >> N >> C;

	int D[31][31] = { {0} };
	rep(i, C) {
		rep(j, C) {
			cin >> D[i][j];
		}
	}

	int c[501][501] = { {0} };
	int g[3][31] = { {0} };
	rep(i, N) {
		rep(j, N) {
			cin >> c[i][j];
			g[(i + j) % 3][c[i][j]-1]++;
		}
	}

	ans = INF;
	int cost;
	rep(i, C) {
		rep(j, C) {
			rep(k, C) {
				if (i != j && j != k && k != i) {
					cost = 0;
					rep(m, C) {
						cost += g[0][m] * D[m][i];
						cost += g[1][m] * D[m][j];
						cost += g[2][m] * D[m][k];
					}
					if (ans > cost) {
						ans = cost;
					}
				}
			}
		}
	}

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

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

	solve_abc099_d();

	return 0;
}

Measured memory_bytes: 1280
#include<bits/stdc++.h>
typedef long long ll;
#define INF 100000000
#define MOD 1000000007
int dx[4]={1,0,-1,0},dy[4]={0,-1,0,1};
using namespace std;
int main(void){
    int n;
    string s;
    cin>>n>>s;
    int ans=0;
    for(int i=0;i<n-2;i++){
        if(s[i]=='A' and s[i+1]=='B' and s[i+2]=='C'){
            ans++;
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <vector>
#include <set>
#include <cstdlib>
#include <utility>
#include <cmath>
#include <queue>
#include <stack>
#include <cstring>

using namespace std;

#define ll long long

#ifndef ONLINE_JUDGE
#define debug(format, ...) fprintf(stderr, \
    "%s:%d: " format "\n", __func__, __LINE__,##__VA_ARGS__)
#else
#define debug(format, ...)
#define NDEBUG
#endif

int h, w, n;
int sr, sc;

char s[200005];
char t[200005];

bool check(int cur, char dec, char inc, int maxv)
{
    int left = 1;
    int right = maxv;
    for (int i = n; i >= 1; i--) {
        if (s[i] != dec && s[i] != inc) {
            if (t[i] == dec) right++;
            if (t[i] == inc) left--;
        } else if (t[i] != dec && t[i] != inc) {
            if (s[i] == dec) left++;
            if (s[i] == inc) right--;
        } else {
            if (s[i] == t[i]) {
                if (s[i] == dec) {
                    left++, right++;
                } else {
                    left--, right--;
                }
            } else {
                if (s[i] == dec) {
                    left = max(left, 2);
                } else {
                    right = min(right, maxv - 1);
                }
            }
        }
        left = max(left, 1);
        right = min(right, maxv);
        if (left > right) return true;
    }
    return cur < left || cur > right;
}

int main()
{
    scanf("%d%d%d", &h, &w, &n);
    scanf("%d%d", &sr, &sc);
    scanf("%s%s", s + 1, t + 1);
    if (check(sc, 'L', 'R', w) || check(sr, 'U', 'D', h)) {
        printf("NO");
    } else {
        printf("YES");
    }
    return 0;
}


Measured memory_bytes: 3576
#include <bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
#define pb push_back
#define pii pair < int , int >
#define F first
#define S second
#define endl '\n'
#define int long long
#define sync ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")
#define kill(x) return cout<<x<<'\n', 0;
using namespace std;
const int inf=(ll)1e18;
struct edge{
	ll to, cap, rev;
	edge(ll a, ll b, ll c){
		to = a, cap = b, rev = c;
	}
};

int n, m;
int a[105][105], b[105][105], c[105][105];
vector<int> vec[105][105];

vector<edge> G[255];
int S, T;
ll level[255], iter[255];

void bfs(ll s)
{
	for(int i = 0; i <= T; i++) level[i] = inf;
	level[s] = 0;

	queue<int> Q;
	Q.push(s);
	while(Q.size()){
		int v = Q.front();
		Q.pop();
		for(int i = 0; i < G[v].size(); i++){
			int u = G[v][i].to;
			if(G[v][i].cap <= 0 || level[u] < inf) continue;
			level[u] = level[v] + 1;
			Q.push(u);
		}
	}
}

ll dfs(int v, ll f)
{
	if(v == T) return f;

	ll ret;
	for(int i = iter[v]; i < G[v].size(); i++){
		if(level[v] >= level[G[v][i].to] || G[v][i].cap <= 0) continue;
		ret = dfs(G[v][i].to, min(f, G[v][i].cap));
		if(ret > 0){
			G[v][i].cap -= ret;
			G[G[v][i].to][G[v][i].rev].cap += ret;
			return ret;
		}
	}
	return 0;
}

void add_edge(int s, int t, ll cap)
{
	G[s].push_back(edge(t, cap, G[t].size()));
	G[t].push_back(edge(s, 0, G[s].size()-1));
}

int32_t main()
{
	cin >> n >> m;
	for(int i = 0; i < n; i++){
		for(int j = 0; j < m; j++){
			cin >> a[i][j];
			a[i][j]--;
			vec[i][a[i][j]/m].push_back(a[i][j]);
		}
	}

	S = 2*n, T = 2*n+1;
	for(int z = 0; z < m; z++){

		for(int i = 0; i <= T; i++) G[i].clear();
		for(int i = 0; i < n; i++){
			for(int j = 0; j < n; j++){
				if(vec[i][j].size() > 0) add_edge(j, n+i, 1);
			}
		}
		for(int i = 0; i < n; i++) add_edge(S, i, 1), add_edge(n+i, T, 1);

		ll ans = 0, flow;
		while(1){
			bfs(S);
			if(level[T] >= inf) break;
			for(int i = 0; i <= T; i++) iter[i] = 0;
			while(1){
				flow = dfs(S, inf);
				if(flow <= 0) break;
				ans += flow;
			}
		}

		for(int i = 0; i < n; i++){
			for(int j = 0; j < G[i].size(); j++){
				int v = G[i][j].to;
				if(G[i][j].cap > 0 || v < n || v >= 2*n) continue;
				v -= n;
				b[v][z] = vec[v][i].back(), vec[v][i].pop_back();
			}
		}
	}

	for(int i = 0; i < n; i++){
		for(int j = 0; j < m; j++){
			cout << b[i][j]+1 << " ";
		}
		cout << endl;
	}

	for(int j = 0; j < m; j++){
		vector<int> vec;
		for(int i = 0; i < n; i++) vec.push_back(b[i][j]);
		sort(vec.begin(), vec.end());
		for(int i = 0; i < n; i++) c[i][j] = vec[i];
	}

	for(int i = 0; i < n; i++){
		for(int j = 0; j < m; j++){
			cout << c[i][j]+1 << " ";
		}
		cout << endl;
	}

	return 0;
}


Measured memory_bytes: 5124
#!/usr/bin/env python3

N, K = map(int, input().split())
A = list(map(int, input().split()))

A = [a-1 for a in A]

b = bin(K)
D = {0:list(range(N))} # ダブリングマトリクス
D[1] = [A[D[0][i]] for i in range(N)]

for i in range(1, len(b)-2):
    D[2**i] = [D[2**(i-1)][D[2**(i-1)][j]] for j in range(N)]


n = 2**(len(b[2:])-1)
S = D[n][0] # 初期状態
keta = len(b[2:]) - 2
for j in range(len(b[3:])):
    k = 2**keta
    if b[j+3] == '1':
        S = D[k][S]
    keta -= 1

print(S+1)


Measured memory_bytes: 218356
#include<bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define sz(a) int(a.size())
#define clr(a) memset(a,0,sizeof(a))
#define all(a) a.begin(),a.end()
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,int> pli;
const int inf=1e9;
const ll Inf=1e18;
const int N=2e5+10;
const int mod=0;
int gi() {
    int x=0,o=1;char ch=getchar();
    while((ch<'0'||ch>'9')&&ch!='-') ch=getchar();
    if(ch=='-') o=-1,ch=getchar();
    while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
    return x*o;
}
template<typename T> bool chkmax(T &a,T b) { return a<b?a=b,1:0; };
template<typename T> bool chkmin(T &a,T b) { return a>b?a=b,1:0; };
int add(int a,int b) { return a+b>=mod?a+b-mod:a+b; }
int sub(int a,int b) { return a-b<0?a-b+mod:a-b; }
void inc(int &a,int b) { a=(a+b>=mod?a+b-mod:a+b); }
void dec(int &a,int b) { a=(a-b<0?a-b+mod:a-b); }
int n,a[N],st[N],tp=0;
int main() {
    n=gi();
    for(int i=1;i<=n;i++) {
        a[i]=gi();
        if(a[i]==0) st[++tp]=i;
    }
    if(st[1]!=1) return puts("-1"),0;
    ll ans=0;
    st[++tp]=n+1;
    for(int t=1;t<tp;t++) {
        int l=st[t],r=st[t+1]-1;
        for(int i=l+1;i<=r;i++) {
            if(a[i]>a[i-1]+1) return puts("-1"),0;
            if(a[i]!=a[i-1]+1) ans+=a[i];
            else ++ans;
        }
    }
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 1792
/*|In The Name Of Allah|*/

#include <bits/stdc++.h>

using namespace std;

const int N = 2e5+5;

int ar[3];

int main(){
    cin >> ar[0] >> ar[1] >> ar[2];
    sort(ar , ar + 3);
    cout << ar[0] + ar[1] << endl;
}

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

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

	vector<string> A(N);

	for (int i = 0; i < N; i++)
	{
		cin >> A.at(i);
		sort(A.at(i).begin(), A.at(i).end());
	}

	map<string, long long> mp;

	for (int i = 0; i < N; i++)
	{
		string s = A.at(i);
		mp[s]++;
	}

	long long ans = 0;

	for (auto e : mp)
	{
			ans += e.second * (e.second - 1) / 2;
	}

	cout << ans << endl;
	return 0;


}

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

long long int MOD = 1e9+7;

long long int f(long long int x,long long int n){
    if(n == 0)return 1;
    long long int a = f(x,n/2);
    a = a * a % MOD;
    if(n % 2 == 1)a *= x;
    return a % MOD;
}

int main(void){
    long long int n,a,b;
    cin >> n >> a >> b;
    long long ans = f(2,n)-1;
    long long a1 = 1,a2 = 1,b1 = 1,b2 = 1;
    for(long long i = n-a+1;i <= n;i++){
        a1 *= i;
        a1 %= MOD;
    }
    for(long long i = 1;i <= a;i++){
        a2 *= i;
        a2 %= MOD;
    }
    for(long long i = n-b+1;i <= n;i++){
        b1 *= i;
        b1 %= MOD;
    }
    for(long long i = 1;i <= b;i++){
        b2 *= i;
        b2 %= MOD;
    }
    ans += MOD - (a1*f(a2,MOD-2)) % MOD;
    ans %= MOD;
    ans += MOD - (b1*f(b2,MOD-2)) % MOD;
    ans %= MOD;
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define MAX 100000
const long long INF=1145141919,MOD=1e9+7;
const int dx[8]={1,0,-1,0,1,-1,-1,1};
const int dy[8]={0,1,0,-1,1,1,-1,-1};

int main(){
    int n,p;
    cin>>n>>p;
    while(n){
        int x[n]={};
        int ans=p;
        x[0]=1;
        p--;
        int i=0;
        while(1){
            if(i==n-1) i=0;
            else i++;
            if(p>1){
                x[i]++;
                p--;
            }else if(p==0){
                if(x[i]>0){
                    p+=x[i];
                    x[i]=0;
                }
            }else{
                if(x[i]==ans-1){
                    cout<<i<<endl;
                    break;
                }else{
                    x[i]++;
                    p--;
                }
            }
        }
        cin>>n>>p;
    }
    return 0;
}



Measured memory_bytes: 3040
# include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
    vector<int> vec;
    int a,b,k;
    scanf("%d%d%d",&a,&b,&k);
    for(int i=1;i<=max(a,b);i++){
        if(a%i == 0 && b%i == 0)
            vec.push_back(i);
    }
    printf("%d\n",vec[vec.size()-k]);
    return 0;
}


Measured memory_bytes: 256
#D line++

n, x, y = map(int, input().split())
a = [0]*n

for i in range(n-1):
    for j in range(i+1, n):
        ans = 10000
        if j-i < ans:
            ans = j-i
        
        cut = abs(x-1-i) + abs(y-1-j) + 1
        if cut < ans:
            ans = cut
        
        a[ans-1] += 1

for i in range(n-1):
    print(a[i])



Measured memory_bytes: 3444
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())


n, m = map(int, input().split())
uf = UnionFind(n)
for i in range(m):
    a, b = map(int, input().split())
    a-=1; b-=1
    uf.union(a, b)

print(max([uf.size(i) for i in uf.roots()]))




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

typedef long long ll;

ll mod_pow(ll x, ll n, ll mod) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * x % mod;
        x = x * x % mod;
        n >>= 1;
    }
    return res;
}

int main() {
    ll n, k, MOD = 1e9 + 7;
    cin >> n >> k;
    vector<ll> f(2 * n, 1);
    rep(i, 2 * n - 1) f[i + 1] = (f[i] * (i + 1)) % MOD;
    if (k >= n - 1) {
        //cout << (2n - 1) C (n - 1);
        cout << (((f[2 * n - 1] * mod_pow(f[n], MOD - 2, MOD)) % MOD) * mod_pow(f[n - 1], MOD - 2, MOD)) % MOD << endl;;
        return 0;
    }
    //n - k人は移動できないので空き部屋がkより多くなることはない
    //空き部屋i部屋のときn-i部屋のパターンは(n-1)C(i) * (n)C(i)
    ll ans = 0;//i=0
    rep(i, k + 1) {
        ll p = (f[n - 1] * mod_pow(f[i], MOD - 2, MOD)) % MOD;
        p = (p * mod_pow(f[n - 1 - i], MOD - 2, MOD)) % MOD;
        p = (p * f[n]) % MOD;
        p = (p * mod_pow(f[i], MOD - 2, MOD)) % MOD;
        p = (p * mod_pow(f[n - i], MOD - 2, MOD)) % MOD;
        ans = (ans + p) % MOD;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3328
n, a, b, c, d = (int(i) for i in input().split())
road=input()

def aida(x, y, list):
    #print(list[x-1:y])
    iwa=0
    space=0
    for l in list[x-1:y]:
        if l=="#":
            space=0
            if iwa==1:
                return 0
            else:
                iwa=1
        else:
            iwa=0
            if space==2:
                return 2
            elif space==1:
                space=2
            else:
                space=1
    return 1 #岩が連続していない
    


if c<b:
    t=aida(a,c,road)
    u=aida(b,d,road)
    if t>0 and u>0:
        print('Yes')
    else:
        print('No')
elif c<d:
    t=aida(a,c,road)
    u=aida(b,d,road)
    if t>0 and u>0:
        print('Yes')
    else:
        print('No')
else:
    t=aida(a,c,road)
    u=aida(b-1,min(d+1,n),road)
    #print(t,u)
    if t>0 and u==2:
        print('Yes')
    else:
        print('No')

Measured memory_bytes: 3572
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0;i < n;i++)
using namespace std;
 
int main(){
    int n; cin >> n;
    string ans;
    vector<char> s(n);
    rep(i,n) cin >> s.at(i);
    sort(s.begin(), s.end());
    for(int i = 0;i < n/2;i++){
        if(s.at(i) == s.at(i+1)){
            ans = "Yes";
            i++;
        }else{
            ans = "No";
            break;
        }
    }
    if(n % 2 == 1) ans = "No";
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <string>
#include <iostream>
using namespace std;
string s[2], t[2], b, v[] = { "..", ".#", "#.", "##" };
int n;
int main() {
	cin >> n;
	bool ok = false;
	while (!ok) {
		bool found = false;
		for (int i = 0; i < 4; i++) {
			t[0] = v[i][0] + s[0]; t[1] = v[i][1] + s[1];
			cout << t[0] << endl << t[1] << endl;
			cin >> b;
			if (b == "T" || b == "end") {
				s[0] = t[0]; s[1] = t[1];
				found = true;
				if (b == "end") ok = true;
				break;
			}
		}
		if (!found) break;
	}
	while (!ok) {
		bool found = false;
		for (int i = 0; i < 4; i++) {
			t[0] = s[0] + v[i][0]; t[1] = s[1] + v[i][1];
			cout << t[0] << endl << t[1] << endl;
			cin >> b;
			if (b == "T" || b == "end") {
				s[0] = t[0]; s[1] = t[1];
				found = true;
				if (b == "end") ok = true;
				break;
			}
		}
		if (!found) break;
	}
	return 0;
}

Measured memory_bytes: 724
#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 w, h, n; cin >> w >> h >> n;
    vector<int> vc[4];
    vc[0].push_back(0);
    vc[1].push_back(w);
    vc[2].push_back(0);
    vc[3].push_back(h);
    rep(i, n) {
        int x, y, a; cin >> x >> y >> a;
        if(a <= 2) vc[a-1].push_back(x);
        else vc[a-1].push_back(y);
    }
    rep(i, 4) sort(vc[i].begin(), vc[i].end());
    //printf("%d %d\n", vc[1].front()-vc[0].back(), vc[3].front()-vc[2].back());
    cout << max(vc[1].front()-vc[0].back(), 0) * max(vc[3].front()-vc[2].back(), 0);
}

Measured memory_bytes: 256
n,wei = [int(x) for x in input().split()]
w = []
v = []
for _ in range(n):
    a,b = [int(x) for x in input().split()]
    w.append(a)
    v.append(b)
v_x = n*max(v)+1
dp = [[float("inf")]*(v_x) for x in range(n+1)]
dp[0][0] = 0
for i in range(n):
    for j in range(v_x):
        if j < v[i]:
            dp[i+1][j] = dp[i][j]
        else:
            dp[i+1][j] = min(dp[i][j],dp[i][j-v[i]]+w[i])

res = 0
for i in range(v_x):
    if dp[n][i]<=wei:
        res = i
print(res)



Measured memory_bytes: 310424
#include<bits/stdc++.h>
using namespace std;
#define ll  long long
#define scan(n) scanf("%d",&n)
#define ls(n) scanf("%lld",&n)
#define print(n) printf("%d ",n)
#define pln(n) printf("%d\n",n)
#define lpln(n) printf("%lld\n",n)
#define rep(i,a,n) for(int i=a;i<n;i++)
#define rev(i,a,n) for(int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define gcd __gcd
#define tc           ll t1; cin>>t1; while(t1--)
#define inp         ll n; cin>>n; ll arr[n]; rep(i,0,n) cin>>arr[i];
#define vect vector<ll>
#define sortv(v)       sort(v.begin(),v.end())
#define lower(v,n)    lower_bound(v.begin(),v.end(),n)-v.begin()
#define upper(v,n)    upper_bound(v.begin(),v.end(),n)-v.begin()
#define bitcount(n) __builtin_popcount(n)
#define ln <<endl
#define inf          1e12
#define ninf         LONG_MIN
#define fast()         ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
const   ll mod=1e9+7;
const ll N=1e5+5;




int main() 
{ 
         fast();
        
         int n;
         cin >> n;
         if(n>=30)
          cout<<"Yes";
        else cout<<"No";
         

  return 0; 
} 


Measured memory_bytes: 3604
#include<iostream>
using namespace std;
int main(){
	long long int X,A,B;
	long long int ans = 0,n,m;

	cin >> X >> A >>B;
	cin >> n;

	for (int i = 1; i < X; i++) {
		cin >> m;
		if ((m - n)*A < B) {
			ans += (m - n)*A;
		}
		else {
			ans += B;
		}
        n = m;
	}

	cout << ans << endl;

	return 0;
}


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

const ll MAXN = 200000;
const ll INF = 1001001001001;
const ll MOD = 1000000007;

ll N, M, K, ans=0, tmp=0;
vector<ll> QA, QB, A;
//queue<ll> QA, QB;

signed main(){
    cin >> N >> M >> K;
    for(int i=0;i<N;i++) {
        ll a;
        cin >> a;
        QA.push_back(tmp+a);
        tmp += a;
    }
    tmp=0;
    for(int i=0;i<M;i++) {
        ll a;
        cin >> a;
        QB.push_back(tmp+a);
        tmp += a;
    }
    for(int i=0;i<N;i++) {
        if(QA[i]>K) break;
        ll id = upper_bound(QB.begin(), QB.end(),K-QA[i])-QB.begin();
        ans = max(ans,i+id+1);
    }
    for(int i=0;i<M;i++) {
        if(QB[i]>K) break;
        ll id = upper_bound(QA.begin(), QA.end(),K-QB[i])-QA.begin();
        ans = max(ans,i+id+1);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 7908
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <deque>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <cstring>
#include <iomanip>
#include <utility>
 
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n) for(int i=1;i<=(n);i++)
#define lol long long
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
 
using namespace std;
 
int h,w,sx,sy,gx,gy,tx,ty;
char house[505][505];   
bool isvisited[505][505]={false};
 
void search(int x,int y){
    if(isvisited[x][y]){
        return;
    }
    isvisited[x][y]=true;
 
    if(x<=0 || x>h || y<=0 || y>w){
        return;
    }
 
    if(house[x][y]=='#'){
        return;
    }
 
    search(x-1,y-1);
    search(x-1,y);
    search(x-1,y+1);
    search(x,y-1);
    search(x,y);
    search(x,y+1);
    search(x+1,y-1);
    search(x+1,y);
    search(x+1,y+1);
}
 
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    lol k,n,a[200005];
    
    cin>>n>>k;
    rep(i,n){
      cin>>a[i];
    }

    sort(a,a +n,greater<int>());
    lol sum=0;
    for(int i=k;i<n;i++){
      sum+=a[i];
    }

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


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

int main () {
  int n, m;
  cin >> n >> m;
  long long p = m * 1900 + (n - m) * 100;
  for (int i = 0; i < m; i++) {
    p = p * 2;  
  } 
  cout << p << endl;
}

Measured memory_bytes: 256
n = int(input())
A = list(map(int, input().split()))
maxSoFar = 0
for i in range(n-1):
    maxSoFar = max(maxSoFar, A[i])
    #print (A[i])
    if A[i] > A[i+1] and maxSoFar - A[i+1] > 1:
        print ("No")
        exit()
print ("Yes")

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

int main() {
    int N;
    cin>>N;
    bool prime[5000000];
    for(long i=0;i<5000000;++i){
        prime[i] = true;
    }
    prime[0] = false;
    prime[1] = false;
    for(long i=2;i<5000000;++i){
        if(prime[i]==false)continue;
        else {
            long j = 2;
            while(i*j<5000000){
                prime[i*j] = false;
                j++;
            }
        }
    }
    vector<int> ans;
    int now = 0;
    for(int i=0;i<N;++i){

        while(!((prime[now]==true) & (now%5==1))){
            now++;
        }
        ans.push_back(now);
        now++;
    }
    for(int i=0;i<N;++i){
        cout<<ans[i]<<" ";
    }
    cout<<endl;
}


Measured memory_bytes: 5120
#define rep(i,n) for (int i=0;i<(n);i++)
#include<iostream>
#define SIZE 100001
using namespace std;
int ans_s[100][100];

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int w,h,n;
	int x[SIZE],y[SIZE],a[SIZE];
	cin >> w >> h >> n;
	rep(i,n) cin >> x[i] >> y[i] >> a[i];

	rep(i,n){
		if(a[i] == 1){
			for(int k = 0; k<x[i];k++){
				rep(j,h) ans_s[j][k] = 1;
			}
		}
		else if(a[i] == 2){
			for(int k = x[i]; k<w;k++){
				rep(j,h) ans_s[j][k] = 1;
			}
		}
		else if(a[i] == 3){
			for(int k = 0; k<y[i];k++){
				rep(j,w) ans_s[k][j] = 1;
			}
		}
		else if(a[i] == 4){
			for(int k = y[i]; k<h;k++){
				rep(j,w) ans_s[k][j] = 1;
			}
		}
	}
	int count = 0;
		rep(i,h){
			rep(j,w){
				if(ans_s[i][j]== 0) count++;
			}
		}

	cout << count << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

ll a[3];
int main() {
	ll n;
	cin>>n;
	ll ans=1;
	for(ll i=0;i<n;i++){
		ll now;
		cin>>now;
		ll cnt=0;
		bool ch=true;
		for(ll i=0;i<3;i++){
			if(a[i]==now){
				cnt++;
				if(ch){
					ch=false;
					a[i]++;
				}
			}
		}
		ans*=cnt;
		ans%=inf;
	}
	cout <<ans;
	// your code goes here
	return 0;
}

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

dp = [1] * (n + 1)
dp2 = [1] * (n + 1)
dp[0] = 1 - p[0]
dp[1] = p[0]

for i in range(2, n + 1):
    dp2[0] = dp[0] * (1 - p[i - 1])
    dp2[i] = dp[i - 1] * p[i - 1]
    for j in range(1, i):
        dp2[j] = dp[j] * (1 - p[i - 1]) + dp[j - 1] * p[i - 1]
    for k in range(n + 1):
        dp[k] = dp2[k]
print(sum(dp[(n + 1) // 2:]))


Measured memory_bytes: 71892
#include<bits/stdc++.h>
// #include "/Users/Coder_Jay/Desktop/Codeforces/header.h"
 
// Competetive Template:
typedef long long int lli;
typedef unsigned long long int ulli;
typedef long double ldb;
 
#define pb push_back
#define pf push_front
#define popb pop_back
#define popf pop_front
#define ba  back
#define si size()
#define be begin()
#define en end()
#define le length()
#define mp make_pair 
#define mt make_tuple
#define fi first
#define se second
#define gcd __gcd
#define maxe *max_element
#define mine *min_element
 
#define forz(i,n) for(long long int i=0;i<n;i++)
#define rep(i,k,n) for (lli i = k; i <= n; i++)
#define deci(n)  fixed<<setprecision(n)
#define high(n) __builtin_popcount(n)
#define parity(n) __builtin_parity(n)
#define ctz(n)  __builtin_ctz(n)
#define mod 1000000007
#define mod2 998244353
#define kira ios::sync_with_stdio(0), cin.tie(0),cout.tie(0)
#define  START      auto start = chrono::steady_clock::now()
#define END         auto end = chrono::steady_clock::now()

using namespace std;
typedef pair <lli,lli> pll;
 
// CODE BEGINS :

int main()
{
    kira; START;
    
    map <string,lli> mm;
    
    lli n; cin>>n;
    
    vector <string> v;
    while(n--)
    {
        string s; cin>>s;
        v.pb(s);
        lli t; cin>>t;
        mm[s]=t;
    }
    
    lli res=0;
    bool b=false;
    string X; cin>>X;
    
    forz(i,v.si)
    {
        if(b) res+=mm[v[i]];
        
        if(v[i]==X)
        b=true;
    }
    
    cout<<res<<endl;
    
    END;
    return 0;
}




















Measured memory_bytes: 256
# coding: utf-8
import sys
#from operator import itemgetter
sysread = sys.stdin.readline
read = sys.stdin.buffer.read
#from heapq import heappop, heappush
#from collections import defaultdict
sys.setrecursionlimit(10**7)
#import math
#from itertools import product, accumulate, combinations, product
#import bisect# lower_bound etc
import numpy as np
#from copy import deepcopy
#from collections import deque
import numba

def run():
    N = int(input())
    P = np.array((list(map(int, sysread().split()))))
    P -= 1

    @numba.njit("void(i8,i8[:])")
    def proc(N, P):
        ans = 0
        Removed = np.zeros((500, 500), dtype=np.int8)
        Mat = np.zeros((500, 500), dtype=np.int16)
        Dy, Dx = [1, 0, -1, 0], [0, 1, 0, -1]

        for y in range(N):
            for x in range(N):
                Mat[y, x] = min(y, N - 1 - y, x, N - 1 - x)
        # print(Mat)
        for i in range(N * N):
            p = P[i]
            y, x = divmod(p, N)
            ans += Mat[y, x]
            Removed[y, x] = 1
            st = [(y, x)]
            while st:
                vy, vx = st.pop()
                vr = Removed[vy, vx]
                val = Mat[vy, vx]
                # for dy, dx in zip(Dy, Dx):
                for j in range(4):
                    uy, ux = vy + Dy[j], vx + Dx[j]
                    if not (0 <= uy < N and 0 <= ux < N):
                        continue
                    ur = Removed[uy, ux]
                    if vr:
                        if Mat[uy, ux] >= val + 1:
                            Mat[uy, ux] = val
                            st.append((uy, ux))
                    else:
                        if Mat[uy, ux] >= val + 2:
                            Mat[uy, ux] = val + 1
                            st.append((uy, ux))
        # for m in Mat:
        #     print(m)
        print(ans)

    proc(N, P)


if __name__ == "__main__":
    run()

Measured memory_bytes: 120488
#include <iostream>
#include <string> 
#include <vector> 
#include <algorithm> 
#include <utility> 
#include <tuple> 
#include <cstdint> 
#include <cstdio> 
#include <map> 
#include <queue> 
#include <set> 
#include <stack> 
#include <deque> 
#include <unordered_map> 
#include <unordered_set> 
#include <bitset> 
#include <cctype> 
#include<math.h>
using namespace std;

//#define int long long
#define endl "\n"
#define fir first
#define sec second
#define fro front
#define m_p make_pair
#define mod 1000000007
#define all(v)  v.begin(),v.end()
#define rep(i,n)  for(int i=0; i<(int) (n); i++)
#define all(v)  v.begin(),v.end()
#define vecin(v) for(int i=0; i<(int)v.size(); i++)cin>>v[i];
using namespace std;

const int MAX = 510000;
const int MOD = 1000000007;
long long fac[MAX], finv[MAX], inv[MAX];
int jousu(int x00, int y00) {
	int z00 = 1;
	for (int i = 0; i < y00; i++) {
		z00 *= x00;
	}
	return z00;
}
int keta(int x00) {
	int z00 = x00;
	int w00 = 0;
	while (z00 != 0) {
		z00 /= 10;
		w00++;
	}
	return w00;
}

int modinv(int a, int m) {
	int b = m, u = 1, v = 0;
	while (b) {
		int t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
int modpow(int a, int n) {
	int res = 1;
	while (n > 0) {
		if (n & 1) res* a% mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}
int gcd(int xx, int yy) {
	int p = xx;
	int q = yy;
	if (q > p)swap(p, q);
	while (p % q != 0) {
		p %= q;
		swap(p, q);
	}
	return q;
}
int lcm(int xx, int yy) {
	return xx * yy / gcd(xx, yy);
}
bool prime(int xx) {
	int a = xx;
	for (int i = 2; i * i <= xx; i++) {
		if (xx % i == 0) {
			return 0;
		}
	}
	return 1;
}
int com(int xx, int yy) {
	int zz = 1;
	for (int i = xx; i > xx - yy; i--) {
		zz *= i;
		zz %= mod;
	}
	for (int i = 1; i <= yy; i++) {
		zz *= modinv(i, mod);
		zz %= mod;
	}
	return zz;
}



int main() {
	int l;
	double d, ans;
	cin >> l;
	d = l / 3.0;
	ans = d * d * d;
	printf("%.10lf", ans);
}


Measured memory_bytes: 256
import java.util.*;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int m = scan.nextInt();

        String ret = n == m ? "Yes" : "No";

        System.out.println(ret);
    }
}


Measured memory_bytes: 21972
#include <bits/stdc++.h>
#include <map>
#include <cmath>
typedef long long int ll;
using namespace std; 
int main(){
	ios_base::sync_with_stdio(false);  
	cin.tie(NULL);
	int h,w,n;cin>>h>>w>>n;
	int ans = n/max(h,w);
	if(ans*max(h,w)<n){
		ans++;
	}
	cout<<ans<<endl;
}


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

int main(){
    
    int n,k;
    string s;
    cin>>n>>k>>s;
    
    vector<int> line1 = {0};
    vector<int> line0;
    
    if(s[0]=='1'){
        line1[line1.size()-1]++;
    }else{
        line0.push_back(1);
    }
    
    for(int i=1; i<n; i++){
        if(s[i]=='1'&&s[i-1]=='1'){
            line1[line1.size()-1]++;
        }else if(s[i]=='1'&&s[i-1]=='0'){
            line1.push_back(1);
        }else if(s[i]=='0'&&s[i-1]=='1'){
            line0.push_back(1);
        }else if(s[i]=='0'&&s[i-1]=='0'){
            line0[line0.size()-1]++;
        }
    }
    if(line1.size()==line0.size())
        line1.push_back(0);
    /*
    for(int i : line1){
        cout << i<< endl;
    }
    for(int i : line0){
        cout << i<< endl;
    }
    */
    
    int kmax = line0.size();//line1.size() - 1;
    if(k>=kmax){
        cout << (int)s.size() << endl;
        return 0;
    }
    
    int now = line1[0];
    
    for(int i=0; i<k; i++){
        now += line1[i+1] + line0[i];
    }
    int ans = now;
    int j = k;
    
    while(j<kmax){
        now -= line1[j-k] + line0[j-k];
        now += line1[j+1] + line0[j];
        j++;
        ans = max(ans, now);
    }
    
    cout << ans << endl;
}

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

using namespace std;

int cnt;

int main()
{
    int n,m;
    scanf("%d%d",&n,&m);
    for(int i=1;i<=n+m;i++)
    {
        for(int j=i+1;j<=n+m;j++)
        {
//            cout<<i<<" "<<j<<endl;
            int x=(i<=n ? 2 : 1);
            int y=(j<=n ? 2 : 1);
            if((x+y)%2==0) cnt++;
        }
    }
    printf("%d",cnt);
    return 0;
}

Measured memory_bytes: 256
n = int(input())
jpy = 0
btc = 0.0
for _ in range(n):
    money = list(input().split())
    if money[1] == 'JPY':
        jpy += int(money[0])
    else:
        btc += float(money[0])

print(jpy + (btc/1.0)*380000.0)

Measured memory_bytes: 2940
import static java.util.Arrays.deepToString;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		new Main().run();
	}
	void tr(Object... os) {
		System.err.println(deepToString(os));
	}

	Scanner sc = new Scanner(System.in);
	public void run() {
		int t = sc.nextInt();
		for (int ttt = 0; ttt < t; ttt++) {
			int from = sc.nextInt();
			int to = sc.nextInt();
			int[] a = solve(from, to);
			System.out.print(a[0]);
			for (int i = 1; i < a.length; i++) System.out.print(" " + a[i]);
			System.out.println();
		}
	}
	
	int[] solve(int from, int to) {
		int[] st = {
				0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 5, 4, 3, 2, 1,
				0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 5, 4, 3, 2, 1,};

		ArrayList<Integer> ans = null;
		for (int i = 0; i < st.length / 2; i++) {
			if (st[i] == from) {
				ArrayList<Integer> cur = new ArrayList<Integer>();
				int x = i;
				while (st[x] != to) {
					cur.add(st[x]);
					x++;
				}
				cur.add(to);
				if (ans == null || ans.size() > cur.size()) {
					ans = cur;
				}
			}
		}
		return toIntArray(ans);
	}
	public static <T> int[] toIntArray(Collection<T> src) {
		int[] res = new int[src.size()];
		int p = 0;
		for (T x : src) res[p++] = (Integer)x;
		return res;
	}
}

Measured memory_bytes: 17196
from itertools import groupby, accumulate, product, permutations, combinations
from bisect import *
def solve():
  ans = float('inf')
  N = int(input())
  A = list(map(int, input().split()))
  cum = list(accumulate(A))
  for i in range(1,N-2):
    mae = cum[i]
    usiro = cum[-1]-cum[i]
    ind = bisect_right(cum,mae/2)
    mae_max = min(cum[ind],mae-cum[ind-1])
    if ind==0:
      mae_max = cum[ind]
    mae_min = mae - mae_max
    ind2 = bisect_right(cum,usiro/2+cum[i])
    usiro_max = min(cum[ind2]-cum[i],cum[-1]-cum[ind2-1])
    if ind2==i+1:
      usiro_max = cum[ind2]-cum[i]
    usiro_min = usiro - usiro_max
    lis = [mae_max,mae_min,usiro_max,usiro_min]
    ans = min(ans,max(lis)-min(lis))
  return ans
print(solve())

Measured memory_bytes: 102792
from math import fabs
x, y = map(int, input().split())
if x*y > 0:
	if y >= x:
		print(y-x)
	else:
		print(x-y+2)
elif x*y == 0:
	if x <= y:
		print(y-x)
	else:
		print(int(fabs(fabs(x)-fabs(y))+1))
else:
	print(int(fabs(fabs(x)-fabs(y))+1))


Measured memory_bytes: 3064
import sys
import math


def input():
    return sys.stdin.readline().rstrip()


def main():
    N=int(input())

    #i A
    #j B
    #k? C
    ans =0
    for i in range(1,N):
        ans += (N-1)//i

    print(ans)








if __name__ == "__main__":
    main()

# \n


Measured memory_bytes: 62864
# frozen_string_literal: true

n, m = gets.split.map(&:to_i)
ab = m.times.map { gets.split.map(&:to_i) }

h = Array.new(n) { [] }
c = Array.new(n) { -1 }
d = Array.new(n) { 10**12 }
d[0] = 0

ab.each do |e|
  a = e[0] - 1
  b = e[1] - 1
  h[a].push b if b.positive?
  h[b].push a if a.positive?
end

q = [0]

loop do
  break if q.empty?

  dd = q.shift
  h[dd].each do |e|
    if d[e] - 1 > d[dd]
      c[e] = dd + 1
      d[e] = d[dd] + 1
      q.push e
    end
  end
end

if c[1..-1].all? { |e| e.positive? }
  puts 'Yes'
  puts c[1..-1]
else
  puts 'No'
end


Measured memory_bytes: 55728
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int l = sc.nextInt();
		
		
		int max = l + n - 1;
		int sum = (l + max) * n / 2;
		
		if (max < 0) sum -= max;
		if (l > 0) sum -= l;
		
		System.out.println(sum);
		
		sc.close();
	}
	
}




Measured memory_bytes: 26972
n,m = map(int, input().split())
adj = [[] for i in range(n)]
for _ in range(m):
    u,v = map(int, input().split())
    u -= 1
    v -= 1
    adj[u].append(v)
    adj[v].append(u)

q = [0]
vis = [False]*n
sign = [0]*n
vis[0] = True
while(q):
    s = q.pop(0)
    for i in adj[s]:
        if (not vis[i]):
            vis[i] = True
            sign[i] = s+1
            q.append(i)
if (not all(vis)):
    print('No')
else:
    print('Yes')
    for i in range(1,n):
        print(sign[i])

Measured memory_bytes: 37384
#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() {
    ll X, Y, Z;
    cin >> X >> Y >> Z;
    cout << Z << " " << X << " " << Y << endl;
}



Measured memory_bytes: 3568
package main

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

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 500001), 500000)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}

func getNextUint64(scanner *bufio.Scanner) uint64 {
	i, _ := strconv.ParseUint(getNextString(scanner), 10, 64)
	return i
}

func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}

func main() {
	fp := os.Stdin
	wfp := os.Stdout

	if len(os.Args) > 1 {
		fp, _ = os.Open(os.Args[1])
		if len(os.Args) > 2 {
			wfp, _ = os.Create(os.Args[2])
		}
	}

	scanner := getScanner(fp)
	writer := bufio.NewWriter(wfp)

	s := getNextString(scanner)
	n := len(s)
	counter := make([]int64, 26)

	for i := 0; i < n; i++ {
		counter[s[i]-'a']++
	}

	ans := int64(1)

	for i := 0; i < 26; i++ {
		for j := i + 1; j < 26; j++ {
			ans += counter[i] * counter[j]
		}
	}

	fmt.Fprintln(writer, ans)
	writer.Flush()
}


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

int main() {

    string s; cin >> s;

    if(s[2] == s[3] && s[4] == s[5]){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    
    return 0;        
}

Measured memory_bytes: 3596
#include <stdio.h>		// standard input output
#include <iostream>		// input output stream, cin cout( console in console out)
#include <cmath>		// circle math ( sin, con, sinh
#include <string>
#include <vector>
#include <algorithm>
#include <iomanip>		// input output manipulation​
using namespace std;
#define rep(i, n) for(int i = 1; i <= (int)n; i++)
#define ll long long

int main(){
  int N,M,ans;
  cin >> N >> M;
  int h[N],m[N];
  rep(i,N){
    cin >> h[i];
    m[i]=0;
  }
  rep(i,M){
    int A,B;
    cin >> A >> B;
    m[A]=max(m[A],h[B]);
    m[B]=max(m[B],h[A]);
  }

  rep(i,N){
    if(h[i]>m[i])
      ans++;
  }
  cout << ans << endl;
}


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

using namespace std;

#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {REP(WW,n)cerr << v[WW] << ' ';cerr << endl << endl;}
#define SHOW2d(v,WW,HH) {REP(W_,WW){REP(H_,HH)cerr << v[W_][H_] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 1000000007

typedef long long ll;
typedef pair<ll,ll> P;
int n;
bool used[5555];
vector<int> A;
vector<int> B;
vector<int> ans;
vector<pair<int,int>> AA;
int win;

int win_num(){
	auto a = A;
	auto b = B;
	sort(ALL(a));
	sort(ALL(b));
	int ret = 0;
	int tmp = 0;
	REP(i,n){
		if(tmp == n)break;
		if(a[tmp] < b[i]){
			ret++;
			tmp++;
		}
	}
	
	return ret;
}

bool check(vector<int> b, int pla,int mid){
	int ret = 0;
	int tmp = 0;
	REP(i,b.size()){
		if(i == mid)continue;
		if(tmp == AA.size())continue;
		while(tmp < AA.size() && AA[tmp].SE <= pla)tmp++;
		if(AA[tmp].FI < b[i]){
			tmp++;
			ret++;
		}
	}
	if(ret == win){
		return true;
	}
	else {
		if(ret + (b[mid] > A[pla]) == win){
			return true;
		}
		else if(ret + (b[b.size() - 1] > A[pla]) == win){
			return true;
		}
		else {
			return false;
		}
	}
}

int main(){
	
	cin >> n;
	REP(i,n){
		int tmp;cin >> tmp;
		A.PB(tmp);
		AA.PB(MP(tmp,i));
	}
	REP(i,n){
		int tmp;cin >> tmp;
		B.PB(tmp);
	}
	
	sort(ALL(AA));
	sort(ALL(B));
	
	win = win_num();
	
	REP(i,n){
		int l = 0;
		int r = B.size() - 1;
		while(r - l > 1){
			int mid = (l + r) / 2;
			if(check(B, i, mid))l = mid;
			else r = mid;
		}
		if(check(B, i, r)){
			ans.PB(B[r]);
			win -= A[i] < B[r];
			B.erase(B.begin() + r);
		}
		else{
			ans.PB(B[l]);
			win -= A[i] < B[l];
			B.erase(B.begin() + l);
		}
	}
	
	REP(i,n){
		cout << ans[i];
		if(i != n - 1)cout << " ";
	}
	cout << endl;
	
	return 0;
}



Measured memory_bytes: 3292
#include<bits/stdc++.h>
using namespace std;
 
#define ll long long
#define INF 99999999
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
 
int main()
{
    ll a,b;
    cin >> a >> b;
    
    int tmp = 0;
    for(int i = 1;i < b-a;i++)
    {
        tmp += i;
    }
    cout << tmp - a << endl;
}


Measured memory_bytes: 256
#include <string>
#include <vector>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<stack>
#include<queue>
#include<cmath>
#include<algorithm>
#include<functional>
#include<list>
#include<deque>
#include<bitset>
#include<set>
#include<map>
#include<cstring>
#include<sstream>
#include<complex>
#include<iomanip>
#include<numeric>
#define X first
#define Y second
#define pb push_back
#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define rrep(X,Y) for (int (X) = (Y-1);(X) >=0;--(X))
#define repe(X,Y) for ((X) = 0;(X) < (Y);++(X))
#define peat(X,Y) for (;(X) < (Y);++(X))
#define all(X) (X).begin(),(X).end()
#define rall(X) (X).rbegin(),(X).rend()

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
template<class T> ostream& operator<<(ostream &os, const vector<T> &t) {
os<<"{"; rep(i,t.size()) {os<<t[i]<<",";} os<<"}"<<endl; return os;}
template<class S, class T> ostream& operator<<(ostream &os, const pair<S,T> &t) { return os<<"("<<t.first<<","<<t.second<<")";}

int main(){
  ios_base::sync_with_stdio(false);
  cout<<fixed<<setprecision(10);
  int i,j,k;
  int n;
  ll m,gcd,lcm;
  cin>>n>>m;
  vector<ll> a(n);
  vector<double> p(n);
  rep(i,n)
    cin>>a[i];
  rep(i,n){
    cin>>p[i];
    p[i]/=100;
  }//cout<<p;
  double pro,cnt,re=0;
  rep(i,1<<n)if(i){
    pro=1,cnt=m;lcm=1;
    rep(j,n){
      if(i>>j&1){
	pro*=-p[j];
	gcd=__gcd(lcm,a[j]);
	cnt/=a[j]/gcd;
	if(cnt<1)
	  break;
	lcm*=a[j]/gcd;
      }
    }
    //   cout<<pro<<","<<cnt<<endl;
    re+=pro*floor(cnt);
  }
  cout<<-re<<endl;
  return 0;
}

Measured memory_bytes: 1308
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
#define pp pair<ll,ll>
#define all(v) (v).begin(),(v).end()
#define sz(v) (ll)(v).size()
#define F first 
#define S second 
#define lc "\n"
ll power(ll x,ll y,ll p){ll res=1;x=x%p;while(y>0){if(y&1)res=(res*x)%p;y=y>>1;x=(x*x)%p;}return res;}
ll ncr(ll n,ll k){if(k==0)return 1;if(k>n-k)k=n-k;ll a=1,b=1,d;while(k){a*=n;b*=k;d=__gcd(a,b);a/=d;b/=d;n--;k--;}return a;} 
ll MAX=1e18 , MIN=-1e18 , MOD=1000000007;
void YJ()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
#endif
}
int main() 
{
    YJ(); fastio
    int n,x,t,r; cin>>n>>x>>t;
    r=n/x+(n%x!=0);
    cout<<r*t;
    return 0;
}

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

using namespace std;

typedef            long long int          ll;

ll func(ll n)
{
    ll limit = sqrt(n+1), ans = 1;

    map <ll, ll> mp;

    for(int i = 2; i <= limit; i++)
    {
        if((n%i)==0)
        {
            ans *= (i-1);
            while((n%i)==0)
            {
                ans *= i;
                n /= i;
            }
            ans /= i;
        }
    }

    if(n!=1) ans *= (n-1ll);

    return ans;
}

int main()
{
    ll n;

    cin >> n;

    cout << func(n) << endl;

    return 0;
}



Measured memory_bytes: 3112
#include <bits/stdc++.h>
#ifdef __DEBUG__
    #define DBG(X) cout << #X << " = " << (X) << endl;
    #define SAY(X) cout << (X) << endl;
#else
    #define DBG(X)
    #define SAY(X)
#endif

using namespace std;

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

int dx[]={1, 0, -1, 0, 1,-1, 1,-1};
int dy[]={0, 1, 0, -1, 1, 1,-1,-1};
const int INT_INF = (int)(2e9);
const ll  LL_INF = (ll)(2e18);

inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const map<T, S> p) { for (auto el : p) cout << "[" << el.first << ";" << el.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const deque<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const set<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }

int N;
string S;
void input(){
    fast_io();
    cin >> N;
    cin >> S;
}
const ll mod = 1e9+7;
int solve(){
    map<char,int> cnt;
    for (int i = 0; i < N; i++)
    {
        cnt[S[i]]++;
    }
    ll ans = 1;
    for(char c='a';c<='z';c++){
        ans *= (1+cnt[c]);
        ans %= mod;
    }
    ans = (ans+mod-1)%mod;
    cout << ans << endl;
    
    return 0;
}   

int main()
{
    input();
    solve();
    return 0;
}

Measured memory_bytes: 512