akhauriyash/Code-Regression huggingface dataset:
S = input()

l = len(S)

state = 'R'
edge = 0

for i in range(l):
    
    if S[i] == 'R' and state == 'R':
        pass
    elif S[i] == 'L' and state == 'R':
        lenR = i - edge
        edge = i
        state = 'L'
        print('0 ' * (lenR - 1), end = '')
    elif S[i] == 'L' and state == 'L':
        pass
    else:
        lenL = i - edge
        edge = i
        print('{:d} '.format((lenR+1)//2 + (lenL)//2), end = '')
        print('{:d} '.format((lenR)//2 + (lenL+1)//2), end = '')
        print('0 ' * (lenL - 1), end = '')
        state = 'R'

lenL = l - edge
print('{:d} '.format((lenR+1)//2 + (lenL)//2), end = '')
print('{:d} '.format((lenR)//2 + (lenL+1)//2), end = '')
print('0 ' * (lenL - 1), end = '')



Measured memory_bytes: 4848
N = gets.to_i
num = gets.strip.split.map(&:to_i)
i = 0
s = 0
while i < N do
  if num[i] != num.sort[i]
    s += 1
  end
i += 1
end
if s==2 || s==0
  puts "YES"
else
  puts "NO"
end

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

#define all(x)        (x).begin(),(x).end()
#define eb            emplace_back
#define mp            make_pair
#define pb            push_back
#define fi            first
#define se            second
#define sz(x)         ((int)(x).size())
#define rep(x,y,z)    for(int x=y;x<z;x++)
#define per(x,z,y)    for(int x=z-1;x>=y;x--)
#define trav(y,x)     for(auto& y:x)
#define pii           pair<int, int>
#define pll           pair<ll, ll>
#define vi            vector<int>
#define vll           vector<ll> 
#define vpi           vector<pii>

int dbg = 0;
#define cri           if(0)
#define shame         cri cerr<<(++dbg)<<"\n\n";

// aaaaaaaaaaaaaaaa
void solve() {
  int a,b; scanf("%d%d",&a,&b); printf("%d\n",a*b);
}

int main() {
  // int _; scanf("%d", &_); while (_--)
  // ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  // int _; cin >> _; while(_--)
  solve();
	return 0;
}


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

#ifdef LOCAL
#define DEBUG(...) debug(#__VA_ARGS__, __VA_ARGS__);
#else
#define DEBUG(...) 6;
#endif

template<typename T, typename S> ostream& operator << (ostream &os, const pair<T, S> &p) {return os << "(" << p.first << ", " << p.second << ")";}
template<typename C, typename T = decay<decltype(*begin(declval<C>()))>, typename enable_if<!is_same<C, string>::value>::type* = nullptr>
ostream& operator << (ostream &os, const C &c) {bool f = true; os << "["; for (const auto &x : c) {if (!f) os << ", "; f = false; os << x;} return os << "]";}
template<typename T> void debug(string s, T x) {cerr << s << " = " << x << "\n";}
template<typename T, typename... Args> void debug(string s, T x, Args... args) {cerr << s.substr(0, s.find(',')) << " = " << x << " | "; debug(s.substr(s.find(',') + 2), args...);}

int solve(long long a, long long k) {
    long long d = a / k;
    if (a % k == 0)
        return d;
    long long steps = max((a - d * k) / (d + 1), 1LL);
    return solve(max(a - steps * (d + 1), 0LL), k);
}

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

    int n;
    cin >> n;
    int ret = 0;
    for (int i=0; i<n; i++) {
        int a, k;
        cin >> a >> k;
        ret ^= solve(a, k);
    }
    cout << (ret ? "Takahashi" : "Aoki") << "\n";

    return 0;
}


Measured memory_bytes: 3692
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin>>N;
  set<string> s;
  for(int i=0;i<N;i++){
    string st;
    cin>>st;
    s.insert(st);
    }
  cout<<s.size();
  return 0;
}


Measured memory_bytes: 19204
import fractions
from functools import reduce
n = input()
x=[0]*int(n)
def lcm(a, b):
    return (a * b) // fractions.gcd(a, b)
def lcm_list(numbers):
    return reduce(lcm, numbers, 1)
for i in range(int(n)):
  x[i]=int(input())
  
print(lcm_list(x))

Measured memory_bytes: 5048
using System;

namespace AtCoder
{
    class Program
    {
        static void Main()
        {
            string[] input = Console.ReadLine().Split(' ');
            long a = long.Parse(input[0]);
            long b = long.Parse(input[1]);

            long x = a * b;

            if (a < b)
            {
                long temp = a;
                a = b;
                b = temp;
            }

            long r = a % b;
            while (r != 0)
            {
                a = b;
                b = r;
                r = a % b;
            }

            long result = x / b;

            Console.WriteLine(result);
        }
    }
}


Measured memory_bytes: 13140
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <iomanip>
#include <algorithm>
#include <sstream>
#include <string>
#include <math.h>
#include <set>
#include <deque>
#include <queue>
#include <list>
using namespace std;
typedef long long ll;
const int mod = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    int a, b;
    cin >> a >> b;
    cout << max(max(a + b, a - b), a * b);
}

Measured memory_bytes: 3600
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
 
int compare_int(const void *a, const void *b)
{
    return *(long long*)a - *(long long*)b;
}

int min_comp(int min, int a)
{

}
int max_comp(int max, int a)
{
  if(max>a)    return max;
  else    return a;
}


int main()
{
  int N;
  long long X[200001]={};
  long long Y[200001]={};
  long long temp = 0;
  long long mid0 = 0;
  long long mid1 = 0;
  int sel = 0;
  int cost_N = 0;
  int number;
  int debug_cnt;
//  long long N[101]={};
  int i,j;
  int cont;
//    int k=0;

  scanf("%d", &N);

  for(i=0;i<N;i++){
    scanf("%lld", &X[i]);
    Y[i] = X[i];
  }
  
  qsort(X, N, sizeof(long long), compare_int); 
 //   for(j=0;j<N;j++){
 //     printf("%lld  ", X[j]);
 //   }
  mid0 = X[(N-1)/2];
  mid1 = X[((N-1)/2)+1];
 //  printf(" %d %lld %lld\n", (N-1)/2,mid0,mid1);
  for(i=0;i<N;i++){
    if(mid0<Y[i]){
      printf("%lld\n", mid0);
    } else {
      printf("%lld\n", mid1);
    }
  }
//  X_mid = (X_sum - X[0]);
  //debug
//  printf("%lld\n", (X_mid/2));
  
  //  else printf("No\n"); 
return 0;
}


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

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  string ans = "No";
  if (a-b-c == 0) {
    ans = "Yes";
  } else if (b-c-a == 0) {
    ans = "Yes";
  } else if (c-a-b == 0) {
    ans = "Yes";
  }
  cout << ans << endl;
}

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

int main(){
    int x,y; cin >> x >> y;
    int ans = 0;
    if(x>0){
        if(y>0){
            if(x>y){
                ans++; // x -> -x
                ans += abs(x-y); // x -> -y
                ans++; // x-> y
            }else if(x < y){
                ans+= y-x; // x->y
            }
        }else if(y<0){
            if(abs(x) > abs(y)){
                ans++; // x->-x
                ans+= abs(x) - abs(y); // x->-y
            }else if(abs(x) < abs(y)){
                ans+= abs(y) - abs(x); // x->y
                ans++;   // x -> -y
            }else{
                ans++;
            }
        }else{
            ans++;
            ans+= x;
        }
    }else if(x<0){
        if(y>0){
            if(abs(x)>abs(y)){
                ans += abs(x) -abs(y);
                ans++;
            }else if(abs(x)<abs(y)){
                ans++;
                ans += abs(y) - abs(x);
            }else{
                ans++;
            }
        }else if(y<0){
            if(abs(x)>abs(y)){
                ans += abs(x) -abs(y);
            }else if(abs(x)<abs(y)){
                ans++;
                ans += abs(y) - abs(x);
                ans++;
            }
        }else{
            ans+=abs(x);
        }
    }else{
        if(y>0) ans+=y;
        else if(y<0) ans+= abs(y) + 1;
    }
    cout << ans << endl;
    return 0;
}

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

#define int long long
#define endl "\n"
#define MOD 1000000007
#define INF 1000000010
#define EPS 1e-9
#define fst first
#define scd second

#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define lp(i,n) rep(i,n)
#define repn(i,n) for(int i=n;i>=0;i--);

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

  int sum = 0;
  int ans = 0, hoge = 0;
  int n;

  cin>>n;

  for(int i = 1; ; i *= 3){ //cout<<i<<" "<<sum<<endl;

    sum += i + i*3;


    if(sum > n){
      //cout<<"hoge  "<<hoge<<endl;
      int con = 0;
      sum -= i*3 + i;
      //cout<<sum<<endl;
      int num =  n - sum;
      // cout<<n<<" "<<sum <<endl;
      //cout<<num<<endl;
                 int fuga = 1;

      while(num){

        if(fuga == i){
          // cout<<"fuga "<<fuga<<"num "<<num<<" con "<<con<<endl;
          con += num;

          break;
        }

        fuga *= 3;

        // cout<<"num "<<num<<" "<<num%3<<endl;
        con += num%3;
        num /= 3;
      }
                                       // cout<<"con "<<con<<endl;
      ans = con + hoge;
      break;
    }

    hoge += 2;
  }

  cout<<ans<<endl;

  return 0;
}


Measured memory_bytes: 3124
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <numeric>
#include <cstdlib>
#include <cmath>
#include <map>
#include <math.h>

using namespace std;

int main()
{
	int A, B, C;
	cin >> A >> B >> C;
	if (max(A, B) > C&&min(A, B) < C) cout << "Yes" << endl;
	else cout << "No" << endl;
}

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

#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define repn(i, n) for(int (i) = 1; (i) <= (n); (i)++)
#define repr(i, n) for(int (i) = (n-1); (i) >= 0; (i)--)
#define all(x) (x).begin(), (x).end()
#define lint long long
#define ulint unsigned long long
#define fi first
#define se second
#define setpre(x) cout << fixed << setprecision(x)
#define ii(x) int x; cin >> (x)
#define ii2(x, y) int x, y; cin >> (x) >> (y)
#define ii3(x, y, z) int x, y, z; cin >> (x) >> (y) >> (z)
#define out(x) cout << (x) << endl
#define yn(x) cout << ((x)?("Yes"):("No")) << endl
#define YN(x) cout << ((x)?("YES"):("NO")) << endl
#define bit_c(x) __builtin_popcountll(x)

inline void logger(){ cout << endl; }
template<typename A, typename... B>
void logger(const A& a, const B&... b){
    cout << a << " , ";
    logger(b...);
}

typedef pair<lint, lint> P;
const lint MOD = 1000000007;
const lint MOD9 = 998244353;
const lint INF = MOD * MOD;
const int MAX = 100005;

/* ...o(^-^)o... */

const int MAX_C = 100;
lint cmb[MAX_C][MAX_C];
void cmb_init(){
    cmb[0][0] = 1;
    repn(i, 50) rep(j, i+1){
        if(j == 0) cmb[i][0] = 1;
        else if(j == i) cmb[i][i] = 1;
        else cmb[i][j] = cmb[i-1][j-1] + cmb[i-1][j];
    }
}

lint dp[105][80000];

int main(){
    lint n; int k; cin >> n >> k;
    
    vector<lint> c;
    for(lint i = 1; i*i <= n; i++){
        lint j = n / i;
        c.push_back(i); c.push_back(j);
    }
    sort(all(c));
    int m = c.size();

    rep(j, m) dp[1][j] = c[j];
    for(int i = 2; i <= k; i++){
        rep(j, m){
            if(j == 0){
                dp[i][0] = dp[i-1][m-1];
                continue;
            }
            dp[i][j] = (dp[i][j-1] + ((c[j] - c[j-1]) * dp[i-1][m-j-1]) % MOD) % MOD;
        }
    }
    out(dp[k][m-1]);
}

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

int main()
{
  int h, w;
  cin >> h >> w;
  vector<vector<char>> a(h, vector<char>(w));
  int i, j;
  for(i = 0; i < h; i++)
  {
    for(j = 0; j < w; j++)
    {
      cin >> a.at(i).at(j);
    }
  }
  int count;
  vector<bool> checkh(h, false);
  vector<bool> checkw(w, false);
  for(i = 0; i < h; i++)
  {
    count = 0;
    for(j = 0; j < w; j++)
    {
      if(a.at(i).at(j) == '#') count++;
    }
    if(count == 0) checkh.at(i) = true;
  }
  for(i = 0; i < w; i++)
  {
    count = 0;
    for(j = 0; j < h; j++)
    {
      if(a.at(j).at(i) == '#') count++;
    }
    if(count == 0) checkw.at(i) = true;
  }
  for(i = 0; i < h; i++)
  {
    for(j = 0; j < w; j++)
    {
      if(checkh.at(i) == false && checkw.at(j) == false)
      {
        cout << a.at(i).at(j);
      }
    }
    if(checkh.at(i) ==false) cout << endl;
  }
}

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

using namespace std;

int main(){
	long a,b,k,resa,resb;
	cin >> a >> b >> k;
	resa = max((long)0,a-k);
	if(resa > 0)resb = b;
	else resb = max((long)0,b-(k-a));
	cout << resa << " " << resb << endl;
}

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

using namespace std;

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

#define MAX_N 100000

ll dp[MAX_N], h[MAX_N], N, K;

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

    cin >> N >> K;

    for (int i = 0; i < N; i++)
        cin >> h[i];

    dp[1] = abs(h[1] - h[0]), dp[0] = 0;

    for (int i = 2; i < N; i++) {
        dp[i] = LONG_LONG_MAX;

        for (int k = 1; k <= K and i - k >= 0; k++) {
            dp[i] = min(dp[i], dp[i - k] + abs(h[i] - h[i - k]));
        }
    }

    cout << dp[N - 1] << "\n";

    // --------------------
    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define rep(i,a) for(int i=0;i<int(a);++i)
#define REP(i,a,b) for(int i=int(a);i<int(b);++i)
using ll = long long;
using itn = int;
using namespace std;
int GCD(int a, int b){
    return b ? GCD(b, a%b) : a;
}
int main() {
	int n;
	cin >> n;
	int a[n];
	for(int i=0; i<n; i++){
		cin >> a[i];
	}
	int max = 0,second=0;
	for(int i=0; i<n; i++){
		if(a[i]>max){
			second = max;
			max = a[i];
		}else if(a[i]>second){
			second = a[i];
		}
	}
	for(int i=0; i<n; i++){
		if(a[i]==max) cout << second << endl;
		else cout << max << endl;
	}
}

Measured memory_bytes: 2432
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <numeric>
#include <tuple>
#include <stack>

#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define print(s) cout << s << endl
typedef long long ll;
using namespace std;

int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}

int main() {
	string s,t; cin >> s >> t;
	rep(i,3){
		if (s[i]!=t[2-i]){
			cout <<"NO" << endl;
			return 0;
		}
	}
	cout << "YES" << endl;
}

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

int n = 20;

vector<pair<pair<int, int> , int> > ed;

void aded(int a, int b, int c){
	ed.push_back(make_pair(make_pair(a, b), c));
}

int main(){
	aded(19, 20, 0);
	aded(19, 20, 1);
	aded(19, 20, 2);
	aded(19, 20, 3);
	f(i, 2, 19){
		int v = 20 - i;
		aded(v, v + 1, 0);
		aded(v, v + 1, 1 << i);
	}
	int l;
	scanf("%d", &l);
	if (l & 1)aded(1, 20, l - 1);
	if (l & 2)aded(1, 20, l - (l & 1) - 1), aded(1, 20, l - (l & 1) - 2);
	f(i, 2, 20)if (l >> i & 1)aded(1, 20 - i + 1, l ^ (l & (1 << i + 1) - 1));
	printf("%d %d\n", n, (int)ed.size());
	f(i, 0, ed.size())printf("%d %d %d\n", ed[i].first.first, ed[i].first.second, ed[i].second);
}

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

int mod_pow(int n, int e, int mod){
    int ans = 1;
    n = n % mod;
    while(e != 0){
        if(e % 2 == 1){
            ans = (ans * n) % mod;
        }
        e /= 2;
        n = (n * n) % mod;
    }
    return ans;
}

int mod_inv(int n, int mod){
    return mod_pow(n, mod-2, mod);
}

int mod_combination(int n, int k, int mod){
    if(n < k || k < 0) return 0;
    if(n-k < k) k = n-k;
    int ans = 1;
    for(int i=1; i<=k; i++){
        ans = (((ans * (n+1-i)) % mod) * mod_inv(i, mod)) % mod;
    }
    return ans;
}

signed main(){
    // cout << fixed << setprecision(10) << flush;

    int mod = 998244353;
    int n, m, k;
    cin >> n >> m >> k;

    int ans = 0;
    int combi = 1;
    if(m == 1){
        if(k == n-1){
            cout << 1 << endl;
        }
        else{
            cout << 0 << endl;
        }
        return 0;
    }
    int m_1_pow = mod_pow(m-1, n-1, mod);
    int m_1_inv = mod_inv(m-1, mod);
    for(int l=0; l<=k; l++){
        ans = (ans + (((combi * m_1_pow) % mod) * m) % mod) % mod;
        m_1_pow = (m_1_pow * m_1_inv) % mod;
        combi = (((combi * (n-1-l)) % mod) * mod_inv(l+1, mod)) % mod;
    }
    cout << ans << endl;

    return 0;
}

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

using ll = long long;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define ddrep(i, n) for (int i = n; i > 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define ssrep(i, s, t) for (int i = s; i <= t; ++i)

#define rng(a) a.begin(), a.end()
#define rrng(a) a.rbegin(), a.rend()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second

#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))

using pi = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using ld = long double;

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "{";
  rep(i, (int)v.size()) {
    if (i)
      os << ",";
    os << v[i];
  }
  os << "}";
  return os;
}

template <typename T, size_t S> void printArray(const T (&array)[S]) {
  for (auto val : array)
    std::cout << val << ", ";
  std::cout << "\n";
}

const int mod = 1e9 + 7;
const int inf = 1e9 + 5;

const int MAX = 1000'000+5;
int prime[MAX];
void init() {
  rep(i, MAX) prime[i] = i;
  for (int i = 2; i*i <= MAX; i++) {
    if (prime[i] != i) continue;
    for (int j = i*i; j < MAX; j+=i) {
      prime[j] = i;
    }
  }
}

struct mint {
  ll x;
  mint(ll x=0) : x(x%mod) {}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x -= a.x) < 0) x += mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) {
    mint res(*this);
    return res*=a;
  }
};

const int MOD_MAX = 1'000'000 + 5;
ll inv[MOD_MAX];
void initModDiv() {
  inv[1] = 1;
  srep(i, 2, MOD_MAX) {
    inv[i] = mod - inv[mod%i] * (mod / i) % mod;
  }
}

inline ll mypow(ll x, ll n) {
  if (n == 0) return 1;
  if (n % 2 == 0)
    return mypow(x * x % mod, n / 2);
  else
    return x * mypow(x, n - 1) % mod;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << std::setprecision(10);

  int n; std::cin >> n;
  vi a(n); rep(i, n) std::cin >> a[i];
  init();
  initModDiv();
  map<int, int> pcnt;
  rep(i, n) {
    map<int, int> tmp;
    int ai = a[i];
    while (ai != 1) {
      tmp[prime[ai]]++;
      ai /= prime[ai];
    }
    for (auto &p : tmp) {
      chmax(pcnt[p.fi], p.se);
    }
  }
  mint fact = 1;
  for (auto &p : pcnt) {
    fact *= mypow(p.fi, p.se);
  }
  mint ans = 0;
  rep(i, n) {
    ans += fact * inv[a[i]];
  }
  std::cout << ans.x << "\n";
}


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

using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    map<char, char> m;
    m['A'] = 'T';
    m['T'] = 'A';
    m['C'] = 'G';
    m['G'] = 'C';
    string s;
    cin >> s;
    for (char c : s) {
        cout << m[c];
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std; 
int main(){
	int N, M, V, P; 
	cin >> N >> M >> V >> P; 
	long long int A[100010] = {}; 
	for(int i = 0; i < N; i++){
		cin >> A[i]; 
	}
	sort(A, A+N, greater<int>()); 
	int ans = 0; 
	if(V <= P){
		for(int i = 0; i < N; i++){
			if(A[i] >= A[P-1] - M) ans ++; 
		}
	}
	else{
		int ok = 0; int ng = N; 
		while(ng - ok > 1){
			int mid = (ok + ng) / 2; 
			if(mid < P){
				ok = mid; continue; 
			}
          else if(A[mid] + M < A[P-1]){
           	 ng = mid; continue; 
          }
			long long sum = 0; 
			for(int j = P-1; j < mid; j++){
				sum += A[mid] + M - A[j]; 
			}
			if(sum >= (long long) M * ((long long) mid - P + 1 - N + V)) ok = mid; 
			else ng = mid; //cout << mid << " " << sum << endl; 
		}
		ans = ok + 1; //cout << mid << " " << sum << endl; 
	}
	cout << ans << endl; 
}

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

typedef long long ll;

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

	int ans=1e9;
	for (int i = -100; i <= 100; i++) {
		int sum=0;
		for (int j = 0; j < N; j++) {
			sum += (i-a[j])*(i-a[j]);
		}
		ans = min(ans,sum);
	}

	cout << ans << endl;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n,m) for(int i=n;i<(int)(m);i++)
#define rrep(i,n,m) for(int i=((int)(n)-1);i>=m;i--)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
using namespace std;
int main(){
    int a,b,c;
    cin>>a>>b>>c;
    cout<<(a==b&&b==c ? "Yes" : "No")<<endl;
}


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

int main()
{
	int64_t n, inf = (1LL << 60);
	cin >> n;
	vector<int64_t> as(n);
	for (auto &&a : as)
	{
		cin >> a;
	}

	reverse(as.begin(), as.end());

	vector<int64_t> dp(n, inf);

	for (auto &&a : as)
	{
		*upper_bound(dp.begin(), dp.end(), a) = a;
	}

	cout << distance(dp.begin(), lower_bound(dp.begin(), dp.end(), inf)) << endl;

	return 0;
}

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

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


Measured memory_bytes: 256
import java.util.Scanner;
import java.util.TreeSet;

public class Main {

	static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		int N = sc.nextInt();
		int[] A = new int[N];
		int[] P = new int[N + 1];
		for (int i = 0; i < N; ++i) {
			A[i] = Integer.parseInt(sc.next());
			P[A[i]] = i;
		}
		long ans = 0;
		TreeSet<Integer> used = new TreeSet<>();
		used.add(-1);
		used.add(N);
		for (int i = 1; i <= N; ++i) {
			int pos = P[i];
			int lo = used.lower(pos);
			int hi = used.higher(pos);
			ans += (long) i * (pos - lo) * (hi - pos);
			used.add(pos);
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 41548
//Utkarsh.25dec
#include <bits/stdc++.h>
#include <chrono>
#include <random>
#define ll long long int
#define ull unsigned long long int
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define rep(i,n) for(ll i=0;i<n;i++)
#define loop(i,a,b) for(ll i=a;i<=b;i++)
#define vi vector <int>
#define vs vector <string>
#define vc vector <char>
#define vl vector <ll>
#define all(c) (c).begin(),(c).end()
#define max3(a,b,c) max(max(a,b),c)
#define min3(a,b,c) min(min(a,b),c)
using namespace std;
ll power(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll modInverse(ll a){return power(a,mod-2);}
const int N=500023;
bool vis[N];
vector <int> adj[N];
void solve()
{
    ll n;
    cin>>n;
    vector <pair<string,ll>> v;
    for(int i=1;i<=n;i++)
    {
        string s;
        ll l;
        cin>>s;
        cin>>l;
        v.pb(mp(s,l));
    }
    string sleep;
    cin>>sleep;
    ll ans=0;
    ll start=0;
    for(int i=0;i<n;i++)
    {
        if(v[i].first==sleep)
        {
            start=i+1;
            break;
        }
    }
    for(int i=start;i<n;i++)
        ans+=v[i].second;
    cout<<ans;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int T=1;
    //cin>>T;
    int t=0;
    while(t++<T)
    {
        //cout<<"Case #"<<t<<":"<<' ';
        solve();
        //cout<<'\n';
    }
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
}

Measured memory_bytes: 12032
#include <bits/stdc++.h>
#define rep(i, n) for(long long int i = 0; i < n; i++)
#define _rep(i, m, n) for(long long int i = m; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int N = 1000000;
const ll mod = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

ll gcd(ll A, ll B){
    if(B == 0)return A;
    return gcd(B, A % B);
}
ll lcm(ll A, ll B){
    return A * B / gcd(A, B);
}

/*------------------------------------------------------------------*/


int main(){
    int n; cin >> n;
    vector<tuple<string,int,int>> s;
    rep(i, n){
        string a;
        int b;
        cin >> a >> b;
        s.emplace_back(a, 100- b, i + 1);
    }
    sort(s.begin(), s.end());
    rep(i, n) cout << get<2>(s[i]) << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n-1); i >= 0; i--)
#define all(v) (v).begin(),(v).end()
template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template <class T> T lcm(T a, T b) { return a/gcd(a,b)*b; }
typedef pair<int, int> P;
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;
const ll MOD = 1e9+7;

int main() {
	int k;
	cin >> k;
    ll ans = 0;
    rep(a,k) rep(b,k) rep(c,k) {
        ans += gcd(gcd(a+1, b+1), c+1);
    }
	cout << ans << "\n";
	return 0;
}


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

int main(void){
    char data[10];
    char maru[2] = "o";
    cin >> data;
    int kane = 0;
    for(int lop=0;lop<3;lop++){
        if(data[lop] == maru[0]){
            kane++;
        }
        
    }
    kane = kane *100 + 700;
    cout<< kane << "\n";
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long int mod = 1e9+7;
void pre(){}
void solve(){
    long long int n,k;cin>>n>>k;
    long long int arr[n];
    long long int dp[n+1][k+1];
    for(long long int i=0;i<=n;i++)for(long long int j=0;j<=k;j++)dp[i][j]=0;
    for(long long int i=0;i<n;i++)cin>>arr[i];
    for(long long int i=0;i<=k;i++) dp[0][i]=0;
    dp[0][0]=1;
    for(long long int i=1;i<=n;i++){
        long long int a = 0;
        long long int iter = 0;
        for(long long int j=0;j<=k;j++){
            a+=dp[i-1][j];
            a%=mod;
            iter++;
            if(iter>arr[i-1]+1){
                a=(mod+a-dp[i-1][j-arr[i-1]-1])%mod;
                iter--;
            }
            dp[i][j]=a%mod;
        }
    }
    cout<<dp[n][k]<<"\n";
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    pre();
    long long int num = 1;
    //cin>>num;
    for(long long int i=0;i<num;i++){
       	solve();
    }   
}


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

int main() {
  vector<int> ans(10);
  rep(i,4){
    int n;cin>>n;
    ans[n]++;
  }
    if(ans[1]==1&&ans[7]==1&&ans[9]==1&&ans[4]==1)cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
}

Measured memory_bytes: 3604
// Vicfred
// https://atcoder.jp/contests/abc153/tasks/abc153_a
// simulation
import std.stdio;

void main() {
    int h, a;
    readf("%s %s", &h, &a);

    int steps = 0;

    while(h > 0) {
        h -= a;
        steps += 1;
    }

    steps.writeln;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _CRT_SECURE_NO_WARNINGS
#define ll long long
#define BUF 50
#define INF 1<<30
using namespace std;
ll MOD = 1e9 + 7;
ll A, B, C, D, G, H, N, M, L, K, P, Q, R, W, X, Y, Z;
string S;
ll ans = 0;
void eratosthenes(set<int>&prime, int N) {
	vector<int>eratos(N + 1, 1);
	eratos[0] = 0; eratos[1] = 0;
	for (int i = 2; i <= N; i++) {
		if (eratos[i] == 0)continue;
		prime.insert(i);
		for (int j = i; i + j <= N; j += i) {
			eratos[i + j] = 0;
		}
	}
}
int main() {
	N = 1e5;
	set<int> prime;
	eratosthenes(prime, N);
	vector<int>N2017;
	for (auto i = prime.begin(); i != prime.end(); i++) {
		int tmp = (*i + 1) / 2;
		if (prime.count(tmp))N2017.push_back(*i);
	}
	cin >> Q;
	for (int i = 0; i < Q; i++) {
		int l, r;
		cin >> l >> r;
		ans = upper_bound(N2017.begin(), N2017.end(), r) - lower_bound(N2017.begin(), N2017.end(), l);
		cout << ans << endl;
	}
}

Measured memory_bytes: 1144
n=int(input())
s=list(input())

w=s.count('W')
e=s.count('E')
r_w=w
r_e=e
l_w=0
l_e=0
ans=n

for i in range(n):
    if s[i]=='W':
        r_w-=1
        tmp=l_w+r_e
        l_w+=1
    else:
        r_e-=1
        tmp=l_w+r_e
        l_e+=1
    if tmp<ans:
        ans=tmp
print(ans)

Measured memory_bytes: 5928
#include <iostream>
#include <vector>
#include <string>
#include <cstdlib>
 
using namespace std;

int main(){

int s,m,h;
cin>>s;
h=s/3600;
s-=h*3600;
m=s/60;
s-=m*60;
cout<<h<<":"<<m<<":"<<s<<endl;

}


Measured memory_bytes: 3088
#include <iostream>
#include <iomanip>
// std::cout << std::setprecision(2) << 3.141; // "3.1"
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <map>
// #include <bits/stdc++.h> all

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef pair<double, ll> pdlg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef tuple<double, double, double> tddd;

static const int giga = pow(10,9);
// double pi = 3.141592653589793238463;

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

  int top = 0;
  vector<pair<char,int>> counter(n, make_pair('a', 0));
  int index = 0;
 

  int i = 0;
  while(i < n){
    if(s[i] == s[top]){
      i++;
    } else {
      top = i;
      index++;
      i++;
    }
  }

 cout << index+1 << endl;

  return 0;
}


Measured memory_bytes: 1280
#include <bits/stdc++.h>
#define fto(i,j,h)   for (int i=j; i<=h; i++)
#define fdto(i,j,h)  for (int i=j; i>=h; i--)
#define ANH BAI1
#define maxn 109
#define ll long long
using namespace std;

int m, d;
int main()
{
    //freopen("ANH.inp", "r", stdin);
    //freopen("ANH.out", "w", stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    cin >> m >> d;
    int res = 0;
    fto(i,1,m)
      fto(j,1,d){
          int t1 = j/10,  t2 = j%10;
          if (t1 >= 2 && t2 >= 2 && t1*t2 == i)    ++res;
      }
    cout << res;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N=1e5+5;
int n,a[N],b[N];
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)scanf("%d",&a[i]);
	for(int i=1;i<n;i++)b[i]=a[i]*2-b[i-1];
	b[0]=a[n]-(b[0]+b[n-1])/2;
	for(int i=1;i<n;i++)b[i]=a[i]*2-b[i-1];
	for(int i=0;i<n;i++)printf("%d ",b[i]);
	return 0;
}

Measured memory_bytes: 2048
import sys
sys.setrecursionlimit(100000000)
def input():
    return sys.stdin.readline()[:-1]
from bisect import *
from collections import *
from heapq import *
from math import *
from copy import *

S = input()
if S == 'zyxwvutsrqponmlkjihgfedcba':
    print(-1)
    exit()
atoz = [chr(i) for i in range(97,97+26)]
N = len(S)
if N == 26:
    for i in range(N-1)[::-1]:
        if S[i] < S[i+1]:
            print(S[:i]+min([y for y in S[i+1:] if y > S[i]]))
            break
else:
    for c in atoz:
        if not c in S:
            print(S+c)
            break


Measured memory_bytes: 3572
#include <bits/stdc++.h>
#define forn(i,n) for(int i = 0; i < n; i++)
using namespace std;

int main(){

    map<string, int> mp;
    string day[] = {"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"};
    forn(i,7){
        mp[day[i]] = 7-i;
    }

    string inp;
    cin>>inp;

    cout<<mp[inp]<<endl;

    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.AccessControl;

class Program
{
	static void Main() => new Program().Solve();

	void Solve()
	{
		var n = ReadLong();
		var c = Console.ReadLine();
		var L = 0;
		var R = (int)n - 1;
		var cnt = 0;

		for (; true;) {
			for (; L < n && c[L] == 'R'; L++) ;
			for (; R >= 0 && c[R] == 'W'; R--) ;
			if (L < R) {
				L++;
				R--;
				cnt++;
			} else {
				break;
			}
		}
		Console.WriteLine(cnt);
	}

	#region Console.Read 関係
	long[] ReadLongArray() => Array.ConvertAll(Console.ReadLine().Split(), long.Parse);
	long ReadLong() => long.Parse(Console.ReadLine());
	#endregion
}



Measured memory_bytes: 28132
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;
typedef long long ll;

int main(){
    ll n;
    cin >> n;
    vector<pair<ll, ll>> a(n);
    for(int i = 0; i < n; ++i){
        ll ai;
        cin >> ai;
        a.at(i) = make_pair(ai, i);
    }
    sort(a.begin(), a.end());
    for(int i = 0; i < n; ++i){
        cout << a.at(i).second + 1;
        if(i < n - 1){
            cout << ' ';
        }
    }
    cout << endl;
    return 0;
}


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

typedef pair<int, int> ii;
typedef pair<int, ii> iii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef long long ll;
typedef long double ld;
typedef vector<ll> vll;
typedef pair<ll,ll> lll;

const ll MOD = 1000000007;
const ll INF = 1e9+5;
const double eps = 1e-7;
const double PI = acos(-1.0);

#define FOR(i,a,b) for(long long i = (long long)(a); i < (long long)(b); i++)
#define RFOR(i,a,b) for(long long i = (long long)(a); i >= (long long)(b); i--)
#define ull unsigned long long
#define deb(x )     cerr << #x << " = "<< x << endl;
#define endl    "\n"
#define coud(a,d) cout << fixed << showpoint << setprecision(d) << a;
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define fill(x, y) memset(x, y, sizeof(y))
#define all(x) (x).begin(), (x).end()

inline void debug_vi(vi a) {FOR(i, 0, a.size()) cout<<a[i]<<" ";}
inline void debug_vll(vll a) {FOR(i, 0, a.size()) cout<<a[i]<<" ";}
/*----------------------------------------------------------------------*/

const int M = 1e3+1;
int n,m,cost[M],sz,tmp;
int dp[M][(1<<12)+1];
vi openers[M];

int solve(int idx, int mask) {
	if(idx == m) {
		if(mask == (1 << n) - 1) return 0;
		return INF;
	}
	int &res = dp[idx][mask];
	if(res >= 0) return res;
	res = INF;

	res = solve(idx + 1, mask);
	for(int op : openers[idx]) {
		mask |= (1 << op);
	}
	res = min(res, cost[idx] + solve(idx + 1, mask));
	return res;
}

int main(){
    std::ios::sync_with_stdio(false);cin.tie(NULL); cout.tie(NULL);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
 	cin>>n>>m; memset(dp, -1, sizeof(dp));
 	FOR(i, 0, m) {
 		cin>>cost[i]>>sz;
 		FOR(j, 0, sz) {
 			cin>>tmp; tmp--;
 			openers[i].push_back(tmp);
 		}
 	}
 	int res = solve(0, 0);
 	if(res == INF) res = -1;
 	cout<<res;
    return 0;
}

Measured memory_bytes: 16384
#include<stdio.h>
#include<stdlib.h>
#include<string.h>


typedef struct tag_vertex_t
{
	int id, is_passed;
	int edge_num, *edge;
}vertex_t;


#define N_MAX 100000
#define M_MAX 100000

int n, m;
vertex_t vertex[N_MAX+1];
int result[N_MAX];
int result_num;


void result_init(void)
{
	result_num=0;
}


void result_push_back(int x)
{
	result[result_num++]=x;
}


void result_push_front(int x)
{
	memmove(result+1, result, sizeof(result[0])*result_num);
	result[0]=x;
	result_num++;
}


int result_pop_back(void)
{
	if(result_num<=0) return -1;
	return result[--result_num];
}


void edge_add(vertex_t *vert, int to)
{
	vert->edge=realloc(vert->edge, sizeof(int)*(vert->edge_num+1));
	vert->edge[vert->edge_num++]=to;
}


void vertex_zero(vertex_t *vert)
{
	vert->id=0;
	vert->is_passed=0;
	vert->edge_num=0;
	free(vert->edge);
	vert->edge=NULL;
}


int main(void)
{
	int a, b, i, c=0, s, e;

	while(scanf("%d%d", &n, &m)==2)
	{
		result_init();
		for(i=0;i<n;i++)
		{
			vertex_zero(&vertex[i]);
		}

		for(i=0;i<m;i++)
		{
			scanf("%d%d", &a, &b);
			edge_add(&vertex[a], b);
			edge_add(&vertex[b], a);
			c=a;
		}

		for(s=c;;)
		{
			result_push_front(s);
			vertex[s].is_passed=1;
			for(i=0;i<vertex[s].edge_num;i++)
			{
				if(vertex[vertex[s].edge[i]].is_passed) continue;
				break;
			}
			if(i>=vertex[s].edge_num) break;
			s=vertex[s].edge[i];
		}

		result_pop_back();
		for(e=c;;)
		{
			result_push_back(e);
			vertex[e].is_passed=1;
			for(i=0;i<vertex[e].edge_num;i++)
			{
				if(vertex[vertex[e].edge[i]].is_passed) continue;
				break;
			}
			if(i>=vertex[e].edge_num) break;
			e=vertex[e].edge[i];
		}

		printf("%d\n%d", result_num, result[0]);
		for(i=1;i<result_num;i++) printf(" %d", result[i]);
		printf("\n");
	}

	return 0;
}


Measured memory_bytes: 6656
#include <iostream>
#include <vector>
#include <set>
using i64 = long long;

int main() {
    int h, w, m;
    std::cin >> h >> w >> m;
    std::vector<int> rows(h);
    std::vector<std::vector<int>> bs(w);
    for (int i = 0; i < m; i++) {
        int p, q;
        std::cin >> p >> q;
        --p; --q;
        rows[p]++;
        bs[q].push_back(p);
    }

    std::multiset<int> s;
    for (const int e : rows) s.insert(e);

    int ret = 0;
    for (int i = 0; i < w; i++) {
        const int base = bs[i].size();
        for (const int x : bs[i]) {
            const int t = base + rows[x] - 1;
            if (t > ret) ret = t;
            s.erase(s.find(rows[x]));
        }
        if (!s.empty()) {
            const int t = base + *s.rbegin();
            if (t > ret) ret = t;
        }
        for (const int x : bs[i]) s.insert(rows[x]);
    }

    std::cout << ret << std::endl;

    return 0;
}


Measured memory_bytes: 34936
using System;
using System.Linq;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{
	    long n = IO.GetLong();
	    if(n%2==1){
	        Console.WriteLine(0);
	        return;
	    }
	    
	    long ans = 0;
	    long inc = 1;
	    long dC = 0;
	    
	    do{
	        long b = (long)Math.Pow(5,inc);
	        //5
	        dC = n/(2*b);
	        //dC = (long)Math.Floor((double)dC/2);
	        //Console.WriteLine("n:"+n+" b:"+b+" dC:"+dC);
	        ans += dC;
	        
	        inc++;
	    }
	    while(dC!=0 && inc!=26);
	    
	    Console.WriteLine(ans);
	}
    
}

static class IO
{
    static public string GetString() { return Console.ReadLine(); }
    static public int GetInt() { return int.Parse(Console.ReadLine()); }
    static public long GetLong() { return long.Parse(Console.ReadLine()); }
    static public List<string> GetStringList() { return Console.ReadLine().Split(' ').ToList(); }
    static public List<int> GetIntList() { return Console.ReadLine().Split(' ').Select(int.Parse).ToList(); }
    static public List<long> GetLongList() { return Console.ReadLine().Split(' ').Select(long.Parse).ToList(); }
    static public List<double> GetDoubleList() { return Console.ReadLine().Split(' ').Select(double.Parse).ToList(); }
    static public void WriteStrings<T>(IEnumerable<T> values) { foreach (var o in values) { Console.Write(o + " "); } }
}


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

typedef long long ll;
#define pii pair<int , int>
#define _FastIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define MAXX 1005

int n , s;
int h[MAXX];

int main()
{
    _FastIO;
    cin >> n;
    int m = 0;
    for(int i = 0; i < n; i++){
        cin >> h[i];
        if(m <= h[i]){
            s++;
            m = h[i];
        }
    }
    cout << s << endl;
    return 0;
}


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

const double Pi = acos(-1) ;

int main () {
  int N ;
  cin >> N ;
  int A[N] , B[N] ;
  for(int i = 0 ; i < N ; i++ ) cin >> A[i] ;
  for(int i = 0 ; i < N ; i++ ) cin >> B[i] ;
  double ans = 0 ;
  for(int i = 0 ; i < N ; i++ ) {
    ans += abs(A[i]-B[i]);
  }
  cout << fixed << setprecision(10) <<ans<< endl ;
  ans = 0 ;
  for(int i = 0 ; i < N ; i++ ) {
    ans += pow((A[i]-B[i]),2) ;
  }
  cout << fixed << setprecision(10) << sqrt(ans) << endl ;
  ans = 0 ;
  for(int i = 0 ; i < N ; i++ ) {
    ans += pow(abs(A[i]-B[i]),3) ;
  }
  cout << fixed << setprecision(10)<<pow(ans,0.33333333333333333333333333333333)<< endl ;
  ans = 0 ;
  for(int i = 0 ; i < N ; i++ ) {
    ans = max(abs(A[i]-B[i]),(int)ans) ;
  }
  cout << fixed << setprecision(10)<<ans<< endl ;

}


Measured memory_bytes: 3428
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vs = vector<string>;
using msi = map<string, int>;
using mii = map<int, int>;
using psi = pair<string, int>;
using pii = pair<int, int>;
using vlai = valarray<int>;
#define rep(i,n) for(int i=0;i<n;i++)
#define range(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 fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define INF 1E9
#define EPS 1E-9
#define MOD (1E9+7)
#define PI 3.1415926535897932384626433832795

struct node {
	int p = -1, s = -1, deg = 0, dep = -1, h = -1;
	vi c;
};

vector<node> G;

void setdepth(int n,int d) {
	G[n].dep = d;
	rep(i, G[n].c.size()) {
		setdepth(G[n].c[i], d + 1);
	}
}

int setheight(int n) {
	int maxh = -1;
	rep(i, G[n].c.size()) {
		G[G[n].c[i]].h = setheight(G[n].c[i]);
		maxh = max(maxh, G[G[n].c[i]].h);
	}
	return maxh+1;
}


int main() {
	int n,ina,inb,inc;
	cin >> n;
	G.resize(n);
	rep(i, n) {
		cin >> ina >> inb >> inc;
		if (inb != -1) {
			G[ina].c.push_back(inb);
			G[inb].p = ina;
		}		
		if (inc != -1) {
			G[ina].c.push_back(inc);
			G[inc].p = ina;
		}
		if (G[ina].c.size()==2) {
			G[inc].s = inb;
			G[inb].s = inc;
		}
	}
	rep(i, n) {
		if (G[i].p == -1) {
			setdepth(i,0);
			G[i].h = setheight(i);
		}
	}
	rep(i,n){
		//node 0: parent = -1, sibling = -1, degree = 2, depth = 0, height = 3, root
		cout << "node " << i << ": parent = " << G[i].p;
		cout << ", sibling = " << G[i].s;
		cout << ", degree = " << G[i].c.size();
		cout << ", depth = " << G[i].dep;
		cout << ", height = " << G[i].h<<", ";
		if (G[i].p == -1)cout << "root";
		else if (G[i].h == 0)cout << "leaf";
		else cout << "internal node";
		cout << endl;
	}
}


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

using namespace std;

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

#define REP(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, a, b) for(int i=(a); i<(b); ++i)
#define FORR(i, a, b) for(int i=(b)-1; i>=(a); --i)

#define DEBUG(x) cout<<#x<<": "<<x<<'\n'
#define DEBUG_VEC(v) cout<<#v<<":";REP(i, v.size())cout<<' '<<v[i];cout<<'\n'
#define ALL(a) (a).begin(), (a).end()

#define CHMIN(a, b) a=min((a), (b))
#define CHMAX(a, b) a=max((a), (b))

const ll MOD=1000000007ll;
// const ll MOD=998244353ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

const double EPS=1e-11;
#define EQ0(x) (abs((x))<EPS)
#define EQ(a, b) (abs((a)-(b))<EPS)

ll sum[214514];

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	ll a[214514];
	cin>>n;
	REP(i, n){
		cin>>a[i];
		sum[i+1]=sum[i]+a[i];
	}
	ll ans=1e18;
	REP(i, n-1){
		ans=min(ans, abs(sum[n]-2*sum[i+1]));
	}
	cout<<ans<<'\n';
	return 0;
}


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

typedef long long ll;

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl

const int maxn = 1e6 + 5;

int main() {
  ios_base::sync_with_stdio(false); cin.tie(0);  cout.tie(0);
  cout << fixed << setprecision(12);
  int n; cin>>n;
  vector<int> v(n); int tot=0;
  for (int i=0; i<n; i++) {
    cin>>v[i]; tot += v[i];
  }
  sort(v.begin(), v.end()); tot-=v.back();
  if (tot>v.back()) out("Yes");
  out("No");

  return 0;
}


Measured memory_bytes: 256
N = int(input())
A = list(map(int,input().split()))

act = 0
damm = True
while damm:
    act += 1
    for i in range(len(A)):
        if A[i]%2==0:
            A[i] = A[i]/2
        else:
            act -= 1
            damm = False
            break

print(act)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define rep(i,m,n) for(int i=m;i<n;i++)
ll mod=1e9+7;

int main(){
  int k;
  cin>>k;
  ll ans=0;
  rep(i,1,k+1){
    rep(j,1,k+1){
      rep(l,1,k+1){
        ans+=gcd(i,gcd(j,l));
      }
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3636
#include<stdio.h>
#include<algorithm>
#include<string.h>
#include<string>
#include<math.h>
#include<stdlib.h>
#include<time.h>
#include<map>
#include<queue>
#include<set>
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fd(i,a,b) for(int i=a;i>=b;i--)
using namespace std;
int n,a[110000],b[110000],c[110000],p,q;
long long ans;
int main(){
	scanf("%d",&n);
	fo(i,1,n) scanf("%d",&a[i]);
	fo(i,1,n) scanf("%d",&b[i]);
	fo(i,1,n) scanf("%d",&c[i]);
	sort(a+1,a+n+1);
	sort(b+1,b+n+1);
	sort(c+1,c+n+1);
	p=0;q=1;
	fo(i,1,n){
		while (p<n&&a[p+1]<b[i]) p++;
		while (q<=n&&c[q]<=b[i]) q++;
		ans+=p*(long long)(n-q+1);
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
#define mp make_pair
// GCD inbuilt func: __gcd(a,b)
// LCM formula: (a*b)/__gcd(a,b)

int main(){
	ios::sync_with_stdio(false);
    cin.tie(NULL);
	// CODE goes here
	int n;
	cin >> n;
	ll a[n];
	ll ans=0;
	for(int i=0;i<n;i++) cin >> a[i];
	for(int i=1;i<n;i++){
		if(a[i-1]>a[i]){
			ans+=(a[i-1]-a[i]);
			a[i]=a[i-1];
		}
	}
	cout << ans;
	return 0;
}


Measured memory_bytes: 5256
#include<stdio.h>
#include<string.h>
int main()
{
    char s[100000];
    scanf("%s", s);
    int l, i, j;
    l = strlen(s);
    for(i=0;i<l;i++)
    {
        int count = 1;
        for(j=i+1;j<l;j++)
        {
            if(s[i] >= 'a' && s[i] <= 'z')
            {
                if(s[i] == s[j])
                {
                    count++;
                    s[j] = '0';
                }
            }
        }
        if(s[i] >= 'a' && s[i] <= 'z')
        {
            if(count%2 != 0)
            {
                printf("No\n");
                return 0;
            }
        }
    }
    printf("Yes\n");
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include<string>
using namespace std;
int main() {
	string A, B, C;
	cin >> A >> B >> C;
	int Acount=0, Bcount=0, Ccount = 0;
	int Turn = 0;
	while (true) {
		if (Turn == 0) {
			if (Acount == A.size()) {
				cout << 'A' << endl;
				break;
			}
			else {
				if (A[Acount] == 'b') {
					Turn = 1;
				}
				else if (A[Acount] == 'c') {
					Turn = 2;
				}
				Acount++;
			}
		}
		else if (Turn == 1) {
			if (Bcount == B.size()) {
				cout << 'B' << endl;
				break;
			}
			else {
				if (B[Bcount] == 'a') {
						Turn = 0;
				}
				else if (B[Bcount] == 'c') {
						Turn = 2;
				}
				Bcount++;
			}
		}
		else {
			if (Ccount == C.size()) {
				cout << 'C' << endl;
				break;
			}
			else {
				if (C[Ccount] == 'a') {
					Turn = 0;
				}
				else if (C[Ccount] == 'b') {
					Turn = 1;
				}
				Ccount++;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 256