akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
using namespace std;

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

    int s=a+b;
    int d=a-b;
    int p=a*b;

    if(s>=d && s>=p){cout<<s;}
    else if(d>=s && d>=p){cout<<d;}
    else if(p>=s && p>=d){cout<<p;}

    return 0;
}


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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define repi(i,a,b) for(int i=int(a);i<(int)(b);i++)
#define all(x) (x).begin(),(x).end()
#define foreach(u,v) for(auto (u) : (v))
#define pb push_back
#define mp make_pair
#define mt make_tuple

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<ll, ll> pll;
typedef vector<ll> vl;

const int inf = 1e9;
const ll linf = 1e18;
const ll mod = 1e9 + 7;
const double eps = 1e-9;

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

  if(x == 1 or x == 2*n-1){
    cout << "No" << endl;
    return 0;
  }

  vi ans(2*n-1);
  ans[n-2] = x-1;
  ans[n-1] = x;
  ans[n] = x+1;
  int cur = 1;
  rep(i, 2*n-1){
    if(x-1 <= cur and cur <= x+1){
      cur = x+2;
    }
    if(i < n-2 or n < i) ans[i] = cur++;
  }

  cout << "Yes" << endl;
  rep(i, 2*n-1) cout << ans[i] << endl;

  return 0;
}


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

const long long m=1e9+5;

int main()
{
 int n,x,y,z;
 cin>>n;
 vector<int>v(3,0);
 cin>>x>>y>>z;
 v[0]=x;v[1]=y;v[2]=z;

 n--;
 while(n--)
 {
     int a[3],i,j;
     for(i=0;i<3;i++)cin>>a[i];
     vector<int>dp(3,0);


     for(i=0;i<3;i++)
     {
         for(j=0;j<3;j++)
         {
             if(i!=j)
             {
                 dp[i]=max(dp[i],v[j]+a[i]);

             }
         }
         //cout<<dp[i]<<" ";
     }
   //  cout<<endl;
     v=dp;

 }

 cout<<*max_element(v.begin(),v.end())<<endl;

}


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

using namespace std;

typedef long long ll;
typedef long double ld;

const int N = (int) 1e5 + 7;
ll n;
ll sol;
int x;
int mod;
bool vis[N];
vector<int> ord;

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

    cin >> n >> x >> mod;
    while (vis[x] == 0)
    {
        ord.push_back(x);
        vis[x] = 1;
        x = (ll) x * x % mod;
    }
    int where = 0;
    while (ord[where] != x)
    {
        where++;
    }
    vector<int> pref;
    vector<int> cycle;
    for (int i = 0; i < where; i++)
    {
        pref.push_back(ord[i]);
    }
    for (int i = where; i < (int) ord.size(); i++)
    {
        cycle.push_back(ord[i]);
    }
    if (n <= (int) pref.size())
    {
        for (int i = 0; i < n; i++)
        {
            sol += pref[i];
        }
        cout << sol << "\n";
        return 0;
    }
    for (int i = 0; i < (int) pref.size(); i++)
    {
        sol += pref[i];
    }
    n -= (int) pref.size();
    ll full = n / (int) cycle.size();
    ll semi = n % (int) cycle.size();
    for (int i = 0; i < (int) cycle.size(); i++)
    {
        sol += full * cycle[i];
        if (i < semi)
        {
            sol += cycle[i];
        }
    }
    cout << sol << "\n";
}


Measured memory_bytes: 3980
<?php
fscanf(STDIN, '%s', $s);

if (strlen($s) != 4) {
  exit('No'.PHP_EOL);
}

$s1 = '';
$s1_cnt = 0;
$s2 = '';
$s2_cnt = 0;

for ($i = 0; $i < 4; $i++) {
  if ($s1 === '') {
    $s1 = $s[$i];
    $s1_cnt++;
    continue;
  }
  if ($s1 === $s[$i]) {
    $s1_cnt++;
    continue;
  }
  if ($s2 === '') {
    $s2 = $s[$i];
    $s2_cnt++;
    continue;
  }
  if ($s2 === $s[$i]) {
    $s2_cnt++;
    continue;
  }
}

if ($s1_cnt === 2 && $s2_cnt === 2) {
  echo 'Yes'.PHP_EOL;
} else {
  echo 'No'.PHP_EOL;
}

Measured memory_bytes: 4732
n,m = map(int,input().split())
lst = [[0 for i in range(m+1)] for j in range(n+1)]
for i in range(n):
    line = list(map(int,input().split()))
    for j in range(m):
        lst[i][j] = line[j]
for i in range(n):
    for j in range(m):
        lst[i][m] += lst[i][j]
for j in range(m+1):
    for i in range(n):
        lst[n][j] += lst[i][j]
for i in range(n+1):
    for j in range(m+1):
        if j>0:
            print(f" {lst[i][j]}", end="")
        else:
            print(lst[i][j], end="")
    print()


Measured memory_bytes: 6224
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE BinaryLiterals #-}
{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE NumDecimals #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TupleSections #-}

import Control.Applicative
import Control.Arrow
import Control.Monad
import Control.Monad.ST

import Data.Char
import Data.List
import Data.Maybe

import qualified Data.ByteString.Char8 as B

import Data.Array.ST.Safe
import Data.STRef

import Debug.Trace
import Text.Printf

readInt = readLn :: IO Int
readInteger = readLn :: IO Integer
readInts = map ( fst . fromJust . B.readInt ) . B.words <$> B.getLine
readIntegers = map ( fst . fromJust . B.readInteger ) . B.words <$> B.getLine

which a b f = if f then a else b
mp [ a, b ] = ( a, b )

modifyArray a i f = writeArray a i =<< f <$> readArray a i

main = readInt >>= print . ( `div` 2 ) . succ

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

int main(){
  ll n;
  cin>>n;
  
  ll ans=100100100100100100;
  for(int i=1;i<=1000000;i++){
    if(n%i==0){
      ll p=i+(n/i);
      ans=min(ans,p);
    }
  }
  ans-=2;
  cout<<ans<<endl;
}

Measured memory_bytes: 384
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")

#include <bits/stdc++.h>  // This will work only for g++ compiler.
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define tree_set tree<int, null_type,greater<int>, rb_tree_tag,tree_order_statistics_node_update>
#define for0(i, n) for (int i = 0; i < (int)(n); ++i) // 0 based indexing
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i) // 1 based indexing
#define forc(i, l, r) for (int i = (int)(l); i <= (int)(r); ++i) // closed interver from l to r r inclusive
#define forr0(i, n) for (int i = (int)(n) - 1; i >= 0; --i) // reverse 0 based.
#define forr1(i, n) for (int i = (int)(n); i >= 1; --i) // reverse 1 based
#define FASTIO ios::sync_with_stdio(false); cin.tie(0); //for faster IO

//short hand for usual tokens
#define pb push_back
#define fi first
#define se second


// to be used with algorithms that processes a container Eg: find(all(c),42)
#define all(x) (x).begin(), (x).end() //Forward traversal
#define rall(x) (x).rbegin(), (x).rend() //reverse traversal


// traversal function to avoid long template definition. Now with C++11 auto alleviates the pain.
#define tr(c,i) for(__typeof__((c)).begin() i = (c).begin(); i != (c).end(); i++)


// find if a given value is present in a container. Container version. Runs in log(n) for set and map
#define present(c,x) ((c).find(x) != (c).end())


//find version works for all containers. This is present in std namespace
#define cpresent(c,x) (find(all(c),x) != (c).end())


// Avoiding wrap around of size()-1 where size is a unsigned int.
#define size(a) int((a).size())


using namespace std;
using namespace __gnu_pbds;

// Shorthand for commonly used types
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef double ld;


const ll INF = 1e18+7;


const int M = 1e9+7;

ll mod(ll x){
    return ((x%M + M)%M);
}

ll add(ll a, ll b){
    return mod(mod(a)+mod(b));
}

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

ll minu(ll a, ll b){
    return mod(mod(a)-mod(b));
}

ll modPow(ll a,ll b){
    if(b==0)
        return 1LL;
    if(b==1)
        return a%M;
    ll res=1;
    while(b){
        if(b%2==1)
            res=mul(res,a);
        a=mul(a,a);
        b=b/2;
    }
    return res;
}

void solve(){
    int n;
    cin>>n;
    vll dp(n+1);
    dp[0]=1;dp[1]=0;dp[2]=0;dp[3]=1;dp[4]=1;dp[5]=1;
    for(int i=6;i<=n;i++){
        ll temp=0;
        for(int j=3;j<=i;j++){
            temp=add(dp[i-j],temp);
        }
        dp[i]=temp;
    }
    cout<<dp[n]<<"\n";
}


int main() {
    FASTIO
    cout.precision(10);
    cout << fixed;
    int t=1;
    //cin>>t;
    while(t--)solve();
    return 0;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
//using Graph = vector<vector<int>>;
//using P = pair<int,int>;
//int dy[4] = {-1,0,1,0};
//int dx[4] = {0,-1,0,1};


int main()
{
    int S,W;
    cin >> S >> W;
    
    if(S > W) cout << "safe" << endl;
    else cout << "unsafe" << endl;
    
    return 0;
    
}

/*
 if(ok) cout << "Yes" << endl;
 else cout << "No" << endl;
 */


/*
    int N;
    cin >> N;
    
    int ans;
    cout >> ans;
    */

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

int main(){
  int n;
  cin >> n;
  vector<int> h(n);
  for(int i=0;i<n;i++)
    cin >> h.at(i);
  
  int a=0;
  int k=0;
  
  for(int i=0;i<n;i++){
    if(a<=h.at(i)){
      a=h.at(i);
      k++;
    }
  }
  
  cout << k << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
const ll MOD = 1000000007;
const ll INF = 9999999999;
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;}
template<class T> inline T powerM(T a,T b){if (b==0) return 1;
  T tmp = powerM(a,b/2); if (b%2==0) return tmp*tmp%MOD; else return tmp*tmp%MOD*a%MOD; }


int main() {
  int n,k; cin >>n >>k;
  int res = 0;
  while (n > 0){
    n /= k;
    res++;
  }
  cout <<res <<endl;
}

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



int main(){
  int INF = 1000;
  int d[51][51];
  for(int i=0;i<51;i++){
    for(int j=0;j<51;j++){
      d[i][j]=INF;
    }
  }

  int N,M;
  cin>>N>>M;

  int a[51],b[51],ans=0;
  for(int i=0;i<M;i++){
    cin>>a[i]>>b[i];
    d[a[i]-1][b[i]-1]=1;
    d[b[i]-1][a[i]-1]=1;
  }

  for(int i=0;i<M;i++){
    d[a[i]-1][b[i]-1]=INF;
    d[b[i]-1][a[i]-1]=INF;

  for(int k=0;k<N;k++){
    for(int i=0;i<N;i++){
      for(int j=0;j<N;j++){
        d[i][j]=min(d[i][j],d[i][k]+d[k][j]);
      }
    }
  }
  if(d[a[i]-1][b[i]-1]==INF){
    ans+=1;
  }
  for(int i=0;i<51;i++){
    for(int j=0;j<51;j++){
      d[i][j]=INF;
    }
  }
  for(int i=0;i<M;i++){
    d[a[i]-1][b[i]-1]=1;
    d[b[i]-1][a[i]-1]=1;
  }
}
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <stdio.h>
#include <algorithm>
#include <functional>
using namespace std;

int main() {


	int N;
	cin >> N;

	int sum = 0;

	string S = std::to_string(N);

	for (int i = 0; i < S.size(); i++){
		sum += std::stoi(S.substr(i,1));
	}

	if ((N % sum) == 0){
		std::cout << "Yes" << std::endl;
	}
	else{
		std::cout << "No" << std::endl;
	}





	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define rrep(i,n) for (int i = n-1; i >= 0; i--)
#define rep2(i,s,n) for (int i = s; i < n; ++i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define tmax(a,b,c) max(a,max(b,c))
#define tmin(a,b,c) min(a,min(b,c))
#define pb push_back
#define eb emplace_back
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vs vector<string>
#define vc vector<char>
#define vb vector<bool>
#define vp vector<P>
using namespace std;
using ll = long long;
using P = pair<int,int>;
using LP = pair<ll,ll>;
template<class T> istream& operator>>(istream& is,vector<T>& v) { for(T& t:v){is>>t;} return is; }
template<class T> ostream& operator<<(ostream& os,const vector<T>& v) { for(T t:v){os<<t<<" ";} os<<"\n"; return os; }
void Yes(bool b) { cout << (b ? "Yes" : "No") << endl; }
void YES(bool b) { cout << (b ? "YES" : "NO") << endl; }
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;}
const int inf = 1001001001;
const ll linf = 1001001001001001001;

template<typename T>
class weight_unionfind {
    vi par,rank;
    vector<T> diff_weight;
public:
    weight_unionfind(int n):par(n,-1),rank(n,0),diff_weight(n,0) {}
    int root(int x) {
        if(par[x] < 0) return x;
        else {
            int r = root(par[x]);
            diff_weight[x] += diff_weight[par[x]];
            return par[x] = r;
        }
    }
    T weight(int x) {
        root(x);
        return diff_weight[x];
    }
    bool same(int x,int y) { return root(x) == root(y); }
    bool merge(int x,int y,T w) {
        w += weight(x); w -= weight(y);
        x = root(x); y = root(y);
        if(x == y) return false;
        if(rank[x] < rank[y]) swap(x,y),w = -w;
        if(rank[x] == rank[y]) rank[x]++;
        par[x] += par[y];
        par[y] = x;
        diff_weight[y] = w;
        return true;
    }
    T diff(int x,int y) {
        assert(same(x,y));
        return weight(y)-weight(x);
    }
};

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);
    int n,m;
    cin >> n >> m;
    weight_unionfind<int> uf(n);
    rep(_,m) {
        int l,r,d;
        cin >> l >> r >> d;
        l--; r--;
        if(!uf.same(l,r)) uf.merge(l,r,d);
        else {
            if(uf.diff(l,r) == d) continue;
            Yes(0);
            return 0;
        }
    }
    Yes(1);
}


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

using namespace std;

#define pb push_back
#define mp make_pair
#define fs first
#define fst first
#define sc second
#define snd second
#define sz(X) (int)(X).size()
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define fornr(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define forab(i, a, b) for(int i = int(a); i < int(b); i++)
#define all(X) X.begin(), X.end()

typedef long long ll;
typedef vector<pair<ll, ll>> vpll;
typedef pair<int, int> pii;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef double dbl;
typedef long double ld;
typedef vector<int> vi;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n, m;
    cin >> n >> m;
    string s = "", t = "";
    forn(i, n) s += to_string(m);
    forn(i, m) t += to_string(n);
    cout << min(s, t) << "\n";
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main{
	static int search(int[] lst,int n,int key){
		for(int i=0;i<n;i++){
		    if(lst[i]==key)return i;
		}
		return -1 ;
	}
	
	public static void main(String[] args){
	    Scanner sc = new Scanner(System.in);
	    
	    int n=sc.nextInt();
	    int[] lst = new int[n+1];
	    for(int i=0;i<n;i++)lst[i]=sc.nextInt();
	    
	    int q=sc.nextInt();
	    int sum=0;
	    
	    for(int i=0;i<q;i++){
	        if(search(lst,n+1,sc.nextInt())>=0)sum++;
	    }
	    
	    System.out.println(sum);
	}
}


Measured memory_bytes: 40440
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
    int n,countr=0,countb=0;
    cin >> n;
    string s;
    cin >> s;
    for(int i=0;i < s.size();i++){
        if(s.at(i)=='R'){
            countr++;
        }
        else{
            countb++;
        }
    }

    if(countr>countb){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;

namespace m_solutions2020_d
{
  class Program
  {
    static void Main(string[] args)
    {
      var N = CIn.ReadInt();
      var A = CIn.ReadIntArray(N);

      var b = 0;
      var m = 1000L;

      for (int i = 1; i <= N; i++)
      {
        if (i == N || A[i - 1] > A[i])
        {
          var c = m / A[b];
          m += (A[i - 1] - A[b]) * c;
          
          b = i;
        }
      }

      Console.WriteLine(m);
    }
  }

  static class CIn
  {
    private static readonly Queue<string> fieldBuffer = new Queue<string>();

    public static string Read()
    {
      if (fieldBuffer.Count == 0)
      {
        foreach (var field in Console.ReadLine().Split())
        {
          fieldBuffer.Enqueue(field);
        }
      }
      return fieldBuffer.Dequeue();
    }

    public static int ReadInt() => int.Parse(Read());
    public static long ReadLong() => long.Parse(Read());
    public static double ReadDouble() => double.Parse(Read());

    public static string[] ReadStringArray(int n)
    {
      var array = new string[n];
      for (var i = 0; i < n; i++)
      {
        array[i] = Read();
      }
      return array;
    }

    public static int[] ReadIntArray(int n)
    {
      var array = new int[n];
      for (var i = 0; i < n; i++)
      {
        array[i] = ReadInt();
      }
      return array;
    }

    public static long[] ReadLongArray(int n)
    {
      var array = new long[n];
      for (var i = 0; i < n; i++)
      {
        array[i] = ReadLong();
      }
      return array;
    }

    public static double[] ReadDoubleArray(int n)
    {
      var array = new double[n];
      for (var i = 0; i < n; i++)
      {
        array[i] = ReadDouble();
      }
      return array;
    }

    public static char[,] ReadCharMatrix(int h, int w)
    {
      var array = new char[h, w];
      for (var i = 0; i < h; i++)
      {
        var l = Console.ReadLine().ToCharArray();
        for (var j = 0; j < w; j++)
        {
          array[i, j] = l[j];
        }
      }
      return array;
    }
  }
}


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

int main() {
  vector<int> x(5);
  for (int i = 0; i < 5; i++) cin >> x[i];

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

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

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

	vector<int> dp(n);
	dp[0]=a[0];
	//for (int i=1;i<n;++i)
	//{
	//	dp[i]=-1;
	//}

	int count=1;
	for (int i=1;i<n;++i)
	{
		// lookup first dp[j]>a[i]
		if (dp[count-1]<a[i])
		{
			dp[count]=a[i];
			++count;
			continue;
		}

		int minimum=0;
		int maximum=count-1;
		while (maximum-minimum>1)
		{
			int mid=(maximum+minimum)/2;
			if (dp[mid]>a[i])
			{
				maximum=mid;
			}
			else if (dp[mid]==a[i])
			{
				break;
			}
			else
			{
				minimum=mid;
			}
		}
	
		if (maximum-minimum<=1)
		{
			if (dp[minimum]>a[i])
			{
				dp[minimum]=a[i];
			}
			else if  (dp[minimum]<a[i]) 
			{
				dp[maximum]=a[i];
			}
		}
	}
	cout << count << endl;

#ifdef NEVER_DEFINED
	for (int i=0;i<count;++i)
	{
		cout << ' ' << dp[i];
	}
	cout << endl;
#endif
}











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

int main(){
  int n,m;
  while(cin >> n >> m, n){
    vector< vector<int> > g(n);
    for(int i=0;i<m;i++){
      int a,b;
      cin >> a >> b;
      a--; b--;
      g[a].push_back(b);
      g[b].push_back(a);
    }

    set<int> invite;
    for(int v : g[0]){
      invite.insert(v);
      for(int u : g[v]){
        invite.insert(u);
      }
    }
    cout << invite.size() - 1 << endl;
  }
}

Measured memory_bytes: 3180
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep2(i, a, n) for(ll i = a; i < (ll)(n); i++)
#define memi cout << endl
#define kono(n) cout << fixed << setprecision(n)
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define hina cout << ' '
#define in(n) cin >> n
#define in2(n, m) cin >> n >> m
#define in3(n, m, l) cin >> n >> m >> l
#define out(n) cout << n
const ll mei = (ll)1e9 + 7;

int main(){
  ll n, m, a;
  in2(n, m);
  vector<pair<ll, ll>> c(n);
  rep(i, n)
    in2(c[i].first, c[i].second);
  sort(all(c));
  a = 0;
  rep(i, n){
    a += min(c[i].second, m) * c[i].first;
    m -= min(c[i].second, m);
    if(m == 0)
      break;
  }
  out(a);
  memi;
}

Measured memory_bytes: 1792
#include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;
#define DEBUG(x) cerr << #x << " = " << x << endl
const int INF = (int)1e9;
int main() {
  while(true) {
    int R, N; cin >> R >> N;
    if(R == 0 && N == 0) break;
    int H[201];
    for(int i = 0; i < 201; ++i) H[i] = 0;
    for(int i = 0; i < N; ++i) {
      int l, r, h; cin >> l >> r >> h;
      for(int j = l; j < r; ++j) {
        H[j+100] = max(H[j+100], h);
      }
    }
    double ans = 1e9;
    H[-R+100-1] = INF;
    H[R+100] = INF;
    for(int i = -R; i <= R; ++i) {
      int h = min(H[i+100-1], H[i+100]);
      ans = min(ans, h-sqrt(max<double>(0.0, R*R-abs(i)*abs(i))));
    }
    cout.setf(ios::fixed);
    cout.precision(4);
    cout << ans +R << endl;
  }
}

Measured memory_bytes: 1228
#include "bits/stdc++.h"
using namespace std;

using ll = long long;
using ld = long double;
using P = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
ld EPS = 1e-12;
int INF = numeric_limits<int>::max() / 2;
ll LINF = numeric_limits<ll>::max() / 2;
int MOD = 1e9 + 7;
#define rep(i,n) for(int i = 0; i < n; i++)
#define all(obj) (obj).begin(), (obj).end()
#define debug(x) cerr << #x << ": " << x << '\n'

int main()
{
    int a,b;
    cin >> a >> b;
    bool f = (a%3==0 || b%3==0)||(a+b)%3==0;
    cout << (f ? "Possible" : "Impossible") << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define FORR(i, m, n) for(int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)

int main(){
  string s;
  cin >> s;
  int sum = 0;
  REP(i, 4){
    if(s[i] == '+') sum++;
    else sum--;
  }
  cout << sum;
}


Measured memory_bytes: 256
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys,collections,itertools,re,math,fractions,decimal,random,array,bisect,heapq

# decimal.getcontext().prec = 50
# sys.setrecursionlimit(10000)
# MOD = 10**9 + 7

def solve(f):
    n = f.read_int()
    a = f.read_int_list()

    ans = 0
    for i in xrange(n-1):
        if a[i] == a[i+1]:
            a[i+1] = -1
            ans += 1

    return ans


class Reader(object):
    def __init__(self, filename=None):
        self.file = open(filename) if filename is not None else None
        self.case = 1

    def __readline(self):
        return self.file.next().strip() if self.file else raw_input()

    def next_case(self):
        self.file.next()
        self.case += 1

    def read_int(self): return int(self.__readline())
    def read_float(self): return float(self.__readline())
    def read_long(self): return long(self.__readline())
    def read_decimal(self): return decimal.Decimal(self.__readline())
    def read_str(self): return self.__readline()

    def read_int_list(self): return map(int, self.__readline().split())
    def read_float_list(self): return map(float, self.__readline().split())
    def read_long_list(self): return map(long, self.__readline().split())
    def read_decimal_list(self): return map(decimal.Decimal, self.__readline().split())
    def read_str_list(self): return self.__readline().split()

if __name__ == '__main__':
    filename = sys.argv[1] if len(sys.argv) > 1 else None
    f = Reader(filename)
    if f.file:
        while True:
            print "Case #%d\n"%f.case, solve(f)
            try:
                f.next_case()
            except StopIteration:
                break
    else:
        print solve(f)


Measured memory_bytes: 36072
#include<bits/stdc++.h>
#define rep(i,s,n) for(int i=s;i<n;i++)
using namespace std;
int d[10010],n,m,k,r,l;
int main(){while(1){cin>>n>>k>>m>>r;if(!(n+m+k+r))break;rep(i,0,r+9)d[i]=0;k=1,l=n;rep(i,0,r+9)d[i]+=k/l,k%=l,k*=10;if(m)rep(i,1,n){k=1,l=i*n;rep(j,0,r+9)d[j]+=k/l,k%=l,k*=10;}for(int i=r+9;i>0;i--)d[i-1]+=d[i]/10,d[i]%=10;cout<<d[0]<<".";rep(i,1,r+1)cout<<d[i];cout<<endl;}return 0;}

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

#define rep(i, n) REP(i, 0, n)
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(x) cout << x << endl;

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

    string a = "";
    string b = "";
    a += s[0];
    a += s[1];
    b += s[2];
    b += s[3];

    int ia = stoi(a);
    int ib = stoi(b);

    int cnt = 0;
    // MMYY
    if(
        1 <= ia && ia <= 12 &&
        0 <= ib && ib <= 99
    ) cnt++;
    // YYMM
    if(
        1 <= ib && ib <= 12 &&
        0 <= ia && ia <= 99
    ) cnt += 2;

    if(cnt == 0){
        OP("NA");
    }else if(cnt == 1){
        OP("MMYY");
    }else if(cnt == 2){
        OP("YYMM");
    }else{
        OP("AMBIGUOUS");
    }
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <string>
#include <vector>

#define rep(inc, bgn, end) for (int inc = bgn; inc < end; ++inc)
#define repe(inc, bgn, end) for (int inc = bgn; inc <= end; ++inc)

using ll = long long;
using namespace std;

int main() {
    int n, k;  // 1000
    cin >> n >> k;

    vector<int> value(n);
    rep(i, 0, n) {
        cin >> value[i];
    }

    sort(value.begin(), value.end());

    int ans = 0;
    rep(i, 0, k) {
        ans += value[i];
    }

    cout << ans << endl;
    return 0;
}


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

#define ld long double
#define ll long long
#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define spa << " " <<
#define MP make_pair
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
ll INF = 1e18;
void chmin(ll &a,ll b){if(a>b)a=b;}
void chmax(ll &a,ll b){if(a<b)a=b;}
void pmod(ll &a,ll b){a=(a+b)%MOD;}
void qmod(ll &a,ll b){a=(a*b)%MOD;}
void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
void ans(bool x,ll y,ll z){if(x)cout<<y<<endl;else cout<<z<<endl;}
void anss(bool x,string y,string z){if(x)cout<<y<<endl;else cout<<z<<endl;}   
ll gcd(ll x,ll y){ll r;while((r=x%y)!=0){x=y;y=r;}return y;}

int main(){
  ll i,j,o;
  ll res=0,res1=0,res2=INF,buf=0,buf1=0,buf2=0,buf3=0,buf4=0,sum=0;
  ll l,r;
  bool judge = true;
  ll n;cin>>n;
  set<ll>a;
  for(i=0;i<n;i++){
    cin>>buf;
    if(a.find(buf)==a.end()){
      res++;
      a.insert(buf);
    }
    else{
      res1++;
    }
  }
  cout<<res-res1%2<<endl;

  return 0;
}

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

int main() {
  char c;
  cin >> c;
  
  vector<char> data = {'a', 'i', 'u', 'e', 'o'};
  bool p = true;
  for (int i = 0; i < 5; i++) {
    if (c == data.at(i)) {
      cout << "vowel" << endl;
     p = false;
      break;
    }
  }
  if (p) {
      cout << "consonant" << endl;
  }
}



Measured memory_bytes: 256
n = int(input())
a = list(map(int,input().split()))
count=0
for i in range(len(a)):
  num = 0
  if i>0:
    if a[i-1]>a[i]:
      num =a[i-1]-a[i]
      count+=num
      a[i]=num+a[i]
      
print(count)

Measured memory_bytes: 32252
#include <bits/stdc++.h>
#define rep(i, a) for(int i = 0; i < a; i++)
#define all(v) v.begin(), v.end()
#define dcout cout << fixed << setprecision(15)
#define arep(i, a) for(auto i : a)
#define F first
#define S second
#define VE vector<int>
#define pb(x) push_back(x)
#define MOD 1000000007
#define INF 10000000000
#define int long long
#define KETA(n) floor(log10(n) + 1)
using namespace std;
signed main() {
    int a,b,c;
    cin>>a>>b>>c;
    if(b-a==c-b) cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
    return 0;
}

Measured memory_bytes: 256
def makelist2(n, m):
    return [[0 for k in range(m)] for i in range(n)]

n, m, c = map(int, input().split())
b = input().split()

a = makelist2(n, m)
for i in range(len(b)):
    b[i] = int(b[i])

for i in range(n):
    temp = input().split()
    for j in range(m):
        a[i][j] = int(temp[j])

ans = 0

for i in range(n):
    sum = 0
    for j in range(m):
        sum += a[i][j]*b[j]
    if(sum>(-1)*c):
        ans += 1


print(ans)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
using namespace std;
// using namespace _gnu_pbds;
#define vb __int128
#define ll long long
#define ld long double
#define full(a) a.begin(),a.end()
#define fr(i,a,b) for(ll i = a ; i < b ; i++)
#define stoink stack<ll>
#define quu queue<ll>
#define quee queue<pair<ll,ll>>
#define vec vector <ll>
#define vecd vector<ld>
#define vg vector<vector<ll> >
#define eg vector<pair<ll,ll>>
#define vgw vector<vector<pair<ll,ll> > >
#define pa pair<ll,ll>
#define pb push_back
#define ff first
#define ss second
#define pre 0.00000000000000000001
#define inf 100000000
#define mod 998244353
#define endl '\n'
    // gp_hash_table<ll, int,chash> dist;
// using namespace __gnu_pbds;
// ll power(ll x,ll exp)
// {ll res=1;while(exp>0){if(exp%2==1)res=((res%mod)*(x%mod)%mod);
// 	x=((x%mod)*(x%mod)%mod);exp=exp>>1;}return res;}
struct chash {
    const int RANDOM = (long long)(make_unique<char>().get()) ^ chrono::high_resolution_clock::now().time_since_epoch().count();
    static unsigned long long hash_f(unsigned long long x) {
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }
    static unsigned hash_combine(unsigned a, unsigned b) { return a * 31 + b; }
    int operator()(int x) const { return hash_f(x)^RANDOM; }
};
struct block {
    ll w,st,val;
    void read() {
        cin >> w >> st >> val;
    }
    bool operator < (const block &b) const {
        return w + st < b.w + b.st;
    }
};
int main()
{	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	ll n;
    cin >> n;
    vector<block> arr(n);
    ll maxi = 0;
    fr(i,0,n){
        arr[i].read();
        maxi = max(maxi,arr[i].st + arr[i].w);
    }
    vec dp(maxi + 1,0);
    sort(full(arr));
    for(auto i : arr) {
        for(ll w = min(i.st,maxi - i.w) ; w >= 0 ; w--){
            dp[w + i.w] = max(dp[w + i.w],dp[w] + i.val);
        }
    }
    ll ans = 0;
    fr(i,0,maxi + 1) {
        ans = max(ans,dp[i]);
    }
    cout << ans;
    return 0;
}	

Measured memory_bytes: 3720
// In the name of Allah. Ya ali!
#include<bits/stdc++.h>
#define double long double
#define debug(x)  cerr << #x << " = " << x << endl
typedef long long ll;
const ll MAX_N = 1e4+100;
const ll MOD = 1e9+7;
using namespace std;

int main()
{
    ll n;
    cin >> n;
    set<ll> divs;
    ll s = sqrt(n);
    for(ll i = 1;i<=s;++i)
    {
        if (n%i==0)
        {
            divs.insert(i);
            if (n/i!=i)
                divs.insert(n/i);
        }
    }
    ll ans = 0;
    for(auto x:divs)
    {
        ll t = n/x-1;
        if (t and n/t==n%t)
            ans+=t;
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
int main(){
  ll N,i,ans = 0,now = 0;scanf("%lld",&N);
  ll A[N];
  for(i=0;i<N;i++) scanf("%lld",&A[i]);
  now = A[N-1];
  for(i=N-2;i>=0;i--){
    ans = (ans+A[i]*now%mod)%mod;
    now = (now+A[i])%mod;
  }
  printf("%lld\n",ans);
}

Measured memory_bytes: 5372
import sys
import math
from collections import defaultdict

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N,num):
    if N<=0:
        return [[]]*num
    elif num==1:
        return [I() for _ in range(N)]
    else:
        read_all = [tuple(II()) for _ in range(N)]
        return map(list, zip(*read_all))

#################

N = I()

if N%2==1:
    print(0)
    exit()
else:
    ans = 0
    for i in range(1,31):
        ans += N//(5**i*2)

print(ans)

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

int main() {
  int X, A, B;
  scanf("%d",&X);
  scanf("%d",&A);
  scanf("%d",&B);
  int ans=X-A;
  while (ans>=B) {
    ans-=B;
  }
  printf("%d\n",ans);
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(void){
	int n;
	int m;
	char data;
	
	bool flg=false;
	while(1){
		cin>>n;
		char a[n+1],b[n+1];
		if(n==0){
			break;
		}
		for(int i=0;i<n;i++){
			cin>>a[i]>>b[i];
		}
		cin>>m;
		for(int i=0;i<m;i++){
			cin>>data;
			flg=false;
			for(int j=0;j<n;j++){
				if(data==a[j]&&!flg){
					data=b[j];
					flg=true;
				}
			}
			cout<<data;
		}
		cout<<endl;
	}
	return 0;
}

		


Measured memory_bytes: 3100
#include<iostream>
#include<string>
#include<iomanip>
using namespace std;
int main(){
	int a,b;
	while(cin>>a>>b){
		int x=a,y=b;
		while(true){
			if(x==y)
				break;
			if(x>y)
				x-=y;
			else if(y>x)
				y-=x;
		}
		cout<<x<<" ";
		int keep=x;
		x=a/keep;
		y=b/keep;
		cout<<x*y*keep<<endl;
	}
	return 0;
}

Measured memory_bytes: 1160
using System;
public class AprobC {
    public static void Main() {
        string read = Console.ReadLine();
        if (read == "a" | read == "i" | read == "u" | read == "e" | read == "o") {
            Console.WriteLine("vowel");
        } else {
            Console.WriteLine("consonant");
        }
    }
}

Measured memory_bytes: 2648
// inputに入力データ全体が入る
function Main(input) {
	// 1行目がinput[0], 2行目がinput[1], …に入る
	input = input.split("\n");
	x = parseInt(input[0])
	//文字列から10進数に変換するときはparseIntを使います
	
	m = 100
	n = 0

	while(1) {
		if (m>=x) {
			console.log(n);
			break;
		}
		n++;
		m = Math.floor(m*1.01)
	}

	
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 29660
import sys

args = []

for l in sys.stdin:
  args.append(l.strip('\n'))
  
names = args[1:]

focus_initial = 'MARCH'
initial_num = [0, 0, 0, 0, 0]
for name in names:
  for i in range(5):
    if focus_initial[i] == name[0]:
      initial_num[i] += 1
      
ct = 0
for i in range(5):
  for j in range(i+1, 5):
    for k in range(j+1, 5):
      ct += initial_num[i] * initial_num[j] * initial_num[k]

print(ct)

Measured memory_bytes: 10616
#include <iostream>
#include <sstream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <string>
#include <cstring>
#include <bitset>
#include <functional>
#include <random>
#define REP(i,a,n) for(int i=a;i<=n;++i)
#define PER(i,a,n) for(int i=n;i>=a;--i)
#define hr putchar(10)
#define pb push_back
#define lc (o<<1)
#define rc (lc|1)
#define mid ((l+r)>>1)
#define ls lc,l,mid
#define rs rc,mid+1,r
#define x first
#define y second
#define io std::ios::sync_with_stdio(false)
#define endl '\n'
#define DB(a) ({REP(__i,1,n) cout<<a[__i]<<' ';hr;})
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int P = 1e9+7, INF = 0x3f3f3f3f;
ll gcd(ll a,ll b) {return b?gcd(b,a%b):a;}
ll qpow(ll a,ll n) {ll r=1%P;for (a%=P;n;a=a*a%P,n>>=1)if(n&1)r=r*a%P;return r;}
ll inv(ll x){return x<=1?1:inv(P%x)*(P-P/x)%P;}
inline int rd() {int x=0;char p=getchar();while(p<'0'||p>'9')p=getchar();while(p>='0'&&p<='9')x=x*10+p-'0',p=getchar();return x;}
//head



const int N = 1e6+50;
int n, a[N], L[N], R[N];

int main() {
	scanf("%d", &n);
	REP(i,1,n) scanf("%d",a+i);
	REP(i,1,n) {
		L[i] = i-1;
		while (L[i]&&a[i]<a[L[i]]) L[i]=L[L[i]];
	}
	PER(i,1,n) {
		R[i] = i+1;
		while (R[i]<=n&&a[i]<a[R[i]]) R[i]=R[R[i]];
	}
	ll ans = 0;
	REP(i,1,n) ans += (ll)(R[i]-i)*(i-L[i])*a[i];
	printf("%lld\n", ans);
}








Measured memory_bytes: 9216
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>

using namespace std;
#define int long long int
const int INF = 1001001001001001LL;

int di[] = {-1, 0, 1, 0, -1, 1, 1, -1};
int dj[] = {0, 1, 0, -1, 1, 1, -1, -1};

void f(string s, vector<string> &sr, vector<string> &si){
    
    int mode = 0;
    string str = "";
    for(int i = 0; i < (int)s.size(); i++){
        if(s[i] == '\"'){
            if(mode == 0){
                sr.push_back(str);
            }else{
                si.push_back(str);
            }
            mode = (mode + 1) % 2;
            str = "";
        }else{
            str = str + s.substr(i, 1);
        }
    }
}

signed main(){
    
    while(1){
        string s; cin >> s;
        if(s == ".") break;
        string t; cin >> t;



        if(s == t){
            cout << "IDENTICAL" << endl;
            continue;
        }

        s = s + "\"";
        t = t + "\"";
        
        vector<string> sr;
        vector<string> si;
        vector<string> tr;
        vector<string> ti;

        f(s, sr, si);
        f(t, tr, ti);
        /*
        for(auto st : sr) cout << st << endl;
        cout << endl;
        for(auto st : si) cout << st << endl;
        cout << endl;
        for(auto st : tr) cout << st << endl;
        cout << endl;
        for(auto st : ti) cout << st << endl;
        */
        // お前さんは似ているのか?
        if(sr != tr || si.size() != ti.size()){
            cout << "DIFFERENT" << endl;
            continue;
        }
        
        int cnt = 0;
        for(int i = 0; i < (int)si.size(); i++){
            if(si[i] != ti[i]) cnt++;
        }

        if(cnt <= 1) cout << "CLOSE" << endl;
        else cout << "DIFFERENT" << endl;

    }
    return 0;
}



Measured memory_bytes: 3156
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin >> n;
	for (int i = 1; i <= sqrt(n); i++) {
		if (n % i == 0 && i <= 9 && n / i <= 9)
			return cout << "Yes", 0;
	}
	cout << "No";
	return 0;
}

Measured memory_bytes: 256
primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97]
prime_count = {}
n = int(input())

for i in range(1, n + 1):
    for prime in primes:
        if i < prime:
            break
        devided = i
        while devided % prime == 0:
            prime_count[prime] = prime_count.get(prime) + 1 if prime_count.get(prime) else 1
            devided /= prime

primes_2 = []
primes_4 = []
primes_14 = []
primes_24 = []
primes_74 = []
for k, v in prime_count.items():
    if v >= 74:
        primes_74.append(k)
    if v >= 24:
        primes_24.append(k)
    if v >= 14:
        primes_14.append(k)
    if v >= 4:
        primes_4.append(k)
    if v >= 2:
        primes_2.append(k)

count = 0

# a**2 * b**4 * c**4
count_primes_4 = len(primes_4)
for prime_2 in primes_2:
    if prime_2 in primes_4 and count_primes_4 >= 3:
        count += ((count_primes_4 - 1) * (count_primes_4 - 2)) // 2
    if prime_2 not in primes_4 and count_primes_4 >= 2:
        count += ((count_primes_4) * (count_primes_4 - 1)) // 2

# a**4 * b**14
count_primes_14 = len(primes_14)
for prime_4 in primes_4:
    if prime_4 in primes_14:
        count += count_primes_14 - 1
    else:
        count += count_primes_14

# a**2 * b**24
count_primes_24 = len(primes_24)
for prime_2 in primes_2:
    if prime_2 in primes_24:
        count += count_primes_24 - 1
    else:
        count += count_primes_24

# a**74
count += len(primes_74)

print(count)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i,l,n) for(int i=l;i<n;i++)
#define rer(i,l,n) for(int i=l;i<=n;i++)
#define all(a) a.begin(),a.end()
#define o(a) cout<<a<<endl
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int,int> pii;

int main(){
	int n,k,p;
	cin>>n;
	rep(i,0,n){
		cin>>k>>p;
		o((k%p==0?p:k%p));
	}
}

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

int main() {
  int N, K;
  double E_max = 0;
  cin >> N >> K;
  vector<double> p(N);
  for(int i = 0; i < N; i++) {
    cin >> p[i];
  }
  for(int j = 0; j < K; j++){
    E_max += 1. + p[j];
  }
  double E = E_max;
  for(int i = 1; i + K <= N; i++) {
    E += p[i + K - 1] - p[i - 1];
    if (E > E_max) {
      E_max = E;
    }
  }
  cout << fixed << setprecision(6);
  cout << E_max / 2.0 << endl;
  return 0;
}


Measured memory_bytes: 1792
// --------------------<optimizations>--------------------
#pragma GCC optimize("O3")

//(UNCOMMENT WHEN HAVING LOTS OF RECURSIONS)\
#pragma comment(linker, "/stack:200000000")
//(UNCOMMENT WHEN TRYING TO BRUTEFORCE WITH A LOT OF LOOPS)\
#pragma GCC optimize("unroll-loops")

// -------------------</optimizations>--------------------
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define d long double
#define pii pair<int,int>
#define pb push_back
#define pf push_front
#define cases int t;cin>>t;while(t--)
#define N 100003
#define M 103
#define inf LLONG_MAX
//int mod=1e9+7;
//int mod=998244353;

signed main()
{
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

    int n;
    cin>>n;
    string s[n+1];
    int i,j,ca=0,cb=0,cab=0,ans=0,cob,coa;
    for(i=1;i<=n;++i)
    {
        cin>>s[i];
        for(j=0;j<=s[i].length()-2;++j)
            if(s[i][j]=='A' and s[i][j+1]=='B')
                ++ans;
        if(s[i][0]=='B' and s[i][j]=='A')
            ++cab;
        else if(s[i][0]=='B')
            ++cb;
        else if(s[i][j]=='A')
            ++ca;
    }
    cob=cb,coa=ca;
    ans+=min(cb,ca);
    if(cab and (coa or cob))
        ans+=cab;
    else if(cab)
        ans+=cab-1;
    cout<<ans;



    return 0;
}


Measured memory_bytes: 768
#include <bits/stdc++.h> 
using namespace std; 
typedef long long int ll;
typedef long double ld;
typedef unsigned long long int ull;
const long long int m=pow(10,9)+7;

int main() 
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n,m;
    cin>>n>>m;
    vector<int>v;
    vector<int> number(n, -1);
	while (m--)
	{
		int s, c;
		cin>>s>>c;
		if (number[s-1]!=-1 && number[s - 1] != c) //checking for contradiction
		{
			cout<<"-1"<<endl;
			return 0;
		}
		number[s - 1] = c;
	}
	if (number[0]==0 && n!=1)
	{
		cout<<"-1"<<endl;
		return 0;
	}
	else
	{
		if(number[0] == -1) number[0]=(n>1);
		for(auto digit : number) 
		    cout<<max(digit,0);
	    cout<<endl;
	}
    return 0;
}

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

using namespace std;

#define all(x) x.begin(), x.end()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define reps(i, m, n) for (int i = m; i <= n; ++i)

using i64 = long long;
using pii = pair<i64, i64>;

template<class A, class B>inline bool chmax(A &a, const B &b){return b > a ? a = b,1 : 0;}
template<class A, class B>inline bool chmin(A &a, const B &b){return b < a ? a = b,1 : 0;}

constexpr int INF = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int MOD = int(1e9) + 7;

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

  int k, t;
  cin >> k >> t;

  int maxv = 0;
  rep(i, t) {
    int a;
    cin >> a;
    chmax(maxv, a - 1 - (k - a));
  }

  cout << maxv << "\n";

  return 0;
}

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

int main(void)
{
  int shain_num;
  
  cin >> shain_num;
  
  vector<int> buka_cnt(shain_num, 0);
  
  for(int i = 0; i < (shain_num-1); i++)
  {
  	int jousi_id;
    cin >> jousi_id;
    buka_cnt[jousi_id - 1]++;
  }
  
  for(int i = 0; i < buka_cnt.size(); i++)
  {
    cout << buka_cnt[i] << endl;
  }
  
  return 0;
}


Measured memory_bytes: 4060
#include <cstdio>
#include <iostream>

using namespace std;

int main(void) {
    string f;
    cin >> f;

    int n;
    cin >> n;

    int cnt = 0;
    for (int i = 0; i < n; i++) {
        string str;
        cin >> str;
        str += str;
        if (str.find(f) != std::string::npos) cnt++;
    }

    printf("%d\n", cnt);
    return 0;
}



Measured memory_bytes: 3284
#include <iostream>
using namespace std;
int main() {
char n[4];
cin >> n;
if ((n[0] == n[1] and n[1] == n[2]) or (n[1] == n[2] and n[2] == n[3])) {
	cout << "Yes" << endl;
} else {
	cout << "No" << endl;
}
}

Measured memory_bytes: 256
//-------------
//include
//-------------
#include <map>
#include <list>
#include <cmath>
#include <vector>
#include <string>
#include <cctype>
#include <random>
#include <cstdlib>
#include <iostream>
#include <algorithm>
using namespace std;
//-------------
//typedef
//-------------
typedef long long LL;
typedef  vector<int> VI;
typedef  pair<int, int> PII;
typedef  vector<int, int> VII;
typedef  map<string, int> MSI;
//-------------
//utillty
//-------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define MK make_pair
#define PB push_back
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
//-------------
//repetition
//-------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
//-------------
//debug
//-------------
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define dumpl(x) REP(i,SZ(x))cerr<<i<<x<<"="<<x[i]<<endl;
const int MOD = 1000000007;
int main()
{
	int a, b;
	cin >> a>> b;
	(a + b) > 9 ? cout<<"error"<<endl:cout << a + b << endl;
#ifdef _DEBUG
	while(1);
#endif
	return 0;
}

Measured memory_bytes: 256
from bisect import bisect_right

s = input()
t = input()
obj = {}

loop_num = 0
temp_num = -1

for i in range(len(s)):
    char = s[i]
    if not (char in obj):
        obj[char] = [i]
    else:
        obj[char].append(i)

for i in range(len(t)):
    char = t[i]
    if not (char in obj):
        loop_num = -1
        break
    else:
        next_index = bisect_right(obj[char], temp_num)
        if next_index == len(obj[char]):
            loop_num += 1
            temp_num = obj[char][0]
        else:
            temp_num = obj[char][next_index]

if(loop_num == -1):
    print(-1)
else:
    print(loop_num * len(s) + temp_num + 1)

Measured memory_bytes: 7540
def n_cand(x):
    return int(x*1.08)

n = int(input())

x = round(n / 1.08)
n_dash = n_cand(x)
n_dash_m = n_cand(x-1)
n_dash_p = n_cand(x+1)
if n_dash == n:
    print(x)
elif n_dash_m == n:
    print(x-1)
elif n_dash_p == n:
    print(x+1)
else:
    print(':(')

Measured memory_bytes: 9124
#include <bits/stdc++.h>
using namespace std;
int main(){
    long n;
    cin>>n;
    vector<long> a(n);
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    sort(begin(a),end(a));
    long first=0,last=a.size()-2;
    long left=a[last+1],right=a[last+1];
    long sum=0;
    a.pop_back();
    while(first<=last){
        long t1=max(abs(left-a[first]),abs(right-a[first]));
        long t2=max(abs(left-a[last]),abs(right-a[last]));
        if(t1>t2){
            sum+=t1;
            if(abs(left-a[first])>abs(right-a[first]))
                left=a[first];
            else
                right=a[first];
            first++;
        }
        else{
            sum+=t2;
            if(abs(left-a[last])>abs(right-a[last]))
                left=a[last];
            else
                right=a[last];
            last--;
        }
    }
    cout<<sum;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
// Macros for easier access
#define ll long long
#define endl '\n'
#define F first
#define S second
#define umap unordered_map
#define uset unordered_set
#define test ll cases; cin>>cases; for(ll testCase = 1; testCase <= cases; testCase++)   //test cases
#define fill(name, val) memset(name, val, sizeof(name));
#define mop(a, op, b)    (a%mod op b%mod)%mod
#define error(x) fixed<<setprecision(x) //cout<<error(5)<<someDouble    -> example - 3.14159
#define vll vector<ll>
#define vvll vector<vll>
#define pll pair<ll, ll>
#define get(a, n)    for(ll i = 0; i < n; i++)    cin>>a[i];
#define boost ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define debug(x) cerr << #x << " : " << (x) << endl
// Constants
#define MX 100001
#define mod 1000000007LL
#define inf 1000000000000000000LL
void init(){
	boost;
	#ifndef ONLINE_JUDGE
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif
}

/*	Author: 🆉🅴🅽🅾🅻🆄🆂	*/

int main(){
	init();
	string s, t;	cin>>s>>t;	ll ans = inf;
	for(ll i = 0; i <= s.length() - t.length(); i++){
		ll curr = 0;
		for(ll j = 0; j < t.length(); j++)	curr += (s[i+j] != t[j]);
		ans = min(ans, curr);
	}
	cout<<ans;
}

Measured memory_bytes: 3648