akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

int n, h[100100], a[100100];

int main(){
//	cin.tie(0);
//	ios::sync_with_stdio(false);
	cin >> n;
	for(int i=0; i<n; ++i) cin >> h[i];
	for(int i=1; i<n; ++i) a[i] = 1e9+7;
	for(int i=0; i<n; ++i){
		a[i+1] = min(a[i+1], a[i] + abs(h[i+1] - h[i]));
		a[i+2] = min(a[i+2], a[i] + abs(h[i+2] - h[i]));
	}
	cout << a[n-1] << "\n";
}

Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <tuple>
#include <cstdio>
#include <bitset>
#include <sstream>
#include <iterator>
#include <numeric>
#include <map>
#include <cstring>

using namespace std;

//#define DEBUG_ //!!提出時にコメントアウト!!
#ifdef DEBUG_
	#define dump(x)  cerr << #x << " = " << (x) << endl;
#else
	#define dump(x)  ; //何もしない文
#endif

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size()) //unsignedのサイズをint型に変換
#define pb push_back

typedef long long LL; 
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;

template <typename T>
std::string printVector(const std::vector<T> &data)
{
    std::stringstream ss;
    std::ostream_iterator<T> out_it(ss, ", ");
    ss << "[";
    std::copy(data.begin(), data.end() - 1, out_it);
    ss << data.back() << "]";
    return ss.str();
}

const int MOD = 1e9+7;
const LL LINF = 1001002003004005006ll;
const int INF = 1001001001;

int main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);	
    int N,Q; cin >> N >> Q;
    string S; cin >> S;
    VI l(Q), r(Q);
    VI memo(N+1);
    REP(i,Q)
    {
        cin >> l[i] >> r[i];
    }
    memo[0] = 0;
    memo[1] = 0;
    FOR(i,1,N)
    {
        if(S[i-1] == 'A' && S[i] == 'C') 
        {
            memo[i+1] = memo[i] + 1;
        }
        else
        {
            memo[i+1] = memo[i];
        }
    }
    REP(i,N+1)
    {
//        dump(memo[i])
    }
    REP(i,Q)
    {
        int ans;
        ans = memo[r[i]] - memo[l[i] - 1];
        dump(memo[r[i]])
        dump(memo[l[i]-1])
        if(S[l[i]-2] == 'A' && S[l[i]-1] == 'C') ans--;
        cout << ans << endl;
    }


}


Measured memory_bytes: 2256
#include <iostream>
#include <vector>
using namespace std;
int main(){
    int n;
    cin >> n;
    vector<int>a(n+1,0);
    long long sum=0;
    for(int i=1;i<=n;++i){
        for(int j=0;j<=n;j=j+i){
            a[j]++;
        }
    }
    for(long long i=1;i<=n;++i){
        sum = sum + (i*(long long)a[i]);
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 42328
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pull = pair<ull, ll>;
using pis = pair<int, string>;
#define all(x) (x).begin(), (x).end()
#define INF 1000000000
#define LLINF 10000000000000000ll
#define MOD1 1000000007LL
#define MOD2 999999937LL

struct prime_n {
  //2以上の最小の素因数を求める。
  //0, 1については1とする。
  int minfactor = 1;
  bool isPrime = true;
};

int struct_prime(vector<prime_n>&primes) {
  primes[0].isPrime = false;
  primes[1].isPrime = false;
  int cnt = 0;
  for (int i = 0; i < primes.size(); i++) {
    if (!primes[i].isPrime) continue;
    primes[i].minfactor = i;
    cnt++;
    for (int k = 2 * i; k < primes.size(); k += i) {
      primes[k].isPrime = false;
      if (primes[k].minfactor == 1) primes[k].minfactor = i;
    }
  }
  return cnt;
}

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

  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  int MAX_A = 1000001;
  vector<prime_n> primes(MAX_A);
  struct_prime(primes);

  vector<bool> isuse(MAX_A, false);
  int gcdall = a[0];
  bool ispairwise = true;
  for (int i = 0; i < n; i++) {
    gcdall = __gcd(gcdall, a[i]);
    int tar = a[i];
    while(tar != 1) {
      int p = primes[tar].minfactor;
      while(tar % p == 0) tar /= p;
      if (!isuse[p]) isuse[p] = true;
      else ispairwise = false;
    }
  }
  if (ispairwise) {
    cout << "pairwise coprime" << endl;
    return 0;
  }
  if (gcdall == 1) {
    cout << "setwise coprime" << endl;
    return 0;
  }
  cout << "not coprime" << endl;
  return 0;
}


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

using namespace std;

#define DUMP(x) std::cerr << (#x) << " = " << (x) << "\n"
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define REP(i, k, n) for (int i = (k); i < (int)(n); ++i)
#define ALL(r) r.begin(), r.end()
#define YES puts("YES")
#define Yes puts("Yes")
#define NO puts("NO")
#define No puts("No")
#define IMP puts("IMPOSSIBLE")
#define Imp puts("Impossible")
#define imp puts("impossible")
#define M1 puts("-1")
#define pb push_back

template <typename T>
ostream &operator<<(ostream &os, vector<T> &v)
{
    os << "{";
    rep(i, v.size()) os << v[i] << (i == (int)v.size() - 1 ? "" : ", ");
    os << "}";
    return os;
}
template <typename T>
T dup(T x, T y)
{
    return (x + y - 1) / y;
};
template <typename A, size_t N, typename T>
inline void arrayFill(A (&array)[N], const T &val) { std::fill((T *)array, (T *)(array + N), val); }
struct in
{
    const size_t n = 0;
    in() = default;
    in(size_t n) : n(n){};
    template <typename T>
    operator T()
    {
        T ret;
        cin >> ret;
        return ret;
    }
    template <typename T>
    operator vector<T>()
    {
        assert(n != 0);
        vector<T> ret(n);
        for (auto &x : ret)
            cin >> x;
        return ret;
    }
};

using ll = int64_t;
using vint = vector<int32_t>;
using vvint = vector<vint>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pint = pair<int32_t, int32_t>;
using pll = pair<ll, ll>;
using setint = set<int32_t>;
using setstr = set<string>;
using qint = queue<int32_t>;
using qpint = queue<pint>;

constexpr std::int32_t INF = 1001001001;
constexpr std::int64_t LINF = 1001001001001001001;

void Main()
{
    int n, k;
    cin >> n >> k;
    vector<bool> v(10, true);
    rep(i, k)
    {
        int d = in();
        v[d] = false;
    }

    REP(i, n, 100005)
    {
        int x = i;
        bool ok = true;
        while (x)
        {
            if (!v[x % 10])
            {
                ok = false;
                break;
            }
            x /= 10;
        }
        if (ok)
        {
            cout << i << endl;
            return;
        }
    }
}

int main()
{
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


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

#define ll long long
#define rep(i,x,y) for(int i=x;i<y;i++)
#define rel(i,x,y) for(int i=x-1;i>=y;i--)
#define all(x) x.begin(),x.end()

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    string s;cin >> s;
    ll n = s.size();
    int ans=0;
    rep(i,0,n){
        if(s[i] - '0'> 5 || ((s[i]-'0')== 5 && i<n-1 && (s[i+1]-'0') > 4)){
            ans +=2; //1つ上の桁を払う
            bool ok = true;
            while(i<n && ((s[i]-'0')>4  || (((s[i]-'0')==4 && i<n-1 && (s[i+1]-'0')>4)))){
                ans += (9-(s[i]-'0'));
                i++;
                ok = false;
            }
            if(ok) ans -= 2;
            if(i<n) ans+= s[i]-'0';
        }
        else if(i<n) ans += (s[i]-'0');
    }
    cout << ans << endl;
}


Measured memory_bytes: 1948
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define faster ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef long long ll;
 
typedef vector<int> vi;;
typedef vector<ll> vll;

#define l() length()
#define sz() size()
 
#define b() begin()
#define e() end()
#define all(x) x.begin(), x.end()
 
#define pb(i) push_back(i)
#define PB() pop_back()
 
 
typedef pair<int, int> pii;
typedef pair<ll,ll> pll;
#define mp make_pair
#define Fi first
#define Se second
 
const int maxx=1e6+9;
 
// Happy Coding!

void solve(){
    int n;
    cin>>n;
    vi arr(3*n);
    for(int i=0;i<3*n;i++){cin>>arr[i];}
    sort(all(arr));
    
    ll ans1=0;
    for(int i=n;i<2*n;i++){
        ans1+=arr[i];
    }
    ll ans2=0;
    int cnt=0;
    for(int i=3*n-2;cnt++<n;i-=2){
        ans2+=arr[i];
    }
    cout<<max(ans1,ans2)<<endl;
}





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

Measured memory_bytes: 4464
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <map>
#include <bits/stdc++.h>
#include <string>

using namespace std;
typedef long long ll;
const long double EPS = 1e-9;
const ll mod = 1e9 + 7;

#define rep(i, n) for(int i = 0; i < n ; i++ )
#define For(i, a, b) for(int i = (a); i < (b) ; i++ )
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()

const int MAX_N = 100000;

int main(void){
    int N;
    int A[MAX_N];
    int answer_pm[MAX_N][2];
    int answer_mp[MAX_N][2];
    bool allPos = true;
    bool allNeg = true;

    cin >> N;

    rep(i, N){
        cin >> A[i];
        if (A[i] < 0){
            allPos = false;
        }else if(A[i] > 0){
            allNeg = false;
        }
    }

    sort(A, A + N);

    if(allNeg){
        int answer = A[N - 1];
        
        rep(i, N - 1){
            answer -= A[i];
        }
        
        cout << answer << endl; 

        answer = A[N - 1];
        rep(i, N - 1){
            cout << answer << " " << A[i] << endl;
            answer -= A[i];
        }

        return 0;
    }
    
    if (allPos){
        int answer = A[0];
        
        For(i, 1, N - 1){
            answer -= A[i];
        }
        
        answer = A[N - 1] - answer;

        cout << answer << endl; 

        answer = A[0];
        rep(i, N - 2){
            cout << answer << " " << A[i + 1] << endl;
            answer -= A[i + 1];
        }

        cout << A[N - 1] << " " << answer << endl;

        return 0;
    }

    answer_mp[0][0] = A[0];
    answer_pm[0][0] = A[N - 1];
    int idx_mp = 0;
    int idx_pm = 0;

    For(i, 1, N - 1){
        if (A[i] < 0){
            answer_pm[idx_pm][1] = A[i];
            idx_pm ++;
            answer_pm[idx_pm][0] = answer_pm[idx_pm - 1][0] - answer_pm[idx_pm - 1][1];
        }else{
            answer_mp[idx_mp][1] = A[i];
            idx_mp ++;
            answer_mp[idx_mp][0] = answer_mp[idx_mp - 1][0] - answer_mp[idx_mp - 1][1];
        }
    }

    cout << answer_pm[idx_pm][0] - answer_mp[idx_mp][0] << endl;

    rep(i, idx_pm){
        cout << answer_pm[i][0] << " " << answer_pm[i][1] << endl;
    }
    rep(i, idx_mp){
        cout << answer_mp[i][0] << " " << answer_mp[i][1] << endl;
    }

    cout << answer_pm[idx_pm][0] << " " << answer_mp[idx_mp][0] << endl;

    return 0;
}

Measured memory_bytes: 3072
def cmb(n,k):
    if n < k:
        return 0
    return fac[n]*inv_fac[n-k]*inv_fac[k] % mod
fac = [1]
mod = 10**9+7
n = int(input())
a = list(map(int,input().split()))
for i in range(1,n+2):
    fac.append(fac[-1]*i % mod)
inv_fac = [pow(fac[n+1],mod-2,mod)]
for i in range(1,n+2)[::-1]:
    inv_fac.append(inv_fac[-1]*i % mod)
inv_fac = inv_fac[::-1]
s = set()
num = -1
for i in range(n+1):
    if a[i] in s:
        idx2 = i
        num = a[i]
        break
    s.add(a[i])
for i in range(n+1):
    if a[i] == num:
        idx1 = i
        break
for i in range(1,n+2):
    ans = cmb(n+1,i)
    ans -= cmb(n+idx1-idx2,i-1)
    ans %= mod
    print(ans)

Measured memory_bytes: 111320
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, n) for (int i = (int)(n); i >= 0; i--)
#define REP(i, m, n) for (int i = (int)(m); i <= (int)(n); i++)
#define REPR(i, m, n) for (int i = (int)(m); i >= (int)(n); i--)
#define all(v) v.begin(), v.end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

using Graph = vector<vector<int> >;
vector<bool> seen;
vector<int> order;
vector<int> indeg;

void bfs(const Graph &G, int u){
  queue<int> q;
  q.push(u);
  while(!q.empty()){
    int v = q.front(); q.pop();
    seen[v] = true;
    order.push_back(v);
    for(int nv : G[v]){
      indeg[nv]--;
      if(seen[nv]) continue;
      if(indeg[nv] != 0) continue;
      q.push(nv);
    }
  }
}

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

  indeg.assign(n, 0);
  Graph G(n);
  rep(i, e){
    int s, t; cin >> s >> t;
    G[s].push_back(t);
    indeg[t]++;
  }

  seen.assign(n, false);
  order.clear();
  rep(i, n){
    if(indeg[i] == 0 && !seen[i]) bfs(G, i);
  }

  rep(i, n) cout << order[i] << endl;

  return 0;
}






Measured memory_bytes: 3628
#ifdef LOCAL
#define _GLIBCXX_DEBUG
#endif
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define reps(i,a,b) for(int i=a;i<b;++i)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
using namespace std;
using ll = long long;
using P = pair<int, int>;
template<typename T> inline bool chmax(T &a,T b){if(a<b){a=b;return 1;}return 0;}
template<typename T> inline bool chmin(T &a,T b){if(b<a){a=b;return 1;}return 0;}
template<typename T> vector<T> make_vec(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>
auto make_vec(size_t a,Ts... ts){return vector<decltype(make_vec<T>(ts...))>(a,make_vec<T>(ts...));}
template<typename T,typename U,typename... V>
typename enable_if<is_same<T,U>::value>::type fill_v(U &u,const V... v){u=U(v...);}
template<typename T,typename U,typename... V>
typename enable_if<!is_same<T,U>::value>::type fill_v(U &u,const V... v){for(auto &e:u)fill_v<T>(e,v...);}

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

    string s;
    cin >> s;
    rep(i, 3) cout << s[i];
    cout << endl;
}


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


int main(){
    int a, b;

    while (scanf("%d%d", &a, &b) != EOF){
	int c = a + b;
	int digit = 1;
	while (c >= 10){
	    c = c / 10;
	    digit++;
	}
	cout << digit << endl;
    }
}

Measured memory_bytes: 0
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <string>
using namespace std;
int main() {
	string a, b;
	//string s="error";
	cin >> a; cin >> b; //cin >> c;
	if (a == b)cout << "H" << endl;
	else cout << "D" << endl;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
 
int main(){
  int a, b;
  cin >> a >> b;
  if(a == b){
    cout << "Draw";
  }
  else if(a != 1 && b != 1){
    if(a > b){
      cout << "Alice";
    }
    else{
      cout << "Bob";
    }
  }
  else if(a == 1||b == 1){
    if(a == 1){
      cout << "Alice";
    }
    else if(b == 1){
      cout << "Bob";
    }
  }
}

Measured memory_bytes: 3560
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        List<Integer> list = Arrays.asList(a+b, a-b, a*b);
        System.out.println(Collections.max(list));
    }
}


Measured memory_bytes: 21844
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
      	int n = sc.nextInt();
      	int k = sc.nextInt();
      	int tall;
      	int count = 0;
      	for(int i = 0 ; i < n; i++){
        	tall = sc.nextInt(); 
          	if(tall >= k) count++;
        }
     	System.out.println(count);
    }
}

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

using namespace std;

int main(void){
    int n, point, times;
    cin >> n >> point >> times;
    vector<int> member(n,point-times);
    int crct;
    for (int i = 0; i < times;i++){
        cin >> crct;
        member.at(crct-1)++;
    }

    for(int i = 0; i < n;i++){
        if(member.at(i)<=0)
            cout << "No" << endl;
        else
            cout << "Yes" << endl;
    }

    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define  rep(i, n) for(int i = 0; i < n; i++) 
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  INF 1LL << 60
typedef long long int LL;
typedef long long int ll;
#define pll pair<ll, ll>
#define F first
#define S second
const int MOD = 1000000007;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }
//sort(all(x))とするとソートできるよ
// 10^x は pow(10,(x)) 
// 任意のlogは　対数の底の変換を使う    log(N) / log(任意の底)

int main(){
    int N;cin >> N;
    vector<int> A(N);
    rep(i,N)cin >> A[i];

    bool ok = true;
    rep(i,N){
        if(A[i] % 2 == 0){
            if(A[i] % 3 != 0 && A[i] % 5 != 0)ok = false;
        }
    }

    if(ok)cout << "APPROVED" << endl;
    else cout << "DENIED" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n)  for (int i = 0; i < (int) (n); i++)
#define REP1(i, n) for (int i = 1; i <= (int) (n); i++)
#define all(x)     (x).begin(), (x).end()
#define SZ(x)      ((int) (x).size())
using ll = long long;

int main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  int t  = (c + b - 1) / b;
  int ao = (a + d - 1) / d;
  if (t <= ao) {
	  cout << "Yes" << endl;
	} else {
	  cout << "No" << endl;
	}
  return 0;
}


Measured memory_bytes: 3612
# readtest
parseInt(x) = parse(Int, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function main()
	n = readline() |> parseInt
	str = readlines()
	#println(str)
	a = Array{Int}(2,n)
	for i in 1:n
		a[:,i] = str[i] |> split |> parseMap
	end
	a = sortcols(a, by=z->z[2])
	t = 0
	flg = 0
	for i in 1:n
		t += a[1,i]
		if t > a[2,i]
			flg = 1
			break
		end
	end
	println(flg==0?"Yes":"No")
end

main()


Measured memory_bytes: 176140
n = int(input())

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

def cnt(arr):
    c = 0
    n = arr[1]
    i = 1
    while True:
        if 0 <= n - i:
            c += 1
            n -= i
            i += 1
        else:
            break

    return c

arr = factorization(n)

ans = 0
if n != 1:
    for i in arr:
        ans += cnt(i)

print(ans)

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

int main() {
  long long count=0;
  string S;
  cin>>S;
  if(S[6]-'4'>0){
    cout<<"TBD";
    return 0;
  }
  else{
    if(S[5]=='0'){
      cout<<"Heisei";
      return 0;
    }
    else{
      cout<<"TBD";
      return 0;
    }
  }
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var scanner = bufio.NewScanner(os.Stdin)
var rdr = bufio.NewReaderSize(os.Stdin, 0x100000)

// SplitSpace 空白で分割設定
func SplitSpace() {
	scanner.Split(bufio.ScanWords)
}

// NextLine 標準入力から１行読み込む
func NextLine() string {
	scanner.Scan()
	return scanner.Text()
}

// NextInt 標準入力から数値を一つ読み込む
func NextInt() int {
	n, _ := strconv.Atoi(NextLine())
	return n
}

// ReadLine 標準入力から長めの1行を読み込む
func ReadLine() string {
	buf := make([]byte, 0, 0x100000)
	for {
		line, isPrefix, err := rdr.ReadLine()
		if err != nil {
			panic(err)
		}
		buf = append(buf, line...)
		if !isPrefix {
			break
		}
	}
	return string(buf)
}

func Abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}

//================

func main() {
	SplitSpace()
	h := NextInt()
	a := NextInt()
	fmt.Println(((h + a - 1) / a))
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using ll = long long;
using VI = vector<int>;
using VVI = vector<vector<int>>;

int main(){
  int n;
  cin >> n;
  VI v(n);
  rep(i,n) cin >> v[i];
  
  sort(v.begin(),v.end());
  
  double ans = v[0];
  rep(i,n-1){
  	ans = (ans + v[i+1]) / 2;
  }
  
  cout << setprecision(12) << ans << endl;
  
  return 0;
}

Measured memory_bytes: 256
n,k = map(int,input().split())
R,S,P = map(int,input().split())
po = {'r':P, 's':R, 'p':S}
t = list(input())
sub = [[] for _ in range(k)]

for i in range(n):
    sub[i%k].append(t[i])

point = 0
for j in range(k):
    m = len(sub[j])
    point += po[sub[j][0]]
    for l in range(1,m):
        if sub[j][l-1] != sub[j][l]:
            point += po[sub[j][l]]
        else:
            sub[j][l] = '#'

print(point)

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

int main()
{
  int n;
  string s;
  cin>>n>>s;
  for(int i=0;i<s.length();i++)
    s[i] = ((((s[i]-'A')+n)%26)+'A');
  cout<<s<<"\n";
  
  
  return 0;
}

Measured memory_bytes: 256
import java.util.*;
import java.io.*;

public class Main {

  public static void main(String ... args) throws Exception {
    int n = 0, k = 0;
    String s;
    try (BufferedReader isr = new BufferedReader(new InputStreamReader(System.in))) {
      String buf = isr.readLine();
      System.err.println(buf);
      String[] input = buf.split(" ");
      n = Integer.parseInt(input[0]);
      k = Integer.parseInt(input[1]);
      buf = isr.readLine();
      System.err.println(buf);
      s = buf;
    }

    k--;
    StringBuilder sb = new StringBuilder(s);
    sb.setCharAt(k, Character.toLowerCase(sb.charAt(k)));

    System.out.println(sb);
  }

}


Measured memory_bytes: 22996
#include<iostream>
#include<cstring>
#include<map>
using namespace std;
typedef long long LL;
const int N = 1e5;
LL ans[N+1];
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	map<LL,LL> freq;
	map<LL,int> smallest;
	LL total_on_board = 0;
	int n; cin >> n;
	for(int i = 0; i < n; i++)
	{
		LL x; cin >> x;
		total_on_board += x;
		freq[x]++;
		if(smallest.find(x)==smallest.end())
			smallest[x] = i;
	}

	LL moves = 0;
	memset(ans,0,sizeof ans);
	while(smallest[(*(--freq.end())).first] != 0) //while the largest pile is not at 1
	{
		LL largest = (*(--freq.end())).first;
		LL second_largest = (*(--(--freq.end()))).first;

		total_on_board -= (largest-second_largest)*freq[largest];
		ans[smallest[(*(--freq.end())).first]] += (largest-second_largest)*freq[largest];

		freq[second_largest] += freq[largest];
		freq.erase(largest);
		smallest[second_largest] = min(smallest[second_largest],smallest[largest]);
	}
	ans[0] = total_on_board;

	for(int i = 0; i < n; i++)
		cout<<ans[i]<<'\n';

	cout<<flush;
	return 0;
}

Measured memory_bytes: 14336
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;
using namespace std;
 
#define ff                  first
#define ss                  second
#define endl                "\n"
#define loop(i,s,e)         for(int i=s;i<e;i++)
#define int                 long long
#define vi                  vector<int> 
#define S(v)                sort(v.begin(),v.end())
#define RS(v)               sort(v.rbegin(),v.rend())
#define R(v)                reverse(v.begin(),v.end())
#define mxpq(T)             priority_queue <T>
#define mnpq(T)             priority_queue<T,vector<T>,greater<T>>
#define prv(v)              for(auto &x : v)cout << x << " ";
#define piirv(v)            for(auto &x : v)cout << x.ff << " " << x.ss << endl;
#define prvv(v)             for(auto &x : v)for(auto &y : x.ss)cout << y << " ";
#define mp                  make_pair
#define pii                 pair<int,int>
#define mset(a,f)           memset(a , f , sizeof(a))
#define pb                  push_back
#define inf                 INT_MAX
#define INF                 LLONG_MAX
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> oset;
 
const int N = 2e6 + 6;
const int M = 1e9+7;
int A[N];
int n , m;

void solve()
{
	string s ,t;
	cin >> s >> t;

	int n1 = s.length();
	int n2 = t.length();

	int ans = INT_MAX;

	loop(i,0,n1-n2+1)
	{
		int cnt = 0;
		loop(j,0,n2)
		{
			if(s[i+j] != t[j])cnt++;
		}
		ans = min(ans , cnt);
	}

	cout << ans;
}			
 
int32_t main()
{
 
cout<<fixed<<setprecision(16);
 
ios_base:: sync_with_stdio(false);
cin.tie(NULL); cout.tie(NULL);
 	
 
 	int t = 1;
 	// cin >> t;
 	while(t--)solve();
  
}

Measured memory_bytes: 3600
#include<iostream>
#include<algorithm>
 
using namespace std;
 
int main()
{
  int A, B , C, maxi, s;
  cin >> A >> B >> C;
  if (A >= B && A >= C)
    maxi = A;
  else if (B >= A && B >= C)
    maxi = B;
  else
    maxi = C;
  
  s = A + B +C - (maxi);
  cout << maxi*10 + s << "\n";
  
  return 0;
}

Measured memory_bytes: 256
/*
* @Author: 王文宇
* @Date:   2017-11-18 16:16:33
* @Last Modified by:   王文宇
* @Last Modified time: 2017-11-18 16:17:47
*/
#include <iostream>
using namespace std;
int main()
{
	ios::sync_with_stdio(false);
	int x,y,z;
	cin>>x>>y>>z;
	x-=z;
	cout<<x/(y+z)<<endl;
	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <tuple>
#include <cctype>
#include <cstdio>
#include <vector>
#include <string>
#include <stdexcept>
using namespace std;

#define nameof(x) #x

void read_un() {};
template<typename T, typename... Args> void read_un(T& x, Args&&... args) {
  x = 0; int ch = 0;
  while (!isdigit(ch = getchar())); x = ch ^ '0';
  while (isdigit(ch = getchar())) x = (x << 3) + (x << 1) + (ch ^ '0');
  read_un(args...);
};

const unsigned& maxx(const unsigned& a, const unsigned& b) {
  return a > b ? a : b;
}

template <class T> struct triplet : std::tuple<T, T, T> {
  using super = std::tuple<T, T, T>;
  using size_type = unsigned long;
  constexpr const T& first() const {
    return std::get<0>(*this);
  };
  T& first() {
    return std::get<0>(*this);
  };
  constexpr const T& second() const {
    return std::get<1>(*this);
  };
  T& second() {
    return std::get<1>(*this);
  };
  constexpr const T& third() const {
    return std::get<2>(*this);
  };
  T& third() {
    return std::get<2>(*this);
  };
  constexpr const T& at(size_type pos) const {
    if (pos < 3) return pos ? pos == 1 ? second() : third() : first();
    throw std::out_of_range((string() + "triplet::at:" + " " + nameof(pos) + " which is " + "(" + to_string(pos) + ")" + " > 2" ).c_str());
  };
  T& at(size_type pos) {
    if (pos < 3) return pos ? pos == 1 ? second() : third() : first();
    throw std::out_of_range((string() + "triplet::at:" + " " + nameof(pos) + " which is " + "(" + to_string(pos) + ")" + " > 2" ).c_str());
  }
};

int main() {
  unsigned n; read_un(n);
  vector<triplet<unsigned>> vec(n);
  for (auto &t : vec) read_un(t.first(), t.second(), t.third());
  vector<triplet<unsigned>> f(n);
  f.at(0) = vec.at(0);
  for (unsigned i = 1; i < n; ++i)
    for (unsigned j = 0; j < 3; ++j)
       for (unsigned k = 0; k < 3; ++k)
          if (j != k)
            f.at(i).at(j) = maxx(f.at(i).at(j), vec.at(i).at(j) + f.at(i -1).at(k));
  printf("%u", maxx(f.back().first(), maxx(f.back().second(), f.back().third())));
  return 0;
}


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

int n, m, q;
vector<int> a, b, c, d;
int ans;

void dfs(vector<int> A)
{
#if 0
        for (int i = 0; i < A.size(); ++i) {
                cout << A[i] << " ";
        }
        cout << endl;
#endif
        if (A.size() == n+1) {
                int now = 0;
                for (int i = 0; i < q; ++i) {
                        if (A.at(b.at(i)) - A.at(a.at(i)) == c.at(i)) {
                                now += d.at(i);
                        }
                }
                ans = max(now, ans);
                return;
        }

        A.push_back(A.back());
        while (A.back() <= m) {
                dfs(A);
                A.back()++;
        }

}

int main()
{
        cin >> n >> m >> q;
        for (int i = 0; i < q; ++i) {
                int t1, t2, t3, t4;
                cin >> t1 >> t2 >> t3 >> t4;
                a.push_back(t1);
                b.push_back(t2);
                c.push_back(t3);
                d.push_back(t4);
        }
        ans = 0;
        dfs(vector<int>(1, 1));
        cout << ans << endl;

}


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

#define REP(i,num) for(int i=0;i<(num);++i)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto& x:c){cout<<x<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	auto N=in();
	REP(i,N){
		auto v=vecin(3);
		sort(ALL(v));
		if(v[0]*v[0]+v[1]*v[1]==v[2]*v[2]) out("YES");
		else out("NO");
	}
	return 0;
}


Measured memory_bytes: 3040
#include <bits/stdc++.h>
using namespace std;
typedef __int128 ll;
#define x first
#define y second
#define pii pair<int , int>
#define mp make_pair
#define pb push_back
#define sz(a) (int)(a.size())
const int INF = 1000 * 1000 * 1000 + 7;
const ll LINF = INF * (ll)INF;
const int mod = 998244353;
const int MAX = 2000005;
bool eq(char c1 , char c2)
{
	return c1 == '?' || c2 == '?' || c1 == c2;
}
vector<int> f(string &a, string &b)
{
	vector<int> ans(sz(a) + 1);
	for(int i = 0; i < sz(a); i++)
	{
		bool ok = true;
		for(int j = 0; j < sz(b) && i + j < sz(a); j++)
			ok &= eq(b[j] , a[i + j]);
		ans[i] = ok;
	}
	ans[sz(a)] = 1;
	return ans;
}

int solve(string &a, string &b, string &c)
{
	vector<int> ok1 = f(a , b) , ok2 = f(a, c) , ok3 = f(b, c);

	int ans = INF;
	for(int p1 = 0; p1 <= sz(a); p1++)
		for(int p2 = p1; p2 <= max(sz(a) , p1 + sz(b)); p2++)
		{
			if(ok1[p1] && (p2 >= sz(ok2) || ok2[p2]) && (p2 - p1 >= sz(ok3) || ok3[p2 - p1]))
			{
				
				ans = min(ans , max(sz(a) , max(p1 + sz(b) , p2 + sz(c))));
			}
		}
		
	return ans;
}
	
int main()
{
	ios_base::sync_with_stdio(0);

	vector<string> v(3);
	for(auto &x : v)
		cin >> x;

	sort(v.begin() , v.end());
	int ans = INF;
	do {
		ans = min(ans , solve(v[0] , v[1], v[2]));
	}while(next_permutation(v.begin(), v.end()));
	cout << ans;
}


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

/*int n;
  cin >> n;
  vector<int> h(n);*/

int main() {

  int n,x;
  cin >> n >> x;
  vector<int> l(n);
  int ans=0, count=0;
  
  for(int i=0;i<n;i++){
    cin >> l[i];
  }

  for(int i=0;i<n;i++){
    if(i > 0){
      ans = ans + l[i-1];
    }
    if(ans > x){
      break;
    }
    count++;
    if((i+1)==n && ans < x){
      count++;
    }
  }

  cout << count << endl;


  return 0;
}

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

int main(){
	long long K;
	cin >> K;
	long long ans = -1;
	if(K % 2 != 0 && K % 5 != 0){
		long long one = K % 10;
		long long keta = 0;
		long long car = 0;
		ans = 0;
		for(int i=0;i<10;i++){
			if((i * one + car) % 10 == 7){
				keta = i;
				break;
			}
		}
		car = (car + keta * K) / 10;
		ans++;
		while(car != 0){
			for(int i=0;i<10;i++){
				if((i * one + car) % 10 == 7){
					keta = i;
					break;
				}
			}
			car = (car + keta * K) / 10;
			ans++;
			//cout << car << endl;
		}
	}
	cout << ans << endl;

}


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

using namespace std;

#define NMAX 100

int main(){

	int n;
	int k[NMAX];
	string s;
	string sta("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ");
	int ans;

	while(1){
		cin>>n;
		if(n==0) break;
		for(int i=0;i<n;i++) cin>>k[i];
		cin>>s;
		for(int i=0;i<s.size();i++){
			ans=sta.find(s[i]);
			ans-=k[i%n];
			if(ans<0) ans+=sta.size();
			s[i]=sta[ans];
		}
		cout<<s<<endl;
	}

}

Measured memory_bytes: 1208
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int SZ = 100005;
const int INF = 1000000005;
int a[SZ];
int b[SZ];
int dif[SZ];
int main(void){
	int n; scanf("%d",&n);
	for(int i=0;i<n;i++) scanf("%d",&a[i]);
	for(int i=0;i<n;i++) scanf("%d",&b[i]);
	ll minu = 0;
	for(int i=0;i<n;i++){
		if(a[i]>=b[i]) dif[i]=a[i]-b[i];
		else dif[i]=INF;
		minu += (ll)(a[i]-b[i]);
	}
	if(minu<0){
		printf("-1");
		return 0;
	}
	sort(dif,dif+n);
	int ans = n;
	for(int i=0;i<n;i++){
		if(minu < 0LL || dif[i]==INF) break;
		minu -= (ll)dif[i];
		if(minu>=0) ans--;
	}
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 1408
#include<stdio.h>
#include<string.h>

int main(){
    int b;
    char a[4];
    char c[4];
    scanf("%s",a);
    strcpy(c,a);
    for (int i = 0; i < 3; i++)
    {
        if(c[i] == '1'){
            b++;
        }
    }
    printf("%d",b);
    
}

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

void solve()
{
    int n;
    cin >> n;
    string s;
    cin >> s;
    string t = s;
    sort(t.begin(), t.end());
    int cnt = 0;
    rep(i, n)
    {
        if (s[i] != t[i])
            cnt++;
    }
    int ans = cnt / 2;
    cout << ans << endl;
}

int main()
{
    solve();
    return 0;
}

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

using namespace std;
typedef long long ll;
#define sz size()
#define pb push_back 
#define bg begin()
#define ed end()
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(ll i=1;i<=n;i++)

int main(){
	ll N,T; cin>>N>>T;
	vector<ll>A(N);
	rep(i,N) cin>>A[i];
	ll minmem=A[0];
	vector<ll>V(N,0);
	rep1(i,N-1){
		V[i]=A[i]-minmem;
		if(A[i]<minmem) minmem=A[i];
	}
	sort(V.bg,V.ed,greater<ll>());
	ll mem=V[0],ans=0;
	rep(i,N){
		if(V[i]==mem) ans++;
	}
	cout<<ans;
}

Measured memory_bytes: 1920
#include "bits/stdc++.h"
using namespace std;
const int MAX = 700000;
const int MOD = 1000000007;

long long  fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
/*第二引数で第一引数を割ったときの切り上げの計算*/
long long int maxtime(long long int x, long long int y){
	return(x + y - 1) / y;

}
/*最大公約数*/
long long int lcm(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;

	if (number2 > number1) {
		m = number2;
		n = number1;
	}
	long long int s = -1;
	while (s != 0) {
		s = m % n;
		m = n;
		n = s;
	}
	return m;
}
/*最大公倍数*/
long long int gcd(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;
	return m / lcm(m, n) * n;
}
/*逆元計算*/
long long int  modinv(long long a, long long m) {
	long long int b = m, u = 1, v = 0;
	while (b) {
		long long int t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
// index が条件を満たすかどうか
vector<long long int >meguru;
bool isOK(int index, int key) {
	if (meguru[index] >= key) return true;
	else return false;
}
// 汎用的な二分探索のテンプレ
int binary_search(int key) {
	int left = -1; //「index = 0」が条件を満たすこともあるので、初期値は -1
	int right = (int)meguru.size(); // 「index = a.size()-1」が条件を満たさないこともあるので、初期値は a.size()
	/* どんな二分探索でもここの書き方を変えずにできる！ */
	while (right - left > 1) {
		int mid = left + (right - left) / 2;

		if (isOK(mid, key)) right = mid;
		else left = mid;
	}
	/* left は条件を満たさない最大の値、right は条件を満たす最小の値になっている */
	return right;
}
long long modpow(long long a, long long n, long long mod) {
	long long res = 1;
	while (n > 0) {
		if (n & 1) res = res * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}
int main() {
	long double x;
	cin >> x;
	long double ans = x / 3;
	ans = ans * x / 3;
	ans = ans * x / 3;
	cout << fixed << setprecision(10) << ans << endl;
}


Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; ++i)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = int64_t;
using ld = long double;
using P = pair<int, int>;
using vs = vector<string>;
using vi = vector<int>;
using vvi = vector<vi>;
template<class T> using PQ = priority_queue<T>;
template<class T> using PQG = priority_queue<T, vector<T>, greater<T> >;
const int INF = 100010001;
const ll LINF = (ll)INF*INF*10;
template<typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) {return a < b && (a = b, true);}
template<typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) {return a > b && (a = b, true);}
template<typename T1, typename T2>
istream &operator>>(istream &is, pair<T1, T2> &p) { return is >> p.first >> p.second;}
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) { return os << p.first << ' ' << p.second;}

struct BM {
  int V;
  vector<vector<int > > G;
  vector<int> match;
  vector<bool> used;
  BM(int n=0) : V(n), G(n), match(n, -1), used(n) {}
  inline void add(int u, int v) {
    G[u].emplace_back(v);
    G[v].emplace_back(u);
  }
  bool dfs(int v) {
    used[v] = true;
    for(int u:G[v]) {
      int w = match[u];
      if(w < 0 or (!used[w] and dfs(w))) {
        match[v] = u;
        match[u] = v;
        return true;
      }
    }
    return false;
  }
  int bipartite_matching() {
    int res = 0;
    rep(v, V) {
      if(match[v] < 0) {
        rep(i, v) used[i] = 0;
        if(dfs(v)) res++;
      }
    }
    return res;
  }
};

int64_t gcd(int64_t a, int64_t b) {return b?gcd(b, a%b):a;}
int64_t lcm(int64_t a, int64_t b) {return a/gcd(a,b)*b;}
int64_t extgcd(int64_t a, int64_t b, int64_t &x, int64_t &y) { // ax+by=gcd(a, b)の解を与える
  int64_t d = a;
  if(b) {
    d = extgcd(b, a%b, y, x);
    y -= (a/b)*x;
  } else {
    x = 1; y = 0;
  }
  return d;
}

const int N = 500;

//head

int m, n;
int b[N], r[N];

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> m >> n;
  while(m) {
    BM bpm(n+m);
    rep(i, m) cin >> b[i];
    rep(i, n) cin >> r[i];
    rep(i, m) rep(j, n) {
      if(gcd(b[i], r[j]) != 1) {
        bpm.add(i, j+m);
      }
    }
    cout << bpm.bipartite_matching() << '\n';
    cin >> m >> n;
  }
}


Measured memory_bytes: 4452
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
bool In(){
	char z;
	cin>>z;
	if(z=='N')return false;
	return true;
}
int main(){
	long long t=1000000000;
	while(true){
		//rrrrr
		cout<<"? "<<t<<"\n"<<flush;
		if(In()){
			if(t==1000000000){
				long long x=500000000;
				while(true){
					cout<<"? "<<x<<"\n"<<flush;
					if(!In()){
						break;
					}
					x/=10;
					if(x==0){
						cout<<"! "<<1<<"\n"<<flush;
						return 0;
					}
				}
				cout<<"! "<<x*2<<"\n"<<flush;
				return 0;
			}
			break;
		}
		t/=10;
	}
	long long left=t,right=t*10;
	long long mid,ans=114514114514114514;
	while(left<right){
		mid=(left+right)/2;
		//rrrrr
		cout<<"? "<<mid*10<<"\n"<<flush;
		if(!In()){
			left=mid+1;
		}
		else{
			right=mid;
			ans=min(ans,mid);
		}
	}
	//rrrrr
	cout<<"! "<<ans<<"\n"<<flush;
	return 0;
}


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

#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 INF 2e9
#define ALL(v) v.begin(), v.end()


using namespace std;

int main()
{
	int N;
	double ans = 0.0;
	vector<double> x(20);
	string u[20];

	cin >> N;
	REP(i, N) { cin >> x[i] >> u[i]; }

	REP(i, N)
	{
		if (u[i] == "JPY")
		{
			ans += x[i];
		}
		else
		{
			ans += x[i] * 380000.0;
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

A, B = MAP()
print(max(2*A-1, 2*B-1, A+B))

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

using namespace std;

int N;
int Data[1000];
multiset<int> Numbers;

int main() {
	double maxSum, minSub, ans;

	Numbers.clear();
	cin >> N;
	for (int i = 0; i < N; ++i) {
		cin >> Data[i];
		Numbers.insert(Data[i]);
	}

	ans = 0.0;
	for (int i = 0; i < N; ++i) {
		Numbers.erase(Numbers.find(Data[i]));
		for (int j = 0; j < N; ++j) {
			if (i == j) {
				continue;
			}
			Numbers.erase(Numbers.find(Data[j]));
			maxSum = *(Numbers.rbegin()) + *(++Numbers.rbegin());
			minSub = abs(Data[i] - Data[j]);
			ans = max(ans, maxSum / minSub);
			Numbers.insert(Data[j]);
		}
		Numbers.insert(Data[i]);
	}
	cout << fixed << setprecision(6) << ans << endl;

	return 0;
}



Measured memory_bytes: 3280
#include <stdio.h>
#include <cstdlib>
#include <cassert>
#include <iostream>
#include <set>
#include <vector>
#include <cstring>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <complex>
#include <map>
#include <unordered_map>
#include <queue>
#include <array>
#include <bitset>
#include <chrono>
#include <random>
using namespace std;
typedef long double ld;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef long double ld;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef vector<pii> vii;
typedef vector<string> vs;
//const int mod = ;

int main() {
  //mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
  //std::ios::sync_with_stdio(false); std::cin.tie(0);
  ll n, a, b;
  cin >> n >> a >> b;
  if (b - a <= 2 || n < a + 1) {
    cout << n + 1 << endl;
  } else {
    ll res = a;
    n -= a - 1;
    res += n / 2 * (b - a) + n % 2;
    cout << max(n + 1, res) << endl;    
  }
  return 0;
}


Measured memory_bytes: 256
#include <numeric>
#include<iostream>
#include<set>
#include <bitset>
#include<queue>
#include<vector>
#include<map>
#include<stack>
#include <cstdio>
#include<algorithm>
#include <sstream>
#include<string>
#include<string.h>
#include <cmath>
#include <iomanip>
#include <string>
#include<list>
using namespace std;
#define int long long
#define inf 1000000007
#define rep(i,j,n) for(int i=j;i<n;i++)
typedef pair<int,int>  P;
double pi = 3.141592653589793;
//使うやつはここから下に置こうな
signed main(){
    int n,x;cin>>n>>x;
    int  cost[2005];
    int a[4500];
    rep(i,0,n){
        cin>>a[i];
        a[i+n]=a[i];
        cost[i]=inf;
    }
    int ans;
    rep(i,0,n){int h=0;
        rep(j,0,n){
            cost[j]=min(cost[j],a[(j-i+n)%n]);
            h+=cost[j];
        }
        if(i==0)ans=h+i*x;
        else ans=min(ans,h+i*x);
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
  
using namespace std;
  
template<class T> void ckmin(T &a, T b) { a = min(a, b); }
template<class T> void ckmax(T &a, T b) { a = max(a, b); }
  
#define pb push_back
#define mp make_pair
#define cotu cout
#define itn int
#define Red ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define F first
#define S second
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int i = 0; i < n; ++i)
#define repr(i,n) for(int i = n - 1; i >= 0; --i)
#define Rep(i, a, n) for(int i = (a); i <=(n); ++i)
#define repst(i, n) for(auto it = n.begin(); it != n.end(); ++it)
#define Repr(i, a, n) for(int i = (n); i >= (a); --i)
#define sp(x) fixed << setprecision(x)
#define ordered_set tree<int , null_type,less<int >, rb_tree_tag,tree_order_statistics_node_update> 
  
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
  
typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
  
const int inf = int(1e9);
const int mod = inf + 7;
const int N = 1e6 + 555; // TL MB
const double PI = acos(-1.0);
void mul(ll &x, ll y){
	x *= y;
	if(x >= mod) x %= mod;
}
 
void add(ll &x, ll y){
	x += y;
	if(x >= mod) x -= mod;
	if(x < 0) x += mod;
}
ll bp(ll a, ll n){
	ll r = 1;
	while(n){
		if(n & 1) mul(r, a);
		mul(a, a);
		n >>= 1;
	}
 
}

void out(vector<int> &v){
	for(int x : v) cout << x << " ";
}

void solve()
{
	int n;
	cin >> n;
	ll a[n];
	vector<int> x, y;
	rep(i, n) {
		cin >> a[i];
		if(i % 2) x.pb(a[i]);
		else y.pb(a[i]);
	}
	if(n % 2 == 0) {
		reverse(all(x));
		out(x);
		out(y);
	}
	else{
		reverse(all(y));
		out(y);
		out(x);
	}

}

 
int main()
{
	// freopen("crosses.in", "r", stdin);
	// freopen("crosses.out", "w", stdout);
    Red;
  	int T = 1;
  	// cin >> T;
  	for(int i = 1; i <= T; ++i){
  		solve();
  	}
  	return 0;

}

Measured memory_bytes: 5932
#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>

using namespace std;


int main(){
	int N;
	cin >> N;
	vector<int> A(N);
	for(int i=0;i<N;i++){
		cin >> A[i];
	}
	int loop = 1;
	while(loop){
		sort(A.begin(),A.end());
		vector<int>::iterator itr = lower_bound(A.begin(), A.end(), 1);
		if(itr == A.end() - 1){
			loop = 0;
		}
		else{
			for(int i = 0;i<N;i++){
				if(itr != A.begin()+i){
					A[i] = A[i] % *itr;
				}
			}
		}
	}
	cout << A[N-1] << endl;
}

Measured memory_bytes: 640
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<string>
#include<math.h>
#include<vector>
#include<iomanip>
using namespace std;

long long int gcd(long long int x, long long int y)
{
	if (y == 0) { return x; }
	return gcd(y, x % y);
}

int main(void)
{
	int a[3][3],bingo[3][3], n, b[100];
	for (int i = 0; i < 3; i++)
	{
		for (int j = 0; j < 3; j++)
		{
			cin >> a[i][j];
			bingo[i][j] = 0;
		}
	}
	cin >> n;
	for (int i = 0; i < n; i++) { cin >> b[i]; }
	for (int i = 0; i < n; i++)
	{
		for (int j = 0 ; j < 3; j++)
		{
			for (int k = 0; k < 3; k++)
			{
				if (a[j][k] == b[i]) { bingo[j][k] = 1; }
			}
		}
	}
	if (bingo[0][0] == 1 && bingo[0][1] == 1 && bingo[0][2] == 1) { cout << "Yes" << endl; }
	else if (bingo[0][0] == 1 && bingo[1][0] == 1 && bingo[2][0] == 1) { cout << "Yes" << endl; }
	else if (bingo[0][0] == 1 && bingo[1][1] == 1 && bingo[2][2] == 1) { cout << "Yes" << endl; }
	else if (bingo[1][0] == 1 && bingo[1][1] == 1 && bingo[1][2] == 1) { cout << "Yes" << endl; }
	else if (bingo[2][0] == 1 && bingo[2][1] == 1 && bingo[2][2] == 1) { cout << "Yes" << endl; }
	else if (bingo[0][1] == 1 && bingo[1][1] == 1 && bingo[2][1] == 1) { cout << "Yes" << endl; }
	else if (bingo[0][2] == 1 && bingo[1][2] == 1 && bingo[2][2] == 1) { cout << "Yes" << endl; }
	else if (bingo[2][0] == 1 && bingo[1][1] == 1 && bingo[0][2] == 1) { cout << "Yes" << endl; }
	else { cout << "No" << endl; }
	return 0;
}


Measured memory_bytes: 256