akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define IDX(vec, element_iter) distance((vec).begin(), element_iter)
#define print(x) cout<<(x)<<'\n'
#define pe(x) cout<<(x)<<" "
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define pb push_back
#define mp make_pair
#define MOD 1000000007 //10^9+7
#define fi first
#define sc second
using ll=long long;
using pll=pair<ll,ll>;
using vi=vector<int>;
using vll=vector<ll>;
using vstr=vector<string>;
void yes(bool c) { if (c)print("Yes"); else print("No"); };

void solve() {
    int N; cin >> N;
    vector<vi> to(N),cost(N);
    int u,v,w;
	rep(i,N-1) {
        cin >> u >> v >> w;
        u--;v--;
        to[u].pb(v); cost[u].pb(w);
        to[v].pb(u); cost[v].pb(w);
    }
    vi ans(N,-1);
    ans[0] = 0;
    queue<int> q;
    q.push(0);
    while(!q.empty()){
        int v = q.front();
        q.pop();
        rep(i,to[v].size()){
            int u = to[v][i]; 
            int w = cost[v][i]; 
            if(ans[u]!=-1) continue;
            ans[u]=(ans[v]+w)%2;
            q.push(u);
        }
    }
	rep(i,N) print(ans[i]);
}

int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
	cout<<fixed<<setprecision(20);

    //int q; cin >> q;
	//while (q--)
		solve();
    return 0;
}

Measured memory_bytes: 11904
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long unsigned int ll;

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

int main() {
    int a;
    int b;
    int x;
    cin  >>  a >> b;
    x = b - a -1;
    int h =  x * (x+1) / 2;
    cout << (h - a) << endl;


    return 0;
}


Measured memory_bytes: 256
x, y, z, k = map(int, input().split())
alst = list(map(int, input().split()))
blst = list(map(int, input().split()))
clst = list(map(int, input().split()))
alst.sort(reverse = True)
blst.sort(reverse = True)
clst.sort(reverse = True)
ans = []
for i in range(x):
    for j in range(y):
        if i * j > k:
            break
        for l in range(z):
            if i * j * l > k:
                break
            ans.append(alst[i] + blst[j] + clst[l])
ans.sort(reverse = True)
print(*ans[:k], sep = "\n")

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

using namespace std;

int main(){
    string s;
    cin>>s;
    if (s.at(0)=='9' || s.at(1)=='9') {
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main () {
	int N,K;
	cin >> N >> K;
	std::vector<int> v(N);
	for (int i = 0; i < N; ++i)
	{
		cin >> v[i];
	}
	sort(v.begin(), v.end());
	reverse(v.begin(), v.end());
	int sum = 0;
	for (int i = 0; i < K; ++i)
	{
		sum += v[i];
	}
	cout << sum << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNextInt()) {
            int A = sc.nextInt();
            int B = sc.nextInt();
            int C = sc.nextInt();
            int D = sc.nextInt();
            int X = A * B;
            int Y = C * D;
            if ( X > Y ) {
                System.out.println(X);
            } else {
                System.out.println(Y);
            }
        }
    }
}


Measured memory_bytes: 22732
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,K;
  cin >> N >> K;
  
  vector<int>count(N);
  for (int i = 0; i < N; i++) {
    count.at(i) = (K+i)/(i+1) -1; 
  }
  
  vector<int>A(N,0);
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < 18; j++) {
      if (count.at(i) != 0){
        A.at(i)++;
        count.at(i) /= 2;
      }
    }
  }
    
  vector<int>B(18);
  B.at(0) = 1;
  for (int i = 1; i < 18; i++) {
    B.at(i) = B.at(i-1) * 2;
  }
  
  double sum = 0;
  for (int i = 0; i < N; i++) {
    sum += 1.0/B.at(A.at(i));
  }
  
  printf("%.10lf\n", sum/N);
}
    
  
  



Measured memory_bytes: 3980
#include <iostream>
#include <iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <string>
#include <stdio.h>
#include <sstream>

using namespace std;
void swap(int &a, int &b);

int main()
{
	double p1[2], p2[2];
	cin >> p1[0] >> p1[1] >> p2[0] >> p2[1];

	double x = p1[0] - p2[0];
	double y = p1[1] - p2[1];

	cout << fixed<<setprecision(9) << sqrt(x*x + y*y) << endl;

	return 0;
}






Measured memory_bytes: 3300
#include <bits/stdc++.h>
using namespace std;
# define ll long long int
int main(){
	ios::sync_with_stdio(false);
  	cin.tie(0);
  	int a,b,c;
	cin>>a>>b>>c;
	a=100*a+10*b+c;
	if(a%4==0){
		cout<<"YES";
		return 0;
	}cout<<"NO";
}


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

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

    int a, b;
    cin >> a >> b;

    string m = a <= 8 and b <= 8 ? "Yay!" : ":(";
    cout << m << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <string>
#include <set>
#include <vector>
#include <map>
#include <list>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> p;
int main(void) {
    ll n, i, j, tmp;
    cin >> n;
    ll x[n], c[n];
    for(i=0; i<n; i++) {
        scanf("%lld", &x[i]);
        c[i] = x[i];
    }
    sort(c, c+n);
    
    for(i=0; i<n; i++) {
        if(x[i]>=c[n/2])
            cout << c[n/2-1] << endl;
        else
            cout << c[n/2] << endl;
    }
}

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

using namespace std;


#define pb push_back
#define fo(i, n) for(int i = 1; i <= n; ++i)

const int mod = 1e9 + 7;
const int N = 700012;
const int inf = 2e9;
typedef long long ll;
int n;
map<int, int> cnt1, cnt2;
int a[N];
vector<int> g[N];
inline bool cmp(pair<int,int> a, pair<int,int> b) {
    if(a.second!=b.second) return a.second>b.second;
    return a.first<b.first;
}
int main() {
    ios::sync_with_stdio(0); cin.tie(0);
    string s;
    cin >> s;
    int n = s.length();
    s='#'+s;
    if(s[n]=='1') return cout << -1, 0;
    if(s[1]=='0') return cout << -1, 0;
    for(int i=1;i<n;++i)
        if(s[i]!=s[n-i]) return cout << -1, 0;
    int cur=1;
    vector<pair<int, int> > e;
    bool not_add = 0;
    for(int i=2;i<=n;++i) {
        e.pb({i, cur});
        if(s[i-1] == '1')
            cur = i;
    }
    for(auto &x: e) cout << x.first << ' ' << x.second << '\n';
    return 0;
}

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

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<pii,int> ppii;
typedef pair<int,pii> pipi;
typedef pair<ll,ll> pll;
typedef pair<ll,pll> plpl;
typedef tuple<ll,ll,ll> tl;
ll mod=1000000007;
ll mod2=998244353;
ll inf=1000000000000000000;
#define rep(i,m,n) for(int i=m;i<n;i++)
#define rrep(i,n,m) for(int i=n;i>=m;i--)
ll lmax(ll a,ll b){
    if(a<b)return b;
    else return a;
}
ll lmin(ll a,ll b){
    if(a<b)return a;
    else return b;
}
ll n;
ll f(vector<ll> v,ll k){
    ll ki=v[k-1];
    ll now=ki+1;
    ll ret=n;
    rep(i,k,n+1){
        if(v[i]>=now){
            now+=2;
        }
        else{
            ret=i;
            break;
        }
    }
    return ret;
}
int main(){
    cin>>n;
    vector<ll> v(n);rep(i,0,n)cin>>v[i];
    v.insert(v.begin(),0);
    ll now=1;
    ll ans=1;
    ll cnt=0;
    for(;;){
        ll g=n;
        ll ki=v[now-1];
        ll ss=ki+1;
        rep(i,now,n+1){
            if(v[i]>=ss){
                ss+=2;
            }
            else{
                g=i;
                break;
            }
        }
        //cout<<g<<" ";
        if(g==n){
            if(n==cnt)break;
            rrep(i,n-cnt,1){
                ans*=i;
                ans%=mod;
            }
            break;
        }
        ans*=(g-cnt+mod)%mod;
        cnt++;
        now=g+1;
        ans%=mod;
    }
    cout<<ans<<endl;
}


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

int main()
{
  	vector<int> prices(3);
  	for (int i = 0; i < 3; i++) cin >> prices[i];
	sort(prices.begin(), prices.end());
  	int sum = prices[0] + prices[1];
  	cout << sum;
}

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

int main(){


  int serve = 0;
    
  int sa=0,sb=0;


  while(1){
    string s;
    cin >> s;
    if(s == "0") break;
    int a=0,b=0;
    for(int i=1; i< s.size(); i++){
      if(s[i] == 'A')  a++,serve = 0;
      else if(s[i] == 'B')  b++,serve = 1;
    }
    if( a > b ) a++,sa++;
    if( b > a ) b++,sb++;
    
    cout << a << " " << b << "\n";
  }
    
  
}

Measured memory_bytes: 1188
#include<bits/stdc++.h>
using namespace std;
#define re register
int a[100100],b[100100],c[100100],fa[100100];
int find(re int a){return (fa[a]==a)?a:fa[a]=find(fa[a]);}
int main()
{
	re int n,q,num,bbl=0;
	re long long m,mx=0;
	scanf("%d%lld%d",&n,&m,&q);num=n;
	for(re int i=1;i<=n;i++)fa[i]=i;
	for(re int i=1;i<=q;i++)
	{
		scanf("%d%d%d",&a[i],&b[i],&c[i]);a[i]++;b[i]++;
		if(c[i]==0)
		{
			re int x=find(a[i]),y=find(b[i]);
			if(x!=y)num--,fa[x]=y;
		}
	}
	for(re int i=1;i<=q;i++)if(c[i]==1)
	{bbl=1;
		if(find(a[i])==find(b[i]))
		{
			puts("No");
			return 0;
		}
	}
	if(bbl&&num<=2){puts("No");return 0;}
	if(bbl&&m==n-1){puts("No");return 0;}
	mx=n-1;
	mx+=(long long)num*(num-1)/2-num+1;
	if(m<=mx)puts("Yes");
	else puts("No");
}

Measured memory_bytes: 1792
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int cnt = 0;
        int cnt1 = 0;
        for(int i = 0;i < N;i++){
            int a = sc.nextInt();
            if(a % 2 == 0){
                cnt++;
                if(a % 3 == 0 || a % 5 == 0){
                    cnt1++;
                }
            }
        }
        if(cnt == cnt1){
            System.out.println("APPROVED");
        }else{
            System.out.println("DENIED");
        }
    }
}


Measured memory_bytes: 23124
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Objects;
import java.util.StringTokenizer;

public class Main {

	public static void main(String args[]) {
		FastScanner cin = new FastScanner();
		PrintWriter cout = new PrintWriter(System.out);
		solve(cin, cout);
		cout.flush();
	}

	private static void solve(FastScanner cin, PrintWriter cout) {
		String[] abc = { cin.next(), cin.next(), cin.next() };

		if (Objects.equals(abc[0].charAt(abc[0].length() - 1), abc[1].charAt(0))
				&& Objects.equals(abc[1].charAt(abc[1].length() - 1), abc[2].charAt(0)))
			cout.println("YES");
		else
			cout.println("NO");
	}

	/**
	 * How to read input in Java — tutorial <br />
	 * By Flatfoot<br />
	 * http://codeforces.com/blog/entry/7018
	 */
	static class FastScanner {
		private BufferedReader br;
		private StringTokenizer st;

		FastScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st == null || !st.hasMoreElements())
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					throw new IllegalStateException(e);
				}
			return st.nextToken();
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				throw new IllegalStateException(e);
			}
			return str;
		}

		long nextLong() {
			return Long.parseLong(next());
		}
	}

}


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

Measured memory_bytes: 4008
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <string>

using namespace std;
typedef long long ll;
const int MAXN = 100100;

int N;
string s;
int ans[MAXN];

int cbreak;

void roll (int x)
{
    int cstart = cbreak;
    while (s[cstart] == 'R')
        cstart++;
    for (int i = cbreak; i <= x; i++)
    {
        if (i % 2 == cstart % 2)
            ans[cstart]++;
        else
            ans[cstart-1]++;
    }
    cbreak = x + 1;
}

int main()
{
    ios_base::sync_with_stdio(0);
    
    cin >> s;
    N = s.length();

    cbreak = 0;
    for (int i = 0; i + 1 < N; i++)
    {
        if (s[i] == 'L' && s[i+1] == 'R')
            roll(i);
    }
    roll(N-1);

    for (int i = 0; i < N; i++)
    {
        if (i) cout << " ";
        cout << ans[i];
    }
    cout << "\n";
}

Measured memory_bytes: 1104
#include <iostream>
#define MAXN 100100

using namespace std;
long long mod = 1000000000;

int main(){
	int dp[MAXN], h[MAXN];
	int n, k;

	cin >> n >> k;

	for(int i = 0; i < n; i++){
		cin >> h[i];
		dp[i] = mod;
	}
	dp[0] = 0;
	for(int i = 0; i < n; i++){
		for(int j = i + 1; j <= i + k; j++){
			if(j < n){
				dp[j] = min(dp[j], dp[i] + abs(h[i] - h[j]));
			}
		}
	}
	cout << dp[n - 1] << "\n";
	}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;
typedef long long int ll;
typedef vector<ll> vl;
typedef pair<ll, ll> PP;
#define rep(i, n) for(ll i = 0; i < ll(n); i++)
#define all(v) v.begin(), v.end()
#define ITR(v, i) for(auto ite = v.begin(); ite != v.end(); ite++)
const ll INF = 999999999999999;
const ll MOD = 1000000007;
const ll MAX_N = 500010;
ll a, b, c, d, e, f, p, t, x, y, z, q, m, n, r, h, k, w, l, ans;
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n;
    cout << setprecision(10) << n * 4 * asin(1) << endl;
}

Measured memory_bytes: 3804
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string s;
	cin>>s;
	if(s.size()&1) 
	{
        printf("No");
        return 0;
    }
	for(int i=0; i<s.size()/2; i++) 
	{
        int r=abs(s[i]-s[s.size()-i-1]);
        if(r!=1&&r!=2) 
        { 
            cout<<"No";
            return 0;
        }
    }
	cout<<"Yes";
	return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define PII pair<int,int>
#define PSI pair<string,int>
#define PIII pair< int, pair<int,int> >
const int MaxN = 1e5+5;
vector<int> g[MaxN];
int dp[MaxN];
int N;

int dfs(int node){

    auto &ret = dp[node];
    if(ret!=-1) return ret;
    
    ret = 0;
    for(auto i: g[node])
        ret = max(ret, dfs(i)+1 );

    return ret;
}

void read(){

    int edge;
    memset(dp, -1, sizeof dp);
    cin>>N>>edge;

    for(int i=0; i<edge; i++){
        int u,v;
        cin>>u>>v;
        g[u].push_back(v);
    }
}

void solve(){

    read();
    int res = 0;
    for(int i=1; i<=N; i++)
        res = max(res, dfs(i) );

    cout<< res << "\n";
}


int main(){

    //freopen("input.txt","r",stdin);
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    solve();

    return 0;
}


Measured memory_bytes: 11312
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#define rep(i, n) for (int i = 0; i < (n); i++)
const long long MOD = 1000000007;
using namespace std;
typedef long long ll;
map<ll, int> mp;
signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n;
	cin >> n;
	vector<int> s(n);
	for (int i = 0; i < n; i++) cin >> s[i];
	int sum = 0;
	for (int i = 0; i < n; i++) {
		sum += s[i];
	}
	if (sum % 10 != 0) {
		cout << sum << endl;
	}
	else {
		int ans = 101;
		for (int i = 0; i < n; i++) {
			if (s[i] % 10 != 0) {
				ans = min(s[i], ans);
			}
		}
		if (ans == 101) cout << 0 << endl;
		else cout << sum - ans << endl;
	}
	return 0;
}

Measured memory_bytes: 256
s = input()
if len(s)==2:
    if s[0]==s[1]:
        print(1,2)
    else:
        print(-1,-1)
    exit()
for i in range(len(s)-1):
    if s[i] == s[i+1]:
        print(i+1,i+2)
        exit()
for i in range(len(s)-2):
    if s[i] == s[i+2]:
        print(i+1,i+3)
        exit()
print(-1,-1)


Measured memory_bytes: 3188
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder.Minpro2019_2_9
{
    class B
    {
        public static void Solve()
        {
            var deg = Enumerable.Repeat(2, 4).ToArray();
            for (int i = 0; i < 3; i++)
            {
                var input = Console.ReadLine().Split().Select(int.Parse).ToArray();
                for(int j = 0; j < 2; j++)
                {
                    deg[input[j]-1]--;
                }
            }
            bool o = deg.Count(x => x == 1) == 2;
            Console.WriteLine(o ? "YES":"NO");
        }
    }
}

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            Minpro2019_2_9.B.Solve();
        }
    }
}


Measured memory_bytes: 13396
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int h = Integer.parseInt(sc.next());
        int w = Integer.parseInt(sc.next());
        char[][] c = new char[h][w];
        for (int i = 0; i < h; i++) {
            String s = sc.next();
            for (int j = 0; j < w; j++) {
                c[i][j] = s.charAt(j);
            }
        }
        int[][] dp = new int[h + 1][w + 1];
        int init = c[0][0] == '.' ? 0 : 1;
        dp[1][1] = init;
        for (int i = 1; i <= h; i++) {
            for (int j = 1; j <= w; j++) {
                int temp = c[i - 1][j - 1] == '.' ? 0 : 1;
                int cw;
                int ch;
                if (i == 1 && j == 1) {
                    continue;
                }
                if (i == 1) {
                    cw = c[i - 1][j - 2] == '.' ? 0 : 1;
                    if (cw == 0) {
                        dp[i][j] = dp[i][j - 1] + temp;
                    } else {
                        dp[i][j] = dp[i][j - 1];
                    }
                } else if (j == 1) {
                    ch = c[i - 2][j - 1] == '.' ? 0 : 1;
                    if (ch == 0) {
                        dp[i][j] = dp[i - 1][j] + temp;
                    } else {
                        dp[i][j] = dp[i - 1][j];
                    }
                } else {
                    ch = c[i - 2][j - 1] == '.' ? 0 : 1;
                    cw = c[i - 1][j - 2] == '.' ? 0 : 1;
                    int temp2 = cw == 0 ? temp : 0;
                    int temp3 = ch == 0 ? temp : 0;
                    if (dp[i - 1][j] > dp[i][j - 1]) {
                        dp[i][j] = dp[i][j - 1] + temp2;
                    } else if (dp[i - 1][j] < dp[i][j - 1]) {
                        dp[i][j] = dp[i - 1][j] + temp3;
                    } else {
                        dp[i][j] = Math.min(dp[i - 1][j], dp[i][j - 1]) + Math.min(temp2, temp3);
                    }
                }
            }
        }
        System.out.println(dp[h][w]);
    }
}

Measured memory_bytes: 24148
// import chie template :) {{{
import std.stdio, std.algorithm, std.array, std.string, std.math, std.conv,
    std.range, std.container, std.bigint, std.ascii, std.typecons;

// }}}
// nep.scanner {{{
class Scanner
{
    import std.stdio : File, stdin;
    import std.conv : to;
    import std.array : split;
    import std.string : chomp;

    private File file;
    private char[][] str;
    private size_t idx;

    this(File file = stdin)
    {
        this.file = file;
        this.idx = 0;
    }

    private char[] next()
    {
        if (idx < str.length)
        {
            return str[idx++];
        }

        char[] s;
        while (s.length == 0)
        {
            s = file.readln.chomp.to!(char[]);
        }

        str = s.split;
        idx = 0;

        return str[idx++];
    }

    T next(T)()
    {
        return next.to!(T);
    }

    T[] nextArray(T)(size_t len)
    {
        T[] ret = new T[len];

        foreach (ref c; ret)
        {
            c = next!(T);
        }

        return ret;
    }

    void scan()()
    {
    }

    void scan(T, S...)(ref T x, ref S args)
    {
        x = next!(T);
        scan(args);
    }
}
// }}}

void main()
{
    auto cin = new Scanner;
    int a, b, c;
    cin.scan(a, b, c);
    if (a + b >= c)
    {
        writeln("Yes");
    }
    else
    {
        writeln("No");
    }
}


Measured memory_bytes: 256
K = int(input())
num = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(num[K-1])

Measured memory_bytes: 3060
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
#include <string>
#include <cstdlib>
using namespace std;
#define N 200010
int a[N];
int main() {

    int k, n;
    while (scanf("%d %d",&n,&k)!=EOF) {
        for (int i=0;i<n;i++) {
            scanf("%d",&a[i]);
            if (i>=k) {
                printf("%s\n",a[i]>a[i-k]?"Yes":"No");
            }
        }
    }
    return 0;
}


Measured memory_bytes: 3944
/*** author: yuji9511 ***/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using lpair = pair<ll, ll>;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i=(m);i<(n);i++)
#define rrep(i,m,n) for(ll i=(m);i>=(n);i--)
#define printa(x,n) for(ll i=0;i<n;i++){cout<<(x[i])<<" \n"[i==n-1];};
void print() {}
template <class H,class... T>
void print(H&& h, T&&... t){cout<<h<<" \n"[sizeof...(t)==0];print(forward<T>(t)...);}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    ll a[200010];
    rep(i,0,N) cin >> a[i];
    map<ll,ll> mp;
    rep(i,0,N) mp[a[i]]++;
    if(mp[1] == 0){
        print(-1);
        return 0;
    }
    ll cur = 1;
    rep(i,0,N){
        if(a[i] == cur){
            cur++;
        }
    }
    ll ans = N - (cur-1);
    print(ans);

}

Measured memory_bytes: 14336
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <tuple>
#include <cstdio>
#include <bitset>
#include <sstream>
#include <iterator>
#include <numeric>
#include <map>
#include <cstring>
#include <set>

using namespace std;

#define DEBUG_ //!!提出時にコメントアウト!!
#ifdef DEBUG_
	#define dump(x)  cerr << #x << " = " << (x) << endl;
#else
	#define dump(x)  ;
#endif

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size())
#define pb push_back
#define eb emplace_back

//#define int long long

typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;

template <typename T>
std::string printVector(const std::vector<T> &data)
{
    std::stringstream ss;
    std::ostream_iterator<T> out_it(ss, ", ");
    ss << "[";
    std::copy(data.begin(), data.end() - 1, out_it);
    ss << data.back() << "]";
    return ss.str();
}

const int MOD = 1e9+7;
const LL LINF = 1001002003004005006ll;
const int INF = 1001001001;

signed main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    LL X,Y; cin >>X>>Y;
    if(abs(X-Y)<= 1) cout << "Brown" << endl;
    else cout << "Alice" << endl;

}

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

int main() {
  string s;
  cin >> s;
  int c[25], n = s.size(), i, ans = 1;
  for (i = 0; i < 25; i++) {
    c[i] = 0;
  }
  for (i = 0; s[i] != '\0'; i++) {
    c[s[i] - 'a']++;
  }
  for (i = 0; i < n; i++) {
    if (c[i] > 1) {
      ans = 0;
      break;
    }
  }
  if (ans == 1) {
    cout << "yes"
         << "\n";
  } else {
    cout << "no"
         << "\n";
  }
  return 0;
}

Measured memory_bytes: 256
X,Y,A,B,C = map(int,input().split())
P = list(map(int, input().split()))
Q = list(map(int, input().split()))
R = list(map(int, input().split()))

R+=sorted(P)[-X:]
R+=sorted(Q)[-Y:]

a=-(X+Y)
print(sum(sorted(R)[a:]))


Measured memory_bytes: 23328
#include <vector>
#include <iostream>
#include <cmath>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <fstream>
#include <unistd.h>
#include <string.h>
#include <string>
#include <numeric>
#include <queue>
#include <deque>
#include <sstream>
#include <iomanip>
#include <set>
#include <stack>
#include <cassert>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<vvb> vvvb;
typedef vector<vvvb> vvvvb;
typedef vector<string> vs;
typedef vector<vs> vvs;
typedef vector<vvs> vvvs;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<vvd> vvvd;
typedef pair<ll, ll> PL;
typedef vector<PL> vpl;
typedef vector<vector<PL>> vvpl;
const int INF = 1001001001;
const ll LINF = 1e17;
const double pi = 3.1415926535897932;
const string endstr = "\n";
#define FOR(i, a, b) for(ll i = (a); i < b; i++)
#define RFOR(i, a, b) for(ll i = (a); i > b; i--)
#define rep(i, n) for(ll i = 0; i < n; i++)
#define rrep(i, n) for(ll i = n-1; i > -1; i--)
#define FORMAP(it, m) for(auto it = m.begin(); it != m.end(); it++)
#define ff first
#define ss second
#define pb push_back
#define epb emplace_back
#define ALL(X) (X).begin(),(X).end()

template <typename T>
T gcd(T a, T b) {
    return (a == 0) ? b : gcd(b%a, a);
}
template <typename T>
T lcm(T a, T b) {
    return a / gcd(a, b) * b;
}

bool p_comp_fs(const PL p1, const PL p2){ return p1.first < p2.first;};
bool p_comp_fg(const PL p1, const PL p2){ return p1.first > p2.first;};
bool p_comp_ss(const PL p1, const PL p2){ return p1.second < p2.second;};
bool p_comp_sg(const PL p1, const PL p2){ return p1.second > p2.second;};
template <typename T>
vector<T> uniquen(vector<T> vec){
    vec.erase(unique(vec.begin(), vec.end()), vec.end());
    return vec;
}

inline ll popcnt(ll x){return __builtin_popcountll((unsigned long long)x);};
template<class T> bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }




int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    ll S; cin >> S;
    ll x1 = 1e9;
    ll y2 = (S+x1-1)/x1;
    ll x2 = 1;
    ll y1 = y2*x1 - S;
    cout << 0 << " " << 0 << " ";
    cout << x1 << " " << y1 << " ";
    cout << x2 << " " << y2 << endstr;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void){
  int i,j;
  int n,m;
  int a[100][100],b[100],c[100]={};
  scanf("%d %d",&n,&m);
  for(i=0;i<n;i++){
    for(j=0;j<m;j++){
      scanf("%d",&a[i][j]);
    }
  }
  for(i=0;i<m;i++){
    scanf("%d",&b[i]);
  }
  for(i=0;i<n;i++){
    for(j=0;j<m;j++){
      c[i] += a[i][j] * b[j];
    }
    printf("%d\n",c[i]);
  }
  return(0);
}

Measured memory_bytes: 1812
N = int(input())
t = [0] * (N+1)
x = [0] * (N+1)
y = [0] * (N+1)
for i in range(1, N+1):
    t[i], x[i], y[i] = map(int, input().split())
count = 0    
for j in range(1, N+1):
    if not(t[j]-t[j-1] >= abs(x[j]-x[j-1]) + abs(y[j]-y[j-1]) and (abs(x[j]-x[j-1]) + abs(y[j]-y[j-1])) % 2 == (t[j]-t[j-1]) % 2):
        print('No')
        count = 1
        break
        
if count == 0:
    print('Yes')

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

int main() {
  int n,k;
  cin >> n >> k;
  vector<int>p(n);
  rep(i,n) cin >> p[i];
  sort(p.begin(),p.end());
  int ans=0;
  rep(i,k) {
    ans+=p[i];
  }
  cout << ans << endl;
}


Measured memory_bytes: 3584
#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define dunk(a) cout << (a) << endl
#define rall(a) (a).rbegin(),(a).rend()
const int INF = 2e9;
using namespace std;
using Graph = vector<vector<int>>;
typedef pair<int,int> P;
typedef long long ll;

int main(){
    int y, m, d;
    char c1, c2;

    cin >> y >> c1 >> m >> c2 >> d;
    
    cout << (m <= 4 ? "Heisei" : "TBD") << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
#define ALL(a) a, a+sizeof(a)/sizeof(a[0])
using namespace std;
ll gcd(ll n, ll m) {
	if (m == 0) return n;
	return gcd(m, n % m);
}

ll lcm(ll n, ll m) {
	return m / gcd(n, m) * n;
}

int main(void) {
	int x;
	scanf("%d", &x);
	switch (x%7){
		case 1:
			cout << "fri" << endl;
			break;
		case 2:
			cout << "sat" << endl;
			break;
		case 3:
			cout << "sun" << endl;
			break;
		case 4:
			cout << "mon" << endl;
			break;
		case 5:
			cout << "tue" << endl;
			break;
		case 6:
			cout << "wed" << endl;
			break;
		case 0:
			cout << "thu" << endl;
			break;
		default:
			break;
	}
	return 0;
}


Measured memory_bytes: 3160
n = gets.strip.to_i
abc = (n-1).times.map { gets.strip.split.map(&:to_i) }
q, k = gets.strip.split.map(&:to_i)
xy = readlines.map {|line| line.strip.split.map(&:to_i) }

graph = Array.new(n+1) { [] }
abc.each do |s, g, cost|
  graph[s] << [g, cost]
  graph[g] << [s, cost]  
end

#p graph

tree = Array.new(n+1)

checked = Array.new(n+1, false)
checked[k]=true
queue = [ [k, 0] ]
until queue.empty?
  current, cost = queue.shift
  graph[current].each do |to, cc|
    next if checked[to]
    checked[to]=true
    tree[to] = cost+cc
    queue.push( [to, cost+cc] )
  end
end

xy.each do |x, y|
  p tree[x] + tree[y]
end

Measured memory_bytes: 59100
import java.util.*;
import java.lang.*;
import java.math.*;
import java.io.*;
import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;

public class Main{
	Scanner sc=new Scanner(System.in);

	int INF=1<<28;
	double EPS=1e-12;

	int n;
	int[] a;
	int max=42;

	// [1, 42]

	void run(){
		n=sc.nextInt();
		a=new int[n];
		for(int i=0; i<n; i++){
			a[i]=sc.nextInt();
		}
		solve();
	}

	long end;
	int ub;

	void solve(){
		end=0;
		for(int i=0; i<n; i++){
			end|=1L<<a[i];
		}
		// a+b
		// a-b
		// a*2^k
		for(int t=n-1; t<42; t++){
			ub=t;
//			debug(ub);
			if(dfs(1L<<1, 0)){
				println(ub+"");
				break;
			}
		}
	}

	boolean dfs(long s, int step){
		// テヲツ楪敕、ツサツョ
		// debug("dfs");
		// debug(Long.toBinaryString(s), Long.toBinaryString(end), step,
		// Long.toBinaryString(end&~s), Long.bitCount(end&~s));
		if(step+Long.bitCount(end&~s)>ub){
			return false;
		}
		if((end&s)==end){
			// debug("ok");
			return true;
		}
		// debug("??");
		for(long s1=s; s1!=0; s1&=s1-1){
			// debug(s1);
			int i=Long.numberOfTrailingZeros(s1);
			for(; i<=max; i<<=1){
				if((s>>i&1)==0){
					if(dfs(s|(1L<<i), step+1)){
						return true;
					}
				}
			}
		}
		// debug("a");
		for(long s1=s; s1!=0; s1&=s1-1){
			int i=Long.numberOfTrailingZeros(s1);
			for(long s2=s; s2!=0; s2&=s2-1){
				// debug("s2", s2);
				int j=Long.numberOfTrailingZeros(s2);
				if(i+j<=max&&(s>>(i+j)&1)==0){
					if(dfs(s|(1L<<(i+j)), step+1)){
						return true;
					}
				}
				if(abs(i-j)>0&&(s>>abs(i-j)&1)==0){
					if(dfs(s|(1L<<abs(i-j)), step+1)){
						return true;
					}
				}
				// debug("??");
			}
		}
		// debug("hogepi");
		return false;
	}

	void debug(Object... os){
		System.err.println(Arrays.deepToString(os));
	}

	void print(String s){
		System.out.print(s);
	}

	void println(String s){
		System.out.println(s);
	}

	public static void main(String[] args){
		new Main().run();
	}
}

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

using namespace std;

int main(){
    long a=100;
    long goal;
    cin >> goal;

    for(int i=0;;i++){
        if(a>=goal){
            cout << i << endl;
            break;
        }
        
        long rishi = a/100;
        a += rishi;
    }
    
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
vector<int> s[55];
int book[55]={};
bool dfs(int from,int goal,int x)
{
	bool is=true;
	int i,q;
	for(i=0;i<s[from].size();i++)
	{
		q=s[from][i];
		if(q==goal&&from!=x)
		{
			return false;
		}
		if(book[q])
		{
			continue;
		}
		book[q]=1;
		is&=dfs(q,goal,x);
		book[q]=0;
	}
	if(is)
		return true;
	return false;
}
int main(){
	int n,m,a[55],b[55],times[55]={},i,j,k,l,q,p,sum=0;
	cin>>n>>m;
	for(i=0;i<m;i++)
	{
		cin>>a[i]>>b[i];
		s[a[i]].push_back(b[i]);
		s[b[i]].push_back(a[i]);
	}
	for(i=0;i<m;i++)
	{
		for(j=0;j<55;j++)
		{
			book[j]=0;
		}
		book[a[i]]=1;
		book[b[i]]=1;
		if(s[a[i]].size()<s[b[i]].size())
		{
			if(dfs(a[i],b[i],a[i]))
			{
				sum++;
			}
		}
		else
		{
			if(dfs(b[i],a[i],b[i]))
			{
				sum++;
			}
		}
	}
	cout<<sum<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  vector<int> A(N);
  for(int i = 0;i < N; i++){
    cin >> A.at(i);
  }
  sort(A.begin(),A.end());
  cout << A.at(N-1) - A.at(0);
}

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

queue<int> q[301];
int visited[301];
int cnt[301];

int main(){
	int n,m;
	scanf("%d%d",&n,&m);
	for(int i=0;i<n;i++){
		for(int j=0;j<m;j++){
			int su;
			scanf("%d",&su);
			q[i].push(su-1);
		}
	}
	int ans = n+1;
	for(int i=0;i<m;i++){
		int mx = 0, mxn = 0;
		for(int j=0;j<m;j++) cnt[j] = 0;
		for(int j=0;j<n;j++){
			while(visited[q[j].front()] == 1){
				q[j].pop();
			}
			cnt[q[j].front()]++;
		}
		for(int j=0;j<m;j++){
			mx = max(mx, cnt[j]);
			if(mx == cnt[j]) mxn = j;
		}
		ans = min(ans, mx);
		visited[mxn] = 1;
		//printf("%d %d\n", mx,mxn);
	}
	printf("%d",ans);
}

Measured memory_bytes: 768
//#include <climits>
#include <vector>
#include <iostream>
//#include <sstream>
// #include <string>
using namespace std;


bool linerSearch(vector<int> &S, int target) {
    for (int i = 0; i < (int)S.size(); ++i)
    {
        if(target == S[i]) {
            return true;
        }
    }

    return false;
}

bool linerSearch2(vector<int> &S, int target) {
    //番兵の追加
    S.resize(S.size()+1);
    S[S.size()] = target; 

    //見つかるまでループを回すだけで良い(番兵なしverと比較して、if文が不要)
    int i = 0;
    while(S[i] != target) {
        i++;
    }

    //見つからないまま最後まで到達したとき
    if(i == (int)S.size()) {
        return false;
    }

    return true;

}



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

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

    int q;
    cin >> q;

    vector<int> T(q);
    for (int i = 0; i < q; ++i)
    {
        cin >> T[i];
    }


    int ans = 0;
    for (int i = 0; i < q; ++i)
    {
        int target = T[i];
        // if(linerSearch(S, target)) {
        //     ans++;
        // }

        //番兵ver
        if(linerSearch2(S, target)) {
            ans++;
        }
    }

    cout << ans << endl;

    return 0;
}


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

#define f first
#define s second
#define pb push_back

#define ll long long

#define mp make_pair

#define int ll

using namespace std;
                        

const int inf = 1e9 + 7;

const ll ll_inf = 1e18 + 7;
const int K = 18;
const int N = 3e5 + 100;
                        

ll binpow (ll a, ll n)
{
    ll res = 1;
    while (n) {
        if (n & 1)
        {
            res *= a;
            res %= inf;
        }
        a *= a;
        n >>= 1;
        a %= inf;
    }                      	
    return res;
}   

void boost()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
}

int sum;                                                                                                

int a;       

main()
{                  
	cin >> a;
	if (a% 10 == 7 || (a / 10) % 10 == 7 || (a / 100) % 10 == 7)
	{
		cout << "Yes";
		return 0;
	}	
	cout << "No";
}

Measured memory_bytes: 3588
#include<cstdio>
#include<string>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;

int main(){
    char a[4][4];
    scanf("%s%s%s",a[0],a[1],a[2]);
    printf("%c%c%c\n",a[0][0],a[1][1],a[2][2]);
    return 0;
}


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

int main() {
  int a, b, x;
  cin >> a >> b;
  
  x = a * b;
  if (x % 2 == 1){
    cout << "Odd" << endl;
  }
  
  else{
    cout << "Even" << endl;
  }
}


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

int main()
{
	int n,sum=0;
	cin>>n;
	vector<pair<int,int>>v(n);
	for(int i=0;i<n;i++)
	{
		cin>>v[i].second>>v[i].first;
	}
	sort(v.begin(),v.end());
	for(int i=0;i<n;i++)
	{
		sum+=v[i].second;
		if(sum>v[i].first)
		{
			cout<<"No"<<endl;
			return 0;
		}
	}
	cout<<"Yes"<<endl;
	return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define int long long
#define endl '\n'
#define FOR(i, a, n) for (int i = (a); i < (n); ++i)
#define REP(i, n) FOR(i, 0, n)
using namespace std;

void _main() {
    int H, W;
    cin >> H >> W;
    vector<string> c(H);
    vector<pair<int, int>> pos;
    REP (i, H) {
        cin >> c[i];
        REP (j, W) if (c[i][j] == 'B') {
            pos.emplace_back(i, j);
            break;
        }
        for (int j = W - 1; j >= 0; --j) if (c[i][j] == 'B') {
            pos.emplace_back(i, j);
            break;
        }
    }
    sort(pos.begin(), pos.end());
    pos.erase(unique(pos.begin(), pos.end()), pos.end());
    int ans = 0;
    for (int i = 0; i < pos.size(); ++i) {
        for (int j = 0; j < pos.size(); ++j) {
            ans = max(ans, abs(pos[i].first - pos[j].first) + abs(pos[i].second - pos[j].second));
        }
    }
    cout << ans << endl;
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(10);
    _main();
    return 0;
}


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

int main(){
  string S,T;
  cin >> S >> T;
  int t=T.size(),s=S.size();
  set<string> ans;
  for (int i=0;i<s-t+1;i++){
    bool checked=true;
    for (int j=0;j<t;j++){
      if (!(S[i+j]==T[j]||S[i+j]=='?')){
        checked=false;
      }
    }
    if (checked){
      string S2=S;
      for (int j=0;j<t;j++){
        S2[i+j]=T[j];
      }
      for (int k=0;k<s;k++){
        if (S2[k]=='?'){
          S2[k]='a';
        }
      }
      ans.insert(S2);
    }
  }
  if (!ans.empty()){
    cout << *ans.begin() << endl;
  }
  else {
    cout << "UNRESTORABLE" << endl;
  }
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void){
  int a, b, c;
  
  scanf("%d %d %d", &a, &b, &c);
  if(a + b + c <= 21){
     printf("win\n");
  }
  else{
     printf("bust\n");
  }
  
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <string.h>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <stdio.h>
#include <vector>
#define int long long
#define endre getchar();getchar();return 0
#define moder 1000000007
#define inf 1000000000000000007
#define rep(i,n) for(int i=0;i<n;i++)
#define P pair<int,int>
#define all(v) v.begin(),v.end()
#define prique(T) priority_queue<T,vector<T>,greater<T>>
#define vecunique(vec) sort(vec.begin(), vec.end());decltype(vec)::iterator result = std::unique(vec.begin(), vec.end());vec.erase(result, vec.end())
using namespace std;
bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (x < y)swap(x, y);
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x * y / gcd(x, y);
}
int mod_pow(int x, int y, int mod) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x%mod;
		}
		x = x * x%mod;
		y >>= 1;
	}
	return res;
}

/*--------Library Zone!--------*/

string s;
signed main() {
	cin >> s;
	for (int i = 0; i < s.size() - 1; i++) {
		if (s[i] == s[i + 1]) {
			cout << i + 1 << " " << i + 2 << endl;
			endre;
		}
	}
	for (int i = 0; i < s.size() - 2; i++) {
		if (s[i] == s[i + 1] || s[i] == s[i + 2] || s[i + 1] == s[i + 2]) {
			cout << i + 1 << " " << i + 3 << endl;
			endre;
		}
	}
	cout << -1 << " " << -1 << endl;
	endre;
}


Measured memory_bytes: 512
#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <string>
#include <numeric>
#include <cmath>
#include <bitset>

#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
using P = pair<ll, ll>;

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

const ll MOD = 1000000007;
const int INF = 1<<30;
//const ll INF = (ll)1e18 + 1;

int main(){
  double A, B, C, D, E, F; cin >> A >> B >> C >> D >> E >> F;

  double max_concentration = 0;
  double mass_all = 0, mass_sugar = 0;
  for (int i = 0; i < 35; ++i){
    for (int j = 0; j < 35; ++j){
      for (int k = 0; k < 3100; ++k){
        if (100 * A * i + 100 * B * j + C * k > F) continue;
        for (int m = 0; m < 3100; ++m){
          if (100 * A * i + 100 * B * j + C * k + D * m <= F && C * k + D * m <= E * (A * i + B * j)) {
            double a = 100 * A * i + 100 * B * j, b = C * k + D * m;
            double concentration = (100 * b) / (a + b);
            if (chmax(max_concentration, concentration)){
              mass_all = a + b;
              mass_sugar = b;
            }
          }
        }
      }
    }
  }
  cout << mass_all << " " << mass_sugar << endl;
}


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

int main() {
    int N, K;
    cin >> N >> K;
    ll mod = 1e9+7;
    vector<int> A(N);
    for (int i = 0; i < N; i++) cin >> A[i];
    
    vector<vector<ll>> dp(N+1, vector<ll>(K+1, 0));
    dp[0][0] = 1;
    for (int i = 0; i < N; i++) {
        ll sum = 0;
        for (int j = 0; j <= K; j++) {
            sum += dp[i][j];
            if (j >= A[i]+1) sum -= dp[i][j-A[i]-1];
            if (sum < 0) sum += mod;
            dp[i+1][j] = sum%mod;
        }
    }
    cout << dp[N][K] << endl;
    return 0;
}

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

#define int long long
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define REP(i, n) for (int i = 0; i < n; ++i)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x) cout << #x << " = " << (x) << endl;
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define SP << " " <<

typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;
typedef vector<int> vec;
typedef vector<P> pvec;
typedef vector<vector<int>> vvec;
typedef vector<vector<P>> pvvec;
typedef priority_queue<int> PQI;
typedef priority_queue<P> PQP;
typedef priority_queue<int,vector<int>,greater<int>> PQIG;
typedef priority_queue<P,vector<P>,greater<P>> PQPG;

const vector<int> DX = {0, -1, 0, 1, 1, 1, -1, -1};
const vector<int> DY = {1, 0, -1, 0, 1, -1, 1, -1};
constexpr int MOD = (1000000007);
// const int MOD = (998244353);
// const int INF = (1 << 30); // 1073741824
const ll INF = (1LL << 60); // 1152921504606846976
const double PI = (3.141592653589794);
const double EPS = (0.0000000001); // 10^(-10)

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return 1;} return 0;}
template<class T> inline T ceil(T a, T b) {return T((a + b - 1) / b);}
template<class T> inline T round(T a, T b) {return T(a / b);}
template< typename T1, typename T2 > istream &operator>>(istream &is, pair< T1, T2 > &p) { is >> p.first >> p.second; return is; }
template <class T> inline void out(T &a) { bool flag=true; for(auto&x:a){if(flag) {flag=false;} else{ cout << ' '; } cout<<x; } cout << endl; }



//----------------------------------------------------------------
int nmax=200000; // 2*(10^5)
vvec G(nmax);





void solve4ts()
{
  
  
  int n;
  cin>>n;

  vector<int> a(n);
  rep(i,n) cin >> a[i];
  
  vec r=a;
  vec l=a;

  rep(i,n-1){
    r[i+1]=r[i]^a[i+1];
  }
  
  for(int i=n-1;i>=1;i--){
    l[i-1]=l[i]^a[i-1];
  }

  vec ans(n);

  ans[0]=l[1];
  ans[n-1]=r[n-2];

  for(int i=1;i<n-1;i++){
    ans[i]=r[i-1]^l[i+1];
  }

  out(ans);

  
}
//-----------------------------------------------------------------

signed main(){ ios::sync_with_stdio(false); cin.tie(0); cout << fixed << setprecision(15);
    int repeat = 1;
    // cin >> repeat;
    while(repeat--) solve4ts();
}

Measured memory_bytes: 14240
#include<stdio.h>
#define MAX 300000

int Abs(int x) {
	if (x >= 0)return x;
	else return -x;
}

int main() {
	int N;
	int A[MAX];
	long long buff, max = -1;
	char ch;

	scanf("%d", &N);
	scanf("%c", &ch);
	for (int i = 0; i < N; i++) {
		scanf("%c", &ch);
		if (ch == 'E')A[i] = 1;
		else if (ch == 'W')A[i] = -1;
	}

	max = 0;
	for (int i = 1; i < N; i++) {
		if (A[i] == 1)max++;
	}
	buff = max;
	for (int j = 1; j < N; j++) {
		if (A[j - 1] == -1)buff += 1;
		if (A[j] == 1)buff -= 1;
		if (max > buff)max = buff;
	}


	printf("%lld\n", max);
	return 0;
}

Measured memory_bytes: 1280
#include"bits/stdc++.h"
using namespace std;

struct Node {
	int in, out;
	bool flag = false;
	vector<int> v;
};

int dfs(vector<Node>& u, int id, int d)
{
	if (u[id].flag) return d - 1;

	int a;
	u[id].in = d;
	u[id].flag = true;
	for (int i = 0; i < u[id].v.size(); i++)
	{
		d = dfs(u, u[id].v[i], d + 1);

	}
	u[id].out = d + 1;
	return d + 1;
}

int main(void)
{
	int N, id, k, x;
	Node z;
	cin >> N;
	vector<Node> u(N + 1);
	for (int i = 0; i < N; i++)
	{
		cin >> id >> k;
		for (int j = 0; j < k; j++)
		{
			cin >> x;
			u[id].v.push_back(x);
		}
	}

	int d = 0;
	for(int i = 1; i <= N; i++) d = dfs(u, i, d + 1);

	for (int i = 1; i <= N; i++) cout << i  << " " << u[i].in << " " <<  u[i].out << endl;

	return 0;
}


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

int main() {
  int n;
  cin >> n;
  bool a = true;
  vector<int> vec(n);
  for(int i = 0;i < n;i++) {
    cin >> vec.at(i);
  }
  for(int i = 0;i < n;i++) {
    if(vec.at(i)%2 == 0) {
      if(vec.at(i)%3!=0 && vec.at(i)%5!=0) {
        a = false;
      }
    }
  }
  if(a) {
    cout << "APPROVED" <<endl;
  }
  else {
    cout << "DENIED" <<endl;
  }
}

Measured memory_bytes: 256
N, Q = map(int, input().split())

values = [0] * N
links = [[] for _ in range(N)]
for _ in range(N - 1):
    a, b = map(int, input().split())
    links[a - 1].append(b - 1)
    links[b - 1].append(a - 1)
for _ in range(Q):
    p, x = map(int, input().split())
    values[p - 1] += x

s = [(0, -1)]
while s:
    i, p = s.pop()
    for j in links[i]:
        if j == p:
            continue
        values[j] += values[i]
        s.append((j, i))
print(*values)


Measured memory_bytes: 60392
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define INF pow(10,10)
#define M 1000000007
ll n;
vector<vector<vector<double>>> memo(305,vector<vector<double>>(305,vector<double>(305,-1)));

double sushi(ll x, ll y, ll z){
    if(memo[x][y][z]!=-1)return memo[x][y][z];
    double a=0,b=0,c=0;
    if(0<x) a = sushi(x-1,y+1,z) * (double)x/(x+y+z);
    if(0<y) b = sushi(x,y-1,z+1) * (double)y/(x+y+z);
    if(0<z) c = sushi(x,y,z-1) * (double)z/(x+y+z);
    memo[x][y][z] = a+b+c + (double)n/(x+y+z);
    return memo[x][y][z];
}

int main(void){
    cin >> n;
    vector<ll>cnt(4,0);
    for(int i=0;i<n;i++){
        ll tmp; cin >> tmp;
        cnt[tmp]++;
    }
    memo[0][0][1]=n;
    printf("%.10f\n",sushi(cnt[3],cnt[2],cnt[1]));
    // return 0;

    // for(int i=0;i<3;i++){
    //     for(int j=0;j<3;j++){
    //         for(int k=0;k<3;k++){
    //             cout << memo[i][j][k] << ' ';
    //         }cout << endl;
    //     }cout << endl;
    // }cout << endl;
}

Measured memory_bytes: 225664