akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <climits>
#include <string>
#include <bitset>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define fin(ans) cout<<(ans)<<endl
#define STI(s) atoi(s.c_str())
#define mp(p,q) make_pair(p,q)
#define pb(n) push_back(n)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define Sort(a) sort(a.begin(),a.end())
#define Rort(a) sort(a.rbegin(),a.rend())
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;}
const int P = 1000000007;
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;




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

int sx,sy,tx,ty;
cin >> sx >> sy >> tx >> ty;
int dis_x,dis_y;
dis_x = tx-sx;
dis_y = ty-sy;
rep(i,dis_x) cout << "R";
rep(i,dis_y) cout << "U";
rep(i,dis_x) cout << "L";
rep(i,dis_y) cout << "D";
cout << "D";
rep(i,dis_x+1) cout << "R";
rep(i,dis_y+1) cout << "U";
cout << "LU";
rep(i,dis_x+1) cout << "L";
rep(i,dis_y+1) cout << "D";
cout << "R";

//////////////////////////////////////////////////////
return 0;}

Measured memory_bytes: 256
(let ((A (read))
      (B (read))
      (C (read))
      (X (read)))
  (format t "~A~%"
          (loop for k upto A
             sum (loop for m upto B
                    sum (loop for n upto C
                           count (= (+ (* 500 k)
                                       (* 100 m)
                                       (* 50 n))
                                    X))))))


Measured memory_bytes: 13284
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp79
{
    class Program
    {
        static void Main(string[] args)
        {
            string ws = Console.ReadLine();
            bool Judge = true;
            int count=0;
            for (int i = 0; i < ws.Length; i++)
            {
                for(int j = 0; j < ws.Length; j++)
                {
                    if (ws[i] ==ws[j])
                    {
                        count++;
                    }

                }
                if (count % 2 != 0)
                {
                    Console.WriteLine("No");
                    Judge = false;
                    return;
                }
                count = 0;
            }
            if (Judge !=false)
            {
                Console.WriteLine("Yes");
            }
        }
    }
}



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


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

    ll N;
    ll K;
    cin >> N >> K;
    ll A[N];
    rep(i, N) cin >> A[i];

    //rep(k, K){
    //    ll ans = 0;
    //    rep(i, N){
    //        ans += (k+1) xor A[i];
    //    }
    //    cout << k+1 << " " << ans << endl;
    //}
    //cout << "---------------------" << endl;
    //return 0;

    //if(K == 0){
    //    ll ans = 0;
    //    rep(i, N){
    //        ans += A[i];
    //    }
    //    cout << ans << endl;
    //    return 0;
    //}
    int keta[64][2] = {};
    for(int i=0; i<60; i++){
        rep(j, N){
            keta[i][A[j]>>i&1]++;
        }
    }

    ll now = 0;
    //ll ok = 0;
    for(int i=59; i>=0; i--){
        if((now|(1ll<<i)) <= K){
            if(keta[i][0] > keta[i][1]){
                now |= (1ll<<i);
            }
            //ok += (1<<i)*max(keta[i][0], keta[i][1]);
        }
        //cout << now << " " << (1<<i) << " " << keta[i][0] << " " << keta[i][1] << " " << ok << endl;
    }
    ll ans = 0;
    rep(i, N){
        ans += A[i] ^ now;
    }
    cout << ans << endl;
}


Measured memory_bytes: 1276
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
using VI = vector<int>;
using VVI = vector<VI>;

int main() {
  cin.tie(0); ios::sync_with_stdio(false);
  int a, b; cin >> a >> b;
  cout << (a <= 8 and b <= 8 ? "Yay!" : ":(") << '\n';
  return 0;
}

Measured memory_bytes: 256
a,b,c,x = 4.times.map { gets.to_i }

cnt = 0

(0..a).each do |i|
  (0..b).each do |j|
    (0..c).each do |k|
      cnt += 1 if i*500 + j*100 + k*50 == x
    end
  end
end

puts cnt

Measured memory_bytes: 1788
a,b,k = map(int,raw_input().split())

z = []

for x in range(a,a+k):
  if x == (b+1):
    break
  z.append(x)

for x in range(b,b-k,-1):
  if x == (a-1):
    break
  z.append(x)

z = list(set(z))
z.sort()

for x in z:
  print x


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

using namespace std;

int main()
{
    int n;
    string s;
    map <string,int> lego;
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>s;
        lego[s]++;
    }
    cout<<"AC x "<<lego["AC"]<<endl;
    cout<<"WA x "<<lego["WA"]<<endl;
    cout<<"TLE x "<<lego["TLE"]<<endl;
    cout<<"RE x "<<lego["RE"]<<endl;
    return 0;
}


Measured memory_bytes: 3600
#include <iostream>

int main(){
    double n;
    std::cin >> n;
    
    double sum=0;
    
    for(int i=1;i<=n;++i){
        if(i%2==1){
            sum++;
        }
    }
    
    double ans=sum/n;
    
    std::cout << ans << std::endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,(n)-1,0)
#define all(v) v.begin(), v.end()
#define endk '\n'
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;
const ld eps = 1e-10;
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b){if(a>b) a=b;}
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b){if(a<b) a=b;}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n; cin >> n;
  vector<int> A(n);
  rep(i, n) cin >> A[i];
  int allGcd = A[0];
  rep(i, n) allGcd = __gcd(allGcd, A[i]);
  if(allGcd != 1) {
    cout << "not coprime" << endk;
    return 0;
  }
  int M = 1000005;
  vector<int> cnt(M);
  rep(i, n) cnt[A[i]]++;
  vector<bool> done(M);
  for(int i=2; i<M; i++) {
    if(!done[i]) {
      int tmp = 0;
      for(int j=0; i*(j+1)<M; j++) {
        tmp += cnt[i*(j+1)];
        done[i*(j+1)] = true;
      }
      if(tmp > 1) {
        cout << "setwise coprime" << endk;
        return 0;
      }
    }
  }
  cout << "pairwise coprime" << endk;
  return 0;
}


Measured memory_bytes: 11336
#include <iostream>
using namespace std;
int main(){

int x1,x2;

 cin>>x1>>x2;

  if(x1 > x2)cout<<x1 - x2<<endl;
     else
   if(x1 < x2)cout<<x2 - x1<<endl;
       else
      cout<<0<<endl;

    




return 0;
}


Measured memory_bytes: 3084
#include <stdio.h>
#include <iostream>
#include <string.h>
#include <vector>
using namespace std;

int main()
{
    int N, M, a, b;
    vector<int> ma(1000000, 0), h(1000000, 0);
    cin >> N >> M;
    for (int i = 1; i <= N; i++)
    {
        cin >> h[i];
    }
    for (int i = 0; i < M; i++)
    {
        cin >> a >> b;
        ma[a] = max(ma[a], h[b]);
        ma[b] = max(ma[b], h[a]);
    }
    int c = 0;
    for (int i = 1; i <= N; i++)
    {
        if (ma[i] < h[i])
            c += 1;
    }
    cout << c << endl;
    return 0;
}

Measured memory_bytes: 11000
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<cstring>
#include<vector>
#include<queue>
using namespace std;
#define INT(x) int x; scanf("%d",&x)
#define INPUT(x) scanf("%d",&x)
#define REP1(x,n) for(int x = 0; x < n; x++)
#define REP2(x,s,e) for(int x = s; x <= e; x++)
#define BR printf("\n")
#define INF 2000000000
#define NIL -1

struct Point{
    int x,y,id;
};

bool lessX(const Point &p1, const Point &p2) { return p1.x < p2.x;}
bool lessY(const Point &p1, const Point &p2) { return p1.y < p2.y;}

Point A[500000];

struct Node{
    int id,l,r,x,y;
};

Node T[500000];
int np = 0;

int make2Dtree(int l,int r,int d){
    if (r-l <= 0) return NIL;
    int mid = (l+r)/2;
    int t = np++;
    
    if (d == 0) sort(A+l,A+r,lessX);
    else sort(A+l,A+r,lessY);
    
    T[t].id = A[mid].id;
    T[t].x = A[mid].x;
    T[t].y = A[mid].y;
    T[t].l = make2Dtree(l,mid,(d+1)%2);
    T[t].r = make2Dtree(mid+1,r,(d+1)%2);
    
    return t;
}

vector<int> ans;

void findTree(int i,int xs,int xt,int ys,int yt,int d){
    if (d == 0) {
        if(xs <= T[i].x && T[i].l != NIL) findTree(T[i].l,xs,xt,ys,yt,1);
        if (xs <= T[i].x && T[i].x <= xt && ys <= T[i].y && T[i].y <= yt) ans.push_back(T[i].id);
        if(T[i].x <= xt && T[i].r != NIL) findTree(T[i].r,xs,xt,ys,yt,1);
    }else{
        if(ys <= T[i].y && T[i].l != NIL) findTree(T[i].l,xs,xt,ys,yt,0);
        if (xs <= T[i].x && T[i].x <= xt && ys <= T[i].y && T[i].y <= yt) ans.push_back(T[i].id);
        if(T[i].y <= yt && T[i].r != NIL) findTree(T[i].r,xs,xt,ys,yt,0);
    }
}

void in_order(Node T[],int i){
    if (T[i].l != NIL) in_order(T,T[i].l);
    printf("%d\n",T[i].id);
    if (T[i].r != NIL) in_order(T,T[i].r);
}

int main(){
    INT(n);
    REP1(i,n){
        INT(x);INT(y);
        A[i].x = x;
        A[i].y = y;
        A[i].id = i;
    }
    make2Dtree(0,n,0);
    INT(q);
    REP1(i,q){
        INT(xs);INT(xt);INT(ys);INT(yt);
        findTree(0,xs,xt,ys,yt,0);
        sort(ans.begin(),ans.end());
        REP1(j,ans.size()) printf("%d\n",ans[j]);
        BR;
        ans.clear();
    }
    return 0;
}

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

int main()
{
    int k,x;
    cin >> k >> x;
    int sougaku = 500 * k;
    if(sougaku>=x) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
use std::io::{self, BufRead, Write};

fn solve<R, W>(reader: R, mut writer: W)
where
    R: BufRead,
    W: Write,
{
    let mut lines = reader.lines();
    let _ = lines.next().unwrap().unwrap();
    let a_line = lines.next().unwrap().unwrap();
    let s: Vec<char> = a_line.trim().chars().collect();
    let n = s.len();

    let mut m = vec![vec![0; n]; n];

    let mut ans = 0;
    for i in 0..n {
        for j in i + 1..n {
            if s[i] == s[j] {
                let m_i_j_prev = if i >= 1 && j >= 1 {
                    m[i - 1][j - 1]
                } else {
                    0
                };
                m[i][j] = m_i_j_prev + 1;
                if ans < m[i][j] && m[i][j] <= j - i {
                    ans = m[i][j];
                }
            }
        }
    }

    writeln!(&mut writer, "{}", ans).unwrap();
}

fn main() {
    let stdio = io::stdin();
    let input = stdio.lock();

    let output = io::stdout();

    solve(input, output);
}

#[cfg(test)]
mod tests {
    use super::*;

    const TESTS: &'static [(&'static [u8], &'static [u8])] = &[
        (
            br"5
ababa", br"2
",
        ),
        (
            br"2
xy", br"0
",
        ),
        (
            br"13
strangeorange", br"5
",
        ),
        (
            br"0
aaaaaaaa", br"4
",
        ),
    ];

    #[test]
    fn test_e() {
        for &(input, expected) in TESTS {
            let mut output = Vec::new();
            solve(input, &mut output);
            let expected_str = String::from_utf8(expected.to_vec()).unwrap();
            let output_str = String::from_utf8(output).unwrap();
            assert_eq!(expected_str, output_str);
        }
    }
}


Measured memory_bytes: 231676
#include <bits/stdc++.h>
using namespace std;
int main() {
int A,B,C,D;
cin >> A >> B >> C >> D;
if (A + B == C + D) cout << "Balanced" << endl;
else if (A+B > C+D) cout << "Left" << endl;
else cout << "Right" << endl;



return 0;
}

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

int a, b, c, d;

int solve(int h1, int h2) {
  return h1 * a + h2 * b + (h1 / 10) * c + (h2 / 20) * d;
}

int main() {
  int h[2][2];
  for (int i = 0; i < 2; ++i) {
    for (int j = 0; j < 2; ++j) {
      cin >> h[i][j];
    }
  }

  cin >> a >> b >> c >> d;

  int s = solve(h[0][0], h[0][1]);
  int t = solve(h[1][0], h[1][1]);
  if (s == t) {
    puts("even");
  }
  else {
    puts(s < t ? "kenjiro" : "hiroshi");
  }
}

Measured memory_bytes: 3080
A, B, M = [int(x) for x in input().split()]
list_a = [int(x) for x in input().split()]
list_b = [int(x) for x in input().split()]

list_x = [0] * M
list_y = [0] * M
list_c = [0] * M

for i in range(M):
    list_x[i], list_y[i], list_c[i] = \
        [int(x) for x in input().split()]




min_ab = min(list_a) + min(list_b)

for i in range(M):
    min_ab = min(min_ab, list_a[list_x[i]-1] + list_b[list_y[i]-1] - list_c[i])

print(min_ab)



Measured memory_bytes: 23284
import sys
import collections


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    h, w = list(map(int, readline().split()))
    a = [list(str(readline().rstrip().decode('utf-8'))) for _ in range(h)]
    fq = [[True] * w for _ in range(h)]
    ql = collections.deque()
    for i in range(h):
        for j in range(w):
            if a[i][j] == "#":
                fq[i][j] = False
                ql.append([0, i, j])
    mt = 0
    while True:
        if len(ql) != 0:
            cost, x, y = ql.popleft()
            mt = max(mt, cost)
            for xv, yv in [[x + 1, y], [x - 1, y], [x, y + 1], [x, y - 1]]:
                if 0 <= xv < h and 0 <= yv < w:
                    if fq[xv][yv]:
                        ql.append([cost + 1, xv, yv])
                        fq[xv][yv] = False
        else:
            break
    print(mt)


if __name__ == '__main__':
    solve()


Measured memory_bytes: 183004
/**
*	created: 15.08.2020 21:19:29
**/
#include <bits/stdc++.h>
// #include <boost/multiprecision/cpp_int.hpp>
// using bint = boost::multiprecision::cpp_int;
using namespace std;
using P = pair<int,int>;
#define endl '\n'
#define int long long
#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++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define pcnt(bit) __builtin_popcountll(bit)
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;}
const long double pi = acos(-1.0);
const int MAX = 1000010;
const int INF = LLONG_MAX;
const int MOD = 1000000007;
// const int MOD = 998244353;

signed main() {

    cin.tie(0);
    ios_base::sync_with_stdio(false);

    int n, k; cin >> n >> k;
    vector<int> p(n), c(n);
    rep(i,n) {cin >> p[i]; p[i]--;}
    rep(i,n) cin >> c[i];
    int ans = -INF;

    rep(i,n) {
        int now = i;
        vector<int> val;
        do {
            now = p[now];
            val.push_back(c[now]);
        } while (now != i);
        int csum = 0;
        rep(i,min(k,(long long)val.size())) {
            csum += val[i];
            chmax(ans,csum);
        }
        if (k > val.size()) {
            csum *= k/val.size() - 1;
            int r = k % val.size() + val.size();
            chmax(ans,csum);
            rep(j,r) {
                csum += val[j%val.size()];
                chmax(ans,csum);
            }
        }
    }
    cout << ans << endl;
    return 0;
}

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

int main() {
    int t;
    int n, k;
    int tmp;
    int ans;
    vector<int> x;
    vector<int> sukima;
    cin >> t;
    for (int i=0; i<t; i++) {
        x.clear();
        sukima.clear();
        cin >> n >> k;
        for (int j=0; j<n; j++) {
            cin >> tmp;
            if (j>0) {
                sukima.push_back(tmp - x[x.size()-1]);
            }
            x.push_back(tmp);
        }
        sort(sukima.rbegin(), sukima.rend());
        ans = x[x.size()-1] - x[0];
        for (int i=0; i<sukima.size(); i++) {
            if (i >= k-1) break;
            ans -= sukima[i];
        }
        cout << ans << endl;
    }

    return 0;
}

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

int main(){
    
   string S,T;
   
   int count = 0;
   
   cin >> S >> T;
   
   for(int i = 0; i < 3; i++){
       if(S.at(i) == T.at(i)){
           count++;
       }
   }
   cout << count <<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define inf 1000000000
#define INF 1000000000000000
#define ll long long
#define ull unsigned long long
#define M (int)(1e9+7)
#define P pair<int,int>
#define PLL pair<ll,ll>
#define FOR(i,m,n) for(int i=(int)m;i<(int)n;i++)
#define RFOR(i,m,n) for(int i=(int)m;i>=(int)n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
#define all(a) a.begin(),a.end()
#define IN(a,n) rep(i,n){ cin>>a[i]; }
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define PI 3.14159265
#define F first
#define S second
#define PB push_back
#define EB emplace_back
void init(){
  cin.tie(0);
  ios::sync_with_stdio(false);
}

int main(){
  int n;
  cin>>n;
  ll a[110000];
  ll sum=0;
  rep(i,n){
    cin>>a[i];
    sum+=a[i];
  }
  sort(a,a+n);
  sum-=a[n-1];

  int i=n-1;
  while(i>=0&&sum*2>=a[i]){
    i--;
    sum-=a[i];
  }

  cout<<n-i<<endl;
}


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

using namespace std;

#define ll long long
#define ld long double
#define pll pair <ll , ll>

#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define mp make_pair

#define X first
#define Y second

#define LB(x) ((x) & -(x))
#define BIT(a , b) (((a)>>(b)) & 1)

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

	ll t;
	cin>>t;

	while (t--)
    {
        ll a , b , c , d;
        cin>>a>>b>>c>>d;

        if (a<b || d<b)
        {
            cout<<"No"<<endl;
            continue;
        }

        ll e=__gcd(d , b);

        if (((a%b)+e*((b-(a%b))/e)==b ? (a%b)+e*((b-(a%b))/e)-e : (a%b)+e*((b-(a%b))/e))>c)
        {
            cout<<"No"<<endl;
        }
        else
        {
            cout<<"Yes"<<endl;
        }
    }
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace _0166
{
    public class Program

    {
        public static void Main(string[] args)
        {
            while (true)
            {
                int m = RInt(); if (m == 0) break;

                double mArea = 0;
                int mAngleSum = 0;
                for (int i = 0 ; i < m - 1 ; i++)
                {
                    int angle = RInt();
                    mArea += GetTriangleArea(angle);
                    mAngleSum += angle;
                }
                mArea += GetTriangleArea(360 - mAngleSum);

                int n = RInt();

                double nArea = 0;
                int nAngleSum = 0;
                for (int i = 0 ; i < n - 1 ; i++)
                {
                    int angle = RInt();
                    nArea += GetTriangleArea(angle);
                    nAngleSum += angle;
                }
                nArea += GetTriangleArea(360 - nAngleSum);

                if (Math.Abs(mArea - nArea) <= 1e-10) Console.WriteLine(0);
                else if (mArea > nArea) Console.WriteLine(1);
                else Console.WriteLine(2);

            }
        }

        private static double GetTriangleArea(int angle)
        {
            double rAngle = (angle * Math.PI / 180);
            return  Math.Sin(rAngle / 2) * Math.Cos(rAngle / 2);
        }

        static string RSt() { return Console.ReadLine(); }
        static int RInt() { return int.Parse(Console.ReadLine().Trim()); }
        static long RLong() { return long.Parse(Console.ReadLine().Trim()); }
        static double RDouble() { return double.Parse(Console.ReadLine()); }
        static string[] RStAr(char sep = ' ') { return Console.ReadLine().Trim().Split(sep); }
        static int[] RIntAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => int.Parse(e)); }
        static long[] RLongAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => long.Parse(e)); }
        static double[] RDoubleAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => double.Parse(e)); }
        static string WAr<T>(IEnumerable<T> array, string sep = " ") { return string.Join(sep, array.Select(x => x.ToString()).ToArray()); }
    }

}



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

int main() {
    ll N; cin >> N;
    vector<ll> d(N, 0);
    rep(i, N) cin >> d.at(i);

    ll cnt = 0;
    sort(d.begin(), d.end());
    rep(i, N-1){
        if(d.at(i)<d.at(i+1)){
            if(i+1==N/2){
                cnt = d.at(i+1) - d.at(i);
            }
        }
    }

    cout << cnt << endl;

}


Measured memory_bytes: 1024
import Foundation

func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}

let nk=readInts()
let n=nk[0]
let S=readLine()!

let index=S.index(S.startIndex,offsetBy:n/2)
let T1=S[..<index]
let T2=S[index...]

if (n%2==1)||(T1 != T2){
  print("No")
}else{
  print("Yes")
}

Measured memory_bytes: 13420
def main():
    from sys import stdin, stdout

    def read():
        return stdin.readline().rstrip('\n')

    def read_array(sep=None, maxsplit=-1):
        return read().split(sep, maxsplit)

    def read_int():
        return int(read())

    def read_int_array(sep=None, maxsplit=-1):
        return [int(a) for a in read_array(sep, maxsplit)]

    def write(*args, **kwargs):
        sep = kwargs.get('sep', ' ')
        end = kwargs.get('end', '\n')
        stdout.write(sep.join(str(a) for a in args) + end)

    def write_array(array, **kwargs):
        sep = kwargs.get('sep', ' ')
        end = kwargs.get('end', '\n')
        stdout.write(sep.join(str(a) for a in array) + end)

    n = read_int()
    b_starts = 0
    a_ends = 0
    both = 0
    count = 0

    for i in range(n):
        word = read().strip()
        for i in range(1, len(word)):
            if word[i-1] == 'A' and word[i] == 'B':
                count += 1

        if word[0] == 'B' and word[-1] == 'A':
            both += 1
        elif word[-1] == 'A':
            a_ends += 1
        elif word[0] == 'B':
            b_starts += 1

    if a_ends > 0 and b_starts > 0:
        count += both + 1
        a_ends -= 1
        b_starts -= 1
    elif a_ends > 0:
        count += both
        a_ends -= 1
    elif b_starts > 0:
        count += both
        b_starts -= 1
    elif both:
        count += both - 1
    count += min(a_ends, b_starts)

    write(count)

main()


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

class Program
{
    static void Main()
    {
        var S = ReadLine();

        var ans = 700 + S.Count(c => c == 'o') * 100;

        WriteLine(ans);
    }
}

static class ArrayDeconstructExtensions
{
    public static void Deconstruct<T>(this T[] a, out T i1, out T i2) => (i1, i2) = (a[0], a[1]);
    public static void Deconstruct<T>(this T[] a, out T i1, out T i2, out T i3) => (i1, i2, i3) = (a[0], a[1], a[2]);
    public static void Deconstruct<T>(this T[] a, out T i1, out T i2, out T i3, out T i4) => (i1, i2, i3, i4) = (a[0], a[1], a[2], a[3]);
    public static void Deconstruct<T>(this T[] a, out T i1, out T i2, out T i3, out T i4, out T i5) => (i1, i2, i3, i4, i5) = (a[0], a[1], a[2], a[3], a[4]);
}


Measured memory_bytes: 26168
#pragma GCC optimize ("O2")
#pragma GCC target ("avx2")
//#include<bits/stdc++.h>
#include<iostream>
#include<cstring>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

const int CM = 1 << 17, CL = 12;
char cn[CM + CL], * ci = cn + CM + CL, * owa = cn + CM, ct;
const ll ma0 = 1157442765409226768;
const ll ma1 = 1085102592571150095;
const ll ma2 = 71777214294589695;
const ll ma3 = 281470681808895;
const ll ma4 = 4294967295;
inline int getint() {
	if (ci - owa > 0) {
		memcpy(cn, owa, CL);
		ci -= CM;
		fread(cn + CL, 1, CM, stdin);
	}
	ll tmp = *(ll*)ci;
	int dig = 68 - __builtin_ctzll((tmp & ma0) ^ ma0);
	tmp = tmp << dig & ma1;
	tmp = tmp * 10 + (tmp >> 8) & ma2;
	tmp = tmp * 100 + (tmp >> 16) & ma3;
	tmp = tmp * 10000 + (tmp >> 32) & ma4;
	ci += 72 - dig >> 3;
	return tmp;
}

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


	int N = getint();

	int A[1000001] = {};
	rep(i, N) A[getint()]++;

	if (A[1]) {
		if (A[1] == 1) co(1);
		else co(0);
		return 0;
	}

	int kotae = 0;
	for (int i = 2; i <= 500000; i++) {
		if (A[i]) {
			kotae += (A[i] == 1);
			for (int j = i + i; j <= 1000000; j += i) {
				A[j] = 0;
			}
		}
	}
	for (int i = 500001; i <= 1000000; i++) kotae += (A[i] == 1);
	co(kotae);

	Would you please return 0;
}

Measured memory_bytes: 7664
//57
#include<iostream>
#include<algorithm>

using namespace std;

int main(){
  int c=0;
  for(int W;cin>>W,W;){
    c++;
    int N;
    cin>>N;
    int val[1001]={};
    while(N--){
      int v,w;
      (cin>>v).ignore()>>w;
      for(int i=1000;i-w>=0;i--){
	val[i]=max(val[i],val[i-w]+v);
      }
    }
    int i;
    for(i=W;i&&val[i]==val[i-1];i--) ;
    cout<<"Case "<<c<<':'<<endl;
    cout<<val[i]<<endl;
    cout<<i<<endl;
  }
  return 0;
}

Measured memory_bytes: 0
N=gets.to_i
a=gets.split.map(&:to_i)
b=gets.split.map(&:to_i)
sum=0
N.times do |i|
  if a[i] >= b[i]
    sum += b[i]
    next
  else
    sum += a[i]
    b[i] -= a[i]
    if a[i+1] >= b[i]
      sum += b[i]
      a[i+1] -= b[i]
    else
      sum += a[i+1]
      a[i+1] = 0
    end
  end
end

puts sum

Measured memory_bytes: 15508
from sys import stdin
def main():
    N, K = map(int, stdin.readline().rstrip().split())
    A = list(map(int, stdin.readline().rstrip().split()))

    groupList=[]
    # まずは部分列をつくる
    for i in range(N):
        for j in range(N-i):
            groupList.append(sum(A[j:j+i+1]))
    
    # ビットでandをとって残った物を採用
    ans=0
    for b in range(40,-1,-1):
        checkBit=2**b
        new_group_list = []

        for g in groupList:
            if  checkBit & g == checkBit:
                new_group_list.append(g)

        if len(new_group_list) >= K:
            groupList = new_group_list
            ans+=checkBit

    print(ans)

input = lambda: stdin.readline()
main()


Measured memory_bytes: 24064
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define prtd(var, i) cout << fixed << setprecision(i) << var << endl;
#define ll long long
#define P pair<int, int>
using namespace std;

ll f(vector<P> p){
    int n = p.size();
    rep(i, n) p[i].first = min(p[i].first, n);
    vector<vector<int>> s(n+1);
    rep(i, n) s[p[i].first].push_back(p[i].second);

    ll res = 0;
    priority_queue<int> q;
    for(int i = n; i >= 1; i--){
        for(int x : s[i]) q.push(x);
        if(q.size() > 0){
            res += q.top();
            q.pop();
        }
    }
    return res;
}

void solve(){
    int n;
    cin >> n;
    vector<P> pl, pr;
    ll ans = 0;
    rep(i, n){
        int k, l, r;
        cin >> k >> l >> r;
        int m = min(l, r);
        l -= m; r -= m;
        ans += m;
        if(l > 0) pl.emplace_back(k, l);
        else pr.emplace_back(n-k, r);
    }
    ans += f(pl);
    ans += f(pr);
    cout << ans << endl;
}

int main(){
    int ts;
    cin >> ts;
    rep(ti, ts) solve();
    return 0;
}

Measured memory_bytes: 10656
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    S = readline().strip()

    ans = len(S) // 2 - S.count('p')

    print(ans)
    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 9204
#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 fi first
#define se second
using namespace std;
using lint = long long;
using uint = unsigned int;
using ulint = unsigned long long;
using ldouble = long double;
using pii = pair<int, int>;
using pli = pair<lint, lint>;
using pdd = pair<double, double>;
using pld = pair<ldouble, ldouble>;
using v1i = vector<int>;
using v1li = vector<lint>;
using v2i = vector<vector<int>>;
using v2li = vector<vector<lint>>;
using v3i = vector<vector<vector<int>>>;
using v3li = vector<vector<vector<lint>>>;
using v1b = vector<bool>;
using v2b = vector<vector<bool>>;
using v3b = vector<vector<vector<bool>>>;
using v1c = vector<char>;
using v2c = vector<vector<char>>;
using v3c = vector<vector<vector<char>>>;
constexpr lint mod1 = 1e9+7;

int main() {
  int n, q;
  cin >> n >> q;
  lint s = 0;
  v2i v(n); v1i a(n, 0);
  rep(i, n-1){
    int p, r;
    cin >> p >> r;
    v[p-1].push_back(r-1);
    v[r-1].push_back(p-1);
  }
  rep(i, q){
    int p, r;
    cin >> p >> r;
    a[p-1] += r;
  }
  deque<int> d; d.push_back(0); int tmp = 0; v1b c(n, 1); c[0] = 0;
  while(!d.empty()){
    d.pop_front();
    for(int b: v[tmp]){
      if(c[b]){
        c[b] = 0;
        d.push_back(b);
        a[b] += a[tmp];
      }
    }
    tmp = d.front();
  }
  rep(i, n){
    cout << a[i];
    if(i == n-1) cout << endl;
    else cout << " ";
  }
  return 0;
}

Measured memory_bytes: 15604
#include<stdio.h>
#include<algorithm>
using namespace std;
int a[200010],b[200010];
main(){
    int n,i,x,y;
    scanf("%d",&n);
    for(i=0;i<n;++i)
    {
        scanf("%d",&a[i]);
        b[i]=a[i];
    }
    sort(b,b+n);
    x=b[(n/2)-1];
    y=b[(n/2)];
    if(x==y)
    {
        for(i=1;i<=n;++i)
        {
            printf("%d\n",x);
        }
    }
    else
    {
        for(i=0;i<n;++i)
        {
            if(a[i]<=x)
            {
                printf("%d\n",y);
            }
            else
            {
                printf("%d\n",x);
            }
        }
    }
}


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

ll pow(ll a, int n) {
	ll tmp = 1;
	while (n) {
		tmp *= a;
		n--;
	}
	return tmp;
}

int main() {
	int n, m;
	cin >> n >> m;
	vector<bool> first(n, true);
	vector<int> keta(n, 0);
	for (int i = 0; i < m; i++) {
		int s, c;
		cin >> s >> c;
		if ((s == 1 && c == 0) && n != 1) {
			cout << -1 << endl;
			return 0;
		}
		s--;
		if (!first.at(s)) {
			if (c != keta.at(s)) {
				cout << -1 << endl;
				return 0;
			}
		}
		else if (first.at(s)) {
			keta.at(s)= c;
			first.at(s) = false;
		}
	}
	int ans = 0;
	if (first.at(0)) {
		ans += pow(10, n - 1);
		if (n == 1) {
			ans = 0;
		}
	}
	for (int i = 0; i < n; i++) {
		if (!first.at(i)) {
			ans += keta.at(i)*pow(10, n - i - 1);
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
package main

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

var (
	NGPatterns   = []string{"AGC", "GAC", "ACG"}
	CharPatterns = []string{"A", "G", "C", "T"}
)

func scanInt(sc *bufio.Scanner) int {
	if !sc.Scan() {
		panic(nil)
	}

	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}

	return i
}

func check() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)

	a := make([]int, 0, 5)

	a = append(a, scanInt(sc))
	a = append(a, scanInt(sc))
	a = append(a, scanInt(sc))
	a = append(a, scanInt(sc))
	a = append(a, scanInt(sc))

	k := scanInt(sc)

	for i := 0; i < len(a); i++ {
		for j := i + 1; j < len(a)-i; j++ {
			dis := a[j] - a[i]
			if dis > k {
				fmt.Printf(":(\n")
				return
			}
		}
	}
	fmt.Printf("Yay!\n")

}

func main() {
	check()
}


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

int N, M;
int score[1002001];
int point[1001];
int bin_search(int n){
    int h=0, t=(N+1)*(N+1);
    int temp;
    int status;
    while(h<=t){
        temp = (t+h)/2;
        if(n == score[temp]) return -1;
        else if(n > score[temp]){
            h = temp + 1;
            status = 1;
        }else{
            t = temp - 1;
            status = 0;
        }
    }
    if(status){
        return score[temp];
    }else{
        return score[temp-1];
    }
}
int main(){
    int a;
    int size;
    int b;
    int m;
    cin >> N >> M;
    while(N || M){
        m = 0;
        point[0] = 0;
        for(int i=1;i<=N;i++){
            cin >> point[i];
        }
        size = -1;
        for(int i=0;i<=N;i++){
            for(int j=0;j<=N;j++){
                score[size++] = point[i]+point[j];
            }
        }
        sort(score,score+size);
        for(int i=0;i<size && score[i] < M;i++){
            b = bin_search(M-score[i]);
            if(b == -1){
                break;
            }else{
                m = max(m, b+score[i]);
            }
        }
        cout << m << endl;
        cin >> N >> M;
    }
}

Measured memory_bytes: 5096
def partition(A, p, r):
    x = A[r-1]
    i = p-1
    for j in range(p, r):
        if A[j] <= x:
            i = i +1
            A[i], A[j] = A[j], A[i]
            
    return i
        

n = int(input())
A = list(map(int, input().split()))

num = partition(A,0,n)
A[num] = "[" + str(A[num]) +"]"
print(*A)


Measured memory_bytes: 16384
n = int(input())
d_1 = []
d_2 = []

for i in range(n):
        a = list(map(int, input().split()))
        d_1.append(a[0])
        d_2.append(a[1])

for i in range(n-2):
        if d_1[i] == d_2[i] and d_1[i+1] == d_2[i+1] and d_1[i+2] == d_2[i+2]:
                print("Yes")
                exit()

print("No")

Measured memory_bytes: 9192
n,m = [int(x) for x in input().split()]
ab = []
for _ in range(m):
    tmp = [int(x) for x in input().split()]
    ab.append(tmp)

start = [x[1] for x in ab if x[0] == 1]
goal = [x[0] for x in ab if x[1] == n]

ans = "IMPOSSIBLE"

if len(set(start) & set(goal)) > 0:
    ans = "POSSIBLE"

print(ans)



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

//??????????????????????????????????????????
char key[10][6] = {
  {}, //0
  {5, '.', ',', '!', '?', ' '},
  {3, 'a', 'b', 'c'},
  {3, 'd', 'e', 'f'},
  {3, 'g', 'h', 'i'},
  {3, 'j', 'k', 'l'},
  {3, 'm', 'n', 'o'},
  {4, 'p', 'q', 'r', 's'},
  {3, 't', 'u', 'v'},
  {4, 'w', 'x', 'y', 'z'}
};
		 

int main(){

  int N;

  std::cin >> N;

  //??\????????\???????????°??????????????????????????¨???????????¨???????????????
  while(N){
    int row = 0;
    int count = -1;
  
    std::string str;
    std::cin >> str;

    for(int i = 0; i < (int)str.size(); i++){
      int num = str[i] - '0'; //???'??°???' - '0'??? ??§????????¨???????????°?????????int ?????????(ex: '1'-'0' = 1)

      if(num != 0){
	row = num;
	count++;
      }else{

	if(row != 0) //?????????0?????´???????°?????????????
	  std::cout << key[row][ (count % key[row][0]) + 1 ]; 
	
	row = 0;
	count = -1;
	/*??????????????§???????????????count???0????????????????????????key??????????????????cout%key[row][0]????????????????????¨
	  5550???????????????????????\?????¨???????????????0????????£?????????????????¬??????3????????£????????????????????¨????????????????????????*/
      }

    }

    std::cout << std::endl;

    N--;
    
  }
  return 0;
}

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

int main(){
  int A,B;
  cin >> A >> B;
  if(0<A){
    cout << "Positive" << endl;
  }
  else if(A<=0 && 0<=B){
    cout << "Zero" << endl;
  }
  else{
    int C=B-A+1;
    if(C%2==0){
      cout << "Positive" << endl;
    }
    else{
      cout << "Negative" << endl;
    }
  }
}

Measured memory_bytes: 3604
#include<cstdio>
#include<iostream>
#include<vector>
#include<set>
#include<algorithm>
using namespace std;

int isColor(int rate) {
	if (rate <= 399) return 0;
	else if (rate <= 799) return 1;
	else if (rate <= 1199) return 2;
	else if (rate <= 1599) return 3;
	else if (rate <= 1999) return 4;
	else if (rate <= 2399) return 5;
	else if (rate <= 2799) return 6;
	else if (rate <= 3199) return 7;
	else return 8;
}

int main(void) {
	int N;
	scanf("%d", &N);
	set<int> colors;
	int flee = 0;
	for (int i = 0; i < N; i++) {
		int a;
		scanf("%d", &a);
		int color = isColor(a);
		if (color <= 7) colors.insert(color);
		else flee++;
	}
	int M, m;
	m = max((int)colors.size(), 1);
	M = (int)colors.size() + flee;
	printf("%d %d\n", m, M);
	return 0;
}


Measured memory_bytes: 3728
#include <iostream>
#include <numeric>
#include <cmath>
#include <limits>
#include <stdio.h>
#include <iomanip>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;
using ll = long long;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
ll Max(ll(a), ll(b), ll(c)) {
	return max(max(a, b), c);
}
ll Min(ll(a), ll(b), ll(c)) {
	return min(min(a, b), c);
}

int main() {
	ll N, K;
	cin >> N >> K;
	vector<ll> P(N);
	vector<ll> C(N);
	rep(i, N) {
		cin >> P.at(i);
	}
	rep(i, N) {
		cin >> C.at(i);
	}
	ll an = -999999999999;
	rep(i, N) {
		ll kf = i;
		ll koma = P.at(kf);
		ll score = C.at(koma-1);
		ll scm = C.at(koma-1);
		ll kai = 1;
		while (koma != (kf+1)&&kai<K) {
			scm = max(scm, score);
			koma = P.at(koma - 1);
			score+= C.at(koma-1);
			
			kai++;
			scm = max(scm, score);
		}
		an = max(scm, an);
		if (score > 0 && kai < K) {
			score = ((K / kai) - 1) * score;

			kai = ((K / kai) - 1) * kai;
			while (kai < K) {
				scm = max(scm, score);
				score += C.at(koma-1);
				koma = P.at(koma-1);
				kai++;
				scm = max(scm, score);
			}
		}
		an = max(scm, an);
	}
	cout << an << endl;
}

Measured memory_bytes: 3704
#include <cmath>
#include <cstdio>
#include <iostream>
#include <iomanip>
using namespace std;

int main()
{
	double x1, y1, x2, y2;
	cin >> x1 >> y1 >> x2 >> y2;
	double ans = sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));

	printf("%.5f\n", ans);


	return 0;
}


Measured memory_bytes: 3204
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;

typedef long long ll;
typedef pair<int,int> PP;

/*
    freopen("input","r",stdin);
    freopen("output","w",stdout);
*/

bool D[100][100];

int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    memset(D, 0, sizeof(D));
    int A, B;
    cin >> B >> A;
    memset(D, 0, sizeof(D));
	int a = A - 1;
	int b = B - 1;
	for (int i = 0;i < 50;i++) {
		for (int j = 0;j < 100;j++) D[i][j] = 1;
	}
    for (int i = 0;i < 50;i += 2) {
    	for (int j = 0;j < 100;j += 2) {
    		if (b > 0) {
    			D[i][j] = 0;
    			b--;
    		}
    	}
    }
    for (int i = 51;i < 100;i += 2) {
    	for (int j = 0;j < 100;j += 2) {
    		if (a > 0) {
    			D[i][j] = 1;
    			a--;
    		}
    	}
    }
    cout << 100 << ' ' << 100 << endl;
    for (int i = 0;i < 100;i++) {
    	for (int j = 0;j < 100;j++) {
    		if (D[i][j] == 1) cout << '#';
    		else cout << '.';
    	}
    	cout << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstring>
#include <deque>

using namespace std;
int rev,n,i,j,x;
deque<int> d;

int main()
{
    cin>>n;
    rev=0;
    for(i=1;i<=n;i++)
    {
        cin>>x;
        if(rev%2==0) d.push_front(x);
        else d.push_back(x);
        rev++;
    }
    for(i=1;i<=n;i++)
    {
        if(rev%2==1)
        {
            cout<<d.front()<<' ';
            d.pop_front();
        }
        else
        {
            cout<<d.back()<<' ';
            d.pop_back();
        }
    }
    cout<<'\n';
    return 0;
}


Measured memory_bytes: 2944
public class Main {


  private static void solve() {
    int n = ni();
    char[] s = ns();
    int[] cnt = new int[26];
    for (char c : s) {
      cnt[c - 'a'] ++;
    }
    
    int mod = 1000000000 + 7;
    long ret = 1;
    for (int v : cnt) {
      ret *= v + 1;
      ret %= mod;
    }
    System.out.println((ret + mod - 1) % mod);
  }

  public static void main(String[] args) {
    new Thread(null, new Runnable() {
      @Override
      public void run() {
        long start = System.currentTimeMillis();
        String debug = args.length > 0 ? args[0] : null;
        if (debug != null) {
          try {
            is = java.nio.file.Files.newInputStream(java.nio.file.Paths.get(debug));
          } catch (Exception e) {
            throw new RuntimeException(e);
          }
        }
        reader = new java.io.BufferedReader(new java.io.InputStreamReader(is), 32768);
        solve();
        out.flush();
        tr((System.currentTimeMillis() - start) + "ms");
      }
    }, "", 64000000).start();
  }

  private static java.io.InputStream is = System.in;
  private static java.io.PrintWriter out = new java.io.PrintWriter(System.out);
  private static java.util.StringTokenizer tokenizer = null;
  private static java.io.BufferedReader reader;

  public static String next() {
    while (tokenizer == null || !tokenizer.hasMoreTokens()) {
      try {
        tokenizer = new java.util.StringTokenizer(reader.readLine());
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
    return tokenizer.nextToken();
  }

  private static double nd() {
    return Double.parseDouble(next());
  }

  private static long nl() {
    return Long.parseLong(next());
  }

  private static int[] na(int n) {
    int[] a = new int[n];
    for (int i = 0; i < n; i++)
      a[i] = ni();
    return a;
  }

  private static char[] ns() {
    return next().toCharArray();
  }

  private static long[] nal(int n) {
    long[] a = new long[n];
    for (int i = 0; i < n; i++)
      a[i] = nl();
    return a;
  }

  private static int[][] ntable(int n, int m) {
    int[][] table = new int[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[i][j] = ni();
      }
    }
    return table;
  }

  private static int[][] nlist(int n, int m) {
    int[][] table = new int[m][n];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[j][i] = ni();
      }
    }
    return table;
  }

  private static int ni() {
    return Integer.parseInt(next());
  }

  private static void tr(Object... o) {
    if (is != System.in)
      System.out.println(java.util.Arrays.deepToString(o));
  }
}


Measured memory_bytes: 25172
#pragma region header
#include <bits/stdc++.h>
using namespace std;

#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_CAT_I(x,y) x ## y
//#define CPP_STR(x) CPP_STR_I(x)
//#define CPP_STR_I(args...) #args
//#define ASSERT(expr...) assert((expr))

using i8 = int8_t;
using u8 = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;
using f32 = float;
using f64 = double;
//using f80 = __float80;
#pragma endregion

#pragma region const
constexpr i64 INF = 1'010'000'000'000'000'017LL;
constexpr i64 MOD = 1'000'000'007LL;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
#pragma endregion

#pragma region util
#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }
template<typename T, size_t N>
i64 SIZE(const T(&)[N]) { return static_cast<i64>(N); }

template<typename T, typename U, typename Comp = less<>>
bool chmax(T& xmax, const U& x, Comp comp = {}) {
	if (comp(xmax, x)) {
		xmax = x;
		return true;
	}
	return false;
}
template<typename T, typename U, typename Comp = less<>>
bool chmin(T& xmin, const U& x, Comp comp = {}) {
	if (comp(x, xmin)) {
		xmin = x;
		return true;
	}
	return false;
}
#pragma endregion

#pragma region init
struct ProconInit {
	static constexpr int IOS_PREC = 15;
	static constexpr bool AUTOFLUSH = false;

	ProconInit() {
		cin.tie(nullptr);
		ios::sync_with_stdio(false);
		cout << fixed << setprecision(IOS_PREC);
		if (AUTOFLUSH)
			cout << unitbuf;
	}
} PROCON_INIT;
#pragma endregion

int main()
{
	i64 N;
	cin >> N;

	double ans = 0.0;
	REP(i, N)
	{
		double x;
		string u;
		cin >> x >> u;
		ans += u == "JPY" ? x : x * 380000.0;
	}

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


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

s=input()

k=input()
k=int(k)

tmp = s[k-1]
tmp_list=list(s)

for i in range(len(s)):
	if s[i]!=tmp:
		tmp_list[i]="*"

aaa = "".join(tmp_list)
print(aaa)


Measured memory_bytes: 2940
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
typedef long long int ll;

#define BIG_NUM 2000000000

using namespace std;

struct Node{

	Node(int arg_to,int arg_cost){
		to = arg_to;
		cost = arg_cost;
	}
	bool operator<(const struct Node &arg) const{
			return cost > arg.cost;
	};

	int to,cost;
};
int main(){

	int N;
	scanf("%d",&N);

	vector<Node> V[N];

	int node,num,to,cost,D[N];;

	for(int loop = 0; loop < N; loop++){
		scanf("%d",&node);
		scanf("%d",&num);
		for(int i = 0; i < num; i++){
			scanf("%d %d",&to,&cost);
			V[node].push_back(Node(to,cost));
		}
		D[loop] = BIG_NUM;
	}

	D[0] = 0;

	priority_queue<Node> Q;

	for(int i = 0; i < V[0].size(); i++){
		D[V[0][i].to] = V[0][i].cost;
		Q.push(Node(V[0][i].to,V[0][i].cost));
	}

	int min_index;

	while(!Q.empty()){
		if(Q.top().cost == D[Q.top().to]){
			min_index = Q.top().to;
			Q.pop();
		}else{
			Q.pop();
			continue;
		}

		for(int k = 0; k < V[min_index].size(); k++){
			if(D[V[min_index][k].to] > D[min_index] + V[min_index][k].cost){
				D[V[min_index][k].to] = D[min_index] + V[min_index][k].cost;
				Q.push(Node(V[min_index][k].to,D[V[min_index][k].to]));
			}
		}
	}

	for(int i = 0; i < N; i++)printf("%d %d\n",i,D[i]);

    return 0;
}


Measured memory_bytes: 7340
#include <iostream>
#include <string>
#include <cstdio>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <functional>
#include <queue>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;

int main(){
    int A[3][3];
    bool flags[3][3]={false};
    cin>>A[0][0]>>A[0][1]>>A[0][2];
    cin>>A[1][0]>>A[1][1]>>A[1][2];
    cin>>A[2][0]>>A[2][1]>>A[2][2];
    int n;
    cin>>n;
    rep(i,n){
        int tmp;
        cin>>tmp;
        rep(j,3){
            rep(k,3){
                if(A[j][k]==tmp)flags[j][k]=true;
            }
        }
    }
    bool flag=false;
    rep(i,3){
        if(flags[i][0]&&flags[i][1]&&flags[i][2])flag=true;
        if(flags[0][i]&&flags[1][i]&&flags[2][i])flag=true;
    }
    if(flags[0][0]&&flags[1][1]&&flags[2][2])flag=true;
    if(flags[2][0]&&flags[1][1]&&flags[0][2])flag=true;

    if(flag){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
}

Measured memory_bytes: 384