akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

using ll=long long;
#define int ll

#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define pb push_back
#define eb emplace_back
#define a first
#define b second
#define bg begin()
#define ed end()
#define all(x) x.bg,x.ed
#ifdef LOCAL
#define dmp(x) cerr<<__LINE__<<" "<<#x<<" "<<x<<endl
#else
#define dmp(x) void(0)
#endif

template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(b<a)a=b;}

template<class t> using vc=vector<t>;
template<class t> using vvc=vc<vc<t>>;

using pi=pair<int,int>;
using vi=vc<int>;

template<class t,class u>
ostream& operator<<(ostream& os,const pair<t,u>& p){
	return os<<"{"<<p.a<<","<<p.b<<"}";
}

template<class t> ostream& operator<<(ostream& os,const vc<t>& v){
	os<<"{";
	for(auto e:v)os<<e<<",";
	return os<<"}";
}

#define mp make_pair
#define mt make_tuple
#define one(x) memset(x,-1,sizeof(x))
#define zero(x) memset(x,0,sizeof(x))

using uint=unsigned;
using ull=unsigned long long;

template<int i,class T>
void print_tuple(ostream&,const T&){
}

template<int i,class T,class H,class ...Args>
void print_tuple(ostream&os,const T&t){
	if(i)os<<",";
	os<<get<i>(t);
	print_tuple<i+1,T,Args...>(os,t);
}

template<class ...Args>
ostream& operator<<(ostream&os,const tuple<Args...>&t){
	os<<"{";
	print_tuple<0,tuple<Args...>,Args...>(os,t);
	return os<<"}";
}

void print(ll x,int suc=1){
	cout<<x;
	if(suc==1)
		cout<<"\n";
	if(suc==2)
		cout<<" ";
}

ll read(){
	ll i;
	cin>>i;
	return i;
}

vi readvi(int n,int off=0){
	vi v(n);
	rep(i,n)v[i]=read()+off;
	return v;
}

template<class T>
void print(const vector<T>&v,int suc=1){
	rep(i,v.size())
		print(v[i],i==int(v.size())-1?suc:2);
}

string readString(){
	string s;
	cin>>s;
	return s;
}

template<class T>
T sq(const T& t){
	return t*t;
}

//#define CAPITAL
void yes(bool ex=true){
	#ifdef CAPITAL
	cout<<"YES"<<endl;
	#else
	cout<<"Yes"<<endl;
	#endif
	if(ex)exit(0);
}
void no(bool ex=true){
	#ifdef CAPITAL
	cout<<"NO"<<endl;
	#else
	cout<<"No"<<endl;
	#endif
	if(ex)exit(0);
}

constexpr ll ten(int n){
	return n==0?1:ten(n-1)*10;
}

const ll infLL=LLONG_MAX/3;

#ifdef int
const int inf=infLL;
#else
const int inf=INT_MAX/2-100;
#endif

int topbit(signed t){
	return t==0?-1:31-__builtin_clz(t);
}
int topbit(ll t){
	return t==0?-1:63-__builtin_clzll(t);
}
int popcount(signed t){
	return __builtin_popcount(t);
}
int popcount(ll t){
	return __builtin_popcountll(t);
}
bool ispow2(int i){
	return i&&(i&-i)==i;
}

bool inc(int a,int b,int c){
	return a<=b&&b<=c;
}

template<class t> void mkuni(vc<t>&v){
	sort(all(v));
	v.erase(unique(all(v)),v.ed);
}

ll rand_int(ll l, ll r) { //[l, r]
    static random_device rd;
    static mt19937_64 gen(rd());
    return uniform_int_distribution<ll>(l, r)(gen);
}

signed main(){
	cin.tie(0);
	ios::sync_with_stdio(0);
	cout<<fixed<<setprecision(20);
	
	int m,d;cin>>m>>d;
	int ans=0;
	rng(j,1,d+1){
		int a=j%10;
		int b=j/10%10;
		if(a>=2&&b>=2&&inc(1,a*b,m))
			ans++;
	}
	cout<<ans<<endl;
}


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

int main() {
    string s; cin >> s;
    string str = "CODEFESTIVAL2016";
    int count = 0;
    for(int i = 0; i < s.length(); i ++) {
        if(s[i]!=str[i]) count ++;
    }
    cout << count << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
using namespace std;
int main(void){
    int n,i,x,q;
    char p;
    int ch[4][13];
     scanf("%d",&n);

for(i=0;i<n;i++){
  
  scanf("%c",&p); 
  scanf("%c %d",&p,&x);
  
  if(p=='S'){
      ch[0][x-1]=10;
  }else if(p=='H'){
  ch[1][x-1]=10;
  }else if(p=='C'){
  ch[2][x-1]=10;
  }else if(p=='D'){
  ch[3][x-1]=10;}
  }

    for(i=0;i<13;i++){
    if(ch[0][i]==10){
    }else{
    printf("S %d\n",i+1);
    }
    }
     
    for(i=0;i<13;i++){
    if(ch[1][i]==10){
    }else{
    printf("H %d\n",i+1);
    }
    }
     
    for(i=0;i<13;i++){
    if(ch[2][i]==10){
    }else{
    printf("C %d\n",i+1);
    }
    }
     
    for(i=0;i<13;i++){
    if(ch[3][i]==10){
    }else{
    printf("D %d\n",i+1);
    }
    }
}
    
    

  



Measured memory_bytes: 2620
#include <algorithm>
#include <cassert>
#include <cstring>
#include <iostream>
#include <vector>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define TRACE(x) cout << #x << " = " << x << endl
#define _ << " _ " <<

typedef long long llint;

const int MAX = 100100;

vector<int> E[MAX];
int a[MAX];

vector<int> comp[MAX];
bool bio[MAX];

void dfs(int x, int c) {
  comp[c].push_back(x);
  bio[x] = true;

  for (int y: E[x]) {
    if (!bio[y]) {
      dfs(y, c);
    }
  }
}

int main(void) {
  int N, M;
  scanf("%d %d", &N, &M);
  REP(i, N) scanf("%d", &a[i]);
  REP(i, M) {
    int a, b;
    scanf("%d %d", &a, &b);
    E[a].push_back(b);
    E[b].push_back(a);
  }

  int nc = 0;
  REP(i, N) {
    if (!bio[i]) {
      dfs(i, nc++);
    }
  }

  if (nc == 1) {
    puts("0");
    return 0;
  }


  vector<int> rem;
  llint ret = 0;
  REP(i, nc) {
    vector<int> v;
    for (int x: comp[i]) v.push_back(a[x]);

    sort(v.begin(), v.end());
    ret += v[0];
    for (int i = 1; i < (int)v.size(); ++i) {
      rem.push_back(v[i]);
    }
  }

  sort(rem.begin(), rem.end());
  if ((int)rem.size() < (nc-2)) {
    puts("Impossible");
  } else {
    REP(i, nc-2) ret += rem[i];
    printf("%lld\n", ret);
  }
  return 0;
}


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

int main(){
    using namespace std;
    unsigned long N, T;
    cin >> N >> T;
    vector<pair<unsigned long, unsigned long>> dish(N);
    for(auto& i : dish)cin >> i.first >> i.second;
    sort(dish.rbegin(), dish.rend());
    vector<unsigned long> dp(T + dish[0].first + 1);
    for(const auto& i : dish)for(unsigned long j = 0; j < T; ++j)dp[j] = max(dp[j], dp[j + i.first] + i.second);
    cout << dp[0] << endl;
    return 0;
}

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

int main()
{
	int n;cin>>n;
	vector<int> h;
	for(int i=0;i<n;i++)
	{
		int x;cin>>x;
		h.push_back(x);
	}
	vector<int> cost(n,0);
	//int sum=0;
	for(int i=0;i<n;i++)
	{
		if(i==0)
		{
			cost[i]=0;
		}
		else if(i==1)
		{
			cost[i]=abs(h[i]-h[i-1]);
		}
		else
		{
			int c1=cost[i-1]+abs(h[i-1]-h[i]);
			int c2=cost[i-2]+abs(h[i-2]-h[i]);
			cost[i]=min(c1,c2);
		}
		//sum+=cost[i];
	}
	cout<<cost[n-1];
	return 0;
}

Measured memory_bytes: 1144
use proconio::input;
// dbg {{{
#[allow(dead_code)]
mod dbg {
    use std::fmt::{Debug, Formatter};

    #[derive(Clone)]
    pub struct Tabular<'a, T: Debug>(pub &'a [Vec<T>]);

    impl<'a, T: Debug> Debug for Tabular<'a, T> {
        fn fmt(&self, f: &mut Formatter) -> std::fmt::Result {
            for i in 0..self.0.len() {
                writeln!(f, "{:2} | {:?}", i, &self.0[i])?;
            }
            Ok(())
        }
    }
}
// }}}
use dbg::Tabular;
use std::cmp::Reverse;

fn main() {
    input!(k: usize);
    let mut g = vec![vec![]; k];
    for i in 0..k {
        for j in 0..10 {
            g[i].push(((10 * i + j) % k, j as u32));
        }
    }

    let mut dist = vec![std::u32::MAX; k];
    let mut heap = std::collections::BinaryHeap::new();
    for i in 1..k {
        dist[i] = i as u32;
        heap.push((Reverse(i as u32), i));
    }
    while let Some((Reverse(d), x)) = heap.pop() {
        if dist[x] < d {
            continue;
        }
        for &(y, w) in &g[x] {
            let dy = dist[x] + w;
            if dy < dist[y] {
                heap.push((Reverse(dy), y));
                dist[y] = dy;
            }
        }
    }
    println!("{}", dist[0]);
}


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

#include<bits/stdc++.h>

using namespace std;

void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

#define SPEED ios_base::sync_with_stdio(false);cin.tie(nullptr)
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

using ll = long long;
using P = pair<ll, ll>;

constexpr double PI = 3.14159265358979323846;
mt19937_64 engine(chrono::steady_clock::now().time_since_epoch().count());

class AConnectionAndDisconnection {
public:
    void solve(istream& cin, ostream& cout) {
      SPEED;
      string s; cin >> s;
      ll k; cin >> k;
      int n = s.size();
      int cnt1 = 0;
      rep(i, n) {
        if (s[i] == s[0]) {
          cnt1++;
        } else {
          break;
        }
      }
      if (cnt1 == n) {
        ll ans = k*n;
        cout << ans/2 << endl;
        return;
      }

      int cnt2 = 0;
      for(int i=n-1; i>=0; i--) {
        if (s[n-1] == s[i]) {
          cnt2++;
        } else {
          break;
        }
      }

      ll ans = 0;
      int cnt = 0;
      char before = '?';
      rep(i, n) {
        if (s[i] != before) {
          ans += cnt/2;
          cnt = 0;
        }
        cnt++;
        before = s[i];
      }
      ans += cnt/2;
      ans *= k;
      if (s[0] == s[n-1] && (cnt1+cnt2)%2 == 0) {
        ans += k-1;
      }
      cout << ans << endl;
    }
};

signed main() {
  AConnectionAndDisconnection solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  solver.solve(in, out);
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	static Scanner sc = new Scanner(System.in);

	public static void main(String[] arg) {
		int[] count = new int[10 + 1];

		for(int i = 0; i < 3; i++) {
			int len = sc.nextInt();
			count[len]++;
		}

		System.out.println(count[5] == 2 && count[7] == 1 ? "YES" : "NO");
	}

}


Measured memory_bytes: 21716
#include<cstdio>
using namespace std;
int main()
{
    int n,p1,p2,i,j,hum[50],flg[50],stok;
    for(;scanf("%d%d",&n,&p1),n+p1!=0;)
    {
        p2=p1;
        for(i=0;i<n;i++)
            hum[i]=0;
        for(i=0;;i++)
        {
            if(hum[i]==p1)
                break;
            if(p2==0)
            {
                p2=hum[i];
                hum[i]=0;
            }
            else if(p2!=0)
            {
                hum[i]++;
                p2--;
            }
            if(i==(n-1))
            {
                i=-1;
            }
        }
        printf("%d\n",i);
    }
    return 0;
}

Measured memory_bytes: 1032
#include <iostream>
#include <complex>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
#include <random>
#include <iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> P;
const ll MOD=1000000007;
const ll MAX_N=500010;
const ll INF=999999999999;

int gcd(int a,int b){
    int M=max(a,b);
    int m=min(a,b);
    while(m>0){
        int buf=M%m;
        M=m;
        m=buf;
    }
    return M;
}

int main(){
    int x;
    cin>>x;
    int g=gcd(x,360);
    cout<<360/g<<endl;
}

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

int main() {
  string S, T;
  cin >> S >> T;

  int ans = 0;
  for (int i = 0; i < (int)S.size(); i++) {
    char s = S.at(i);
    char t = T.at(i);
    if (s != t) {
      ans++;
    }
  }

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

Measured memory_bytes: 3852
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<utility>
#include<map>
#include<queue>
#include<set>
#include<bitset>
#include<stdio.h>
#include<deque>
#include<iomanip>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
typedef long long ll;

int main()
{
    string s;
    int ans = 1e5;
    cin >> s;
    for(int i = 1; i < s.size()-1; i++){
        int a = ((s[i-1]-'0')*100)+((s[i]-'0')*10)+(s[i+1]-'0');
        ans = min(ans, abs(753-a));
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
//#define NDEBUG
#include <cstddef>
#include <cstdint>
#include <vector>

using i8 = ::std::int_least8_t;
using i32 = ::std::int_least32_t;
using i64 = ::std::int_least64_t;
using u8 = ::std::uint_least8_t;
using u32 = ::std::uint_least32_t;
using u64 = ::std::uint_least64_t;
using isize = ::std::ptrdiff_t;
using usize = ::std::size_t;

class rep {
	const usize f, l;

public:
	class itr {
		friend rep;
		usize i;
		itr(usize x) noexcept : i(x) {}

	public:
		void operator++() noexcept { ++i; }
		usize operator*() const noexcept { return i; }
		bool operator!=(const itr x) const noexcept { return i != x.i; }
	};
	rep(usize first, usize last) noexcept : f(first), l(last) {}
	itr begin() const noexcept { return itr(f); }
	itr end() const noexcept { return itr(l); }
};
class revrep {
	const usize f, l;

public:
	class itr {
		friend revrep;
		usize i;
		itr(usize x) noexcept : i(x) {}

	public:
		void operator++() noexcept { --i; }
		usize operator*() const noexcept { return i; }
		bool operator!=(const itr x) const noexcept { return i != x.i; }
	};
	revrep(usize first, usize last) noexcept : f(first), l(last) {}
	itr begin() const noexcept { return itr(l - 1); }
	itr end() const noexcept { return itr(f - 1); }
};
template <class T> bool maxi(T &a, const T &b) {
	return a <= b ? (a = b, 1) : 0;
}
template <class T> bool mini(T &a, const T &b) {
	return b <= a ? (a = b, 1) : 0;
}
template <class T> bool smaxi(T &a, const T &b) {
	return b <= a ? 0 : (a = b, 1);
}
template <class T> bool smini(T &a, const T &b) {
	return a <= b ? 0 : (a = b, 1);
}
template <class T> using vec_alias = ::std::vector<T>;
template <class T> auto md_vec(usize n, const T &value) {
	return ::std::vector<T>(n, value);
}
template <class... Args> auto md_vec(usize n, Args... args) {
	return ::std::vector<decltype(md_vec(args...))>(n, md_vec(args...));
}
template <class T> const T &as_const(const T &v) noexcept { return v; }

#include <algorithm>
#include <iostream>
#include <utility>
#include <queue>
#include <tuple>
#include <unordered_map>

int main() {
	usize n;
	::std::cin >> n;
	::std::vector<u64> d(n), sub(n, 1);
	::std::vector<usize> parent(n, n);
	::std::unordered_map<u64, usize> mp;
	for (auto &e : d)
		::std::cin >> e;
	::std::priority_queue<u64> que;
	for (const auto i : rep(0, n)) {
		que.emplace(d[i]);
		mp[d[i]] = i;
	}

	::std::vector<u64> csum(n, 0);

	while (que.size() != 1) {
		u64 c = que.top();que.pop();
		usize i = mp[c];
		if (n <= sub[i] * 2 || c < n - sub[i] * 2)
			return ::std::cout << "-1" << ::std::endl, 0;
		u64 next = c - (n - sub[i] * 2);
		if (mp.count(next)) {
			usize j = mp[next];
			parent[i] = j;
			csum[j] += csum[i] + sub[i];
			sub[j] += sub[i];
		}
		else {
			return ::std::cout << "-1" << ::std::endl, 0;
		}
	}
	const usize top = mp[que.top()];
	if (csum[top] != d[top])
		return ::std::cout << "-1" << ::std::endl, 0;

	for (const auto i : rep(0, n)) {
		if (parent[i] != n)
			::std::cout << i + 1 << " " << parent[i] + 1 << ::std::endl;
	}
		

	return 0;

}


Measured memory_bytes: 9500
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#define ll long long
using namespace std;

int main() {
	ll H, W;
	cin >> W >> H;
	vector<pair<ll, int>> v(H+W);
	for(int i=0; i<H+W; ++i){
	    ll c;
	    cin >> c;
	    if(i<W) v[i]=make_pair(c, 0);
	    else v[i]=make_pair(c, 1);
	}
	sort(v.begin(), v.end());
	ll ans=0, hnow=H+1, wnow=W+1;
	for(int i=0; i<H+W; ++i){
	    if(v[i].second==0){
	        ans += v[i].first*hnow;
	        --wnow;
	    }
	    else{
	        ans += v[i].first*wnow;
	        --hnow;
	    }
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3328
#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for(ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF (1ll << 60)
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll, ll> p;
constexpr int MOD = 1000000007;
using ll = long long;
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;
}

void print(const std::vector<int> &v) {
    std::for_each(v.begin(), v.end(), [](int x) { std::cout << x << " "; });
    std::cout << std::endl;
}

long long gcd(long long a, long long b) {
    for(;;) {
        if(a == 0)
            return b;
        b %= a;
        if(b == 0)
            return a;
        a %= b;
    }
}

long long lcm(long long a, long long b) {
    long long temp = gcd(a, b);
    return temp ? (a / temp * b) : 0;
}

vector<long long> divisor(long long n) {
    vector<long long> res;
    for(long long i = 1; i * i <= n; i++) {
        if(n % i == 0) {
            res.push_back(i);
            if(i != n / i) {
                res.push_back(n / i);
            }
        }
    }
    return res;
}

int main() {
    int N;
    cin >> N;
    vector<int> A(N);
    int l = 1;
    REP(i, N) {
        cin >> A[i];
        l = lcm(l, A[i]);
    }
    int down = 0;
    REP(i, N) { down += l / A[i]; }
    cout << setprecision(10) << (double)l / down << endl;
    return 0;
}

Measured memory_bytes: 256
#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;
using VP = vector<P>;
using VVP = vector<VP>;
using VI = vector<ll>;
using VVI = vector<VI>;
using VVVI = vector<VVI>;
const int inf = 1e9 + 7;
const ll INF = 1LL << 61;
const ll mod = 1e9 + 7;

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

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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int i, j;
    int n;
    cin >> n;
    ll l[n];
    for (i = 0; i < n; i++) {
        cin >> l[i];
    }
    sort(l, l + n);
    ll cnt = 0;
    for (i = 0; i < n; i++) {
        for (j = i + 1; j < n; j++) {
            for (int k = j + 1; k < n; k++) {
                if (l[i] == l[j]) continue;
                if (l[j] == l[k]) continue;
                if (l[i] + l[j] > l[k]) cnt++;
                // cout << l[i] << " " << l[j] << " " << l[k] << endl;
            }
        }
    }
    cout << cnt << endl;
}

Measured memory_bytes: 3672
#include <bits/stdc++.h>
#define DEBUG(x) cout << #x << " = " << x << endl
#define pb push_back
using namespace std;
typedef long long ll;

const ll MOD = 1000000007;
const int MAXN = 100005;
int x[MAXN];
int var[MAXN];

int main()
{
    //freopen("input.txt", "r", stdin);
    int n;
    cin >> n;
    for (int i = 1; i <= n; i++)
    {
        cin >> x[i];
    }

    for (int i = 1; i <= n; i++)
    {
        var[i] = n-i+1;
    }

    int place = 1;
    for (int i = 1; i <= n; i++)
    {
        if (x[i] < 2*(i-place+1)-1)
        {
            var[place] = i-place+1;
            place++;
        }
    }

    ll ans = 1;
    for (int i = 1; i <= n; i++)
    {
        ans = ans * (ll) (var[i]) % MOD;
    //    cout << var[i] << " ";
    }
    cout << ans;
    return 0;
}




Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <assert.h>
#include <numeric>

using namespace std;

int p[100000];

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

	return 0;
}

Measured memory_bytes: 640
using System;
using System.Collections.Generic;

class D {
    static Dictionary<long, long> M = new Dictionary<long, long>{
        {0L, 1L}, {1L, 2L}
    };

    static long F(long n) {
        var answer = 0L;
        if (M.TryGetValue(n, out answer)) return answer;
        return M[n] = (F(n >> 1) + F(n - 1 >> 1) + F(n - 2 >> 1)) % 1000000007;
    }

    public static void Main() {
        var n = long.Parse(Console.ReadLine());
        Console.WriteLine(F(n));
    }
}


Measured memory_bytes: 13152
n=int(input())
G=[""]+["x"+input() for s in range(n)]
V=[0 for i in range(n+1)] 

V[1]=1
que=[1]
head=0
while len(que)>head:
    now=que[head]
    head+=1
    nexr=G[now]
    for i in range(1,n+1):
        if nexr[i]=="1" and V[i]==0:
            V[i]=V[now]+1
            que.append(i)

flg=True
for i in range(1,n):
    for q in range(i+1,n+1):
        if G[i][q]=="1" and abs(V[i]-V[q])!=1:
            flg=False

if flg:
    ans=0
    for sta in range(1,n+1):
        V=[0 for i in range(n+1)] 
        V[sta]=1
        que=[sta]
        head=0
        while len(que)>head:
            now=que[head]
            head+=1
            nexr=G[now]
            for i in range(1,n+1):
                if nexr[i]=="1" and V[i]==0:
                    V[i]=V[now]+1
                    que.append(i)
        ans=max(max(V),ans)
    print(ans)
        
else:
    print(-1)


Measured memory_bytes: 9260
N, C = map(int, input().split())
hs = list(map(int, input().split()))
ls = [(-2*hs[0], hs[0]**2)] + [0]*N
I,J = 0,0
for h in hs[1:]:
    u, v = ls[I]
    while I<J:
        w, y = ls[I+1]
        if u*h+v < w*h+y:
            break
        u, v, I = w, y, I+1
    a, b = -2*h, u*h+v+2*h**2+C
    while J:
        (c, d), (e, f) = ls[J], ls[J-1]
        if (c-e)*(b-d) < (d-f)*(a-c):
            break
        J-=1
    J+=1
    ls[J] = (a, b)
print(u*h+v + h**2+C)

Measured memory_bytes: 88060
/*  -*- coding: utf-8 -*-
 *
 * a.cc: A - αlphabet
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

/* typedef */

/* global variables */

/* subroutines */

/* main */

int main() {
  char s[4];
  scanf("%s", s);

  printf("%c\n", (s[0] >= 'A' && s[0] <= 'Z') ? 'A' : 'a');
  return 0;
}


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

int main() {
  long long n;
  cin>>n;
  vector<long long> a(n+1),b(n);
  rep(i,n+1) cin>>a[i];
  rep(i,n) cin>>b[i];
  ////////
  long long ans=0;
  rep(i,n){
       if(a[i]>=b[i]) {
           ans+=b[i];
      
         }
       else{
            ans+=a[i];
           	long long s=b[i]-a[i];
           if(a[i+1]>s){
             a[i+1]-=s;
             ans+=s;
           }
           else{
             ans+=a[i+1];
              	a[i+1]=0; 
           }
         
         
         
       }
  }
  cout<<ans<<endl;
}




 






Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <cstring>
#include <vector>
#include <algorithm>
#include <set>
#include <stack>
#include <deque>
#include <cmath>
#include <map>
using namespace std;
using ll = long long;
#define rep(i, n) for (ll i = 0; i < n; i++)
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

int main() {
    string s;
    cin >> s;
    rep(i, s.size()-1) {
        if (s.substr(i, 2) == "AC") {
            cout << "Yes\n";
            return 0;
        }
    }
    cout << "No\n";
}

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

using namespace std;

int main()
{
    int a, b, c;
    vector<int> vec(10);
    cin >> vec[0] >> vec[1] >> vec[2];
    int cnt = count(vec.begin(), vec.end(), 5);
    int cnt2 = count(vec.begin(), vec.end(), 7);
    if (cnt == 2 && cnt2 == 1)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef pair<int, int> ii;

const int N = 2e5+100, M = 1e6+100, MOD = 998244353;

int sum[M], sum2[M], muls[M], a[N];

int add(ll a, int b){
    return (a + b + 2LL*MOD) % MOD;
}
 
int mul(ll a, int b){
    return (a * b) % MOD;
}

void sadd(int &a, int b){
    a = add(a, b);
}

void smul(int &a, int b){
    a = mul(a, b);
}

int bp(int a, int b){
    if(b == 0)
        return 1;
    int x = bp(a, b/2);
    smul(x, x);
    return b&1 ? mul(x, a) : x;
}

int inv(int a){
	return bp(a, MOD-2);
}

signed main(){
	ios_base::sync_with_stdio(false); cin.tie(NULL);
	int two_inv = inv(2);
	int n;cin >> n;
	for(int i=0 ; i<n ; i++){
		cin >> a[i];
		sadd(sum[a[i]], a[i]);
		sadd(sum2[a[i]], mul(a[i], a[i]));
	}
	for(int i=1 ; i<M ; i++)
		for(int j=2*i ; j<M ; j+=i){
			sadd(sum[i], sum[j]);
			sadd(sum2[i], sum2[j]);
		}
	int ans=0;
	for(int i=M-1 ; i>=1 ; i--){
		int cur = mul(sum[i], sum[i]);
		sadd(cur, -sum2[i]);
		smul(cur, two_inv);
		muls[i] = cur;
		for(int j=2*i ; j<M ; j+=i)
			sadd(muls[i], -muls[j]);
		int cans = mul(muls[i], inv(i));
		sadd(ans, cans);
	}
	cout << ans << "\n";
	return 0;
}
















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

int main(){
    int x1, x2, x3, x4, y1, y2, y3, y4;
    cin >> x1 >> y1 >> x2 >> y2;

    x3 = x2 - (y2 - y1);
    y3 = y2 + (x2 - x1);
    x4 = x3 - (x2 - x1);
    y4 = y3 - (y2 - y1);

    printf("%d %d %d %d\n", x3, y3, x4, y4);

    return 0;
}

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

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

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

    sort(a.begin(), a.end());
    auto it = unique(a.begin(), a.end());

    cout << it - a.begin() << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1e16;
const ll mod = 1000000007;
#define rep(i, n) for (int i = 0; i < (ll)(n); i++)

int main() {
  ll x, a, b; cin >> x >> a >> b;
  if (abs(x-a) < abs(x-b)) cout << 'A' << endl;
  else cout << 'B' << endl;
}

Measured memory_bytes: 3572
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ALDS1_2_D
{
    public class Program

    {
        public static void Main(string[] args)
        {
            int n = ReadInt();
            int[] line = new int[n];            
            for (int i = 0 ; i < n ; i++) line[i] = ReadInt();

            List<object> res = ShellSort(line);
            int swapTimes = (int)res[0];
            List<int> interval = (List<int>)res[1];

            Console.WriteLine(interval.Count);
            Console.WriteLine(string.Join(" ",interval.OrderByDescending(x => x).Select(x => x.ToString()).ToArray()));
            Console.WriteLine(swapTimes);
            for (int i = 0 ; i < n ; i++) Console.WriteLine(line[i].ToString());
        }

        //●シェルソート
        public static List<object> ShellSort(int[] array)
        {
            int swapTimes = 0;
            List<int> interval = new List<int>();
            for (int i = 1 ; i <= array.Length ; i = i * 3 + 1) interval.Add(i);

            for (int i = interval.Count - 1 ; i >= 0 ; i--)
            {
                swapTimes += InsertionSort(array, interval[i]);
            }

            List<object> res = new List<object>();
            res.Add(swapTimes);
            res.Add(interval);
            return res;
        }

        //●挿入ソート
        public static int InsertionSort(int[] array, int interval)
        {
            int swapTimes = 0;
            for (int i = interval ; i < array.Length ; i++)
            {
                int v = array[i];
                int j = i - interval;
                while (j >= 0 && array[j] > v)
                {
                    array[j + interval] = array[j];
                    j -= interval;
                    swapTimes++;
                }
                array[j + interval] = v;
            }
            return swapTimes;
        }

        static string ReadSt() { return Console.ReadLine(); }
        static int ReadInt() { return int.Parse(Console.ReadLine()); }
        static long ReadLong() { return long.Parse(Console.ReadLine()); }
        static double ReadDouble() { return double.Parse(Console.ReadLine()); }
        static string[] ReadStAr(char sep = ' ') { return Console.ReadLine().Split(sep); }
        static int[] ReadIntAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => int.Parse(e)); }
        static long[] ReadLongAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => long.Parse(e)); }
        static double[] ReadDoubleAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => double.Parse(e)); }

    }

}



Measured memory_bytes: 24036
#include<bits/stdc++.h>
#define ll long long int
#define lb long double
#define ull unsigned long long int
#define pb push_back
#define vi vector < int >
# define vs vector < string >
# define vb vector < bool >

# define pii pair < int , int >
# define pll pair < ll , ll >
# define pld pair < ld , ld >
# define pDD pair < D , D >


# define fast ios_base::sync_with_stdio(false) ; cin.tie(0) ; cout.tie(0);
using namespace std  ;
 void solve()
{
int a,b,c;
cin>>a>>b>>c;
if(a==b&&a!=c)
    cout<<"Yes\n";
else if(a==c&&a!=b)
    cout<<"Yes\n";
else if(b==a&&b!=c)
cout<<"Yes\n";
else if(b==c&b!=a)
 cout<<"Yes\n";
 else if(c==b&&c!=a)
cout<<"Yes\n";
 else if(c==a&&c!=b)
cout<<"Yes\n";
else cout<<"No\n";

}
int main(){
//{fast
//int t;
//cin>>t;
//while(t--)
//{
solve();
//}

}





Measured memory_bytes: 256
A1 = list(map(int, input().split()))
A2 = list(map(int, input().split()))
A3 = list(map(int, input().split()))
N = int(input())
lst = []
for _ in range(N):
    i = int(input())
    lst.append(i)

for n, i in enumerate(A1):
    for j in lst:
        if i == j:
            A1[n] = 0

for n, i in enumerate(A2):
    for j in lst:
        if i == j:
            A2[n] = 0
            
for n, i in enumerate(A3):
    for j in lst:
        if i == j:
            A3[n] = 0
            
B1 = sum(A1)
B2 = sum(A2)
B3 = sum(A3)
B4 = A1[0] + A2[0] + A3[0]
B5 = A1[1] + A2[1] + A3[1]
B6 = A1[2] + A2[2] + A3[2]
B7 = A1[0] + A2[1] + A3[2]
B8 = A1[2] + A2[1] + A3[0]

if B1 * B2 * B3 * B4 * B5 * B6 * B7 * B7 * B8 == 0:
    print('Yes')
else:
    print('No')

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

int main(){
   
    int N;cin>>N;
    vector<vector<int>> S(N,vector<int>(N,0));
    for(int i=0;i<N;i++){
        int a,b;cin>>a>>b;
        for(int j=0;j<b;j++){
            int k;cin>>k;
            S[i][k-1]=1;
        }
    }
    for(int i=0;i<N;i++){
        for(int j=0;j<N;j++){
            if(j) cout<<" ";
            cout<<S[i][j];
        }
        cout<<endl;
    }
}



Measured memory_bytes: 3176
#include <cstdio>
int a, b, c ,d;
char ch;
int main() {
	while((ch = getchar()) != EOF) {
		if(ch == 'N') a = 1;
		else if(ch == 'S') b = 1;
		else if(ch == 'E') c = 1;
		else if(ch == 'W') d = 1;
	}
	if((a^b) || (c^d)) puts("No");
	else puts("Yes");
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
const int mx = 200005;
int n, a, h[mx];

struct SegTree{
    int sz = 2;
    vector<long long> dat;
    SegTree(int n){
        while(n >= sz) sz *= 2;
        dat.assign(sz*2, 0);
    }
    void set(int x, long long n){
        int l = sz, r = x-1+sz;
        long long res = 0;
        while(l <= r){
            if(l&1) res = max(res, dat[l++]);
            if(r&1^1) res = max(res, dat[r--]);
            l /= 2; r /= 2;
        }
        dat[x += sz] = n + res;
        for(;x;x/=2) dat[x/2] = max(dat[x], dat[x^1]);
    }
};
int main(){
    scanf("%d", &n);
    SegTree sg(n);
    for(int i = 0; i < n; i++) scanf("%d", h+i);
    for(int i = 0; i < n; i++){
        scanf("%d", &a);
        sg.set(h[i], a);
    }
    printf("%lld\n", sg.dat[1]);
}


Measured memory_bytes: 5120
# import itertools
# import math
import sys
# sys.setrecursionlimit(500*500)
# import numpy as np
# import heapq
# from collections import deque

# N = int(input())
# S = input()
# n, *a = map(int, open(0))
X, Y = map(int, input().split())
# A = list(map(int, input().split()))
# B = list(map(int, input().split()))
# tree = [[] for _ in range(N + 1)]
# B_C = [list(map(int,input().split())) for _ in range(M)]
# S = input()

# B_C = sorted(B_C, reverse=True, key=lambda x:x[1])
# all_cases = list(itertools.permutations(P))
# a = list(itertools.combinations_with_replacement(range(1, M + 1), N))
# itertools.product((0,1), repeat=n)

# A = np.array(A)
# cum_A = np.cumsum(A)
# cum_A = np.insert(cum_A, 0, 0)

# def dfs(tree, s):
#     for l in tree[s]:
#         if depth[l[0]] == -1:
#             depth[l[0]] = depth[s] + l[1]
#             dfs(tree, l[0])
# dfs(tree, 1)

# def factorization(n):
#     arr = []
#     temp = n
#     for i in range(2, int(-(-n**0.5//1))+1):
#         if temp%i==0:
#             cnt=0
#             while temp%i==0:
#                 cnt+=1
#                 temp //= i
#             arr.append([i, cnt])
#     if temp!=1:
#         arr.append([temp, 1])
#     if arr==[]:
#         arr.append([n, 1])
#     return arr

if (X + Y) % 3 != 0:
    print(0)
    sys.exit()

cnt = (X + Y) // 3

diff = abs(X - Y)



def comb(n, m, mod = 10 ** 9 + 7):
    if m < 0:
        return 0
    numerator = 1
    denominator = 1
    for i in range(1, m + 1):
        numerator = numerator * (n - i + 1) % mod
        denominator = denominator * i % mod
    d_inv = pow(denominator, mod - 2, mod)
    return numerator * d_inv % mod

print(comb(cnt, (2 * Y - X) // 3) % (10 ** 9 + 7))

Measured memory_bytes: 9192
tscore = hscore = 0
n = int( input( ) )
for i in range( n ):
	tcard, hcard = input( ).split( " " )
	if tcard < hcard:
		hscore += 3
	elif hcard < tcard:
		tscore += 3
	else:
		hscore += 1
		tscore += 1

print( "{:d} {:d}".format( tscore, hscore ) )

Measured memory_bytes: 6724
import std.stdio, std.string, std.conv;

void main() {
    auto input = getStdin!(int[])();
    for (int i = 0; i < input.length; i++) {
    	if (input[i] == 0) break;
    	writefln("Case %d: %d", i + 1, input[i]);
    }
}

T getStdin(T)() {
    string[] cmd;
    string line;
    while ((line = chomp(stdin.readln())) != "") cmd ~= line;
    return to!(T)(cmd);
}

Measured memory_bytes: 2604
int main(void)
{
    int height, width, H, W;
    scanf("%d %d", &H, &W);
    if(H == 0 && W == 0){
        return 0;
    }
 
    for(height = 0; height < H; height++){
        for(width = 0; width <W; width++){
            printf("#");
        }
        printf("\n");
    }
    printf("\n");
 
    main();
}

Measured memory_bytes: 572
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		try (Scanner sc = new Scanner(System.in)) {
			// 整数の入力
			long a = sc.nextLong();
			long b = sc.nextLong();

			long min = a < b ? a : b;
			long max = a > b ? a : b;

			for (long i = 1; i <= max; i++) {
				if (min * i % max == 0) {
					System.out.println(min * i);
					break;
				}
			}
		}
	}
}


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

long long int n;

int main(){
  cin >> n;
  long long int num = sqrt(n);
  long long int i = 0, j = 0;
  for(long long int k = 1; k <= num; k++){
    if(n % k != 0){
      continue;
    }
    i = k;
    j = n / i;
  }
  cout << i + j - 2 << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
using namespace std;
int n,h,w;
int a[100005],xx[100005],yy[100005];
multiset<pair<int,pair<int,int> > >S;
vector<int>g[2][100005];
struct ssss{
	int par[200005];
	ssss(){for(int i=1;i<=200002;i++)par[i]=i;}
	int find(int x){
		return par[x]==x?x:par[x]=find(par[x]);
	}
	void merge(int x,int y){
		int nx=find(x),ny=find(y);
		par[nx]=ny;
	}
}uf;
bool dead[2][100005];
#define kill ffweifnweoifnweoif
void kill(int op,int x){
//	cerr<<op<<" "<<x<<endl;
	dead[op][x]=1;
	for(int i=0;i<g[op][x].size();i++){
		if(dead[op^1][g[op][x][i]])continue;
		kill(op^1,g[op][x][i]);
	}
}
bool can(int x,int y){
	if(dead[0][x]&&dead[1][y])return false;
	if(dead[0][x]){
		kill(1,y);
		return true;
	}
	if(dead[1][y]){
		kill(0,x);
		return true;
	}
	if(uf.find(x)==uf.find(y+1e5)){
		kill(0,x);
	}else{
		g[0][x].push_back(y);
		g[1][y].push_back(x);
		uf.merge(x,y+1e5);
	}
	return true;
}
signed main(){
	cin>>n>>h>>w;
	for(int i=1;i<=n;i++){
		cin>>xx[i]>>yy[i]>>a[i];
		S.insert(make_pair(-a[i],make_pair(xx[i],yy[i])));
	}
	int ans=0;
	while(!S.empty()){
		if(can(S.begin()->second.first,S.begin()->second.second)){
			ans-=S.begin()->first;
		}
		S.erase(S.begin());
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 19840
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define MAXSIZE 10000000;

const int MAX = 510000;
const int MOD = 1000000007;

int main(){
    int N;
    int a[100001];
    int b[100001];
    int c[100001];

    int dp[100001][3] = {0};

    cin >>N;

    for(int i = 0; i < N;i++){
        cin >>a[i]>>b[i]>>c[i];
    }

    dp[0][0] = a[0];
    dp[0][1] = b[0];
    dp[0][2] = c[0];

    for(int i = 1; i < N;i++){
        dp[i][0] = max(dp[i-1][1] + a[i], dp[i-1][2] + a[i]);
        dp[i][1] = max(dp[i-1][0] + b[i], dp[i-1][2] + b[i]);
        dp[i][2] = max(dp[i-1][0] + c[i], dp[i-1][1] + c[i]);
    }

    cout <<max(dp[N-1][0], max(dp[N-1][1], dp[N-1][2]))<<endl;

    return 0;
}

/*Syakutori
while(cin >>b && b)){
      ll t = 1;
      long long int ansS = 1,ansT=0;
      long long int sum = 0;

      for(ll s = 1;s < 50000000;s++){

        while(t <  50000000 && sum+Rsum[t] < b){
          sum += Rsum[t];
          t++;
        }
        if(b == sum+Rsum[t]){
          if(ansT - ansS < t-s){
            ansS = s;
            ansT = t;
          }
          cout <<ansS<<" "<<ansT-ansS + 1<<endl;
          break;
        }
        if(t == s)++t;
        else sum -= Rsum[s];
        }
    }

//priority_queue<long long int,vector<long long int>, greater<long long int>> PQ;
//priority_queue<long long int> PQ1;

bool comp(const pair<int,int> a, const pair<int,int> b) {
    return a.second < b.second;
}

ll gcd(ll a,ll b){
  if(a%b == 0){
    return b;
  }else{
    return gcd(b,a%b);
  }
}


*/


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

int main() {
  int n, k, x, y;
  cin >> n >> k >> x >> y;

  int ans = 0;
  for(int i=0; i<n; i++) {
    if(i <= k-1)
      ans += x;
    else
      ans += y;
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
int main(){
  int a,b=0,c=1,d=1;
  scanf("%d",&a);
  for(int i=0;i<10;i++){
    for(int j=0;j<10;j++){
      if(a==i*j)b=1;
    }
  }
  if(b==1)printf("Yes\n");
  else printf("No\n");
  return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<stack>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
//#define mt make_tuple
//typedef tuple<double,int,double> tp;
//typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
const double PI=acos(-1);
const double EPS=1e-7;
Def inf=sizeof(Def)==sizeof(long long)?2e18:1e9;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
int main(){
	int a,b,c,d,e,f;
	cin>>a>>b>>c>>d>>e>>f;
	int A=100*a,B=0;
	vi dp(f+1);
	vi dp2(f+1);
	rep(i,f+1)rep(j,f+1)if(100*a*i+100*b*j<=f)dp[100*a*i+100*b*j]=true;
	rep(i,f+1)rep(j,f+1)if(c*i+d*j<=f)dp2[c*i+d*j]=true;
	rep(i,f+1)rep(j,f+1)if(dp[i]&&dp2[j]&&i+j<=f){
		if(i/100*e<j)continue;
		if(B*(i+j)<(A+B)*j){
			A=i,B=j;
		}
	}
	cout<<A+B<<" "<<B<<endl;
}








Measured memory_bytes: 256
X, Y = [int(x) for x in input().split()]

def solve(X, Y):
    if X == Y:
        return -1
    if Y < X:
        if X % Y == 0:
            return -1

    for x in range(X, 10**18+1, X):
        if x % Y != 0:
            return x
print(solve(X, Y))





Measured memory_bytes: 2940
#include <bits/stdc++.h>
#define lsb(x) (x & (-x))
#define ll long long
#define ull unsigned long long



#if 0
const int MOD = ;

inline int lgput(int a, int b) {
    int ans = 1;
    while(b > 0) {
        if(b & 1) ans = (1LL * ans * a) % MOD;
        b >>= 1;
        a = (1LL * a * a) % MOD;
    }
    return ans;
}

inline void mod(int &x) {
    if(x >= MOD)
        x -= MOD;
}

inline void add(int &x, int y) {
    x += y;
    mod(x);
}

inline void sub(int &x, int y) {
    x += MOD - y;
    mod(x);
}

inline void mul(int &x, int y) {
    x = (1LL * x * y) % MOD;
}

inline int inv(int x) {
    return lgput(x, MOD - 2);
}
#endif

#if 0
int fact[], invfact[];

inline void prec(int n) {
    fact[0] = 1;
    for(int i = 1; i <= n; i++) {
        fact[i] = (1LL * fact[i - 1] * i) % MOD;
    }
    invfact[n] = lgput(fact[n], MOD - 2);
    for(int i = n - 1; i >= 0; i--) {
        invfact[i] = (1LL * invfact[i + 1] * (i + 1)) % MOD;
    }
}

inline int comb(int n, int k) {
    if(n < k) return 0;
    return (1LL * fact[n] * (1LL * invfact[k] * invfact[n - k] % MOD)) % MOD;
}
#endif

using namespace std;



int main() {
#if 0
    ifstream cin("A.in");
    ofstream cout("A.out");
#endif
    int i, n, x;
    ios::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);

    cin >> n >> x;
    vector <int> b(n), l(n), u(n);
    for(i = 0; i < n; i++) {
        cin >> b[i] >> l[i] >> u[i];
    }

    auto get = [&](int p, int cnt) {
        return 1LL * l[p] * min(cnt, b[p]) + 1LL * max(0, cnt - b[p]) * u[p];
    };

    auto check = [&](ll h) {
        ll cnt = h / x;
        if(cnt >= n) {
            return 0LL;
        }
        vector < pair <ll, int> > sum(n);
        for(i = 0; i < n; i++) {
            sum[i] = {1LL * b[i] * l[i] + 1LL * (x - b[i]) * u[i], i};
        }
        sort(sum.rbegin(), sum.rend());
        for(i = 1; i < n; i++) {
            sum[i].first += sum[i - 1].first;
        }
        ll ans = -1;
        for(i = 0; i < n; i++) {
            ll cur = 0;
            int p = sum[i].second;
            if(i < cnt) {
                cur += sum[cnt].first - (1LL * b[p] * l[p] + 1LL * (x - b[p]) * u[p]);
                cur += get(p, h - cnt * x);
            }
            else {
                cur += (cnt > 0 ? sum[cnt - 1].first : 0) + get(p, h - cnt * x);
            }
            ans = max(ans, cur);
        }
        //cerr << h << " " << ans << "\n";
        for(i = 0; i < n; i++) {
            ans -= 1LL * b[i] * l[i];
        }
        return ans;
    };

    ll res = -1;
    for(ll step = 1LL << 50; step; step >>= 1) {
        if(check(res + step) < 0) {
            res += step;
        }
    }
    cout << res + 1;

    return 0;
}



Measured memory_bytes: 3044
N = [0] + [int(x) for x in list(input())] # 例："1234" → [0, 1, 2, 3, 4]

def dfs(L, same):
    '''same ... True if L[i] == N[i] for all i = 0, 1, ..., len(L)-1'''
    global N
    if len(L) == len(N):
        if L.count(7) > 0 and L.count(5) > 0 and L.count(3) > 0:
            return 1
        else:
            return 0

    i = len(L) - 1  # Lの右端の桁
    ans = 0
    if same:    # Lの0, 1, .., i桁がNの0, 1, ..., i桁と同じ
        if i == 0:  # L[i]はダミーの0
            next = [0, 3, 5, 7]
        else:
            next = [3, 5, 7]
        for j in next:
            if j < N[i + 1]:
                ans += dfs(L + [j], same = False)
            if j == N[i + 1]:
                ans += dfs(L + [j], same = True)
    else:  # 残りの桁に関わらずLがNより小さいことが確定している
        if L[i] == 0: # L = [0, 0, .., 0]
            next = [0, 3, 5, 7]
        else:
            next = [3, 5, 7]
        for j in next:
            ans += dfs(L + [j], same = False)

    return ans

print(dfs([0], True))

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


int main() {
    string s, t;
    cin >> s >> t;
    int n1 = s.size(), n2 = t.size();
    vector<string> res;
    for (int i = 0; i + n2 <= n1; i++) {
        string ss = s;
        int flag = 1;
        for (int j = 0; j < n2; j++) {
            if (ss[j + i] == '?' || ss[j + i] == t[j]) {
                ss[j + i] = t[j];
            } else {
                flag = 0;
                break;
            }
        }
        if (flag == 0) continue;
        for (int j = 0; j < n1; j++) {
            if (ss[j] == '?') ss[j] = 'a';
        }
        res.push_back(ss);
    }
    if (res.size() == 0) {
        cout << "UNRESTORABLE" << endl;
    } else {
        sort(res.begin(), res.end());
        cout << res[0] << endl;
    }
}




Measured memory_bytes: 3568
#include<cstdio>
#include<algorithm>

int main()

{

  int k,v,n,i,j,m=0;

  scanf("%d",&n);

  int Adj[n][n];

  for(i=0; i<n; i++){
    for(j=0; j<n; j++){
      Adj[i][j]=0;
	

  }
    
  }

  
  

  for(i=0; i<n; i++)
    {
      scanf("%d",&m);
      scanf("%d",&k);
      for(j=0; j<k; j++)
	{
	  scanf("%d",&v);
	  Adj[i][v-1]=1;
	}
      
    }
  for(i=0; i<n; i++){
    for(j=0; j<n; j++){
      printf("%d",Adj[i][j]);
      if(j!=n-1) printf(" ");
	

  }
    printf("\n");
  }
  
  
}



Measured memory_bytes: 2712
#include <iostream>
#include <string>
#include <vector>
#include<algorithm>

using namespace std;

int main(void) {
	int A, B, M,amin=100000,bmin=100000;
	cin >> A >> B >> M;

	vector<int> a(A), b(B);
	vector<vector<int>> x(M, vector<int>(3));
	for (int i = 0; i < A; i++) {
		cin >> a[i];
		amin = min(amin, a[i]);
	}
	for (int i = 0; i < B; i++) {
		cin >> b[i];
		bmin = min(bmin, b[i]);
	}
	for (int i = 0; i < M; i++) {
		cin >> x[i][0]>>x[i][1]>>x[i][2];
	}
	
	int ans=1000000;
	for (int i = 0; i < M; i++) {
		ans = min(ans, a[x[i][0]-1] + b[x[i][1]-1] - x[i][2]);
	}
	
	ans = min(amin + bmin, ans);

	cout << ans;
	return 0;
}

Measured memory_bytes: 6528
#include <bits/stdc++.h>
using namespace std;
using ull = unsigned long long;

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

    vector<ull> a(n);
    for(int i=0; i<n; i++){
        ull t;
        cin >> t;
        a.at(i) = t;
    }
    sort(a.begin(), a.end());

    // 偶数→1パターン
    // 奇数→2パターン：中心3つの振り分けの差

    ull ans = 0;
    if(n%2==0){
        ans = a.at(n/2) - a.at(n/2-1);
        for(int i=0; i<n/2-1; i++){
            ans += a.at(n-1-i) * 2;
            ans -= a.at(i) * 2;
        }
    }
    else{
        long long mid1 = a.at(n/2+1) + a.at(n/2) - a.at(n/2-1) * 2;
        long long mid2 = a.at(n/2+1) * 2 - a.at(n/2) - a.at(n/2-1);
        ans = (ull)max(mid1, mid2);
        for(int i=0; i<n/2-1; i++){
            ans += a.at(n-1-i) * 2;
            ans -= a.at(i) * 2;
        }
    }

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


Measured memory_bytes: 1024