akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize(2)
#pragma GCC optimize(3)
#pragma GCC optimize(4)
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pi acos(-1.0)
#define LL long long
//#define mp make_pair
#define pb push_back
#define ls rt<<1, l, m
#define rs rt<<1|1, m+1, r
#define ULL unsigned LL
#define pll pair<LL, LL>
#define pii pair<int, int>
#define piii pair<pii, int>
#define mem(a, b) memset(a, b, sizeof(a))
#define fio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define fopen freopen("in.txt", "r", stdin);freopen("out.txt", "w", stout);
//head

const int N = 2e5 + 5;
int res[N];
int main() {
	fio;
	int n, k;
	cin >> n >> k;
	for (int i = 1; i <= n; i++) res[i%k]++;
	LL ans = 0;
	ans += 1LL * res[0] * res[0] * res[0];
	if(k % 2 == 0) ans += 1LL * res[k/2] * res[k/2] * res[k/2];
	cout << ans << endl;
	return 0;
} 

Measured memory_bytes: 640
#include <bits/stdc++.h>
#include <iomanip>
 
using namespace std;
 
typedef long long LL;
typedef long double LD;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;
typedef pair<LD, LD> PLDLD;
typedef vector<int> VI;
typedef vector<LL> VLL;
typedef vector<char> VB;
 
#define FOR(i,a,b) for(int i=(a);i<(int)(b);++i)
#define REP(i,n) FOR(i,0,n)
#define CLR(a) memset((a), 0 ,sizeof(a))
#define ALL(a) a.begin(),a.end()
#define endl "\n"
 
const LD EPS=1e-10;
const long long INFLL=(LL)(1e9)*(LL)(1e9);
const int INF=1e9;
 
template<class T>
void chmin(T& a, const T b)
{
	if(a>b)
		a=b;
}
template<class T>
void chmax(T& a, const T b)
{
	if(a<b)
		a=b;
}
 
const LL pow(const LL p, const LL q)
{
	LL t=1;
	for(int i=0;i<q;i++)
		t*=p;
	return t;
}

template <typename T>
struct has_iter
{
	private:
		template <typename U>
		static constexpr true_type check(typename U::iterator*);
		template <typename U>
		static constexpr false_type check(...);

	public:
		static constexpr bool value = decltype(check<T>(nullptr))::value;
};


template<typename T, typename U = typename T::iterator>
void print(const T& container)
{
		auto&& first=begin(container), last=end(container);
		auto&& back=prev(last);
		for(auto e=first; e!=last; e=next(e))
			cout<<*e<<" \n"[e==back];
}


extern void* enabler;
template<typename Head, typename enable_if<!has_iter<Head>::value>::type*& = enabler>
void print(const Head& head)
{
	cout<<head<<endl;
}

template<> void print<string>(const string& container)
{
	cout<<container<<endl;
}

template<typename Head, typename... Tail>
void print(const Head& head, const Tail&... tail)
{
	cout<<head<<" ";
	print(tail...);
}

void io_speedup()
{
	cin.tie(0);
	cout.tie(0);
	ios::sync_with_stdio(false);
}

template<typename T>
istream& operator >> (istream& is, vector<T>& vec)
{
	for(T& x: vec) is >> x;
	return is;
}


template<typename T, typename U>
ostream& operator << (ostream& os, const pair<T, U>& p)
{
	os<<'('<<p.first<<", "<<p.second<<')';
	return os;
}

template<typename T>
vector<T> read(int n)
{
	vector<T> t(n);
	cin>>t;
	return t;
}

template<typename T>
T read()
{
	T t;
	cin>>t;
	return t;
}

template<typename Head, typename... Tail>
struct vector_demensions
{
	using type=vector<typename vector_demensions<Tail...>::type>;
};

template<typename Head>
struct vector_demensions<Head> { using type=Head; };

template<typename T>
vector<T> make_vectors(int size, T val)
{
	return vector<T>(size, val);
}

template<typename T=int, typename... Args>
auto make_vectors(int size, Args... tail)
	-> typename vector_demensions<Args..., T>::type
{
	auto val=make_vectors<T>(forward<Args>(tail)...);
	return vector<decltype(val)>(size, val);
}


int main()
{
	int a,b;
	cin>>a>>b;
	if(a+b==15)
		print('+');
	else if(a*b==15)
		print('*');
	else
		print('x');
}


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

int main() {
	int n,k;
	cin>>n>>k;
	if(k==0) {
		for(int i=0;i<(1<<n);i++) printf("%d %d ",i,i);
	}
	else if(n>1&&k<(1<<n)) {
		for(int i=(1<<n)-1;i>=0;i--) if(i!=k) printf("%d ",i);
		cout<<k<<' ';
		for(int i=0;i<(1<<n);i++) if(i!=k) printf("%d ",i);
		cout<<k<<endl;
	}
	else puts("-1");
}

Measured memory_bytes: 1792
from bisect import *
try:
    while True:
        print ['light fly', 'fly', 'bantam', 'feather', 'light', 'light welter',
               'welter', 'light middle', 'middle', 'light heavy', 'heavy'][bisect_left([48, 51, 54, 57, 60, 64, 69, 75, 81, 91], float(raw_input()))]
except EOFError:
    pass

Measured memory_bytes: 4300
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <numeric>
#include <iomanip>
#include <tuple>

using namespace std;
const long long mod=1e9+7;
const long long INF=1LL<<60;

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

   long long ans=0;
   sort(d.begin(),d.end());
   ans=d[n/2]-d[n/2-1];
   cout<<ans<<endl;
}
 
   

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

int main(){
  int n,k,j=1;
  cin >> n >> k;
  for(int i=0;i<n-1;++i){
    j *= (k-1);
  }
    
  cout << k*j << endl;
}
/*int pow(int a,int b){
int b=1;
for(int i=0;i<b;i++) b*=a;
return 0;
}*/

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#define INF 1010001000
#define loop(i, n) for (int i = 1; i < n; i++)

int main()
{
int n, m; 
while(cin >> n >> m,(n|m)){
m++;
vector<vector<int> > time(m,vector<int>(m,INF)), cost(m,vector<int>(m,INF));
loop(i, n+1){
int a,b,c,t; cin>>a>>b>>c>>t;
time[a][b]=t;time[b][a]=t;
cost[a][b]=c;cost[b][a]=c;
}
loop(k, m){loop(i, m){loop(j, m){
time[i][j]=min(time[i][j],time[i][k]+time[k][j]);
cost[i][j]=min(cost[i][j],cost[i][k]+cost[k][j]);
}}}
int k; cin>>k;
loop(i, k+1){
int p,q,r; cin>>p>>q>>r;
if(r) cout<<time[p][q]<<endl;
else cout<<cost[p][q]<<endl;
}
}
return 0;

}

Measured memory_bytes: 3132
# Atcoder国では、郵便番号は A+B+1 文字からなり、
# A+1 文字目はハイフン -、それ以外の全ての文字は 0 以上 9 以下の数字です。
# 文字列 S が与えられるので、Atcoder国の郵便番号の形式を満たすかどうか判定してください。

input_line_1 = gets.chomp.split
s = gets.chomp

a = input_line_1[0].to_i
b = input_line_1[1].to_i

result = "Yes"
numbers = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]

a.times do |i|
  unless numbers.include?(s[i])
    result = "No"
    break
  end
end

if result != "No"
  if s[a] == "-"
    b.times do |i|
      unless numbers.include?(s[a + i + 1])
        result = "No"
        break
      end
    end
  else
    result = "No"
  end
end

puts result


Measured memory_bytes: 3836
#include <stdio.h>

int main(){
  int i,j,k,l,n,r[10000],m[101][101];

  scanf("%d",&n);
  for(i=1;i<=n;i++){
    scanf("%d %d",&r[i-1],&r[i]);
  }

  for(i=1;i<=n;i++){
    m[i][i] = 0;
  }
  for(l=2;l<=n;l++){
    for(i=1;i<=n-l+1;i++){
      j = i + l -1;
      m[i][j] = 500000000;
      for(k=i;k<=j-1;k++){
	if(m[i][j] >= m[i][k]+m[k+1][j]+r[i-1]*r[k]*r[j]){
	  m[i][j] = m[i][k]+m[k+1][j]+r[i-1]*r[k]*r[j];
	}
      }
    }
  }

  printf("%d\n",m[1][n]);

  return 0;

}

Measured memory_bytes: 644
#include<stdio.h>
int main(void)
{
	for(;;){
		int i,a,b,c=0;
		scanf("%d %d\n",&a,&b);
		if(a==0&&b==0)
		break;
		if(a>b){
			c=a;
			a=b;
			b=c;
		}
		printf("%d %d\n",a,b);
	}
	return 0;
}

Measured memory_bytes: 1752
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <map>
#include <set>
using namespace std;

#define INF (1ll<<60)

long long solve(int l, vector<int> x){
    int n=x.size();
    long long res=x[n-1];
    long long v=res;
    int r=n-1,ll=-1;
    for(int i=n-2;i>-1;--i){
        if((n-i)%2==0){
            v-=x[r]-x[i];
            v+=x[i]+l-x[n+ll];
            r--;
            ll--;
        }
        else{
            v-=x[r]-x[i];
            v+=x[i]+l-x[n+ll+1];
        }
        // cout<<res<<endl;
        res=max(res,v);
    }
    return res;
}

int main(int argc, char const *argv[]) {
    int l,n;
    cin>>l>>n;
    vector<int> x(n);
    for(int i=0;i<n;++i){
        cin>>x[i];
    }
    long long res = solve(l,x);
    vector<int> y(n);
    for(int i=0;i<n;++i)y[i]=l-x[n-i-1];
    res=max(res,solve(l,y));
    cout<<res<<endl;
    return 0;
}

Measured memory_bytes: 2544
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.HashMap;

public class Main {
    public static void main(String[] args){
        try{
            BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
            String  t=br.readLine();
            boolean ff=false;
            for(int i=0;i<t.length();i++){
                if(t.charAt(i)=='7'){
                    ff=true;
                }
            }
            if(ff){
                System.out.println("Yes");
            }else{
                System.out.println("No");
            }
        }catch(Exception e){
            System.out.println("KKKK "+e.getMessage());
        }
    }
}


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

signed main(){
  int S,W;
  cin>>S>>W;
  string ans="safe";
  if(W>=S)ans="unsafe";
  cout<<ans<<endl;
}

Measured memory_bytes: 3624
using System;

public class P
{
    public int n { get; set; }
    public int m { get; set; }
    public int[] got { get; set; }
    public int p { get; set; }
}

public class Hello
{
    public static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        var n = int.Parse(line[0]);
        var m = int.Parse(line[1]);
        line = Console.ReadLine().Trim().Split(' ');
        var c = Array.ConvertAll(line, int.Parse);
        var w = new P { n = n, m = m, got = new int[6], p = 0 };
        var ans = goDfs(c, w);
        if (ans) print(w);
        else Console.WriteLine("NA");
    }
    static void print (P w)
    {
        for (int i = 1; i <= w.p; i++)
            Console.Write(w.got[i]);
        Console.WriteLine();
    }
    static bool goDfs ( int [] c, P w)
    {
        if (w.n == 0) return true;
        var ok = false;
        for (int i = 0; i <= 9; i++)
        {
            if (c[i] <=w.m && w.n > 0)
            {
                w.n--;
                w.m -= c[i];
                w.p++;
                w.got[w.p] = i;
                var a =  goDfs(c, w);
                if (a) { ok = true; break; }
                else
                {
                    w.n++;
                    w.m += c[i];
                    w.p--;
                }
            }
        }
        return ok;
    }
}



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

int main() {
	string S, out = "None";
	cin >> S;
	for (int i = 1; i <= 26; i++) {
		bool check = true;
		char x = i + 96;
		for (int j = 0; j < S.size(); j++) {
			if (S[j] == x) check = false;
		}
		if (check) {
			out = x;
			break;
		}
	}
	cout << out << endl;
}

Measured memory_bytes: 512
N,X = map(int,input().split())

a,p = [1], [1] #総枚数a,パティの枚数がp
for i in range(N): #a[i] = iバーガーの枚数
    a.append(a[i] *2 +3)
    p.append(p[i] *2 +1)

def f(N,X):
    if N == 0:
        if X>0:
            return 1
        else:
            return 0
        
    elif X <= 1 + a[N-1]:#真ん中以下の場合
        return f(N-1,X-1)#N-1バーガーでX-1（バンズがふえているので）枚食べるのと同じ
    else:
        return p[N-1] +1 + f(N-1, X-2-a[N-1])#N-1バーガー+真ん中パティ+N-1バーガーのうち[X-2-N-1バーガーの枚数]分だけ食べる
print(f(N,X))

Measured memory_bytes: 38384
#include<bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define lint long long
#define ll long long
#define pq priority_queue
#define mp make_pair
#define pb push_back
#define vl vector<long long>
#define pii pair<long long,long long>
#define all(x) (x).begin(),(x).end()
#define rep(x) for(int i = 0;i < (x);i++)
#define repj(x) for(int j = 0;j < (x);j++)
#define REP(i,x) for(int (i) = 0;(i) < (x);(i)++)
#define rrep(x) for(int i = (x);i >= 0;i--)
#define mod 1000000007
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
int qp(int a,ll b){int ans=1;do{if(b&1)ans=1ll*ans*a;a=1ll*a*a;}while(b>>=1);return ans;}
int qp(int a,ll b,int mo){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
long long INF = 1e10;
/************************  DEFINE  ****************************/

/************************ FUNCTION ****************************/

/************************   MAIN   ****************************/
int main(void){
    int n;cin >> n;
    vector<int> a(n); rep(n) cin >> a[i];
    a.pb(1000000000 + 10);
    sort(all(a));

    int i = 0;
    int j = 1;
    int ans = 0;
    while(i < n){
        if(a[i+1] == a[i]){
            j++; i++; continue;
        }else{
            if(j >= a[i]) ans += j - a[i];
            else ans += j;
            j = 1; i++; continue;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>

int main(void){
	int n, i, min, su, max;
	long int sum;
	scanf("%d", &n);
	min = 1000000;
	max = -1000000;
	sum = 0;

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

		if(su < min){
			min = su;
		}
	
		if(su > max){
			max = su;
		}
		sum = sum + su;
	}
	printf("%d %d %ld\n", min, max, sum);
	return 0;
}

Measured memory_bytes: 600
N = int(input())
A = list(map(int, input().split()))

approved = True
for i in range(N):
  if A[i]%2 == 0:
    if A[i]%3 == 0 or A[i]%5 == 0:
      continue
    else:
      approved = False
  
print("APPROVED" if approved == True else "DENIED")

Measured memory_bytes: 3060
#include<stdio.h>
int main(void)
{
	int n,m;
	int i,j;
	char a[100],b[100],c;

	scanf("%d",&n);
	while(n!=0){
		for(i=0;i<n;i++){
			scanf(" %c %c",&a[i],&b[i]);
		}
		scanf("%d",&m);
		for(i=0;i<m;i++){
			scanf(" %c",&c);
			for(j=0;j<n;j++){
				if(a[j]==c){
					c=b[j];
					break;
				}
			}
			printf("%c",c);
		}
		printf("\n");
		scanf("%d",&n);
	}
	return 0;
}

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

int main()
{
    string s;
    int i,a[4]={0};
    cin>>s;
    for(i=0;i<=2;i++) 
    {
        if(s[i]=='a') a[1]++;
        if(s[i]=='b') a[2]++;
        if(s[i]=='c') a[3]++;
    }
    if (a[1]==1 && a[2]==1 && a[3]==1) cout<<"Yes"; else cout<<"No";
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
/*#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
*/typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll,ll> pl;
typedef pair<int,int> pii;

#define int ll
#define LOCAL 0
#define dbg(x) cout << #x << " is " << x << "\n"
#define gll(x) scanf("%d",&x)
#define gll2(x,y) scanf("%d%d",&x,&y)
#define gll3(x,y,z) scanf("%d%d%d",&x,&y,&z)
#define gllarr(arr,n) f(i,n) gll(arr[i]);
#define sz(x) ((int)x.size())
#define s(x) sort(x.begin(),x.end())
#define all(v) v.begin(),v.end()
#define rs(v) { s(v) ; r(v) ; }
#define r(v) {reverse(all(v));}
#define pb push_back
#define f(i,n) for(int i=0;i<n;i++)
#define fr(i,n) for(int i=n-1;i>=0;i--)
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define repr(i,a,b) for(int i=a;i>=b;i--)

const ll mod = (ll)1e9 + 7;
const ll inf = (ll)1e16;
const ld eps = 1e-12;
const ll N = (int)1e5 + 5;
const ll LOGN = 19;
const ld PI = 3.14159265358979323846;
inline ll mul(ll a, ll b, ll m = mod) { return (ll)(a * b) % m;}
inline ll add(ll a, ll b, ll m = mod) { a += b; if(a >= m) a -= m; if(a < 0) a += m; return a;}
inline ll power(ll a, ll b, ll m = mod) { if(b == 0) return 1; if(b == 1) return (a % m); ll x = power(a, b / 2, m); x = mul(x, x, m); if(b % 2) x = mul(x, a, m); return x;}

void solve() {
    int n, k;
    cin>>n>>k;
    int freq[n];
    f(i, n) freq[i] = 0;
    f(i, k) {
        int tt;
        cin>>tt;
        f(j, tt) {
            int u;
            cin>>u;
            u--;
            freq[u]++;
        }
    }
    int cnt = 0;
    f(i, n) {
        if(freq[i] == 0) cnt++;
    }
    cout<<cnt<<endl;
} 


int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    if (LOCAL) {
        freopen("C:\\Users\\Dishant\\Desktop\\Collection-DEV c++\\input.txt", "r", stdin);
        freopen("C:\\Users\\Dishant\\Desktop\\Collection-DEV c++\\output.txt", "w", stdout);
    }
    int t = 1;
    //cin>>t;
    for(int test = 1; test <= t; test++) {
        //cout<<"Case #"<<test<<": ";
        solve();
    }
    return 0;
}


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

struct block {
    int state;
    int count;
};

int main(){
    int N, K;
    string S;
    cin >> N >> K;
    cin >> S;

    vector<block> v;
    int p = 0;
    do {
        int i = p;
        while (i+1 < S.length()) {
            if (S[p] != S[i+1]) break;
            i++;
        }
        block b = {S[p]-'0', (i - p) + 1};
        v.push_back(b);
        p = i + 1;
    } while (p < S.length());

    int l,k,sum;
    l = 0;
    k = 0;
    sum = 0;

    int ans = 0;
    for (int i=0; i<v.size(); i++) {
        sum += v[i].count;
        if (v[i].state == 0) {
            k++;
            // 減らす
            while (l < i && k > K) {
                sum -= v[l].count;
                if (v[l].state == 0) k--;
                l++;
            }
        }
        ans = max(ans,sum);
    }

    cout << ans << endl;
}

Measured memory_bytes: 1528
#include<bits/stdc++.h>
#define endl '\n'
#define ll long long int
#define loop(i,a,b)           for(ll i=a;i<=b;++i)
#define pb                    push_back
#define F                     first
#define S                     second
#define mp                    make_pair
#define clr(x)                x.clear()
#define MOD                   1000000007
#define itoc(c)               ((char)(((int)'0')+c))
#define vl                    vector<ll>
#define SZ(x)                 (x).size()
#define all(p)                p.begin(),p.end()
#define mid(s,e)              (s+(e-s)/2)
#define sv()                  ll t,n; scanf("%lld",&t);n=t; while(t--)
#define tcase()               ll t,n; cin>>t;n=t; while(t--)
#define iscn(num)             scanf("%d",&num);
#define scn(num)              scanf("%lld",&num);
#define scn2(num,num2)        scanf("%lld%lld",&num,&num2);
#define dbg(x)                cerr <<"( "<<#x << " = " << x << " )"<<endl
using namespace std;
const ll INF = 2e18 + 99;
typedef pair<ll,ll> Pair;
typedef vector<int> vec;;
void FAST_IO();
void ara_read(vec &v,ll n);
////////////////////////

int main()
{
	int n, k;
	scanf("%d%d",&n,&k);
	vec num;
	ara_read(num,n);
	// taking number of stones k, as dp dimension...
	vector< bool > dp(k+1);
	
	for(int stone=0; stone<= k; ++stone){
		for(auto x : num){
			if(stone>= x  && !dp[stone-x]){
				dp[stone]=true;
				break ;
			}
		}
	}
	// if dp[k] is true, that means first player is winner 
    puts((dp[k] ? "First" : "Second"));
    return 0;
}

void FAST_IO()
{
    // ios_base::sync_with_stdio(0);
    //cin.tie(NULL);
    //cout.tie(NULL);
    //cout.setf(ios::fixed);
    //cout.precision(2);

}
void ara_read(vec &v,ll n){
	v.resize(n);
	for(int & i : v){
		scanf("%d",&i);
	}
	
}


Measured memory_bytes: 256
s = input()
k = int(input())

counter = 0
for i in range(len(s)):
  if s[i] == "1":
    counter += 1
    ans = 1
  else:
    ans = i
    break
  
if k <= counter:
  ans = 1
else:
  ans = s[ans]
  
print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
/////////////////////////////////
int main(){
    int k, x;
    cin >> k >> x;
    
        int cnt = x - k + 1;
        rep(_,2*k-2){
            cout << cnt << " ";
            cnt++;
        }
        cout << cnt << endl;
    

}


Measured memory_bytes: 3596
A, B, C, D, E, F = map(int, input().split())

A_max = int(F / (100*A))
B_max = int(F / (100*B))
AB = []

for a in range(1, A_max+1):
    for b in range(B_max+1):
        if 100*A*a + 100*B*b > F: break
        AB.append(100*A*a + 100*B*b)

AB = sorted(set(AB))
S_max = int(AB[-1] * E / 100)
C_max = int(S_max / C)
D_max = int(S_max / D)

max_ab = AB[-1]
max_cd = 0
max = 0

for ab in AB:
    S = ab * E / 100
    for c in range(C_max+1):
        for d in range(D_max+1):
            cd = C*c + D*d
            if cd > S or ab + cd > F: break
            if cd / (ab + cd) > max:
                max_ab = ab
                max_cd = cd
                max = max_cd / (max_ab + max_cd)

print(max_ab + max_cd, max_cd)


Measured memory_bytes: 3064
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author aryssoncf
 */



// Taken from: https://github.com/bqi343/USACO/blob/master/Implementations/content/contest/templateShort.cpp

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ull> vul;
typedef vector<ll> vl;
typedef vector<pii> vpii;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define F0R(i, a) FOR(i,0,a)
#define ROF(i, a, b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i, a) ROF(i,0,a)
#define trav(a, x) for (auto& a: x)

#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rsz resize

#define mp make_pair
#define pb push_back
#define f first
#define s second

const int MOD = 1e9 + 7; // 998244353; // = (119<<23)+1
const int MX = 2e5 + 5;

template<class T>
bool ckmin(T &a, const T &b) {
    return a > b ? a = b, 1 : 0;
}

template<class T>
bool ckmax(T &a, const T &b) {
    return a < b ? a = b, 1 : 0;
}

mt19937 rng((uint32_t) chrono::steady_clock::now().time_since_epoch().count());


//
// Created by aryssoncf on 28/10/2019.
//

#include <type_traits>


#include <iterator>
#include <utility>

template<typename T>
constexpr auto hasBegin(int) -> decltype(std::begin(std::declval<T>()), true) {
    return true;
}

constexpr bool hasBegin(...) {
    return false;
}

template<typename T>
using IsContainer = std::integral_constant<bool, hasBegin<T>(0)>;


#ifndef JHELPER_EXAMPLE_PROJECT_IO_HPP
#define JHELPER_EXAMPLE_PROJECT_IO_HPP

#endif //JHELPER_EXAMPLE_PROJECT_IO_HPP

template<typename T>
std::istream &operator>>(std::istream &is, std::vector<T> &vec) {
    for (T &element: vec) {
        is >> element;
    }
    return is;
}

template<typename T, typename U>
std::istream &operator>>(std::istream &is, std::pair<T, U> &p) {
    is >> p.first;
    is >> p.second;
    return is;
}

template<class X, class Y>
std::ostream &operator<<(std::ostream &os, std::pair<X, Y> const &p) {
    return os << p.first << " " << p.second;
}

template<class Ch, class Tr, class Container>
std::basic_ostream<Ch, Tr> &operator<<(std::basic_ostream<Ch, Tr> &os, Container const &x) {
    bool first = true;
    for (auto &y : x) {
        if (first) {
            first = false;
        } else {
            os << " ";
        }
        os << y;
    }
    return os;
}

using namespace std;

class BPowerSocket {
public:
    void solve(std::istream &in, std::ostream &out) {
        int a, b;
        in >> a >> b;
        int res = (b + a - 3) / (a - 1);
        out << res << '\n';
    }

    void setup() {}
};


int main() {
    std::ios_base::sync_with_stdio(false);
    BPowerSocket solver;
    solver.setup();
    std::istream &in(std::cin);
    std::ostream &out(std::cout);
    in.tie(nullptr);
    out << std::fixed;
    out.precision(20);
    solver.solve(in, out);
    return 0;
}


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

int main(void)
{
	char str[1028];
	int n, i;
	char *target_pos;

	scanf("%d ", &n);
	for (i = 0; i < n; i++){
		fgets(str, sizeof(str), stdin);
		while ((target_pos = strstr(str, "Hoshino")) != NULL){
			target_pos[6] = 'a';
		}
		printf("%s", str);
	}

	return (0);
}

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

using namespace std;

//#define FILE_IO

typedef pair<int, int> pii;
typedef pair<int, pii> p3i;
typedef long long LL;

int N;
pii p[100005];
int f[100005];
int ordx[100005], ordy[100005];
vector <p3i> edges;

int F(int x) { if(x == f[x]) return x; return f[x] = F(f[x]); }

int main()
{
    #ifdef FILE_IO
    freopen("1.in", "r", stdin);
    freopen("1.out", "w", stdout);
    #endif

    scanf("%d", &N);
    for(int i = 1; i <= N; i++)
    {
        int x, y;
        scanf("%d%d", &x, &y);
        p[i] = {x, y};
        ordx[i] = i, ordy[i] = i;
    }

    sort(ordx + 1, ordx + N + 1,
         [](int a, int b) { if(p[a].first == p[b].first) return p[a].second < p[b].second; return p[a].first < p[b].first; });
    sort(ordy + 1, ordy + N + 1,
         [](int a, int b) { if(p[a].second == p[b].second) return p[a].first < p[b].first; return p[a].second < p[b].second; });

    for(int i = 1; i < N; i++)
    {
        edges.push_back( { p[ ordx[i + 1] ].first - p[ ordx[i] ].first, {ordx[i], ordx[i + 1]} } );
        edges.push_back( { p[ ordy[i + 1] ].second - p[ ordy[i] ].second, {ordy[i], ordy[i + 1]} } );
    }

    for(int i = 1; i <= N; i++) f[i] = i;

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

    LL ans = 0;
    for(auto e: edges)
    {
        int x = e.second.first;
        int y = e.second.second;

        if(F(x) == F(y))    continue;

        ans += e.first;
        f[F(x)] = F(y);
    }

    printf("%lld\n", ans);


    return 0;
}


Measured memory_bytes: 6516
#include<bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 7;
vector<int>G[MAXN], rG[MAXN];
int dp[MAXN], d[MAXN];
int main()
{
    int n, m; scanf("%d%d", &n, &m);
    for (int i = 1, u, v; i <= m; i++)
    {
        scanf("%d%d", &u, &v);
        G[u].push_back(v); d[u]++;
        rG[v].push_back(u);
    }
    queue<int>q;
    for (int i = 1; i <= n; i++) if (!d[i]) q.push(i);
    int ans = 0;
    while (q.size())
    {
        int u = q.front(); q.pop();
        for (int v : rG[u]) 
        {
            ans = max(ans, dp[v] = max(dp[v], dp[u] + 1));
            if ((--d[v]) == 0) q.push(v);
        }
    }
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 11904
import java.util.Scanner;
 
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int maxW = sc.nextInt();
		
		int[] w = new int[n + 1];
		int[] v = new int[n + 1];
		for (int i = 1; i <= n; i++) {
			w[i] = sc.nextInt();
			v[i] = sc.nextInt();
		}
		
		long[][] dp = new long[n + 1][maxW + 1];
		for (int i = 1; i <= n; i++) {
			for (int j = 0; j <= maxW; j++) {
				dp[i][j] = dp[i - 1][j];
				if (j - w[i] >= 0)
					dp[i][j] = Math.max(dp[i][j], dp[i - 1][j - w[i]] + v[i]);
			}
		}
		
		System.out.println(dp[n][maxW]);
		
		sc.close();
	}
}



Measured memory_bytes: 131936
import java.util.*;
public class Main {
    public static void main(String args[]) {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int a[][]=new int[n+1][4];
        for(int i=1;i<=n;i++)
         for(int j=1;j<=3;j++)
            a[i][j]=sc.nextInt();

        int dp[][]=new int[n+1][4];
        dp[1][1]=a[1][1];
        dp[1][2]=a[1][2];
        dp[1][3]=a[1][3];
        for(int i=2;i<=n;i++)
        {
            dp[i][1]=a[i][1]+Math.max(dp[i-1][2],dp[i-1][3]);
            dp[i][2]=a[i][2]+Math.max(dp[i-1][1],dp[i-1][3]);
            dp[i][3]=a[i][3]+Math.max(dp[i-1][2],dp[i-1][1]);
        }
        int ans=Math.max(dp[n][3],Math.max(dp[n][1],dp[n][2]));
        System.out.println(ans); 
    }
}

Measured memory_bytes: 100256
#include <bits/stdc++.h>
using namespace std;
#define INF 1001001001
typedef pair<int,int> pp;
typedef pair<int, pp> P;
int dx[4] = {1,0,-1,0};
int dy[4] = {0,1,0,-1};
int H,W;

bool isIn(int i, int j) {
    return i>=0 && i<H && j>=0 && j<W;
}

int main() {
    cin >> H >> W;
    char s[50][50];
    int white = 0;
    for(int i=0; i<H; ++i) {
        for(int j=0; j<W; ++j) {
            cin >> s[i][j];
            if(s[i][j] == '.') ++white;
        }
    }

    priority_queue<P, vector<P>, greater<P>> q;
    vector<vector<int>> dist(H, vector<int>(W, INF));
    dist[0][0] = 0;
    q.push(P(0, pp(0,0)));
    while(!q.empty()) {
        P cur = q.top(); q.pop();
        pp v = cur.second;
        if(dist[v.first][v.second] < cur.first) continue;
        for(int i=0; i<4; ++i) {
            int nx = v.first + dx[i];
            int ny = v.second + dy[i];
            if(isIn(nx, ny) && s[nx][ny] == '.' && dist[nx][ny] > cur.first + 1) {
                dist[nx][ny] = cur.first + 1;
                q.push(P(dist[nx][ny], pp(nx, ny)));
            }
        }
    }
    
    if(dist[H-1][W-1] == INF) cout << -1 << endl;
    else cout << white - dist[H-1][W-1] - 1 << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
using namespace std;

int main(){
	double a,b,c,degree,S;
	scanf("%lf %lf %lf",&a,&b,&degree);
	S = (0.5)*a*b*sin(M_PI*degree/180);
	c = sqrt(a*a+b*b-2*a*b*cos(M_PI*degree/180));
	printf("%.8lf\n",S);
	printf("%.8lf\n",a+b+c);
	printf("%.8lf\n",2*S/a);
}



Measured memory_bytes: 2876
#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 in0, in1;
    cin >> in0 >> in1;
    ll n = max(in0, in1);
    ll m = min(in0, in1);
    if(n == 1 && m == 1){
        cout << 1 << endl;
    }else if(m == 1){
        cout << n-2 << endl;
    }else{
        cout << n*m - 2*n - 2*m + 4 << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define all(a) a.begin(),a.end()
#define F first
#define S second
#define pb push_back
#define ll unsigned long long
#define ld long double
#define mkp make_pair
#define sz(x) (int)x.size()
#define pi pair<long long, long long>
#define watch(x) cout << (#x) << " is " << (x) << endl; cout.flush()
#define endl '\n'
#define _ << ' '
#define FAST_LOG2(x) (sizeof(unsigned long)*8 - 1 - __builtin_clzl((unsigned long)(x)))
#define clog2(x) (((x) - (1 << FAST_LOG2(x))) ? FAST_LOG2(x) + 1 : FAST_LOG2(x))
using namespace __gnu_pbds;
using namespace std;
typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> idxset;
//find_by_order(i) : iterator to the value at index i, order_of_key(x) : the index of value x
const ll mod = (ll)1e9+7;
const ll INF = (ll)1e9+1;
const int N = 1e7;

int n, in, cnt=0;
int h[1001][1001], ar[1001][1001], to[1000001];
vector<int> adj[1000001];
vector<int> cur;

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    #ifndef ONLINE_JUDGE
    //freopen("A.txt", "r", stdin);
    #endif
    cin >> n;
    int idx = 1;
    for(int i=1; i<=n; i++){
        for(int j=1; j<n; j++){
            cin >> ar[i][j];
            int a = min(i, ar[i][j]), b = max(i, ar[i][j]);
            if(!h[a][b]){
                h[a][b] = idx;
                idx++;
            }
        }
    }
    for(int i=1; i<=n; i++){
        for(int j=1; j<n-1; j++){
            int a = min(i, ar[i][j]), b = max(i, ar[i][j]), c = min(i, ar[i][j+1]), d = max(i, ar[i][j+1]);
            adj[h[a][b]].pb(h[c][d]);
            to[h[c][d]]++;
        }
    }
    int tot = 0;
    for(int i=1; i<=n*(n-1)/2; i++){
        if(to[i]==0) cur.pb(i), tot--;
    }
    tot += n*(n-1)/2;
    while(++cnt){
        int si = sz(cur);
        for(int i=si-1; i>=0; i--){
            for(auto nxt : adj[cur[i]]){
                to[nxt]--;
                if(to[nxt]==0){
                    cur.pb(nxt);
                    tot--;
                }
            }
            cur.erase(cur.begin()+i);
        }
        if(cur.empty()){
            if(tot) cout << -1;
            else cout << cnt;
            return 0;
        }
    }
    cout << -1;
}



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

int main() {
  int n;
  cin >> n;
  
  vector<int> v(n);
  for (int i = 0; i < n; i++) {
    cin >> v.at(i);
  }
  
  int64_t money = 1000;
  int64_t stock = 0;
  
  for (int i = 0; i < n - 1; i++) {
    if (stock == 0) {
      if (v.at(i) < v.at(i + 1)) {
        stock += money / v.at(i);
        money %= v.at(i);
      }
    }
    else {
      if (v.at(i) > v.at(i + 1)) {
        money += stock * v.at(i);
        stock = 0;
      }
    }
  }
  
  if (stock > 0)
    money += stock * v.at(n - 1);
                                   
                                 
  cout << money << endl;  
}

Measured memory_bytes: 3584
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
using namespace std;
typedef long long ll;

const int maxn = 50;
bool grid[maxn][maxn];
int H, W;

bool check(int i, int j) {
    pair<int,int> dd[] = {{-1,0},{1,0},{0,-1},{0,1}};
    for (int a = 0; a < 4; a++) {
        int x = i + dd[a].first;
        int y = j + dd[a].second;
        if (x >= 0 && x < H && y >= 0 && y < W) {
            if (grid[x][y]) return true;
        }
    }
    return false;
}

int main()
{
    //ios_base::sync_with_stdio(false); cin.tie(NULL);
    //read input
    cin >> H >> W;
    for (int i = 0; i < H; i++) {
        string s; cin >> s;
        for (int j = 0; j < W; j++) {
            grid[i][j] = (s[j] == '#');
        }
    }
    //check that each black square is valid
    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            if (grid[i][j] && !check(i,j)) {
                cout << "No\n";
                return 0;
            }
        }

    }
    cout << "Yes\n";
    return 0;
}


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

int main()
{
	string s,t;
	cin >> s >> t;
	ll a,b;
	cin >> a >> b;
	string u;
	cin >> u;
	if(u==s)
		cout << a-1 << " " << b;
	else
		cout << a << " " << b-1;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mod 1000000007
#define sp ' '
#define intmax 2147483647
#define llmax 9223372036854775807
#define mkp make_pair
typedef long long ll;
using namespace std;

ll N, A, B;

int main(){
	cin >> N >> A >> B;
	if (A + B <= N + 1 && N <= A*B) {
		vector<int>v(B + 1, 0);
		vector<vector<int>>u(B);
		int t = N;
		for (int i = 0; i < B; ++i) {
			int k = min(A, t - (B - i - 1));
			v[i] = k;
			t -= k;
		}
		int p = 0;
		for (int i = N; i; --i) {
			u[p].push_back(i);
			--v[p];
			++p;
			if (!v[p])p = 0;
		}
		for (int i = 0; i < B; ++i) {
			for (int j = u[i].size() - 1; j >= 0; --j) {
				cout << u[i][j] << sp;
			}
		}
		cout << endl;
	}
	else {
		cout << -1 << endl;
		return 0;
	}
	return 0;
}

Measured memory_bytes: 13952
from bisect import bisect_right, bisect_left
A, B, Q = map(int, input().split())
INF = float('inf')
S = [-INF]
T = [-INF]
for i in range(A):
    S.append(int(input()))

for i in range(B):
    T.append(int(input()))

S.append(INF)
T.append(INF)

for i in range(Q):
    x = int(input())
    b = bisect_right(S, x)
    d = bisect_right(T, x)
    ans = INF
    ans = min(ans, abs(x - S[b - 1]) + abs(S[b - 1] - T[d - 1]))
    ans = min(ans, abs(x - S[b]) + abs(S[b] - T[d - 1]))
    ans = min(ans, abs(x - S[b - 1]) + abs(S[b - 1] - T[d]))
    ans = min(ans, abs(x - S[b]) + abs(S[b] - T[d]))
    ans = min(ans, abs(x - T[d - 1]) + abs(T[d - 1] - S[b - 1]))
    ans = min(ans, abs(x - T[d]) + abs(T[d] - S[b - 1]))
    ans = min(ans, abs(x - T[d - 1]) + abs(T[d - 1] - S[b]))
    ans = min(ans, abs(x - T[d]) + abs(T[d] - S[b]))
    print(ans)


Measured memory_bytes: 12080
// |x - a|の総和を最小化
// 中央値ゲー
// setで前後半に分けて管理
// bは適当に合計取って終わり

#include <iostream>
#include <algorithm>
#include <set>
using namespace std;
using ll = long long;

multiset<ll> left_hirf;
multiset<ll> right_hirf;
ll left_sum;
ll right_sum;
ll b_sum;

ll q;
ll com, a, b;

ll mid(void);
void insert(ll x);

int main()
{
    cin >> q;
    for (int i = 0; i < q; i++) {
        cin >> com;

        if (com == 1) {
            cin >> a >> b;
            
            b_sum += b;

            insert(a);
        }
        else {
            ll ans = b_sum;
            ll x = mid();

            ans += x * left_hirf.size() - left_sum;
            ans += -x * right_hirf.size() + right_sum;

            cout << mid() << ' ' << ans << endl;
        }
    }
    
    return 0;
}

ll mid(void)
{
    return *left_hirf.rbegin();
}

void insert(ll x)
{
    if (left_hirf.empty()) {
        left_sum += x;
        left_hirf.insert(x);
        return;
    }

    if (x <= mid()) {
        left_sum += x;
        left_hirf.insert(x);
    }
    else {
        right_sum += x;
        right_hirf.insert(x);
    }

    if (right_hirf.size() > left_hirf.size()) {
        x = *right_hirf.begin();

        left_sum += x;
        right_sum -= x;
        
        left_hirf.insert(x);
        right_hirf.erase(right_hirf.lower_bound(x));
    }
    else if (left_hirf.size() - 1 > right_hirf.size()) {
        left_sum -= mid();
        right_sum += mid();

        right_hirf.insert(mid());
        left_hirf.erase(left_hirf.lower_bound(mid()));
    }
}


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

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

const ll mod =  1000000007;  //出力は (ans % mod + mod) % mod  (負の剰余を正にする)
const int inf = 1e9;
const long long INF = 1LL << 60;   // INF = 1152921504606846976
const double PI = 3.1415926535897932;

int h,w;
char f[405][405];
ll v[405][405];
int dx[4] = {-1,0,0,1};
int dy[4] = {0,-1,1,0};

int main()
{
    cin >> h >> w;
    rep(i,h) rep(j,w){
        cin >> f[i][j];
    }
    ll ans = 0;
    rep(i,h) rep(j,w){
        if(!v[i][j]){
            v[i][j] = true;
            queue<P> q;
            q.push(make_pair(j,i));
            ll cntw = 0,cntb = 0;
            while(!q.empty()){
                P p = q.front(); q.pop();
                int x = p.first, y = p.second;

                if(f[y][x] == '#') cntb++;
                else cntw++;
                
                rep(k,4){
                    int ny = y+dy[k], nx = x+dx[k];
                    if(ny >= 0 && ny < h && nx >= 0 && nx < w && !v[ny][nx] && f[y][x] != f[ny][nx]){
                        v[ny][nx] = true;
                        q.push(make_pair(nx,ny));
                    }
                }
            }
            ans += cntw*cntb;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 1664
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
int main(){
    int n,tmp;
    cin >> n;
    vector<pair<int,int> > p(0);
    rep(i,n){
        cin >> tmp;
        p.push_back(make_pair(tmp,i));
    }
    sort(p.begin(),p.end());
    rep(i,n)cout << p.at(i).second+1 << " " ;
    cout << endl;
}
    


Measured memory_bytes: 1780
#include<bits/stdc++.h>
using namespace std;
using LL = int64_t;
const int maxn=1e5+5;
int num[20][20],ans[20][20];
int dp[30][30];
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n,m;
    cin>>n>>m;
    for(int i=0;i<=9;i++) {
        for(int j=0;j<=9;j++) {
            cin>>dp[i][j];
        }
    }
    for(int k=0;k<=9;k++)
            for(int x=0;x<=9;x++)
               for(int y=0;y<=9;y++)
                dp[x][y]=min(dp[x][y],dp[x][k]+dp[k][y]);
    int sum=0,x;
    for(int i=1;i<=n;i++) {
        for(int j=1;j<=m;j++) {
            cin>>x;
            if(x==-1||x==1) continue;
            sum+=dp[x][1];
        }
    }
    cout<<sum<<endl;
    return 0;
}


Measured memory_bytes: 256
// 5/18
// 過去問ガリガリ
#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>;
using Graph = vector<vector<int>>;

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

    vector<P> submit(N, make_pair(0, 0));  // firstがAC、secondがWA

    rep(i, M) {
        int p;
        string s;
        cin >> p >> s;
        p--;

        if (s == "AC") {
            submit[p].first++;
        } else {
            if (submit[p].first == 0) {
                submit[p].second++;
            }
        }
    }

    P ans = make_pair(0, 0);
    rep(i, N) {
        if (submit[i].first > 0) {
            ans.first++;
            ans.second += submit[i].second;
        }
    }

    cout << ans.first << " " << ans.second << endl;
}


Measured memory_bytes: 1024
//input
use proconio::input;
use proconio::marker::{Bytes, Chars};
//use std::io::Read;

//collections
//use std::collections::BTreeMap;
//use std::collections::BTreeSet;
//use std::collections::HashMap;
//use std::collections::HashSet;
//use std::collections::VecDeque;
//use std::collections::BinaryHeap;

//use std::cmp::*;

fn main() {
    input! {
        r: f64,
    }

    let pi: f64 = 3.14159265358979323846264;

    println!("{}", 2. * pi * r);
}


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

#define FIO ios_base::sync_with_stdio(0); cin.tie(0);
#define T() int tt; cin >> tt; rep1(qq,1,tt)
#define rep(i,start,lim) for(int i=start;i<lim;i++)
#define rep1(i,start,lim) for(int i=start; i<=lim; ++i)
#define repd(i,start,lim) for(int i=start;i>=lim;i--)
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define br cout<<"\n"
#define MOD (1000000007LL)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define eps (1e-6)
#define what_is(x) cerr << #x << " is " << x << "\n";
#define int long long int
#define infll 9e18
#define inf 1e12

#define lnode (2 * node + 1)
#define rnode (2 * node + 2)

using namespace std;

typedef pair<int, int> pii;

const int N = 2005;

int n, x, y;
vector<int> g[N];
int d[N][N], res[N];

int32_t main(){

  FIO
  //cout << fixed << setprecision(10);
  //freopen("input.txt", "r", stdin);
  //freopen("output.txt", "w", stdout);

  cin >> n >> x >> y;
  for(int i = 1; i <= n - 1; ++i){
    g[i].pb(i + 1);
    g[i + 1].pb(i);
  }
  g[x].pb(y);
  g[y].pb(x);
  
  queue<int> q;
  for(int i = 1; i <= n; ++i){
    vector<int> vis(n + 1, 0);
    queue<int> q; q.push(i);
    d[i][i] = 0;
    while(!q.empty()){
      int u = q.front(); q.pop();
      vis[u] = 1;
      for(int v : g[u]){
        if(vis[v]) continue;
        d[i][v] = d[i][u] + 1;
        vis[v] = 1;
        q.push(v);
      }
    }
  }
  for(int i = 1; i <= n; ++i){
    for(int j = i + 1; j <= n; ++j){
      res[d[i][j]]++;
    }
  }
  for(int i = 1; i <= n - 1; ++i){
    cout << res[i] << '\n';
  }



	return 0;
}




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

int main () {
  int x,y;
  cin >>x>>y;
  if (y % 2 ==1){
    cout << "No" << endl;
    return 0;
  }
  else if (2*x  <= y && y <= 4*x){
    cout << "Yes" << endl;
    return 0;
  } 
  else    
    cout << "No" << endl;
}


Measured memory_bytes: 3632
#include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<deque>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const int inf=1e9+7;
const ll INF=1LL<<60 ;
const ll mod=1e9+7 ;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define debug(x)  cout << #x << " = " << (x) << endl;
using Graph = vector<vector<int> >;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
//#define int long long

void solve() {
	int a, b; cin >> a >> b;
    if(1 <= a && a <= 9 && 1 <= b && b <= 9) {
        cout << a * b << endl;
    } else {
        cout << -1 << endl;
    }
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//init();
	solve();
	//cout << "finish" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define SORT(a) sort(a.begin(), a.end())
#define REVERSE(a) reverse(a.begin(), a.end())
#define int long long
#define INF 1000000000000000
using namespace std;
 
typedef vector<int> vec;
typedef vector<vec> mat;
typedef pair<int, int> Pii;
 
template<typename T>
void readvec(vector<T> &a);
void readindex(vector<int> &a);
 
 
 
signed main(){
 
    string A; cin >> A;
    
    mat alfpos(26, vec(1, -1));
    REP(i, A.size()){
        alfpos[A[i] - 'a'].push_back(i);
    }
 
    vec x(0);
    int pos = INF, alf;
    while(pos >= 0){
        int minv = INF;
        REP(i, 26){
            int p = distance(alfpos[i].begin(), lower_bound(alfpos[i].begin(), alfpos[i].end(), pos)) - 1;
            int v = alfpos[i][p];
            if(v < minv){
                minv = v;
                alf = i;
            }
        }
        pos = minv;
        if(pos >= 0) x.push_back(pos);
    }

    string ans = "";
    ans += (char)('a' + alf);

    REVERSE(x);
    x.push_back(A.size());
    
    FOR(i, 0, x.size() - 1){
        bool used[26];
        fill(used, used + 26, false);
        int j0;
        FOR(j, x[i], x[i + 1]){
            if(A[j] - 'a' == alf){
                j0 = j;
                break;
            }
        }
        FOR(j, j0 + 1, x[i + 1]) used[A[j] - 'a'] = true;
        REP(j, 26){
            if(!used[j]){
                alf = j;
                break;
            }
        }
        ans = ans + (char)('a' + alf);
    }

    
    cout << ans;
 
    return 0;
}
 
 
template<typename T>
void readvec(vector<T> &a){
    REP(i, a.size()){
        cin >> a[i];
    }
}
void readindex(vector<int> &a){
    REP(i, a.size()){
        cin >> a[i];
        a[i]--;
    }
}

Measured memory_bytes: 2436
#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;
  cin >> N;

  bool ans = false;

  int a, b, c;
  a = N % 10;
  b = N /10 % 10;
  c = N /100;

  if (a == 7 || b == 7 || c == 7) ans = true;
  
  if (ans) cout << "Yes" << endl;
  else cout << "No" << endl;
}


Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  string s;
  cin >> n >> s;
  map<char, int> cnt;
  for(int i = 0; i < n; i++)
    cnt[s[i]]++;
  long long ans = 1LL;
  for(auto p: cnt){
    ans *= p.second + 1;
    ans %= 1000000007;
  }
  cout << ans-1 << endl;
  return 0;
}

Measured memory_bytes: 512
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
a = sorted(a)
b = sorted(b)
c = sorted(c)
num = 0
p, q = 0, 0
for i in range(n):
    while p < n and a[p] < b[i]:
        p += 1
    while q < n and c[q] <= b[i]:
        q += 1
    num += p * (n - q)

print(num)

Measured memory_bytes: 23328
A, B = map(int, input().split())
S = input()

flag = True
for i in range(A+B+1):
  if i == A:
    if S[i] != '-':
      flag = False
  else:
    if not S[i].isdecimal():
      flag = False
if flag:
  print("Yes")
else:
  print("No")
  

Measured memory_bytes: 38384
import java.util.LinkedHashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int a = scanner.nextInt();
        int b = scanner.nextInt();
        int k = scanner.nextInt();

        Set<Integer> resultSet = new LinkedHashSet<>();
        for (int i = a; i <= b; i++) {
           if(i <= a+k-1 || i >= b-k+1) {
              resultSet.add(i);
           }
        }
        for(Integer result : resultSet){
            System.out.println(result);
        }
    }
}


Measured memory_bytes: 21712