akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>

int main(){
	char a[102];
	int i;
    
  scanf("%s", a);
  for(i=0;a[i]!='\0';i++){
  	if(i%2==0){
    	if(a[i] == 'L'){
          printf("No\n");
          return 0;
        }
    }else{
    	if(a[i] == 'R'){
          printf("No\n");
          return 0;
        }
    }
  }
  
  
    printf("Yes\n");
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <stdio.h>
#include <math.h>
#include <vector>
#include <algorithm>
using namespace std;


int main(){
	vector<int> v;
	int x;
	for(int i=0;i<10;i++){
		cin >> x;
		v.push_back(x);
	}
	sort(v.begin(),v.end(),greater<int>());
	for(int i=0;i<3;i++){
		cout << v[i] << endl;
	}
	return 0;
}

Measured memory_bytes: 1220
n = int(input())
c = input()

w = 0
r = n - 1
ans = 0
flag = True

while flag:
    while c[w] == 'R':
        w += 1
        if w == n-1:
            flag = False
            break
    if not flag:
        break
    while c[r] == 'W':
        r -= 1
        if r == 0:
            flag = False
            break
    if not flag:
        break
    if w < r:
        ans += 1
        w += 1
        r -= 1
        if w == n-1 or r == 0:
            break
    else:
        break


print(ans)


Measured memory_bytes: 67828
N = [0] + list(map(int, list(input())))
L = len(N)
ans = 0
for i in range(L-1, -1, -1):
    if N[i] == 10:
        if i == 0:
            ans += 1
        else:
            N[i-1] += 1
            N[i] = 0
    if N[i] < 5:
        ans += N[i]
    elif N[i] > 5:
        ans += 10 - N[i]
        N[i-1] += 1
    else:
        if i == 0:
            ans += N[i]
        else:
            if N[i-1] >= 5:
                N[i-1] += 1
                ans += 5
            else:
                ans += N[i]

print(ans)


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

    using Graph = vector<vector<int>>;
 
int main() {

    int64_t N,x;
    cin>>N>>x;


    vector<int64_t> a(N);
    for(int i=0;i<N;i++){
        cin>>a.at(i);
    }
    

    sort(a.begin(),a.end());


    //お菓子を配る。喜ばない子供がいてもよい。
    int64_t sum=0;
    int64_t distribution_number=0;
    for(int i=0;i<N;i++){
        sum+=a.at(i);

        if(sum>x){
            distribution_number=i;
            break;
        }
    }

    if(sum==x)
        cout<<N<<endl;
    else if(distribution_number==0 && sum<x)
        cout<<N-1<<endl;
    else
        cout<<distribution_number<<endl;

 	return 0;
}

Measured memory_bytes: 3600
#include<bits/stdc++.h>
using namespace std;
int main(void)
{
   long long int t,n,x,y,a,b,c;
   cin>>a>>b>>c;
   swap(a,b);
   swap(a,c);
   cout<<a<<" "<<b<<" "<<c<<endl;
   return 0;
}


Measured memory_bytes: 256
//raja1999
#include <bits/stdc++.h>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <climits>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <iomanip> 
//setbase - cout << setbase (16); cout << 100 << endl; Prints 64
//setfill -   cout << setfill ('x') << setw (5); cout << 77 <<endl;prints xxx77
//setprecision - cout << setprecision (14) << f << endl; Prints x.xxxx


using namespace std;
#define f(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) f(i,0,n)
#define fd(i,a,b) for(i=a;i>=b;i--)
#define pb push_back
#define mp make_pair
#define vi vector< int >
#define vl vector< ll >
#define ss second
#define ff first
#define ll long long
#define pii pair< int,int >
#define pll pair< ll,ll >
#define sz(a) a.size()
#define inf (1000*1000*1000+5)
#define all(a) a.begin(),a.end()
#define tri pair<int,pii>
#define vii vector<pii>
#define vll vector<pll>
#define viii vector<tri>
#define mod (1000*1000*1000+7)
#define pqueue priority_queue< int >
#define pdqueue priority_queue< int,vi ,greater< int > >

//std::ios::sync_with_stdio(false);
int siz[100005],par[100005];
vector <vi >adj(100005);
ll val=0,val1;
vi v;
int dfs(int cur,int prev)
{
	int i;
	par[cur]=prev;
	rep(i,adj[cur].size())
	{
		if(adj[cur][i]!=prev)
		{
			siz[cur]+=dfs(adj[cur][i],cur);
		}
	}
	siz[cur]++;
	return siz[cur];
} 
int main(){
	std::ios::sync_with_stdio(false);
	int n,i,j,k=0,x,a,b,k1=0;
	cin>>n;
	rep(i,n-1)
	{
		cin>>a>>b;
		adj[a].pb(b);
		adj[b].pb(a);
	}
	dfs(1,-1);
	par[1]=-1;
	i=n;
	x=par[n];
	//v.pb(n);
	while(1)
	{

		if(par[i]==1)
			break;
		else
			i=par[i];
		v.pb(i);
		k++;
	}
	if(k/2!=0)
		val1=siz[v[(k/2)-1]];
	else 
		val1=siz[n];
	val=n-val1;
	//cout<<val<<" "<<val1<<" "<<k<<endl;
	if(val>val1)
		cout<<"Fennec"<<endl;
	else
		cout<<"Snuke"<<endl;

} 


Measured memory_bytes: 11900
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n)  for(int i = 0; i < n; i++)
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.rbegin(), cont.rend()
#define unique(a)  (a).erase(unique((a).begin(), (a).end()),(a).end())
#define fastio          ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define PB push_back
#define endl "\n"
#define mod 1000000007
typedef long long LL;
#define int long long
typedef long double LD;
typedef vector<int> VI;
inline LL add(LL x, LL y) { x += y; if (x >= mod) x -= mod; return x; }
inline LL moduloMultiplication(LL x, LL y) {
	return (x%mod * 1LL * y%mod) %mod;
}
inline LL power(LL a, LL b) {
	LL x = 1 % mod;
	while (b) {
		if (b & 1) x = moduloMultiplication(x, a);
		a = moduloMultiplication(a, a);
		b >>= 1;
	}
	return x % mod;
}

inline LL inv(LL a) { return power(a, mod - 2) % mod; }
LL gcd(LL a, LL b)
{
	if (!a)
		return b % mod;
	return gcd(b%a, a) % mod;
}

signed main()
{
	fastio;
	int n, d;
	cin >> n >> d;
	vector < vector<int> >v(n, vector<int>(d, 0));
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < d; j++) {
			cin >> v[i][j];
		}
	}
	int count = 0;
	for (int i = 0; i < n; i++) {
		for (int k = i + 1;  k< n; k++)
		{
			int ans = 0;
			for (int j = 0; j < d; j++) {
				ans += pow(v[i][j] - v[k][j], 2);
			}

			if ((int)sqrt(ans)*(int)sqrt(ans) == ans)count++;
		}
	}
	cout << count << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <utility>

using namespace std;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int a[2][100];
    int sum[2][100]={};
    int n;
    cin>>n;
    
    for(int i=0; i<2; i++){
        for(int j=0; j<n; j++){
            cin>>a[i][j];
        }
    }
    sum[0][0]=a[0][0];
    sum[1][0]=a[0][0]+a[1][0];
    for(int i=1; i<n; i++) sum[0][i]=sum[0][i-1]+a[0][i];
    for(int i=1; i<n; i++) sum[1][i]=max(sum[0][i], sum[1][i-1])+a[1][i];
    
    cout<<sum[1][n-1]<<'\n';
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define X first
#define Y second
#define pb emplace_back
#define FOR(i,a,b) for(int (i)=(a);i<(b);++(i))
#define EFOR(i,a,b) for(int (i)=(a);i<=(b);++(i))
#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define REP rep
#define rrep(X,Y) for (int (X) = (Y)-1;(X) >=0;--(X))
#define all(X) (X).begin(),(X).end()
#define eb emplace_back

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef ll LL;
typedef pii PII;
typedef pll PLL;
const ll MOD=1e9+7;

#define rall(X) (X).rbegin(),(X).rend()
#define UNIQUE(X) (X).erase(unique(all(X)),(X).end())
#define reps(X,S,Y) for (int (X) = S;(X) < (Y);++(X))
#define rreps(X,S,Y) for (int (X) = (Y)-1;(X) >= (S);--(X))
template<class T> inline bool MX(T &l,const T &r){return l<r?l=r,1:0;}
template<class T> inline bool MN(T &l,const T &r){return l>r?l=r,1:0;}

int N;
int X[1145];
int Y[1145];

signed main(){
  ios_base::sync_with_stdio(false);
  cout<<fixed<<setprecision(0);

  cin >> N;
  map<pii, int> mp;
  rep(i, N) {
    cin >> X[i] >> Y[i];
    mp[pii(X[i], Y[i])] = 1;
  }

  int ans = N;
  rep(i, N) {
    rep(j, N) {
      if (i == j) continue;
      int dx = X[j]-X[i];
      int dy = Y[j]-Y[i];
      int cand = 0;
      rep(k, N) {
        if (!mp.count(pii(X[k]-dx, Y[k]-dy))) cand++;
      }
      MN(ans, cand);
    }
  }
  cout << ans << endl;
}


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

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

#define FOR(i, n, m) for (ll(i) = (m); (i) < (n); ++(i))
#define REP(i, n) FOR(i, n, 0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll)1e15;

int main()
{
    string S;
    cin >> S;
    int N=S.length();
    ll sum = 0;
    REP(i, pow(2, N - 1))
    {
        ll s = 0;
        ll n = 0;
        REP(j, N)
        {
            n = n * 10 + (S[j] - '0');
            if (((i >> j) & 1) == 1)
            {
                s += n;
                n = 0;
            }
        }
        sum += s+n;
    }
    cout << sum << endl;
    return 0;
}

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

const int INF = -1 << 29;

int main() {
	const int MAX = 200000;
	int R[MAX], n;
	cin >> n;
	for (int i = 0; i < n; i++) cin >> R[i];

	int maxv = -2000000000;
	int minv = R[0];

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

	cout << maxv << endl;

	return 0;
}


Measured memory_bytes: 3852
import sys
from functools import reduce

stdin = sys.stdin
 
sys.setrecursionlimit(10**5) 
 
def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

def get_gcd(a:int, b:int) -> int:
    while b:
        a, b = b, a % b
    return a
    
def get_lcm(a:int, b:int) -> int:
    return (a // get_gcd(a,b)) * b


n = ni()
t = [ni() for _ in range(n)]

lcm = reduce(get_lcm, t)

print(lcm)

Measured memory_bytes: 3572
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <tuple>
#include <utility>
#include <vector>
#define ll long long
#define itn int
#define endl '\n'
#define co(ans) cout<<ans<<endl
#define COYE cout<<"YES"<<endl
#define COYe cout<<"Yes"<<endl
#define COye cout<<"yes"<<endl
#define CONO cout<<"NO"<<endl
#define CONo cout<<"No"<<endl
#define COno cout<<"no"<<endl
#define FORE(i,a) for(auto &i:a)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,1,n)
#define PB push_back
#define MP make_pair
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort((V).begin(),(V).end())
#define REVERSE(V) reverse((V).begin(),(V).end())
#define EACH(V,i) for(typeof((V).begin()) i=(V).begin();i!=(V).end();++i)
#define equals(a,b) (fabs((a)-(b))<EPS)
#define INF ((1LL<<62)-(1LL<<31))
#define EPS 1e-10
#define PI 3.141592653589793238
#define MOD 1000000007
#define MAX 5100000
using namespace std;
using Edge=pair<ll,ll>;
using Graph=vector<vector<int>>;
inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T>inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int main(){
  ll X;
  cin>>X;
  
  co(10-X/200);
  return 0;
}

Measured memory_bytes: 3632
import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.range, std.typecons;
import std.numeric, std.math, std.random;
import core.bitop;

string FMT_F = "%.10f";

static string[] s_rd;
T RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
string RDR()() { return readln.chomp; }
T[] ARR(T = long)(in string str, T fix = 0) { auto r = str.split.to!(T[]); r[] += fix; return r; }
size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
bool minimize(T)(ref T x, T y) { if (x > y) { x = y; return true; } else { return false; } }
bool maximize(T)(ref T x, T y) { if (x < y) { x = y; return true; } else { return false; } }

long mod = 10^^9 + 7;
void moda(ref long x, long y) { x = (x + y) % mod; }
void mods(ref long x, long y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(ref long x, long y) { x = (x * y) % mod; }

void main()
{	
	auto N = RD;
	auto v = RDR.ARR;
	auto c = RDR.ARR;

	long ans;
	foreach (i; 0..N)
	{
		ans += max(0, v[i] - c[i]);
	}

	writeln(ans);
	stdout.flush();
	debug readln();
}

Measured memory_bytes: 256
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

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

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

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

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

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

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

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

#[allow(unused_imports)]
use std::io::{stdout, Write, BufWriter};
#[allow(unused_imports)]
use std::cmp::{max, min, Ordering};
//#[allow(unused_imports)]
//use proconio::marker::{Isize1, Usize1, Bytes, Chars};

//#[proconio::fastout]

fn main() {
    input!{
        a: i32,
        b: i32,
    }
    for m in 13..1001 {
        if (2 * m) / 25 == a && m / 10 == b {
            println!("{}", m);
            return;
        }
    }
    println!("-1");
 }


Measured memory_bytes: 4352
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <algorithm>
#include <utility>
typedef long long ll;
const int INF = 1e9+1;
const int MOD = 2e9 + 9;
const ll LINF = 1e18;
using namespace std;
int main() {
	int N;
	double ans = MOD;
	cin >> N;
	vector< double>a(N);
	for (int i = 0; i < N; i++)cin >> a.at(i);
	sort(a.begin(), a.end());
	double m = a.at(N - 1);
	//cout << a.at(N - 1) << endl;
	for (int i = 0; i < N - 1; i++) {
		if (abs(a.at(i) - m / 2) <= abs(m / 2 - ans)) {
			//cout << "hoo" << endl;
			ans = a.at(i);
			
		}
	}
	//cout << MOD << endl;
	cout << (int)m << " " << (int)ans << endl;
	return 0;
}


Measured memory_bytes: 3988
#
# File    : B.rb
# Author  : Kazune Takahashi
# Created : 2/24/2019, 9:02:06 PM
# Powered by Visual Studio Code
#

n = gets.to_i

ans = 0.0

n.times{
  x, u = gets.chomp.split(" ")
  if u == "JPY"
    ans += x.to_f
  else
    ans += x.to_f * 380000.0
  end
}

puts sprintf("%.12f", ans)


Measured memory_bytes: 1788
#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.buffer.readline().split()]
def I(): return int(sys.stdin.buffer.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    n = I()
    for i in range(int(n**0.5)+2)[::-1]:
        if not n%i:
            print(n//i+i-2)
            return
    return

#Solve
if __name__ == "__main__":
    solve()


Measured memory_bytes: 38512
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
//#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<array>
#include<map>
#include<iomanip>
#include<assert.h>
#include<bitset>
#include<stack>
#include<memory>
using namespace std;
//using namespace std::chrono;
typedef long long int llint;
typedef double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase

/*
cout<<fixed<<setprecision(20);
cin.tie(0);
ios::sync_with_stdio(false);
*/
const llint mod=1000000007;
const llint big=2.19e17+1;
const long double pai=3.141592653589793238462643383279502884197;
const long double eps=1e-7;
template <class T,class U>bool mineq(T& a,U b){if(a>b){a=b;return true;}return false;}
template <class T,class U>bool maxeq(T& a,U b){if(a<b){a=b;return true;}return false;}
llint gcd(llint a,llint b){if(a%b==0){return b;}else return gcd(b,a%b);}
llint lcm(llint a,llint b){if(a==0){return b;}return a/gcd(a,b)*b;}
template<class T> void SO(T& ve){sort(ve.begin(),ve.end());}
template<class T> void REV(T& ve){reverse(ve.begin(),ve.end());}
template<class T>llint LBI(vector<T>&ar,T in){return lower_bound(ar.begin(),ar.end(),in)-ar.begin();}
template<class T>llint UBI(vector<T>&ar,T in){return upper_bound(ar.begin(),ar.end(),in)-ar.begin();}
int solve(void){
	int n,m,L,i,j;cin>>n>>m>>L;
	if(n==0){return 0;}
	vector<vector<tuple<int,int,int>>>go(n);
	while(m--){
		int a,b,d,e;cin>>a>>b>>d>>e;a--;b--;
		go[a].pub(mt(b,d,e));
		go[b].pub(mt(a,d,e));
	}
	int den[101][101];
	for(i=0;i<n;i++){
		for(j=0;j<=L;j++){
			den[i][j]=mod;
		}
	}
	den[0][L]=0;
	priority_queue<tuple<int,int,int>,vector<tuple<int,int,int>>,greater<tuple<int,int,int>>> que;
	//危険度,所持金,場所
	que.push(mt(0,L,0));
	while(que.size()){
		int now=get<0>(que.top());
		int syo=get<1>(que.top());
		int tow=get<2>(que.top());
		que.pop();
		if(den[tow][syo]<now){continue;}
		//cerr<<"now="<<now<<"syo="<<syo<<"tow="<<tow<<endl;
		int aaa=syo-1;
		while(aaa>=0&&mineq(den[tow][aaa],den[tow][syo])){aaa--;}
		for(auto it:go[tow]){
			//cerr<<"de"<<endl;
			int ter=get<0>(it);
			int cost=get<1>(it);
			int kya=get<2>(it);
			if(mineq(den[ter][syo],now+kya)){que.push(mt(now+kya,syo,ter));}
			if(syo>=cost&&mineq(den[ter][syo-cost],now)){que.push(mt(now,syo-cost,ter));}
		}
	}
	cout<<den[n-1][0]<<endl;
	return 1;
	
}

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


Measured memory_bytes: 3248
#include <bits/stdc++.h>
using namespace std;
#define fio ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
#define ll long long
#define dd double
#define pb push_back
#define ff first
#define ss second
#define Mp make_pair
const ll Mod=1000000007;
const ll INF=999999999999999999;
const ll NN=(ll)(1e6+5);
int mod(string s,int a) 
{ 
    int ans=0; 
    for (int i=0;i<s.length();i++) 
         ans=(ans*10+(int)s[i]-'0')%a; 
    return ans; 
}
ll min(ll x,ll y){if(x<y) return x;return y;}
ll max(ll x,ll y){if(x>y) return x;return y;}
ll power(ll x,unsigned ll y) 
{ 
    if (y==0) 
        return 1; 
    else if (y%2==0) 
        return power(x,y/2)*power(x,y/2); 
    else
        return x*power(x,y/2)*power(x,y/2); 
}
ll hcf(ll a,ll b) 
{ 
    if(b==0) 
        return a; 
    return hcf(b,a%b);  
}
int main()
{
   fio;
   /*#ifndef ONLINE_JUDGE 
    	freopen("input.txt", "r", stdin); 
    	freopen("output.txt", "w", stdout); 
    	freopen("error.txt", "w", stderr); 
   #endif*/
   ll TT=1;
   //cin>>TT;
   while(TT--)
   {    
       ll n,ans=0,i,c=0;
       cin>>n;
       vector <ll> v(n);
       priority_queue <ll> pq;
       for(auto &u:v)
        cin>>u;
       sort(v.rbegin(),v.rend());
       ans+=v[0];
       c++;
       for(i=1;i<n;i++)
       {
           if(c==n-1)
            break;
           ans+=v[i];
           c++;
           if(c==n-1)
            break;
           ans+=v[i];
           c++;
           if(c==n-1)
            break; 
       }  
       cout<<ans; 
   }
}

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

int m[310][310];

int main() {
    int h, w, k; cin >> h >> w >> k;
    string s[h];
    memset(m, 0, sizeof(m));
    int count = 1;
    for (int i = 0; i < h; i++) {
        cin >> s[i];
        bool flag = false;
        for (int j = 0; j < w; j++) {
            if (s[i][j] == '#') flag = true;
        }
        if (!flag) {
            if (i == 0) continue;
            if (i && !m[i-1][0]) continue;
            for (int j = 0; j < w; j++) {
                m[i][j] = m[i-1][j];
            }
        } else {
            bool fl = false;
            for (int j = 0; j < w; j++) {
                if (s[i][j] == '#') {
                    if (fl) count++;
                    else fl = true;
                }
                m[i][j] = count;
            }
            for (int k = i-1; k >= 0; k--) {
                if (m[k][0]) break;
                for (int j = 0; j < w; j++) {
                    m[k][j] = m[i][j];
                }
            }
            count++;
        }
    }
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            if (j) cout << " ";
            cout << m[i][j];
        }
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 1280
#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>;

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

  int numR = 0;
  rep(i, N) {
    if (c.at(i) == 'R') numR++;
  }

  int ans = 0;
  rep(i, numR) {
    if (c.at(i) == 'W') ans++;
  }

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

Measured memory_bytes: 3728
a1 = list(map(int,input().split()))
a2 = list(map(int,input().split()))
a3 = list(map(int,input().split()))
alist = [a1,a2,a3]
N = int(input())
blist = [int(input()) for i in range(N)]
for i in range(N):
    for j in range(3):
        for k in range(3):
            if blist[i] == alist[j][k]:
                alist[j][k] = 0
if alist[0] == [0,0,0] or alist[1] == [0,0,0] or alist[2] == [0,0,0] or [alist[0][0],alist[1][0],alist[2][0]] == [0,0,0] or [alist[0][1],alist[1][1],alist[2][1]] == [0,0,0] or [alist[0][2],alist[1][2],alist[2][2]] == [0,0,0] or [alist[0][0],alist[1][1],alist[2][2]] == [0,0,0] or [alist[2][0],alist[1][1],alist[0][2]] == [0,0,0]:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3064
<?php
list($a, $b, $c) = explode(" ", trim(fgets(STDIN)));

$a = (int) $a;
$b = (int) $b;
$c = (int) $c;

if($a < $b && $b < $c){
    echo "Yes\n";
} else {
    echo "No\n";
}



Measured memory_bytes: 9196
#include<cstdio>
#include<cstring>
#include<iostream>
#include<queue>
#include<vector>
#include<cmath>
#include<algorithm>
using namespace std;
int n,a[200005],b[200005],aa[200005],bb[200005],ans;
int main(){
	scanf("%d",&n);
	for (int i=1;i<=n;i++) scanf("%d",&a[i]);
	for (int i=1;i<=n;i++) scanf("%d",&b[i]);
	for (int i=1;i<=29;i++){
		int num=0;
		for (int j=1;j<=n;j++) if (a[j]&(1<<(i-1))) num+=n;
		for (int j=1;j<=n;j++) if (b[j]&(1<<(i-1))) num+=n;
		for (int j=1;j<=n;j++) aa[j]=a[j]&((1<<(i-1))-1);
		for (int j=1;j<=n;j++) bb[j]=b[j]&((1<<(i-1))-1);
		sort(aa+1,aa+n+1);sort(bb+1,bb+n+1);
		int jj=n+1;
		for (int j=1;j<=n;j++){
			while (jj-1>=0&&aa[jj-1]+bb[j]>=(1<<(i-1))) jj--;
			num+=n-jj+1;
		}
		ans+=(1<<(i-1))*(num&1);
	}
	printf("%d",ans);
}

Measured memory_bytes: 3328
// https://atcoder.jp/contests/abc169/tasks/abc169_b

#include "algorithm"
#include "bitset"
#include "cmath"
#include "functional"
#include "iomanip"
#include "iostream"
#include "map"
#include "numeric"
#include "queue"
#include "set"
#include "string"
#include "vector"
#define rep(i, to) for (ll i = 0; i < (to); ++i)
#define rep1(i, to) for (ll i = 1; i <= (to); ++i)
#define repf(i, from, to) for (ll i = from; i < (to); ++i)
#define repr(i, from) for (ll i = from - 1; i >= 0; --i)
#define all(vec) vec.begin(), vec.end()
#define unless(cond) if (!(cond))
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef long double ld;
template <typename T>
using V = vector<T>;
using VL = V<ll>;
using VVL = V<VL>;
template <typename T, typename U>
using P = pair<T, U>;
using PL = P<ll, ll>;
using VPL = V<PL>;

template <typename T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}

template <typename T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}

template <typename T>
inline ll len(V<T> arr) {
  return arr.size();
}

struct exit_exception : public std::exception {
  const char* what() const throw() { return "Exited"; }
};

template <typename T>
void drop(T res) {
  cout << res << endl;
  throw exit_exception();
}

const ll INF = 1e18;

void solve();

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

  try {
    solve();
  } catch (exit_exception& e) {
  }

  return 0;
}
#endif

void solve() {
  ll N;
  cin >> N;

  VL as(N);
  rep(i, N) cin >> as[i];

  auto is_zero = [](ll a) { return a == 0; };

  if (any_of(all(as), is_zero)) {
    drop(0);
  }

  ll acc = 1;

  rep(i, N) {
    ll _;
    if (__builtin_mul_overflow(acc, as[i], &_)) drop(-1);
    acc *= as[i];
  }

  ll LIMIT = 1e18;
  if (acc > LIMIT) drop(-1);

  cout << acc << "\n";
}


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

#define ll long long
#define ull unsigned long long

using namespace std;

int main() {
	int N;
	cin >> N;
	vector <int> A(N, 0);
	vector <int> dummy(N, 0);
	for (int ii = 0; ii < N; ++ii){
		cin >> A[ii];
		dummy[ii] = A[ii];
	}

	sort(dummy.rbegin(), dummy.rend());
	int max1 = dummy[0];
	int max2 = dummy[1];

	for (int ii = 0; ii < N; ++ii){
		if (A[ii] == max1){
			cout << max2 << "\n";
		} else {
			cout << max1 << "\n";			
		}
	}


	

	return 0;
}


Measured memory_bytes: 3200
using System;
using System.Linq;

class _0054 {
    public static void Main() {
        string str;
        double[] ns;
        while((str = Console.ReadLine()) != null) {
            ns = Array.ConvertAll(str.Split(), s => double.Parse(s));
            Console.WriteLine((ns[0] / ns[1]).ToString("F15").Split('.')[1].Take((int)ns[2]).Select(c => c - '0').Sum());
        }
    }
}

Measured memory_bytes: 9520
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		String output = "No";

		Scanner scanner = new Scanner(System.in);

		int n = scanner.nextInt();
		int a = scanner.nextInt();

		if((n%500)<=a)
			output = "Yes";

		System.out.println(output);

	}

}


Measured memory_bytes: 21460
/*                  ___
               :                
               ;                
              :                 
              ;                 
             /                  
           o/                   
         ._/\___,                
             \                  
             /                   
             `      
	bug
*/
#define _CRT_SECURE_NO_WARNINGS

#include <bits/stdc++.h>

using namespace std;
#define PI 3.14159265359
#define eps 1e-8
#define mp make_pair
#define pb push_back
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define FORN(i,a,b) for(int i=a;i<=b;i++)
#define REP(i,n) FOR(i,0,n)
typedef long long int ll;
const int INF = 1<<29;
typedef long long ll;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

double tick() { 
	static clock_t oldticks;
	clock_t newticks = clock();
	double diff = 1.0 * (newticks - oldticks) / CLOCKS_PER_SEC; 
	oldticks = newticks;
	return diff;
}

inline int toInt(string s){
	return atoi(s.c_str());
}

inline int gcd(int a,int b){
	return b==0?a:gcd(b,a%b);
}

inline int lcm(int a,int b){
	return a*(b/gcd(a,b));
}

inline bool isPrime(int n){
	ll j;
	j=sqrt(n);

	if(n<2)
		return 0;
	for(int i=2;i<=j;i++){
		if(n%i==0)
			return false;
	}
	return true;
}

ll n;

int main(){
	ios_base::sync_with_stdio(false); //Fast I/O
	cin.tie(NULL);
	//freopen("in.txt","r",stdin);
	//freopen("output.txt","w",stdout);	

	cin >> n;
	ll x=1;

	string res="";

	while(n!=0){
		if(n%abs(2*x)){
			n-=x;
			res+='1';
		}else{
			res+='0';
		}
		x*=-2;
	}

	reverse(res.begin(),res.end());

	if(res.length()==0)
		cout << 0 << endl;
	else
		cout << res << endl;

    //cerr << tick();

	return 0;
	
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
#include <algorithm> 
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<endl
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define mp make_pair
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define sz(x) (int)(x).size()
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pll = pair<ll, ll>;
using vc = vector<char>;
using vvc = vector<vc>;
ll dx[4]={0,1,0,-1};
ll dy[4]={1,0,-1,0};
int main(){
  ll n,a;
  cin>>n>>a;
  vll x(n+1);
  rep(i,n) cin>>x[i+1];
  vector<vvll> dp(n+1,vvll(n+1,vll(a*n+1)));
  dp[0][0][0]=1;
  rep(i,n+1){
    rep(j,n+1){
      for(int u=0;u<=a*n;u++){
        if(i>=1&&u<x[i]) dp[i][j][u]=dp[i-1][j][u];
        else if(x[i]<=u&&j>=1&&i>=1)dp[i][j][u]=dp[i-1][j-1][u-x[i]]+dp[i-1][j][u];
      }
    }
  }
  ll ans=0;
  for(int i=1;i<=n;i++){
    ans+=dp[n][i][i*a];
  }
  COUT(ans);
}

Measured memory_bytes: 52224
#include <cstdio>
#include <iostream>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <queue>
#include <vector>
using namespace std;

const int maxn = 100000 + 5;
int color[maxn];
bool vis[maxn];
vector <int> G[maxn];

void dfs(int u, int c)
{
    vis[u] = true;
    color[u] = c;

    for (int i = 0; i < G[u].size(); i++)
        if (!vis[G[u][i]])
        dfs(G[u][i], c);
}

int main()
{
    int n, m;
    while (scanf("%d %d", &n, &m) != EOF)
    {
        for (int i = 0; i < n; i++)
            G[i].clear();

        int u, v;
        for (int i = 0; i < m; i++)
        {
            scanf("%d %d", &u, &v);
            G[u].push_back(v);
            G[v].push_back(u);
        }

        memset(color, 0, sizeof(color));
        memset(vis, false, sizeof(vis));

        int c = 0;
        for (int i = 0; i < n; i++)
        {
            if (!vis[i])
            {
                ++c;
                dfs(i, c);
            }
        }

        int q;
        scanf("%d", &q);
        while (q--)
        {
            int u, v;
            scanf("%d %d", &u, &v);
            if (color[u] == color[v])
                printf("yes\n");
            else
                printf("no\n");
        }
    }
    return 0;
}




Measured memory_bytes: 12296
import math

A = 90
North = 0
East = 0
while True:
    d, a = map(int, input().split(','))
    if d==0 and a==0:
        break
    North += d * math.sin(math.radians(A))
    East += d * math.cos(math.radians(A))
    A -= a

print(int(East))
print(int(North))


Measured memory_bytes: 5716
people = {'a' => [], 'b' => [], 'c' => []}

people['a'] = gets.chomp.chars.to_a
people['b'] = gets.chomp.chars.to_a
people['c'] = gets.chomp.chars.to_a

current = 'a'
while true
  if people[current].empty?
    break
  end
  
  current = people[current].shift
end

puts current.upcase
  

Measured memory_bytes: 1788
#include <bits/stdc++.h>
#include <stdio.h>
 
using namespace std;
 
#define int long long
#define rep(i, a, b) for (int i = (a); i < (b); ++i)
#define trav(i, a) for (auto &i: (a))
#define sz(x) (int)(x).size()
#define all(v) (v).begin(), (v).end()
#define fr(i, a, b) for (int i = (a); i <= (b); ++i)
 
void solve();

 
signed main () {
    clock_t beg = clock();
    cout << fixed << setprecision(15);
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    #ifdef LOCAL
    freopen("input.txt", "r", stdin);
    #endif 
    int a,b;
    cin>>a>>b;
    int mod = 1000000000 +7;
    int dp[a][b]={};
    int ans[a][b]={};
    char s;
    rep(i,0,a){
        rep(j,0,b){
            cin>>s;
            if(s=='.'){
                dp[i][j]=1;
            }
            else{
                dp[i][j]=0;
            }

        }
    }
    rep(i,0,a){
        rep(j,0,b){
            if(dp[i][j]==0){
                ans[i][j]=0;
            }
            else{
                if(i==0&&j==0){
                    ans[i][j]=1%mod;
                }
                else if(i==0){
                    ans[i][j]=ans[i][j-1]%mod;
                }
                else if(j==0){
                    ans[i][j]=ans[i-1][j]%mod;
                }
                else{
                    ans[i][j]=(ans[i-1][j]%mod+ans[i][j-1]%mod)%mod;
                }
            }
        }
    }

    if(ans[0][0]){
        cout<<ans[a-1][b-1]%mod;
    }
    else{
        cout<<0;
    }
    return 0;
}


Measured memory_bytes: 19172
# 異なる一から取り出された部分列は区別して数えるから、特定の文字の場所による関係は考慮しなくてよい
from collections import Counter
N = int(input())
S = input()
mod = 10**9+7
# 同じ文字を使うことはできないので、"b"を使える回数は1回までで、どのbを使うかだけを考慮する
count = Counter(S)
ans = 1
for k, v in count.items():
    ans *= (v+1) % mod
print((ans-1) % mod)


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

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<bool> vb;
typedef pair<int, int> pii;
typedef pair<char, char> pcc;

#define ALL(a) (a).begin(),(a).end()
#define ZP(a, len) setfill('0') << setw(len) << right << a
const int INF = 1e9;
const int MOD = 1e9 + 7;
const int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0};

ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }

ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

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

    int a, b, c, d, e;
    vi t = vi(5);
    for (int i = 0; i < 5; ++i) {
        cin >> t[i];
    }

    int ans = 0;
    int maxLoss = 0;
    for (int i = 0; i < 5; ++i) {
        ans += t[i];
        int loss = t[i] % 10;
        if (loss != 0) {
            loss = 10 - loss;
            ans += loss;
            maxLoss = max(maxLoss, loss);
        }
    }
    ans -= maxLoss;

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


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define rep2(i, l, r) for (int i = (l); i < (r); i++)
#define ALL(x) (x).begin(), (x).end()     //昇順
#define RALL(x) (x).rbegin(), (x).rend()  // 降順
#define pri(x) cout << (x) << "\n"
#define pri2(x, y) cout << (x) << " " << (y) << "\n"
#define pri3(x, y, z) cout << (x) << " " << (y) << " " << (z) << "\n"
const long long mod = 1e9 + 7;
typedef long long ll;
typedef priority_queue<int> PQ;
typedef vector<long long> VL;
typedef vector<bool> VB;
typedef vector<int> VI;  // VI a(n);
typedef vector<double> VD;
typedef vector<string> VS;
typedef vector<char> VC;
typedef vector<VS> VSS;
typedef vector<VC> VCC;
typedef vector<VI> VII;  // VII a(n,VI(m)) n * m
typedef vector<VL> VLL;
typedef pair<ll, ll> PII;
typedef map<ll, ll> MP;  // MP a;
typedef vector<pair<ll, ll>> PS;

template <class T, class U>
bool chmax(T &a, U b) {
  if (a <= b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T, class U>
bool chmin(T &a, U b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename T>
ostream &operator<<(ostream &os, vector<T> &v) {
  os << "{";
  rep(i, (int)v.size()) { os << v[i] << (i < v.size() - 1 ? ", " : ""); }
  os << "}";
  return os;
}

// g++ -std=c++11 prac.cpp
// operator << (cout,a);
// chmin(min,a)

int main() {
  ll n,k,m,x=0,y=0,z = 0,h=0,w=0,ans=0,sum = 1, Max = -1, Min = 3e9+1;
  string u;
  bool ok=true;
  cin >> n;
  VL a(n);
  map<int, ll> mp;
  rep(i,n){
    cin >> x;
    auto itr = mp.find(x);
    if(itr != mp.end()){
      itr->second++;
    }
    else{
      mp.insert(make_pair(x,1));
    }
  }
  for( auto i = mp.rbegin(); i != mp.rend();i++ ) { 
    if(i->second/2 >= 2 && h > 0 ){
      w = i->first;
    }
    else if(i->second/2 >= 2 && h==0){
      x=i->first;
      pri(x*x);
      return 0;
    } 
    else if(i->second/2 >= 1 && h>0){
      w = i->first;
    }
    else if(i->second/2 >= 1){
      h = i->first;
    }

    if(w>0){
      pri(h*w);
      return 0;
    }
  }
  pri(0);
  return 0;
}

Measured memory_bytes: 7296
n = int(input())
l = list(map(int, input().split(" ")))
a =[0]*n

for i in range(n):
    #print(i)
    a[l[i]-1] = i + 1 #each_numのi番目のインデックスに代入, -1 はi 番目が1,2,3 ...

for i in range(n):
    print(a[i], end = " ")

Measured memory_bytes: 13880
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#define INF 100000000000LL
using namespace std;
typedef long long int ll;

int main()
{
	ll h, w;
	scanf("%lld %lld", &h, &w);
	ll ans=INF;
	for(ll i=1; i<=h-1; i++){
		ans=min(ans, max(i*w, (w+1)/2*(h-i))-min(i*w, w/2*(h-i)));
	}
	for(ll i=1; i<=w-1; i++){
		ans=min(ans, max(i*h, (h+1)/2*(w-i))-min(i*h, h/2*(w-i)));
	}
	if(h>2){
      if(h%3==0){
        printf("%d\n", 0);
        return 0;
      }
		ans=min(ans, w);
	}
	if(w>2){
      if(w%3==0){
        printf("%d\n", 0);
        return 0;
      }
		ans=min(ans, h);
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define inf 1001001001
#define mod 1000000007
#define mod2 998244353
#define pi acos(-1)
#define all(v) v.begin(),v.end()

ll gcd(ll a,ll b){
    if(b>a) swap(a,b);
    if(b==0) return a;
    return gcd(b,a%b);
}
ll lcm(ll a,ll b){
    ll g=gcd(a,b);
    return a/g*b;
}
ll rep_jijo(ll n,ll x){
    if(x==0) return 1;
    if(x%2==0){
        ll t=rep_jijo(n,x/2);
        return t*t;
    }
    return n*rep_jijo(n,x-1);
}

int main(){
    int x,n;
    int ans = inf;
    int ansp;
    cin >> x >> n;
    vector<int>p(n);
    rep(i,n) cin >> p[i];
    vector<int>num;
    for(int i = -300; i <= 300; i++){
        bool flag=true;
        rep(j,n){
            if(p[j] == i) flag =false;
        }
        if(flag)num.push_back(i);
    }
    for(int i = 0; i < num.size(); i++){
        int sub = abs(x-num[i]);
        if(sub < ans ){
            ans = sub;
            ansp=num[i];
        }
    }
    cout << ansp <<endl;

   return 0;
}

Measured memory_bytes: 3636
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>
#include<cmath>
#include<cstdio>
#include<tuple>
#include<bitset>
#include<map>

using namespace std;
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define ALL(x) x.begin(),x.end()
using P=pair<int,int>;
using lint=long long;
using ll=long long;
const lint inf=1e18+7;
const int MOD=1000000007;
signed main(){
  lint a;cin>>a;
  string b;cin>>b;
  b+="xxxxxxx";
  lint l=b.length();
  lint bb=0;
  lint mul=100;
  rep(i,5){
    if(b[i]=='.'){
      continue;
    }
    if(b[i]=='x')break;
    bb*=10;
    bb+=b[i]-'0';
  }
  //cout<<bb<<endl;
  lint res=a*bb;
  res/=100;
  cout<<res<<"\n";
  return 0;
}


Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define N 200005
ll mod=1000000007;
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL)
#define all(x) x.begin(),x.end()
#define lb lower_bound
ll powermodm(ll x,ll n,ll M){ll result=1;while(n>0){if(n % 2 ==1)result=(result * x)%M;x=(x*x)%M;n=n/2;}return result;}
ll power(ll _a,ll _b){ll _r=1;while(_b){if(_b%2==1)_r=(_r*_a);_b/=2;_a=(_a*_a);}return _r;}
 
int main(){
    
    fast;
    
    ll n,k;
    cin>>n>>k;
    bool f=0;
    ll a[n+1],b[n+1];
    multiset<ll> mul;
    for(int i=1;i<=n;i++){
        cin>>a[i];
    }
    for(int i=1;i<=n;i++){
        cin>>b[i];
    }
    
    ll l=0;
    ll r=1e13;
    sort(a+1,a+n+1);
    sort(b+1,b+n+1);
    
    ll ans=r;
    
    while(l<=r){
        ll mid=(l+r)/2;
        ll c1=0;
        for(int i=1;i<=n;i++){
            if(a[i]*b[n-i+1] > mid){
                c1 = c1 + a[i] - mid/b[n-i+1];
            }
        }
        
        if(c1>k){
            l=mid+1;
        }
        else{
            ans=min(ans,mid);
            r=mid;
        }
        
        if(l==r){
            if(f==0)
                f=1;
            else
                break;
        }
    }
    
    cout<<ans<<endl;
    
    return 0;
}


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

using namespace std;

int main(){
    int n; cin >> n;
    vector<int> p(n);
    for(int i=0; i<n; ++i){
        cin >> p[i];
    }
    int ans = 0;
    for(int i=1; i<n-1; ++i){
        if(p[i]>p[i-1] && p[i]<p[i+1]) ans++;
        else if(p[i]<p[i-1] && p[i]>p[i+1]) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
import numpy as np

N = int(input())
rN = int(np.sqrt(N))

A = np.zeros(N)



for i in range(rN):
   for j in range(rN):
       for k in range(rN):
           x = i + 1
           y = j + 1
           z = k + 1
           n = x**2 + y**2 + z**2 + x*y + y*z + z*x
           if N < n :
               break
           else:
               A[n-1] += 1



for a in A:
    print(int(a))

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

#define pb         push_back

typedef long long ll;
const ll INF = 1000000000000000000ll;
const ll MOD = 1000000007ll;
const double EPS = 1e-8;

const int MAX_N = 100005;
int par[MAX_N], tree_rank[MAX_N];
void init(int n){
    for(int i=0; i<n; i++){
        par[i] = i;
        tree_rank[i] = 0;
    }
}

int root(int x){
    return par[x] == x ? x : par[x] = root(par[x]);
}

bool same(int x, int y){
    return root(x) == root(y);
}

void unite(int x, int y){
    x = root(x);
    y = root(y);
    if(x == y) return;

    if(tree_rank[x] < tree_rank[y]){
        par[x] = y;
    }else{
        par[y] = x;
        if(tree_rank[x] == tree_rank[y]) tree_rank[x]++;
    }
}


int main(void) {
    //ios_base::sync_with_stdio(false);
    //cin.tie(0);
    int n, m;
    cin >> n >> m;
    init(n+1);

    vector<int> p;
    for(int i=0; i<n; i++){
        int t;
        cin >> t;
        p.pb(t);
    }

    vector<int> xs;
    vector<int> ys;
    for(int i=0; i<m; i++){
        int x, y;
        cin >> x >> y;
        unite(x, y);
    }

    int ans = 0;
    for(int i=1; i<=n; i++){
        if(same(p[i-1], i)){
            ans++;
        }
    }

    cout << ans << endl;


    return 0;
}


Measured memory_bytes: 1660
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
OV = [a-b for a, b in zip(A, B) if a-b>0]
OV.sort(reverse = True)
UD = [a-b for a, b in zip(A, B) if a-b<0]
ans = len(UD)
if ans != 0:
  OVC = [sum(UD)]*(len(OV)+1)
  for i in range(1,len(OV)+1):
    OVC[i]=OVC[i-1]+OV[i-1]
    if OVC[i]>=0:
      ans += i
      OVC[-1]=0
      break
  if OVC[-1]<0:
    print(-1)
  else:
    print(ans)
else:
  print(ans)

Measured memory_bytes: 18620
#include<stdio.h>
int main(void){
  int a,b;
  int max=0;
  int i;

  scanf("%d",&a);
  scanf("%d",&b);
  for(i=0;i<2;i++){
    if(a>=b) {
      max=max+a;
      a=a-1;
    }else{
      max=max+b;
      b=b-1;
    } 
  }
    printf("%d",max);

    return 0;
}

Measured memory_bytes: 128
S = raw_input()
i = len(S)
while i >= 0:
    hit = False
    for w in ["dreamer", "eraser", "dream", "erase"]:
        if S[i-len(w):i] == w:
            i -= len(w)
            hit = True
            break
    if not hit:
        break
print "YES" if (i == 0) else "NO"

Measured memory_bytes: 2692
#include <stdio.h>
	
int main()
{
	int a,b;
	int d, r;
	double f;
	scanf("%d %d",&a, &b);
	d = a / b;
	r = a % b;
	f = (double)a/(double)b;

	printf("%d %d %f\n", d, r, f);
	return 0;
}

Measured memory_bytes: 636
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <string>
#include <algorithm>
#include <climits>
#include <utility>

#define PRINT(STR) cout << STR << endl;
#define REP(i, n) for (int (i) = 0; (i) < (int)(n); (i)++)
#define REG(i, a, b) for (int (i) = ((int)(a)); (i) < ((int)(b)); i++)
#define ALL(V) (V).begin(), (V).end()
#define SPACE " "

typedef long long ll;

using namespace std;

int nextInt() { int n = -1; cin >> n; return n; }
double nextDouble() { double d = -1; cin >> d; return d; }
ll nextll() { ll n = -1; cin >> n; return n; }
string nextString() { string str; cin >> str; return str; }

int INF = 1LL << 25;
double EPS = 1e-9;
int numofbits(int bits)
{
    bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555);
    bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333);
    bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f);
    bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff);
    return (bits & 0x0000ffff) + (bits >>16 & 0x0000ffff);
}

// BEGIN //////////////////////////////////////////////////////////////
int main() {
  int x[3];
  int a = 0, b = 0;
  while (scanf("%d,%d,%d", x, x+1, x+2) != EOF) {
    if (x[0] * x[0] + x[1] * x[1] == x[2] * x[2]) {
      a++;
    } else if (x[0] == x[1]) {
      b++;
    }
  }
  cout << a << endl << b << endl;
	return 0;
}
// END   //////////////////////////////////////////////////////////////

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

typedef pair<int, int> Pair;

int main() {
  for(int n, w, d; cin >> n >> w >> d && (n|w|d); ) {
    vector<Pair> ps(1, make_pair(w, d));
    for(int i = 0; i < n; ++i) {
      int p, s; cin >> p >> s; --p;
      int a = ps[p].first;
      int b = ps[p].second;
      ps.erase(ps.begin() + p);
      s %= a + b;
      int c, d, e, f;
      if(s < a) {
        c = s; e = a - s;
        d = f = b;
      } else  {
        s -= a;
        c = e = a;
        d = s; f = b - s;
      }
      if(c * d <= e * f) {
        ps.push_back(make_pair(c, d));
        ps.push_back(make_pair(e, f));
      } else {
        ps.push_back(make_pair(e, f));
        ps.push_back(make_pair(c, d));
      }
    }
    vector<int> area;
    for(int i = 0; i < ps.size(); ++i) {
      area.push_back(ps[i].first * ps[i].second);
    }
    sort(area.begin(), area.end());
    for(int i = 0; i < ps.size(); ++i) {
      if(i) cout << " ";
      cout << area[i];
    }
    cout << endl;
  }
  return 0;
}

Measured memory_bytes: 1220