akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
int a;
int main(){
	ios::sync_with_stdio(0);
	cin>>a;
	if(a==1){
		cout<<"1.0000000000";
		return 0;	
	}
	if(a%2==0){
		cout<<"0.5000000000";
		return 0;	
	}
	printf("%.7lf",((a+1)/2)/(double)a);
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;

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

    vl a(n);
    rep(i, n) {
        cin >> a[i];
    }

    vvl dp(n+1, vl(n+1));  // dp[l][r] : 区間a[l]～a[r-1]から始めて二人が最適に行動したときのx-yの値
    exrep(len, 1, n) {
        for(ll l = 0; l + len <= n; l++) {
            ll r = l + len;
            // 先手
            if((n - len)%2 == 0) {
                dp[l][r] = max(dp[l+1][r] + a[l], dp[l][r-1] + a[r-1]);
            }
            // 後手
            else {
                dp[l][r] = min(dp[l+1][r] - a[l], dp[l][r-1] - a[r-1]);
            }
        }
    }
    
    out(dp[0][n]);
    re0;
}

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

int main(){
int n,m,l;
long long A[101][101],B[101][101],C[101][101];

cin >>n >>m >>l;
for(int i=0;i<n;i++){
for(int j=0;j<m;j++){
cin >>A[i][j];
}
}
for(int i=0;i<m;i++){
for(int j=0;j<l;j++){
cin >>B[i][j];
}
}
for(int i=0;i<n;i++){
for(int j=0;j<l;j++){
C[i][j]=0;
for(int k=0;k<m;k++){
C[i][j]+=A[i][k]*B[k][j];
}
}
}
for(int i=0;i<n;i++){
for(int j=0;j<l;j++){
if(j) cout <<" ";
cout <<C[i][j];
}
cout <<endl;
}
return 0;
}

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

int sx, sy, tx, ty;

int main() {
    cin >> sx >> sy >> tx >> ty;

    for (int i = sx; i < tx; i++) {
        cout << "R";
    }
    for (int i = sy; i < ty; i++) {
        cout << "U";
    }

    for (int i = tx; i > sx; i--) {
        cout << "L";
    }
    for (int i = ty; i > sy; i--) {
        cout << "D";
    }
    
    cout << "D";
    for (int i = sx; i <= tx; i++) {
        cout << "R";
    }
    for (int i = sy; i <= ty; i++) {
        cout << "U";
    }

    cout << "L" << "U";
    for (int i = tx; i >= sx; i--) {
        cout << "L";
    }
    for (int i = ty; i >= sy; i--) {
        cout << "D";
    }
    cout << "R" << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define ALL(x) x.begin(), x.end()
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
using ll = long long;
using lld = long double;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<ll>;
using VVL = vector<VL>;
using PII = pair<int, int>;
random_device rnd;
mt19937 mt(rnd());

double PI = 6.28318530717958623200 / 2.0;

const int IINF = 1 << 30;
const ll INF = 1ll << 60;
const ll MOD = 1e9 + 7;

ll mpow(ll base, ll num)
{
    if (num == 0)
    {
        return 1;
    }
    ll prev = mpow(base, num / 2);
    if (num % 2 == 0)
    {
        return (prev * prev) % MOD;
    }
    else
    {
        return (prev * prev * base) % MOD;
    }
}

int main()
{
    int n, k;
    cin >> n >> k;
    ll ans = 0;
    ll curMax = 0;
    ll curMin = 0;

    rep(i, k)
    {
        curMax += n - i;
        curMin += i;
    }
    rep(i, k, n + 2)
    {
        ans += curMax - curMin + 1;
        //  cerr << curMax << " " << curMin << endl;
        curMax += n - i;
        curMin += i;
        ans %= MOD;
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3604
#include <iostream>
#include <iomanip>
#include <cmath>
#include <functional>
#include <algorithm>
#include <numeric>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <deque>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <boost/range/irange.hpp>
#include <boost/container/static_vector.hpp>
#include <boost/utility/string_ref.hpp>

class input
{
    std::istream& cin;

public:
    input() : cin(std::cin)
    {
        std::cin.tie(nullptr);
        std::ios::sync_with_stdio(false);
    }

    template <class T>
    inline input& operator>>(T& var)
    {
        cin >> var;
        return *this;
    }
    template <class T>
    inline input& operator,(T& var)
    {
        cin >> var;
        return *this;
    }

    template <class T>
    inline T read()
    {
        T var;
        cin >> var;
        return var;
    }

    template <class InputIterator>
    inline void read(InputIterator head, std::size_t n)
    {
        for (std::size_t i = 0; i < n; ++i) {
            cin >> *head;
            ++head;
        }
    }

    template <class T>
    inline std::vector<T> read(std::size_t n)
    {
        std::vector<T> res;
        res.reserve(n);

        for (std::size_t i = 0; i < n; ++i) {
            T tmp;
            cin >> tmp;
            res.emplace_back(tmp);
        }
        return res;
    }

    template <class T, class F>
    inline void online(std::size_t n, F&& f)
    {
        T var;
        for (std::size_t i = 0; i < n; ++i) {
            cin >> var;
            f(var);
        }
    }
};
template <class T, std::size_t n>
std::istream& operator>>(std::istream& in, std::array<T, n>& var)
{
    for (std::size_t i = 0; i < n; ++i) {
        in >> var[i];
    }
    return in;
}

class output
{
    std::ostream& cout;

public:
    class proxy
    {
        std::ostream& cout;

    public:
        proxy() : cout(std::cout) {}
        ~proxy() { cout << '\n'; }
        template <class T>
        proxy& operator,(T&& val)
        {
            cout << ' ' << val;
            return *this;
        }
    };

public:
    output() : cout(std::cout)
    {
        cout << std::fixed << std::setprecision(15);
    }

    template <class T>
    proxy operator<<(T&& val)
    {
        cout << val;
        return {};
    }

    template <class T>
    void print(const T& container)
    {
        bool first = true;
        for (auto&& x : container) {
            if (!first) {
                cout << ' ';
                first = false;
            }
            cout << x;
        }
    }
};

int main()
{
    input in;
    output out;

    std::uint64_t N, K;
    in >> N, K;
    std::vector<std::uint64_t> S(N + 1);
    for (auto i : boost::irange<std::uint64_t>(0, N)) {
        S[i + 1] = (S[i] + in.read<std::uint64_t>() - 1) % K;
    }
    std::uint64_t res = 0;
    std::map<std::uint64_t, std::uint64_t> m;
    for (auto i : boost::irange<std::uint64_t>(0, N + 1)) {
        if (K <= i) {
            m[S[i - K]]--;
        }
        res += m[S[i]];
        m[S[i]]++;
    }
    out << res;

    return 0;
}


Measured memory_bytes: 14336
#include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>

using namespace std;

#define FOR(i,k,n) for(int i=(k); i<(int)n; ++i)
#define REP(i,n) FOR(i,0,n)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

template<class T> void debug(T begin, T end){ for(T i = begin; i != end; ++i) cout<<*i<<" "; cout<<endl; }

typedef long long ll;
const int INF = 100000000;
const double EPS = 1e-8;
const int MOD = 1000000007;

bool is_prime(ll n){
	for(int i = 2; (ll)i * i <= n; i++){
		if(n % i == 0) return false;
	}
	return n != 1;
}

int main(){
	int n;
	while(cin>>n,n){
		if(is_prime(n))cout<<"0"<<endl;
		else{
			int ans = 0;
			for(int i = n - 1; i >= 2; i--){
				if(is_prime(i)){
					ans += abs(n - i);
					break;
				}
			}
			for(int i = n + 1; i <= INF; i++){
				if(is_prime(i)){
					ans += abs(n - i);
					break;
				}
			}
			cout<<ans<<endl;
		}
	}
	return 0;
}

Measured memory_bytes: 868
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; ++i)
#define REPP(i, n) for(int i = 1; i <= n; ++i)
#define REPR(i, n) for(int i = n-1; i >= 0; --i)
#define FOR(i, m, n) for(int i = m; i < n; ++i)
#define ALL(v) v.begin(), v.end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 1000000007;
const ll INF = 1000000000;

struct LowLink {
    vector<P> bridge;
    vector<int> ord,low,articulation;
    vector<bool> used;
    vector<vector<int>> g;
    int n, k = 0;
    LowLink(const vector<vector<int>> &g) : g(g) {
        n = g.size();
        ord.resize(n, -1);
        low.resize(n, -1);
        used.resize(n, false);
    }
    void dfs(int v, int pre) {
        used[v] = true;
        ord[v] = k++;
        low[v] = ord[v];
        bool isArticulation = false;
        int cnt = 0;
        for(auto &to : g[v]) if(to != pre) {
            if(!used[to]) {
                cnt ++;
                dfs(to, v);
                low[v] = min(low[v], low[to]);
                if(low[to]>ord[v]) {
                    bridge.emplace_back(min(v,to), max(v,to));
                }
                if(pre != -1 && low[to]>=ord[v]) {
                    isArticulation = true;
                }
            }
            else {
                low[v] = min(low[v], ord[to]);
            }
        }
        if(pre == -1 && cnt>1) isArticulation = true;
        if(isArticulation) articulation.push_back(v);
    }
};

int main() {
    int n,m; cin >> n >> m;
    vector<vector<int>> g(n);
    REP(i,m) {
        int a,b; cin >> a >> b; a--, b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    LowLink ans(g);
    ans.dfs(0,-1);
    cout << ans.bridge.size() << endl;
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <complex>
#include <vector>
#include <limits>
#include <iomanip>
#include <cassert>

using namespace std;

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

#define debug(x) cout << #x << " = " << (x) << endl;
#define rep(i, n) for(int i = 0;i < n;i++)
#define repr(i, n) for(int i = n-1;i >= 0;i--)
#define pb push_back
#define mp make_pair
#define F first
#define S second

const long double pi = 3.141592653589793;
const int mod = 1e9 + 7;

int A[200], n;

int main() {

 // freopen("input.in","r",stdin);
 // freopen("output.out","w",stdout);

 ios_base::sync_with_stdio(false);
 cin.tie(nullptr);
 cin>>n;
 rep(i,n) {
   cin>>A[i]>>A[i+1];
   A[i] = (A[i] == A[i+1]);
 }
 A[n]=0;
 rep(i,n) {
   if(A[i]+A[i+1]+A[i+2] == 3) {
     cout<<"Yes"<<endl;return 0;
   }
 }
 cout<<"No";



 return 0;
}


Measured memory_bytes: 3648
#include<iostream>
using namespace std;
int main()
{
int x;
cin>>x;
if(x==25)
    cout<<"Christmas";
else if(x==24)
    cout<<"Christmas Eve";
    else if(x==23)
        cout<<"Christmas Eve Eve";
else if(x==22)
    cout<<"Christmas Eve Eve Eve";
 return 0;
}


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

vector<int> A;
vector<int> nums = {3, 5, 7};
ll ans = 0;

void dfs(vector<int> &A, int N) {

    if (A.size() > to_string(N).size()) {
        return;
    }

    int num = 0, cnt = A.size() - 1;
    bool judge3 = 0, judge5 = 0, judge7 = 0;
    for (auto a : A) {
        num += a * pow(10, cnt);
        if (a == 3)
            judge3 = true;
        if (a == 5)
            judge5 = true;
        if (a == 7)
            judge7 = true;

        cnt--;
    }

    if (judge3 && judge5 && judge7) {
        if (num <= N)
            ans++;
    }

    for (int i = 0; i < 3; i++) {
        A.push_back(nums[i]);
        dfs(A, N);
        A.pop_back();
    }
}

int main() {
    int N;
    cin >> N;
    vector<int> A;
    dfs(A, N);
    cout << ans << endl;
}

Measured memory_bytes: 384
#include <algorithm>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for(int(i) = 0; (i) < (n); (i)++)
#define FOR(i, m, n) for(int(i) = (m); (i) < (n); (i)++)
#define All(v) (v).begin(), (v).end()
#define pb push_back
#define MP(a, b) make_pair((a), (b))
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const int INF = 1 << 30;
const ll LINF = 1LL << 60;
const int MOD = 1e9 + 7;

template <uint_fast64_t MOD> class ModInt {
    using u64 = uint_fast64_t;

  public:
    u64 val;

    ModInt(const u64 x = 0) : val(x % MOD) {}
    constexpr u64 &value() { return val; }
    constexpr ModInt operator-() { return val ? MOD - val : 0; }
    constexpr ModInt operator+(const ModInt &rhs) const {
        return ModInt(*this) += rhs;
    }
    constexpr ModInt operator-(const ModInt &rhs) const {
        return ModInt(*this) -= rhs;
    }
    constexpr ModInt operator*(const ModInt &rhs) const {
        return ModInt(*this) *= rhs;
    }
    constexpr ModInt operator/(const ModInt &rhs) const {
        return ModInt(*this) /= rhs;
    }
    constexpr ModInt &operator+=(const ModInt &rhs) {
        val += rhs.val;
        if(val >= MOD) {
            val -= MOD;
        }
        return *this;
    }
    constexpr ModInt &operator-=(const ModInt &rhs) {
        if(val < rhs.val) {
            val += MOD;
        }
        val -= rhs.val;
        return *this;
    }
    constexpr ModInt &operator*=(const ModInt &rhs) {
        val = val * rhs.val % MOD;
        return *this;
    }

    constexpr ModInt &operator/=(const ModInt &rhs) {
        *this *= rhs.inv();
        return *this;
    }

    constexpr bool operator==(const ModInt &rhs) { return this->a == rhs.a; }
    constexpr bool operator!=(const ModInt &rhs) { return this->a != rhs.a; }
    friend constexpr ostream &operator<<(ostream &os, const ModInt<MOD> &x) {
        return os << x.val;
    }
    friend constexpr istream &operator>>(istream &is, ModInt<MOD> &x) {
        return is >> x.val;
    }

    constexpr ModInt inv() const { return ModInt(*this).pow(MOD - 2); }

    constexpr ModInt pow(int e) const {
        u64 x = 1, p = val;
        while(e > 0) {
            if(e % 2 == 0) {
                p = (p * p) % MOD;
                e /= 2;
            } else {
                x = (x * p) % MOD;
                e--;
            }
        }
        return ModInt(x);
    }
};

int main() {
    int N, a, b;
    cin >> N >> a >> b;
    using mint = ModInt<MOD>;
    mint res = mint(2).pow(N) - mint(1);
    mint nCa = 1, nCb = 1;
    for(int i = 0; i < a; i++) {
        nCa *= mint(N - i);
        nCa /= mint(i + 1);
    }
    for(int i = 0; i < b; i++) {
        nCb *= mint(N - i);
        nCb /= mint(i + 1);
    }
    cout << res - nCb - nCa << endl;
    return 0;
}

Measured memory_bytes: 3632
h,w,k = map(int, input().split())
sx,sy,gx,gy = map(lambda x: int(x)-1, input().split())
board = [list(map(lambda x: int(x=="."), input())) for i in range(h)]
inf = 1<<30
DP = [[inf for j in range(w)] for i in range(h)]
DP[sx][sy] = 0

from collections import deque
que = deque([(sx,sy)])

dxdy = [(0,1),(1,0),(0,-1),(-1,0)]
while que:
    x,y = que.popleft()
    for dx,dy in dxdy:
        nx,ny = x,y
        for i in range(k):
            nx += dx
            ny += dy
            if not(0<=nx<h and 0<=ny<w and board[nx][ny] and DP[nx][ny] >= DP[x][y]+1):
                break
            # コストが変わらない場合は無視か...
            if DP[nx][ny] == DP[x][y]+1:
                continue
            DP[nx][ny] = DP[x][y]+1
            que.append((nx,ny))
ans = DP[gx][gy]
if ans == inf:
    ans = -1
print(ans)

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

struct data{
	int id;
	int num;
};

bool comp(data d1, data d2){
	if(d1.num > d2.num){
		return true;
	}else{
		return false;
	}
}

int main(){
	data d;
	char c;
	int n;
	vector<data> vd;
	while(cin >> d.id >> c >> d.num){
		if(d.id == 0 && d.num == 0) break;
		vd.push_back(d);
	}
	sort(vd.begin(), vd.end(), comp);
	while(cin >> n){
		int count = 1;
		int a = vd[0].num;
		vector<data>::iterator iter = vd.begin();
		while((*iter).id != n){
			if((*iter).num != a){
				count++;
				a = (*iter).num;
			}
			iter++;
		}
		if((*iter).num != a){
			count++;
		}
		cout << count << endl;
	}
	return 0;
}

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

int main(void)
{
    int N, M;
    std::cin >> N;
    std::cin >> M;
    std::vector<int> mark(N + 1, -1), front(1, 1), nfront;
    std::vector<std::vector<int>> path(N + 1);
    std::vector<int>::iterator imin;
    int temp1, temp2;
    for (int c = 0; c < M; ++c)
    {
        std::cin >> temp1;
        std::cin >> temp2;
        path[temp1].push_back(temp2);
        path[temp2].push_back(temp1);
    }
    while (front.size() != 0)
    {
        for (int c : front)
        {
            for (int d = 0; d < path[c].size(); ++d)
            {
                if (mark[path[c][d]] == -1)
                {
                    mark[path[c][d]] = c;
                    nfront.push_back(path[c][d]);
                }
            }
        }
        front = nfront;
        nfront.clear();
    }
    imin = std::min_element(mark.begin() + 1, mark.end());
    if (*imin == -1)
    {
        std::cout << "No" << std::endl;
        return 0;
    }
    std::cout << "Yes" << std::endl;
    for (int c = 2; c <= N; ++c)
    {
        std::cout << mark[c] << std::endl;
    }
    return 0;
}

Measured memory_bytes: 10492
import sys
N = int(input())
C = [0]
n = N
for i in range(1, n + 1):
    c = int(sys.stdin.readline())
    if c == C[-1]:
        N -= 1
    else:
        C.append(c)
dp = [0] * (N + 2)
dp[0] = 1
dp[1] = 1
cumsum = [0] * (2 * (10 ** 5) + 2)
cumsum[C[1]] = 1
for i in range(2, N+1):
    dp[i] = dp[i - 1] + cumsum[C[i]]
    cumsum[C[i]] += dp[i-1]
    dp[i] %= (10 ** 9 + 7)
print(dp[N])


Measured memory_bytes: 55752
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

#ifdef DEBUG_MODE
	#define DBG(n) n;
#else
	#define DBG(n) ;
#endif

#define REP(i,n) for(ll (i) = (0); (i) < (n); ++i)
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define ALL(v) v.begin(),v.end()
#define INF 1100000000
#define LLINF 1000000000000000000LL
#define MOD 1000000007

typedef long long ll;
typedef pair<ll, ll> P;


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

	int cnt = 1;
	int ans = 0;
	for(int i = 1; i < N; i++) {
		if(a[i] != a[i - 1]) {
			ans += cnt / 2;
			cnt = 1;
		} else {
			cnt++;
		}
	}
	ans += cnt / 2;
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for (int i = 0; i < n; i++)
const ll INF = 1e9;
const ll MOD = 1e9 + 7;
int main()
{
    ll n, x;
    cin >> n >> x;
    ll ans = 0;
    vector<ll> a(n);
    vector<ll> b(n);
    rep(i, n)
    {
        cin >> a[i];
    }
    for (int i = 0; i < n - 1; i++) {
        ll tmp = max(0ll, a[i + 1] + a[i] - x), rem = min(tmp, a[i + 1]);
        ans += tmp;
        a[i + 1] -= rem;
        a[i] -= tmp - rem;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1792
#include <stdio.h>

int main(void)
{
    int a, b, c,m;
    scanf("%d %d %d", &a, &b, &c);

    if(a>b){
        m = b;
        b = a;
        a = m;
    }

    if(b>c){
        m = c;
        c = b;
        b = m;
    }

    if(a>b){
        m = b;
        b = a;
        a = m;
    }

    printf("%d %d %d\n", a, b, c);

    return 0;
}

Measured memory_bytes: 596
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int inf = INT_MAX;
const ll INF = LLONG_MAX;
const ll MOD = 1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b, const ll mod=MOD) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b, const ll mod=MOD) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b, const ll mod=MOD) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b, const ll mod=MOD) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n; cin >> n;
    vi a(n); for(auto& e : a) cin >> e;

    sort(_all(a));
    int sum = 0;
    rep(i, n-1) sum += a[i];
    bool ok = (a.back() < sum);

    cout << (ok ? "Yes":"No") << endl;

    return 0;
}


Measured memory_bytes: 256
s = input().rstrip()
n = int(input())
for _ in range(n):
	line = input().rstrip().split()
	a = int(line[1])
	b = int(line[2])
	if line[0] == 'replace':
		p = line[3]
		s = s[0:a] + p + s[b+1:]
	elif line[0] == 'reverse':
		s = s[0:a] + s[a:b+1][::-1] + s[b+1:]
	elif line[0] == 'print':
		print(s[a:b+1])


Measured memory_bytes: 5612
def prime_factorize(n):
    a=[]
    while n%2==0:
        a.append(2)
        n //=2
    f=3
    while f**2<=n:
        if n%f==0:
            a.append(f)
            n //=f
        else:f +=2
    if n!=1:a.append(n)
    return a


n=int(input())
A=prime_factorize(n)
print("{}:".format(n),*A)


Measured memory_bytes: 5596
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Math;

class MainClass
{
    static void Main()
    {
        int N = int.Parse(ReadLine());
        var A = ReadLine().Split().Select(int.Parse).ToArray();
        Array.Sort(A);
        bool frag = true;
        for (int i = 0; i < N-1; i++)
        {
            if (A[i] == A[i + 1]) frag = false;
        }
        WriteLine(frag?"YES":"NO");
    }
}


Measured memory_bytes: 44604
use std::io::stdin;
use std::cmp::max;
use std::str::FromStr;


fn main(){
    let x: usize = get_one();
    let cs: Vec<char> = vec!['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'];
    solve("a".to_string(), 0, x, &cs);
}

fn solve(s: String, m: usize, n: usize, cs: &Vec<char>) {
    if s.len() == n {
        println!("{}", s);
        return
    }
    for i in 0..m+2 {
        solve(format!("{}{}", &s, cs[i]), max(m, i), n, cs);
    }
}

#[allow(dead_code)]
fn get_line() -> String {
    let mut s = String::new();
    match stdin().read_line(&mut s){
        Ok(_) => {s.trim().to_string()}
        Err(_) => String::new()
    }
}

#[allow(dead_code)]
fn get_vec<T: std::str::FromStr>() -> Vec<T> {
    let line = get_line();
    line.split_whitespace().filter_map(|x| x.parse().ok()).collect()
}

#[allow(dead_code)]
fn get_one<T: FromStr + Copy>() -> T {
    let v = get_vec();
    v[0]
}

#[allow(dead_code)]
fn get_pair<T: FromStr + Copy>() -> (T, T) {
    let v = get_vec();
    (v[0], v[1])
}

#[allow(dead_code)]
fn get_triple<T: FromStr + Copy>() -> (T, T, T) {
    let v = get_vec();
    (v[0], v[1], v[2])
}

#[allow(dead_code)]
fn get_chars() -> Vec<char> {
    get_line().chars().collect()
}

#[allow(dead_code)]
fn vec_min(xs: &Vec<i64>) -> i64 {
    xs.iter().map(|&x|x).fold(std::i64::MAX, std::cmp::min)
}

#[allow(dead_code)]
fn vec_max(xs: &Vec<i64>) -> i64 {
    xs.iter().map(|&x|x).fold(std::i64::MIN, std::cmp::max)
}

#[allow(dead_code)]
fn vec_sum(xs: &Vec<i64>) -> i64 {
    xs.iter().fold(0, |acc, &x| acc+x)
}


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

//using namespace ;

int main(){
	std::string s, ans;
	std::cin >> s;

	if(
		s.find('a')!=std::string::npos &&
		s.find('b')!=std::string::npos &&
		s.find('c')!=std::string::npos
	)ans = "Yes";
	else ans = "No";

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


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define fs first
#define sc second
using namespace std;
typedef double D;
typedef pair<D,D> pdd;
typedef vector<D> vd;
const D EPS = 1e-8;
const D PI = acos(-1);

int n,k;
pdd p[2000];
vector<pdd> v;
int max_r[2000], max_l[2000];

inline void modify(D &seta){
  if(seta>PI)seta-=2*PI;
  if(seta<-PI)seta+=2*PI;
}

inline bool in_upper(const D &seta){
  return (EPS<seta && seta<PI-EPS);
}

inline bool comp(const pdd &a, const pdd &b){
  return abs(a.fs-b.fs)<EPS?a.sc+EPS<b.sc:a.fs<b.fs;
}

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

  cin >> n >> k;
  rep(i,n){
    D x,y,r;
    cin >> x >> y >> r;
    complex<D> c(x,y);
    D d = abs(c), s = arg(c), a = sqrt(d*d-r*r);
    D ds = acos( (d*d + a*a - r*r)/(2*d*a) );
    
    D start = s-ds, end = s+ds;
    modify(start); modify(end);
    pdd tmp = pdd(in_upper(start)?start:0, in_upper(end)?end:PI);
    if(tmp.fs<EPS && PI-EPS<tmp.sc)continue;
    v.push_back(tmp);
  }

  sort(v.begin(),v.end(),comp);

  rep(i,v.size())rep(j,v.size()){
    if(i==j)continue;
    if(v[j].fs-EPS<v[i].fs && v[i].sc<v[j].sc+EPS){
      v.erase(v.begin()+i);
      i--;
      break;
    }
  }

  int m = v.size();
  rep(i,m){
    pdd dummy(v[i].sc,0);
    max_l[i] = upper_bound(v.begin(),v.end(),dummy,comp) - v.begin();
    max_r[i] = max_l[i]-1;
  }
  
  vector<vd> dp1(m+1,vd(k+1,0)), dp2 = dp1;

  rep(i,m)rep(j,k+1){
    dp1[i+1][j] = max(dp1[i+1][j], dp1[i][j]);
    if(j+1<=k){
      D use = max(dp1[i][j], dp2[i][j]);
      dp1[max_l[i]][j+1] = max(dp1[max_l[i]][j+1], use + v[i].sc-v[i].fs);
      if(max_r[i]!=i){
	dp2[max_r[i]][j+1] = max(dp2[max_r[i]][j+1], use + v[max_r[i]].fs-v[i].fs);
      }
    }
  }

  D ans = 0;
  rep(i,k+1)ans = max(ans, dp1[m][i]);
  cout << fixed << setprecision(10) << ans/PI << "\n";
}

Measured memory_bytes: 36644
#include <bits/stdc++.h>
#define ll long long
#define sz(x) (int)(x).size()
using namespace std;

int index(int numToFind, std::vector<int> vectorToFindIn) {int len = vectorToFindIn.size();for (int i = 0; i < len; i++){if (vectorToFindIn[i] == numToFind){return i;}}return -1;}

ll gcd(ll a,ll b)
{
	if (b==0) return a;
	return gcd(b,a%b);
}
string to_upper(string a)
{
	for (int i=0;i<(int)a.size();++i) if (a[i]>='a' && a[i]<='z') a[i]-='a'-'A';
	return a;
}
 
string to_lower(string a)
{
	for (int i=0;i<(int)a.size();++i) if (a[i]>='A' && a[i]<='Z') a[i]+='a'-'A';
	return a;
}

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	int n,m,cur=1,ans=0;
	cin>>n>>m;
	while (cur<m)
	{
		++ans;
		cur+=n-1;
	}
	cout<<ans;
	return 0;
}

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

typedef vector<int> vi;

const int INF = (int)1e9;
int N, M;
vector<vi> G;
vector<vi> dp;
vi cost;
int total = 0;

int main(void) {
	cin >> N >> M;
	vi v0(N, 0);
	G.resize(N, v0);
	for (int i = 0; i < M; ++i) {
		int a, b, c;
		cin >> a >> b >> c;
		G[a - 1][b - 1] = G[b - 1][a - 1] = c;
		total += c;
	}

	cost.resize(1 << N, 0);
	for (int i = 0; i < (1 << N); ++i) {
		for (int j = 0; j < N; ++j) {
			if ((i >> j) & 1) {
				for (int k = j + 1; k < N; ++k) {
					if ((i >> k) & 1)
						cost[i] += G[j][k];
				}
			}
		}
	}

	vi v1(N, -INF);
	dp.resize(1 << N, v1);
	for (int i = 0; i < (1 << N); ++i) {
		if (i & 1)
			dp[i][0] = cost[i];
	}

	for (int S = 0; S < (1 << N); ++S) {
		for (int i = 0; i < N; ++i) {
			if (dp[S][i] == -INF)
				continue;
			int sup = (~S) & ((1 << N) - 1);
			int sub = sup;
			for (int sub = sup; sub; sub = ((sub - 1) & sup)) {
				for (int j = 0; j < N; ++j) {
					if (G[i][j] != 0 && ((sub >> j) & 1))
						dp[S | sub][j] = max(dp[S | sub][j], dp[S][i] + G[i][j] + cost[sub]);
				}
			}
		}
	}

	int ans = total - dp[(1 << N) - 1][N - 1];
	cout << ans << '\n';
	return 0;
}


Measured memory_bytes: 3840
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
using System.Numerics;

namespace AtCoder
{
    public class Program
    {
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }
        static public (T1 a, T2 b) Slice<T1, T2>()
        {
            var t = ReadLine().Split();
            return (
            (T1)Convert.ChangeType(t[0], typeof(T1)),
            (T2)Convert.ChangeType(t[1], typeof(T2)));
        }
        static public (T a, T b) Slice2<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)));
        }
        static public (T a, T b, T c) Slice3<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)),
            (T)Convert.ChangeType(t[2], typeof(T)));
        }
        static long Mod = (long)1e9 + 7;
        public static void Main(string[] args)
        {
            //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            Solve();
            //Out.Flush();
            Read();
        }
        static void Solve()
        {
            (long a, long b, long c) = Slice3<long>();
            var hs = new HashSet<long>() { a, b, c };
            WriteLine(hs.Count);
        }
    }
}

Measured memory_bytes: 27644
#include <bits/stdc++.h>
#define BIT(n) (1LL << (n))
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPB(i, n) for (int i = 0; i < BIT(n); i++)
#define REPS(i, x) for (int i = 1; i <= (int)(x); i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORA(i, n) for (auto &&i : n)
#define FORS(i, m, n) for (int i = m; i <= n; i++)
#define INF 2e9
#define MOD (1000000007)
#define EPS 1e-9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef long long int lli;
lli gcd(lli m, lli n) { return m % n == 0 ? n : gcd(n, m % n); }
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N, X;
  cin >> N >> X;
  vector< lli > x(N + 1);
  vector< lli > xdif(N);
  x[0] = X;
  REP(i, N) { cin >> x[i + 1]; }
  sort(ALL(x));
  REP(i, N) {
    xdif[i] = x[i + 1] - x[i];
  //  cout << xdif[i] << " ";
  }
  lli ans = xdif[0];
  REP(i, N - 1) { ans = gcd(ans, xdif[i + 1]); }
  cout << ans << "\n";
}

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

int main(){
  int N,count =0;
  bool judge = false;
  cin >> N;
  vector<int> vec(N);

  for(int i = 0; i < N; i++){
    cin >> vec.at(i);
  }
  
  while(!judge){
    for(int i = 0; i < N; i++){
      if(vec.at(i) % 2 == 0){
        vec.at(i) /= 2;
      } else {
        judge = true;
      }
    }
    if(judge == false) count++;  
  }
  cout << count << endl;
}


Measured memory_bytes: 384
import java.util.*;

public class Main {
    public static void main(String args[]) {
        Scanner in = new Scanner(System.in);
        int h = in.nextInt();
        int n = in.nextInt();
        long checkAns = 0;
        for(int i = 0; i < n; i++) {
            int a = in.nextInt();
            checkAns += a;
        }
        if(checkAns >= h) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}


Measured memory_bytes: 47744
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define hell  1000000007
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define pb   push_back

int main()
{
	ios;
	ll n,k,sum=0;
	cin>>n>>k;
	for(ll i=k;i<=n+1;i++)
	{
		sum+=(i*((2*n)-i+1))/2-((i*(i-1))/2)+1;
	}
	cout<<sum%hell;
}

Measured memory_bytes: 3640
import java.util.*;

class Main {
  public static void main(String[] args) {
    Scanner in = new Scanner(System.in);

    int N = in.nextInt();
    int count = 0;
    for (int i = 1; i <= N; i++) {
      int n = in.nextInt();
      if (i % 2 == 1 && n % 2 == 1) count++;
    }
    System.out.println(count);
  }

  public static int gcd(int a, int b) {
        if (b == 0) return a;
    return gcd(b, a % b);

  }

  public static long gcd(long a, long b) {
    if (b == 0) return a;
    return gcd(b, a % b);
  }
}

Measured memory_bytes: 27216
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
using namespace std;

int main(void){
    // Your code here!"
    long int n,sum=0;
    string s;
    cin >> n >> s;
    vector <long int> r,g,b;
    for(int i=0; i<n; i++){
        if(s[i] == 'R'){
            r.push_back(i);
        }else if(s[i] == 'G'){
            g.push_back(i);
        }else{
            b.push_back(i);
        }
    }
    sum = r.size()*g.size()*b.size();
    //cout << sum << endl;
    for(int i=0; i<n; i++){
        for(int j=1; i+j+j<n; j++){
            if(s[i] != s[i+j] && s[i] != s[i+j+j] && s[i+j] != s[i+j+j]){
                sum--;
                //cout << i << " "<< j << endl;
            }
        }
    }
    
    cout << sum << endl;
    return 0;
}

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

#define inf 0x3f3f3f3f
#define pi acos(-1)
#define fi first
#define se second
#define pb push_back
#define all(a) a.begin(),a.end()
template<class T> bool mmin(T &a,T b){return (a>b ?(a=b,true):false);};
template<class T> bool mmax(T &a,T b){return (a<b ?(a=b,true):false);};

int32_t main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	
	int n,k;
	cin >> n >> k;
	k--;
	string str;
	cin >> str;
	str[k] = tolower(str[k]);
	cout << str << '\n';
#ifdef LOCAL_DEFINE
	cerr << "\nTime: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
	return 0;
}




















Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int dp[55][50005], mon;
int main() {
	int n, k[55], ans = 99999;
	cin >> n;
	for (int i = 0; i < n; ++i) {
		cin >> k[i];
	}
	for (int i = 0; i < 51; ++i) {
		for (int j = 0; j < 50001; ++j) {
			dp[i][j] = 99999;
		}
	}
	for (int i = 0; i < n; ++i) {
		mon += k[i];
		if (i + 1 < n) {
			dp[i + 1][mon] = mon;
		}
		for (int j = 50000; j >= 0; --j) {
			if (dp[i][j] == 99999) continue;
			int monn = 0;
			for (int kk = i; kk < n; ++kk) {
				monn += k[kk];
				dp[kk + 1][min(monn, j)] = min(dp[kk + 1][min(monn, j)], max(dp[i][j], monn));
			}
		}
	}

	for (int i = 0; i < 50001; ++i) {
		ans = min(ans, dp[n][i] - i);
	}
	cout << ans << endl;
}



Measured memory_bytes: 13068
#include<cstdio>
#include<cstring>
long long arr[55];
long long dp[55][2505];
int main()
{
    int N,A;
    scanf("%d%d",&N,&A);
    for(int i=0; i<N; i++)
    {
        scanf("%lld",&arr[i]);
    }
    memset(dp,0,sizeof(dp));
    dp[0][0]=1;
    for(int i=1; i<=N; i++)
    {
        for(int k=i; k>0; k--)
        {
            for(int j=arr[i-1]; j<=2500; j++)
            {
                dp[k][j]+=dp[k-1][j-arr[i-1]];
            }
        }
    }
    long long sum=0;
    for(int i=1; i<=N; i++)
    {
        sum+=dp[i][A*i];
    }
    printf("%lld\n",sum);
    return 0;
}


Measured memory_bytes: 1280
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
using namespace std;
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define END {}
#endif
typedef long long ll;
#define int ll
#define uset unordered_set
#define umap unordered_map
typedef std::pair<int,int> P;
struct edge{int to,cost;};
const int INF=100000000000000000;
const int INF2=9223372036854775807;
const int MOD=1000000007;
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define min(X,Y) (((int)(X)<(int)(Y))?(X):(Y))
#define max(X,Y) (((int)(X)>(int)(Y))?(X):(Y))
#define MAX(X,Y) (*max_element(X,Y))
#define MIN(X,Y) (*min_element(X,Y))
#define NP(X,Y) next_permutation(X,Y)

int N,M;
int X[100010],Y[100010];
int num[100010];
bool F[100010];

signed main(){
	cin>>N>>M;
	REP(i,M){
		cin>>X[i]>>Y[i];
	}
	REP(i,N){
		num[i]=1;
	}
	F[0]=true;
	int ans=0;
	REP(i,M){
		if(F[X[i]-1]==true){
			F[Y[i]-1]=true;
		}
		num[X[i]-1]--;
		if(num[X[i]-1]<=0){
			F[X[i]-1]=false;
		}
		num[Y[i]-1]++;
	}
	REP(i,N){
		if(F[i]==true){
			ans++;
		}
	}
	cout<<ans<<endl;
	return 0;
}


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
    int N;
    cin >> N;
    vector<int> a(N);

    rep(i, N)
        cin >> a.at(i);

    int minv = a.at(0);
    int maxv = a.at(0);
    rep(i, N) {
        minv = min(minv, a.at(i));
        maxv = max(maxv, a.at(i));
    }

    cout << (maxv - minv) << endl;
}

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

using namespace std;

int main()
{
	cin.tie(0);ios::sync_with_stdio(false);
	/* ====================================== */
	int T;
	int X;
	cin >> T;
	cin >> X;
	double res = (double)T/X;


	cout << res;
	/* ====================================== */
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using lint = long long;

void solve() {
    lint h, w;
    std::cin >> h >> w;

    std::cout << (h == 1 || w == 1 ? 1 : (h * w + 1) / 2)
              << std::endl;
}

int main() {
    std::cin.tie(nullptr);
    std::cout.tie(nullptr);
    std::ios::sync_with_stdio(false);

    solve();

    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = Integer.parseInt(sc.next());
		int B = Integer.parseInt(sc.next());
		sc.close();
		if(A == B) {
			System.out.println("Draw");
		}else if( A == 1) {
			System.out.println("Alice");
		}else if( B == 1) {
			System.out.println("Bob");
		}else {
			if(A > B) {
				System.out.println("Alice");
			}else {
				System.out.println("Bob");
			}
		}
	}
}


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

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

    int sum = 0;
    for (int i = 0; i < s.size(); i++)
    {
        sum += s[i] - '0';
    }

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

Measured memory_bytes: 3748
input = open(0).read

N, *An = map(int, input().split())


def main():
    for i in range(N):
        An[i] = An[i] - i - 1

    ans = 0

    An.sort()

    for i in range(N):
        ans += abs(An[i] - An[N // 2])

    print(ans)
    return


main()


Measured memory_bytes: 25772
package main

import (
   "fmt"
)

func solution(s, t string) int {
   out := 0
   for i := range s {
        if s[i] != t[i] {
                out++
        }
   }
   return out
}

func main() {
   var s, t string
   fmt.Scan(&s, &t)
   fmt.Println(solution(s, t))
}

Measured memory_bytes: 3388
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int a = scanner.nextInt();
        int b = scanner.nextInt();
        
        int area = a * b;
        int circumference = 2 * a + 2 * b;
        System.out.println(area + " " + circumference);
    }
}


Measured memory_bytes: 26396
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i < (int)(n); i++)
#define Sort(a) sort(a.begin(), a.end())
typedef long long int ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
template <class T> inline bool chmax(T& a,T b){if(a<b){a=b;return true;} return false;}
template <class T> inline bool chmin(T& a,T b){if(a>b){a=b;return true;} return false;}

int main(){
    double r;
    cin >> r;
    printf("%.3lf", r*2*3.14159265358979);
    return 0;
}

Measured memory_bytes: 3788
a, b, c = list(map(int,input().split()))
l = [a, b, c]
if l[0] > l[1]:
    l[0],l[1] = l[1],l[0]
if l[1] > l[2]:
    l[1],l[2] = l[2],l[1]
if l[0] > l[1]:
    l[0],l[1] = l[1],l[0]
print("{} {} {}".format(l[0],l[1],l[2]))


Measured memory_bytes: 5596
input = readlines()

n = input.shift.chomp.to_i
v_list = input.shift.chomp.split("\s").map{|x| x.to_i}
c_list = input.shift.chomp.split("\s").map{|x| x.to_i}

r = 0
(1..n).each do |ip|
  i = ip - 1
  diff = v_list[i] - c_list[i]
  r += diff if diff > 0
end

puts r

Measured memory_bytes: 14160
import sys
input = sys.stdin.readline

def main():
    N = int(input())
    s = input().strip()
    
    for c in s:
        i = ord(c) + N
        # print(ord(c), i)
        if i > ord("Z"):
            i -= ord("Z") - ord("A") + 1
        print(chr(i), end="")
    print()

if __name__ == "__main__":
    main()

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

#include <algorithm>

using namespace std;

#define sqr(x) ((x) * (x))
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()

typedef long long ll;

const int MOD = 1000000007;
const int INF = 1000000007;
const ll INFLL = 1000000000000000007LL;

void solve() {
  int N, M;
  cin >> N >> M;
  cout << (N * (N - 1) / 2) + (M * (M - 1) / 2) << endl;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  // cout << fixed << setprecision(12);

  solve();

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <map>
 
int main() {
	int n;
  	std::cin >> n;
  	std::map <std::string, int> mp;
  
  	for (int i = 0; i < n; ++i) {
     	std::string s;
      	std::cin >> s;
      	mp[s] += 1;
    }
  
  	std::cout << "AC x " << mp["AC"] << '\n';
  	std::cout << "WA x " << mp["WA"] << '\n';
  	std::cout << "TLE x " << mp["TLE"] << '\n';
  	std::cout << "RE x " << mp["RE"] << '\n';
  	
  
 	return 0; 
}


Measured memory_bytes: 3604
#include <iostream>
#include <vector>
using namespace std;
int main(){
  int n,m,p;
  while(cin >> n >> m >> p,n | m | p){
    vector<int> vec(n,0);
    for(int i = 0;i < n;i++){
      cin >> vec[i];
    }
    int sum = 0;
    for(int i = 0;i < n;i++){
      sum += vec[i];
    }
    sum = sum*(100 - p);
    if(vec[m-1] == 0)cout << 0 << endl;
    else cout << (int)(sum / vec[m-1]) << endl;
  }
  return 0;
}

Measured memory_bytes: 1196
public class Main {
	public static void main(String[] args){
		java.util.Scanner scan = new java.util.Scanner(System.in);
		String W = scan.next().toLowerCase();
		int count = 0;
		while(true){
			String str = scan.next();

			if("END_OF_TEXT".equals(str)){
				break;
			}
			if(W.equalsIgnoreCase(str)){
				count++;
			}
		}
		System.out.println(count);
	}

}

Measured memory_bytes: 26176
#include<iostream>
#include<stdio.h>
#include<math.h>
using namespace std;

#define MAX 256

int main(void){
	
	int n[MAX] = { 0 };
	int x[MAX] = { 0 };
	int k = 0, i = 0;

	while (k == 0){
		scanf("%d%d", &n[i], &x[i]);
		if (n[i] + x[i] == 0)k = 1;
		i++;
	}

	int count = 0;

	for (int j = 0; j < i - 1; j++){
		count = 0;
		for (int k = 1; k <= x[j] / 3; k++){
			for (int l = k + 1; l <= (x[j] - k) / 2; l++){
				if (x[j] - k - l != l && x[j] - k - l <= n[j])count++;
			}
		}
		printf("%d\n", count);
	}

	return 0;
}

Measured memory_bytes: 3204
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);

	        int n = scan.nextInt();		//n人
	        
	        int[] xarray = new int[n];
	        int[] yarray = new int[n];
	        
	        for(int i=0; i<n; i++) {
	        	xarray[i] = scan.nextInt();		//n人
	        }
	        
	        for(int i=0; i<n; i++) {
	        	yarray[i] = scan.nextInt();		//n人
	        }
	        
	        
	        double p1 = 0;
	        double p2 = 0;
	        double p3 = 0; 
	        double pinf = Math.abs(xarray[0] - yarray[0]); 

	        for(int i=0; i<n; i++) {
	        	int xy = Math.abs(xarray[i] - yarray[i]);
		        
	        	p1 += xy;
	        	p2 += xy * xy;
	        	p3 += xy * xy * xy;
	        	
	            if(pinf < xy) {
	                pinf = xy;
	            }
	        }
	        System.out.println(p1);
	        System.out.println(Math.sqrt(p2));
	        System.out.println(Math.cbrt(p3));
	        System.out.println(pinf);
	}
}


Measured memory_bytes: 26560
from sys import stdin
K = int(stdin.readline().rstrip())
a=[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]
print(a[K-1])

Measured memory_bytes: 3060
#include <algorithm>
#include <iostream>
#include <cstdint>
#include <string>
#include <vector>

using namespace std;

int main() {
	int n, k;
	string s;
	cin >> n;
	cin >> s;
	cin >> k;
	for ( int i = 0; i < n; i++ ) {
		if ( s[i] != s[k-1] ) s[i] = '*';
	}
	cout << s << endl;
	return 0;
}


Measured memory_bytes: 256
n,k = map(int,input().split())
k = k-1
x = list(map(int,input().split()))
ans = float('inf')
for i in range(k,len(x)):
    ans = min(ans,abs(x[i-k])+abs(x[i]-x[i-k]))
for i in range(len(x)-k):
    ans = min(ans,abs(x[i+k])+abs(x[i+k]-x[i]))
print(ans)

Measured memory_bytes: 14252
import itertools
from collections import Counter

N, C = map(int, input().split())

mat_D = [list(map(int, input().split())) for _ in range(C)]
mat_c = [list(map(int, input().split())) for _ in range(N)]

zero = []
one = []
two = []

for i, row in enumerate(mat_c):
    for j, col in enumerate(row):
        if (i+j+2) % 3 == 0:
            zero.append(col)
        elif (i+j+2) % 3 == 1:
            one.append(col)
        else:
            two.append(col)

zero_dict = dict(Counter(zero))
one_dict = dict(Counter(one))
two_dict = dict(Counter(two))
a = [zero_dict, one_dict, two_dict]


def make_color_patterns():
    color_pats = list(itertools.permutations(list(range(1, C + 1)), 3))
    return color_pats


def calc_D(i, col):
    aa = a[i]
    D = 0
    for k, v in aa.items():
        D += mat_D[k-1][col-1] * v
    return D


# print(mat_D, mat_c)

color_pats = make_color_patterns()

ans = float("inf")
for color_pat in color_pats:
    # print(color_pat)
    D0 = calc_D(0, color_pat[0])
    D0 = calc_D(0, color_pat[0])
    D1 = calc_D(1, color_pat[1])
    D2 = calc_D(2, color_pat[2])
    D = D0 + D1 + D2
    # print(D)
    ans = min(D, ans)

print(ans)


Measured memory_bytes: 9864