akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#include<iostream>
#include<vector>
#include<math.h>
#include<queue>
using namespace std;
int main(){
 int hy,wx,i,j,white=0;
 scanf("%d%d ",&hy,&wx);
 char s[51][51];//配列はx,yの順に入れる
 for(i=1;i<=hy;i++){
  for(j=1;j<=wx+1;j++){
   scanf("%c",&s[j][i]);
   if(s[j][i]=='.')white++;
  }
 }

 bool visited[55][55]={0};
 int num[55][55]={0};
 queue<int>quex,quey;
 int u,v;
 visited[1][1]=1;
 quex.push(1);quey.push(1);
  
 while(!quex.empty()){
  u=quex.front();
  v=quey.front();
  quex.pop();quey.pop();
  
  if(u==wx&&v==hy){
  // printf("white %d num %d\n",white,num[u][v]);
   printf("%d\n",white-num[u][v]-1);
   return 0;
  }
   
  for(i=u-1;i<=u+1;i++){//x
   for(j=v-1;j<=v+1;j++){//y
    if((i!=u&&j!=v)||(i==u&&j==v))continue;
    if(visited[i][j]||s[i][j]!='.')continue;
    visited[i][j]=1;
    num[i][j]=num[u][v]+1;
  //  printf("i %d j %d num %d\n",i,j,num[i][j]);
    quex.push(i);quey.push(j);
   }
  }
 }
  
 puts("-1");
return 0;}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    int K, N;
    cin >> K >> N;
    vector<int> A(N);
    int maxz = -1;
    int maxi = 70000000;
    for (int i = 0; i < N; i++)
    {
        cin >> A[i];
    }
    for (int i = 0; i < N-1;i++)
    {
        if (maxz < A[i + 1] - A[i])
        {
            maxz = A[i + 1] - A[i];
            maxi = i;
        }
    }
    if(maxz  < K-A[N-1] + A[0]){
        maxz = K - A[N - 1] + A[0];
        maxi = N - 1;
    }
    cout << K - maxz << endl;
}


Measured memory_bytes: 1024
/* _________________________________________________________________________________________________
  |                                                                                                 |
  |                             Author      : Aditya Ahuja                                          |
  |                             Date        : Thu, 20th Jun 2019                                    |
  |_________________________________________________________________________________________________|
*/
 
#include<bits/stdc++.h>
using namespace std;

#define int long long

#define pb          push_back
#define F           first
#define S           second
#define rep(i,a,b)  for(int i=a; i<b; i++)
#define all(a)      (a).begin(),(a).end()
#define ret(x)      {cout << (x) << endl; return;}
#define sz(x)       (int)x.size()
#define type(x)     typeid(x).name()

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

#define wa(x)       cout << (#x) << " -------- " << (x) << endl
#define pvi(v)      {for(auto it:v) cout << it << " "; cout << endl;}
#define line1	    printf("---------------------------\n")

// #define wa //
// #define line1 //
// #define pvi //
// #define printf //

void solve();
signed main() {
	//ios_base::sync_with_stdio(false); cin.tie(NULL);
	////cout << fixed << setprecision(10);

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

//___________________________________________________________________________________________________
int mod = 1e9  + 7;

int o(int in){
	return in%mod;
}

void solve() {

	int n,m;
	cin >> n >> m;

	vii g(n, vi(m,0));

	rep(i,0,n){
		rep(j,0,m){
			char t;
			cin >> t;
			if(t == '#') g[i][j] = -1;
		}
	}

	g[0][0] = 1;

	rep(i,1,m){
		if(g[0][i] == -1) break;
		else g[0][i] = 1;
	}

	rep(i,1,n){
		if(g[i][0] == -1) break;
		else g[i][0] = 1;
	}

	rep(i,1,n){
		rep(j,1,m){
			if(g[i][j] == -1) continue;
			g[i][j] = 0;
			if(g[i-1][j] != -1) g[i][j] = o(g[i][j] + g[i-1][j]);
			if(g[i][j-1] != -1) g[i][j] = o(g[i][j] + g[i][j-1]);
		}
	}

	// for(auto x:g) pvi(x);
	ret(g[n-1][m-1]);
}


Measured memory_bytes: 8064
h,w,k = (int(a) for a in input().split())
g = [list(input()) for _ in range(h)]
ans = 0

for i in range(2**h) :
    for j in range(2**w) :
        c = 0
        for x in range(h) :
            for y in range(w) :
                if 2 ** x & i > 0 and 2 ** y & j > 0 :
                    if g[x][y] == "#" :
                        c += 1
        if c == k :
            ans += 1

print(ans)

        


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

using namespace std;

#define ll long long


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

	vector<vector<int>> graph(n + 1);

	for (int i = 2; i <= n; i++) {
		int parent;
		cin >> parent;

		graph[parent].push_back(i);
	}

	for (int i = 1; i <= n; i++) {
		cout << graph[i].size() << endl;
	}
}

Measured memory_bytes: 14020
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define gcd __gcd
#define ff first
#define ss second
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vec(cr)vector<cr>
#define fr(j, n)for(int i=j; i<n; i++)
#define scan(cr)for(auto &it:cr)cin >> it
#define all(cr)cr.begin(), cr.end()
#define sz(cr)cr.size()
#define Test() int t; for(cin >> t; t>0; t--)
#define deb(x)cout << #x << ":" << x << '\n'
int lcm(int a, int b){ return a/gcd(a, b) * b; }

int main(){
	int n, ans=0, i, j, k; cin >> n;
	vi v(n); scan(v);
	for(i=0; i<n; i++){
		for(j=i+1; j<n; j++){
			for(k=j+1; k<n; k++){
				if(i==j || i==k || j==k)continue;
				if(v[i]==v[j] || v[i]==v[k] || v[j]==v[k])continue;
				if(v[i]+v[j]>v[k] && v[i]+v[k]>v[j] && v[j]+v[k]>v[i])ans++;
			}
		}
	}
	cout << ans;
	return 0;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define REP(i,a,b) for(int i=(a);i<(b);i++)
#define RREP(i,a,b) for(int i=(a);i>=(b);i--)
#define pq priority_queue
#define P pair<int,int>
#define P2 pair<int,P>
#define P3 pair<int,P2>
typedef long long ll; typedef long double ld;
using namespace std;
const int INF=1e9, MOD=1e9+7, around[]={0,1,1,-1,-1,0,-1,1,0,0};
const int vx[]={1,0,-1,0}, vy[]={0,1,0,-1};
const ll LINF=1e18;
const ld PI=abs(acos(-1));

ll p[55], fact[55], comb[55][55];

void make_comb(){
	REP(i,0,51){
		REP(j,0,i+1){
			if(!j or i == j) comb[i][j] = 1;
			else comb[i][j] = comb[i - 1][j - 1] + comb[i - 1][j];
		}
	}
}
	
int main(){
	int n,a,b; cin >> n >> a >> b;
	REP(i,0,n) cin >> p[i]; sort(p, p + n); reverse(p, p + n);
	
	ld pos = 0, ma = 0.0, mat = INF;
	REP(i,0,b){
		pos += p[i];
		if(i + 1 >= a and pos * mat > ma * (i + 1)){
			ma = pos;
			mat = i + 1;
		}
	}
	
	make_comb();
	pos = 0; ll pot, c = 0, count = 0;
	REP(i,0,b){
		pos += p[i];
		if(pot != p[i]) pot = p[i], c = 1;
		else c++;
		
		if(i + 1 >= a and pos * mat == ma * (i + 1)){	
			ll cou = 0;
			REP(i,0,n) if(pot == p[i]) cou++;
			
			count += comb[cou][c];
		}
	}
	
	cout << fixed << setprecision(10);
	cout << (ld)ma / (ld)mat << endl;
	cout << count << endl;
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
int main()
{
	char s[101][11];
	int n, i, j, l,m;
	scanf("%d %s", &n,s[0]);
	l=strlen(s[0]);
	for(i=1; i<n; i++)
	{
		scanf("%s", s[i]);
		if(s[i][0] != s[i-1][l-1])
		{
			printf("No\n");
			return 0;
		}
		for(j=0; j<i; j++)
			if(strcmp(s[j], s[i])==0)
			{
				printf("No\n");
				return 0;
			}
		l = strlen(s[i]);
	}
	printf("Yes\n");
	return 0;
}

Measured memory_bytes: 760
# -*- coding: utf-8 -*-
"""
http://tenka1-2017-beginner.contest.atcoder.jp/tasks/tenka1_2017_a

"""
import sys
from sys import stdin
input = stdin.readline


def main(args):
    S = input().strip('\n')
    print(S.count('1'))


if __name__ == '__main__':
    main(sys.argv[1:])
    


Measured memory_bytes: 2940
#include <iostream>
#include <set>
#include <map>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <deque>
#include <stack>
#include <climits>
#include <math.h>
#include <cassert>
#include <unordered_map>
#include <chrono>
#include <random>
#include <ctime>
using namespace std;
#pragma warning(disable : 4996)
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

const ld PI = 3.14159265358979323846;
const ll MOD = 1e9 + 7;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());



int main() {
#ifdef _DEBUG
	freopen("input1.txt", "r", stdin);
	freopen("output2.txt", "w", stdout);
#endif
	srand(time(0));
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin >> n;
	vector<int> have(1e6 + 10), done(1e6 + 10);
	for (int i = 0; i < n; i++) {
		int x;
		cin >> x;
		have[x]++;
	}
	int ans = n;
	for (int i = 1; i <= 1e6; i++) {
		if (have[i] && !done[i]) {
			if (have[i] > 1) {
				ans -= have[i];
			}
			for (int j = 2 * i; j <= 1e6; j += i) {
				if(!done[j])ans -= have[j];
				done[j] = 1;
			}
		}
	}
	cout << ans;
}

Measured memory_bytes: 11184
import math

A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())

a = math.ceil(A/10) * 10 - A
b = math.ceil(B/10) * 10 - B
c = math.ceil(C/10) * 10 - C
d = math.ceil(D/10) * 10 - D
e = math.ceil(E/10) * 10 - E

time = math.ceil(A/10) * 10 + math.ceil(B/10) * 10 + math.ceil(C/10) * 10 + math.ceil(D/10) * 10 + math.ceil(E/10) * 10 - max(a,b,c,d,e)
print(time)


Measured memory_bytes: 3064
#include <functional>
#include <algorithm>
#include <iostream>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <tuple>
#include <set>
#include <map>

#define FOR0(var, max) for (ul (var) = 0; (var) < (max); ++(var))
#define FORi(var, min, max) for (ul (var) = (min); (var) < (max); ++(var))
#define FORi_INV(var, min, max) for (ul (var) = (max) - 1; (var) + 1 > (min); --(var))
#define FORITER(var, iter) for (auto (iter) = (var).begin(); (iter) != (var).end(); (iter)++)
#define FORITER_INV(var, iter) for (auto (iter) = (var).rbegin(); (iter) != (var).rend(); (iter)++)

#define LTLT(a, b, c) (((a) < (b)) && ((b) < (c)))
#define LELT(a, b, c) (((a) <= (b)) && ((b) < (c)))
#define LTLE(a, b, c) (((a) < (b)) && ((b) <= (c)))
#define LELE(a, b, c) (((a) <= (b)) && ((b) <= (c)))

using namespace std;

using uc = unsigned char;
using ui = unsigned int;
using ul = unsigned long long int;

using sc = signed char;
using si = signed int;
using sl = signed long long int;

template <class T>
T gcd(T a, T b) {
  while (b) {
    T t = a % b;
    a = b;
    b = t;
  }
  return a;
}

/* (identity element, operation) */
template <class T>
using Monoid = pair<T, function<T(T, T)>>;

template <class T, ul K>
class SegmentTree {
  const Monoid<T> monoid;
  const ul N = (1 << K);
  T tree[2 * (1 << K) - 1];

  ui parent(ui i) {
    if (i == 0) {
      return 0;
    }
    return (i - 1) / 2;
  }

  ui child1(ui i) {
    return i * 2 + 1;
  }

  ui child2(ui i) {
    return i * 2 + 2;
  }

  bool is_leaf(ui i) {
    return (N - 1 <= i);
  }

  void propagate_from_leaf(ui i) {
    ui cur = N - 1 + i;
    while (cur != 0) {
      cur = parent(cur);
      auto x1 = tree[child1(cur)];
      auto x2 = tree[child2(cur)];
      tree[cur] = monoid.second(x1, x2);
    }
  }

  T query_impl(ui a, ui b, ui k, ui l, ui r) {
    if (r <= a || b <= l) {
      return monoid.first;
    } else if (a <= l && r <= b) {
      return tree[k];
    } else {
      auto ta = query_impl(a, b, child1(k), l, (l + r) / 2);
      auto tb = query_impl(a, b, child2(k), (l + r) / 2, r);
      return monoid.second(ta, tb);
    }
  }
public:
  /* Initialize Segment Tree with Monoid `_monoid` */
  SegmentTree(const Monoid<T>& _monoid) : monoid(_monoid) {
    FOR0(i, 2 * (1 << K) - 1) {
      tree[i] = monoid.first;
    }
  }

  void update(ui i, T x) {
    tree[N - 1 + i] = x;
    propagate_from_leaf(i);
  }

  // [a, b)
  T query(ui a, ui b) {
    return query_impl(a, b, 0, 0, N);
  }
};

const string seq[3] = {"Sunny", "Cloudy", "Rainy"};

string S;

void solve(void) {
  FOR0(i, 3) {
    if (S == seq[i]) {
      cout << seq[(i + 1) % 3] << endl;
    }
  }
}

int main(void) {
  cin >> S;
  solve();
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define mod 1000000007
#define dbg(n) cout<<#n<<' '<<n<<endl;
int main(){ 
	string s,t;
	cin>>s>>t;
	int c=0;
	for(int i=0;i<(int)s.length();i++){
		if(s[i]!=t[i])c++;	
	}
	cout<<c<<endl;
	
}



Measured memory_bytes: 3916
#include<stdio.h>

void trace(int A[], int N) {
    int i;
    for (i = 0; i < N; i++) {
        if (i > 0) printf(" ");
        printf("%d", A[i]);
    }
    printf("\n");
}

void insertionSort(int A[], int N) {
    int j, i, v;
    for (i = 1; i < N; i++) {
        v = A[i];
        j = i - 1;
        while (j >= 0 && A[j] > v) {
            A[j + 1] = A[j];
            j--;
        }
        A[j + 1] = v;
        trace(A, N);
    }
}

int main() {
    int N, i, j;
    int A[100];

    scanf("%d", &N);
    for (i = 0; i < N; i++) scanf("%d", &A[i]);

    trace(A, N);
    insertionSort(A, N);

    return 0;
}

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

int w, v;
map<int, int> f[100];
int main() {
    int N, W;
    int s = 0;
    cin >> N >> W;
    f[0][0] = 0;
    for (int i = 0; i < N; i++) {
        cin >> w >> v;
        f[i+1] = f[i];
        for (pair<int, int> j: f[i]) {
            if (j.first + w <= W) {
                int k = max(f[i+1][j.first + w], j.second + v);
                f[i+1][j.first+w] = k;
                if (k > s)
                    s = k;
            }
        }
    }
    cout << s << endl;
    return 0;
}


Measured memory_bytes: 4864
import java.math.*;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long h = sc.nextInt();
        long w = sc.nextInt();
        long ans = h * w;
        if (h == 1 || w == 1) {
            ans = 1;
        }
        else {
            if (ans % 2 == 1)
                ans++;
            ans /= 2;
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 21716
#include <stdio.h>

int main() {
    int n;
    int ans[4] = {0,0,0,0};
    scanf("%d",&n);
    for(int i = 0;i <= n;i++){
        char tmp[4];
        gets(tmp);
        switch(tmp[0]){
            case 'A':
                ans[0]++;
                break;
            case 'W':
                ans[1]++;
                break;
            case 'T':
                ans[2]++;
                break;
            case 'R':
                ans[3]++;
                break;
        }
    }
    printf("AC x %d\n",ans[0]);
    printf("WA x %d\n",ans[1]);
    printf("TLE x %d\n",ans[2]);
    printf("RE x %d\n",ans[3]);
    return 0;
}


Measured memory_bytes: 1776
def change(a,b,c):
    a1=b//2+c//2
    b1=a//2+c//2
    c1=a//2+b//2
    return a1,b1,c1
a,b,c = map(int,input().split())
if a==b and b==c and a%2==0:
    print(-1)
    exit()
cnt=0
while a%2==0 and b%2==0 and c%2==0:
    a,b,c=change(a,b,c)
    cnt+=1
    if a==b and b==c and a%2==0:
        print(-1)
        exit()
print(cnt)


Measured memory_bytes: 3064
import Control.Monad
import Control.Applicative

main = do
  [a,b,c,x,y] <- map read . words <$> getLine
  print $ solve a b c x y

solve a b c x y = if a+b <= 2*c
  then a*x + b*y
  else 2 * c * min x y + let
    (z,d) = if x<y then (y-x,b) else (x-y,a)
    in if d <= 2*c then d*z else 2*c*z


Measured memory_bytes: 508
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;
int main()
{
	int n;
	cin >> n;

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

	int ans = 0;
	int cnt = 0;

	for (int i = n - 2; i >= 0; i--)
	{
		if (arr[i] >= arr[i + 1])
		{
			cnt++;
		}
		else
		{
			ans = max(ans, cnt);
			cnt = 0;
		}
	}

	ans = max(ans, cnt);

	cout << ans << endl;
}

Measured memory_bytes: 764
#include <iostream>
#include <algorithm>
#include <map>
#include <string>
#define Z(z)m[a+b]=1;m[b+a]=1;reverse(z.begin(),z.end());
using namespace std;
int main(){
	int i,j=0,n;
	for(cin>>n;j<n;j++){
		string s,a,b;cin>>s;map<string,int> m;
		for(i=1;i<s.length();i++){
			a=s.substr(0,i),b=s.substr(i);
			Z(a)Z(b)Z(a)Z(b)
		}
		cout<<m.size()<<endl;
	}
}

Measured memory_bytes: 1300
#include<bits/stdc++.h>
using namespace std;
constexpr int64_t mod=1e9+7;

int main()
{
  int64_t n,cnt=0;
  cin>>n;
  vector<int64_t> a(n);
  for (int i = 0; i < n; ++i)
  {
    cin>>a[i];
  }
  a.emplace_back(0);
  for (int i = 0; i < n; ++i)
  {
    if(a[i]%2==0){
      cnt+=a[i]/2;
      continue;
    }
    cnt+=(a[i]-1)/2;
    if(a[i+1]>0){
      cnt++;
      a[i+1]--;
    }
  }
  cout<<cnt;
}

Measured memory_bytes: 1792
#include <iostream>

using namespace std;

int main() {
	int x; cin >> x;
	int delta = 1;
	while (1LL * delta * (delta + 1) / 2 <= x) {
		delta++;
	}
	delta--;

	cout << delta + (1LL * delta * (delta + 1) / 2 != x) << '\n';
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mod 1000000007
#define pb push_back
#define ll long long
#define mp make_pair
using namespace std;
int main(){
	ll n,k;
	cin>>n>>k;
	ll rev = 0;
	for(int i=1;i<=n;i++){
		if(i<=k){
			rev += (n+1);
		}
		else{
			ll sh = (n+1)/i;
			ll am = (n+1)%i;
			rev += k * sh;
			rev += min(am,k);
		}
	}
	if(k==0)rev = n;
	cout<<n*(n+1)-rev<<endl;
	return 0;
}

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

#define ll long long int
#define str string
#define ALL(a)  (a).begin(),(a).end()
#define P pair<ll,ll>

using Graph = vector<vector<int>>;

const int dy[] = { 0, 0, 1, -1 }, dx[] = { 1, -1, 0, 0 };
ll INFL = 1ll << 60, INF = 1 << 30, mod = 1e9 + 7, Min = INFL, Max = -1;
ll a, b, c, d,n, sum, A[500010], B[500000], rui[500000], dp[5000];
str S, T, U; bool check = true;	vector<ll> v;
map<ll,ll> m;


int main() {
	//Code Line
cin >> n;
for(int i = 0;i < n;i++){
cin >> A[i];
if((i+1) % 2 == 1 && A[i] % 2 == 1)sum++;
}

cout << sum << endl;
	return 0;
}


Measured memory_bytes: 3616
/***********************************************************
 *This code By @1353055672(Ligen)                          *
 *[Warning]You're not excepted to understand this code!    *
 *STOI GDOI APIO CTS NOIP 2019 RP++                        *
 ***********************************************************/
//#pragma GCC optimize(3)
//#pragma comment(linker, "/STACK:102400000,102400000")
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<queue>
#include<map>
#include<stack>
#include<set>
#include<bitset>
#include<ctime>
#include<vector>
#define ll long long
#define ull unsigned long long
#define mn 200020
#define Max(x,y) ((x>y)?x:y)
#define Min(x,y) ((x<y)?x:y)
#define Abs(x) (((x)<(0))?(-(x)):(x))
#define infll (ll)(1e18)
#define infint (int)(1<<30)
#define mod (int)(1e9+7)
#define FOR(a,b,c) for (register ll a=b;a<=c;a++)
#define FORD(a,b,c) for (register ll a=b;a>=c;a--)
using namespace std;
inline ll read(){
    ll x=0,f=1;char c;
    for(c=getchar();c<'0'||c>'9';f=((c=='-')?-1:f),c=getchar());
    for(;c>='0'&&c<='9';x=x*10+c-'0',c=getchar());return x*f;
}

template<typename T>
inline void write(T a){
    if(a==0){putchar('0');return;}if(a<0)putchar('-'),a=-a;char c1[120];int h=0;
    while(a)c1[++h]=a%10+'0',a/=10;FORD(i,h,1)putchar(c1[i]);
}
inline void write_(){return;}
template<typename T,typename... Args>
inline void write_(T a,Args... b){write(a);putchar(' ');write_(b...);}
inline void writeln(){putchar('\n');return;}
template<typename T,typename... Args>
inline void writeln(T a,Args... b){write(a);putchar(' ');writeln(b...);}
//need c++11

//inline void write(ll a){
//    if(a==0){putchar('0');return;}if(a<0)putchar('-'),a=-a;char c1[120];int h=0;
//    while(a)c1[++h]=a%10+'0',a/=10;FORD(i,h,1)putchar(c1[i]);
//}
//inline void write_(ll a){write(a);putchar(' ');}
//inline void writeln(ll a){write(a);putchar('\n');}

inline ll gcd(ll a,ll b){return a==0?b:gcd(b%a,a);}
inline ll lcm(ll a,ll b){return 1ll*a/gcd(a,b)*b;}
inline ll Pow(ll n,ll a){ll b=1;while(a){if(a&1)b=1ll*b*n%mod;n=1ll*n*n%mod;a>>=1;}return b;}
//---------------------Head Files--------------------------//
char s[120];
int n;
signed main(){
	scanf("%s",s+1);
	n=strlen(s+1);
	int ans=15-n;
	FOR(i,1,n)if(s[i]=='o')++ans;
	if(ans>=8)puts("YES");else puts("NO"); 
    return 0;
}


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

int main(){
	int n,k,i,ans = 0;
	cin >> n;
	cin >> k;
	int h[n];
	for(i = 0; i < n; i++){
		cin >> h[i];
	}
	sort(h, h+n);

	for(i = n-1; i >= 0; i--){
		if(h[i] < k){
			break;
		}
		ans++;
	}

	cout << ans;
	return 0;
}


Measured memory_bytes: 640
N,x = map(int,input().split())
if x == 1 or x == 2*N-1:
    print("No")
else:
    lis = [0 for _ in range(2*N-1)]
    lis[N-1] = x
    lis[N] = x-1
    lis[N-2] = x+1
    count = 1
    for i in range(2*N -1):
        if count == x-1:
            count = x+2
        if abs(N-i-1) <= 1:
            None
        else:
            lis[i] = count
            count+=1
    print("Yes")
    for j in lis:
        print(j)

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

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

    vector<double> x(n);
    vector<string> u(n);
    double ans = 0.0;
    for (int i = 0; i < n; i++)
    {
        cin >> x[i] >> u[i];
    }
    for (int i = 0; i < n; i++)
    {
        if (u[i] == "BTC")
        {
            x[i] *= 380000.0;
        }
        ans += x[i];
    }
    
    cout << ans << endl;
}

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


int main() {
  int N, D, X;
  cin >> N >> D >> X;
  int A[N];
  int cnt = N;
  for(int i = 0; i < N; i++) cin >> A[i];
  for(int i = 1; i <= D; i++){
    for(int j = 0; j < N; j++){
      if(i-1 > 0 && (i-1)%A[j]==0){
        cnt++;
      }
    }
  }
  cout << cnt+ X << endl;
}


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


public class Main {

	private static Scanner sc;
	private static Printer pr;

	private static void solve() {
		Prime prime = new Prime(55555);

		int n = sc.nextInt();

		List<Integer> ans = new ArrayList<>();
		for (int p : prime) {
			if (ans.size() >= n) {
				break;
			}

			if (p % 10 == 1) {
				ans.add(p);
			}
		}

		for (int i = 0, size = ans.size(); i < size; i++) {
			if (i > 0) {
				pr.print(' ');
			}
			pr.print(ans.get(i));
		}
		pr.println();
	}

	static class Prime implements Iterable<Integer> {
		private int n;
		private BitSet p;

		Prime(int n) {
			this.n = n;

			p = new BitSet(n / 2);
			int m = (int)Math.sqrt(n);

//			for (int i = 1; i <= m; i++) {
			for (int bi = p.nextClearBit(0); 2 * (bi + 1) + 1 <= m; bi = p.nextClearBit(bi + 1)) {
				long i = bi + 1;
//				if (p.get(i - 1)) {
//					continue;
//				}

				for (long j = 2 * i * (i + 1); 2 * j + 1 <= n; j += 2 * i + 1) {
					p.set((int)(j - 1));
				}
			}
		}

		boolean isPrime(int n) {
			if (n == 2) {
				return true;
			}

			if (n == 1 || (n & 0x1) == 0) {
				return false;
			}

			return !p.get(n / 2 - 1);
		}

		List<Integer> getPrimeList() {
			List<Integer> ret = new ArrayList<>();
			for (int p : this) {
				ret.add(p);
			}

			return ret;
		}

		Map<Long, Integer> primeFactorize(long x) {
			Map<Long, Integer> hm = new TreeMap<>();
			long n = x;
			for (int p : this) {
				if ((long)p * p > n) {
					break;
				}
				int cnt = 0;
				while (n % p == 0) {
					cnt++;
					n /= p;
				}
				if (cnt > 0) {
					hm.put((long)p, cnt);
				}
			}
			if (n != 1) {
				hm.put(n, 1);
			}

			return hm;
		}

		@Override
		public Iterator<Integer> iterator() {
			return new PrimeIterator();
		}

		private class PrimeIterator implements Iterator<Integer> {
			int index;

			PrimeIterator() {
				index = -1;
			}

			@Override
			public boolean hasNext() {
				if (index == -1) {
					return n >= 2;
				} else {
					return 2 * (index + 1) + 1 <= n;
				}
			}

			@Override
			public Integer next() {
				if (index == -1) {
					if (n >= 2) {
						index = p.nextClearBit(0);
						return 2;
					} else {
						throw new NoSuchElementException();
					}
				} else {
					int ret = 2 * (index + 1) + 1;

					if (ret <= n) {
						index = p.nextClearBit(index + 1);

						return ret;
					} else {
						throw new NoSuchElementException();
					}
				}
			}
		}

		static boolean isPrime(long n) {
			if (n == 2) {
				return true;
			}

			if (n == 1 || (n & 0x1) == 0) {
				return false;
			}

			for (long i = 3; i * i <= n; i += 2) {
				if (n % i == 0) {
					return false;
				}
			}

			return true;
		}
	}

	// ---------------------------------------------------
	public static void main(String[] args) {
		sc = new Scanner(INPUT == null ? System.in : new ByteArrayInputStream(INPUT.getBytes()));
		pr = new Printer(System.out);

		solve();

//		pr.close();
		pr.flush();
//		sc.close();
	}

	static String INPUT = null;

	private static class Printer extends PrintWriter {
		Printer(OutputStream out) {
			super(out);
		}
	}
}


Measured memory_bytes: 21588
#include<stdio.h>
#pragma warning (disable:4996)
int main()
{
	int a, b;
	while (scanf("%d%d", &a, &b) != EOF)
	{
		int  n = 1;
		while (a--)
		{
			if (n < b)n*=2;
			else n += b;
		}
		printf("%d", n);
	}
}

Measured memory_bytes: 128
//Multiplication 3

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define int long long
#define rep(i,x,y) for(ll i=x;i<y;i++)
#define irep(i,a) for(auto i = a.begin(); i != a.end(); ++i)
#define nvarep(n,a) ll n;cin>>n;vector<ll>a(n);rep(i,0,n)cin>>a[i]
#define vecrep(n,a,type) vector<type>a(n);rep(i,0,n)cin>>a[i]
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a/__gcd(a, b)*b)
#define range(a) (a).begin(),(a).end() 
#define pb push_back
#define mp make_pair
#define nnn "\n"
#define spa " "
#define cout15(a) printf("%.15f\n",a)
template<class T>inline bool chmin(T& a,T b,bool f){
if(f==1){if(a>b){a=b;return true;}return false;}
else if(f==0){if(a<b){a=b;return true;}return false;}return false;}
typedef pair<ll,string> p;
using g = vector<vector<ll>>;
const int inf = 2147483647;//2*10^9
const ll INF = 9223372036854775807;//9*10^18

signed main (){
    ll a;
    ld b;
    cin>>a>>b;
    
    cout<<(ll)(a*b)<<nnn;
    return 0;
}

Measured memory_bytes: 3728
from itertools import product

d, g = map(int, input().split())
prob = []
for i in range(1, d + 1):
    p, c = map(int, input().split())
    prob.append((i * 100, p, c))  # score, num, bonus

ans = 1000000000
# repeatは
for prd in product([0, 1], repeat=d):
    cnt = 0
    allScore = 0
    for j, (score, num, bonus) in zip(prd, prob):
        if j == 1:
            cnt += num
            allScore += score * num + bonus

    if allScore < g:
        for j, (score, num, bonus) in zip(prd, prob):
            if j == 0 and (score * num >= g - allScore):
                rest = (g - allScore) // score
                cnt += rest
                allScore += score * rest
                break

    if allScore >= g:
        ans = min(ans, cnt)

print(ans)


Measured memory_bytes: 3188
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		while(true) {
			int n = stdIn.nextInt();
			if(n == 0) break;
			int w = stdIn.nextInt();
			int h = stdIn.nextInt();
			w++;
			h++;
			boolean[][] map = new boolean[h][w];
			for(int i = 0; i < n; i++) {
				int x = stdIn.nextInt();
				int y = stdIn.nextInt();
				map[y][x] = true;
			}
			
			int s = stdIn.nextInt();
			int t = stdIn.nextInt();
			int count = 0;
			for(int i = 0; i <= h - t; i++) {
				for(int j = 0; j <= w - s; j++) {
					int precount = 0;
					for(int k = 0; k < t; k++) {
						for(int l = 0; l < s; l++) {
							if(map[i+k][j+l]) {
								precount++;
							}
						}
					}
					if(precount > count) {
						count = precount;
					}
				}
			}
			System.out.println(count);
		}
	}
 }

Measured memory_bytes: 35696
import java.util.Scanner;

public class Main {

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

		int max = 999999;
		int tmp;
		int c=0;
		for(int i = 0; i < n; i++) {
			tmp= sc.nextInt();
			if(tmp < max) {
				max = tmp;
				c++;
			}
		}

		System.out.println(c);
        return;
    }

}



Measured memory_bytes: 65156
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int N=1e5+2;
pair<int,pair<int,int> > query[N];
int head[N];
int findd(int x){
	if(head[x]<0){
		return x;
	}
	return head[x]=findd(head[x]);
}
void unionn(int x,int y){
	x=findd(x),y=findd(y);
	if(x==y){
		return;
	}
	head[x]+=head[y];
	head[y]=x;
}
signed main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n,i,j,k,l,m,q;
	cin>>n>>m>>q;
	for(i=1;i<=q;i++){
		cin>>j>>k>>l;
		query[i]={l,{j,k}};
	}
	sort(query+1,query+1+q);
	for(i=1;i<=n;i++){
		head[i]=-1;
	}
	for(i=1;i<=q;i++){
		j=query[i].second.first+1,k=query[i].second.second+1;
		if(query[i].first==0){
			unionn(j,k);
		}
		else{
			if(m==n-1){
				cout<<"No";
				return 0;
			}
			if(findd(j)==findd(k)){
				cout<<"No";
				return 0;
			}
		}
	}
	if(m==n-1){
		cout<<"Yes";
		return 0;
	}
	j=0;
	for(i=1;i<=n;i++){
		if(i==findd(i)){
			j++;
		}
	}
	if(j==2||m>j*(j-3)/2+n){
		cout<<"No";
		return 0;
	}
	cout<<"Yes";
}

Measured memory_bytes: 6780
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(x) (x).begin(),(x).end()
#define LL long long
#define pii pair<int,int>
#define pll pair<LL,LL>

using namespace std;

int main(){

    LL N,M;cin>>N>>M;
    LL ans = (1<<M)*(100*(N-M)+1900*M);
    cout<<ans<<endl;

    return 0;
}

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

int main() {
  int N,S1=0,S2=0,S3=0,A=1000;
  cin >> N;
  int W[N];
  for(int i=0; i<N; i++) {
    cin >> W[i];
    S1+=W[i];
  }
  for(int i=0; i<N; i++) {
    S2+=W[i];
    S1-=W[i];
    if(abs(S1-S2)<A) {
      A=abs(S1-S2);
    }
  }
  cout << A << endl;
}

Measured memory_bytes: 256
Scanf.scanf "%d" (fun k ->
    let a = Array.init k (fun _ -> Scanf.scanf " %d" (fun a -> a)) in
    let rec loop i acc1 acc2 =
        if i < 0 then acc1, acc2 else
            let v = a.(i) in
            let c2 = acc2 / v in
                if c2 * v < acc1 then (-1, -1) else
                    let c1 = ((acc1 + v - 1) / v) * v in
                    loop (i - 1) c1 (c2 * v + v - 1)
    in
    let acc1, acc2 = loop (k - 1) 2 2 in
    if acc1 < 0 then Printf.printf "-1\n" else
                     Printf.printf "%d %d\n" acc1 acc2
)

Measured memory_bytes: 5376
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<map>
#include<string.h>
#include<complex>
#include<math.h>
#include<queue>
#include <functional>
#include<time.h>
#include <stack>
using namespace std;
#define rep(i,a,n) for(int i=(a);i<(n);i++)
#define ll long long
#define llint long long int
#define sort(s) sort(s.begin(),s.end())
#define reverse(v)  reverse(v.begin(), v.end());
#define Yes(ans) if(ans)cout<<"Yes"<<endl; else cout<<"No"<<endl;
#define YES(ans) if(ans)cout<<"YES"<<endl; else cout<<"NO"<<endl;
#define hei(a) vector<a>
#define whei(a) vector<vector<int>>
constexpr auto mod = 1000000007;


//2のn乗を求めるよ！！！
int ni(int n) {
	if (n == 0)return 1;
	int x = ni(n / 2);
	x *= x;
	if (n % 2 == 1)x *= 2;
	return x;
}

//フィボナッチ数列のx番目を求めるよ！
int f(int x,vector<int> s) {
	if (x == 0)return 0;
	if (x == 1)return 1;
	if (s[x] != 0)return s[x];
	s[x] = f(x - 1,s) + f(x - 2,s);
	return s[x];
}

//aとｂの最大公約数を求めるよ！
llint gcd(llint a, llint b) {
	if (a < b)swap(a, b);
	if (b == 0)return a;
	return gcd(b, a % b);
}



// a^n mod を計算する
long long modpow(long long a, long long n, long long mod) {
	long long res = 1;
	while (n > 0) {
		if (n & 1) res = res * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}

// mod. m での a の逆元 a^{-1} を計算するよ！
long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}


//aCbをmod.mで割った余りを求める
ll int c(ll int a, ll int b,ll int m) {
	ll int ans = 1;
	for (ll int i = 0; i < b; i++) {
		ans *= a - i;
		ans %= m;
	}
	for (ll int i = 1; i <= b; i++) {
		ans *= modinv(i, m);
		ans %= m;
	}
	return ans;
}

//m進数のn桁を全列挙やで
void dfs(int m, int n) {

	stack<string> st;
	st.push("");
	while (!st.empty()) {
		string now = st.top();
		st.pop();
		if (now.size() == n) {
			cout << now << endl;
		}
		else {
			for (int i = m-1; i >= 0; i--) {
				string next = now + to_string(i);
				st.push(next);
			}
		}
	}
}

int main(){
	int n;
	cin >> n;
	hei(llint) a(n+1);
	rep(i, 0, n)cin >> a[i];
	a[n] = 1000000001;
	sort(a);
	int x = 1;
	int ans = 0;
	rep(i, 0, n) {
		if (a[i] == a[i + 1])x++;
		else {

			if (a[i] < x)ans += x - a[i];
			if (a[i] > x)ans += x;
			x = 1;
		}
	}
	
	cout << ans << endl;

	return 0;
}




  


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef long long LD;
typedef pair<int,int> PII;
const int N=503001;
const int M=2*N;
const LL MOD1=98764321261LL;
const LL MOD=998244353LL;

inline int lowbit(int x){
    return x&(-x);
}

struct fenwick {
    LL a[N];
    int n;
    void init(int n){
        for(int i=0;i<=n;++i)
            a[i]=0;
        this->n=n;
    }
    void add(int x,LL v) {
        for(int i=x;i<=n;i+=lowbit(i))
            a[i]+=v;
    }
    LL query(int x) {
        LL ret=0;
        for(int i=x;i;i^=lowbit(i))
            ret+=a[i];
        return ret;
    }
    void rangeadd(int l,int r,LL v) {
        add(l,v);
        add(r+1,-v);
    }
    LL rangequery(int l,int r) {
        l=max(l,1);
        r=min(r,n);
        if(r<l)return 0;
        LL ret=query(r);
        ret-=query(l-1);
        return ret;
    }
};

inline LL powmod(LL x,LL y,LL MOD){
    LL ret=1;
    while(y){
        if(y&1LL)ret=ret*x%MOD;
        x=x*x%MOD;
        y=y>>1;
    }
    return ret;
}

struct graph{
    int head[N],next[M],to[M];
    int tot;
    inline void init(int n){
        for(int i=0;i<=n;++i)
            head[i]=-1;
        tot=0;
    }
    inline void addedge(int x,int y){
        to[tot]=y;
        next[tot]=head[x];
        head[x]=tot;
        ++tot;
    }
};

struct point{
    LD x,y;
    point(){}
    point(LD x,LD y):x(x),y(y){}

    void read(){
        scanf("%lld%lld",&x,&y);
    }

    point operator + (const point &rhs)const{
        return point(x+rhs.x,y+rhs.y);
    }

    point operator - (const point &rhs)const{
        return point(x-rhs.x,y-rhs.y);
    }

    LD operator ^ (const point &rhs)const{
        return x*rhs.y-y*rhs.x;
    }

    bool operator < (const point &rhs)const{
        if(y!=rhs.y)return y<rhs.y;
        return x<rhs.x;
    }
};

LL phi(LL x)
{
    LL res=x;
    for(LL i=2;i*i<=x;++i)
    {
        if(x%i==0)
        {
            res=res/i*(i-1);
            while(x%i==0) x/=i;
        }
    }
    if(x>1) res=res/x*(x-1);
    return res;
}


int n,m,k;
char s[N];

int main(){
    int cases=1;
    //init();
    //scanf("%d",&cases);
    for(int iii=1;iii<=cases;++iii){
        double s;
        scanf("%lf",&s);
        s/=3;
        printf("%.10lf\n",s*s*s);
    }



}
/*
1
4 8
1 2 1
2 3 1
3 4 1
4 1 1
1 2 2
2 3 2
3 4 2
4 1 2
*/


Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))

x_1 = sum(a) // n
x_2 = x_1 + 1

cost_1 = 0
cost_2 = 0

for _a in a:
  cost_1 += (x_1 - _a) ** 2
  cost_2 += (x_2 - _a) ** 2

print(min(cost_1, cost_2))

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

int main() {
	int a[3];cin>>a[0]>>a[1]>>a[2];
	int s=0;
	int f=0;
	for(int i=0;i<3;i++){
		if(a[i]==5){
			f++;
		}
		if(a[i]==7){
			s++;
		}
	}
	if(s==1){
		if(f==2){
			cout<<"YES"<<endl;
			return 0;
		}
	}
	cout<<"NO"<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<algorithm>
#include<math.h>
#include<string>
#include<iostream>
#include<vector>
#include<cstdlib>
using namespace std;
 
template <class T> using V = vector<T>;
 
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
 
const long long INF = 1LL << 60;
 
using ll = long long;
using db = double;
using st = string;
using ch = char;
using bl = bool;
using vll = V<ll>;
using vpll =V<pair<ll,ll>>;
using vst = V<st>;
using vdb = V<db>;
using vch = V<ch>;
using vbl = V<bl>;
 
 
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define rFOR(i,a,b) for(ll i=(a);i>(b);i--)
#define oFOR(i,a,b) for(ll i=(a);i<(b);i+=2)
#define bgn begin()
#define en end()
#define SORT(a) sort((a).bgn,(a).en)
#define REV(a) reverse((a).bgn,(a).en)
#define M(a,b) max(a,b)
#define rM(a,b) min(a,b)
#define fi first
#define se second
#define sz size()
#define gcd(a,b) __gcd(a,b)
#define co(a) cout<<a<<endl;
#define ci(a) cin>>a;
 

vll dp(100100);

ll sum(ll n) {
  ll m=0;
  FOR(i,0,20){
    m+=n%10;
    n/=10;
    if(n==0){
      break;
    }
  }
  return m;
}
 
 
const int MAX = 510000;
const int MOD = 1000000007;
 
long long fac[MAX], finv[MAX], inv[MAX];
 
void Comuse() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
 
 
#define comuse Comuse()
 
ll combi(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
 
 
 
 
ll lcm(ll a,ll b){
  ll n;
  n=a/gcd(a,b)*b;
  return n;
}
 
 
/****************************************\
| Thank you for viewing my code:)        |
| Written by RedSpica a.k.a. RanseMirage |
| Twitter:@asakaakasaka                  | 
\****************************************/
 
 
signed main() {
  ll a,b;
  	cin>>a>>b;
  ll z=0;
  
  co(max(z,a-2*b))
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define F first
#define S second

using namespace std;
typedef pair<int,int> P;

const int MOD=1000000007;
int INF=100100100100100;

signed main(){
  int n,m;cin>>n>>m;
  cout<<(1<<m)*(1900*m+100*(n-m))<<endl;
  return 0;
}

Measured memory_bytes: 256
N = int(input())
n = ["3", "5", "7"]
l = 0
r = 3
x = 1
flag = True
while flag:
    for m in (3, 5, 7):
        if not flag:
            break
        for i in range(l, r):
            y = int(n[i])+m*10**x
            if y > N:
                flag = False
                break
            n.append(str(y))

    l = r
    r = len(n)   
    x += 1

res = 0
for s in n:
    if "3" in s and "5" in s and "7" in s:
        res += 1

print(res)

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

class Main {
  public static void main(String[] args) throws Exception{
    try (Scanner sc = new Scanner(System.in)){
      int N = sc.nextInt();
      int sum = 0;
      for (int i = 0; i < N; i++) {
        sum += sc.nextInt();
      }
      System.out.println(sum - N);
    }
  }
}

Measured memory_bytes: 25452
#pragma gcc optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;

int n, ans;

int main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    cin >> n;
    for (int i = 1; i <= n; ++i) {
        int t = i;
        int cnt = 1;
        while (t/=10) ++cnt;
        ans += cnt & 1;
    }
    cout << ans << '\n';
}

Measured memory_bytes: 256
n = int(input())
R = []
for _ in range(n):
    x, l = map(int, input().split())
    R.append((x+l, x-l))
R.sort()

ans = 0
last = -1e10
for r, l in R:
    if last <= l:
        ans += 1
        last = r
print(ans)

Measured memory_bytes: 53464
#include <bits/stdc++.h>
#define F first
#define S second
#define pb push_back
#define mp make_pair
using namespace std;
typedef long long int ll;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n;
	cin >> n;
	double ans = 0.00;
	while (n--) {
		double x;
		string u;
		cin >> x >> u;
		if (u == "JPY") {
			ans += x;
		}
		else {
			ans += (x * 380000.0);
		}
	}
	cout << setprecision(9) << ans << "\n";
}



Measured memory_bytes: 256
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors
n = int(input())
ans_li = []
divisors = make_divisors(n)
for item in divisors:
  a = item + n//item
  ans_li.append(a)
print(min(ans_li)-2)

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

int n, f[10], ans = INT_MAX, vis[1000000];

int gen(int x) { 
	if(x > ans) return 0;
	vis[x] = 1;
	if(x >= n) ans = min(ans, x);
	for(int i = 0; i <= 9; i++) {
		if(!f[i]) {
			gen(x * 10 + i);
		}
	}
	return 0;
}

int32_t main() {
	ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0);

	int k; cin >> n >> k;
	for(int i = 1; i <= k; i++) {
		int x; cin >> x; f[x] = 1;
	}
	for(int i = 1; i <= 9; i++) if(!f[i]) {
		gen(i);
	}

	cout << ans << endl;
} 

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> P;
struct st{
  int m,x,y;
  st(){}
  st(int m,int x,int y):m(m),x(x),y(y){}
};
int dp[6][333][333];
signed main(){
  int sx,sy,gx,gy;
  cin>>sx>>sy>>gx>>gy;
  int n;
  cin>>n;
  int x[n],y[n];
  for(int i=0;i<n;i++) cin>>x[i]>>y[i];
  int lx,ly;
  cin>>lx>>ly;
 
  set<P> sp;
  for(int i=0;i<n;i++) sp.insert(P(x[i],y[i]));
   
  int ax[2][7]={{0,1,1,0,-1,-1,0},{0,1, 1,0,-1,-1,0}};
  int ay[2][7]={{1,0,-1,-1,-1,0,0},{1,1,0,-1,0,1,0}};
  deque<st> q;
  int ans=-1;
  memset(dp,-1,sizeof(dp));
  q.push_back(st(0,sx,sy));
  dp[0][sx+150][sy+150]=0;
  while(!q.empty()){
    st p=q.front();q.pop_front();
    if(p.x==gx&&p.y==gy){
      ans=dp[p.m][p.x+150][p.y+150];
      break;
    }
    int f=abs(p.x*p.y*p.m)%6;
    //cout<<p.m<<" "<<p.x<<" "<<p.y<<" "<<f<<":"<<dp[p.m][p.x+150][p.y+150]<<endl;
    for(int k=0;k<7;k++){
      int nx=p.x+ax[abs(p.x)%2][k],ny=p.y+ay[abs(p.x)%2][k],nm=(p.m+1)%6;
      if(abs(nx)>lx||abs(ny)>ly) continue;
      if(sp.count(P(nx,ny))) continue;
      if(k==f){
    if(dp[nm][nx+150][ny+150]<0||dp[nm][nx+150][ny+150]>dp[p.m][p.x+150][p.y+150]){
      dp[nm][nx+150][ny+150]=dp[p.m][p.x+150][p.y+150];
      q.push_front(st(nm,nx,ny));
    }
      }else{
    if(dp[nm][nx+150][ny+150]<0||dp[nm][nx+150][ny+150]>dp[p.m][p.x+150][p.y+150]+1){
      dp[nm][nx+150][ny+150]=dp[p.m][p.x+150][p.y+150]+1;
      q.push_back(st(nm,nx,ny));
    }
      }
    }
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 8520
#include "bits/stdc++.h"
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
static const int INF = 0x3f3f3f3f; static const long long INFL = 0x3f3f3f3f3f3f3f3fLL;
typedef vector<int> vi; typedef pair<int, int> pii; typedef vector<pair<int, int> > vpii; typedef long long ll;
template<typename T, typename U> static void amin(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> static void amax(T &x, U y) { if(x < y) x = y; }

int main() {
	char S[100001];
	while(~scanf("%s", S)) {
		int n = (int)strlen(S);
		int ans = 0;
		rep(i, n - 1)
			ans += S[i] != S[i + 1];
		printf("%d\n", ans);
	}
	return 0;
}


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

using ll = long long int;
using ull = unsigned long long int;


int solve(){
    int n, m, q;
    cin >> n >> m >> q;
    if(n==0) return 1;
    vector<pair<ll, bitset<1000> > > vec(n, make_pair((1LL<<n)-1,bitset<1000>().set()));
    for(ll i=0,px=0;i<q;i++){
        string s, b;
        cin >> s >> b;
        ll x = 0;
        bitset<1000> bit;
        for(int j=0;j<n;j++){
            x |= ll(s[j]-'0')<<j;
        }
        x ^= px;
        for(int j=0;j<m;j++){
            if(b[j]=='1') bit.set(j);
        }
        for(int j=0;j<n;j++){
            if((x>>j)&1){
                vec[j].first &= x;
                vec[j].second &= bit;
            }else{
                vec[j].first &= ~x;
                vec[j].second &= ~bit;
            }
        }
        px = x;
    }
    vector<int> ans(m, -1);
    for(auto e : vec){
        ll x = e.first;
        // cout << "x=" << x << endl;
        int cnt = 0, idx = -1;
        for(int i=0;i<n;i++){
            if((x>>i)&1){
                cnt++;
                idx = i;
            }
        }
        if(cnt != 1) continue;
        auto bit = e.second;
        for(int i=0;i<m;i++){
            if(bit.test(i)) ans[i] = idx;
        }
    }
    for(int i=0;i<m;i++){
        if(ans[i]>=0){
            if(ans[i]<=9){
                cout << ans[i];
            }else{
                cout << char('A'+ans[i]-10);
            }
        }else{
            cout << '?';
        }
    }
    cout << endl;
    return 0;
}


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



Measured memory_bytes: 3068
import java.util.*;
public class Main {
        public static void main(String[] args){
                Scanner sc = new Scanner(System.in);
                int n = sc.nextInt();
                long[] a = new long[n];
                long zentai = 0;
                for(int i = 0 ; i < n ; i++){
                        a[i] = sc.nextLong();
                        zentai += a[i];
                }
                sc.close();
                long aaa = zentai;
                long bbb = 0;
                long ccc = zentai;
                for(int i = 0 ; i < n ; i++){
                        aaa -= a[i];
                        bbb += a[i];
                        ccc = Math.min(ccc , Math.abs(aaa - bbb));
                }
                System.out.println(ccc);
        }
}

Measured memory_bytes: 61752
#include <bits/stdc++.h>
using namespace std;
#define fio ios_base::sync_with_stdio(false), cin.tie(NULL)
bool cmp(pair<pair<string,int>,int> a,pair< pair<string,int>,int> b){
    if(a.first.first==b.first.first)return a.first.second>b.first.second;
    else return a.first.first<b.first.first;
}
int main() {
  fio;
  int n;cin>>n;
  vector<pair<pair<string,int>,int>> v;
  string s;
  int a;
  for(int i=0;i<n;i++){
      cin>>s>>a;
      v.push_back(make_pair(make_pair(s,a),i+1));
  }
  sort(v.begin(),v.end(),cmp);
  for(auto x:v)cout<<x.second<<endl;
  return 0;
}


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

const ll INF = 1e18;
const int di[4] = {-1, 0, 1, 0};
const int dj[4] = { 0, 1, 0,-1};

int main(){
  int h,w,k,si,sj,gi,gj;
  cin >> h >> w >> k >> si >> sj >> gi >> gj;
  si--;
  sj--;
  gi--;
  gj--;
  vector<string> g(h);
  rep(i,h) cin >> g[i];

  //各マスについてスタートから到達までのコスト（かく回数）
  vector<vector<ll>> cost(h,vector<ll>(w,INF));
  cost[si][sj] = 0;//スタートマスはコスト0

  //調べるマスを入れるキュー
  queue<P> q;
  
  //調べるマスをキューに追加する関数
  auto add_g = [&](int i, int j){
    q.push(make_pair(i,j));
  };

  //スタート地点から調べる
  add_g(si,sj);

  while(!q.empty()){//キューが空でない限りループ
    //キューから調べるマスの座標を取り出す
    P p = q.front();
    int cur_i = p.first;
    int cur_j = p.second;
    const ll c = cost[cur_i][cur_j];
    q.pop();

    //キューに調べるマスを追加
    rep(i,4) rep(j,k){
      //行先のマスの座標
      int to_i = cur_i + di[i] * (j + 1);
      int to_j = cur_j + dj[i] * (j + 1);

      if(h<=to_i||to_i<0||w<=to_j||to_j<0) break;//範囲外だったら追加しない
      if(c>=cost[to_i][to_j]) break;//行先のコストの方が小さかったら追加しない
      if(g[to_i][to_j]=='@') break;//ハスがあったら追加しない

      if(c+1<cost[to_i][to_j]){//行先のコストをもっと小さくできそうなら追加する
        add_g(to_i,to_j);
        cost[to_i][to_j] = c + 1;//行先のコストを更新
      }
    }

  }

  ll ans = cost[gi][gj];
  if(ans==INF) cout << -1 << endl;
  else cout << ans << endl;

  return 0;
}

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

using namespace std;

template <class T>inline T updmax(T& a, T b) {return a = max(a, b);}
template <class T>inline T updmin(T& a, T b) {return a = min(a, b);}

class Solution {
public:
	void solve() {
		int n,m;
		cin >> n >> m;
		vector<long long> h(n+2, 0);
		for(int i=0; i<n; i++)cin >> h[i+1];
		long long inf = 0x3f3f3f3f3f3f3f3f;
		n += 2;
		vector<vector<long long>> dp(n, vector<long long>(m+1, inf));
		dp[0][0] = 0;
		for(int i=1; i < n; i++){
			for(int j=0; j <= m; j++){
				for(int k = 0; i-1 >= k && j >= k; k++){
					updmin(dp[i][j], dp[i-k-1][j-k] + max(h[i] - h[i-k-1], 0LL));
				}
			}
		}
		long long ans = inf;
		for(int i=0; i <= m; i++)updmin(ans, dp[n-1][i]);
		cout << ans << endl;
		return;
	};
};

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	Solution solution;
	solution.solve();
	return 0;
}

Measured memory_bytes: 1024