akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
 
#define 	pi 				3.1415926536
#define 	mod 			1000000007
#define 	ll  			long long int
#define 	rep(i, a, b) 	for(ll i = a ; i < b ; i++)
#define     repn(i, a, b)   for(ll i = a ; i > b ; i--)
#define 	mod1 			1000003
#define     mod2            998244353
#define     inf             2e18
#define 	hi   			"hello"
#define 	nl 				"\n"
#define 	ws 				" "
#define     sz              size()
#define     len             length()
#define 	F 				first
#define 	S 				second
#define 	PB 				push_back
#define 	MP				make_pair
#define 	B 				begin()
#define     RB              rbegin()
#define 	E 				end()
#define     UB              upper_bound
#define     LB              lower_bound
#define     present(k, m)   (m.find(k)!=m.end())?1:0
#define 	all(v) 			v.begin(), v.end()
#define 	reset(a, val) 	memset(a, val, sizeof(a))
#define     pll             pair<ll, ll>
#define     vll             vector<ll>
#define     vpll            vector<pll>
#define 	vs 				vector<string>
#define     vc              vector<char>
#define     sqr(a)          (a)*(a)
#define 	print1(a) 		for(auto i : a)cout<<i<<" ";cout<<"\n"
#define 	print2(a) 		for(auto i : a)cout<<i;cout<<"\n"
#define 	print3(a) 		for(auto i : a)cout<<i<<nl;
#define 	boost 			ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

 
/*############################# DSU ##############################*/
vll parent(1e5), Size(1e5), Rank(1e5);
 
void make_set(ll v){
    parent[v]=v;
    Size[v] = 1;
    // Rank[v] = 0;
}
 
int find_set(ll v){
    return (parent[v]==v) ?  v : parent[v] = find_set(parent[v]);
}
 
void union_sets(ll a, ll b){
    a = find_set(a);
    b = find_set(b);
    if(a != b){
        if(Size[a] < Size[b])
            swap(a, b);
        // if(Rank[a] < Rank[b])
        //     swap(a, b);
        parent[b] = a;
        Size[a] += Size[b];
        // if(Rank[a] == Rank[b])
        //     Rank[a]++;
    }
}
/*############################# DSU ##############################*/
 
// ostringstream str1;
//             str1 << n;
//             string tmp = str1.str();
bool sortbysec(const pair<int, int> &a, const pair<int, int> &b) { return (a.second < b.second); }
 
bool compare(const pair<string, int>&a, const pair<string, int>&b){ return a.second<b.second; }
 
double logn(double n, double r) { return (n > r - 1) ? 1 + logn(n / r, r) : 0; }
 
vll pwx(32);
void cal(ll x){ pwx[0] = 1; rep(i, 1, 32)pwx[i] = x*pwx[i-1]; }
 
/* ################################################################ */
 
 
void solve()
{
    double a, b, h, m;
    cin>>a>>b>>h>>m;
    double theta = 0.0;
    theta = ((pi/6)*(h + (m/60))) - (pi*m)/30;
    // cout<<theta<<nl;
    cout<<setprecision(20)<<sqrt(sqr(a) + sqr(b) - 2*a*b*cos(theta))<<nl;
}
 
 
int main(){
    // boost;
    // cal(2);
    int t = 1, k = 1;
    // cin>>t;
    while(t--){
        // cout<<"Case #"<<k<<": ";
        solve();
        k++;
    }
}

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

#define INF 100100100
#define MOD 1000000007

using namespace std;
using ll = long long;
using ull = unsigned long long ;

int main(int argc, char const* argv[]){
   ios::sync_with_stdio(false);
   cin.tie(0);
   ll N;
   cin>>N;
   vector<ll>A(N);
   for(int i=0;i<N;i++)cin>>A[i];
   for(int i=0;i<N;i++)A[i]-=i+1;
   sort(A.begin(),A.end());
   ll ans;
   if(N%2==0)ans = (A[N/2]+A[N/2-1])/2;
   else ans = A[N/2];
   ll res = 0;
   for(int i=0;i<N;i++)res += abs(A[i]-ans);
   cout<<res;
   return 0;
}


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

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

  string s, t, u;
  int a, b;
  cin >> s >> t >> a >> b >> u;
  if(s == u) a -= 1;
  else b -= 1;
  cout << a << " " << b << endl;
  return 0;
}

Measured memory_bytes: 892
#include<bits/stdc++.h>
#define rep(i,N) for(ll (i)=0;(i)<(N);(i)++)
#define chmax(x,y) x=max(x,y)
#define chmin(x,y) x=min(x,y)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const int mod = 1000000007;
const ll INF = 1e16;

int main() {
  int n, k;
  cin >> n >> k;
  vector<int> p(n), c(n);
  rep(i, n) {
    cin >> p[i];
    p[i]--;
  }

  rep(i, n) cin >> c[i];

  ll ans = -1e18;
  rep(si, n) {
    int x = si;
    vector<int> s;
    ll total = 0;
    while (1) {
      total += c[x];
      s.push_back(c[x]);
      x = p[x];
      if (x == si) break;
    }

    ll cur = 0;
    int m = s.size();
    rep(i, m) {
      if (i + 1 > k) break;
      cur += s[i];
      ll t = cur;
      if (total > 0) t += ((k - (i + 1)) / m) * total;
      ans = max(ans, t);
    }
  }

  cout << ans << endl;

}

Measured memory_bytes: 3720
import numpy as np
from scipy.sparse.csgraph import shortest_path
from scipy.sparse.csgraph import floyd_warshall
from scipy.sparse.csgraph import csgraph_from_dense

INF = float('inf')

def main():
    N, M, L = map(int, input().split())

    # G[x][y]: xからyへ直接移動するときのコスト。移動できない場合はINF
    G = [[INF] * (N+1) for n in range(N+1)]

    for i in range(M):
        a, b, c = map(int, input().split())
        G[a][b] = c
        G[b][a] = c
    G = csgraph_from_dense(G, null_value=INF)

    Q = int(input())
    Queries = []
    for i in range(Q):
        s, t = map(int, input().split())
        Queries.append((s, t))

    # ワーシャルフロイド法で、全点間の距離を求める
    cost = floyd_warshall(G)
    # 全点間の距離のうち、移動距離がL以内でおさまる頂点同士は、給油せずにすむ
    # そこで、全点間の距離のうち、移動距離がL以内でおさまる頂点同士を距離1で結んだグラフを作成し、
    # そのグラフに対してワーシャルフロイド法で最短距離を計算することで、
    # refuel[x][y] =「xからyへ移動するときの給油回数+1」というグラフを作成できる
    no_refuel = [[1 if x <= L else INF for x in c] for c in cost]
    no_refuel = csgraph_from_dense(no_refuel, null_value=INF)
    refuel_count = floyd_warshall(no_refuel)

    ans = []
    for s, t in Queries:
        d = refuel_count[s][t]
        ans.append(int(d-1) if d != INF else -1)
    
    print(*ans, sep='\n')

if __name__ == '__main__':
    main()

Measured memory_bytes: 52376
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define fastio ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
//STANDARD DATA TYPES
#define ll long long
#define llu unsigned long long
#define ld long double
//ADV DATA TYPES
#define pii pair < int , int >
#define pll pair < ll, ll >
#define mp make_pair
#define ff first
#define ss second
//C ++ DS
#define vi vector < int >
#define vll vector < ll >
#define pb push_back
#define pf push_front
#define iter :: iterator
#define all(x) x.begin(),x.end()

//priority_queue < pii, vector < pii >, greater < pii > > pq;
//lower_bound(v.begin(),v.end(),20);//for any sorted container
//CONSTANTS
#define MOD (int)(1e9+7)
#define INF 0x3f3f3f3f
#define MAXN (int)(1e5+1)
//MOD OPERATIONS
inline ll fpow(ll n, ll k, int p = MOD) {ll r = 1; for (; k; k >>= 1) {if (k & 1) r = r * n % p; n = n * n % p;} return r;}
inline ll inv(ll a, ll p = MOD) {return fpow(a, p - 2, p);}
inline ll addmod(ll a, ll val, ll p = MOD) {{if ((a = (a + val)) >= p) a -= p;} return a;}
inline ll submod(ll a, ll val, ll p = MOD) {{if ((a = (a - val)) < 0) a += p;}return a;}
inline ll mult(ll a, ll b, ll p = MOD) {return (ll) a * b % p;}
//DEBUG
#define shout()  {cout << "I'm Here...!!!" << endl;}
#define dbg(x) { cout<< #x << ": " << (x) << endl; }
#define dbg2(x,y) { cout<< #x << ": " << (x) << " , " << #y << ": " << (y) << endl; }
int match[21][21];
int dp[1<<21];
int main()
{
	fastio;
	int n;cin>>n;
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<n;j++)
			cin>>match[i][j];
	}
	//dp[i][mask] represent number of ways to match subset women(mask) with upto 0 to i men
	//for i+1 iterate over masks then jth women 
	//if jth women can pair with ith men
	//dp[i+1][mask^(1<<j)]+=dp[i][mask]
	//else dp[i+1][mask]+=dp[i][mask]//dont pair ith men(note if we iterate mask big to small then this will be first update of dp[i+1][mask])
	dp[0]=1;
	for(int i=0;i<n;i++)//ith men
	{
		for(int mask=(1<<n)-1;mask>=0;mask--)
		{
			if(dp[mask]==0)continue;
			for(int j=0;j<n;j++)
			{
				if(match[i][j] && !(mask&(1<<j)))
				{
					dp[mask^(1<<j)]=addmod(dp[mask^(1<<j)],dp[mask]);
				}
			}
		}
	}  
	cout<<dp[(1<<n)-1]<<endl;
}


Measured memory_bytes: 8576
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        MyScanner in = new MyScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        E solver = new E();
        solver.solve(1, in, out);
        out.close();
    }

    static class E {
        public void solve(int testNumber, MyScanner in, PrintWriter out) {
            String N = in.next();
            int K = in.nextInt();

            int length = N.length();
            long[][][] dp = new long[length + 1][K + 1][2];
            dp[0][0][0] = 1;
            for (int i = 0; i < length; i++) {
                int c = N.charAt(i) - '0';
                for (int k = 0; k <= K; k++) {
                    for (int n = 0; n < 10; n++) {
                        if (k == K && n > 0) continue;
                        if (c < n) {
                            dp[i + 1][k + 1][1] += dp[i][k][1];
                        } else if (c == n) {
                            int a = n == 0 ? 0 : 1;
                            dp[i + 1][k + a][0] += dp[i][k][0];
                            dp[i + 1][k + a][1] += dp[i][k][1];
                        } else {
                            int a = n == 0 ? 0 : 1;
                            dp[i + 1][k + a][1] += dp[i][k][0] + dp[i][k][1];
                        }
                    }
                }
            }
            out.println(dp[length][K][0] + dp[length][K][1]);
        }

    }

    static class MyScanner {
        private BufferedReader in;
        private StringTokenizer st;

        public MyScanner(InputStream stream) {
            in = new BufferedReader(new InputStreamReader(stream));
        }

        public String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    String rl = in.readLine();
                    if (rl == null) {
                        return null;
                    }
                    st = new StringTokenizer(rl);
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return st.nextToken();
        }

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

    }
}



Measured memory_bytes: 21460
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

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

int h, w;
vector<string> program;
vector<vector<vector<vector<bool> > > > check;

bool solve(int y, int x, int d, int m)
{
    if(check[y][x][d][m])
        return false;
    check[y][x][d][m] = true;

    char c = program[y][x];
    if(c == '@'){
        return true;
    }else if(c == '>'){
        d = 0;
    }else if(c == 'v'){
        d = 1;
    }else if(c == '<'){
        d = 2;
    }else if(c == '^'){
        d = 3;
    }else if(c == '_'){
        if(m == 0)
            d = 0;
        else
            d = 2;
    }else if(c == '|'){
        if(m == 0)
            d = 1;
        else
            d = 3;
    }else if('0' <= c && c <= '9'){
        m = c - '0';
    }else if(c == '+'){
        ++ m;
        m %= 16;
    }else if(c == '-'){
        m += 15;
        m %= 16;
    }

    if(c == '?'){
        for(int i=0; i<4; ++i){
            int y1 = (y + dy[i] + h) % h;
            int x1 = (x + dx[i] + w) % w;
            if(solve(y1, x1, i, m))
                return true;
        }
        return false;
    }else{
        y += dy[d] + h;
        y %= h;
        x += dx[d] + w;
        x %= w;
        return solve(y, x, d, m);
    }
}

int main()
{
    cin >> h >> w;

    program.resize(h);
    for(int i=0; i<h; ++i)
        cin >> program[i];

    check.assign(h, vector<vector<vector<bool> > >(w, vector<vector<bool> >(4, vector<bool>(16, false))));

    if(solve(0, 0, 0, 0))
        cout << "YES" << endl;
    else
        cout << "NO" << endl;

    return 0;
}

Measured memory_bytes: 0
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cctype>

#include <algorithm>
#include <functional>
#include <set>
#include <map>
#include <vector>
#include <iostream>
#include <limits>
#include <numeric>

#define LOG(FMT...) fprintf(stderr, FMT)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

int main() {

  int a, b;
  scanf("%d%d", &a, &b);
  printf("%.5lf\n", a * 1. / b);

  return 0;
}


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

string key[25];
string yaml[50005];
int indent[50005];
int line;
int n;

bool starts_with(const string &s, const string &key) {
    if (s.size() < key.size()) return false;
    
    for (int i = 0; i < key.size(); i++) {
        if (s[i] != key[i]) return false;
    }

    return true;
}

string get_property_value(const string &s) {
    for (int i = 0; i < s.size(); i++) {
        if (s[i] == ' ') return "string \"" + s.substr(i + 1) + "\"";
    }
    return "object";
}

string dfs(int kptr, int lptr) {
    if (lptr >= line) return "";
    if (kptr >= n) return get_property_value(yaml[lptr]);

    int m = indent[lptr + 1];
    int i = lptr + 1;
    while (indent[i] > indent[lptr] && i < line) {
        if (indent[i] == m && starts_with(yaml[i], key[kptr] + ":")) return dfs(kptr + 1, i);
        i++;
    }
    

    return "";
}

int main() {
    //input
    {
        string tmp;
        getline(cin, tmp);

        int cnt = 0;
        for (int i = 1; i < tmp.size(); i++) {
            if (tmp[i] == '.') {
                cnt++;
                continue;
            }
            key[cnt] += tmp[i];
        }
        n = cnt + 1;
    }

    {
        string tmp;
        int cnt = 0;
        while (getline(cin, tmp)) {
            yaml[cnt++] = tmp;
        }
        line = cnt;
    }

    for (int i = 0; i < line; i++) {
        int j = 0;
        while (yaml[i][j] == ' ') j++;
        indent[i] = j;

        yaml[i] = yaml[i].substr(indent[i]);
    }

    int i = 0;
    string ans;
    while (!starts_with(ans, "string") && i < line) {
        if (indent[i] == 0 && starts_with(yaml[i], key[0])) {
            string tmp = dfs(1, i);
            if (!tmp.empty()) ans = tmp;
        }
        i++;
    }
    
    if (ans.empty()) cout << "no such property" << endl;
    else cout << ans << endl;

    return 0;
}



Measured memory_bytes: 3700
#include<bits/stdc++.h>
using namespace std;
#define pb push_back

int N, X, Y;
int res = 0;
vector<vector<int>> Graph(2010, vector<int>());
vector<vector<int>> dp(2010, vector<int>(2010, 0));
vector<vector<int>> circular_list(2010, vector<int>(2,0));
vector<int> num_dist;


/*循環リストの作成*/
void make_cl(int x, int y){
    for(int i = x; i <= y; i++){
        if(i == y) circular_list[i][0] = x;  //forward
        else circular_list[i][0] = i+1;
        if(i == x) circular_list[i][1] = y;  //back
        else circular_list[i][1] = i-1;
    }
    return ;
}


/*循環リスト域の頂点間の最短距離票を作成*/
void make_dl(int i, int x, int y){
    int diff = y-x;
    if(diff & 1){   //対頂点は1つ
        int ver_p = (x+y+1)/2 + (i-x);
        if(ver_p > y) ver_p = ver_p % (y+1) + x;  //形状：環⇒修正

        int f, b; f = b = ver_p;  //対頂点を格納
        int fd, bd; fd = bd = (y-x+1)/2;  //対頂各同士の距離
        while(f != i){
            dp[i][f] = dp[f][i] = fd--;
            f = circular_list[f][0];
        }
        
        while(b != i){
            dp[i][b] = dp[b][i] = bd--;
            b = circular_list[b][1];
        }

    }else{
        int ver_p1 = (x+y)/2+1+(i-x);    //進行対頂点
        int ver_p2 = (x+y)/2+(i-x);    //後退対頂点
        if(ver_p1 > y) ver_p1 = ver_p1 % (y+1) + x;
        if(ver_p2 > y) ver_p2 = ver_p2 % (y+1) + x;

        int fd, bd; fd = bd = (y-x)/2;
        while(ver_p1 != i){
            dp[i][ver_p1] = dp[ver_p1][i] = fd--;
            ver_p1 = circular_list[ver_p1][0];
        }

        while(ver_p2 != i){
            dp[i][ver_p2] = dp[ver_p2][i] = bd--;
            ver_p2 = circular_list[ver_p2][1];
        }
    }

    return ;
}


int main(){
    cin >> N >> X >> Y;
    num_dist.assign(N, 0);  //最大距離まで

    Graph[X].pb(Y); Graph[Y].pb(X);  //特別の一辺
    for(int i = 1; i <= N-1; i++){
        Graph[i].pb(i+1);
        if(X <= i && i+1 <= Y) Graph[i+1].pb(i);
    }

    make_cl(X, Y);
    for(int i = X; i <= Y; i++) make_dl(i, X, Y);

    for(int i = 1; i <= N-1; i++){
        for(int j = i+1; j <= N; j++){
            if(i <= X){
                if(j <= X) ++num_dist[j-i];
                else if(X < j && j <= Y) ++num_dist[(X-i)+dp[X][j]];
                else if(Y < j) ++num_dist[(X-i)+dp[X][Y]+(j-Y)];
            }else if(X < i && i <= Y){
                if(X < j && j <= Y) ++num_dist[dp[i][j]];
                else if(Y < j) ++num_dist[dp[i][Y]+(j-Y)];
            }else if(Y < i) ++num_dist[j-i];

        }
    }

    for(int i = 1; i < N; i++) cout << num_dist[i] << endl;
    return 0;
}





Measured memory_bytes: 19712
while 1:
    N = int(input())
    if N == 0:
        break
    *H, = map(int, input().split())
    def gen(k):
        for i in range(N+1):
            if i == k:
                continue
            yield H[i]
    for i in range(N+1):
        ok = 1
        g = gen(i).__next__
        h0 = g(); h1 = g()
        d = h1 - h0
        for j in range(N-2):
            h2 = g()
            if h2 - h1 != d:
                ok = 0
                break
            h1 = h2
        if ok:
            print(H[i])
            break


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


def solve():
    N = int(input())
    par = {i:[] for i in range(1, N+1)}
    q = [1]
    l = []
    dp = [0] * (N+1)

    for i in range(2, N+1):
        a = int(input())
        par[a].append(i)

    while q:
        s = q.pop()
        l.append(s)
        for t in par[s]:
            q.append(t)

    for s in l[::-1]:
        depth = 1
        res = sorted([dp[t] for t in par[s]])[::-1]
        for i, j in enumerate(res):
            depth = max(depth, i+j+1)
        dp[s] = depth

    print(dp[1]-1)


if __name__ == "__main__":
    solve()


Measured memory_bytes: 91504
#include<bits/stdc++.h>
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 RREP(i,n) for (int i=(n)-1;i>=0;i--)
typedef long long LL;
int A[100];
int main(){
        REP(i,100){
            A[i]=0;
        }
	int N,M;
	cin>>N>>M;
	REP(i,M){
	    int a,b;
	    cin>>a>>b;
	    A[a-1]++;
	    A[b-1]++;
	}
        REP(i,N){
            cout<<A[i]<<endl;
        }
	return(0);
}

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

int main()
{
    int n, m;
    cin >> n >> m;
    priority_queue<double> que;
    rep(i, n)
    {
        double x;
        cin >> x;
        que.push(x);
    }
    rep(i, m)
    {
        double x = que.top();
        que.pop();
        que.push(x / 2.0);
    }
    ll ans = 0;
    while (!que.empty())
    {
        double x = que.top();
        que.pop();
        ans += (int)x;
    }
    cout << ans << endl;
}

Measured memory_bytes: 1400
import java.util.*;

public class Main{
  public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int S = sc.nextInt();
		int W = sc.nextInt();
		if(W >= S) {
			System.out.println("unsafe");
		}else {
			System.out.println("safe");
		}
	}
}

Measured memory_bytes: 35668
from math import factorial
def ncr(n,r):
    a=factorial(n)
    b=factorial(n-r)*factorial(r)
    return a//b
N,P=list(map(int,input().split()))
A=list(map(int,input().split()))
A=[i%2 for i in A]
zero=[i for i in A if i==0]
one=[i for i in A if i==1]
lzero=len(zero)
lone=len(one)
if lzero==0:
    if P%2==0:
        a = 0
        for i in range(2, lone+1, 2):
            a += ncr(lone, i)
        print(a+1)
    else:
        a = 0
        for i in range(1, lone+1, 2):
            a += ncr(lone, i)
        print(a)
    exit()
if lone==0:
    if P%2==0:
        print(2**lzero)
    else:print(0)
    exit()
if P%2==1:
    guu=2**lzero
    a=0
    for i in range(1,lone+1,2):
        a+=ncr(lone,i)
    print(guu*a)
else:
    guu=2**lzero
    a=0
    for i in range(0,lone+1,2):
        a+=ncr(lone,i)
    print(guu*a)


Measured memory_bytes: 9200
#include <cmath>
#include <iostream>
#include <cstdint>

using namespace std;
using u = uint64_t;
using f = double;

int main() {
  u a;
  f b;
  cin >> a >> b;
  cout << (a * u(round(b * 100)) / 100) << '\n';
  return 0;
}

Measured memory_bytes: 3744
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <cmath>

using namespace std;

int main(){
  string S;
  cin >> S;
  if(S[0] == S[1] || S[1] == S[2] || S[2] == S[3]) cout << "Bad" << endl;
  else cout << "Good" << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <limits.h>
#include <math.h>
#include <float.h>
#include <assert.h>
typedef int64_t ll;
typedef uint64_t ull;
int acs(const void *a, const void *b){return *(int*)a - *(int*)b;} /* 1,2,3,4.. */
int des(const void *a, const void *b){return *(int*)b - *(int*)a;} /* 8,7,6,5.. */
#define min(a,b) (a < b ? a: b)
#define max(a,b) (a > b ? a: b)

#define MAXN (600)
#define MOD (1000000007)


//グラフ
#define MAXV (MAXN)
int Gv;
typedef struct edge
{
    int to;
    ll cost;
    struct edge* next;
}edge;

edge* Ge[MAXV]; //vから出てる有向辺
int Gd[MAXV]; //vの次数

void Gadd(int v, int to, ll cost)
{
    edge* e = malloc(sizeof(edge));
    e->to = to;
    e->cost = cost;
    e->next = Ge[v];
    Ge[v] = e;
    Gd[v]++;
}

int n;
double sc[MAXV];
double bsc[MAXV];

int main(void)
{
    ll m;
    scanf("%d %ld",&n,&m);
    for(int i=0;i<m;i++) 
    {
        int s,t;
        scanf("%d %d",&s,&t);
        s--;t--;
        Gadd(s,t,0);
    }

    bsc[n-1] = 0.0;
    for(int j=n-2;j>=0;j--)
    {
        double mx = 0.0;
        double ns = 0.0;
        int c=0;
        edge* e = Ge[j];
        for(;e!=NULL;e=e->next)
        {
            if(bsc[e->to]==-1.0) continue;
            mx = max(mx,bsc[e->to]+1.0);
            ns += bsc[e->to]+1.0;
            c++;
        }
        if(ns==0.0)
        {
            bsc[j] = -1.0;
            continue;
        }
        bsc[j] = ns/c;
    }

    double ans = DBL_MAX;
    for(int i=0;i<n-1;i++)
    {
        sc[n-1] = 0.0;
        for(int j=n-2;j>=0;j--)
        {
            if(i<j)
            {
                sc[j] = bsc[j];
                continue;
            }
            double mx = 0.0;
            double ns = 0.0;
            int c=0;
            edge* e = Ge[j];
            for(;e!=NULL;e=e->next)
            {
                if(sc[e->to]==-1.0) continue;
                mx = max(mx,sc[e->to]+1.0);
                ns += sc[e->to]+1.0;
                c++;
            }
            if(ns==0.0)
            {
                sc[j] = -1.0;
                continue;
            }
            if(i==j && c>=2)
            {
                sc[j] = (ns-mx)/(c-1);
            }else
            {
                sc[j] = ns/c;
            }
        }
        ans = min(ans,sc[0]);
    }

    printf("%lf\n", ans);
    return 0;
}


Measured memory_bytes: 5760
import sys
import math

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    a, b, x = map(int, input().split())
    s = a * (x / pow(a, 2))

    if (a * b) // 2 >= s:
        l = s * 2 / b
        res = math.degrees(math.atan(b / l))
        print(res)
    else:
        l = (a * b - s) * 2 / a
        res = math.degrees(math.atan(l / a))
        print(res)


if __name__ == '__main__':
    resolve()


Measured memory_bytes: 3188
#include<stdio.h>

int counter = 0;
void selectionSort(int* A, int N){
    for(int i=0; i<N; i++){
        bool flag = false;
        int min = i;
        for(int j=i; j<N; j++){
            if(A[j] < A[min]){
            min = j;
            flag = true;
            }
        }
        if(flag==true){
        int tmp = A[i];
        A[i] = A[min];
        A[min] = tmp;
        counter++;
        }
    }
}

int main(){

    int n;
    scanf("%d", &n);

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

    selectionSort(A, n);
    for(int i=0; i<n; i++){
        if(i!=n-1) printf("%d ", A[i]);
        if(i==n-1) printf("%d\n", A[i]);
    }
    printf("%d\n", counter);
    return 0;
}


Measured memory_bytes: 2720
#include<bits/stdc++.h>
#include<iostream>
#include<fstream>
#define ll long long
using namespace std;

int main(){
    int N, K;  cin >> N >> K;
    double ans = 0.0;
    for(int i=1; i<=N; i++){
        if(i>=K){
            ans += 1.0/N;
            continue;
        }

        double prob = 1.0/N;
        int point = i;
        while(point<K){
            prob *= 0.5;
            point *= 2;
        }
        ans += prob;
    }    
    cout << setprecision(12) << ans << endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void){

  int a, b;
  int sum, dif, mul, dev;
  char op;

  while(1){

  scanf("%d %c %d",&a ,&op ,&b);
  /*limit check*/
  if (a>20001 || b>20001) break;
  /*operator check*/
  else if (op == '?') break;
  else if (op != '+' && op != '-' && op != '*' && op != '/' ){    break;}

  /*tashizan*/
  else if (op == '+'){    sum = (a + b);    printf("%d\n",sum);}
  /*hikizan*/
  else if (op == '-'){    dif = (a - b);    printf("%d\n",dif);}
  /*kakezan*/
  else if (op == '*'){    mul = (a * b);    printf("%d\n",mul);}
  /*warizan*/
  else if (op == '/'){    dev = (a / b);    printf("%d\n",dev);}

  }

  return 0;
}

Measured memory_bytes: 600
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include<cmath>
#define rep(i,n) for(int i = 0;i < (n);i++)
using namespace std;

int main(){
  int N;
  cin >> N;
  
  int a[101];
  double sum = 0;
  rep(i,N){
    cin >> a[i];
    sum += 1.0/(double)a[i];
  }
  cout << 1.0/sum << endl;
}
  

Measured memory_bytes: 256
n = int(input())
x = input().split()

min = 2**50

for p in range(100):
    min_i = 0
    if p in x:
        continue
    for i in x:
        min_i = min_i + (int(i) - p)**2
    if min_i <= min:
        min = min_i
print(min)

Measured memory_bytes: 9036
use std::io::{ stdin, stdout, BufRead, Write, BufWriter };
use std::ops::{ Add, Sub, Mul };

const SP : u8 = b' ';
const LF : u8 = b'\n';

#[inline(always)]
fn atoui<T>(s: &[u8]) -> T
  where T: Add<Output=T> +
           Sub<Output=T> +
           Mul<Output=T> +
           Default +
           From<u8>
{
  let mut n = T::default();
  if s.len() == 0 {
    return n;
  }

  let mut i = 0;
  if s[i] == b'+' {
    i += 1;
  }

  for b in &s[i..] {
    n = (n * T::from(10)) + T::from(b - b'0');
  }

  n
}

fn main() {
  let stdin = stdin();
  let mut stdin = stdin.lock();

  let mut buf = Vec::with_capacity(500 * 2);
  let len = stdin.read_until(SP, &mut buf).unwrap();
  buf.truncate(len - 1);
  let h = atoui::<usize>(&buf);

  buf.clear();
  let len = stdin.read_until(LF, &mut buf).unwrap();
  buf.truncate(len - 1);
  let w = atoui::<usize>(&buf);

  let mut ans = Vec::new();
  let mut n   = 0;

  let mut odd = 0;
  let mut x   = 0;
  let mut y   = 0;

  for i in 0..h {
    buf.clear();
    stdin.read_until(LF, &mut buf).unwrap();

    if i % 2 == 0 {
      for j in 0..w {
        if odd != 0 {
          writeln!(&mut ans, "{} {} {} {}", y + 1, x + 1, i + 1, j + 1).unwrap();
          n += 1;
        }
        odd ^= buf[j * 2] & 1;
        y = i;
        x = j;
      }
    } else {
      for mut j in 0..w {
        j = w - 1 - j;

        if odd != 0 {
          writeln!(&mut ans, "{} {} {} {}", y + 1, x + 1, i + 1, j + 1).unwrap();
          n += 1;
        }
        odd ^= buf[j * 2] & 1;
        y = i;
        x = j;
      }
    }
  }

  let stdout = stdout();
  let mut stdout = BufWriter::new(stdout.lock());
  writeln!(&mut stdout, "{}", n).unwrap();
  stdout.write(&ans).unwrap();
  stdout.flush().unwrap();
}


Measured memory_bytes: 8188
def eratosthenes(n):
 is_p=[1]*n
 p_list=[]

 is_p[0]=0
 is_p[1]=0

 for i in range(2,n):
  if is_p[i]:
   p_list.append(i)
   for j in range(i*i,n,i):
    is_p[j] = 0

# return p_list
 return is_p

q=int(input())

lim=10**5+1
is_p=eratosthenes(lim)

#print(is_p)

b=[0]
for i in range(1,lim+1):
 if is_p[i-1]==1 and is_p[i//2]==1:
  b.append(b[i-1]+1)
 else:
  b.append(b[i-1])

#print(b)

for i in range(q):
 l,r=map(int,input().split())
 print(b[r+1]-b[l])

Measured memory_bytes: 5292
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;

bool is_C(string str){
    int count = 0;
    for(int i = 2; i < str.size() - 1; i++){
        if(str[i] == 'C') count++;
    }
    if (count == 1) return true;
    else return false;
}

bool is_AorC(string str){
    REP(i, str.size()){
        if(str[i] > 64 && str[i] < 91){
            if(str[i] != 'A' && str[i] != 'C'){
                return false;
            }
        }
    }
    return true;
}

int main(){
    string str;
    cin >> str;
    if(str[0] == 'A' && is_C(str) && is_AorC(str)) cout << "AC\n";
    else cout << "WA\n";
}


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

const int kMaxN = 2e5 + 5, kBit = 29;

int n;
vector<int> a, b;

int main() {
  ios::sync_with_stdio(false);
  cin >> n;
  a.resize(n);
  b.resize(n);
  for (int i = 0; i < n; ++i)
    cin >> a[i];
  for (int j = 0; j < n; ++j)
    cin >> b[j];
  int res = 0;
  for (int i = 28; i >= 0; --i) {
    int mask = 1 << i, mod = mask << 1;
    for (int i = 0; i < n; ++i) {
      a[i] %= mod;
      b[i] %= mod;
    }
    sort(b.begin(), b.end());
    int ans = 0;
    for (int i = 0; i < n; ++i) {
      ans += (upper_bound(b.begin(), b.end(), mask * 2 - a[i] - 1) - lower_bound(b.begin(), b.end(), mask - a[i]));
      ans += (upper_bound(b.begin(), b.end(), mask * 4 - a[i] - 1) - lower_bound(b.begin(), b.end(), mask * 3 - a[i]));
    }
    if (ans & 1)
      res |= mask;
  }
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 1792
def insertionSort( nums, n, g ):
	cnt = 0
	for i in range( g, len( nums ) ):
	    v = nums[i]
	    j = i - g
	    while 0 <= j and v < nums[j]:
	        nums[ j+g ] = nums[j]
	        j -= g
	        cnt += 1
	    nums[ j+g ] = v
	
	return cnt


def shellSort( nums, n ):
	cnt = 0
	g = []
	val =0
	for i in range( 0, n ):
		val = 3*val+1
		if  n < val:
			break
		g.append( val )

	g.reverse( )
	m = len( g )
	print( m )
	print( " ".join( map( str, g ) ) )
	for i in range( 0, m ):
		cnt += insertionSort( nums, n, g[i] )
	print( cnt )

n = int( raw_input( ) )
nums = []
for i in range( 0, n ):
	nums.append( int( raw_input( ) ) )

shellSort( nums, n )
for i in nums:
	print( i )

Measured memory_bytes: 67800
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<queue>
#include<map>
#include<iomanip>
#include<set>
#define rep(index,num) for(int index=0;index<num;index++)
#define rep1(index,num) for(int index=1;index<=num;index++)
#define brep(index,num) for(int index=num-1;index>=0;index--)
#define brep1(index,num) for(int index=num;index>0;index--)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-9
#define mp(a1,a2) make_pair(a1,a2)
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef long long ll;
typedef long double ld;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=1e+18+1;
int INF=1e+9+1;
int main(){
	string S,T;
	scan(S>>T);
	int ans=0;
	rep(i,3) if(S[i]==T[i]) ans++;
	prin(ans);
	return 0;
}


Measured memory_bytes: 256
n,x,y=map(int,input().split())

#最短距離が１の時２の時、、、という風に実験しても途方に暮れるだけだった
#i,j固定して最短距離がどう表せるかを考える
def min_route_count(i,j):
  return min(abs(j-i),abs(j-y)+1+abs(x-i))

ans_list=[0]*(n-1)
for i in range(1,n):
  for j in range(i+1,n+1):
    ans_list[min_route_count(i,j)-1]+=1
    
for t in range(n-1):
  print(ans_list[t])


Measured memory_bytes: 75108
#include <iostream>
#include <cmath>
#include <algorithm>
using namespace std;
const int MAXN=100000+100;
int h[MAXN],f[MAXN];
int main()
{
	int n,k;
	cin>>n>>k;
	for(int i=1;i<=n;i++) cin>>h[i];
	for(int i=2;i<=n;i++)
	{
		f[i]=f[i-1]+abs(h[i-1]-h[i]);
		for(int j=2;j<=k;j++)
		{
			if(i>j)
			{
				f[i]=min(f[i],f[i-j]+abs(h[i-j]-h[i]));
			}	
   		}
	}
	cout<<f[n]<<"\n";
	return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
  int a, b;
  string ans;
   cin >> a >> b;
   if(a==b){
     ans = "Draw";
   }else if(a<b && a!=1 || b==1){
     ans = "Bob";
   }else{
     ans = "Alice";
   }
   cout << ans << endl;
}

Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var a, b int
	fmt.Scan(&a, &b)
	if a > b {
		fmt.Println(a+a-1)
	} else if b > a {
		fmt.Println(b+b-1)
	} else {
		fmt.Println(a+b)
	}
}

Measured memory_bytes: 512
#!/usr/bin/env python
# -*- coding:utf-8 -*-
#from __future__ import print_function
import time
import sys
import io
import re
import math
start = time.clock()
i = 0
n=input()
S=map(int, raw_input().split())
q=input()
T=map(int, raw_input().split())
#s=sorted(set(S), key=S.index)
print len(set(S)&set(T))

Measured memory_bytes: 18616
#include<cstdio>
#include<cstdlib>
#include<cstring>

struct Node{
    int key;
    Node *next;
    Node *prev;
};

Node *nil;

Node* listSearch(int key){
    Node *cur = nil -> next;
    while ( cur != nil && cur -> key != key) cur = cur -> next;
    return cur;
}

void init(){
    nil = (Node *)malloc(sizeof(Node));
    nil->next = nil;
    nil->prev = nil;
}

void printList(){
    Node *cur = nil->next;
    int isf = 0;
    while(1){
        if ( cur == nil ) break;
        if ( isf++ > 0)  printf(" ");
        printf("%d", cur->key);
        cur = cur->next;
    }
    printf("\n");
}

void deleteNode(Node *t){
    if ( t == nil ) return;
    t ->prev->next = t ->next;
    t->next->prev = t->prev;
    free(t);
}

void deleteFirst(){
    deleteNode(nil->next);
}

void deleteLast(){
    deleteNode(nil->prev);
}

void deleteKey(int key){
    deleteNode(listSearch(key));
}


void insert(int key){
    Node *x = (Node *)malloc(sizeof(Node));
    x->key = key;
    x->next = nil->next;
    nil->next->prev = x;
    nil->next = x;
    x->prev = nil;
}

int main(){
    int key, n, i;
    int size = 0;
    char com[20];
    int np = 0, nd = 0;
    scanf("%d", &n);
    init();
    for ( i = 0; i < n; i++ ){
        scanf("%s%d", com, &key);
        if ( com[0] == 'i' ) {insert(key); np++; size++;}
        else if ( com[0] == 'd' ) {
            if (strlen(com) > 6){
     	        if ( com[6] == 'F' ) deleteFirst();
    	        else if ( com[6] == 'L' ) deleteLast();
        } else {
	        deleteKey(key); nd++; 
        }
        size--;
    }
  }

  printList();
  return 0;
}


Measured memory_bytes: 33828
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }

struct BipartiteMatching {
    vector<vector<int>> E; int n, m; vector<int> match, dist;
    void init(int _n,int _m){n=_n,m=_m;E.resize(n+m+2);match.resize(n+m+2);dist.resize(n+m+2);}
    bool bfs() {
        queue<int> que;
        rep(i, 1, n + 1) {
            if (!match[i]) dist[i] = 0, que.push(i);
            else dist[i] = inf;
        }
        dist[0] = inf;
        while (!que.empty()) {
            int u = que.front(); que.pop();
            if (u) fore(v, E[u]) if (dist[match[v]] == inf) {
                dist[match[v]] = dist[u] + 1;
                que.push(match[v]);
            }
        }
        return (dist[0] != inf);
    }
    bool dfs(int u) {
        if (u) {
            fore(v, E[u]) if (dist[match[v]] == dist[u] + 1) if (dfs(match[v])) {
                match[v] = u; match[u] = v;
                return true;
            }
            dist[u] = inf;
            return false;
        }
        return true;
    }
    void add(int a, int b) { b += n; E[a + 1].push_back(b + 1); E[b + 1].push_back(a + 1); }
    int whois(int x) { return match[x + 1] - 1; }
    int solve() {
        rep(i, 0, n + m + 1) match[i] = 0;
        int res = 0;
        while (bfs()) rep(i, 1, n + 1) if (!match[i] && dfs(i)) res++;
        return res;
    }
};

int N, A[101], B[101], C[101], D[101];

void _main() {
    cin >> N;
    rep(i, 0, N) cin >> A[i] >> B[i];
    rep(i, 0, N) cin >> C[i] >> D[i];

    BipartiteMatching bm;
    bm.init(N, N);
    rep(i, 0, N) rep(j, 0, N) {
        if (A[i] < C[j] and B[i] < D[j]) bm.add(i, j);
    }
    cout << bm.solve() << endl;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fs first
#define se second
#define pb push_back
#define cppio ios::sync_with_stdio(false);cin.tie(0)
using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> VI;

const int maxn=1e6+5;
const ll inf=0x3f3f3f3f;
const ll mod=1e9+7;

ll dp[maxn][4];

int main(){
	ll n;
	scanf("%lld",&n);
	dp[0][0]=1;
	for(int i=1;i<=n;i++){			
		dp[i][0]=(dp[i-1][0]*8)%mod;
		dp[i][1]=(dp[i-1][0]+dp[i-1][1]*9)%mod;
		dp[i][2]=(dp[i-1][0]+dp[i-1][2]*9)%mod;
		dp[i][3]=(dp[i-1][3]*10+dp[i-1][2]+dp[i-1][1])%mod;
	}
	printf("%lld",dp[n][3]);
	return 0;
}


Measured memory_bytes: 34816
y, x = [int(i) for i in input().split()]
allsum = [0] * (x + 1)

for _ in range(y):
    temp = [int(i) for i in input().split()]
    sumrow = sum(temp)
    print('{} {}'.format(' '.join(map(str, temp)), str(sumrow)))
    for i in range(len(allsum) - 1):
        allsum[i] += temp[i]
    allsum[-1] += sumrow

print(' '.join(map(str, allsum)))



Measured memory_bytes: 5620
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <stack>
#include <numeric>
#include <algorithm>
#include <stdio.h>
#include <bitset>
#include <complex>
#include <iomanip>
using namespace std;
#define MM 1000000000
#define MOD MM+7
#define pi pair<int32,int32>
#define pl pair<int64,int64>
#define chmax(a,b) (a<b ? a=b:0)
#define chmin(a,b) (a>b ? a=b:0)
const long double PI = acos(-1);
const long long INF = 1e15;
int dx[8] = {-1,0,1,0,-1,-1,1,1};
int dy[8] = {0,-1,0,1,-1,1,1,-1};
template<typename T>
T GCD(T u,T v){
    return v ? GCD(v,u%v) : u;
}
template<typename T>
T LCM(T x,T y){
    return x*y/(T)GCD(x,y);
}
int main(){
    int r; cin >> r;
    cout << r*r*3 << endl;
}
  



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int llt;
int main()
{
    llt n, m;
    cin>>n>>m;
    priority_queue<llt> pq;
    for(int i=0;i<n;i++){
        llt a;
        cin>>a;
        pq.push(a);
    }
    for(int i=0;i<m;i++)
    {
        llt a = pq.top();
        a = a >> 1;
        pq.pop();
        pq.push(a);
    }
    llt ans = 0;
    for(int i=0;i<n;i++)
    {
        ans += pq.top();pq.pop();
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 1400
#include<stdio.h>
int main(){
  int n,i,j;
  long long count=0;
  scanf("%d",&n);
  int a[n+1],b[n+1][21],c[21];
  for(i=1;i<=n;i++)
    scanf("%d",&a[i]);
  for(i=1;i<=n;i++){
    for(j=0;j<21;j++){
      b[i][j]=a[i]%2;
      a[i]/=2;
    }
  }
  for(i=0;i<21;i++)
    c[i]=0;
  int right=1;
  for(i=1;i<=n;i++){
    int check=0;
    while(check==0 && right<=n){
      for(j=0;j<21;j++){
        c[j]+=b[right][j];
        if(c[j]>1)
          check=1;
      }
      if(check==0)
        right++;
    }
    count+=right-i;
    for(j=0;j<21;j++)
      c[j]-=b[i][j]+b[right][j];
  }
  printf("%lld\n",count);
  return 0;
}


Measured memory_bytes: 17408
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <chrono>
#define _USE_MATH_DEFINES
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;

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

const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-8;
const int MOD = 1000000007; // 998244353;
const int dy[] = {1, 0, -1, 0}, dx[] = {0, -1, 0, 1};
/*-------------------------------------------------*/
int dp[100][100] = {};
int rec(int x, int y) {
  int &d = dp[x][y];
  if (d != 0) return d;
  if (x <= 1 && y <= 1) return d = -1;
  for (int i = 2; i <= x; i += 2) {
    if (rec(x - i, y + i / 2) == -1) return d = 1;
  }
  for (int i = 2; i <= y; i += 2) {
    if (rec(x + i / 2, y - i) == -1) return d = 1;
  }
  return d = -1;
}

int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);
  // freopen("input.txt", "r", stdin);

  long long x, y; cin >> x >> y;
  cout << (abs(x - y) >= 2 ? "Alice\n" : "Brown\n");
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define fr(i,n) for(i=0;i<n;i++)
#define F first
#define S second
#define fast std::ios_base::sync_with_stdio(false)
#define mod 1000000007
#define pi 3.14159265
	long long binpow(long long a, long long b, long long m) {
    a %= m;
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a % m;
        a = a * a % m;
        b >>= 1;
    }
    return res;
}
lli modInverse(lli a, lli m) 
{ 
	return binpow(a, m - 2, m); 
} 
int main() {
	fast;
	lli n,k;
	cin>>n>>k;
	lli i;
	lli sum=((n%mod)*((n+1)%mod)),ans=0;
	sum=(sum%mod*modInverse(2,mod))%mod;
	//cout<<sum<<endl;
	for(i=k;i<=n+1;i++)
	{
		lli temp=((i%mod)*((i-1)%mod))%mod;
		temp=(temp%mod*modInverse(2,mod))%mod;
		//cout<<temp<<"\n";
		lli temp1=(n%mod*2%mod)%mod;
		temp1=(temp1%mod-(i-1)%mod+mod)%mod;
		temp1=(temp1%mod*i%mod)%mod;
		temp1=(temp1%mod*modInverse(2,mod))%mod;
	//	cout<<temp<<" "<<temp1<<"\n";
		lli temp3=((temp1%mod)-(temp%mod)+mod)%mod;
		temp3++;
		//cout<<temp3<<"\n";
		ans=((ans%mod)+(temp3%mod))%mod;
	
	}
	cout<<ans;
	

	return 0;
}

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

int main() {
    int N;
    cin >> N;
    if (N % 10 == 7) {
        cout << "Yes" << endl;
        return 0;
    }
    N /= 10;
    if (N % 10 == 7) {
        cout << "Yes" << endl;
        return 0;
    }
    N /= 10;
    if (N % 10 == 7) {
        cout << "Yes" << endl;
        return 0;
    }
    cout << "No" << endl;

    return 0;
}


Measured memory_bytes: 3596
import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.range, std.typecons;
import std.numeric, std.math, std.random;
import core.bitop;

string FMT_F = "%.10f";

static string[] s_rd;
T RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
string RDR()() { return readln.chomp; }
T[] ARR(T = long)(in string str, T fix = 0) { auto r = str.split.to!(T[]); r[] += fix; return r; }
T[] RDA(T = long)(T fix = 0) { auto r = readln.chomp.split.to!(T[]); r[] += fix; return r; }
T[][] RDA2(T = long)(size_t n, T[] fix = []) { auto r = new T[][](n); foreach (i; 0..n) { r[i] = readln.chomp.split.to!(T[]); foreach (j, e; fix) r[i][j] += e; } return r; }
size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
long lcm(long x, long y) { return x * y / gcd(x, y); }

long mod = 10^^9 + 7;
//long mod = 998244353;
//long mod = 1_000_003;
void moda(ref long x, long y) { x = (x + y) % mod; }
void mods(ref long x, long y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(ref long x, long y) { x = (x * y) % mod; }

void main()
{
	auto N = RD;
	auto A = RDA;
	auto B = RDA;
	long ans;
	foreach (i; 0..N)
	{
		auto x = min(A[i], B[i]);
		ans += x;
		A[i] -= x;
		B[i] -= x;
		auto y = min(A[i+1], B[i]);
		ans += y;
		A[i+1] -= y;
		B[i] -= y;
	}

	writeln(ans);
	stdout.flush();
	debug readln();
}


Measured memory_bytes: 10412
import math
n = int(input())
s = math.ceil(math.sqrt(n))
h = 10**5
for i in range(1,s+1):
  if n%i==0:
    if h > max(len(str(i)),len(str(int(n/i)))):
      h = max(len(str(i)),len(str(int(n/i))))
print(h)

Measured memory_bytes: 9060
N, M = gets.split.map(&:to_i)
Ps = Hash.new{|hash, key| hash[key] = []}
Query = Array.new()
M.times do |i|
  a, b = gets.split.map(&:to_i)
  Ps[a] = Ps[a].push(b)
  Query.push([a,b])
end

ans_table = Hash.new()
Ps.each do |key,value|
  value.sort!
  value.each_with_index{|y, i|
     ans_table[[key,y]] = format('%06d', key) + format('%06d', i+1)
  }
end

Query.each{|x|
  puts ans_table[x]
}


Measured memory_bytes: 41212
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;
import java.util.function.IntToDoubleFunction;
 
/**
 * @author yoshizaki
 *
 */
public class Main {
    public static void main(String[] args) {
        Scanner scanner= new Scanner(System.in);
        int num = scanner.nextInt();
        List<Double> values = new ArrayList<Double>();
        for (int i = 0 ; i < num ; i++) {
            values.add(scanner.nextDouble());
        }
        Collections.sort(values);
        for(int i = 0; i < num-1 ; i++) {
            Double v = (values.get(i) + values.get(i+1))/2;
            values.set(i+1, v);
        }
        System.out.println( values.get(num-1));
    
    
        
    }
}

Measured memory_bytes: 23252
N = int(input())
S = dict()
for _ in range(N):
    s = input()
    if s not in S:
        S[s] = 1
    else:
        S[s] += 1
M = int(input())
T = dict()
for _ in range(M):
    t = input()
    if t not in T:
        T[t] = 1
    else:
        T[t] += 1

ans = 0
for k, v in S.items():
    res = v
    if k in T:
        res -= T[k]
    ans = max(ans, res)

print(ans)


Measured memory_bytes: 38256
#include <algorithm>
#include <bitset>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stdio.h>
#include <string>
#include <vector>

#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using LP = pair<ll, ll>;
const double PI = 3.1415926535897932;

int main()
{
	int N;
	cin >> N;
	string cn;
	cin >> cn;
	string mn = cn;
	sort(mn.begin(), mn.end());

	int cnt = 0;
	for (int i = 0; i < N; ++i) {
		if (mn[i] == 'R') {
			if (mn[i] != cn[i]) {
				cnt++;
			}
		}
		else {
			break;
		}
	}

	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 3912