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

using namespace std;
using ll = long long;
template<class T> using V = vector<T>;

const int MB = 22;
int n;
V<int> v;

int can[1<<MB];
int up[1<<MB];
bool visit[1<<MB] = {};
int calc(int f) {
    if (visit[f] == false) {
        visit[f] = true;
        for (int i = 0; i < MB; i++) {
            if (f & (1<<i)) continue;
            calc(f | (1<<i));
            if (can[f | (1<<i)]) up[f] |= up[f | (1<<i)];
        }
    }
    if (can[f] >= 3) return __builtin_popcount(up[f]);
    else return 0;
}


int calc() {
    for (int d: v) {
        can[d] += 1;
        up[d] = d;
    }
    for (int i = 0; i < MB; i++) {
        for (int j = 0; j < (1<<MB); j++) {
            if (j & (1<<i)) continue;
            can[j] += can[j | (1<<i)];
        }
    }
    int ans = 0;
    for (int i = 0; i < (1<<MB); i++) {
        ans = max(ans, calc(i) * __builtin_popcount(i));
    }
    return ans;
}

int main() {
    ios::sync_with_stdio(false);
    cin >> n;

    for (int i = 0; i < n; i++) {
        int x;
        cin >> x;
        int y = 0;
        for (int j = 0; j < x; j++) {
            int a;
            cin >> a; a--;
            y |= (1<<a);
        }
        v.push_back(y);
    }
    cout << calc() << endl;
    return 0;
}

Measured memory_bytes: 40088
#include<bits/stdc++.h>
using namespace std;
using lint = long long;
const lint MOD = 1e9+7;

signed main(){
	lint N, K; cin >> N >> K;
	vector<lint> a(N);
	for(lint i = 0; i < N; i++) cin >> a[i];
	vector<vector<lint> > dp(N + 1, vector<lint> (K + 1, 0));
	for(lint i = 0; i <= N; i++) dp[i][0] = 1;
	for(lint i = 0; i < N; i++){
		for(lint j = 1; j <= K; j++){
			if(j - 1 - a[i] >= 0){
			  dp[i + 1][j] = dp[i + 1][j - 1] + dp[i][j] - dp[i][j - 1 - a[i]] + MOD;
				dp[i + 1][j] %= MOD;
			}
			else dp[i + 1][j] = dp[i + 1][j - 1] + dp[i][j];
			dp[i + 1][j] %= MOD;
		}
	}
	cout << dp[N][K] << endl;
}

Measured memory_bytes: 80256
#include <iostream>
#include <algorithm>
using namespace std;
#include <cstdio>
#include <tuple>
#include <string>
#include <vector> 
#include <set>
#include <string.h>
#include <map>
using Graph = vector<vector<int>>;
using Graph_Wei = vector<vector<pair<int,int>>>;
using ll = long long;

//長さを記録する
Graph_Wei graph_wei;
// 二部グラフ判定
vector<int> color;
void dfs(const Graph_Wei &G, int v, int w,int cur = 0) {

    for (auto next_v : G[v]) {
        //訪問ずみならスルー
        if(color[next_v.first] != -1) continue;
        //first:頂点番号　second:長さ
        w += next_v.second;

        //距離が偶数の時、同色
        if(w % 2 == 0){
            color[next_v.first] = cur;
        }else{
            color[next_v.first] = 1 - cur;
        }
        
        dfs(G, next_v.first, w);
          
    }  
}

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

    if(a > 2 * b){

        cout << a- 2*b << endl;
    }else{
        cout << 0 << endl;
    }

    return 0;

}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = uint32_t;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

namespace ICPC {
    array<array<int, 12>, 12> G{}, visited{};
    int h, w, c;
    int ans = 0;

    void dfs(int depth){
        for (int i = 1; i <= 6; ++i) {
            int color = G[1][1];
            if(color == i) continue;
            queue<pair<int, int>> Q;
            Q.emplace(1, 1);
            array<int, 4> di{-1, 1, 0, 0}, dj{0, 0, 1, -1};
            vector<pair<int, int>> v;
            G[1][1] = i;
            while(!Q.empty()){
                auto p = Q.front(); Q.pop();
                v.emplace_back(p);
                int y, x; tie(y, x) = p;
                for (int k = 0; k < 4; ++k) {
                    if(G[y+di[k]][x+dj[k]] == color){
                        G[y+di[k]][x+dj[k]] = i;
                        Q.emplace(y+di[k], x+dj[k]);
                    }
                }
            }
            if(depth == 4 && i == c) {
                for (int j = 0; j < h; ++j) {
                    for (int k = 0; k < w; ++k) {
                        visited[j+1][k+1] = 0;
                    }
                }
                int cnt = 0;
                Q.emplace(1, 1);
                while(!Q.empty()){
                    auto p = Q.front(); Q.pop();
                    int y, x; tie(y, x) = p;
                    visited[y][x] = 1;
                    cnt++;
                    for (int k = 0; k < 4; ++k) {
                        if(G[y+di[k]][x+dj[k]] == i && !visited[y+di[k]][x+dj[k]]){
                            Q.emplace(y+di[k], x+dj[k]);
                            visited[y+di[k]][x+dj[k]] = 1;
                        }
                    }
                }
                ans = max(ans, cnt);
            }else if(depth <= 3) {
                dfs(depth+1);
            }
            for (auto &&j : v) {
                G[j.first][j.second] = color;
            }
        }
    }

    void solve(int H, int W, int C){
        h = H, w = W, c = C;
        for (int i = 0; i <= h+1; ++i) {
            for (int j = 0; j <= w+1; ++j) {
                G[i][j] = -1;
            }
        }
        for (int i = 1; i <= h; ++i) {
            for (int j = 1; j <= w; ++j) {
                cin >> G[i][j];
            }
        }
        ans = 0;
        dfs(0);
        cout << ans << "\n";
    }
}

int main() {
    int h, w, c;
    while(cin >> h >> w >> c, h){
        ICPC::solve(h, w, c);
    }
    return 0;
}


Measured memory_bytes: 3096
#include<bits/stdc++.h>//头文件
using namespace std;
int a,b,c;
int main(){
    cin>>a>>b>>c;
    if(a-b==b-c)cout<<"YES";//如果符合条件
    else cout<<"NO";//否则
    cout<<endl;//别忘了回车
    return 0;//完美结束
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
  double a,b;scanf("%lf%lf",&a,&b);
  double al=a/0.08,ah=(a+1)/0.08,bl=b/0.1,bh=(b+1)/0.1;
  if ((al>=bh) || (bl>=ah)) printf("-1\n");
  else{
    int k;
    if (al<bl) k=bl+0.999999999;
    else k=al+0.99999999; 
    printf("%d\n",k); 
  }
  
  return 0;
}

Measured memory_bytes: 128
n=int(input())
a=list(input())

# あかのインデックス
RR=[]

for i in range(n):
    if a[i]=='R':
        RR.append(i)


v=a.count('R')
ans=v
for i in range(len(RR)):
    if RR[i]+1<=v:
        ans-=1
print(ans)

Measured memory_bytes: 95848
#include<iostream>
using namespace std;
int num[10010];
int mp[110][110];
int main()
{
    int h, w, n;
    while (~scanf("%d%d%d", &h, &w, &n))
    {
        for (int i = 1; i <= n; i++) scanf("%d", &num[i]);
        int r = 1, c = 1,clr=1;
        bool flag = true;
        while (clr<=n)
        {
            int cnt = num[clr];
            while (cnt)
            {
                mp[r][c] = clr;
                if (r % 2)
                {
                    c++;
                    if (c > w)
                    {
                        c = w;
                        r++;
                    }
                }
                else
                {
                    c--;
                    if (c == 0)
                    {
                        c = 1;
                        r++;
                    }
                }
                cnt--;
            }
            clr++;
        }
        for (int i = 1; i <= h; i++)
        {
            for (int j = 1; j <= w; j++)
            {
                if (j > 1) printf(" ");
                printf("%d", mp[i][j]);
            }
            printf("\n");
        }
    }
    return 0;
}

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

char rotate(char c,int n){
	int i = c - 'a';
	return 'a' + (i+n)%26;
}

int dist(char c){
	if(c == 'a')
		return 0;
	else
		return 26 - (c - 'a');
}

int 
main(){
	string s;
	int k;
	cin >> s >> k;
	for(unsigned int i = 0; i < s.length();i++){
		if(dist(s[i]) <= k){
			k-=dist(s[i]);
			s[i] = rotate(s[i],dist(s[i]));
		}
	}
	s[s.length()-1] = rotate(s[s.length()-1],k);
	cout << s << endl;
}



Measured memory_bytes: 512
#include <iostream>
#include <math.h>
#include <stack>

using namespace std;

int main()
{
    long long int n,y,z,temp,i;
    long double x;
    stack <int> s;
    cin>>n;
    temp=1;
    while(n>0)
    {
        n--;
        s.push(n%26);
        n/=26;
    }
    while(!s.empty())
    {
        cout<<char(s.top()+'a');
        s.pop();

    }
    cout<<"\n";
}


Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i=0; (i)<(n); ++(i))
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
const long long INF = 1LL<<60;
int main(){
    int a, b;  cin >> a >> b;
//    vector<int> v;
//    rep(i,n){
//        cin >> v[i];
//    }
    if((a+b)%2==1)cout << "IMPOSSIBLE";
    else cout << (a+b)/2;
    

    return 0;
}

Measured memory_bytes: 256
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.NoSuchElementException;

public class Main implements Runnable {
	public static void main(String[] args) {
		new Thread(null, new Main(), "", Runtime.getRuntime().maxMemory()).start();
	}

	public void run() {
		Scanner sc = new Scanner();
		int Q = sc.nextInt();
		long[] A = new long[Q];
		long[] B = new long[Q];
		for (int i = 0; i < Q; ++i) {
			A[i] = sc.nextLong();
			B[i] = sc.nextLong();
			if (A[i] > B[i]) {
				A[i] ^= B[i];
				B[i] ^= A[i];
				A[i] ^= B[i];
			}
			if (A[i] == B[i] || A[i] + 1 == B[i]) {
				System.out.println(2 * A[i] - 2);
				continue;
			}
			long prd = A[i] * B[i];
			long ok = 0, ng = Math.max(A[i], B[i]);
			while (ng - ok > 1) {
				long m = (ok + ng) / 2;
				if (m * m < prd) {
					ok = m;
				} else
					ng = m;
			}
			long x = ok;
			if (x * (x + 1) >= prd)
				System.out.println(2 * x - 2);
			else
				System.out.println(2 * x - 1);
		}

	}

	class Scanner {
		private final InputStream in = System.in;
		private final byte[] buffer = new byte[1024];
		private int ptr = 0;
		private int buflen = 0;

		private boolean hasNextByte() {
			if (ptr < buflen) {
				return true;
			} else {
				ptr = 0;
				try {
					buflen = in.read(buffer);
				} catch (IOException e) {
					e.printStackTrace();
				}
				if (buflen <= 0) {
					return false;
				}
			}
			return true;
		}

		private int readByte() {
			if (hasNextByte())
				return buffer[ptr++];
			else
				return -1;
		}

		private boolean isPrintableChar(int c) {
			return 33 <= c && c <= 126;
		}

		public boolean hasNext() {
			while (hasNextByte() && !isPrintableChar(buffer[ptr]))
				ptr++;
			return hasNextByte();
		}

		public String next() {
			if (!hasNext())
				throw new NoSuchElementException();
			StringBuilder sb = new StringBuilder();
			int b = readByte();
			while (isPrintableChar(b)) {
				sb.appendCodePoint(b);
				b = readByte();
			}
			return sb.toString();
		}

		public long nextLong() {
			if (!hasNext())
				throw new NoSuchElementException();
			long n = 0;
			boolean minus = false;
			int b = readByte();
			if (b == '-') {
				minus = true;
				b = readByte();
			}
			if (b < '0' || '9' < b) {
				throw new NumberFormatException();
			}
			while (true) {
				if ('0' <= b && b <= '9') {
					n *= 10;
					n += b - '0';
				} else if (b == -1 || !isPrintableChar(b)) {
					return minus ? -n : n;
				} else {
					throw new NumberFormatException();
				}
				b = readByte();
			}
		}

		public int nextInt() {
			long nl = nextLong();
			if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
				throw new NumberFormatException();
			return (int) nl;
		}

		public double nextDouble() {
			return Double.parseDouble(next());
		}

	}

	static void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}
}


Measured memory_bytes: 23252
import sys
sys.setrecursionlimit(10**9)
H, W = map(int, input().split())
S = [list(input()) for _ in range(H)]

cntblack, cntwhite = 0, 0
visited = [[False] * W for _ in range(H)]

def count(h, w):
    global cntblack, cntwhite
    if visited[h][w]: return
    visited[h][w] = True
    if S[h][w] == ".": cntwhite += 1
    else: cntblack += 1
    for ny, nx in ((1,0),(0,1),(-1,0),(0,-1)):
        ny += h
        nx += w
        if not (0 <= ny < H and 0 <= nx < W): continue
        if S[ny][nx] == S[h][w]: continue
        count(ny, nx)


ans = 0
for h in range(H):
    for w in range(W):
        cntblack, cntwhite = 0, 0
        count(h, w)
        ans += cntblack * cntwhite

print(ans)


Measured memory_bytes: 148680
#include <iostream>
#include <string>
#include <algorithm>
#include <ctime>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cassert>
#include <bitset>
#include <list>
#include <cstdio>
#include <stdio.h>
#include <string.h>
#define rep(i,m,n) for(ll i=m;i<n;i++)
#define rrep(i,n,m) for(ll i=n;i>=m;i--)
typedef long long ll;
using namespace std;

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

int main()
{
    int n;
    cin >> n;
    ll a[n];
    rep(i,0,n) cin >> a[i];
    ll forward[n];
    ll backward[n];
    forward[0] = a[0];
    backward[n-1] = a[n-1];
    rep(i,1,n-1)
    {
        forward[i] = gcd(forward[i-1], a[i]);
    }
    rrep(i,n-2,0)
    {
        backward[i] = gcd(backward[i+1], a[i]);
    }
    ll ans = max(backward[1], forward[n-2]);
    rep(i,1,n-1)
    {
        ans = max(ans, gcd(forward[i-1],backward[i+1]));
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 2560
#include<bits/stdc++.h>
#include<cstdio>
#define tara ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)

#define ll long long
#define lll __int128
#define ull unsigned long long
#define pii pair<int,int>
#define pll pair<long,long>
#define eb emplace_back
#define pb push_back
#define sc scanf
#define pf printf
#define endl '\n'
#define INF 1<<30
#define ll_INF 1LL<<62

const int maxx=1010 ;
using namespace std ;

struct node{
    int x, y ;
};


bool cmp(int a, int b ){
    return a>b ;
}

int main(){
    //tara ;
    int n ;
    string s="ACL" ;
    sc("%d",&n) ;

    for(int i=0 ; i<n ; i++)cout<<s ;
    cout<<endl ;

    return 0;

}


Measured memory_bytes: 3660
import math
n = int(input())
x = 1
y = 1
N = int(math.sqrt(n))
for i in range(N):
    if i == 0:
        X = n-i
        Y = 1
    if n % (i+1) == 0:
        x = i+1
        y = n // (i+1)
        if (X+Y) > (x+y):
            X = x
            Y = y
print(X + Y - 2)

Measured memory_bytes: 3188
#include <iostream>
#include <cmath>

using namespace std;

namespace Solver {

    int e;
    inline bool Read() {
        cin >> e;
        return e != 0;
    }

    inline void Work() {
        int m = 1e+8;
        for (int z = 0; z * z * z <= e; z++) {
            int r = e - z * z * z;
            int y = (int)sqrt(r);
            int x = r - y * y;
            m = min(m, x + y + z);
        }

        cout << m << endl;
    }

    inline void Solve() {
        while(Read()) Work();
    }
}

int main() {
    Solver::Solve();
}

Measured memory_bytes: 1160
#include <cstdio>
#include <algorithm>
using namespace std;
const int MAX_N = 50;
int main()
{
    int a[MAX_N];
    for (int i = 0; i < 3; i++)
    {
        scanf("%d", &a[i]);
    }
    sort(a, a + 3);
    printf("%d", a[0] + a[1]);
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int INF = 1e9;
const int MOD = 1e9 + 7;
 
int main()
{
  int n;
  cin >> n;
 
  vector<ll> a(n), b(n);
  for (int i = 0; i < n; ++i)
    cin >> a[i] >> b[i];
 
  vector<pair<ll, int>> c;
  ll t = 0, k = 0;
  for (int i = 0; i < n; ++i)
  {
    c.emplace_back(b[i] + a[i], i);
  }
  sort(c.rbegin(), c.rend());
 
  for (int i = 0; i < n; ++i)
  {
    if (i % 2 == 0)
    {
      t += a[c[i].second];
    }
    else
    {
      k += b[c[i].second];
    }
  }
 
  cout << t - k << endl;
 
  return 0;
}

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

using namespace std;
typedef long long ll;

#define FAST ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define mp make_pair
#define pb push_back
#define lp(i,s,f) for(ll i = s; i < ll(f); i++)
#define inF freopen("input.in", "r", stdin);
#define outF freopen("output.in", "w", stdout);
#define endl '\n'
#define MOD 1000000007
#define mm(arr) memset(arr, 0, sizeof(arr))
#define F first
#define S second

int main(){
    FAST
    int a, b; cin >> a >> b;
    cout << 6 - (a + b);
    return 0;
}


Measured memory_bytes: 3540
#include <cassert>

#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
// #include <boost/foreach.hpp>
// #include <boost/range/algorithm.hpp>
#define rep(i,j,k) for(int i=(int)j;i<(int)k;i++)
#define ll long long
#define Sort(v) sort(all(v))
//#define INF 1e9
#define LINF 1e18
#define END return 0
#define pb push_back
#define se second
#define fi first
#define pb push_back
#define all(v) (v).begin() , (v).end()
#define MP make_pair
#define int long long
using namespace std;
int day[12]={31,28,31,30,31,30,31,31,30,31,30,31};
// int dx[]={0,1,0,-1};
// int dy[]={1,0,-1,0};
//typedef pair<int,int> P;

const long long MOD=1000000007LL;
bool isupper(char c){if('A'<=c&&c<='Z')return 1;return 0;}
bool islower(char c){if('a'<=c&&c<='z')return 1;return 0;}
bool iskaibun(string s){for(int i=0;i<s.size()/2;i++)if(s[i]!=s[s.size()-i-1])return 0;return 1;}
bool isnumber(char c){return ('0'<=c&&c<='9');}
bool isalpha(char c){return (isupper(c)||islower(c));}
template<typename T> 
void print(vector<T> v){
    for(int i=0;i<v.size();i++){
        if(i)cout<<" ";
        cout<<v[i];
    }
    cout<<endl;
}
int INF=1e18;

template<typename T>
void printendl(vector<T> v){
    for(auto date:v)cout<<date<<endl;
}

template<typename T>
void printvv(vector<vector<T>> v){
    for(int i=0;i<v.size();i++){
        for(int j=0;j<v[i].size();j++){
            if(j)cout<<" ";
            cout<<v[i][j];
        }
        cout<<endl;
    }
}
int gcd(int a,int b){
    if(a<b)swap(a,b);
    if(b==0)return a;
    else return gcd(b,a%b);
}

struct Edge{
    int to,cost;
};

signed main (){
    int n;
    cin>>n;
    vector<int> v(n);
    for(int i=0;i<n;i++){
        cin>>v[i];
        v[0]=gcd(v[0],v[i]);
    }
    cout<<v[0]<<endl;

}


/*
*/

Measured memory_bytes: 1024
/*
        Choo Lo jo mujhe tum kabhi, kho na jaoon main raat din
    Nazaron mein tum ho basey
        Keh do jo tum ek baar, Mere ho bas tum mere
    Nazaron mein tum ho basey
*/
 
#include<bits/stdc++.h>
#include<cstdio>
 
#define deb(x) cout << #x << " -> " << x << el
#define db double
#define ll long long int
#define ull unsigned long long int
#define umap unordered_map
#define sc(x) scanf("%d", &x)
#define scl(x) scanf("%lld", &x)
#define sclu(x) scanf("%llu", &x)
#define scd(x) scanf("%lf", &x)
#define pass cout<<"pass\n"
#define vi vector<int>
#define pb push_back
#define vec vector
#define el "\n"
#define pii pair<int, int>
#define pll pair<long long, long long>
#define F first
#define S second
#define mp make_pair
#define mt make_tuple
#define umap unordered_map
#define f(i,x,y) for(int i=x;i<y;++i)
#define ff(i,x,y) for(int i=x;i<=y;++i)
#define mem(x) memset(x, 0, sizeof(x))
#define mems(x,y) memset(x, y, sizeof(x))
#define FIO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define ppi pair<int, pii>
#define mat vector<vector<ll> > 
#define mod 1000000007
#define MAX 100005
 
using namespace std;

const int INF = 1e9 + 5;

void solve() {
	int n;
	cin >> n;

	vec<db> heads(n + 1, 0.0);

	for(int coin = 1; coin <= n; ++coin) {
		db p; cin >> p;

		if(coin == 1) {
			heads[0] = 1.0 - p;
			heads[1] = p;
			continue;
		}

		vec<db> dp(n + 1, 0.0);

		for(int i = coin; i > 0; --i) {
			dp[i] = heads[i - 1] * p;
		}

		for(int i = 0; i < coin; ++i) {
			dp[i] += heads[i] * (1.0 - p);
		}

		ff(i,0,coin) {
			heads[i] = dp[i];
		}
	}
  
	db ans = 0.0;
	for(int i = n; i >= n / 2 + 1; --i) {
		ans += heads[i];
	}
	printf("%1.10lf\n", ans);
}


int main() {
    int ccc = 1;
    // sc(ccc);
    while(ccc--) {
        solve();
    }
 
    return 0;
}


Measured memory_bytes: 256
from heapq import heappush, heappop

INF = 10 ** 20

v_num, e_num, r = map(int, input().split())
edges_lst = [[] for _ in range(v_num)]
dist_lst = [INF for _ in range(v_num)]

for _ in range(e_num):
  s, t, dist = map(int, input().split())
  edges_lst[s].append((t, dist))

que = []
heappush(que, (0, r))
dist_lst[r] = 0

while que:
  dist, node = heappop(que)
  for to, cost in edges_lst[node]:
    if dist_lst[to] > cost + dist:
      dist_lst[to] = cost + dist
      heappush(que, (cost + dist, to))

for dist in dist_lst:
  if dist == INF:
    print("INF")
  else:
    print(dist)



Measured memory_bytes: 90300
#include<stdio.h>
#define N 250

int parent(int);
int left(int);
int right(int);


int main(){
  
  int A[N],id,H;
  scanf("%d",&H);
  for(id=1;id<=H;id++){
    scanf("%d",&A[id]);
  }
  
  for(id=1;id<=H;id++){
    printf("node %d: key = %d,",id,A[id]);
    if(id>1)
      printf(" parent key = %d,",A[parent(id)]);
    if(left(id)<=H)
      printf(" left key = %d,",A[left(id)]);
    if(right(id)<=H)
      printf(" right key = %d,",A[right(id)]);
    printf(" \n");
  }
  return 0;
}
int parent(int i){
  return i/2;
}
int left(int i){
  return 2*i;
}
int right(int i){
  return 2*i+1;
}

Measured memory_bytes: 608
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, a, b) for(int i = a; i < b; i++)
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  FastIO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
typedef long long ll;
using P = pair<int,int>;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }


int main(){
    string s;
    cin >> s;
    ll ans = 0;
    int i = 0;
    int cnt1 = 0;
    while(i < s.size()){
        if (s[i] == '<'){
            int j = i;
            cnt1 = 0;
            while(j < s.size()){
                if (s[j] == '>') break;
                ans += cnt1;
                cnt1++;
                j++;
            }
            if (j >= s.size()) ans += cnt1;
            i = j;
        }
        else{
            int j = i;
            int cnt2 = 0;
            while(j < s.size()){
                if (s[j] == '<') break;
                cnt2++;
                j++;
            }
            for(int k = cnt2; k > 0; k--) ans+=k;
            if (cnt1 > cnt2) ans += cnt1 - cnt2;
            i = j;
        }
    }
    cout << ans << endl;
    return 0;
}

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

using namespace std;

int main()
{
    int n,s=0;
    cin >> n;
    int arr[n];
    for(int i=0;i<n;i++)
        cin >> arr[i];
    for(int i=0;i<n;i++)
    {
        for(int j=i+1;j<n;j++)
            s+=arr[i]*arr[j];
    }
    cout << s;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include <list>
#include<stack>
#include<queue>
#include <vector>
#include <set>
#include <map>
#include<algorithm>
#include<math.h>
#include<stdlib.h>
#include<string.h>
#include"time.h"
using namespace std;

#define FOR(k,m,n) for(int (k)=(m);(k)<(n);(k)++)
#define REP(i,n) FOR((i),0,(n))
#define LL long long
#define CLR(a) memset((a),0,sizeof(a))
#define SZ(x) (int((x).size()))
#define dump(x)  cerr << #x << " = " << (x) << endl

//毎回変える場所
#define N_MAX 100


//問題文のとおり
int N,temp;
int ans = 0;
vector<int> L;

int main() {
	cin>>N;
	REP(i,2*N){
		cin >> temp;
		L.push_back(temp);
	}
	sort(L.begin(),L.end());

	for (int i = 0; i < 2*N; i += 2) {
		ans+=L[i];
	}
	cout<<ans<<endl;
	return 0;
}

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

#define REP(i,n)    for(int i = 0; i < (int)n; i++)
#define MAX_N   100000

int N;
pair<vector<int>, vector<long int> > G[MAX_N];
vector<int> d(MAX_N);
vector<int> color(MAX_N);

void input(){
    cin >> N;
    REP(i,N-1){
        int s, t, u;
        cin >> s >> t >> u;
        s--;
        t--;
        G[s].first.push_back(t);
        G[t].first.push_back(s);
        G[s].second.push_back(u);
        G[t].second.push_back(u);
    }
}

void dfs(int V, int iro){
    color[V] = iro;
    REP(i,G[V].first.size()){
        if(color[G[V].first[i]] >= 0)
            continue;
        else{
            d[G[V].first[i]] = d[V] + G[V].second[i];
            if(d[G[V].first[i]] % 2)
                dfs(G[V].first[i], 1);
            else
                dfs(G[V].first[i], 0);
        }
    }
}

void solve(){
    input();
    fill(color.begin(), color.end(), -1);
    dfs(0,0);
    REP(i,N)
        cout << color[i] << endl;
}

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


Measured memory_bytes: 14080
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N=sc.nextInt();
		String S=sc.next();
		int ans=0;
		S+="Z";

		for(int i=0;i<N;i++) {
			char c1= S.charAt(i);
			char c2=S.charAt(i+1);
			if(c1!=c2) {

				ans++;
			}
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 27948
import std.algorithm, std.conv, std.range, std.stdio, std.string;

void main()
{
  for (;;) {
    auto rd = readln.split.map!(to!int), h = rd[0], w = rd[1];
    if (h == 0 && w == 0) break;
    foreach (i; 0..h) {
      foreach (j; 0..w)
        write((i + j) % 2 == 0 ? '#' : '.');
      writeln;
    }
    writeln;
  }
}

Measured memory_bytes: 2480
#include <bits/stdc++.h>
using namespace std;
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n; cin >> n;
	string s, t; cin >> s >> t;
	for(int i = 0; i < n; i++){
		cout << s[i] << t[i];
	}
	cout << endl;
	return 0;
}


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

int main(void){
        int a,b;
        cin>>a;
        cin>>b;
        if(a>b){
            cout<<"a > b";
        }
        else if(a==b){
            cout<<"a == b";
        }
        else{
            cout<<"a < b";
        }
        cout<<endl;
}


Measured memory_bytes: 3100
(defn betweenAandB [[a b x]]
  (+ 
   (- (long (/ b x)) (long (/ a x)))
   (if (zero? (mod a x)) 1 0)))

(defn create-data [s]
  (map #(Long/parseLong %) (.split s " ")))

(println (betweenAandB (create-data (read-line))))

Measured memory_bytes: 67356
#include<stdio.h>

int main(){
    char s[500001];
    scanf("%s", s);
    int n = 0;
    while(s[n] != '\0'){
        n++;
    }
    int a[n+1];
    for(int i=0; i<=n; i++){
        a[i] = 0;
    }
    for(int i=1; i<=n; i++){
        if(s[i-1] == '<'){
            a[i] = a[i-1] + 1;
        }
    }
    for(int i=n-1; i>=0; i--){
        if(s[i] == '>'){
            if(a[i] < a[i+1] + 1){
                a[i] = a[i+1] + 1;
            }
        }
    }
    long long int ans = 0;
    for(int i=0; i<=n; i++){
        ans += a[i];
    }
    /*for(int i=0; i<=n; i++){
        printf("%d ", a[i]);
    }
    printf("\n");*/
    printf("%lld", ans);

    return 0;
}

Measured memory_bytes: 2560
#include<iostream>
using namespace std;
int main(){
long long n;
cin >>n;
long long c[n],s[n],f[n];
for(long long i=0;i<n-1;i++){
cin >> c[i]>>s[i]>>f[i];
}
for(long long i=0;i<n-1;i++){
long long ans=s[i];
ans=s[i]+c[i];
for(long long j=i+1;j<n-1;j++){
long long div=ans/f[j];
if((ans%f[j])!=0){
div=(div+1)*f[j];
}
else
div=div*f[j];
if(div>=s[j])
ans=div+c[j];
else
ans=s[j]+c[j];
}
cout <<ans<<endl;
}
cout << 0;
return 0;
}

Measured memory_bytes: 256
import java.util.*;
import java.io.*;

/**
 * C
 */
public class Main {

    void run() {
        
        Scanner sc = new Scanner(System.in);
        int q = Integer.parseInt(sc.nextLine());

        for(int i=0; i<q; i++) {
            System.out.println(ans(sc.nextLine(), sc.nextLine()));
        }

    }

    int ans(String x, String y) {
        
        int[][] DP = new int[x.length()+1][y.length()+1];

        for(int i=1; i<=x.length(); i++) {
            for(int j=1; j<=y.length(); j++) {
                
                DP[i][j] = Math.max(DP[i][j-1], DP[i-1][j]);

                if(x.charAt(i-1) == y.charAt(j-1)) {
                    DP[i][j] = Math.max(DP[i][j], DP[i-1][j-1]+1);
                }

            }
        }

        return DP[x.length()][y.length()];

    }

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

}


Measured memory_bytes: 64028
import java.util.Scanner;

public class Main {
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();

		System.out.println((M*(M-1)/2)+(N*(N-1)/2));

		sc.close();
	}
}

Measured memory_bytes: 21972
// ====================================
//   author: M_sea
//   website: https://m-sea-blog.com/
// ====================================
#include <bits/stdc++.h>
#define file(x) freopen(#x".in","r",stdin); freopen(#x".out","w",stdout)
#define debug(...) fprintf(stderr,__VA_ARGS__)
using namespace std;
typedef long long ll;

int read() {
	int X=0,w=1; char c=getchar();
	while (c<'0'||c>'9') { if (c=='-') w=-1; c=getchar(); }
	while (c>='0'&&c<='9') X=X*10+c-'0',c=getchar();
	return X*w;
}

const int N=1000+10,M=1000000+10;

int sx,sy,tx,ty,n;
struct circle { int x,y,r; } c[N];

double getdis(int x1,int y1,int x2,int y2) {
	return sqrt(1ll*(x1-x2)*(x1-x2)+1ll*(y1-y2)*(y1-y2));
}

struct edge { 
	int v; double w; int nxt;
	edge(int v_=0,double w_=0,int nxt_=0): v(v_),w(w_),nxt(nxt_) {}
} e[M<<1];
int head[N];
void addEdge(int u,int v,double w) {
	static int cnt=0;
	e[++cnt]=edge(v,w,head[u]),head[u]=cnt;
}

struct node { int u; double d; };
bool operator <(node a,node b) { return a.d>b.d; }
priority_queue<node> Q;
double dis[N];
double dijkstra() {
	memset(dis,127,sizeof(dis)); dis[0]=0; Q.push((node){0,0});
	while (!Q.empty()) {
		int u=Q.top().u; double d=Q.top().d; Q.pop();
		if (fabs(d-dis[u])>=1e-9) continue;
		for (int i=head[u];i;i=e[i].nxt) {
			int v=e[i].v; double w=e[i].w;
			if (dis[u]+w<dis[v])
				dis[v]=dis[u]+w,Q.push((node){v,dis[v]});
		}
	}
	return dis[n+1];
}

int main() {
	sx=read(),sy=read(),tx=read(),ty=read(),n=read();
	for (int i=1;i<=n;++i) c[i]=(circle){read(),read(),read()};
	c[0]=(circle){sx,sy,0},c[n+1]=(circle){tx,ty,0};
	for (int i=0;i<=n;++i)
		for (int j=i+1;j<=n+1;++j) {
			double w=max(0.0,getdis(c[i].x,c[i].y,c[j].x,c[j].y)-c[i].r-c[j].r);
			addEdge(i,j,w),addEdge(j,i,w);
		}
	printf("%.10lf\n",dijkstra());
	return 0;
}

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

struct Fast {Fast(){std::cin.tie(0);ios::sync_with_stdio(false);}} fast;

/* cpp template {{{ */

/* short */
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define X real()
#define Y imag()

/* REPmacro */
#define REPS(i, a, n) for (ll i = (a); i < (ll)(n); ++i)
#define rep(i, n) REPS(i, 0, n)
#define REP0(i,n) for (ll i = 0; i <= (ll)(n); ++i)
#define REP1(i,n) for (ll i = 1; i <= (ll)(n); ++i)
#define RREP(i, n) REPS(i, 1, n + 1)
#define DEPS(i, a, n) for (ll i = (a); i >= (ll)(n); --i)
#define DEP(i, n) DEPS(i, n, 0)
#define EACH(i, n) for (auto&& i : n)

/* debug */
#define debug(x) cerr << x << " " << "(L:" << __LINE__ << ")" << '\n';

/* alias */
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using pii = pair<int, int>;
using D = double;
using P = complex<D>;
using vs = vector<string>;
template <typename T> using PQ = priority_queue<T>;
template <typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

/* const */
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;
const D EPS = 1e-9;
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};

/* func */
inline bool inside(int y, int x, int H, int W) {return y >= 0 && x >= 0 && y < H && x < W;}
inline int in() {int x; cin >> x; return x;}
inline ll IN() {ll x; cin >> x; return x;}
inline vs split(const string& t, char c) {vs v; stringstream s(t); string b; while(getline(s, b, c)) v.eb(b); return v;}
template <typename T> inline bool chmin(T& a, const T& b) {if (a > b) a = b; return a > b;}
template <typename T> inline bool chmax(T& a, const T& b) {if (a < b) a = b; return a < b;}
template <typename T, typename S> inline void print(const pair<T, S>& p) {cout << p.first << " " << p.second << endl;}
template <typename T> inline void print(const T& x) {cout << x << '\n';}
template <typename T, typename S> inline void print(const vector<pair<T, S>>& v) {for (auto&& p : v) print(p);}
template <typename T> inline void print(const vector<T>& v, string s = " ") {rep(i, v.size()) cout << v[i] << (i != (ll)v.size() - 1 ? s : "\n");}

signed main() 
{
  int h,w; cin>>h>>w;
  rep(i,h)
  {
    string tmp; cin>>tmp;
    print(tmp);
    print(tmp);
  }


  return 0;
}

Measured memory_bytes: 256
#include<string>
#include<iostream>
#include<algorithm>
using namespace std;
int A[6000];
int B[6000];
int main()
{
	int a,b;
	cin >> a >> b;
	for (int i = 0; i < a; i++)
	{
		cin >> A[i];
	}
	for (int i = 0; i < b; i++)
	{
		cin >> B[i];
	}

	int kotae = 0;
	for (int i = 0; i < b; i++)
	{
		int ans = 0;
		int now = 0;
		int k = i;
		while (now<a)
		{
			if (B[k] == A[now])
			{
				ans++;
				k++;
			}
			now++;
		}
		kotae = max(kotae, ans);
	}
	cout << kotae << endl;

}

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

typedef long long int ll;
typedef long double ld;

ll lucas(ll n) {
    if(n == 0) return 2;
    if(n == 1) return 1;
    return lucas(n-1)+lucas(n-2);
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    ll n;
    cin >> n;
    if(n < 30) {
        cout << lucas(n) << endl;
    }
   else {
        ld phi = (ld(1)+sqrt(ld(5)))/(ld(2));

        ld ans = 1;
        for(int i=0; i < n; i++) {
            ans *= phi;
        }

        cout << ll(floor(ans+0.5)) << endl;
   }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#ifndef ONLINE_JUDGE
#define dbg(x...) do { cout << "\033[32;1m " << #x << " -> "; err(x); } while (0)
void err() { cout << "\033[39;0m" << endl; }
template<template<typename...> class T, typename t, typename... A>
void err(T<t> a, A... x) { for (auto v: a) cout << v << ' '; err(x...); }
template<typename T, typename... A>
void err(T a, A... x) { cout << a << ' '; err(x...); }
#else
#define dbg(...)
#endif
typedef long long ll;
typedef pair<int,int> pi;
typedef vector<int> vi;
template<class T> using vc=vector<T>;
template<class T> using vvc=vc<vc<T>>;
template<class T> void mkuni(vector<T>&v)
{
    sort(v.begin(),v.end());
    v.erase(unique(v.begin(),v.end()),v.end());
}
template<class T>
void print(T x,int suc=1)
{
    cout<<x;
    if(suc==1) cout<<'\n';
    else cout<<' ';
}
template<class T>
void print(const vector<T>&v,int suc=1)
{
    for(int i=0;i<v.size();i++)
    print(v[i],i==(int)(v.size())-1?suc:2);
}
const int maxn=1e5+7;
vi G[maxn];
int sz[maxn];
int dep[maxn];
pi dfs(int u,int fa=-1)
{
    pi ret={0,u};
    sz[u]=1;
    for(auto v:G[u])if(v!=fa)
    {
        dep[v]=dep[u]+1;
        pi cur=dfs(v,u);
        sz[u]+=sz[v];
        cur.first++;
        ret=max(ret,cur);
    }
    return ret;
}
int a,b;
bool ok=1;
bool onpath[maxn];
void check(int u,int d,int fa=-1)
{
    if(dep[u]+d!=dep[b]&&G[u].size()!=1)
    {
        ok=0;
        return;
    }
    if(dep[u]+d==dep[b]) onpath[u]=1;
    for(auto v:G[u])if(v!=fa)
        check(v,d+1,u);
}
vi ans[2];
void getans(int u,int id,int tp,int fa=-1)
{
    int son=G[u].size();
    son--;
    if(u!=a&&u!=b) son--;
    int curid=id;
    id++;
    //dbg(u,son);
    while(son--)
    {
        ans[tp].push_back(id);
        id++;
    }
    ans[tp].push_back(curid);
    for(auto v:G[u])if(v!=fa&&onpath[v])
        getans(v,id,tp,u);
}
int main()
{
    int n;
    cin>>n;
    for(int i=1,u,v;i<n;i++)
    {
        cin>>u>>v;
        G[u].push_back(v);
        G[v].push_back(u);
    }
    auto c=dfs(1);
    a=c.second;
    dep[a]=0;
    b=dfs(a).second;
    check(b,0);
    //dbg(a,b);
    if(!ok) print(-1);
    else{
        getans(a,1,0);
        getans(b,1,1);
        print(min(ans[0],ans[1]));
    }
}

Measured memory_bytes: 19064
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using Library;
using static Library.Input;

namespace AtCoderTemplate
{
    class ProgramB
    {
        static void Main()
        {
            int a = NextInt, b = NextInt;

            int tmp = 1, count = 0;
            while (tmp < b)
            {
                tmp = tmp - 1 + a;
                count++;
            }

            System.Console.WriteLine(count);
        }
    }
}

namespace Library
{
    class Input
    {
        static IEnumerator<string> enumerator = new string[] { }.AsEnumerable().GetEnumerator();

        public static string Line => Console.ReadLine();

        public static string[] StrArr => Line.Split(' ');

        public static int NextInt => int.Parse(NextWord());

        public static long NextLong => long.Parse(NextWord());

        public static List<int> IntList => StrArr.Select(int.Parse).ToList();

        public static List<long> LongList => StrArr.Select(long.Parse).ToList();

        public static IEnumerable<long[]> TakeLine(int N)
        {
            return Enumerable.Repeat(0, N).Select(_ => Console.ReadLine().Split(' ').Select(long.Parse).ToArray());
        }

        public static string NextWord()
        {
            while (!enumerator.MoveNext())
            {
                enumerator = StrArr.AsEnumerable().GetEnumerator();
            }
            return enumerator.Current;
        }
    }
}


Measured memory_bytes: 13268
#include <iostream>
using namespace std;
typedef long long ll;
const int mod = 1e9 + 7;
int a[21][21], dp[1 << 21][21] = {}, n; 
bool visited[1 << 21][21] = {};

int solve(int j, int i)
{
	if (visited[j][i]) return dp[j][i];
	visited[j][i] = 1;
	
	if (i == 0)
	{
		for (int k = 0; k < n; k++)
			if ((j & (1 << k)) && a[0][k])
				dp[j][0]++;
		return dp[j][0];
	}
	
	for (int k = 0; k < n; k++)
		if ((j & (1 << k)) && a[i][k])
			dp[j][i] = (solve((j ^ (1 << k)), i - 1) + dp[j][i]) % mod;
			
	return dp[j][i];
}

int main() 
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cin >> n;
	
	for (int i = 0; i < n; i++)
		for (int j = 0; j < n; j++)
			cin >> a[i][j];
	
	cout << solve((1 << n) - 1, n - 1);
}

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

int main(){
  vector<pair<int, int>> P(3);
  int A, B;
  for(int i=0; i<3; i++){
    cin >> A >> B;
    if(A>B){
      P.at(i)=make_pair(B, A);
    }
    else{
      P.at(i)=make_pair(A, B);
    }
  }
  sort(P.begin(), P.end());
  int Now=1;
  if(P.at(0).first!=1){
    cout << "NO" << endl;
  }
  else if(P.at(0).second==2){
    if(P.at(1).first==2 && (P.at(1).second==3 || P.at(1).second==4) && P.at(2).first==3 && P.at(2).second==4){
      cout << "YES" << endl;
    }
    else{
      cout << "NO" << endl;
    }
  }
  else if(P.at(0).second==3){
    if(P.at(1).first==2 && ((P.at(1).second==3 && P.at(2).first==2 && P.at(2).second==4) || P.at(1).second==4)){
      cout << "YES" << endl;
    }
    else{
      cout << "NO" << endl;
    }
  }
  else{
    if(P.at(1).second!=4){
      cout << "YES" << endl;
    }
    else{
      cout << "NO" << endl;
    }
  } 
}

Measured memory_bytes: 256
using System;
class p
{
  static void Main()
  {
    int N = int.Parse(Console.ReadLine());
    string[] input = Console.ReadLine().Split(' ');
    int[] arr = new int[N];
    for (int i = 0; i < N; i++) {
      arr[i] = int.Parse(input[i]);
    }
    
    int moveMax = 0, move = 0;
    for (int i = 0; i < N - 1; i++) {
      if (arr[i + 1] <= arr[i]) {
        move++;
      } else {
        moveMax = Math.Max(moveMax, move);
        move = 0;
      }
    }
    Console.WriteLine(Math.Max(moveMax, move));
  }
}


Measured memory_bytes: 25052
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
  ll a,b,c,d;
  cin>>a>>b>>c>>d;
  ll ans = a*d;
  ans = max(ans,a*c);
  ans = max(ans,b*c);
  ans = max(ans,b*d);
  cout<<ans<<endl;
}


Measured memory_bytes: 3608
using System;

namespace MyProgram{
    class AtCoder{
        static void Main(string[] args){
            long N = long.Parse(Console.ReadLine());
            for(int i=(int)Math.Sqrt((double)N);i>0;i--){
                if(N%i==0){
                    Console.WriteLine(N/i+i-2);
                    break;
                }
            }
        }
    }
}

Measured memory_bytes: 13140
#include<stdio.h>
int main(){
  
  int a,b,c;
  
  for(a=1;a<=9;a++){
    for(b=1;b<=9;b++){
      c=a*b;
      printf("%dx%d=%d\n",a,b,c);
    }
  }

  return 0;
}

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

using namespace std;

#define rep(i, n) for(int i = 0; i < (n); ++i)
#define eee(a) (cerr << (#a) << ": " << (a) << endl);
#define ppp(a) (cout << (a) << endl);
#define cop(a) for(auto x:(a)){cout << x << endl;}


using ll = long long;
using pint = pair<int, int>;
using pll = pair<ll, ll>;
using mint = map<int, int>;

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

constexpr char sp = ' ';
constexpr char cmm = ',';
constexpr int MOD = 1e9+7;
constexpr int INF = 1e9;
constexpr ll LINF = 1e18;

ll mod(ll a, ll b){return (a%b+b)%b;}
ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b){return a*b/gcd(a,b);}
void Yes(){cout << "Yes" << endl;}
void No(){cout << "No" << endl;}
void Judge(bool b){b?Yes():No();}
void YES(){cout << "YES" << endl;}
void NO(){cout << "NO" << endl;}
void JUDGE(bool b){b?YES():NO();}
ll powmod(ll b, ll e){ll r=1;while(e>0){if(e&1)r=(r%MOD)*(b%MOD)%MOD;b=(b%MOD)*(b%MOD)%MOD;e>>=1;}return r;}
double distance(ll x1, ll y1, ll x2, ll y2){return sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));}

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; }
template<typename T1, typename T2> ostream& operator<<(ostream& s, const pair<T1, T2>& p) {return s << "(" << p.first << ", " << p.second << ")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
    int len = v.size();
    s << '[';
    for (int i = 0; i < len; ++i) {
        s << v[i]; if (i < len-1) s << ", ";
    }
    s << ']';
    return s;
}

struct aaa{
    aaa(){
        // comment this out when you use scanf or printf
        // cin.tie(0); ios::sync_with_stdio(0);
        cout<<fixed<<setprecision(15);
    };
}fastio;

int main(){

    string s;
    cin >> s;
    
    for(int i = 0; i < s.size(); ++i){
        if(i%2){
            if(s[i] == 'R'){
                No();
                return 0;
            }
        }
        else{
            if(s[i] == 'L'){
                No();
                return 0;
            }
        }
    }
    Yes();


    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define mp make_pair
#define print(a) cout<<"print\n";for(pii i:a) cout<<i.first<<" "<<i.second<<"\n"
using namespace std;
typedef pair<int,int> pii;	
typedef long long ll;
pii p[300001];
int X[300001];
int Y[300001];
int main()
{

	int h,w,m;
	while(cin>>h>>w>>m)
	{
		memset(X,0,sizeof(X));
		memset(Y,0,sizeof(Y));
		int maxX=0,maxY=0;
	//	set<pii> v;
	//	set<pii> v2;
		for(int i=0;i<m;i++)
		{
			cin>>p[i].first>>p[i].second;
			//m[p]=1;
			int y=++Y[p[i].first];
			int x=++X[p[i].second];
			maxX=max(x,maxX);
			maxY=max(y,maxY);
		}
		int r=1;
		unordered_map<int,bool> m1,m2;
		ll count=0;
		ll xcount=0,ycount=0;
		for(int i=1;i<=h;i++)
		{
			if(Y[i]==maxY) 
			{
				m1[i]=1;
				ycount++;
			//	cout<<i<<":y\n";
			}
 		}
 		for(int i=1;i<=w;i++)
 		{
 			if(X[i]==maxX)
 			{
 				m2[i]=1;
 				xcount++;
 			//	cout<<i<<":x"<<"\n";
			}
		}
	//	int r=1;
		for(int i=0;i<m;i++)
		{
			int k=m1[p[i].first]+m2[p[i].second];
			if(k==2) {count++;
			}
		}
		
		cout<<maxX+maxY-bool(xcount*ycount==count)<<"\n";
		//pii p[m];
		
	}
}

Measured memory_bytes: 35432
def solve(h, w, S):
    A = [[s == '#' for s in l] for l in S]
    for y in range(h):
        for x in range(w):
            if A[y][x] and \
                (y == 0 or not A[y - 1][x]) and (y == h - 1 or not A[y + 1][x]) and \
                (x == 0 or not A[y][x - 1]) and (x == w - 1 or not A[y][x + 1]):
                return 'No'
    return 'Yes'

_h, _w = map(int, input().split())
_S = [input() for _ in range(_h)]
print(solve(_h, _w, _S))

Measured memory_bytes: 3064
#include <iostream>
using namespace std;
int a[10];
int main() {
	string s;
	cin >> s;
	a[1] = 'R';
	a[2] = 'L';
	a[3] = 'U';
	a[4] = 'U';
	a[5] = 'D';
	a[6] = 'D';
	cin >> s;
	int cd = s.size();
	s = '0' + s;
	for (int i = 1 ; i <= cd ; i++)
	{
		if (i % 2 == 1)
		{
			int have = (i - 1) / 2 + 1;
			int g = have % 3;
			if (g == 0) g = 5;
			if (g == 1) g = 1;
			if (g == 2) g = 3;
			if (a[1] != s[i] && a[3] != s[i] && a[5] != s[i])
			{
				cout <<"No";
				exit(0);
			}
		}
		if (i % 2 == 0)
		{
			int have = (i - 1) / 2 + 1;
			int g = have % 3;
			if (g == 1) g = 2;
			if (g == 2) g = 4;
			if (g == 0) g = 6;
			if (a[2] != s[i] && a[4] != s[i] && a[6] != s[i])
			{
				cout <<"No";
				exit(0);
			}
		}
	}
	cout <<"Yes"<<endl;
}

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


Measured memory_bytes: 2036
n = int(input())
l = list(map(int,input().split()))

count = 0
dec = 0

is_reverse = True
while is_reverse:
    is_reverse = False
    
    for i in range(n-1-dec):
        if l[i] > l[i+1]:
            l[i] , l[i+1] = l[i+1], l[i]
            is_reverse = True
            count += 1
    
    dec += 1

print(' '.join(map(str,l)))
print(count)


Measured memory_bytes: 5600