akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int d = a / b;
		int r = a % b;
		double f ;
		f = (double) a/b;

		System.out.println(String.format("%d %d %.5f", d,r,f) );
	}
}

Measured memory_bytes: 26332
#include<iostream>
#include<sstream>
#include<vector>
#include<iterator>
using namespace std;

int main(void)
{
    int a, b;
    cin >> a >> b;

    string A = "";
    for (int i = 0; i < b; i++)
        A += to_string(a);

    string B = "";
    for (int i = 0; i < a; i++)
        B += to_string(b);

    if (A < B)
        cout << A << endl;
    else
        cout << B << endl;

    return 0;
}


Measured memory_bytes: 256
n = int(input())
a_list = list(map(int, input().split()))

sign = 1
abs_sum = 0
min_abs = int(1e9)

for a in a_list:
    tmp = abs(a)
    abs_sum += tmp
    min_abs = min(min_abs, tmp)
    sign *= (a >= 0) * 2 - 1

if sign > 0:
    print(abs_sum)
else:
    print(abs_sum - 2 * min_abs)


Measured memory_bytes: 14412
#include <bits/stdc++.h>
using namespace std;
#define ll long long
bool is_square(int n)
{
    for (int i = 0; i <= n; i++)
    {
        if (i * i == n)
        {
            return true;
        }
    }
    return false;
}

int main()
{
    int d, n;
    cin >> d >> n;
    int a = 1;
    for (size_t i = 0; i < d; i++)
    {
        a *= 100;
    }
    if (n == 100)
    {
        cout << a * 101 << endl;
    }
    else
    {
        cout << a * n << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
using namespace std;
typedef long long ll;

void solve(void) {
  ll N; cin >> N;
  vector<string> str(N);
  for(ll si = 0; si < N; ++si) cin >> str[si];

  map<string, ll> table;

  ll res = 0;
  for (ll i = 0; i < N; ++i) {
    sort(str[i].begin(), str[i].end());

    res += table[str[i]];
    table[str[i]]++;
  }

  cout << res << endl;
  
}
int main(void) {
  solve();
  return 0;
}


Measured memory_bytes: 18176
A, B, C = list(map(int, input().split()))

if not (A % 2 == 0 and B % 2 == 0 and C % 2 == 0):
    print(0)
elif A == B == C:
    print(-1)
else:
    c = 0
    while A % 2 == 0 and B % 2 == 0 and C % 2 == 0:
        c += 1
        A2 = (B + C) // 2
        B2 = (A + C) // 2
        C2 = (A + B) // 2

        A = A2
        B = B2
        C = C2
        # print(A, B, C)
    print(c)

Measured memory_bytes: 3064
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;
using LLONG = long long;
const LLONG MOD = 1000000007;

int main()
{
    LLONG N, C, K; cin >> N >> C >> K;
    vector<LLONG> ts(N);
    for (auto &ti : ts) cin >> ti;
    sort(ts.begin(), ts.end());
    LLONG num = 0;
    LLONG start = 0;
    LLONG ans = 0;
    for (int i = 0; i < N; ++i)
    {
        // 新しいバスを追加
        if (num == 0)
        {
            start = ts[i];
            ++ans;
        }
        // 待ちきれない乗客が来た場合，新しいバスを手配
        else if (ts[i] > start + K)
        {
            start = ts[i];
            ++ans;
            num = 0;
        }
        ++num;
        // 乗員が一杯になったら次のバスにする
        if (num == C)
        {
            num = 0;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mod 1000000007
int main()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    int sz=1000000;
    vector<int>prime(1000001,1);
    map<int,int>rel;
    for(int i=2; i<=1000000; i++){
        if(prime[i]==1){
            rel[i]=0;
            for(int j=2; i*j<=sz; j++)
                prime[i*j]=0;
        }
    }
    int n;
    cin>>n;
    vector<int>arr(n);
    for(int i=0; i<n; i++)
        cin>>arr[i];
    int gcd=arr[0];
    for(int i=1; i<n; i++)
        gcd=__gcd(gcd,arr[i]);
    if(gcd>1)
        cout<<"not coprime";
    else{
        for(int i=0; i<n; i++){
            int num=arr[i];
            for(int j=2; j*j<=num; j++){
                if(num%j==0){
                    rel[j]++;
                    while(num%j==0)
                        num/=j;
                }
            }
            if(num>1)
                rel[num]++;
        }
        int flag=0;
        for(auto var : rel){
            if(var.second>1){
                flag=1;
                break;
            }
        }
        if(flag==0)
            cout<<"pairwise coprime";
        else
            cout<<"setwise coprime";
    }
    return 0;

}

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

int main(){
    string s;
    cin >> s;
    int k;
    cin >> k;
    if(k == 1) cout << s[0] << endl;
    else{
        for(int i = 0; i < s.size(); ++i)
        if(s[i] != '1'){
            cout << s[i] << endl;
            return 0;
        }else if(k == i + 1 && s[i] == '1'){
            break;
        }

    cout << 1 << endl;
    }
}

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

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

    int la = n/2, lb = n-la;

    cout << "?";
    for(int i=1;i<=n;++i) cout << " " << i;
    cout << endl;

    string ans1, ans2;
    cin >> ans1;
    if(ans1 == "-1") return 0;
    cout << "?";
    for(int i=1;i<=la;++i) cout << " " << i;
    for(int i=n+la+1;i<=2*n;++i) cout << " " << i;
    cout << endl;
    cin >> ans2;
    if(ans2 == "-1") return 0;

    vector<int> ok;
    pair<int,int> dif[2];
    if(ans1 == ans2){
        for(int i=la+1;i<=n;++i) ok.push_back(i);
        dif[0] = {1, la};
        dif[1] = {n+1, n+la};
    }else{
        for(int i=1;i<=la;++i) ok.push_back(i);
        dif[0] = {la+1, n};
        dif[1] = {n+la+1, 2*n};
    }

    while(dif[0].first < dif[1].second){
        la = (dif[0].second-dif[0].first + 1) / 2;
        lb = (dif[0].second-dif[0].first + 1) - la;
        cout << "?";
        for(int i: ok) cout << " " << i;
        for(int i=dif[0].first;i<dif[0].first+la;++i) cout << " " << i;
        for(int i=dif[1].first+la;i<=dif[1].second;++i) cout << " " << i;
        cout << endl;
        cin >> ans2;
        if(ans2=="-1") return 0;

        if(ans1==ans2){
            for(int i=dif[1].first+la;i<=dif[1].second;++i) ok.push_back(i);
            dif[0].second = dif[0].first+la-1;
            dif[1].second = dif[1].first+la-1;
        }else{
            for(int i=dif[0].first;i<dif[0].first+la;++i) ok.push_back(i);
            dif[0].first = dif[0].first+la;
            dif[1].first = dif[1].first+la;
        }
        if(ok.size() >= n-1) break;
    }

    int ans[200] = {0};
    bool in_ok[200] = {0};
    string s;
    for(int i : ok) in_ok[i] = true;
    for(int i=1;i<=2*n;++i){
        if(in_ok[i]) continue;
        cout << "?";
        for(int j:ok) cout << " " << j;
        cout << " " << i << endl;
        cin >> s;
        if(s=="Red") ans[i] = 1;
        else ans[i] = -1;
    }

    vector<int> v_r, v_b;
    for(int i=1;i<=2*n;++i){
        if(ans[i] == 1) v_r.push_back(i);
        if(ans[i] == -1) v_b.push_back(i);
    }
    for(int i:ok){
        cout << "?";
        for(int j=0;j<n/2;++j) cout << " " << v_r[j];
        for(int j=0;j<n/2;++j) cout << " " << v_b[j];
        cout << " " << i << endl;
        cin >> s;
        if(s=="Red") ans[i] = 1;
        else ans[i] = -1;
    }

    cout << "! ";
    for(int i=1;i<=2*n;++i){
        if(ans[i]==1) cout << "R";
        else cout << "B";
    }
    cout << endl;

    return 0;
}

Measured memory_bytes: 724
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while(sc.hasNext()){
			int a = sc.nextInt();
			int b = sc.nextInt();
			int n = sc.nextInt();
			int sum = 0;
			a %= b;
			for(int i = 0; i < n; i++){
				a *= 10;
				sum += a/b;
				a %= b;
			}
			System.out.println(sum);
		}
	}
}

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

using namespace std;

const long long N = 1e18;

int main() {
    cin.tie(0);
    cout.tie(0);
    ios_base::sync_with_stdio(0);

    long long x, c = 100, ans = 0;
    cin >> x;
    while(c < x) {
        c += c / 100;
        ans++;
    }

    cout << ans << endl;
}


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

int main() {
  int x; cin >> x;
  if (x == 1) cout << 0 << endl;
  else cout << 1 << endl;
}

Measured memory_bytes: 3616
#include <stdio.h>
int main() {
	int a, b, c, d;
	scanf("%d%d%d%d", &a, &b, &c, &d);
	if (a + b > c + d) {
		printf("Left\n");
	} else if (a + b < c + d) {
		printf("Right\n");
	} else {
		printf("Balanced\n");
	}
	return 0;
}

Measured memory_bytes: 128
import java.util.Scanner;

class Main {
	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		int a=sc.nextInt();
		int b=sc.nextInt();
		for(int i=1;i<=100000;i++) {
			if(i*a>=b) {
				System.out.println(i);
				break;
			}
		}
	}
	}



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

using namespace std;
using ll = long long;

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

  int n;
  cin >> n;
  vector<int> x(n);
  vector<int> y(n);
  vector<ll> h(n);
  for (int i = 0; i < n; i++)
    cin >> x[i] >> y[i] >> h[i];

  for (int cx = 0; cx <= 100; cx++) {
    for (int cy = 0; cy <= 100; cy++) {
      ll ch = -1;
      bool f = true;
      vector<ll> hh;
      vector<ll> h0;
      for (int i = 0; i < n; i++) {
        ll a = abs(x[i] - cx) + abs(y[i] - cy);
        if (h[i] == 0) {
          h0.push_back(a);
        } else {
          hh.push_back(h[i] + a);
        }
      }
      if (hh.size() == 0)
        continue;
      if (!all_of(hh.begin(), hh.end(), [&](ll x) { return x == hh[0]; }))
        continue;
      if (!all_of(h0.begin(), h0.end(), [&](ll x) { return x >= hh[0]; }))
        continue;
      cout << cx << " " << cy << " " << hh[0] << endl;
      return 0;
    }
  }

  return 0;
}


Measured memory_bytes: 3668
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <iomanip>
#include <cassert>
#include <bitset>
using namespace std;

typedef pair<int, int> P;
#define rep(i, n) for (int i=0; i<(n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define index(xs, x) (int)(lower_bound(all(xs), x) - xs.begin())
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007

string S;
int X, Y;
bool dp[16001];

bool solve(vector<int> A, int X) {
  if (X < 0) return false;
  assert(X <= 16000);
  rep(i, X+1) dp[i] = false;
  dp[0] = true;
  for (int a : A) {
    for (int j=X-a; j>=0; j--) dp[j+a] |= dp[j];
  }
  return dp[X];
}

signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  cin >> S >> X >> Y;
  reverse(all(S));
  while (!S.empty()) {
    if (S.back() == 'F') {
      S.pop_back();
      X--;
    }
    else {
      S.pop_back();
      break;
    }
  }
  reverse(all(S));
  bool xdir = 0;
  vector<int> xs, ys;
  ys.pb(0);
  for (char c : S) {
    if (xdir) {
      if (c == 'F') xs.back()++;
      else xdir = false, ys.pb(0);
    }
    else {
      if (c == 'F') ys.back()++;
      else xdir = true, xs.pb(0);
    }
  }
  sort(all(xs));
  sort(all(ys));
  for (int &x : xs) X += x, x*=2;
  for (int &y : ys) Y += y, y*=2;
  if (solve(xs, X) && solve(ys, Y)) cout << "Yes\n";
  else cout << "No\n";
  return 0;
}


Measured memory_bytes: 384
#include        <bits/stdc++.h>
#define ll      long long int
#define pb      push_back
#define mp      make_pair
#define F       first
#define S       second
#define MOD     1000000007
#define pii     pair<int,int>
#define vi      vector<int>
#define fio     ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define N       100010
#define M       1000000000000000
#define O       1LL
#define INF     10000000
using namespace std;

int a[N];

int main()
{
    fio;
    int n,ans=0;
    cin>>n;
    for(int i=0; i<n; i++)cin>>a[i];
    int c=1;
    for(int i=1; i<n; i++){
        if(a[i]==a[i-1]){
            c++;
        }
        else{
            //cout<<i<<" zz "<<c<<endl;
            if(c>1){
                ans+=(c/2);
            }
            c=1;
        }
    }
    if(c>1){
        ans+=(c/2);
    }
            cout<<ans;
    return 0;
}















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

using namespace std;

vector<int> mincost(10,0);
vector<vector<int> >cost(10, vector<int>(10,0));
//returnt the index
int find_min_cost(){
	int minc = -1;
	int minindex = 0;
	for(int i = 0; i < 10; i++){
		if (i == 1 || mincost[i] != 0) continue;
		if(minc == -1) {minc = cost[i][1]; minindex = i;}
		else if (minc > cost[i][1]){minc = cost[i][1];minindex = i;}
	}
	mincost[minindex] = cost[minindex][1];
	return minindex;
}
void adjust(int index){
	for(int i = 0; i < 10; i ++){
		if (i == 1 || mincost[i] != 0) continue;
		cost[i][1] = min(cost[i][1], cost[index][1] + cost[i][index]);
	}
	return;
}
void optimize(){
	for(int i = 0; i < 9; i++){
		int minindex = find_min_cost();
		adjust(minindex);
	}
}

int main () {
	int H,W;
	cin >> H >> W;
		
	for(int i=0; i < 10; i++){
		for(int j = 0; j < 10; j ++){
			int temp;
			cin >> temp;
			cost[i][j] = temp;
		}
	}
	optimize();
	long long res = 0;
	for(int i=0; i < H*W; i++){
		int temp;
		cin >> temp;
		if(temp == -1 || temp == 1) continue;
		res += mincost[temp];
	}

	cout << res;
	

	return 0;
}

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

int main() {
  int N;
  cin >> N;
  vector<int64_t> A(N);
  for (int i = 0; i < N; i++) cin >> A[i];
  int64_t sum = 0;
  for (int i = 1; i < N; i++) {
    if (A[i-1] > A[i]) {
      sum += A[i-1] - A[i];
      A[i] = A[i-1];
    }
  }
  cout << sum << endl;
}

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

using int32 = int_fast32_t;
using int64 = int_fast64_t;

const int32 INF = 1e9;
const int32 MOD = 1e9+7;
const int64 LLINF = 1e18;

#define YES(n) cout << ((n) ? "YES\n" : "NO\n"  )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n"  )
#define ANS(n) cout << (n) << "\n"
#define REP(i,n) for(int64 i=0;i<(n);++i)
#define FOR(i,a,b) for(int64 i=(a);i<(b);i++)
#define FORR(i,a,b) for(int64 i=(a);i>=(b);i--)
#define ALL(obj) (obj).begin(),(obj).end()
#define pii pair<int32,int32>
#define pll pair<int64,int64>
#define pb(a) push_back(a)
#define mp make_pair

int64 modpow(int64 n, int64 r){
    if(r == 0)return 1;
    if(r % 2 == 0){
        int64 x = modpow(n, r / 2);
        return x * x % MOD;
    }else{
        return modpow(n, r - 1) * n % MOD;
    }
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int64 n;
    cin >> n;
    vector<int64> x(n);
    REP(i,n)cin >> x[i];
    vector<int64> factorial(n+1);
    factorial[0] = 1;
    FOR(i,1,n+1){
        factorial[i] = factorial[i-1] * i % MOD;
    }
    vector<int64> revFactorial(n+1);
    revFactorial[n] = modpow(factorial[n], MOD-2);
    FORR(i,n-1,0){
        revFactorial[i] = revFactorial[i+1] * (i+1) % MOD;
    }
    vector<int64> s(n+1);
    s[0] = 0;
    REP(i,n){
        s[i+1] = (s[i] + modpow((i+1) * (i+2) % MOD, MOD-2)) % MOD;
    }
    int64 ans = 0;
    // REP(i,n-2)FOR(j,i+1,n-1){
    //     int32 a = j - i - 1, b = n - j - 2 + i;
    //     // ans += (x[j] - x[i]) * factorial[a] % MOD * factorial[b] % MOD * factorial[a+b+2] % MOD * revFactorial[a+2] % MOD * revFactorial[a + b + 2] % MOD * factorial[n-1] % MOD;
    //     ans += (x[j] - x[i]) * factorial[a] % MOD * revFactorial[a+2] % MOD * factorial[n-1] % MOD;
    //     ans %= MOD;
    // }
    REP(i,n-2){
        // ans -= x[i] * revFactorial[n-2-i] % MOD * revFactorial[n-i-1] % MOD * factorial[n-1] % MOD;
        ans += (MOD-1) * x[i] % MOD * s[n-2-i] % MOD * factorial[n-1] % MOD;
        // ans = (ans % MOD + MOD) % MOD;
        ans %= MOD;
    }
    FOR(j,1,n-1){
        ans += x[j] * s[j] % MOD * factorial[n-1] % MOD;
        ans %= MOD;
    }
    REP(i,n-1){
        // ans += (x[n-1] - x[i]) * revFactorial[n-i-1] % MOD * factorial[n-1] % MOD;
        int32 a = n - 2 - i, b = i;
        // ans += (x[n-1] - x[i]) * factorial[b] % MOD * revFactorial[a+1] % MOD * factorial[n-1] % MOD;
        ans += (x[n-1] - x[i]) * factorial[a] % MOD * revFactorial[a+1] % MOD * factorial[n-1] % MOD;
        ans %= MOD;
    }
    ANS(ans);
    return 0;
}

Measured memory_bytes: 3456
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String args[]){

		Scanner cin = new Scanner(System.in);

		int N = cin.nextInt();
		int count = 0;
		int pass = 0;
		long C = cin.nextLong();
		long K = cin.nextLong();
		boolean hasyet[] = new boolean[N];
		long T[] = new long[N];

		for(int i=0;i<N;i++){
			T[i] = cin.nextLong();
		}

		Arrays.sort(T);
		Arrays.fill(hasyet, false);

		for(int j=0;j<N;j++){
			if(!hasyet[j]){
				hasyet[j] = true;
				count++;
				pass = 1;
				for(int k=j+1;k<N&&T[k]<=T[j]+K&&pass<C;k++){
					hasyet[k] = true;
					pass++;
				}
			}
		}

		System.out.println(count);
	}
}


Measured memory_bytes: 49904
/**
 *      purpose : 
 *      author  : kyomukyomupurin
 *      created : 
**/

// input/output
#include <iostream>
#include <fstream>
#include <sstream>
// container class
#include <array>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
// math, algorithm
#include <algorithm>
#include <cmath>
#include <complex>
#include <numeric>
// etc
#include <bitset>
#include <cassert>
#include <cctype>
#include <cstring>
#include <chrono>
#include <iomanip>
#include <random>
#include <utility>
// using-directive
using namespace std;
// alias template
using int64 = int64_t;
using pii = pair<int, int>;
using pll = pair<int64_t, int64_t>;
// text macro replacement
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define print(x) cout << (x) << '\n'
#define debug(x) cout << #x << ": " << (x) << '\n'
// variadic template
template<typename T> inline void chmin(T &a, T b) {if (a > b) a = b; return;}
template<typename T> inline void chmax(T &a, T b) {if (a < b) a = b; return;}

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

  int x, a; cin >> x >> a;
  if (x < a) {
    print(0);
  } else {
    print(10);
  }

  return 0;
}

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

typedef long long ll;

int main() {
    int N;
    string num = "0123456789";
    int ans = 0;
    string S;
    cin >> N;
    cin >> S;

    for (int i = 0; i < 10; i++) {
        for (int j = 0; j < 10; j++) {
            for (int k = 0; k < 10; k++) {
                int v1, v2, v3;
                bool i_check = true;
                bool j_check = true;
                bool k_check = true;
                for (int a = 0; a < S.size(); a++) {
                    if (i_check) {
                        if (S[a] == num[i]) {
                            v1 = a;
                            i_check = false;
                        }
                    } else if (j_check) {
                        if (S[a] == num[j]) {
                            v2 = a;
                            j_check = false;
                        }
                    } else if (k_check) {
                        if (S[a] == num[k]) {
                            v3 = a;
                            k_check = false;
                        }
                    } else {
                       break; 
                    }
                }
                if (!i_check && !j_check && !k_check) {
                    ans++;
                }
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3660
// finish date: 2018/01/15
#include <iostream>
#include <cmath>
#include <vector>
#include <bitset>
#include <algorithm>
#include <stack>
#include <map>
#include <climits>

using namespace std;

#define FOR(i, a, b) for(int i=a;i<b;i++)
#define rep(i, n)  FOR(i,0,n)
#define ll long long
#define bigmod 1000000007
#define INF 500000000

int mul(int a, int b) {
    return (int) (((ll) (a % bigmod) * (b % bigmod)) % bigmod);
}

ll combination(int n, int k) {
    if(k==0) return 1;
    ll ans = 1;
    FOR(i,1, k+1) {
        ans *= n;
        n--;
        ans /= i;
    }
    return ans;
}


int main() {
    int N, A, B;
    cin >> N >> A >> B;
    vector<ll> v(N, 0);
    rep(i, N) cin >> v[i];
    sort(v.begin(), v.end(), greater<ll>());
    double ma = 0;
    rep(i, A) {
        ma += v[i];
    }
    ma /= A;

    ll mi = v[A - 1];
    int mi_nanko = 0; //この値は適当
    int mi_left = 0;
    rep(i, N) {
        if (v[i] == mi) {
            if (mi_nanko == 0) mi_left = i;
            mi_nanko++;
        } else {
            if (mi_nanko != 0) break;
        }
    }

    ll count = 0;
    FOR(i, A - 1, B) {
        if (i == A - 1 || v[0] == v[i]) count += combination(mi_nanko, i - mi_left + 1);
        else break;
    }

    printf("%.6f\n%lld\n", ma, count);
    return 0;
}


Measured memory_bytes: 256
// Sort I - Shell Sort
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_2_D
using System;
using System.Linq;
using System.Collections.Generic;

namespace ALDS1_2_D {
	class Program {
		public Program() {}
		
		public static void Main() {
			new Program().Calc();
		}
		
		void Calc() {
			var N = int.Parse(Input);	// Number of elements
			var A = new int[N];         // Array : N elements
            for (int i = 0; i < N; i++)
                A[i] = int.Parse(Input);
			shellSort(A, N);
		}
		
		String Input {
			get {
				return Console.ReadLine();
			}
		}
		
		void Output(String str) {
			Console.WriteLine(str);
		}

        int[] selectionSort(int[] A, int N, int g, ref int count) {
            for(int i = g; i < N; i++) {
				int target = A[i];
				int j = i - g;
				while(j >= 0 && target < A[j]) {
					A[j+g] = A[j];
                    count++;
                    j -= g;
                }
				A[j+g] = target;
			}
            //Output(A.Select(s => s.ToString())
            //        .Aggregate((s, t) => s + " " + t));
            return A;
        }
        
        void shellSort(int[] A, int N) {
            int cnt = 0;
            var GList = new List<int>() {1};
            int tmp = 8;
            int k = 0;
            while(tmp < N) {
                GList.Add(tmp);
                k++;
                tmp = (int)Math.Pow(4,k+1) + 3 * (int)Math.Pow(2,k) + 1;   // G_n = 4^n + 3*2^(n-1) + 1 
            }
            GList.Reverse();
            var G = GList.ToArray();
            int m = G.Length;

            Output(m.ToString());
            Output(G.Select(i => i.ToString())
						.Aggregate((i, j) => i + " " + j));
            for(int i = 0; i < m; i++) {
                A = selectionSort(A, N, G[i], ref cnt);
            }

            Output(cnt.ToString());
            for (int i = 0; i < N; i++)
                Output(A[i].ToString());
        }
	}
}

Measured memory_bytes: 16984
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <tuple>
#include <cstring>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<long long, long long> P;
#define rep(i, n) for(long long i=0; i<n; i++)
#define reps(i, s, e) for(long long i=s; i<e; i++)
#define repr(i, n) for(long long i=n-1; i>=0; i--)
#define reprs(i, s, e) for(long long i=e-1; i>=s; i--)

int main(){

    cin.tie(0);
    ios::sync_with_stdio(false);

    ll n, m, x;
    cin >> n >> m >> x;

    ll c[n], a[n][m];
    rep(i, n){
        cin >> c[i];
        rep(j, m){
            cin >> a[i][j];
        }
    }

    ll cost_min = 1e18;
    ll asum[m];
    ll cnt = 1;

    while(cnt <= pow(2, n)){

        rep(j, m){
            asum[j] = 0;
        }

        ll cnt_temp = cnt;
        ll cost = 0;
        rep(i, n){
            if(cnt_temp % 2 == 1){
                cost += c[i];
                rep(j, m){
                    asum[j] += a[i][j];
                }
            }
            cnt_temp /= 2;
        }

        bool is_cleared = true;
        rep(j, m){
            if(asum[j] < x){
                is_cleared = false;
                break;
            }
        }

        if(is_cleared){
            if(cost < cost_min){
                cost_min = cost;
            }
        }

        cnt++;
    }


    if(cost_min > 1e9){
        cout << -1 << endl;
    }
    else{
        cout << cost_min << endl;
    }


    return 0;
}

Measured memory_bytes: 4012
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<queue>
#include<vector>
#include<set>
#include<map>
#include<string>
#define fi first
#define se second
#define L(i,u) for (register int i=head[u]; i; i=nxt[i])
#define rep(i,a,b) for (register int i=a; i<=b; i++)
#define per(i,a,b) for (register int i=a; i>=b; i--)
using namespace std;
typedef long long ll;
typedef pair<int,int> Pii;
typedef vector<int> Vi;
template<class T> inline void read(T &x) {
	x=0; char c=getchar(); int f=1;
	while (c<'0'||c>'9') {if (c=='-') f=-1; c=getchar();}
	while (c>='0'&&c<='9') {x=10*x+c-'0'; c=getchar();} x*=f;
}
const int N = 555555,inf=0x3f3f3f3f;
int n,head[N],to[N],nxt[N],edgenum,dis[N],q[N],pre[N],deg[N];
void add(int u, int v){
	to[++edgenum]=v;nxt[edgenum]=head[u];head[u]=edgenum;
}
int bfs(int s){
	memset(dis,inf,sizeof(dis));dis[s]=0;
	int f=0,r=1;q[f]=s;int res=s;
	while(f!=r){
		int u=q[f++];
		L(i,u)if(dis[to[i]]>dis[u]+1){
			dis[to[i]]=dis[u]+1;q[r++]=to[i];pre[to[i]]=u;
			if(dis[to[i]]>dis[res])res=to[i];
		}
	}
	return res;
}
int a[N],b[N],c[N],len,mrk[N];
void solve(int *a){
//	rep(i,1,len)printf("[%d]\n",a[i]);
	int num=0,sz=0;rep(i,1,len){
		int x=++num;rep(j,1,a[i])c[++sz]=++num;c[++sz]=x;
	}
	rep(i,1,n)printf("%d ",c[i]);
}
int main() {
	read(n);rep(i,1,n-1){int u,v;read(u);read(v);add(u,v);add(v,u);deg[u]++;deg[v]++;}
	int S=bfs(1),T=bfs(S);
	for(int u=T;;u=pre[u]){mrk[u]=1;if(u==S)break;}
	for(int u=T;;u=pre[u]){
		len++;L(i,u)if(!mrk[to[i]]){
			a[len]++;if(deg[to[i]]>1){puts("-1");return 0;}
		}if(u==S)break;
	}
	rep(i,1,len)b[i]=a[len-i+1];
	rep(i,1,len)if(a[i]!=b[i]){
		if(a[i]<b[i])solve(a);else solve(b);return 0;
	}
	solve(a);
	return 0;
}

Measured memory_bytes: 21632
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N,Q;
  cin >> N >> Q;
	string S;
  cin >> S;
  S.push_back('D');
  vector<int> l(Q),r(Q),ans(N+1);
  for (int i=0;i<Q;i++){
    cin >> l.at(i) >> r.at(i);
  }
  ans.at(0)=0;

  for (int i=0;i<N;i++){
    if (S.at(i)=='A' && S.at(i+1)=='C'  ) ans.at(i+1)=ans.at(i)+1;
    else ans.at(i+1)=ans.at(i);
  }
  for (int i=0;i<Q;i++) {
cout << ans.at(r.at(i)-1)-ans.at(l.at(i)-1) << endl;
}
}

Measured memory_bytes: 2176
import java.util.ArrayList;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner kb = new Scanner(System.in);
		int n = kb.nextInt();
		int k = kb.nextInt();
		ArrayList<Integer> a = new ArrayList<Integer>();
		for (int i = 0; i < k; i++) {
			int d = kb.nextInt();
			for (int j = 0; j < d; j++) {
				int l = kb.nextInt();
				a.add(l);
			}
		}
		int count = n;
		for (int i = 1; i <= n; i++) {
			for (int e : a) {
				if (i == e) {
					count -= 1;
					break;
				}
			}
		}
		System.out.println(count);

		kb.close();
	}

}


Measured memory_bytes: 37664
#include "bits/stdc++.h"
#include <cmath>
#include <iomanip>
using namespace std;
 
#define f first
#define s second
 
#define pb push_back
#define pp pop_back
#define mp make_pair
 
#define sz(x) (int)x.size()
#define sqr(x) ((x) * 1ll * (x))
#define all(x) x.begin(), x.end()
#define clr(a,v) memset(a, v, sizeof(a))
 
#define rep(i, l, r) for (int i = (l); i <= (r); i++)
#define per(i, l, r) for (int i = (l); i >= (r); i--)
#define reflex ios_base::sync_with_stdio(false)
 
#define nl '\n'
#define ioi exit(0);
 

#define PI 3.14159265

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
 
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int N= (int)5e5 + 7;
const int inf = (int)1e9 + 7;
const int mod = (int)1e9 + 7;
//const int mod = 1000000007;
const ll linf = (ll)1e18 + 7;
 
const int dx[] = {-1, 0, 1, 0, 1, -1, -1, 1};
const int dy[] = {0, 1, 0, -1, 1, -1, 1, -1};
const int kx[] = {-1,1,2,2,1,-1,-2,-2};
const int ky[] = {2,2,1,-1,-2,-2,-1,1};




int main(){
	string s; cin>> s;
	vector<pair<ll,bool> > p;
	
	
	int m = (int) s.size();
	int n = m+1;
	
	for(int i = 0; i < m; i++){
		if(i == 0 && s[i] == '<'){
			p.push_back(mp(i+1,true));
		}
		if(i == m-1 && s[i] == '>'){
			p.push_back(mp(i+2,true));
		}
		if(i + 1 < m && s[i] == '>' && s[i+1] == '<'){
			p.push_back(mp(i+2,true));
		}
		if(i + 1 < m && s[i] == '<' && s[i+1] == '>'){
			p.push_back(mp(i+2,false));
		}
	}
	
	//~ for(pair<ll,bool> x: p)
		//~ cout<<x.f<<" ";
	//~ cout<<endl;
	
	ll ans = 0;
	
	ll a = (p[0].f - 1) ;
	ans += a*(a+1)/2;
	
	ll b = n - p[(int) p.size() -1].f;
	ans += b*(b+1)/2;
	
	for(int k = 0; k < (int) p.size(); k++){
		ll sum = 0;
		if(k+1 < (int)p.size()){
			if(p[k+1].s == true){
				ll c = p[k+1].f - p[k].f - 1;
				sum = c*(c+1)/2;
			}
			else{
				ll l = p[k+1].f - p[k].f;
				ll r = p[k+2].f - p[k+1].f - 1;
				//~ cout<<p[k].f<<" "<<p[k+2].f<<"=";
				if(l > r){
					//~ cout<<l<<" ";
					sum = l*(l+1)/2;
					l -= 1;
					for(int i = 1; i <= r; i++,l--){
						//~ cout<<l<<" ";
						sum += i; 
					}
				}
				else{
					//~ cout<<"r"<<" ";
					sum = r*(r+1)/2 + (r+1);

					for(int i = 1; i <= l-1; i++,r--){
						//~ cout<<r<<" ";
						sum += i;
					}
				}
				//~ cout<<"= "<<sum;
				//~ cout<<endl;
				ans += sum;
				k+=1;
			}
		}
	}
	cout<<ans;
	return 0;
}
 
		


Measured memory_bytes: 6264
#include <iostream>
using namespace std;
int main(void){
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    int A;
    A=a+b+c+d;
    int x,y;
    x=A/60;
    y=A%60;
    cout<<x<<endl<<y;
    cout<<endl;
}



Measured memory_bytes: 3064
#include<bits/stdc++.h>
    using namespace std;
    typedef unsigned long long ul;
     
    int main(void) {
      ul n;
      cin >> n;
      ul ans = n-1;
      for (ul i=1; i*i<=n; ++i) {
        if (n%i!=0) continue;
        ans = min(ans, i+n/i-2);
      }
      cout << ans << endl;
      return 0;
    }

Measured memory_bytes: 256
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;

public class Main {

    Scanner sc = new Scanner(System.in);

    int h = sc.nextInt();
    int w = sc.nextInt();
    int k = sc.nextInt();

    char[][] arr = new char[h][w];

    PrintWriter out = new PrintWriter(System.out);

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

    void run() {

        for (int i=0; i<h; i++) {
            arr[i] = sc.next().toCharArray();
        }

        int ans = Integer.MAX_VALUE;
        label:
        for (int i=0; i<1<<(h-1); i++) {
            int[][] a = new int[h][w];
            int varH = 0;
            int tmpAns = Integer.bitCount(i);
            for (int j=0; j<h; j++) {
                for (int l=0; l<w; l++) {
                    a[varH][l] += arr[j][l]-'0';
                }
                if ((i>>j & 1) == 1) {
                    varH++;
                }
            }
            int[] sum = new int[h];
            int front = 0;
            for (int j=0; j<w; j++) {
                inner:
                for (int l=0; l<h; l++) {
                    sum[l] += a[l][j];
                    if (sum[l]>k) {
                        if (j==front) {
                            continue label;
                        }
                        front = j;
                        Arrays.fill(sum, 0);
                        tmpAns++;
                        j--;
                        break inner;
                    }
                }
            }
//            out.println(tmpAns);
//            out.flush();
            ans = Math.min(ans, tmpAns);
        }

        out.println(ans);
        out.flush();
    }
}


Measured memory_bytes: 41060
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String T = sc.next();
		char s[]=new char[S.length()+1];
		char t[]=new char[T.length()];
		boolean flag=true;
        sc.close();
        if(S.length()+1==T.length()) {
        	for(int i=0;i<S.length();i++) {
        		s[i]=S.charAt(i);
        		t[i]=T.charAt(i);
        		if(s[i]!=t[i]) {
        			flag=false;
        			break;
        		}
        	}
        	
        }
        if(flag==true) {
        	 System.out.println("Yes");
        }else if(flag==false) {
        		System.out.println("No");
        }
	}
}


Measured memory_bytes: 35676
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-9;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

ll h,w;

int main(){
	cin>>h>>w;
	if(h==1||w==1) cout<<1<<endl;
	else cout<<((w+1)/2)*((h+1)/2)+(w/2)*(h/2)<<endl;
}

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

using namespace std;

vector<int> next_int_vector(int n) {
    vector<int> v(n);
    for (int i = 0; i < n; ++i) {
        cin >> v.at(i);
    }
    return v;
}

int main() {
    string s, t;
    cin >> s >> t;

    int distance = 0;
    for (int i = 0; i < s.size(); ++i) {
        if (s.at(i) != t.at(i)) distance++;
    }
    cout << distance << endl;
}


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

long long int dp[100010];

int x[100010];

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n,e,t;
	cin>>n>>e>>t;
	for(int i=1;i<=n;i++)
		cin>>x[i];
	long long int trans = 1e18;
	int p=0;
	for(int i=1;i<=n;i++)
		dp[i]=1e18;
	for(int i=1;i<=n;i++){
		while(p+1<=i&&(x[i]-x[p+1])*2>=t)
			trans=min(trans,dp[p]-2*x[p+1]),p++;
		dp[i]=min(x[i]*2+trans,dp[i]);
		if(p!=i)
			dp[i]=min(dp[i],t+dp[p]);
	}
	cout<<dp[n]+e<<endl;
}


Measured memory_bytes: 1536
reversePolish :: [Int] -> String -> [Int]
reversePolish [] y = [(read y)]
reversePolish [x] y = (read y) : [x]
reversePolish axs@(x1:x2:xs) y
  | y == "+" = (x2 + x1) : xs
  | y == "-" = (x2 - x1) : xs
  | y == "*" = (x2 * x1) : xs
  | otherwise = (read y) : axs

main = do
  input <- getLine
  let inputs = words input
  let result = foldl reversePolish [] inputs
  print (result !! 0)

Measured memory_bytes: 4060
#include <bits/stdc++.h>
#define ll long long int
#define INF 10000000000
#define MOD 1000000007
#define DEBUG(x) cerr<<'>'<<#x<<':'<<x<< endl
using namespace std;
ll height[100005], ans[100005];

ll F(ll j, ll K)
{
    if(j == 1)
        return 0;
    else if(ans[j] != -1)
        return ans[j];
    else
    {
        ll mn = INF;
        for(int i = 1; i <= K; i++)
        {
            if(j - i < 1)
                break;
            ll diff = abs(height[j] - height[j - i]);
            mn = min(mn, F(j - i, K) + diff);
        }
        return ans[j] = mn;
    }
}


signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll N;
    cin >> N;
    for(int i = 1; i <= N; i++)
    {
        ans[i] = -1;
        cin >> height[i];
    }
    ll Ans = F(N, 2);
    cout << Ans << endl;
    return 0;
}


Measured memory_bytes: 8064
#include <stdio.h>

int counter = 0;
int currTable[10000];
int currTableSize = 0;

int getFactors(int num)
{
	counter++;
	int flag = 1;
	int flag2 = 1;
	int t = 0;
	if ((num - 1) % 7 == 0)
		t = (num - 1) / 7;
	if ((num + 1) % 7 == 0)
	{
		t = (num + 1) / 7;
		flag2 = 0;
	}

	for (int m = 1; m < t; m++)
	{
		for (int n = m; n < t; n++)
		{
			if (flag2)
			{
				if (t == (7 * m * n + m + n))
				{
					getFactors(7 * m + 1);
					getFactors(7 * n + 1);
					flag = 0;
				}
				else if (t == (7 * m * n - m - n))
				{
					getFactors(7 * m - 1);
					getFactors(7 * n - 1);
					flag = 0;
				}
			}
			else
			{
				if (t == (7 * m * n - m + n))
				{
					getFactors(7 * m + 1);
					getFactors(7 * n - 1);
					flag = 0;
				}
				else if (t == (7 * m * n + m - n))
				{
					getFactors(7 * m - 1);
					getFactors(7 * n + 1);
					flag = 0;
				}
			}
		}
		if (m * m * 7 > t)
			break;
	}

	if (flag)
	{
		int i = 0;
		for (i = 0; currTable[i] != 0; i++)
		{
			if (num == currTable[i])
				return 0;
		}
		currTable[i] = num;
		currTableSize = i;
	}
}

int main()
{
	for (int num; (scanf("%d", &num)) && num != 1; printf("\n"))
	{
		printf("%d:", num);
		getFactors(num);
		int flag = 1;
		while (flag)
		{
			flag = 0;
			for (int i = 0; i < currTableSize; i++)
			{
				if (currTable[i] > currTable[i + 1])
				{
					int temp = currTable[i + 1];
					currTable[i + 1] = currTable[i];
					currTable[i] = temp;
					flag = 1;
				}
			}
		}
		for (int i = 0; i <= currTableSize; i++)
		{
			printf(" %d", currTable[i]);
			currTable[i] = 0;
		}
		currTableSize = 0;
	}
	return 0;
}



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

typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;
typedef pair<int, ii> iii;
typedef pair<ii, int> ri3;
#define mp make_pair
#define pb push_back
#define fi first
#define sc second
#define SZ(x) (int)(x).size()
#define ALL(x) begin(x), end(x) 
#define REP(i, n) for (int i = 0; i < n; ++i) 
#define FOR(i, a, b) for (int i = a; i <= b; ++i)
#define RFOR(i, a, b) for (int i = a; i >= b; --i)

const int MX_N = 305;

int N, K, H[MX_N], ord[MX_N], X[MX_N];
ll dp[2][MX_N][MX_N];

int main() {
    //freopen("in.txt", "r", stdin);
    ios::sync_with_stdio(false);
    cin.tie(0);

    cin >> N >> K;
    H[0] = 0; ord[0] = 0;
    for (int i = 1; i <= N; ++i) {
        cin >> H[i];
        ord[i] = i;
    }
    sort(ord,ord+N+1,[](int a, int b) { if (H[a] == H[b]) return a < b; return H[a] < H[b]; });
    for (int i = 0; i <= N; ++i) X[ord[i]] = i;
    sort(H,H+N+1);

    // dp[i][x][p] = min (dp[i+1][x][i], for all j dp[i+1][x-1][j] + max(H[j]-H[p], 0))
    int c = 0;
    for (int i = N; i >= 1; --i) {
        ll bel[N+1], abv[N+1];
        for (int x = 0; x <= K; ++x) {
            for (int p = 0; p <= N; ++p) {
                dp[c][x][p] = dp[!c][x][X[i]] + max(H[X[i]] - H[p], 0);
                if (x > 0) {
                    dp[c][x][p] = min({ dp[c][x][p], bel[p], abv[p]-H[p] });
                }
                //cout << X[i] << " " << H[X[i]] << " :: " << i << " " << x << " " << p << " :: " << dp[c][x][p] << endl;
            }

            bel[0] = dp[!c][x][0];
            abv[N] = dp[!c][x][N] + H[N];
            for (int p = 1; p <= N; ++p) {
                bel[p] = min(bel[p-1], dp[!c][x][p]);
                abv[N-p] = min(abv[N-p+1], dp[!c][x][N-p] + H[N-p]);
            }
        }
        c = !c;
    }
    cout << dp[!c][K][0] << '\n';
}



Measured memory_bytes: 1664
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
 
def main():
    x, y = map(int, readline().split())
    cnt = 0
    while x <= y:
        x *= 2
        cnt += 1
    print(cnt)
if __name__ == '__main__':
    main()


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

int simbol(char a){
  if(a=='M')return 0;
  else if(a=='D')return 1;
  else if(a=='C')return 2;
  else if(a=='L')return 3;
  else if(a=='X')return 4;
  else if(a=='V')return 5;
  else if(a=='I')return 6;
  else return 7;
}

int trans(int value[],char str[100],int pos){
  if(simbol(str[pos]) - simbol(str[pos+1]) > 0){
    return -1 * value[simbol(str[pos])];
  }else{
    return value[simbol(str[pos])];
  }
}
    

int main(void){
  int i;
  char roman[100];
  int value[] = {1000,500,100,50,10,5,1,0};
  int len;
  int sum;

  while(scanf(" %s ",roman)!=EOF){

    sum = 0;
    len = strlen(roman);

    for(i=0;i<len;i++){
      sum += trans(value,roman,i);
    }
    printf("%d\n",sum);
  }


  return 0;
}

Measured memory_bytes: 0
n,m = list(map(int, input().split()))
info = [list(map(int, input().split())) for i in range(m)]

pref = {}
for p,y in info:
    if not p in pref: pref[p] = [y]
    else: pref[p].append(y)

id = {}
for p,years in pref.items():
    years.sort()
    id[p] = {}
    for i,y in enumerate(years):
        id[p][y] = str(p).zfill(6) + str(i+1).zfill(6)

for p,y in info:
    print(id[p][y])

Measured memory_bytes: 83460
use std::io;

fn procon_read<T: std::str::FromStr>() ->  Vec<T> {
	let mut buf = String::new();
	io::stdin().read_line(&mut buf).expect("");
	let iter = buf.split_whitespace();
	let mut v: Vec<T> = Vec::new();
	for i in iter {
		v.push(i.parse().ok().unwrap());
	}
	v
}

fn main() {
	let v: Vec<i32> = procon_read();
	let ab = v[0];
	let bc = v[1];
	println!("{}", ab*bc/2);
}

Measured memory_bytes: 4352
#include<cstdio>
#include<cstring>

int main(){
    int n;
    scanf("%d",&n);
    long long ans = 0, last = -1;
    for(int i = 1; i <= n; i++){
        long long u;
        scanf("%lld",&u);
        if(u<last){
            ans += last-u;
        }
        else last = u;
    }
    printf("%lld\n",ans);
    return 0;
}


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

int main(){
  ll A,B,C,K,cnt=0;
  cin>>A>>B>>C>>K;
  
  while(A>=B){
    B*=2;
    cnt++;
  }
  while(B>=C){
    C*=2;
    cnt++;
  }
  
  if(cnt<=K) COYe;
  else CONo;
  return 0;
}

Measured memory_bytes: 3632
p = lambda n:2**(n+1)-1
a = lambda n:2**(n+2)-3


def dfs(n,x):
    if n==0:
        return 0 if x<=0 else 1
    if x<=1+a(n-1):
        return dfs(n-1,x-1)
    else:
        return p(n-1)+1 + dfs(n-1,x-2-a(n-1))

n, x = map(int, input().split())
print(dfs(n,x))


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

    
k,a,b = li()
k += 1

if k <= a:
    print(k)

elif b <= a+2:
    print(k)

else:
    k -= a
    n = k//2
    print(b + (n-1)*(b-a) + bool(k%2))


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define int long long
#define double long double
#define INF 1e18
using namespace std;
template<class T> inline bool chmin(T& a, T b) {
  if (a > b) a = b;
  return a > b;
}
template<class T> inline bool chmax(T&a, T b) {
  if (a < b) a = b;
  return a < b;
}

signed main() {
  int i; cin >> i;
  cout << i*32 << endl;  
}



Measured memory_bytes: 3104
#include<bits/stdc++.h>
#define pb push_back
using namespace std;
const int N=1e5+200;
int a[N],b[N],c[N],x[N][3];


int main(){
    int n;
    cin >> n;
    for (int i=0 ; i<n ; i++){
        for (int j=0  ; j<3 ; j++){
            cin >> x[i][j];
        }
    }
    a[0]=x[0][0];
    b[0]=x[0][1];
    c[0]=x[0][2];
    for (int i=1 ; i<n ; i++){
        a[i]=max(b[i-1]+x[i][0],c[i-1]+x[i][0]);
        b[i]=max(a[i-1]+x[i][1],c[i-1]+x[i][1]);
        c[i]=max(b[i-1]+x[i][2],a[i-1]+x[i][2]);
    }
    int w=max( max( a[n-1], b[n-1] ) , c[n-1] );
    cout << w;
}






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

int main() {
    int N;
    cin >> N;
    string s;
    cin >> s;
    int l=0;int r=0;
    int lappendNum =0; 
    for(int i=0;i<N;i++){
        if(s[i] == '('){
            l++;
        }else{
            r++;
        }
        if(l<r){
            l++;
            lappendNum++;
        }
    }
    string ans ="";
    for(int i=0;i<lappendNum;i++){
        ans += '(';
    }
    ans += s;
    for(int i=0;i<(l-r);i++){
        ans += ')';
    }
    cout << ans << endl;

    return 0;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

const long long INF=INT_MAX/4;
const long long MOD=1'000'000'007;
const double EPS=1e-14;
const bool DEBUG=true;

const string YES = "YES";
const string NO = "NO";
const string Yes = "Yes";
const string No = "No";

template<class T>
void debug(T head){
    if(DEBUG){
        cout<<head<<endl;
    }
}

template <class Head, class... Body>
void debug(Head head, Body... body){
    if(DEBUG){
        cout<<head<<" ";
        debug(body...);
    }
}

/////
void answer(){
    int N;
    cin>>N;
    unsigned long long answer = 0;
    for(int i=1; i<N; ++i){
        answer += int(N/i);
        if(N%i == 0){
            answer--;
        }
    }
    cout<<answer<<endl;

    return;
}

/////

int main(int argc, char* argv[]){
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout.precision(16);

    answer();

    return 0;
}


Measured memory_bytes: 3652
from collections import defaultdict


def p_c():
    N, K, Q = map(int, input().split())

    l = defaultdict(int)

    for _ in range(Q):
        A = int(input())
        l[A - 1] += 1

    for i in range(N):
        if K - Q + l[i] > 0:
            print("Yes")
        else:
            print("No")


if __name__ == '__main__':
    p_c()


Measured memory_bytes: 62820
n = int(input())
a = input().split()
for i in range(n):
    a[i] = int(a[i])

p = max(a)
q = 0
for i in range(n):
    m = abs(a[i]-p/2)
    if m < abs(q-p/2):
        q = a[i]
        

print(p,q)

Measured memory_bytes: 11064