akhauriyash/Code-Regression huggingface dataset:
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Sagor
 */

#include <fstream>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <vector>
#include <map>
#include <set>
typedef long long int ll;
typedef double ld;
using namespace std;

class DCaracalVsMonster {
public:
	void solve(std::istream& in, std::ostream& out) {
	    ll n,i,step=0;
	    in>>n;

	   for(i=0;;i++)
       {
	       ll po =(ll)pow(2,i);
	       if(po>n)
           {
	           break;
           }
	       if(po<=n)
           {
	           step+=po;
           }
       }
	    out<<step<<endl;
	}
};


int main() {
    std::ios_base::sync_with_stdio(0);
    std::cin.tie(0);
    DCaracalVsMonster solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 512
// template version 1.15
using namespace std;
#include <bits/stdc++.h>

// varibable settings
#define int long long
const int INF=1e18;

// define basic macro {{{
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _rrep(i,n) rrepi(i,0,n)
#define rrepi(i,a,b) for(int i=(int)((b)-1);i>=(int)(a);--i)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
#define each(i,a) for (auto&& i : a)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define mt(a, b, c) make_tuple(a, b, c)
#define divceil(a,b) ((a)+(b)-1)/(b)
#define is_in(x, a, b) ((a)<=(x) && (x)<(b))
#define uni(x) sort(all(x));x.erase(unique(all(x)),x.end())
#define ub upper_bound
#define lb lower_bound
#define posl(A, x) (lower_bound(all(A), x)-A.begin())
#define posu(A, x) (upper_bound(all(A),x)-A.begin())
template<class T> inline void chmax(T &a, const T &b) { if((a) < (b)) (a) = (b); }
template<class T> inline void chmin(T &a, const T &b) { if((a) > (b)) (a) = (b); }

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long double ld;
typedef pair<int,int> pii;
typedef tuple<int,int,int> iii;

template<typename T> using PQ = priority_queue<T, vector<T>, greater<T>>;
struct Fast { Fast(){ std::cin.tie(0); ios::sync_with_stdio(false); } } fast;

void sputs(){}
template <class Head, class... Tail>
void sputs(Head&& head, Tail&&... tail) {
  cout << head;
  if (sizeof...(Tail) == 0) { cout << endl; }
  else { cout << " "; }
  sputs(std::move(tail)...);
}

#if defined(PCM) || defined(LOCAL)
  #include "lib/dump.hpp"
#else
  #define dump(...) 42
  #define dump_1d(...) 42
  #define dump_2d(...) 42
#endif
//}}}
struct UnionFind {
  vector<int> data;  // size defined only for root node
  int count;

  UnionFind(int size) : data(size, -1), count(size){ }

  bool merge(int x, int y) {
    x=root(x); y=root(y);
    if (x!=y) {
      if (data[y]<data[x]) swap(x, y);
      data[x]+=data[y]; data[y]=x;
      count--;
    }
    return x != y;
  }
  int root(int x) {
    return (data[x]<0 ? x : data[x]=root(data[x]));
  }
  bool same(int x,int y){
    return root(x)==root(y);
  }
  int size(int x) {
    return -data[root(x)];
  }
};


signed main() {
  int n,m;cin>>n>>m;
  UnionFind uf(n);
  vvi L(n);
  vvi ms(m+1);
  rep(i, n){
    int k;cin>>k;
    rep(j, k){
      int l;cin>>l;
      L[i].pb(l);;
      ms[l].pb(i);
    }
  }
  dump(L);
  dump(ms);
  rep(l, 1, m+1){
    rep(i, 1, sz(ms[l])){
      uf.merge(ms[l][i], ms[l][i-1]);
    }
  }
  dump(uf.count);
  cout << (uf.count==1?"YES":"NO") << endl;
  

  return 0;
}


Measured memory_bytes: 9588
#include<bits/stdc++.h>
using namespace std;
#define MAXM 5000
#define MAXN 2501
#define INF (int)1e+9
typedef long long ll;

int N, M, P;
vector<pair<int, int>> adj[MAXN];
ll dist[MAXN];
bool update[MAXN];
bool color[MAXN];

void dijkstra() {
    for (int i=1; i<=N; i++) {
        dist[i] = -INF;
        update[i] = false;
    }
    dist[1] = 0;
    for (int i=1; i<=N; i++) {
        for (int n=1; n<=N; n++) {
            for (int j=0; j<adj[n].size(); j++) {
                int from = n;
                int to = adj[n][j].first;
                int w = adj[n][j].second;
                if (dist[from] != -INF && dist[to]<dist[from]+w) {
                    dist[to] = dist[from] + w;
                    if (i==N) update[to] = true;
                }
            }
        }
    }
}

bool bps(int node) {
    for (int i=1; i<=N; i++) color[i] = false;
    color[node] = true;
    queue<int> Q;
    Q.push(node);
    while(!Q.empty()) {
        int from = Q.front();
        Q.pop();
        for (int j=0; j<adj[from].size(); j++) {
            int to = adj[from][j].first;
            if (to==N) return true;
            else if (color[to]==false) {
                Q.push(to);
                color[to] = true;
            }
        }
    }
    return false;
}

void solve() {
    dijkstra();

    if (update[N]) {
        cout << -1 << endl;
        return;
    }
    for (int i=1; i<N; i++) {
        if (update[i]) {
            if (bps(i)) {
                cout << -1 << endl;
                return;
            }
        }
    }

    if (dist[N]<0) cout << 0 << endl;
    else cout << dist[N] << endl;
}

int main() {
    cin >> N >> M >> P;
    for (int i=0; i<M; i++) {
        int a, b, c;
        cin >> a >> b >> c;
        adj[a].push_back(make_pair(b, c-P));
    }

    solve();

    return 0;
}

Measured memory_bytes: 384
#include <algorithm>
#include <complex>
#include <cstdlib>
#include <ctime>
#include <time.h>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <numeric>
#include <limits>
#include <type_traits>
#include <locale>

using namespace std;
#define SAY_YES cout << "YES" << endl;
#define SAY_Yes cout << "Yes" << endl;
#define SAY_NO cout << "NO" << endl;
#define SAY_No cout << "No" << endl;
#define IFYES(TRUE_OR_FALSE)   \
    if (TRUE_OR_FALSE)         \
    {                          \
        cout << "YES" << endl; \
    }                          \
    else                       \
    {                          \
        cout << "NO" << endl;  \
    }
#define IFYes(TRUE_OR_FALSE)   \
    if (TRUE_OR_FALSE)         \
    {                          \
        cout << "Yes" << endl; \
    }                          \
    else                       \
    {                          \
        cout << "No" << endl;  \
    }
#define IFyes(TRUE_OR_FALSE)   \
    if (TRUE_OR_FALSE)         \
    {                          \
        cout << "yes" << endl; \
    }                          \
    else                       \
    {                          \
        cout << "no" << endl;  \
    }
#define DEBUG_OUTPUT_ARRAY(XXX, ONE)                            \
    for (int i = 0; i < (ONE); i++)                             \
    {                                                           \
        cout << "DEBUG: i = " << i << " -> " << XXX[i] << endl; \
    }
#define DEBUG_OUTPUT_ARRAY2(XXX, ONE, TWO)                             \
    for (int i = 0; i < (ONE); i++)                                    \
    {                                                                  \
        cout << "<<< i = " << i << " >>>" << endl;                     \
        for (int j = 0; j < (TWO); j++)                                \
        {                                                              \
            cout << "DEBUG: j = " << j << " -> " << XXX[i][j] << endl; \
        }                                                              \
    }
#define DEBUG_OUTPUT_ARRAY2_BOX(XXX, ONE, TWO) \
    for (int i = 0; i < (ONE); i++)            \
    {                                          \
        cout << i << "  ";                     \
        for (int j = 0; j < (TWO); j++)        \
        {                                      \
            cout << XXX[i][j] << " ";          \
        }                                      \
        cout << endl;                          \
    }

typedef pair<long long int, long long int> pll;
typedef pair<long long int, pll> lpll;


const long long int mod = 1000000007;
const long long int INF = 1e18;
const long double PI=3.14159265358979323; 
const long long int pl=1000000;

long long int H1,M1,H2,M2,K,res=0;
string S;

int main(){
    cout << fixed << setprecision(18);
    cin>>S;
    bool beforeP=false;
    for(long long int i = 0; i < S.size(); i++){
        if(S[i]=='?'){S[i]='D';}
    }
    cout<<S<<endl;
}




Measured memory_bytes: 3744
// D - Rain Flows into Dams

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//const int INF = 2147483647;
// const ll INF = 9223372036854775807;
// const int MOD = 1e9 + 7;

int A[100000];
int X[100000];

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

	ll S = 0;
	for (int i=0; i<N; i++) {
		cin >> A[i];
		S += A[i];
	}

	X[0] = S;
	for (int i=1; i<= N-2; i+=2) {
		X[0] -= 2*A[i];
	}

	for (int i=0; i<N-1; i++) {
		X[i+1] = 2*A[i] - X[i];
	}

	for (int i=0; i<N; i++) {
		if (i > 0) cout << " ";
		cout << X[i];
	}
	cout << endl;

	return 0;
}

Measured memory_bytes: 2048
#include<stdio.h>
int main()
{
	int num;
	scanf("%d", &num);
	int s = 0, m = 1000, t = 0;
	for (int i = 0; i < num; i++)
	{
		int z;
		scanf("%d", &z);
		s += z;
		if (z % 10 != 0)
		{
			t++;
			if (m > z)m = z;
		}
	}
	if (t == 0)printf("0\n");
	else if (s % 10 != 0)printf("%d\n", s);
	else printf("%d\n", s - m);
}

Measured memory_bytes: 128
#include <stdio.h>

using namespace std;

struct Node{
	Node(){
		left_child = right_child = parent = -1;
	};
	int left_child,right_child,parent;
};

void preORDER(Node order[],int id){
	printf(" %d",id);
	if(order[id].left_child != -1) preORDER(order,order[id].left_child );
	if(order[id].right_child != -1) preORDER(order,order[id].right_child );
}

void inORDER(Node order[],int id){
	if(order[id].left_child != -1) inORDER(order,order[id].left_child );
	printf(" %d",id);
	if(order[id].right_child != -1) inORDER(order,order[id].right_child );
}

void postORDER(Node order[],int id){
	if(order[id].left_child != -1) postORDER(order,order[id].left_child );
	if(order[id].right_child != -1) postORDER(order,order[id].right_child );
	printf(" %d",id);
}

int main(){
	int n,id,left,right,root_id;
	scanf("%d",&n);
	Node order[n];
	for(int i = 0; i < n; i++){
		scanf("%d %d %d",&id,&left,&right);
		if(left != -1){
			order[id].left_child = left;
			order[left].parent = id;
		}
		if(right != -1){
			order[id].right_child = right;
			order[right].parent = id;
		}
	}

	for(root_id = 0; root_id < n; root_id++){
		if(order[root_id].parent == -1) break;
	}

	printf("Preorder\n");
	preORDER(order,root_id);
	printf("\n");

	printf("Inorder\n");
	inORDER(order,root_id);
	printf("\n");

	printf("Postorder\n");
	postORDER(order,root_id);
	printf("\n");
}



Measured memory_bytes: 2684
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		long n = scanner.nextLong();
		long min = Integer.MAX_VALUE;
		for(long i=1;i<=Math.sqrt(n);i++){
			if(n % i == 0){
				long x = n / i;
				String y = String.valueOf(i);
				String z = String.valueOf(x);
				long max = Math.max(y.length(), z.length());
				min = Math.min(min, max);
			}
		}
		System.out.println(min);
	}

}


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

int main()
{
    int n, chk = 0;
    cin >> n;
    for(int i = 0; i < 10; i++){
        for(int j = 0; j < 10; j++){
            if(i*j == n){
                chk = 1;
            }
        }
    }
    if(chk == 1)
        cout << "Yes";
    else
        cout << "No";

    return 0;
}


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

using namespace std;

typedef long long ll;
typedef vector < long long > vll;
typedef pair < long long, long long > pll;
typedef pair < int, int > pii;
typedef vector < int > vii;

#define rep(i,n) for(int i = 0; i < n; i++)
#define reps(i,a,n) for(int i = a; i < n; i++)
#define inf (1e9 + 7)
#define pb push_back




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

    vector<int> v(n),dp(n);
    for(auto& a: v){
        scanf("%d",&a);
    }
    for(int i=0;i<n;i++){
        dp[i]=inf;
    }
    dp[0]=0;
    for(int i=0;i<n;i++){

            if(i+1<n) dp[i+1]=min(dp[i+1],dp[i]+abs(v[i+1]-v[i]));
            if(i+2<n) dp[i+2]=min(dp[i+2],dp[i]+abs(v[i+2]-v[i]));

    }
    cout<<dp[n-1];





return 0;

}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define mp make_pair
#define si(x) int(x.size())
const int mod=998244353,MAX=6005,INF=1<<30;
ll dp[MAX][MAX][2];

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int N,S;cin>>N>>S;
    vector<int> A(N);
    for(int i=0;i<N;i++) cin>>A[i];
    
    dp[0][0][0]=1;
    dp[N+1][0][1]=1;
    
    for(int i=0;i<N;i++){
        for(int j=0;j<=S;j++){
            dp[i+1][j+A[i]][0]+=dp[i][j][0];
            dp[i+1][j][0]+=2*dp[i][j][0];
            
            dp[i+1][j+A[i]][0]%=mod;
            dp[i+1][j][0]%=mod;
        }
    }
    
    cout<<dp[N][S][0]<<endl;
}




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

int main() {
  int N;
  cin >> N;
  
  int COUNT = 0;
  vector<int> p(N);
  for (int i = 0; i < N; i++) {
    cin >> p.at(i);
    COUNT += p.at(i);
  }
  sort(p.begin(), p.end());
  cout << COUNT-p.at(N-1)/2 << endl;
}

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

int main(){
    int h, w;
    cin >> h >> w;

    int c[10][10];
    for(int i = 0; i < 10; i++){
        for(int j = 0; j < 10; j++){
            cin >> c[i][j];
        }
    }

    int a[h][w];
    int ans = 0;
    int min = 0;
    queue<pair<int, int> > qu;
    for(int i= 0; i < h; i++){
        for(int j = 0; j < w; j++){
            cin >> a[i][j];
            if(a[i][j] != -1 && a[i][j] != 1){
                min = c[a[i][j]][1];
                for(int k = 0; k < 10; k++){
                    if(k != 1){
                        if(min > c[a[i][j]][k]){
                            if(c[a[i][j]][k] != 0){
                                qu.push(make_pair(c[a[i][j]][k], k));
                            }
                        }
                    }
                }

                while(!qu.empty()){
                    pair<int, int> p;
                    p = qu.front();
                    qu.pop();
                    int l = c[p.second][1];
                    l += p.first;
                    if(min > l){
                        min = l;
                    }
                    for(int k = 0; k < 10; k++){
                        if(k != 1){
                            if(min > c[p.second][k] + p.first){
                                if(c[p.second][k] != 0){
                                    qu.push(make_pair(c[p.second][k] + p.first, k));
                                }
                            }
                        }
                    }
                }

                ans += min;
            } 
        }   
    }
    cout << ans << endl;
}

Measured memory_bytes: 384
#include <stdio.h>

long long int gcd(long long int m,long long int n){
    if(m%n==0)
        return n;
    else
        return gcd(n,m%n);
}

int main(){
    long long int a,b;
    scanf("%lld %lld",&a,&b);
    printf("%lld",a*b/gcd(a,b));
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
#define re register
#define int long long
using namespace std;
inline int read(){
	re int t=0;re char v=getchar();
	while(v<'0')v=getchar();
	while(v>='0')t=(t<<3)+(t<<1)+v-48,v=getchar();
	return t;
}
struct edge{
	int to,next,w;
}e[20000002];
int n,m,head[300002],ans,cnt,sum,s;
inline void add(re int x,re int y,re int w){
	e[++cnt].to=y;
	e[cnt].next=head[x];
	head[x]=cnt;
	e[cnt].w=w;
}
struct node{
    int pos,dis;
    bool operator <(const node x)const{
        return dis>x.dis;
    }
}h[300002];
priority_queue <node> q;
bool v[300002];
inline int pos(re int x,re int y){
	return x*(sum+1)+y;
}
inline void dis(re int s){for(re int i=1;i<=pos(n,sum);++i)h[i].dis=1e18,h[i].pos=i;
    h[s].dis=0;
    q.push(h[s]);
    while(!q.empty()){
        while((h[q.top().pos].dis<q.top().dis)){q.pop();if(q.empty())break;
        }
        if(q.empty())break;
        node tmp=q.top();
        q.pop();
        for(re int i=head[tmp.pos];i;i=e[i].next){
            if((tmp.dis+e[i].w)<h[e[i].to].dis){
                h[e[i].to].dis=tmp.dis+e[i].w;
                q.push(h[e[i].to]);
            }
        }
     
    }
}
signed main(){
	n=read();m=read();s=read();
	sum=2500;
	for(re int i=1,x,y,a,b;i<=m;++i){
		x=read();y=read();a=read();b=read();
		for(re int j=a;j<=sum;++j)add(pos(x,j),pos(y,j-a),b),add(pos(y,j),pos(x,j-a),b);
	}
	for(re int x,y,i=1;i<=n;++i){
		x=read();y=read();
		for(re int j=0;j<=sum;++j){
		add(pos(i,j),pos(i,min(j+x,sum)),y);if(j)add(pos(i,j),pos(i,j-1),0);}
	}
	dis(pos(1,min(s,sum)));
	for(re int i=2;i<=n;++i)printf("%lld\n",h[pos(i,0)].dis);
}

Measured memory_bytes: 24368
#include<bits/stdc++.h>
using namespace std;
#define all(vec) vec.begin(),vec.end()
typedef long long int ll;
typedef pair<ll,ll> P;
const ll MOD=1234567;
const ll INF=1000000010;
const ll LINF=1000000000000000010LL;
const int MAX=500010;
const double EPS=1e-3;
int dx[4]={0,1,0,1};
int dy[4]={0,0,1,1};
ll a[300010],sum1[300010],sum2[300010];
int main(){
    int n;cin>>n;
    for(int i=0;i<3*n;i++){
        cin>>a[i];
    }
    priority_queue<ll,vector<ll>,greater<ll>> q1;
    priority_queue<ll> q2;
    for(int i=0;i<n;i++){
        if(i)sum1[i]=sum1[i-1];
        q1.push(a[i]);
        sum1[i]+=a[i];
    }
    for(int i=3*n-1;i>=2*n;i--){
        sum2[i]=sum2[i+1];
        q2.push(a[i]);
        sum2[i]+=a[i];
    }
    for(int i=n;i<2*n;i++){
        sum1[i]=sum1[i-1];
        q1.push(a[i]);
        sum1[i]+=a[i];
        sum1[i]-=q1.top();
        q1.pop();
    }
    for(int i=2*n-1;i>=n;i--){
        sum2[i]=sum2[i+1];
        q2.push(a[i]);
        sum2[i]+=a[i];
        sum2[i]-=q2.top();
        q2.pop();
    }
    
    ll ans=-LINF;
    for(int i=n-1;i<2*n;i++){
        ans=max(sum1[i]-sum2[i+1],ans);
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 8180
a,b,c=map(int, input().split())
k=int(input())

from itertools import product
lis=['0','1','2']
P=product(lis,repeat=k)

for p in P:
    tmp=[a,b,c]
    for j in range(k):
        tmp[int(p[j])]*=2
    if tmp[1]>tmp[0] and tmp[2]>tmp[1]:
        print('Yes')
        exit()

print('No')

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

int main(){
  int N;
  cin >> N;
  
  set<string> S;
  string a;
  for(int i = 0; i < N; i++){
    cin >> a;
    S.insert(a);
  }
  
    cout << S.size() << endl;
     
  
}

Measured memory_bytes: 19228
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstring>
using namespace std;

char str[123456];

int main(void)
{
	scanf("%s", str);
	int n = strlen(str);
	if (str[0] == str[n - 1])
	{
		if (n % 2 == 0)
		{
			printf("First\n");
		}
		else
		{
			printf("Second\n");
		}
	}
	else
	{
		if (n % 2 == 0)
		{
			printf("Second\n");
		}
		else
		{
			printf("First\n");
		}
	}
	return 0;
}


Measured memory_bytes: 384
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
      	//数値の入力
      	int n = sc.nextInt();
		String s = sc.next();
      	int count =0;
      	int index = 0;
      	while(true) {
        index = s.indexOf("R", index) + 1;
        if (index == 0) break;
        count++;
		}
        if(count > n-count){
         System.out.println ("Yes");
        }else{
          System.out.println ("No");
      }
     }
}

Measured memory_bytes: 35632
def getdigit(N):
  cnt = 0
  while(N>0):
    cnt += 1
    N //= 10
  return cnt

N = int(input())
for i in reversed(range(1,int(pow(N, 1/2))+1)):
  if(N % i == 0):
    print(max(getdigit(i), getdigit(N/i)))
    exit()

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,k;
    cin>>n>>k;
    int a[n];
    for(int i=0;i<n;i++)
        cin>>a[i];
    sort(a,a+n);
    int sum = 0;
    for(int i=0;i<k;i++)
        sum += a[i];
    cout<<sum;    
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
#include<numeric>
#include<cstdlib>


 
#define ll long long int
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

#define v vector<long long int> 
#define vv vector< int> 
#define gcd(m,n) __gcd(m,n)

#define vp vector<pair<long long int ,long long int>>
#define pb push_back
#define mp make_pair
#define pp pop_back
#define iter vector<int>::iterator
#define pa pair<long long int ,long long int> 
#define f(i,n) for(int i=0;i<n;i++)

#define fe(d,e) for(auto d:e)
#define mod 1000000007
#define F first
#define S second
#define sett set<long long int>
#define um unordered_map<ll,ll>
#define ordered_set tree<pa, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
// ll mul(ll a,ll b)

using namespace std;
ll power(ll x, unsigned long long  y, ll p)  
{  
    ll res = 1;     // Initialize result  
  
    x = x % p; // Update x if it is more than or  
                // equal to p 
   
    if (x == 0) return 0; // In case x is divisible by p; 
  
    while (y > 0)  
    {  
        // If y is odd, multiply x with result  
        if (y & 1)  
            res = (res*x) % p;  
  
        // y must be even now  
        y = y/2; // y = y/2  
        x = (x*x) % p;  
    }  
    return res;  
} 
int fib(int n) { 
  double phi = (1 + sqrt(5)) / 2; 
  return round(pow(phi, n) / sqrt(5)); 
} 
ll max_subarray_sum(v arr)
{
    ll max_till = -10000000000000;
    ll  val =0;
    f(i,arr.size())
    {
        val+=arr[i];
        max_till = max(max_till,val);
        if (val <0)
        val=0;
    }
    // cout<<"max-till"<<max_till;
    return max_till;


}

void print_vec(v arr){
    f(i,arr.size())
    cout<<arr[i]<<" ";
    cout<<endl;
}


void solve()
{   
   ll n,k;
   cin>>n>>k;
   v arr(n);
   for(auto &x:arr)cin>>x;
   ll ans=0;
   f(i,n){
       if (arr[i]>=k)ans+=1;
   }
   cout<<ans<<endl;
    }











    



int main()
{   fastio;

    
	ll t;
    // ll n,m; 
    // cin>>t;
    t=1;
    f(_,t){
        solve();
    }

     
    



}

    


Measured memory_bytes: 1024
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String o = scan.next();
		String e = scan.next();
		scan.close();

		for(int i=0;i<e.length();i++) {
			System.out.print(o.charAt(i)+""+e.charAt(i));
		}
		System.out.println((o.length()==e.length())? "":o.charAt(o.length()-1));
	}
}

Measured memory_bytes: 21844
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <vector>
#include <map>
using namespace std;

int main(){
    string s;
    int ans=0, zero=0, one=0;
    cin >> s;
    for(int i=0; i<s.size(); i++){
        if(s[i]=='0'){
            zero++;
        }
        if(s[i]=='1'){
            one++;
        }
    }
    ans = min(zero,one)*2;
    cout << ans << endl;
}

Measured memory_bytes: 512
import java.util.*;
 
public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner (System.in);
		int n = sc.nextInt(); int m = sc.nextInt(); int s = 0;
		int[] a = new int[m];
		while (m-- > 0) {
			a[m] = sc.nextInt();
			s+=a[m];
		}
			int v = n-s;
			System.out.println(v >= 0 ? v : "-1");
	}
}

Measured memory_bytes: 46320
using System;

namespace B___Varied
{
    class Program
    {
        static void Main(string[] args)
        {
            var s = Console.ReadLine();
            for(var i=0; i<s.Length-1; i++)
            {
                for(var j=1+i; j<s.Length; j++)
                {
                    if(s[i]==s[j])
                    {
                        Console.WriteLine("no");
                        return;
                    }
                }
            }
            Console.WriteLine("yes");
        }
    }
}

Measured memory_bytes: 11092
# coding: utf-8
# Your code here!
import sys
import math
n=int(input())
ans=n
for i in range(1,int(math.sqrt(n))+1):
    if n%i==0:
        a=i
        b=int(n/i)
        if a+b-2<ans:
            ans=a+b-2
print(ans)
    


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

int main() {
    int n, m;
    cin >> n >> m;
    int si, c;
    vector<int> s(n, 0);
    vector<bool> already(n, false);
    rep(i, m) {
        cin >> si >> c;
        if (already[si - 1] == true && s[si - 1] != c) {
            cout << "-1" << endl;
            exit(0);
        }
        already[si - 1] = true;
        if (si == 1 && c == 0 && n != 1) {
            cout << "-1" << endl;
            exit(0);
        }
        s[si - 1] = c;
    }
    if (s[0] == 0 && n != 1) s[0] = 1;
    if (n == 1) {
        cout << s[0] << endl;
    }
    else if (n == 2) {
        cout << s[0] * 10 + s[1] << endl;
    }
    else if (n == 3) {
        cout << s[0] * 100 + s[1] * 10 + s[2] << endl;
    }
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	int n, m;
	scanf("%d %d", &n, &m);
	int i;
	int s[8], c[8];
	for (i = 0; i < m; i++)
		scanf("%d %d", &s[i], &c[i]);
	int ans[8];
	for (i = 0; i < n; i++)
		ans[i] = -1;
	for (i = 0; i < m; i++)
	{
		if (ans[s[i] - 1] >= 0 && ans[s[i] - 1] != c[i])
		{
			printf("-1\n");
			return 0;
		}
		ans[s[i] - 1] = c[i];
	}
	if (ans[0] == 0)
	{
		if (n > 1)
		{
			printf("-1\n");
			return 0;
		}
	}
	if (ans[0] < 0)
	{
		if (n > 1)
			ans[0] = 1;
		else
			ans[0] = 0;
	}
	for (i = 0; i < n; i++)
	{
		if (ans[i] > 0)
			printf("%d", ans[i]);
		else
			printf("0");
	}
	printf("\n");
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  double a,b,h,m,c;
  cin >> a >> b >> h >> m;
  double pi = 3.1415926535;
  long double ax,ay,bx,by,am,bm,cx,cy;
  bm=m/30;
  am=h/6+bm/12;
  ax=a*cos(pi*am);
  ay=a*sin(pi*am);
  bx=b*cos(pi*bm);
  by=b*sin(pi*bm);
  cx=(ax-bx)*(ax-bx);
  cy=(ay-by)*(ay-by);
  
  c=cx+cy;
  cout << fixed << setprecision(12) << sqrt(c)<< endl;
}

Measured memory_bytes: 4152
/* ex4-1
  kt125 */

#include<stdio.h>

int main(void){
    int number, D; //number本の木
    scanf("%d %d", &number, &D);

    int ans = 0; //answer
    while(number > 0){
        number -= (2*D+1);  //カッコ内は一人の監視員が見れる本数
        ans ++;
    }
    printf("%d", ans);
    return 0;
}

Measured memory_bytes: 128
using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
using static System.Console;
using static System.Math;

class Program
{
    static void Main(string[] args)
    {
        ReadLine();
        WriteLine(ReadLineParseIntArray().Select(x => x - 1).Sum());
    }
    static int ReadLineParseInt() => int.Parse(ReadLine());
    static int[] ReadLineParseIntArray() => ReadLine().Split(' ').Select(int.Parse).ToArray();
}

Measured memory_bytes: 13424
n = int(input())
a = list(map(int, input().split()))
total = 0
for i in range(n):
    a[i] = a[i] - (i + 1)
if n == 1:
    print(0)
    exit()
a.sort()
if n % 2 == 0:
    ave = a[int(n/2)]
    for i in range(n):
        total += abs(a[i] - ave)
    print(total)
else:
    total2 = 0
    ave = a[int(n/2)]
    for i in range(n):
        total += abs(a[i] - ave)
    ave = a[int((n + 1)/2)]
    for i in range(n):
        total2 += abs(a[i] - ave)
    if total2 >= total:
        print(total)
    else:
        print(total2)

Measured memory_bytes: 26020
import java.util.Scanner;

class Main{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		
		String 
				input,
				output = "";
		
	//入力
		input = sc.nextLine();
		
	//文字変換
		//String型をchar型へ変換
		char[] c = new char[input.length()];
		c = input.toCharArray();
		
		for(int i = 0;i < c.length;i++){
			//1文字ずつ大文字変換された文字と比較
			if(c[i] == Character.toUpperCase(c[i])){
				output += Character.toLowerCase(c[i]);
			}else{
				output += Character.toUpperCase(c[i]);
			}
		}
		
	//出力
		System.out.println(output);
		
	}
}



Measured memory_bytes: 31524
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <random>

using namespace std;
 
#define mod 1000000007
#define FOR(x,to) for(int x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define long long long
inline int rei(){int x;cin>>x;return x;}
inline long rel(){long x;cin>>x;return x;}
inline string res(){string x;cin>>x;return x;}
//------------------------------------------------------- 
void Calc(){
	int N = rei();
	int c = 0;
	for(int i=1;i<=N;i++){
		int x = rei();
		if(i != x){
			c++;
		}
	}
	if(c > 2){
		cout << "NO" << endl;
	}
	else{
		cout << "YES" << endl;
	}
}
int main(int argc,char** argv){
	ios::sync_with_stdio(false), cin.tie(0);
	cout.tie(0); Calc(); return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define REP(i, n) for (ll i = 0; i < n; i++)
#define REPR(i, n) for (ll i = n; i >= 0; i--)
#define FOR(i, m, n) for (ll i = m; i < n; i++)
#define FORR(i, m, n) for (ll i = m; i >= n; i--)
#define REPO(i, n) for (ll i = 1; i <= n; i++)
#define ll long long
#define INF (ll)1 << 60
#define MINF (-1 * INF)
#define ALL(n) n.begin(), n.end()
#define MOD 1000000007
#define P pair<ll, ll>

ll n, k;

ll gcd(int a, int b) {
    return (b == 0 ? a : gcd(b, a % b));
}
bool same(long double a,long double b){
    return abs(a - b) < 1e-14;
}
ll x[3100], y[3100];
int main(){
    cin >> n >> k;
    REP(i, n){
        cin >> x[i] >> y[i];
    }
    REP(i, n){
        vector<long double> s;
        FOR(j, i + 1, n){
            long double a = atan2(x[i] - x[j], y[i] - y[j]);
            s.push_back(a);
        }
        sort(ALL(s));
        ll now = 1;
        REP(i, s.size()){
            if (same(s[i], s[i + 1])) now++;
            else now = 1;
            if(now >= k - 1){
                cout << 1 << endl;
                return 0;
            }
        }
    }
    cout << 0 << endl;
}




Measured memory_bytes: 3572
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int maxx = 100005;
int n,m;
struct node{
    int l , r;
};
node a[maxx];
bool cmp(node p1,node p2)
{
    if(p1.r == p2.r)
        return p1.l < p2.l;
    return p1.r < p2.r;
}
int main()
{
    int minr = 1000050;
    scanf("%d %d",&n,&m);
    for(int i=1;i<=m;i++)
    {
        scanf("%d %d",&a[i].l , &a[i].r);
        minr = min(minr , a[i].r);
    }
    int cnt = 1;
    sort(a+1,a+1+m,cmp);
    for(int i=2;i<=m;i++)
    {
        if(a[i].l >= minr){
            minr = a[i].r;
            cnt++;
        }
    }
    cout<<cnt<<endl;


    return 0;
}


Measured memory_bytes: 1024
#include <cstdio>
#include <cmath>

using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);++i)

inline char tc(){
  static char fl[100],*A=fl,*B=fl;
  return A==B&&(B=(A=fl)+fread(fl,1,100,stdin),A==B)?EOF:*A++;  
}
inline int read(){
  int a=0;static char c;
  while((c=tc())<48||c>57);
  while(c>=48&&c<=57)a=a*10+c-48,c=tc();
  return a;
}
int h[100001];
int main(){
  int n=read(),a=read(),b=read();a-=b;
  rep(i,n)h[i]=read();
  int left=0,right=1000000000;
  ll temp,cnt=0,mid;
  while (right>left+1) {
    mid=(right+left)>>1;
    cnt=0;
    rep(i,n){
      temp=h[i]-b*mid+a-1;
      if(temp>a-1)cnt+=temp/a;
    }
    if(cnt<=mid)right=mid;
    else left=mid;
  }
  printf("%d\n",right);
  return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define all(a) (a).begin(),(a).end()
#define rep(i,n) for(ll i=0,i##_len=(n);i<i##_len;i++)
#define rep2(i,a,b) for(ll i=(a),i##_len=(b);i<=i##_len;i++)
#define rrep(i,n) ll i=(n);ll now=-1;while(i--&&(now++||1))
#define Yes(n) cout<<((n)?Yes:No)
#define vll vector<ll>
#define pb push_back
using namespace std;
using ll = long long;

static inline void ignore_ret(int x) {x++;}
template<class T> inline bool chmax(T&a,const T&b){if(a<b){a=b;return true;}return false;}
template<class T> inline bool chmin(T&a,const T&b){if(a>b){a=b;return true;}return false;}
template<class T> inline T gcd_vec(vector<T>v){T r=v.at(0);for(T i=1;i<v.size();i++)r=gcd(r,v.at(i));return r;}
template<class T> inline T lcm_vec(vector<T>v){T r=v.at(0);for(T i=1;i<v.size();i++)r=lcm(r,v.at(i));return r;}
template<class T> inline T factorial(T n){if(n==0)return 1;T r=1;for(T i=2;i<=n;i++)r*=i;return r;}
template<class T> inline T nCr(T n,T k){if(n<k||n<0||k<0)return 0;T r=1;k=min(k,n-k);for(T i=n-k+1;i<=n;i++)r*=i;return r/factorial(k);}
template<class T> inline T dot_product(vector<T>u,vector<T>v){T r=0;for(T i=0;i<u.size();i++)r+=u.at(i)*v.at(i);return r;}
template<class T> inline T sum(vector<T>v){return reduce(all(v),0LL);}

// Template ends here

vector<vll> dp(110, vll(100100, 0));

void solve(ll N, ll W, vector<ll> w, vector<ll> v){
    rep2(i, 1, N) {
        rep2(j, 0, W) {
            dp.at(i).at(j) = dp.at(i - 1).at(j);
            if (j - w.at(i - 1) >= 0) chmax(dp.at(i).at(j), dp.at(i - 1).at(j - w.at(i - 1)) + v.at(i - 1));
        }
    }
    cout << dp.at(N).at(W) << endl;
}

int main() {
    ll N;
    ignore_ret(scanf("%lld",&N));
    ll W;
    ignore_ret(scanf("%lld",&W));
    vector<ll> w(N);
    vector<ll> v(N);
    for(int i = 0 ; i < N ; i++){
        ignore_ret(scanf("%lld",&w[i]));
        ignore_ret(scanf("%lld",&v[i]));
    }
    solve(N, W, move(w), move(v));
    return 0;
}


Measured memory_bytes: 87296
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    scanf("%d",&n);
    string str;
    int i,j=0,k=0,l=0,h=0;
    for(i=0;i<n;i++)
    {
        cin>>str;
        if(str[0]=='A')
            j++;
        else if(str[0]=='W')
            k++;
        else if(str[0]=='T')
            l++;
        else if(str[0]=='R')
            h++;
    }
        printf("AC x %d\n",j);
        printf("WA x %d\n",k);
        printf("TLE x %d\n",l);
        printf("RE x %d\n",h);
    return 0;
}


Measured memory_bytes: 3776
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll (i) = 0; (i) < (n); (i)++)
#define rep1(i, n) for(ll (i) = 1; (i) <= (n); (i)++)
#define rrep(i, n) for(ll (i) = (n) - 1; (i) >= 0; (i)--)
#define rrep1(i, n) for(ll (i) = (n); (i) >= 1; (i)--)
const ll INF = 1145141919;
const ll MOD = 1000000007;
template<class T> void chmax(T &a, const T &b){if(a < b){a = b;}}
template<class T> void chmin(T &a, const T &b){if(a > b){a = b;}}

int main(){

    string s;
    cin >> s;
    ll N = s.size();
    s += "*********";
    vector<ll>dp(s.size() + 10, 0);
    dp[0] = 1;
    rep(i, N){
        if(dp[i] == 0)continue;
        if(s.substr(i, 5) == "dream")dp[i + 5] = 1;
        if(s.substr(i, 7) == "dreamer")dp[i + 7] = 1;
        if(s.substr(i, 5) == "erase")dp[i + 5] = 1;
        if(s.substr(i, 6) == "eraser")dp[i + 6] = 1;
    }
    if(dp[N])cout << "YES" << endl;
    else cout << "NO" << endl;

    return 0;
}

Measured memory_bytes: 1280
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); i++)
#define all(x) (x).begin(),(x).end()
#define dup(x,y) (((x)+(y)-1)/(y))
#define sz(x) (int)(x).size()
#define MOD 1000000007
using namespace std;
typedef long long ll;

int main(){
    int n, a;
    cin >> n >> a;
    if(a >= n%500) puts("Yes");
    else puts("No");
    return 0;
}

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

int main() {
   int N, K;
   cin >> N >> K;
   vector<int> v;
   int tmp;
   for (int i = 0; i < N; i++) {
      cin >> tmp;
      v.push_back(tmp);
   }
   sort(v.begin(), v.end());
   int ans = pow(10, 9) - 1;
   for (int i = K - 1; i < N; i++) {
      int anstmp = v[i] - v[i - K + 1];
      if (anstmp < ans) ans = anstmp;
   }
   cout << ans << endl;
}

Measured memory_bytes: 892
def s()
  gets().chomp
end
def i()
  gets.to_i
end
def li()
  gets.split.map(&:to_i)
end
def ili()
  n = gets.to_i
  as = gets.split.map(&:to_i)
  [n, as]
end
class Array
  def sum
    total = 0
    self.each do |item|
      total += item
    end
    total
  end
end

def eratosthenes(size)
  prime_list = []
  is_prime = Array.new(size, true)
  is_prime[0] = false
  is_prime[1] = false

  2.upto(size-1){|i|
    if is_prime[i]
      prime_list << i
      (2).upto((size.to_f/i).ceil-1){|j|
        is_prime[j*i] = false
      }
    end
  }
  [prime_list, is_prime]
end

def dijkstra(s, e, cost)
  size = cost.length
  if s==e
    return 0
  end
  dp = {}
  dp[s] = 0
  undefined_node = {}
  size.times{|i|
    if i != s
      undefined_node[i] = cost[s][i]
    end
  }
  while undefined_node.length != 0
    min = undefined_node.min_by{|_, v| v}
    stock = {}
    temp = undefined_node.clone
    temp.each{|k, v|
      if min[1] == v
        undefined_node.delete(k)
        if k == e
          return v
        end
        dp[k] = v
        stock[k] = v
      end
    }

    stock.each{|k, v|
      undefined_node.each{|k2, v2|
        undefined_node[k2] = v + cost[k][k2] < v2 ?  v + cost[k][k2] : v2
      }
    }
  end
end

def get_bits(len)
  res =  []
  (2**len).times{|i|
    res << i.to_s(2).rjust(len, '0')
  }
  res
end

tyo = 5000000000000000

s = s()
k = i()
len = 0
s.each_char{|x|
  if x=="1"
    len += 1
  else
    break
  end
}
if k <= len
  puts 1
else
  puts s[len]
end


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

using ll=long long;
const ll MOD=1000000007;

int main() {
  int n;
  string a;
  cin >> n >> a;
  int cnt=0;
  for(int i=0;i<n-2;i++){
    if(a[i]=='A'&&a[i+1]=='B'&&a[i+2]=='C')
      cnt++;
  }
  cout << cnt << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
using namespace std;
int main(){
 
  double a,b,c,d,e,f;
  double X,Y;
  while(cin>>a>>b>>c>>d>>e>>f){
    Y=(c*d-f*a)/(b*d-e*a);
    X=(c-b*Y)/a;

    Y*=10000.0;
    if((int)Y%10>4)Y+=1.0;
    Y/=10000.0;
    X*=10000.0;
    if((int)X%10>4)X+=1.0;
    X/=10000.0;
    printf("%.3f %.3f\n",X,Y);
    
  }
  
}

Measured memory_bytes: 1236
#include<iostream>
    using namespace std;
    int main()
    {
    	string s;
    	int i=0,j=0,k=0;
    	cin>>s;
    	for(;s[i]!='A';++i){
    		
    	}
    	for(j=s.length();s[j]!='Z';j--)
    	{
    	}
    	j++;
    	cout<<j-i<<"\n";
    }

Measured memory_bytes: 888
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int c = scan.nextInt();
		int ans = 0;
		int f = 0;
		int b = c-1;
		int[] a = new int [c]; 
		for(int i = 0;i < c; i++) {
			a[i] = scan.nextInt();
		}
		for(int i = 0;i < c; i++) {
			
			if(ans <= 0) {
				ans += a[f];
				f++;
			}else {
				ans -= a[b];
				b--;
			}
		}
		System.out.println(Math.abs(ans));
	}
}


Measured memory_bytes: 65800
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#define abdelrahman010 ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef long long ll;
using namespace std;
const int N = 2e5 + 5;
int r , c , n , a[N];
int ans[105][105];
int main() {
    abdelrahman010
    cin >> r >> c >> n;
    for(int i = 1;i <= n;i++)
        cin >> a[i];
    int lstr = 0 , lstc = 0 , d = 1;
    for(int i = 1;i <= n;i++) {
        while(a[i]--) {
            ans[lstr][lstc] = i;
            lstc += d;
            if(lstc == c)
                d = -1 , lstc-- , lstr++;
            else if(lstc == -1)
                d = 1 , lstc++ , lstr++;
        }
    }
    for(int i = 0;i < r;i++ , cout << '\n')
        for(int j = 0;j < c;j++)
            cout << ans[i][j] << " ";
    return 0;
}


Measured memory_bytes: 384
import java.util.Scanner;

public class Main {

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

		String s = sc.next();

		int count = 0;
		for (int i = 0; i < s.length(); i++) {
			if (s.charAt(i) == 'o') {
				count++;
			}
		}

		System.out.println(700 + count * 100);

		sc.close();
	}

}




Measured memory_bytes: 21716
#include <bits/stdc++.h>
#include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <random>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define repp(i,n,m) for (int i = m; i < (n); ++i)
#define repl(i,n) for (long long i = 0; i < (n); ++i)
#define reppl(i,n,m) for (long long i = m; i < (n); ++i)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using PL = pair<long long, long long>;
using Pxy = pair<double, double>;
using T = tuple<int, int, bool>;
const int INF = 1001001007;
const int mod = 1000000007;
const int MOD = 998244353;
const ll inf = 1e18;
template <typename AT>
void printvec(vector<AT> &ar){
    rep(i,ar.size()-1) cout << ar[i] << " ";
    cout << ar[ar.size()-1] << endl;
}
template <typename Q>
void printvvec(vector<vector<Q>> &ar){
    rep(i,ar.size()){
        rep(j,ar[0].size()-1) cout << ar[i][j] << " ";
        cout << ar[i][ar[0].size()-1] << endl;
    }
}
template <typename S>
bool range(S a, S b, S x){
    return (a <= x && x < b);
}

void yes(){
    cout << "Yes" << endl;
}

void no (){
    cout << "No" << endl;
}

ll cel (ll a, ll b){
    if (a % b == 0) return a / b;
    else return a / b + 1;
}

ll gcds(ll a, ll b){
    ll c = a % b;
    while (c != 0){
        a = b;
        b = c;
        c = a % b;
    }
    return b;
}

int main() {
    int n; cin >> n;
    ld ans = 0.0;
    rep(i,n){
        ld a; cin >> a;
        string s; cin >> s;
        if (s == "JPY") ans += a;
        else ans += 380000.0 * a;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3820
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
 
//const int dx[] = {1, 0, -1, 0, 1, -1, -1, 1};
//const int dy[] = {0, 1, 0, -1, 1, 1, -1, -1};
 
int main()
{
	int p[3];
	int j[2];
	REP(i, 3) cin >> p[i];
	REP(i, 2) cin >> j[i];

	int pmin = INF;
	REP(i, 3){
		if (pmin > p[i]) pmin = p[i];
	}
	int jmin;
	if (j[0] < j[1]) jmin = j[0];
	else jmin = j[1];

	cout << pmin + jmin - 50 << endl;


}


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

using namespace std;

#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define INF (1LL << 55)
#define MOD (1000 * 1000 * 1000 + 7)
#define maxn 200111

typedef long long ll;
typedef long double ld;

vector<int> water, sugar;
int w[33333], s[33333];

int main(){
	int a, b, c, d, e, f;
	int ans = 0, sug = 0;
	ld perc = -1.0;
	scanf("%d%d%d%d%d%d", &a, &b, &c, &d, &e, &f);

	w[0] = s[0] = 1;
	for(int i = 0; i <= f; i++){
		if(w[i]){
			water.pb(i);
			w[i + 100 * a] = 1;
			w[i + 100 * b] = 1;
		}

		if(s[i]){
			sugar.pb(i);
			s[i + c] = 1;
			s[i + d] = 1;
		}
	}

	for(int v : water){
		int csug = min(f - v, v / 100 * e);
		auto it = upper_bound(sugar.begin(), sugar.end(), csug);
		if(it == sugar.begin())
			continue;
		it--;

		if(*it > (perc * (*it + v))){
			sug = *it;
			ans = *it + v;
			perc = (ld) *it / (1.0 * *it + v);
		}
	}

	printf("%d %d\n", ans, sug);
	return 0;
}

Measured memory_bytes: 256
while True:
    n,m=map(int,input().split())
    if n==0:
        break
    a=[int(input()) for _ in range(n)]
    b=[int(input()) for _ in range(m)]
    a.sort()
    b.sort()
    sumA=sum(a)
    sumB=sum(b)
    def search():
        for i in a:
            for j in b:
                if (i-j)*2==sumA-sumB:
                    print(i,j)
                    return
        print(-1)
    search()


Measured memory_bytes: 5600
n, k = map(int, raw_input().split())

arr = []
for i in xrange(n):
    a = int(raw_input())
    arr.append(a)

arr.sort()
# print arr

min = 1000000001
# res = -1

for i in xrange((n-k)+1):
    diff = arr[i+k-1] - arr[i]

    if diff < min:
        min = diff
        # res = i

print min

Measured memory_bytes: 6208
#include<stdio.h>
#include<stdlib.h>
int main()
{
int a,b,c,d,x,y;
x = a*b;
y = c*d;
scanf("%d%d%d%d",&a,&b,&c,&d);
if(a*b >= c*d)
printf("%d\n", x = a*b);
else if(a*b <= c*d)
printf("%d\n", y = c*d);
return 0;
}


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

char sieve[1000000];

int main (void) {
    int n, i, j, d, s;

    memset(sieve, 0, sizeof(sieve));
    sieve[0] = sieve[1] = 1;
    sieve[2] = 0;
    for (i = 3; i < 1000; i+=2) {
        if (sieve[i] == 0) {
            for (d = i * 2, j = i + d; j < 1000000; j += d) {
                sieve[j] = 1;
            }
        }
    }
    while (scanf("%d", &n) != EOF) {
        if (n < 2) {
            puts("0");
        }
        else if (n == 2) {
            puts("1");
        }
        else {
            for (i = 3, s = 1; i <= n; i+=2) {
                s += sieve[i] == 0;
            }
            printf("%d\n", s);
        }
    }
    return 0;
}

Measured memory_bytes: 1592
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
const int maxn = 1001010;
char a[maxn], b[maxn];
int p[maxn], p1, p2, ff = 1;
int main(){
    scanf("%s", a);
    int len = 0;
    for(int i = 0; a[i] != '\0'; i ++){
        if(a[i] == 'x')
            continue;
        p[++len] = i+1;
        b[len] = a[i];
    }
    p[len+1] = strlen(a) + 1;
    for(int i = 1; i <= len; i ++){
        if(b[i] != b[len-i+1])
            ff = 0;
    }
    if(!ff)
        printf("-1");
    else{
        int ans = 0;
        if(len & 1)
            p1 = p2 = (len + 1)/ 2;
        else
            p1 = len / 2, p2 = len / 2 + 1;
        while(1){
            p1 --;
            p2 ++;
            if(p1 < 0)
                break;
            ans += abs(abs(p[p1] - p[p1+1]) - abs(p[p2] - p[p2-1]));
        }
        printf("%d",ans);
    }
    
    return 0;
}


Measured memory_bytes: 2688
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        a: usize,
        b: usize,
        c: usize,
    }

    println!("{} {} {}", c, a, b);
}


Measured memory_bytes: 4352