akhauriyash/Code-Regression huggingface dataset:
//#define NDEBUG
#define _CRT_SECURE_NO_WARNINGS
#include <cstddef>
#include <cstdint>

template <class T> const T &as_const(const T &v) noexcept { return v; }
class rep {
	const ::std::size_t f, l;

public:
	using value_type = ::std::size_t;
	using reference = value_type;
	class repitr {
		friend rep;
		value_type i;
		repitr(value_type x) noexcept : i(x) {}

	public:
		void operator++() noexcept { ++i; }
		reference operator*() const noexcept { return i; }
		bool operator!=(const repitr x) const noexcept { return i != x.i; }
	};
	explicit rep(value_type first, value_type last) noexcept
		: f(first), l(last) {}
	repitr begin() const noexcept { return repitr(f); }
	repitr end() const noexcept { return repitr(l); }
};
template <class T> bool maxi(T &a, const T &b) {
	return a <= b ? (a = b, 1) : 0;
}
template <class T> bool mini(T &a, const T &b) {
	return b <= a ? (a = b, 1) : 0;
}
template <class T> bool smaxi(T &a, const T &b) {
	return b <= a ? 0 : (a = b, 1);
}
template <class T> bool smini(T &a, const T &b) {
	return a <= b ? 0 : (a = b, 1);
}

using i32 = ::std::int_least32_t;
using i64 = ::std::int_least64_t;
using u32 = ::std::uint_least32_t;
using u64 = ::std::uint_least64_t;

#include <algorithm>
#include <iostream>
#include <utility>
#include <vector>
#include <string>

template <class T> using vec_alias = ::std::vector<T>;

#include <utility>

template <class T> T gcd(T m, T n) {
	while (m %= n)
		::std::swap(m, n);
	return n;
}


int main() {
	u32 n;
	::std::cin >> n;
	vec_alias<u32> x(n + 1);
	for (auto &e : x)
		::std::cin >> e;
	::std::sort(x.rbegin(), x.rend());
	x.erase(::std::unique(x.begin(), x.end()), x.end());
	for (const auto i : rep(0, n))
		x[i] -= x[i + 1];
	x.pop_back();
	u32 a = x.front();
	for (const auto i : rep(1, x.size()))
		a = gcd(a, x[i]);
	::std::cout << a << ::std::endl;
	return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <algorithm>
#include <iomanip>
#include <math.h>
#include <string.h>
using namespace std; using ll = long long; using pll = pair<ll, ll>;
using vl = vector<ll>; using vll = vector<vl>; using vpll = vector<pll>;
int ctoi(char c) {
	switch (c) {
	case '0': return 0; case '1': return 1; case '2': return 2;
	case '3': return 3; case '4': return 4; case '5': return 5;
	case '6': return 6; case '7': return 7; case '8': return 8;
	case '9': return 9;  default: return 0;
	}
}
bool pairCompare(const pll firstElof, pll secondElof)
{
	return firstElof.first > secondElof.first;
}
ll nod(ll F) { return log10(F) + 1; }
//**定義場所**//
//gcd, isPrime, eratos, modinv, bitSearch, dfs, bfs, dijkstra, UnionFind//
ll i, j, k, l, m, n; ll N, M, K, H, W, L; string S;
ll MOD = 1000000007; ll ans = 0; ll INF = 9999999999999;
vl flag, color; vll path;
//***********//

int main() {
	ll A;
	cin >> H >> A;
	if (H % A ==0) {
		cout << H / A;
	}
	else {
		cout << H / A + 1;
	}
}


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

int main( void )
{
  int H, W;
  cin >> H >> W;
  vector<string> S( H );
 
  for( int i = 0; i < H; i++ )
    cin >> S.at( i );

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

  for( int i = 0; i < H; i++ ) {
    for( int j = 0; j < W; j++ ) {
      if( S.at( i ).at( j ) == '.' ) {
	int num = 0;
	for( int d = 0; d < 8; d++ ) {
	  int ni = i + dx[ d ];
	  int nj = j + dy[ d ];
	  if( ni < 0 || ni >= H )
	    continue;
	  if( nj < 0 || nj >= W )
	    continue;
	  if( S.at( ni ).at( nj ) == '#' )
	    num++;
	}
	S.at( i ).at( j ) = num + '0';
      }
    }
  }

  for( int i = 0; i < H; i++ )
    cout << S.at( i ) << endl;
}

Measured memory_bytes: 3624
#include "bits/stdc++.h"
#define long int64_t
using namespace std;

struct Solver {
	static const long mod = 1000000007;
	
	long powmod( long x, long y ) {
		long r = 1;
		while( y-- > 0 ) { r = r*x % mod; }
		return r;
	}

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

		long ans = powmod( 10, N );
		ans -= powmod( 9, N );
		ans -= powmod( 9, N );
		ans += powmod( 8, N );
		ans = (ans % mod + mod) % mod;

		cout << ans << endl;
	}
};

int main() {
	ios::sync_with_stdio( false );
	cout << fixed << setprecision( 10 );
	Solver().solve();
	return 0;
}


Measured memory_bytes: 3636
import sys
from functools import reduce
X, Y = map(int, input().split())
mod = 10**9 + 7

if (X+Y)%3 != 0:
    print(0)
    sys.exit()

if 2 * min(X, Y) < max(X, Y):
    print(0)
    sys.exit()

def f(n, A):
    bunsi = reduce(lambda x, y: x*y%mod, range(n, n-A, -1))
    bunbo = reduce(lambda x, y: x*y%mod, range(1, A+1))
    return bunsi * pow(bunbo, mod-2, mod) % mod

ans = 0
r, d = 0, 0
if X == Y:
    r, d = X//3, Y//3
    ans = f(r+d, d)%mod
else:
    r = abs(X-Y) + ((X+Y) - 3*abs(X-Y))//6
    d = ((X+Y) - 3*abs(X-Y))//6
    if d == 0:
        print(1)
        sys.exit()
    ans = f(r+d, d)%mod

print(ans)

Measured memory_bytes: 3572
/* ex4_1
   takafumi_ueki */
#include <stdio.h>
#include <math.h>
int main(void){
    double tree_num,watch_num,tree_range;
    int count;
    //tree_num(木の本数)とwatch_num(監視員の数)を受け取る
    scanf("%lf %lf",&tree_num,&watch_num);
    //監視員が見れる木の本数を計算する
    tree_range = 2*watch_num + 1;
    //「全ての木の本数」を「監視員が見れる木の本数」で割り、割り切れない場合は一人追加する
    count = ceil(tree_num/tree_range);
    printf("%d\n",count);
    return 0;
}


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

typedef long long ll;
typedef unsigned long long ull;
typedef unsigned __int128 HASH;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef pair<ull, ull> pullull;
typedef pair<ll,int> plli;
typedef pair<double, int> pdbi;
typedef pair<int,pii> pipii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<pii> vpii;
typedef vector<vector<int>> mat;

#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n);i>0;i--)
#define rrep2(i,a,b) for (int i=(a);i>b;i--)
#define pb push_back
#define fi first
#define se second
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()

const ll hmod1 = 999999937;
const ll hmod2 = 1000000000 + 9;
const ll INF = 1<<30;
const ll mod = 1000000000 + 7;
const int dx4[4] = {1, 0, -1, 0};
const int dy4[4] = {0, 1, 0, -1};
const int dx8[8] = {1, 1, 1, 0, 0, -1, -1, -1};
const int dy8[8] = {0, 1, -1, 1, -1, 0, 1, -1};
const double pi = 3.141592653589793;

//#define int long long
#define addm(X, Y) (X) = ((X) + ((Y) % mod) + mod) % mod


struct edge {
    int to, cap, rev;
    edge (int to, int cap, int rev) : to(to), cap(cap), rev(rev) {}
};


void add_edge(int from, int to, int cap, vector<vector<edge>>& G) {
    G[from].emplace_back(to, cap, G[to].size());
    G[to].emplace_back(from, 0, G[from].size() - 1);
}

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

int max_flow(int s, int t, vector<bool>& used, vector<vector<edge>>& G) {
    int flow = 0;
    for(;;) {
        fill(used.begin(), used.end(), false);
        int f = dfs(s, t, INT_MAX, used, G);
        if (f == 0) return flow;
        flow += f;
    }
    return flow;
}


signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int v, e;
    cin >> v >> e;
    vector<vector<edge>> G(v);
    vector<bool> used(v);
    rep(i, e) {
        int u, v, c;
        cin >> u >> v >> c;
        add_edge(u, v, c, G);
    }
    cout << max_flow(0, v - 1, used, G) << endl;
}

Measured memory_bytes: 3208
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;
const double PI = 3.141592653589793238;
const double EPS = 1e-10;

int main() {
	int N;
	cin >> N;
	ll ans = 1;
	for (int i = 2; i <= N; i++) {
		int p = i;
		bool prime = 1;
		for (int j = 2; j*j <= p; j++) {
			if (p%j == 0) {
				prime = 0;
				break;
			}
		}
		if (!prime) continue;
		int x = N;
		int sum = 0;
		while (x) {
			sum += x / p;
			x /= p;
		}
		(ans *= (sum + 1)) %= MOD;
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
_ = input()
a_list = list(map(int, input().split()))

can_devide = sum([a%2 for a in a_list])==0
count = 0
while can_devide:
    count += 1
    for i, a in enumerate(a_list):
        a_list[i] = a//2
        
    can_devide = sum([a%2 for a in a_list])==0

print(count)


Measured memory_bytes: 2940
#include<iostream>
using namespace std;
int main() {
	int a, b, ans;
    cin>>a>>b;
	if ((a + b) % 2 == 0)
		cout << (a + b) / 2 << endl;
	else
		cout << (a + b) / 2 + 1 << endl;
	return 0;
}

Measured memory_bytes: 256
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#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>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// 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>

#if __cplusplus >= 201103L
#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>
#endif




#define int long long
#define rng(i,l,r) for(size_t i=(l);i<(r);++i)
#define rep(i,n) rng(i,0,n)
#define gnr(i,l,r) for(size_t i=(r)-1;i>=(l);i--)
#define per(i,b) gnr(i,0,b)
#define ALL(obj) (obj).begin(), (obj).end()   //1,2,3,...
#define rALL(obj) (obj).rbegin(), (obj).rend()//...,3,2,1

using namespace std;


//constant
const int MOD = 1e9+7;
const int INF = 1e18;
const int dx4[4] = {1, 0, -1, 0};
const int dy4[4] = {0, 1, 0, -1};
const int dx8[8] = {1,1,0,-1,-1,-1,0,1};
const int dy8[8] = {0,1,1,1,0,-1,-1,-1};
const double pi = acos(-1);


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

int gcd(int a,int b){return b?gcd(b,a%b):a;}
//*max_element(ALL(vector))
//count(ALL(vector),num) -> n
//memset(obj,value,sizeof(obj));




void solve(){
    
    // remove the bottom 3 lines when you submit this code.
    std::ifstream in("sample.txt");
    std::cin.rdbuf(in.rdbuf());

    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n; cin >> n;
    int count = 0;
    vector<int> A(n);
    rep(i,n){
        int a; cin >> a;
        if(a<0){
            count++;
            a = -a;
        }
        A[i] = a;
    }
    int ans = 0;
    if(count%2){
        rep(i,n) ans += A[i];
        sort(ALL(A));
        ans -= 2*A[0];
    }else{
        rep(i,n) ans += A[i];
    }
    
    cout << ans << endl;
    
    
    
    
}





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




Measured memory_bytes: 1024
from collections import Counter
n = int(input())
a_L = list(map(int,input().split()))
a_L = Counter(a_L)
dic = {}

for i,v in a_L.items():
    dic[i] = v
for i in range(n):
    try:
        print(dic[i+1])
    except:
        print(0)


Measured memory_bytes: 46704
#include "bits/stdc++.h"
using namespace std;
using ll = long long;

int main()
{
    std::cin.sync_with_stdio(false);
    std::cin.tie(0);
    int n;
    cin >> n;
    int i=1;
    while (i<=n&&i<10)
    {
        cout << i << "\n";
        i++;
    }
    ll m=9;
    ll x=10;
    while (i<=n)
    {
        m+=x;
        cout << m << "\n";
        ll k=m+x;
        ll y=0;
        while (k>0)
        {
            y+=k%10;
            k/=10;
        }
        ll a=m+x*10;
        ll b=0;
        while (a>0)
        {
            b+=a%10;
            a/=10;
        }
        if ((m+x*10)*y<=(m+x)*b)
        {
            x*=10;
        }
        i++;
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
using namespace std;
signed main() {
    int x;
    cin >> x;
    if(x < 7)
    cout << 1 << endl;
    else if(x >= 7 && x <= 11)
    cout << 2 << endl;
    else
    {
        cout << x / 11 * 2 + (x % 11 < 7 ? x % 11 == 0 ? 0 : 1 : 2) << endl;
    }
    
    
}

Measured memory_bytes: 256
N = int(input())
z = []
zz = []
for _ in range(N):
    x, y = map(int, input().split())
    zz.append(x-y)
    z.append(x+y)
z.sort()
zz.sort()
ans = z[-1]-z[0]
ans = max(ans, zz[-1]-zz[0])

print(ans)

Measured memory_bytes: 99756
/**
     **author : _KMS_
     **created : 07-03-2020
**/
#include<bits/stdc++.h>
using namespace std;
const long long M =1e6,MOD=2e9;
typedef long long ll;
bool prime[M+100];
int dp[M];
void precal()
{
      prime[0]=prime[1]=1;
      for(int i=2;i*i<M;i++)
      {
            if(!prime[i])
            {
                  for(int j=i*i;j<M;j+=i)
                  {
                        prime[j]=1;
                  }
            }
      }
      int cnt=0;
      for(int i=3;i<=100000;i++)
      {
            if(!prime[i]&&!prime[(i+1)/2])cnt++;
            dp[i]=cnt;
      }
}
int main() {
      
   ios::sync_with_stdio(false);
   cin.tie(0);
   precal();
   int q;
   cin>>q;
   while(q--)
   {
         int l,r;
         cin>>l>>r;
         cout<<dp[r]-dp[l-1]<<"\n";
   }
  
   return 0;
}


Measured memory_bytes: 3840
while True:
    line = list(map(int,input().split()))
    if line[0]==0&line[1]==0:
        break
    for i in range(line[0]):
        for j in range(line[1]):
            if (i+j)%2 ==0:
                print("#",end="")
            else:
                print(".",end="")
        print()
    print()


Measured memory_bytes: 7004
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include <limits>
#include <iomanip>

using namespace std;

int main(){
	int a,b;
	
	cin >> a >> b;
	
	if(a > b)swap(a,b);
	
	for(int i=0;i<b;i++){
		cout << a;
	}
	
	cout << endl;
		
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define mo 1000000007
#define ll long long
using namespace std;
struct Po{int x,y;}a[610];
int n,k,c[610];
ll p[610],an[610][610],ansn;
bool be(int x,int y,int z){
	if (x<=y&&(z<x||z>y))return false;
	if (x>y&&y<z&&z<x)return false;
	return true;
}
int co(int x){if (x<=0) x+=n*2;if (x>n*2)x-=n*2;return x;}
int coc(int l,int r){
	if (l<=r) return c[r]-c[l-1];
	return c[r]+c[n*2]-c[l-1];
}
int main(){
	scanf("%d %d",&n,&k);
	for (int i=1;i<=n*2;i++)c[i]=1;
	for (int i=1;i<=k;i++){cin>>a[i].x>>a[i].y;c[a[i].x]=c[a[i].y]=0;}
	for (int i=1;i<=n*2;i++) c[i]+=c[i-1];
	p[0]=1; 
	for (int i=1;i<=n*2;i++)if(i%2==1)p[i]=0;else p[i]=p[i-2]*(i-1)%mo;
	for (int i=1;i<=n*2;i++){
		for (int j=i+1;j<=n*2;j+=2){
			bool c=true;
			for (int l=1;l<=k;l++)if ((be(i,j,a[l].x)^be(i,j,a[l].y))==1)c=false;
			if (c)an[i][j]=p[coc(i,j)]%mo;
		}
	}
	for (int i=1;i<=n*2;i++)
		for (int j=i+1;j<=n*2;j+=2){
			if (an[i][j]!=0){
				for (int l=i+1;l<j;l+=2)an[i][j]=(an[i][j]-an[i][l]*p[coc(l+1,j)])%mo;
			}
		}
	for (int i=1;i<=n*2;i++)
		for (int j=i+1;j<=n*2;j+=2){
			ansn=(ansn+an[i][j]*(p[n*2-k*2-coc(i,j)]))%mo;
		}
	ansn=(ansn+mo)%mo;
	cout<<ansn<<endl;
	return 0;
}

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

int main() {
    int N;
    cin >> N;
    for (int i = 0; i < N; i++) {
        int A;
        cin >> A;
        if (A%2 == 0 && (A%3 != 0 && A%5 != 0)) {
            cout << "DENIED" << endl;
            return 0;
        }
    }
    cout << "APPROVED" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <chrono>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

/*
unsigned seed1 = std::chrono::system_clock::now().time_since_epoch().count();
mt19937 g1.seed(seed1);
*/
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<pii, pii> ppiipii;
typedef pair<int, ppiipii> pippiipii;
typedef pair<int, pii> pipii;
typedef pair<pii, int> ppiii;
typedef pair<int, ppiii> pippiii;
typedef pair<int, ll> pill;
typedef pair<int, double> pid;
// note to self, the below two triggers someone
typedef pair<ll, ll> pll;
typedef pair<ll, int> plli;
typedef long double ld;

int main() {
  int a, b;
  scanf("%d%d", &a, &b);
  int n = b-a;
  printf("%d\n", n*(n+1)/2 - b);
}


Measured memory_bytes: 256
import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.regex : regex;
import std.container;
import std.bigint;
import std.ascii;


void main()
{
  int x, y;
  readf("%s %s\n", &x, &y);

  writeln(x+y/2);
}


Measured memory_bytes: 256
hm={}
n=int(input())
ans=n
arr=[int(i) for i in input().split()]
for i in arr:
    hm[i]=hm.get(i,0)+1
for i in hm:
    if hm[i]!=i:
        if hm[i]>i:
            ans-=hm[i]-i
        else:
            ans-=hm[i]
print(n-ans)

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

int main(){
    ll ans = 0;
    ll n = 0;
    ll m,s;
    cin >> n;
    s = 0;
    vector<ll> v(n);
    for(int i=0;i<n;i++){
        cin >> m;
        s += m;
        s %= INF;
        v[i] = m;
    }
    for(int i=0;i<n;i++){
        ans += (v[i]*(s-v[i]))%INF;
        s -= v[i];
        s%=INF;
        ans = (ans+INF)%INF;
    }
    cout << ans;
}

Measured memory_bytes: 4780
#include<bits/stdc++.h>
#include<time.h>
#include<stdlib.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse4")
#define pb push_back
#define mp make_pair
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long
#define pll pair<ll,ll>
#define vll vector<ll,ll>
#define all(a) (a).begin(),(a).end()
#define ff first
#define ss second
#define sz(x) (ll)x.size()
#define hell 1000000007
#define repf(i,a,b) for(ll i=a;i<b;i++)
#define repb(i,a,b) for(ll i=a;i>b;i--)
#define lbnd lower_bound
#define ubnd upper_bound
#define bs binary_search
#define gcd(a,b) __gcd((a),(b))
#define EPS 1e-12
#define lcm(a,b) ((a)*(b))/__gcd((a),(b))
#define sqrt sqrtl
#define cbrt cbrtl
using namespace std;

int main()
{
  IOS
  ll n;
  cin>>n;
  double a[n+5];
  ll i,x;
  double sum=0;
  for(i=1;i<=n;i++)
  {
  	 cin>>x;
  	 a[i]=1/(double)x;
  	 sum+=a[i];
  }
  double ans=1/(double)sum;
  cout<<fixed<<setprecision(10)<<ans<<"\n";
  return 0;
}                   

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

using namespace std;
const int off=6410;
int h,w;
int a[110][110],b[110][110];
bitset<off*2> c[110][110];

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0),cout.tie(0);
    int i,j,k;
    cin>>h>>w;
    for(i=1;i<=h;i++)
        for(j=1;j<=w;j++)
            cin>>a[i][j];
    for(i=1;i<=h;i++)
        for(j=1;j<=w;j++){
            cin>>k;
            a[i][j]=abs(a[i][j]-k);
        }
    c[1][1][off+a[1][1]]=1,c[1][1][off-a[1][1]]=1;
    for(i=1;i<=h;i++)
        for(j=1;j<=w;j++)
        {
            c[i][j]|=(c[i-1][j]<<a[i][j])|(c[i-1][j]>>a[i][j]);
            c[i][j]|=(c[i][j-1]<<a[i][j])|(c[i][j-1]>>a[i][j]);
        }
    int ans=off;
    for(i=0;i<off*2;i++)
        if(c[h][w][i])
            ans=min(ans,abs(i-off));
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 14080
#include<iostream>

using namespace std;

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

  int cnt=0;
  for(int i=0; i<=a; i++) {
    for(int j=0; j<=b; j++){
      for(int k=0; k<=c; k++){
        if(i*500+j*100+k*50 == x) { cnt++;}
      }
    }
  }
  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
//#define int long long
#define SIZE 101
#define VALUE 10001
//#define _DEBUG
using namespace std;
int N, W, Vs[SIZE], Ws[SIZE] , T[SIZE][VALUE];
int solve(){
    for(int i=0; i<=N; i++){
        for(int w=0; w<=W; w++){
            if(i==0 || w==0){
                T[i][w] = 0;
            }else if(w<Ws[i-1]){
                T[i][w] = T[i-1][w]; 
            }else{
                T[i][w] = max(T[i-1][w], T[i][w-Ws[i-1]]+Vs[i-1]);
            }
        }
    }
#ifdef _DEBUG
    for(int i=0; i<=N; i++){
        if(i>0)cout << Vs[i-1] << "," << Ws[i-1] << "\t";
        else cout << "\t";
        for(int w=0; w<=W; w++){
            cout << T[i][w] << " ";
        }cout << endl;
    }
#endif
    return T[N][W];
}
signed main(){
    while(cin >> N >> W){
        for(int i=0; i<N; i++){
            cin >> Vs[i] >> Ws[i];
        }
        cout << solve() << endl;
    }
}


Measured memory_bytes: 7048
g,r=map(int,input().split())
A=["."*(r+2)]
for i in range(g):
    w="."+input()+"."
    A.append(w)
A.append("."*(r+2))
for i in range(1,g+1):
    for j in range(1,r+1):
        if A[i][j]==".":
            B=[]
            for m in [i-1,i,i+1]:
                for k in [j-1,j,j+1]:
                    B.append(A[m][k])
            A[i]=A[i][1:r+1:].replace(".",str(B.count("#")),1)
            A[i]="."+A[i]+"."
for i in range(1,g+1):
    print(A[i][1:r+1:])


Measured memory_bytes: 3316
'use strict'

function main(input) {
  const x = Math.floor(input / 11)
  if (input % 11 > 6) console.log(x * 2 + 2)
  else if (input % 11 > 0) console.log(x * 2 + 1)
  else console.log(x * 2)
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
#include <stdio.h>

int main() {
	int i;
	char S[6];

	scanf("%s", &S);

	for (i = 0; i < 4; i++) {
		if (S[i] == S[i + 1]) {
			printf("Bad\n");
			return 0;
		}
	}

	printf("Good\n");

	return 0;
}

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

int main(){
    string S; cin >> S;
    bool ok = true;
    rep(i,S.size()){
        if((i%2 == 0) && (S[i] == 'L')) ok = false;
        else if((i%2 == 1) && (S[i] == 'R')) ok = false;
    }
    cout << ((ok)? "Yes" : "No") << endl;
    return 0;
}

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

Measured memory_bytes: 17160
#include<iostream>
#include<vector>
#include<string>
#include<math.h> 
#include<algorithm> 
#include<sstream>
#include<fstream>  
using namespace std; 
typedef long long ll; 
typedef long double ld; 

int ceil(int a, int m){
    // division of a and m
    if(a % m == 0){
        return a/m; 
    }
    else{
        return a/m + 1; 
    }
}

vector<int> sort(vector<int> arr){
    sort(arr.begin(), arr.end()); 
    return arr; 
}





int main(){

char nl = '\n'; 
char bl = ' ';
/*
For array arr use the following preamble to sort
int diff = sizeof(arr)/sizeof(arr[0]); 
sort(arr, arr + diff); 

*/

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

}

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

#define N 100

int a[2][N];
int sa[2][N];

int main()
{
	int ans = 0;
	int n;

	cin >> n;
	for( int i = 0; i < n; i++ ) {
		cin >> a[0][i];
		sa[0][i] = a[0][i];
	}
	for( int i = 0; i < n; i++ ) {
		cin >> a[1][i];
		sa[1][i] = a[1][i];
	}

	for( int i = 1; i < n; i++ ) {
		sa[0][i] += sa[0][i-1];
	}
	for( int i = n - 2; i >= 0; i-- ) {
		sa[1][i] += sa[1][i+1];
	}
	for( int i = 0; i < n; i++ ) {
		if( sa[0][i] + sa[1][i] > ans ) {
			ans = sa[0][i] + sa[1][i];
		}
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
N, M, X = map(int, input().split())
C = [0]*N
A = [[0]*(M+1)]*N
cost = 1
for i in range(N):
  A[i] = list(map(int, input().split()))
  cost += A[i][0]
cost_temp = cost 
for i in range(2**N):
  flag = True
  B = [False]*N
  D = [0]*(M+1)
  for j in range(N):
    if ((i >> j) & 1):
      B[j]=True
  for n in range(N):
    if B[n]:
      for m in range(M+1):
        D[m] += A[n][m]
  for m in range(M):
    if D[m+1]<X:
      flag = False
      break
  if flag and cost > D[0]:
    cost = D[0]
if cost == cost_temp:
  print(-1)
else:
  print(cost)
  

Measured memory_bytes: 9212
fn main() {
    let (n, m, v) = read();
    let ans = solve(n, m, v);
    write(ans);
}

fn read() -> (i32, i32, Vec<i32>) {
    let mut l1 = String::new();
    std::io::stdin().read_line(&mut l1).ok();
    let mut iter = l1.trim().split_whitespace();
    let n: i32 = iter.next().unwrap().parse().unwrap();
    let m: i32 = iter.next().unwrap().parse().unwrap();
    
    let mut l1 = String::new();
    std::io::stdin().read_line(&mut l1).ok();
    let mut iter = l1.trim().split_whitespace();
    let mut v = Vec::<i32>::new();
    for i in iter {
        v.push(i.parse().unwrap());
    }

    (n, m, v)
}

fn write(s: i32) {
    println!("{}", s);
}

fn solve(n: i32, m: i32, v: Vec<i32>) -> i32 {
    let s = v.iter().sum();
    if n >= s {
        n - s
    } else {
        -1
    }
}


Measured memory_bytes: 2172
use proconio::input;

fn main() {
    input! {
        n: usize,
        q: usize,
        a: [usize; n],
    }

    let mut ans = vec![];
    let mut t = FenwickTree::from_vec(a);
    for _ in 0..q {
        input! {
            f: u8,
            l: usize,
            r: usize,
        };
        if f == 0 {
            t.add(l, r);
        } else {
            ans.push(t.cum(l, r).to_string());
        }
    }
    println!("{}", ans.join("\n"));
}

struct FenwickTree<T> {
    v: Vec<T>,
}

use std::ops::AddAssign;
use num::{Integer, zero};

impl<T: Copy + AddAssign + Integer> FenwickTree<T> {
    fn new(n: usize) -> Self {
        Self {
            v: vec![zero(); n],
        }
    }

    fn from_vec(v: Vec<T>) -> Self {
        let n = v.len();
        let mut t = Self::new(n);
        for i in 0..n {
            let v = t.v[i] + v[i];
            t.v[i] = v;
            let p = i + Self::lsb(i + 1);
            if p < n {
                t.v[p] += v;
            }
        }
        t
    }

    fn add(&mut self, mut i: usize, v: T) {
        while i < self.v.len() {
            self.v[i] += v;
            i += Self::lsb(i + 1);
        }
    }

    fn cum(&self, l: usize, r: usize) -> T {
        assert!(l <= r && r <= self.v.len());

        self.cum0(r) - self.cum0(l)
    }

    fn cum0(&self, mut r: usize) -> T {
        let mut v = zero();
        while r > 0 {
            v += self.v[r - 1];
            r -= Self::lsb(r);
        }
        v
    }

    fn lsb(i: usize) -> usize {
        i & i.wrapping_neg()
    }
}


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

using namespace std;

int main() {
	string s;
	long long a, b = 0;
	cin >> a;
	map<string, int> mp;
	for (int i = 0; i < a; i++) {
		cin >> s;
		sort(s.begin(), s.end());
		mp[s]++;
	}
	for (map<string, int>::iterator it = mp.begin(); it != mp.end(); ++it) {
		b += (((long long)it->second * (it->second - 1)) / 2);
//		cout << it->first << ' ' << it->second << endl;
	}
	cout << b;
	return 0;
}

Measured memory_bytes: 11136
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <vector>

using namespace std;

typedef long long ll;

void solve() {
  int a, b;
  cin >> a >> b;
  int ret = 0;
  ret = max(ret, a + a - 1);
  ret = max(ret, b + b - 1);
  ret = max(ret, a + b);
  cout << ret << endl;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL); cout.tie(NULL);
  solve();
  /*
  int t;
  cin >> t;
  for(int i = 1; i <= t; i++) {
    cout << "Case #" << i << ": ";
    solve();
  }
  */
}


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

int main() {
    int n, a, b, c, d, flag = 0;
    string s;
    cin >> n >> a >> b >> c >> d >> s;
    a--;  b--;  c--; d--;

    for(int i = a; i <= max(c, d)-2; i++) {
        if(s[i] == '#' && s[i+1] == '#') {
            flag = 1;
            break;
        }
    }

    if(flag == 1) {
        cout << "No" << endl;
        return 0;
    }

    if(c < d) {
        cout << "Yes" << endl;
        return 0;
    }

    int flag2 = 0;
    for(int i = b-1; i <= d-1; i++) {
        if(s[i] == '.' && s[i+1] == '.' && s[i+2] == '.') {
            flag2 = 1;
            break;
        }
    }

    if(flag2 == 1) {
        cout << "Yes" << endl;
        return 0;
    }
    else {
        cout << "No" << endl;
        return 0;
    }

}

Measured memory_bytes: 640
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
using ld = long double;
template<typename T> using V = vector<T>;
template<typename T> using VV = vector<vector<T>>;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(),(v).end()
#define siz(v) (ll)(v).size()
#define rep(i,a,n) for(ll i=a;i<(ll)(n);++i)
#define repr(i,a,n) for(ll i=n-1;(ll)a<=i;--i)
#define ENDL '\n'
typedef pair<int,int> Pi;
typedef pair<ll,ll> PL;
constexpr ll mod = 1000000007;
constexpr ll INF = 1000000099;
constexpr ll LINF = (ll)(1e18 +99);
const vector<ll> dx={-1,1,0,0},dy={0,0,-1,1};
template<typename T,typename U> inline bool chmin(T& t, const U& u){if(t>u){t=u;return 1;}return 0;}
template<typename T,typename U> inline bool chmax(T& t, const U& u){if(t<u){t=u;return 1;}return 0;}
template<typename T> inline T gcd(T a,T b){return b?gcd(b,a%b):a;}
template<typename T,typename Y> inline T mpow(T a, Y n) {
  T res = 1;
  for(;n;n>>=1) {
    if (n & 1) res = res * a;
    a = a * a;
  }
  return res;
}



signed main(){
  cin.tie(0);ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(20);
  int n,m;cin>>n>>m;
  VV<int> e(11*n,V<int>(0));

  rep(i,0,m){
    int a,b;cin>>a>>b;
    a--;b--;
    rep(j,1,11){
      e[11*a+j].pb(11*b+j-1);
      e[11*b+j].pb(11*a+j-1);
    }
  }

  V<int> used(11*n,0),ans(n,0);

  int qq;cin>>qq;
  V<int> v(qq),d(qq),c(qq);
  rep(i,0,qq)cin>>v[i]>>d[i]>>c[i];


  queue<int> q;
  repr(i,0,qq){  
    v[i]--;

    if(!used[11*v[i]+d[i]]){
      q.push(11*v[i]+d[i]);
      used[11*v[i]+d[i]]=1;
      if(!ans[v[i]])ans[v[i]]=c[i];
    }


    while(q.size()){
      int now=q.front();q.pop();

      for(auto&& nex:e[now]){
        if(!used[nex]){
          used[nex]=1;
          if(!ans[nex/11])ans[nex/11]=c[i];
          q.push(nex);
        }
      }
    }
  }


  rep(i,0,n){
    cout<<ans[i]<<ENDL;
  }
}
//! ( . _ . ) ! 
//CHECK overflow,vector_size,what to output?

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

if a%2==1 or b%2==1 or c%2==1:
  print(0)
  exit()
if a==b==c:
  print(-1)
  exit()
ans=0
while a%2==0 and b%2==0 and c%2==0:
    a,b,c=(b+c)//2,(c+a)//2,(a+b)//2
    ans+=1 
print(ans)

Measured memory_bytes: 9116
n, m = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
a.sort()
bc = [[int(i) for i in input().split()] for _ in range(m)]
bc.sort(key=lambda x: -x[1])

i = 0
for b, c in bc:
    for _ in range(b):
        a[i] = max(a[i], c)
        i += 1
        if i == n:
            break
    if i == n:
        break
print(sum(a))

Measured memory_bytes: 30144
n = int(input())
nums = list(map(int, input().split()))
best = [999999]*n
best[0] = 0
for i in range(1, n):
    if i==1:
        best[1] = abs(nums[0]-nums[1])
    else:
        best[i] = min(abs(nums[i]-nums[i-1])+best[i-1], abs(nums[i]-nums[i-2])+best[i-2])

print(best[-1])

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

int main(){
    int N;
    cin >> N;
    int ans = 99999;
    for (int i = 1; i < N; i++){
        int A = i, B = N-i;
        int cand = 0;
        while (A > 0) {
            cand += A%10;
            A /= 10;
        }
        while (B > 0) {
            cand += B%10;
            B /= 10;
        }
        ans = min(cand, ans);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define all(x) x.begin(),x.end()
#define dbg(x) cout<<#x<<":"<<x<<endl
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<ll,P> PP;

int main(){
  ll n;
  cin>>n;
  ll mi=1LL<<60;
  for(int i=0;i<5;i++){
    ll a;
    cin>>a;
    mi=min(mi,a);
  }
  cout<<4LL+(n+mi-1LL)/mi<<endl;
  return 0;
}


Measured memory_bytes: 256
import sys
sys.setrecursionlimit(2*10**5)

# 入力
N, M = map(int, input().split())
A, B = zip(*(map(int, input().split()) for _ in range(M)))

# 隣接リスト表現のグラフに変換
E = [[] for _ in range(N + 1)]
for a, b in zip(A, B):
    E[a].append(b)
    E[b].append(a)

# 訪れたことがあるかどうかのフラグ
v = [i == 1 for i in range(N + 1)]


# 訪れたことのない頂点を深さ優先探索する
def dfs(i, p):
    for j in E[i]:
        if not v[j]:
            v[j] = True
            p.append(j)
            return dfs(j, p)
    else:
        return p


# Hamiltonish Path を求める
p = list(reversed(dfs(1, []))) + [1] + dfs(1, [])

# 出力
ans = '{}\n{}'.format(len(p), ' '.join(map(str, p)))
print(ans)


Measured memory_bytes: 111076
#include<bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl
typedef long long ll;
using namespace std;
int static fast = [](){
  ios::sync_with_stdio(false);
  cin.tie(0); cout.tie(0); return 0;
}();

int main() {
    int a, b;
    cin >> a >> b;
    if (a >= 13)
        cout << b << endl;
    else if (a <= 12 && a >= 6)
        cout << b/2 << endl;
    else
        cout << 0 << endl;
    return 0;
}




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

int dp[5010][5010];
int main() {
	int n; cin >> n;
	string s; cin >> s;
	for(int l = 1; l <= n; ++l) {
		for(int r = l + 1; r <= n; ++r) {
			if(s[l - 1] == s[r - 1]) {
				dp[l][r] = min(dp[l - 1][r - 1] + 1, r - l);
			}
		}
	}
	int ans = 0;
	for(int i = 0; i <= n; ++i) {
		for(int j = 0; j <= n; ++j) {
			ans = max(ans, dp[i][j]);
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 96768
#include <bits/stdc++.h>
using namespace std;
int main() {
  int hi,hy,ki,ky,ip,yp,ia,ya;
  cin >> hi >> hy >> ki >> ky >> ip >> yp >> ia >> ya;
  int hirosi,kenjiro;
  hirosi += hi*ip + hy*yp;
  kenjiro += ki*ip + ky*yp;
  hirosi += hi/10*ia;
  hirosi += hy/20*ya;
  kenjiro += ki/10*ia;
  kenjiro += ky/20*ya;
  if (hirosi == kenjiro) {
    cout << "even" << endl;
  }
  if (hirosi > kenjiro) {
    cout << "hiroshi" << endl;
  } else if (hirosi < kenjiro) {
    cout << "kenjiro" << endl;
  }
}


Measured memory_bytes: 3104
import scala.util.control.Breaks
object Main{
  def main(args:Array[String]) = {
    val sc = new java.util.Scanner(System.in)
    val N = sc.nextInt
    val K = sc.nextInt

    val x_ = Array.ofDim[BigInt](N)
    val y_ = Array.ofDim[BigInt](N)
    for(i <- 0 to N-1){
      x_(i) = sc.nextInt
      y_(i) = sc.nextInt
    }

    val x = x_.sorted
    val y = y_.sorted

    var ans : BigInt = (x(N-1)-x(0)) * (y(N-1)-y(0))
    for(xi <- 0 to N-1){
      for(xj <- xi+1 to N-1){
        for(yi <- 0 to N-1){
          for(yj <- yi+1 to N-1){
            val lx = x(xi)
            val rx = x(xj)
            val by = y(yi)
            val uy = y(yj)

            var cnt = 0
            val br = new Breaks
            br.breakable{
              for(i <- 0 to N-1){
                if(lx<=x_(i) && x_(i)<=rx && by<=y_(i) && y_(i)<=uy) cnt = cnt + 1
                if(cnt >= K) br.break
                if(cnt + (N-1-i) < K) br.break
              }
            }

            if(cnt >= K){
              ans = ans.min((rx-lx)*(uy-by))
            }
          }
        }
      }
    }
    println(ans)
  }
}


Measured memory_bytes: 118144
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/range/adaptor/reversed.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
typedef long long int ll;

#define PI (acos(-1))
#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define dumparr(x) cerr << #x ; for(auto elem: x){cerr << " " << elem;} cerr << endl;
#define dumppairs(x) cerr << #x ; for(auto elem: x){cerr << "(" << elem.first << " " << elem.second << ") ";} cerr << endl;
#define dumpline cerr << "**********************" << endl;
#define dumpwline(x) cerr << "******** " << #x << "=" << (x) << " ********" << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))

int main(void){
    ll n; cin >> n;
    ll k; cin >> k;
    vector <ll> as;
    REP(i, n){
        ll a; cin >> a;
        as.push_back(a);
    }
    REP(i, n-k){
        if (as[i+k] >as[i]){
            cout << "Yes" << endl;
        } else {
            cout << "No" << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 5296
#include <bits/stdc++.h>
using namespace std;
#define rep2(i,m,n) for (int i = (m); i < (n); ++i)
#define rep(i,n) rep2(i,0,n)
#define debug(x) cerr << x << endl
typedef long long int ll;
typedef long double ld;
typedef pair<int, int> P;
template<typename T> struct V : vector<T> { using vector<T>::vector; };
V() -> V<int>;
V(size_t) -> V<int>;
template<typename T> V(size_t, T) -> V<T>;
template<typename T> vector<T> make_vec(size_t n, T a) { return vector<T>(n, a); }
template<typename... Ts> auto make_vec(size_t n, Ts... ts) { return vector<decltype(make_vec(ts...))>(n, make_vec(ts...)); }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &v) { for (auto &e : v) os << e << ' '; return os; }
struct fast_ios { fast_ios(){ cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
template<typename T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
template<typename T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
const int INF = 1<<30;
const ll LINF = 1LL<<61;
const ll MOD = 1000000007;

int main()
{
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    vector<ll> x(4);
    x[0] = a * c;
    x[1] = a * d;
    x[2] = b * c;
    x[3] = b * d;
    // debug(x);
    sort(x.begin(), x.end(), greater<ll>());
    // debug(x);
    cout << x[0] << endl;
}


Measured memory_bytes: 3656
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#define abdelrahman010 ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef long long ll;
using namespace std;
const int N = 2e5 + 5;
const int mod = 1e9 + 7;
int n , a[62] , b[62];
int ans;
int main() {
    abdelrahman010
    cin >> n;
    for(int i = 0;i < n;i++) {
        ll x;
        cin >> x;
        for(int j = 61; j >= 0;j--)
            if(!((1ll << j) & x))
                b[j]++ , ans = (ans + (1ll * a[j] * ((1ll << j) % mod)) % mod) % mod;
            else
                a[j]++ , ans = (ans + (1ll * b[j] * ((1ll << j) % mod)) % mod) % mod;
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 256
# ABC 057
import math
def getInt(): return int(input())
def db(x): 
    global debug
    if debug: print(x)
debug = False
N = getInt()
m = int(math.sqrt(N))
for i in range(m,0,-1):
    db(i)
    if N%i==0: 
        print(int(math.log10(N//i))+1)
        break
        

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

int bucket[101]={0};

int main(){
    int n;
    while(scanf("%d",&n) != EOF){
        bucket[n]++;
    }
    int maxi=0;
    for(int i=1;i<=100;++i){
        maxi = max(maxi, bucket[i]);
    }
    for(int i=1;i<=100;++i){
        if(bucket[i] == maxi){
            cout << i << endl;
        }
    }

    return 0;
}


Measured memory_bytes: 3128
H,W=map(int,input().split())
S=[input() for _ in range(H)]
ans="Yes"
for i in range(1,H-1):
  for j in range(1,W-1):
    if S[i][j]=="#" and S[i-1][j]=="." and S[i][j-1]=="." and S[i+1][j]=="." and S[i][j+1]==".":
      ans="No"
print(ans)

Measured memory_bytes: 3064
n = int(input())
a = list(map(int,input().split()))
dp = [0,abs(a[1]-a[0])]
for i in range(2,n):
    dp.append(min(dp[i-1]+abs(a[i]-a[i-1]), dp[i-2]+abs(a[i]-a[i-2])))
print(dp[-1])


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

int main(){
    int n, cnt=0;
    cin >> n;
    int array[n];
    for(int i=0; i<n; i++){
        cin >> array[i];
    }
    for(int i=0; i<n; i++){
        if(i+1==array[array[i]-1]) cnt++;
    }
    cout << cnt/2 << endl;
    return 0;
}


Measured memory_bytes: 640
#include <algorithm>
#include <iostream>
#include <queue>
#include <vector>

using namespace std;

struct Edge
{
    int node;
    int cost;
    int id;

    bool operator<(const Edge &other) const
    {
        return cost > other.cost;
    }
};

using Graph = vector<vector<Edge>>;

void AddImportant(const Graph &g, int start, vector<bool> &is_important)
{
    priority_queue<Edge> heap;
    heap.push({start, 0, -1});

    vector<int> costs(g.size(), (1 << 25));
    costs[start] = 0;

    while (!heap.empty()) {
        auto e = heap.top();
        heap.pop();

        if (e.cost > costs[e.node]) {
            continue;
        }
        if (e.id != -1) {
            is_important[e.id] = true;
        }

        for (const auto &ne : g[e.node]) {
            auto new_cost = e.cost + ne.cost;
            if (new_cost <= costs[ne.node]) {
                costs[ne.node] = new_cost;
                heap.push({ne.node, new_cost, ne.id});
            }
        }
    }
}

int CountImportant(const Graph &g, int edges)
{
    vector<bool> is_important(edges, false);
    for (size_t i = 0; i < g.size(); i += 1) {
        AddImportant(g, i, is_important);
    }
    return count(is_important.begin(), is_important.end(), false);
}

int main()
{
    int nodes, edges;
    cin >> nodes >> edges;

    Graph graph(nodes);
    for (auto i = 0; i < edges; i += 1) {
        int a, b, cost;
        cin >> a >> b >> cost;
        graph[a - 1].push_back({b - 1, cost, i});
        graph[b - 1].push_back({a - 1, cost, i});
    }

    auto res = CountImportant(graph, edges);
    cout << res << "\n";

    return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python
from __future__ import division, print_function

import os
import sys
from io import BytesIO, IOBase

if sys.version_info[0] < 3:
    from __builtin__ import xrange as range
    from future_builtins import ascii, filter, hex, map, oct, zip


def main():
    h, w = [int(s) for s in input().strip().split()]
    if h == 1 or w == 1:
        print(1)
        return
    result = h * (w // 2) + (w % 2) * (h + 1) // 2
    print(result)


# region fastio

BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


def print(*args, **kwargs):
    """Prints the values to a stream, or to sys.stdout by default."""
    sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", "\n"))
    if kwargs.pop("flush", False):
        file.flush()


if sys.version_info[0] < 3:
    sys.stdin, sys.stdout = FastIO(sys.stdin), FastIO(sys.stdout)
else:
    sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)

input = lambda: sys.stdin.readline().rstrip("\r\n")

# endregion

if __name__ == "__main__":
    main()


Measured memory_bytes: 38256
// Example program
#include <iostream>
#include <string>
using namespace std;
int main()
{
    int w,h,x,y,r;
    cin>>w>>h>>x>>y>>r;
    if(x>=0&&y>=0){
        if(w>=x+r&&h>=y+r){
            cout<<"Yes"<<endl;
        }
        else{
            cout<<"No"<<endl;
        }
    }else{
        cout<<"No"<<endl;
    }
    return 0;
}



Measured memory_bytes: 3096
def input_int():
    return map(int, input().split())

def one_int():
    return int(input())

def one_str():
    return input()

def many_int():
    return list(map(int, input().split()))

H,W = input_int()

if H==1 or W==1:
    print(1)
else:
    print(int(H*(W/2) +0.5))    

Measured memory_bytes: 2940
//SILENT KILLER
#include<bits/stdc++.h>
//typedef long long ll;
using namespace std;
//vector<int>v;
int main()
{
   string s;
  cin>>s;
  int sum=0;
  for(int i=0;i<s.size();i++)
  {
      sum=sum+(s[i]-'0');
  }
    if(sum%9==0)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;


}





Measured memory_bytes: 3628
def solve(n, x):
    m = 2 * n - 1
    if x == 1 or x == m:
        print('No')
        return
    if x <= n:
        tmp = [1] + list(range(x, m + 1)) + list(range(2, x))
    else:
        tmp = [m] + list(range(x, 0, -1)) + list(range(x + 1, m))
    ans = list(reversed(tmp[0::2])) + tmp[1::2]
    print('Yes')
    print('\n'.join(map(str, ans)))


n, x = map(int, input().split())
solve(n, x)


Measured memory_bytes: 26684