akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
#define REP(var, a, b) for (int var = (a); var < (b); var++)
#define rep(var, n) for (int var = 0; var < (n); ++var)
#define ALL(c) (c).begin(), (c).end()
#define rALL(c) (c).rbegin(), (c).rend()
ll MOD = 1000000007;
ll INF = 1000000000;

int main() {
  //
  string s;
  cin >> s;
  ll a = 0, b = 0, c = 0;
  rep(i, s.size()) {
    if (s[i] == 'a')
      a++;
    else if (s[i] == 'b')
      b++;
    else
      c++;
  }
  if (abs(a - b) <= 1 && abs(b - c) <= 1 && abs(c - a) <= 1) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
  return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
int n;
int a[105];
bool can(int x) {
	int sum = 0;
	for(int i = 0; i < n; i++) {
		sum += a[i];
		sum -= x;
		if(sum < 0) {
			return false;
		}
	}
	return true;
}
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);  
	cin >> n;
	for(int i = 0; i < n; i++) {
		cin >> a[i];
	}
	int l = 1, r = 100;
	while(r - l > 1) {
		int mid = (l + r) / 2;
		if(can(mid)) l = mid;
		else r = mid;
	}
	cout << (can(l) ? l : r) << endl;
	return 0;	
}



Measured memory_bytes: 3208
//Bismillah hirrahmanir Rahim
        #include<bits/stdc++.h>
        #define ll long long
        #define pb push_back
        #define dbug printf("I am here\n");
        #define Fast ios_base::sync_with_stdio(false); cin.tie(0);
        const int m = 10e6;
        using namespace std;

        int main(){
         long long int a,b,tst,k;
         string s;
         cin>>s;
        if(s[1]=='R')cout<<"ABC"<<endl;
        else cout<<"ARC"<<endl;
           return 0;

        }


Measured memory_bytes: 3624
#include <iostream>
#include <set>

using namespace std;

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

  set<int> a;
  for(int i=0; i<n; i++){
    int temp;
    std::cin >> temp;
    a.insert(temp);
  }
  if( a.size() == n ) std::cout << "YES" << '\n';
  else std::cout << "NO" << '\n';
  return 0;
}


Measured memory_bytes: 9600
#include <iostream>

using namespace std;

int main(void) {
 
    int N;
    int v[200000];
    
    cin >> N;
    
    for (int i = 0; i < N; ++i) {
        
        cin >> v[i];
        
    }
    
    for (int i = N -1; i >= 0; i -= 2) {
        
        cout << v[i] << ' ';
        
    }
    
    int k;
    
    if (N % 2 == 0) {
        
        k = 0;
        
    }
    else {
        
        k = 1;
        
    }
    
    for (; k < N; k += 2) {
        
        cout << v[k] << ' ';
        
    }
    
    return 0;
    
}

















Measured memory_bytes: 2944
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define EPS (1e-7)
#define INF (1e9)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
const double PI = acos(-1);
const ll MOD = 1000000007;
// const ll MOD = 998244353;
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;
}
///////////////////////////////////////////////////////////////
 
int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    int N,K; cin >> N >> K;
    ll L,R; cin >> L >> R;
    vector<ll> a(N);
    rep(i,N) cin >> a[i];

    int M = N/2;
    vector<vector<ll>> left(M+1),right(N-M+1);
    for (int tmp = 0; tmp < (1 << M); tmp++) {
        bitset<20> s(tmp);
        ll num = 0;
        rep(i,M) {
            if (s.test(i)) num += a[i];  
        }

        left[s.count()].emplace_back(num);
    }
    for (int tmp = 0; tmp < (1 << (N-M)); tmp++) {
        bitset<20> s(tmp);
        ll num = 0;
        rep(i,(N-M)) {
            if (s.test(i)) num += a[M+i];  
        }
        right[s.count()].emplace_back(num);
    }

    rep(i,M+1) sort(all(left[i]));
    rep(i,N-M+1) sort(all(right[i]));

    ll cnt = 0;
    rep(i,min(M+1,K+1)) {
        if (K - i > N - M) continue;
        if (right[K-i].empty()) continue;
        for (auto num : left[i]) {
            cnt += (upper_bound(all(right[K-i]),R-num) - lower_bound(all(right[K-i]),L-num));
        }
    }

    cout << cnt << endl;

}


Measured memory_bytes: 23388
#include "bits/stdc++.h"
#define esc(ret) cout << (ret) << endl,quick_exit(0)
#define fcout(d) cout << fixed << setprecision(d)
#define repU(i,s,t) for(int i = (int)(s); i <= (int)(t); ++i)
#define repD(i,s,t) for(int i = (int)(s); i >= (int)(t); --i)
#define rep(i,n) repU(i,0,n - 1)
#define rep1(i,n) repU(i,1,n)
#define all(v) begin(v),end(v)
#define vct vector
#define prique priority_queue
#define l_bnd lower_bound
#define u_bnd upper_bound
#define puf push_front
#define pub push_back
#define pof pop_front
#define pob pop_back
#define mkp make_pair
#define mkt make_tuple
#define fir first
#define sec second
#define qceil(n,d) ((n) > 0 ? ((n) - 1) / (d) + 1 : (n) / (d))
#define parity(a,b) ((a) & 1 == (b) & 1)

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef pair<int,int> pii;
typedef pair<db,int> pdi;

const pii dir[] = { {1,0},{0,1},{-1,0},{0,-1},{1,1},{-1,1},{-1,-1},{1,-1} };
const int mod = 1e9 + 7;
const int inf32 = (1 << 30) - 1;
const ll inf64 = (1LL << 62) - 1;

db bfs[1010];
db x[1010],y[1010],r[1010];

db cal(int i, int j){
	return max(0.0,sqrt(pow(x[i] - x[j],2) + pow(y[i] - y[j],2)) - r[i] - r[j]);
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int xt,yt,N;
	cin >> x[0] >> y[0] >> xt >> yt >> N;
	x[N + 1] = xt,y[N + 1] = yt;
	rep1(i,N) cin >> x[i] >> y[i] >> r[i];
	r[0] = r[N + 1] = 0.0;
	fill(all(bfs),inf64);
	bfs[0] = 0.0;
	prique<pdi,vct<pdi>,greater<pdi>> que;
	que.push({0.0,0});
	while(!que.empty()){
		db d = que.top().fir;
		int v = que.top().sec;
		que.pop();
		if(v == N + 1) break;
		if(bfs[v] < d) continue;
		rep(i,N + 2){
			db tmp = d + cal(i,v);
			if(bfs[i] > tmp) que.push({bfs[i] = tmp,i});
		}
	}
	fcout(11) << bfs[N + 1] << endl;
}



Measured memory_bytes: 6256
import sys
input = sys.stdin.readline

N = int(input())
E = [[] for _ in range(N)]
for _ in range(N-1):
    a, b = list(map(int, input().split()))
    E[a-1].append(b-1)
    E[b-1].append(a-1)

DF = [None]*N
DF[0] = 0
queue = [0]
while queue:
    queue_new = []
    for q in queue:
        for e in E[q]:
            if DF[e] is not None: continue
            DF[e] = DF[q]+1
            queue_new.append(e)
    queue = queue_new

DS = [None]*N
DS[N-1] = 0
queue = [N-1]
while queue:
    queue_new = []
    for q in queue:
        for e in E[q]:
            if DS[e] is not None: continue
            DS[e] = DS[q]+1
            queue_new.append(e)
    queue = queue_new
    
NF, NS = 0, 0
for df, ds in zip(DF,DS):
    if df<=ds: NF+=1
    else: NS+=1

print('Fennec' if NF>NS else 'Snuke')

Measured memory_bytes: 35316
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pli = pair<ll, int>;
using pil = pair<int, ll>;
using uint = unsigned int;
using matrix = vector<vector<uint>>;
template <typename T>
using Graph = vector<vector<T>>;
const int MOD = 1e9 + 7;
const ld PI = acos(-1);

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

    int N, M;
    cin >> N >> M;

    ll sum = 0;
    for (int i = 0; i < M; ++i) {
        int A;
        cin >> A;
        sum += A;
    }

    cout << max<ll>(N - sum, -1) << endl;
    return 0;
}


Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a,b;
  cin >> a >> b;
  
  int x;
  x = a * b;

  if ( x % 2 == 0){
    
    cout << "Even" << endl;
  } else {
    
    cout << "Odd" << endl;
  }
}

Measured memory_bytes: 3580
n, m = map(int, input().split())
# one attempt 1/2^m
# two attempts (1-1/2^m) * 1/2^m
# x attempts (1 - 1/2^m)**(x-1) * 1/2^m
exec = m * 1900 + 100 * (n - m)
a = 1 / (2 ** m)
b = 1 - a
left = 1
x = 0
prob = 1
att = 0
while prob > 1e-9:
    att += 1
    prob = left * a
    x += prob * att * exec
    #print(prob, x)
    left *= b
print(int(x + .5))

Measured memory_bytes: 3064
#include <iostream>


using namespace std;


int main(void)
{
        int d;

        cin >> d;
        cin >> d;
        cin >> d;
        cin >> d;

        if (d == 1) {
                cout << '1' << endl;
        } else {
                cout << '0' << endl;
        }

        return 0;
}

Measured memory_bytes: 888
#include"bits/stdc++.h"
using namespace std;
using ll = int64_t;

int main() {
	ll M, K;
	cin >> M >> K;

	const ll N = (1 << M);

	if (K == 0) {
		for (ll i = 0; i < N; i++) {
			cout << i << " " << i << " \n"[i == N - 1];
		}
		return 0;
	}

	if (M <= 1 && K == 1 || K >= N) {
		cout << -1 << endl;
		return 0;
	}

	//Kを分解
	ll a, b;

	for (ll i = 0; i < N; i++) {
		if (i == K) {
			continue;
		}

		if ((K ^ i) != K) {
			a = i;
			b = K ^ i;
			break;
		}
	}

	vector<ll> ans;

	ans.push_back(a);

	for (ll i = 0; i < N; i++) {
		if (i != a && i != b && i != K) {
			ans.push_back(i);
		}
	}

	ans.push_back(K);

	for (ll i = N - 1; i >= 0; i--) {
		if (i != a && i != b && i != K) {
			ans.push_back(i);
		}
	}

	ans.push_back(a);
	ans.push_back(b);
	ans.push_back(K);
	ans.push_back(b);

	for (ll i = 0; i < ans.size(); i++) {
		cout << ans[i] << " \n"[i == (ans.size() - 1)];
	}
}

Measured memory_bytes: 3952
#include <vector>
#include <iostream>
#include <utility>
#include <algorithm>
#include <string>
#include <deque>
#include <queue>
#include <tuple>
#include <queue>
#include <functional>
#include <cmath>
#include <iomanip>
#include <map>
#include <set>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
#include <complex>
#include <iterator>
#include <array>
#include <memory>
#include <stack>
#define vi vector<int>
#define vvi vector<vector<int> >
#define ll long long int
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define all(in) in.begin(), in.end()
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
#define MAX 9999999
using namespace std;
typedef pair<int, int> pii;
typedef pair<double,double>pdd;
typedef pair<ll,ll>pll;
int main(){
    string s; cin>>s;
    string t; cin>>t;
    vector<string>res;
    int index=0;
    for(int i=0;i<s.size();i++){
        bool flag=true;
        int temp=i;
        for(int j=0;j<t.size();j++){
            if(temp+j>(int)s.size()-1){flag=false;break;}
            if(s[temp+j]=='?')continue;
            else if(s[temp+j]==t[j])continue;
            else flag=false;
        }
        
        if(!flag)continue;
        cmax(index,i);
        string foo;
        for(int j=0;j<s.size();j++){
            if(j==index){
                foo+=t;
                rep(i,(int)t.size()-1)j++;
            }else if(s[j]=='?')foo.push_back('a');
            else
                foo.push_back(s[j]);
        }
        res.push_back(foo);
    }
    sort(all(res));
    if(res.size())cout<<res[0]<<endl;
    else cout<<"UNRESTORABLE"<<endl;
}



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

using namespace std;

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

int main(void)
{
  int n, m;
  int A[105];
  int B[105];
  int ans[2];
  while(cin >> n >> m){
    if(n == 0 && m == 0) break;
   
    
    ans[0] = 0;
    ans[1] = 0;
    for(int i = 0; i < n; i++) cin >> A[i];
    for(int i = 0; i < m; i++) cin >> B[i];
    
    int sum1 = 0;
    int sum2 = 0;
    
    for(int i = 0; i < n; i++) sum1 += A[i];
    for(int i = 0; i < m; i++) sum2 += B[i];

    int min = 1000000;

    for(int i = 0; i < n; i++){
      for(int j = 0; j < m; j++){
	if(sum1 - A[i] + B[j] == sum2 - B[j] + A[i] && min > A[i] + B[j]){
	  ans[0] = A[i];
	  ans[1] = B[j];
	  min = A[i] + B[j];
	}
      }
    }
    
    if(ans[0] == 0) cout << -1 << endl;
    else cout << ans[0] << " " << ans[1] << endl;
   
  }
    return 0;
}

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


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

    int toppingCnt = 0;
    for (int i = 0; i < s.size(); ++i) {
        if (s[i] == 'o') ++toppingCnt;
    }

    cout << 700 + toppingCnt * 100 << endl;

}


Measured memory_bytes: 3584
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int i =0;
int[][] a = new int[300][2];
while (true) {
int H = sc.nextInt();
int W = sc.nextInt();
if (H == 0 && W == 0) {
break; }
a[i][0]=H;
a[i++][1]=W;
}

for (int k=0;k<i;k++){
	for (int j=0;j<a[k][1];j++){
		System.out.print("#");
} 
System.out.print("\n");
	for (int l=0;l<a[k][0]-2;l++){
		System.out.print("#");
	for (int j=0;j<a[k][1]-2;j++){
		System.out.print(".");
} System.out.println("#");}
for (int j=0;j<a[k][1];j++){
		System.out.print("#");
} System.out.print("\n");
System.out.print("\n");
	}

}
 }



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

#define pb push_back
#define mk make_pair
#define fi first
#define se second
#define eb emplace_back

typedef long long ll;
typedef pair<int,int> ii;
typedef vector< pair<int,int> > vii;
const int INF = 0x3f3f3f3f;

int n,m;
priority_queue<int, vector<int> > pq;
 
int main() {
    ios_base::sync_with_stdio(false);
    cin >> n >> m;

    for(int i = 0; i < n; i++) {
        int x; cin >> x;
        pq.push(x);
    }

    while(m--) {
        int at = pq.top(); 
        pq.pop();
        if(at) at /= 2;
        pq.push(at);
    }

    ll ans = 0;
    while(!pq.empty()) ans += pq.top(), pq.pop();
    cout << ans << endl;

        

    
    
    return 0;
}



Measured memory_bytes: 892
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll, ll> Pll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repn(i, n) for (int i = 0; i <= (int)(n); i++)
#define srep(i, l, n) for (int i = l; i < (int)(n); i++)
#define srepn(i, l, n) for (int i = l; i <= (int)(n); i++)
#define pb push_back 
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

const int MOD = 1000000007;
const int INF = 1e9;
#define PI 3.14159265369;
int dx[4] = {1,-1,0,0};
int dy[4] = {0,0,1,-1};
int ddx[8] = {1,1,1,-1,-1,-1,0,0};
int ddy[8] = {0,1,-1,0,1,-1,1,-1};

int n, m;
vector<int> ans;
vector<vector<int>> e;


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

	cin >> n >> m;
	ans.assign(n,-1);
	e.resize(n);
	rep(i,m) {
		int a,b;
		cin >> a >> b;
		a--;b--;
		e[a].push_back(b);
		e[b].push_back(a);
	}
	queue<P> q;
	q.push(P(0,-2));
	while(!q.empty()) {
		P p = q.front();
		q.pop();
		int now = p.first;
		int pre = p.second;
		for(auto a: e[now]){
			if(a!=pre&&ans[a]==-1){
				ans[a] = now;
				q.push(P(a, now));
			}
		}
	}
	for(int i = 0; i < n; i++){
		if(i!=0&&ans[i]==-1) {
			cout << "No";
			return 0;
		}
	}
	cout << "Yes" << endl;
	for(int i = 1; i < n; i++){
		cout << ans[i]+1 << endl;
	}

}

Measured memory_bytes: 10392
#![allow(unused_imports)]
#![allow(unused_variables)]

use itertools::Itertools;
use proconio::marker::*;
use proconio::*;

#[fastout]
fn main() {
    input! {
        n: String
    }

    let num = n.chars().map(|x| x as i32 - 48).sum::<i32>();

    println!("{}", if num % 9 == 0 { "Yes" } else { "No" });
}


Measured memory_bytes: 2396
import java.util.Scanner;

public class Main {

	@SuppressWarnings("resource")
	public static void main(String args[]) {
		Scanner scanner = new Scanner(System.in);
		String s = scanner.next();

		for (int i = 0; i < 10; i++) {
			if (i == 3) {
				System.out.print("8");
			} else {
				System.out.print(s.charAt(i));
			}
		}

	}
}


Measured memory_bytes: 23252
n = gets.chomp.to_i
           
left = Array.new

alphabet = ('a'..'z').to_a


while n > 0 do
  left << (n-1) % 26
  n = (n-1) / 26                                                                                                                                                                                                                                                                                                                                                                        
end

txt = ''

left.reverse.each do |x|
  txt << alphabet[x]
end

puts txt

Measured memory_bytes: 14284
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
using namespace std;

int main()
{
	int n,a,b;
	scanf("%d%d%d",&n,&a,&b);
	if (a>b) swap(a,b);
	if (abs(b-a-1)%2==0) puts("Borys");
	else puts("Alice");
	return 0;
}

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

int main() {
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  
  if (A + B < C + D) cout << "Right" << endl;
  
  else if (A + B > C + D) cout << "Left" << endl;
  else cout << "Balanced" << endl;
  
  // ここにプログラムを追記
}

Measured memory_bytes: 256
#include <cstdio>
#include <vector>
#include <algorithm>

using namespace std;

vector<int> G[1000000];
vector<pair<int, int> > bridge;
vector<int> articulation;
int ord[1000000], low[1000000];
bool vis[1000000];

void dfs(int v, int p, int &k)
{
	vis[v] = true;
	
	ord[v] = k++;
	low[v] = ord[v];
	
	bool isArticulation = false;
	int ct = 0;
	
	for (int i = 0; i < G[v].size(); i++){
		if (!vis[G[v][i]]){
			ct++;
			dfs(G[v][i], v, k);
			low[v] = min(low[v], low[G[v][i]]);
			if (~p && ord[v] <= low[G[v][i]]) isArticulation = true;
			if (ord[v] < low[G[v][i]]) bridge.push_back(make_pair(min(v, G[v][i]), max(v, G[v][i])));
		}
		else if (G[v][i] != p){
			low[v] = min(low[v], ord[G[v][i]]);
		}
	}
	
	if (p == -1 && ct > 1) isArticulation = true;
	if (isArticulation) articulation.push_back(v);
}

int main()
{
	int n, m;
	
	scanf("%d %d", &n, &m);
	
	for (int i = 0; i < m; i++){
		int x, y;
		scanf("%d %d", &x, &y);
		G[--x].push_back(--y);
		G[y].push_back(x);
	}
	
	int k = 0;
	for (int i = 0; i < n; i++){
		if (!vis[i]) dfs(i, -1, k);
	}
	
	sort(bridge.begin(), bridge.end());
	
	printf("%d\n", bridge.size());
	
	return (0);
}

Measured memory_bytes: 26880
n,m = map(int,input().split())
fr = {}
t = {}
for i in range(m):
    a,b = map(int,input().split())
    if a == 1:
        fr[b] = 1
    if b == n:
        t[a] = 1

flag = False
for kk in t.keys():
    if kk in fr:
        flag = True
        break

if flag:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")


Measured memory_bytes: 24116
#include <iostream>
#include <string>
#include <cstdio>

using namespace std;

int main()
{
    double ans = 0;
    int N;
    cin >> N;
    for (int i = 0; i < N; i++)
    {
        double x;
        cin >> x;
        string type;
        cin >> type;
        if (type == "JPY")
        {
            ans += x;
        }
        else
        {
            ans += x * 380000.;
        }
    }

    printf("%.10f\n", ans);
}

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

int main(){
  int a[6],mn=10,sum=0,j;
  for(int i = 1;i<=5;i++){
    cin >> a[i];
    if(mn>a[i]%10 && a[i]%10) mn =  a[i]%10,j=i;
  }
  for(int i = 1;i<=5;i++){
    if(i==j)sum+=a[j];
    else{
        if(a[i]%10)
        a[i]=a[i]+ 10 - a[i]%10;
        sum+=a[i];

    }
  }
  cout<< sum <<endl;
return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
using namespace std;
typedef long long ll;
int main()
{
 
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  string s;
  cin>>s;
  if(s[2]==s[3])
  {
   if(s[4]==s[5])
   {
    cout<<"Yes";
    return 0;
   }
  }
  cout<<"No";
   
   
  return 0;
}

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

#define MP make_pair
#define PB push_back
#define ST first
#define ND second

using namespace std;

typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<PII> VII;
typedef long long LL;

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

string a, b;
int x, y;

int main()
{
    init_ios();
    int n;
    cin >> n;
    cin >> a >> b;
    int co = n;
    for (; co >= 1; --co) {
    	if (b.substr(0, co) == a.substr(n-co))
    		break;
    }
    cout<<2*n-co<<"\n";
}

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

using namespace std;

#define REP(var, n)  for (int var = 0; var < (n); var++)
#define RREP(var, n)  for (auto var = n - 1; var != static_cast<int>(-1); var--)
#define FOR(var, a, b)  for (auto var = (a); var < (b); var++)
#define RFOR(var, a, b)  for (auto var = b - 1; var != a; var--)

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<int, int> pii;

#define all(c) begin(c),end(c)

#define D(x) do { std::cerr << x << " "; } while (0)
#define D2(x) do { std::cerr << #x << ": " << x << std::endl; } while (0)


template<typename T>
std::ostream &operator<<(std::ostream &out, const std::vector<T> &v) {
    if (!v.empty()) {
        out << '[';
        std::copy(v.begin(), v.end(), std::ostream_iterator<T>(out, ", "));
        out << "\b\b]";
    }
    return out;
}


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


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

auto solve() {
    int N;
    cin >> N;
    vvll a(N, vll(N, 0));
    REP(i, N) REP(j, N) cin >> a[i][j];

    int S = 1 << N;
    vll dp(S, 0);

    vll ones(S, 0);
    REP(i, S) {
        REP(j, N) {
            if ((i >> j) % 2 == 1) {
                FOR(k, j + 1, N) {
                    if ((i >> k) % 2 == 1) {
                        ones[i] += a[j][k];
                    }
                }
            }
        }
    }

    REP(i, S) {
        ll res = ones[i];

        for (int U = (1 << N) - 1; U >= 0; --U) {
            U &= i;
            int IU = i - U;
            ll sum = dp[U] + dp[IU];
            chmax(res, sum);
        }

        chmax(dp[i], res);
    }

    return dp[S - 1];
}


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

//    cout << (solve() ? "Heisei" : "TBD") << endl;
//    cout << (solve() ? "YES" : "NO") << endl;
    cout << solve() << endl;
//    solve();

    return 0;
}

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

int main() {
  int n, k; cin >> n >> k;
  vector<int> a(n); for(int i = 0; i < n; i++) cin >> a[i];
  for(int i = k; i < n; i++) {
    if(a[i] > a[i-k]) cout << "Yes" << endl;
    else cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 4036
n=gets.to_i;
v=0;w=1;
n.times do
	a,b=gets.split.map &:to_i
	case a
	when 1
		v+=b*w;
	when 2
		v-=b*w;
	when 3
		v*=b;
	when 4
		w*=b;
	end
end
p(v/w);

Measured memory_bytes: 143800
import sys


inint = lambda: int(sys.stdin.readline())
inintm = lambda: map(int, sys.stdin.readline().split())
inintl = lambda: list(inintm())
instrm = lambda: map(str, sys.stdin.readline().split())
instrl = lambda: list(instrm())

n, m, x = inintm()
A = inintl()

h = 0
l = 0

for a in A:
    if a < x:
        l += 1
    else:
        h += 1

print(min(h, l))


Measured memory_bytes: 62004
#include<cstdio>
#include<iostream>
#include<queue>
#include<cstring>
#define ll long long
using namespace std;
int n,m,doe,flag;
int pre[804040],son[804040],now[201010];
ll f[201010],v[804040];
bool br[201010],ok[201010];
void add(int x,int y,ll z)
{
	++doe;
	pre[doe]=now[x];
	now[x]=doe;
	son[doe]=y;
	v[doe]=z;
}
void spfa(int x)
{
	br[x]=1;
	int p=now[x];
	while (p)
	{
		int y=son[p];
		if (f[y]>f[x]+v[p])
		{
			if (br[y]||flag) {flag=1;return;}
			f[y]=f[x]+v[p];
			spfa(y);
		}
		p=pre[p];
	}
	br[x]=0;
}
int main()
{
//	freopen("D.in","r",stdin);
	scanf("%d%d",&n,&m);
	int x,y,z;
	for (int i=1;i<=m;++i)
	{
		scanf("%d%d%d",&x,&y,&z);
		add(x,y,z);
		add(y,x,-z);
	}
	
	memset(f,0x3f3f3f3f,sizeof(f));
	for (int i=1;i<=n;++i)
		if (ok[i]==0)
			{
				f[i]=0;
				spfa(i);
				if (flag)
				{
					printf("No\n");
					return 0;
				}
			}
	printf("Yes\n");
	return 0;
}

Measured memory_bytes: 14080
#include <stdio.h>
#include<math.h>
#include <iostream>
#include<string.h>
#include<algorithm>
using namespace std;
#define mod 1000000007
int main()
{
    char s[5];
    scanf("%s",s);
    if(s[1]=='B')
        printf("ARC\n");
    else
        printf("ABC\n");
    return 0;
}


Measured memory_bytes: 3764
#include <iostream>
#include <vector>
#include <string>
#include <bitset>
#include <cmath>
#include <queue>
#include <iomanip>
using namespace std;

#define INF 1e18
#define int long long

signed main() {
    int n, x; cin >> n >> x;
    vector<int> l(n); for(int i = 0; i < n; i++) cin >> l[i];

    int ans = 0;
    int d = 0;
    for(int i = 0; i <= n; i++) {
        if(d > x) break;
        d += l[i];
        ans++;
    }

    cout << ans << endl;
}


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

int main()
{
  int n,m;
  cin >> n >> m;
  vector<double> score(n);
  double sum=0;
  for(int i=0;i<n;i++){
    cin >> score[i];
  	sum += score[i];
  }
  double limit = sum/(4*m);
  sort(score.begin(),score.end(),greater<int>());
  int count = 0;
  for(int i=0;i<n;i++){
    if(score[i] >= limit) count++;
    if(count == m){
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define rep(i, n) for(int i=0;i<n;++i)
#define rrep(i, n) for(int i=n;i>=0;--i)
const int inf=1e9+7;
const ll mod=1e9+7;
const ll mod1=998244353;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  int N;
  cin>>N;
  ll A[N];
  for(int i=0;i<N;++i) cin>>A[i];
  ll ans1 = 0, ans2 = 0;
  ll sum = 0;
  for(int i=0;i<N;++i) {
    sum += A[i];
    if(i%2==0 && sum<=0) {
      ans1 += 1-sum;
      sum = 1;
    }
    else if(i%2==1 &&  sum>=0){
      ans1 += sum + 1;
      sum = -1;
    }
  }
  
  sum = 0;
  for(int i=0;i<N;++i) {
    sum += A[i];
    if(i%2!=0 && sum<=0) {
      ans2 += 1-sum;
      sum = 1;
    }
    else if(i%2!=1 &&  sum>=0){
      ans2 += sum + 1;
      sum = -1;
    }
  }
  cout<<min(ans1, ans2)<<endl;
}



Measured memory_bytes: 4352
def main():
    n, a, b = map(int, input().split())
    MOD = 10 ** 9 + 7
    ans = pow(2, n, MOD)
    e = 1
    f = 1
    for i in range(1,a+1):
        e *= (n - i + 1)
        f *= i 
        e %= MOD
        f %= MOD
    c = e * pow(f, MOD-2, MOD)
    e = 1
    f = 1
    for i in range(1,b+1):
        e *= (n - i + 1)
        f *= i 
        e %= MOD
        f %= MOD
    d = e * pow(f, MOD-2, MOD)
    ans -= (c + d)
    ans %= MOD
    print(ans-1)



if __name__ == "__main__":
    main()

Measured memory_bytes: 38768
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n;cin>>n;
	vector<int> vec,vec2;
	for(int i=0;i<n;i++){
		int x;cin>>x;
		vec.push_back(x);
	}
	vec2 = vec;
	sort(vec.begin(),vec.end());

	int mid = n/2;
	int ans[n] = {0};
	for(int i=0;i<n;i++){
		int i_ = upper_bound(vec.begin(),vec.end(),vec2[i])-vec.begin();
		if(i_<= mid)
			printf("%d\n",vec[mid]);
		else
			printf("%d\n",vec[mid-1]);
	}
	return 0;
}

Measured memory_bytes: 4724
#include <stdio.h>

int
main(int argc, char *argv[])
{
    unsigned long n, i;

    if (1 != scanf("%lu\n", &n)) {
        fprintf(stderr, "Invalid number of data set.\n");
        return 1;
    }

    for (i = 1; i <= n; i++) {
        unsigned long a, b, c;
        if (3 != scanf("%lu %lu %lu\n", &a, &b, &c)) {
            fprintf(stderr, "Invalid data at line %lu\n", i);
            continue;
        }
        if (!a || !b || !c) {
            puts("NO");
            continue;
        }
        if ( (a*a == (b*b + c*c))
            || (b*b == (c*c + a*a))
            || (c*c == (a*a + b*b) )) {
            puts("YES");
            continue;
        }
        puts("NO");
    }
    return 0;
}

Measured memory_bytes: 588
def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod
mod = 10**9+7
MAX = 4000
g1 = [1, 1]
g2 = [1, 1]
inverse = [0, 1]
for i in range( 2, MAX + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )
n,k= map(int,input().split())
for i in range(1,k+1):
    pre = cmb(k-1,i-1,mod)
    pos = cmb(n-k+1,i,mod)
    print((pre*pos)%mod)

Measured memory_bytes: 3828
n = int(input())
S = list(map(int,input().split()))
q = int(input())
T = list(map(int,input().split()))

def linear_search(A,key):
    i = 0
    A.append(key)
    n = len(A) - 1
    while A[i] != key:
        i += 1
    if i == n:
        return 0
    return 1

cnt = 0
for j in T:
    cnt += linear_search(S,j)

print(cnt)


Measured memory_bytes: 6552
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <tuple>
#include <cassert>

using namespace std;

#define all(c) (c).begin(), (c).end()
#define iter(c) __typeof((c).begin())
#define cpresent(c, e) (find(all(c), (e)) != (c).end())
#define tr(c, i) for (iter(c) i = (c).begin(); i != (c).end(); ++i)
#define pb(e) push_back(e)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define mp(a,b) make_pair((a), (b))
#define mt(a,b,c) make_tuple((a),(b),(c))

typedef long long ll;

int main(){
    string ss; cin >> ss;
    string s;
    for(int i=0;i<ss.length();i++){
        if(ss[i]=='A') s += 'A';
        else if(ss[i]=='B' && i!=s.length()-1 && ss[i+1]=='C'){
            s += 'K';
            i++;
        }else{
            s += 'X';
        }
    }
    //cin >> s;
    int pos = 0;
    long long  ans = 0;
    rep(i, s.length()){
        if(s[i]=='A'||s[i]=='K'){
            long long len = 0;
            while(i!=s.length() && (s[i]=='A'||s[i]=='K')){
                if(s[i]=='A'){len++;}
                else if(s[i]=='K'){ans = ans + len;}
                i++;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1020
#include<iostream>

int main(){
  int m, f, r, sum;
  while(1){
    std::cin >> m >> f >> r;
    if(m == -1 && f == -1 && r == -1) break;
    sum = m + f;
    if(m == -1 || f == -1 || sum < 30){
      std::cout << 'F' << std::endl;
    }else if(sum >= 80){
      std::cout << 'A' << std::endl;
    }else if(65 <= sum && sum < 80){
      std::cout << 'B' << std::endl;
    }else if(50 <= sum && sum < 65){
      std::cout << 'C' << std::endl;
    }else if(30 <= sum && sum < 50){
      if(r >= 50){
	std::cout << 'C' << std::endl;
      }else{
	std::cout << 'D' << std::endl;
      }
    }
  }
  return 0;
}

Measured memory_bytes: 3064
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Yulian
 */



#include <iostream>

#include <fstream>
#include <vector>
#include <set>
#include <cmath>
#include <queue>
#include <deque>
#include <string>
#include <algorithm>
#include <map>
#include <numeric>
#include <limits>




#include <ostream>
#include <sstream>


using namespace std;
class A {
public:
	void solve(std::istream& in, std::ostream& out) {

    ios::sync_with_stdio(false);
    int x, y;
    in >> x >> y;
    if (y < x || y == 2){
      int tmp = x;
      x = y;
      y = tmp;
    }
    if(x == 2){
      out << (y == 2 ? "Yes" : "No") << endl;
      return;
    }
    if((x < 8 && x % 2 == 0) || (x > 8 && x % 2 == 1)){
      out << ((y < 8 && y % 2 == 0) || (y > 8 && y % 2 == 1)? "Yes" : "No") << endl;
      return;
    }
    out << ((y < 8 && y % 2 == 1) || (y >= 8 && y % 2 == 0) ? "Yes" : "No") << endl;

	}
};


int main() {
	A solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=1000000007,MAX=1<<18,INF=1<<30;

int bit[MAX+1],N;

//1-indexed

int sum(int i){
    int s=0;
    while(i>0){
        s+=bit[i];
        i-=i&-i;
    }
    return s;
}

//sからtの和=sum(t)-sum(s-1)

void add(int i,int x){
    while(i<=N){
        bit[i]+=x;
        i+=i&-i;
    }
}

int main(){
    
    string S;cin>>S;
    N=S.size();
    
    for(int i=0;i<N;i++){
        add(i+1,1);
    }
    
    deque<int> when[26];
    for(int i=0;i<N;i++){
        when[S[i]-'a'].push_back(i);
    }
    
    int oddcnt=0;
    
    for(int i=0;i<26;i++){
        if(when[i].size()%2) oddcnt++;
    }
    
    if(oddcnt>=2){
        cout<<-1<<endl;
        return 0;
    }
    
    ll ans=0;
    int i=0,cnt=0;
    bool plus=false;
    for(cnt=0;cnt<N/2;cnt++){
        
        while(when[S[i]-'a'].size()==0||when[S[i]-'a'].front()!=i||when[S[i]-'a'].size()==1){
            if(when[S[i]-'a'].size()==1){
                plus=true;
                //cout<<i<<" "<<cnt<<endl;
            }
            i++;
        }
        
        int l=when[S[i]-'a'].front(),k=when[S[i]-'a'].back();
        ans+=(sum(N)-sum(k+1));
        if(plus) ans++;
        add(l+1,-1);
        add(k+1,-1);
        when[S[i]-'a'].pop_front();
        when[S[i]-'a'].pop_back();
        //cout<<l<<" "<<k<<" "<<ans<<endl;
        i++;
    }
    cout<<ans<<endl;
    
}



Measured memory_bytes: 2052
#include<bits/stdc++.h>
using namespace std;
#define INF 100000000

// 🔴

// O(ElogE)

// pq<pair> はfirstが大きい順に出てくるのですか？
// s:= 開始ノード  v:= 頂点数  adjlist:= 隣接リスト (first:= コスト   second:= 行先)
vector<int> dijk(int s, int v, vector<vector<pair<int, int> > > adjlist){
    
    priority_queue <pair<int, int> > wait;
    vector<int> result(v, INF);

    //スタート地点を追加
    result[s] = 0;
    wait.push(make_pair(0, s));

    //ダイクストラ本体
    while(!wait.empty()){    //waitが空になるまで

        int nowpoint = wait.top().second;
        int nowcost = -wait.top().first;
        wait.pop();

        if(result[nowpoint] < nowcost) continue;


        //今いる頂点と隣接しているすべての頂点をなめる
        for(int i = 0; i < adjlist[nowpoint].size(); i++){

            int nextpoint = adjlist[nowpoint][i].second;
            int nextcost = nowcost + adjlist[nowpoint][i].first;
            //現時点より安く到達できそうであれば、結果を更新して優先度付きキューに格納
            if(result[nextpoint] > nextcost){
                result[nextpoint] = nextcost;
                wait.push(make_pair(-nextcost, nextpoint));
            }
        }
    }
    
    return result;         //結果列を返す
}

int main(){

    while(1){

    int V, E, S, G1, G2; cin >> V >> E >> S >> G1 >> G2;     // V:= 頂点の数    E:= 辺の数    S:= スタートノード　　G:= ゴールノード
    if(!V) break;
    S--;
    G1--;
    G2--;
    vector<vector<pair<int, int> > > adjlist(V);      //first := コスト　second := 行先

    //入力
    for(int i = 0; i < E; i++){
        int a, b, c; cin >> a >> b >> c;           // a ,b 間に コスト c の辺がある
        a--;
        b--;
        adjlist[a].push_back(make_pair(c, b));
        //adjlist[b].push_back(make_pair(c, a));      
    }

    int ans = INF;
    vector<int> result(V);
    vector<int> res(V);
    result = dijk(S, V, adjlist);
    for(int i = 0; i < V; i++){
        res = dijk(i, V, adjlist);
        ans = min(ans, result[i] + res[G1] + res[G2]);
    }

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


Measured memory_bytes: 3068
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class AtCoderA
{
    static void Main()
    {
        var sc = new Scanner();

        long a = sc.NextLong();
        long b = sc.NextLong();

        string answer = a + b == 15 ? "+" : (a * b == 15 ? "*" : "x");

        Console.WriteLine(answer);
    }

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}


Measured memory_bytes: 27356
import java.util.*;
import java.math.*;
public class Main{
	static int max;
	static int[] dx={0,1,-1,0};
	static int[] dy={1,0,0,-1};
	static int h;
	static int w;
	static char[][] map;
	static boolean[][] mm;
	static int[][] c;
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		h=sc.nextInt();
		w=sc.nextInt();
		map=new char[h][w];
		for(int i=0; i<h; i++){
			String s=sc.next();
			for(int j=0; j<w; j++){
				map[i][j]=s.charAt(j);
			}
		}
		int ans=0;
		for(int i=0; i<h; i++){
			for(int j=0; j<w; j++){
				if(map[i][j]=='#'){
					continue;
				}
				mm=new boolean[h][w];
				c=new int[h][w];
				max=0;
				Queue<Integer> q=new ArrayDeque<>();
				q.add(i);
				q.add(j);
				while(!q.isEmpty()){
					int x=q.poll();
					int y=q.poll();
					if(mm[x][y]){
						continue;
					}
					mm[x][y]=true;
					for(int k=0; k<4; k++){
						int xx=x+dx[k];
						int yy=y+dy[k];
						if(xx>=0 && xx<h && yy>=0 && yy<w && map[xx][yy]=='.' && !mm[xx][yy]){
							q.add(xx);
							q.add(yy);
							c[xx][yy]=c[x][y]+1;
							max=Math.max(max,c[xx][yy]);
						}
					}
				}
				ans=Math.max(ans,max);
			}
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 25200
#include<bits/stdc++.h>
#define int           long long
#define pb            push_back
#define ppb           pop_back
#define si            set <int>
#define endl          '\n'
#define fr            first
#define sc            second
#define mii           map<int,int>
#define msi           map<string,int >
#define mis           map<int,string>
#define rep(i,a,b)    for(int i=a;i<b;i++)
#define f(i,n)   		  for(int  i=0;i<n;i++)
#define all(v)        v.begin(),v.end()
#define sort(v)       sort(all(v))
#define sm(v)			accumulate(v.begin(),v.end(),0)
#define pii           pair<int ,int >
#define vi            vector<int >
#define vii           vector<pair<int , int >>
#define vs            vector<string>
#define sz(x)         (int )x.size()
#define M             1000000007
#define bs            binary_search
#define mp            make_pair
#define sp(n)         setprecision(n)
#define spl           " "
#define arr(a,n)      rep(i,0,n) cin>>a[i]
#define mod           998244353
#define MAX           1000000
    using namespace std;
    void sv(vector<int>v)
    {
        vector<int>::iterator i;
        for(i=v.begin();i!=v.end();i++)
            cout<<*i<<' ';
        cout<<endl;
    }
     
    signed main()
    {
                ios_base::sync_with_stdio(false);
                cin.tie(0);
                cout.tie(0);
                #ifndef ONLINE_JUDGE
            //   freopen("input.txt","r",stdin);
             //  freopen("output.txt","w",stdout);
                #endif
                int t=1;
                //cin>>t;
                while(t--)
                {
                	
                	int n,s=0,p;
                	cin>>n;
                	//p=n;
                	rep(i,1,n)
                	{
                		s=s+i;
                		//p--;
                	}
                	cout<<s;
    }}
    	

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>

using namespace std;

int main()
{
	int N;
	vector <int> d;

	cin >> N;
	for (int i = 0; i < N; i++)
	{
		int val;
		cin >> val;
		d.push_back(val);
	}
	sort(d.begin(), d.end(), greater<int>());

	int cur, next;
	int cnt = 1;
	for (int i = 0; i < d.size()-1; i++)
	{
		cur = d[i];
		next = d[i+1];
		if (cur != next) cnt++;
	}

	cout << cnt << endl;

    return 0;
}


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

int main() {
    int R, G, B, N;
    cin >> R >> G >> B >> N;
    int RR = N / R + 1;
    int GG = N / G + 1;
    int BB = N / B + 1;
    int count = 0;

    for (int i = 0; i < RR; i++) {
        for (int j = 0; j < (N - R * i) / G + 1; j++) {
            if ((N - R * i - G * j) % B == 0) {
                count++;
            }
        }
    }
    cout << count << endl;
}

Measured memory_bytes: 384
#include<iostream>
#include<vector>

using namespace std;

typedef long long ll;

const ll MOD = 1000000007;

namespace comb {
	ll fact[100001];
	ll fact_inv[100001];
	
	ll modpow(ll a, ll b) {
		ll base = 1, kakeru = a;
		while (b > 0) {
			if (b & 1)base *= kakeru, base %= MOD;
			kakeru *= kakeru, kakeru %= MOD;
			b >>= 1;
		}
		return base;
	}

	void setup() {
		fact[0] = 1, fact[1] = 1;
		for (int i = 2; i <= 100000; i++) {
			fact[i] = (fact[i - 1] * i) % MOD;
		}

		fact_inv[100000] = modpow(fact[100000], MOD - 2);

		for (int i = 99999; i >= 0; i--) {
			fact_inv[i] = fact_inv[i + 1] * (i + 1);
			fact_inv[i] %= MOD;
		}

	}

	ll combination(int a, int b) {
		if (a - b < 0)return 0;
		ll ret = fact[a];
		ret *= fact_inv[b], ret %= MOD;
		ret *= fact_inv[a - b], ret %= MOD;
		return ret;
	}

	ll permutation(int a, int b) {
		if (a - b < 0)return 0;
		ll ret = fact[a];
		ret *= fact_inv[a - b], ret %= MOD;
		return ret;
	}

}

int N, K;
vector<vector<int>> E;

ll ans = 1;

ll dfs(int pos, int parent) {
	ll ret = 1;
	if (pos == 0) {
		ret *= K, ret %= MOD;
		ret *= comb::permutation(K - 1, E[pos].size());
		ret %= MOD;
	}
	else {
		ret *= comb::permutation(K - 2, E[pos].size() - 1);
		ret %= MOD;
	}
	for (int i = 0; i < E[pos].size(); i++) {
		int next = E[pos][i];
		if (next == parent)continue;
		ret *= dfs(next, pos);
		ret %= MOD;
	}
	return ret;
}

int main() {

	comb::setup();

	cin >> N >> K;
	E.resize(N);

	for (int i = 0; i < N - 1; i++) {
		int a, b;
		cin >> a >> b;
		a--, b--;
		E[a].push_back(b);
		E[b].push_back(a);
	}

	cout << dfs(0, -1) << endl;

	return 0;
}

Measured memory_bytes: 13184
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

#define MAX 10000
#define INFTY ( 1 << 29 )

class DisjointSet {
    public:
        vector<int> rank, p;

        DisjointSet() {}
        DisjointSet( int size ) {
            rank.resize( size, 0 );
            p.resize( size, 0 );
            for ( int i = 0; i < size; ++i ) makeSet(i);
        }

        void makeSet(int x) {
            p[x] = x;
            rank[x] = 0;
        }

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

        void unite(int x, int y){
            link(findSet(x), findSet(y));
        }

        void link(int x, int y){
            if ( rank[x] > rank[y] ) {
                p[y] = x;
            } else {
                p[x] = y;
                if ( rank[x] == rank[y] ) {
                    rank[y]++;
                }
            }
        }

        int findSet(int x){
            if ( x != p[x] ){
                p[x] = findSet(p[x]);
            }
            return p[x];
        }
};

class Edge {
    public:
        int source, target, cost;
        Edge( int source = 0, int target = 0, int cost = 0 ):
            source(source), target(target), cost(cost) {}
        bool operator < ( const Edge &e ) const {
            return cost < e.cost;
        }
};

int kruskal ( int N, vector<Edge> edges) {
    int totalCost = 0;
    sort(edges.begin(), edges.end());

    DisjointSet dset = DisjointSet(N + 1);

    for ( int i = 0; i < N; ++i ) dset.makeSet(i);

    int source, target;
    for ( int i = 0; i < edges.size(); ++i ) {
        Edge e = edges[i];
        if ( !dset.same( e.source, e.target ) ) {
            totalCost += e.cost;
            dset.unite( e.source, e.target );
        }
    }
    return totalCost;
}

int main(){
    int N, M, cost;
    int source, target;

    cin >> N >> M;

    vector<Edge> edges;
    for ( int i = 0; i < M; ++i ) {
        cin >> source >> target >> cost;
        edges.push_back(Edge(source, target, cost));
    }

    cout << kruskal(N, edges) << endl;

    return 0;
}



Measured memory_bytes: 5404
n = gets.to_i
S = gets.chomp.chars
A = S.uniq
# p A
ans = 0
A.each do |i|
    i_b = S.index(i) + 1
    # p i_b
    b = S[i_b..-1]
    next if b.size == 0
    b = b.uniq
    b.each do |j|
        i_c = S[i_b..-1].index(j) + 1
        c = S[i_b..-1][i_c..-1]
        # p [b,c]
        if !!c 
            c = c.uniq
            ans += c.size
        end
    end
end

puts ans

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

int main(void) {
  //input
  int N;
  cin >> N;
  vector<int> d(N);
  rep(i,N) {
    cin >> d.at(i);
  }
  //calc
  int answer = 0;
  for(int i = 0; i < N; i++) {
    if ( d.at(i) == 0 ) {
      continue;
    }
    for(int j = i+1; j < N; j++) {
      answer += d.at(i) * d.at(j);
    }
  }
  //output
  cout << answer << endl;
}

Measured memory_bytes: 256
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "ctime"

using namespace std;

const long long int MOD = 1000000007;
//const int MOD = 998244353;

//long long int N, M, K, H, W, L, R;
long long int N, M, K, H, W, L, R;


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

	cin >> N;
	L = 0;
	R = N;
	vector<long long int>v(N);
	vector<long double>lg;
	for (auto &i : v)cin >> i;
	for (auto i : v) {
		lg.push_back(log2((long double)i));
	}
	vector<long long int>r(N + 1);
	vector<long long int>l(N + 1);
	stack<int>rht;
	long double st = lg.back();
	for (int i = N - 2; i >= 0; i--) {
		r[i] = r[i + 1];
		while (st < lg[i]) {
			st += log2((long double)4);
			if(rht.empty())	r[i] += 2 * (N - i - 1);
			else {
				r[i] += 2 * (rht.top() - i);
				rht.pop();
			}
		}
		for (long double j = lg[i]+2; j <= lg[i + 1]; j += 2) {
			rht.push(i);
		}
		st = lg[i];
	}
	auto w = v;
	stack<int>lft;
	st = lg.front();
	lg.push_back(-1000);
	for (int i = 1; i <= N; i++) {
		l[i] = l[i - 1];
		while (st < lg[i]) {
			st += log2((long double)4);
			if (lft.empty())	l[i] += 2 * i;
			else {
				l[i] += 2 * (i - lft.top());
				lft.pop();
			}
		}
		for (long double j = lg[i]+2; j <= lg[i - 1]; j += 2) {
			lft.push(i);
		}
		st = lg[i];
	}
	//for (int i = 0; i <= N; i++) {
	//	cout << i << " " << l[i] << " " << r[i] << endl;
	//}
	long long int ans = r[0];
	for (int i = 1; i <= N; i++)ans = min(i + l[i - 1] + r[i],ans);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 10604