akhauriyash/Code-Regression huggingface dataset:
//master
import java.io.*;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.*;
public class Main {
    static int[][] memo;
    public static void main(String[] args) {
        FastScanner sc = new FastScanner();
        String a = sc.next();
        String b = sc.next();
        BigDecimal ba = new BigDecimal(a);
        BigDecimal bb = new BigDecimal(b); 

        BigDecimal ans = ba.multiply(bb).setScale(0, RoundingMode.DOWN);
        p(ans);

    }

    public static <T> void p(T message) {
        System.out.println(message);
    }

    public static <T> void pe(T message) {
        System.err.println(message);
    }

    public static <T> void pp(T message) {
        System.out.print(message);
    }
    
}
class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        } else {
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
 
    private int readByte() {
        if (hasNextByte())
            return buffer[ptr++];
        else
            return -1;
    }
 
    private boolean isPrintableChar(int c) {
        return 33 <= c && c <= 126;
    }
 
    public boolean hasNext() {
        while (hasNextByte() && !isPrintableChar(buffer[ptr]))
            ptr++;
        return hasNextByte();
    }
 
    public String next() {
        if (!hasNext())
            throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while (isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
 
    public long nextLong() {
        if (!hasNext())
            throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while (true) {
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            } else if (b == -1 || !isPrintableChar(b)) {
                return minus ? -n : n;
            } else {
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
 
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
            throw new NumberFormatException();
        return (int) nl;
    }
 
    public double nextDouble() {
        return Double.parseDouble(next());
    }
}


Measured memory_bytes: 25580
#include <iostream>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <vector>
#include <complex>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <bitset>
#include <ctime>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cassert>
#include <cstddef>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <sstream>
#include <fstream>

#define REP(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
#define RREP(i,a) for(int (i)=(a)-1;(i)>=0;(i)--)
#define FORR(i,a,b) for(int (i)=(a)-1;(i)>=(b);(i)--)
#define PI acos(-1.0)
#define DEBUG(C) cout<<C<<endl;
#define VI vector<int>
#define VII vector<VI>
#define VL vector<LL>
#define VLL vector<VL>
#define VD vector<double>
#define VDD vector<VD>
#define PII pair<int,int>
#define PDD pair<double,double>
#define PLL pair<LL,LL>
#define VPII vector<PII>
#define ALL(a) (a).begin(),(a).end()
#define SORT(a) sort(ALL(a))
#define REVERSE(a) reverse(ALL(a))
#define MP make_pair
#define EP emplace_back
#define FORE(a,b) for(auto &&a:b)

using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
const int INF=1e9;
const int MOD=INF+7;
#define int LL

signed main(){
    int N; cin >> N;
    VL A(N);
    REP(i,N){
        scanf("%lld",&A[i]);
    }
    LL ans=0;
    LL buf=0;
    REP(i,N){
        if(A[i]==0){
            ans+=buf/2;
            buf=0;
        }else{
            buf+=A[i];
        }
    }
    cout<<ans+(buf/2)<<endl;
}


Measured memory_bytes: 1024
ABCD = list(input())

A = int(ABCD[0])
B = int(ABCD[1])
C = int(ABCD[2])
D = int(ABCD[3])

AA = ABCD[0]
BB = ABCD[1]
CC = ABCD[2]
DD = ABCD[3]

if A+B+C+D==7:
    print(AA+'+'+BB+'+'+CC+'+'+DD+'=7')
elif A+B+C-D==7:
    print(AA+'+'+BB+'+'+CC+'-'+DD+'=7')
elif A+B-C+D==7:
    print(AA+'+'+BB+'-'+CC+'+'+DD+'=7')
elif A+B-C-D==7:
    print(AA+'+'+BB+'-'+CC+'-'+DD+'=7')
elif A-B+C+D==7:
    print(AA+'-'+BB+'+'+CC+'+'+DD+'=7')
elif A-B+C-D==7:
    print(AA+'-'+BB+'+'+CC+'-'+DD+'=7')
elif A-B-C+D==7:
    print(AA+'-'+BB+'-'+CC+'+'+DD+'=7')
elif A-B-C-D==7:
    print(AA+'-'+BB+'-'+CC+'-'+DD+'=7')

Measured memory_bytes: 38256
#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <functional>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <deque>
#include <ctime>
  
using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define pb push_back
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second
#define println(X) cout<<X<<endl;
#define DBG(X) cout<<#X<<" : "<<X<<endl;
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<ll> vl;
typedef vector<vl> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;
const double PI = acos(-1);

int main(){
	int n;
	cin>>n;
	if(n == 1) {
		cout<<1<<endl;
		return 0;
	}
	map<int, int> mp;
	for(int i = 2; i <= n; i++){
		int a = i;
		for(int j = 2; j * j<= i; j++){
			while(a > 1 && a % j == 0){
				a /= j;
				mp[j]++;
			}
		}
		if(a > 1) mp[a]++;
	}
	ll ans = 1LL;
	for(auto& p : mp){
		(ans *= (ll)(p.se+1))%=MOD;
		//cout<<" "<<p.fi<<" "<<p.se<<" "<<ans<<endl;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
int main(){
   int n;
   cin>>n;
   vector<int> inp(n);
   vector<vector<long long int>>dp(n+1, std::vector<long long int>(n+1));
   long long int sum=0;
   std::vector<long long int > pre_sums(n+1);
   for(int i=0;i<n;i++){
   	cin>>inp[i];
    sum+=inp[i];
    pre_sums[i+1]=(long long int)inp[i]+pre_sums[i];
  }

  for(int j=0;j<n;j++){
  	dp[j][j]=inp[j];
   for(int i=j-1;i>=0;i--){
    dp[i][j]=max(inp[i]+(pre_sums[j+1]-pre_sums[i+1])-dp[i+1][j], inp[j]+(pre_sums[j]-pre_sums[i])-dp[i][j-1]);
   }
  }



cout<<(dp[0][n-1]-(sum-dp[0][n-1]))<<endl;

	return 0;
}

Measured memory_bytes: 70784
#include <iostream>
#include <iomanip>
#include <valarray>

int main() {
    while (true) {
        int n;
        std::cin >> n;
        if (n == 0) break;

        std::valarray<double> s(n);
        for (int i = 0; i < n; i++) {
            std::cin >> s[i];
        }

        double mean = s.sum() / s.size();
        double variance = (s * s).sum() / s.size() - mean * mean;
        std::cout << std::fixed << std::sqrt(variance) << std::endl;
    }
}



Measured memory_bytes: 3292
N = int(input()) 
S = input() 
r = S.count('R')
g = S.count('G')
b = N - g - r
count = 0
for i in range(N-2):
    for j in range(i+1,N-1):
        k = 2*j-i
        if k < N:
            if not (S[i] == S[j] or S[i] == S[k] or S[j] == S[k]):
                count = count + 1
        else:
            break
print(r*g*b - count)

Measured memory_bytes: 9212
N = int(input())
a = list(map(int, input().split()))

b=[-1]*N
b[N-1]=a[N-1]
for i in range(N-1)[::-1]: #N=4なら 2,1,0
    sum_count = N // (i+1)
    if sum_count==1:
        b[i]=a[i]
    else:
        sum1=0
        for j in range(sum_count-1):
            sum1 = sum1 + b[(i+1)*(j+2)-1]
        sum1 = sum1 % 2
        b[i]=(a[i]+ sum1)%2

print(sum(b))
for i in range(N):
    if b[i]==1:
        print(i+1,end=" ")

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

using namespace std;

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

#define MOD 1000000007
#define REP(i, N) for (int i = 0; i < N; ++i)
#define REP1(i, N) for (int i = 1; i <= N; ++i)
#define RREP(i, N) for (int i = N - 1; i >= 0; --i)
#define ALL(a) a.begin(), a.end()

int main() {
  int n;
  string s;
  cin >> n >> s;
  if (n % 2 != 0) {
    cout << "No" << endl;
    return 0;
  }
  string t = "";
  string u = "";
  REP(i, n / 2) t += s[i];
  for (int i = n / 2; i < n; ++i) u += s[i];
  if (t == u) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {
    int n, k;
    int[] ls;

    public static void main(String args[]) {
        new Main().run();
    }

    void run() {
        FastReader sc = new FastReader();
        n = sc.nextInt();
        k = sc.nextInt();
        ls = new int[n];
        for(int i = 0; i < n; i++) {
            ls[i] = sc.nextInt();
        }
        solve();
    }

    void solve() {
        Arrays.sort(ls);
        int sum = 0;
        for (int i = n - 1; i >= n - k; i--) {
            sum += ls[i];
        }
        System.out.println(sum);
    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }
}


Measured memory_bytes: 21204
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
typedef long long ll;
#include <bits/stdc++.h>
using namespace std;
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}
const int MAX = 510000;
 const int MOD = 1000000007;
 
 long long fac[MAX], finv[MAX], inv[MAX];
 
 // テーブルを作る前処理
 void COMinit() {
     fac[0] = fac[1] = 1;
     finv[0] = finv[1] = 1;
     inv[1] = 1;
     for (int i = 2; i < MAX; i++){
         fac[i] = fac[i - 1] * i % MOD;
         inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
         finv[i] = finv[i - 1] * inv[i] % MOD;
     }
 }
 
 // 二項係数計算
 long long COM(int n, int k){
     if (n < k) return 0;
     if (n < 0 || k < 0) return 0;
     return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
 }
int main() {
    COMinit();
    ll h,w,a,b;
    cin >> h>>w>>a>>b;
    ll result = 0;
    rep(i,w-b){
        result += fac[h-a-1+b+i]*finv[h-a-1]%MOD*finv[b+i]%MOD*fac[a-1+w-b-1-i]%MOD*finv[a-1]%MOD*finv[w-b-1-i]%MOD;
        result %= MOD;
    }
    cout<<result<<endl;
}


Measured memory_bytes: 12160
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define fi first
#define se second
typedef pair<ll,ll> P;
#define Mod 1000000007
using VP = vector<P>; using VVP = vector<VP>;
using VI = vector<ll>; using VVI = vector<VI>; using VVVI = vector<VVI>;
#define INF 1ll<<59

int main(){
    ll a,p;
    cin>>a>>p;
    p+=3*a;
    cout<<p/2<<endl;
}

Measured memory_bytes: 256
#include<stdio.h>

#define MAX 10000
#define NIL -1

struct Node {
  int p;
  int l;
  int r;
};

  struct Node t[MAX];
int n;

void preOrder(int u){
  if(u == NIL){
    return;
  }
  printf(" %d",u);
  preOrder(t[u].l);
  preOrder(t[u].r);
}

void inOrder(int u){
  if(u == NIL){
    return;
  }
  inOrder(t[u].l);
  printf(" %d",u);
  inOrder(t[u].r);
  
}

void postOrder(int u){
  if( u == NIL){
    return;
  }
  postOrder(t[u].l);
  postOrder(t[u].r);
  printf(" %d",u);
  
}

int main(){
  int i,v,l,r,root;

  scanf("%d",&n);
  for(i = 0;i<n;i++){

    t[i].p = NIL;
    }
  for(i = 0;i<n;i++){
    scanf("%d%d%d",&v,&l,&r);
    t[v].l = l;
    t[v].r = r;
    if(l!=NIL)t[l].p = v;
    if(r!=NIL)t[r].p = v;
  }
  for(i = 0;i<n;i++){
    if(t[i].p == NIL){
      root = i;
    }
  }
  printf("Preorder\n");
  preOrder(root);
  printf("\n");
  printf("Inorder\n");
  inOrder(root);
  printf("\n");
  printf("Postorder\n");
  postOrder(root);
  printf("\n");

  return 0;
  
  

}



Measured memory_bytes: 2096
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define PB push_back
#define MP make_pair
#define ll long long

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();}

int main(){
    std::ios::sync_with_stdio(false);
    int n;
    cin >> n;
    ll arr[n+1] = {};
    ll acc = 0;
    for(int i=1;i<=n;++i)
    {
        if((i%3 != 0) && (i%5 !=0))
        {
            acc += i;
        }
        arr[i] = acc;
    }
    cout << arr[n] << endl;
}

Measured memory_bytes: 11396
#include <stdio.h>
int n, x;
int a[100];
int main() {
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%d", a + i);
		if (a[i] % 2)x++;
		else if (a[i] % 3 == 0 || a[i] % 5 == 0)x++;
	}
	if (n == x)printf("APPROVED\n");
	else printf("DENIED\n");
}

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

int main()
{
    string s;
    cin >> s;
    vector<int> num(s.size());

    rep(i, s.size()) 
        num.at(i) = s.at(i) - '0';

    int sum;
    vector<char> op(s.size()-1);

    rep(tmp,(1<<3)) {
        bitset<3> bit(tmp);
        
        sum = num.at(0);
        rep(i, 3) {
            if (bit.test(i)) {
                sum += num.at(i+1);
                op.at(i) = '+';
            } else {
                sum -= num.at(i+1);
                op.at(i) = '-';
            }
        }
        if (sum == 7) {
            cout << num.at(0) << op.at(0) << num.at(1) << op.at(1) << num.at(2) << op.at(2) << num.at(3) << "=" << sum << endl;
            break;
        } else {
            continue;
        }
    }

}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>
#include<functional>
#include<map>
#define LL long long
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPA(i,n) for(int i=1;i<(n);++i)
#define PII pair<int,int>
#define PLI pair<long long, int>
#define MOD ((int)1e9 + 7)
#define INF ((int)1e9)
#define INFLL ((LL)1e18)
#define ALL(x) (x).begin(),(x).end()
#define ctoi(x) (x - 'a') 
#define CTOI(x) (x - 'A')
#define BIT(x) (1 << (x))
using namespace std;
int main(){
    int N;
    cin >> N;
    vector<int> line(N+1, 1);
    REPA(i, N+1){
        int d = i;
        int p = 2;
        while(p<=d){
            while(d%p==0){
                line[p]++;
                d/=p;
            }
            ++p;
        }
    }
    LL ans = 1;
    REPA(i, N+1){
        ans = (ans * line[i]) % MOD;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
/*
Author: Sanskar Agarwal
Nick: sanskaragarwal
Birla Institute Of Technology, Mesra
*/
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define endl "\n"
#define fast ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define F(i,a,b) for(ll i = (ll)(a); i <= (ll)(b); i++)
#define RF(i,a,b) for(ll i = (ll)(a); i >= (ll)(b); i--)
#define INF 100009
#define mod 1000000007
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define ff first
#define ss second
#define test while(t--)solve();

void solve()
{
	int n;
	cin >> n;
	int arr[n];
	int x = 0;
	set<int> s;
	unordered_map<int, int> mp;
	for (int i = 0; i < n; ++i)
	{
		cin >> arr[i];
		x ^= arr[i];
		mp[arr[i]]++;
		s.insert(arr[i]);
	}
	if (s.size() == 1 && *s.begin() == 0)
	{
		cout << "Yes" << endl;
		return;
	}
	if (s.size() == 2)
	{
		auto i = s.begin();
		auto j = s.rbegin();
		if ((2 * n) % 3 == 0 && mp[*j] == (2 * n / 3) && mp[*i] == n / 3)
			cout << "Yes" << endl;
		else
			cout << "No" << endl;
		return;
	}
	if (x != 0 || s.size() != 3)
	{
		cout << "No" << endl;
		return;
	}
	auto i = s.begin();
	int t = mp[*i];
	for (i; i != s.end(); ++i)
	{
		if (mp[*i] != t)
		{
			cout << "No" << endl;
			return;
		}
	}
	cout << "Yes" << endl;
}

int main()
{

	fast
	int t;
	t = 1;
	// cin >> t;
	test;
#ifndef ONLINE_JUDGE
	cout << "\nTime Elapsed : " << 1.0 * clock() / CLOCKS_PER_SEC << " s\n";
#endif
	return 0;
}

Measured memory_bytes: 10336
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int N = scan.nextInt();
        List<Integer> kushi = new ArrayList<>();
        for (int i = 0; i < 2 * N; i++) {
            kushi.add(scan.nextInt());
        }
        kushi.sort(Comparator.naturalOrder());
        int total = 0;
        int idx = 0;
        for (Integer l : kushi) {
            if (idx % 2 == 0) {
                total += l;
            }
            idx++;
        }
        System.out.println(total);
    }
}

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

double compute(double a, double b){
    return sqrt((a*a)+(b*b));
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    int x,d,c=0;
    cin >> x >> d;
    for(int i = 0 ; i < x; ++i){
        double a,b;
        cin >> a >> b;
        c += (compute(a,b)<=d);
    }
    cout << c;
    return 0;
}

Measured memory_bytes: 3848
function inI()
    a = Ref{Int64}(0)
    ccall(:scanf, Int32, (Ptr{UInt8}, Ref{Int64},), "%lld", a)
    Int(a[])
end

function outI(x::Int64)
    ccall(:printf, Void, (Ptr{UInt8}, Int64), "%lld\n", x)
end

@inbounds let
    n = inI()
    x = Int[inI() for _ in 1:n]
    l = inI()
    q = inI()
    const lg = 20
    F = Array(Int, lg, n)
    B = Array(Int, lg, n)
    for i = 1:n
        F[1,i] = searchsortedlast(x, x[i]+l)
        B[1,i] = searchsortedfirst(x, x[i]-l)
    end

    for fe = 2:lg
        for i = 1:n
            F[fe,i] = F[fe-1,F[fe-1,i]]
            B[fe,i] = B[fe-1,B[fe-1,i]]
        end
    end

    for i = 1:q
        a = inI()
        b = inI()

        ans = 1
        if a < b
            for fe = lg:-1:1
                if F[fe,a] < b
                    a = F[fe,a]
                    ans += 2^(fe-1)
                end
            end
        else
            for fe = lg:-1:1
                if B[fe,a] > b
                    a = B[fe,a]
                    ans += 2^(fe-1)
                end
            end
        end
        outI(ans)
    end
end


Measured memory_bytes: 101688
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
int main()
{

    int i;
    char input[19];
    gets(input);
    for(i=0;i<19;i++)
    {
        if(input[i]==','||input[i]=='.')
        {
            input[i]=' ';
        }
    }
    printf("%s\n",input);
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
 
#define DEBUG
 
// 型名の省略
typedef unsigned int uint;
typedef long long lint;
typedef unsigned long long ulint;
 
const int MOD = 1000000007;
const double PI=acos(-1.0);
 
// cinとcoutの高速化
#define endl "\n"
struct cinacc{cinacc(){cin.tie(0);ios::sync_with_stdio(false);}}cinaccc;
struct coutacc{coutacc(){cout.setf(ios::fixed);cout.precision(12);}}coutaccc;
 
// 繰り返し
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep_(i,n) for(int i=0;i<(int)(n-1);i++)
#define rep__(i,n) for(int i=n-1;i>=0;i--)
 
int main(void) {
    int a, b;
    cin >> a >> b;
    for(int i = 1; i <= 1009; i++) {
        if((int)(i * 0.08) == a && (int)(i * 0.10) == b) {
            cout << i;
            return 0;
        }
    }
    
    cout << -1;
    
    return 0;
}


Measured memory_bytes: 256
N,M = map(int,input().split())
a = []
for i in range(N):
    array = list(map(int,input().split()))
    a.append(array)
a.sort()
ans = 0
bought = 0
for i in range(N):
    if bought+a[i][1]>M:
        ans+= a[i][0]*(M-bought)
        bought=M
        print(ans)
        exit()
    ans += a[i][0]*a[i][1]
    bought += a[i][1]
print(ans)

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

public class Main {
    PrintWriter out = new PrintWriter(System.out);
    long mod = 1000000000+7;
    public static void main(String[] args) throws Exception {
        Main main = new Main();
//        main.solve();
        System.out.println(main.solve());
    }
    long solve(){
        Scanner sc = new Scanner(System.in);
        // use i-indexed here
        int n = sc.nextInt(), m = sc.nextInt();
        int[] s = new int[n+1], t = new int[m+1];
        for(int i=1;i<=n;i++) s[i] = sc.nextInt();
        for(int i=1;i<=m;i++) t[i] = sc.nextInt();
        long[][] dp = new long[n+1][m+1];
        for(int i=1;i<=n;i++){
            for(int j=1;j<=m;j++){
                dp[i][j] = (dp[i-1][j]+dp[i][j-1]-dp[i-1][j-1]+mod)%mod;
                if(s[i]==t[j]){
                    dp[i][j] += 1+dp[i-1][j-1];
                    dp[i][j] %= mod;
                }
            }
        }
        return dp[n][m]+1;
    }
}



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

#define N	200000
#define M	200000
#define N_	(1 << 18)	/* N_ = pow2(ceil(log2(M))) */

int max(int a, int b) { return a > b ? a : b; }

int ll[N], rr[N];

int compare(const void *a, const void *b) {
	int i = *(int *) a;
	int j = *(int *) b;

	return ll[i] - ll[j];
}

int sum[N_ * 2], suf[N_ * 2], n_;

void pul(int i) {
	int l = i << 1, r = i << 1 | 1;

	sum[i] = sum[l] + sum[r];
	suf[i] = max(suf[r], suf[l] + sum[r]);
}

void build(int n) {
	int i;

	n_ = 1;
	while (n_ < n)
		n_ <<= 1;
	for (i = 1; i < n - 1; i++)
		sum[n_ + i] = -1;
	for (i = n_ - 1; i > 0; i--)
		pul(i);
}

void update(int i) {
	i += n_;
	suf[i] = max(sum[i]++, 0);
	while (i > 1)
		pul(i >>= 1);
}

int main() {
	static int ii[N];
	int n, m, i, l, ans;

	scanf("%d%d", &n, &m);
	for (i = 0; i < n; i++) {
		scanf("%d%d", &ll[i], &rr[i]);
		ii[i] = i;
	}
	qsort(ii, n, sizeof *ii, compare);
	build(m + 2);
	ans = max(n - m, 0);
	for (l = 0, i = 0; l <= m; l++) {
		while (i < n && ll[ii[i]] == l)
			update(rr[ii[i++]]);
		ans = max(ans, suf[1] - l);
	}
	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 7656
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
#include <stack>
#include <queue>
#include <string>

#define REP(i,n)for (int i=0;i<(n);i++)
#define PB push_back
#define MP make_pair
#define ALL(a) (a).begin(),(a).end()
#define ll long long
using namespace std;
typedef pair<int,int> P;

string fld[10];

void to_fld(string s){
	int p=0;
	REP(i,s.size()){
		if(s[i]=='/'){
			p++;
		}else if(s[i]=='b'){
			fld[p]+='b';
		}else{
			int c=s[i]-'0';
			REP(j,c)fld[p]+='.';
		}
	}
}

string to_string(){
	int i=0;
	string s="";
	while(fld[i]!=""){
		int c=0;
		REP(j,fld[i].size()){
			if(fld[i][j]=='b'){
				if(c>0){
					s+=c+'0';
					c=0;
				}
				s+='b';
			}else{
				c++;
			}
		}
		if(c>0){
			s+=c+'0';
		}
		s+='/';
		i++;
	}
	return s;
}

int main(){
	string s;
	while(1){
		cin>>s;
		if(s=="#")break;
		int a,b,c,d;
		cin>>a>>b>>c>>d;
		REP(i,10)fld[i]="";
		to_fld(s);
		fld[--a][--b]='.';
		fld[--c][--d]='b';
		s=to_string();
		s.erase(s.size()-1);
		cout<<s<<endl;
	}
}


Measured memory_bytes: 3164
x,y = map(int,input().split())
a = [1,3,5,7,8,10,12]
b = [4,6,9,11]
c = [2]
if x in a and y in a:
    print("Yes")
elif x in b and y in b:
    print("Yes")
elif x in c and y in c:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3060
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "ctime"

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(begin, i, end) for (int i = begin; i < (int)(end); i++)
#define all(v) v.begin(), v.end()
const int MOD = 1000000007;

int main()
{
    ll x, y;
    cin >> x >> y;
    vector<ll> a(13);
    a = {0,
         1,
         3,
         1,
         2,
         1,
         2,
         1,
         1,
         2,
         1,
         2,
         1};
    if (a.at(x) == a.at(y))
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
}

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


void solve(long long N, long long K, std::vector<long long> D){
    long long ans = 0;
    for(long long i = N; i < 100000; ++i){
        //cout << i << endl;
        string S = to_string(i);
        bool check = true;
        for(auto s : S){
            for(auto d : D){
                string st{s};
                string ds = to_string(d);
                //cout << st << " " << ds << endl;
                if(st == ds){
                    //cout << "check!" << endl;
                    check = false;
                }
            }
        }
        if(check){
            //cout << i << endl;
            ans = i;
            break;
        }
    }
    cout << ans << endl;
    return;
}

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


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

int main()
{
    int P, Q, R;
    cin >> P >> Q >> R;
    vector<int> array(3);
    array[0] = P;
    array[1] = Q;
    array[2] = R;
    sort(array.begin(), array.end());
    cout << array[0] + array[1] << endl;
}

Measured memory_bytes: 256
#pragma region head
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
#define bit(n) (1LL << (n))
#define len(x) ((ll)(x).size())
#define debug(var) cout << "[" << #var << "]\n" << var << endl
#define test(s) \
  if (!(s))     \
    cout << "Line " << __LINE__ << ": [" << #s << "] is false" << endl;
#define int long long
typedef long long ll;
#define double long double
typedef double ld;
const int INF = 1001001001001001001ll;
const ll LINF = 1001001001001001001ll;
const int MOD = 1000000007;
const double EPS = 1e-9;
const double PI = acos(-1.0);

template <typename T>
ostream& operator<<(ostream& s, const vector<T>& v) {
  int len = v.size();
  for (int i = 0; i < len; ++i) {
    s << v[i];
    if (i < len - 1)
      s << ' ';
  }
  return s;
}

template <typename T>
ostream& operator<<(ostream& s, const vector<vector<T>>& vv) {
  int len = vv.size();
  for (int i = 0; i < len; ++i) {
    s << vv[i];
    if (i != len - 1)
      s << '\n';
  }
  return s;
}

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

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

__attribute__((constructor)) void initial() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
}
#pragma endregion

int ff(int n) {
  int res = 0;
  while (n != 0) {
    res++;
    n %= __builtin_popcount(n);
  }
  return res;
}

signed main() {
  int N;
  cin >> N;
  string X;
  cin >> X;

  int B = 0;
  for (char c : X) {
    B += c == '1';
  }

  int Bp = B + 1, Bm = B - 1;

  if (Bm == 0) {
    vector<int> R(N);
    int t = 1;
    rep(i, N) {
      t %= 2;
      R[i] = t;
      t *= 2;
    }
    reverse(all(R));

    int ind = -1;
    rep(i, N) {
      if (X[i] == '1') {
        ind = i;
        break;
      }
    }

    rep(i, N) {
      if (X[i] == '1')
        cout << 0 << endl;
      else {
        int temp = R[ind] + R[i];
        temp %= 2;
        int ans = ff(temp) + 1;
        cout << ans << endl;
      }
    }

    return 0;
  }

  int Sp = 0, Sm = 0;
  for (char c : X) {
    Sp = Sp * 2 + c - '0';
    Sp %= Bp;
    Sm = Sm * 2 + c - '0';
    Sm %= Bm;
  }

  vector<int> Rp(N), Rm(N);
  int tp = 1, tm = 1;
  rep(i, N) {
    tp %= Bp;
    Rp[i] = tp;
    tp *= 2;
    tm %= Bm;
    Rm[i] = tm;
    tm *= 2;
  }
  reverse(all(Rp));
  reverse(all(Rm));

  rep(i, N) {
    int n;
    if (X[i] == '1') {  // m
      n = Sm - Rm[i];
      n = (n + Bm) % Bm;
    } else {
      n = Sp + Rp[i];
      n %= Bp;
    }
    int ans = ff(n) + 1;
    cout << ans << endl;
  }
}

Measured memory_bytes: 6832
#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 1001001001001001001
#define mod 1000000007
#define mod2 998244353
#define pi acos(-1)
#define all(v) v.begin(),v.end()

int main(){
    int N;cin>>N;
    vector<int>L(N);
    int ans=0;
    rep(i,N){
        cin>>L.at(i);
    }
    sort(L.begin(),L.end());
    reverse(L.begin(),L.end());
    for(int i=0;i<N-2;i++){
        for(int j=i+1;j<N-1;j++){
            for(int l=j+1;l<N;l++){
                int a=L.at(i);
                int b=L.at(j);
                int c=L.at(l);
                if(a==b|| b==c || c==a){
                    continue;
                }
                if((a+c)>b && (a+b)>c && (b+c)>a){
                    ans++;
                    continue;
                }
            }
        }
    }
    cout<<ans<<endl;

}

Measured memory_bytes: 3632
def bubleSort(table):
    table = table.copy()
    for nAchieve in range(len(table)):
        for i in range(len(table) - 1, nAchieve, -1):
            if table[i][1] < table[i - 1][1]:
                table[i], table[i - 1] = table[i - 1], table[i]
    return table


def selectionSort(table):
    table = table.copy()
    for nAchieve in range(len(table)):
        minimum_index = nAchieve
        for i in range(nAchieve + 1, len(table)):
            if table[minimum_index][1] > table[i][1]:
                minimum_index = i
        if minimum_index != nAchieve:
            table[nAchieve], table[minimum_index] = table[minimum_index], table[nAchieve]
    return table


def checkStable(stable, comparison):
    if stable == comparison:
        return 'Stable'
    else:
        return 'Not stable'


element = int(input())
table = list(map(str, input().split()))

y = selectionSort(table)
x = bubleSort(table)
print(' '.join(map(str, x)))
print('Stable')
print(' '.join(map(str, y)))
print(checkStable(x, y))



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

int const M = 1e6 + 41;
int const N = 1e5 + 41;
int const B = 2341;
long long INF = 1e9 * 1LL * 1e9;
long long MAXV = 1e9 * 10LL;

int n, ans, l[M], add;
map<long long, int> ma, was;
vector<pair<long long, long long> > all;

void sieve(){
	for(int i=2;i<M;++i){
		if(l[i] == 0){
			for(int j=i;j<M;j+=i){
				if(l[j] == 0 || l[j] > i){
					l[j] = i;
				}
			}
		}
	}
}

pair<long long, long long> pushSmall(long long v){
	long long v1 = 1;
	long long v2 = 1;
	while(v > 1){
		int k = l[v];
		int d = 0;
		while(v % k == 0){
			++d;
			v /= k;
		}
		d %= 3;
		if(d > 0){
			for(int i=0;i<d;++i){
				v1 *= k;
			}
			for(int i=0;i<3-d;++i){
				v2 *= k;
				if(v2 > MAXV){
					return make_pair(v1, INF);
				}
			}
		}
	}
	return make_pair(v1, v2);
}

pair<long long, bool> isQ(long long v){
	long long c = sqrt(v);
	if((c-1)*(c-1) == v){
		return make_pair(c-1, true);
	}
	if(c*c == v){
		return make_pair(c, true);
	}
	if((c+1)*(c+1) == v){
		return make_pair(c+1, true);
	}
	return make_pair(41, false);
}

vector<pair<long long, int> > getFactV(long long v){
	vector<pair<long long, int> > ret;
	while(v > 1){
		int k = l[v];
		int d = 0;
		while(v % k == 0){
			v /= k;
			++d;
		}
		d %= 3;
		if(d > 0){
			ret.push_back(make_pair(k, d));
		}
	}
	return ret;
}

pair<long long, long long> push(long long v){
	if(v < M){
		return pushSmall(v);
	}else{
		for(int i=2;i<B;++i){
			if(l[i] == i && (v % i == 0)){
				int k = i;
				int d = 0;
				while(v % k == 0){
					v /= k;
					++d;
				}
				d %= 3;
				long long v1 = 1;
				long long v2 = 1;
				if(d > 0){
					for(int j=0;j<d;++j){
						v1 *= k;
					}
					for(int j=0;j<3-d;++j){
						v2 *= k;
						if(v2 > MAXV){
							return make_pair(v1, INF);
						}
					}
				}
				pair<long long, long long> ret = push(v);
				if(MAXV / v2 < ret.second){
					return make_pair(41, INF);
				}
				return make_pair(v1 * ret.first, v2 * ret.second);
			}
		}
		pair<long long, bool> q = isQ(v);
		if(q.second){
			vector<pair<long long, int> > fV = getFactV(q.first);
			long long v1 = 1;
			long long v2 = 1;
			for(int i=0;i<fV.size();++i){
				for(int j=0;j<3-fV[i].second;++j){
					v1 *= fV[i].first;
				}
				for(int j=0;j<fV[i].second;++j){
					v2 *= fV[i].first;
				}
			}
			return make_pair(v1, v2);
		}
		return make_pair(41, INF);
	}
}

int main(){
#ifdef _DEBUG
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
#endif
	sieve();
	scanf("%d",&n);
	for(int i=0;i<n;++i){
		long long ai;
		scanf("%lld",&ai);
		pair<long long, long long> cur = push(ai);
		if(cur.second == INF){
			++add;
		}else{
			all.push_back(cur);
		}
	}
	for(int i=0;i<all.size();++i){
		++ma[all[i].first];
	}
	for(int i=0;i<all.size();++i){
		if(all[i].first == 1){
			continue;
		}
		if(was[min(all[i].first, all[i].second)] == 0){
			was[min(all[i].first, all[i].second)] = 1;
			ans += max(ma[all[i].first], ma[all[i].second]);
		}
	}

	ans += (ma[1] ? 1 : 0);
	printf("%d\n",ans+add);

	return 0;
}

Measured memory_bytes: 21104
<?php
main();

function main() {
	$sumTime = 0;
	$minFirstDigitValue = 10;
 
	for ($i = 0; $i < 5; $i++) {
		$input = fgets(STDIN);
		$minFirstDigitValue = compareFirstDigit($minFirstDigitValue, $input);
		$sumTime += roundUpFirstDigit($input);
	}
 
	$sumTime -= 10 - $minFirstDigitValue;
 
	printf($sumTime);
}
 
function roundUpFirstDigit($value) {
	return intval(ceil($value * 0.1) * 10);
}
 
function compareFirstDigit($minFirstDigitValue, $value) {
	$firstDigit = $value % 10;
	if ($firstDigit < $minFirstDigitValue && $firstDigit > 0) {
		$minFirstDigitValue = $firstDigit;
	}
	return $minFirstDigitValue;
}

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

int main() {
    char a,b;
    cin>>a>>b;
    if (a=='H'&&b=='H') cout<<"H";
    if (a=='H'&&b=='D') cout<<"D";
    if (a=='D'&&b=='H') cout<<"D";
    if (a=='D'&&b=='D') cout<<"H";
}


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

int main() {
  int x,y;
  cin>>x>>y;
  int h=x;
  int e=x;
  vector<int>a(y);
  for(int i=0;i<y;i++){
    cin>>a.at(i);
  } 
  int c=0;
  for(int i=0;i<y;i++){
    for(int j=0;j<y;j++){
      if(a.at(j)==h){
        c++;
        h--;
        break;
      }
    }
  }
  int d=0;
   for(int i=0;i<y;i++){
    for(int j=0;j<y;j++){
      if(a.at(j)==e){
        d++;
        e++;
        break;
      }
    }
  }
  if(c==0&&d==0){
    cout<<x;
  }
  else if(c>d){
    cout<<x+d;
  }
  else if(c<=d){
       cout<<x-c;
  }
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
int64_t MOD=10000007;

int main() {
  int N;
  cin>>N;
  N%=10;
  if(N==3) cout<<"bon";
    else if(N==0||N==1||N==6||N==8) cout<<"pon";
  else cout<<"hon";
}


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

using namespace std;

const int INF = 1e9 + 7;

void solve()
{
  int x, y;
  cin >> x >> y;
  switch (x) {
  case 2:
    if (y == 2) cout << "Yes\n";
    else cout << "No\n";
    break;
  case 4:
  case 6:
  case 9:
  case 11:
    switch (y) {
    case 4:
    case 6:
    case 9:
    case 11:
      cout << "Yes\n";
      break;
    default:
      cout << "No\n";
      break;
    }
    break;
  case 1:
  case 3:
  case 5:
  case 7:
  case 8:
  case 10:
  case 12:
    switch (y) {
    case 1:
    case 3:
    case 5:
    case 7:
    case 8:
    case 10:
    case 12:
      cout << "Yes\n";
      break;
    default:
      cout << "No\n";
      break;
    }
    break;
  default:
    break;
  }
}

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

Measured memory_bytes: 256
N, W = map(int, input().split())
dp = [{ 0: 0 }]
for i in range(N):
  w, v = map(int, input().split())
  d = dp[i]
  d2 = {}
  for w0 in d:
    v0 = d[w0]
    d2[w0] = v0
  for w0 in d:
    v0 = d[w0]
    if w0+w > W:
      continue
    if w0+w not in d:
      d2[w0+w] = v0+v
    else:
      d2[w0+w] = max(d2[w0+w], v0+v)
  dp.append(d2)
r = max(dp[N].values())
print(r)


Measured memory_bytes: 646628
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repr(i,n) for(int i = (int)(n); i >= 0; i--)
#define all(v) v.begin(),v.end()
typedef long long ll;

int main(){
    ll S;
    cin >> S;
    vector<ll> vec(2001, 0);
    vec[0] = 0;
    vec[1] = 0;
    vec[2] = 0;
    vec[3] = 1;
    vec[4] = 1;
    vec[5] = 1;
    for (ll i = 6; i <= 2000; i++){
        vec[i] = 1;
    }
    for (ll i = 6; i <= 2000; i++){
        for (ll j = 0; j <= i - 3; j++){
            vec[i] = (vec[i] + vec[j]) % 1000000007;
        }
    }
    cout << vec[S] << endl;
}

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

public class Main {
	static int[] a, lis, b;
	static ArrayList<Integer>[] adjList;

	static Stack<Solve> st;

	public static int bins(int key) {
		int lo = 0;
		int hi = b.length - 1;
		int ans = -(int) 1e9;
		while (lo <= hi) {
			int mid = lo + hi >> 1;
			if (b[mid] >= key) {
				ans = mid;
				hi = mid - 1;
			} else {
				lo = mid + 1;
			}
		}
		return ans;
	}

	public static void solve() {
		st.add(new Solve(0, -1, true));
		while (!st.isEmpty()) {
			st.pop().ex();
		}
	}

	static class Solve {
		int u;
		int p;
		boolean s;
		int old;
		int changedidx;

		public Solve(int u, int p, boolean s) {
			this.u = u;
			this.p = p;
			this.s = s;
		}

		public Solve(int old, int changedidx) {
			this.old = old;
			this.changedidx = changedidx;
			s = false;
		}

		public void ex() {
			if (s) {
				int cidx = bins(a[u]);
				int old = b[cidx];
				b[cidx] = a[u];
				lis[u] = bins((int) 2e9);
				st.add(new Solve(old, cidx));
				for (int x : adjList[u]) {
					if (x != p) {
						st.add(new Solve(x, u, true));
					}
				}
			} else {
				b[changedidx] = old;
			}
		}
	}

	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		PrintWriter pw = new PrintWriter(System.out);
		int n = sc.nextInt();
		a = sc.nextIntArr(n);
		b = new int[n + 1];
		Arrays.fill(b, (int) 2e9);
		adjList = new ArrayList[n];
		for (int i = 0; i < adjList.length; i++) {
			adjList[i] = new ArrayList<Integer>();
		}
		for (int i = 0; i < n - 1; i++) {
			int u = sc.nextInt() - 1;
			int v = sc.nextInt() - 1;
			adjList[u].add(v);
			adjList[v].add(u);
		}

		lis = new int[n];

		st = new Stack<Solve>();
		solve();
		for (int i = 0; i < lis.length; i++) {
			pw.println(lis[i]);
		}
		pw.close();

	}

	static class Scanner {
		BufferedReader br;
		StringTokenizer st;

		public Scanner(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}

		public int[] nextIntArr(int n) throws IOException {
			int[] arr = new int[n];
			for (int i = 0; i < n; i++) {
				arr[i] = Integer.parseInt(next());
			}
			return arr;
		}

	}

}


Measured memory_bytes: 82104
h,w=map(int,input().split())
board=[list(input())+['#'] for _ in range(h)]
board.append(['#']*(w+1))
hacum=[[0]*(w+1) for _ in range(h+1)]
wacum=[[0]*(w+1) for _ in range(h+1)]
for i in range(h):
  tmp=0
  for j in range(w+1):
    if board[i][j]=='#':
      for k in range(tmp,j):
        wacum[i][k]=j-tmp
      tmp=j+1
for i in range(w):
  tmp=0
  for j in range(h+1):
    if board[j][i]=='#':
      for k in range(tmp,j):
        hacum[k][i]=j-tmp
      tmp=j+1
ans=0
for i in range(h):
  for j in range(w):
    ans=max(ans,wacum[i][j]+hacum[i][j]-1)
print(ans)

Measured memory_bytes: 251016
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A.at(i);
  }
  vector<int> Ans(N);
  
  for (int i = 0; i < N; i++) {
    Ans.at(A.at(i)-1) = i+1;
  }
  
  for (int i = 0; i < N; i++) {
  cout << Ans.at(i);
    if (i == N-1) {
      cout << endl;
    }
    else {
      cout << " ";
    }
  }
}

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

int main (void) {
  long long N, A, B;	
  cin >> N >> A >> B;
  long long count = 0;
  long long q = N / (A + B);
  long long r = N % (A + B);
  count += q * A;
  if (r < A) count += r;
  else count += A;
  cout << count << endl;
  return 0;
}

Measured memory_bytes: 256
from itertools import product
N, K = map(int, input().split())
A = list(map(int, input().split()))

ans = 10 ** 18
for build in product(range(2), repeat=N - 1):
    if sum(build) != K - 1:
        continue

    # 左のやつは絶対見る
    cost = 0
    h = A[0]
    for i, p in enumerate(build, start=1):
        if p == 0:
            h = max(h, A[i])
            continue
        if A[i] > h:
            h = A[i]
            continue
        else:
            h += 1
            cost += (h - A[i])
    ans = min(ans, cost)

print(ans)

Measured memory_bytes: 3064
#include<iostream>
#include<bits/stdc++.h>
#define mod 1000000007
#define int long long
#define pii pair<int,int>
#define pb(x) push_back(x)
#define lbound lower_bound
#define ubound upper_bound
#define gcd(a,b) __gcd(a,b)
#define all(v) v.begin(),v.end()
#define bits(x) __builtin_popcountll(x)
#define heap_min priority_queue<int,vector<int>,greater<int>>
#define heap_max priority_queue<int>
#define precision(x) cout << setprecision(x) << fixed;
#define printv(v) for(auto p : v) cout << p << " ";
#define printa(a,n) for(int i = 0 ; i < n ; i++) cout << a[i] << " "; 
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

using namespace std;

int32_t main()
{
   fast;
   #ifndef ONLINE_JUDGE
   freopen("goodluckin.txt","r",stdin);
   freopen("goodluckout.txt","w",stdout);
   #endif

   int t,d,s;
   cin >> d >> t >> s;
   int k = (d/s);
   if(d%s!=0){
    k++;
   }
   if(k<=t){
    cout << "Yes";
   }
   else{
    cout << "No";
   }

}


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

int main() {
  int N; cin >> N;
  vector<vector<int>> H(N, vector<int>(3));
  for (int i = 0; i < N; i++) cin >> H[i][0] >> H[i][1] >> H[i][2];
  
  vector<vector<int>> dp(N, vector<int>(3, 0));
  for (int j = 0; j < 3; j++) {
    dp[0][j] = H[0][j];
  }
  
  for (int i = 1; i < N; i++) {
    for (int j = 0; j < 3; j++) {
      int cur = -1;
      for (int k = 0; k < 3; k++) {
        if (j == k) continue;
        cur = max(dp[i-1][k] + H[i][j], cur);
      }
      dp[i][j] = cur;
    }
  }
  
  int ans = -1;
  for (int j = 0; j < 3; j++) {
    ans = max(dp[N-1][j], ans);
  }
  
  cout << ans << endl;
}

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

int main() {
	int A, B;
	cin >> A >> B;
	int Amin = ceil((double)A / 0.08);
	int Amax = ceil((A + 1.0) / 0.08) - 1;
	int Bmin = ceil((double)B / 0.1);
	int Bmax = ceil((B + 1.0) / 0.1) - 1;
	if (Amax < Bmin || Bmax < Amin) cout << -1;
	else cout << max(Amin, Bmin);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
# define PI           3.14159265358979323846  /* pi */
typedef long double ld;

int main(){
    ld a, b, h, m;
    cin >> a >> b >> h >> m;
    long long ta = 12*60;
    long long  tb  = 60;
    long long gt = h*60 + m;
    long double angle_a;
    angle_a = (2*PI *(gt%ta)) / (ta);
    long double angle_b;

    angle_b = (2*PI *(gt%tb)) / (tb);

    long double xa, xb, ya, yb;
    xa = a * cosl(angle_a);
    ya = a * sinl(angle_a);

    xb = b * cosl(angle_b);
    yb = b * sinl(angle_b);

    long double fans = sqrt((yb-ya)*(yb-ya) + (xb-xa)*(xb-xa));
    printf("%.10Lf", fans);

    return 0;
}

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

typedef long long ll;
const int dx[]={1,-1,0,0};
const int dy[]={0,0,1,-1};
const int MAXN=7e6+10;
const int MAXM=505;
const int INF=10000000;
const int mod=1e9+7;

ll power(ll a,ll b){
    ll c=1;
    while(b){
        if ((b&1)!=0) c=(c*a)%mod;
        a=(a*a)%mod;
        b/=2;
    }
    return c;
}

int f(int a){
    int len=0;
    while(a!=0){
        len++;
        a/=10;
    }
    return len;
}

int main(){
    int s;
    scanf("%d",&s);
    int r=0,sum=0,a=1,len1=1,b=1,len2=1;
    ll cnt1=0;
    for(int i=1;i<1e7;i++){
        if (i-1<a) sum-=len1-1;
        else a*=10,len1++,sum-=len1-1;
        while(sum<s){
            r++;
            if (r<b) sum+=len2-1;
            else b*=10,len2++,sum+=len2-1;
        }
        if (sum==s){
            cnt1++;
            if (cnt1==mod) cnt1=0;
        }
    }
    //cout<<cnt1<<endl;
    ll cnt2=0;
    for(int i=1;i<=s/8;i++){
        if (s%i!=0){
            cnt2++;
            continue;
        }
        cnt2+=(((power(10,s/i-1)*9)%mod-i+1)%mod+mod)%mod;
        cnt2%=mod;
    }
    ll cnt3=0;
    cout<<((cnt1+cnt2)%mod+cnt3)%mod<<endl;
    return 0;
}

Measured memory_bytes: 256