akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Numerics;

namespace AtCoderWorkspace
{
    public class Solver
    {
        public void Solve()
        {
            var cin = new Scanner();
            var a = cin.nextInt();
            var b = cin.nextInt();

            var ans = new List<int> { 1, 2, 3 };
            ans.Remove(a);
            ans.Remove(b);
            Console.WriteLine(ans[0]);
        }
    }

    class Scanner
    {
        string[] s;
        int i;

        char[] cs = new char[] { ' ' };

        public Scanner()
        {
            s = new string[0];
            i = 0;
        }

        public string next()
        {
            if (i < s.Length) return s[i++];
            string st = Console.ReadLine();
            while (st == "") st = Console.ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            if (s.Length == 0) return next();
            i = 0;
            return s[i++];
        }

        public int nextInt()
        {
            return int.Parse(next());
        }
        public int[] ArrayInt(int N, int add = 0)
        {
            int[] Array = new int[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextInt() + add;
            }
            return Array;
        }

        public int[] DPArrayInt(int N, int ex)
        {
            int[] Array = new int[N+ex];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextInt();
            }
            return Array;
        }

        public long nextLong()
        {
            return long.Parse(next());
        }

        public long[] ArrayLong(int N, long add = 0)
        {
            long[] Array = new long[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextLong() + add;
            }
            return Array;
        }

        public long[] DPArrayLong(int N, int ex)
        {
            long[] Array = new long[N + ex];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextLong();
            }
            return Array;
        }

        public double nextDouble()
        {
            return double.Parse(next());
        }


        public double[] ArrayDouble(int N, double add = 0)
        {
            double[] Array = new double[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextDouble() + add;
            }
            return Array;
        }
    }   

    class Program
    {
        static void Main(string[] s) => new Solver().Solve();
    }
}


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

using namespace std;
typedef long long ll;
const int maxn = 1e5 + 10;
const int INF = 2e9 + 10;
int n;
ll arr[2 * maxn];
int main()
{
    ios_base::sync_with_stdio(false);
    cin >> n;
    for(int i = 1; i <= n; i ++){
        cin >> arr[i];
    }
    ll diff = (1LL << 50LL);
    vector<ll> v;
    for(ll i = 1; i <= n; i ++){
        v.push_back(arr[i] - i);
    }
    sort(v.begin(), v.end());
    
    int k = (int)v.size();
    ll ret = (1LL << 50LL);
    k /= 2;
    for(int b = k - 1; b <= k + 1; b ++){
        ll sum =0 ;
        for(int i = 1; i <= n; i ++){
            sum += llabs(arr[i] - (v[b] + i));
        }
        ret = min(ret, sum);
    }
    cout << ret << endl;
    return 0;
}


Measured memory_bytes: 3956
//minamoto
#include<bits/stdc++.h>
#define R register
#define fp(i,a,b) for(R int i=(a),I=(b)+1;i<I;++i)
#define fd(i,a,b) for(R int i=(a),I=(b)-1;i>I;--i)
#define go(u) for(int i=head[u],v=e[i].v;i;i=e[i].nx,v=e[i].v)
template<class T>inline bool cmax(T&a,const T&b){return a<b?a=b,1:0;}
template<class T>inline bool cmin(T&a,const T&b){return a>b?a=b,1:0;}
using namespace std;
typedef long long ll;
const int N=505;const ll inf=0x3f3f3f3f3f3f3f3f;
ll sa[N][N],sb[N][N],f[N][N];int n,a[N][N];
int main(){
	scanf("%d",&n);
	fp(i,1,n)fp(j,1,n)if(i!=j)scanf("%d",&a[i][j]);
	fp(i,1,n)fp(j,i+1,n+1){
		sa[i][j]=sa[i][j-1];
		fp(k,i,j-1)sa[i][j]+=a[k][j];
	}
	fp(i,1,n)fd(j,n,i+1){
		sb[i][j]=sb[i][j+1];
		fp(k,1,i)sb[i][j]+=a[j][k];
	}
	memset(f,0x3f,sizeof(f));
	f[0][0]=0;
	fp(i,0,n)fp(j,i,n)if(f[i][j]<inf)
		fp(k,j+1,n+1)cmin(f[j][k],f[i][j]+sa[j+1][k]+sb[j][k+1]-sb[i][k+1]);
	R ll res=inf;
	fp(i,0,n)cmin(res,f[i][n+1]);
	printf("%lld\n",res);
	return 0;
}

Measured memory_bytes: 7296
#include<stdio.h>

int main(void)
{
    int i;
    char c[3][4];
    for(i=0;i<3;i++)
    {
        scanf("%s",c[i]);
    }
    printf("%c%c%c\n",c[0][0],c[1][1],c[2][2]);
    return 0;
}

Measured memory_bytes: 128
n = input()
data = raw_input()
res = True
for one in data.split():
  d = int(one)
  if d % 2 == 0:
    if (d % 3 != 0) and (d % 5 != 0):
      res = False
      break
if res:
  print("APPROVED")
else:
  print("DENIED")

Measured memory_bytes: 2568
N = int(input())
S =input()
wn = [0] * (N + 1)
en = [0] * (N + 1)
for i in range(1, N + 1):
    if S[i - 1] == 'W':
        wn[i] = wn[i - 1] + 1
        en[i] = en[i - 1]
    else:
        wn[i] = wn[i - 1]
        en[i] = en[i - 1] + 1
ans = [wn[i] + en[N] - en[i + 1] for i in range(N)]
print(min(ans))


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

using namespace std;
#define ll long long 
#define endl '\n'
int main()
{
    int a,b;
    cin>>a>>b;
    if(b*2>=a)
        cout<<0<<endl;
    else
        cout<<a-(b*2)<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <complex>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

#define REP(i, m, n) for (int i = int(m); i < int(n); i++)
#define RREP(i, m, n) for (int i = int(n) - 1; i >= int(m); --i)
#define EACH(i, c) for (auto &(i) : c)
#define all(c) begin(c), end(c)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define SORT(c) sort(begin(c), end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
//#define int long long

#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x) cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s)                                                               \
    do {                                                                       \
    } while (0)
#define dump(x)                                                                \
    do {                                                                       \
    } while (0)
#define BR
#endif
using namespace std;

using UI = unsigned int;
using UL = unsigned long;
using LL = long long;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VVLL = vector<VLL>;
using VS = vector<string>;
using PII = pair<int, int>;
using VP = vector<PII>;

template <class T> inline T sqr(T x) { return x * x; }

void solve() {
    vector<bool> p(100000 + 1, true);
    p[0] = false;
    p[1] = false;
    REP(i, 2, 100000 + 1) {
        if (!p[i])
            continue;
        for (int j = i * 2; j < 100000 + 1; j += i)
            p[j] = false;
    }
    VI rui(100000 + 1);
    REP(i, 1, 100000 + 1)
    rui[i] = rui[i - 1] + ((i % 2 == 1) && p[i] && p[(i + 1) / 2]);
    int q;
    cin >> q;
    int l, r;
    REP(i, 0, q) {
        cin >> l >> r;
        cout << rui[r] - rui[l - 1] << endl;
    }
}

signed main() {
    solve();

    return 0;
}

Measured memory_bytes: 1024
//#include"pch.h"
//#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<stdlib.h>
#include<cmath>
#include<math.h>
#include<string>
#include<string.h>
#include<algorithm>
#include<iostream>
using namespace std;

int main() {
	char S[200], T[200];
	char tmp;
	cin >> S >> T;
	size_t size = strlen(S);

	for (int i = 0; i <= size; i++) {
		if (strcmp(S,T)!=0) {
			tmp = S[size - 1];
			for (int j = 1; j < size;j++) {
				S[size - j] = S[size - j - 1];
			}
			S[0] = tmp;
		}
		else {
			puts("Yes");
			return 0;
		}
	}
	puts("No");

	return 0;
}

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

int N;
int A[210];

int main(){
  cin >> N;
  for(int i = 0;i < N; ++i) cin >> A[i];
  int res = 0;
  
while(true){
  	bool existOdd = false;
    for(int i = 0;i < N; ++i){
      if(A[i] % 2 != 0){
        existOdd = true;
        break;
      } 
    }
    if(existOdd) break;
    for(int i = 0;i < N;++i){
      A[i] /= 2;
    }
    ++res;
}
 cout << res << endl;

}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;

int n,ans;

int main() {

    // freopen("C:\\Users\\Dell\\CLionProjects\\untitled6\\AAA.txt", "r", stdin);

    ios::sync_with_stdio(false);
    cin.tie(0);
    //bool test= true;
    //const ll oo = 1e18;

    cin>>n;

    int arr[n];


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

    for(int i=0, j=1 , k =2 ; i<n-2 ;i++, j++ , k++)
    {
        if(arr[j] > arr[i] && arr[j] > arr[k])
        {
            continue;
        }
        else if( arr[j] < arr[i] && arr[j] < arr[k])
        {
            continue;
        } else
        {
            ans++;
        }
    }

    cout<<ans;
}



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

#define ll long long int
#define SPEED ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ff first
#define ss second
const int INF=0x3f3f3f3f;
const int M=1e9+7;

int mul(int a,int b)
{
    return (ll)a*b%M;
}
int power(int a ,int b)
{
	if(b==0)
	return 1;
	int temp=power(a,b/2);
	if(b%2==0)
	return mul(temp,temp);
	else
	return mul(a,mul(temp,temp));
}
int inv(int v)
{
 	return power(v,M-2);
}
int main()
{
 SPEED
 int a,b;cin>>a>>b;
 if(b%a==0)
 cout<<a+b<<endl;
 else
 cout<<b-a;


}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file 
#include <ext/pb_ds/tree_policy.hpp> 
#include <functional> // for less 
#define pb push_back
#define For(i,s,e) for (ll i=(s); i<(e); i++)
#define Debug_array(a,n) for (ll i=(0); i<(n); i++) cout<<a[i]<<" "
#define Foe(i,s,e) for (ll i=(s); i<=(e); i++)
#define Fod(i,s,e) for (ll i=(s)-1; i>=(e); i--)
#define Mod 1000000007
#define pii pair<ll,ll>
#define fi first
#define se second
#define endl "\n"
#define mp make_pair
#define big_prime 15486277
#define bigger_prime 179424697
#define biggest_prime 32416188691
//#define random_shuffle(indices.begin(), indices.end());
//std::random_device rd;
//std::mt19937 g(rd());
//std::shuffle(v.begin(), v.end(), g);
using namespace __gnu_pbds; 
using namespace std;

typedef long long ll;
typedef tree<ll, null_type, less<ll>, rb_tree_tag,tree_order_statistics_node_update> ordered_set; 

#define MAX 100000

int main(){
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	
	ll n,x;cin>>n>>x;
	ll f[MAX];
	memset(f,0,sizeof(f));
	f[0]=1;
	ll a[n];
	For(i,0,n) cin>>a[i];
	ll d = 0;
	For(i,0,n){
		d = d+a[i];
		f[d]++;
	}
	ll ans=0;
	For(i,0,x+1) ans+=f[i];

	cout<<ans<<endl;











	
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//template<class itr> void cins(itr first, itr last){ for(auto i = first; i != last; i++){ cin >> (*i); } }
/*
string S_str[H];
cins(S_str, S_str + H);
S_str[i][j];
*/
inline int at(ll x, int k){ return (x >> k) & 1; }
#define rep(i, n) for(ll i = 0; i < n; i++)


int main(){
  ll n;
  cin >> n;
  map<string,int> s;
  rep(i,n){
    string temp;
    cin >> temp;
    if(s.count(temp)==0)
    s.insert(make_pair(temp,1));
  }
  ll ans =s.size();
  cout <<ans<<endl;


}


Measured memory_bytes: 19256
#include <iostream>
#include <map>
#include <set>
#include <vector>
#include <algorithm>
#include <string>
#include <math.h>
#include <iomanip>


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

using namespace std;

int main()
{
  int x, y;
  cin >> x >> y;

  for (int i = 0; i <= x; ++i)
  {
    int result = i * 2 + (x - i) * 4;
    if (result == y)
    {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
}


Measured memory_bytes: 3632
def foo(x):
    count = 0
    while x % 2 ==0:
        x = x / 2
        count += 1
    return count

if __name__ == '__main__':
    hoge = input()
    max_count = 0
    for x in input().split():
        x = int(x)
        if x % 2 != 0:
            continue
        max_count += foo(x)
    print(max_count)

Measured memory_bytes: 3828
[n,m,k] = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]


a_acc = [0]
b_acc = [0]

for i in range(n):
    a_acc.append(a_acc[-1] + a[i])
for i in range(m):
    b_acc.append(b_acc[-1] + b[i])
ans = 0
#print(len(b_acc))
#0冊からn冊まで
for i in range(n+1):
    criteria = k - a_acc[i]
    if criteria < 0:
        break
    #b_accについて2分探索
    left = 0
    right = m
    #print(i,criteria)
    while left != right-1:
        #print(left,right)
        tmp = (left + right) // 2
        #if criteria == b_acc[right]:
        #    left = right
        #    break
        #el
        if criteria < b_acc[tmp]:
            right = tmp
        else:
            left = tmp
    if criteria < b_acc[right]:
        ans = max(ans,i + left)
    else:
        ans = max(ans,i + right)

print(ans)


Measured memory_bytes: 126732
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define REP(i,n) for(ll i=0;i<(n);i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORC(i,a,b,c) for(ll i=(a);i<(b);i+=(c))
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define ff first
#define ss second
#define dd long double
#define mod 1000000007

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n;
    cin>>n;
    ll xorr=0;
    ll arr[n];
    REP(i,n){
        cin>>arr[i];
        xorr^=arr[i];
    }
    REP(i,n){
        cout<<(arr[i]^xorr)<<" ";
    }
    cout<<endl;
}


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

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> ii;
typedef tuple<ll, ll, ll> iii;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
#define REP(i,n) for (ll i = 0; i < n; ++i)
#define REPR(i,n) for (ll i = n-1; i >= 0; --i)
#define FOR(i,m,n) for (ll i = m; i < n; ++i)
#define FORR(i,m,n) for (ll i = n-1; i >= m; --i)
#define FORE(x,xs) for (const auto& x : xs)
#define PB push_back
#define MP make_pair
#define MT make_tuple
#define ALL(v) v.begin(), v.end()

int H, W, h, w;

int main() {
    cin >> H >> W >> h >> w;
    cout << (H-h) * (W-w) << endl;
}

Measured memory_bytes: 256
candy = input()
x = candy.split()
y = [0,0,0]
for i in range(3):
    y[i] = int(x[i])
i = 0
for v in y:
    if max(y) == v and y[(i+1)%3] + y[(i+2)%3] == v:
            print('Yes')
            break
    i = i+1
if i >= 3:
    print('No')

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

using namespace std;

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    
    int a[3];
    cin >> a[0] >> a[1] >> a[2];
    sort(a, a + 3);
    cout << a[0] + a[1] << '\n';
    

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ld long double
using namespace std;
const ld pi=3.14159265359;
int main()
{  int n;cin>>n;
int h[n];
for(int i=0;i<n;++i)cin>>h[i];
int ans[n];ans[0]=0;
ans[1]=abs(h[1]-h[0]);
for(int i=2;i<n;++i)
    ans[i]=min(ans[i-1]+abs(h[i]-h[i-1]),
               ans[i-2]+abs(h[i]-h[i-2]));
cout<<ans[n-1];
    return 0;
}


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

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

int main() {
    int a, b;
    cin >> a >> b;
    cout << gcd(a, b) << endl;

    return 0;
}


Measured memory_bytes: 3100
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <functional>
using namespace std;
using namespace __gnu_pbds;

#define ll long long
#define mk make_pair

template <class key, class cmp = std::less<key>>
using ordered_set = tree<key, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
const ll mod = 1e9 + 7;

/*
if you have any question about any part of my code,
please don't shy to ask anytime :)
*/

void solve()
{
    ll a;
    long double b;
    cin >> a >> b;
    ll bb = b*100+0.5; //round
    ll ans = a*bb;
    cout<<ans/100<<endl;
}

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

    // ll t;
    // cin >> t;

    // while (t--)
    // {
    //     solve();
    // }
    solve();
    return 0;
}

Measured memory_bytes: 3744
#include <boost/multiprecision/cpp_dec_float.hpp>//小数点を１００桁ほどに増やせる(atcoderなら動く)
namespace mp = boost::multiprecision;

#include <iostream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <bitset>

#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define INF 2000000000
#define rep(i,n) for(int i=0;i<(n);i++)
typedef pair<int, int> P;
const ll MOD=1000000007;
using Graph = vector<vector<int>>;
 

int cut(int a, int b) {//切り捨て
	return (a - a % b) / b;
}
ull up(ull a, ull b) {
	return (a + a % b) / b;
}

int main() {
	mp::cpp_dec_float_100 a, b, c;
	cin >> a >> b >> c;
	if (mp::sqrt(a) + mp::sqrt(b) < mp::sqrt(c)) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

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

// #[fastout]
fn main() {
    input! {
        n: usize,
        k: usize,
        mut p: [usize; n],
    }

    p.sort();

    // println!("{}", p.truncate(k).iter());
    println!("{}", &p[..k].to_vec().iter().fold(0, |a, b| a+b));
}


Measured memory_bytes: 2100
#include<iostream>

using namespace std;

int main(){
	
	int a, b, c, d, e, f, g, h;
	cin >> a >> b >> c >> d >> e >> f>> g >> h;
	int answer;

	if ( a + b + c + d >= e + f + g + h ){
		answer = a + b + c + d;
	}

	if ( e + f + g + h > a + b + c + d ){
		answer = e + f + g + h;
	}

	cout << answer << endl;

	

	return 0;
}


Measured memory_bytes: 3092
#include<stdio.h>

int main(){
  double x1, y1, x2, y2, x3, y3, xp, yp, X1, X2, X3;
  while(scanf("%lf%lf%lf%lf%lf%lf%lf%lf", &x1, &y1, &x2, &y2, &x3, &y3, &x\
p, &yp) != EOF){
    X1 = (x2-x1)*(yp-y1)-(y2-y1)*(xp-x1);
    X2 = (x3-x2)*(yp-y2)-(y3-y2)*(xp-x2);
    X3 = (x1-x3)*(yp-y3)-(y1-y3)*(xp-x3);
    if((X1>0 && X2>0 && X3>0) || (X1<0 && X2<0 && X3<0)){
      printf("YES\n");
    }else{
      printf("NO\n");
    }
  }
  return 0;
}

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

using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int q;
    cin >> q;
    vector<int> l(q), r(q);
    for (int i = 0; i < q; i++) {
        cin >> l[i] >> r[i];
        r[i]++;
    }
    vector<int> isprime(100001, 1);
    isprime[0] = 0, isprime[1] = 0;
    for (int i = 2; i < isprime.size(); i++) {
        if (!isprime[i]) continue;
            for (int j = i * 2; j < isprime.size(); j += i) {
                isprime[j] = 0;
            }
    }
    vector<int> a(100001, 0);
    for (int i = 0; i < a.size(); i++) {
        if (isprime[i] && isprime[(i + 1) / 2]) a[i] = 1;
    }
    vector<int> s(100002, 0);
    for (int i = 0; i < s.size(); i++) s[i + 1] = s[i] + a[i];
    for (int i = 0; i < q; i++) cout << s[r[i]] - s[l[i]] << '\n';
    return 0;
}

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

int main(){
    int N, M, Lmax=1, Rmin=100000;
    vector<int> L(100000), R(100000);

    //input
    cin >> N >> M;
    for(int i=0; i<M; i++){
        cin >> L.at(i) >> R.at(i);
        if(L.at(i)>Lmax){
            Lmax = L.at(i);
        }
        if(R.at(i)<Rmin){
            Rmin = R.at(i);
        }
    }

    //output
    if(Rmin-Lmax>=0){
        cout << Rmin-Lmax+1 << endl;
    }else{
        cout << 0 << endl;
    }
}

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

int main(){
  int N;
  cin >> N;
  vector<int> A(N),B(N);
  for(int i=0;i<N;i++){
    cin >> A.at(i);
    B.at(A.at(i)-1)=i+1;
  }
  for(int i=0;i<N;i++){
    cout << B.at(i) << ' ';
  }
  cout << endl;
}

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

int main(){
    int x; cin >> x;

    if(x >= 30) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 3604
using System;

namespace ProgramingStydying
{
    class Program
    {
        static void Main(string[] args)
        {
            var a = int.Parse(Console.ReadLine());
            var b = int.Parse(Console.ReadLine());
            var c = int.Parse(Console.ReadLine());

            var x = int.Parse(Console.ReadLine());

            var ans = 0;

            for(int i = 0; i <= a; i++)
            {
                for (int j = 0; j <= b; j++)
                {
                    for (int k = 0; k <= c; k++)
                    {
                        var cost = 500 * i + 100 * j + 50 * k;
                        if(cost == x)
                        {
                            ans++;
                        }
                    }
                }
            }
            Console.WriteLine(ans);
        }
    }
}

Measured memory_bytes: 27460
import java.util.Scanner;

// https://atcoder.jp/contests/agc032/tasks/agc032_d
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long a = sc.nextInt();
        long b = sc.nextInt();
        long[] p = new long[n];
        for (int i = 0; i < n; i++) {
            p[i] = sc.nextInt();
        }
        // costDP[i][j] = cost to sort the first i elements, moving some to
        // the right at cost A, such that the maximum element not moved to
        // the right has value <=j.
        long[][] costDP = new long[n][n + 1];
        for (int i = 0; i < n; i++) {
            costDP[i][0] = a * (i + 1);
        }
        for (int j = 0; j < p[0]; j++) {
            costDP[0][j] = a;
        }
        for (int i = 1; i < n; i++) {
            for (int j = 1; j <= n; j++) {
                if (j < p[i]) {
                    costDP[i][j] = Math.min(costDP[i][j - 1], costDP[i - 1][j] + a);
                } else if (j > p[i]) {
                    costDP[i][j] = Math.min(costDP[i][j - 1], costDP[i - 1][j] + b);
                } else {
                    costDP[i][j] = Math.min(costDP[i][j - 1], costDP[i - 1][j]);
                }
            }
        }

        long bestCost = costDP[n - 1][0];
        for (int i = 1; i <= n; i++) {
            bestCost = Math.min(costDP[n - 1][i], bestCost);
        }
        System.out.println(bestCost);
    }
}


Measured memory_bytes: 251396
#include<bits/stdc++.h>
using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;

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

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

	cout << (1000 - N % 1000) % 1000 << endl;

	return 0;
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std; 
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define CINA2(a,n,m); REP(i,(n)){ REP(j,(m)){cin >> (a)[i][j];} }
#define LINY "YES\n"
#define Liny "Yes\n"
#define LINN "NO\n"
#define Linn "No\n"

// a1+b1 a1+b2 a1+b3 
// a2+b1 a2+b2 a2+b3 
// a3+b1 a3+b2 a3+b3 

int main(){
  int c[3][3]; CINA2(c,3,3);
  bool f = true;
  REP(i,3){
    int n = i;
    int m = (i+1)%3;
    int d[3];
    REP(j,3){d[j] = c[n][j] - c[m][j];}
    if(!(d[0]==d[1] && d[1]==d[2]) ){f = false;break;}
  }
  if(f){
    REP(i,3){
      int n = i;
      int m = (i+1)%3;
      int d[3];
      REP(j,3){d[j] = c[j][n] - c[j][m];}
      if(!(d[0]==d[1] && d[1]==d[2]) ){f = false;break;}
    }
  }
  cout << (f?Liny:Linn);
  
}


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

const int MAXN = 1e5 + 10;

struct Edge {
	int dest, kind;
	
	Edge() {}
	Edge(int _dest, int _kind) : dest(_dest), kind(_kind) {}
};

int n, m, edge_cnt, cnt, col[MAXN];
vector<Edge> edges[MAXN];
bool vis[MAXN];
long long tag[3];

void dfs(int x) {
	vis[x] = 1;
	++tag[col[x]];
	for (int i = 0; i < edges[x].size(); ++i) {
		int y = edges[x][i].dest, k = edges[x][i].kind;
		if (!vis[y]) {
			col[y] = (col[x] + k) % 3;
			edge_cnt += k == 1;
			dfs(y);
		} else {
			edge_cnt += k == 1;
			if (col[y] != (col[x] + k) % 3) cnt = 1;
		}
	}
}

int main() {
	scanf("%d%d", &n, &m);
	for (int i = 0; i < m; ++i) {
		int x, y;
		scanf("%d%d", &x, &y);
		edges[x].push_back(Edge(y, 1));
		edges[y].push_back(Edge(x, 2));
	}
	long long ans = 0;
	for (int i = 1; i <= n; ++i)
		if (!vis[i]) {
			edge_cnt = cnt = tag[0] = tag[1] = tag[2] = 0;
			dfs(i);
			if (cnt) ans += (tag[0] + tag[1] + tag[2]) * (tag[0] + tag[1] + tag[2]);
			else {
				if (!tag[0] || !tag[1] || !tag[2]) ans += edge_cnt;
				else ans += tag[0] * tag[1] + tag[1] * tag[2] + tag[0] * tag[2];
			}
		}
	printf("%lld\n", ans);
}

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

using namespace std;

typedef long long ll;

const int INF = 1e9;
const ll LLINF = 1e18;
const ll MOD = (ll)1e9 + 7;

int main()
{
  int N; scanf("%d", &N);
  vector<int> T(N + 5, 0);
  int total = 0;
  for (int i = 1; i <= N; ++i) {
    scanf("%d", &T[i]);
    total += T[i];
  }
  int M; scanf("%d", &M);
  int p, x;
  for (int i = 0; i < M; ++i) {
    scanf("%d %d", &p, &x);
    printf("%d\n", total - T[p] + x);
  }
  return 0;
}


Measured memory_bytes: 256
//		HYSO SERIOUS? WHY SO SERIOUS                            RIOUS? WHY SO SERIOUS? WHYSO SERIO
	//		 ERIOUS? WHY SO SERIOUS ? WHY                          WHY SO SERIOUS? WHY SOSERIOUSWHYS
	//		       OSERIOUS? WHY SO SERIOU         SERIOUS        ERIOUS? WHY SO SERIOUS? WHYS
	//		          WHY SO SERIOUS? WHY SOSERIOUS? WHYSOSERIOUS? WHY SO SERIOUS?WHY SO SE
	//		           ERIOUS? WHY SO SERIOUS? WHY SO SERIOUS? WHY SO SERIOUS? WHY SOSERIO
	//		           WHY SO SERIOUS? WHY SO SERIOUS? WHY SO SERIOUS? WHY SO SERIOUS? WH
	//		            SERIOUS?WHYSO SERIOUS? WHY SO SERIOUS? WHY SO SERIOUS? WHYSO SE
	//		              ?WHYSOSERIOUS?WHY SO SERIOUS? WHY SO SERIOUS?WHYSO SERIOUS?
	//		                           OSERIOUS? WHY SO SERIOUS?WHYSOSER
	//		                                 HYSOSERIOUS?WHYSOSERI
	//		                                     SOSERIOUS?W
	//		                                         SER
	//		                                          W


	#include <iostream>
	using namespace std;
	#include<bits/stdc++.h>
	#include <algorithm>
	#define ll long long int
	#define read(a) long long int a; cin>>a;
	#define readstr(s) string s; cin>>s;
	#define readarr(a,l) long long int a[l]={0}; for(ll i=0;i<l;i++) cin>>a[i];
	#define loop(i,a,b) for(ll i=a;i<b;i++)
	#define rloop(i,a,b) for(ll i=a;i>b;i--)
	#define ff first
	#define ss second
	#define readmtrx(i,j,a,b) ll arr[a][b]={0};for(ll i=0;i<a;i++)for(ll j=0;j<b;j++) cin>>arr[i][j];
	#define v(pi) vector<ll>pi
	#define vp(pi) vector<pair<ll,ll>>pi
	#define fast ios_base::sync_with_stdio(false);cin.tie(0);
	#define pb(p) push_back(p)
	#define mp make_pair
	#include <cmath>
	#include <map>
	#define mi(lol) map<ll,ll>lol

	int main() {
		fast;
	//#ifndef ONLINE_JUDGE
	  //freopen("input.txt","r",stdin);
	  ///freopen("output.txt","w",stdout);
	//#endif
	  read(a)
	  read(b)
	  if(a>=b) {loop(i,0,a)cout<<b;}
	  else {loop(i,0,b)cout<<a;}
		return 0;
	}


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

int main() {
    int n;
    string s, t;
    cin >> n >> s >> t;

    for (int i = n; i > 0; i--) {
        if (s.substr(n-i, i) == t.substr(0, i)) {
            cout << n*2-i << endl;
            return 0;
        }
    }
    cout << n*2 << endl;
}

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

#define fo(i,a,b) for (int i=(a); i<(b); i++)
#define sz(v) int(v.size())

using namespace std;

int n;
int a[100005];
int odo[100005];
int evo[100005];

int main() {
    scanf("%d", &n);
    fo(i,0,n) scanf("%d", a+i);

    int res = 0;
    fo(i,0,n) {
        int tot = 0;
        int oa = a[i];
        while (a[i] > 1) {
            res++;
            tot++;
            if (a[i] & 1) {
                a[i] = (a[i]+1)/2;
            } else {
                a[i] = a[i] / 2;
            }
        }
        if (oa & (oa-1)) {
            evo[i] = tot-1;
            odo[i] = 1;
        } else {
            evo[i] = tot;
            odo[i] = 0;
        }
    }

    //printf("res = %d\n", res);

    int tk = 0;
    for (int i = n-1; i >= 0; i--) {
        int ev = evo[i], od = odo[i];
        //printf("tk = %d, ev = %d, od = %d\n", tk, ev, od);
        int ntk = 0;
        while (ev && tk) {
            ntk++;
            ev--;
            tk--;
            res--;
        }
        while (od && tk) {
            od--;
            tk--;
            res--;
        }
        tk = ntk + ev + od;
    }
    printf("%d\n", res);
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key
#define INF 1e18
 
typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef vector < pair<int, int> > vii;
typedef long double ld;
typedef tree<pair<int,int>, null_type, less<pair<int,int> >, rb_tree_tag, tree_order_statistics_node_update> pbds;
typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;
 
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll x, y;
	cin >> x >> y;
	if(x%y==0){
		cout << -1;
	}
	else{
		cout << x;
	}
	return 0;
}


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

int main() {
  
  int n, d;
  cin >> n >> d;
  
  vector<vector<int>> x(n, vector<int>(d));
  REP(i,n) {
    REP(j,d) {
      cin >> x[i][j];
    }
  }
  
  int ans = 0;
  int y = 0, z = 0;
  REP(i,n-1) {
    for(int j = i+1; j < n; j++) {
      REP(k,d) {
        y += pow((x[i][k] - x[j][k]),2);
      }
      z = pow(y,0.5);
      if (z * z == y) ans++;
      y = 0;
    }
  }    
  
  cout << ans << endl;
  
}

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

int cost=0;


int SortCost(int A[], int n, int min, int min1)
{
	int i,c=0,d;
	for(i=0;i<=n-1;i++)
	{
		if(A[i]!=min) c+=A[i]+min;
	}
	d=c+2*(min+min1)-(n-1)*(min-min1);
	if(c<d) cost+=c;
	else cost+=d;
}

int partition(int A[], int p, int r)
{
	int i,j;
	int x,temp;
	
	x=A[r];
	i=p-1;
	for(j=p;j<=r-1;j++)
	{
		if(A[j]<=x)
		{
			i++;
			temp=A[j];
			A[j]=A[i];
			A[i]=temp;
		}
	}
	temp=A[r];
	A[r]=A[i+1];
	A[i+1]=temp;
	return i+1;
}

int quickSort(int A[], int p, int r)
{
	int q;
	
	if(p<r)
	{
		q=partition(A,p,r);
		quickSort(A,p,q-1);
		quickSort(A,q+1,r);
	}
}

int bs (int A[], int n, int c) 
 {
    int j,k,l;
    j=0;
    k=n-1;
    while(1)
    {
        if(j<=k)
        {
            l=(j+k)/2;
            if(A[l] > c)
            {
                k=l-1;
            }
            else if(A[l] < c)
            {
                j=l+1;
            }
            else
            {
                return l;
            }
        }
    }
}


int main()
{
	int i,j,n,k;
	int A[1000];
	int B[1000];
	int S[1000];
	int a[1000];
	
	scanf("%d",&n);
	
	for(i=0;i<=n-1;i++) 
	{
		scanf("%d",&A[i]);
		S[i]=A[i];
		a[i]=0;
	}
	
	quickSort(S,0,n-1);
	
	for(i=0;i<=n-1;i++)
	{
		j=0;
		if(a[i]==0 && A[i]!=S[i])
		{
			B[j]=A[i];
			j++;
			do
			{
				k=bs(S,n,B[j-1]);
				B[j]=A[k];
				a[k]=1;
				j++;
			} while(A[k]!=B[0]);
			SortCost(B,j-1,S[i],S[0]);
		}
	}
	printf("%d\n",cost);
	return 0;
}

Measured memory_bytes: 3208
#include<bits/stdc++.h>
const int N = 4e6 + 5;
const int mod = 1e9 + 7;
using namespace std;

int n, k, f[N], dp[2005][2005], sum[2005][2005], inv[N], ans;

int C(int k, int n){
    if (k < 0 || k > n) return 0;
    return 1LL * f[n] * inv[k] % mod * inv[n-k] % mod;
}

int po(int n, int k){
    int ans = 1;
    while (k){
        if (k&1) ans = 1LL * ans * n % mod;
        n = 1LL * n * n % mod;
        k >>= 1;
    }
    return ans;
}

void add(int& a, int b){
    a += b; if (a >= mod) a -= mod;
}

int main(){
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    f[0] = 1;
    for (int i = 1; i < N; i++) f[i] = 1LL * f[i-1] * i % mod;
    inv[N-1] = po(f[N-1], mod-2);
    for (int i = N-2; i >= 0; i--) inv[i] = 1LL * inv[i+1] * (i+1) % mod;
    cin >> n >> k;
    if (k == 1) return cout << 1, 0;
    dp[1][1] = 1; sum[1][1] = sum[1][0] = 1;
    for (int i = 2; i <= n; i++) {
        for (int j = i; j >= 1; j--){
            add(dp[i][j], 1LL * sum[i-1][j-1] * C(k-2, i*k-j-1) % mod * i % mod);
        }
        for (int j = n; j >= 0; j--) sum[i][j] = sum[i][j+1], add(sum[i][j], dp[i][j]);
    }
    for (int i = 1; i <= n; i++) add(ans, dp[n][i]);
    cout << ans;
}

Measured memory_bytes: 62976
#include<iostream>
#include<cmath>
#include<algorithm>

int main(){
	int n,l;
	std::cin >> n >> l;
	int sum = (2*l+(n-1))*n/2;
	int data = 100000000;
  	int num = 0;
	for (int i = 0; i <n; i++)
	{	
      if(data > std::min(data,std::abs(l+i))){
      	data = std::min(data,std::abs(l+i));
        num = l + i;
      }
      	
	}

	std::cout << sum - num;
	
}

Measured memory_bytes: 256
#include<stdio.h>
#include<bits/stdc++.h>
#define min(a,b) ((a)<(b)?(a):(b))
using namespace std;

int n;
int a[21];

inline long long DFS(int l,int r,int x,int y)
{
	if(l>=r-1) return 0;
	register long long res=1e18;
	for(register int i=l+1;i<r;++i)
	{
		register long long temp=DFS(l,i,x,y+x)+DFS(i,r,x+y,y)+1ll*a[i]*(x+y);
		res=min(res,temp);
	}
	return res;
}

int main(void)
{
	scanf("%d",&n);
	for(register int i=1;i<=n;++i)
		scanf("%d",&a[i]);
	printf("%lld\n",a[1]+a[n]+DFS(1,n,1,1));
	return 0;
}

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

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	int64_t x,k,d; cin>>x>>k>>d; x=abs(x);
	int64_t a=x/d;
	if(x-a*d>=abs(x-a*d-d))++a;
	if(a>=k)cout<<abs(x-k*d);
	else{
		int64_t ans=abs(x-a*d);
		if(a%2==k%2)cout<<ans;
		else cout<<min(ans+d,abs(ans-d));
	}
	cout<<"\n"s;
}


Measured memory_bytes: 3624
#include <iostream>
#include <cstdio>

using namespace std;

typedef long long ll;

ll d;
ll c[29];
ll a[369][29];
ll t[369];
ll b[29];

int main()
{
    scanf("%lld", &d);
    for(ll i = 1; i <= 26; i++)
    {
        scanf("%lld", &c[i]);
    }
    for(ll i = 1; i <= d; i++)
    {
        for(ll j = 1; j <= 26; j++)
        {
            scanf("%lld", &a[i][j]);
        }
    }
    ll ans = 0;
    for(ll i = 1; i <= d; i++)
    {
        ll mx = -4e18, mi = 0;
        for(ll ii = 1; ii <= 26; ii++)
        {
            t[i] = ii;
            ll ans2 = 0;
            ll tt = b[t[i]];
            b[t[i]] = d;
            for(ll j = 1; j <= 26; j++)
            {
                ans2 -= (d - b[j]) * c[j];
            }
            ans2 += a[i][t[i]];
            if(mx < ans2) mx = ans2, mi = ii;
            b[t[i]] = tt;
        }
        t[i] = mi;
        b[t[i]] = d;
        for(ll j = 1; j <= 26; j++)
        {
            ans -= (d - b[j]) * c[j];
        }
        ans += a[i][t[i]];
        printf("%lld\n", mi);
    }
    return 0;
}


Measured memory_bytes: 3872
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include <boost/multiprecision/cpp_int.hpp>
//typedef boost::multiprecision::cpp_int ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E17;

#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
///////////////////////////////////////

bool comp(l_l a,l_l b){
    return a.second<b.second;
}

int main(){fastio
    ll n;cin>>n;
    l_l a[n];rep(i,0,n-1)cin>>a[i].first>>a[i].second;
    sort(a,a+n,comp);
    
    rep(q,1,5000){
        ll time=0;
        rep(i,0,n-1){
            time+=a[i].first;
            if(time>a[i].second){
                cout<<"No"<<endl;return 0;
            }
        }
    }
    cout<<"Yes"<<endl;
    
    return 0;
}


Measured memory_bytes: 3328
#include "bits/stdc++.h"
#include <sys/timeb.h>
#include <fstream>

using namespace std;

#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define replrev(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define reprev(i,n) replrev(i,0,n)
#define repi(itr,ds) for(auto itr = ds.begin(); itr != ds.end(); ++itr)
#define all(a) a.begin(),a.end()
#define mp make_pair
#define INF 2000000000
#define INFL 9000000000000000000LL
#define EPS 1e-9
#define MOD 1000000007
#define PI 3.1415926536
#define RMAX 4294967295

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<P> vP;
typedef vector<vector<int> > vvi;
typedef vector<vector<bool> > vvb;
typedef vector<vector<ll> > vvll;
typedef vector<vector<char> > vvc;
typedef vector<vector<double> > vvd;
typedef vector<vector<P> > vvP;
typedef priority_queue<int, vector<int>, greater<int> > pqli;
typedef priority_queue<ll, vector<ll>, greater<ll> > pqlll;
typedef priority_queue<P, vector<P>, greater<P> > pqlP;
typedef pair<int, pair<int, int> > Edge;
typedef vector<Edge> vE;
typedef priority_queue<Edge, vector<Edge>, greater<Edge> > pqlE;

int main() {
	/*
	ifstream ifs(".in");
	ofstream ofs("A1.txt");
	cin.rdbuf(ifs.rdbuf());
	cout.rdbuf(ofs.rdbuf());
	*/
	int N, M;
	cin >> N >> M;
	vi ans(N, 0);
	rep(i, M) {
		int a, b;
		cin >> a >> b;
		a--;
		b--;
		ans[a]++;
		ans[b]++;
	}
	rep(i, N) {
		cout << ans[i] << endl;
	}

	return 0;
}

Measured memory_bytes: 256
{-# LANGUAGE BangPatterns, MagicHash #-}
import Control.Monad
import Control.Applicative
import Data.List
import Data.Maybe
import Data.Bits
import qualified Data.IntMap.Strict as M
import qualified Data.ByteString.Char8 as B
import qualified Data.Vector.Unboxed as V
import Data.Vector.Unboxed ((!))
import Data.Tuple
import Data.Ord (Down(..))
import Data.Coerce
                                 
query :: Int -> V.Vector (Int,Int) -> Int
query n =
  snd
  . V.ifoldl' (\(x,cnt) a b -> let x' = min b x
                               in if x'-1 == a
                                  then (n,cnt+1)
                                  else (x',cnt)) (n,0)
  . V.init . V.accumulate min (V.replicate n n)
     
main :: IO ()
main = do
  [n,m] <- map read . words <$> getLine
  ls <- V.replicateM m $ (\[x,y]->(x-1,y-1)) . map read . words <$> getLine
  putStrLn $ show $ query n ls



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


//-----------------------------------------
class DataUnit{

    public: vector<string> m_type;
    public: vector<float>  money;
};


double sum_money(DataUnit d, int n){

    double sum_m = 0;

    for(int i=0; i<n ;i++){
        if(d.m_type[i]=="JPY"){
            sum_m += d.money[i];
        }else if(d.m_type[i]=="BTC"){
            sum_m += d.money[i] * 380000.0;
        };
    };

    return sum_m;
}


int main() {
    int N; cin >> N;
    float out;

    DataUnit data;
    for(int i=0; i<N;i++){
        float   m_i;
        string  m_type_i;

        cin >> m_i >> m_type_i;
        data.m_type.push_back(m_type_i);
        data.money.push_back(m_i);
    };


    out = sum_money(data, N);
    cout << out << endl;

    return 0;
}





Measured memory_bytes: 256
#include "bits/stdc++.h"
#include <sys/timeb.h>
#include <fstream>

using namespace std;

#define repr(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repr(i,0,n)
#define reprrev(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define reprev(i,n) reprrev(i,0,n)
#define repi(itr,ds) for(auto itr=ds.begin();itr!=ds.end();itr++)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define mp make_pair
#define mt make_tuple
#define INF 1050000000
#define INFL 1100000000000000000LL
#define EPS (1e-10)
#define MOD 1000000007
#define PI 3.1415926536
#define RMAX 4294967295

typedef long long ll;
typedef pair<int, int> Pi;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<Pi> vPi;
typedef vector<vector<int> > vvi;
typedef vector<vector<bool> > vvb;
typedef vector<vector<ll> > vvll;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<double> > vvd;
typedef vector<vector<Pi> > vvPi;
typedef priority_queue<int, vector<int>, greater<int> > pqli;
typedef priority_queue<ll, vector<ll>, greater<ll> > pqlll;
typedef priority_queue<Pi, vector<Pi>, greater<Pi> > pqlP;
struct Edge {
	int from, to, cost;
	bool operator<(Edge e) {
		return cost < e.cost;
	}
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;
template <class T>
using vec = vector<T>;
template<class T>
using pql = priority_queue<T, vector<T>, greater<T>>;

string debug_show(Pi a) {
	return "(" + to_string(a.first) + "," + to_string(a.second) + ")";
}

template<class T>
struct augEdge {
	T from, to;
	int cost;
	bool operator<(Edge e) {
		return cost < e.cost;
	}
	bool operator>(Edge e) {
		return cost > e.cost;
	}
};

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

	int N, M;
	cin >> N;
	vi d(N);
	rep(i, N)cin >> d[i];
	cin >> M;
	vi t(M);
	rep(i, M)cin >> t[i];

	sort(all(d));
	sort(all(t));

	int cur = 0;
	rep(i, N) {
		if (d[i] == t[cur]) {
			cur++;
			if (cur == M) {
				cout << "YES" << endl;
				return 0;
			}
		}
	}
	cout << "NO" << endl;
	return 0;
}

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

public class Main {
    static public void main(String[] args) {

        int x = 0;
        while (x == 0) {

            Scanner s = new Scanner(System.in);

            int[] a = new int[10000];
            int[] b = new int[10000];
            String[] op = new String[10000];
            Arrays.fill(a, 0);
            Arrays.fill(b,0);
            Arrays.fill(op,"");

            for(int i = 0; i<a.length; i++) {
                a[i] = s.nextInt();
                op[i] = s.next();
                b[i] = s.nextInt();
                if(op[i].equals("?") ){
                    break;
                }
            }
            for(int I =0; I<a.length; I++) {
                switch (op[I]) {
                    case "+":
                        System.out.println(a[I] + b[I]);
                        break;
                    case "-":
                        System.out.println(a[I] - b[I]);
                        break;
                    case "*":
                        System.out.println(a[I] * b[I]);
                        break;
                    case "?":
                        return;
                    case "/":
                        System.out.println(a[I] / b[I]);
                    default:
                        break;
                }
            }
        }
    }
}



Measured memory_bytes: 26428
#include<bits/stdc++.h>
using namespace std;
int main()
{
  string  S, flag;
  cin >> S;
  flag = "No";
  
  if(S[2] == S[3]){
    flag = "Yes";
  }
  if(S[4] != S[5]){
    flag = "No";
  }
  
  
  cout << flag <<endl;
}


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

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

    int n = s.length();
    string former = s.substr(0,n/2);
    reverse(s.begin(),s.end());
    string latter = s.substr(0,n/2);
    //cout << former << " " << latter << endl;

    int ans = 0;
    vector<int> d(n);
    for(int i=0; i<n/2; i++){
        if(former[i] != latter[i]) ans += 1;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>

int compare(const void *a,const void *b){
    return *(int*)a-*(int*)b;
}

int main(void){
    int a[5],i;
    for(i=0;i<5;i++) scanf("%d",&a[i]);
    qsort(a,5,sizeof(int),compare);
    for(i=4;i>=0;i--){
        printf("%d",a[i]);
        if(i!=0) printf(" ");
    }
    printf("\n");
    return 0;
}


Measured memory_bytes: 2056
n,W=map(int,input().split())
w=[0 for i in range(n)]
v=[[] for i in range(4)]
dp=[[0] for i in range(4)]
for i in range(n):
  w[i],vi=map(int,input().split())
  v[w[i]-w[0]].append(vi)
for i in range(4):
  v[i].sort(reverse=True)
  for j in v[i]:
    dp[i].append(dp[i][-1]+j)
def dfs(i,cost):
  if cost>W:
    return -10**10
  elif i==4:
    return 0
  else:
    val=0
    for j in range(len(dp[i])):
      val=max(val,dp[i][j]+dfs(i+1,cost+j*(w[0]+i)))
    return val
print(dfs(0,0))

Measured memory_bytes: 9256
s = input()
t = input()

dp = [[0]*(len(t)+1) for _ in range(len(s)+1)]

for n in range(len(s)):
    for m in range(len(t)):
        if s[n] == t[m]:
            dp[n+1][m+1] = dp[n][m]+1
        else:
            dp[n+1][m+1] = max(dp[n+1][m],dp[n][m+1])

n = len(s)
m = len(t)
ans = ''
while n >= 0 and m >= 0:
    if dp[n][m] == dp[n-1][m]:
        n -= 1
    elif dp[n][m] == dp[n][m-1]:
        m -= 1
    else:
        ans = s[n-1]+ans
        n -= 1
        m -= 1
print(ans)

Measured memory_bytes: 112348
#include "bits/stdc++.h"
using namespace std;

#define int int64_t

#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0,a1,a2,a3,x,...) x
#define REP1(i, s, cond, cal) for (signed i = signed(s); i cond; i cal)
#define REP2(i, s, n) REP1(i, s, < signed(n), ++)
#define REP3(i, n) REP2(i, 0, n)
#define rep(...) CHOOSE((__VA_ARGS__,REP1,REP2,REP3))(__VA_ARGS__)

#define all(c) begin(c), end(c)
#define maxup(ans, x) (ans = (ans < x ? x : ans))
#define minup(ans, x) (ans = (ans > x ? x : ans))

#define breakif(cond) if(cond) break; else

template<typename T>
inline void input(vector<T>& v) { for (auto& x : v) cin >> x; }

using VV = vector<vector<int>>;
using V = vector<int>;
using P = pair<int, int>;
using IP = pair<int, P>;

const int INF = 1 << 29;
#define Int int32_t
Int gcd(Int a, Int b) {
	return b != 0 ? gcd(b, a % b) : a;
}
Int lcm(Int a, Int b) {
	return a * b / gcd(a, b);
}
// a x + b y = gcd(a, b)
Int extgcd(Int a, Int b, Int &x, Int &y) {
	Int g = a; x = 1; y = 0;
	if (b != 0) g = extgcd(b, a % b, y, x), y -= (a / b) * x;
	return g;
}
Int invMod(Int a, Int m) {
	Int x, y;
	if (extgcd(a, m, x, y) == 1) return (x + m) % m;
	else                         return 0; // unsolvable
}

const int MOD = 1000000007;
int fact(int x) {
	int ret = 1;
	rep(i, 2, x + 1) {
		ret *= i;
		ret %= MOD;
	}
	return ret;
}
signed main() {
	int h, w, a, b; cin >> h >> w >> a >> b;
	vector<int> v(h - a);
	v[0] = 1;
	for (int i = 1; i < h - a; i++) {
		//v[i] = v[i - 1] * (i + b - 1) / i;
		v[i] = ((v[i - 1] * (i + b - 1)) % MOD) * invMod(i, MOD);
		v[i] %= MOD;
		//cout << v[i] << endl;s
	};
	//int tmp = fact(a + w - b - 1) / fact(a) / fact(w - b - 1);
	int tmp = ((fact(a + w - b - 1) * invMod(fact(a), MOD)) % MOD) * invMod(fact(w - b - 1), MOD);
	tmp %= MOD;
	int ans = tmp * v[h - a - 1];
	for (int i = 1; i < h - a; i++) {
		tmp = (tmp * (a + i + w - b - 1) % MOD) * (invMod(a + i, MOD) % MOD);
		tmp %= MOD;
		ans += tmp * v[h - a - 1 - i];
		ans %= MOD;
	}
	cout << ans % MOD << endl;
	system("pause");
}

Measured memory_bytes: 1152