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

using namespace std;
typedef long long ll;
const ll mod = 1e9 + 7;
const int inf = 1000000;
const int MAX_N = 200010;

int main(int argc, const char * argv[]) {
  string s;
  cin >> s;
  
  if (s[0] == s.back()) {
    if (s.size() % 2 == 0) {
      cout << "First" << endl;
    } else {
      cout << "Second" << endl;
    }
  } else {
    if (s.size() % 2 == 0) {
      cout << "Second" << endl;
    } else {
      cout << "First" << endl;
    }
  }
  
  cout << endl;
  return 0;
}


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

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

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

	int a; read(a);
	write(a + a * a + a * a * a);
}


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

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = std::int64_t;
using P = std::tuple<int,int>;

int N;
ll D[100100];
std::map<ll,int> ma;
std::vector<int> order;
std::vector<P> G;
int A[100100];
ll B[100100];

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

    std::cin >> N;

    for(int i=1;i<=N;++i){
        std::cin >> D[i];
        ma[D[i]] = i;
    }

    order.resize(N);
    std::iota(order.begin(), order.end(), 1);
    std::sort(order.begin(), order.end(), [](const int& l, const int& r){return D[l] > D[r];});
    
    for(int i=0;i<N-1;++i){
        int v = order[i];

        A[v] += 1;

        ll d = N - 2 * A[v];

        unless(ma.count(D[v] - d) > 0){
            std::cout << -1 << std::endl;
            return 0;
        }

        int w = ma[D[v] - d];
        
        G.emplace_back(v, w);

        B[w] += B[v] + A[v];
        A[w] += A[v];
    }

    unless(B[order[N-1]] == D[order[N-1]]){
        std::cout << -1 << std::endl;
        return 0;
    }

    for(auto &e : G){
        int v, w;
        std::tie(v, w) = e;

        std::cout << v << " " << w << std::endl;
    }
}


Measured memory_bytes: 12664
fun main(arg: Array<String>) {
    val fact = Array(200001) { ModInt(1) }
    for (n in 1 until 200000) fact[n] = fact[n - 1] * n

    val (N, M) = listOfInt()
    val p1 = fact[N]
    val p2 = fact[M]
    val ans = when (Math.abs(N - M)) {
        0 -> p1 * p2 * 2
        1 -> p1 * p2
        else -> ModInt(0)
    }
    println(ans.toString())
}

data class ModInt(private var v: Long) {
    companion object { private const val MOD = 1000000007L }
    init { this.v %= MOD }
    constructor(k: Int): this(k.toLong())
    operator fun plus(other: Int) = ModInt((this.v + other) % MOD)
    operator fun minus(other: Int) = ModInt((this.v + MOD - other) % MOD)
    operator fun minus(other: ModInt) = ModInt((this.v + MOD - other.v) % MOD)
    operator fun times(other: Int) = ModInt(this.v * other % MOD)
    operator fun times(other: ModInt) = ModInt(this.v * other.v % MOD)
    operator fun div(other: ModInt) = ModInt(this.v * pow(other.v, MOD - 2) % MOD)
    private fun pow(a: Long, b: Long): Long {
        if (b == 0L) return 1L
        if (b % 2 == 0L) {
            val d = pow(a, b / 2)
            return (d * d) % MOD
        }
        return a * pow(a, b - 1) % MOD
    }
    override fun toString() = this.v.toString()
}

fun next() = readLine()!!
fun nextInt() = next().toInt()
fun nextLong() = next().toLong()
fun listOfString() = next().split(" ")
fun listOfInt() = listOfString().map(String::toInt)
fun listOfInt(vararg deltas: Int) = listOfString().map { Integer.parseInt(it) }.mapIndexed { index, int -> int + deltas[index % deltas.size] }
fun listOfLong() = listOfString().map(String::toLong)


Measured memory_bytes: 53524
// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
//#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
// #define mt make_tuple
//typedef tuple<pii,int,int> tp;
//typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
//template<class C>constexpr int size(const C &c){return (int)c.size();}
//template<class T,size_t N> constexpr int size(const T (&xs)[N])noexcept{return (int)N;}
const double PI=acos(-1);
const double EPS=1e-7;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
string s;int n;
int dp[301][301][301];
int f(int a,int b,int c){
	if(dp[a][b][c]!=-inf)return dp[a][b][c];
	if(b<=a)return 0;
	if(a+1==b)return 1;
	int out=0;
	if(s[a]==s[b-1]){
		out=max(out,2+f(a+1,b-1,c));
	}else if(c+1<=n){
		out=max(out,2+f(a+1,b-1,c+1));
	}
	out=max(out,f(a+1,b,c));
	out=max(out,f(a,b-1,c));
//	cout<<a<<" "<<b<<" "<<c<<" "<<out<<endl;
	return dp[a][b][c]=out;
}
int main(){
	cin>>s;
	cin>>n;
	rep(i,301)rep(j,301)rep(k,301)dp[i][j][k]=-inf;
	cout<<f(0,s.size(),0)<<endl;
//	cout<<min((int)s.size(),LCS(s,t)+2*m)<<endl;
}








Measured memory_bytes: 106880
#include <bits/stdc++.h>
#define int long long
using pii=std::pair<int,int>;
using namespace std;

const int maxn = 1e6 + 5;

int n;
int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin >> n;
    int ans = 0;
    for(int i = 1; i <= n; i++)
        for(int j = 1; i * j < n; j++)
            ans++;
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 3648
#include<iostream>
#include<algorithm>
using lint=int64_t;
using namespace std;

int main()
{
	lint N,x;
	lint a[2010]={};
	
	cin >> N >> x;
	for(int i=0;i<N;i++)
		cin >> a[i];
	
	lint ans=1e18;
	lint b[2010]={};
	for(int i=0;i<N;i++)
		b[i]=a[i];
	for(int k=0;k<N;k++)
	{
		for(int i=0;i<N;i++)
			b[i]=min(b[i],a[(i-k+N)%N]);
		
		lint tans=x*k;
		for(int i=0;i<N;i++)
			tans+=b[i];
		ans=min(ans,tans);
	}

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



Measured memory_bytes: 384
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<utility>
#include <functional>
#include <set>
#include <map>
#include <queue>
#include <cmath>
#include <stack>

using namespace std;



int main() {
	string s;
	string t;
	cin >> s >> t;
	reverse(s.begin(), s.end());
	if (s == t)cout << "YES";
	else cout << "NO";
}

Measured memory_bytes: 256
use proconio::input;
use proconio::marker::Usize1;

fn main() {
    input! {
        n: usize,
        m: usize,
        ps: [(Usize1, String); m],
    }

    let mut is_ac = vec![false; n];
    let mut count_wa = vec![0; n];

    for (p, s) in ps {
        match s.as_str() {
            "AC" => is_ac[p] = true,
            "WA" if !is_ac[p] => count_wa[p] += 1,
            _ => continue,
        }
    }

    let ac = is_ac.iter().filter(|x| **x).count();
    let wa: i64 = count_wa
        .iter()
        .enumerate()
        .filter(|(i, _)| is_ac[*i])
        .map(|x| x.1)
        .sum();

    println!("{} {}", ac, wa);
}


Measured memory_bytes: 9736
#include <stdio.h>

#define N_MAX 200000
#define S_MAX 2000000000

long long int c;

void merge(int a[], int left, int mid, int right){
	int n1 = mid - left;
	int n2 = right - mid;
	int i, j, k;
	long long int L[n1+1],R[n2+1];
	for(i = 0 ; i < n1 ; i++){
    	L[i] = a[left + i];
	}
	for(i = 0 ; i < n2 ; i++){
    	R[i] = a[mid + i];
	}
  	L[n1] = R[n2] = S_MAX;
	for(i = 0, j = 0, k = left ; k < right ; k++){
   		if(i < n1 && (j == n2 || L[i] <= R[j])){
      		a[k] = L[i++];
    	}
		else{
     		c += (n1 + n2) / 2 - i;
     		a[k] = R[j++];
    	}
  	}
}
 
void mergeSort(int a[], int left, int right){
  int mid;
  if(left + 1 < right){
    mid = (left + right) / 2;
    mergeSort(a, left, mid);
    mergeSort(a, mid, right);
    merge(a, left, mid, right);
  }
}
	
int main(void){
	int i;
	int A[N_MAX];
	long long int n;
	scanf("%d" ,&n);
	for(i = 0; i < n; i++){
		scanf("%d" ,&A[i]);
	}
	mergeSort(A,0,n); 
	printf("%lld\n",c);
	return 0;
}


Measured memory_bytes: 4196
n,k = map(int, input().split())
a = list(map(int, input().split()))
d=""
e=0
for i in range(100000):
  d=str(n+i)
  for j in range(k):
    e=e+d.count(str(a[j]))
  if e==0:
    print(int(d))
    break
  e=0

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int LCM(int x,int y)
{
    return x*y/(__gcd(x,y));
}
int main ()
{
    int N;cin >> N;
    int A[N+10];
    int lc=0;
    for(int i=1;i<=N;i++){
        cin >> A[i];
        if(!lc)lc=A[i];
        else lc = LCM(lc,A[i]);
    }
    double ans=lc,dv=0.0;
    for(int i=1;i<=N;i++){
        dv+= lc/A[i];
    }
    ans = ans/dv;
    cout<<setprecision(10)<<fixed<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<map>
#include<vector>
using namespace std;
typedef long long ll;

int di[8] = {0,0,1,-1,1,1,-1,-1};
int dj[8] = {1,-1,0,0,1,-1,1,-1};
#define inRange(x,a,b) (a <= x && x < b)

ll enc(vector<int> v){
    ll ret = 0;
    for(int i = 0; i < v.size(); i++)   ret = ret * 5 + v[i];
    return ret;
}

map<ll, int> memo;
int ans;

int dfs(vector<int> v){
    ll num = enc(v);
    if(memo.count(num)) return memo[num];
    memo[num] = v.size();
    
    vector<vector<int>> mat(5, vector<int>(4, 0));
    for(int i = 0; i < v.size(); i++){
        mat[i/4][i%4] = v[i];
    }

    for(int i = 0; i < 5; i++){
        for(int j = 0; j < 4; j++){
            if(mat[i][j] == 0)  break;
            for(int k = 0; k < 8; k++){
                int ni = i + di[k], nj = j + dj[k];
                if(!inRange(ni,0,5) || !inRange(nj, 0,4) || mat[ni][nj] != mat[i][j])   continue;
                int cp = mat[i][j];
                mat[ni][nj] = mat[i][j] = 0;
                vector<int> vcp;
                for(int l = 0; l < 5; l++){
                    for(int m = 0; m < 4; m++){
                        if(mat[l][m])   vcp.push_back(mat[l][m]);
                    }
                }
                memo[num] = min(memo[num], dfs(vcp));
                mat[ni][nj] = mat[i][j] = cp;
            }
        }
    }
    
    ans = min(ans, memo[num]);

    return memo[num];
}

int main(){
    int n;
    cin >> n;
    while(n-- > 0){
        memo.clear();   ans = 20;
        vector<int> v(20);
        for(int i = 0; i < 20; i++) cin >> v[i];
        dfs(v);
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 3080
#include <bits/stdc++.h>
#define int long long
#pragma GCC optimize("O3")

#define fi first
#define se second
#define em emplace
#define eb emplace_back
#define mp make_pair
#define pi pair<int,int>
#define vi vector<int>
#define vpi vector<pair<int,int>>
#define vll vector<ll>
#define vpll vector<pair<ll,ll>>
#define endl '\n'

#define si(v) int(v.size())
#define all(v) v.begin(), v.end()
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define rep2(i, n, m) for (ll i = n; i <= (m); ++i)
#define rep3(i, n, m) for (ll i = n; i >= (m); --i)

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

using ll = long long;
using ld = long double;
using namespace std;

constexpr ll MOD = 1000000007, MAX = 2000000;

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

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

class mint {
  private:
    ll x;

  public:
    constexpr mint(const ll x = 0) noexcept : x((x % MOD + MOD) % MOD) {}
    constexpr ll value() noexcept { return x; }
    constexpr mint operator += (const mint right) noexcept {
      if ((x += right.x) >= MOD) x -= MOD;
      return *this;
    }
    constexpr mint operator -= (const mint right) noexcept {
      if ((x += MOD - right.x) >= MOD) x -= MOD;
      return *this;
    }
    constexpr mint operator *= (const mint right) noexcept {
      x = x * right.x % MOD;
      return *this;
    }
    constexpr mint operator /= (const mint right) noexcept {
      return *this *= right.inv();
    }
    constexpr mint operator + (const mint right) const noexcept {
      return mint(*this) += right;
    }
    constexpr mint operator - (const mint right) const noexcept {
      return mint(*this) -= right;
    }
    constexpr mint operator / (const mint right) const noexcept {
      return mint(*this) /= right;
    }
    constexpr mint operator * (const mint right) const noexcept {
      return mint(*this) *= right;
    }
    constexpr mint inv() const {
      return pow(MOD-2);
    }
    constexpr mint pow(ll n) const {
      if (n == 0) return 1;
      mint a = pow(n>>1);
      a *= a;
      if (n & 1) a *= *this;
      return a;
    }
};

signed main()
{
  cout << fixed << setprecision(20);
  ios::sync_with_stdio(false);
  cin.tie(0);

  COMinit();

  ll n; cin >> n;

  mint ans = mint(10).pow(n) - mint(9).pow(n) - mint(9).pow(n) + mint(8).pow(n);
  cout << ans.value() << endl;
  
  return (0);
}

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

ll gcd(ll a,ll b){
  if(b == 0) return a;
  return gcd(b, a % b);
}
const ll P =  1000000007;
ll factorial(ll n){
   ll ans = 1;
   for(int i = n;i>=1;i--){
     ans *= i;
     ans %= P;
   }
   return ans;
}
using Graph = vector<vector<int>>;

ll kzyou(ll a,ll k){//aのk乗を返す
    ll zyou = 1;
    for(ll i = 1;i<=k;i++){
        zyou *= a;
    }
    return zyou;
}

int main(){
  int N;
  cin >> N;
  set<int> S;

  rep(i,N){
    int c = 0;
    cin >> c;
    S.insert(c);
  }
  if(S.size() == N) cout << "YES" << endl;
  else cout << "NO" << endl;
 }

Measured memory_bytes: 9600
n = int(input())
for _ in range(n):
    n_out, n_run, score = 0, 0, 0
    while n_out < 3:
        evt = input()
        if evt == 'HIT':
            if n_run < 3:
                n_run += 1
            else:
                score += 1
        elif evt == 'HOMERUN':
            score += n_run + 1
            n_run = 0
        elif evt == 'OUT':
            n_out += 1
    print(score)

Measured memory_bytes: 7568
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
const int inf = 1e9;

struct edge{
	int to, cost, cap, rev;
	edge(int to, int cost, int cap, int rev)
		:to(to),cost(cost),cap(cap),rev(rev){}
	edge(){}
};

int min_cost_flow(int s, int g, int f, vector<vector<edge> > &adj){
	int n = adj.size();
	int res = 0;
	while(f > 0){
		vector<int> prevv(n), preve(n);
		vector<int> mincost(n, inf);
		mincost[s] = 0;
		while(1){
			bool update = false;
			for(int i=0; i<n; i++){
				if(mincost[i] == inf) continue;
				for(int j=0; j<(int)adj[i].size(); j++){
					edge &e = adj[i][j];
					if(e.cap>0 && mincost[i] +e.cost < mincost[e.to]){
						mincost[e.to] = mincost[i] +e.cost;
						prevv[e.to] = i;
						preve[e.to] = j;
						update = true;
					}
				}
			}
			if(!update) break;
		}
		if(mincost[g] == inf){
			return -1;
		}
		
		int d = f;
		for(int v=g; v!=s; v=prevv[v]){
			d = min(d, adj[prevv[v]][preve[v]].cap);
		}
		f -= d;
		res += d*mincost[g];
		for(int v=g; v!=s; v=prevv[v]){
			edge &e = adj[prevv[v]][preve[v]];
			e.cap -= d;
			adj[v][e.rev].cap += d;
		}
	}
	return res;
}

int main(){
	while(1){
		int n;
		cin >> n;
		if(n==0) break;
		
		vector<vector<edge> > adj(366);
		for(int i=0; i<365; i++){
			adj[i].push_back(edge(i+1, 0, 2, adj[i+1].size()));
			adj[i+1].push_back(edge(i, 0, 0, adj[i].size()-1));
		}
		for(int i=0; i<n; i++){
			int a,b,w;
			cin >> a >> b >> w;
			a--; b--;
			adj[a].push_back(edge(b+1, -w, 1, adj[b+1].size()));
			adj[b+1].push_back(edge(a, w, 0, adj[a].size()-1));
		}
		cout << -min_cost_flow(0, 365, 2, adj) << endl;
	}
	return 0;
}


Measured memory_bytes: 3100
#include <iostream>
#include <vector>
#include <array>
#include <set>
#include <cmath>
#include <string>
#include <queue> 
#include <list>
#include <stack>
#include <unordered_map>
#include <algorithm> 
#include <numeric>  
#include <functional>
#include <cassert>
#include <bitset>
#include <cctype>  
#include <iomanip> 
#include <limits>  
// std::numeric_limits<int>::max(), min()
// std::setprecision(X)
// std::islower(), std::isupper(), std::tolower, std::toupper
// std::accumulate(m.begin(), m.end(), 0LL);
// std::sort(begin(),end()) // 0, 1, 2, 3 ,4 (default, less);
// std::priority_queue<int, vector<int>, less<int>> que; // 4, 3, 2, 1 (defualt, less) : 
 
#define  rep(i, n) for(int i = 0; i < (int)(n);    i++)
#define rrep(i, n) for(int i = ((int)(n)-1); i>=0; i++)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()

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; }
typedef long long ll;

ll gcd ( ll a, ll b ) { if ( b == 0 ) return a; else return gcd ( b, a%b ); }
ll lcm ( ll a, ll b ) { return a * b / gcd(a, b); }


int main (void) {
  std::cin.tie(0);  std::ios::sync_with_stdio(false);
  int N, M; std::cin >> N >> M;

  std::priority_queue<ll, std::vector<ll>> q;
  rep(i,N){
    ll A; std::cin >> A; q.push(A);
  }

  rep(i,M){
    ll cur = q.top(); q.pop();
    cur = std::floor((double)cur / 2);
    q.push(cur);
  }

  ll ans = 0;
  while(!q.empty()) {
    ll cur = q.top(); q.pop(); ans += cur;
  }
  std::cout << ans << std::endl;
  return 0;
}


Measured memory_bytes: 1400
object Main extends App{
    val s = scala.io.StdIn.readLine()
    val t = scala.io.StdIn.readLine()
    val len = s.length
    var count = 0
    for(i <- 0 until len; if s(i) != t(i)){
        count = count + 1
    }
    println(count)
}

Measured memory_bytes: 57072
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<unordered_map>
#include<random>
#include<array>
#include<cassert>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())




double dp[301][301][301];




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

	int n;
	int one = 0, two = 0, three = 0;
	cin >> n;
	rep(i,n) {
		int a;
		cin >> a;
		if (a == 1) {
			one++;
		}
		else if (a == 2) {
			two++;
		}
		else {
			three++;
		}
	}

	rep(a, three + 1)rep(b, two + three + 1)rep(c, n + 1) if(a+b+c){
		if (b > three + two)continue;
		if (a + b + c > n)continue;
		double sum = a + b + c;
		double emp = n - sum;

		dp[a][b][c] += n / sum;
		if (0 < a) {
			dp[a][b][c] += a / sum * dp[a - 1][b + 1][c];
		}
		if (0 < b) {
			dp[a][b][c] += b / sum * dp[a][b - 1][c + 1];
		}
		if (0 < c) {
			dp[a][b][c] += c / sum * dp[a][b][c - 1];
		}
	}

	printf("%.10f\n", dp[three][two][one]);


	return 0;
}


Measured memory_bytes: 213248
import java.util.Scanner;
import java.util.Arrays;
public class Main {
  public static void main(String[] args) {
    int maxn = 101;
    int maxv = 1001;
    Scanner sc = new Scanner(System.in);
  	int N = sc.nextInt();
    int W = sc.nextInt();
    long[] dp = new long[maxn * maxv];
    int[] w = new int[maxn];
    int[] v = new int[maxn];
    for (int i = 0; i < N; i++) {
		    w[i] = sc.nextInt();
      	v[i] = sc.nextInt();
    }
    Arrays.fill(dp,(1L << 50));
    dp[0] = 0;
    for (int i = 0; i < N; i++) {
      for (int j = maxn * maxv - 1; j >= v[i]; j--) {
      	dp[j] = Math.min(dp[j],dp[j - v[i]] + w[i]);
      }
    }
    for (int i = maxn * maxv - 1; i >= 0; i--) {
      if (dp[i] <= W) {
        System.out.println(i);
        return;
      }
    }
  }
}

Measured memory_bytes: 23764
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <complex>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <iomanip>
#include <assert.h>
#include <array>
#include <cstdio>
#include <cstring>
#include <random>
#include <functional>
#include <numeric>
#include <bitset>
#include <fstream>

using namespace std;

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a, 0, sizeof a)
#define minus(a) memset(a, -1, sizeof a)
#define watch(a) { cout << #a << " = " << a << endl; }
template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); }
template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); }

typedef long long ll;
int const inf = 1<<29;

int main() {

  int N, L; cin >> N >> L;
  vector<string> s(N);
  rep(i, N) {
    cin >> s[i];
  }

  sort(all(s));
  rep(i, N) {
    cout << s[i];
  }
  cout << endl;
  
  return 0;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        Integer[] first = {1, 3, 5, 7, 8, 10, 12};
        Integer[] second = {4, 6, 9, 11};

        List<Integer> firstArrays = Arrays.asList(first);
        List<Integer> secondArrays = Arrays.asList(second);

        String result = "No";
        int x = scanner.nextInt();
        int y = scanner.nextInt();

        if (firstArrays.contains(x) && firstArrays.contains(y)) {
            result = "Yes";
        } else if (secondArrays.contains(x) && secondArrays.contains(y)) {
            result = "Yes";
        }

        System.out.println(result);
    }
}

Measured memory_bytes: 21844
#include<iostream>
using namespace std;
int main(){
  while(1){
    int n,p;
    cin>>n>>p;
    if(n==0&&p==0)break;
    int k=p;
    int ch[50]={},f=0;
    while(1){
      if(k==0){
	k=ch[f%n];
	ch[f%n]=0;
      }     
      else{
	ch[f%n]++;
	k--;
      }	 
      if(ch[f%n]==p)break;
      f++;
    }
    cout<<f%n<<endl;
  } 
  return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
#define DEBUG fprintf(stderr, "Passing [%s] line %d\n", __FUNCTION__, __LINE__)
#define File(x) freopen(x".in","r",stdin); freopen(x".out","w",stdout)
#define int long long

using namespace std;

typedef long long LL;
typedef pair <int, int> PII;
typedef pair <int, PII> PIII;

inline int gi()
{
	int f = 1, x = 0; char c = getchar();
	while (c < '0' || c > '9') {if (c == '-') f = -1; c = getchar();}
	while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
	return f * x;
}

inline LL gl()
{
	LL f = 1, x = 0; char c = getchar();
	while (c < '0' || c > '9') {if (c == '-') f = -1; c = getchar();}
	while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
	return f * x;
}

const int INF = 0x3f3f3f3f, N = 100003, M = N << 1;

int n, x, y, a, b, c;
int p[N], Q[N], r[N];
int nx, ny;
int sx, sy;
priority_queue <PII> q;
LL sum;

inline bool cmp(int gg, int hh) {return gg > hh;}

signed main()
{
	//File("");
	x = gi(), y = gi(), a = gi(), b = gi(), c = gi();
	for (int i = 1; i <= a; i+=1) p[i] = gi();
	for (int i = 1; i <= b; i+=1) Q[i] = gi();
	for (int i = 1; i <= c; i+=1) r[i] = gi(), q.push(make_pair(r[i], 3));
	sort(p + 1, p + 1 + a, cmp); sort(Q + 1, Q + 1 + b, cmp); sort(r + 1, r + 1 + c, cmp);
	for (int i = 1; i <= x; i+=1) q.push(make_pair(p[i], 1));
	for (int i = 1; i <= y; i+=1) q.push(make_pair(Q[i], 2));
	for (int i = 1; i <= x + y; i+=1)
	    sum += q.top().first, q.pop();
	cout << sum << endl;
	return 0;
}


Measured memory_bytes: 12908
#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <cstdlib>
using namespace std;

int main() {
  long long N; cin>>N; 
  long long big=pow(10, 9)+7;
  long long answer=1;
  for(long long i=1; i<=N; i++){
    answer=(answer*(i%big))%big;
  }
  cout<<answer<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define all(x) x.begin(),x.end()
#define rep(i,j,n) for (long long i = j; i < (long long)(n); i++)
#define _GLIBCXX_DEBUG
#define MOD 1000000007
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
//(a+b-1)/b

signed main(){
	string s; cin>>s;
  int n=s.size();
  if(n%2==1)cout<<"No";
  else{
	for(int i=n-1;i>=0;i--){
		if(i%2==0 && s[i]!='h'){
          cout<<"No"<<endl;
          return 0;
        }
		else if(i%2==1 && s[i]!='i'){
          cout<<"No"<<endl;
          return 0;
        }
    }
    cout<<"Yes"<<endl;
  }
  

    


	
	return 0;
}

Measured memory_bytes: 3604
#include<bits/stdc++.h>
#define mod 1000000007
#define ll long long
using namespace std;
struct node
{
    int x,y;
} a[200009];
int n,ans=0,tmp,tmp1;
int cmp(node a,node b)
{
    return a.x<b.x;
}
int main()
{
    scanf("%d",&n);
    for(int i=1; i<=n; i++)
        scanf("%d%d",&a[i].x,&a[i].y);
    sort(a+1,a+n+1,cmp);
    tmp=a[1].y-a[1].x,tmp1=-a[1].x-a[1].y;
    for(int i=2; i<=n; i++)
    {
        ans=max(ans,a[i].x-a[i].y+tmp);
        ans=max(ans,a[i].x+a[i].y+tmp1);
        tmp=max(tmp,a[i].y-a[i].x);
        tmp1=max(tmp1,-a[i].x-a[i].y);
    }
    printf("%d",ans);
    return 0;
}


Measured memory_bytes: 5316
n, x = [int(s) for s in input().split(" ")]
L = [int(s) for s in input().split(" ")]

d = 0
cnt = 1
for i in range(1,n+1):
  d = d + L[i - 1]
  if d <= x:
    cnt += 1
  else:
    break
print(cnt)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0; i<(n); i++)
int main() {
  int n;
  cin >> n;
  vector<string> s(n);
  vector<int> t(n);
  rep(i,n) cin >> s[i] >> t[i];
  string x;
  cin >> x;
  int start;
  rep(i,n){
    if(s[i]==x) start = i;
  }
  int ans = 0;
  for(int i = start+1; i<n; i++){
    ans += t[i];
  }
  cout << ans << endl;
}

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

using namespace std;

int main(){
    int n;
    cin >> n;
    set<int> s;
    for(int i = 0; i < n; i++){
        int a;
        cin >> a;
        s.insert(a);
    }
    if(s.size() == n){
        cout << "YES\n";
    }else{
        cout << "NO\n";
    }
}

Measured memory_bytes: 9600
#include<stdio.h>

int main(void) 
{

	int x, y, a, b;
	
	scanf ("%d %d" ,&x ,&y);
	if (x < y){
	a = x;
	x = y;
	y = a;
}
	while (y > 0){
	b = x % y;
	x = y;
	y = b;
	} 

	printf("%d\n" ,x);

	return 0;
}
	

Measured memory_bytes: 592
//https://discuss.codechef.com/t/robagain-editorial/20734
#pragma GCC optimize("O3")
#include<queue>
#include <cmath>
#include <complex>
#include<map>
#include <string>
#include<iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cstring>
#include <string>
#include <iostream>
#include <stdio.h>
#include<bits/stdc++.h>


/*
#define x real()
#define y imag()
#define angle(a)                (atan2((a).imag(), (a).real()))
#define vec(a,b)                ((b)-(a))
#define same(p1,p2)             (dp(vec(p1,p2),vec(p1,p2)) < EPS)
#define dp(a,b)                 ( (conj(a)*(b)).real() )	// a*b cos(T), if zero -> prep
#define cp(a,b)                 ( (conj(a)*(b)).imag() )	// a*b sin(T), if zero -> parllel
#define length(a)               (hypot((a).imag(), (a).real()))
#define normalize(a)            (a)/length(a)
//#define polar(r,ang)            ((r)*exp(point(0,ang)))  ==> Already added in c++11
#define rotateO(p,ang)          ((p)*exp(point(0,ang)))
#define rotateA(p,ang,about)  (rotateO(vec(about,p),ang)+about)
#define reflectO(v,m)  (conj((v)/(m))*(m))
*/

//#define pi 3.141592654
#define forr(i,a,b) for(int i=a;i<=b;i++)
#define F first
#define S second
#define input ios_base::sync_with_stdio(0);cin.tie(0);
#define NOT(x) (1^x)

const double PI  = acos(-1.0);
using namespace std;
typedef pair<double,double>pdd;
typedef long long  ll;
typedef pair<ll, ll>pii;
typedef complex<double> point;

//int x[8]={1,0,0,-1,-1,-1,1,1};
//int y[8]={0,1,-1,0,-1,1,-1,1};
//const int N=500009,M=1000000;
const double EPS= 1e-9,eps=-1e9;
const int N =100005;

ll n,e,t,mem[N][2],x;
vector<ll>a,b;
ll dp(int i=0,int ck=0)
{
    if(i>=n)return 0;
    ll&ret=mem[i][ck];
    if(~ret)return ret;
    ret=4e18;
    auto it=upper_bound(a.begin(),a.end(),a[i]+t/2);
    int j=it-a.begin();
    if(ck==0){
        ret=min(ret,dp(b[j],0)+t);
        if(i+1!=n)ret=min(ret,dp(b[j],1)+(a[j]-a[i])*(ll)2);
    }
    else{
        ret=min(ret,dp(i+1,0));
        if(i+1!=n)ret=min(ret,dp(i+1,1)+(a[i+1]-a[i])*(ll)2);
    }
    return ret;
}
 int main()
{
//freopen("travel.in","r",stdin);
//freopen("travel.out","w",stdout);
//__builtin_popcount()
input;


      cin>>n>>e>>t;
      for(int i=0;i<n;i++)
      {
          cin>>x;
          a.push_back(x);
          b.push_back(i);
      }
      a.push_back(4e18);
      b.push_back(n);
      memset(mem,-1,sizeof mem);
      cout<<e+dp()<<endl;



return 0;
}


Measured memory_bytes: 9836
#include<stdio.h>
#include<string.h>
int a[1000],b[1000],c[1000];
int main(){
	int i,j,n,len,f;
	char s[1000];
	
	scanf("%d",&n);
	while(n--){
		memset(a,-1,sizeof(a));
		memset(b,-1,sizeof(b));
		memset(c,-1,sizeof(c));
		memset(s,0,sizeof(s));
		scanf("%s",s);
		len=strlen(s);
		for(i=len-1;i>=0;i--)a[len-1-i]=s[i]-'0';
		memset(s,0,sizeof(s));
		scanf("%s",s);
		len=strlen(s);
		for(i=len-1;i>=0;i--)b[len-1-i]=s[i]-'0';
		i=0;
		f=0;
		while(1){
			if(c[i]==1)f=1;
			else f=0;
			if(a[i]!=-1 && b[i]!=-1){
				c[i]=a[i]+b[i]+f;
			}
			else if(a[i]!=-1){
				c[i]=a[i]+f;
			}
			else if(b[i]!=-1){
				c[i]=b[i]+f;
			}
			else break;
			if(c[i]>9){
				c[i+1]=1;
				c[i]%=10;
			}
			i++;
		}
		if(c[i]==-1)i--;
		if(i>79){
			printf("overflow\n");
			continue;
		}
		for(j=i;j>=0;j--)printf("%d",c[j]);
		printf("\n");
	}
	
	return 0;
}

Measured memory_bytes: 0
while (ls = gets.split.map{|i|i.to_i})!=[0]
  ls.map!{|i|i=[i,10].min}
  ans=ls.inject(:+)
  if ans>21
    ans=0
  else
    c=ls.count(1)
    for i in 1..c
      ans+=10 if ans+10 <= 21
    end
  end
  puts ans
end

Measured memory_bytes: 6104
#include <iostream>
#include <cmath>
#include <algorithm>

using namespace std;
int N;
long long a[405], s[405], S[405][405], d[405][405];
long long rez;

int main() {
    cin >> N;
    for (int i = 1; i <= N; i++) {
        cin >> a[i];
        s[i] = s[i - 1] + a[i];
    }
    for (int i = 1; i <= N; i++)
        for (int j = i; j <= N; j++)
            S[i][j] = s[j] - s[i - 1];
    for (int k = 2; k <= N; k++) {
        for (int i = 1; i <= N - k + 1; i++) {
            int j = i + k - 1;
            d[i][j]=d[i][i]+d[i+1][j]+S[i][j];
            for(int t=i;t<j;t++)
                d[i][j]=min(d[i][j],d[i][t]+d[t+1][j]+S[i][j]);
        }
    }
    cout<<d[1][N];
}

Measured memory_bytes: 2816
#include <cstdlib>
#include <iostream>
#include <cstdint>
#include <vector>
#include <string>
#include <complex>

#include <boost/algorithm/string/predicate.hpp>

using namespace std;

#if 0
// memo
abs()

start_with(str, "hoge");
ends_with(str, "hoge");

std::sort(d.begin(), d.end());
d.erase(std::unique(d.begin(), d.end()), d.end());
#endif

using namespace boost;
using namespace boost::algorithm;

static inline bool isOdd(int v)
{
    return v & 0x01;
}

int main()
{
    int A,B,C;
    scanf("%d%d%d", &A, &B, &C);

    if (A + B >=C) {
        printf("Yes\n");
    }
    else {
        printf("No\n");
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n,x;
    while (1)
    {
       int ans = 0;
        cin >> n >> x;
        if(n == 0 && x == 0)
            break;
        
        for(int i = 1 ; i <= n ; i++)
            for(int j = i + 1 ; j <= n ; j++)
                for(int k = j + 1 ; k <= n ; k++)
                    if(i + j + k == x)
                        ans++;
 
        cout << ans << endl;
    }
    
  
    return 0;
}


Measured memory_bytes: 3096
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
using namespace std;

#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 1000001;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

ll gcd(ll a, ll b) {
	if (b == 0) { return a; }
	if (a < b) { return gcd(b, a); }
	return gcd(b, a%b);
}

ll lcm(ll a, ll b) {
	return a / gcd(a, b) *b;
}

struct edge {
	ll ind;
	ll to;
	ll d;
};


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



int main() {

	ll A, B;
	char op;
	cin >> A >> op >> B;

	if (op == '+') { cout << A + B; }
	else { cout << A - B; }

	system("PAUSE");
}

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

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
using ll = long long;
using P = pair<ll, ll>;
string char_to_string(char val) {
  return string(1, val);
}
int char_to_int(char val) {
  return val - '0';
}
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;
}
struct edge {
  ll to, cost;
};

int main() {
  int N; cin >> N;
  vector<int> dp(100010, 10000000); dp[0] = 0;
  for(int i = 1; i <= N; ++i) {
    dp[i] = min(dp[i - 1] + 1, dp[i]);
    for(int k=0;k<10;k++) {
      if(i - pow(6, (k + 1)) >= 0) dp[i] = min(dp[i - pow(6, (k + 1))] + 1, dp[i]);
      if(i - pow(9, (k + 1)) >= 0) dp[i] = min(dp[i - pow(9, (k + 1))] + 1, dp[i]);
    }
  }
  cout << dp[N] << endl;
}


Measured memory_bytes: 3960
def resolve():
    s=input()
    t=input()
    ans=0
    for i in range(len(s)-len(t)+1):
        ansh=0
        for j in range(len(t)):
            if s[i+j]==t[j]:
                ansh+=1
        ans=max(ansh,ans)
    print(len(t)-ans)
resolve()

Measured memory_bytes: 67668
# coding: utf-8
# Here your code !
import sys
import collections
import math
import unittest


def calculate_triangle_area():
    try:
        [side_a, side_b, deg_C] = [float(value) for value in input().rstrip().split()]
    except:
        __input_error()
    
    area        = (1/2) * side_a * side_b * math.sin(deg_C * math.pi / 180)
    perimeter   = side_a + side_b + math.sqrt(side_a**2 + side_b**2 - 2 * side_a * side_b * math.cos(deg_C * math.pi / 180))
    height      = side_b * math.sin(deg_C * math.pi / 180)
    
    print(area)
    print(perimeter)
    print(height)

def __input_error():
    print("input error")
    return -1

class __TestValueClass(unittest.TestCase):
    def testEqual(self,func,tuples):
        self.testFunction(self.assertEqual,func,tuples)
    
    def testFunction(self,assertfunc,func,tuples):
        #tuples[index] = ([*arguments of func], compared value)
        for item in tuples:
            try:
                if isinstance(item[0], collections.Iterable):
                    assertfunc(func(*item[0]),item[1])
                else:
                    assertfunc(func(item[0]),item[1])
            except Exception as msg:
                swidth = 15
                print("="*50)
                print("-- Assertion Error in '" + func.__name__ + "' --")
                print("arguments".ljust(swidth)+":",item[0])
                print("compared value".ljust(swidth)+":",item[1])
                print("message".ljust(swidth)+":")
                print(msg)
                sys.exit()
        print(func.__name__,": succeeded")
        
#test
if __name__ == "__main__" :

    calculate_triangle_area()
#    test = __TestValueClass()

Measured memory_bytes: 10252
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>

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

const long long INF = 1LL << 60;

int main(void)
{

	int N;
	cin >> N;
	vector<vector<long long>> happy(N, vector<long long>(3, 0));
	rep(j, N) rep(i, 3) {
		cin >> happy[j][i];
	}

	vector<vector<long long>> dp(N+1 , vector<long long>(3, 0));

	rep(i, N) rep(j, 3) rep(k, 3){
		if (j == k) continue;
		dp[i + 1][j] = max(dp[i + 1][j], dp[i][k] + happy[i][j]);
	}

	cout << max({ dp[N][0], dp[N][1], dp[N][2] }) << endl;

	return 0;
}

Measured memory_bytes: 11136
object Main extends App{
  import scala.io.StdIn.readLine;
    val compare : (Int, Int, Int) => String = (a: Int, b: Int, c: Int) => {
      (a < b && b < c) match {
        case true => "Yes"
        case false => "No"
      }
    }
    val a = readLine().split(" ").map(_.toInt)
    println(compare(a(0), a(1), a(2)))
}



Measured memory_bytes: 43876
#include<bits/stdc++.h>
using namespace std;
#define ll long long int 
#define pi pair<int ,int >
#define pl pair<ll ,ll >
#define pb push_back
#define vl vector <long long int >
#define vi vector <int >
#define vp vector <pi>
#define mod 1000000007
#define eps 1e-9
#define fi first
#define se second
#define all(x) x.begin(), x.end()
#define _ <<" "<<
#define forn(x,	n) for(int x = 0; x < n ;++ x) 
#define forn1n(x,n) for(int x = 1; x <= n ;++ x)
#define forn1(x,n) for(int x = 1; x < n ;++ x)
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#pragma GCC optimize ("Ofast")
void scan(){}
template<typename F, typename... R> void scan(F &f,R&... r){cin>>f;scan(r...);}
int di_; string dnms_, co_ = ",";
void debug_(){cout<<endl;}
template<typename F, typename... R> void debug_(F &f, R&... r){while(dnms_[di_] != ',')cout<<dnms_[di_++];di_++;cout<<": "<<f<<",";debug_(r...);}
#define debug(...) dnms_=#__VA_ARGS__+co_,di_=0,debug_(__VA_ARGS__)

template<class A, class B> ostream& operator<<(ostream& out, const pair<A, B> &a){
    return out<<"("<<a.first<<","<<a.second<<")";}
template<class A> ostream& operator<<(ostream& out, const vector<A> &a){
	out<<"";for(auto it=a.begin();it!=a.end();it++){if(it!=a.begin())out<<" ";out<<*it;}out<<"";
	return out;}
template<class A, class B> istream& operator>>(istream& in, pair<A,B> &a){in>>a.first>>a.second;return in;}
template<class A> istream& operator>>(istream& in, vector<A> &a){for(A &i:a)in>>i;return in;}

int main(){
	IOS

	int n,k,q;
	cin>>n>>k>>q;
	vi v(n+1,0);
	int temp;

	forn(i,q)
	{
		cin>>temp;
		v[temp]++;
	}

	forn1n(i,n)
	{
		if(q-v[i]<k)
			cout<<"Yes\n";
		else
			cout<<"No\n";
	}
 
	return 0;	
}

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

int main()
{
    ios_base::sync_with_stdio(0),cin.tie(NULL),cout.tie(NULL);
    int n;
    cin >> n;
    ll a[n], cnt[n];
    memset(cnt, 0, sizeof(cnt));
    map<ll, ll> mp;
    for(int i=0;i<n;i++) {
        cin >> a[i];
        if(mp.count(a[i]) > 0) {
            cnt[i] = mp[a[i]] + 1;
            mp[a[i]]++;
        }
        else {
            cnt[i] = 1;
            mp.insert({a[i], 1});
        }
    }
    ll ans = 0;
    for(auto p : mp) {
        ans += p.second * (p.second - 1) / 2;
    }
    int j = 0;
    for(int i=0;i<n;i++) {
        ll mx = mp[a[j]];
        if(a[i] == a[j]) {
            mx--;
        }
        cout << ans - mp[a[i]] + 1 << endl;
        j++;
    }
    return 0;
}

Measured memory_bytes: 12672
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
#include <unordered_map>
#include <iomanip>
#include <functional>
#include <bitset>
#include <complex>
#include <stack>
#include <cstdint>



#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rrep(i, n) for(int i = (int)(n-1); i >= 0; i--)
#define repi(i,a,b) for(int i=(ll)(a);i<(ll)(b);i++)
#define rrepi(i,a,b) for(int i=(ll)(b);i>=(ll)(a);i--)

#define all(x) (x).begin(),(x).end()

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

typedef long long ll;

using namespace std;


int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n;cin>>n;
  struct ran{
    ll mi,ma;
  };
  ran xl,xm,xr;
  ran yd,ym,yu;
  xl={(ll)1e9,(ll)-1e9};
  yd=ym=yu=xr=xm=xl;

  vector<vector<ll>>x(3),y(3);
  rep(i,n){
    ll a,b;
    char d;
    cin>>a>>b>>d;
    a*=2;
    b*=2;
    if(d=='L'){
      y[1].push_back(b);
      x[0].push_back(a);
    }
    if(d=='R'){
      y[1].push_back(b);
      x[2].push_back(a);
    }
    if(d=='U'){
      y[2].push_back(b);
      x[1].push_back(a);
    }
    if(d=='D'){
      y[0].push_back(b);
      x[1].push_back(a);
    }
  }
  rep(i,3){
    sort(all(x[i]));
    sort(all(y[i]));
  }
  if(x[0].size())xl={x[0][0],x[0][x[0].size()-1]};
  if(x[1].size())xm={x[1][0],x[1][x[1].size()-1]};
  if(x[2].size())xr={x[2][0],x[2][x[2].size()-1]};
  if(y[0].size())yd={y[0][0],y[0][y[0].size()-1]};
  if(y[1].size())ym={y[1][0],y[1][y[1].size()-1]};
  if(y[2].size())yu={y[2][0],y[2][y[2].size()-1]};
  auto calx=[&](ll t){
    ll res;
    res=max({xl.ma-t,xm.ma,xr.ma+t})-min({xl.mi-t,xm.mi,xr.mi+t});
    return res;
  };
  auto caly=[&](ll t){
    return max({yd.ma-t,ym.ma,yu.ma+t})-min({yd.mi-t,ym.mi,yu.mi+t});
  };
  vector<ll>kouho;
  repi(d,-2,2){
    ll ok=-1e9,ng=1e9;
    auto check=[&](ll num){
      if(calx(num+1)-calx(num)<=d)return 1;
      return 0;
    };
    while(ng-ok>1){
      ll nn=(ng+ok)/2;
      if(check(nn))ok=nn;
      else ng=nn;
    }
    kouho.push_back(ng);

    ok=0,ng=1e9;
    auto check2=[&](ll num){
      if(caly(num+1)-caly(num)<=d)return 1;
      return 0;
    };
    while(ng-ok>1){
      ll nn=(ng+ok)/2;
      if(check2(nn))ok=nn;
      else ng=nn;
    }
    kouho.push_back(ng);
  }
  ll res=calx(0)*caly(0);
  for(auto t:kouho){
    if(t<0)continue;
    chmin(res,calx(t)*caly(t));
  }
  cout<<setprecision(12)<<(double)res/4<<endl;





  return 0;

}


Measured memory_bytes: 2288
#include<bits/stdc++.h>
using namespace std;
//#include<boost/multiprecision/cpp_int.hpp>
//using boost::multiprecision::cpp_int;

#define int long long
#define cint cpp_int
#define endl "\n"
#define REP(i,a,n) for(int i=a;i<n;++i)
#define REPR(i,a,n) for(int i=a;i>n;--i)
#define RUP(a,b) (((a)+(b)-1)/(b))
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define MOD 1000000007
#define INF LLONG_MAX/2
#define PI acos(-1.0)

typedef long long ll;
typedef pair<int,int> Pii;
typedef tuple<int,int,int> Tiii;
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef vector<Pii> VPii;
typedef vector<string> Vs;
typedef priority_queue<int> PQi;

template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
void vout(Vi &v){for(int i=0;i<(v).size();i++) cout<<v[i]<<" ";cout<<endl;}
void vout(Vs &v){for(int i=0;i<(v).size();i++) cout<<v[i]<<" ";cout<<endl;}
void vvout(VVi &v){for(int i=0;i<(v).size();i++) vout(v[i]);}
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a/gcd(a,b)*b;}
int mypow(int x, int n, int m){if(n==0)return 1;if(n%2==0)return mypow(x*x%m,n/2,m);else return x*mypow(x,n-1,m)%m;}
int digit(int k,int i){string s = to_string(k);return s[s.size()-i]-'0';}
void uniq(Vi &v){sort(v.begin(),v.end()); v.erase(unique(v.begin(),v.end()),v.end());} //vectorの同じ要素消す
int ctoi(char c){if(c>='0'&&c<='9'){return c-'0';}return 0;}
int leng(int n){string s=to_string(n); return s.size();} //intの桁数
int digitsum(int n){int ret=0; while(n>0){ret+=n%10;n/=10;}return ret;} //桁和
int lesscount(int x,Vi &a){return lower_bound(a.begin(),a.end(),x)-a.begin();} //vector aにおけるx未満の数の個数
int orlesscount(int x,Vi &a){return upper_bound(a.begin(),a.end(),x)-a.begin();} //vector aにおけるx以下の数の個数
int morecount(int x,Vi &a){return a.size()-orlesscount(x,a);} //vector aにおけるxより大きい数の個数
int ormorecount(int x,Vi &a){return a.size()-lesscount(x,a);} //vector aにおけるx以上の数の個数
int count(int x,Vi &a) {return upper_bound(ALL(a),x)-lower_bound(ALL(a),x);} //vector aにおけるxの個数
Vi accum(Vi &v){Vi ret((v).size()+1);REP(i,0,(v).size()) ret[i+1]=ret[i]+v[i];return ret;}
bool comp(Pii a,Pii b){
    if(a.second != b.second) return a.second<b.second;
    else return a.first<b.first;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
signed main(){cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);
    double l;
    cin>>l;
    cout<<(l/3)*(l/3)*(l/3)<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MOD 1000000007
#define INF 1e9
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()


int main(){
    string s;
    cin>>s;
    int q;
    cin>>q;
    bool ok=true,ok1=false;
    string r,u;
    int cnt=0;
    while(q--){
        int t;
        cin>>t;
        if(t==1){
            cnt++;
            if(ok1){
                if(ok) ok=false;
                else ok=true;
            }
        }
        else{
            ok1=true;
            int f;
            string c;
            cin>>f>>c;
            if(f==1){
                if(ok) r=c+r;
                else u=u+c;
            }
            else{
                if(ok) u=u+c;
                else r=c+r;
            }
        }
    }

    if(cnt%2==1) reverse(all(s));

    if(!ok){
        reverse(all(r));
        reverse(all(u));
        s=u+s+r;
    }
    else{
        s=r+s+u;
    }
    cout<<s<<endl;
}

Measured memory_bytes: 1512
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#include <stack>
#include <cstdlib>
#include <map>
#include <queue>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <vector>
#include <set>
using namespace std;

int main()
{
    long long int x,y;
    scanf("%lld%lld",&x,&y);
    long long int ans=0;
    long long int i=x;
    for(;i<=y;i*=2)
    {
        ans++;
    }
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 256