akhauriyash/Code-Regression huggingface dataset:
"use strict";//const 使用のため宣言
// inputに入力データ全体が入る
function Main(input) {

    const arg = input.split('\n');
    const A = parseInt(arg[0]);
    const B = parseInt(arg[1]);
    const C = parseInt(arg[2]);
    const X = parseInt(arg[3]);

    let count = 0;

    for (let a = 0; a <= A; a++) {
        for (let b = 0; b <= B; b++) {
            for (let c = 0; c <= C; c++) {

                let sum = (500 * a) + (100 * b) + (50 * c);
                if (sum === X) count = (count + 1) | 0;
                //console.log(sum);
                //console.log(count);



            }

        }

    }
    console.log(count);

}

//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//Main(require("fs").readFileSync("./a.txt", "utf8"));

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

using ll = long long;
const int mod = 1e9 + 7;

int cnt[11][10];

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    string S;
    cin >> S;
    for (int i = 0; i < 3; i++) {
        if (S[i] == '7') {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
}

Measured memory_bytes: 3652
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String {
            bytes
                .by_ref()
                .map(|r| r.unwrap() as char)
                .skip_while(|c| c.is_whitespace())
                .take_while(|c| !c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

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

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

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

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

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

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

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

fn main() {
    input!{
        x: usize,
        y: usize
    }
    println!("{}", x + y / 2);
}


Measured memory_bytes: 4352
// Optimise
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

// #define MULTI_TEST
#ifdef LOCAL
#include "/home/shahraaz/bin/debug.h"
#else
#define db(...)
#define pc(...)
#endif

#define f first
#define s second
#define pb push_back
#define all(v) v.begin(), v.end()
auto TimeStart = chrono::steady_clock::now();
auto seed = TimeStart.time_since_epoch().count();
std::mt19937 rng(seed);
using ll = long long;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template <typename T>
using Random = std::uniform_int_distribution<T>;

const int NAX = 2e5 + 5, MOD = 1000000007;

class Solution
{
private:
public:
    Solution() {}
    ~Solution() {}
    void solveCase()
    {
        string str;
        cin >> str;
        if (str.size() == 6 && str[2] == str[3] && str[4] == str[5])
            cout << "Yes\n";
        else
            cout << "No\n";
    }
};

int32_t main()
{
#ifndef LOCAL
    ios_base::sync_with_stdio(0);
    cin.tie(0);
#endif
    int t = 1;
#ifdef MULTI_TEST
    cin >> t;
#endif
    Solution mySolver;
    for (int i = 1; i <= t; ++i)
    {
        mySolver.solveCase();
#ifdef TIME
        cerr << "Case #" << i << ": Time " << chrono::duration<double>(chrono::steady_clock::now() - TimeStart).count() << " s.\n";
        TimeStart = chrono::steady_clock::now();
#endif
    }
    return 0;
}

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

int main() {
  string S, T;
  cin >> S >> T;
  int m = S.size() - T.size() + 1;
  int n = T.size();
  vector<int> vec(m);
  rep(i, m){
    for (int j = i; j < n + i; j++){
      if(S.at(j) == T.at(j - i)){
        vec.at(i)++;
      }
    } 
  }
  sort(vec.begin(), vec.end());
  cout << n - vec.at(m - 1) << endl;  
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
 
using namespace std;
inline void prep ()
{
  cin.tie (0);
  cin.sync_with_stdio (0);
};
const double pi = acos(-1.);
//printf(%.12lf\n,mid);
// __builtin_popcount(int) count 1's in binary
// get decimal part of number
/*
double intpart;
double thiss = modf((double)(n*m)/(double)k, &intpart);
*/
// round = (int)(num+.5)
long long mod = 1000000007;
 
// 32 mil = ~1 sec 
long long mymod(long long num){
  if (num< 0 && !(num%mod == 0)){
    if (mod == 1){
      return 0;
    }
    return mod-abs(num)%mod;
  }else{
    return num%mod;
  }
}
 
/*string sentence = And I feel fine...;
    istringstream iss(sentence);
*/  
 
double eps = .000000001;


int dx[] = {-1, 0, 1, 0};
int dy[] = {0, -1, 0, 1};
int h, w;
string grid[20];
bool valid(int x, int y){
    if (x < 0 || y < 0 || x >= h || y >= w){
        return false;
    }
    if (grid[x][y] == '#'){
        return false;
    }
    return true;
}
int main ()
{
  prep();
  
  cin >> h >> w;
  
  for (int i=0; i<h; i++){
      cin >> grid[i];
  }
  int maxest = 0;
  for (int i=0; i<h; i++){
      for (int j=0; j<w; j++){
          if (grid[i][j] == '#'){
              continue;
          }
          queue<tuple<int, int, int> > q;
          q.emplace(i, j, 0);
          bool vis[h][w];
          memset(vis, false, sizeof(bool)*h*w);
          while (!q.empty()){
              tuple<int, int, int> top = q.front();
              q.pop();
              int x = get<0>(top);
              int y = get<1>(top);
              int dist = get<2>(top);
              if (vis[x][y]){
                  continue;
              }
              vis[x][y] = true;
              maxest = max(maxest, dist);
              for (int k=0; k<4; k++){
                  int newx = x+dx[k];
                  int newy = y+dy[k];
                  if (!valid(newx, newy)){
                      continue;
                  }
                  q.emplace(newx, newy, dist+1);
              }
          }
      }
  }
  cout << maxest;
  return 0; 
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define f first
#define s second
#define mp make_pair
#define all(x) x.begin(), x.end()
#define EPS 1e-9
#define X real()
#define Y imag()
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
using vi = vector<int>;
using ii = pair<int, int>;
using vii = vector<ii>;
void print_strings(string s, int n, int m, int j) {
	if(m == 0)
		cout << s << '\n';
	else {
		for(int i = 0; i <= j + 1; ++i)
			print_strings(s + char('a' + i), n, m - 1, max(i, j));
	}
}
int main() {

	ios_base :: sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int n;
	cin >> n;
	print_strings("a", n, n - 1, 0);
    return 0;
}

Measured memory_bytes: 1536
#include <iostream>
#include <string>
#include <vector>
using namespace std;
using ll = long long;
const int mod = 1000000007;

ll dp[11000][2][110];

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

    string s;
    int m;
    cin >> s >> m;

    int n = s.size();
    dp[0][0][0] = 1;

    for(int i = 0; i < n; ++i){
        int D = s[i] - '0';
        for(int j = 0; j < 2; ++j){
            for(int k = 0; k < m; ++k){
                for(int d = 0; d <= (j? 9: D); ++d){
                    dp[i+1][j||(d<D)][(k+d)%m] += dp[i][j][k];
                    dp[i+1][j||(d<D)][(k+d)%m] %= mod;
                }
            }
        }
    }


    cout << (dp[n][0][0] + dp[n][1][0] + mod - 1) % mod << endl;

    return 0;
}

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

#define F first
#define S second
#define int long long
#define inf 1000000000

using namespace std;

signed main(){
    int n;
    string s;
    cin >> n >> s;
    int cnt[3] = {0};
    for (int i = 0; i < n; i++){
        if (s[i] == 'R'){
            cnt[0]++;
        } else if (s[i] == 'G'){
            cnt[1]++;
        } else if (s[i] == 'B'){
            cnt[2]++;
        }
    }
    int ans = cnt[0]*cnt[1]*cnt[2];
    for (int k = 1; k <= n/2; k++){
        for (int i = 0; i < n-2*k; i++){
            if (s[i] != s[i+k] && s[i] != s[i+2*k] && s[i+k] != s[i+2*k]){
                ans--;
            }
        }
    }
    cout << ans << endl;
    return 0;
}























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

using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;

#define REP(i, n, m) for(ll i=n; i<(ll)m; ++i)
#define IREP(i, n, m) for(ll i=n-1; i>=m; --i)
#define rep(i, n) REP(i, 0, n)
#define irep(i, n) IREP(i, n, 0)
#define all(v) v.begin(), v.end()

int main(){
    ll n;
    cin >> n;
    REP(i, 1, 10){
        if(n%i==0 && n/i<=9){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cstdio>
#include <string>
#include <algorithm>

using namespace std;

int main() {
    int A,P;
    cin >> A >> P;
    int kakera = A * 3 + P;
    cout << (int) kakera / 2 << endl; 
    return 0;
}

Measured memory_bytes: 256
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}
 
#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};
 
    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
 
    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}
 
#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };
 
    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };
 
    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };
 
    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };
 
    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };
 
    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

use std::collections::BinaryHeap;

fn main() {
    input! {
        n: usize,
        m: isize,
        mut a: [(isize, isize); n],
    }

    a.sort_by_key(|n| (n.0, -n.1));

    let mut  p_queue = BinaryHeap::new();
    let mut index = 0;
    let mut ans = 0;

    for i in 1..m+1 {
        while index < n && a[index].0 <= i {
            p_queue.push(a[index].1);
            index = index + 1;
        }
        ans = ans + p_queue.peek().unwrap_or(&0);
        p_queue.pop();       
        //p_queue.clear();
    }

    println!("{}", ans);
}


Measured memory_bytes: 8444
import java.util.ArrayList;
import java.util.BitSet;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int k = in.nextInt();
		BitSet sb = new BitSet();
		List<Integer> list = new ArrayList<Integer>();
		while ((n != k) && (n != 0)) {
			sb.clear();
			list.clear();
			for (int i = 0; i < k; i++) {
				sb.set(in.nextInt());
			}
			int start = sb.nextSetBit(1);
			int sizeMax = 0;
			if (!sb.get(1)) {
				list.add(0);
			}
			while (start != -1) {
				final int end = sb.nextClearBit(start);
				list.add(Integer.valueOf(end - start));
				start = sb.nextSetBit(end);
				if (start - end != 1) {
					list.add(Integer.valueOf(0));
				}
			}
			if (sb.get(0)) {
				for (int i = 0; i < list.size() - 1; i++) {
					sizeMax = Math.max(sizeMax, list.get(i) + list.get(i + 1)
							+ 1);
				}
			} else {
				for (int i = 0; i < list.size(); i++) {
					sizeMax = Math.max(sizeMax, list.get(i));
				}
			}
			System.out.println(sizeMax);
			n = in.nextInt();
			k = in.nextInt();
		}
	}

}

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

void lengthLIS(ll *arr,ll *ne,ll n)
{
    
    for(ll i=1;i<n;i++)
    {
        for(ll j=i-1;j>=0;j--)
        {
            if(arr[j]<arr[i]&&ne[j]+1>ne[i])
            {
                ne[i]=ne[j]+1;
                
                
                
            }
        }
    }
    return;
    
}

 
int main()
{
    ll n,a,start,end,mid,ma=1,t,b;
    //double x,y,z;
  
    cin>>n;
      ll arr[n];
    for(int i=0;i<n;i++)
    {
        cin>>arr[i];
      
    }
      ll cnt=1;
    for(int i=1;i<n;i++)
    {
      if(arr[i]<arr[i-1])
         {
           cnt++;
         }
         else arr[i]=arr[i-1];
      
    }
      cout<<cnt;
    return 0;
}
 
 

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

#define REP(i,n) for(int i=0;i<(int)(n);i++)

using namespace std;

const int INF = 1e+8;

int main() {
  int n,m;
  cin>>n>>m;
  bitset<15> bs;
  REP(i,n) {
    int j;
    cin>>j;
    bs[n-i-1]=j;
  }
  int num = bs.to_ulong();
  vector<int> dist(1<<n,INF);
  dist[num] = 0;
  queue<int> q;
  q.push(num);
  while(!q.empty()) {
    int i=q.front();q.pop();
    bitset<15> b(i);
    REP(j,n-1) {
      auto cp = b;
      bool tmp = cp[j];
      cp[j] = cp[j+1];
      cp[j+1] = tmp;
      int nb = cp.to_ulong();
      if (dist[nb] > dist[i] + 1) {
        dist[nb] = dist[i] + 1;
        q.push(nb);
      }
    }
  }
  int g1,g2;
  REP(i,m) {
    int k;
    cin>>k;
    REP(j,k) {
      g1 *= 2;
      g1 |= i & 1;
      g2 *= 2;
      g2 |= 1 - (i & 1);
    }
  }
  cout << min(dist[g1], dist[g2]) << endl;
  return 0;
}

Measured memory_bytes: 1280
import Foundation

let N = Int(readLine()!)!
let values = readLine()!.components(separatedBy: " ").map({Int($0)!})

func later_pattern() {
    var count = 0
    for i in 0 ..< N {
        var ok = true
        for j in 0 ..< N {
            if i == j { continue }
            if values[i] % values[j] == 0 {
                ok = false
                continue
            }
        }
        if ok {
            count += 1
        }
    }

    print(count)
}

func fast_pattern() {
    let sorted = values.sorted()
    var dp = [Bool](repeating: true, count: sorted.last! + 1)
    for i in 0 ..< N {
        if dp[sorted[i]] == false {continue}
        // 同じ数があるかチェック
        if 0 < i, sorted[i] == sorted[i - 1] {
            dp[sorted[i]] = false
        }
        // 倍数をマークする
        var a = sorted[i] * 2
        while a <= sorted.last! {
            dp[a] = false
            a += sorted[i]
        }
    }

    var count = 0
    for i in 0..<N {
        if dp[values[i]] {
            count += 1
        }
    }
    print(count)
}

fast_pattern()



Measured memory_bytes: 21108
#include<iostream>
#include<vector>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<queue>
#include<deque>
#include<map>
#include<bitset>
using namespace std;

typedef long long ll;
#define rep(i, n) for(int i = 0;i < (n);i++)
#define repr(i, n) for(int i = (n);i >= 0;i--)
#define repf(i, m, n) for(int i = (m);i < (n);i++)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1;} return 0;}
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1;} return 0;}
int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};
//////////////////////////////////////////////////

const int mod = 1e9+7;

// combination c;
// c(n, k); => nCk
struct combination {
    const int max = 510000;
    vector<long long> fact, ifact, inv;
    combination() {
        fact.resize(max);   // i!
        ifact.resize(max);  // (i!)^(mod-2)
        inv.resize(max);    // i^(mod-2)
        fact[0] = fact[1] = 1;
        ifact[0] = ifact[1] = 1;
        inv[1] = 1;
        for (int i = 2; i < max; i++) {
            fact[i] = fact[i-1] * i % mod;
            inv[i] = mod - inv[mod%i] * (mod/i) % mod;
            ifact[i] = ifact[i-1] * inv[i] % mod;
        }
    }

    long long operator()(int n, int k) {
        if (n < k) return 0;
        if (k < 0 || k > n) return 0;
        return fact[n]*ifact[k]%mod*ifact[n-k]%mod;
    }
};

int main() {
  ll n, m; cin >> n >> m;
  map<ll, ll> mp;
  auto prime_factrize = [&](ll a) -> void {
      for (ll i = 2; i*i <= a; i++) {
          if (a%i != 0) continue;
          ll cnt = 0;
          while (a%i == 0) {
              cnt++;
              a /= i;
          }
          mp[i] += cnt;
      }
      if (a > 1) mp[a]++;
  };
  prime_factrize(m);

  combination c;

  ll ans = 1;
  for (auto v : mp) {
    // cout << v.first << " " << v.second << endl;
    ans = ans * c(n-1+v.second, n-1) % mod;
  }
  cout << ans << endl;
  return 0;
}


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

int main() {
  int a[9];
  for (int i = 0; i < 9; i++)
    cin >> a[i];
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int b;
    cin >> b;
    for (int j = 0; j < 9; j++) {
      if (b == a[j]) a[j] = 0;
    }
  }
  bool bingo = false;
  for (int i = 0; i < 3; i++) {
    if (a[i] + a[i + 3] + a[i + 6] == 0 || a[3 * i] + a[3 * i + 1] + a[3 * i + 2] == 0)
      bingo = true;
  }
  if (a[0] + a[4] + a[8] == 0 || a[2] + a[4] + a[6] == 0)
    bingo = true;
  if (bingo)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <string>
#include <algorithm>
using namespace std; //std::の省略のため
using ll = long long;

ll MOD = 1000000007;

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

    ll ans;

    if(n % 1000 != 0)
        ans = 1000 - n%1000;
    else 
        ans = 0;

    cout << ans << endl;
}


Measured memory_bytes: 3636
#include<iostream>
using namespace std;
int main()
{
    int a,b;
    cin>>a>>b;
    
    if((a%3==0)||(b%3==0)||((a+b)%3==0))
    {
        cout<<"Possible";
    }
    else
    {
        cout<<"Impossible";
    }
 
    return 0;
}

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

#define REP(i,n) for(int (i) = (0);(i) < (n);++i)

using namespace std;

#define MAX_D 10000

int dp[MAX_D][MAX_D];

void LS(string a,string b)
{
	REP(i,a.size()+1)dp[i][0] = i;
	REP(i,b.size()+1)dp[0][i] = i;	
	for(int i = 1;i <= a.size() ;i++)
	{
		for(int j = 1;j <= b.size() ;j++)
		{
			int q = 1;
			if(a[i-1] == b[j-1])q = 0;
			dp[i][j] = min(min(dp[i-1][j-1]+q,dp[i][j-1]+1),dp[i-1][j]+1);
		}
	}	
}

int main()
{
	string a,b;cin >> a >> b;
	cout << (LS(a,b),dp[a.size()][b.size()]) << endl;
	return 0;
}

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

int main() {
  ll x, y;
  cin >> x;
  if (x % 11 >= 7) {
    y = 2;
  } else if (x % 11 == 0) {
    y = 0;
  } else {
    y = 1;
  }
  cout << (x / 11) * 2 + y << "\n";
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
int n,i;
int a[9];
while(1){
scanf("%d\n",&n);
if(n==0)break;
for(i=0;i<9;i++){
scanf("%d\n",&a[i]);
n-=a[i];
}
printf("%d\n",n);
}
return 0;
}

Measured memory_bytes: 604
#include <bits/stdc++.h>
using namespace std;
// rep macro
#define rep(i, n)        for (int i = 0; i < (int)(n); i++)
#define rev(i, n)        for (int i = (int)(n - 1); i >= 0; i--)
#define rep2(i, s, n)    for (int i = (s); i < (int)(n); i++)
#define rev2(i, s, n)    for (int i = (int)(n) - 1; i >= (int)(s); i--)
#define bitrep(i, n)     for (int i = 0; i < (1 << (int)(n)); i++)
#define bitrep2(i, s, n) for (int i = (s); i < (1 << (int)(n)); i++)
const int di[8] = {-1, 0, 1, 0, -1, -1, 1, 1};
const int dj[8] = {0, 1, 0, -1, -1, 1, 1, -1};
// type macro
using ll = int64_t;
// vector macro
#define all(v) v.begin(), v.end()
using  vi = vector<int>;
using vvi = vector<vector<int>>;
using  vu = vector<size_t>;
using vvu = vector<vector<size_t>>;
using  vl = vector<ll>;
using vvl = vector<vector<ll>>;
using  vd = vector<double>;
using vvd = vector<vector<double>>;
using  vb = vector<bool>;
using vvb = vector<vector<bool>>;
using  vc = vector<char>;
using vvc = vector<vector<char>>;
using  vs = vector<string>;
using vvs = vector<vector<string>>;
// pair macro
#define fi first
#define sj second
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pdd = pair<double, double>;
// math macro
#define lcm(a, b) a / __gcd(a, b) * b
#define dist(a, b) sqrt(pow(a.fi - b.fi, 2) + pow(a.sj - b.sj, 2))
// print macro
#define println(x) cout << x << endl
#define Yes println("Yes")
#define No println("No")
#define YES println("YES")
#define NO println("NO")
// memo
// desc sort: sort(vec.begin(), vec.end(), greater<int>());#include "header.h"

void dfs(int n, vector< vector<int> >& ki, vector<int>& c, vector<bool>& seen)
{
    seen[n] = true;
    rep(i, ki[n].size())
    {
        if (seen[ki[n][i]] == false)
        {
            c[ki[n][i]] += c[n];
            dfs(ki[n][i], ki, c, seen);
        }
    }
}

int main()
{
    int n, q; cin >> n >> q;
    vector< vector<int> > ki(n, vector<int>());
    rep(i, n - 1)
    {
        int a, b; cin >> a >> b; a--; b--; 
        ki[a].push_back(b);
        ki[b].push_back(a);
    }
    vector<int> c(n, 0);
    rep(i, q)
    {
        int p, x; cin >> p >> x; p--;
        c[p] += x;
    }
    vector<bool> seen(n, false);
    dfs(0, ki, c, seen);
    rep(i, n)
    {
        cout << c[i];
        if (i == n - 1) cout << endl;
        else cout << " ";
    }
}

Measured memory_bytes: 30632
#include<bits/stdc++.h>
#define INF 1e9
using namespace std;

typedef pair<int, int> P;
int dx[4] = {0, 0 ,1, -1}, dy[4] = {1, -1, 0, 0};
int H, W, b[100][100];
char s[100][100];


int bfs(){
  P p;
  queue<P> que;

  for(int i = 0; i <= H; i++)
    for(int j = 0; j <= W; j++)b[i][j] = INF;

  que.push(P(1,1));
  b[1][1] = 1;
  
  while(!que.empty()){
    p = que.front();  que.pop();
    int y = p.first, x = p.second;

    if(y == H && x == W) break;

    for(int i = 0; i < 4; i++){
      int ny = y + dy[i], nx = x + dx[i];
      if(ny <= H && ny >= 1 && nx <= W && nx >= 1 && b[ny][nx] == INF && s[ny][nx] == '.'){
	que.push(P(ny, nx));
	b[ny][nx] = b[y][x]+1;
      }
    }
  }
}


int main(){
  int count = 0;
  cin>>H>>W;

  for(int i = 1; i <= H; i++){
    for(int j = 1; j <= W; j++){//cout<<i<<j<<endl;
      cin>>s[i][j];
      if(s[i][j] == '.')count++;
    }
  }

  bfs();

  if(b[H][W] == INF) cout<<-1<<endl;
  else cout<<count-b[H][W]<<endl;
  

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n)  for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
#define pb emplace_back
#define eb emplace_back
#define lb(v,k) (lower_bound(all(v),k)-v.begin())
#define ub(v,k) (upper_bound(all(v),k)-v.begin())
#define fi first
#define se second
#define pi M_PI
#define PQ(T) priority_queue<T>
#define SPQ(T) priority_queue<T,vector<T>,greater<T>>
#define dame(a) {out(a);return 0;}
#define decimal cout<<fixed<<setprecision(15);
#define dupli(a) {sort(all(a));a.erase(unique(all(a)),a.end());}
typedef long long ll;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> PP;
typedef tuple<ll,ll,ll,ll> PPP;
typedef multiset<ll> S;
using vi=vector<ll>;
using vvi=vector<vi>;
using vvvi=vector<vvi>;
using vvvvi=vector<vvvi>;
using vp=vector<P>;
using vvp=vector<vp>;
using vb=vector<bool>;
using vvb=vector<vb>;
const ll inf=1001001001001001001;
const ll INF=1001001001;
const ll mod=1000000007;
const double eps=1e-10;
template<class T> bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
template<class T> bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<class T> void out(T a){cout<<a<<'\n';}
template<class T> void outp(T a){cout<<'('<<a.fi<<','<<a.se<<')'<<'\n';}
template<class T> void outvp(T v){rep(i,v.size())cout<<'('<<v[i].fi<<','<<v[i].se<<')';cout<<'\n';}
template<class T> void outvvp(T v){rep(i,v.size())outvp(v[i]);}
template<class T> void outv(T v){rep(i,v.size()){if(i)cout<<' ';cout<<v[i];}cout<<'\n';}
template<class T> void outvv(T v){rep(i,v.size())outv(v[i]);}
template<class T> bool isin(T x,T l,T r){return (l)<=(x)&&(x)<=(r);}
template<class T> void yesno(T b){if(b)out("yes");else out("no");}
template<class T> void YesNo(T b){if(b)out("Yes");else out("No");}
template<class T> void YESNO(T b){if(b)out("YES");else out("NO");}
template<class T> void noyes(T b){if(b)out("no");else out("yes");}
template<class T> void NoYes(T b){if(b)out("No");else out("Yes");}
template<class T> void NOYES(T b){if(b)out("NO");else out("YES");}
void outs(ll a,ll b){if(a>=inf-100)out(b);else out(a);}
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll modpow(ll a,ll b){ll res=1;a%=mod;while(b){if(b&1)res=res*a%mod;a=a*a%mod;b>>=1;}return res;}

int main(){
    ll n,k;cin>>n>>k;
    vi v(n);
    rep(i,n)cin>>v[i];
    ll ok=inf,ng=0;
    while(ok-ng>1){
        ll md=(ok+ng)/2;
        ll sum=0;
        rep(i,n)sum+=(v[i]+md-1)/md;
        if(sum>k+n)ng=md;
        else ok=md;
    }
    out(ok);
}

Measured memory_bytes: 4776
#include<bits/stdc++.h>
using namespace std;
int main(){
int N;
  cin>>N;
  vector<vector<int>>A(N+1,vector<int>(3));
  A.at(0)={0,0,0};
  for(int i=1;i<=N;i++){
  for(int j=0;j<3;j++){
  cin>>A.at(i).at(j);
  }
  
  }vector<vector<int>>B(N,vector<int>(3));
  for(int i=0;i<N;i++){
  for(int j=0;j<3;j++){
  B.at(i).at(j)=(A.at(i+1).at(j)-A.at(i).at(j));
  }
  
  } bool ans=true;
  for(int i=0;i<N;i++){
  int t=B.at(i).at(0);
    int x=B.at(i).at(1);
    int y=B.at(i).at(2);
    if(t<abs(x)+abs(y) || abs(t-x-y)%2==1){
    ans=false; break;
    }
      }if(ans)
    cout<<"Yes"<<endl;
  else
    cout<<"No"<<endl;
  
    return 0;
}

Measured memory_bytes: 11136
N=list(input())
l=len(N)-1
for n in range(2**l):
    lis=list(format(n,'b'))
    list(map(int,lis))
    nagasa=len(lis)
    if nagasa<l:
        for _ in range(l-nagasa):
            lis.insert(0,0)
    S=int(N[0])
    ans=[]
    for ll in range(l):
        if lis[ll]=='1':
            S=S+int(N[ll+1])
            ans.append('+')
        else:
            S=S-int(N[ll+1])
            ans.append('-')
    if S==7:
        kotae=[N[0]]
        for x in range(l):
            kotae.append(ans[x])
            kotae.append(N[x+1])
        kotae.append('=7')
        last=''.join(kotae)
        print(last)
        break


Measured memory_bytes: 3064
#include<stdio.h>

int main(int argc, char const* argv[])
{
    int a, b, c;
    scanf("%d%d%d", &a, &b, &c);
    if (a < b && b < c) {
        printf("Yes\n");
    } else {
        printf("No\n");
    }

    return 0;
}


Measured memory_bytes: 2044
emptyList :: [Int]
emptyList = replicate 9 0

add :: Int -> Int -> [Int] -> [Int]
add 1 x (a:d) = ((a+x):d)
add i x (a:d) = (a : add (i-1) x d)

get :: Int -> [Int] -> Int
get 1 (a:d) = a
get i (a:d) = get (i-1) d

readNums :: [Char] -> [Int]
readNums [] = emptyList
readNums (c:s) = add (read [c]) 1 $ readNums s

deletePung :: [Int] -> [Int]
deletePung s = add 1 (-3) s

deleteChow :: [Int] -> [Int]
deleteChow s = add 3 (-1) $ add 2 (-1) $ add 1 (-1) s

judge :: [Int] -> Bool
judge [] = True
judge (x:(y:(z:r)))
    | x>=3 && y>=1 && z>=1 = or [judge $ deletePung s, judge $ deleteChow s]
    | x>=1 && y>=1 && z>=1 = judge $ deleteChow s
    | x>=3 = judge $ deletePung s
    | x==0 = judge $ tail s
    | otherwise = False
    where s = (x:(y:(z:r)))
judge (x:s) 
    | x==0 = judge s
    | x>=3 = judge $ deletePung (x:s)
judge _ = False

checkAny :: [Int] -> Bool
checkAny [] = False
checkAny s = any (\i -> (get i s)>=2 && judge (add i (-2) s)) [1..9]

result :: [Int] -> [Int]
result s = filter (\i -> (get i s)<=3 && checkAny (add i 1 s)) [1..9]

resultStr str = if null s then "0" else unwords $ map show s
    where s = result $ readNums str

main = getContents >>= mapM putStrLn . map resultStr . lines
    

Measured memory_bytes: 4128
-- AtCoder My Practice
-- author: Leonardone @ NEETSDKASU

main = interact $ solve . map read . take 4 . map return

solve [a,b,c,d] = ans
    where
        ops = [((+), "+"), ((-), "-")]
        ys = [ show a ++ s1 ++ show b ++ s2 ++ show c ++ s3 ++ show d
             | (op1, s1) <- ops
             , (op2, s2) <- ops
             , (op3, s3) <- ops
             , let v = a `op1` b `op2` c `op3` d
             , v == 7
             ]
        ans = head ys ++ "=7"


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

typedef vector<vector<int> > Matrix;
Matrix d,m;

void warshall_floyd(int n) { // nは頂点数
  for (int i = 0; i < n; i++)      // 経由する頂点
    for (int j = 0; j < n; j++)    // 開始頂点
      for (int k = 0; k < n; k++)  // 終端
        m[j][k] = min(m[j][k], m[j][i] + m[i][k]);
}

int main() {
  int N, i,j,k;
  long long ans;
  cin >> N;
  d = Matrix(N, vector<int>(N));
  m = Matrix(N, vector<int>(N));
  
  for (i = 0; i < N; i++){
    for (j = 0; j < N; j++){
          cin >> d[j][i];
          m[j][i]=d[j][i];
    }
  }
  
  warshall_floyd(N);
  
  for(int i = 0; i < N; i++){
    for(int j = 0; j < N; j++){
      if(i<j)ans+=m[j][i];
      
      //条件の判定
      if(m[j][i]!=d[j][i]){
          cout<<-1<<endl;
          return 0;
      }
      //存在しない道を取り除く
      for(int k = 0; k < N; k++){
        if(k == i || k == j) continue;
		if(m[j][i] == m[j][k]+m[k][i] && i < j){
            ans -= m[j][i];
            break;
        }
      }
    }
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 1024
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static string InputPattern = "InputX";

    static List<string> GetInputList()
    {
        var WillReturn = new List<string>();

        if (InputPattern == "Input1") {
            WillReturn.Add("5");
            WillReturn.Add("5 2 3 4 1");
            //YES
        }
        else if (InputPattern == "Input2") {
            WillReturn.Add("5");
            WillReturn.Add("2 4 3 5 1");
            //NO
        }
        else if (InputPattern == "Input3") {
            WillReturn.Add("7");
            WillReturn.Add("1 2 3 4 5 6 7");
            //YES
        }
        else {
            string wkStr;
            while ((wkStr = Console.ReadLine()) != null) WillReturn.Add(wkStr);
        }
        return WillReturn;
    }

    static void Main()
    {
        List<string> InputList = GetInputList();

        int[] PArr = InputList[1].Split(' ').Select(X => int.Parse(X)).ToArray();
        int[] SortedArr = PArr.OrderBy(X => X).ToArray();

        int DiffCnt = 0;
        for (int I = 0; I <= PArr.GetUpperBound(0); I++) {
            if (PArr[I] != SortedArr[I]) DiffCnt++;
        }
        Console.WriteLine(DiffCnt <= 2 ? "YES" : "NO");
    }
}


Measured memory_bytes: 13396
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<list>
#include<iomanip>
#include<cmath>
using namespace std;

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define INF 2e9
#define MOD 1000000007
//#define MOD 998244353
#define LINF (long long)4e18
#define jck 3.141592

using ll = long long;
using Pi = pair<int,int>;
using Pl = pair<ll,ll>;


int dp[100010];
int main(){
   int N; cin >> N;
   vector<int> h(N);
   rep(i,N) cin >> h[i];
   dp[1] = 0;
   dp[2] = abs(h[1]-h[0]);
   repr(i,1,N-1){
       dp[i+2] = min(dp[i]+abs(h[i+1]-h[i-1]),dp[i+1]+abs(h[i+1]-h[i])); 
   }
   cout << dp[N] << endl;
}



Measured memory_bytes: 1024
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp> // Common file
//#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
 
using namespace std;
//using namespace __gnu_pbds;
//typedef tree< pair<int, int>, null_type, less<pair<int, int>>, rb_tree_tag, tree_order_statistics_node_update>
//ordered_set;
int dx[] = {0, 1, 0, -1};
int dy[] = {-1, 0, 1, 0};
#define X first
#define Y second
#define int long long int 
const int N = (int)1e6 + 10;
const int MOD = (int) 1e9 + 7;
 
 
void solve(){
    int n; cin >> n;
    int sum = 0;
    for(int i = 1; i <= n; ++i){
        if( (i%3) != 0 and (i%5) != 0){
            sum += i;
        }
    }
    cout << sum << '\n';
}
 
int32_t main(){
    ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr); 
    //int t; cin >> t;
    //while(t--)
        solve();
    return 0;
}
/*
Sample inp
*/

Measured memory_bytes: 3612
use std::io::stdin;

fn main(){
    let _: Vec<String> = getvec();
    let xs: Vec<usize> = getvec();
    let (mut a, mut b, mut c) = (0, 0, 0);
    for &x in &xs {
        if x%4==0 { a+=1; }
        else if x%2==0 { b += 1; }
        else { c+= 1; }
    }
    if b==0 {
        if a+1>=c {
            println!("Yes");
        }
        else {
            println!("No");
        }
    } else {
        if a>=c {
            println!("Yes");
        } else {
            println!("No");
        }
    }
}

#[allow(dead_code)]
fn getline() -> String {
    let mut s = String::new();
    match stdin().read_line(&mut s){
        Ok(_) => {s.trim().to_string()}
        Err(_) => String::new()
    }
}

#[allow(dead_code)]
fn getvec<T: std::str::FromStr>() -> Vec<T>{
    let line = getline();
    line.split_whitespace().filter_map(|x| x.parse().ok()).collect()
}

#[allow(dead_code)]
fn getpair() -> (usize, usize){
    let nm = getvec();
    (nm[0], nm[1])
}

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

typedef long long int lli;
typedef unsigned long long int ulli;
typedef long double ldb;

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define pb push_back
#define popb pop_back()
#define pf push_front
#define popf pop_front()
#define si size()
#define be begin()
#define en end()
#define all(v) v.be, v.en
#define le length()
#define mp make_pair
#define mt make_tuple
#define acc(v) accumulate(all(v), 0)
#define F first
#define S second
#define INF lli(1e19)

#define forz(i, n) for (lli i = 0; i < n; i++)
#define fore(i, m, n) for (lli i = m; i < n; i++)
#define rforz(i, n) for (lli i = n - 1; i >= 0; i--)
#define rfore(i, m, n) for (lli i = n - 1; i >= m; i--)
#define deci(n) fixed << setprecision(n)
#define high(n) __builtin_popcount(n)
#define highll(n) __builtin_popcountll(n)
#define parity(n) __builtin_parity(n)
#define ctz(n) __builtin_ctz(n)
#define lb lower_bound
#define ub upper_bound
#define er equal_range
#define maxe *max_element
#define mine *min_element
#define mod 1000000007
#define mod2 998244353
#define gcd __gcd
#define kira ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define newline cout<<endl;
//#define endl "\n"



inline lli power(lli x, lli y, lli p = mod)
{
    lli res = 1;
    x = x % p;
    while (y > 0)
    {
        if (y & 1)
            res = (res * x) % p;
        y = y >> 1;
        x = (x * x) % p;
    }
    return res;
}

inline lli modadd(lli a, lli b, lli m = mod)
{
    a += b;
    if (a >= m)
        a -= m;
    return a;
}

inline lli modmul(lli a, lli b, lli m = mod)
{
    return ((a % m) * (b % m)) % m;
}

inline lli modi(lli a, lli m = mod) { return power(a, m - 2, m); }
inline lli md(lli x) {if(x>=0)return x; return -x;}
///////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////
lli n,m,k;
//const lli mxN = 1e6;
//lli u, v;
//bool vis[mxN];
//vector<lli> adj[mxN];
//void init()
//{
//    forz(i,n) vis[i]=0, adj[i].clear();
//}


int32_t main()
{
    kira;

    lli T=1;
    //cin>>T;

    while(T--)
    {
        string s, t;
        cin>>s>>t;
        lli r = LLONG_MAX;
        for(int i = 0; i+t.size()-1<s.size(); i++)
        {
            lli x = 0;
            for(lli j = 0; j<t.size(); j++)
                if(s[i+j]!=t[j]) x++;
            r = min(r,x);
        }
        cout<<r<<endl;
    }

    return 0;

}


Measured memory_bytes: 3656
#include<bits/stdc++.h>
#define for(i,a,b) for(int i=a;i<=b;i++)
#define _inline __inline__ __attribute__((always_inline))
using namespace std;
_inline void read(int &x){
	int res=0,f=1;
	char c=getchar();
	if(c=='-') f=-1;
	while(c>'9'||c<'0') c=getchar();
	while(c>='0'&&c<='9'){
		res=res*10+c-'0';
		c=getchar();
	}
	x=res*f;
}
inline void print(int x){
    if(x<0) putchar('-'),x=-x;
    if(x>9) print(x/10);
    putchar(x%10+'0');
}
int main(){
    char a[101000];
    long long k,m,n;
    cin>>a;
    n=strlen(a);
    for(i,0,n-1){
        if(a[i]=='e'){
            if(a[i+1]=='r'&&a[i+2]=='a'&&a[i+3]=='s'&&a[i+4]=='e'){
                if(a[i+5]=='r') i+=5;
                else i+=4;
            }
        }
        else if(a[i]=='d'){
            if(a[i+1]=='r'&&a[i+2]=='e'&&a[i+3]=='a'&&a[i+4]=='m'){
                if(a[i+5]=='e'&&a[i+6]=='r'&&a[i+7]=='a'&&a[i+8]=='s'&&a[i+9]=='e') i+=4;
                else{
                    if(a[i+5]=='e'&&a[i+6]=='r') i+=6;
                    else i+=4;
                }
            }
        }
        else{
            puts("NO");
            exit(0);
        }
    }
    puts("YES");
    exit(0);
}

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

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

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

	bool ans=true;
	for(int i=0;i<S.size();i++){
		if(i%2==0){
			if(S.at(i)!='R' && S.at(i)!='U' && S.at(i)!='D')	ans=false;
		}
		if(i%2==1){
			if(S.at(i)!='L' && S.at(i)!='U' && S.at(i)!='D')	ans=false;
		}
	}

	if(ans)	cout << "Yes" << endl;
	else	cout << "No" << endl;

	return 0;
}


Measured memory_bytes: 256
let () = Scanf.scanf "%d %d\n" @@ fun n m ->
  let abs_ = Array.init n @@ fun _ -> Scanf.scanf "%d %d\n" @@ fun a b -> a, b in
  let cds = Array.init m @@ fun _ -> Scanf.scanf "%d %d\n" @@ fun c d -> c, d in
  Array.iter (fun (a, b) ->
    Array.init m (fun i -> i)
    |> Array.fold_left (fun j i ->
        if abs (a - fst cds.(i)) + abs (b - snd cds.(i)) < abs (a - fst cds.(j)) + abs (b - snd cds.(j)) then i
        else j) 0
    |> ( + ) 1
    |> Printf.printf "%d\n") abs_


Measured memory_bytes: 512
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace abc119d
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = ReadInt();
            var b = ReadIntList();
            b.Insert(0, -1);
            var ans = new List<int>();
            ans.Add(-1);
            for (int i = 1; i <= N; i++)
            {
                if (b[i] > i)
                {
                    Console.WriteLine(-1);
                    return;
                }
            }
            for (int i = 1; i <= N; i++)
            {
                ans.Insert(b[i], b[i]);
            }
            for (int i = 1; i <= N; i++)
            {
                Console.WriteLine(ans[i]);
            }

#if DEBUG
            Console.ReadKey();
#endif
        }

        private static bool IsRange(int a, int from, int to) => (from <= a && a <= to);
        private static int ReadInt() => int.Parse(Console.ReadLine());
        private static List<int> ReadIntList() => Console.ReadLine().Split().Select(int.Parse).ToList();
        private static double ReadDouble() => double.Parse(Console.ReadLine());
        private static List<double> ReadDoubleList() => Console.ReadLine().Split().Select(double.Parse).ToList();
        private static long ReadLong() => long.Parse(Console.ReadLine());
        private static List<long> ReadLongList() => Console.ReadLine().Split().Select(long.Parse).ToList();
        private static List<int> Int2Digits(int a) => a.ToString().ToCharArray().Select(_ => int.Parse(_.ToString())).ToList();
        private static int BinarySearch<Type>(IReadOnlyList<Type> s, Type target) // target 以下の最大要素のインデックスを返す
            where Type : IComparable
        {
            var lower = 0;
            var upper = s.Count - 1;
            while (upper - lower > 1)
            {
                var mid = lower + (upper - lower) / 2;
                if (s[mid].CompareTo(target) <= 0)
                {
                    lower = mid;
                }
                else
                {
                    upper = mid;
                }

            }
            return lower;
        }
    }
}


Measured memory_bytes: 13268
#include <cstdio>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>

using namespace std;

#define INF (1 << 28)
#define MAX_V 1000

int d[MAX_V][MAX_V];

void warshall_floyd(int n){
	for (int i = 0; i < n; i++)
		for (int j = 0; j < n; j++)
			for (int k = 0; k < n; k++)
				d[j][k] = min(d[j][k], d[j][i] + d[i][k]);
}

int main(){
	
	int A, B, C, D, E, F;
	cin >> A >> B >> C >> D >> E >> F;

	bool wat[100] = {};
	bool sug[5000] = {};

	wat[0] = true;
	sug[0] = true;

	for(int i = 0; i < 50; i++){
		if(wat[i]){
			wat[i + A] = true;
			wat[i + B] = true;
		}
	}
	for(int i = 0; i < 3000; i++){
		if(sug[i]){
			sug[i + C] = true;
			sug[i + D] = true;
		}
	}

	int ans1 = 100 * A;
	int ans2 = 0;
	double noudo = 0;

	for(int i = 0; i < 50; i++){
		for(int j = 0; j < 3000; j++){
			if(100 * i + j > F || E * i < j){
				break;
			}
			if(wat[i] && sug[j] && (double)j / (double)(100 * i) > noudo){
				noudo = (double)j / (double)(100 * i);
				ans1 = 100 * i + j;
				ans2 = j;
			}
		}
	}
	cout << ans1 << " " << ans2 << endl;
	return 0;
}



Measured memory_bytes: 256
//
//  main.cpp
//  ICPC2009B
//
//  Created by aki33524 on 2014/07/02.
//  Copyright (c) 2014年 aki33524. All rights reserved.
//

#include <iostream>
using namespace std;

int H, W;
int field[50][50];
int dh[] = {0, 0, 1, -1};
int dw[] = {1, -1, 0, 0};

void dfs(int h, int w){
    field[h][w] = 0;
    for(int i=-1; i<=1; i++){
        for(int j=-1; j<=1; j++){
            int nh = h + i;
            int nw = w + j;
            if(0<=nh&&nh<H && 0<=nw&&nw<W && field[nh][nw])
                dfs(nh, nw);
        }
    }
}

void solve(){
    int ans = 0;
    for(int h=0; h<H; h++){
        for(int w=0; w<W; w++){
            if(field[h][w]){
                dfs(h, w);
                ans++;
            }
        }
    }
    cout << ans << endl;
}

int main(int argc, const char * argv[])
{
    while(cin >> W >> H, H|W){
        for(int h=0; h<H; h++){
            for(int w=0; w<W; w++){
                cin >> field[h][w];
            }
        }
        solve();
    }
    
    return 0;
}

Measured memory_bytes: 1348
#include <iostream>
#include <algorithm>
#include <math.h>
#include <cmath>
#include <limits>
#include <vector>
#define ll long long
#define rep(i,n) for(int i = 0;i < n;i++)
#define pb push_back
#define mp make_pair

using namespace std;

int main(){
    int a,b;
    cin >> a >> b;
    int tmp = a;
    if(a%b == 0){
        cout << -1 << endl;
    }
    else
    {
        while(tmp%b == 0){
            tmp += a;
            if(a > 1e18){
                cout << -1 <<endl;
                return 0;
            }
        }
        cout << tmp << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i, s, n) for (int i = (s); i < (n); ++i)
#define rrep(i, n, g) for (int i = (n)-1; i >= (g); --i)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define len(x) (int)(x).size()
#define dup(x, y) (((x) + (y)-1) / (y))
#define pb push_back
#define Field(T) vector<vector<T>>
using namespace std;
using ll = long long;
using P = pair<int, int>;

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

Measured memory_bytes: 3600
#include<iostream>
#include<algorithm>
#include<string>
#include<cstring>
#include<queue>
#include<stack>
#include<cmath>
#include<set>
#include<vector>
#include<map>
#include<unordered_map>

#define ll long long
#define pll pair<int,int>

using namespace  std;
int gcd(int a, int b) {
	return b == 0 ? a : gcd(b, a%b);
}
ll qpow(ll a, ll b, ll modd) {
	ll ans = 1, base = a;
	while (b) {
		if (b & 1) {
			ans = (ans*base) % modd;
		}
		base = (base*base) % modd;
		b >>= 1;
	}
	return ans;
}

/*A*/
//int main() {
//	ios::sync_with_stdio(0); cin.tie(0);
//
//
//
//}

//****************************************************************************
/*B*/
//int main() {
//	ios::sync_with_stdio(0); cin.tie(0);
//
//
//
//}

//****************************************************************************
/*C*/
//int main() {
//	ios::sync_with_stdio(0); cin.tie(0);
//
//
//
//}

//****************************************************************************
/*D*/
//int main() {
//	ios::sync_with_stdio(0); cin.tie(0);
//
//
//
//}

//****************************************************************************
/*E*/
//int main() {
//	ios::sync_with_stdio(0); cin.tie(0);
//
//
//
//}

//****************************************************************************
/*F*/
vector<pll> v ;
int main() {
	ios::sync_with_stdio(0); cin.tie(0);
	int n; cin >> n;
	for (int i = 1; i <= n; ++i) {
		int tmp;
		cin >> tmp;
		v.push_back(make_pair(tmp, i));
	}
	sort(v.begin(), v.end());
	for (int i = 0; i < n; ++i) {
		cout << v[i].second << ' ';
	}
}


//****************************************************************************
/*G*/

//int main() {
//	ios::sync_with_stdio(0); cin.tie(0);
//	ll a, b;
//	cin >> a >> b;
//
//
//
//}

//****************************************************************************
/*H*/
//int main() {
//	ios::sync_with_stdio(0); cin.tie(0);
//
//
//
//}

//****************************************************************************
/*I*/
//int main() {
//	ios::sync_with_stdio(0); cin.tie(0);
//
//
//
//}

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

/*J*/
//int main() {
//	ios::sync_with_stdio(0); cin.tie(0);
//
//
//
//}

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

/*K*/
//int main() {
//	ios::sync_with_stdio(0); cin.tie(0);
//
//
//
//}

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

Measured memory_bytes: 4276