akhauriyash/Code-Regression huggingface dataset:
until (n = gets.strip.to_i) == 0
	points = gets.strip.split(" ").map {|i| i.to_f}
	avg = (points.reduce(0.0){|sum, p| sum += p}) / n.to_f
	var = points.reduce(0.0){|sum, p| sum += (p - avg) ** 2} / n.to_f
	std = var ** 0.5
	puts std.floor(4)
end


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

# define x first
# define y second 
# define mp make_pair

# define pb push_back
# define vec vector
# define sz(a) int(a.size())

# define y1 kek_y1
# define left kek_left
# define right kek_right

using namespace std;

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

const int Sz = 1110111;
const int Mod = (int)1e9 + 7;
const int MX = (1<<30) - 1; // 1e9
const ll MXLL = (1ll<<62) - 1;        

inline void Read_rap() {
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
}
void files (string name) {
	if (fopen ((name+".in").c_str(), "r")) {
		freopen ((name+".in").c_str(), "r", stdin);
		freopen ((name+".out").c_str(), "w", stdout);
	}
}       
struct fenwick { 
	int n;
	vec < multiset <pii> > t;            
	fenwick (int n = 0) : n(n), t(n+1) {}

	void init (int _n) {
		n = _n;
		t.clear();
		t.resize(n);
	}	

	void add (int i, int x, int y) {
		pii cur = mp (x, y);
		for (; i <= n; i |= (i + 1))	
			t[i].insert (cur);
	}
	void del (int i, int x, int y) {
		pii cur = mp (x, y);
		for (; i <= n; i |= (i + 1)) { 
			t[i].erase (t[i].find(cur));
		}
	}

	int get (int i) {
		pii res = mp (0, 0);
		for (; i >= 0; i = (i & (i + 1)) - 1)
			if (sz(t[i]))	
				res = max (res, *t[i].rbegin());
		return res.y;
	}
};

struct tree {
	int n;
	vec <vec<int> > g;
                
    vec <vec<int> > m, q;
    fenwick F;
	tree (int n = 0, int n2 = 0) : n(n), g(n+1), m(n+1), q(n+1), F(n2)  {}
	     
	void init (int _n, int _q) {
		F.init(_q);      
		n = _n;        
		g.clear(), m.clear(), q.clear();
		g.resize(n+1), q.resize(n+1), m.resize(n+1);
	}	
			

	void mark (int v, int i) {
		m[v].pb (i);
	}
	void query (int v, int i) {
		q[v].pb (i);
	}
        
   	void calc (int v, int lvl, ll &sum) {
   		for (int &i : m[v])
   			F.add (i, lvl, v);

   		for (int &i : q[v])
   			sum += F.get (i - 1);

   		for (int &to : g[v]) 
   			calc (to, lvl + 1, sum);
   		for (int &i : m[v])
   			F.del (i, lvl, v);
   	}
};       
                                   

int main()
{
	tree T;  
	int n, q;
	while (true) {
		scanf ("%d %d", &n, &q);
		if (n+q == 0)
			break;

		T.init(n, q);
        for (int i = 2, pr; i <= n; i++) {
        	scanf ("%d", &pr);
        	T.g[pr].pb (i);                
        }         
        T.mark (1, 0);
        for (int i = 1; i <= q; i++) {
        	static char c[10];
        	static int v;                 
        	scanf ("%s %d", c, &v);          
        	if (c[0] == 'M')
        		T.mark (v, i);
        	else
        		T.query (v, i);
    	}
        ll ans = 0;
        T.calc (1, 0, ans);
        //return 0;
    	printf ("%lld\n", ans);
	}
		
	return 0;
}











//Coded by Z....	
    


Measured memory_bytes: 48496
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int a,c,b,d=0;
  cin>>a>>b;
  
  for(int i=0;i<a;i++)
  {  cin>>c;
   if(c>=b)
     ++d;
  }
  cout<<d;
}
  

Measured memory_bytes: 256
import os
import sys
from fractions import gcd

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353


N, M = list(map(int, sys.stdin.buffer.readline().split()))
A = list(map(int, sys.stdin.buffer.readline().split()))


def lcm(a, b):
    return a * b // gcd(a, b)


A = np.array(A, dtype=int)
A //= 2

# l = reduce(lcm, A)
l = 1
for a in A:
    l = lcm(l, a)
    if l > M:
        print(0)
        exit()
for a in A:
    if l // a % 2 == 0:
        print(0)
        exit()
        

# cnt = math.ceil((M // l) / 2)
cnt = (M // l + 1) // 2
print(cnt)


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

int main(){
  string S;
  int i, N, rem, x, x1=0, x2=0 ;
  cin >> S;
  N = S.size();
  
  for(i=0;i<N;i++){
    rem = S[i]=='1';
    if(i%2 == rem) x1++;
  }
  
  for(i=0;i<N;i++){
    rem = S[i]=='0';
    if(i%2 == rem) x2++;
  }
  x = min(x1,x2);
  cout << x << endl;
  return 0;
  
}

Measured memory_bytes: 512
#pragma region _head

#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<map>
#include<set>
#include<iomanip>
#include<queue>
#include<stack>
#include<numeric>
#include<utility>

#pragma region _define

#define int LL
#define f(i,a,b) for(LL i=a;i<b;i++)
#define rep(i,n) for(LL i=0;i<n;i++)
#define f_vI(v,n) f(i,0,n)cin>>v[i]
#define f_v2I(v1,v2,n) f(i,0,n)cin>>v1[i]>>v2[i]
#define f_v3I(v1,v2,v3,n) f(i,0,n)cin>>v1[i]>>v2[i]>>v3[i]
#define f_vO(v,n,option) f(i,0,n)cout<<v[i]<<option;
#define all(a) a.begin(),a.end()
#define size(s) ((int)s.size())
#define check() cout<<"! ! !"
#define endl "\n"
#define _y() cout<<"Yes"<<endl
#define _Y() cout<<"YES"<<endl
#define _n() cout<<"No"<<endl
#define _N() cout<<"NO"<<endl
#define INT_INF 1<<29
#define LL_INF 1LL<<60
#define MOD 10000007

#pragma endregion

#pragma region _using

using namespace std;

using LL = long long;
using st = string;
using vi = vector<LL>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vc = vector<char>;
using vs = vector<st>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvvb = vector<vvb>;
using qi = queue<int>;
using qc = queue<char>;
using qs = queue<st>;
using si = stack<LL>;
using sc = stack<char>;
using ss = stack<st>;
using pi = pair<LL, LL>;
using mll = map<LL, LL>;
using vpi = vector<pi>;

#pragma endregion


//素数判定
bool is_prime(int n) {
	for (int i = 2; i*i <= n; i++) {
		if (n%i == 0) {
			return false;
		}
	}
	return true;
}

void y_n(bool p) {
	if (p)_y();
	else _n();
}

void Y_N(bool p) {
	if (p) _Y();
	else _N();
}

LL gcd(LL a, LL b) {
	LL r;
	while ((r = a % b) != 0) {
		a = b;
		b = r;
	}
	return b;
}
LL lcm(LL a, LL b) {
	return (a / gcd(a, b)*b);
}

//階乗計算
LL factorial(LL n) {
	LL a = 1, ret = 1;
	while (a < n) {
		a++;
		ret *= a;
		//ret %= 1000000007;
	}
	return ret;
}


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

	while (1) {
		int n;
		cin >> n;
		if (n == 0)break;
		vi a(n);
		rep(i, n)cin >> a[i];
		double sum = 0;
		rep(i, n) {
			sum += a[i];
		}
		sum = sum / (double)n;
		int cnt = 0;
		rep(i, n) {
			if (a[i] <= sum) {
				cnt++;
			}
		}
		cout << cnt << endl;
	}
	return 0;
}


Measured memory_bytes: 3216
#include <stdio.h>
int main(){

  int i;
  char a[3][10];

  for(i = 0; i < 3; i++) scanf("%s",a[i]);

  for(i = 0; i < 3; i++) a[i][0] -= 32;

  for(i = 0; i < 3; i++) printf("%c",a[i][0]);

  printf("\n");

  return 0;

}



Measured memory_bytes: 128
import java.util.*;

public class Main {
	public static void main(String[] args) throws Exception{
		Scanner scn = new Scanner(System.in);
		int[] a = new int[6];
		for(int i=0; i<a.length; i++){
			a[i] = scn.nextInt();
		}
      	String ans = "YES";
      	int count1 = 0;
      	int count2 = 0;
      	int count3 = 0;
      	int count4 = 0;
      	for(int i=0; i<a.length; i++){
			if(a[i]==1){
              count1++;
              if(count1>=3) ans = "NO";
            }
          	if(a[i]==2){
              count2++;
              if(count2>=3) ans = "NO";
            }
          	if(a[i]==3){
              count3++;
              if(count3>=3) ans = "NO";
            }
          	if(a[i]==4){
              count4++;
              if(count4>=3) ans = "NO";
            }
		}
      	System.out.println(ans); 	
	}
}


Measured memory_bytes: 35624
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define all(x) (x).begin(), (x).end()
using ll = long long;
using namespace std;
template <typename T> using vec = std::vector<T>;

int main() {
    int N;
    cin >> N;
    
    vec<ll> a(N);
    rep(i, N) cin >> a[i];
    rep(i,N-1) a[i+1]+=a[i];

    ll ans = 1e14+7;
    rep(i,N-1){
        ans = min(ans,abs(a[i]-(a[N-1]-a[i])));
    }
    cout << ans << endl;
}


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

using namespace std;

int main()
{
    string s;
    cin>>s;
    if(s[1]=='B')
    {
        s[1]='R';
    }
    else if(s[1]=='R')
    {
        s[1]='B';
    }
    cout<<s<<endl;
    return 0;
}


Measured memory_bytes: 3588
#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    d = I()
    c = LI()
    s = LIR(d)
    t = IR(d)
    n = 26
    v = 0
    minus = sum_ = sum(c)
    last = [0]*n
    for i in range(d):
        ti = t[i]-1
        minus -= (i+1-last[ti])*c[ti]
        v += s[i][ti]-minus
        minus += sum_
        last[ti] = i+1
        print(v)
    return

#Solve
if __name__ == "__main__":
    solve()


Measured memory_bytes: 74020
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <cmath>
#include <complex>
#include <map>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cassert>
#include <iomanip>
using namespace std;

#define Rep(b, e, i) for(int i = b; i <= e; i++)
#define Repr(e, b, i) for(int i = e; i >= b; i--)
#define rep(n, i) Rep(0, n-1, i)
#define repr(n, i) Repr(n-1, 0, i)
#define all(v) (v).begin(), (v).end()
#define pb(v) push_back(v)
#define uniq(v) (v).erase(unique(all(v)),(v).end())
#define bitcnt(x) __builtin_popcount(x)
#define fst first
#define snd second
#define Pqaz(T) priority_queue<T,vector<T>,greater<T>>
#define Pqza(T) priority_queue<T>
#define put(x) cout << x;
#define putsp(x) cout << x << ' ';
#define putbd cout << "---------------------------------------------" << endl;
#define putln(x) cout << x << endl;
#define debug(x) cerr << #x << "=" << x << endl;
#define ENJYU std::ios::sync_with_stdio(false);std::cin.tie(0);

typedef long long ll;
typedef pair<ll, ll> llP;
typedef pair<int, int> intP;
typedef complex<double> comp;
typedef vector <int> vec;
typedef vector <ll> vecll;
typedef vector <double> vecd;
typedef vector <vec> mat;
typedef vector <vecll> matll;
typedef vector <vecd> matd;

//vector の中身を出力
template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

const int MAX = 200020;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<29;
const ll INFL = 1e18;
const ll MOD = 1e9+7;

const int dx[]={1,0,-1,0},dy[]={0,1,0,-1};
//const int dx[]={-1,-1,-1,0,1,1,1,0},dy[]={-1,0,1,1,1,0,-1,-1};

//********************************template END****************************************//

void solve(void){

	ll N;
	cin >> N;

	if (N <= 5)
	{
		if (N == 2 || N == 4 || N == 5)
		{
			cout << "No" << endl;
			return;
		}

		cout << "Yes" << endl;

		if (N == 1)
		{
			cout << 2 << endl;
			cout << 1 << ' ' << 1 << endl;
			cout << 1 << ' ' << 1 << endl;
		}

		if (N == 3)
		{
			cout << "3\n2 1 2\n2 3 1\n2 2 3" << endl;
		}

		return;
	}

	vecll cands;

	ll tmp = 1, x = 2;

	while(tmp <= 1e5)
	{
		cands.pb(tmp);
		tmp += x++;
	}

	//cout << cands << endl;

	auto p = lower_bound(all(cands), N);

	if (*p != N)
	{
		cout << "No" << endl;
		return;
	}

	cout << "Yes" << endl;

	ll idx = p - cands.begin() + 1;

	cout << idx+1 << endl;

	mat ans(idx+1, vec(idx, 0));

	ans[0][0] = 1;
	ans[1][0] = 1;

	int d = 2, u = 1, r = 0, l = 0;

	Rep(2, N, n)
	{
		ans[d][r] = n;
		ans[l][u] = n;
		r++;
		l++;
		if (*lower_bound(all(cands), n) == n)
		{
			u++, d++;
			l = r = 0;
		}
	}

	for (auto v : ans)
	{
		cout << idx << ' ';
		rep(idx, j)
		{
			cout << v[j] << (j == idx-1 ? '\n' : ' ');
		}
	}



}

int main(void){
	solve();
	//cout << "yui(*-v・)yui" << endl;
	return 0;
}


Measured memory_bytes: 2176
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
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; }
#define all(x) (x).begin(),(x).end()
#define pll pair<ll,ll>
#define pii pair<int,int>
#define rep(i,n) for(int i=0;i<n;i++)
#define For(i,a,b) for(int i=a;i<b;i++)
#define sz(x) ((ll)(x).size())
#define pb push_back
#define mp make_pair
#define bit(n) (1LL<<(n))
#define F first
#define S second
#define debug(x) cerr << x << endl
#define Complex complex<double>
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
const ll INF = 1LL<<60;
const ll mod = (int)1e9 + 7;

int main() {
    ll x;
    cin >> x;
    ll y;
    y=x/500;
    x-=500*y;
    cout << 1000*y+x/5*5;


    
}

Measured memory_bytes: 256
#define _DEBUG 1
#define _GLIBCXX_DEBUG

#include <bits/stdc++.h>
using namespace std;

using ll = long long;

#ifdef _DEBUG
#define dump(x) cerr << #x << "=" << x << endl
#define dump2(x, y) cerr << #x << "=" << x << "," << #y << "=" << y << endl
#define dump3(x, y, z)                                                     \
  cerr << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z \
       << endl
#define check(s) cerr << s << endl
#else
#define dump(x)
#define dump2(x, y)
#define dump3(x, y, z)
#define check(s)
#endif

#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define unique(v) v.erase(unique(v.begin(), v.end()), v.end());

const ll LINF = 2e18;
const int INF = 1e9;


vector<ll> pow5(201);

void solve(ll X) {
  ll A, B;

  for (int i = 0; i <= 200; i++) {
    pow5.at(i) = pow(i, 5);
  }

  bool found = false;
  for (int i = 0; i <= 200; i++) {
    ll ap = pow5.at(i);
    ll an = -pow5.at(i);
    for (int j = 0; j <= 200; j++) {
      ll bp = pow5.at(j);
      ll bn = -pow5.at(j);

      if (ap - bp == X) {
        A = i;
        B = j;
        found = true;
        break;
      }
      if (an - bp == X) {
        A = -i;
        B = j;
        found = true;
        break;
      }
      if (an - bn == X) {
        A = -i;
        B = -j;
        found = true;
        break;
      }
      if (ap - bn == X) {
        A = i;
        B = -j;
        found = true;
        break;
      }
    }
    if (found) {
      break;
    }
  }

  cout << A << " " << B << endl;
}

int main() {
  ll X;
  scanf("%lld", &X);
  solve(X);
  return 0;
}


Measured memory_bytes: 4172
function F()
  S = readline()
  T = readline()
 
  c = []
  
  for i =1:length(S)-length(T)+1
    s = 0
    for j = 1:length(T)
      if S[i+j-1] == T[j]
        s += 1
      
      end
      ss = length(T)-s
      c = append!(c,ss)
    end
  end
  
  println(minimum(c))
end
F()

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

using namespace std;
using ll = long long;
using ld = long double;

#define ALL(x) begin(x), end(x)
#define REP(i, n) for (size_t i = 0, i##_len = (n); i < i##_len; ++i)

void solve(ll X, ll t) {
  cout << max(0ll, X-t) << endl;
}

int main() {
  ll X;
  cin >> X;
  ll t;
  cin >> t;
  solve(X, t);
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define MODV 1000000007
#define INF INT_MAX // 2147483647
#define INFLL LLONG_MAX // 9223372036854775807
#define rep(i, n) for(ll i=0, i##_len=(ll)(n); i<i##_len; i++)
#define repf(i, n) for(ll i=1, i##_len=(ll)(n+1); i<i##_len; i++)
#define per(i, n) for(ll i=((ll)(n))-1; i>=0; i--)
#define perf(i, n) for(ll i=((ll)(n)); i>0; i--)
#define all(v) v.begin(), v.end()
#define endl "\n"
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define Yes() cout << "Yes" << endl
#define YES() cout << "YES" << endl
#define No() cout << "No" << endl
#define NO() cout << "NO" << endl
template<class T>bool chmax(T &a, const T &b){ if(a<b){ a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b){ if(b<a){ a=b; return 1; } return 0; }
using namespace std;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(10);
    string s; cin >> s;
    bool yymm = true, mmyy = true;
    ll mm = (s[2]-'0')*10 + s[3]-'0';
    if(mm < 1 || mm > 12) yymm = false;
     mm = (s[0]-'0')*10 + s[1]-'0';
    if(mm < 1 || mm > 12) mmyy = false;

    if(yymm && !mmyy) cout << "YYMM" << endl;
    else if(!yymm && mmyy) cout << "MMYY" << endl;
    else if(!yymm && !mmyy) cout << "NA" << endl;
    else if(yymm && mmyy) cout << "AMBIGUOUS" << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
typedef pair<int, pair<int,int> > P;
P t[1000];
int n,m,a;
int ans[1000];
int main(){
  while(1){
    cin>>n>>m>>a;
    if(n==0&&m==0&&a==0)break;
    for(int i=0;i<m;i++)
      cin>>t[i].first>>t[i].second.first>>t[i].second.second;
    sort(t,t+m);
    for(int i=1;i<=n;i++)ans[i]=i;
    for(int i=0;i<m;i++){
      swap(ans[ t[i].second.first ],ans[ t[i].second.second ]);
    
    }
    cout<<ans[a]<<endl;
  }
  return 0;
}

Measured memory_bytes: 1180
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    vector<double> x(n);
    vector<string> u(n);
    double ans=0,BTC=0;
    for(int i=0;i<n;i++){
        cin>>x.at(i)>>u.at(i);
        if(u.at(i)=="JPY")
        ans+=x.at(i);
        else
        BTC+=x.at(i);
    }
    ans+=BTC/1*380000.0;
    cout<<ans<<endl;
}

Measured memory_bytes: 3840
#include <bits/stdc++.h>
using namespace std;
string a,b;
int dian;
char c[100],d[100],ans[100];
void mut(string a,string b){
    int la=a.length();
    int lb=b.length();
    int x=0;
    for(int i=0;i<la;i++)
        c[la-i-1]=a[i]-'0';
    for(int i=0;i<lb;i++)
        d[lb-i-1]=b[i]-'0';
    for(int i=0;i<la;i++){
        x=0;
        for(int j=0;j<lb;j++){
            ans[i+j]=ans[i+j]+x+c[i]*d[j];
            x=ans[i+j]/10;
            ans[i+j]=ans[i+j]%10;
        }
        ans[i+lb]=x;
    }
    int lc=la+lb;
    while(lc>1&&ans[lc-1]==0)
        lc--;
    if(lc<dian)
        printf("0");
    for(int i=lc-1;i>=dian;i--)
        printf("%d",ans[i]);
}
int main()
{
    cin>>a>>b;
    int lb=b.length();
    string tmp="";
    for(int i=0;i<lb;i++){
        if(i==0&&b[i]=='0')continue;
        if(b[i]!='.')
            tmp+=b[i];
        else{
            dian=lb-i-1;
        }
    }
    mut(a,tmp);
    return 0;
}


Measured memory_bytes: 3640
#include<bits/stdc++.h>
typedef long long int ll;
using namespace std;
int main()
{   ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin>>n;
    vector<int>a(n);
    for(int i=0;i<n;i++)
    cin>>a[i];
    vector<int>dp(n);
    dp[0] = 0;
    dp[1] = abs(a[1]-a[0]);
    for(int i=2;i<n;i++)
    dp[i] = min(dp[i-1]+abs(a[i]-a[i-1]),dp[i-2]+abs(a[i]-a[i-2]));
    cout<<dp[n-1]<<endl;
}

Measured memory_bytes: 3924
#include <iostream>
#define abs(a) ((a) < 0 ? -(a):(a))

using namespace std;
int main()
{
  int n, i;
  int a[101];
  long long min=1000000000, max = 0;

  cin >> n;

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

  for(i=0; i<n; i++){
    if(a[i]<min) min=a[i];
  }

  for(i=0; i<n; i++){
    if(a[i]>max) max = a[i];
  }

  cout << (max-min) << endl;
  return 0;
}


Measured memory_bytes: 256
import numpy as np

N = int(input())
A = np.array([int(i) for i in input().split()])
# dif = A1-A2+A3-A4 ...
dif = sum([A[i] * pow(-1, i) for i in range(N - 1)])
ans = [0] * N
ans[0] = A[-1] + dif
ans[-1] = A[-1] - dif
for i in range(1, N - 1):
    ans[i] = 2 * A[i - 1] - ans[i - 1]
print(*ans)


Measured memory_bytes: 23120
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main(){
  ll a = 2;
  ll b = 1;
  ll ans;
  int n;

  cin >> n;

  if(n == 1){
    ans = b;
  }else{
    for(int i=2;i<=n;i++){
      ans = a + b;
      a = b;
      b = ans;
    }
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
import * as fs from 'fs';

let input = fs.readFileSync("/dev/stdin", "utf8").split(" ").map(x => parseInt(x));
input = input.sort();
if(input[0] === 5 && input[1] === 5 && input[2] === 7)
{
    console.log("YES");
}
else
{
    console.log("NO");
}

Measured memory_bytes: 7500
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> pll;
const ll mod=1e9+7;
//const ll mod=998244353;
const ll inf=5e18;

int main() {
  ll n;
  cin >> n;
  string s[2];
  for(ll i=0;i<2;i++) {
    cin >> s[i];
  }
  ll ans=1;
  ll last;
  for(ll i=0;i<n;i++) {
    if(i==0) {
      if(s[0][i]==s[1][i]) {
        ans*=3;
        last=0;
      }
      else {
        ans*=6;
        last=1;
        i++;
      }
    }
    else {
      if(s[0][i]==s[1][i]) {
        if(last) {
          ans*=1;
        }
        else {
          ans*=2;
        }
        last=0;
      }
      else {
        if(last) {
          ans*=3;
        }
        else {
          ans*=2;
        }
        last=1;
        i++;
      }
    }
    ans%=mod;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {
        s: String,
    }

    let s = s.as_bytes().to_vec();
    let ans = if s[0] == s[1] && s[1] == s[2] {
        "No"
    } else {
        "Yes"
    };

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


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

public class Main {


    public static void main(String[] args) throws IOException {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
//        int n=Integer.parseInt(br.readLine().trim());
        String[] s=br.readLine().split(" ");
        int n=Integer.parseInt(s[0].trim());
        int x=Integer.parseInt(s[1].trim());
        int t=Integer.parseInt(s[2].trim());
        int ceil=(int)Math.ceil((float)n/x);
//        System.out.println(ceil);
        int res=ceil*t;
//        if(x==1){
//            res=n*t;
//        }
        System.out.println(res);





//        long[] a=new long[n];
//        long res=0;
//        for(int i=0;i<n;i++){
//            a[i]=Long.parseLong(s[i].trim());
//        }
//
//        long last=a[0];
//        for(int i=1;i<n;i++){
//            if(a[i]<last){
//                res+=(last-a[i]);
//            }
//            last=Math.max(last,a[i]);
//        }
//        System.out.println(res);





    }






}


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

#define F(i,a,b) for (int i = a; i <= b; i ++)

const int N = 1e5 + 10;

using namespace std;

int n, m, a[N], b[N], cnt;
int x, y, ans, fa[N], tot; bool bz[N];
struct node {
	int x, num;
	friend bool operator < (node a, node b) { return a.x < b.x; }
} A[N], B[N];

int get(int x) { return !fa[x] ? x : fa[x] = get(fa[x]); }

int main() {
	scanf("%d", &n);
	F(i, 1, n) scanf("%d", &a[i]), x = x ^ a[i]; a[n + 1] = x; x = 0;
	F(i, 1, n) scanf("%d", &b[i]), x = x ^ b[i]; b[n + 1] = x; x = 0;

	F(i, 1, n + 1) A[i] = {a[i], i};
	F(i, 1, n + 1) B[i] = {b[i], i};
	sort(A + 1, A + n + 2);
	sort(B + 1, B + n + 2);

	F(i, 1, n + 1)
		if (A[i].x ^ B[i].x) { puts("-1"); return 0; }
	F(i, 1, n + 1)
		a[A[i].num] = cnt += A[i].x != A[i - 1].x;
	cnt = 0;
	F(i, 1, n + 1)
		b[B[i].num] = cnt += B[i].x != B[i - 1].x;
	
	F(i, 1, n)
		if (a[i] ^ b[i]) {
			x = get(a[i]), y = get(b[i]), ans += (i <= n);
			if (x ^ y) fa[x] = y;
		}
	F(i, 1, n + 1)
		if (a[i] ^ b[i] && (get(a[i]) == a[i]) && !bz[a[i]])
			ans ++, tot ++, bz[a[i]] = 1;
	if (ans == 0) { puts("0"); return 0; }
	ans ++;
	F(i, 1, n)
		if (b[i] == a[n + 1] && a[i] ^ b[i])
			{ ans --; break; }

	printf("%d\n", ans - (tot > 0));
}

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

int main(){
	int week, yen=100000, hasuu;
	cin>>week;
	while(week--){
		yen = yen*1.05;
		if(hasuu=yen%1000){
			yen += 1000-hasuu;
		}
	}
	cout << yen <<endl;
	return 0;
}

Measured memory_bytes: 1160
#!/usr/bin/env python3

LI = [0, 4, 7, 8, 12, 14, 16, 20, 21, 24, 11, 15, 19, 23, 27, 18, 22, 26, 25]

def main():
    n = int(input())
    print("Yes" if n % 28 in LI else "No")

main()


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

using namespace std;

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

long long dp[maxn];

int main(){

	int n,m;

	cin >> n >> m;

	bitset<maxn> mp;

	for(int i=0,x;i<m;++i){
		cin >> x;
		mp[x] = 1;
	}

	dp[1] = (mp[1] ? 0 : 1);
	dp[2] = (mp[2] ? 0 : mp[1] ? 1 : 2);

	for(int i=3;i<=n;++i){
		if(!mp[i]) dp[i] = (dp[i-1] + dp[i-2])%mod;
	}

	cout << dp[n] << '\n';

	return 0;
}

Measured memory_bytes: 1024
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
using ll = long long;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-8;
const int MOD = 1000000007;
// const int MOD = 998244353;
const int dy[] = {1, 0, -1, 0}, dx[] = {0, -1, 0, 1};
const int dy8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dx8[] = {0, -1, -1, -1, 0, 1, 1, 1};
template <typename T, typename U> inline bool chmax(T &a, U b) { return a < b ? (a = b, true) : false; }
template <typename T, typename U> inline bool chmin(T &a, U b) { return a > b ? (a = b, true) : false; }
struct IOSetup {
  IOSetup() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
  }
} iosetup;

int main() {
  int n, m; cin >> n >> m;
  int mx = 1;
  REP(_, n) mx *= 10;
  int mn = 0;
  if (n == 2) {
    mn = 10;
  } else if (n == 3) {
    mn = 100;
  }
  vector<int> s(m), c(m);
  REP(i, m) {
    cin >> s[i] >> c[i]; --s[i];
    s[i] = n - 1 - s[i];
  }
  FOR(ans, mn, mx) {
    string str = to_string(ans);
    reverse(ALL(str));
    bool ok = true;
    REP(i, m) ok &= str.length() > s[i] && str[s[i]] - '0' == c[i];
    if (ok) {
      cout << ans << '\n';
      return 0;
    }
  }
  cout << "-1\n";
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main() {
   int N,M;
   int sum = 0;
   int cnt = 0;
   int com;
   scanf("%d %d",&N, &M);
 
   int array[N];
   for(int i = 0; i < N; i++) {
      scanf("%d",&array[i]);
      sum += array[i];
   }
 
   com = sum/(4*M);
 
   for(int i = 0; i < N; i++) {
      if(sum <= array[i]*4*M) {
         cnt++;
      }
   }
   if(cnt >= M) {
      printf("Yes\n");
   } else {
      printf("No\n");
   }
 
   return 0;
}


Measured memory_bytes: 1632
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,i,b,c,m,n;
    cin>>m>>n;
    queue<int>q[m];
    while(n--)
    {
        cin>>a>>b;
        if(a==0)
        {
            cin>>c;
            q[b].push(c);
        }
        else if(a==1)
        {
            if(!q[b].empty())
                cout<<q[b].front()<<endl;
        }
        else
        {
            if(!q[b].empty())
                q[b].pop();
        }
    }
}



Measured memory_bytes: 4292
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#define F first
#define S second
#define int long long
#define ll long long
//#define int  unsigned long long
#define pb push_back
#define double long double

using namespace std;
using namespace __gnu_pbds;
typedef  tree< int , null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
const int N = 1000000;
const int K = 19;
const int mod = 1e9 + 7;
int dp[2][N], s, t, n, m, d[2][N], c[2][N];
vector < int > gr[2][N];
vector < pair < int, int > > g[N];
void solve(int k){
    vector < pair < int, int > > a;
    for (int i = 1; i <= n; i++) if (d[0][i] + d[1][i] == d[0][t]) a.pb({d[0][i], i});
    sort(a.begin(), a.end());
    if (k == 1) reverse(a.begin(), a.end());
    if (k == 1) dp[k][t] = 1; else dp[k][s] = 1;
    for (auto i: a){
        int v = i.S;
        for (auto u: gr[k][v]){
            dp[k][u] = (dp[k][u] + dp[k][v]) % mod;
         //   cout << k << " " << u << " " << dp[k][u] << " v = " << v << endl;
        }
    }
}
void dist(int k){
    for (int i = 1; i <= n; i++) d[k][i] = 1e18;
    set < pair < int, int > > q;
    if (k == 0){
        q.insert({0, s});
        d[k][s] = 0;
    }
    else{
        q.insert({0, t});
        d[k][t] = 0;
    }
    while(!q.empty()){
        int v = (*q.begin()).S;
        q.erase(q.begin());
        for (auto u: g[v]){
            if (d[k][u.F] > d[k][v] + u.S){
                q.erase({d[k][u.F], u.F});
                d[k][u.F] = d[k][v] + u.S;
                q.insert({d[k][u.F], u.F});
            }
        }
    }
}
main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    //freopen("input.txt", "r", stdin);
    cin >> n >> m;
    cin >> s >> t;
    for (int i = 1; i <= m; i++){
        int u, v, w;
        cin >> u >> v >> w;
        g[u].pb({v, w});
        g[v].pb({u, w});
    }
    dist(0);
    dist(1);

   // for (int i = 1; i <= n; i++) cout << d[0][i] << " " << d[1][i] << endl;;
   // cout << endl;
    int cnt = 0;
    for (int v = 1; v <= n; v++){
        for (auto u: g[v]){
            if (d[0][v] + d[1][u.F] + u.S != d[0][t] || d[0][v] > d[0][u.F]) continue;
            gr[0][v].pb(u.F);
            gr[1][u.F].pb(v);
          //  cout << v << " " << u.F << endl;
            if (2 * d[0][v] < d[0][t] && 2 * d[0][u.F] > d[0][t]){
                c[0][cnt] = v;
                c[1][cnt] = u.F;
                cnt++;
            }
        }
        if (2 * d[0][v] == d[0][t] && 2 * d[1][v] == d[1][s]){
            c[0][cnt] = v;
            c[1][cnt] = v;
            cnt++;
        }
    }
    solve(0);
    solve(1);
    int s1 = 0;
    int s2 = 0;
    int ans = 0;
    for (int i = 0; i < cnt; i++){
        int u = c[0][i];
        int v = c[1][i];
       // cout << u << " -- " << v << " " << dp[0][u] << " --- " << dp[1][v] << endl;
        int x = dp[0][u] * dp[1][v] % mod;
        x = x * x % mod;
        ans = (ans - x + mod) % mod;
    }
    cout << (ans + dp[0][t] * dp[1][s]) % mod;
}


Measured memory_bytes: 106840
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n,a;
  cin>>n;
  a=n%10;
  if(a==2||a==4||a==5||a==7||a==9){
	cout<<"hon"<<endl;
  }
  else if(a==3){
    cout<<"bon"<<endl;
  }
  else{
    cout<<"pon"<<endl;
  }
}

Measured memory_bytes: 3636
#include <stdio.h>  
#include <algorithm>  
#include <assert.h>
#include <bitset>
#include <cmath>  
#include <complex>  
#include <deque>  
#include <functional>  
#include <iostream>  
#include <limits.h>  
#include <map>  
#include <math.h>  
#include <queue>  
#include <set>  
#include <stdlib.h>  
#include <string.h>  
#include <string>  
#include <time.h>  
#include <unordered_map>  
#include <unordered_set>  
#include <vector>  
#include <chrono>
#include <random>
#include <time.h>
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pq priority_queue<int>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define vec vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define endl "\n"
#define all(c) begin(c),end(c)
using namespace std;
int in() {int x;scanf("%d",&x);return x;}
ll lin() {ll x;scanf("%lld",&x);return x;}

#define INF 1e9+7
#define LLINF 1e18+7
#define N 500000
ll MOD=1e9+7;
ll dp[2000000];
int a[N];
ll n;
vec mem(20,-1);
main(){
    int n=in();
    cout<<(n-2)*180;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPR(i, n) for (int i = n; i >= 0; --i)
#define FOR(i, n, m) for (int i = m; i < n; i++)
#define MM(i, n, m) for (int i = m; i <= n; i++)
#define INF 1e9
#define ALL(v) v.begin(), v.end()

typedef long long ll;

/**
 * C問以降は ll を使う.
 * double型にするのを忘れない.
 * nC2の求め方 (1/2)*n*(n-1)
 * vector<型> 変数名(要素数, 初期値)
 * pair<型, 型> 変数名
 * map<型, 型> 変数名  // 連想配列
 * priority_queue<型> 変数名  // 最大値から出てくるヒープ
*/
int main()
{
    ll N;
    cin >> N;
    vector<ll> A(N);
    REP(i, N)
    {
        cin >> A.at(i);
    }
    sort(ALL(A));
    REP(i, N - 1)
    {
        if (A.at(i) == A.at(i + 1))
        {
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;
    return 0;
}

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

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  string s; cin>>s;
  if (s.size()==2) cout<<s<<endl;
  else {
    cout<<s.at(2)<<s.at(1)<<s.at(0)<<endl;
  }
}




Measured memory_bytes: 256
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt(), T = sc.nextInt(), c, t, ans = Integer.MAX_VALUE;
        for (int i = 0; i < N; ++i) {
            c = sc.nextInt();
            t = sc.nextInt();
            if (t <= T) ans = Math.min(c, ans);
        }
        sc.close();
        if (ans == Integer.MAX_VALUE) System.out.print("TLE");
        else System.out.print(ans);
    }
}

Measured memory_bytes: 21844
// AOJ 0617 Ball
// 2018.3.31 bal4u

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

//#define getchar_unlocked()  getchar()
int in()
{
	int n = 0, c = getchar_unlocked();
	do n = 10*n + (c & 0xf), c = getchar_unlocked(); while (c >= '0');
	return n;
}

#define INF 0x50505050
int N, M, K;
int d1[100004], d2[100004], d[100004];
int  p[100004];
int dp[200004];

int binarySearch(int x, int n)
{
	int m, l = 0, r = n;

    while (l < r) {
        m = (l + r) >> 1;
        if (d2[m] < x) l = m + 1; else r = m;
    }
	return l;
}

int check(int k)
{
	int i, m, t;
	long long s;

	for (i = 0; i < N; i++) dp[i] = 1;
	for (i = 0; i < M; i++) {
		m = p[i], dp[m] = 0;
		if (d1[i] < k) dp[m] = INF;
	}
	m = N-1; for (i = 1; i <= m; i+=3) {
		s = t = dp[i-1];
		if (t < dp[i  ]) t = dp[i];
		if (t < dp[i+1]) t = dp[i+1];
		s += dp[i]+dp[i+1]-t;
		if (s > INF) s = INF;
		dp[++m] = (int)s;
	}
	return K-binarySearch(k, K) >= dp[m];
}
 
int cmp(int *a, int *b) { return *a - *b; }

int main()
{
	int i, m, lo, hi, mi;
	N = in(), M = in(), K = N-M;
	for (i = 0; i < M; i++) d[i] = d1[i] = in(), p[i] = in()-1;
	m = 0; for (; i < N; i++) d[i] = d2[m++] = in();
	qsort(d , N, sizeof(int), cmp);
	qsort(d2, K, sizeof(int), cmp);

	lo = 0, hi = N;
	while (lo + 1 < hi) {
		mi = (lo + hi) >> 1;
		if (check(d[mi])) lo = mi; else hi = mi;
	}
	printf("%d\n", d[lo]);
	return 0;
}


Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
#define SORT(x) sort(x.begin(),x.end())
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000000
#define mod 1000000007
typedef long long ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
int main(){
    int n;
    cin>>n;
    int a[n];double sum=0;
    rep(i,n){
        cin>>a[i];
        sum+=a[i];
    }
    double aved=(double)sum/n;
    int ave=sum/n;
    double tmp=(double)ave+0.5;
    if(aved>tmp){
        ave++;
    }
    ll ans=0;
    rep(i,n){
        ans+=(a[i]-ave)*(a[i]-ave);
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
 long long int dp[103][100003];
 long long int call(long long int weight[],long long int price[],int n,int w,int i)
 {
 	if(i==n)
 	return 0;
 	
 	if(dp[i][w]!=-1)
 	return dp[i][w];
 	
 	
 	if(w-weight[i]>=0)
 	return dp[i][w]=max(price[i]+call(weight,price,n,w-weight[i],i+1),call(weight,price,n,w,i+1));
 	else
 	return dp[i][w]=call(weight,price,n,w,i+1);
 }
 
 
 int main()
{   ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n,w;
    cin>>n>>w;
    long long int weight[n],price[n];
    
    for(int i=0;i<n;i++)
     cin>>weight[i]>>price[i];
     
     for(int i=0;i<=n;i++)
      for(int j=0;j<=w;j++)
        dp[i][j]=-1;
     
     cout<<call(weight,price,n,w,0)<<endl;
     
	return 0;
}  

Measured memory_bytes: 80128
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(v) v.begin(),v.end()
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const int INF=1e9;
const int di[] = {-1,0,1,0};
const int dj[] = {0,-1,0,1};

int main(){
  string s;
  cin>>s;
  int ans=1;
  for(int i=1;i<s.length();i++){
    if(s[i]==s[i-1]&&i==s.length()-1){
      continue;
    }
    if(s[i]==s[i-1]&&i==s.length()-2){
      ans++;
      break;
    }
    if(s[i]==s[i-1]&&i!=s.length()-1){
      i+=2;
      ans+=2;
      continue;
    }
    ans++;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3728
n, k = gets.chomp.split(" ").map(&:to_i)

x = gets.chomp.split(" ").map(&:to_i)

neg = []
pos = []

x.each do |e|
  if e < 0
    neg << e.abs
  else
    pos << e
  end
end

neg.reverse!

if neg.empty?
  puts pos[k - 1]
elsif pos.empty?
  puts neg[k - 1]
else
  ans = []
  0.upto(k) do |i|
    next if i > neg.length || k - i > pos.length
    tm = 0
    left = neg[i - 1]
    right = pos[k - i - 1]
    tm = left + right + [left, right].min
    ans << tm
  end
  puts ans.min
end

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

using pos     = complex<double>;

template <typename Itr>
void printv(Itr begin, Itr end)
{
  for (Itr iter = begin; iter != end; iter++) {
    cout << *iter << ", ";
  }
  cout << endl;
}

double dist(pos a, pos b)
{
  return sqrt(pow(a.imag() - b.imag(), 2) + pow(a.real() - b.real(), 2));
}

pair<pos, pos> get_centers(pos a, pos b)
{
  pos c    = (a + b) / 2.0;
  double l = sqrt(1 - pow(dist(a, c), 2));
  pos vec  = (a - b) * pos(0, 1);
  vec      = (vec / dist(vec, 0)) * l;
  return {c + vec, c - vec};
}

int main()
{
  int n;
  while (cin >> n) {
    if (!n) break;

    vector<pos> t(n);
    for (int i = 0; i < n; ++i) {
      double x, y;
      cin >> x >> y;
      t[i] = pos(x, y);
    }

    int ans = 0;
    for (int pi = 0; pi < n; ++pi) {
      for (int qi = 0; qi < n; ++qi) {
        pos p = t[pi];
        pos q = t[qi];
        if (pi == qi || dist(p, q) > 2.0) {
          ans = max(ans, 1);
          continue;
        }
        pair<pos, pos> centers = get_centers(p, q);
        for (pos center : {centers.first, centers.second}) {
          int cnt_d = 2;
          for (int ci = 0; ci < n; ++ci) {
            if (ci != pi && ci != qi) {
              if (dist(t[ci], center) <= 1) {
                ++cnt_d;
              }
            }
          }
          ans = max(ans, cnt_d);
        }
      }
    }
    cout << ans << endl;
  }
}



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

int main(){
  int a[5];
  rep(i,5) cin >> a[i];
  int val[5];
  rep(i,5){
    val[i] = a[i]%10;
    if(val[i]>0) val[i] = 10-val[i];
  }
  sort(val, val+5);
  int sum = 0;
  rep(i,5) sum +=a[i];
  rep(i,4) sum +=val[i];
  
  cout << sum  << endl;
  return 0;
}

Measured memory_bytes: 256
import sys


# input = sys.stdin.readline

def main():
    S = input()
    we = ["Sunny","Cloudy","Rainy"]
    if S ==we[0]:
        print(we[1])
    elif S ==we[1]:
        print(we[2])
    else:
        print(we[0])



if __name__ == "__main__":
    main()

Measured memory_bytes: 8944
// Problem: C - A x B + C
// Contest: AtCoder - AtCoder Beginner Contest 179
// URL: https://atcoder.jp/contests/abc179/tasks/abc179_c
// Memory Limit: 1024 MB
// Time Limit: 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
#define ll long long int
#define ii int
#define du double
#define jmp "\n"
#define vl vector<ll>
#define vvl vector<vl>
#define pb push_back
#define printv(v)     \
  for (auto x : v)    \
    cout << x << " "; \
  cout << jmp;
#define vi vector<int>
#define vb vector<bool>
#define ump unordered_map
#define SORT(v) sort(v.begin(), v.end())
#define REV(x) reverse(x.begin(), x.end())
#define all(x) x.begin(), x.end()
#define SET(x, a) memset(x, a, sizeof(x))
#define si(x) x.size()
#define ff first
#define ss second
#define iin insert
#define deb(x) cout << "test " << #x << "=" << x << jmp
#define deb2(x, y) cout << "test " << #x << "=" << x << "," << #y << "=" << y << jmp
using namespace std;
const ll nax = 1e5 + 5;

void solve()
{
  ll n;
  cin >> n;
  ll ctr = 0;
  for (ll j = 1; j < n; j++)
  {
    if (n % j == 0)
      ctr--;
    ctr += (n / j);
  }
  cout << ctr << jmp;
}
int32_t main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ll t = 1;
  // cin >> t;
  while (t--)
    solve();
  return 0;
}

Measured memory_bytes: 3636
#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
using namespace std;
typedef long long ll;
const int maxn=5e5+10;
const ll mod=1e9+7;
ll fpow(ll a,ll b){
	ll ans=1;
	while(b){
		if(b&1) ans=(ans*a)%mod;
		b/=2;a=(a*a)%mod; 
	}
	return ans%mod;
}

int main()
{
	ll n;cin>>n;
	cout<<(fpow(10,n)+mod-(2*fpow(9,n))%mod+fpow(8,n))%mod;
	return 0;	
} 

Measured memory_bytes: 3144
#include <bits/stdc++.h>
 
using namespace std;
 
int main(){
	
	long long int n;
	cin>>n;
	
	int p=(64-__builtin_clzll(n));
  	long long ans = 1LL<<p;
	cout<<(ans-1);
	
	return 0;		
}

Measured memory_bytes: 256
import java.util.*;
import java.math.BigInteger;
 class Main{

     public static void main(String []args){
      Scanner scan = new Scanner(System.in);
      int n = scan.nextInt() ;
      int c = scan.nextInt() ;
      int sum = 1 ; 
      for(int i =0 ;i<n  ;i++){
          if(sum*2 < sum+c){
              sum*=2 ;
          }else{
              sum+=c ;
          }
      }
      System.out.println(sum) ;
    }
}

Measured memory_bytes: 22868
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using P = pair<int, int>;
#define PI acos(-1)
#define Mod (int)1000000007
#define INFTY (int)INT_MAX
#define Rep(i, n) for (int i = 0; i < (int)(n); i++)
#define BitRep(i, n) for (int i = 0; i < (int)(1 << n); i++)
#define All(vec) vec.begin(), vec.end()
#define Sum(vec) accumulate(vec.begin(), vec.end(), 0)
#define Sort(vec) sort(vec.begin(), vec.end())
#define Reverse(vec) reverse(vec.begin(), vec.end())
#define Count(vec, x) count(vec.begin(), vec.end(), x)
#define Next_permutation(vec) next_permutation(vec.begin(), vec.end())
#define Find(S, s) S.find(s) != string::npos

int gcd(int a, int b) {
    if (a == 0) return b;
    else return gcd(b % a, a);
}

int lcm(int a, int b) {
    return a / gcd(a, b) * b;
}

int main() {
    int n;
    cin >> n;
    int ans = 1;
    Rep(i, n) {
        int a;
        cin >> a;
        ans = lcm(ans, a);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3088
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int num = sc.nextInt();
		int point[][] = new int[num][2];
		for(int i = 0; i < num; i ++) {
			point[i][0] = sc.nextInt();
			point[i][1] = sc.nextInt();
		}
		Arrays.sort(point, (a, b) -> Integer.compare(b[1], b[1]));
		Arrays.sort(point, (a, b) -> Integer.compare(a[0], b[0]));

		int min = 100_100;
		if(num == 1) { System.out.println(1); return; }
		for(int i = 0; i < num; i ++) {
			for(int j = 0; j < i; j ++) {
				int p = point[i][0] - point[j][0];
				int q = point[i][1] - point[j][1];
				int count = num;
				for(int i2 = 0; i2 < num; i2 ++) {
					for(int j2 = 0; j2 < num; j2 ++) {
						if(point[i2][0] - point[j2][0] == p && point[i2][1] - point[j2][1] == q) {
							count --;
							break;
						}
					}
				}
				min = Math.min(min, count);
			}
		}
		System.out.println(min);
	}
}

Measured memory_bytes: 28884
N=int(input())
S=input()
K=int(input())-1
k=S[K]
h=[]
for i in range(N):
    g=S[i]
    if k==g:
        h.append(k)
    else:
        h.append("*")
m=','.join(h)
j=m.maketrans({',':''})
print(m.translate(j))

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

using namespace std;

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

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

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

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

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

// floating
typedef double Real;
const Real EPS = 1e-11;
#define EQ0(x) (abs(x)<EPS)
#define EQ(a,b) (abs(a-b)<EPS)
typedef complex<Real> P;

int n,m;
// g[pos][type] -> vi
unordered_map<int,vi> g[125252];
vi colors[125252];
unordered_map<int,int> dist[125252];

const int NICO = 830252521;

int main(){
  scanf("%d%d",&n,&m);
  REP(i,m){
    int p,q,c;
    scanf("%d%d%d",&p,&q,&c);
    --p;--q;
    g[p][c].push_back(q);
    g[q][c].push_back(p);
    colors[p].push_back(c);
    colors[q].push_back(c);
  }
  REP(i,n){
    sort(ALL(colors[i]));
    colors[i].erase(unique(ALL(colors[i])),colors[i].end());
    for(const int& com:colors[i]){
      dist[i][com] = NICO;
    }
    dist[i][NICO] = NICO;
  }
  // dist,pos,company
  deque<pair<int,pii>> Q;
  Q.push_back(make_pair(0,pii(0,NICO)));
  dist[0][NICO] = 0;
  while(!Q.empty()){
    pair<int,pii> P = Q.front(); Q.pop_front();
    int d = P.first;
    int p = P.second.first;
    int c = P.second.second;
    if(c==NICO){
      // get train
      for(const int& com:colors[p]){
        if(d+1>=dist[p][com])continue;
        dist[p][com] = d+1;
        Q.push_back(make_pair(d+1,pii(p,com)));
      }
    }else{
      // continue train or ride off
      for(const int& to:g[p][c]){
        if(d>=dist[to][c])continue;
        dist[to][c] = d;
        Q.push_front(make_pair(d,pii(to,c)));
      }
      if(d<dist[p][NICO]){
        dist[p][NICO] = d;
        Q.push_front(make_pair(d,pii(p,NICO)));
        if(p==n-1){
          Q.clear();
          break;
        }
      }
    }
  }
  int ans = dist[n-1][NICO];
  if(ans==NICO)ans=-1;
  printf("%d\n",ans);
  return 0;
}


Measured memory_bytes: 82560
N, M = map(int, input().split())
XY = [i for i in range(N + 1)]

def root(x):
  temp = x
  while temp != XY[temp]:
    temp = XY[temp]
  XY[x] = temp
  return temp
for _ in range(M):
  x, y = map(int, input().split()[:2])
  XY[root(x)] = root(y)

print(sum(i == v for i, v in enumerate(XY)) - 1)


Measured memory_bytes: 49184
#include<iostream>
#include<string>
#include<algorithm>
#include<queue>
#include<vector>
#include<cstdlib>

using namespace std;

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

int main(){
    int const INF = 1000000001;
    int n;
    cin >> n;
    int a[n+1];
    rep(i, n) cin >> a[i];
    a[n] = INF;
    sort(a, a + n + 1);
    int num = a[0];
    int count = 1;
    int ans = 0;
    for (int i = 1; i < n + 1; i++){
        if (num != a[i]){
            if (count < num){
                ans += count;
                num = a[i];
                count = 1;
            }else{
                ans += count - num;
                num = a[i];
                count = 1;
            }
        }else{
            count++;
        }
    }
    cout << ans << endl;

}

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

int main() {
  int a = 1, b = 1, c = 1, N, K;
  cin >> N >> K;
  for (int i = 0; i < N; i++){
    a = c * 2;
    b = c + K;
    if (a < b){
      c = a;
    }
    else {
      c = b;
    }
  }
  cout << c << endl;

}


Measured memory_bytes: 3600