akhauriyash/Code-Regression huggingface dataset:
#pragma region _head

#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<map>
#include<set>
#include<iomanip>
#include<queue>
#include<stack>
#include<numeric>
#include<utility>
#include<regex>

#pragma region _define

#define int LL
#define f(i,a,b) for(LL i=a;i<b;i++)
#define f_vI(v,n) f(i,0,n)cin>>v[i]
#define f_v2I(v1,v2,n) f(i,0,n)cin>>v1[i]>>v2[i]
#define f_v3I(v1,v2,v3,n) f(i,0,n)cin>>v1[i]>>v2[i]>>v3[i]
#define f_vO(v,n) f(i,0,n)cout<<v[i]<<endl
#define ei else if
#define all(a) a.begin(),a.end()
#define size(s) ((LL)s.size())
#define F first
#define S second
#define check() cout<<"! ! !"
#define endl "\n"
#define _y() cout<<"Yes"<<endl
#define _Y() cout<<"YES"<<endl
#define _n() cout<<"No"<<endl
#define _N() cout<<"NO"<<endl
#define int_INF 1<<29
#define ll_INF 1LL<<60
#define MOD 1000000007

#pragma endregion

#pragma region _using

using namespace std;

using LL = long long;
using st = string;
using vi = vector<LL>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vc = vector<char>;
using vs = vector<st>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvvb = vector<vvb>;
using qi = queue<LL>;
using qc = queue<char>;
using qs = queue<st>;
using si = stack<LL>;
using sc = stack<char>;
using ss = stack<st>;
using pi = pair<LL, LL>;
using mll = map<LL, LL>;
using vpi = vector<pi>;

#pragma endregion

#pragma region _graph

#define node 50  //グラフの最大位数　適宜変更
//bool graph[node][node]; bool visited[node] = { false };
#define link(a,b,m) f(i,0,m){cin>>a[i]>>b[i]; a[i]--; b[i]--; graph[a[i]][b[i]]=graph[b[i]][a[i]]=true;}

#pragma endregion


LL gcd(LL a, LL b) {
	LL r;
	while ((r = a % b) != 0) {
		a = b;
		b = r;
	}
	return b;
}
LL lcm(LL a, LL b) {
	return (a / gcd(a, b) * b);
}

//素数判定
bool is_prime(int n) {
	for (int i = 2; i*i <= n; i++) {
		if (n % i == 0) {
			return false;
		}
	}
	return true;
}

//階乗計算
LL factorial(LL n) {
	LL a = 1, ret = 1;
	while (a < n) {
		a++;
		ret *= a;
		ret %= MOD;
	}
	return ret;
}

#pragma endregion 



/*****************************************************************************/

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

	int n;
	st s;
	cin >> n >> s;
	int R = 0, B = 0;
	f(i, 0, n) {
		if (s[i] == 'R') {
			R++;
		}
		else {
			B++;
		}
	}
	
	R > B ? _y() : _n();
	return 0;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline

N = int(input())
S = input()

left_w = [0] * (N)
right_b = [0] * (N)

for i in range(N):
  if i == 0:
    left_w[0] = int(S[0] == '#')
    right_b[-1] = int(S[-1] == '.')
  else:
    left_w[i] = left_w[i-1] + int(S[i] == '#')
    right_b[-i-1] = right_b[-i] + int(S[-i-1] == '.')
left_w = [0] + left_w
right_b = right_b + [0]
# print(left_w)
# print(right_b)

res = N
for i in range(N+1):
  res = min(res, right_b[i] + left_w[i])
print(res)

Measured memory_bytes: 20704
import java.util.*;

public class Main {
    private static Scanner scanner;

    public static int[] inputIntArray(int n) {
        int[] res = new int[n];
        for (int i = 0; i < n; ++i) {
            res[i] = scanner.nextInt();
        }

        return res;
    }

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

        try{
            while(true){
                int n = scanner.nextInt();
                
                if(n == 0) {return;}
                
                int[] arr = inputIntArray(n);
                
                int sum = 0;
                
                Arrays.sort(arr);
                for(int i = 1; i + 1 < arr.length; ++i) {
                    sum += arr[i];
                }
                
                System.out.println(sum / (arr.length - 2));
            }
        }catch(Exception e){}
    }
}


Measured memory_bytes: 29192
def fib(n):
    if n == 1 or n == 2:
        return 1
    else:
        seq = [0 for _ in range(0, n)]
        seq[0], seq[1] = 1, 1
        for i in range(2, n):
            seq[i] = seq[i - 1] + seq[i - 2]
    return seq[n - 1]


n = int(input()) + 1
print(fib(n))




Measured memory_bytes: 5604
// A C++ program to count number of partitions 
// of a set with n elements into k subsets 
#include<iostream> 
using namespace std; 

// Returns count of different partitions of n 
// elements in k subsets 
int countP(int n, int k) 
{ 
    // Base cases 
    if (n == 0 || k == 0 || k > n) 
        return 0; 
    if (k == 1 || k == n) 
        return 1; 

    // S(n+1, k) = k*S(n, k) + S(n, k-1) 
    return k*countP(n-1, k) + countP(n-1, k-1); 
} 

// Driver program 
int main() 
{ 
    int a;
    int b;
    cin>>a>>b;
    if(a>9 || b>9) cout<<-1<<endl;
    else cout<<a*b;
    return 0; 
} 

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
int main(){
	int d,g,p[10],c[10];
	cin>>d>>g;
	for(int i=0;i<d;i++)
		cin>>p[i]>>c[i];
	int ans=1000;
	for(int i=0;i<1<<d;i++){
		int psum=0,gsum=0;
		for(int j=0;j<d;j++){
			if(i&1<<j){
				psum+=p[j];
				gsum+=p[j]*(j+1)*100+c[j];
			}
		}
		if(gsum<g){
			for(int j=d-1;j>=0;j--){
				if(~i&1<<j){
					psum+=min(p[j],(g-gsum+(j+1)*100-1)/((j+1)*100));
					gsum+=min(p[j],(g-gsum+(j+1)*100-1)/((j+1)*100))*((j+1)*100);
					break;
				}
			}
		}
		if(gsum<g)
			continue;
		ans=min(ans,psum);
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<math.h>
using namespace std;
int main()
{
    double n,d;
    double count=0,p,q;
    double res;
    cin>>n>>d;
    for(int i=0;i<n;i++)
    {
        cin>>p;
        cin>>q;
        res = sqrt(pow(p,2)+ pow(q,2));
        if(res<=d)
        {
            count++;
        }
    }
    cout<<count;
    return 0;
}


Measured memory_bytes: 3856
#include <bits/stdc++.h>
using namespace std;
using ll = long long; // ll は long long　と同じとする。(int64_t)
int main() {
    ll N;
    cin >> N;
    int ans = 0;
    for(int i = 1; i <= N; i++){
        if(int(i * 1.08) == N){
            ans = i;
            break;
        }
    }
    if(ans == 0){
        cout << ":(" << endl;
    }
    else{
        cout << ans << endl;
    }
}


Measured memory_bytes: 256
N, K = map(int, input().split())
P = list(map(int, input().split()))
for ind in range(len(P)-1):
		iSm = ind
		for i in range(ind, len(P)):
			if P[iSm]>P[i]:
				iSm = i
		P[ind], P[iSm] = P[iSm], P[ind]
ans = 0
for j in range(K):
	ans += P[j]
print(ans)

Measured memory_bytes: 9240
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <climits>
using namespace std;
#define MOD 1000000007

long long calc(int n, const vector<long long> x){
    vector<long long> tmp1(n);
    vector<long long> tmp2(n);
    for(int i=0; i<n; i++) tmp1[i] = (i * x[i]) % MOD;
    tmp2[0] = 0;
    for(int i=1; i<n; i++) tmp2[i] = (tmp2[i-1] + x[i-1]) % MOD;

    long long D = 0;
    for(int i=0; i<n; i++) D = (D + tmp1[i]) % MOD;
    for(int i=0; i<n; i++) D = (D - tmp2[i] + MOD) % MOD;
    return D;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, m;
    cin >> n >> m;
    vector<long long> x(n);
    vector<long long> y(m);
    for(int i=0; i<n; i++) cin >> x[i];
    for(int i=0; i<m; i++) cin >> y[i];

    long long DX = calc(n, x);
    long long DY = calc(m, y);
    long long ans = (DX * DY) % MOD;
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 4224
import sys
input = sys.stdin.readline

def solve():
    dxys = [(1,0), (0,1)]

    H, W = map(int, input().split())
    Sss = ['$'*(W+2)] + ['$'+input().rstrip()+'$' for _ in range(H)] + ['$'*(W+2)]

    vWhites, vBlacks = set(), set()
    if Sss[1][1] == '.':
        vWhites.add((1, 1))
    else:
        vBlacks.add((1, 1))

    ans = 0
    while True:
        while vWhites:
            v2s = set()
            for r, c in vWhites:
                if (r, c) == (H, W):
                    return ans
                for dr, dc in dxys:
                    r2, c2 = r+dr, c+dc
                    if Sss[r2][c2] == '$': continue
                    if Sss[r2][c2] == '.':
                        v2s.add((r2, c2))
                    else:
                        vBlacks.add((r2, c2))
            vWhites = v2s
        ans += 1

        while vBlacks:
            v2s = set()
            for r, c in vBlacks:
                if (r, c) == (H, W):
                    return ans
                for dr, dc in dxys:
                    r2, c2 = r+dr, c+dc
                    if Sss[r2][c2] == '$': continue
                    if Sss[r2][c2] == '#':
                        v2s.add((r2, c2))
                    else:
                        vWhites.add((r2, c2))
            vBlacks = v2s
#        ans += 1


ans = solve()
print(ans)


Measured memory_bytes: 45276
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <climits>
#include <ctime>
#include <cassert>
using namespace std;

#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define all(v) begin(v), end(v)
#define pb(a) push_back(a)
#define fr first
#define sc second
#define INF 2000000000
#define int long long int

#define X real()
#define Y imag()
#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) ( EQ((a).X, (b).X) && EQ((a).Y, (b).Y) )
#define LE(n, m) ((n) < (m) + EPS)
#define LEQ(n, m) ((n) <= (m) + EPS)
#define GE(n, m) ((n) + EPS > (m))
#define GEQ(n, m) ((n) + EPS >= (m))

typedef vector<int> VI;
typedef vector<VI> MAT;
typedef pair<int, int> pii;
typedef long long ll;

typedef complex<double> P;
typedef pair<P, P> L;
typedef pair<P, double> C;

int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
int const MOD = 1000000007;

namespace std {
    bool operator<(const P& a, const P& b) {
        return a.X != b.X ? a.X < b.X : a.Y < b.Y;
    }
}

signed main() {
    int x; cin >> x;
    int n = (x - 1) / 11;

    if(0 < x % 11 && x % 11 < 7) cout << 2 * n + 1 << endl;
    else cout << 2 * n + 2 << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
 
int main(void)
{   int a,b,i;
    char op;
    for(i=1;i>0;i++){
        scanf("%d %c %d",&a,&op,&b);
        if(op=='+')
        {printf("%d\n",a+b);
        }
        else if(op=='-')
        {printf("%d\n",a-b);
        }
        else if(op=='*')
        {printf("%d\n",a*b);
        }
        else if(op=='/'){
            printf("%d\n",a/b);
        }else if(op=='?') {
            break;
        }
    }
    return 0;
}


Measured memory_bytes: 2052
import sys
sys.setrecursionlimit(10**7)
def dfs(i,we,par):
    global adj,co,res
    we+=co[i]
    res[i]=we
    for j in adj[i]:
        if j!=par:
            dfs(j,we,i)
            
input = sys.stdin.readline
n,q=map(int,input().split())
adj=[set() for i in range(n)]
for _ in range(n-1):
    a,b=map(int,input().split())
    adj[a-1].add(b-1)
    adj[b-1].add(a-1)
co=[0]*n
for i in range(q):
    a,b=map(int,input().split())
    co[a-1]+=b
res=[0]*n
dfs(0,0,None)
for i in range(n):
    print(res[i],end=" ")
print()



Measured memory_bytes: 259332
#500円玉100円玉50円玉をそれぞれ指定枚数持っているときに入力した額をちょうど払える払い方は何通りか
  
a=int(input())
b=int(input())
c=int(input())
x=int(input())
cnt=0

for i in range(a+1):
        for j in range(b+1):
                for k in range(c+1):
                        total=500*i+100*j+50*k
                        if total==x:
                                cnt+=1

print(cnt)



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

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

  int maxb = -(1e9 + 7);
  int minv = R[0];

  for (int i = 1; i < n; i++) {
    maxb = max(maxb, R[i] - minv);
    minv = min(minv, R[i]);
  }

  cout << maxb << endl;

};



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

int main() {
    long long a, b, x, ans;
    cin >> a >> b >> x;
    if (a == 0)
        ans = b/x+1;
    else
        ans = b/x-(a-1)/x;
    cout << ans << endl;
    return 0;
}


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

int main(){
    int a,b,c;
    cin >> a >> b >> c;
    if(a != b && a == c){
        cout << b << '\n';
    }else if(a != c && a == b){
        cout << c << '\n';
    }else{
        cout << a << '\n';
    }
    return 0;
}

Measured memory_bytes: 3548
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<cstring>
#include<string>
#include<cmath>
#include<vector>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
using namespace std;
const int inf=2147483647,dx[]={-1,0,1,0},dy[]={0,-1,0,1};// 上 左 下 右
const int N=100005,M=1000005,mod=1000000007;
const long long llinf=9223372036854775807ll;
long long n,res,area[N];
long long m,a,b,lead[N],x[N],y[N];
vector<long long> ans;
vector<long long> v;
int leadd(int num)
{
	if(lead[num]==num)
		return num;
	lead[num]=leadd(lead[num]);
	return lead[num];
}
int main(){
	cin>>n>>m;
	ans.push_back((n-1)*(n)/2ll);
	res=ans[0];
	for(int i=1;i<=n;i++)
		lead[i]=i,area[i]=1;
	for(int i=1;i<=m;i++)
		cin>>x[i]>>y[i];
	for(int i=m;i>=1;i--)
	{
		a=x[i],b=y[i],a=leadd(a),b=leadd(b);
		if(a==b)
		{
			ans.push_back(res);
			continue; 
		}
		res-=(area[a]*area[b]);
		area[a]+=area[b];
		lead[b]=a;
		ans.push_back(res);
	}
	for(int i=ans.size()-2;i>=0;i--)
		cout<<ans[i]<<'\n';
	return 0;
}

Measured memory_bytes: 5364
#include<iostream>
#include<string>
#include<algorithm>
#include<functional>

#include<vector>
#include<set>

using namespace std;


int main()
{
	int N;
	int Y;

	cin >> N >> Y;

	for (int i = 0; i <= N; i++) {

		for (int j = 0; j <= N-i; j++) {

			int ret = Y - i*10000 - j*5000;
			int k = N - i - j;

			if (ret==1000*k) {
				printf("%d %d %d", i, j, k);
				return 0;
			}

		}

	}

	printf("%d %d %d", -1,-1,-1);



    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

using namespace std;
using boost::multiprecision::cpp_int;

typedef long long ll;
typedef pair<ll, ll> pll;

const ll INF = 1e17;
const ll MOD = 1e9+7;

// https://math.nakaken88.com/textbook/cp-binary-exponentiation-and-recursive-function/
ll modPow(long long a, long long n) {
  if (n == 1) return a % MOD;
  if (n % 2 == 1) return (a * modPow(a, n - 1)) % MOD;
  long long t = modPow(a, n / 2);
  return (t * t) % MOD;
}

ll comb(ll n, ll p) {
	if (p * 2 > n) p = n - p;
	if (p > n - p) p = n - p;
	ll a = 1, b = 1;
	for(int i=1; i< p+1; i++) {
		a = (a * (n - i + 1)) % MOD;
		b = (b * i) % MOD;
	}
	return a * (modPow(b, MOD - 2)) % MOD;
}

int main() {
    // input, ready
    int N;
    cin >> N;

    ll ans = 0;
    for (int i = 1; i<=N; i++) {
      if (i % 3 != 0 && i % 5 != 0) ans+=i;
    }

    cout << ans << endl;

    return 0;
}


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

// PowMod( base, index, modulo) return base ** index % modulo {{{
// PowMod = base ** index % mod ( natural numbers )
long long unsigned int Pow( long long unsigned int base, long long unsigned int index ){
    if( index == 0 ) return 1;
    // O( log(index) )
    if( index % 2 ){
        return base * Pow(base, index - 1);
    }else{
        long long unsigned int Phalf = index / 2;
        long long unsigned int half = Pow(base, Phalf);
        return half * half;
    }
}
// }}}

// definition {{{ 1

// scaning {{{ 2
#define Scd(x) scanf("%d", &x)
#define Scd2(x,y) scanf("%d%d", &x, &y)
#define Scd3(x,y,z) scanf("%d%d%d", &x, &y, &z)

#define Scll(x) scanf("%llu", &x)
#define Scll2(x,y) scanf("%llu%llu", &x, &y)
#define Scll3(x,y,z) scanf("%llu%llu%llu", &x, &y, &z)

#define Scc(c) scanf("%c", &c);
#define Scs(s) scanf("%s", s);
#define Scstr(s) scanf("%s", &s);
// }}} 2

// constants {{{ 2
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
// }}} 2

// systems {{{ 2
#define Rep(x,y) for(int x = 0; x < y; x++)
#define Repe(x,y,z) for(int x = z; x < y; x++)
// }}} 2

// output {{{ 2
#define YesNo(a) (a)?printf("Yes\n"):printf("No\n");
// }}} 2

// }}} 1

ll ans = 0;
ll p[54] = {};
ll bp[54] = {};
int n;
ll x;

void answer( ll l , int lv ){
    if( l <=  0 ) return;
    if( lv <= 0 ) {ans++; return;}
    //printf ("%llu\n", l);
    if( l <= bp[lv] / 2 ){
        answer( l-1 , lv-1 );
    }else{
        ans += p[lv];
        ans++;
        l -= bp[lv-1];
        l--;
        l--;
        answer( l , lv-1 );
    }
}

int main() {

    Scd(n);
    Scll(x);

    ll leng = Pow(2,n+2) - 3;

    bp[0] = 1;

    Repe(i,n+1,1){
        p[i] = p[i-1] * 2 + 1;
        bp[i] = bp[i-1] * 2 + 3;
    }

    answer(x,n);
    printf ("%llu\n", ans);


    return 0;
}



Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long n = sc.nextLong();
		long k = sc.nextLong();
		long x = n%k;
		System.out.println(Math.min(x, k-x));
		sc.close();
	}

}


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


public class Main {
  public static void main(String[] args) {
    InputReader_INTXOR ir = new InputReader_INTXOR(System.in);
    int n = ir.readInt();
    System.out.println(2*3.14159*n);
    System.out.flush();
  }
}
  class InputReader_INTXOR {

    private InputStream stream;
    private byte[] buf = new byte[1024];
    private int curChar;
    private int numChars;
    private SpaceCharFilter filter;

    public InputReader_INTXOR(InputStream stream) {
      this.stream = stream;
    }

    public int read() {
      if (numChars == -1)
        throw new InputMismatchException();
      if (curChar >= numChars) {
        curChar = 0;
        try {
          numChars = stream.read(buf);
        } catch (IOException e) {
          throw new InputMismatchException();
        }
        if (numChars <= 0)
          return -1;
      }
      return buf[curChar++];
    }

    public final int readInt() {
      int c = read();
      while (isSpaceChar(c))
        c = read();
      int sgn = 1;
      if (c == '-') {
        sgn = -1;
        c = read();
      }
      int res = 0;
      do {
        if (c < '0' || c > '9')
          throw new InputMismatchException();
        res *= 10;
        res += c - '0';
        c = read();
      } while (!isSpaceChar(c));
      return res * sgn;
    }

    public long readLong() {
      int c = read();
      while (isSpaceChar(c))
        c = read();
      int sgn = 1;
      if (c == '-') {
        sgn = -1;
        c = read();
      }
      long res = 0;
      do {
        if (c < '0' || c > '9')
          throw new InputMismatchException();
        res *= 10;
        res += c - '0';
        c = read();
      } while (!isSpaceChar(c));
      return res * sgn;
    }

    public String readString() {
      int c = read();
      while (isSpaceChar(c))
        c = read();
      StringBuilder res = new StringBuilder();
      do {
        res.appendCodePoint(c);
        c = read();
      } while (!isSpaceChar(c));
      return res.toString();
    }

    public boolean isSpaceChar(int c) {
      if (filter != null)
        return filter.isSpaceChar(c);
      return isWhitespace(c);
    }

    public double readDouble() {
      return Double.parseDouble(readString());
    }

    public static boolean isWhitespace(int c) {
      return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    }

    public String next() {
      return readString();
    }

    public interface SpaceCharFilter {
      public boolean isSpaceChar(int ch);
    }
  }


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

#include <algorithm>

using namespace std;

#define sqr(x) ((x) * (x))
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()

typedef long long ll;

const int MOD = 1000000007;
const int INF = 1000000007;
const ll INFLL = 1000000000000000007LL;

void solve() {
  int N, M, X;
  cin >> N >> M >> X;
  map<int, int> A;
  for (int i = 0; i < M; i++) {
    int a;
    cin >> a;
    A[a] = 1;
  }
  int ans_l = 0;
  for (int i = X; i >= 0; i--) {
    ans_l += A[i];
  }
  int ans_r = 0;
  for (int i = X; i <= N; i++) {
    ans_r += A[i];
  }
  cout << min(ans_l, ans_r) << endl;
}

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

  solve();

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std; 
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define ALL(a) (a).begin(),(a).end()
#define ll long long
long long min(long long x,long long y){return (x<y ? x:y);}
long long max(long long x,long long y){return (x>y ? x:y);}
#define ld long double
int stoi(string s) {return atoi(s.c_str());}
int keta(ll x){ if(x<10){return 1;} else{return keta(x/10) + 1;}}
#define LINEY "YES\n"
#define Liney "Yes\n"
#define LINEN "NO\n"
#define Linen "No\n"

int main(){
  int N,K;
  string s;
  cin >> N >> s>> K;
  char e = s[K-1];
  REP(i,N){
    if(s[i]==e){printf("%c",e);}
    else{printf("*");}
  }
  printf("\n");
}

Measured memory_bytes: 256
#include<algorithm>
#include<iostream>
#include<vector>
#include<string>
#define int long long
#define vel vector<long long>
using namespace std;
int pr = 1000000007;
int rui(int a, int n, int p) {
	if (n == 0) {
		return 1;
	}
	int x = rui(a, n / 2, p);
	x *= x;
	x = x % p;
	int bai = 1;
	if (n % 2 == 1) {
		bai = a % p;
	}
	x *= bai;
	x = x % p;
	return x;
}
int inv(int a, int p) {
	a = a % p;
	return rui(a, p - 2, p);
}
int inpe(int n, int r, vel &kai,vel &ink) {
	if (0 <= r and r <= n) {
		int ans = kai[n-r];
		return (ans*(ink[n])) % pr;
	}
	return 0;
}
int per(int n, int r, vel &kai, vel &ink) {
	if (0 <= r and r <= n) {
		int ans = kai[n];
		return (ans*(ink[n - r])) % pr;
	}
	return 0;
}
int comb(int n, int r, vel &kai, vel &ink) {
	if (0 <= r and r <= n) {
		int ans = (kai[n] * ink[r]) % pr;
		return (ans*(ink[n - r])) % pr;
	}
	return 0;
}
void ref(int &x) { x= (x + pr) % pr; }
signed main() {
	int dz = 200000+100;
	int pr = 1000;
	vel kai(dz + 1,1);
	vel ink(dz + 1,1);
	vel ru(dz + 1, 1);
	vel r(dz + 1, 1);
	int b, w; cin >> b >> w;
	int sum = b + w;
	pr *= pr * pr;
	pr += 7;
	for (int i = 1; i <= dz; i++) {
		kai[i] = (kai[i - 1] * i) % pr;
	}
	for (int i = 1; i <= dz; i++) {
		ink[i] = inv(kai[i], pr);
	}
	for (int i = 1; i <= dz; i++) {
		ru[i] = (ru[i - 1] * ink[2]) % pr;
		r[i] = (r[i - 1] * 2) % pr;
	}
	int bl = 0;
	int wh = 0;
	for (int n = 1; n <= sum; n++) {
		int ans = r[n-1] - bl + wh;
		ans = ans % pr; ref(ans);
		ans *= ru[n];
		ans = ans % pr;
		cout << ans << endl;
		bl *= 2; bl = bl % pr;
		bl += comb(n-1, b-1, kai, ink);
		bl = bl % pr;
		wh *= 2; wh = wh % pr;
		wh += comb(n-1, w-1, kai, ink);
		wh = wh % pr;
	}
	int x=0;
	return 0;
}

Measured memory_bytes: 9088
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<unordered_map>
#include<cmath>
using namespace std;
typedef unsigned long long ll;
ll mod = (10e+8)+ 7;


int main(){
	int A,B;
	cin>>A>>B;
	int ans = A+B;
	ans = max(ans,A-B);
	ans = max(ans,A*B);
	cout<<ans<<endl;
}

Measured memory_bytes: 256
S = gets.chomp

index = 1
ret = "Yes"
S.each_char do |s|
  if index.odd?
    if s == "L"
      ret = "No"
      break
    end
  else
    if s == "R"
      ret = "No"
      break
    end
  end
  index += 1
end
puts ret

Measured memory_bytes: 1788
input()

vals = input().split(" ")
vals = map(int, vals)

bol = True

for val in vals :
	if val % 2 == 0 :
	  if not (val % 3 == 0 or val % 5 == 0) :
	    bol = False

if bol :
  print("APPROVED")
else : 
  print("DENIED")
	

Measured memory_bytes: 2940
#define _USE_MATH_DEFINES
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cctype>
#include <climits>
#include <clocale>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

const int MOD = 1000000007; 
const int INF = 1000000000; //1e9
const int NIL = -1;
const long long LINF = 1000000000000000000; // 1e18
const double EPS = 1E-10;

template<class T, class S>
bool chmax(T &a, const S &b){
    if(a < b){
        a = b; return true;
    }
    return false;
}
template<class T, class S>
bool chmin(T &a, const S &b){
    if(b < a){
        a = b; return true;
    }
    return false;
}



int main(){
    int N, A, B; std::cin >> N;
    std::vector<int> AB(N);
    long long sum(0);
    for(int i(0); i < N; ++i){
        std::cin >> A >> B;
        sum -= B;
        AB[i] = A + B;
    }
    std::sort(AB.rbegin(), AB.rend());
    for(int i(0); i < N; i += 2)
        sum += AB[i];
    std::cout << sum << std::endl;
    return 0;
}


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

const int MOD = (int)1e9+7;

int main(){
	string S;
	long long K;
	cin >> S >> K;

	long long ans=0;
	for(int i=0;i<S.size()-1;i++){
		if(i+2<S.size() && S.at(i)==S.at(i+1) && S.at(i+1)==S.at(i+2)){
			ans++;
			i++;
		}
		else if(S.at(i)==S.at(i+1))	ans++;
	}
	if(K==1){
		cout << ans << endl;
		return 0;
	}

	ans*=K;
	if(S.at(0)==S.at(S.size()-1)){
		long long count1=1;
		for(int i=1;i<S.size();i++){
			if(S.at(0)==S.at(i))	count1++;
			else	break;
		}
		long long count2=1;
		for(int i=S.size()-2;i>=0;i--){
			if(S.at(S.size()-1)==S.at(i))	count2++;
			else	break;
		}

		if(count1==S.size()){
			if(count1%2==1)	ans=count1*K/2;
		}
		else{
			if(count1%2==1 && count2%2==1)	ans+=K-1;
		}
	}
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
/*
digu_J - Digvijay Janartha
NIT Hamirpur - INDIA
*/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

template < typename T > using ordered_set = tree < T, null_type, less < T >, rb_tree_tag, tree_order_statistics_node_update >;
template < typename T > using MinPriorityQueue = priority_queue < T, vector < T >, greater < T > >;

#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template < typename Arg1 >
void __f(const char* name, Arg1&& arg1) {
    cout << name << " : " << arg1 << std :: endl;
}
template < typename Arg1, typename... Args >
void __f(const char* names, Arg1&& arg1, Args&&... args) {
    const char* comma = strchr(names + 1, ',');
    int len = comma - names;
    for (int i = 0; i < len; ++i) {
        cout << names[i];
    }
    cout <<  " : " << arg1 << " | ";
    __f(comma + 1, args...);
}
#else
#define trace(...)
#endif

typedef double db;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair < ll, ll > pll;
typedef pair < int, int > pii;
typedef vector < ll > vll;
typedef vector < int > vi;

#define eb emplace_back
#define pb push_back
#define F first
#define S second
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define fast_io() ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0)

const ll LINF = LLONG_MAX, base = 1e9, MOD = 1e9 + 7, N = 1e5 + 10, M = 1e3 + 10;
const int INF = INT_MAX;
const db PI = acos(-1);

void test();

int main() {
    fast_io();
    test();
    return 0;
}

void test() {
    cout << fixed << setprecision(12);
    int n, k;
    cin >> n >> k;
    db ans = 0;
    for (int i = 1; i <= n; ++i) {
        if (i < k) {
            int cnt = 0, temp = i;
            while (temp < k) {
                ++cnt;
                temp *= 2;
            }
            ans += db(1) / (db(n) * (1 << cnt));
        } else {
            ans += db(1) / db(n);
        }
    }
    cout << ans << "\n";
}


Measured memory_bytes: 256
s=list(input())
n=len(s)+1
a=[0]*n
x=[0]*n
y=[0]*n

for i in range(1,n):
  if s[i-1]=="<":
    x[i]=x[i-1]+1
  else:
    x[i]=0
    
for j in range(n-2,-1,-1):
  if s[j]==">":
    y[j]=y[j+1]+1
  else:
    y[j]=0

for k in range(0,n):
  a[k]=max(x[k],y[k])
  
print(sum(a))  
    
    
  
  


Measured memory_bytes: 36656
#include "bits/stdc++.h"
using namespace std;
#define all(v) (v).begin(), (v).end()
#define io ios::sync_with_stdio(0)
#define rep(i, a, b) for (int i = a; i <= b; i++)
#define rson rt << 1 | 1, mid + 1, r
#define lson rt << 1, l, mid
#define lll __int128
#define pii pair<int, int>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define int long long
const int mod = 1e9 + 7;
inline int ksm(int a, int b)
{
	int ans = 1;
	for (; b; b >>= 1, a = a * a % mod)
		if (b & 1)
			ans = ans * a % mod;
	return ans;
}

int a[200][2000];
signed main()
{
	io;
	rep(i,1,3)rep(j,1,3)cin>>a[i][j];
	int f=0;
	int b[200];
	int n;cin>>n;
	rep(i,1,n)cin>>b[i];
	rep(i,1,3){
		int cnt=0;
		rep(j,1,3){
			rep(u,1,n)cnt += b[u]==a[i][j];
		}
		f |= cnt==3;
		cnt=0;
		rep(j,1,3){
			rep(u,1,n)cnt += b[u]==a[j][i];
		}
		f |= cnt==3;
	}
	int cnt=0;
	rep(i,1,3){
		rep(u,1,n)cnt += b[u] == a[i][i];
		f |= cnt==3;
	}
	cnt=0;
	rep(i,1,3){
		rep(u,1,n)cnt += b[u] == a[i][3-i+1];
	}
	f |= cnt==3;

	f?puts("Yes"):puts("No");
	
	
	getchar(); //
	getchar();
}

Measured memory_bytes: 256
#include <iostream>

void swap(char& left, char& right)
{
  char temp = left;
  left = right;
  right = temp;
}

void reverse(char* arr, int begin, int end)
{
  int i = begin, k = end;
  while (i < k)
  {
    k -= 1;
    swap(arr[i], arr[k]);
    i += 1;
  }
  for (int j = begin; j < end; j += 1)
    arr[j] = (arr[j] == 'L' ? 'R' : 'L');
}

long long count_happy(char* arr, int length)
{
  long long res = 0;
  for (int i = 1; i < length; i += 1)
    if (arr[i] == arr[i - 1])
      res += 1;
  return res;
}

void print(char* queue, int n)
{
  for (int i = 0; i < n; i += 1)
    std::cout << queue[i];
  std::cout << "\n";
}

int main()
{
  int n, k;
  std::cin >> n >> k;
  char* queue = new char[n];
  for (int i = 0; i < n; i += 1)
    std::cin >> queue[i];
  
  for (int i = 1; i < n && k > 0; i += 1)
    if (queue[i] != queue[i - 1])
      for (int j = i + 1; j < n; j += 1)
        if (queue[j - 1] == queue[i] && queue[j] == queue[i - 1])
        {
          reverse(queue, i, j);
          k -= 1;
          break;
        }

  for (int i = 1; i < n && k > 0; i += 1)
    if (queue[i] != queue[i - 1])
    {
      k -= 1;
      if (queue[i - 1] == queue[0])
        reverse(queue, 0, i);
      else if (queue[i] == queue[n - 1])
        reverse(queue, i, n);
      else
        k += 1;
    }

  std::cout << count_happy(queue, n);
  delete[] queue;
  return 0;
}

Measured memory_bytes: 3700
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
using namespace std;
#define len(n) (int)n.length()
#define pb push_back
#define ll long long
#define make_pair mkp
#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 ALL(v) (v).begin(), (v).end()
#ifdef DBGPRT
#define dbg(n) cerr << "//" << #n << ":" << n <<endl
#else
#define dbg(n) ;
#endif
typedef pair<ll, ll> LLARR;
#define INF 999999999
const double PI = 3.1415926535897932384626433832795;

int main()
{
	ios::sync_with_stdio(false);

	int a,b,c,d;
	
	cin >> a >> b >> c >> d;
	cout << ((a*b) > (c*d) ? (a*b) : (c*d)) << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  char c;
  cin >> c;
  if (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u') 
    cout << "vowel" << endl;
  else 
    cout << "consonant" << endl;
}

Measured memory_bytes: 3520
#include <string>
#include <vector>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <map>
#include <list>
#include <set>
#include <numeric>
#include <queue>
#include <stack>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <climits>
#include <cfloat>
#include <ctime>
#include <complex>
#include <cassert>
#include <array>
#include <bitset> 
#include <unordered_map>
#include <random>
using namespace std;
typedef long long LL;
typedef pair<LL,LL> P;


vector<int> org;
set<int> nz;
vector<int> ds,ds0,fs;
int f(int K)
{
	if(ds.size()<K){
		return 0;
	}
	auto p=[&](int t,int d){
		if(fs[t]!=K){
			org.push_back(t);
			fs[t]=K;
		}
		ds[t]+=d;
		if(abs(ds[t])==1){
			nz.insert(t);
		}
		else if(ds[t]==0){
			nz.erase(t);
		}
#if 0
		for(auto v:ds){
			cerr << v << ", ";
		}
		cerr << endl;
		for(auto n:nz){
			cerr << n << endl;
		}
		if((ds[t]!=0)!=(nz.count(t)!=0)){
			cerr << t << ", " << ds[t] << ", " << nz.count(t) << ", " << d << endl;
		}
#endif
	};
	org.clear();
	int s=K-1,t=K-1;
	int ret=0;
	while(1){
		if(ds[t]==0){
			auto it=lower_bound(nz.begin(),nz.end(),t);
			if(it==nz.end()){
				t=ds.size()-1;
			}
			else{
				t=*it;
			}
		}
		if(s>0&&ds[s-1]==0){
			auto it=lower_bound(nz.begin(),nz.end(),s);
			if(it==nz.begin()){
				s=0;
			}
			else {
				it--;
				s=*it+1;
			}
		}

		if(t==s){
			p(t,-1);
		}
		else{
			p(t,-1);
			if(s>0){
				p(s-1,-1);
			}
			int u=t-(K-s);
			if(u>=0){
				p(u,1);
			}
			if(u<K-1)
			{
				s=u+1;
			}
			else{
				t=u;
			}
		}
		if(ds.back()<0)break;
		ret++;
	}
	for(auto t:org){
		ds[t]=ds0[t];
		if(ds[t]){
			nz.insert(t);
		}
		else{
			nz.erase(t);
		}
	}
	return ret;
}

void solve(long long N, std::vector<long long> A){
	sort(A.begin(),A.end());
	int k=1;
	for(int i=1;i<N;i++){
		if(A[i]==A[i-1]){
			k++;
		}
		else{
			ds.push_back(k);
			k=1;
		}
	}
	ds.push_back(k);
	sort(ds.begin(),ds.end(),greater<int>());
	for(int i=0;i<ds.size()-1;i++)
	{
		ds[i]-=ds[i+1];
		if(ds[i]){
			nz.insert(i);
		}
	}
	nz.insert(ds.size()-1);
#if 0
	cerr << "aaa ";
	for(int i=0;i<ds.size();i++){
		cerr << ds[i];
	}
	cerr << endl;
#endif
	ds0=ds;
	fs.resize(ds.size());
#if 0
	for(auto v:ds){
		cerr << v << ", ";
	}
	cerr << endl;
	for(auto n:nz){
		cerr << n << endl;
	}
#endif
	for(int i=1;i<=N;i++){
		printf("%d\n",f(i));
	}
}


int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> A(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&A[i]);
    }
    solve(N, std::move(A));
    return 0;
}




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

ans_list=[]
for j in range(n):
    m=0
    while a[j]%2==0:
        m+=1
        a[j]=a[j]//2
    ans_list.append(m)
ans_list.sort()
print(ans_list[0])

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

int main(){
	long long n;
	string stones;
	getline(cin,stones,'\n');
	n = stones.length();
	long long cnt = 0;
	long long cntB = 0;
	for(long i=0;i<n;i++){
		if(stones[i]=='B'){
			cntB++;
		}else{
			cnt+=cntB;
		}
	}
	cout << cnt << endl;
}


Measured memory_bytes: 3724
// ====================================
//   author: M_sea
//   website: https://m-sea-blog.com/
// ====================================
#include <bits/stdc++.h>
#define file(x) freopen(#x".in","r",stdin); freopen(#x".out","w",stdout)
#define debug(...) fprintf(stderr,__VA_ARGS__)
using namespace std;
typedef long long ll;

int read() {
	int X=0,w=1; char c=getchar();
	while (c<'0'||c>'9') { if (c=='-') w=-1; c=getchar(); }
	while (c>='0'&&c<='9') X=X*10+c-'0',c=getchar();
	return X*w;
}

const int N=300000+10;

int n,m;
struct node { int l,r; } a[N];
bool operator <(node a,node b) { return a.r-a.l<b.r-b.l; }

int c[N];
void add(int x,int y) { for (;x<=m;x+=x&-x) c[x]+=y; }
int sum(int x) { int s=0; for (;x;x-=x&-x) s+=c[x]; return s; }

int main() {
	n=read(),m=read();
	for (int i=1;i<=n;++i) a[i].l=read(),a[i].r=read();
	sort(a+1,a+n+1);
	for (int i=1,j=1;i<=m;++i) {
		while (j<=n&&a[j].r-a[j].l+1<=i)
			add(a[j].l,1),add(a[j].r+1,-1),++j;
		int ans=n-j+1;
		for (int j=i;j<=m;j+=i) ans+=sum(j);
		printf("%d\n",ans);
	}
	return 0;
}

Measured memory_bytes: 6468
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr ll INF = 1'010'000'000'000'000'017LL;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()

int main() {
    ll n;
    cin >> n;
    vector<ll> x(n);
    vector<ll> y(n);
    vector<long double> res;
    long double ans = 0;
    long double cnt = 0;

    rep(i, n) {
        cin >> x[i];
        cin >> y[i];
    }
    vector<ll> ptn(n);
    rep(i, n) ptn.at(i) = i;

    do {
        // rep(i, ptn.size()) cout << ptn.at(i) << ' ';
        // cout << endl;
        for(size_t i = 0; i < n - 1; i++) {
            res.push_back((long double)sqrt(
                pow(x.at(ptn.at(i)) - x.at(ptn.at(i + 1)), 2) +
                pow(y.at(ptn.at(i)) - y.at(ptn.at(i + 1)), 2)));
        }
        cnt++;

    } while(next_permutation(all(ptn)));

    rep(i, res.size()) {
        ans += res.at(i);
        // cout << res.at(i) << endl;
    }
    // cout << ans / cnt << endl;ac
    ans /= cnt;
    printf("%f16", (double)ans);
}


Measured memory_bytes: 10476
n = int(input())
INF = float('inf')
dp = [INF]*(n+1)
dp[0] = 0
# 配ればいい
for i in range(n):
    for j in range(7):
        if i+6**j < n+1:
            dp[i+6**j] = min(dp[i+6**j], dp[i]+1)
        if i+9**j < n+1:
            dp[i+9**j] = min(dp[i+9**j], dp[i]+1)
print(dp[-1])

Measured memory_bytes: 48464
while line = gets
  num = line.chomp

  cnt = 0

  10000.times do |i|

    str = sprintf("%04d",i)
    sum = str[0].to_i + str[1].to_i + str[2].to_i + str[3].to_i

    #puts str[0] +"-" + str[1]+"-" +str[2]+"-" +str[3]
    #puts str
    #puts sum

    if(sum.to_i == num.to_i)
      cnt = cnt +1
    end
  end

  puts cnt
end

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

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = Integer.parseInt(sc.nextLine());
    int[] arr = new int[n];
    for (int i = 0; i < n; i++) {
      arr[i] = sc.nextInt();
    }
    int cnt = 0;
    int pow = 2;
    out: while (true) {
      for (int i = 0; i < n; i++) {
        if (arr[i] % pow != 0) {
          System.out.println(cnt);
          break out;
        }
      }
      cnt += 1;
      pow *= 2;
    }
  }
}


Measured memory_bytes: 21844
import java.util.Scanner;

/**
 * Created by labuser on 2016/04/20.
 */
public class Main {
    public static void main(String[] args) {
        new Main().run();

    }

    private void run() {

        int a, b;
        double f;
        Scanner sc = new Scanner(System.in);
        String[] input = sc.nextLine().split(" ");
        a = Integer.parseInt(input[0]);
        b = Integer.parseInt(input[1]);
        f = 1.0 * a / b;
        System.out.printf("%d %d %.5f\n",a/b,a%b,f);


    }


}

Measured memory_bytes: 26212
<?php

function pat($a, $s = ''){
    $r = array();
    if (count($a) && is_array($a)){
        foreach ($a as $k => $v){
            $_s = $s . $v;
            $_a = $a;
            unset($_a[$k]);
            $_r = pat($_a, $_s);
            $r = array_merge($r, $_r);
        }
    } else {
        $r[] = $s;
    }
    return $r;
}


fscanf(STDIN, "%d", $N);
$P = implode(explode(" ", trim(fgets(STDIN))));
$Q = implode(explode(" ", trim(fgets(STDIN))));

for ($n=1; $n<$N+1; $n++){
    $arr[] = $n;
}

$all_arrs = pat($arr);
foreach ($all_arrs as $index => $a){
    if ($a == $P){
        $p_index = $index;
    }
    if ($a == $Q){
        $q_index = $index;
    }
}
echo abs($p_index - $q_index);

Measured memory_bytes: 15204
#include <bits/stdc++.h>
#define endl '\n'

using namespace std;

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

	int k;

	cin >> k; 
	k = k / 500 * 1000 + k % 500 / 5 * 5;
	cout << k;
}

Measured memory_bytes: 256
N = int(input())
s = [input() for i in range(N)]

count =0

for i in range(N):

    BTCindex =  s[i].find("BTC")
    if BTCindex != -1:
        BTC_strip = ((s[i]).strip("BTC"""))
        count +=(float(BTC_strip)*380000.0)
    
    JPYindex =  s[i].find("JPY")
    if JPYindex != -1:
        JPY_strip = ((s[i]).strip("JPY"""))
        count +=(float(JPY_strip))


print(count)

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

using namespace std;

#define ok1 printf("ok1\n");
#define ok2 printf("ok2\n");
#define M 1000000000000000000LL
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n)　for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define pb push_back
#define pf push_front
#define MIN(a,b) a=min((a),(b))
#define MAX(a,b) a=max((a),(b))
#define SIZE(v) (int)v.size()
#define Eunique(v) v.erace(unique(all(v)),v.end())
#define pvec(v)　rep(i,v.size()){cout << v[i] << " ";}
#define INF 0x3f3f3f3f
#define mset(m,v) memset(m,v,sezeof(m))
#define mod 1e9 +7;

const double pi = acos(-1.0);

typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef deque<ll> dll;
typedef pair<ll,ll> P;
ll dx[4] = {1,0,-1,0},dy[4] = {0,1,0,-1};

ll gcd(ll x,ll y)
{
    ll r;
    while((r = x % y) != 0)
    {
        x = y;
        y = r;
    }
    return y;
}

ll lcm(ll x,ll y)
{
    x /= gcd(x,y);
    y /= gcd(x,y);
    return (x*y);
}

int main()
{
   ll n,k,sum=0;
   cin >> n >> k;
   vll a(n);
   rep(i,n)cin >> a[i];
   sort(rall(a));
   rep(i,k)sum += a[i];
   cout << sum << endl;
   return 0;
}

Measured memory_bytes: 256
#include <vector>
#include <iostream>
#include <cmath>
#include <map>
#include <algorithm>
#include <fstream>
#include <unistd.h>
#include <string>
#include <numeric>
#include <queue>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
typedef vector<P> vp;
typedef vector<PL> vpl;
typedef vector<vector<P>> vvp;
const int INF = 1001001001;
const ll LINF = 1e18;
const string endstr = "\n";

template <typename T>
T gcd(T a, T b) {
    if(a < b) gcd(b, a);
    T r;
    while((r=a%b)) {
        a = b; b = r;
    }
    return b;
}
bool p_comp_fs(const P p1, const P p2){ return p1.first < p2.first;};
bool p_comp_fg(const P p1, const P p2){ return p1.first > p2.first;};
bool p_comp_ss(const P p1, const P p2){ return p1.second < p2.second;};
bool p_comp_sg(const P p1, const P p2){ return p1.second > p2.second;};
    
int main(){
    string input; cin >> input;
    int a, b, c, d;
    a = input[0] - '0';
    b = input[1] - '0';
    c = input[2] - '0';
    d = input[3] - '0';
    for(int i = 0; i <= 1; i++){
        for (int j = 0; j <= 1; j++) {
            for (int k = 0; k <= 1; k++) {
                int tmp = a;
                tmp = (i == 1) ? tmp + b : tmp - b;
                tmp = (j == 1) ? tmp + c : tmp - c;
                tmp = (k == 1) ? tmp + d : tmp - d;
                if(tmp == 7){
                    string retStr = to_string(a);
                    retStr += (i == 1) ? "+" : + "-";
                    retStr += to_string(b);
                    retStr += (j == 1) ? "+" : "-";
                    retStr += to_string(c);
                    retStr += (k == 1) ? "+" : "-";
                    retStr += to_string(d);
                    retStr += "=7";
                    cout << retStr << endstr;
                    return 0;
                }
            }
        }
    }
    return 0;
}


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

using namespace std;

#define FOR(i,a,b) for(int i = (a); i < (b); ++i)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

inline int toInt(string s) {int v; istringstream sin(s);sin>>v; return v;}

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector< vector<int> > Mat;
typedef tuple<int, int, int, int> T;

const int MOD = (int)1e9+7;
const int INF = (int)1e9;
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};

int main(){
    int N, H, W;
    cin >> N >> H >> W;

    cout << (N-H+1)*(N-W+1) << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define max 999999
vector<int>edges[max];
int in_Degree[max];
int dist[max];
bool vis[max];
int max_f(int a,int b){
  if(a>b)return a;
  else
    return b;}
void dfs(int a){
assert(!vis[a]);
vis[a]=1;
for(auto b:edges[a]){
	dist[b]=max_f(dist[b],dist[a]+1);
	--in_Degree[b];
	if(in_Degree[b]==0)
		dfs(b);
}
}





int main()
{
int n,m;
cin>>n>>m;
while(m--)
{int a,b;
	cin>>a>>b;
	edges[a].push_back(b);
	++in_Degree[b];
} 
for(int i=1;i<=n;i++)
	if(!vis[i] && in_Degree[i]==0)
	dfs(i);

int an=0;
for(int i=1;i<=n;i++)
	an=max_f(an,dist[i]);

cout<<an;
return 0;
}

Measured memory_bytes: 33024
"use strict";
    
const main = arg => {
    arg = arg.trim().split("\n");
    const A = parseInt(arg[0].split(" ")[0]);
    const B = parseInt(arg[0].split(" ")[1]);
    const H = parseInt(arg[0].split(" ")[2]);
    const M = parseInt(arg[0].split(" ")[3]);
    
    let angleA = (360 / 12) * (H % 12);
    const angleB = (360 / 60) * M;
    angleA += 30 * (M / 60);
    
    const absAB = Math.abs(angleA - angleB);
    const angle = Math.min(absAB, 360 - absAB);
    
    let answer;
    
    answer = (Math.pow(A, 2) + Math.pow(B, 2)) - (2 * A * B) * (Math.cos(angle * (Math.PI / 180)));
    
    //console.log(angle);
    console.log(Math.sqrt(answer));
    // console.log(Math.cos(90))
    //console.log(Math.sqrt(20));
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 29812
import java.util.ArrayList;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scn = new Scanner(System.in);
		int n=scn.nextInt();
         String s =scn.next();
         long count=0;
          ArrayList<ArrayList<Integer>> al = new ArrayList<>();
         for(int i=0;i<3;i++){
        	 ArrayList<Integer> al1= new ArrayList<>();
        	 al.add(al1);
         }
         for(int i=0;i<n;i++){
        	 char ch=s.charAt(i);
        	 if(ch=='R'){
        		 ArrayList<Integer> al1 = al.get(0);
        		 al1.add(i);
        		 continue;
        	 }
        	 if(ch=='B'){
        		 ArrayList<Integer> al2 = al.get(1);
        		 al2.add(i);
        		 continue;
        	 }
        	 ArrayList<Integer> al3 = al.get(2);
        	 al3.add(i);
        	 
        	 
        	 
         }
         long val1= (long)al.get(0).size();
         long val2 = (long)al.get(1).size();
         long val3=(long)(al.get(2).size());
         
         long val =val1*val2*val3;
         
         for(int i=0;i<n;i++){
        	 for(int j=1;j<n;j++){
        		 if(i+j<n && i+j+j<n){
        			 if(s.charAt(i)!=s.charAt(i+j) && s.charAt(i+j)!=s.charAt(i+j+j)&& s.charAt(i)!=s.charAt(i+j+j)){
        				 count++;
        			 }
        		 }else{
        			 break;
        		 }
        	 }
         }
         val-=count;
         val = Math.max(val, 0);
         System.out.println(val);

	}

}

Measured memory_bytes: 38452
var
  a:array[0..101]of string;
  n,l,i,j:longint;
  s:string;
begin
  readln(n,l);
  for i:=1 to n do readln(a[i]);
  for i:=1 to n-1 do
    for j:=i+1 to n do
      if a[i]>a[j] then
       begin
         s:=a[i];
         a[i]:=a[j];
         a[j]:=s;
       end;
  for i:=1 to n do write(a[i]);
end.

Measured memory_bytes: 128