akhauriyash/Code-Regression huggingface dataset:
import sys
import math 
ni = lambda: int(ns())
na = lambda: list(map(int, input().split()))
ns = lambda: input()
N,S = ni(),ns()
#print(S)
#累積和を計算
b_ = [0]*(N+1)
w_ = [0]*(N+1)
if(S[0]=="."):
    b_[0]=0
    w_[0]=1
else:
    b_[0]=1
    w_[0]=0
for i in range(1,N):
    if(S[i]=="."):
        b_[i] = b_[i-1]
        w_[i] = w_[i-1]+1
    else:
        b_[i] = b_[i-1]+1
        w_[i] = w_[i-1]
ans = w_[N-1]
for i in range(N):
    ans = min(ans,b_[i]+w_[N-1]-w_[i])
    #print(ans)
#print(b_,w_)
ans = min(ans, b_[N-1])
print(ans)


Measured memory_bytes: 12808
#include <bits/stdc++.h>
typedef long long ll;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define all(v) v.begin(), v.end()
using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
const int INF = 1 << 30;
const ll INFll = 1ll << 60;
template <typename T>
bool chmax(T& a, const T& b) {
  if (a < b) {
    a = b;  // aをbで更新
    return true;
  }
  return false;
}
template <typename T>
bool chmin(T& a, const T& b) {
  if (a > b) {
    a = b;  // aをbで更新
    return true;
  }
  return false;
}

int main() {
  int N, M, C;
  cin >> N >> M >> C;
  vi B(M);
  rep(i, M) cin >> B[i];
  vvi A(N, vi(M));
  rep(i, N) { rep(j, M) cin >> A[i][j]; }

  int ans = 0;

  rep(i, N) {
    int sum = 0;
    rep(j, M) { sum += A[i][j] * B[j]; }
    if (sum + C > 0) ans++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define N 3002
using namespace std;
typedef pair<int,int> P;
vector<P> G[N];
bool num[N];
int n,m,K;

double dijkstra(){
  vector<int> D(N,1e9);
  priority_queue<P,vector<P>,greater<P> >Q;
  for(int i=0;i<n;i++)if(num[i]) Q.push(P(0,i)),D[i] = 0;
  
  while(!Q.empty()){
    P t = Q.top();Q.pop();
    int cost = t.first;
    int pos = t.second;
    if(D[pos]<cost) continue;

    for(int i=0;i<G[pos].size();i++){
      int npos = G[pos][i].first;
      int ncost = cost+G[pos][i].second;
      if(D[npos]<=ncost) continue;
      Q.push(P(ncost,npos));
      D[npos] = ncost;
    }
  }

  double res = 0;
  for(int i=0;i<n;i++)
    for(int j=0;j<(int)G[i].size();j++){
      int npos = G[i][j].first;
      int ncost = G[i][j].second;
      res = max(res,(D[i]+D[npos]+ncost)/2.0);
    }
  return res;
   
}
 
int main(){
  cin>>n>>m>>K;
  for(int i=0,a,b,c;i<m;i++){
    cin>>a>>b>>c;
    G[a-1].push_back(P(b-1,c));
    G[b-1].push_back(P(a-1,c));
  }
 
  for(int i=0,a;i<K;i++)cin>>a,num[a-1]=1;
  printf("%d\n",(int)(dijkstra()+0.5));
  return 0;
}

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

const int N = 2e5 + 5;

// from kactl

struct Line {
	mutable long long k, m, p;
	bool operator<(const Line& o) const { return k < o.k; }
	bool operator<(long long x) const { return p < x; }
};

struct LineContainer : multiset<Line, less<>> {
	// (for doubles, use inf = 1/.0, div(a,b) = a/b)
	const long long inf = LLONG_MAX;
	long long div(long long a, long long b) { // floored division
		return a / b - ((a ^ b) < 0 && a % b); 
	}
	bool isect(iterator x, iterator y) {
		if (y == end()) { x->p = inf; return false; }
		if (x->k == y->k) x->p = x->m > y->m ? inf : -inf;
		else x->p = div(y->m - x->m, x->k - y->k);
		return x->p >= y->p;
	}
	void add(long long k, long long m) {
		auto z = insert({k, m, 0}), y = z++, x = y;
		while (isect(y, z)) z = erase(z);
		if (x != begin() && isect(--x, y)) isect(x, y = erase(y));
		while ((y = x) != begin() && (--x)->p >= y->p)
			isect(x, erase(y));
	}
	long long query(long long x) {
		assert(!empty());
		auto l = *lower_bound(x);
		return l.k * x + l.m;
	}
};

long long c;
int n;

int arr[N];
long long dp[N];
LineContainer hull;
int hullIt;

void read() {
  scanf("%d %lld", &n, &c);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &arr[i]);
  }
}

void add(long long k, long long m) {
  hull.add(k, m);
}

long long extract(long long x) {
  return hull.query(x);
}

void work2() {
  for (int i = 2; i <= n; i++) {
    int best = -1;
    long long val = 4e18;

    for (int j = 1; j < i; j++) {
      long long cur = 1ll * (arr[i] - arr[j]) * (arr[i] - arr[j]) + dp[j] + c;
      if (cur < val) {
        val = cur;
        best = j;
      }
    }

    dp[i] = val;
    printf("%d: best %d dp %lld\n", i, best, dp[i]);
  }
}

long long work() {
  dp[1] = 0;

  add(2 * arr[1], dp[1] - 1ll * arr[1] * arr[1] - c);

  for (int i = 2; i <= n; i++) {
    dp[i] = extract(arr[i]) - 1ll * arr[i] * arr[i];
    // printf("i %d dp %lld\n", i, dp[i]);
    add(2 * arr[i], dp[i] - 1ll * arr[i] * arr[i] - c);
  }

  return -dp[n];
}

int main() {
  read();
  // work2();
  cout << work() << endl;
  return 0;
}

Measured memory_bytes: 15104
x1, y1, x2, y2 = map(int, input().split(" "))
x3 = x2 + y1 - y2
y3 = y2 + x2 - x1
x4 = x3 + y2 - y3
y4 = y3 + x3 - x2
print(x3, y3, x4, y4)


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

zero = [-1]*N

t = 0 # テレポート回数をカウント
a = 1
while zero[a-1] == -1: # テレポートがループした場合に処理を抜ける
  if t == K: # テレポート上限回数に達した場合は処理を抜ける
    break
  zero[a-1] = t # 何番目にレポートしたかを記録
  t += 1
  a = A[a-1] # テレポート先を設定
else:
  k = (K-zero[a-1]) % (t - zero[a-1]) # テレポートの剰余を求める
  a = zero.index(zero[a-1] + k) + 1 # 
print(a)

Measured memory_bytes: 32368
#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cmath>
#include <set>
#include <queue>
#include <vector>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
using namespace std;

int main()
{
	long long W, H, x, y;
	cin >> W >> H >> x >> y;
	auto centerX = W / 2.0;
	auto centerY = H / 2.0;

	auto multi = 0;
	if (x == centerX && y == centerY)
	{
		multi = 1;
	}
	auto result = W * H / 2.0;

	cout << result << " " << multi << endl;

	return 0;
}

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

int n;
int A[20];

// NOTE: すべての組み合わせを作るには再帰関数を使う

// i以降の数の和でmが作れるか
bool solve(int i, int m) {
  if (m == 0) {
    return true;
  }

  if (i >= n) {
    return false;
  }

  return solve(i + 1, m) || solve(i + 1, m - A[i]);
}

int main() {
  cin >> n;

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

  int q;
  cin >> q;

  for (int i = 0; i < q; i++) {
    int m;
    cin >> m;

    if (solve(0, m)) {
      cout << "yes" << endl;
    } else {
      cout << "no" << endl;
    }
  }
}


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

void plus_one(int node, int num, std::vector<int>& count, std::map<int, std::vector<int> >& edges){
    count.at(node) += num;
    for (auto parent : edges[node]){
        plus_one(parent, count.at(node), count, edges);
    }
}

int main(){
    int N, Q;
    cin >> N >> Q;
    std::vector<int> count(N, 0);
    std::vector<pair<int, int> > ope(Q);
    int child, parent;
    int node, num;
    std::map<int, std::vector<int> > edges;
    for(int i=0; i < N-1; i++){
        cin >> parent >> child;
        edges[parent-1].push_back(child-1);
    }

    for(int i=0; i < Q; i++){
        cin >> node >> num;
        count.at(node - 1) += num;
    }
    plus_one(0, 0, count, edges);
    for(int i=0; i < N; i++){
        cout << count.at(i) << " ";
    }
    cout << endl;

}


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

typedef long long ll;

int main(){
    int n;
    while(cin >> n, n){
        vector<ll> v(n);
        vector<int> day[31];
        for(int i = 0; i < n; i++){
            int f;  cin >> f;
            while(f-- > 0){
                int x;  cin >> x;
                day[x].push_back(i);
            }
        }
        for(int i = 0; i < n; i++)  v[i] = 1ll<<i;

        int ans;
        for(ans = 1; ans <= 30; ans++){
            for(int j = 0; j < day[ans].size(); j++){
                for(int k = 0; k < day[ans].size(); k++){
                    v[day[ans][j]] |= v[day[ans][k]];
                }
            }
            bool found = false;
            for(int i = 0; i < n; i++){
                if(v[i] == (1ll<<n)-1)  found = true;
            }
            if(found)   break;
        }
        cout << (ans == 31 ? -1 : ans) << endl;
    }
    return 0;
}


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

#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
template<typename T> void view(T cont) {std::cout << cont << std::endl;}
template<typename T> void view(T* cont, ll sz) {rep(i, sz) std::cout << cont[i] << " "; std::cout << std::endl;}
template<typename T> void view(const std::vector<T>& v) {for (const auto& f: v) std::cout << f << " "; std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv) { for (const auto& v: vv) {view(v);}}
const long long INF = 1LL<<60;
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

int main(){
    int N, M; cin >> N >> M;
    if (N >= M) {
        cout << 0 << endl;
        return 0;
    }
    vector<int> X(M, 0);
    rep(i, M) {
        cin >> X[i];
    }
    sort(X.begin(), X.end());
    vector<int> interval(M - 1, 0);
    rep(i, M - 1) {
        interval[i] = X[i + 1] - X[i];
    }
    sort(interval.begin(), interval.end(), greater<int>());
    int interval_sum = 0;
    rep(i, N - 1) {
        interval_sum += interval[i];
    }
    cout << X[M - 1] - X[0] - interval_sum << endl;
    // view(X);
    // view(interval);
    return 0;



}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n,x;
  cin>>n>>x;
  vector<int> a(n);
  int sum=0;
  for(int i=0;i<n;i++){
    cin>>a[i];
    sum += a[i];
  }
  sort(a.begin(),a.end());
  int aaa=(x-sum)/a[0];
  cout<<n+aaa<<endl;
}

  


Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
#include <string.h>

int main(void)
{
  char s[100001];
  int i, j, n, q, l, r;
  int size = 0;
  int a[100001];
  
  scanf("%d %d", &n, &q);
  scanf("%s", s);
  
  a[0] = 0;
  for (j = 0; j < (n-1); j++){
    if ((s[j] == 'A')&&(s[j+1] == 'C')){
      size++;
    }
    a[j+1] = size;
  }
  
  for (i = 0; i < q; i++){
    scanf("%d %d", &l, &r);
    printf("%d\n", a[r-1]-a[l-1]);
  }
  
  
  return 0;
}

Measured memory_bytes: 1280
import java.util.Scanner;
 
public class Main{
    public void solve(){
        Scanner sc = new Scanner(System.in);
         
        int n = sc.nextInt();
         
        for(int i=0;i<n;i++){
            int x = sc.nextInt();
            int y = sc.nextInt();
            int b = sc.nextInt();
            int p = sc.nextInt();
             
            int kin = x*b + y*p;
             
            if(b>=5 && p>=2){
                kin = (x*b + y*p)*4/5;
            }else{
                if(b<5){
                b=5;
                }
                if(p<2){
                p=2;
                }
                int wari = (x*b + y*p)*4/5;
                 
                if(kin>wari){
                    kin = wari;
                }
            }
            System.out.println(kin);
        }
    }
     
    public static void main(String[]args){
        Main obj = new Main();
        obj.solve();
    }
}

Measured memory_bytes: 23268
#include <iostream>
#include <algorithm>
#include <functional>

#define rep(i,a,n) for(int (i) = (a);(i) < (n);(i)++)
using namespace std;

int main(){
  	int n,a[100],Bob = 0,Alice = 0;
    cin >> n;
  	
  	rep(i,0,n) cin >> a[i];
  
  	sort(a,a+n,greater<int>());
  
  	rep(i,0,n){
      if(i % 2 == 0){
        Alice += a[i];
      }
      else{
      	Bob += a[i];
      }
    }
  
  	cout << Alice - Bob << endl;
  	return 0;
  
}

Measured memory_bytes: 256
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define mp make_pair
#define pb push_back
#define ld long double
#define ss(x) (int) x.size()
#define FOR(i, j, n) for(int i = j; i <= n; ++i)
#define fi first
#define se second
#define cat(x) cerr << #x << " = " << x << endl;
#define ios cin.tie(0); ios_base::sync_with_stdio(0)
 
 
using namespace std;
using namespace __gnu_pbds;
 
// order_of_key
// find_by_order
// tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ja;

const int nax = 2e5 + 111, pod = (1 << 18);
const long long INF = 1e16;

ll lazy[2 * pod], maxi[2 * pod];

void upd(int u, int son) {
	lazy[son] += lazy[u];
	maxi[son] += lazy[u];
}

void push(int u) {
	upd(u, 2 * u);
	upd(u, 2 * u + 1);
	lazy[u] = 0;
}

void add(int x, int y, ll val, int u = 1, int l = 0, int r = pod - 1) {
	if(x <= l && r <= y) {
		lazy[u] += val;
		maxi[u] += val;
		return ;
	}
	push(u);
	int m = (l + r) / 2;
	if(x <= m)
		add(x, y, val, 2 * u, l, m);
	if(m < y)
		add(x, y, val, 2 * u + 1, m + 1, r);
	maxi[u] = max(maxi[2 * u], maxi[2 * u + 1]);
}

int n, m;
int l, r, c;
vector <pair<int, int>> Add[nax], Era[nax];


int main() {
	ios;
	
	FOR(i, 1, 2 * pod - 1) 
		maxi[i] = -INF;
	add(0, 0, INF);
	cin >> n >> m;
	FOR(i, 1, m) {
		cin >> l >> r >> c;
		Add[l].pb(mp(l - 1, c));
		Era[r + 1].pb(mp(l - 1, -c));
	}
	
	ll best = 0;
	FOR(i, 1, n) {
		for(auto it: Add[i])
			add(0, it.fi, it.se);
		for(auto it: Era[i])
			add(0, it.fi, it.se);
		ll val = maxi[1];
		add(i, i, val + INF);
		best = max(best, val);
	}
	
	cout << best;
	
	
		
	
	
	
	
	
	
	return 0;
}
		


Measured memory_bytes: 29952
/*
 ------------------------------------------------------Read question very carefully------------------------------------------------------
 
                       In every question first approach must be basic, atleast give 15 mins for try to solve in basic approach
*/
 #include<iostream>
 #include<cstring>
 #include<string>
 #include<vector>
 #include<utility>
 #include<stdlib.h>
 #include<limits.h>
 #include<cmath>
 #include<set>
 #include<initializer_list>
 #include<unordered_set>
 #include<unordered_map>
 #include<map>
 #include<iomanip>
 #include<algorithm>
 #include<queue>
 #include<stack>
  
 #define sze 1000005
 #define ld long double
 //#define ll unsigned long long
 #define ll long long
 #define endl "\n"
 #define pb push_back
 #define mkp make_pair
 #define mod 1000000007
 #define ff first
 #define ss second
 #define F(i,a,b) for(int i = (int)(a); i <= (int)(b); i++)
 #define RF(i,a,b) for(int i = (int)(a); i >= (int)(b); i--)
 #define all(c) (c).begin(),(c).end()
 #define pi                   pair<int,int>
 #define pll                  pair<ll,ll>
  
 using namespace std;

//cout << fixed << setprecision(0) << pi <<" "<<npi<<endl;
 //const ll inf=1ll<<60;
 //const double pi = 3.14159265358979323846;

ll gcd(ll a, ll b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
      
}
ll binpow(ll a, ll b) {
    ll res = 1;
    while (b > 0) {
        if (b & 1)
            res = (res%mod * a%mod)%mod;
        a = (a%mod * a%mod)%mod;
        b >>= 1;
    }
    return res;
}
//const int N=300005;

 int main()
 {
     ios_base::sync_with_stdio(false);
     cin.tie(NULL);
     ll a; cin>>a;
     long double b; cin>>b;
     long double x = a*b;
     ll ans =  x;
     cout<<ans<<endl;
 }


Measured memory_bytes: 3748
def solve():
    k, x = read()
    result = think(k, x)
    write(result)


def read():
    return read_int(2)


def read_int(n):
    return list(map(lambda x: int(x), read_line().split(' ')))[:n]


def read_float(n):
    return list(map(lambda x: float(x), read_line().split(' ')))[:n]


def read_line(n=0):
    if n == 0:
        return input().rstrip()
    else:
        return input().rstrip()[:n]


def think(k, x):
    minimum = -1000000
    maximum = 1000000

    left = max(x - k + 1, minimum)
    right = min(x + k - 1, maximum)

    return list(range(left, right + 1))


def write(result):
    print(' '.join(map(str, result)))


if __name__ == '__main__':
    solve()

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

int main(){
	while(1){
		int n, hand[3] = {0};
		cin >> n;
		if(n == 0) break;
		hand[n - 1] = 1;
		for(int i = 1;i < 5;i++){
			int h;
			cin >> h;
			hand[h - 1] |= 1 << i;
		}
		for(int i = 0;i < 5;i++){
			int h = 0;
			while(!(hand[h] & 1 << i)) h++;
			int ans = 0;
			if(hand[(h + 1) % 3]) ans += 1;
			if(hand[(3 + h - 1) % 3]) ans += 2;
			if(ans == 0) ans = 3;
			cout << ans << endl;
		}
	}
		
	return 0;
}

Measured memory_bytes: 1160
import Foundation

var line = readLine()!.components(separatedBy: " ").map { Int($0)! }
let H1 = line[0]
let M1 = line[1]
let H2 = line[2]
let M2 = line[3]
let K = line[4]

print((H2 - H1) * 60 + (M2 - M1) - K)

Measured memory_bytes: 14176
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <limits>
#include <numeric>
#include <utility>
#include <unordered_map>
#include <unordered_set>

using namespace std;

#ifndef debug_on
#define debug_on 0
#endif

#define dbg \
    if(debug_on) cerr << "DEBUG:"
#define ast(cond)           \
    do {                    \
        if((cond) == false) \
        {                   \
            if(debug_on)    \
            cerr << "ASSERT" << #cond " failed at line:" << __LINE__ << endl;   \
            exit(1);        \
        }                   \
    }while(0)

void show(bool ok)
{
    cout << (ok ? "AC" : "WA") << endl;
    exit(0);
}
int main(int, char *[])
{
    string S;
    cin >> S;
    if(S.front() != 'A')
        show(false);

    int idx[2] = {2, S.length() - 2};
    if(idx[0] > idx[1])
        swap(idx[0], idx[1]);
    int num_C = 0;

    int c_idx = -1;
    for(int i = idx[0]; i <= idx[1]; ++i)
        if(S[i] == 'C')
        {
            c_idx = i;
            ++num_C;
        }

    if(num_C != 1)
        show(false);

    for(size_t i = 1; i < S.length(); ++i)
    {
        const char c = S[i];
        if(i == c_idx) continue;
        if(!('a' <= c && c <= 'z'))
            show(false);
    }

    show(true);

    return 0;
}


Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var x, a, b int
	fmt.Scan(&x, &a, &b)

	expire := b - a
	if expire > x {
		fmt.Println("dangerous")
	} else if expire > 0 {
		fmt.Println("safe")
	} else {
		fmt.Println("delicious")
	}
}


Measured memory_bytes: 1832
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int N;
  double T,A;
  cin>>N>>T>>A;
  vector<double>vecA(N);
  vector<double>vecB(N);
  for(int i=0;i<N;i++){
    double H;
    cin>>H;
    vecB[i]=A-T+(H*0.006);
    if((A-T+(H*0.006))>=0 )vecA[i]=A-T+(H*0.006);
    else vecA[i]=T-(H*0.006)-A;
  }
  sort(vecA.begin(),vecA.end());
  for(int i=0;i<N;i++){
    if(vecB[i]==vecA[0]){
      cout<<i+1<<endl;
      break;      
    }
    else if(vecB[i]==0-vecA[0]){
      cout<<i+1<<endl;
      break;
    }
    else continue;
  }
}
  

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<math.h>
#include<map>
using namespace std;
int main() {
    int n;
    cin >> n;
    if(n % 2 == 1){
        cout << n / 2 + 1 << endl;
    }else{
        cout << n/2 << endl;
    }
}

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

int main() {
  int N;
    cin >> N;
  vector<int> v(N);
  for(int i = 0; i < N; i++){
    cin >> v.at(i);
  }
  sort(v.begin(),v.end());
  reverse(v.begin(),v.end());
  int A = 0;
  int B = 0;
  for(int i = 0; i < (N + 1) / 2; i++){
    A += v.at(i * 2);
  }
  for(int i = 0; i < N / 2; i++){
    B += v.at(i * 2 + 1);
  }
  cout << A - B << endl;
}


Measured memory_bytes: 256
def readinput():
    n=int(input())
    a=[0]
    for _ in range(n):
        a.append(int(input()))
    return n,a

def main(n,a):
    button=[0]*(n+1)
    button[1]=1
    i=1
    count=0
    while(True):
        i=a[i]
        count+=1
        if i==2:
            return count
        if button[i]>0:
            return -1
        button[i]+=1

if __name__=='__main__':
    n,a=readinput()
    ans=main(n,a)
    print(ans)


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

int main()
{
    int N;
    cin >> N;
    set<string> S;
    rep(i, 0, N)
    {
        string x;
        cin >> x;
        S.insert(x);
    }
    cout << S.size() << endl;
}


Measured memory_bytes: 19256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
#define int long long
#define ull unsigned long long
#define ld long double
#define rep(a) rep1(i,a)
#define rep1(i,a) rep2(i,0,a)
#define rep2(i,b,a) for(int i=(b); i<((int)(a)); i++)
#define rep3(i,b,a) for(int i=(b); i>=((int)(a)); i--)
#define all(a) a.begin(),a.end()
#define pii pair<int,int>
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define sz(a) ((int)a.size())
#define pow2(x) (1ll<<(x))
#define ceiling(a,b) (((a)+(b)-1)/(b))
#define print0(a) cout << (a) << ' '
#define print1(a) cout << (a) << '\n'
#define print2(a,b) cout << (a) << ' ',print1(b)
#define print3(a,b,c) cout << (a) << ' ',print2(b,c)
#define print4(a,b,c,d) cout << (a) << ' ',print3(b,c,d)
#ifdef i_am_noob
#define debug(a) print2(#a,a)
#else
#define debug(a) 
#endif
#define ordered_set tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>
 
using namespace std;
using namespace __gnu_pbds;
 
const int Mod=1000000007,Mod2=998244353;
const int MOD=Mod;
 
inline int add(int a, int b){return (a+b>=MOD?a+b-MOD:a+b);}
inline int sub(int a, int b){return (a+MOD-b>=MOD?a-b:a+MOD-b);}
int Pow(int a, int b){
	if(!b) return 1;
	int tmp=Pow(a*a%MOD,b>>1);
	return (b&1?tmp*a%MOD:tmp);
}
inline int inverse(int n){return Pow(n,MOD-2);}
 
const int maxn=200005;
//i_am_noob
int n,k,ans=0;

signed main(){
	ios_base::sync_with_stdio(0),cin.tie(0);
	cin >> n >> k;
	rep2(i,k,n+2){
		ans=add(ans,sub(add((n-i+1+n)*i/2%MOD,1),(0+i-1)*i/2%MOD));
		//print1(ans);
	}
	print1(ans);
	return 0;
}

Measured memory_bytes: 3612
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>
#include <deque>
#include <map>

using namespace std;

using VDI = vector<deque<int>>;

void show(VDI &vd) {
	for (auto d : vd) {
		for (auto e : d) {
			cout << e << " ";
		}
		cout << endl;
	}
}

map<int, int> count_sports(VDI &vd) {
	map<int, int> sports;
	for (auto d : vd) {
		sports[d.front()]++;
	}
	return sports;
}

bool pop_fronts(VDI &vd, vector<bool> &valids) {
	for (auto &deq : vd) {
		while (!valids[deq[0]]) {
			deq.pop_front();
			if (deq.empty()) {
				return false;
			}
		}
	}
	return true;
}

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

	vector<deque<int>> a(n, deque<int>(m, 0));
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m; j++) {
			cin >> a[i][j];
		}
	}

	int ans = 1e6;
	vector<bool> valids(m + 1, true);
	while(1) {
		auto sports = count_sports(a);
		pair<int, int> max_sports = *sports.begin();

		for (pair<int, int> p : sports) {
			if (p.second > max_sports.second) {
				max_sports = p;
			}
		}

		ans = min(ans, max_sports.second);
		valids[max_sports.first] = false;

		bool go_next = pop_fronts(a, valids);

		// show(a);
		// cout << endl;

		if (!go_next) {
			break;
		}
	}


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


Measured memory_bytes: 768
#include<stdio.h>
#include<math.h>
#include<limits.h>
#include<assert.h>
#include<stdbool.h>
#include<stddef.h>
#include<stdint.h>
#include<string.h>
#include<unistd.h>
#include<stdlib.h>

#include<ctype.h>
#include<time.h>
typedef long long ll;
#define pi 3.14159
int main()
{ 
int x;
scanf("%d",&x);
printf("%d\n",x*x);



return 0;
}

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

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

    vector<int> b(100002);

    for(int i=0; i<N; i++) {
        b.at(a.at(i))++;
        b.at(a.at(i)+1)++;
        b.at(a.at(i)+2)++;
    }
    int max = *max_element(b.begin(), b.end());

    cout << max << endl;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define U [1<<17]={}
typedef long long L;using namespace std;map<L,L>T U;L P U,E U,Z U,H U,C U,A U,O U,X U,B U,k,n,a,b,c,p,r;char s U;
L D(L a){L d;Z[a]=1;for(map<L,L>::iterator I=T[a].begin();I!=T[a].end();I++)
    d=I->first,d-P[a]?P[d]=a,E[d]=E[a]+1,C[d]=I->second,D(d),Z[a]+=Z[d],!H[a]|Z[H[a]]<Z[d]?H[a]=d:0:0;}
#define G(a)((r=A[a]+A[P[a]]+C[a])%k?r:0)
L M(L i){return i?B[i]+M(i^i&-i):0;}
L S(L x,L i){for(x=G(x)+M(i++)-M(i);i<1<<17;i+=i&-i)B[i]+=x;}
L K(L a){p=X[a];n=X[b];return p-n?E[p]<E[n]?swap(p,n),swap(a,b),0:0,M(O[a])-M(O[p])+G(p)+K(P[p]):abs(M(O[a])-M(O[b]));}
main(){for(cin>>n>>k;++p<n;T[a][b]=T[b][a]=c)cin>>a>>b>>c;
       for(D(c=p=0);p<n;p++)if(!p|H[P[p]]-p)for(a=p;!c|a;S(a=H[a],O[a]=c++))X[a]=p;
       for(cin>>a;cin>>s>>a>>b;*s&2?cout<<K(a)<<endl,0:A[a]+=b,S(H[a],O[a]),a?S(a,O[a]-1):0);}

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

using int32 = int_fast32_t;
using int64 = int_fast64_t;

const int32 INF = 1e9;
const int32 MOD = 1e9+7;
const int64 LLINF = 1e18;

#define YES(n) cout << ((n) ? "YES\n" : "NO\n"  )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n"  )
#define POSSIBLE cout << ((n) ? "POSSIBLE\n" : "IMPOSSIBLE\n"  )
#define ANS(n) cout << (n) << "\n"
#define REP(i,n) for(int64 i=0;i<(n);++i)
#define FOR(i,a,b) for(int64 i=(a);i<(b);i++)
#define FORR(i,a,b) for(int64 i=(a);i>=(b);i--)
#define ALL(obj) (obj).begin(),(obj).end()
#define pii pair<int32,int32>
#define pll pair<int64,int64>
#define pb(a) push_back(a)

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  string s;
  cin >> s;
  int32 n = s.size();
  vector<int32> ans(n,0);
  int32 cnt = 0;
  int32 preR = -1;
  REP(i,n){
    if(s[i] == 'L'){
      ans[i] += cnt / 2;
      ans[i-1] += (cnt + 1) / 2;
      cnt = 0;
      if((i - preR) % 2 == 0){
        ans[preR]++;
      }else{
        ans[preR+1]++;
      }
    }else{
      preR = i;
      cnt++;
    }
  }
  REP(i,n){
    if(i != 0)cout << " ";
    cout << ans[i];
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 1488
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll GCD(ll a,ll b) {
    ll r;
    while(b) {
        r = b;
        b = a % b;
        a = r;
    }
    return a;
}
int n;
set<ll> num;
int main() {
    scanf("%d",&n);
    for(int i=0,pos;i<=n;i++)
        scanf("%d",&pos),
        num.insert(1ll*pos);
    ll las=0,ans;
    for(set<ll>::iterator it=num.begin();it!=num.end();it++){
        ll val=*it;
        if(!las) {las=val;continue;}
        if(las==*num.begin()) ans=val-las;
        else ans=GCD(ans,val-las);
        las=val;
    }
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 4992
object Main extends App {
  val in = new java.util.Scanner(System.in)
  val N = in.nextInt
  val X = in.nextLong
  val lStream: Stream[Long] = 1L #:: lStream.map(_ * 2 + 3)
  val ls = lStream.take(N + 1).toArray
  val pStream: Stream[Long] = 1L #:: pStream.map(_ * 2 + 1)
  val ps = pStream.take(N + 1).toArray

  def count(l: Int, eat: Long): Long = {
    lazy val ll = ls(l - 1)
    if (eat == 1) (if (l == 0) 1 else 0)
    else if (eat <= 1 + ll) count(l - 1, eat - 1)
    else if (eat == 1 + ll + 1) ps(l - 1) + 1
    else if (eat <= 1 + ll + 1 + ll) ps(l - 1) + 1 + count(l - 1, eat - ll - 2)
    else ps(l - 1) * 2 + 1
  }

  println(count(N, X))
}

Measured memory_bytes: 27444
def main():
    n = int(input())
    s = input()
    ans = 0
    for i in range(n):
        if i == 0:
            ans += 1
            mae = s[i]
        else:
            if s[i] != mae:
                ans += 1
                mae = s[i]
    print(ans)


    
if __name__ == "__main__":
    main()


Measured memory_bytes: 67480
import std.stdio, std.conv, std.string;

void main() {
    int n,m,k;
    scanf("%d %d %d", &n, &m, &k);

    foreach (i;0..(m+1)) {
	foreach (j;0..(n+1)) {
	    auto a = n*i + (m-2*i)*j;
	    if (a == k) { writeln("Yes"); return; }
	}
    }
    writeln("No");
}


Measured memory_bytes: 256
import sys
import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N, A, B, C, D = map(int, read().split())

N -= 1

x = np.arange(N + 1, dtype=np.int64)  # 増加回数
low = C * x - D * (N - x)
high = D * x - C * (N - x)

diff = B - A
cond = np.any((low <= diff) & (diff <= high))
print('YES' if cond else 'NO')

Measured memory_bytes: 42708
#include <cstdio>
#include <iostream>
#include <algorithm>
#define ll long long
using namespace std;
const ll N=500010;
ll n,Q,m,d[N],g[N],f[N];
int main()
{
    scanf("%lld%lld",&n,&m),g[0]=m;
    for (ll i=1;i<=n;i++) scanf("%lld",&d[i]),g[i]=min(g[i-1],abs(g[i-1]-d[i]));
    for (ll i=n;i>=1;i--)
    {
        f[i]=f[i+1];
        if (d[i]<=2*f[i+1]+1) f[i]=max(f[i],f[i+1]+d[i]);
    }
    scanf("%lld",&Q);
    for (ll i=1,x;i<=Q;i++)
    {
        scanf("%lld",&x);
        if (g[x-1]>f[x+1]) printf("YES\n"); else printf("NO\n");
	}
}

Measured memory_bytes: 13696
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<math.h>
#include<stdlib.h>
#include<string>
#include<iostream>
using namespace std;
typedef long long ll;
ll com[60][60];
int main()
{
	int num, lb, ub;
	scanf("%d%d%d", &num, &lb, &ub);
	vector<ll>v;
	for (int i = 0; i < num; i++)
	{
		ll z;
		scanf("%lld", &z);
		v.push_back(z);
	}
	sort(v.begin(), v.end());
	reverse(v.begin(), v.end());
	for (int i = 0; i < 60; i++)
	{
		com[i][0] = 1;
		for (int j = 1; j <= i; j++)com[i][j] = com[i - 1][j - 1] + com[i - 1][j];
	}
	double s = 0;
	for (int i = 0; i < lb; i++)s += v[i];
	printf("%lf\n", s / lb);
	int c = 0, d = 0;
	for (int i = 0; i < num; i++)
	{
		if (v[lb - 1] == v[i])
		{
			c++;
			if (i <= lb - 1)d++;
		}
	}
	ll ans = 0;
	if (v[0] == v[lb - 1])
	{
		for (int i = lb; i <= ub; i++)
		{
			ans += com[c][i];
		}
	}
	else ans = com[c][d];
	printf("%lld\n", ans);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    vector<int> vc;
    for(int i=0; i<=4; i++){
        cin >> n;
        vc.push_back(n);     
    }
    sort(vc.begin(),vc.begin()+3);
    sort(vc.begin()+3,vc.end());
    cout << vc[0]+vc[3]-50 <<endl;
    return 0;
}

Measured memory_bytes: 3144
#include <bits/stdc++.h>
using namespace std;
const int N = 200005;
const int mod = 1000000007;
int n, a[N], b[N];
int f[4005][4005];
long long fact[8005], invfact[8005], inv[8005];
long long C(int n, int m) {
	return fact[n] * invfact[m] % mod * invfact[n - m] % mod;
}
int main() {
	inv[1] = 1;
	for (int i = 2; i <= 8000; i++)
		inv[i] = (mod - mod / i) * inv[mod % i] % mod;
	fact[0] = invfact[0] = 1;
	for (int i = 1; i <= 8000; i++) {
		fact[i] = fact[i - 1] * i % mod;
		invfact[i] = invfact[i - 1] * inv[i] % mod;
	}
	scanf("%d", &n);
	for (int i = 1; i <= n; i++) {
		scanf("%d%d", &a[i], &b[i]);
		f[2001 - a[i]][2001 - b[i]]++;
	}
	for (int i = 1; i <= 4001; i++)
		for (int j = 1; j <= 4001; j++)
			f[i][j] = (f[i][j] + (f[i - 1][j] + f[i][j - 1]) % mod) % mod;
	long long ans = 0;
	for (int i = 1; i <= n; i++) {
		ans = (ans + f[2001 + a[i]][2001 + b[i]]) % mod;
		ans = (ans + mod - C(a[i] * 2 + b[i] * 2, a[i] * 2)) % mod;
	}
	ans = ans * inv[2] % mod;
	printf("%lld\n", ans);
	return 0;
}

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

    /*
    ||||||||||||||||||||||||||||||||||||||||||||||||
       |      |||         |      ||||    ||||  |   |
      | |     |   |      | |     |   |  |      |   |
     |   |    |    |    |   |    |   |  |      |   |
    |||||||   |    |   |||||||   |||     |||   |||||
    |     |   |   |    |     |   | |        |  |   |
    |     |   |||      |     |   |  ||  ||||   |   |
    ||||||||||||||||||||||||||||||||||||||||||||||||

    */
    using namespace std;
    #define ff first
    #define ss second
    #define mp make_pair
    #define all(v) v.begin(),v.end()
    #define int long long
    #define ll long long
    #define M 1000000007

    #define mii  map<ll ,ll >
    #define msi  map<string,ll >
    #define mis  map<ll int, string>
    #define rep(a,b)    for(ll i=a;i<b;i++)
    #define rep0(n)    for(ll i=0;i<n;i++)
    #define repi(i,a,b) for(ll i=a;i<b;i++)
    #define pb push_back
    #define vi vector<ll>
    #define mp make_pair
    #define vs vector<string>
    #define ppb pop_back
    #define endl '\n'
    #define asdf ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    #define r0 return 0;
    #define FORD(i, a, b) for (int i = (int) (a); i >= (int) (b); --i)
    #define FORE(it, c) for (__typeof((c).begin()) it = (c).begin(); it != (c).end(); ++it)
    #define inputoutput freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
    #define input freopen("input.txt", "r", stdin);
    #define Set(a, s) 4(a, s, sizeof (a))
    #define FOR repi
    //#define float long double
    ll max(ll a, ll b) { return (a > b)? a : b;}
    int min(int a, int b) { return (a < b)? a : b;}


     int solve()
     {
         int n,m;   
         cin>>n>>m;
         vi d(n+1,0);
         rep0(m){
            int l,r;
            cin>>l>>r;
            d[l]++;
            d[r+1]--;
            
         }
         int ans=0;
         vi a(n+1);
         rep(1,n+1)
         a[i]=d[i]+a[i-1];
         rep(1,n+1) if(a[i]==m) ans++;
         cout<<ans;     }
    signed main()
    {   
        
        int t=1;
        //cin>>t;
        while(t--)
        {
            solve();
        }     
        
}

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

int main(){
    string s;
    cin >> s;
    int c = 0;
    
    if(count(s.begin(), s.end(), 'R') > 0){
        int value = 1;
        for(int i = 0; i<3; i++){
            while(s[i] == s[i+1] && s[i] == 'R'){
                i++;
                value += 1;
            }
            c = value;
        }
    }
    cout << c << endl;
    return 0;
}

Measured memory_bytes: 3632
#include<bitset>
#include<math.h>
#include<limits.h>
#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<sstream>
#include<list>
#include<queue>
#include<algorithm>
#include<functional>
#include<map>
#include<set>
#include<utility>
#include<initializer_list>
#include<tuple>
#include<regex>
using namespace std;
#define ull unsigned long long
#define ll long long
#define rep(i, n) for(int i=0;i<(int)(n);i++)
#define rep1n(i, n) for(int i=1;i<=(int)(n);i++)
#define all(t) t.begin(), t.end()
#define rall(t) t.rbegin(), t.rend()
#define mat(type, row, col, init) vector<vector<type>>(row, vector<type>(col, init));
#define Yes(cond) cout<<(cond? "Yes":"No")<<endl;
#define YES(cond) cout<<(cond? "YES":"NO")<<endl;
struct edge {
	int to, cap, rev;
};
const int MAX_V = 300;
const int INF = INT32_MAX;
vector<bool>used(MAX_V);
vector<edge>G[MAX_V];
void add_edge(int from, int to, int cap) {
	G[from].push_back(edge({ to, cap, (int)G[to].size() }));
	G[to].push_back(edge({ from, 0, (int)G[from].size() - 1 }));

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


	return 0;
}
int max_flow(int s, int t) {
	int flow = 0;
	for (;;) {
		rep(i, MAX_V)used[i] = 0;
		int f = dfs(s, t, INF);
		if (f == 0)return flow;
		flow += f;
	}
}







int main() {

	int n;
	cin >> n;
	vector<int>a(n), b(n), c(n), d(n);
	rep(i, n)cin >> a[i] >> b[i];
	rep(i, n)cin >> c[i] >> d[i];
	int s = 2*n ;
	int t = 2*n + 1;
	rep(i, n) {
		add_edge(s, i, 1);
		add_edge(n + i, t, 1);
	}
		
	rep(i, n) {
		rep(j, n) {
			if (a[i] < c[j] && b[i] < d[j]) {
				add_edge(i, j+n, 1);
			}
		}
	}
	cout << max_flow(s, t);
	

	return 0;
}





Measured memory_bytes: 384
#include "iostream"
#include "vector"
#include "array"
#include "string"
#include "algorithm"

using namespace std;
#define rep(p,q) for(int i = p;i < q;i++)

//c
int main(void) {
	int n = 0;
	vector<int> a = vector<int>();
	a.push_back(0);
	cin >> n;
	int max_price = 0;
	vector<int> original_diff = vector<int>(); // i番目に|a[i + 1]-a[i] ()
	vector<int> acutual_diff = vector<int>(); // i - 1番目に|a[i+1]-a[i - 1]| (iは消えた点の番号)
	rep(1, n + 1) {
		int num = 0;
		cin >> num;
		a.push_back(num);
		original_diff.push_back(abs(a[i] - a[i - 1]));
		max_price += original_diff[i-1];
		
		if (i > 1) {
			acutual_diff.push_back(abs(a[i] - a[i - 2]));
		}
		if (i == n) {
			a.push_back(0);
			original_diff.push_back(abs(a[i + 1] - a[i]));
			max_price += original_diff[i];
			acutual_diff.push_back(abs(a[i + 1] - a[i - 1]));
		}
	}
	rep(0, n) {
		int ans = 0;
		ans = max_price - (original_diff[i] + original_diff[i + 1]) + acutual_diff[i];
		

		cout << ans << endl;
	}
}

Measured memory_bytes: 2668
#include <iostream>

using namespace std;

int main(void)
{	
	int n;
	cin >> n;
	if (n < 1200) {
		cout << "ABC" << endl;
	}
	else if (n < 2800) {
		cout << "ARC" << endl;
	}
	else {
		cout << "AGC" << endl;
	}
	
	return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) {
        try {
            // 標準入力
            InputStreamReader isr = new InputStreamReader(System.in);
            BufferedReader br = new BufferedReader(isr);
            String strArr[] = br.readLine().split(" ");
            int a = Integer.parseInt(strArr[0]);
            int b = Integer.parseInt(strArr[1]);
            int c = Integer.parseInt(strArr[2]);
            boolean trueFlag = false;
            for (int i = 0; i < b; i++) {
                if ((i * b + c) % a == 0) {
                    System.out.println("YES");
                    trueFlag = true;
                    break;
                }
            }
            if (!trueFlag) {
                System.out.println("NO");
            }
        } catch (IOException e) {
            e.printStackTrace();
           }
    }
}


Measured memory_bytes: 21332
import sys
input = sys.stdin.readline
x, y, z, k = map(int,input().split())
a =list(map(int,input().split()))
b =list(map(int,input().split()))
c =list(map(int,input().split()))
c.sort(reverse=True)
ab = [0]*(x*y)
l = 0
for i in range(x):
    for j in range(y):
        ab[l] = a[i] + b[j]
        l += 1

ab.sort(reverse=True)
q = 0
i = 0
j = 0
ans = [0]*(k*k)
l = 0
for i in range(min(k,x*y)):
    for j in range(min(k,z)):
        ans[l] = ab[i] + c[j]
        l += 1

ans.sort(reverse=True)

for i in range(k):
    print(ans[i])

Measured memory_bytes: 159156
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define int long long
#define inf 1000000007
#define LINF 1000000000000000007LL
#define ll long long
using namespace std;
std::complex<double> Circumcenter(std::complex<double> a, std::complex<double> b, std::complex<double> c) {

	double eAB = abs(b - a);
	double eBC = abs(c - b);
	double eCA = abs(a - c);

	double aCAB = acos((eCA*eCA + eAB*eAB - eBC*eBC) / (2 * eCA*eAB));
	double aABC = acos((eAB*eAB + eBC*eBC - eCA*eCA) / (2 * eAB*eBC));
	double aBCA = acos((eBC*eBC + eCA*eCA - eAB*eAB) / (2 * eBC*eCA));

	double A = sin(2 * aCAB);
	double B = sin(2 * aABC);
	double C = sin(2 * aBCA);

	std::complex<double> ans;
	ans.real((A*a.real() + B*b.real() + C*c.real()) / (A + B + C));
	ans.imag((A*a.imag() + B*b.imag() + C*c.imag()) / (A + B + C));

	return(ans);
} 

double Circumradius(std::complex<double> a, std::complex<double> b, std::complex<double> c) {

	double eAB = abs(b - a);
	double eBC = abs(c - b);
	double eCA = abs(a - c);

	double aCAB = acos((eCA*eCA + eAB*eAB - eBC*eBC) / (2 * eCA*eAB));
	double R = 0.5*eBC / sin(aCAB);

	return(R);

}
double dis( double x, double y ){
	return sqrt( x * x + y * y);
}
signed main(){
	int n;
	cin>>n;
	vector<double> x(n),y(n);
	for(int i=0;i<n;i++){
		int xx,yy;
		cin>>xx>>yy;
		x[i] = 1.0 * xx; y[i] = 1.0 * yy;
	}
	double ans = 114514.1919810;
	double eps = 0.00000001;
	for(int i=0;i<n;i++){
		for(int j=i+1;j<n;j++){
			double cx = ( x[i] + x[j] )/2, cy = (y[i] + y[j] )/2;
			double cr = dis( x[i] - cx, y[i] - cy );
			bool fl = true;
			for(int k=0;k<n;k++){
				if( dis( x[k] - cx, y[k] - cy ) > cr + eps ) fl = false;
			}
			if( fl ) ans = min( ans, cr );
		}
	}
	for(int i=0;i<n;i++){
		for(int j=i+1;j<n;j++){
			for(int k=j+1;k<n;k++){
				complex<double> ci(x[i],y[i]), cj(x[j],y[j]), ck(x[k],y[k]);
				complex<double> ctr = Circumcenter(ci,cj,ck);
				double cr = Circumradius(ci,cj,ck);
				double cx = ctr.real();
				double cy = ctr.imag();
				bool fl = true;
				for(int p=0;p<n;p++){
					if( dis( x[p] - cx, y[p] - cy ) > cr + eps ) fl = false;
				}
				if( fl ) ans = min(ans,cr);
			}
		}
	}
	cout<<setprecision(16)<<ans<<endl;
	return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>
#include <string>
#define shosu(x) fixed<<setprecision(x)
using namespace std;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,P> pip;
typedef long long ll;
const int inf=1<<30;
const double pi=acos(-1);

int n;

int main(){
	while(cin>>n){
		cout<<(n*n+n+2)/2<<endl;
	}
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
using namespace std;
#define int long long
int n,k,s[200005],ans;
int sol(int l,int r,int k)
{
	return (l+r)*k/2;
}
signed main()
{
	cin>>n>>k;
	for(int i=k;i<=n+1;i++)
	{
		ans+=sol(n-i+1,n,i)-sol(0,i-1,i)+1;
		ans%=1000000007;
	}
	cout<<ans;
}

Measured memory_bytes: 3604
import java.util.Arrays;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();

        int[] arr = new int[]{a, b, c};
        Arrays.sort(arr);
        for (int i = 0; i < arr.length; i++) {
            if (i == 2) {
                System.out.println(arr[i]);
            } else {
                System.out.print(arr[i] + " ");

            }
        }
    }
}



Measured memory_bytes: 26152
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef double d;
typedef vector<ll> v;
typedef pair<ll,ll> p;
ll mod=1000000007;

void solve(){
	ll n;
	cin>>n;
	ll ac=0,tle=0, wa=0, re=0;
	for(ll i=0;i<n;i++){
		string x;
		cin>>x;
		if(x=="AC")ac++;
		else if(x=="TLE")tle++;
		else if(x=="WA")wa++;
		else if(x=="RE")re++;
	}
	cout<<"AC x "<<ac<<endl;
	cout<<"WA x "<<wa<<endl;
	cout<<"TLE x "<<tle<<endl;
	cout<<"RE x "<<re<<endl;
}


int main()
{
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);

	int test=1;
	//cin>>test;
	while(test--){
		solve();
	}
}

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

using namespace std;
const int N = 20 + 5;
const int A = 50 + 5;

int n, a, b;

int res;

int main()
{
    scanf("%d%d%d", &n, &a, &b);
   
    res = min(n * a, b);
    printf("%d", res);
}

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


int main() {
  ll n;cin >> n;
  vector<ll> a(n);
  rep(i,n) cin >> a.at(i);

  // rep(i,2){
  //   for(ll i=0;i<n-1;++i){
  //     ll sum = a.at(i) + a.at(i+1);
  //     if( sum < 0 ){
  //       a.at(i) *= -1;
  //       a.at(i+1) *= -1;
  //     }
  //   }
  // }
  // ll ans = 0;
  // rep(i,n) ans += a.at(i);

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

  ll cnt = 0;
  rep(i,n){
    if( a.at(i) < 0 ) ++cnt;
  }

  ll ans = 0;
  rep(i,n) ans += abs(a.at(i));

  if( cnt%2 != 0 ){
    ll m = 9999999999;
    rep(i,n) m = min(m,abs(a.at(i)));
    ans -= m*2;
  }


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

Measured memory_bytes: 4008
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

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

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif

using namespace std;

#define _GLIBCXX_DEBUG

using _loop_ll = long long;
#define REP(i,n) for(_loop_ll (i)=0; (i)<(_loop_ll)(n); (i)++)
#define FOR(i,a,b) for(_loop_ll (i)=(_loop_ll)(a); (i)<(_loop_ll)(b); (i)++)
#define FORR(i,a,b) for(_loop_ll (i)=(_loop_ll)(b)-1; (i)>=(_loop_ll)(a); (i)--)
 
#define ALL(v) (v).begin(),(v).end()
 
#define DEBUG(x) cerr<<#x<<": "<<(x)<<endl
#define DEBUG_VEC(v) cerr<<#v<<": ";REP(__i,(v).size())cerr<<((v)[__i])<<", ";cerr<<endl

using ll = long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vvl = vector<vl>;

constexpr long long int MOD = 1e9 + 7;

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

    vl a(n);
    REP(i, n) cin >> a[i];

    set<ll> s;
    REP(i, n){
        auto it = s.find(a[i]);
        if(it != s.end()){
            cout << "NO" << endl;
            return 0;
        }
        s.insert(a[i]);
    }

    cout << "YES" << endl;

    return 0;
};


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

int main() {
  int N,Y,tmp;
  cin >>N>>Y;
  for(int i=0;i<=N;i++){
    for(int j=0;j<=N;j++){
      tmp=10000*i+5000*j+1000*(N-i-j);
      if(tmp==Y&&i+j<=N){
        cout <<i<<" "<<j<<" "<<N-(i+j)<<endl;
        return 0;
      }
    }
  }
  cout<<"-1 -1 -1"<<endl;
}

Measured memory_bytes: 256