akhauriyash/Code-Regression huggingface dataset:
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		int[] x = new int[M];
		int[] y = new int[M];
		for (int i = 0; i < M; i++) {
			x[i] = sc.nextInt() - 1;
			y[i] = sc.nextInt() - 1;
		}

		boolean[] red = new boolean[N];
		int[] num = new int[N];
		Arrays.fill(red, false);
		red[0] = true;
		Arrays.fill(num, 1);

		for (int i = 0; i < M; i++) {
			num[x[i]] -= 1;
			num[y[i]] += 1;
			if (red[x[i]]) {
				red[y[i]] = true;
				if (num[x[i]] <= 0) {
					red[x[i]] = false;
				}
			}
		}

		int ans = 0;
		for (int i = 0; i < N; i++) {
			if (red[i]) {
				ans++;
			}
		}
		System.out.println(ans);
	}
}


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

const ll INF = 1LL << 60;

ll N, M;
vector<P> v;

// 宝箱を開ける時に必要な最小コスト
ll dp[5000];

int main() {
    cin >> N >> M;
    v.resize(M);
    rep(i, M) {
        ll a, b;
        cin >> a >> b;

        int s = 0;
        rep(j, b) {
            ll c;
            cin >> c;
            c--;
            s |= (1 << c);
        }
        // s を開けるのに a 円必要
        v[i] = P(s, a);
    }

    rep(i, 5000) dp[i] = INF;
    sort(v.begin(), v.end());

    // rep(i, v.size()) {
    //     cout << v[i].first << " " << v[i].second << endl;
    // }
    // return 0;

    dp[0] = 0;


   for (int i = 0; i < (1 << N); i++) {
        for (int j = 0; j < M; j++) {
            // 使う
            ll idx = v[j].first;
            ll cost = v[j].second;

            // cout << cost << " " << idx << endl;
            dp[i | idx] = min(dp[i | idx],  dp[i] + cost);
        }
    }

    if (dp[(1 << N) - 1] == INF) {
        cout << -1 << endl;
    } else {
        cout << dp[(1 << N) - 1] << endl;
    }
}

Measured memory_bytes: 3536
import java.util.Scanner

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val s = sc.next()
    val dateInt = s.split("/").map { it.toInt() }
    val year = dateInt[0]
    val month = dateInt[1]
    val day = dateInt[2]
    if (year > 2019) {
        println("TBD")
        return
    } else if (year < 2019) {
        println("Heisei")
        return
    }
    // 以下は2019年のみ
    if (month > 4) {
        println("TBD")
        return
    }
    if (month == 4) {
        if (day <= 30) {
            println("Heisei")
            return
        }
    }
    println("Heisei")
    return
}

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

int main() {
  vector<int> a(3);
  cin >>a.at(0) >>a.at(1) >>a.at(2);
  sort(a.begin(),a.end());
  int s;
  s = a.at(0)+a.at(1);
  if(s==a.at(2)){
    cout <<"Yes" <<endl;
  }
  else{
    cout <<"No" <<endl;
  }

}

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

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

    bool c[26];
    for (int i = 0; i < 26; i++) {
        c[i] = false;
    }
    if (s.size() < 26) {
        for (int i = 0; i < s.size(); i++) {
            c[s[i] - 'a'] = true;
        }
        for (int i = 0; i < 26; i++) {
            if (!c[i]) {
                cout << s << (char)('a' + i) << endl;
                return 0;
            }
        }

    } else {
        // for (int i = 24; i >= 0; i--) {
        //     if (s[i + 1] > s[i]) {
        //         cout << s.substr(0, i) << s[25] << endl;
        //         return 0;
        //     }
        // }
        char a[26];
        for (int i = 0; i < 26; i++) {
            a[i] = s[i];
        }
        if (!next_permutation(a, a + 26)) {
            cout << "-1" << endl;
            return 0;
        }

        for (int i = 0; i < 26; i++) {
            cout << a[i];
            if (a[i] != s[i]) {
                break;
            }
        }
        cout << endl;
    }

}


Measured memory_bytes: 256
H, W = map(int, input().split())

m = []
l = []
end = 0
for y in range(H):
    h = list(input())
    m.append(h)
    for x, w in enumerate(h):
        if w == '#':
            l.append([y, x])
            end += 1
HW = H * W
ans = 0
# print(m[2][0]) m[y][x]
while (end < HW):
    nl = []
    for ll in l:
        if (0 < ll[1]):
            if (m[ll[0]][ll[1] - 1] == '.'):
                m[ll[0]][ll[1] - 1] = '#'
                end += 1
                nl.append([ll[0], ll[1] - 1])

        if (ll[1] < W - 1):
            if (m[ll[0]][ll[1] + 1] == '.'):
                m[ll[0]][ll[1] + 1] = '#'
                end += 1
                nl.append([ll[0], ll[1] + 1])

        if (0 < ll[0]):
            if (m[ll[0] - 1][ll[1]] == '.'):
                m[ll[0] - 1][ll[1]] = '#'
                end += 1
                nl.append([ll[0] - 1, ll[1]])

        if (ll[0] < H - 1):
            if (m[ll[0] + 1][ll[1]] == '.'):
                m[ll[0] + 1][ll[1]] = '#'
                end += 1
                nl.append([ll[0] + 1, ll[1]])

    l = nl
    ans += 1

print(ans)

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

#define db(x) cout<<x<<'\n'
#define db1(x) cout<<#x<<"="<<x<<'\n'
#define db2(x,y) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<'\n'
#define db3(x,y,z) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<","<<#z<<"="<<z<<'\n'
#define repi(i,n) for(int i=0;i<(n);++i)
//#define repA(i,a,n) for(int i=a;i<=(n);++i)
//#define repD(i,a,n) for(int i=a;i>=(n);--i)
#define ll long long int
#define endl '\n'
#define lld long long double
#define vi vector<int> 
#define vl vector<ll> 
#define vb vector<bool> 
#define vvi vector<vector<int>  >
#define err(t) cout<<"Error : "<<t<<endl;
#define all(v) v.begin(),v.end()
#define mp make_pair
#define M 100000
#define MD 1000000007
#define pb push_back
#define rep(i,a,b) for(ll i = a; i <= (b); i++)
#define pii pair<int,int>
#define pll pair<ll,ll> 
#define vec(a) vector<a >
#define se second
#define fi first
#define inf 0xffffffff
#define inchar getchar_unlocked
#define outchar(x) putchar_unlocked(x)

const double PI=3.14159265358979323846264338327;
int32_t main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);cout.tie(NULL);
	// int n;cin>>n;
	// string s;cin>>s;
	
	//ll n;cin>>n; vl a(n); repi(i,n) cin>>a[i];
	double a,b,h,m;
	cin>>a>>b>>h>>m;
	double ha=h*30+0.5*m;
	double ma=6*m;
	double an=abs(ha-ma);if(an>180) an=360-an;
	cout<<setprecision(20)<<sqrtl(a*a+b*b-2*a*b*cos(an*PI/180))<<endl;
	
	/*
	int test1;cin>>test1;while(test1--){ 
		
	 }
	 //*/
return 0;
}



Measured memory_bytes: 4208
// A - 居合を終え、青い絵を覆う / UOIAUAI
#include <bits/stdc++.h>
using namespace std;
#define ote(x) cout<<(x)<<endl

int main(){
	char c; cin>>c;
	if(c=='a') ote("vowel");
	else if(c=='i') ote("vowel");
	else if(c=='u') ote("vowel");
	else if(c=='e') ote("vowel");
	else if(c=='o') ote("vowel");
	else ote("consonant");
}

Measured memory_bytes: 256
package main

import (
  "fmt"
)

func main() {
  var N int
  fmt.Scan(&N)

  Vs := make([]int, 0, N)
  for i := 0; i < N; i++ {
    var V int
    fmt.Scan(&V)
    Vs = append(Vs, V)
  }
  
  max := 0
  for i := 0; i < N; i++ {
    var C int
    fmt.Scan(&C)
    if Vs[i] > C {
      max += Vs[i] - C
    }
  }
  fmt.Println(max)
}

Measured memory_bytes: 512
#include <stdio.h>
#define mod 1000000007
typedef long long ll;

ll mul(ll a, ll b) {
  return a * b % mod;
}

ll rev(ll a) {
  ll ans = 1, b = mod - 2;
  while(b) {
    if(b & 1) ans = mul(ans, a);
    a = mul(a, a), b >>= 1;
  }
  return ans;
}
    

int main(void) {
  ll i, j, n, m, now = 1, c = 1, ans = 0, t = 1;
  scanf("%lld", &n);
  char s[1000010];
  scanf("%s", s);
  for(m = 0; s[m]; ++m);
  for(i = 0; i < n + 1; ++i) 
    ans += mul(now, c), ans %= mod, now = mul(now, 25), c = mul(c, mul(rev(i + 1), n + m - i));
  printf("%lld", ans);
  return 0;
}

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

int main(){
    string s;
    cin >> s;
    char ch[26];
    int num[26]={};
    string ans = "None";
    for(int i = 0; i < 26; i++) ch[i] = 'a' + i;
    for(int i = 0; i < s.size(); i++){
        for(int j = 0; j < 26; j++){
            if(s[i] == ch[j]) num[j]++;
        }
    }
    for(int i = 0; i < 26; i++){
        if(num[i] == 0){ans = ch[i]; break;}
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 512
/* B - String Palindrome */

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int Palindrome(char *s, int l, int r){
  int i, truth;
  for(i = 0; i <= (r - l) / 2; i++){
    if(s[l + i] != s[r - i]){
      truth = 0;
      break;
    }
    if(i == (r - l) / 2){
      truth = 1;
    }
  }
  return truth;
}

int main(void){
  char S[100];
  int N;
  scanf("%s", S);
  N = strlen(S);
  if(Palindrome(S, 0, N - 1) == 1 && Palindrome(S, 0, (N - 3) / 2) == 1 && Palindrome(S, (N + 1) / 2, N - 1) == 1){
    printf("Yes\n");
  }else{
    printf("No\n");
  }
}


Measured memory_bytes: 128
N,P = map(int,input().split())
if N==1 or P==1:
    print(P)
else:
    k = 0
    x = P
    while x>1:
        x = x//2
        k += 1
    if N>k:
        print(1)
    else:
        cmax = 1
        for i in range(1,int(P**0.5)+1):
            if P%(i**N)==0:
                cmax = i
        print(cmax)

Measured memory_bytes: 73828
#include <stdio.h>

int main() {
int n, m, X, Y;
scanf("%d %d %d %d", &n, &m, &X, &Y);
int x[n];
int y[m];

for (int i = 0; i < n; i++) {
scanf("%d", &x[i]);
}
for (int j = 0; j < m; j++) {
scanf("%d", &y[j]);
}

int Xmax = -100;
for (int i = 0; i < n; i++) {
if (Xmax < x[i]) {
Xmax = x[i];
}
}
if (Xmax < X) {
Xmax = X;
}
int Ymin = 100;
for (int j = 0; j < m; j++) {
if (Ymin > y[j]) {
Ymin = y[j];
}
}
if (Ymin > Y) {
Ymin = Y;
}

if (Xmax >= Ymin) {
printf("War");
} else {
printf("No War");
}
return 0;
}

Measured memory_bytes: 128
import sys
import math
from decimal import Decimal
sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    a, b = input().split()
    res = math.floor(Decimal(a) * Decimal(b))
    print(res)


if __name__ == '__main__':
    resolve()


Measured memory_bytes: 10080
s = input()
ans = float("inf")
for i in range(26):
  c = chr(ord("a")+i)
  if c not in s:
    continue
  temp = s
  count = 0
  while set(temp) != {c}:
    t = ""
    for j in range(len(temp)-1):
      if temp[j] == c or temp[j+1] == c:
        t += c
      else:
        t += "#"
    temp = t
    count += 1
  ans = min(ans, count)
print(ans)

Measured memory_bytes: 3064
x,n=map(int,input().split())
s=sorted(list(map(int, input().split())))
a=x
b=x
if n==0:
    print(x)
    exit()
for i in range(n+100):
    if not (a in s):
        print(a)
        exit()
    if not (b in s):
        print(b)
        exit()
    a-=1
    b+=1


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

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

#define int long long

string solve(int k, int n){
	string res = "";
	rep(i,200){
		res += to_string(i);
	}
	return res.substr(k,n);
}

string solve(int s, int k, int n){
	string res = "";
	for (int i = s; res.size() < k + 200; i++) {
		res += to_string(i);
	}
	return res.substr(k, n);
}

signed main(){
	int k, n;
	while(cin >> k >> n, k||n){
		if(k <= 10){
			cout << solve(k, n) << endl;
			continue;
		}

		int i = 2;
		int t = 10, q = 100, d = 10;
		int idx = 10;
		while(k > idx + (q - d) * i){
			idx += (q - d) * i;
			t += q - d;
			q *= 10;
			d *= 10;
			i++;
		}

		int diff = k - idx;
		int times = diff / i;
		//cout << t + times << ' ' << diff % i << endl;
		cout << solve(t + times, diff % i, n) << endl;
	}
}



Measured memory_bytes: 3216
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

int N, M;
vector <int> G[100005];

bool visited[100005][3];

int main() {
    ios_base::sync_with_stdio(false);
    cin >> N >> M;
    for(int i = 0; i < M; i++) {
        int a, b;
        cin >> a >> b;
        G[a].push_back(b);
//        G[b].push_back(a);
    }

    int S, T;
    cin >> S >> T;

    queue <pair<int, int>> q;
    q.push({S, 0});

    while(!q.empty()) {
        int v = q.front().first;
        int dis = q.front().second;
        q.pop();
        if(visited[v][dis % 3])
            continue;
        visited[v][dis % 3] = true;
        if(v == T && dis % 3 == 0) {
            cout << dis / 3 << endl;
            return 0;
        }

        for(auto u: G[v]) if(!visited[u][(dis + 1) % 3]) {
            q.push({u, dis + 1});
        }
    }
    cout << -1;
}


Measured memory_bytes: 6016
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(ll i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  ll n;
  cin >> n;
  vl a(n);
  rep(i, n) cin >> a[i];
  bool ok = true;
  if(a[0] != 0) ok = false;
  rep(i, n - 1) if(a[i] + 1 < a[i + 1]) ok = false;
  if(!ok) {
    cout << -1 << endl;
    return 0;
  }
  ll ans = 0;
  rep(i, n - 1) {
    if(a[i + 1] - 1 == a[i])
      ans++;
    else
      ans += a[i + 1];
  }
  cout << ans << endl;
}

Measured memory_bytes: 4812
#include <iostream>
#include <cmath>
#include <vector>
#include <bitset>
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <climits>
#include <set>
#include <map>
#include <iomanip>
#include <cassert>
#include <functional>
#include <cstring>

using namespace std;

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

typedef pair<int, int> P;
#define mp make_pair
#define FOR(i, a, b) for(int (i)=a;(i)<(b);++(i))
#define rep(i, n)  FOR(i,0,n)
#define rrep(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define vsort(v) sort((v).begin(), (v).end());					//小さい順
#define rvsort(v) sort(v.begin(), v.end(),greater<int>());		//大きい順
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define all(c) (c).begin(),(c).end()
#define ll long long
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define vs vector<string>
#define vc vector<char>
#define vvc vector<vector<char>>
#define Print(p) cout<<(p)<<endl
#define F first
#define S second
#define pb push_back
#define mod 1000000007LL
#define INF 12345678901234567

const int maxn = 1e5 + 10;

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

	int n;ll k; cin >> n >> k;

	ll kazu[maxn] = { 0 };

	int a, b;
	rep(i, n)
	{
		cin >> a >> b;
		a--;
		kazu[a] += b;
	}
	int i = -1;
	while(k > 0)
	{
		i++;
		k -= kazu[i];
	}
	Print(i+1);

	return 0;
	
}

Measured memory_bytes: 1024
#include "bits/stdc++.h"
#define Rep(i,n) for(int i=0;i<(int)(n);i++)
#define For(i,n1,n2) for(int i=(int)(n1);i<(int)(n2);i++)
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define RREP(i,n) for(ll i=((ll)(n)-1);i>=0;i--)
#define FOR(i,n1,n2) for(ll i=(ll)(n1);i<(ll)(n2);i++)
#define RFOR(i,n1,n2) for(ll i=((ll)(n1)-1);i>=(ll)(n2);i--)
#define all(a)  (a).begin(),(a).end()
#define IOS std::cin.tie(0),std::ios::sync_with_stdio(false)

namespace idaten {

	using namespace std;
	using ll = int_fast64_t;
	using ull = uint_fast64_t;
	using P = std::pair<int64_t, int64_t>;
	template<typename T1, typename T2> inline bool chmin(T1& a, T2 b) { if (a > b) { a = b; return 1; }return 0; }
	template<typename T1, typename T2> inline bool chmax(T1& a, T2 b) { if (a < b) { a = b; return 1; }return 0; }
	template<class T> inline std::istream& operator >> (std::istream& is, std::vector<T>& v) { for (T& x : v) { is >> x; }return is; }
	template<class T> inline std::ostream& operator << (std::ostream& os, const std::vector<T>& v) {
		for (auto itr = v.begin(); itr != v.end();) { os << (*itr) << ((++itr != v.end()) ? " " : ""); }
		return os;
	}
	template<class V, typename T>inline void fill(V& v, const T& val) { v = val; }
	template<class V, typename T>inline void fill(std::vector<V>& v, const T& val) { for (V& x : v) { fill(x, val); } }
	template<class V, typename H>inline void resize(std::vector<V>& v, const H h) { v.resize(h); }
	template<class V, typename H, typename... T>inline void resize(std::vector<V>& v, const H& h, const T& ... t) { v.resize(h); for (auto& x : v) { resize(x, t...); } }
	inline void put() {}
	template<class T> inline void put(const T& first) { std::cout << first << "\n"; }
	template<class T, class... N> inline void put(const T& first, const N& ... rest) { std::cout << first << " "; put(rest...); }

	void solve() {
		IOS;
		int n, k;
		cin >> n >> k;
		vector<int> res(n, 0);
		REP(i, k) {
			int d;
			cin >> d;
			vector<int> a(d);
			REP(j, d) {
				cin >> a[j];
				a[j]--;
				res[a[j]] = 1;
			}
		}
		int cnt = 0;
		REP(i, n) {
			if (res[i] == 0) {
				cnt++;
			}
		}
		put(cnt);
	}
} // namespace idaten

int main() {
	idaten::solve();
	return 0;
}


Measured memory_bytes: 3656
#include<bits/stdc++.h>
using namespace std;
using ll =long long;
#define REP(i,m,n) for(int i=(int)(m);i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define SORT(i) sort((i).begin(),(i).end())
constexpr int INF = 2000000000;
constexpr int mod = 1000000007;

int main() {
	string s; cin >> s;
	int ans = 0;
	rep(bit, (1 << 3)) {
		int a = s[0] - '0';
		rep (i, 3) {
			if (bit & (1 << i)) {
				a += s[i + 1] - '0';
			}
			else a -= s[i + 1] - '0';
		}
		if (a == 7)ans = bit;
	}
	cout << s[0];
	rep(i, 3) {
		if (ans & (1 << i)) {
			cout << '+';
		}
		else cout << '-';
		cout << s[i + 1];
	}
	cout << "=7" << "\n";

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int maxtime(int x) {
	return (x + 9) / 10 * 10;
}
int remtime(int x) {
	return maxtime(x) - x;
}
int main() {
	int A, B, C, D, E;
	cin >> A >> B >> C >> D >> E;
	int sum = maxtime(A) + maxtime(B) + maxtime(C) + maxtime(D) + maxtime(E);
	sum -= max({ remtime(A), remtime(B), remtime(C), remtime(D), remtime(E) });
	cout << sum << endl;
	return 0;
}
    
      


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int int64_t
using namespace std;
typedef pair<int, int> P;
const int INF = 100000000;

// グローバル変数


// 関数：


signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	int N; cin >> N;
	vector<int> a(N+1), b(N+1, 0);
	for (int i=1; i<=N; i++) {
		cin >> a.at(i);
	}
	
	for (int i=N; i>0; i--) {
		int sum = 0;
		for (int j=i+i; j<=N; j=j+i) {
			sum += b.at(j);
		}
		if (sum%2 != a.at(i)) b.at(i) += 1;
	}
	
	vector<int> ans;
	for (int i=1; i<=N; i++) {
		if (b.at(i)) {
			ans.push_back(i);
		}
	}
	cout << ans.size() << endl;
	for (int i=0; i<ans.size(); i++) {
		cout << ans.at(i);
		if (i==ans.size()-1) cout << endl;
		else cout << ' ';
	}
}


Measured memory_bytes: 5108
#include <stdio.h>
#include <iostream>
#include <string>
using namespace std;

int main()
{
    //std::string a;
    int A;
    int B;
    int C;
    int X;
    cin >> A;
    cin >> B;
    cin >> C;
    int out = A+B+C;
    if(out <= 21) cout<< "win" << endl;
    else cout << "bust" << endl;    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#define int long long
#define mod (int)(1e9+7)
#define inf (int)(3e18)
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define P std::pair<int,int>
#define PiP std::pair<int,std::pair<int,int>>
#define all(v) v.begin(),v.end()
#define mkp std::make_pair
#define prique(T) std::priority_queue<T,vector<T>,greater<T>>
using namespace std;
template<class T> inline void chmax(T& a, T b) { a = std::max(a, b); }
template<class T> inline void chmin(T& a, T b) { a = std::min(a, b); }

bool prime(int x) {
	for (int i = 2; i * i <= x; i++) {
		if (x % i == 0)return false;
	}
	return x != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= i; res %= mod;
	}
	return res;
}
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y) * mod_pow(kai(y, y), mod - 2, mod) % mod;
}
int get_rand(int MIN, int MAX) {
	std::random_device rnd;
	std::mt19937 mt32(rnd());
	std::uniform_int_distribution<int>engine(MIN, MAX);
	return engine(mt32);
}
/*--------Library Zone!--------*/

int ans[205];
signed main() {
	int n;
	cin >> n;

	string one;
	cout << "? " << 1;
	for (int i = 2; i <= n; i++)cout << " " << i;
	cout << endl;
	cin >> one;


	int l = 1, r = n + 1;
	while (r - l > 1) {
		int mid = (l + r) / 2;
		cout << "? " << mid;
		rep(i, n - 1)cout << " " << mid + i + 1;
		cout << endl;
		string t; cin >> t;
		if (t == one)l = mid;
		else r = mid;
	}
	if (one == "Red") {
		ans[l] = 1; ans[l + n] = -1;
	}
	else {
		ans[l] = -1; ans[l + n] = 1;
	}
	vector<int>v;
	for (int i = 1; i <= 2 * n; i++) {
		if (l <= i && i <= l + n)continue;
		cout << "? " << i;
		rep(j, n - 1)cout << " " << l + j + 1;
		cout << endl;
		string t; cin >> t;
		if (t == "Red")ans[i] = 1;
		else ans[i] = -1;
		v.push_back(i);
	}
	for (int i = l + 1; i < l + n; i++) {
		cout << "? " << i;
		for (int j : v)cout << " " << j;
		cout << endl;
		string t; cin >> t;
		if (t == "Red")ans[i] = 1;
		else ans[i] = -1;
	}
	cout << "! ";
	REP(i, 2 * n + 1) {
		if (ans[i] == 1)cout << "R";
		else cout << "B";
	}
	cout << endl;
}


Measured memory_bytes: 724
#include <stdio.h>
#include <assert.h>
#include <fstream>
#include <iostream>
#include <algorithm>
#include <array>
#include <vector>
#include <queue>
#include <set>
#include <cmath>
#include <unordered_map>
//#include <unordered_set>
//#include <boost/container/static_vector.hpp>
//#include <boost/unordered_set.hpp>
//#include <boost/unordered_map.hpp>
//#include <unistd.h>

const int MAX_N = 300;
const int MAX_M = MAX_N * MAX_N;
const long long INF = (long long)1000000000 * MAX_N;

const int MAX_R = 10;
const int BIT_MAX = (1 << MAX_R);

int N, M, R;
int r[MAX_R];
int A[MAX_M], B[MAX_M];
long long C[MAX_M];

long long dist[MAX_N][MAX_N];

long long dp[MAX_R][BIT_MAX];

long long res(const int i, const int bit) {
    //std::cout << "res:" << i << " " << bit << std::endl;
    if (dp[i][bit] != INF) {
        return dp[i][bit];
    }
    if (bit == (1 << R) - 1) {
        //std::cout << "check0:" << i << " " << bit << std::endl;
        dp[i][bit] = 0;
        return dp[i][bit];
    }
    //std::cout << "check:" << std::endl;
    long long ret = INF;
    for (int j = 1; j <= R; j++) {
        if (((bit >> (j - 1)) & 1) == 0) {
            //std::cout << "check:" << j << " " << dist[r[i]][r[j]] << std::endl;
            ret = std::min(ret, dist[r[i]][r[j]] + res(j, bit + (1 << (j - 1))));
        }
    }
    dp[i][bit] = ret;
    return ret;
}

int main(int argc, char **argv) {
    std::cin >> N >> M >> R;
    for (int i = 1; i <= R; i++) {
        std::cin >> r[i];
    }

    for (int i = 1; i <= M; i++) {
        std::cin >> A[i] >> B[i] >> C[i];
    }

    for (int i = 1; i <= N; i++) {
        for (int j = 1; j <= N; j++) {
            dist[i][j] = INF;
        }
        dist[i][i] = 0;
    }

    for (int i = 1; i <= M; i++) {
        dist[A[i]][B[i]] = C[i];
        dist[B[i]][A[i]] = C[i];
    }

    for (int k = 1; k <= N; k++) {
        for (int i = 1; i <= N; i++) {
            for (int j = 1; j <= N; j++) {
                dist[i][j] = std::min(dist[i][j], dist[i][k] + dist[k][j]);
            }
        }
    }

    for (int i = 1; i <= R; i++) {
        for (int b = 0; b < (1 << (R + 1)); b++) {
            dp[i][b] = INF;
        }
    }

    long long ret = INF;

    for (int i = 1; i <= R; i++) {
        int tmp = (1 << (i - 1));
        ret = std::min(ret, res(i, tmp));
    }

    std::cout << ret << std::endl;

    //std::cout << dp[3][5] << std::endl;

    return 0;

}

Measured memory_bytes: 1532
import java.util.Scanner;

public class Main {

	public void run() {
		Scanner sc = new Scanner(System.in);

		while (sc.hasNext()) {
			long a = sc.nextInt();
			long b = sc.nextInt();

			long c = gcd(a, b);

			long d = a * b / c;

			System.out.println(c + " " + d);
		}
		sc.close();
	}

	// 最大公約数
	// ユークリッドの互除法
	public long gcd(long a, long b) {
		if (b == 0) {
			return a;
		}
		else {
			return gcd(b, a % b);
		}
	}

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

}

Measured memory_bytes: 17220
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin >> n;
    vector<int> p(n);
    for(int i = 0; i < n; i++)
        cin >> p[i];
    int s = p[0];
    int t = p[0];
    int ans = 0;
    for(int i = 1; i < n; i++){
        if(s < p[i])
            s = p[i];
        else if(t > p[i]){
            t = p[i];
            ans++;
        }
    }
    cout << ans + 1 << endl;
    return 0;
}

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

int main(){
  ll h,n,b;
  b = 0;
  cin >> h >> n;
  vector<ll> A(n);
  rep(i,n){
    cin >> A[i];
    b += A[i];
  }
  if(h <= b) puts("Yes");
  if(h > b) puts("No");
  return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mp make_pair
#define ios ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
const ll mod=(int)1e9+7;

int main()
{
	ios;
	int x;
	cin>>x;
	if(x>=30) cout<<"Yes\n";
	else cout<<"No\n";
	
	return 0;
}


Measured memory_bytes: 3648
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstdio>
#include <iostream>
#include <vector>
#include<string>


using namespace std;


int main() {
	int N, A, B;
	cin >> N;

	long long p = 1, q = 1;
	for (int i = 0; i < N; i++)
	{
		cin >> A >> B;
		if (p%A != 0) p += A - (p % A);
		if (q%B != 0) q += B - (q % B);
		if (p / A*B > q) q = p / A*B;
		else p = q / B * A;
	}
	cout << p + q << endl;
}


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

int N;
const int MAX_N = 1e5 + 10;
int A[MAX_N];

ll cnt(bool flg) {
    ll sm = (ll)A[0], res = 0;
    if(flg && sm <= 0) res += -sm + 1, sm = 1;
    if(!flg && sm >= 0) res += sm + 1, sm = -1;
    for(int i = 1; i < N; ++i) {
        flg = sm > 0;
        sm += (ll)A[i];
        if(flg && sm >= 0) res += sm + 1, sm = -1;
        if(!flg && sm <= 0) res += -sm + 1, sm = 1;
    }
    return res;
}

int main()
{
    scanf("%d", &N);
    for(int i = 0; i < N; ++i) scanf("%d", &A[i]);
    ll res = min(cnt(true), cnt(false));
    printf("%lld\n", res);
    return 0;
}



Measured memory_bytes: 640
#include <stdio.h>
#include <iostream>
#include <string>
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
#define MOD 1000000007
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3f
#define EPS (1e-10)
using namespace std;
typedef long long ll;
typedef pair<int,int>P;
 
int long long dp[110][100010];
int long long c[110][2];
int main(){
  	int long long n, w;
  	cin >> n >> w;
	rep(i,n)rep(j,2)scanf("%d",&c[i][j]);
	//memset(dp,0x3f,sizeof(dp));
for(int long long i = 0; i < 100; i++){
    for(int long long j = 0; j < 100000; j++){
        dp[i][j] = 0;
    }
}
  //int long long q = c[0][1]
dp[0][c[0][0]] = c[0][1];
//dp[i][j] = max(dp[i - 1][j], dp[i - 1][j - c[i][0](w)] + c[i][1](v))
//max(dp[n - 1])
for(int long long i = 1; i < n; i++){
    for(int long long j = 0; j < w + 1; j++){
        if(j - c[i][0] >= 0){
            dp[i][j] = max(dp[i - 1][j], dp[i - 1][j - c[i][0]] + c[i][1]);
        }
        else{
            dp[i][j] = dp[i - 1][j];
        }
    }
}
 int long long ans = 0;
 for(int long long j = 0; j < w + 1; j++){
   if(ans < dp[n - 1][j]){
     ans = dp[n - 1][j];
   }
 }
	cout<<(ans)<<endl;
}

Measured memory_bytes: 80128
import java.util.Scanner;
import java.util.Arrays;
import java.util.ArrayList;

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

	int s = scan.nextInt();
	ArrayList<Integer> a = new ArrayList<Integer>();

	a.add(s);

	int index = 1;
	int flag = -1;
	while(true){
	    if(a.get(index-1) % 2 == 0){
		a.add(a.get(index-1) / 2);
	    }else{
		a.add(3*a.get(index-1)+1);
	    }
	    for(int i = index-1; i >= 0; i--){
		if(a.get(index) == a.get(i)){
		    flag = 1;
		    break;
		}
	    }
	    if(flag == 1){
		break;
	    }
	    index++;
	}
	/*
	for(int i = 0; i < a.size(); i++){
	    System.out.println(a.get(i));
	}
	*/
	System.out.println(index+1);
    }
}


Measured memory_bytes: 21588
// atcoder/abc172/B/main.cpp
// author: @___Johniel
// github: https://github.com/johniel/

#include <bits/stdc++.h>

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << "," << p.second << ")"; return os; }
template<typename P, typename Q> istream& operator >> (istream& is, pair<P, Q>& p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; for (auto& i: v) os << i << ","; os << ")"; return os; }
template<typename T> istream& operator >> (istream& is, vector<T>& v) { for (auto& i: v) is >> i; return is; }
template<typename T> ostream& operator << (ostream& os, set<T> s) { os << "#{"; for (auto& i: s) os << i << ","; os << "}"; return os; }
template<typename K, typename V> ostream& operator << (ostream& os, map<K, V> m) { os << "{"; for (auto& i: m) os << i << ","; os << "}"; return os; }

template<typename T> inline T setmax(T& a, T b) { return a = std::max(a, b); }
template<typename T> inline T setmin(T& a, T b) { return a = std::min(a, b); }

using lli = long long int;
using ull = unsigned long long;
using point = complex<double>;
using str = string;
template<typename T> using vec = vector<T>;

constexpr array<int, 8> di({0, 1, -1, 0, 1, -1, 1, -1});
constexpr array<int, 8> dj({1, 0, 0, -1, 1, -1, -1, 1});
constexpr lli mod = 1e9 + 7;

int main(int argc, char *argv[])
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.setf(ios_base::fixed);
  cout.precision(15);

  str s, t;
  while (cin >> s >> t) {
    int cnt = 0;
    for (int i = 0; i < s.size(); ++i) {
      cnt += (s[i] != t[i]);
    }
    cout << cnt << endl;
  }

  return 0;
}


Measured memory_bytes: 3804
#include <cstdio>

int main()
{
  double a;
  while (~scanf("%lf", &a)) {
    double ans = a;
    for (int i = 2; i <= 10; ++i) {
      if (i&1) {
	a /= 3.0;
      } else {
	a *= 2.0;
      }
      ans += a;
    }
    printf("%.8f\n", ans);
  }
  return 0;
}

Measured memory_bytes: 0
//agrawal117
//chahatagrawal117
#include<bits/stdc++.h>
#define endl '\n'
#define mod 1000000007
typedef long long int ll;
using namespace std;
#define MAX 100005
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll n,k,c; cin>>n>>k>>c;
    string s; cin>>s;
    ll prev[n+2];
    int idx=c+100; idx*=-1;
    ll cnt=0;
    // cout<<idx<<endl;
    vector<ll> v,v1;
    for(int i=0;i<s.size();i++){
        if(s[i]=='o')
        {
            if(i>(idx+c) && cnt<k) {
                idx=i;
                cnt++;
                v.push_back(i);
            }
            prev[i]=idx;
        }
    }
    ll next[n+2];
    idx=n+c+100;
    cnt=0;
    for(int i=s.size()-1;i>=0;i--)
    {
        if(s[i]=='o')
        {
            if(i<(idx-c) && cnt<k){ idx=i;  cnt++; v1.push_back(i);}
            next[i]=idx;
        }
    }
    // for(int i=0;i<k;i++) cout<<v[i]<<" "<<v1[i]<<endl;
    ll ans=0;
    reverse(v1.begin(),v1.end());
    for(int i=0;i<v.size();i++) if(v[i]==v1[i]) cout<<v[i]+1<<endl;
    // for(int i=0;i<s.size();i++){
    //     if(s[i]=='o' && prev[i]==next[i] && prev[i]==i) cout<<i+1<<endl;
    // }
    // cout<<ans<<endl;
}



Measured memory_bytes: 8072
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <iterator>
#pragma warning(disable:4996)
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223372036854775807
#define INF 2147483647
#define MOD 1000000007
using namespace std;


int main(int argc, char* argv[])
{
    long a[2];
    scanf("%ld%ld", &a[0], &a[1]);

    long count[3]={0};
    long k;
    for(k=0; k<2; k++) {
        if(a[k]==2) {
            count[0]++;
        }
        else if(a[k]==4 || a[k]==6 || a[k]==9 || a[k]==11 ) {
            count[1]++;
        }
        else {
            count[2]++;
        }
    }
    if(count[0]==2 || count[1]==2 || count[2]==2) {
        printf("Yes\n");
    }
    else {
        printf("No\n");
    }

    return 0;
}



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

int main() {
	ll x, k, d;
    cin >> x >> k >> d;
    x = abs(x);
    ll times = x / d;
    if(times > k) {
        x -= d*k;
        cout << abs(x) << endl;
        return 0;
    }

    k -= times;
    k %= 2;
    x -= d*times;
    if(k > 0) {
        x -= d;
    }
    cout << abs(x) << endl;
}


Measured memory_bytes: 3620
import java.math.BigInteger;
import java.util.*;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		long a = Long.parseLong(sc.next());
		long b = Long.parseLong(sc.next().replace(".", ""));

		BigInteger bigA = BigInteger.valueOf(a);
		BigInteger bigC = bigA.multiply(BigInteger.valueOf(b));
		BigInteger bigD = bigC.divide(BigInteger.valueOf(100));
		
		System.out.println(bigD.longValue());

	}

}

Measured memory_bytes: 35808
#include <bits/stdc++.h>
#include <limits.h>
#include <algorithm>  
#include <numeric>
 
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
 
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define endl '\n'
using ll = long long;
 
const int precision = 3;
const int modulo =  1000000007; // 10^9 + 7
const ll lmodulo =  1000000007; // 10^9 + 7
 
const double EPS = 1e-9;
const ll inf = 1e18;

void solve () {
	int n, W; cin >> n >> W;
	vector<vector<ll>> dp(n + 1, vector<ll>(W + 1));

	for (auto i = 1; i <= n; ++i) {
		int cw, v; cin >> cw >> v;
		for (int w = W; w >= 0; --w) {
			dp[i][w] = dp[i - 1][w];
			if(w - cw >= 0)
				dp[i][w] = max(dp[i][w], v + dp[i - 1][w - cw]);
		} 
	}
	cout << dp[n][W] << endl;
}

// void solve () {
// 	int n, W; cin >> n >> W;
// 	vector<vector<ll>> dp(2, vector<ll>(W + 1));

// 	for (auto i = 1; i <= n; ++i) {
// 		int cw, v; cin >> cw >> v;
// 		auto & cur = dp[i % 2];
// 		const auto & prev = dp[(i - 1) % 2];
// 		for (int w = W; w >= 0; --w) {
// 			cur[w] = prev[w];
// 			if(w - cw >= 0) {
// 				cur[w] = max(cur[w], v + prev[w - cw]);
// 			}
// 		}
// 	}

// 	cout << dp[n % 2][W];
// }

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  cout.precision(precision);
  cout.setf(ios_base::fixed);
  solve();
  return 0;
}



Measured memory_bytes: 80256
/* ex7_3
   keY_tree */

#include <stdio.h>
#include <stdlib.h>


int main(void){
    int ROW, COL;
    int *row, *col;
    char **matrix;
    // 縦と横のマス目の数を読み取る
    scanf("%d %d", &ROW, &COL);
    
    // メモリ領域の確保
    row = (int*)calloc(ROW, sizeof(int));
    // エラーチェック
    if (row == NULL){
        exit(1);
    }

    // メモリ領域の確保
    col = (int*)calloc(COL, sizeof(int));
    // エラーチェック
    if (col == NULL){
        exit(1);
    }
    
    // メモリ領域の確保
    matrix = (char**)calloc(ROW, sizeof(char*));
    // エラーチェック
    if (matrix == NULL){
        exit(1);
    }
    for (int i=0; i<ROW; i++){
        // メモリ領域の確保
        matrix[i] = (char*)calloc(COL, sizeof(char));
        // エラーチェック
        if(matrix[i] == NULL){
            exit(1);
        }
    }

    // マス目を読み取る
    for (int i=0; i < ROW; i++){
        for (int j=0; j < COL; j++){
            scanf(" %c", &matrix[i][j]);
            // マス目が黒なら該当する行列の配列に1を代入
            if (matrix[i][j] == '#'){
                row[i] = 1;
                col[j] = 1;
            }
        }
    }
 
    // 出力
    for (int i=0; i < ROW; i++){
        // 黒マスがない行は飛ばす
        if (row[i] == 0)
            continue;
        for (int j=0; j < COL; j++){
            // 黒マスがない列は飛ばす
            if (col[j] == 0)
                continue;
            printf("%c", matrix[i][j]);
            }
        printf("\n");
        
    }
    
    // 確保と逆順でメモリの解放
    free(row);
    free(col);
    for (int i=0; i<ROW; i++){
        free(matrix[i]);
    }
    free(matrix);
 
    return 0;
}


Measured memory_bytes: 1620
#include<iostream>
#include<cstdlib>
#include<map>
#include<utility>
#include<vector>
#include<string>

using namespace std;

struct edge{
  int to,cap,rev;
};

vector<edge> G[52];
bool used[52];

void add_edge(int from,int to,int cap){
  G[from].push_back({to,cap,(int)G[to].size()});
  G[to].push_back({from,cap,(int)G[from].size()-1});
}

int dfs(int v,int t,int f){
  if(v==t)return f;
  used[v]=true;
  for(int i=0;i<G[v].size();i++){
    edge &e=G[v][i];
    if(!used[e.to]&&e.cap>0){
      int d=dfs(e.to,t,min(f,e.cap));
      if(d>0){
	e.cap-=d;
	G[e.to][e.rev].cap+=d;
	return d;
      }
    }
  }
  return 0;
}

int max_flow(int s,int t){
  int flow=0;
  for(;;){
    fill(begin(used),end(used),false);
    int f=dfs(s,t,1e9);
    if(f==0)return flow;
    flow+=f;
  }
}

int main(){
  for(int N,M;cin>>N>>M,N|M;){
    bool nz=false;
    map<pair<int,int>,vector<int> >pols;
    for(int i=0;i<M;i++){
      int u,v;
      char p[1234];
      cin>>u>>v>>p;
      vector<int> c(51);
      for(char *pp=p;*pp;){
	pp+=*pp=='+';
	int cc=1;
	if(*pp!='x'){
	  cc=strtol(pp,&pp,10);
	}
	int f=0;
	if(*pp){
	  pp++;
	  f=1;
	  if(*pp=='^'){
	    f=strtol(pp+1,&pp,10);
	  }
	}
	c[f]=cc;
      }
      pols[make_pair(u,v)]=c;
    }
    for(int i=50;i>=0;i--){
      for(auto &e:G){
	e.clear();
      }
      for(auto e:pols){
	add_edge(e.first.first,e.first.second,e.second[i]);
      }
      int f=max_flow(1,N);
      if(f){
	if(nz){
	  cout<<'+';
	}
	nz=true;
	if(f>1||i==0){
	  cout<<f;
	}
	if(i){
	  cout<<'x';
	  if(i>1){
	    cout<<'^'<<i;
	  }
	}
      }
      for(int j=1;j<=N;j++){
	for(auto e:G[j]){
	  auto k=make_pair(j,e.to);
	  if(pols.count(k)&&e.cap!=0&&e.cap!=pols[k][i]*2){
	    for(int l=i;l>=0;l--){
	      pols[k][l]=1e9;
	    }
	  }
	}
      }
    }
    if(!nz){
      cout<<0;
    }
    cout<<endl;
  }
}

	
	

Measured memory_bytes: 1364
//:Ditttoo
#include<bits/stdc++.h>
#define int long long int 
using namespace std;
int32_t main()
{
	int n;
	cin>>n;
	double p[n+1];
	for(int i=1;i<=n;i++)
		cin>>p[i];

	double h[n+1][n+1] ;
	for(int i=0;i<=n;i++){
		for(int j=0;j<=n;j++){
			h[i][j] = 0 ;
		}
	}
    h[0][0] = 1 ;

	for(int i=1;i<=n;i++){
		for(int j=0;j<i+1;j++){
			if(j>0){
				h[i][j] = h[i-1][j-1] * p[i] + h[i-1][j] * (1-p[i]);
			}
			else { 
				h[i][j] =  h[i-1][j] * (1-p[i]);
			}
		}
	}

	double res = 0;

	for(int i=n/2 + 1 ;i<=n;i++){
		res += h[n][i] ;
	}
	printf("%.14f",res);
	return 0;
}        


Measured memory_bytes: 70528
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Threading.Tasks;
using static System.Console;
using static System.Math;
class Z { static void Main() => new K(); }
class K
{
	int F => int.Parse(Str);
	long FL => long.Parse(Str);
	int[] G => Strs.Select(int.Parse).ToArray();
	uint[] GU => Strs.Select(uint.Parse).ToArray();
	decimal[] GD => Strs.Select(decimal.Parse).ToArray();
	long[] GL => Strs.Select(long.Parse).ToArray();
	string Str => ReadLine();
	string[] Strs => Str.Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
	static T[] ConstantArray<T>(int n, T val) { var a = new T[n]; for (var i = 0; i < n; i++) a[i] = val; return a; }
	static T[] MakeArray<T>(int n, Func<int, T> f) { var a = new T[n]; for (var i = 0; i < n; i++) a[i] = f(i); return a; }
	static ulong One(int k) => 1ul << k;
	static ulong All(int k) => One(k) - 1;
	static bool Has(ulong s, int k) => (s & One(k)) != 0;
	const int MOD = 1000000007;
	public K()
	{
		SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
		Solve();
		Out.Flush();
	}
	void hoge(int[,][] x, int c, int f, int t)
	{
		x[f, c] = new[] { t };
	}
	readonly int[] Empty = new int[0];
	int[] Make(params int[] a) => a;
	void Solve()
	{
		// (AGC を含む) or (どこかを入れ替えると AGC を含む)
		// .* (AGC | ACG | GAC | A.GC | AG.C) .*
		var dict = new Dictionary<char, int> { ['A'] = 0, ['G'] = 1, ['C'] = 2, ['T'] = 3 };
		var nfa = new int[8, 4][];
		for (var i = 0; i < 8; i++) for (var j = 0; j < 4; j++) nfa[i, j] = Empty;
		nfa[0, 0] = Make(0, 2);
		nfa[0, 1] = Make(0, 1);
		nfa[0, 2] = nfa[0, 3] = Make(0);
		nfa[1, 0] = Make(5);
		nfa[2, 1] = Make(3, 4, 5);
		nfa[2, 2] = Make(3, 6);
		nfa[2, 0] = nfa[2, 3] = Make(3);
		nfa[3, 1] = Make(5);
		for (var i = 0; i < 4; i++) nfa[4, i] = Make(5);
		nfa[5, 2] = Make(7);
		nfa[6, 1] = Make(7);
		var M = 1 << 7;
		var dfa = new int[M + 1, 4];
		for (var s = 0; s < M; s++)
			for (var c = 0; c < 4; c++)
			{
				var t = new HashSet<int>();
				for (var i = 0; i < 8; i++) if ((s & (1 << i)) != 0) t.UnionWith(nfa[i, c]);
				if (t.Contains(7)) dfa[s, c] = M;
				else
				{
					var x = 0;
					foreach (var i in t) x |= 1 << i;
					dfa[s, c] = x;
				}
			}
		for (var c = 0; c < 4; c++) dfa[M, c] = M;
		var N = F;
		var dp = new long[N + 1, M + 1];
		dp[0, 1] = 1;
		for (var i = 0; i < N; i++)
			for (var s = 0; s <= M; s++)
				for (var c = 0; c < 4; c++)
				{
					var t = dfa[s, c];
					dp[i + 1, t] = (dp[i + 1, t] + dp[i, s]) % MOD;
				}
		WriteLine((Pow(4, N, MOD) - dp[N, M] + MOD) % MOD);
	}
	public static long Pow(long a, long b, long mod)
	{
		var p = 1L;
		var x = a;
		while (b > 0)
		{
			if ((b & 1) == 1) p = (p * x) % mod;
			b >>= 1;
			x = (x * x) % mod;
		}
		return p;
	}
}


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

int main(){
    int a=0,b;
    string day,mon="MON",tue="TUE",wed="WED",thu="THU",fri="FRI",sat="SAT",sun="SUN";
    cin>>day;
    if(day==sun){
        a=0;
    }
    if(day==mon){
        a=1;
    }
    if(day==tue){
        a=2;
    }
    if(day==wed){
        a=3;
    }
    if(day==thu){
        a=4;
    }if(day==fri){
        a=5;
    }if(day==sat){
        a=6;
    }
    b=7-a;
    cout<<b;
}




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

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

char ch(int a, int b, int c) {
	return (a * (c - 'a') + b) % 26 + 'a';
}

int main() {
	int n, a, b, c;
	cin >> n;
	cin.ignore();

	string str, res = "";
	for (; n > 0; n--) {
		getline(cin, str);

		rep(1, 50, a) {
			if (a == 2 || a == 13) continue;
			rep(1, 50, b) {
				res = str;
				c = 0;
				rep(0, str.size(), c) {
					if (res[c] == ' ') continue;

					res[c] = ch(a, b, res[c]);
				}
				if (res.find("this") != -1 || res.find("that") != -1) {
					cout << res << endl;
					a = 114514;
					b = 114514;
				}
			}
		}
	}
	return 0;
}

Measured memory_bytes: 3100
#include <math.h>

#include <algorithm>
#include <bitset>
#include <iostream>
#include <sstream>
#include <vector>

using namespace std;

int main() {
  long a = 100;
  long X;
  cin >> X;
  int ans;
  for (int i = 0; i < 10000000; i++) {
    a += 0.01 * a;
    if (a >= X) {
      ans = i;
      cout << ans + 1 << endl;
      return 0;
    }
  }

  return 0;
}


Measured memory_bytes: 3632
#include<iostream>
using namespace std;
long N,c[10][10],ans;
int main(){
  cin>>N;
  for(int i=1;i<=N;i++)c[to_string(i)[0]-'0'][i%10]++;
  for(int i=0;i<10;i++)for(int j=0;j<10;j++)ans+=c[i][j]*c[j][i];
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
N,K = input().split()
N = int(N)
K = int(K)
mod = 1000000007
ans =0

A =[int(i) for i in input().split()]

firstcnt = 0
seccnt = 0
for i in range(N-1):
    for j in range(i+1,N):
        if A[i]> A[j]:
            firstcnt += 1
for i in range(N):
    for j in range(N):
        if A[i]> A[j]:
            seccnt += 1


firstcnt =  firstcnt % mod
seccnt = seccnt % mod

a = (firstcnt*K)%mod
c = ((K-1)*K//2)%mod
b = (seccnt * c)%mod

ans = a + b
ans = ans % mod

print(int(ans))


Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define Mod 1000000007
ll dp[1009][1009];
int main()
{
    ll h, w;
    cin>>h>>w;
    char mat[h+1][w+1];
    for(ll i=1;i<=h;i++)
        for(ll j=1;j<=w;j++)
            cin>>mat[i][j];
    dp[1][1]=1;
    for(ll i=1;i<=h;i++)
        for(ll j=1;j<=w;j++)
        {
            if(mat[i][j]=='#')
                dp[i][j]=0;
            else
                dp[i][j]=(dp[i-1][j]%Mod+dp[i][j-1]%Mod+dp[i][j]%Mod)%Mod;
        }
    cout<<dp[h][w]<<endl;
}


Measured memory_bytes: 12424
#include <iostream>
#include <iomanip>
#include<math.h>
#include<list>
#include <algorithm>
#include<set>
#include<vector>
#include<math.h>
#include<map>
#include<string>
#include <numeric>
#include <queue>
#include <sstream>
#include <bitset>
#include<stack>

using namespace std;
using ll = long long;
using vll = vector<long long>;
using sll = set<long long>;


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

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

template<typename T>
bool IsPrimeNumber(T num)
{
	if (num <= 2) return true;
	else if (num % 2 == 0) return false;

	double sqrtNum = sqrt(num);
	for (int i = 3; i <= sqrtNum; i += 2)
	{
		if (num % i == 0)
		{
			return false;
		}
	}

	return true;
}

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

#define rep(i,s,e) for(ll i=s;i<e;i++)
#define repeq(i,s,e) for(ll i=s;i<=e;i++)


int main() {
	ll N;
	std::cin >> N;
	
	ll tar = N;
	if (!(N & 1)) {
		tar++;
	}

	ll cnt = 0;
	rep(i, 1, N) {

		cnt += N-i;
		if (i <= N / 2) {
			cnt --;
		}
	}

	map<ll, ll> experiment;
	std::cout << cnt << endl;
	rep(i, 1, N) {
		repeq(j, i + 1, N) {
			if (i + j != tar) {
				std::cout << i << " " << j << endl;
				experiment[i] += j;
				experiment[j] += i;
			}
		}
	}

	/*
	// 実験用
	std::cout << "-- experiment ------------------" << endl;
	for (auto itr = experiment.begin(); itr != experiment.end(); itr++) {
		std::cout << itr->first << " " << itr->second << endl;
	}
	*/


	return 0;
}


Measured memory_bytes: 256