akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;

namespace atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var vs = Console.ReadLine().Split(' ')
                .Select(num => double.Parse(num))
                .OrderBy(num => num)
                .ToArray();
            var result = (vs[0] + vs[1]) / 2;
            for (var i = 2; i < n; i++)
            {
                result = (result + vs[i]) / 2;
            }

            Console.WriteLine(result);
        }

    }
}

Measured memory_bytes: 28328
#include <stdio.h>
#include <string.h>

int main() {
  int x;
  char contain[5];
  int ac=0,wa=0,tle=0,re=0;
  scanf("%d",&x);
  for(int i=0;i<x;i++){
    scanf("%s", &contain);
    if (strcmp(contain,"AC")==0){
      ac=ac+1;
    }
    else if (strcmp(contain,"WA")==0){
      wa=wa+1;
    }
    else if (strcmp(contain,"TLE")==0){
      tle=tle+1;
    }
    else if (strcmp(contain,"RE")==0){
      re=re+1;
    }
  }
  printf("AC x %d\n",ac);
  printf("WA x %d\n",wa);
  printf("TLE x %d\n",tle);
  printf("RE x %d\n",re);
}

Measured memory_bytes: 1688
#include <bits/stdc++.h>
#include <iomanip>
#include <math.h>
//#include <unistd.h>
//#include <stdio.h>
#define rep(i,x) for(ll i = 0;i<x;i++)
#define all(a) (a).begin(),(a).end()
using ll = long long;
using ld = long double;
using namespace std;
using dou = double;
const ll INF = 1LL << 60;
const ll mod = 1000000007;
typedef pair<ll,ll> P;
using graph = vector<vector<ll>>;
template<class T> inline bool chmax(T& a, T b){if(a < b){a = b; return true;}return false;}
template<class T> inline bool chmin(T& a, T b){if(a > b){a = b; return true;}return false;}
ll gcd(ll a,ll b){
    if(a < b)swap(a,b);
    if(a % b == 0)return b;
    else return gcd(b,a%b);
}
//素数判定O(sqrt(N))
bool isp(ll n){
    bool res = true;
    if(n == 1)return false;
    else{
        for(ll i = 2;i * i <= n;i++){
            if(n % i == 0){
                res = false;
                break;
            }
        }
        return res;
    }
}

ll fac[510000], finv[510000], inv[510000];

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

// 二項係数計算
ll COM(ll n, ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}
//nのm乗をMODで割ったあまりO(logN)
ll modpow(ll n,ll m,ll MOD){
    ll res = 1;
    while(m){
        if(m & 1)res = (res * n) % MOD;
        m >>= 1;
        n *= n;
        n %= MOD;
    }
    return res;
}

//printf("%.10f\n", N);
/*  vector<ll> vec = {1,2,5,6,8,9,10};
    cout << binary_search(all(vec),5) << endl; -> true*/
/*
    vector<ll> vec = {1,2,5,6,8,9,10};
    auto n = upper_bound(all(vec),4);
    cout << *n << endl; -> 5*/
/*
    cout << fixed << setprecision(15);
*/

int main(){
    ll N,K;
    cin >> N >> K;
    vector<ll> num(N);
    rep(i,N)cin >> num[i];
    sort(all(num));
    ll ans = 0;
    rep(i,K){
        ans += num[i];
    }
    cout << ans << endl;
}

Measured memory_bytes: 3636
#include<iostream>
#include<cmath>
#include<iomanip>
using namespace std; long double X1[100000], X2[100000], X3[100000], X4[100000], Y1[100000], Y2[100000], Y3[100000], Y4[100000], INF = 1e+14, EPS = 1e-14, Q;
bool paralel(long double X1, long double Y1, long double X2, long double Y2, long double X3, long double Y3, long double X4, long double Y4) {
	long double xp[4], yp[4]; xp[0] = X1 - X2; yp[0] = Y1 - Y2; xp[1] = X3 - X4; yp[1] = Y3 - Y4;
	if (yp[0] == 0 && yp[1] == 0) { return true; }if (yp[0] == 0 && yp[1] != 0) { return false; }
	if (yp[0] != 0 && yp[1] == 0) { return false; }if ((xp[0] / yp[0]) == (xp[1] / yp[1])) { return true; }return false;
}
pair<long double, long double>kouten(long double X1, long double Y1, long double X2, long double Y2, long double X3, long double Y3, long double X4, long double Y4) {
	if (paralel(X1, Y1, X2, Y2, X3, Y3, X4, Y4) == true) { return make_pair(INF, INF); }
	if (fabs(X1 - X2) < EPS) { X1 -= EPS; }if (fabs(X3 - X4) < EPS) { X3 -= EPS; }
	if (fabs(Y1 - Y2) < EPS) { Y1 -= EPS; }if (fabs(Y3 - Y4) < EPS) { Y3 -= EPS; }long double XP[4], YP[4], ZP[4];
	XP[0] = X1 - X2; YP[0] = Y1 - Y2; XP[1] = X3 - X4; YP[0] = Y1 - Y2; YP[1] = Y3 - Y4; ZP[0] = YP[0] / XP[0]; ZP[1] = YP[1] / XP[1];
	long double X5 = X1, Y5 = Y3 - (X3 - X1)*ZP[1], K = (Y5 - Y1) / (ZP[0] - ZP[1]); long double L = K*ZP[0]; return make_pair(X1 + K, Y1 + L);
}
void solve(long double X1, long double Y1, long double X2, long double Y2, long double X3, long double Y3, long double X4, long double Y4) { 
	pair<long double, long double>pa = kouten(X1, Y1, X2, Y2, X3, Y3, X4, Y4); 
	cout << fixed << setprecision(15) << pa.first << ' ' << fixed << setprecision(15) << pa.second << endl; 
} int main() { cin >> Q; for (int i = 0; i < Q; i++) { cin >> X1[i] >> Y1[i] >> X2[i] >> Y2[i] >> X3[i] >> Y3[i] >> X4[i] >> Y4[i];; solve(X1[i], Y1[i], X2[i], Y2[i], X3[i], Y3[i], X4[i], Y4[i]); } return 0; }

Measured memory_bytes: 3436
N = input()
H = list(map(int, input().split()))

Hk = set([0])
for h in H:
  Hk.add(h)
Hk = sorted(Hk)

def po(h, s, e):
  if h >= len(Hk)-1:
    return Hk[h] - Hk[h-1]
  posS = s
  cnt = 0
  for posE in range(s, e+1):
    if posE >= e or H[posE] <= Hk[h]:
      if posS < posE:
        cnt += po(h+1, posS, posE)
      posS = posE + 1
  if h > 0:
    cnt += Hk[h] - Hk[h-1]
  return cnt

print(po(0, 0, len(H)))


Measured memory_bytes: 3064
from networkx import *
N = int(input())
E1 = [list(map(int,input().split())) for n in range(N-1)]
Q,K = map(int,input().split())
E2 = [list(map(int,input().split())) for q in range(Q)]
G = Graph()

for a,b,c in E1:
  G.add_edge(a-1,b-1,weight=c)

D = shortest_path_length(G,weight="weight",target=K-1)

for x,y in E2:
  print(D[x-1]+D[y-1])

Measured memory_bytes: 207604
#include "bits/stdc++.h"
#include <set>

using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define all(i) (i).begin(), (i).end()
#define rall(i) (i).begin(), (i).end(), greater<int>()
#define int long long
#define elif else if
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define fst first
#define sec second
#define mod 1000000007
#define INF 10e10
template <typename T>

void print(T x)
{
	std::cout << x << " ";
}
template <typename T>

void println(T x)
{
	std::cout << x << "\n";
}

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

Measured memory_bytes: 3636
using namespace std;
#include<bits/stdc++.h>
#define BEGIN ios_base::sync_with_stdio(0);cin.tie(0);
#define END return EXIT_SUCCESS;
#define FOR(I,A,B) for((I)=(A);(I)<(B);(I)++)
#define REP(I,N) FOR((I),0,(N))
#define UP(I,A,B) for((I)=(A);(I)<=(B);(I)++)
#define DW(I,A,B) for((I)=(A);(I)>=(B);(I)--)
#define IN(P) cin>>(P)
#define IN2(P1,P2) cin>>(P1)>>(P2)
#define IN3(P1,P2,P3) cin>>(P1)>>(P2)>>(P3)
#define INS(I,N,V) REP((I),(N)) cin>>(V[I])
#define INS2(I,N,V1,V2) REP((I),(N)) cin>>(V1[I])>>(V2[I]);
#define INS3(I,N,V1,V2,V3) REP((I),(N)) cin>>(V1[I])>>(V2[I])>>(V3[I]);
#define OUT(P) cout<<(P)<<endl
#define OUT2(P1,P2) cout<<(P1)<<" "<<(P2)<<endl
#define OUT3(P1,P2,P3) cout<<(P1)<<" "<<(P2)<<" "<<(P3)<<endl
#define OUTS(I,N,V) REP((I),(N)) cout<<(V[i])<<endl
#define ALL(C) (C).begin(),(C).end()
#define RALL(C) (C).rbegin(),(C).rend()
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
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 N,i;
char c;
map<char,int> cnt;
inline void solve(){
  IN(N);
  REP(i,N){
    IN(c);
    cnt[c]++;
  }
  OUT(cnt.size()==3?"Three":"Four");
}

int main(int argc,char**argv){
  BEGIN
  solve();
  END
}


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

#define REP(i,n) for(long long i = 0; i < (n); i++)
#define FOR(i, m, n) for(long long i = (m);i < (n); ++i)
#define ALL(obj) (obj).begin(),(obj).end()

template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;

const ll MOD = (ll)1e9 + 7;
const ll MOD2 = 998244353;
const ll LLINF = (ll)1e18;
const ll INTINF = (ll)1e9;
const long double PI = 3.1415926535897932384626433;

template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template <class T, class U>ostream &operator<<(ostream &o, const map<T, U>&obj) {o << "{"; for (auto &x : obj) o << " {" << x.first << " : " << x.second << "}" << ","; o << " }"; return o;}
template <class T>ostream &operator<<(ostream &o, const set<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const vector<T>&obj) {o << "{"; for (int i = 0; i < (int)obj.size(); ++i)o << (i > 0 ? ", " : "") << obj[i]; o << "}"; return o;}
template <class T, class U>ostream &operator<<(ostream &o, const pair<T, U>&obj) {o << "{" << obj.first << ", " << obj.second << "}"; return o;}
template <template <class tmp>  class T, class U> ostream &operator<<(ostream &o, const T<U> &obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr)o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
void print(void) {cout << endl;}
template <class Head> void print(Head&& head) {cout << head;print();}
template <class Head, class... Tail> void print(Head&& head, Tail&&... tail) {cout << head << " ";print(forward<Tail>(tail)...);}
template <class T> void chmax(T& a, const T b){a=max<T>(a,b);}
template <class T> void chmin(T& a, const T b){a=min<T>(a,b);}
void YN(bool flg) {cout << ((flg) ? "YES" : "NO") << endl;}
void Yn(bool flg) {cout << ((flg) ? "Yes" : "No") << endl;}
void yn(bool flg) {cout << ((flg) ? "yes" : "no") << endl;}

int main() {
    int N; cin >> N;
    string S; cin >> S;
    int K; cin >> K;
    char c = S[K-1];
    for(auto& e:S) if(e!=c) e = '*';
    cout << S << endl;
 
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(int argc, char *argv[])
{
    int i, j, N, a, n;
    int list[9] = {0};
    scanf("%d", &N);
    for ( i = 0; i < N; i++ ){
        scanf("%d", &a);
        for ( j = 0; j < 9; j++ ){
            if ( a >= 3200 - 400*j ){
                list[j]++;
                break;
            }
        }
    }
    for ( i = 1, n = 0; i < 9; i++ ){
        if ( list[i] > 0 ){
            n++;
        }
    }
    printf("%d %d\n", n==0?1:n, n+list[0]);

    return 0;
}

Measured memory_bytes: 128
x,n = map(int,input().split())
p = list(map(int,input().split()))
p.sort()
for i in range(n):
    p[i] -= x

idx = -1
for i in range(n):
    if p[i] == 0:
        idx = i
if idx == -1:
    print(x)
    exit()
sa = 1
while 1:
    if idx-sa<0:
        print(x-sa)
        exit()
    if p[idx-sa] != -sa:
        print(x -sa)
        exit()
    if idx+sa>n-1:
        print(x+sa)
        exit()
    elif p[idx+sa] != sa:
        print(x+sa)
        exit()
    sa +=1

Measured memory_bytes: 61908
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <bitset>
#include<vector>
#include<cstdlib>
#include<map>
#include<queue>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
const ll MOD = 1e9 + 7;
#define rep(i,k) for(int i=0;i<k;i++)
ll n, m, i, j, k, o, p, l, z,x,y;
ll a[200010], ps[200010], inf = 1000000000000;
map <ll, ll> cnt;

string s;
queue<ll> q;

int main() {
	cin >> s;
	n = s.size();
	k = (1 << (n - 1));
	rep(i, n)a[i] = ll(int(s[i]) - '0');
	z = 0;
	for (i = 0; i < k; i++) {
		x = a[0];
		for (j = 1; j < n; j++) {
			if ((1 << (j-1)) & i) {
				x = 10 * x + a[j];
			}
			else {
				z += x;
				x = a[j];
			}
		}
		z += x;
		//cout << z << " ";

	}

	cout << z<<" ";
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;

namespace AtTest.HCPC2019_10
{
    class C
    {
        static void Main(string[] args)
        {
            Method(args);
        }

        static void Method(string[] args)
        {
            int[] nm = ReadInts();
            int n = nm[0];
            int m = nm[1];
            int[][] kshs = new int[n][];
            for (int i = 0; i < n; i++) kshs[i] = ReadInts();

            double[] dp = new double[m + 1];
            for(int i = 0; i < n; i++)
            {
                double[] heights = new double[m + 1];
                int hI = 1;
                for (int j = 0; j < kshs[i][0]; j++)
                {
                    int limit = kshs[i][1 + j * 2] * kshs[i][2 + j * 2];
                    for (int k = 0; k < limit&&hI<=m; k++)
                    {
                        heights[hI] = heights[hI - 1];
                        heights[hI] += 1.0 / kshs[i][1 + j * 2];
                        hI++;
                    }
                }
                for (; hI <= m; hI++) heights[hI] = heights[hI - 1];

                double[] next = new double[m + 1];
                for (int j = 0; j <= m; j++)
                {
                    for (int k = 0; k + j <= m; k++)
                    {
                        next[k + j] = Max(next[k + j], dp[k] + heights[j]);
                    }
                }

                dp = next;
            }
            WriteLine(dp[m]);
        }

        private static string Read() { return ReadLine(); }
        private static char[] ReadChars() { return Array.ConvertAll(Read().Split(), a => a[0]); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}



Measured memory_bytes: 18032
a,b=map(int,input().split())

def f(n):
    p=0
    if n%2==1:
        p=(n+1)//2
        if p%2==0:
            return 0
        else:
            return 1
    else:
        p=n//2
        if p%2==0:
            return n^0
        else:
            return n^1

print(f(a-1)^f(b))

Measured memory_bytes: 3060
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back
#define INF (1e9+1)
//#define INF (1LL<<59)

#define int ll
const ll MOD = 1e9+7;
typedef string::const_iterator state;

string t;
int expr(state &end);

int number(state &end){
    string str="";
    while(isdigit(*end)){
        str+=*end;
        end--;
    }
    reverse(all(str));
    
    int ret = 0;
    rep(i,str.size()){
        ret*=10;
        ret+=str[i]-'0';
    }
    return ret;
}

int term(state &end){
    if(*end=='>'){
        end--;
        int res = expr(end);
        end-=2;
        return (res*res)%MOD;
    }else if(isdigit(*end)){
        int res = number(end);
        return res;
    }else{
        throw"impossible";
        return -1;
    }
}

int expr(state &end){
    if(end+1==t.begin())throw "empty";
    
    vector<int> res;
    res.pb( term(end) );
    
    while(end+1!=t.begin()&&*end!='<'){
        end-=2;
        res.pb( term(end) );
    }
    
    reverse(all(res));
    int tmp = res[0];
    
    for(int i=1;i<res.size();i++){
        rep(j,res[i]){
            if(tmp==0)break;
            tmp/=2;
        }
    }
    
    return tmp;
}

signed main(){
    string s;
    while(getline(cin,s)&&s!="#"){
        t = "";
        rep(i,s.size())if(s[i]!=' ')t+=s[i];
        
        state st = t.end()-1;
        int ans;
        try{
            ans = expr(st);
        }catch(char const* e){
            cout<<"error"<<e<<endl;
            exit(-1);
        }
        cout<<ans<<endl;
    }
}

Measured memory_bytes: 6444
#include <iostream>
using namespace std;
int main(void){
    long long N,i,j,n,ans;
    string S;
    cin>>N>>S;
    long long a[10],b[100],c[1000];
    for(i=0;i<10;i++){
        a[i]=0;
    }
    for(i=0;i<100;i++){
        b[i]=0;
    }
    for(i=0;i<1000;i++){
        c[i]=0;
    }
    for(i=N-1;i>-1;i--){
        n=S[i]-'0';
        for(j=0;j<100;j++){
            if(b[j]==1){
                c[j+n*100]=1;
            }
        }
        for(j=0;j<10;j++){
            if(a[j]==1){
                b[j+n*10]=1;
            }
        }
        a[n]=1;
    }
    ans=0;
    for(i=0;i<1000;i++){
        if(c[i]==1){
            ans++;
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int maxn = 105;
const int inf = 1e9;
char s[maxn][maxn];
int mem[maxn][maxn];
int h, w;

bool inside(int i, int j) {
  return (0 <= i && i < h) && (0 <= j && j < w);
}
int dp(int i, int j) {
  if(i == h-1 && j == w-1) return 0;
  int &ans = mem[i][j];
  if(ans != -1) return ans;
  ans = inf;
  if(inside(i + 1, j)) ans = min(ans, dp(i + 1, j) + (s[i][j] == '.' && s[i + 1][j] == '#'));
  if(inside(i, j + 1)) ans = min(ans, dp(i, j + 1) + (s[i][j] == '.' && s[i][j + 1] == '#'));
  return ans;
}
int main() {
  scanf("%d %d", &h, &w);
  for(int i = 0; i < h; i++) {
    scanf("%s", s[i]);
  }
  memset(mem, -1, sizeof mem);
  printf("%d\n", dp(0, 0) + (s[0][0] == '#'));
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _overload3(_1,_2,_3,name,...)name
#define _rep(i,n)repi(i,0,n)
#define repi(i,a,b)for(int i=int(a),i##_len=(b);i<i##_len;++i)
#define MSVC_UNKO(x)x
#define rep(...)MSVC_UNKO(_overload3(__VA_ARGS__,repi,_rep,_rep)(__VA_ARGS__))
#define all(c)c.begin(),c.end()
#define write(x)cout<<(x)<<'\n'
using namespace std; using ll = long long; template<class T>using vv = vector<vector<T>>;
template<class T>auto vvec(int n, int m, T v) { return vv<T>(n, vector<T>(m, v)); }
constexpr int INF = 1 << 29, MOD = int(1e9) + 7; constexpr ll LINF = 1LL << 60;
struct aaa { aaa() { cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(10); }; }aaaa;

int main() {
    ll A;
    string B;
    cin >> A >> B;

    ll ans = 0;
    ans += A * (B[0] - '0');
    ans += A * (B[2] - '0') / 10;
    ans += A * (B[3] - '0') / 100;
    ans += (A * (B[2] - '0') % 10 + A * (B[3] - '0') % 100 / 10) / 10;

    write(ans);
}

Measured memory_bytes: 3656
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int a = in.nextInt();
		int b = in.nextInt();
		System.out.println(Math.min(a*n, b));
		
		in.close();
	}

}


Measured memory_bytes: 23764
/*
 * atcoder/dp_2nd/i.cpp
 */

// C++ 14
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstring> // memset
#include <cassert>

using namespace std;

#define ll long long
#define MOD 1000000007

#define loop(__x, __start, __end) for(int __x = __start; __x < __end; __x++)
template <class T> bool chmin(T &a, T b) { if (a > b) {a = b; return true; } return false; }
template <class T> bool chmax(T &a, T b) { if (a < b) {a = b; return true; } return false; }

const int MAX = 3100;
int N;
double P[MAX];

double dp[MAX][MAX] = {0.0};

void input() {
  cin >> N;
  loop(n,0,N) {
    cin >> P[n];
  }
}

void solve() {
  for (int i=0; i<N; i++) {
    for (int j=0; j<=i+1; j++) {
      if (j==0) { dp[i][j] = 1.0; continue; } // 表が0枚以上出る確率は常に1
      if (i==0 && j == 1) { dp[i][j] = P[i]; continue; } // 1枚目のコインで1枚以上表が出る確率
      dp[i][j] = dp[i-1][j] * (1-P[i]); // 前回までで表がj枚出ていて、かつ今回裏
      dp[i][j] += dp[i-1][j-1] * P[i]; // 前回までで表がj-1枚出ていて、かつ今回表
    }
  }

  cout << dp[N-1][(N/2)+1] << endl; // コインをすべて(N-1)振ったとき、半分以上((N/2)+1)表が出る確率
}

int main() {
  cout.precision(15);
  input();
  solve();
  return 0;
}


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

Measured memory_bytes: 596
k = int(input())

cand = [[1,2,3,4,5,6,7,8,9]]

for _ in range(9):
    tmp = []
    for val in cand[-1]:
        if val % 10 != 0:
            tmp.append(val * 10 + (val%10 -1))
        tmp.append(val * 10 + (val % 10 ))
        if val % 10 != 9:
            tmp.append(val * 10 + (val % 10 + 1))
    cand.append(tmp)
ans = []
for i in range(len(cand)):
    for val in cand[i]:
        ans.append(val)
ans=sorted(ans)
print(ans[k-1])

Measured memory_bytes: 22108
#include <algorithm>
#include <iostream>
#include <vector>
#include <stdio.h>

class UnionFind {
public:
  std::vector<int> data;
  UnionFind(int size) { data.assign(size, -1); }
  int find(int x) {
    if (data[x] < 0) {
      return x;
    } else {
      data[x] = find(data[x]);
      return data[x];
    }
  }
  void unite(int x, int y) {
    int xpar = find(x);
    int ypar = find(y);
    if (xpar != ypar) {
      if (data[xpar] > data[ypar])
        std::swap(xpar, ypar);
      data[xpar] += data[ypar];
      data[ypar] = xpar;
    }
  }
  int size(int x) { return -1 * data[find(x)]; }
};

int main() {
  long long n, m;
  std::cin >> n >> m;
  std::vector<std::pair<int, int>> bridges(m);
  for (int i = 0; i < m; i++) {
    std::cin >> bridges[i].first >> bridges[i].second;
    bridges[i].first--;
    bridges[i].second--;
  }

  UnionFind uf(n);
  std::vector<long long> answers(m);
  answers[m-1] = (long long) n * (n - 1) / 2;

  for (int i = m-2; i >= 0; i--) {
    int a = bridges[i+1].first;
    int b = bridges[i+1].second;
    if (uf.find(a) != uf.find(b)) {
      answers[i] = answers[i+1] - (long long)(uf.size(a) * uf.size(b));
      uf.unite(a, b);
    } else {
      answers[i] = answers[i+1];
    }
  }
  for (int i = 0; i < m; i++)
    std::cout << answers[i] << std::endl;
}

Measured memory_bytes: 3328
#include<bits/stdc++.h>                                                                                               
using namespace std;
 
#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,n) for(int i=1;i<=(n);++i)
#define all(x) (x).begin(),(x).end()
#define int long long
using pii = pair<int,int>;
constexpr int INF  = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;

signed main(){
    char a;
    int cnt = 0;
    rep(i,3){
        cin >> a;
        if(a == 'o') ++cnt;
    }   
    cout << 700 + 100 * cnt << '\n';
    return 0;
}


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

int W,H,w[33][33],h[33][33];

struct point{
  int x,y;
};

int bfs(){
  point u,v;
  queue<point> Q;
  int D[37][37],ny,nx;
  int dy[4] = {0,-1,0,1};
  int dx[4] = {1,0,-1,0};

  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++) D[i][j] = 10000;
  }

  u.y = u.x = 0;
  D[u.y][u.x] = 1;
  Q.push(u);

  while(!Q.empty()){
    u = Q.front();
    Q.pop();
    if(u.y == H-1 && u.x == W-1) return D[u.y][u.x];

    for(int r=0; r<4; r++){
      nx = u.x + dx[r];
      ny = u.y + dy[r];
      if(nx < 0 || ny < 0 || nx >= W || ny >= H)  continue;
      if(D[ny][nx] != 10000) continue;
      if(r == 0 && w[u.y][u.x] == 1) continue;
      if(r == 1 && h[ny][u.x] == 1) continue;
      if(r == 2 && w[u.y][nx] == 1) continue;
      if(r == 3 && h[u.y][u.x] == 1) continue;
      D[ny][nx] = D[u.y][u.x] + 1;
      v.x = nx;
      v.y = ny;
      Q.push(v); 
    }
  }
  return 0;
}    

int main(){
  int i,j;
  while(1){
    cin >> W >> H;
    if(W == 0 && H == 0) break;

    for(i=0;i<W-1;i++){
      cin >> w[0][i];
    }

    for(i=1;i<H;i++){
      for(j=0;j<W;j++){
	cin >> h[i-1][j];
      }
      for(j=0;j<W-1;j++){
	cin >> w[i][j];
      }
    }
    cout << bfs() << endl;

  }

  return 0;
}

Measured memory_bytes: 0
N,Q = map(int,input().split())
S = list(input())
AC_list=[]
sum_AC=0
sum_list=[]
Ans=[]

for i in range(N-1):
    if S[i]=='A':
        if S[i+1]=='C':
            AC_list.append(1)
        else:
            AC_list.append(0)
    else:
        AC_list.append(0)

    sum_AC = sum_AC+int(AC_list[i])
    sum_list.append(sum_AC)

for j in range(Q):

    l,r=map(int,input().split())
    if l == 1 :
        Ans.append(sum_list[r-2])
    else:
        Ans.append(sum_list[r-2]-sum_list[l-2])

for k in range(Q):
    print(Ans[k])

Measured memory_bytes: 13336
//
//AtCoder Beginner Contest 162
//A - Lucky 7
//

#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define zero(a) memset(a, 0, sizeof(a))

using ll = long long;

int main()
{
    int n;

    cin >> n;

    bool flag = false;
    if (n%10 == 7) flag = true;
    if ((n/10)%10 == 7) flag = true;
    if ((n/100)%10 == 7) flag = true;

    if (flag) cout << "Yes" << endl;
    else cout << "No" << endl;
    
    return 0;
}


Measured memory_bytes: 3652
h, w, k = map(int, input().split())
mat = [input() for _ in range(h)]
ans = 0
for row in range(2**h):
    for col in range(2**w):
        bs = 0
        for r in range(h):
            for c in range(w):
                if mat[r][c] == '#' and row >> r & 1 == 0 and col >> c & 1 == 0:
                    bs += 1
        if bs == k:
            ans += 1
print(ans)

Measured memory_bytes: 9136
#include<vector>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
#include<stack>
#include<bitset>
#include<functional>
#include<ctime>
#include<queue>
#include<deque>
#include<complex>
#include<cassert>
using namespace std;
#define pb push_back
#define pf push_front
typedef long long lint;
typedef complex<double> P;
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
//問題文および制約はちゃんと確認しよう！
//サイズは10^5じゃなくて2×10^5とかかもしれないし、重要な制約・条件を見落としているかも
//とりあえずサンプルを読んでから解法を考えよう？
lint co[58][58];
lint cal(vector<int> v,int S,int K){
	int n=v.size();
	lint ret=0;
	rep(i,(1<<18)){
		if((S|i)>S) continue;
		int x=0,t=1;
		if(__builtin_popcount(i)%2>0) t=-1;
		rep(j,n){
			if(!(i&v[j])) x++;
		}
		rep(j,K+1){
			ret+=co[x][j]*t;
		}
	}
	return ret;
}
int a[58];
int main()
{
	memset(co,0,sizeof(co));
	rep(i,55){
		co[i][0]=co[i][i]=1;
		REP(j,1,i) co[i][j]=co[i-1][j]+co[i-1][j-1];
	}
	int n,K,S,T,m=0,x,okm=0;
	cin>>n>>K>>S>>T;
	rep(j,18){
		if((S&(1<<j))!=(T&(1<<j))) okm+=(1<<j);
	}
	rep(i,n){
		cin>>x;
		int f=0;
		rep(j,18){
			if((x&(1<<j)) && !(T&(1<<j))) f=1;
			if(!(x&(1<<j)) && (S&(1<<j))) f=1;
		}
		if(f<1){
			a[m]=x;m++;
		}
	}
	//cout<<m<<endl;rep(i,m) cout<<a[i]<<endl;
	lint out=0;
	rep(i,m){
		vector<int> v;
		REP(j,i+1,m) v.pb(a[i]^a[j]);
		out+=cal(v,S^T,K-1);
	}
	cout<<out<<endl;
}


Measured memory_bytes: 3608
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] a = new int[n + 1];
		for(int i = 1; i <= n; i++) a[i] = sc.nextInt();
		int min = a[1], max = a[1];
		for(int i = 2; i <= n; i++) {
			if(min > a[i]) min = a[i];
			else if(max < a[i]) max = a[i];
		}
		System.out.println(max - min);
	}

}


Measured memory_bytes: 19924
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
#define rep1(i,n) for (int i = 1; i <= (n); i++)
#define repi(i,a,b) for (int i = (a); i < (b); i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using vc = vector<char>;
using vvc = vector<vc>;
using vs = vector<string>;

int main() {
  int a, b, h;
  cin >> a >> b >> h;
  
  cout << (a+b)*h/2 << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
using namespace std;
#define rep(i,x) for(int i = 0; i < x; i++)
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<vector<vector<int>>> vvvi;
const ll N = 1e9+7;
const int n_max = 1e5+10;

void print() {
    cout << endl;
}

template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
    cout << head;
    if (sizeof...(tail) != 0) cout << ' ';
    print(forward<Tail>(tail)...);
}

template <class T>
void print(vector<T> &vec) {
    for (auto& a : vec) {
        cout << a;
        if (&a != &vec.back()) cout << ' ';
    }
    cout << endl;
}

template <class T>
void print(vector<vector<T>> &df) {
    for (auto& vec : df) {
        print(vec);
    }
}

int main(){
    int n; cin >> n;
    string s;cin >> s;
    vector<int> left,right;
    vector<int> lr(2*n);
    ll ans = 0;
    bool ok = true;

    ll dp[n+1];
    dp[0] = 1;
    rep(i,n+1){
        if(!i)continue;
        dp[i] =dp[i-1] * i;
        dp[i] %= N;
    }
    //前半
    rep(i,n){
        if(i == 0 && s[i] == 'W'){
            ans = 0;
            ok = false;
            break;
        }
        if( (i%2 && s[i] == 'W') || (!(i%2) && s[i] == 'B')){
            left.push_back(i);
            lr[i] = 0;
        }
        if( (i%2 && s[i] == 'B') || (!(i%2) && s[i] == 'W')){
            right.push_back(i);
            lr[i] = 1;
        } 
    }
    //後半
    rep(i,n){
        int temp = i + n;
        if(temp == 2*n-1 && s[temp] == 'W'){
            ans = 0;
            ok = false;
            break;
        }
        if( (temp%2 && s[temp] == 'W') || (!(temp%2) && s[temp] == 'B')){
            left.push_back(temp);
            lr[temp] = 0;
        }
        if( (temp%2 && s[temp] == 'B') || (!(temp%2) && s[temp] == 'W')){
            right.push_back(temp);
            lr[temp] = 1;
        } 
    }
    if(left.size() != right.size())ok = false;
    // print(right);print(left);
    // print(lr);
    int right_i[2*n] = {},left_i[2*n] = {};
    ll choose = 1;
    rep(i,2*n){
        if(i == 2*n-1)continue;
        if(!lr[i]){
            left_i[i+1] = left_i[i] + 1;
            right_i[i+1] = right_i[i];
        }
        else{
            left_i[i+1] = left_i[i];
            right_i[i+1] = right_i[i] + 1;
            choose *= (left_i[i] - right_i[i]);
            choose %= N;
        }
    }

    if(choose < 0)ok = false;

    cout << (ok ? choose * dp[n] % N : 0) << endl;
    return 0;
}

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

int main() {
  int N = 0;

  cin >> N;
  vector<uint64_t> confs(N);
  for (int i = 0; i < N; i++) {
    cin >> confs[i];
  }
  sort(confs.begin(), confs.end(),
       [](uint64_t a, uint64_t b) { return a > b; });
  int mid_point_index = 0;

  uint64_t result = 0;
  for (int inserted_index = 1; inserted_index < N; inserted_index++) {
    result += confs[mid_point_index];
    if (inserted_index == 1) {
      mid_point_index = 1;
    } else if (inserted_index % 2 == 1) {
      mid_point_index++;
    }
  }
  cout << result << endl;
}


Measured memory_bytes: 4796
#include<iostream>
#include<string>
#include<algorithm>
#include<bits/stdc++.h>
using namespace std;

int main(){
  int N;
  cin >> N;
  long long L[N+1];
  L[0]=2; L[1]=1;
  if(N==1){
    cout << '1' << endl;
    return 0;
  }
  for(int i=2; i<=N; i++){
    L[i]=L[i-1]+L[i-2];
}cout << L[N] << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
#define x first
#define y second
#define mp make_pair
#define pb push_back
#define enum(i,x,y) for(int i=(x);i<=(y);++i)
#define try(i,x,y) for(int i=(x);i>=(y);--i)
template <typename TYPE> inline void chkmax(TYPE &x,TYPE y){x<y?x=y:0;}
template <typename TYPE> inline void chkmin(TYPE &x,TYPE y){y<x?x=y:0;}
template <typename TYPE> void readint(TYPE &x)
{
    x=0;int f=1;char c;
    for(c=getchar();!isdigit(c);c=getchar())if(c=='-')f=-1;
    for(;isdigit(c);c=getchar())x=x*10+c-'0';
    x*=f;
}
const int MAXN=105;

char s[MAXN];
int n,len[MAXN],m;
ll k;

int main()
{
	scanf("%s",s+1);readint(k);
	n=strlen(s+1);
	int cur=0;
	enum(i,1,n)
		if(s[i]!=s[i+1])len[++m]=cur+1,cur=0;
		else ++cur;
	if(m==1)printf("%lld\n",(n*k)/2);
	else
	{
		int sum=0;
		enum(i,2,m-1)sum+=len[i]/2;
		if(s[1]==s[n])
			printf("%lld\n",len[1]/2+len[m]/2+(len[1]+len[m])/2*(k-1)+sum*k);
		else
		{
			sum+=len[1]/2+len[m]/2;
			printf("%lld\n",sum*k);
		}
	}
    return 0;
}

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

using namespace std;

typedef long long int ll;
typedef pair<int,int> P;

#define rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=int(a);i<(b);i++)
#define repr(i,b,a) for(int i=int(b);i>=(a);i--)
#define all(x) x.begin(),x.end()

const ll mod = 1e9+7;
const ll INF = 1e9;

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
bool valid(int lx,int ux,int ly,int uy,int x,int y){
	return lx<=x&&x<ux&&ly<=y&&y<uy; 
}
ll power(ll x,ll p){
	if(p==0)return 1;
	ll res=power(x*x%mod,p/2);
	if(p%2==1)res=res*x%mod;
	return res;
}

const int ss = 2e5+10;

ll n,k;
ll a[ss];

void input(){
	cin>>n>>k;
	rep(i,n){
		cin>>a[i];
		a[i]--;
	}
}

int solve(){
	ll num[ss]={};
	rep(i,ss)num[i]=-1;

	ll p=0, cnt=0;
	while(num[p]<0&&cnt<k){
		num[p]=cnt;
		cnt++;
		p=a[p];
	}

	if(cnt==k){
		return p+1;
	}

	k-=cnt;
	cnt=0;
	ll q=p;
	rep(i,ss)num[i]=-1;
	while(num[p]<0&&cnt<k){
		num[p]=cnt;
		cnt++;
		p=a[p];
	}
	if(cnt==k){
		return p+1;
	}

	// cout<<l<<" "<<cnt<<" "<<p<<" "<<num[p]<<endl;

	// k-=num[p];
	k%=cnt;
	p=q;
	while(k>0){
		p=a[p];
		k--;
	}
	return p+1;
}

int main()
{
	input();
	cout<<solve()<<endl;
	return 0;
}

Measured memory_bytes: 6728
#include <iostream>
#include <vector>
#include <cstdlib>
#include <algorithm>
#include <numeric>
using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
using vi = vector<int>; // intの1次元の型に vi という別名をつける
using vvi = vector<vi>; // intの2次元の型に vvi という別名をつける
using vl = vector<ll>;  // long longの1次元の型に vl という別名をつける
using vvl = vector<vl>; // long longの2次元の型に vvl という別名をつける
int MOD = 1000000007; //10^9 + 7

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

// 無限大の値
const ll  LINF = 1LL << 60;
const int iINF = 1 << 29;

int main(void){
  int a,b;
  cin >> a >> b;
  if(a == 1) cout << (b == 1 ? "Draw" : "Alice") << endl;
  else if(b == 1) cout << "Bob" << endl;
  else if(a == b) cout << "Draw" << endl;
  else cout << (a > b ? "Alice" : "Bob") << endl;
  return 0;
} 

Measured memory_bytes: 3572
import java.util.Arrays;
import java.util.Scanner;

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

        final int[] evens = Arrays.stream(scanner.nextLine().split(" "))
                .mapToInt(Integer::parseInt)
                .filter(i -> i % 2 == 0)
                .toArray();

        boolean approved = true;
        for (int i: evens) {
            if (i % 3 != 0 && i % 5 != 0) {
                approved = false;
                break;
            }
        }

        System.out.println(approved ? "APPROVED" : "DENIED");
    }
}

Measured memory_bytes: 28496
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
typedef long long ll;

int main(){
	ll l, r;
	cin >> l >> r;
	int ans = 2019;
  if (r-l >= 2019) { cout << 0 << endl; return 0; }

  for (ll i = l; i < r; i++) {
    for (ll j = i + 1; j <= r; j++) {
      ans = min(ans, (int)(i * j % 2019));
      if (ans == 0){
          cout << 0 << endl;
          return 0;
      }
    }
  }
  cout << ans << endl;
}

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

#define MAX_NUM (1000000000 + 7)

typedef uint64_t u64;
typedef int64_t i64;
typedef uint32_t u32;
typedef int32_t i32;

using namespace std;

template <typename T>
static inline void ArrayInput(vector<T>& A) {
  for (auto itr = A.begin(); itr < A.end(); ++itr) cin >> *itr;
}

template <typename T>
static inline void ArrayPut(const vector<T>& A) {
  for (auto itr = A.begin(); itr < A.end(); ++itr) cout << *itr << " ";
  cout << endl;
}

template <typename T>
static inline T ArraySum(vector<T>& A) {
  T res = 0;
  for (auto itr = A.begin(); itr < A.end(); ++itr) res += *itr;
  return res;
}

bool Sec_compare(pair<uint64_t, uint64_t> a, pair<uint64_t, uint64_t> b) {
  if (a.second != b.second) {
    return a.second < b.second;
  } else {
    return a.first < b.first;
  }
}

u64 dec_dig(u64 num) {
  u64 res = 0;
  while (num > 0) {
    num /= 10;
    ++res;
  }
  return res;
}

u64 gcd(u64 a, u64 b) {
  if (a < b) {
    a ^= b;
    b ^= a;
    a ^= b;
  }

  return b ? gcd(b, a % b) : a;
}

int main() {
  cout << setprecision(18);
  u32 N, M;
  cin >> N >> M;
  vector<u32> H(N);
  ArrayInput(H);
  vector<vector<u32>> Tree(N);
  for (u32 i = 0; i < M; ++i) {
    u32 A, B;
    cin >> A >> B;
    Tree[A - 1].push_back(B - 1);
    Tree[B - 1].push_back(A - 1);
  }
  u32 res = 0;
  for (u32 i = 0; i < N; ++i) {
    bool flag = true;
    for (auto itr = Tree[i].begin(); itr != Tree[i].end(); ++itr) {
      if (H[i] <= H[*itr]) {
        flag = false;
        break;
      }
    }
    if (flag) res++;
  }

  cout << res << endl;
  return 0;
}


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

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

int main() {
    ll a, b;
    cin >> a >> b;

    ll t = gcd(a, b);

    int cnt = 0;

    for(ll i = 2; i*i <= t; ++i) {
        if(t % i != 0) continue;
        ++cnt;
        while(t % i == 0) {
            t /= i;
        }
    }
    if(t != 1) ++cnt;

    cnt += 1;
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 3620
from collections import Counter
N = int(input())
A = list(map(int, input().split()))
ans = sum(A)
cnt = Counter(A)
Q = int(input())
for _ in range(Q):
    a, b = map(int, input().split())
    ans += (b-a)*cnt[a]
    cnt[b] += cnt[a]
    cnt[a] = 0
    print(ans)

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

using namespace std;

#define INF 100000000
#define YJ 1145141919
#define INF_INT_MAX 2147483647
#define INF_LL 9223372036854775
#define INF_LL_MAX 9223372036854775807
#define EPS 1e-10
#define MOD 1000000007
#define MOD9 998244353
#define Pi acos(-1)
#define LL long long
#define ULL unsigned long long
#define LD long double

#define int long long

using II = pair<int, int>;

int gcd(int a, int b) { return b != 0 ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a * b / gcd(a, b); }
int extgcd(int a, int b, int &x, int &y) { int g = a; x = 1; y = 0; if (b != 0) g = extgcd(b, a % b, y, x), y -= (a / b) * x; return g; }

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(a)  begin((a)), end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())

signed main()
{
  int K, X;
  cin >> K >> X;
  FOR(x,X-K+1,X+K) {
    cout << x;
    if(x < X+K-1) cout << " ";
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>

int main () {
  std::string s; std::cin >> s;
  char c = s[(int)(s.size())-1];
  if (c == '3')
    std::cout << "bon\n";
  else if (c == '0' || c == '1' || c == '6' || c == '8')
    std::cout << "pon\n";
  else
    std::cout << "hon\n";
  return 0;
}

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

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

using i64 = int_fast64_t;
using f64 = double;
using p64 = pair<i64, i64>;

constexpr i64 INF = INT_FAST64_MAX / 2;
constexpr f64 EPS = DBL_EPSILON;

void solve() {
    string a;
    cin >> a;
    i64 n = a.size();

    i64 ans = n * (n - 1) / 2 + 1;
    map<char, i64> cnt;
    for (auto& e : a) ans -= cnt[e], cnt[e]++;
    cout << ans << endl;
}

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


Measured memory_bytes: 720
#include "bits/stdc++.h"
#define in std::cin
#define out std::cout
#define rep(i,N) for(int i=0;i<N;++i)
typedef long long int LL;

LL D, N;

int main()
{
	in >> D >> N;
	if (N == 100) out << 101 * (LL)pow(100, D) << std::endl;
	else out << N * (LL)pow(100, D) << std::endl;
	return 0;
}


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

using namespace std;
#define rep(i, n) for (ll i = 0; i < (n); ++i)
//#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) ll(x.size())
//typedef long long ll;
typedef long long ll;
//typedef pair<int, int> P;
typedef pair<ll, ll> P;
//const double INF = 1e10;
const ll INF = 10e15;
const ll MINF = -10e10;
//const int INF = INT_MAX / 100;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)


//ifstream myfile("~/Downloads/02.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);

typedef priority_queue<P, vector<P>, greater<P> > PQ_ASK;
const int mod = 1000000007;

int main() {

    vector<int> nums(3);
    rep(i, 3) cin >> nums[i];
    sort(nums.begin(), nums.end());
    printf("%d %d %d\n", nums[0], nums[1], nums[2]);
}



Measured memory_bytes: 3228
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ll_s long
#define mod 1000000007
#define forn(i,start,lim) for(ll i=start;i<lim;i++)
#define forn_d(i,start,lim) for(ll i=start;i>=lim;i--)
#define f first
#define s second
#define pb push_back
#define pf push_front
#define mp make_pair
#define debug1(a) cout<<"------\n"<<#a<<" = "<<a<<endl<<"------"<<endl
#define debug2(a,b) cout<<"--------------\n"<<#a<<" = "<<a<<" ; "<<#b<<" = "<<b<<endl<<"--------------"<<endl
#define debug3(a,b,c) cout<<"----------------------\n"<<#a<<" = "<<a<<" ; "<<#b<<" = "<<b<<" ; "<<#c<<" = "<<c<<endl<<"----------------------"<<endl
#define sz(a) (ll)(a.size())
#define debug4(a) cout<<"chu "<<a<<endl
#define endl "\n"

ll n,a[25][25];

int main()
{
  ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	cin>>n;
	forn(i,0,n){
		forn(j,0,n)
			cin>>a[i][j];
	}
	vector <ll> dp(1<<n,0);
	// dp[mask] - number of ways in which woman (1s) are matched with 1st x men ; x-pop count of mask
	dp[0]=1;
	for(ll mask=0;mask<(1<<n);mask++){
		ll m=__builtin_popcount(mask);
		for(ll w=0;w<n;w++){
			if(!(mask&(1<<w)) && a[m][w]){
				ll mask2=mask^(1<<w);
				dp[mask2]=(dp[mask2]+dp[mask])%mod;
			}
		}
	}
	ll ans=dp[(1<<n)-1];
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 16640
#include <stdio.h>
 
int main(void)
{
    static char prime[1000002];
    long i, j;
    long n, ans;
     
    for (i = 1; i <= 1000000; i += 2){
        prime[i] = 1;
    }
     
    prime[1] = 0;
    prime[2] = 1;
     
    for (i = 1; i <= 1000; i += 2){
        if (prime[i] == 1){
            for (j = 3; i * j <= 1000000; j += 2){
                prime[i * j] = 0;
            }
        }
    }
     
    while (1){
        scanf(" %ld", &n);
         
        if (n == 0){
            break;
        }
         
        ans = 0;
        for (i = 2; i <= n / 2; i++){
            if (prime[i] && prime[n - i]){
                ans++;
            }
        }
         
        printf("%ld\n", ans);
    }
    return 0;
}

Measured memory_bytes: 1576
#include <cmath>
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
#include <functional>
using namespace std;
int main() {
	long long X;
	cin >> X;
	long long cur = 100;
	int years = 0;
	while (cur < X) {
		cur = cur + cur / 100;
		++years;
	}
	cout << years << endl;
	return 0;
}

Measured memory_bytes: 3592
/* 
        *** LONGEST COMMON PREFIX ***
*/

#pragma GCC optimize ("O3")

#pragma GCC optimize("Ofast")

/* 
   *********************************************************
    Code_Blooded Human == @{{ samrat_12   [  0_0  ^_^  ] }}
   *********************************************************
*/
#include <bits/stdc++.h>
#include<algorithm>
#include<queue>
#include<list>
#include<map>
#include <math.h>
#include<numeric>
using namespace std;
#define E "\n"
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define  ipfile    ifstream cin ("input.txt");std::cin.rdbuf(std::cin.rdbuf())
#define ll long long int
#define ull unsigned long long int
#define db long double
#define mod 1000000007
#define vll vector<ll>
#define all(v) v.begin(),v.end()
#define GCD(m,n) __gcd(m,n)
#define LCM(m,n) m*(n/GCD(m,n))
#define REVVEC(v) reverse(v.begin(),v.end())
#define REVARR(a) reverse(a,a+n)
#define maxc(v) max_element(all(v))
#define minc(v) min_element(all(v))
#define inputarr(a,n) for(int xxx=0;xxx<n;++xxx) cin>>a[xxx]
#define outputarr(a,n) for(int xxx=0;xxx<n;xxx++) cout<<a[xxx]<<" "
#define rep(i,m, n)    for(int i = m; i < (n); ++i)
#define sp setprecison(10)
#define cint(x) scanf("%ld",&x)
#define cstr(s) scanf("%s",s)
#define sz(s) (s.length())
#define vz(v) v.size()

void TestCase1()
{
    
    int k,n;
    cin>>k>>n;
    if((k*500)>=n)
    cout<<"Yes\n";
    else
    cout<<"No\n";
    
}

void TestCase2()
{
    
    
    
}

signed main()
{
    FAST
    
    //TestCase2();
    
    TestCase1();
    
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(size_t i=0;i<(size_t)(n);i++)
#define rrep(i,n) for(size_t i=(size_t)(n)-1;i>=0;i--)
#define each(a,x) for(auto a : (x))
#define all(a) (a).begin(),(a).end()
#define chmin(a,b) ((a) = min((a),(b)))
#define chmax(a,b) ((a) = max((a),(b)))
#define in_range(x,l,r) ((l)<=(x) && (x)<(r))
#define printvec(a) rep(i,a) cout << a[i] << " \n"[i+1==(a).size()];
#define fs first
#define sc second
#define em emplace
#define eb emplace_back
#define sz size()
#define MP make_pair
using namespace std;
typedef long long ll;
typedef double D;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vs;

const ll INF = 1e8;
const D EPS = 1e-8;
const ll MOD = 1e9+7;

int main(){
  int h,w;
  cin >> h >> w;
  rep(i,h)rep(j,w){
    string s; cin >> s;
    if(s == "snuke"){
      cout << (char)('A'+j) << i+1 << endl;
      break;
    }
  }
}


Measured memory_bytes: 256