akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>

    using namespace std;
    #define ll  long long
    #define ld  long double
    #define endl '\n'
    #define FAST ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    const ll MOD = 1e9 + 7;
    const double PI = 3.141592653589793238463;
    const int MAXN = 20000005;
    bool isPrime[MAXN];
    vector<int> pr;
    vector<pair<int,int>> ans;
    void sieve()
    {
        memset(isPrime, 1, sizeof isPrime);
        isPrime[0] = isPrime[1] = 0;

        for (int i = 2; i * i <= MAXN; i += 1 + (i & 1))
        {
            if (isPrime[i])
            {

                for (int j = i * i; j < MAXN; j += i)
                    isPrime[j] = 0;
            }
        }
        for(int i=0; i<MAXN; i++)
        {
            if(isPrime[i])
            {
                if(!pr.empty())
                {
                    if(i-pr.back()==2)
                    {
                        ans.push_back({pr.back(),i});
                    }
                }
                pr.push_back(i);

            }
        }
    }

    ld power(ld x, ll y)
    {
        ll temp;
        if (y == 0)
            return 1;
        temp = power(x, y / 2);
        if (y % 2 == 0)
            return temp * temp;
        else
            return x * temp * temp;
    }

    void debug_out()
    {
        cerr << endl;
    }

    template<typename Head, typename... Tail>
    void debug_out(Head H, Tail... T)
    {
        cerr << " " << H;
        debug_out(T...);
    }

    #define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
    ll pre[MAXN];
    int main()
    {

        ll n;
        cin>>n;
        ll arr[n];
        ll sum=0;
        for(int i=0;i<n;i++)
            {
                cin>>arr[i];
                sum+=arr[i];
                pre[arr[i]]++;
            }
            int q;
            cin>>q;
            while(q--){
                ll a,b;
                cin>>a>>b;
                sum-=pre[a]*a;
                sum+=pre[a]*b;
                cout<<sum<<endl;
                pre[b]+=pre[a];
                pre[a]=0;
            }

        return 0;
    }


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

void solve1(vector<int> A, int n,int x){
    long long int ans = 0;
    for(int i=0;i<n;i++){
        ans += abs(A[i]-x);
    }
    cout<<ans<<endl;
}

long long int solve2(vector<int> A, int n, int x){
    long long int ans = 0;
    for(int i=0;i<n;i++){
        ans += abs(A[i]-x);
    }
    return ans;
}

int main(){
    int n;
    cin>>n;
    vector<int> A(n);
    long long int ans = 0;
    for(int i=0;i<n;i++){
        cin>>A[i];
        A[i] -= i;
    }
    sort(A.begin(),A.end());
    if(n%2==0){
        ans = min(solve2(A, n, A[(int)n/2 - 1]), solve2(A, n, A[((int)n / 2)]));
        cout<<ans<<endl;
    }
    else{
        solve1(A, n, A[n / 2]);
    }
}

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


#define vt vector
#define all(c) (c).begin(), (c).end()
#define sz(x) (int)(x).size()
#define ll long long
#define ld long double
#define ar array
#define inf() ifstream cin("d.txt")
#define onf() ofstream cout("test.txt")
#define mod 1000000007
#define pb push_back
#define endl cout<<"\n";
#define prt1(a) cout<<a<<" "
#define prt2(a,b) cout<<a<<" "<<b<<" "
#define prt3(a,b,c) cout<<a<<" "<<b<<" "<<c<<" "
#define in(a) cin>>a
#define inn(a,b) cin>>a>>b
#define innn(a,b,c) cin>>a>>b>>c 
#define rep(i,st,end) for(int i=st;i<end;i++)
#define repv(i,st,end) for( i=st;i>=end;i--)
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define TEST ll tc;cin>>tc;while(tc--)
#define EACH(x, a) for (auto& x: a)

template<class A> void read(vt<A>& v);
template<class A, size_t S> void read(ar<A, S>& a);
template<class T> void read(T& x) {
    cin >> x;
}
void read(double& d) {
    string t;
    read(t);
    d=stod(t);
}
void read(long double& d) {
    string t;
    read(t);
    d=stold(t);
}
template<class H, class... T> void read(H& h, T&... t) {
    read(h);
    read(t...);
}
template<class A> void read(vt<A>& x) {
    EACH(a, x)
        read(a);
}
template<class A, size_t S> void read(array<A, S>& x) {
    EACH(a, x)
        read(a);
}
#define debug(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a <<"\n";
    err(++it, args...);
}


void solve()
{

  
  string s,t;
  read(s,t);
  ll ans = 1002;
  ll n=s.length();
  ll m =t.length();
  
  rep(i,0,n-m+1)
  {
    ll l = 0;
    string na = s.substr(i,m);
    rep(j,0,m)
    {
      if(na[j]!=t[j])
        l++;
    }
    ans=min(ans,l);
  }
  cout<<ans;
  }


 int main()
 {
    fio;
    ll k = 1;
    ll tc = 1;
    // cin>>tc;
    while(tc--){
       // cout<<"Case #"<<k<<": ";k++;
        solve();
        endl;
    }
    
 }




Measured memory_bytes: 3656
n = gets.to_i

k = -1
100_000.times{|i|
  if i*(i-1)/2==n
    k = i
  end
}

if k==-1
  puts "No"
  exit
end

#
puts "Yes"
puts k
ans = k.times.map{[k-1]}
num = 1
k.times{|i|
  (i+1).upto(k-1){|j|
    ans[i] << num
    ans[j] << num
    num += 1
  }
}

ans.each{|x| puts x*" "}


Measured memory_bytes: 5372
////////////////////////
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
namespace my {
char itoc(int i) { return i + '0'; }
int ctoi(char c) { return c - '0'; }
ll gcd(ll a, ll b) {
  a = abs(a);
  b = abs(b);
  if (a < b) swap(a, b);
  while (b != 0) {
    a %= b;
    swap(a, b);
  }
  return a;
}
ll lcm(ll a, ll b) { return a * b / my::gcd(a, b); }
vector<pair<ll, ll>> primeFac(ll n) {
  vector<pair<ll, ll>> ret;
  for (ll i = 2; i * i <= n; i++) {
    if (n % i != 0) continue;
    ll exp = 0;
    while (n % i == 0) {
      n /= i;
      exp++;
    }
    ret.push_back(make_pair(i, exp));
  }
  if (n != 1) ret.push_back(make_pair(n, 1));
  return ret;
}
}  // namespace my
////////////////////////

int main() {
  string s;
  cin >> s;
  cout << s.substr(0, 3) << endl;
}

Measured memory_bytes: 3592
#include <stdio.h>

long long light(long long a, long long b);
int main(void)
{
  long long n, x, ans;
  scanf("%lld %lld", &n, &x);
  ans = n;
  if (x < n - x) ans += light(x, n - x);
  else ans += light(n - x, x);
  printf("%lld\n", ans);
}

long long light(long long a, long long b)
{
  if (b % a == 0) return a * (b / a * 2 - 1);
  return light(b % a, a) + a * 2 * (b / a);
}

Measured memory_bytes: 128
// بِسمِ اللہِ  الرَّحم?نِ  الرَّ حِیم
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define MOD 1000000007
#define ll long long
#define pb push_back
#define INF 1e18
#define N 1000100
typedef pair<ll,ll> pll;
ll power(ll a,ll b)
{
    if(b==1)return a;
    if(b==0)return 1;
    ll temp=power(a,b/2);
    ll ans=temp*temp;
    if(b&1)
        ans*=a;
    return ans;
}
ll power(ll a,ll b,ll p)
{
    a=a%p;
    if(b==1)return a;
    if(b==0)return 1;

    ll temp=power(a,b/2,p);
    ll ans=(temp*temp)%MOD;
    if(b&1)
        ans=(a*ans)%MOD;
    return ans;
}
ll inv(ll a)
{
    return power(a,MOD-2,MOD);
}
//code begins



signed main()
{
//    freopen("input.txt","r",stdin);
//    freopen("output.txt","w",stdout);

    cin.sync_with_stdio(false);
    ll t;
    t=1;
//    cin>>t;
    while(t--)
    {
        ll h,n;cin>>h>>n;
        vector<pll> v;
        v.push_back({-1,-1});
        for(ll i=0;i<n;i++)
        {
            ll a,b;cin>>a>>b;
            v.push_back({a,b});
        }
        ll dp[h+1];
        dp[0]=0;
        for(ll i=1;i<=h;i++)
        {
            ll mgpnt=INF;
            for(ll j=1;j<=n;j++)
            {
                ll ai=v[j].first;
                ll bi=v[j].second;
                if(i-ai<=0)
                    mgpnt=min(mgpnt,bi);
                else
                    mgpnt=min(mgpnt,bi+dp[i-ai]);
            }
            dp[i]=mgpnt;
        }
        cout<<dp[h]<<endl;
    }
}


Measured memory_bytes: 384
// Problem : C - Next Prime
// Contest : AtCoder - AtCoder Beginner Contest 149
// URL : https://atcoder.jp/contests/abc149/tasks/abc149_c
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

//Macros

#define ll long long
#define db long double
#define pb push_back
#define eb emplace_back
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<pii>
#define mi map<int,int>
#define mii map<pii,int>
#define fi first
#define se second
#define all(a) (a).begin(),(a).end()
#define sz(x) (int)x.size()
#define mod 1000000007
#define EPS 1e-9
#define io ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define inf 1e10
#define PI acos(-1.0)
#define int long long
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define N 100005

//Solution

bool is_prime(int n){
    for(int i=2;i*i<=n;i++){
        if(n % i == 0) return false;
    }
    return true;
}

void solve(){
    int n;
    cin>>n;
    for(int i=n;;i++){
        if(is_prime(i)){
            cout<<i<<endl;
            break;
        }
    }
}

signed main(){
    io;
    //freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
    int tests;
    //cin>>tests;
    tests = 1;
    while(tests--){
        solve();
    }
    return 0;
}

Measured memory_bytes: 3652
import sys

def main():
    n = input()
    a = input().split()
    n = int(n)
    a = list(map(int, a))


    lst = [0]* 1000000
    dup = 0
    ans =0

    for i in a:
        lst[i]+=1

    for i in lst:
        if i >0:
            ans+= 1
        if i > 1:
            dup = dup + i - 1

    if dup % 2 == 0:
        print(ans)
    else:
        print(ans-1)

if __name__ == "__main__":
        main()


Measured memory_bytes: 16292
#include <iostream>
#include <string>
#include <cstdio>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <functional>
#include <queue>
#include <math.h>
#include <cmath>
#include <unordered_map>

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



void solve(int x){
    int ans=0;
    if((400<=x)&&(x<=599)){
        ans=8;
    }else if(600<=x&&x<=799){
        ans=7;
    }else if(800<=x&&x<=999){
        ans=6;
    }else if(1000<=x&&x<=1199){
        ans=5;
    }else if(1200<=x&&x<=1399){
        ans=4;
    }else if(1400<=x&&x<=1599){
        ans=3;
    }else if(1600<=x&&x<=1799){
        ans=2;
    }else if(1800<=x&&x<=1999){
        ans=1;
    }
    cout<<ans<<endl;
}

// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    int x;
    cin>>x;
    solve(x);
    return 0;
}


Measured memory_bytes: 3620
package main

import (
	"fmt"
)

func main() {
	var n int
	var taro, hanako string
	fmt.Scan(&n)
	t_p, h_p := 0, 0
	for i:=0; i<n; i++ {
		fmt.Scan(&taro, &hanako)
		t_l, h_l := len(taro), len(hanako)
		for i, v := range(taro) {
			if i == h_l {
				t_p += 3
			} else if v == rune(hanako[i]){
				if i == t_l-1 && t_l == h_l{
					t_p++
					h_p++
				} else if i == t_l-1 && h_l > t_l{
					h_p += 3
				} else {
					continue
				}
			} else if v > rune(hanako[i]) {
				t_p += 3
			} else {
				h_p += 3
			}
			break
		}
	}
	fmt.Println(t_p, h_p)
}


Measured memory_bytes: 1176
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		System.out.print(a * b + " ");
		System.out.println(2 * a + 2 * b);
	}
}



Measured memory_bytes: 25896
#二部グラフにできるのか
#ここからよ
#実は奇サイクルを含まない=二部グラフとなる
#それぞれのレベルで奇サイクルかどうか
#二部グラフを考えて残りでもどんどん二部グラフを考えるイメージ

#最終的には1or2の状態で残る
N=int(input())
ans=[[0]*N for j in range(N)]
#nはvecの長さ
#次の通路のレベル
def dfs(n,vec,level):
    global ans
    #print(vec)
    #print(n)
    l=vec[:n//2]
    r=vec[n//2:]
    for i in l:
        for j in r:
            ans[i][j]=level
    if len(l)>1:
        dfs(len(l),l,level+1)
    if len(r)>1:
        dfs(len(r),r,level+1)


dfs(N,[i for i in range(N)],1)
for i in range(N-1):
    a=[]
    for j in range(N):
        if i<j:
            a.append(str(ans[i][j]))
    print(" ".join(a))

Measured memory_bytes: 75808
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <iomanip>
#include <math.h>
#include <string.h>
#include <cstdio>
#include <tuple>
#include <numeric>
#include <time.h>
#include <chrono>
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define REP(i,a,b) for(ll i=a;i>b;i--)
#define CST(x) cout<<fixed<<setprecision(x)//小数点以下の桁数指定
#define ct(a) cout<<a<<endl
#define rep(i,n) for(int i=0;i<(n);i++)
#define repl(i,l,r) for(int i=(1);i<(r);i++)
#define per(i, n) for(int i = ((n)-1); i >= 0; i--)
static const double pi = 3.141592653589793;
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
const ll INF = 1e9 + 7;
const ll mod = 1e9 + 7;


ll A[200005], cnt;
bool B[1000500];

int main(){

	cin.tie(0);
	cout.tie(0);
	ios::sync_with_stdio(false);

	FOR(i, 1, 1000001)B[i] = true;

	ll N; cin >> N;
	FOR(i, 0, N) {
		cin >> A[i];
	}

	sort(A, A + N);

	{
		int mae = -1;
		FOR(i, 0, N) {
			ll cur = A[i];
			if (mae != A[i] && B[A[i]]) {

				cur += A[i];
				while (cur <= 1000000) {
					B[cur] = false;
					cur += A[i];
				}
			}
			if (mae == A[i]) {
				B[mae] = false;
			}
			mae = A[i];
		}
		FOR(i, 0, N)if (B[A[i]]) {
			cnt++;
		}


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


/*
Solver ChokudaiSearch(Solver FirstState) {
	const int MaxTurn = 100;
	priority_queue<Solver> HStates[MaxTurn + 1];
	for (int i = 0; i <= MaxTurn; i++) {
		Solver a;
	}
	int ChokudaiWidth = 1;//chokudai幅

	const ll saTimeStart = get_time_millisec();
	const ll saTimeEnd = saTimeStart + 9950;

	ll saTimeCurrent = saTimeStart;


	while (saTimeCurrent = get_time_millisec() < saTimeEnd) {
		FOR(t, 0, MaxTurn) {
			if (HStates[t].empty())break;
			Solver NowStage = HStates[t].top();
			HStates[t].pop();
			
			貪欲をするです
			
		}
	}
}

*/

Measured memory_bytes: 6184
from collections import deque

import numpy as np
import sys
#input = sys.stdin.readline

sys.setrecursionlimit(5000)

def bfs(point, field, target, H, W):
    visited = [[-1 for _ in range(W+2)] for _ in range(H+2)]
    visited[point[0]][point[1]] = 1
    que = deque()
    que.append(point)

    while True:
        v = que.popleft()
        depth = visited[v[0]][v[1]]
        for a in [(v[0]-1, v[1]), (v[0]+1, v[1]), (v[0], v[1]-1), (v[0], v[1]+1)]:
            if field[a[0]][a[1]] == 0 and visited[a[0]][a[1]] == -1:
                visited[a[0]][a[1]] = 1 + depth
                if a == target:
                    return visited[a[0]][a[1]]
                else:
                    que.append(a)
        if len(que) == 0:
            return 0

H, W = list(map(int, input().split()))
target = (H, W)
field = [[-1] * (W+2)]
number_of_whites = 0
for _ in range(H):
    s = input()
    number_of_whites += s.count('.')
    field.append([-1] + [0 if c=='.' else -1 for c in s] + [-1])
field += [[-1] * (W+2)]

shortest_path = bfs((1, 1), field, target, H, W)
if shortest_path > 0:
    print(number_of_whites - shortest_path)
else:
    print(-1)

Measured memory_bytes: 12456
#include<stdio.h>
#include<iostream>
#include<queue>
using namespace std;
int main(){
    int h,w,a[1010][1010],ans=0,x,y,i,j;
    char s;
    queue<int> q1;
    queue<int> q2;
    scanf("%d %d\n",&h,&w);
    for(i=0;i<=h+1;i++){
        for(j=0;j<=w+1;j++){
            a[i][j]=0;
        }
    }
    for(i=1;i<=h;i++){
        for(j=1;j<=w;j++){
            scanf("%c",&s);
            if(s=='.'){
                a[i][j]=-1;
            }
            else{
                q1.push(i),q2.push(j);
            }
        }
        scanf("\n");
    }
    while(!q1.empty()){
        x=q1.front(),y=q2.front();
        q1.pop(),q2.pop();
        if(a[x+1][y]==-1){
            a[x+1][y]=a[x][y]+1;
            q1.push(x+1),q2.push(y);
        }
        if(a[x-1][y]==-1){
            a[x-1][y]=a[x][y]+1;
            q1.push(x-1),q2.push(y);
        }
        if(a[x][y+1]==-1){
            a[x][y+1]=a[x][y]+1;
            q1.push(x),q2.push(y+1);
        }
        if(a[x][y-1]==-1){
            a[x][y-1]=a[x][y]+1;
            q1.push(x),q2.push(y-1);
        }
    }
    for(i=1;i<=h;i++){
        for(j=1;j<=w;j++){
            if(a[i][j]>ans){
                ans=a[i][j];
            }
        }
    }
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 12416
// Problem : A - Five Variables
// Contest : AtCoder - AtCoder Beginner Contest 170
// URL : https://atcoder.jp/contests/abc170/tasks/abc170_a
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define db long double
#define pb push_back
#define pii pair<int,int>
#define vi vector<int>
#define vl vector<ll>
#define vii vector<pii>
#define mi map<int,int>
#define ml map<ll,ll>
#define mii map<pii,int>
#define fi first
#define se second
#define all(a) (a).begin(),(a).end()
#define sz(x) (int)x.size()
#define mod 1000000007
#define MAX 4294967295
#define EPS 1e-9
#define io ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define MAXN 15000005
#define inf 1e10
#define PI acos(-1.0)
#define int long long

void solve(){
    int x[5];
    for(int i=0;i<5;i++) cin>>x[i];
    for(int i=0;i<5;i++){
        if(x[i] == 0) {
            cout<<i+1;
            return;
        }
    }
}

signed main(){
    io;
    //freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
    int t;
    //cin>>t;
    t = 1;
    while(t--){
        solve();
    }
    return 0;
}

Measured memory_bytes: 3652
Scanf.scanf "%d" @@ fun n ->
  let a = Array.init (3*n) (fun _ -> Scanf.scanf " %d" ((+) 0)) in
  Array.sort (-) a;
  Array.init n (fun i -> a.(n + 2*i))
  |> Array.fold_left (+) 0 |> Printf.printf "%d\n"

Measured memory_bytes: 5760
#include <cstdio>
#include <algorithm>
#include <vector>
#include <cstring>
#include <numeric>
#include <cassert>
#include <cmath>
#include <map>
#include <set>

using namespace std;
typedef long long LL;
typedef double LD;
typedef pair<LD, LD> PLD;
typedef pair<PLD, PLD> PPLD;

#define FOR(k,a,b) for(int k(a); k < (b); ++k)
#define FORD(k,a,b) for(int k(b-1); k >= (a); --k)
#define REP(k,a) for(int k=0; k < (a); ++k)
#define ABS(a) ((a)>0?(a):-(a))
#define EPS 1e-9
#define P45 acos(0.0)/2
#define P90 acos(0.0)

LD cross(PLD a, PLD b) { return a.first * b.second - a.second * b.first; }
LD area2(PLD a, PLD b, PLD c) { return cross(a, b) + cross(b, c) + cross(c, a); }

struct CIRCLE
{
	LD x, y, R;
	CIRCLE() {}
	CIRCLE(LD _x, LD _y, LD _R) : x(_x), y(_y), R(_R) {}
	void Read()
	{
		double _x, _y;
		scanf("%lf %lf", &_x, &_y);
		x = _x, y = _y, R = -1;
	}

	PPLD InterSection(const CIRCLE& other)
	{
		LD lx = x, ly = y, lR = R, ox = other.x, oy = other.y, oR = other.R;
		LD d = (lx - ox)*(lx - ox) + (ly - oy)*(ly - oy);
		d = sqrt(d);
		if (ABS(lR + oR - d) < EPS)
			return PPLD(PLD((x + other.x) / 2, (y + other.y) / 2), PLD(x, y));
		if (d < lR + oR)
		{
			LD a = (lR * lR - oR*oR + d*d) / (2.0*d);
			LD h = sqrt(lR*lR - a*a);
			PLD tp1(lx + a*(ox - lx) / d, ly + a*(oy - ly) / d);
			PLD p1(tp1.first + h*(oy - ly) / d, tp1.second - h*(ox - lx) / d);
			PLD p2(tp1.first - h*(oy - ly) / d, tp1.second + h*(ox - lx) / d);
			return PPLD(p1, p2);
		}
		return PPLD(PLD(x, y), PLD(x, y));
	}	
	bool IsIn(const PLD& p) const
	{
		return ABS((p.first - x)*(p.first - x) + (p.second - y)*(p.second - y)) <   R * R + EPS;
	}
};


int main(int argc, char** argv) 
{
	int N, M;
	scanf("%d", &N);
	M = N;
	vector<CIRCLE> v(N);
	REP(i, N)
		v[i].Read();
	LD lo = 0, hi = 2000;
	while (ABS(hi - lo) > 0.00000001)
	{
		LD actR = (hi + lo) / 2;
		REP(i, N)
			v[i].R = actR;
		int mx = 0;
		REP(i, N) FOR(j,i+1,N)
		{
			PPLD ip = v[i].InterSection(v[j]);
			CIRCLE c1,c2;
			c1.x = ip.first.first, c1.y = ip.first.second, c1.R = actR;
			int db1 = 0, db2 = 0;
			REP(k, N)
			{
				if (c1.IsIn(make_pair(v[k].x, v[k].y)))
					++db1;
			}
			c2.x = ip.second.first, c2.y = ip.second.second, c2.R = actR;
			REP(k, N)
			{
				if (c2.IsIn(make_pair(v[k].x, v[k].y)))
					++db2;
			}
			mx = max<int>(max<int>(db1, db2),mx);
		}
		if (mx >= M)
			hi = actR;
		else
			lo = actR;
	}
	printf("%.10lf\n", lo);
	return 0;
}

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

using namespace std;

namespace util {
    vector<int> read_int_vector() {
        int n;
        cin >> n;

        vector<int> v;
        for (int i = 0; i < n; i++) {
            int in;
            cin >> in;
            v.push_back(in);
        }
        return v;
    }
    void print_vector(vector<int> &v) {
        for (auto it = v.begin(); it != v.end(); it++) {
            cout << *it;
            if (it + 1 != v.end())
                cout << " ";
        }
        cout << endl;
    }
    void swap(vector<int>& v, size_t i, size_t j) {
        int tmp = v[i];
        v[i] = v[j];
        v[j] = tmp;
    }
}

namespace {
    int run_selection_sort(vector<int>& v) {
        int count = 0;
        for (size_t i = 0; i < v.size(); i++) {
            size_t min = i;
            for (size_t j = i; j < v.size(); j++) {
                if (v[j] < v[min])
                    min = j;
            }

            if (min != i) {
                count++;
                util::swap(v,i,min);
            }
        }
        return count;
    }
}

int main() {
    vector<int> in = util::read_int_vector();
    int count = run_selection_sort(in);
    util::print_vector(in);
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 1220
#include <stdio.h>
#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <math.h>
#include <algorithm>
using namespace std;
#define ll long long
const double EPS = 1e-10;
const ll MOD = 7+(1e+9);

int main(){
  ll n;
  ll ans=0;
  cin>>n;
  vector<ll>a(n,0);
  vector<ll>b(n,0);
  for(ll i=0;i<n;i++){
    cin>>a[i];
  }
  for(ll i=0;i<n;i++){
    cin>>b[i];
  }
  for(ll i=0;i<n;i++){
    if((a[i]-b[i])>0)ans+=a[i]-b[i];
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 256
#include<cstdio>
long long num[1001];
int main()
{
	int i=2;
	num[0]=2;
	for(i=1;i<=10;i++)
	{
		num[i]=num[i-1]*2;
	}
	int n;
	while(scanf("%d",&n)!=EOF)
	{
		for(i=0;i<=10;i++)
		{
			if(num[i]>n) break;
		}
		if(n!=1) printf("%d\n",num[i-1]);
		else printf("1\n");
	}
	return 0;
}

Measured memory_bytes: 128
#include<stdio.h>
int main()
{
    int t,a[3],i,j,c=0;

    for(i=0;i<3;i++)
        scanf("%d",&a[i]);

    for(i=0;i<3;i++)
    {
        for(j=2;j>i;j--)
        {
            if(a[j]>a[j-1])
            {
                t=a[j];
                a[j]=a[j-1];
                a[j-1]=t;
            }
        }
    }

    c=(a[0]-a[1])+(a[1]-a[2]);

        printf("%d ",c);

    return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define dup(x,y) (((x)+(y)-1)/(y))
#define v(T) vector<T>
#define vv(T) v(v(T))
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<pii> vp;
typedef vector<T> vt;
inline int getInt() { int x; scanf("%d",&x); return x;}
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MX = 200005;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
//---------------------------------------------------------------
#define fastio cin.tie(nullptr); std::ios::sync_with_stdio(false);
#define myio ifstream iofi; if(argc>1){iofi.open(argv[1]); std::cin.rdbuf(iofi.rdbuf());}
//--------------------------------------------------------------

void Main(){
  string s;
  cin>>s;
  int n = s.length();
  bool dimimished = true;
  while(dimimished and s.length()>=2){
    dimimished=false;
    rep(i,s.length()-1){
      if((s[i]!=s[i+1])){
        s.erase(i,2);
        dimimished=true;
        break;
      }
    }
  }
  cout<<n-s.length()<<endl;
} int main(int argc,char** argv)
{fastio; myio; Main();}


Measured memory_bytes: 512
import java.util.*;
public class Main{
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
      long q = sc.nextLong();
      long h = sc.nextLong();
      long s = sc.nextLong();
      long d = sc.nextLong();
      long n = sc.nextLong();
      if(n%2==0)System.out.println(Math.min(q*4*n,Math.min(h*2*n,Math.min(s*n,d*n/2))));
      else System.out.println(Math.min(q*4*n,Math.min(h*2*n,Math.min(s*n,d*(n/2)+Math.min(q*4,Math.min(h*2,s))))));
    }
}


Measured memory_bytes: 21844
#include <iostream>

using namespace std;

int dir[300001];
int cnt[300001];

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

  char ch;
  for (int i = 1; i <= n; i++) {
    cin >> ch;
    dir[i] = ch == 'E' ? 1 : -1;
  }

  int c = 0;
  for (int i = 2; i <= n; i++) {
    if (dir[i] == -1) c++;
  }
  cnt[1] = c;
  for (int i = 2; i <= n; i++) {
    cnt[i] = cnt[i - 1];
    if (dir[i - 1] == 1) cnt[i]++;
    if (dir[i] == -1) cnt[i]--;
  }

  int max = 0;
  for (int i = 1; i <= n; i++) {
    if (max < cnt[i]) max = cnt[i];
  }

  cout << n - max - 1 << endl;
}

Measured memory_bytes: 2560
def shred(num, base=10, reverse=True):
    digits = []
    while num != 0:
        digits.append(num % base)
        num /= base
        num = int(num)
    if not reverse:
        digits = [dig for dig in reversed(digits)]
    return digits

if __name__ == '__main__':
    N = int(input())
    if 7 in shred(N):
        print('Yes')
    else:
        print('No')


Measured memory_bytes: 9116
#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ for(auto it : P) { s << "<" << it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ for(auto it : P) { s << "<" << it.first << "->" << it.second << "> "; } return s << endl; }


using Graph = vector<vector<int> >;
int N, M;
Graph G;

void solve() {
    vector<int> dist(N, -1);
    vector<int> prev(N, -1);
    queue<int> que;
    que.push(0);
    dist[0] = 0;
    while (!que.empty()) {
        int v = que.front();
        que.pop();
        for (auto nv : G[v]) {
            if (dist[nv] == -1) {
                dist[nv] = dist[v] + 1;
                prev[nv] = v;
                que.push(nv);
            }
        }
    }
    cout << "Yes" << endl;
    for (int i = 1; i < N; ++i) cout << prev[i] + 1 << endl;
}

int main() {
    while (cin >> N >> M) {
        G.assign(N, vector<int>());
        for (int i = 0; i < M; ++i) {
            int a, b;
            cin >> a >> b;
            --a, --b;
            G[a].push_back(b);
            G[b].push_back(a);
        }
        solve();
    }
}

















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

using namespace std;

typedef long long ll;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;

int main() {
    ll n, m, i, j, k;
    string s;
    cin >> s;
    n = s.size();
    if(s[0]=='0' || s.back()=='1' || s[n-2]=='0'){
        cout << -1 << endl;
        return 0;
    }
    s[n-1] = '1';
    for(i=0;i*2<n-1;i++){
        if(s[i]!=s[n-2-i]){
            cout << -1 << endl;
            return 0;
        }
    }
    vector<vector<ll>> G(n+1);
    ll now;
    ll root = n;
    for(i=n-2;i>=0;i--){
        G[root].push_back(i+1);
        if(s[i]=='1'){
            root = i+1;
        }
    }
    for(i=1;i<=n;i++){
        for(ll x:G[i]){
            cout << i << " " << x << endl;
        }
    }
    return 0;
}

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

typedef uint64_t u64;
typedef int64_t i64;
typedef uint32_t u32;
typedef int32_t i32;
typedef uint16_t u16;
typedef int16_t i16;
typedef uint8_t u8;
typedef int8_t i8;

using namespace std;

#define rep(idx, N) for (u64 idx = 0; idx < N; idx++)

int main() {
  i32 a[3][3];
  i32 n;

  rep(i, 3) rep(j, 3) cin >> a[i][j];

  set<i32> row[3];
  set<i32> col[3];
  set<i32> diag[2];

  rep(i, 3) rep(j, 3) { row[i].insert(a[i][j]); }

  rep(j, 3) rep(i, 3) { col[j].insert(a[i][j]); }

  diag[0].insert(a[0][0]);
  diag[0].insert(a[1][1]);
  diag[0].insert(a[2][2]);

  diag[1].insert(a[0][2]);
  diag[1].insert(a[1][1]);
  diag[1].insert(a[2][0]);

  cin >> n;

  vector<i32> b(n);
  rep(k, n) {
    cin >> b[k];
    rep(i, 3) {
      row[i].erase(b[k]);
      col[i].erase(b[k]);
    }
    diag[0].erase(b[k]);
    diag[1].erase(b[k]);
  }

  rep(i, 3) {
    if (row[i].empty()) {
      cout << "Yes";
      return 0;
    }
    if (col[i].empty()) {
      cout << "Yes";
      return 0;
    }
  }

  rep(i, 2) {
    if (diag[i].empty()) {
      cout << "Yes";
      return 0;
    }
  }

  cout << "No";

  return 0;
}


Measured memory_bytes: 3624
#include<bits/stdc++.h>
#define ll long long int
#define FOR(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define REP(i,n) FOR(i,0,n)
#define REP1(i,n) FOR(i,1,n)
using namespace std;

int main() {
  string s, p;
  int n1, n2, flag = 0;
  cin >> s >> p;
  n1 = s.size();
  n2 = p.size();
  s =  s + s;
  REP(i, n1) {
    if (s.substr(i, n2) == p)
      flag = 1;
  }
  if (flag == 1)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;

  return 0;
}

Measured memory_bytes: 3204
#include<iostream>
#include<cstdio>
#include<cstring>
#include<vector>
#include<algorithm>
#define ll long long
#define rep(i, a, b) for(int i = a; i <= b; i++)
void read(int &x) {
    x = 0; int flag = 1; char ch = ' ';
    while(ch < '0' || ch > '9') { if(ch == '-') flag = -1; ch = getchar(); }
    while(ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar();
    x *= flag;
}
void read(ll &x) {
    x = 0; int flag = 1; char ch = ' ';
    while(ch < '0' || ch > '9') { if(ch == '-') flag = -1; ch = getchar(); }
    while(ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar();
    x *= flag;
}
using namespace std;
const int maxn = 51, mod = 1e9 + 7;
int n;
ll k;
struct Matrix {
    ll a[maxn][maxn];
    Matrix() { memset(a, 0, sizeof(a)); }
} a;
Matrix operator * (Matrix a, Matrix b) {
    Matrix ret;
    rep(i, 1, n) rep(j, 1, n) rep(k, 1, n) ret.a[i][j] = (ret.a[i][j] + a.a[i][k] * b.a[k][j]) % mod;
    return ret;
}
Matrix qpow(Matrix a, ll y) {
    Matrix ret;
    rep(i, 1, n) rep(j, 1, n) ret.a[i][i] = 1;
    for(; y; y >>= 1) {
        if(y & 1) ret = ret * a;
        a = a * a;
    }
    return ret;
}
int main()
{
    read(n), read(k);
    rep(i, 1, n) rep(j, 1, n) read(a.a[i][j]);
    Matrix ans = qpow(a, k);
    ll sum = 0;
    rep(i, 1, n) rep(j, 1, n) sum = (sum + ans.a[i][j]) % mod;
    printf("%lld\n", sum);
    return 0;
}

Measured memory_bytes: 384
import java.util.Iterator;
import java.util.LinkedList;
import java.util.Scanner;
import java.util.Queue;
import java.util.Arrays; 

class GraphBFS {
	private int totalVertex;
	private LinkedList<LinkedList<Integer>> adjList;
	//adjacency list of edges
	public GraphBFS() { totalVertex = 0; }
	public void loadAdjList() {
		Scanner in = new Scanner(System.in);
		totalVertex = in.nextInt();
		adjList = new LinkedList<LinkedList<Integer>>();
		for(int i = 0; i < totalVertex; i ++) {
			LinkedList<Integer> tmp = new LinkedList<Integer>();
			int idx1 = in.nextInt() - 1;
			int degree = in.nextInt();
			//System.out.println("mark idx1 = " + idx1 + " degree = " + degree);
			for(int j = 0; j < degree; j ++) {
				int idx2 = in.nextInt();
				tmp.add(idx2);
			}	
			adjList.add(tmp);
		}
		in.close();
	}
	
	public int[] BFS(int start){
		Queue<Integer> Q = new LinkedList<>();
		int [] Dist = new int [totalVertex];
		Arrays.fill(Dist, -1);
		Q.add(start);
		Dist[start-1] = 0;
		while(Q.size()>0){
			int v = Q.remove();
			Iterator<Integer> it = adjList.get(v-1).iterator();
		    while (it.hasNext()) {
		    	int tmp = it.next();
		    	if(Dist[tmp-1]==-1){
		    		Q.add(tmp);
		    		Dist[tmp-1] = Dist[v-1] + 1;
		    	}
		    }
		}
		return Dist;
	}
	public void printDist(int start){
		int[] Dist = BFS(start);
		for(int i=0; i<totalVertex; i++){
			System.out.println((i+1) + " " + Dist[i]);
		}
	}	
}


public class Main {

	public static void main(String argv[]) {
		GraphBFS g = new GraphBFS();
		g.loadAdjList();
		g.printDist(1);
	}
}


Measured memory_bytes: 28192
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int n,  i;
    ll sum = 0;
    cin >> n;
    for(i=1; i<=n; ++i)
    {
        if((i%3 == 0) || (i%5 == 0)) continue;
        else {sum += i;}
    }
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 3652
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<math.h>
#include<map>
#include<iomanip>
#include<functional>

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

#define rep(i,n,m) for(long long int i=n;i<(long long int)(m);i++)



int main() {

	string str;
	
	cin >> str;

	str.pop_back();

	bool flag = false;

	

	while (!flag) {

		if (str.length() % 2 != 0) {
			str.pop_back();
			continue;
		}

		

		string left;
		string right;

		left = str.substr(0,(str.length() / 2));
		right = str.substr(str.length() / 2, str.length()/2);


		if (left == right) {
			flag = true;
		}
		else str.pop_back();

	}


	cout << str.length() << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define mem(a) memset(a,0,sizeof(a))
#define ll long long
int main()
{
	int x;
	
	//40
	ll i,a[1001];for(i=0;i<=1000;i++)a[i]=pow(i,5);//,cout<<a[i]/*pow(i,5)*/<<endl;
	int j;
	cin>>x;
	for(i=0;i<=1000;i++)
	{
		for(j=i;j<=1000;j++)
		{
			if(a[j]-a[i]==x)
			{
				cout<<j<<' '<<i;
				return 0;
			}
			if(a[j]+a[i]==x)
			{
				cout<<j<<' '<<-i;
				return 0;
			}
			
		}
	}
	return 0;
}

Measured memory_bytes: 4108
from collections import deque
n = int(input())
dList = list(map(int,input().split()))
result = deque()

for i in range(n):
  if i % 2 == n % 2:
   result.append(dList[i])
  else:
   result.appendleft(dList[i])

for i in result:
  print(i,end=" ")

print()


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

using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define MOD 1000000007LL

#define rep(i, n) for(ll (i) = 0LL;(i) < (ll)(n);(i)++)
#define rep2(i, s, e) for(ll (i) = (ll)(s);(i) < (ll)(e);(i)++)
#define repi(i, n) for(ll (i) = 0LL;(i) <= (ll)(n);(i)++)
#define repi2(i, s, e) for(ll (i) = (ll)(s);(i) <= (ll)(e);(i)++)
#define per(i, n) for(ll (i) = (ll)(n) - 1LL;(i) >= 0LL;(i)--)
#define per2(i, s, e) for(ll (i) = (ll)(s) - 1LL;(i) >= (ll)(e);(i)--)
#define peri(i, n) for(ll (i) = (ll)(n);(i) >= 0LL;(i)--)
#define peri2(i, s, e) for(ll (i) = (ll)(s);(i) >= (ll)(e);(i)--)
#define iter(i, it) for(auto &(i): (it))

template<typename T, typename U> ostream& operator<<(ostream &s, const pair<T, U> m) {
    cout << "(" << m.first << ", " << m.second << ")";
    return s;
}
template<typename T, typename U> ostream& operator<<(ostream &s, const map<T, U> m) {
    ll c = 0;
    cout << "{ ";
    iter(i, m) cout << i << (c++ == m.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const vector<T> &v) {
    cout << "{ ";
    rep(i, v.size()) cout << v[i] << (i == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const list<T> &v) {
    ll c = 0;
    cout << "{ ";
    iter(i, v) cout << i << (c++ == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}

int main(void) {
    ll X;
    cin >> X;
    cout << 8 - (X - 400) / 200 << endl;
    return 0;
}


Measured memory_bytes: 3632
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <climits>
#include <random>
#include <iomanip>

using namespace std;
typedef long long unsigned int ll;
typedef pair<int, int> P;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

#define fillInt(xs, x)        \
  for (int i = 0; i < (x); i++) \
    scanf("%d", &xs[i]);
#define fillLong(xs, x)       \
  for (int i = 0; i < (x); i++) \
    scanf("%ld", &xs[i]);
#define fillString(xs, x)       \
  for (int i = 0; i < (x); i++) \
    cin >> xs[i];
#define sortv(xs) sort(xs.begin(), xs.end())
#define sortvdi(xs) sort(xs.begin(), xs.end(), std::greater<long>())
#define lbv(xs, x) lower_bound(xs.begin(), xs.end(), x) - xs.begin()
#define ubv(xs, x) upper_bound(xs.begin(), xs.end(), x) - xs.begin()
#define bs(xs, x) binary_search(xs.begin(), xs.end(), x)

#define rep(i,n) for(auto i=0; i<(n); i++)
#define isValidPoint(x, y, mx, my) x >= 0 && x  < mx && y >= 0 && y < my

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

const int MOD = 1000000007;

struct Pony
{
    long a, b;
 
    Pony(long a_, long b_)
    {
        a = a_;
        b = b_;
    }
 
    bool operator<(const Pony &another) const
    {
        return b < another.b;
    };
};

int fac(int k){
    int sum = 0;
    for (int i = 1; i <= k; ++i)
    {
        sum += i;
    }
    return sum;
}

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

  int n;

  cin >> n;

  int b = 0;
  bool isOk = true;
  rep(i, n) {
    int a;
    cin >> a;
    if(a >= b+1) {
      b = a-1;
    } else if (a >= b) {
      b = a;
    } else {
      isOk = false;
      break;
    }
  }
  
  cout << (isOk ? "Yes" : "No") << endl;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)

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

checked = [False]*N
def dfs(p):
    checked[p] = True
    g = 0
    for np in graph[p]:
        if not checked[np]:
            g ^= dfs(np)+1
    return g

if dfs(0) == 0:
    print("Bob")
else:
    print("Alice")

Measured memory_bytes: 110256
#include <iostream>
#include <vector>
#include <string>
#include <cmath>

using namespace std;

bool is_valid_number(long x) {
  string i_str = to_string(x);
  bool is_contain_three = i_str.find('3') != string::npos;
  bool is_contain_five = i_str.find('5') != string::npos;
  bool is_contain_seven = i_str.find('7') != string::npos;

  return is_contain_three && is_contain_five && is_contain_seven;
}

int test_output_is_valid_number(bool expected ,bool actual) {
  bool is_success = expected == actual;
  cout << "A Test Result: " << is_success << endl;
  cout << "  " << "Expected: " << expected << ", " << "Actual: " << actual << endl;

  return 0;
}

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

  vector<string> parts = {"3", "5", "7"};
  vector<string> combined = {""};
  int num_valid = 0;

  while(1) {
    vector<string> combined_buf;

    for (int i = 0; i < 3; i++) {
      for (int j = 0; j < int(combined.size()); j++) {
        long cand = stol(parts[i] + combined[j]);
        combined_buf.emplace_back(to_string(cand));

        if (cand < 357)
          continue;
        if (cand > n) {
          cout << num_valid << endl;
          return 0;
        }
        if (is_valid_number(cand))
          num_valid++;
      }
    }

    combined = move(combined_buf);
  }

  return 0;
}


Measured memory_bytes: 1664
#include <bits/stdc++.h>
#define int long long

using namespace std;
using LL = long long;
using P = pair<int, int>;

#define FOR(i, a, n) for(int i = (int)(a); i < (int)(n); ++i)
#define REP(i, n) FOR(i, 0, n)

#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

const int INF = (int)1e9;
const LL INFL = (LL)1e18;
const int MOD = (int)1e9 + 7;

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

    int n;
    cin >> n;
    int f[105][10];
    REP(i, n) REP(j, 10) cin >> f[i][j];
    LL p[105][11];
    REP(i, n) REP(j, 11) cin >> p[i][j];

    LL ans = -INFL;
    for(int mask = 1; mask < (1 << 10); mask++){
        LL sum = 0;
        REP(i, n){
            int osum = 0;
            REP(j, 10){
                if(f[i][j] == 1 && mask & (1 << j)) osum++;
            }
            sum += p[i][osum];
        }
        ans = max(ans, sum);
    }
    cout << ans << endl;

}

Measured memory_bytes: 256
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include<cmath>
#include<limits>
#define ll long long
#define ALL(x) (x).begin(),(x).end()
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define int_INF 2147483647
#define pint_INF 2000000000
#define ll_INF 	9223372036854775807
#define MOD 1000000007
#define vi vector<int>
#define vvi vector<vector<int>>
#define vvll vector<vector<long long>>
#define vvc vector<vector<char>>
#define vll vector<long long>
#define pii pair<int,int>
#define vpii vector<pair<int,int>>
#define sysp system("PAUSE")
#define pno cout << "no" << endl
#define pyes cout << "yes" << endl
#define pYes cout << "Yes" << endl
#define pNo cout << "No" << endl
using namespace std;
#define int ll
struct Node {
public:
    vector<vector<int>> to_child; // {node_number,weight}
};

bool comp(const vector<int>& a, const vector<int>& b) {
    if (a[1] != b[1]) {
        return a[1] < b[1];
    }
    else {
        return a[0] < b[0];
    }
}

vector<int> Dijkstra(vector<Node> Graph_V, int start) {
    vector<int> Cost(Graph_V.size(), ll_INF);
    priority_queue<vector<int>, vector<vector<int>>, decltype(&comp)> pq(&comp);
    Cost[start] = 0;
    pq.push({ start,0 });
    vector<int> Max = { 0,0 }; //{NodeNumber,CostfromStart}

    while (!pq.empty()) {
        int parent = pq.top()[0]; pq.pop();
        Node u = Graph_V[parent];

        for (vector<int> child : u.to_child) {
            if (Cost[parent] + child[1] < Cost[child[0]]) {
                Cost[child[0]] = Cost[parent] + child[1];
                pq.push({ child[0],Cost[child[0]] });
            }
        }
    }

    return Cost;
}

signed main() {
    //Djikstra
    int N; cin >> N;
    vector<Node> graphV(N);

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

    int Q, K; cin >> Q >> K;
    vector<int> cost = Dijkstra(graphV, --K);

    for (int i = 0; i < Q; i++) {
        int x, y; cin >> x >> y;
        --x; --y;
        cout << cost[x] + cost[y] << endl;
    }

}

Measured memory_bytes: 43460
#include<bits/stdc++.h>
using namespace std;
#define int  long long
#define tc(t)  int t; cin>>t; while(t--)
#define f(n)    for(int i=0;i<n;i++)
#define endl   "\n"







int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin>>n;

   string a,b;
   string ans;
   cin>>a>>b;
   for(int i=0;i<n;i++)
   {
          ans+=a[i];
          ans+=b[i];

   }
   cout<<ans<<endl;







}

Measured memory_bytes: 3652
# coding: utf-8
a,b=gets.chomp.split(" ").map(&:to_i);

t = a+b
h = a-b
k = a*b

if t > h then
  if t > k then
    ret = t
  else
    ret = k
  end
else
  if h > k then
    ret = h
  else
    ret = k
  end
end
print(ret)

Measured memory_bytes: 1788
import java.util.*;

class Main{
        public static void main(String[] args){
                Scanner sc = new Scanner(System.in);
                while(sc.hasNext()){
                        String[] s = sc.nextLine().split(",");
                        int[] c = new int[5];
                        for(int i = 0; i < 5; i++){
                                c[i] = Integer.parseInt(s[i]);
                        }   
                        Arrays.sort(c);
                        if(c[0] == c[3] || c[1] == c[4]){
                                System.out.println("four card");
                        }else if((c[0] == c[1] && c[2] == c[4]) || (c[0] == c[2] && c[3] == c[4])){
                                System.out.println("full house");
                        }else{
                                boolean flag = true;
                                for(int i = 0; i < 4; i++){
                                        flag &= c[i]+1 == c[i+1];
                                }   
                                if(flag || Arrays.equals(c, new int[]{1,10,11,12,13})){
                                        System.out.println("straight");
                                }else if(c[0] == c[2] || c[1] == c[3] || c[2] == c[4]){
                                        System.out.println("three card");
                                }else{

                                        int kinds = 1;
                                        for(int i = 0; i < 4; i++){
                                                if(c[i] != c[i+1])kinds++;
                                        }   
                                        if(kinds == 5){ 
                                                System.out.println("null");
                                        }else if(kinds == 4){ 
                                                System.out.println("one pair");
                                        }else if(kinds == 3){ 
                                                System.out.println("two pair");
                                        }   
                                }   
                        }   

                }   
                sc.close();
        }   
}

Measured memory_bytes: 0
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		if (a < b)
			System.out.println("a < b");
		else if(a > b)
			System.out.println("a > b");
		else 
			System.out.println("a == b");
	}
}



Measured memory_bytes: 26332