akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Main
{
    public static class Program
    {

        static void Main(string[] arg)
        {
            var answer = 0;
            var line = GetIntList(Console.ReadLine());
            var linesmall = GetIntList(Console.ReadLine());
            int a = line[0];
            int b = line[1];
            int All_cell = a * b;
            int vertical = b * linesmall[0];
            int horizontal = a * linesmall[1];
            answer = All_cell - vertical - horizontal + (linesmall[0] * linesmall[1]);



            Console.WriteLine(answer);
            Console.ReadLine();

        
        }
        #region libraries
        private static int[] GetIntList(string line)
        {
            return line.Split(' ').Select(x => int.Parse(x)).ToArray();

        }
        private static double[] GetDoubleList(string line)
        {
            return line.Split(' ').Select(x => double.Parse(x)).ToArray();

        }
        private static int SearchNearest(this IEnumerable<int> list, int target)
        {
            var min = list.Min(c => Math.Abs(c - target));
            return list.First(c => Math.Abs(c - target) == min);
        }
        public static int Gcd(int a,int b)
        {
            if(a < b)
            {
                Gcd(b, a);
            }
            while (b != 0)
            {
                var rm = a % b;
                a = b;
                b = rm;
            }
            return a;
        }
        #endregion
    }
}


Measured memory_bytes: 13268
/*
5
52 67 72 25 79
*/
#include <bits/stdc++.h>
using namespace std;
void print() { cout << '\n'; } template<class T, class ...U> void print(T x, U ...y){ cout << x << ' '; print(y...); }
typedef long long ll; const int N = 2e5 + 5, M = 1e9 + 7; typedef vector<int> vi; typedef vector<vi> vii; void Main();
int main(int argc, char **argv) {
  ios::sync_with_stdio(0), cin.tie(0); cout << setprecision(10) << fixed;
  #ifdef Zmm
  freopen((string(*(argv)).substr(2, string(*(argv)).size() - 6) + string(".cpp")).c_str(), "r", stdin); string x; cin >> x;
  #endif
  Main();
}

ll qpow(ll a, ll b) {
  ll ans = 1;
  while (b) {
    if (b & 1) ans = ans * a % M;
    a = a * a % M, b >>= 1;
  }
  return ans;
}


ll a[N];
void Main() {
  int n;
  cin >> n;
  ll sum = 0;
  for (int i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n);
  reverse(a, a + n);
  ll x = qpow(2, n * 2 - 1), y = x * 500000004 % M;
  for (int i = 0; i < n; i++) {
    sum = (sum + x * a[i]) % M;
    x = (x + y) % M;
  }
  cout << sum << '\n';
  // for (int n = 1; n <= 6; n++) {
  //   memset(a, 0, sizeof a);
  //   for (int i = 0; i < (1 << n); i++) {
  //     for (int j = 0; j < (1 << n); j++) {
  //       int cnt = 0;
  //       for (int k = 0; k < n; k++) {
  //         if(((i >> k) & 1) != ((j >> k) & 1)) {
  //           cnt++;
  //         }
  //       }
  //       for(int k = 0; k < n; k++) {
  //         if(((i >> k) & 1) != ((j >> k) & 1)) {
  //           a[k] += cnt;
  //           cnt--;
  //         }
  //       }
  //     }
  //   }
  //   for(int k = 0; k < n; k++) {
  //     cout << a[k] << " \n"[k + 1 == n];
  //   }
  // }
}

Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>

using namespace std;

inline int parse(const string& s)
{
    const int hour = stoi(s.substr(0, 2));
    const int minute = stoi(s.substr(3, 2));
    const int second = stoi(s.substr(6, 2));
    return hour * 3600 + minute * 60 + second;
}

int main()
{
    while (true) {
        int n;
        cin >> n;
        if (n == 0) {
            break;
        }
        using P = pair<int, int>;
        vector<P> train(n);
        vector<int> number(n, -1);
        for (int i = 0; i < n; i++) {
            string s, e;
            cin >> s >> e;
            train[i] = make_pair(parse(s), parse(e));
        }
        sort(train.begin(), train.end());
        int numbered = 0;
        int num = 0;
        while (numbered < n) {
            int start = 0;
            for (int i = 0; i < n; i++) {
                if (train[i].first >= start and number[i] == -1) {
                    number[i] = num;
                    numbered++;
                    start = train[i].second;
                }
            }
            num++;
        }
        cout << num << endl;
    }
    return 0;
}

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

#define LEN 100005

typedef struct pp {
    char name[100];
    int t;
} P;

P Q[LEN];
int head, tail, n;

void enqueue(P x) {
    Q[tail] = x;
    tail = (tail + 1) % LEN;
}

P dequeue() {
    P x = Q[head];
    head = (head + 1) % LEN;
    return x;
}

int min(int a, int b) {return a < b ? a : b; }

int main(void){
    int elaps = 0, c;
    int q;
    P u;
    cin >> n >> q;
    
    for (int i = 0; i < n; i++) {
        cin >> Q[i].name >> Q[i].t;
    }
    head = 0; tail = n;
    
    while ( head != tail ) {
        u = dequeue();
        c = min(q, u.t);
        u.t -= c;
        elaps += c;
        if ( u.t > 0) enqueue(u);
        else {
            cout << u.name << " " << elaps << endl;
        }
    }
}



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

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

	std::vector<int> a(n);
	for (auto&& e : a)
		std::cin >> e;

	std::vector<int> ans(n);
	for (int i = n - 1; i >= 0; --i) {
		ans[i] = a[i];
		for (int j = (i + 1) * 2; j <= n; j += i + 1)
			if (ans[j - 1] == 1)
				ans[i] = -ans[i] + 1;
	}

	std::cout << std::count(ans.begin(), ans.end(), 1) << std::endl;
	bool isFirst = true;
	for (int i = 0; i < n; ++i) {
		if (ans[i] == 1) {
			if (!isFirst)
				std::cout << " ";

			isFirst = false;
			std::cout << i + 1;
		}
	}
	std::cout << std::endl;
}

Measured memory_bytes: 2432
#include <algorithm>
#include <iostream>

using namespace std;

int main() {
  int n, l;
  string ss[110];

  cin >> n >> l;
  for (int i = 0; i < n; i++) {
    cin >> ss[i];
  }

  sort(ss, ss + n);

  for (int i = 0; i < n; i++) {
    cout << ss[i];
  }
  cout << endl;

  return 0;
}


Measured memory_bytes: 3104
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
const int mod = 1e9+7;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;
vector<pair<int,int>> v[100010];
int main(){
    cout << fixed << setprecision(10);
    int n,m;
    cin >> n >> m;
    vector<int> p(m,0), y(m,0);
    rep(i,m) cin >> p[i] >> y[i];
    rep(i,m){
        v[p[i]].push_back(make_pair(y[i],i));
    }
    vector<pair<int,int>> ans(m); 
    for(int i=0; i < 100010; i++){
        sort(v[i].begin(),v[i].end());
        for(int j=0;j < v[i].size(); j++){
            ans[v[i][j].second] = make_pair(i, j+1);
        }
    }
    rep(i,m){
        cout << setw(6) << setfill('0') << ans[i].first << setw(6) << setfill('0') << ans[i].second  << setprecision(6) << endl;
    }
    return 0;
}

Measured memory_bytes: 10400
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int a[32]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    int b;
    cin >> b;
    cout << a[b-1];
    return 0;
}


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

int main() {
  string S;
  cin>>S;
  int64_t N=S.size(),A=0,Z=0,i=1;
  while(i<N){
    if(S.at(i-1)=='A'){
    A++;
  }
    else if(S.at(i)=='C'&&S.at(i-1)=='B'){
      Z+=A;
      i++;
    }
    else{
      A=0;
  }
    i++;
  }
  cout<<Z<<endl;
}

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

const int mod = 1000000007;
struct mint {
    long long x;
    mint(long long x=0):x((x%mod+mod)%mod){}
    mint operator-() const { return mint(-x);}
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod-a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
    mint operator+(const mint a) const { return mint(*this) += a;}
    mint operator-(const mint a) const { return mint(*this) -= a;}
    mint operator*(const mint a) const { return mint(*this) *= a;}
    mint pow(long long t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }
    mint inv() const { return pow(mod-2);}
    mint& operator/=(const mint a) { return *this *= a.inv();}
    mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

struct combination {
    vector<mint> fact, ifact;
    combination(int n):fact(n+1),ifact(n+1) {
        assert(n < mod);
        fact[0] = 1;
        for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
        ifact[n] = fact[n].inv();
        for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
    }
    mint operator()(int n, int k) {
        if (k < 0 || k > n) return 0;
        return fact[n]*ifact[k]*ifact[n-k];
    }
};

void Main()
{
    long n, k;
    cin >> n >> k;
    combination C(n);
    mint ans = 0;
    for (int i = 0; i <= min(n-1, k); i++)
    {
        ans += C(n-1, i) * C(n, i);
    }
    
    cout << ans << endl;

    // i: 空き部屋の数
    // i = 0 .. n-1
    // sum_m (n-i)^i * nCi
    // sum_m (n-i)Hi * nCi
    // sum_m (n-i)+i-1Ci * nCi
    // sum_m (n-1)Ci * nCi

    // n 種類のものから重複を許して r 個選ぶ場合の数は
    // nHr = (n+r-1)Cr
}

int main(int argc, char **argv)
{
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    Main();
    return 0;
}


Measured memory_bytes: 6360
#include <bits/stdc++.h>
using namespace std;
using P=pair<int,int>;

int main() {
int x,n;
cin >> x >> n;
vector<int> d(102);
for(int i=0;i<n;i++){
	int p;
	cin >> p;
	d[p]=1;
}
P ans(99999,-1);
for(int i=0;i<=101;++i){
	if(d[i] == 1)continue;
	int dif = abs(x-i);
	ans = min(ans,P(dif,i));
}
cout << ans.second<<endl;
return 0;
}


Measured memory_bytes: 3620
#pragma GCC optimize(2)
//#include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
#include <bitset>
#include <string>
#include <set>
#include <stack>
#include <sstream>
#include <list>
//#include <array>
#include <vector>
#include <queue>
#include <map>
#include <memory>
#include <iterator>
#include <climits>
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
using namespace std;
#define FAST_IO ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef unsigned int UINT;
typedef unsigned long long ull;
typedef pair<int, int> pdi;
typedef pair<ll, int> pli;

int const maxn = 1e5 + 10;
const int INF = 0x3f3f3f3f;
const ll INFL = 0x3f3f3f3f3f3f3f3f;
inline int lc(int x)  {return x << 1;}
inline int rc(int x)  {return x << 1 | 1;}


char s[maxn];
int main(void) {
    FAST_IO;
    
    scanf("%s", s);
    int n = strlen(s);
    deque<char> q;
    for (int i = 0; i < n; i++) {
        q.push_back(s[i]);
    }
    int Q;
    int cnt = 0;
    scanf("%d", &Q);
    while (Q--) {
        int t, f;
        char c[3];
        scanf("%d", &t);
        if (t == 1) {
            cnt++;
        } else {
            scanf("%d %s", &f, c);

            if (f == 1 && (cnt & 1) == 0) q.push_front(c[0]);
            else if (f == 1) q.push_back(c[0]);
            if (f == 2 && (cnt & 1) == 0) q.push_back(c[0]);
            else if (f == 2) q.push_front(c[0]);
        }
    }
    if (cnt % 2) {
        reverse(q.begin(), q.end());
    }
    for (auto & x: q) {
        printf("%c", x);
    }
    puts("");
    
    return 0;
}


Measured memory_bytes: 1024
using System;

namespace AtCoder.ABC._123
{
    class c
    {
        static void Main(string[] args)
        {
            var line = Console.ReadLine().Trim();
            var N = long.Parse(line);
            long[] time = new long[5];
            for (var i = 0; i < 5; i++)
            {
                line = Console.ReadLine().Trim();
                time[i] = long.Parse(line);
            }
            var min = time[0];
            for(var i = 1; i < 5; ++i)
            {
                if(min > time[i])
                {
                    min = time[i];
                }
            }
            Console.WriteLine(((long)(Math.Ceiling((double)N/min) + 4)).ToString("D"));
        }
    }
}


Measured memory_bytes: 11092
#include <cstdio>

int main() {
  int a,b,c,d,e,f;
  while(scanf("%d %d %d %d %d %d", &a, &b, &c, &d, &e, &f) != EOF) {
    double x,y;
    y = (c*d - a*f)*1.0/(b*d - a*e);
    x = (c - b*y)/a;
    printf("%.3lf %.3lf\n", x, y);
  }
  return 0;
  
}

Measured memory_bytes: 2664
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <stdio.h>
using namespace std;
#define int long long
int MOD = 1000000007;
vector<int> A;
int N, K, Q;
bool ok(int mn, int mx) {
	int c = 0;
	int cc = 0;
	int kk = 0;
	for (int i = 0; i <= N; i++) {
		if (A[i] < mn) {
			cc += max((int)0, min(kk, c - K + 1));
			c = 0;
			kk = 0;
		}
		else {
			c++;
			if (A[i] > mx) {

			}
			else {
				kk++;
			}
		}
	}
	return cc >= Q;
}
signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cin >> N >> K >> Q;
	A.resize(N);
	int res = (int)1 << 60;
	for (int i = 0; i < N; i++) {
		cin >> A[i];
	}
	A.push_back(-1000);

	for (int i = 0; i < N; i++) {
		int mx = A[i] + 1000000001;
		int mn = A[i] - 1;
		int m;
		while (mx - mn > 1) {
			m = (mx + mn) / 2;
		
			if (ok(A[i], m)) {
				mx = m;
			}
			else {
				mn = m;
			}
		}
		//cerr << i << " " << mx - A[i] << endl;
		res = min(mx - A[i], res);
	}
	cout << res << endl;
}

Measured memory_bytes: 384
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cassert>
#include <iostream>
#include <iomanip>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <bitset>

#define all(c) c.begin(), c.end()
#define rall(c) c.rbegin(), c.rend()
#define debug(x) cerr << #x << ": " << x << endl

using namespace std;

typedef long long ll;
typedef pair<ll, ll> Pll;
typedef pair<int, int> Pii;

const ll MOD = 1000000007;
const long double EPS = 1e-10;
const int dyx[4][2] = {
    { 0, 1}, {-1, 0}, {0,-1}, {1, 0}
};

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

    cout << 0 << endl;
    string s, s0;
    cin >> s0;
    if(s0[0] == 'V') return 0;
    
    int ok = 0, ng = n, mid;
    while(ng-ok > 1) {
        mid = (ok+ng)/2;
        cout << mid << endl;
        cin >> s;
        if(s[0] == 'V') return 0;

        if((mid % 2 == 1) ^ (s[0] == s0[0])) {
            ok = mid;
        } else {
            ng = mid;
        }
    }

    return 0;
}


Measured memory_bytes: 852
#include <stdio.h>

int min(int, int, int);

int main(void) {
  int a, b, ab, a_needs, b_needs;
  int tampin, all_ab, tochu;
  scanf("%d %d %d %d %d", &a, &b, &ab, &a_needs, &b_needs);
  tampin = a * a_needs + b * b_needs;
  if (a_needs > b_needs) {
    all_ab = a_needs * ab * 2;
    tochu = b_needs * ab * 2 + (a_needs - b_needs) * a;
  } else {
    all_ab = b_needs * ab * 2;
    tochu = a_needs * ab * 2 + (b_needs - a_needs) * b;
  }
  printf("%d\n", min(tampin, all_ab, tochu));
  return 0;
}

int min(int a, int b, int c) {
  if (a < b) {
    if (a < c) return a;
    else return c;
  } else {
    if (b < c) return b;
    else return c;
  }
}


Measured memory_bytes: 128
n, s = [int(input()) for _ in range(2)]
def f(b, n):
    if n < b:
        return n
    return f(b, n // b) + n % b

if n == s:
    print(n + 1)
    exit()

for i in range(2, int(n ** .5) + 1):
    if s == f(i, n):
        print(i)
        exit()

for i in reversed(range(1, int(n ** .5) + 1)):
    b = (n - s) // i + 1
    if b > 1 and s == f(b, n):
        print(b)
        exit()
print(-1)

Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define POP pop_back()
#define ll long long
#define db double
#define POP pop_back()
#define endl '\n'
const int maxn = 1e5 + 5;
const int inf = 0x3f3f3f3f;
const int mod = 1e9 + 7;
struct edg{
	int to , nxt;
};
struct node{
	int e , s;
};
edg e[maxn];
int head[maxn] , in[maxn] , s[maxn];
int main(){
	int n , m;cin >> n >> m;
	int u , v;
	for(int i = 1;i <= m;i++){
		scanf("%d%d",&u,&v);
		e[i].nxt = head[u];
		e[i].to = v;
		head[u] = i;
		in[v]++;
	}
	queue<node>q;
	for(int i = 1;i <= n;i++){
		if(in[i] == 0)q.push((node){i,0});
	}
	node now;
	while(!q.empty()){
		now = q.front() , q.pop();
		for(int i = head[now.e];i != 0;i = e[i].nxt){
			in[e[i].to]--;
			s[e[i].to] = max(s[e[i].to] , now.s+1);
			if(in[e[i].to] == 0)q.push((node){e[i].to , s[e[i].to]});
		}
	}
	int ans = 0;
	for(int i = 1;i <= n;i++)ans = max(ans , s[i]);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 5928
#include <cstdio>
#include <algorithm>

const int N = 2e5 + 5;
int n, a[N], mn, ans = 0;
int main() {
    scanf("%d", &n);
    for (int i = 1; i <= n; ++i )
        scanf("%d", a + i);
    mn = a[1];
    for (int i = 1; i <= n; ++i ) {
        if( a[ i ] <= mn )
            ++ans;
        mn = std ::min(mn, a[i]);
    }
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
#define FOR(i, x, y) for (decay<decltype(y)>::type i = (x), _##i = (y); i < _##i; ++i)
#define FORD(i, x, y) for (decay<decltype(x)>::type i = (x), _##i = (y); i > _##i; --i)
#ifdef zerol
#define dbg(args...) do { cout << "DEBUG: " << #args << " -> "; err(args); } while (0)
#else
#define dbg(...)
#endif
void err() { cout<< endl; }
template<template<typename...> class T, typename t, typename... Args>
void err(T<t> a, Args... args) { for (auto x: a) cout << x << ' '; err(args...); }
template<typename T, typename... Args>
void err(T a, Args... args) { cout << a << ' '; err(args...); }
// -----------------------------------------------------------------------------
 
const int N = 2E5 + 100;
multiset<LL> S;
 
int main() {
    int n; cin >> n;
    FOR (i, 0, n) {
        int x; cin >> x;
        S.insert(x);
    }
    int ans = 0;
    while (!S.empty()) {
        LL t = *S.rbegin();
        S.erase(--S.end());
        FOR (i, 0, 33) {
            LL s = 1LL << i;
            auto it = S.find(s - t);
            if (it != S.end()) {
                S.erase(it);
                ans++;
                break;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 9600
# -*- coding: utf-8 -*-


def main():
    from collections import deque

    n = int(input())
    graph = [[] for _ in range(n)]

    # See:
    # https://www.youtube.com/watch?v=26AWkQNRb-A
    # https://atcoder.jp/contests/abc126/submissions/5456359
    for i in range(n - 1):
        ui, vi, wi = map(int, input().split())
        ui -= 1
        vi -= 1
        graph[ui].append((vi, wi))
        graph[vi].append((ui, wi))

    ans = [-1 for _ in range(n)]
    q = deque()
    ans[0] = 0
    q.append(0)

    while q:
        vj = q.popleft()

        for uj, wj in graph[vj]:
            if ans[uj] != -1:
                continue

            ans[uj] = (ans[vj] + wj) % 2
            q.append(uj)

    print('\n'.join(map(str, ans)))


if __name__ == '__main__':
    main()


Measured memory_bytes: 44808
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;
const ll MOD = 1000000007LL;

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

    int n, d;
    cin >> n >> d;

    int x[n][d];
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < d; j++) {
            cin >> x[i][j];
        }
    }

    int ans = 0;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < i; j++) {
            int dis = 0;
            for (int k = 0; k < d; k++) {
                dis += (x[i][k] - x[j][k]) * (x[i][k] - x[j][k]);
            }

            if ((int)sqrt(dis) * (int)sqrt(dis) == dis) {
                ans++;
            }
        }
    }

    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 888
function Main(input) {
  input = input.split("\n");
  var N = parseInt(input[0]);
  input.shift();
  input.splice(N,input.length);
  var x = input.map(i => i.split(" ").map(i => parseInt(i)));
  var ans=0;
  if(x.length==2){
    var ans = Math.sqrt(Math.pow(x[0][0]-x[1][0],2)+Math.pow(x[0][1]-x[1][1],2))/2;
  }else{
    for(var i=0;i<N;i++){
      for(var j=i+1;j<N;j++){
        for(var k=j+1;k<N;k++){
          var edge = new Array();
          edge.push([Math.pow(x[i][0]-x[j][0],2)+Math.pow(x[i][1]-x[j][1],2),0]);
          edge.push([Math.pow(x[i][0]-x[k][0],2)+Math.pow(x[i][1]-x[k][1],2),1]);
          edge.push([Math.pow(x[k][0]-x[j][0],2)+Math.pow(x[k][1]-x[j][1],2),2]);
          edge.sort(function(a,b){return b[0]-a[0]});
          if(edge[0][0]>edge[1][0]+edge[2][0]){
            if(edge[0][1]==0){
              var cx = (x[i][0]+x[j][0])/2;
              var cy = (x[i][1]+x[j][1])/2;
              var r2 = Math.pow(x[i][0]-cx,2)+Math.pow(x[i][1]-cy,2);
            }else if(edge[0][1]==1){
              var cx = (x[i][0]+x[k][0])/2;
              var cy = (x[i][1]+x[k][1])/2;
              var r2 = Math.pow(x[i][0]-cx,2)+Math.pow(x[i][1]-cy,2);
            }else{
              var cx = (x[j][0]+x[k][0])/2;
              var cy = (x[j][1]+x[k][1])/2;
              var r2 = Math.pow(x[j][0]-cx,2)+Math.pow(x[j][1]-cy,2);
            }
          }else{
            var cy = ((x[k][0]-x[i][0])*(Math.pow(x[i][0],2)+Math.pow(x[i][1],2)-Math.pow(x[j][0],2)-Math.pow(x[j][1],2))-(x[j][0]-x[i][0])*(Math.pow(x[i][0],2)+Math.pow(x[i][1],2)-Math.pow(x[k][0],2)-Math.pow(x[k][1],2)))/(2*(x[k][0]-x[i][0])*(x[i][1]-x[j][1])-2*(x[j][0]-x[i][0])*(x[i][1]-x[k][1]));
            if(x[i][0]!=x[j][0]){
              var cx = (2*(x[i][1]-x[j][1])*cy-Math.pow(x[i][0],2)-Math.pow(x[i][1],2)+Math.pow(x[j][0],2)+Math.pow(x[j][1],2))/(2*(x[j][0]-x[i][0]));
            }else{
              var cx = (2*(x[i][1]-x[k][1])*cy-Math.pow(x[i][0],2)-Math.pow(x[i][1],2)+Math.pow(x[k][0],2)+Math.pow(x[k][1],2))/(2*(x[k][0]-x[i][0]));
            }
            var r2 = Math.pow(x[i][0]-cx,2)+Math.pow(x[i][1]-cy,2);
          }
          var flag=0;
          for(var l=0;l<N;l++){
            if(Math.pow(x[l][0]-cx,2)+Math.pow(x[l][1]-cy,2)>r2+0.000001){
              flag=1
              break;
            }
          }
          if(flag==0){
            ans = Math.sqrt(r2);
            break;
          }
        }
        if(ans!=0){
          break;
        }
      }
      if(ans!=0){
        break;
      }
    }
  }
  console.log('%s', ans);
  return ans;
}

function debug(n){
  var input = document.getElementById("input"+n).value;
  var ans=Main(input);
  var result="WA";
  if(ans==document.getElementById("output"+n).value.split("\n")[0]){
    result="AC";
  }
  document.getElementById("result"+n).innerHTML=result;
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

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

int main() {
    long long k, a, b;
    std::cin >> k;
    std::vector<long long> v(k);
    for (auto i = 0ll; i < k; i++) {
        std::cin >> v[i];
    }

    // [a, b]
    a = 2;
    b = 2;
    for (auto i = k - 1; i >= 0; i--) {
        a = (a / v[i] + ((a % v[i] == 0)?0:1)) * v[i];
        if (a > b) {
            std::cout << -1 << std::endl;
            return 0;
        }
        b = b / v[i] * v[i] + v[i] - 1;
    }

    std::cout << a << " " << b << std::endl;

    return 0;
}

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

int main() {
  int a,b,c,x;
  cin>>a>>b>>c;
  int odd=1;
  if ((a+b+c)%2==0) odd=0;
  x=max({a,b,c});
  if (x%2!=odd) x++;
  cout<<(3*x - a-b-c)/2<<endl;//一操作するごとに２ずつ数が増えるために　　/2
}



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

int n, m, mn = 2e9, mx, x, a[305][305], v[305], b[305], cnt[305];
int main()
{
	int i, j;
	cin >> n >> m;
	for (i = 1; i <= n; i++) {
		for (j = 0; j < m; j++) {
			scanf ("%d", &a[i][j]);
		}
	}
	for (i = 1; i <= n; i++) {
		cnt[a[i][0]]++;
	}
	for (i = 0; i < m; i++) {
		mx = 0;
		for (j = 1; j <= m; j++) {
			if (cnt[j] > mx) {
				mx = cnt[j];
				x = j;
			}
		}
		mn = min(mn, mx);
		v[x] = 1;
		for (j = 1; j <= n; j++) {
			if (a[j][b[j]] != x) continue;
			for (b[j]++; b[j] < m && v[a[j][b[j]]]; b[j]++);
			cnt[x]--;
			cnt[a[j][b[j]]]++;
		}
	}
    cout << mn;
    return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please

typedef tuple<int, int, int, int> TP;
TP narabi(int a, int b, int c, int d) {
	TP kari[4];
	kari[0] = tie(a, b, c, d);
	kari[1] = tie(b, c, d, a);
	kari[2] = tie(c, d, a, b);
	kari[3] = tie(d, a, b, c);
	return *min_element(kari, kari + 4);
}

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


	int N;
	cin >> N;
	TP C[400];
	int cnum[1000] = {};
	rep(i, N) {
		int a, b, c, d;
		cin >> a >> b >> c >> d;
		C[i] = narabi(a, b, c, d);
		cnum[a]++;
		cnum[b]++;
		cnum[c]++;
		cnum[d]++;
	}

	sort(C, C + N);
	int kazu[400] = {};
	rep(i, N) {
		int k = i;
		while (k + 1 < N && C[k + 1] == C[i]) k++;
		kazu[i] = k - i + 1;
		i = k;
	}

	ll kotae = 0;
	rep(i, N) {
		int inum = lower_bound(C, C + N, C[i]) - C;
		kazu[inum]--;
		rep(j, N) if (i != j) {

			int a, b, c, d, e, f, g, h;
			a = get<0>(C[i]);
			b = get<1>(C[i]);
			c = get<2>(C[i]);
			d = get<3>(C[i]);
			e = get<0>(C[j]);
			f = get<1>(C[j]);
			g = get<2>(C[j]);
			h = get<3>(C[j]);
			if (cnum[a] <= 2) continue;
			if (cnum[b] <= 2) continue;
			if (cnum[c] <= 2) continue;
			if (cnum[d] <= 2) continue;
			if (cnum[e] <= 2) continue;
			if (cnum[f] <= 2) continue;
			if (cnum[g] <= 2) continue;
			if (cnum[h] <= 2) continue;

			int bairitu = kazu[inum] + 1;
			int jnum = lower_bound(C, C + N, C[j]) - C;
			bairitu *= kazu[jnum]--;

			rep(x, 4) {
				TP D[4];
				D[0] = narabi(a, d, f, e);
				D[1] = narabi(a, e, h, b);
				D[2] = narabi(b, h, g, c);
				D[3] = narabi(c, g, f, d);
				TP* itr[4];
				rep(k, 4) itr[k] = lower_bound(C, C + N, D[k]);
				ll kari = bairitu;
				rep(k, 4) {
					if (itr[k] != C + N && *(itr[k]) == D[k]) {
						kari *= kazu[itr[k] - C]--;
						if (get<0>(D[k]) == get<2>(D[k]) && get<1>(D[k]) == get<3>(D[k])) {
							kari *= 2;
							if (get<1>(D[k]) == get<2>(D[k])) kari *= 2;
						}
					}
					else {
						kari = 0;
						break;
					}
				}
				rep(k, 4) {
					if (itr[k] != C + N && *itr[k] == D[k]) {
						kazu[itr[k] - C]++;
					}
					else break;
				}
				kotae += kari;

				int tmp = e;
				e = f;
				f = g;
				g = h;
				h = tmp;
			}
			j += kazu[jnum]++;
		}
		i += kazu[inum]++;
	}
	co(kotae / 6);

	Would you please return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <array>
#include <cassert>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#define FOR(i,a,b) for (int i=(a),for_##i##_max=(b);i<=(for_##i##_max);++i)
#define RFOR(i,a,b) for (int i=(a),rfor_##i##_min=(b);i>=(rfor_##i##_min);--i)
#define REP(i,n) for (int i=0,rep_##i##_len=(n);i<(rep_##i##_len);++i)
#define RREP(i,n) for (int i=(n)-1;i>=0;--i)

namespace { // Basics

template<typename T>
void chmin(T &x, T y) {
  x = std::min(x, y);
}

template<typename T>
void chmax(T &x, T y) {
  x = std::max(x, y);
}

template<typename T>
__attribute__((unused))
const auto minimum = static_cast<T const &(*)(T const &, T const &)>(std::min);

template<typename T>
__attribute__((unused))
const auto maximum = static_cast<T const &(*)(T const &, T const &)>(std::max);

template<typename T>
__attribute__((unused))
T constexpr infty = std::numeric_limits<T>::max / 3;
template<>
__attribute__((unused))
auto constexpr infty<int> = 1'100'100'100;
template<>
__attribute__((unused))
auto constexpr infty<long long int> = 100'500'400'300'200'100LL;

using lli = long long int;
using ld = long double;

} // namespace

using namespace std;

template <typename T>
struct service {
  size_t L;
  std::vector<T> dat;
  std::vector<T> dividend;
  std::vector<T> sum;

  explicit service(size_t n)
    : L(csqrt(n))
    , dat(L * L, 0)
    , dividend(L, 0)
    , sum(L, 0)
  { }

  void pay(size_t alpha) {
    T offset = dividend[alpha];
    if (offset <= 0) { return; }
    for (size_t i = alpha * L; i < (alpha + 1) * L; ++i) {
      dat[i] += offset;
    }
    dividend[alpha] = 0;
  }

  void add(size_t begin, size_t end, T x) {
    pay(begin / L);
    pay(end / L);
    size_t i;
    for (i = begin; i < end && i % L != 0; ++i) {
      dat[i] += x;
      sum[i / L] += x;
    }
    for (; i + L < end; i += L) {
      dividend[i / L] += x;
      sum[i / L] += x * L;
    }
    for (; i < end; ++i) {
      dat[i] += x;
      sum[i / L] += x;
    }
  }

  T get_sum(size_t begin, size_t end) {
    pay(begin / L);
    pay(end / L);
    T ans = 0;
    size_t i;
    for (i = begin; i < end && i % L != 0; ++i) { ans += dat[i]; }
    for (; i + L <= end; i += L) { ans += sum[i / L]; }
    for (; i < end; ++i) { ans += dat[i]; }
    return ans;
  }


  static size_t csqrt(size_t n) {
    size_t k = 1;
    while (k * k < n + 3) { ++k; }
    return k;
  }
};

int main() {
  // cout << fixed << setprecision(10);

  int N, Q; cin >> N >> Q;
  service<lli> srv(N);
  REP(query, Q) {
    // cerr << stringify(srv.dat, srv.dividend, srv.sum, srv.L) << "\n";
    int T; cin >> T;
    if (T == 0) {
      int S, T, X; cin >> S >> T >> X;
      // cerr << "add: " << stringify(S, T, X) << "\n";
      srv.add(S, T+1, X);
    } else {
      int S, T; cin >> S >> T;
      // cerr << "getSum: " << stringify(S, T) << "\n";
      cout << srv.get_sum(S, T+1) << "\n";
    }
  }
  return 0;
}



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

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;}

//繰り返し自乗法による累乗計算
//a**n
ll pow(ll a, ll n){
  if(n == 0) return 1;
  if(n%2 == 0){
    ll res = pow(a, n/2);
    return res * res;
  }
  return a * pow(a, n-1);
}
//繰り返し自乗法によるmod累乗計算
//a**n (mod)
ll modpow(ll a, ll n){
  if(n == 0) return 1;
  if(n%2 == 0){
    ll res = modpow(a, n/2);
    return res * res % mod;
  }
  return a * modpow(a, n-1) % mod;
}
//組み合わせ
//nCa
ll com(ll n, ll a){
  ll x = 1, y = 1;
  rep(i,a){
    x *= n-i;
    y *= i+1;
  }
  ll res = x / y;
  return res;
}
//組み合わせ(mod)
//nCa (mod)
ll modcom(ll n, ll a){
  ll x = 1, y = 1;
  rep(i, a){
    x = x * (n-i) % mod;
    y = y * (i+1) % mod;
  }
  ll ans = x * modpow(y, mod-2) % mod;
  return ans;
}
//gcd 最大公約数
ll gcd(int x, int y){
  if(x % y == 1) return y;
  return gcd(y, x%y);
}
//lcm 最小公倍数
ll lcm(int x, int y){
  return x * y / gcd(x, y);
}
// n個の最大公約数
ll ngcd(vector<int> a){
  int res;
  res = a[0];
  for(int i=1; i<a.size() && res!=1; i++){
    res = gcd(res, a[i]);
  }
  return res;
}
// n個の最小公倍数
ll nlcm(vector<int> a){
  int res;
  res = a[0];
  REP(i, a.size()){
    res = lcm(res, a[i]);
  }
  return res;
}
// 素数判定
bool isprime(int x){
  int i;
  if(x < 2) return false;
  else if(x == 2) return true;
  if(x % 2 == 0) return false;
  for(i = 3; i*i <= x; i += 2){
    if(x % i == 0) return false;
  }
  return true;
}
// 桁和
int digsum(int x){
  int res = 0;
  while(x > 0){
    res += x % 10;
    x /= 10;
  }
  return res;
}


int main(){
  vector<int> a(3);
  rep(i,3) cin >> a[i];
  sort(a.rbegin(), a.rend());
  int ans = a[0] * 10 + a[1] + a[2];
  cout << ans << endl;
}






Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int,int> pii;
//const int inf = 0x3f3f3f3f,oo = inf;
const ll inf = 0x3f3f3f3f3f3f3f3f;
#define pi 3.14159265358979323846
#define IL inline
#define RG register
#define rep(i,a,b) for(RG int i=(a);i<int(b);++i)
#define Rep(i,a,b) for(RG int i=(a);i<=(b);++i)
#define Dep(i,a,b) for(RG int i=(a);i>=(b);--i)
#define pc putchar
#define gc getchar
IL ll read(){
    RG ll x=0;char f=0;RG char c=gc();
    for(;!isdigit(c);c=gc())f|=(c=='-');
    for(;isdigit(c);c=gc())x=(x<<1)+(x<<3)+(c^48);
    return f?-x:x;
}
IL double readdb(){
    RG double x=0,p=0.1;RG char f=0,c=gc();
    for(;!isdigit(c);c=gc())f|=(c=='-');
    for(;isdigit(c);c=gc())x=x*10+(c^48);
    if(c=='.')for(c=gc();isdigit(c);c=gc(),p/=10)x=x+(c^48)*p;
    return f?-x:x;
}
IL void write(ll x){if(x<0)x=-x,pc('-');if(x>=10)write(x/10);pc(x%10+'0');}
IL void writeln(ll x){write(x);puts("");}
IL void writeln(ll x,char c,ll y){write(x);pc(c);writeln(y);}
IL void writeln(ll x,char c,ll y,char d,ll z){write(x);pc(c);write(y);pc(d);writeln(z);}
#undef gc
#undef pc
#define debug(x) printf(#x" = %d\n",x);
#define rd() read()
#define rdb() readdb()
#define mem(x,v) memset(x,v,sizeof(x))
#define pb push_back
#define mp make_pair
#define sqr(x) ((x)*(x))
#define lowbit(x) ((x)&(-(x)))
#define fin(x) freopen(#x".in","r",stdin)
#define fout(x) freopen(#x".out","w",stdout)
#define y1 ____y1
#define hash __hash
#define union _union
#define int ll
#define fi first
#define se second
const int maxn = 1e5+233;
struct node{
	int a,b,id;
	bool operator < (const node &w) const{
		return a < w.a;
	}
}p[maxn];
int a[maxn],b[maxn],sum[maxn],fa[maxn];
vector<int> edge[maxn];
int vis[maxn],cur[maxn],ans[maxn];
int n,m;
int find(int x){
	return fa[x]==x?x:fa[x]=find(fa[x]);
}
signed main(){
	n = read();m = read();
	Rep(i,1,n){
		a[i] = rd();
		b[i] = rd();
		a[i] = max(a[i],b[i]);
		sum[i] = b[i];
		p[i] = (node){a[i],b[i],i};
	}
	Rep(i,1,m){
		int x = rd(),y = rd();
		edge[x] . push_back(y);
		edge[y] . push_back(x);
	}
	Rep(i,1,n){
		fa[i] = i;
		ans[i] = inf;
	} 
	sort(p+1,p+1+n);
	int j;
	for(int i=1;i<=n;i=j+1){
		j=i;for(;j+1<=n && p[i].a == p[j+1].a;++j);
		Rep(k,i,j) vis[p[k].id] = i;
		Rep(k,i,j){
			int u = p[k].id;
			rep(e,0,edge[u].size()){
				int v = edge[u][e];
				if(!vis[v]) continue;
				cur[v] = find(v);
			}
		} 
		Rep(k,i,j){
			int u = p[k].id;
			rep(e,0,edge[u].size()){
				int v = find(edge[u][e]);
				if(!vis[find(v)] || find(u)==v) continue;
				fa[v] = find(u);
				sum[find(u)]+=sum[v];
			}
		} 
		Rep(k,i,j){
			int u = p[k].id;
			rep(e,0,edge[u].size()){
				int v = cur[edge[u][e]];
				if(!vis[v] || vis[v]==i) continue;
				ll cost=max(a[u],ans[v]+b[u])+sum[find(u)]-sum[v]-b[u];
				ans[find(u)] = min(ans[find(u)],cost);
			}
			ans[find(u)] = min(ans[find(u)],a[find(u)] + sum[find(u)] - b[u]);
		}
	}writeln(ans[find(1)]);
	return 0;
}

Measured memory_bytes: 14080
#include<bits/stdc++.h>
#define MAX_N 2000005
#define rank Ajgrsf
using namespace std;
typedef long long ll;
const int N = 1<<18;
const ll INF= INT_MAX; 

class RMQ{
public:
  ll n;
  vector<ll>dat;
  RMQ(){dat.resize(2*N-1),n=N;for(int i=0;i<n;i++) dat[i]=INF;}
  
  void update(int k,ll a){
    k+=n-1;
    dat[k]=a;
    while(k>0){
      k=(k-1)/2;
      dat[k]=min(dat[k*2+1],dat[k*2+2]);
    }
  }

  ll query(int a,int b,int k=0,int l=0,int r=N){
    if(r<=a||b<=l)return INF;
    if(a<=l&&r<=b)return dat[k];
    ll vl=query(a,b,k*2+1,l,(l+r)/2);
    ll vr=query(a,b,k*2+2,(l+r)/2,r);
    return min(vl,vr);
  }
};

int Len,n;
int rank[MAX_N+1];
int tmp[MAX_N+1];
bool compare_sa(int i,int j){
  if(rank[i]!=rank[j])return rank[i]<rank[j];
  int ri=i+Len<=n?rank[i+Len]:-1;
  int rj=j+Len<=n?rank[j+Len]:-1;
  return ri<rj;
}

void construct_sa(string S,int *sa){
  n=S.length();
  for(int i=0;i<=n;i++){
    sa[i]=i;
    rank[i]=i<n?S[i]:-1;
  }
  
  for(Len=1;Len<=n;Len*=2){
    sort(sa,sa+n+1,compare_sa);
    tmp[sa[0]]=0;
    for(int i=1;i<=n;i++)
      tmp[sa[i]]=tmp[sa[i-1]]+(compare_sa(sa[i-1],sa[i])?1:0);
    for(int i=0;i<=n;i++)rank[i]=tmp[i];
  }
}

bool contain(string &S,int *sa,string &T){
  int left=0,right=S.length();
  while(right-left>1){
    int mid=(left+right)/2;
    if(S.compare(sa[mid],T.length(),T)<0)left=mid;
    else right=mid;
  }
  return S.compare(sa[right],T.length(),T)==0;
}

int Lower(string &S,int *sa,string &T){
  int L=0,M,R=S.size();
  while(L<R){
    M = (L+R)/2;
    if(S.compare(sa[M],T.length(),T)>=0) R = M;
    else L = M+1;
  }  
  return L;
}

int Upper(string &S,int *sa,string &T){
  int L=0,M,R=S.size();
  while(L<R){
    M = (L+R)/2;
    if(S.compare(sa[M],T.length(),T)>0) R = M;
    else L = M+1;
  }  
  return L;
}

int A[MAX_N],B[MAX_N];
int main(){
  string S,rS;
  int n;
  cin>>S; rS = S;
  reverse(rS.begin(),rS.end());
  S+='{';rS+='{';
  n = S.size();
  construct_sa(S,A);
  construct_sa(rS,B);
  RMQ AT,BT;
  for(int i=0;i<=n;i++){
    AT.update(i,A[i]);
    BT.update(i,B[i]);
  }

  int q;  
  cin>>q;
  while(q--){
    string a,b;
    cin>>a>>b;
    reverse(b.begin(),b.end());
    if(!contain(S,A,a)||!contain(rS,B,b)){printf("0\n");continue;}
    int l = AT.query(Lower(S,A,a),Upper(S,A,a));
    int r = n-BT.query(Lower(rS,B,b),Upper(rS,B,b))-b.size()-1;
    if(l+a.size()>r+b.size())printf("0\n");
    else printf("%d\n",r-l+b.size());
  }
  return 0;
}

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

int main () {
  long long N, M;
  cin >> N >> M;
  vector<long long> A(N);
  long long sub = 0;
  vector<long long> sum;
  long long answer = 0;
  map<long long, long long> last;
  for (long long i = 0; i < N; i++) {
    cin >> sub; 
    A[i] = sub % M;   
    if (i == 0) {
      sum.push_back(A[0]);  
      last[A[0]] = 1;
      answer = answer + last[0];
    }
    else {
      sub = A[i] + sum[i-1];
      sub = sub % M;
      sum.push_back(sub);
      answer = answer + last[sub];
      last[sub]++;
      if (sub == 0) {
        answer++;  
      }
    }
  }
  cout << answer << endl;

}

Measured memory_bytes: 6008
#include<bits/stdc++.h>
#define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;

void solve(){
    string s,t;
    cin>>s>>t;
    int ans = 0;
    const int n = s.length();
    for(int i=0;i<n;i++) {
        if(s[i] != t[i])
            ans++;
    }
    cout<<ans;
}

int main(){
    FAST
    // int t;
    // cin>>t;
    // while(t--)
    // {
    //     solve();
    // }
    solve();
return 0;

}

Measured memory_bytes: 3796
#pragma GCC optimize("Ofast")
#include <iostream>
#define pb push_back
#define eb emplace_back
#define F first
#define S second
#define MP make_pair
#define MEM(i,j) memset(i,j,sizeof i)
#define Tie ios::sync_with_stdio(0),cin.tie(0)
#define MOD 1000000007
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

long long n,k,ans,tmp;

int main()
{
	cin>>n>>k;
	if(k%2==0)
	{
		for(int i=k/2;i<=n;i+=k)
			tmp++;
		ans+=tmp*tmp*tmp;
	}
	tmp=0;
	for(int i=k;i<=n;i+=k)
		tmp++;
	ans+=tmp*tmp*tmp;
	cout << ans<<'\n';
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <algorithm>
#include <cmath>
#include <ios>
#include <ctype.h>
#include <stack>
#include <istream>
#include <stdio.h>
#include <map>
#include <set>
#include <queue>
#include <unordered_map>
#include <functional>
#include <bitset>
#include <list>
#include <deque>
#include <time.h>
#include <random>
#include <iomanip>
#include <fstream>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define REP(i,a,b) for (int i = a; i < (b); ++i)
#define RREP(i,a,b) for (int i = a; i > (b); --i)
#define all(x) (x).begin(),(x).end()
const long long INF = 1000000007;
typedef long long ll;
using namespace std;
using Graph = vector<vector<int>>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll a, ll b) { return (a * b) / gcd(a,b); }
int solve(){
  string s;
  cin>>s;
  bool can = false;
  if(s[0] != s[1])can = true;
  if(s[1] != s[2])can = true;
  cout << (can ? "Yes" : "No") << endl; 
  return 0;
}
int main(){
  ios::sync_with_stdio(false);cin.tie(nullptr);
  // cout << fixed;cout << setprecision(16);
  solve();
  return 0;
}

Measured memory_bytes: 256
A,B,C,D = list(map(int,input().split()))

Takahashi = C//B
if C%B != 0 :
    Takahashi += 1
    
Aoki = A//D
if A%D != 0 :
    Aoki += 1
    
# print(Takahashi,Aoki)

ans='No'
if Takahashi <= Aoki:
    ans = 'Yes'
    
print(ans)

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

int main() {
  int N, min;
  cin >> N;
  min = 10000000000;
  
  for (int i=0; i<N; i++){
    
    int A, sum;
    cin >> A;
    sum = 0;
    
     while (A%2==0){
       sum ++;
       A /= 2;
     }
    if (sum < min){
      min = sum;
    }
  }
  
    cout << min << endl;
  }


    

    



Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
	// your code goes here
	int a,b,c;
	scanf("%d%d%d",&a,&b,&c);
	int sum = a+b;
	if(sum>a+c)
		sum = a+c;
	if(sum>b+c)
		sum = b+c;
	printf("%d",sum);
	return 0;
}


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

#define ll long long
#define ull unsigned long long

#define pii pair < int, int >
#define pll pair < ll, ll >
#define pci pair < char, int >
#define psi pair < string, int >

#define vi vector < int >
#define vll vector < ll >
#define vs vector < string >
#define vc vector < char >
#define pvi vector < pii >
#define pvll vector < pll >

#define pb push_back

#define fast ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)

using namespace std;

const int maxn = 1e5 + 5;
const int mod = 1e9 + 7;

int main()
{
    fast;

    int n;

    cin >> n;

    if(n % 1000 == 0){
        cout << 0 << endl;
        return 0;
    }

    cout << ((((n / 1000) + 1) * 1000) - n) << endl;

    return 0;
}



Measured memory_bytes: 3684
import math
q = int(input())
a = [[int(i) for i in input().split()] for i in range(q)]
for i in a:
	if i[0]==i[1]: print((i[0]-1)*2)
	else:
		x = int(math.sqrt(i[0]*i[1]))
		if x*(x+1)<i[0]*i[1]: print(2*x-1)
		elif x==math.sqrt(i[0]*i[1]): print(2*x-3)
		else: print(2*x-2)

Measured memory_bytes: 3064
#include <cstdio>

const int MAX_N = 6;
char S[MAX_N];

int main()
{
	scanf("%s", S);

	bool eq1 = S[2] == S[3];
	bool eq2 = S[4] == S[5];

	if(eq1 && eq2) {
		printf("Yes");
	} else {
		printf("No");
	}

    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main(void){
  int k, a, b;
  cin >> k >> a >> b;
  for(int i = a; i <= b; i++){
    if(i % k == 0){
      cout << "OK" << endl;
      return 0;
    }
  }
  cout << "NG" << endl;
  return 0;
}


Measured memory_bytes: 3572
import           Data.List
main = do
    s <- getLine :: IO String
    print . fst $ foldl f (0,0) s
  where
    f :: (Int,Int) -> Char -> (Int,Int)
    f (m,n) x = if x `elem` "ACGT"
                   then (max m (n+1), n+1) else (m, 0)

Measured memory_bytes: 380
#include <stdio.h>
#include <stdlib.h>
int main(void){
	int x, n;
	int *p;
	int minor = -1;
	int major = 101;
	int in_p;
	scanf("%d", &x);
	scanf("%d", &n);
	p = (int *)malloc(sizeof(int) * n);
	for(int i=0; i<n; i++){
		scanf("%d", &p[i]);
	}
	for(int j=0; j<=x; j++){
		in_p = 0;
		for(int k=0; k<n; k++){
			if(p[k] == x-j){
				in_p = 1;
				break;
			}
		}
		if(in_p == 0){
			minor = x-j;
			break;
		}
	}
	for(int j=x; j<=100; j++){
		in_p = 0;
		for(int k=0; k<n; k++){
			if(p[k] == j){
				in_p = 1;
				break;
			}
		}
		if(in_p == 0){
			major = j;
			break;
		}
	}
	if(x-minor <= major-x){
		printf("%d\n", minor);
	}
	else{
		printf("%d\n", major);
	}
	return 0;
}

Measured memory_bytes: 1724
S = list(input())
A = 10 * int(S[0]) + int(S[1])
B = 10 * int(S[2]) + int(S[3])
if (A > 0) & (A < 13) & (B > 0) & (B < 13):
    print('AMBIGUOUS')
elif (A > 0) & (A < 13):
    print('MMYY')
elif (B > 0) & (B < 13):
    print('YYMM')
else:
    print('NA')

Measured memory_bytes: 3060
#include <iostream>
#include <cmath>
#include <algorithm>
using namespace std;
typedef long long ll;

ll f(ll b,ll n)
{
	if(n<b)
		return n;
	else
		return f(b,n/b)+(n+b)%b;
}

int main()
{
	ll n,s;
	ll ans=1e14-1;
	cin>>n>>s;
	ll sqr=sqrt(n);
	for(ll i=2;i<=sqr;i++)
	{
		ll r=n/(i-1);
		if(i==2)
			r=n-1;
		ll l=n/i+1;
		ll rs=(i-1)+(n+r)%r;
		//cerr<<i<<" "<<rs<<endl;
		if((s-rs)%(i-1)==0 && s-rs>=0 && (s-rs)/(i-1)<r-l+1)
			ans=min(ans,r-(s-rs)/(i-1));
	}
	for(ll i=2;i<=sqr;i++)
	{
		if(f(i,n)==s)
			ans=min(ans,i);
	}
	if(s==n)
		ans=min(ans,n+1);
	if(s==1)
		ans=min(ans,n);
	ans=max(2LL,ans);
	if(ans==1e14-1)
		cout<<-1<<endl;
	else
		cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <time.h>
#include <list>

using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);++i)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define reps(x,c) for(auto x:c)
#define all(x) begin(x), end(x)
#define pb(a) emplace_back(a) 
#define mp(a,b) make_pair((a),(b))
#define pl pair<ll,ll>
#define INF 2147483600
#define MOD 1000000007
#define fi first
#define se second
#define dbg(x) cout << #x"="<< (x) << endl
#define dbgv(x) cout<<#x<<endl;reps(y,x){cout<<y<<" ";}cout<<endl

int main(){
  ll n;cin>>n;
  char s;
  set<char> st;
  rep(i,n){
    cin>>s;
    st.insert(s);
  }
  if(st.size()==3){
    cout<<"Three"<<endl;
  }else{
    cout<<"Four"<<endl;
  }
  return 0;
}

Measured memory_bytes: 384
#[allow(unused_imports)]
use std::char::*;
#[allow(unused_imports)]
use std::cmp::*;
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

pub trait LexicalPermutation {
    fn next_permutation(&mut self) -> bool;
    fn prev_permutation(&mut self) -> bool;
}

impl<T> LexicalPermutation for [T] where T: Ord {
    fn next_permutation(&mut self) -> bool {
        if self.len() < 2 { return false; }
        let mut i = self.len() - 1;
        while i > 0 && self[i-1] >= self[i] {
            i -= 1;
        }
        if i == 0 {
            return false;
        }
        let mut j = self.len() - 1;
        while j >= i && self[j] <= self[i-1]  {
            j -= 1;
        }
        self.swap(j, i-1);
        self[i..].reverse();
        true
    }

    fn prev_permutation(&mut self) -> bool {
        if self.len() < 2 { return false; }
        let mut i = self.len() - 1;
        while i > 0 && self[i-1] <= self[i] {
            i -= 1;
        }
        if i == 0 {
            return false;
        }
        self[i..].reverse();
        let mut j = self.len() - 1;
        while j >= i && self[j-1] < self[i-1]  {
            j -= 1;
        }
        self.swap(i-1, j);
        true
    }
}

//const MAX:usize = 100006;
//const INF:u64 = u64::max_value();

fn main() {
    let m:u32 = read();
    let d:u32 = read();
    
    let mut ans:u32 = 0;
    for i in 1..m+1 {
        for j in 22..d+1 {
            let day:Vec<char> = j.to_string().chars().collect();
            let d1 = day[0] as u8 - b'0';
            let d2 = day[1] as u8 - b'0';
            if d1 <= 1 || d2 <= 1 {continue}
            if d1 as u32 * d2 as u32 == i {
                //println!("{}月{}{}日", i,d1,d2);
                ans += 1
            }
        }
    }

    println!("{}", ans);
    
}

Measured memory_bytes: 4352