akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define rg register
#define oo 0x7fffffff
#define ll long long
#define GG {puts("No"); return 0;}
using namespace std;
inline int read()
{
	int out=0,fh=1;
	char jp=getchar();
	while ((jp>'9'||jp<'0')&&jp!='-')
		jp=getchar();
	if (jp=='-')
		{
			fh=-1;
			jp=getchar();
		}
	while (jp>='0'&&jp<='9')
		{
			out=out*10+jp-'0';
			jp=getchar();
		}
	return out*fh;
}
const int N=300010;
int n;
int a[N],b[N];
inline bool Check(int l,int r)
{
	int lbd=0,rbd=0;
	for(int i=l; i<=r; i++)
		{
			if(b[i]<i)
				{
					if(lbd>b[i] || (b[i]<l || b[i]>r)) return false;
					lbd=b[i];
				}
			else if(b[i]>i)
				{
					if(rbd>b[i] || (b[i]<l || b[i]>r)) return false;
					rbd=b[i];
				}
		}
	return true;
}
int main()
{
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	n=read();
	for(int i=1; i<=n; i++)
		b[i]=read(),a[i]=(b[i]==i);
	for(int i=2; i<n; i++) if(!a[i-1] && !a[i] && !a[i+1]) GG
			for(int i=1; i<=n; i++)
				{
					if(a[i]==0)
						{
							int now=1;
							int l=i,r=i;
							while((a[r]^now) && r<=n) ++r,now^=1;
							--r;
							if(!Check(l,r)) GG
								i=r;
						}
				}
	puts("Yes");
	return 0;
}


Measured memory_bytes: 2688
#include<bits/stdc++.h>
using namespace std ;
#define ll long long 
#define pb push_back
#define in(x) int x; cin>>x;
#define ln(x) long long x; cin>>x;
#define memf(a) memset(a,false,sizeof(a))
#define F first
#define S second
#define endl "\n"
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
ll power(ll b,ll e,ll m)
{
	if(e==0) return 1;
	if(e&1) return b*power(b*b%m,e/2,m)%m;
	return power(b*b%m,e/2,m);
}
ll power( ll b, ll e)
{
	if(e==0) return 1;
	if(e&1) return b*power(b*b,e/2);
	return power(b*b,e/2);
}
int main()
{
	fast
	int x;
	cin>>x;
	if(x==0)
		cout<<"1";
	else cout<<"0";
	return 0;
}

Measured memory_bytes: 3688
N = int(input())
A = list(map(int,input().split()))
if min(A) >= 0:
  Flag = True
elif max(A) <= 0:
  Flag = False
else:
  p_max = max(A)
  m_max = min(A)
  if abs(p_max) >= abs(m_max):
    Flag = True
  else:
    Flag = False
if Flag:
  MAX = max(A)
  for i,v in enumerate(A):
    if v == MAX:
      MAX_loc = i
      break
  ans = []; t = 0
  for i in range(N-1):
    if A[i+1] >= A[i]:
      continue
    A[i+1] += 2*MAX
    ans.append([MAX_loc+1,i+1+1])
    ans.append([MAX_loc+1,i+1+1])
    t += 2
    MAX_loc = i+1
    MAX = A[i+1]

else:
  MIN = min(A)
  for i, v in enumerate(A):
    if v == MIN:
      MIN_loc = i
      break
  ans = []; t = 0
  for i in range(N-1):
    if A[N-1-i] >= A[N-2-i]:
      continue
    A[N-2-i] += 2*MIN
    ans.append([MIN_loc+1,N-2-i+1])
    ans.append([MIN_loc+1,N-2-i+1])
    t += 2
    MIN_loc = N-2-i
    MIN = A[N-2-i]
print(t)
for x in ans:
  print(*x)
#print(ans,t,A)    

Measured memory_bytes: 62444
from itertools import combinations

n = int(input())
s = [input() for _ in range(n)]

d = dict()
for name in s:
    if name[0] not in d:
        d[name[0]] = 1
    else:
        d[name[0]] += 1

res = 0
for v in combinations(['M', 'A', 'R', 'C', 'H'], 3):
    if v[0] in d and v[1] in d and v[2] in d:
        res += d[v[0]] * d[v[1]] * d[v[2]]

print(res)

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

using namespace std;

bool isEven(string s){
	if(s.size()%2==1) return false;
	else{
		
		for(int i = 0; i<(int)s.size()/2;i++){
			if(s[i]!=s[i+s.size()/2]) return false;
			
			}
			return true;
		}
	}

int main(){
	string s;
	cin>>s;
	int len = 0;
	
	for(int i = 1; i<(int)s.size(); i++){
		string d = string(s.begin(),s.end()-i);
		if(isEven(d)){
			len = s.size()-i;
			break;
			}
		}
	cout<<len<<endl;
	
	
	return 0;
	
	
	}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
ull B = 100000007;
ll mod = 1000000007;
int INF = 0x3f3f3f3f;

int main() {
    int n;
    cin >> n;
    vector<int> aa(3);
    cin >> aa[0] >> aa[1] >> aa[2];
    vector<string> str(n + 1);
    for(int i = 1; i <= n; ++i) {
        cin >> str[i];
    }

    string way = "";
    for(int i = 1; i <= n; ++i) {
        int id1 = str[i][0] - 'A';
        int id2 = str[i][1] - 'A';
        if(aa[id1] == 0 && aa[id2] == 0) {
            cout << "No" << endl;
            return 0;
        }
        else if(aa[id1] > aa[id2]) {
            aa[id1]--;
            aa[id2]++;
            way += id2 + 'A';
        }
        else if(aa[id1] < aa[id2]) {
            aa[id1]++;
            aa[id2]--;
            way += id1 + 'A';
        }
        else {
            if(aa[id1] == aa[id2] && aa[id1] == 1 && aa[3 - id1 - id2] == 0 && i != n) {
                string nxt = str[i + 1];
                int check = 3 - id1 - id2;
                int n1 = nxt[0] - 'A';
                int n2 = nxt[1] - 'A';
                if(n1 == check) {
                    if(n2 == id1) {
                        aa[id1]++;
                        aa[id2]--;
                        way += id1 + 'A';
                        continue;
                    } else if(n2 == id2) {
                        aa[id1]--;
                        aa[id2]++;
                        way += id2 + 'A';
                        continue;
                    }
                }
                else if(n2 == check) {
                    if(n1 == id1) {
                        aa[id1]++;
                        aa[id2]--;
                        way += id1 + 'A';
                        continue;
                    } else if(n1 == id2) {
                        aa[id1]--;
                        aa[id2]++;
                        way += id2 + 'A';
                        continue;
                    }
                }
            }
            aa[id1]++;
            aa[id2]--;
            way += id1 + 'A';
        }
    }

    cout << "Yes" << endl;
    for(auto v : way) {
        cout << v << endl;
    }
    return 0;
}



Measured memory_bytes: 6692
#include<stdio.h>
int main(void){
int n,k;
  scanf("%d%d",&n,&k);
  int a[n+1],count=0;
  for(int i=0;i<n;i++){
	scanf("%d",&a[i]);
    if(a[i]>=k)count++;
  }
  printf("%d",count);
  return 0;
}

Measured memory_bytes: 512
#include <cstdio>
#include <algorithm>
#include <map>
using namespace std;
int main(void){
  int n;
  scanf("%d",&n);
  pair<int,int> best = make_pair(0,-100);
  for(int i = 0; i < n; i++){
    pair<int,int> p;
    scanf("%d %d",&p.second,&p.first);
    p.second *= -1;
    if(p > best) best = p;
  }
  printf("%d %d\n",-best.second,best.first);
}

Measured memory_bytes: 1028
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define show(x)  cerr << #x << " = " << (x) << endl;
using namespace std;

template <typename X, typename T>
auto vectors(X x, T a) {
	return vector<T>(x, a);
}

template <typename X, typename Y, typename Z, typename... Zs>
auto vectors(X x, Y y, Z z, Zs... zs) {
	auto cont = vectors(y, z, zs...);
	return vector<decltype(cont)>(x, cont);
}

template<typename T>
ostream& operator << (ostream& os, vector<T>& v){
	rep(i,v.size()){ os << v[i] << (i == v.size() - 1 ? "" : " "); } return os;
}
template<typename T>
istream& operator >> (istream& is, vector<T>& v){
	for(T& x: v){ is >> x; } return is;
}

const long long M = 1000000007;

class Combination{
public:
	vector<long long> fact, rev;
	Combination(int n = 200005) : fact(n), rev(n) { // n = h + w
		fact[0] = fact[1] = 1;
		range(i,2,n){
			(fact[i] = fact[i - 1] * i) %= M;
		}
		rev[n - 1] = power(fact[n - 1], M - 2) % M;
		for (int i = n - 1; i > 0; i--) {
			rev[i - 1] = rev[i] * i % M;
		}
	}
	long long power(long long x, long long n){ //べき乗 x^n mod M
		long long res = 1;
		if(n > 0){
			res = power(x, n / 2);
			if(n % 2 == 0) res = (res * res) % M;
			else res = (((res * res) % M) * x ) % M;
		}
		return res;
	}
	long long factorial(long long l, long long r){ return fact[r] * rev[l - 1] % M; }
	long long factorial(long long n){ return fact[n]; }
	long long combination(long long n, long long r){ //nCr (1,1)から(w,h)だと、引数は(w - 1, h - 1, M)
		return factorial(n - r + 1, n) * rev[r] % M;
	}
};

map<int, int> primeFactor(int n){
	map<int, int> res;
	for(int i = 2; i * i <= n; i++){
		while(n % i == 0){
			++res[i];
			n /= i;
		}
	}
	if(n != 1) res[n] = 1;
	return res;
}

int main(){
	long long n, m;
	cin >> n >> m;

	long long ans = 1;
	Combination com;
	for(auto p : primeFactor(m)){
		(ans *= com.combination(n + p.second - 1, n - 1)) %= M;
	}
	cout << ans << endl;
}


Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define PI 3.141592653589793
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rrep(i, n, k) for (int i = (n); i >= (k); i--);
#define all(x) (x).begin(), (x).end()
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
template<class T>vector<T> make_vector(size_t a){return vector<T>(a);}
template<class T, class... Ts>auto make_vector(size_t a, Ts... ts){return vector<decltype(make_vector<T>(ts...))>(a, make_vector<T>(ts...));}
const int inf = 2e17;
const int mod = 1e9 + 7;

signed main() {
    int N, M, L;
    cin >> N >> M >> L;
    vector<vector<int>> G(N + 5, vector<int>(N + 5, inf));
    for (int i = 0; i <= N; i++) G[i][i] = 0;
    for (int i = 0; i < M; i++) {
        int A, B, C;
        cin >> A >> B >> C;
        G[A][B] = C;
        G[B][A] = C;
    }

    for (int i = 1; i <= N; i++) for (int j = 1; j <= N; j++) for (int k = 1; k <= N; k++)
        G[j][k] = min(G[j][k], G[j][i] + G[i][k]);

    vector<vector<int>> ans(N + 5, vector<int>(N + 5, inf));
    for (int i = 1; i <= N; i++) for (int j = 1; j <= N; j++) {
        if (G[i][j] <= L) {
            ans[i][j] = 1;
            ans[j][i] = 1;
        }
    }
    for (int i = 0; i <= N; i++) ans[i][i] = 0;

    for (int i = 1; i <= N; i++) for (int j = 1; j <= N; j++) for (int k = 1; k <= N; k++)
        ans[j][k] = min(ans[j][k], ans[j][i] + ans[i][k]);

    int Q;
    cin >> Q;
    for (int i = 0; i < Q; i++) {
        int s, t;
        cin >> s >> t;
        cout << (ans[s][t] == inf ? -1 : ans[s][t] - 1) << endl;
    }
}


Measured memory_bytes: 2048
<?php

fscanf(STDIN, "%d %d", $a, $b);

$count = 0;
for ($i = 1; $i <= 2; $i++) {
    if ($a >= $b) {
        $count+=$a;
        $a--;
    } else {
        $count+=$b;
        $b--;
    }
}

echo $count;

?>

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

#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = (n)-1; i >= 0; i--)
#define rep1(i,n) for(int i = 1; i <= (n); i++)
#define rrep1(i,n) for(int i = (n); i > 0; i--)

#define ll long long
#define pi pair<int, int>
#define pll pair<ll, ll>

#define MOD 1000000007
#define INF 1000000000000000LL

using namespace std;

int main(){
  int x,y,z;cin>>x>>y>>z;
  cout<<z<<' '<<x<<' '<<y;
  return 0;
}

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

#define ll long long
#define ld long double
#define xx first
#define yy second
#define vi vector<int>
#define pii pair<int,int>
#define all(v) v.begin(),v.end()

#define MAX 400005

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

    ll n;
    cin >> n;

    ll what = n/1000;

    if(n%1000) what++;

    cout << what*1000 -n << endl;

    return 0;
}

Measured memory_bytes: 3652
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
#include <iomanip>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define pie 3.141592653589793238462643383279
#define mod 1000000007
#define INF 10000000000000007
#define ggr getchar(); getchar();return 0;
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}
bool prime(int x) {
	for (int i = 2; i <= sqrt(x); i++) {
		if (x%i == 0)return false;
	}
	return true;
}

long long n, a[314514], ta;

signed main() {
	cin >> n;
	rep(i, 3 * n)cin >> a[i];
	sort(a, a + 3 * n);
	reverse(a, a + 3 * n);
	rep(i, n) {
		ta += a[(i + 1) * 2 - 1];
	}
	cout << ta << endl;
	ggr
}

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

int64_t Lucus(int N);
bool exist(int N);

vector<int64_t> L{2,1};

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

    cout << Lucus(N) << endl;

    return 0;
}

//コメントアウトしているところは愚直な実装(ただの再帰)．
int64_t Lucus(int N){
    if(N == 0){
        //return 2;
        return L[0];
    }
    else if(N == 1){
        //return 1;
        return L[1];
    }
    else{
        //return Lucus(N-2) + Lucus(N-1);
        if(!exist(N-2)){
            L.push_back(Lucus(N-2));
        }
        if(!exist(N-1)){
            L.push_back(Lucus(N-1));
        }
        return L[N-2] + L[N-1];
    }
}

bool exist(int N){
    return (L.size() >= N+1);
}

Measured memory_bytes: 3588
import java.util.Scanner;

public class Main {

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


Measured memory_bytes: 26288
#define _CRT_SECURE_NO_WARNINGS
#pragma comment(linker, "/stack:512000000")
#include<utility>
#include<iostream>
#include<fstream>
#include<vector>
#include<array>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<ctime>
#include<functional>
#include<random>
#include<climits>
#include<queue>
#include<stack>
#include<deque>
#include<bitset>
#include<map>
#include<set>
#include<unordered_map>
#include<unordered_set>
#include<cassert>
#include<ccomplex>

#ifdef ONLINE_JUDGE
#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,tune=native")
#pragma GCC optimize("unroll-loops")
#define int128 __int128
#else
#define int128 long long
#endif

#define all(x) x.begin(), x.end()
#define mp make_pair
#define X first
#define Y second

using namespace std;

using ll = long long;
using ull = unsigned long long;
using ld = long double;
mt19937_64 gen(time(nullptr));

ll const mod = 1e9 + 7;

namespace {
	ll mul(ll a, ll b) {
		ll val = a * b - (ll)((ld)a * b / mod) * mod;
		if (val < 0) val += mod;
		if (val >= mod) val -= mod;
		return val;
	}

	ll poww(ll a, ll b) {
		ll val = 1;
		a %= mod;
		while (b > 0) {
			if (b % 2) val = mul(a, val);
			a = mul(a, a);
			b >>= 1;
		}
		return val % mod;
	}

	ll inv(ll a) {
		return poww(a, mod - 2);
	}
}

int const maxn = 3e5 + 5;

signed main() {
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	ll k, n; cin >> k >> n;
	vector<ll>a(n);
	for (ll i = 0; i < n; i++) {
		cin >> a[i];
	}

	ll mx = 0;
	for (ll i = 0; i < n - 1; i++) {
		mx = max(mx, a[i + 1] - a[i]);
	}

	cout << min(a[n-1] - a[0], k - mx) << endl;
	return 0;
}

/*
8 6

4 5 1 2 3 5 3 3

*/

Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <map>


using namespace std;


int main()
{
    string w;
    cin >> w;
    
    int len = w.length();
    map<char, int> ans;
    for( int i = 0; i < len; ++i ){
        char tmp = w.c_str()[i];
        if( ans.find(tmp) == ans.end() ) ans[tmp] = 1;
        else ++ans[tmp];
    }
    
    
    for( auto itr = ans.begin(); itr != ans.end(); ++itr ){
        if( itr->second % 2 ){
            cout << "No" << endl;
            return 0;
        }
    }
    
    cout << "Yes" << endl;
    
    
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cctype>
#include <complex>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
template<class T> inline T sqr(T x) {return x*x;}

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;

#define all(a)  (a).begin(),(a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define pb push_back
#define mp make_pair
#define each(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define exist(s,e) ((s).find(e)!=(s).end())
#define range(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  range(i,0,n)
#define clr(a,b) memset((a), (b) ,sizeof(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

#define X first
#define Y second

const double eps = 1e-10;
const double pi  = acos(-1.0);
const ll INF =1LL << 62;
const int inf =1 << 29;

const int N = 200;
const int D = 100;

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

int main(void){
    for(int t, n, res; cin >> t >> n, t; cout << res << endl){
        res = 0;

        vector< vector<bool> > trap(N, vector<bool>(N, false));
        rep(i, n){
            int x, y; cin >> x >> y;
            trap[y + D][x + D] = true;
        }

        pii s; cin >> s.X >> s.Y;

        queue< pair<pii, int> > q;
        q.push(mp(mp(s.X + D, s.Y + D), 0));

        while(!q.empty()){
            pii p = q.front().first;
            int turn = q.front().second;
            q.pop();

            if(turn == t + 1) continue;
            if(trap[p.Y][p.X]) continue;

            res++;
            trap[p.Y][p.X] = true;

            rep(i, 6){
                q.push(mp(mp(p.X + dx[i], p.Y + dy[i]), turn + 1));
            }
        }
    }

	return 0;
}

Measured memory_bytes: 1248
#include <bits/stdc++.h>
using namespace std;
int A[100010];
int S[100010];
int main() {
	int s = 0;
	S[1] = 0;
	for(int i = 2; i < 100001; i++) {
		S[i] = S[i - 1];
		for(int i2 = i * 2; i2 < 100001; i2 += i) {
			A[i2] += 1;
		}
		if (A[i] >= 3) S[i] ++;
	}
	
	int N;
	cin >> N;
	for(int n = 0; n < N; n++) {
		int i;
		cin >> i;
		cout << S[i] << endl;
	}
}


Measured memory_bytes: 3880
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<double,int> pdi;
typedef pair<double,double> pdd;
typedef pair<double,ll> pdl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef vector<vl> vvl;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<pdd> vdd;
typedef vector<pdi> vdi;
typedef vector<pdl> vdl;
#define fi first
#define se second
const ll INFLL=LLONG_MAX;
const int INF=INT_MAX;
const ll MAXLL=0x3f3f3f3f3f3f3f3f;
const int MAX=0x3f3f3f3f;
#define eb emplace_back
#define emp emplace
#define mp(a,b) make_pair(a,b)
template<class T> using min_heap=priority_queue<T,vector<T>,greater<T> >;
template<class T>
void sort(vector<T>& v){
	sort(v.begin(),v.end());
}
template <class T, class U>
void sort(vector<T>& v,U func){
	sort(v.begin(),v.end(),func);
}
template<class T>
void rsort(vector<T>& v){
	sort(v.rbegin(),v.rend());
}
template <class T>
int lb_index(vector<T>& v,T k){
	return lower_bound(v.begin(),v.end(),k)-v.begin();
}
template <class T>
int ub_index(vector<T>& v,T k){
	return upper_bound(v.begin(),v.end(),k)-v.begin();
}
template<class T>
bool is_sorted(vector<T>& v){
	return is_sorted(v.begin(),v.end());
}
template<class T>
bool sorted(vector<T>& v){
	return is_sorted(v);
}

void solve(){
	int n;
	cin>>n;
	vi m(60001);
	for(int i=1;i<=100;i++){
		for(int j=1;j<=100;j++){
			for(int k=1;k<=100;k++){
				m[i*i+j*j+k*k+i*j+j*k+k*i]++;
			}
		}
	}
	for(int i=1;i<=n;i++)cout<<m[i]<<endl;
}

int main(){
	ios::sync_with_stdio(0);
	int numberofsubtestcases=1;
//	cin>>numberofsubtestcases;
	while(numberofsubtestcases--){
		solve();
	}
}

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

using namespace std;

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

  int h[n];
  for (int i = 0; i < n; ++i) cin >> h[i];

  for (int i = n - 2; i >= 0; --i) {
    if (h[i] - 1 > h[i + 1]) {
      cout << "No" << endl;
      return 0;
    }
    if (h[i] - 1 == h[i + 1]) h[i]--;
  }

  cout << "Yes" << endl;
}


Measured memory_bytes: 640
# -*- coding: utf-8 -*-
"""
Created on Sun Jun 23 14:10:18 2019

@author: Enya
"""

X = input()
N = int(X.split()[0])
L = int(X.split()[1])

A = 0
B = N*(L - 1)

for i in range(N):
    A += i + 1

if B >= 0:
    print(A + B - L)

elif B == -1:
    print(A + B)

else:
    if abs(B) > abs(A):
        print(A + B - L - N + 1)
    
    else:
        print(A + B)
        


Measured memory_bytes: 3064
package main

import (
	"fmt"
	"math"
)

func main() {
	var s, a int
	a = int(math.Pow(10, 9)) + 7
	fmt.Scan(&s)
	A := make([]int, 2001)
	A[0] = 1
	A[1] = 0
	A[2] = 0
	var i = 3
	for ; i <= s; i++ {
		A[i] = (A[i-1] + A[i-3]) % a
	}
	i--
	var ans = A[i] % a
	fmt.Println(ans)
}


Measured memory_bytes: 1904
import java.util.*;
import java.lang.*;

public class Main {
    public static void main(String[] arg) {
        Scanner scan = new Scanner(System.in);
        String S = scan.next();
        scan.close();

        System.out.print("Christmas ");
        int t = 25 - Integer.parseInt(S);
        for (int i = 0; i < t; i++) {
            System.out.print("Eve ");
        }
    }
}

Measured memory_bytes: 21588
n=int(input())
a,b=map(int,input().split())
p1,p2,p3=0,0,0
for t in map(int,input().split()):
  if t<=a:
    p1+=1
  elif t<=b:
    p2+=1
  else:
    p3+=1
print(min(p1,p2,p3))

Measured memory_bytes: 3060
#include <iostream>
#include <sstream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <map>

#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;

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

using namespace std;

const ll BIG = 1000000007LL;

int inputValue(){
    int a;
    cin >> a;
    return a;
};

template<typename T>
void inputArray(T* p, int a){
    rep(i, a){
        cin >> p[i];
    }
};

template<typename T>
void inputVector(vector<T> * p, int a){
    rep(i, a){
        T input;
        cin >> input;
        p -> push_back(input);
    }
}

template <typename T>
void output(T a, int precision = 0) {
    if(precision > 0){
        cout << setprecision(precision)  << a << "\n";
    }
    else{
        cout << a << "\n";
    }
}

const int Max = 110000;
int N, M;
int L[Max], R[Max];

int main(int argc, const char * argv[]) {
    cin >> N >> M;
    rep(i, M) {
        cin >> L[i] >> R[i];
    }

    int lower = 0;
    int upper = Max;
    rep(i, M) {
        if (L[i] > lower) lower = L[i];
        if (R[i] < upper) upper = R[i];
    }

    int ans = upper - lower + 1;
    if (ans < 0) ans = 0;

    output(ans);

    return 0;
}

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

#define F first
#define S second
#define PB push_back

using namespace std;

typedef long long LL;
typedef pair<int, int> PII;
typedef priority_queue<int> HEAP;
typedef priority_queue<int, vector<int>, greater<int> > RHEAP;

const int N = 10010, M = 1000010, mod = 1e9 + 7;

int n;
int a[N], f[M];
int cnt, primes[M];
bool st[M];

void init(int n)
{
	for (int i = 2; i <= n; i ++ )
	{
		if (!st[i]) primes[cnt ++ ] = i;
		for (int j = 0; primes[j] <= n / i; j ++ )
		{
			st[primes[j] * i] = true;
			if (i % primes[j] == 0) break;
		}
	}
}

int qp(int a, int b)
{
	int res = 1;
	while (b)
	{
		if (b & 1) res = (LL)res * a % mod;
		a = (LL)a * a % mod;
		b >>= 1;
	}
	return res;
}

int main()
{
	init(M - 1);
	
	scanf("%d", &n);
	for (int i = 1; i <= n; i ++ )
	{
		scanf("%d", &a[i]);
		int t = a[i];
		for (int j = 2; j <= t / j; j ++ )
			if (t % j == 0)
			{
				int cnt = 0;
				while (t % j == 0)
				{
					t /= j;
					cnt ++ ;
				}
				f[j] = max(f[j], cnt);
			}
		if (t > 1) f[t] = max(f[t], 1);
	}
	
	int s = 1;
	for (int i = 2; i < M; i ++ )
		if (f[i])
			s = (LL)s * qp(i, f[i]) % mod;
	
	int res = 0;
	for (int i = 1; i <= n; i ++ ) res = (res + (LL)s * qp(a[i], mod - 2) % mod) % mod;
	printf("%d\n", res);
	return 0;
}

Measured memory_bytes: 5888
a_0, b_0, c_0 = map(int, input().split()) 

a_1 = b_0
b_1 = a_0
c_1 = c_0

a_2 = c_1
b_2 = b_1
c_2 = a_1

print(a_2,b_2,c_2)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    ll a,b,c,d,ans = 0,r,l,lcm;
    cin>>a>>b>>c>>d;
    r = b/c;
    l = (a-1)/c;
    ans  = r-l;
    r = b/d;
    l = (a-1)/d;
    ans = ans+ r-l;
    lcm = (c*d)/__gcd(c,d);
    r = b/lcm;
    l = (a-1)/lcm;
    ans = ans- (r-l);
    ans = (b-a)+1-ans;
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<vector>
#include<deque>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<algorithm>
#include<functional>
#include<utility>
#include<bitset>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<cstdio>

using namespace std;

#define REP(i,n) for(int i=0;i<int(n);i++)
#define foreach(c,itr) for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
typedef long long ll;
typedef pair<int,int> P;

int main(void){

	          int A,B,C,D,E;
	          cin >> A >> B >> C >> D >> E;

	          int ans=0;
	          if(A<0){
	        	  ans+=(-1)*A*C+D+B*E;
	          }else{
	        	  ans+=(B-A)*E;
	          }

	          cout << ans << endl;

	          return 0;
}

Measured memory_bytes: 3088
#include <stdio.h>
int main(){
    int H,A;
    double i,n;

    scanf("%d %d",&H, &A);
    
    i = (double)H / (double)A;

    n = i / (int)i;

    if(n == 1){
        printf("%d\n", (int)i);
    }else{
        printf("%d\n", (int)i + 1);
    }
    
    return 0;
}


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

const long long MAXN = 2e5 + 1;
long long n, m, i, j, k, z, a[MAXN], b[MAXN];

int main()
{
	ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
    cin >> n >> m >> k;
	for (i = 1; i <= n; ++i)
		cin >> a[i], a[i] += a[i - 1];
	for (i = 1; i <= m; ++i)
		cin >> b[i], b[i] += b[i - 1];
	z = 0, i = 0, j = m;
	while (a[i] <= k && i <= n)
	{
		while (b[j] > k - a[i])
			--j;
		z = max(z, i + j);
		++i;
	}
	cout << z << '\n';
    return 0;
}

Measured memory_bytes: 6736
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <queue>
#include <numeric>
#include <climits>
#include <functional>
#include <iterator>     
using namespace std;
using ll = long long;
const ll mod = 1000000007;
int n, m, x;
string s, t;
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
    int N;
	cin >> N;
    vector<int> v;
    for(int i=0; i<N; ++i){
        int a; cin >> a;
        v.push_back(a);
    }
    sort(v.begin(), v.end());
    int n=v[N-1], m=v[0];
    int minV=n-2*m;
        for(int j=0; j<N-1; ++j){
            if(minV > abs(n-2*v[j])){
                minV = abs(n-2*v[j]);
                m = v[j];
            }
        }
    
    cout << n << " " <<  m << endl;
    return 0;
    
}

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

// Inserted snippets: io, root
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
template<typename H> bool chmin(H& v1, const H v2) { if (v1 > v2) { v1 = v2; return true; } return false; }
template<typename H> bool chmax(H& v1, const H v2) { if (v1 < v2) { v1 = v2; return true; } return false; }
template<typename H> void read(H& head) { cin >> head; }
template<typename H, typename ...T> void read(H& head, T& ...tail) { cin >> head; read(tail...); }
template<typename H> void write(H head) { cout << head << '\n'; }
template<typename H, typename ...T> void write(H head, T ...tail) { cout << head << " "; write(tail...); }
template<typename ...T> void die(T ...tok) { write(tok...); exit(0); }
// End snippets

int main() {
	cin.tie(0)->sync_with_stdio(0);
	cin.exceptions(cin.failbit);

	string s; read(s); write(s.substr(0, 3));
}


Measured memory_bytes: 3656
#include "bits/stdc++.h"
#include "math.h"
 
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<int> vin;
typedef pair<ll,ll> P;
typedef vector<P> vp;
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define drep(i,a,b) for(ll i=(a);i>=(b);--i)
#define SIZE(a) ll((a).size())
#define out(a) cout<<(a)<<endl;
const int inf=INT_MAX;
const int MAX = 510000;
const ll MOD = 1000000007;
//転倒数、バブルソート
template <typename T>
struct BIT{
  private:
    vector<T> array;
    const ll n;
  public:
    BIT(ll _n):array(_n+1,0),n(_n){}
    
    T sum(ll i){
      T s=0;
      while(i>0){
        s+=array[i];
        i-=i&(-i);
      }
      return s;
    }
    T sum(ll i,ll j){
      T ret_i=sum(i-1),ret_j=sum(j);
      return ret_j-ret_i;
    }
    void add(ll i,T x){
      while(i<=n){
        array[i]+=x;
        i+=i&(-i);
      }
    }
};
//転倒数
int main(){
  ll n,ans=0;cin>>n;
  vp a(n);vll c(n);
  rep(i,0,n){
    cin>>a[i].first;
    a[i].second=i;
  }
  sort(a.begin(),a.end());
  rep(i,0,n){
    c[a[i].second]=i+1;
  }

  BIT<ll> bit(n);
  rep(i,0,n){
    
    ans+=i-bit.sum(c[i]);
    bit.add(c[i],1);
  }
  cout<<ans<<endl;
  

}




Measured memory_bytes: 9172
#include <iostream>
#include <fstream>
#include <string> 
#include <cmath>  
#include <cstdlib>
#include <ctime>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <functional>

using namespace std;
using ll = long long;

#define FOR(i, m, n) for(int i = (m);i < (n);i++)
#define REP(i,n) for(int i = 0; i < int(n); i++)
#define VI vector<int>
#define VVI vector<vector<int>>
#define VVVI vector<vector<vector<int>>>
#define VL vector<ll>
#define VVL vector<vector<ll>>
#define VB vector<bool>
#define VVB vector<vector<bool>>
#define PAIR pair<int,int>
#define MP make_pair
#define VP vector<pair<int,int>>
#define VS vector<string>
#define QUE queue<int>
#define DEQ deque<int>
#define PQUE priority_queue<int> //5,5,4,3,3,2,...
#define REPQUE priority_queue<int, vector<int>, greater<int>> //1,1,2,3,4,4,5,...
#define SUM(obj) accumulate((obj).begin(), (obj).end(), 0)
#define SORT(obj) sort((obj).begin(), (obj).end()) // 1,2,3,4,5...
#define RESORT(obj) sort((obj).begin(), (obj).end(), greater<int>()) // 5,4,3,2,1...
#define UB(obj,n) upper_bound((obj).begin(), (obj).end(), n) //itr > n
#define LB(obj,n) lower_bound((obj).begin(), (obj).end(), n) //itr>= n

const ll MOD = (ll)1e9 + 7;

int main() {
	int N;
	cin >> N;
	VVI A(2, VI(N));
	REP(i, N) cin >> A[0][i];
	REP(i, N) cin >> A[1][i];

	int countmax = 0;
	REP(i, N) {
		int count = 0;

		REP(j, i + 1) {
			count += A[0][j];
		}
		FOR(j, i, N) {
			count += A[1][j];
		}
		countmax = max(countmax, count);
	}
	cout << countmax << endl;
	

	
	return 0;
}


Measured memory_bytes: 256
import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
from math import *
# import math
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction
# sys.setrecursionlimit(int(pow(10, 2)))
# sys.stdin = open("input.txt", "r")
# sys.stdout = open("output.txt", "w")
mod = int(pow(10, 9) + 7)
mod2 = 998244353
def data(): return sys.stdin.readline().strip()
def out(*var, end="\n"): sys.stdout.write(' '.join(map(str, var))+end)
def l(): return list(sp())
def sl(): return list(ssp())
def sp(): return map(int, data().split())
def ssp(): return map(str, data().split())
def l1d(n, val=0): return [val for i in range(n)]
def l2d(n, m, val=0): return [l1d(n, val) for j in range(m)]





# @lru_cache(None)


    


L,r=l()

if(r-L>=2019):
    print(0)
    exit()
if(r-L<2019 and 0 in [i%2019 for i in range(L,r+1)]):
    print(0)
    exit()
x=[(i*j)%2019 for i in range(L,r+1) for j in range(i+1,r+1)]
print(min(x))



Measured memory_bytes: 77492
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define pi M_PI
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

const int INF = 1e9;
int par[100];

void init(int n){
    REP(i,n){
        par[i] = i;
    }
}

int find(int x){
    if (par[x] == x){
        return x;
    }else{
        return par[x] = find(par[x]);
    }
}

bool same(int x, int y){
    return find(x) == find(y);
}

void merge(int x, int y){
    x = find(x);
    y = find(y);
    if (x==y) return;
    par[x] = y;
}

struct edge{ int u, v, cost; };

vector<edge> es;
int n;

bool comp(const edge &e1, const edge &e2){
    return e1.cost < e2.cost;
}

int kruskal(int x){
    init(n);
    int res = 0;
    FOR(i,x,es.size()-1){
        edge e = es[i];
        if (!same(e.u, e.v)){
            merge(e.u, e.v);
            res = max(res, e.cost-es[x].cost);
        }
    }
    bool f = true;
    REP(i,n){
        if (!same(0,i)) f = false;
    }
    int ans = (f ? res : INF);
    return ans;
}

int main() {
    int m;
    while (cin >> n >> m && n){
        if (m == 0){
            cout << -1 << endl;
            continue;
        }
        es.clear();
        REP(i,m){
            int x, y, w;
            cin >> x >> y >> w;
            edge e;
            e.u = x-1;
            e.v = y-1;
            e.cost = w;
            es.push_back(e);
        }
        sort(es.begin(),es.end(),comp);
        int ans = INF;
        REP(i,m){
            ans = min(ans, kruskal(i));
        }
        cout << (ans == INF ? -1 : ans) << endl;
    }
    return 0;
}

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

int main(){
    int n,m;
    cin >> n >> m;
    vector<vector<string>> problem_array(n,vector<string>(0));
    for(int i=0;i<m;i++){
        int num;
        string res;
        cin >> num >> res;
        problem_array.at(num-1).push_back(res);
    }
    long long penalty=0,correct=0;
    for(int i=0;i<n;i++){
        int p = 0;
        vector<string> arr = problem_array.at(i);
        
        for(long long j=0;j<arr.size();j++){
            if(arr.at(j) == "WA"){
                p++;
            }else if(arr.at(j) == "AC"){
                correct++;
                penalty += p;
                break;
            }
        }
    }
    cout << correct << " " << penalty << endl;


}

Measured memory_bytes: 10328
#include <bits/stdc++.h>
#define ALL(v) v.begin(), v.end()
#define MAX 510000
#define rrep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep(i, n) for(ll i = 1; i <= (ll)(n); i++)
#define dcout cout<<fixed<<setprecision(15);

using namespace std;
typedef long long int  ll;
typedef pair<ll, ll> P;

constexpr int MOD = 1e9 + 7;
constexpr ll inf = 1LL << 60;

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

//lcm//
ll gcd(ll x, ll y) {
	if (x == 0) return y;
	return gcd(y%x, x);
}
ll lcm(ll x, ll y) { return x * y / gcd(x, y); }

//a^n mod p//
ll modpow(ll a, ll n, ll p) {
  if (n == 1) return a % p;
  if (n % 2 == 1) return (a * modpow(a, n - 1, p)) % p;
  ll t = modpow(a, n / 2, p);
  return (t * t) % p;
}

//inversemod//
ll modinv(ll a, ll m) {
	if(m==0)return (ll)1;
	ll b = m, u = 1, v = 0;
	while (b) {
		ll t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}

//Cmonp//
ll fac[MAX], finv[MAX], inv[MAX];
// 
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int 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;
	}
}

// 
ll COM(ll n, ll k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

//LARGE n
ll com(ll n,ll m){
    if(n<m || n<=0 ||m<0){
		return 0;
	}
	if( m==0 || n==m){
		return 1;
	}
	ll k=1;
	for(ll i=1;i<=m;i++){
       k*=(n-i+1); 
	   k%=MOD;
	   k*=modinv(i,MOD);
	   k%=MOD;
	}
	return k;
}

//radP
ll rad(ll u, ll p){
ll cnt=0;
	while(u%p==0){
		u/=p;
		cnt++;
	}
	return cnt;
}


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

int main() {
	int n;
	cin>>n;
	 int a[n+1];
	 rep(i,n){
		 cin>>a[i];
	 }
	 int ans=0;
for(int i=1;i<n;i++){
if(a[i]==a[i+1]){
	a[i+1]=-10;
	ans++;
}

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




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

const ll p = 998244353;
const int M = 1e6+5;

ll fact[M], invfact[M];
ll n, m;

ll exp(ll x, ll k) {
	if (k == 0)
		return 1;
	ll y = exp(x, k/2);
	if (k%2 == 0)
		return y*y%p;
	return y*y%p*x%p;
}

ll inv(ll x) { return exp(x, p-2); }

void precomp() {
	fact[0] = invfact[0] = 1;
	for (int i = 1; i <= M; ++i) {
		fact[i] = i*fact[i-1]%p;
		invfact[i] = inv(fact[i]);
	}
}

ll binom(ll x, ll y) {
	if (x < 0 || y < 0 || x < y)
		return 0;
	return fact[x]*invfact[y]%p*invfact[x-y]%p;
}

int main() {
	cin >> n >> m;
	if (n < m)
		swap(n, m);

	precomp();

	ll ct = 0;
	for (int i = 0; i <= m; ++i) {
		//prob you touch (i, i) from (n, m);
		ct = (ct + binom(n+m-2*i, n-i)*binom(2*i, i))%p;
	}

	ct = ct*inv(binom(n+m, n))%p;
	cout << (n+m+ct+(n-m-1))*(p+1)/2%p << endl;
}

Measured memory_bytes: 15872
#import numpy as np
#import math
#from decimal import *
#from numba import njit

#@njit
def main():
    (N, M) = map(int, input().split())
    neighbor = [[] for _ in range(N+1)]
    for _ in range(M):
        (A,B) = map(int, input().split())
        neighbor[A] += B,
        neighbor[B] += A,

    guide = [0 for _ in range(N+1)]

    # 1の部屋から幅優先で道しるべを置く
    
    # 探索候補
    target = [1]
    checked = [1]
    while len(target) > 0:
        # 候補の先頭から取る
        n = target.pop(0)
        # nから伸びる行き先
        dests = neighbor[n]
        # すでに道しるべがあるものは除く
        dests = filter(lambda d: guide[d] == 0, dests)
        # 道しるべを置く
        for d in dests:
            guide[d] = n
            checked += d,
            # 探索候補の末尾に追加
            target += d,

    print('Yes')
    for i in range(2,N+1):
        print(guide[i])

main()


Measured memory_bytes: 34544
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl;
#define mod 1000000007
using ll=long long;
const int INF=1000000000;
const ll LINF=1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
// ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return true;}return false;}

struct IOSetup{
    IOSetup(){
        cin.tie(0);
        ios::sync_with_stdio(0);
        cout<<fixed<<setprecision(12);
    }
} iosetup;

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

template<typename T>
ostream &operator<<(ostream &os,const vector<T>&v){
    for(int i=0;i<(int)v.size();i++) os<<v[i]<<(i+1==v.size()?"":" ");
    return os;
}


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

    function<int(int,int)> dfs=[&](int pre,int now){
        int c=0,sum=0,non0=0;
        for(auto to:g[now])if(pre!=to){
            int k=dfs(now,to);
            sum+=k;
            if(k)non0++;
            c++;
        }
        int ad=c-1-non0;
        chmax(ad,0);
        return sum+ad;
    };
    int st=-1;
    rep(i,n)if(g[i].size()>2)st=i;
    if(st<0){
        cout<<1<<endl;
    }else{
        cout<<dfs(-1,st)<<endl;
    }

    return 0;
}


Measured memory_bytes: 13868
#include<bits/stdc++.h>
using namespace std;
int n,k,x,kk=0,sum=0;
priority_queue<int> pq;
int main(){
	scanf("%d%d",&n,&k);
	for(int i=1;i<=n;i++){
		scanf("%d",&x);
		pq.push(x);
	}
	while(!pq.empty() && kk < k){
		sum += pq.top();
		pq.pop();
		kk++;
	}
	printf("%d",sum);
}

Measured memory_bytes: 256
=begin
N K
P1 P2 ... Pn
=end

n, k = gets.chomp.split(" ").map(&:to_i)
ps = gets.chomp.split(" ").map(&:to_i)

# 期待値
count = 0
max = 0
current = 0
exps = []

ps.each do |p|
  count += 1
  me = (1 + p) * p / 2

  e = me.to_f / p
  exps.push e
  current += e

  if count > k
    head = exps.shift
    current -= head
    max = [max, current].max
    # puts "#{max} #{current} #{count} #{exps}"
  elsif count == k
    max = current
    # puts "#{max} #{current} #{count} #{exps}"
  end
end

puts max


Measured memory_bytes: 20540
n = int(input())

def divcnt(x):
    cnt = 0
    for i in range(1, x+1):
        if x % i == 0:
            cnt += 1
    return cnt

ans = 0
for i in range(1, n+1, 2):
    if divcnt(i) == 8:
        ans += 1

print(ans)

Measured memory_bytes: 3060
[N,K,S] = list(map(int,input().split()))

if S<10**9:
    dammy1 = [S]*K
    dammy2 = [S+1]*(N-K)
    out=dammy1 + dammy2

else:
    dammy1 = [S]*K
    dammy2 = [1]*(N-K)
    out=dammy1 + dammy2
print(*out)


Measured memory_bytes: 73132
import sys
stdin = sys.stdin
 
sys.setrecursionlimit(10**5)

def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

from math import sqrt

def wc(a:int, b:int) -> int:
    
    if a == b:
        return 2*a - 2
    
    elif abs(a-b) == 1:
        return 2*min(a,b) - 2
    
    else:
        c = int(sqrt(a*b))
        if a*b == c*c:
            c -= 1
        
        if a*b > c*(c+1):
            return 2*c - 1
        else:
            return 2*c - 2
    

q = ni()
query = [tuple(li()) for _ in range(q)]

for a,b in query:
    print(wc(a,b))

Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();

		if (a % 3 == 0 || b % 3 == 0 || (a + b) % 3 == 0) {
			System.out.print("Possible");
		} else {
			System.out.print("Impossible");
		}
	}
}

Measured memory_bytes: 23892
/*
ID: anonymo14
TASK: wormhole
LANG: C++                 
*/
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pair<int,int>> vpii;

#define F first
#define S second
#define PU push
#define PUF push_front
#define PUB push_back
#define PO pop
#define POF pop_front
#define POB pop_back

#define REP(i,a,b) for(int i=a; i<=b; i++)

#define MOD 1000000007

void solve(int test_case) {//227
	int a,b;
	cin>>a>>b;
	cout<<a*b-a-b+1;
}

int main() {
	
	////// FILE BASED IO////
	//freopen("wormhole.in", "r", stdin);
	//freopen("wormhole.out", "w", stdout);
	///////////////
	
	ios::sync_with_stdio(0);
	cin.tie(0);
	int t=1;
	//cin>>t;
	REP(i,1,t) {
		solve(i);
	}
	return 0;
}	


Measured memory_bytes: 3532
#include <iostream> // cout, endl, cin
#include <cmath> //sqrt pow
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // dequef
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower

#define rep(i,n) for(int i = 0; i < n; i++)
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int, int>
#define all(a) (a).begin(), (a).end()
#define mod 1000000007
using ll = long long;
using namespace std;
int main(){
  char s;
  cin >> s;
  if(int(s) < int('a')) cout << 'A' << endl;
  else cout << 'a' << endl;
}

Measured memory_bytes: 3628
import java.util.Scanner

object Main extends App {
  val sc = new Scanner(System.in)
  val as = Vector.fill(sc.nextInt)(sc.nextInt)
  val res = as.foldLeft((Set.empty[Int], 0)) { (acc, next) =>
    next / 400 match {
      case n if n < 8 => acc.copy(_1 = acc._1 + n)
      case _          => acc.copy(_2 = acc._2 + 1)
    }
  }
  println(s"${1 max res._1.size} ${res._1.size + res._2}")
}


Measured memory_bytes: 25660
#include<stdio.h>
int main(void)
{
	int a, b, c,i,amari,count=0;
	scanf("%d %d %d", &a, &b, &c);
	for (i = a; i <= b; i++)
	{
		amari = c%i;
		if (amari == 0)
		{
			count++;
		}
	}
	printf("%d\n", count);
	return 0;
}


Measured memory_bytes: 2084
#include <stdio.h>
#include <vector>
#include <queue>
#include <iostream>
#include <string>
#include <bitset>
#include <map>
#include <set>
#include <tuple>
#include <stack>
#include <string.h>
#include <time.h>
#include <algorithm>

using namespace std;

using i64 = long long int;
using ii = pair<int, int>;
using ii64 = pair<i64, i64>;

struct Edge
{
	int end;
	i64 capa, flow;
	Edge* dual;

	Edge() : Edge(-1, 0) {}
	Edge(int e, i64 c) : end(e), capa(c), flow(0), dual(nullptr) {}

	i64 remain()
	{
		return capa - flow;
	}

	void addFlow(i64 f)
	{
		flow += f;
		dual->flow -= f;
	}
};

template<int Size>
class Dinic
{
public:

	const i64 INFINITE = 1ll << 62;
	~Dinic()
	{
		for (auto& a : adj)
		{
			for (auto& e : a)
			{
				delete e;
			}
		}
	}

	Edge* addEdge(int a, int b, i64 c)
	{
		auto e1 = new Edge(b, c);
		auto e2 = new Edge(a, 0);
		e1->dual = e2;
		e2->dual = e1;

		adj[a].push_back(e1);
		adj[b].push_back(e2);

		return e1;
	}

	i64 maxFlow(int source, int sink)
	{
		i64 totalFlow = 0;

		while (bfs(source, sink))
		{
			memset(work, 0, sizeof(work));

			while (true)
			{
				i64 flow = dfs(source, sink, INFINITE);

				if (flow == 0)
					break;

				totalFlow += flow;
			}
		}

		return totalFlow;
	}

	int edgeCount(int s)
	{
		return adj[s].size();
	}

	Edge* getEdge(int s, int i)
	{
		return adj[s][i];
	}

private:

	vector<Edge*> adj[Size];
	int level[Size];
	int work[Size];

	bool bfs(int source, int sink)
	{
		memset(level, -1, sizeof(level));

		level[source] = 0;

		std::queue<int> q;
		q.push(source);

		while (!q.empty())
		{
			int now = q.front();
			q.pop();

			for (auto& e : adj[now])
			{
				if (level[e->end] != -1 || e->remain() <= 0)
					continue;

				level[e->end] = level[now] + 1;
				q.push(e->end);
			}
		}

		return level[sink] != -1;
	}

	i64 dfs(int s, int e, i64 f)
	{
		if (s == e)
			return f;

		for (int& i = work[s]; i < adj[s].size(); i++)
		{
			auto& next = adj[s][i];

			if (level[next->end] != level[s] + 1 || next->remain() <= 0)
				continue;

			i64 df = dfs(next->end, e, min(f, next->remain()));

			if (df != 0)
			{
				next->addFlow(df);
				return df;
			}
		}

		return 0;
	}
};

Dinic<105> dinic;

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

	vector<i64> arr(n + 1);

	i64 total = 0;

	for (i64 i = 1; i <= n; i++)
	{
		scanf("%lld", &arr[i]);

		if(arr[i] > 0)
			total += arr[i];
	}

	int source = n + 1, sink = n + 2;

	for (int i = 1; i <= n; i++)
	{
		if (arr[i] <= 0)
		{
			dinic.addEdge(source, i, -arr[i]);
		}
		else
		{
			dinic.addEdge(i, sink, arr[i]);
		}

		for (int j = 2 * i; j <= n; j += i)
		{
			dinic.addEdge(i, j, dinic.INFINITE);
		}
	}

	printf("%lld", total - dinic.maxFlow(source, sink));

	return 0;
}

Measured memory_bytes: 256