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

using namespace std;

int main() {
  string str; cin >> str;
  int temp; temp = (int)str.size();
  vector<int> H(temp);
  for(int i=0; i < temp; ++i){
    H[i] = (int)(str[i]-'0');
  }//transform関数を用いても良い.
  int count; count = 0;
  int before; before = H[0];
  for(int i=1; i < temp; ++i){
    if(H[i]==before){
      ++count;
      if(H[i]==0){
        before = 1;
      }
      else {
        before = 0;
      }
    }
    else {
      before = H[i];
    }
  }
  cout << count << endl;
}

Measured memory_bytes: 896
a, b = map(int, input().split())
s = input()
x = s[:a]
y = s[a+1:]
#print(x)
#print(y)
if x.isnumeric() and y.isnumeric() and len(y) == b and s[a] == "-":
    print("Yes")
else:
    print("No")

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

// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const int mod = 1000000007;
struct mint {
  ll x;  // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod - a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const { return mint(*this) += a; }
  mint operator-(const mint a) const { return mint(*this) -= a; }
  mint operator*(const mint a) const { return mint(*this) *= a; }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod - 2); }
  mint& operator/=(const mint a) { return *this *= a.inv(); }
  mint operator/(const mint a) const { return mint(*this) /= a; }
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x; }
ostream& operator<<(ostream& os, const mint& a) { return os << a.x; }

int main() {
  int n, k;
  cin >> n >> k;
  mint ans = 0;
  vector<mint> d(k + 1);
  for (int i = 1; i <= k; i++) {
    d[i] = mint(k / i).pow(n);
  }
  for (int j = k; j >= 1; j--) {
    for (int i = j; i <= k; i += j) {
      if (i == j) continue;
      d[j] -= d[i];
    }
  }
  for (int i = 1; i <= k; i++) {
    ans += d[i] * i;
  }
  cout << ans << endl;
}

Measured memory_bytes: 3892
#include<stdio.h>
int main(){
	int a, b, c, tmp;
	scanf("%d %d %d", &a, &b, &c);
	if(a>b){
		tmp = b;
		b = a;
		a = tmp;

	} 
	if(b>c){
		tmp = c;
		c = b;
		b=tmp;

	} 
	if(a>b){
		tmp = b;
		b = a;
		a = tmp;

	} 

	printf("%d %d %d\n", a, b, c);
	
    return 0;
}

Measured memory_bytes: 596
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int MOD = 1000000007;
struct edge {int to,costa,costb;};


signed main() {
int a,b,x;
  cin>>a>>b>>x;
  if(a<=x&&x<=a+b)cout<<"YES";
  else cout<<"NO";


return 0;
}


Measured memory_bytes: 256
fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val h = readLine()!!.split(' ').map { it.toInt() }
    val dp = IntArray(n) { Int.MAX_VALUE }
    dp[0] = 0
    dp[1] = Math.abs(h[1] - h[0])
    for (i in 2 until n) {
        dp[i] = Math.min(dp[i - 2] + Math.abs(h[i - 2] - h[i]), dp[i - 1] + Math.abs(h[i - 1] - h[i]))
    }
    println(dp[n - 1])
}


Measured memory_bytes: 50620
using System;

class Program
{
    static void Main(string[] args)
    {
        var nm = Console.ReadLine().Split(' ');
        var n = long.Parse(nm[0]);
        var m = long.Parse(nm[1]);

        if (n == m)
        {
            Console.WriteLine(2 * f(n) * f(m) % 1000000007);
        }
        else if (Math.Abs(n - m) == 1)
        {
            Console.WriteLine(f(n) * f(m) % 1000000007);
        }
        else
        {
            Console.WriteLine(0);
        }
    }

    static long f(long n)
    {
        var ans = 1L;
        while (1 < n)
        {
            ans = ans * n % 1000000007;
            n--;
        }
        return ans;
    }
}


Measured memory_bytes: 13268
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
 
int main(){

    int N;
    long long H[100010],dp[100010];
    cin >> N;
    rep(i,N) cin >> H[i];
    rep(i,N) dp[i]=INF;

    dp[0]=0;
    rep(i,N){
        chmin(dp[i],dp[i-1]+abs(H[i]-H[i-1]));
        if(i>1) chmin(dp[i],dp[i-2]+abs(H[i]-H[i-2]));
    }

    cout << dp[N-1] << endl;

 
}

Measured memory_bytes: 1792
#include<iostream>
#include<cstring>
#include<cstdlib>

using namespace std;

int main()
{
    string str;
    cin >> str;
    if(str.size() > 20)
        exit(1);
    else
        {
            string strrev(str.rbegin(), str.rend());
            cout << strrev;
        }
    cout << endl;
}

Measured memory_bytes: 3188
using System;
using System.Linq;//リストの使用
using System.Collections.Generic;
class Program
{
	static void Main()
	{
		long n = long.Parse(Console.ReadLine());//int.Parseは文字列を整数に変換。
    long[,] moveMatrix = new long[n,n];
    bool[,] smallerPath = new bool[n,n];//近道の存在
    bool answer = true;
    bool countPlus = true;
    long answerCount = 0;
    for(long i = 0; i < n; i++)
    {
      long[] nums = Array.ConvertAll(Console.ReadLine().Split(' '),long.Parse);
      for(long j = 0; j < n; j++) moveMatrix[i,j] = nums[j];
    }

    for(int k = 0; k < n; k++)
    {
      for(int i = 0; i < n; i++)
      {
        for(int j = 0; j < n; j++)
        {
          if(moveMatrix[i,j] > moveMatrix[i,k] + moveMatrix[k,j])//近道が存在
          {
            answer = false;
          }else if(moveMatrix[i,j] == moveMatrix[i,k] + moveMatrix[k,j]
            && i != k && j!= k)
          {
            smallerPath[i,j] = true;
            smallerPath[j,i] = true;
          }
        }
      }
    }

    for(long i = 0; i < n; i++)
    {
      for(long j = i+1; j < n; j++)
      {
        if(!(smallerPath[i,j])) answerCount += moveMatrix[i,j];
      }
    }
    
		Console.WriteLine((answer) ? answerCount.ToString() : "-1");
	}
}

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

using ll = long long;

int main() {
    string S;
    cin >> S;
    int N = S.size();
    vector<bool> a(26, false);
    rep(i, N) {
        a[S[i] - 'a'] = true;
    }
    rep(i, 26) {
        if (a[i]) continue;
        cout << S << (char)(i + 'a') << "\n";
        return 0;
    }
    int i = -1;
    rep(k, N - 1) {
        if (S[k] < S[k + 1]) i = k;
    }
    if (i == -1) {
        cout << "-1\n";
        return 0;
    }
    int j;
    rep(k, N) if (S[k] > S[i]) j = k;
    cout << S.substr(0, i) << S[j] << "\n"; 
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

void solve()
{
	for(int i = 0; i < 3; ++i)
	{
		int a[3];
		int b[3];
		for(int j = 0; j < 3; ++j)
		{
			cin >> a[j];
		}
		for(int j = 0; j < 3; ++j)
		{
			cin >> b[j];
		}
		int sum1 = 0;
		int sum2 = 0;
		sum1 += 3600 * a[0] + 60 * a[1] + a[2];
		sum2 += 3600 * b[0] + 60 * b[1] + b[2];
		sum2 -= sum1;
		cout << sum2 / 3600 << " ";
		sum2 %= 3600;
		cout << sum2 / 60 << " ";
		sum2 %= 60;
		cout << sum2 << endl;
	}
}

int main()
{
	solve();
	return(0);
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
#define ll              long long int
#define int             ll
#define ff              first
#define ss              second
#define pb              emplace_back
#define mpair           make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define sbits(x)      __builtin_popcountll(x)
#define zbits(x)      __builtin_popcountlliltin_ctzll(x)
#define w(t)            int t;cin>>t;while(t--)
#define uset            unordered_set
#define forr(i, a, b)   for(int i =int(a);i<=int(b);i++)
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__,__VA_ARGS__)
    template <typename Arg1>
     void __f(const char* name,Arg1&& arg1){
        cout<<name<<" : "<<arg1<<std::endl;
     }
     template <typename Arg1, typename... Args>
     void __f(const char* names,Arg1&& arg1,Args&&... args){
        const char* comma = strchr(names+1 ,',');
        cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
     }
#else
#define trace(...)
#endif
/*     
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
*/
double pi = 2.0*acos(0);
void fast(){ios_base::sync_with_stdio(false);cin.tie(NULL);cout<<fixed<<setprecision(10);}
int max2(int a,int b){ if(a>b) return a;return b;}
int min2(int a,int b){ if(a<b)return a;return b;}
int max3(int a,int b,int c){ return max2(a,max2(b,c));}
int min3(int a,int b,int c){ return min2(a,min2(b,c));}

///////////////////////////////////////////////////////////////////////////////////////////////


void solve(){
    
    string s;
    cin>>s;
    string t;
    cin>>t;
    if(s.length()+1 == t.length())
    {
         for(int  i =0;i<s.length();i++)
         {
             if(s[i]!=t[i])
             {
                cout<<"No"<<endl;
                return;
             }
         }
         cout<<"Yes"<<endl;
    }
    else
    cout<<"No"<<endl;   
        
 }


signed main(void)
{
      fast();
      //w(t)
      solve();

}

Measured memory_bytes: 3644
use proconio::{input, fastout};
use std::cmp::Ordering;

#[fastout]
fn main(){
    proconio::input!{
        D : i32,
        T : i32,
        S : i32,
  }
  let d = S*T;
  match d.cmp(&D){
      Ordering::Less => println!("No"),
      _ => println!("Yes"),
  }
}

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

using std::pair;
using std::make_pair;
typedef pair<int, int> Pair;

#define update_max(a, b) if ((a) < (b)) (a) = (b)
#define update_min(a, b) if ((a) > (b)) (a) = (b)

const int N = 100000 + 10;

int next[N][26];
int pos[26];
std::string s, t;

void run(int case_id = 0) {
  std::cin >> s >> t;
  int n = s.length();
  s += s;
  memset(pos, -1, sizeof(pos));
  for (int i = n + n - 1; i >= n; -- i) {
    char token = s[i] - 'a';
    pos[token] = i - n;
  }
  for (int i = n - 1; i >= 0; -- i) {
    for (int c = 0; c <= 25; ++ c) {
      next[i][c] = pos[c];
    }
    char token = s[i] - 'a';
    pos[token] = i;
  }

  long long answer = 0;
  int pivot = -1;
  for (int i = 0; i < t.length(); ++ i) {
    char token = t[i] - 'a';
    int x = -1;
    if (pivot == -1) {
      x = pos[token];
    } else {
      x = next[pivot][token];
    }
    if (x == -1) {
      answer = -1;
      break;
    }
    int delta = x - pivot;
    if (delta <= 0) delta += n;
    answer += delta;
    pivot = x;
  }
  std::cout << answer << std::endl;
}

void multi_cases_main() {
  int num_tests;
  std::cin >> num_tests;
  for (int t = 1; t <= num_tests; ++ t) {
    run(t);
  }
}

int main() {
  std::ios::sync_with_stdio(false);
  run();
  return 0;
}


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

int digit_sum(int n) {
  string s = to_string(n);
  int res = 0;
  for (int i = 0; i < s.size(); i++) {
    res += s[i] - '0';
  }
  
  return res;
}

int main() {
  int N;
  cin >> N;
  
  // 全探索
  int ans = 1e9;
  for (int i = 1; i < N; i++) {
    ans = min(ans, digit_sum(i) + digit_sum(N - i));
  }
  
  cout << ans << endl;
  return 0;
}

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

int main(){
    int n;
    cin >> n;
    int table[100001][3];
    rep(i, n)rep(j, 3){
        cin >> table[i][j];
    }

    int dp[100001][3];

    int temp = 0;
    rep(i, 3){
        if(temp < table[0][i]){
            dp[0][i] = table[0][i];
        }
    }

    for(int i = 1; i < n; i++){
        rep(j, 3){
            int temp = 0;
            rep(k, 3){
                if(j!=k){
                    temp = max(temp, dp[i-1][k] + table[i][j]);
                }
            }
            dp[i][j] = temp;
        }
    }

    int ans = max({dp[n-1][0], dp[n-1][1], dp[n-1][2]});

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


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

int main() {
  int h,w; cin>>h>>w;
  char grid[h][w];
  rep(i, h){
    rep(j, w){
      cin>>grid[i][j];
    }
  }
  
  int yoko[h]={0};
  
  rep(i, h){
    bool siro1=true;
    rep(j, w){
      if(grid[i][j]!='.'&&grid[i][j]!='s'){siro1=false;
                          break;}
    }
      if(siro1){
          rep(j, w){grid[i][j]='s';}
        yoko[i]=1;
      }
  }
        
  
  
   rep(j, w){
    bool siro1=true;
    rep(i, h){
      if(grid[i][j]!='.'&&grid[i][j]!='s'){siro1=false;
                          break;}
    }
      if(siro1){
          rep(i, h){grid[i][j]='s';}
      }
  }
  
  rep(i, h){
    rep(j, w){
      if(yoko[i]==1) continue;
      if(grid[i][j]!='s')cout<<grid[i][j];
      if(j==w-1)cout<<endl;
    }
  }
  

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int maxN = 100200;
int mem[maxN];
vector<int> nums(maxN);
int solve(int i,int n){
	if(i + 1 >= n){
		return 0;
	}
	if(mem[i] != -1){
		return mem[i];
	}
	int choice1 = abs(nums[i] - nums[i + 1]) + solve(i + 1,n),choice2 = 2000000000;
	if(i + 2 < n){
		choice2 = abs(nums[i] - nums[i + 2]) + solve(i + 2,n);
	}
	return mem[i] = min(choice1,choice2);
}
int main(){
	ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    cin >> n;
    for(int i = 0;i < n; i++){
		cin >> nums[i];
	}
	memset(mem,-1,sizeof(mem));
	cout << solve(0,n);
}


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

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <string>
#include <set>
#include <math.h>
#include <map>
#include <stack>
using namespace std;
static const int INF = 1e9+7;
// 型定義
typedef long long ll;
typedef pair<ll, ll> P;

#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, a, b) for (int i =a; i < b; i++)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define PI 3.14159265359

int main(){
    int n; cin >> n;
    bool flg=false;
    if(n % 4 == 0) flg=true;
    if(n % 7 == 0) flg=true;
    if(n % 11 == 0) flg=true;
    rep(i, n/4+1){
        rep(j, n/7+1){
            if(4*i+7*j == n) flg = true;
        }
    }

    if(flg){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

    return 0;
}


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

int main() {
	int n;
	ll m = 1000;
	cin >> n;
	vector<int> a(n + 5, 0);
	rep(i, n) cin >> a[i];
	int i = 0, mi = 200;
	while (i < n - 1) {
		mi = min(mi, a[i]);
		if (a[i] <= a[i + 1] && a[i + 1] > a[i + 2]) {
			m += (a[i + 1] - mi)*(ll)(m / mi);
			mi = 200;
		}
		i++;
	}
	cout << m << endl;
}

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

int main()
{	
    long long n,W,i,j;
    cin>>n>>W;

    long long v[n],w[n];
    for(i=0;i<n;i++)
    {
      cin>>w[i];
      cin>>v[i];
    }

    long long dp[W+1][n+1];

    for(i=0;i<=W;i++)
      for(j=0;j<=n;j++)
        dp[i][j]=0;

    for(i=1;i<=W;i++)
    {
      for(j=1;j<=n;j++)
      {
        dp[i][j] = dp[i][j-1];

        if(w[j-1]<=i)
          dp[i][j] = max(dp[i][j],dp[i-w[j-1]][j-1]+v[j-1]);
      }
    }
    cout<<dp[W][n]<<endl;

	return 0;
}

Measured memory_bytes: 79104
#include <algorithm>
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <list>
#include <cmath>
#include <stack>
#include <string>
#include <cstring>
#include <numeric>
#include <iomanip>
#include <fstream>
using namespace std;
int main(){
	long long n;
	cin>>n;
	long long ans=0;
	for(int i=1;i<=n-1;i++){//n-c
		for(int j=1;j*j<=i;j++){
			if(i%j==0){
				ans++;
				if(j*j!=i){
					ans++;
				}
			}
		}
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 3220
using LIB;
using System;
using System.Linq;
using System.Text;
using System.Collections.Generic;

class Program
{
    public static IO IO = new IO();
    static void Main(string[] args)
    {
        string[] s = IO.STRING(' ');
        IO.WRITE("A" + s[1][0] + "C");
        IO.FLUSH();
    }
}

namespace LIB
{
    public class IO
    {
        private const int WMAX = 1000;
        private StringBuilder S = new StringBuilder();
        private T R<T>(Func<string, T> f) { return f(Console.ReadLine()); }
        private T[] R<T>(Func<string, T> f, char c) { return STRING().Split(c).Select(f).ToArray(); }
        private T[] R<T>(Func<string, T> f, int l) { T[] r = new T[l]; for (int i = 0; i < l; i++) { r[i] = R(f); } return r; }
        private T[][] R<T>(Func<string, T> f, int l, char c) { T[][] r = new T[l][]; for (int i = 0; i < l; i++) { r[i] = R<T>(f, c); } return r; }
        private void W<T>(Func<T, string> f, T v, bool lf = true) { S.Append(f(v)); if (lf) { S.Append('\n'); } if (S.Length >= WMAX) { FLUSH(); } }
        public string STRING() { return R(s => s); }
        public string[] STRING(char c) { return R(s => s, c); }
        public string[] STRING(int l) { return R(s => s, l); }
        public string[][] STRING(int l, char c) { return R(s => s, l, c); }
        public int INT() { return R(int.Parse); }
        public int[] INT(char c) { return R(int.Parse, c); }
        public int[] INT(int l) { return R(int.Parse, l); }
        public int[][] INT(int l, char c) { return R(int.Parse, l, c); }
        public long LONG() { return R(long.Parse); }
        public long[] LONG(char c) { return R(long.Parse, c); }
        public long[] LONG(int l) { return R(long.Parse, l); }
        public long[][] LONG(int l, char c) { return R(long.Parse, l, c); }
        public double DOUBLE() { return R(double.Parse); }
        public double[] DOUBLE(char c) { return R(double.Parse, c); }
        public double[] DOUBLE(int l) { return R(double.Parse, l); }
        public double[][] DOUBLE(int l, char c) { return R(double.Parse, l, c); }
        public void WRITE(object s, bool lf = true) { W(v => v.ToString(), s, lf); }
        public void FLUSH() { Console.Write(S); S.Length = 0; }
    }
}

Measured memory_bytes: 2904
s=input()
if ((s[0]==s[1] and s[2]==s[3] and s[0]!=s[2])or (s[0]==s[2] and s[1]==s[3] and s[0]!=s[1])or (s[0]==s[3] and s[1]==s[2] and s[0]!=s[1])):
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3060
A, B = map(int, input().split())
a, b = A, B
while b != 0:
  a, b = b, a % b
prod = 1
s = 1
p = 2
g = a
while a != 1:
  i = 0
  while a % p == 0:
    i += 1
    a //= p
    prod *= p
  if i != 0:
    s += 1
  p += 1
  if p > int(g**(1/2)) and prod != g:
    s += 1
    break
print(s)

Measured memory_bytes: 3064
#include <stdio.h>
#include <math.h>
#include <string.h>

  
int main(void){
  float d,t, s=0;
  scanf("%f %f %f", &d,&t, &s);
  if((d/s)>t){
    printf("No\n");
  }
  else 
    printf("Yes\n");
  

    return 0;
}

Measured memory_bytes: 1724
"use strict";
var input=require("fs").readFileSync("/dev/stdin","utf8");
var cin=input.split(/ |\n/),cid=0;
function next(a){return a?cin[cid++]:+cin[cid++];}
function nexts(n,a){return a?cin.slice(cid,cid+=n):cin.slice(cid,cid+=n).map(a=>+a);}
function nextm(h,w,a){var r=[],i=0;if(a)for(;i<h;i++)r.push(cin.slice(cid,cid+=w));else for(;i<h;i++)r.push(cin.slice(cid,cid+=w).map(a=>+a));return r;}
function xArray(v){var a=arguments,l=a.length,r="Array(a["+--l+"]).fill().map(x=>{return "+v+";})";while(--l)r="Array(a["+l+"]).fill().map(x=>"+r+")";return eval(r);}

var myOut = main();
if(myOut !== undefined)console.log(myOut);

function main(){
  var r = next();
  return 2 * r * Math.PI;
}

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

int main()
{
    int a,b,n,m;
    while(~scanf("%d %d %d %d",&a,&b,&n,&m))
    {
       if(a*b>=n*m)
        printf("%d\n",a*b);
       else
        printf("%d\n",m*n);

    }
    return 0;
}


Measured memory_bytes: 128
#include <iostream>
using std::cin;
using std::cout;

void shell_sort(unsigned a[], unsigned n){
  const unsigned gaps[] = {1,8,23,77,281,1073,4193,16577,65921,262913,1050113};
  // generated from pow(4,i)+3*pow(2,i-1)+1 (prefixed with 1)

  unsigned gap_num = 11,count=0;
  while(gaps[--gap_num] > n);

  for(int i = gap_num; i >= 0; i--){
    unsigned gap = gaps[i];
    for(unsigned i = gap; i < n; i++){
      unsigned v = a[i];
      int j = i - gap;
      while(j >= 0 && a[j] > v){
        a[j+gap] = a[j];
        j -= gap;
        count++;
      }
      a[j+gap] = v;
    }
  }

  cout << (gap_num+1) << '\n';

  for(; gap_num; gap_num--) cout << gaps[gap_num] << ' ';
  cout << gaps[0] << '\n';

  cout << count << '\n';
}

int main(){
  std::ios::sync_with_stdio(false);
  unsigned n,i;
  cin >> n;
  auto a = new unsigned[n];
  for(i = 0; i < n; i++) cin >> a[i];
  shell_sort(a,n);
  for(i = 0; i < n; i++) cout << a[i] << '\n';
  delete[](a);
}

Measured memory_bytes: 4888
#include<bits/stdc++.h>
#include<algorithm>
using namespace std;
typedef long long ll;
ll ean=0; 


int main(){
	 string x;
	 cin>>x;
	 int op=0;
	 if(x=="SSS")op=0;
	 if(x=="SSR")op=1;
	 if(x=="SRS")op=1;
	 if(x=="RSS")op=1;
	 if(x=="RRS")op=2;
	 if(x=="SRR")op=2;
	 if(x=="RSR")op=1;
	 if(x=="RRR")op=3;
	 cout<<op<<endl;
	 
}

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

using namespace std;

#define SZ(v) ((int)(v).size())
#define ALL(v) (v).begin(),(v).end()
#define one first
#define two second
typedef long long ll;
typedef pair<int, int> pi;
const int INF = 0x3f2f1f0f;
const ll LINF = 1ll * INF * INF;

const int MAX_N = 3e5 + 10;

ll N, K;
ll Cnt[MAX_N];
void smallAns(ll n, ll kth) {
	//printf("small %lld %lld\n", n, kth);
	if(n == 0) return;
	if(kth == 0) return;
	kth--;
	printf("%lld ", kth / Cnt[n-1] + 1);
	return smallAns(n-1, kth % Cnt[n-1]);
}
void getAns(ll n, ll after) {
	//printf("get %lld %lld\n", n, after);
	if(after < Cnt[n-1]-1) {
		printf("%lld ", (K+1)/2);
		return getAns(n-1, after+1);
	}else{
		return smallAns(n, ((Cnt[n]-(after-1)) + 1) / 2 - 1);
	}
}
int main() {
	cin >> K >> N;
	if(K % 2 == 0) {
		printf("%d ", K/2);
		for(int i=1; i<N; i++) printf("%d ", K); puts("");
		return 0;
	}
	Cnt[0] = 1;
	for(int i=1; i<=N; i++) {
		if(LINF / K >= Cnt[i-1]) Cnt[i] = Cnt[i-1] * K + 1;
		else Cnt[i] = LINF;
	}
	getAns(N, 0);
	return 0;
}


Measured memory_bytes: 4608
import math

N, K = map(int, input().split())
R, S, P = map(int, input().split())
T = input()


def point(i, hand):
    if i >= N: return 0
    t = T[i]
    if t == 'r': return P if hand == 2 else 0
    if t == 's': return R if hand == 0 else 0
    if t == 'p': return S if hand == 1 else 0
    return 0


def max_value(head_index):
    l = math.ceil(N / K)
    dp = [[0, 0, 0] for i in range(l)]
    dp[0] = [
      point(head_index, 0),
      point(head_index, 1),
      point(head_index, 2)
    ]
    for i in range(1, l):
        dp[i][0] = max(dp[i - 1][1], dp[i - 1][2]) + point(head_index + i * K, 0)
        dp[i][1] = max(dp[i - 1][2], dp[i - 1][0]) + point(head_index + i * K, 1)
        dp[i][2] = max(dp[i - 1][0], dp[i - 1][1]) + point(head_index + i * K, 2)
    return max(dp[l - 1])


def solve():
    ans = 0

    for i in range(K):
        ans += max_value(i)

    return ans


print(solve())


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

#define countof(a) (sizeof(a)/sizeof((a)[0]))
#define rep(i, n) for(int i = 0; i < (n); i++)
#define all(a) begin(a),end(a)
template<class T> istream& operator >> (istream& s, vector<T>& v)
{ for (T& x: v) { s >> x; } return s;}
template<class T> inline bool chmin(T& a, T b) {return a>b?a=b,true:false;}
template<class T> inline bool chmax(T& a, T b) {return a<b?a=b,true:false;}


#if 0
int main()
{
    cin.tie(0); ios::sync_with_stdio(false);
    //cout<<std::fixed<<std::setprecision(10);

    int N;
    cin >> N;
    
    vector<int> A(N);
    int a_max[2] = { INT_MIN, INT_MIN };
    rep(i, N) {
        cin >> A[i];
        if (A[i] >= a_max[0]) {
            a_max[1] = a_max[0];
            a_max[0] = A[i];
        } else if (A[i] > a_max[1]) {
            a_max[1] = A[i];
        }
        
    }

    rep(i, N) {
        cout << (A[i] == a_max[0] ? a_max[1] : a_max[0]) << endl; 
    }
}
#else
int main()
{
    int N;
    scanf("%d", &N);
    
    vector<int> A(N);
    int a_max[2] = { INT_MIN, INT_MIN };
    rep(i, N) {
        scanf("%d", &A[i]);
        if (A[i] >= a_max[0]) {
            a_max[1] = a_max[0];
            a_max[0] = A[i];
        } else if (A[i] > a_max[1]) {
            a_max[1] = A[i];
        }
        
    }

    rep(i, N) {
        printf("%d\n", A[i] == a_max[0] ? a_max[1] : a_max[0]);
    }
}
#endif

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

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

void print(vector<int> a) {
    for (int i = 0; i < (int)a.size(); i++) printf("%d%c", a[i] + 1, " \n"[i + 1 == (int)a.size()]);
}

template <typename T>
struct segtree {
    int N;
    vector<T> t;
    T zero;
    function<T(T, T)> f;

    segtree() {}
    void init(int n, T _zero, function<T(T, T)> _f) {
        f = _f;
        zero = _zero;
        N = 1;
        while (N < n) N <<= 1;
        t.assign(2 * N, zero);
    }
    segtree(int n, T _zero, function<T(T, T)> _f) {
        init(n, _zero, _f);
    }
    segtree(vector<T> &a, T _zero, function<T(T, T)> _f) {
        int n = a.size();
        init(n, _zero, _f);

        for (int i = 0; i < n; i++) t[N + i] = a[i];
        for (int i = N - 1; i > 0; i--) {
            t[i] = f(t[i * 2], t[i * 2 + 1]);
        }
    }

    T get(int l, int r) {
        T res = zero;
        l += N;
        r += N;
        while (l <= r) {
            if (l % 2 == 1) res = f(res, t[l]);
            if (r % 2 == 0) res = f(res, t[r]);
            l = (l + 1) >> 1;
            r = (r - 1) >> 1;
        }
        return res;
    }

    void upd(int x, T y) {
        x += N;
        t[x] = y;
        while (x > 1) {
            x >>= 1;
            t[x] = f(t[x * 2], t[x * 2 + 1]);
        }
    }
};

vector<int> solve(vector<int> a) {
    int n = a.size();

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

    vector<segtree<pair<int, int> > > tt(2);
    vector<vector<pair<int, int> > > vv(2);
    for (int i = 0; i < n; i++) {
        vv[i % 2].push_back({a[i], i});
        vv[(i % 2) ^ 1].push_back({INF, -1});
    }
    for (int i = 0; i < 2; i++) {
        tt[i] = segtree<pair<int, int> >(vv[i], {INF, -1}, [&](const pair<int, int> &x, const pair<int, int> &y) {
            return min(x, y);
        });
    }

    set<pair<int, int> > st;
    set<pair<int, int> > cands;
    auto add = [&](int l, int r) {
        assert(l % 2 != r % 2);
        if (l > r) return;
        st.insert({l, r});
        cands.insert(tt[l % 2].get(l, r));
    };
    add(0, n - 1);

    vector<int> ans;
    while (!cands.empty()) {
    ///for (int i = 0; i < n; i++) {
        //if (used[i]) continue;
        //int x = pos[i];
        int i = cands.begin()->first;
        int x = cands.begin()->second;
        cands.erase(cands.begin());
        auto it = st.lower_bound(make_pair(x + 1, -1));
        it--;
        auto o = *it;
        st.erase(it);

        assert(o.first <= x && x <= o.second);
        assert(o.second != x);
        assert(o.first % 2 == x % 2);

        int y = tt[(x % 2) ^ 1].get(x, o.second).second;
        ans.push_back(a[x]);
        ans.push_back(a[y]);
        add(o.first, x - 1);
        add(x + 1, y - 1);
        add(y + 1, o.second);
    }
    return ans;
}

int main() {
#ifdef HOME
    freopen("in", "r", stdin);
#endif

    int n;
    while (scanf("%d", &n) == 1) {
        vector<int> a(n);
        for (int i = 0; i < n; i++) {
            scanf("%d", &a[i]);
            a[i]--;
        }

        print(solve(a));
    }

    return 0;
}

Measured memory_bytes: 19172
#include <bits/stdc++.h>
using namespace std;
 
int main() {
	int a, b;
  	double x;
  
  	cin >> a;
  	cin >> b;
  	x = (a + b) / 2.0;
  	a = x + 0.9;
  
  	cout << a;
  
}

Measured memory_bytes: 256
/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Code author: Saurabh Singhal
Code copy karne vaale tera muh kaala
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/

#include<bits/stdc++.h>
#define mp(a,b) make_pair(a,b)
#define pb push_back
#define ppb pop_back

using namespace std;
typedef long long int ll;
typedef vector<int> vi_t;
typedef vector<ll> vll_t;
int t=1;
vll_t a,b;
int  main(){
	// #ifndef ONLINE_JUDGE
 //    // for getting input from input.txt
 //    freopen("input.txt", "r", stdin);
 //    // for writing output to output.txt
 //    freopen("output.txt", "w", stdout);
	// #endif
	vector<ll>v(5);
	for(int i=0;i<5;i++){
		cin>>v[i];
	}
	vector< pair<int,int > >w;
	ll sum=0;

	for(int i=0;i<5;i++){
		if(v[i]%10==0){
			sum+=v[i];
			continue;
		}
		w.pb(mp(v[i]%10,i));
	}
	if(w.size()>0){
		sort(w.begin(),w.end(),greater<>());
		for(int i=0;i<w.size()-1;i++){
			//cout<<w[i].first<<" "<<w[i].second<<endl;
			sum+=v[w[i].second]+10-w[i].first;
		}
		if(w.size()>0)
			sum+=v[w[w.size()-1].second];
	}
	cout<<sum<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define Imposter ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
#define ll long long int
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("O3")
using namespace __gnu_pbds;
#define ordered_set tree<ll, null_type,less_equal<ll>, rb_tree_tag,tree_order_statistics_node_update>//s.order_of_key(val) *s.find_by_order(ind)
using namespace std;
#define f(n) for(ll i=0;i<n;i++)
#define vll vector<ll>
#define vlll vector<vll>
int main()
{
    Imposter
    
    int t=1;
    //cin>>t;
    while(t--)
    {
        ll a;
        cin>>a;
        cout<<a+(a*a)+(a*a*a)<<endl;
    }
    return 0;
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int total;
  int onecoin;
  int amari;

  
  cin >> total >> onecoin ;
  
  amari = total % 500;
  if(amari <= onecoin){
    cout << "Yes"<<endl;
    
  }
  
  else{
  
    cout << "No" << endl;
  
  }
  
}
  


Measured memory_bytes: 3576
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
typedef long long ll;
 
int main(){
    int a,b,c;cin>>a>>b>>c;
    if(a==b)cout<<c<<endl;
    else if(b==c)cout<<a<<endl;
    else cout<<b<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
long long n, a[200005];
int main(){
    iostream::sync_with_stdio(0);
    cin >> n;
    for(int i=1;i<=n;i++)
        cin >> a[i],
        a[i] += a[i-1];

    int pivot[4] = {1,1,1,1};

    long long ans = (long long) 1e18;
    for(int i=2;i<=n-2;i++){
        while(pivot[1]+1 < i && abs(a[i] - 2ll * a[pivot[1]]) >= abs(a[i] - 2ll * a[pivot[1]+1]))    pivot[1]++;

        pivot[3] = max(pivot[3], i+1);
        while(pivot[3]+1 < n && abs(a[n] - 2ll * a[pivot[3]] + a[i]) >= abs(a[n] - 2ll * a[pivot[3]+1] + a[i]))    pivot[3]++;

        long long ma = max(max(a[pivot[1]], a[i]-a[pivot[1]]), max(a[pivot[3]] - a[i], a[n] - a[pivot[3]]));
        long long mi = min(min(a[pivot[1]], a[i]-a[pivot[1]]), min(a[pivot[3]] - a[i], a[n] - a[pivot[3]]));
        ans = min(ans, ma - mi);
    }
    cout << ans;
}


Measured memory_bytes: 1792
from sys import stdin 

def main():

	n = int(input())

	h = list(map(int, input().split()))

	#print(n, h)

	L = [0 for _ in range(n)]

	L[0] = 0
	L[1] = abs(h[1] - h[0])

	for ind in range(2, n):
		L[ind] = min(L[ind - 1] + abs(h[ind] - h[ind - 1]), L[ind - 2] + 
			abs(h[ind] - h[ind - 2]))

	print(L[-1])





if __name__ == '__main__':
	main()





















Measured memory_bytes: 20432
//#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <queue>

using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<n;++i)
#define mod (ll)(1e9+7)
#define FIX(a) ((a)%mod+mod)%mod
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define fi first
#define se second
#define pb push_back
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,x;
    cin >> n >> x;
    int ans = 1;
    int now = 0;
    REP(i,n){
        int l;
        cin >> l;
        now+=l;
        if(now<=x){
            ans++;
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
let () = Scanf.scanf "%d %d\n" @@ fun n x ->
  let as_ = Array.init n @@ fun _ -> Scanf.scanf "%d " @@ fun a -> a in
  (* dp.(k).(i) = (i - k, i]の最小値 *)
  let dp = Array.make_matrix (n + 1) n max_int in
  for k = 0 to n - 1 do
    for i = 0 to n - 1 do
      dp.(k + 1).((i + k) mod n) <- min as_.(i) dp.(k).((i + k) mod n)
    done
  done;
  Printf.printf "%d\n" @@
  Array.fold_left min max_int @@
  Array.init n @@ fun k ->
    x * k + Array.fold_left ( + ) 0 dp.(k + 1)


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

int main() {
  int n, m, o = 0;
  cin >> n;
  vector<string> s(n), a;
  for(int i = 0; i < n; i++) {
    cin >> s.at(i);
    a.push_back(s.at(i));
  }
  cin >> m;
  vector<string> t(m);
  for(int i = 0; i < m; i++) {
    cin >> t.at(i);
    a.push_back(t.at(i));
  }
  sort(a.begin(), a.end());
  auto l = unique(a.begin(), a.end());
  for(auto i = a.begin(); i < l; i++) {
    int p = 0;
    for(int j = 0; j < n; j++)
      if(*i == s.at(j))
        p++;
    for(int j = 0; j < m; j++)
      if(*i == t.at(j))
        p--;
    o = max(o, p);
  }
  cout << o << endl;
}

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

int main(){
  string s;
  cin >> s;
  rep(i,s.size()){
    if(s[i]=='a'||s[i]=='e'||s[i]=='i'||s[i]=='o'||s[i]=='u'){
      cout << "vowel" << endl;
      return 0;;
    }
  }
  cout << "consonant" <<endl;
  return 0;

}


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

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

using namespace std;
typedef long long ll;
typedef pair<int, int> pint;

constexpr int INF = 1 << 30;
constexpr ll LINF = 1LL << 60;
constexpr int MOD = 1e9 + 7;

constexpr int MAX = 110000;
ll fac[MAX], finv[MAX], inv[MAX];

void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; ++i) {
        fac[i] = fac[i-1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD/i) % MOD;
        finv[i] = finv[i-1] * inv[i] % MOD;
    }
}

ll nCk(int n, int k) {
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n-k] % MOD) % MOD;
}

int main() {
    int n, k; cin >> n >> k;
    vector<ll> a(n); rep(i, n) cin >> a[i];
    sort(a.begin(), a.end());

    COMinit();

    map<int, int> mp;
    rep(i, n) mp[a[i]]++;

    int i = 0;
    ll max_x_sum = 0;

    while (i < n) {
        int cnt = mp[a[i]];
        for (int j = 1; j <= cnt; j++) {
            max_x_sum += a[i] * nCk(cnt, j) % MOD * nCk(i, k-j) % MOD;
            max_x_sum %= MOD;
        }
        i += cnt;
    }

    ll min_x_sum = 0;
    sort(a.rbegin(), a.rend());
    i = 0;
    while (i < n) {
        int cnt = mp[a[i]];
        for (int j = 1; j <= cnt; j++) {
            min_x_sum += a[i] * nCk(cnt, j) % MOD * nCk(i, k-j) % MOD;
            min_x_sum %= MOD;
        }
        i += cnt;
    }

    cout << (max_x_sum - min_x_sum + MOD) % MOD << endl;

    return 0;
}


    


Measured memory_bytes: 7936
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
int main()
{
    ll n,k;
    cin>>n>>k;
    ll a[100005],i,j;
    a[0]=0;
    for(i=1;i<=n;i++)
    cin>>a[i];
    ll dp[100005]={0};
    dp[1]=0;
    dp[2]=abs(a[2]-a[1]);
    for(i=3;i<=n;i++)
    {
        dp[i]=INT_MAX;
        for(j=i-1;j>=i-k;j--)
        {
            if(j>0)
            {
                dp[i]=min(dp[i],abs(a[i]-a[j])+dp[j]);
            }
        }
    }
    /*for(i=1;i<=n;i++)
    cout<<dp[i]<<" ";*/
    cout<<dp[n]<<"\n";
    return 0;
}


Measured memory_bytes: 1792
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#include <numeric>
typedef long long Int;
#define rep(i,a,b) for(Int i=a;i<b;++i)
#define rrep(i,a,b) for(Int i=a;i>=b;--i)
using namespace std;

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

    Int N; cin >> N;
    if (N == 1) cout << "Hello World" << endl;
    else {
        Int A, B; cin >> A >> B;
        cout << A+B << endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
using ld = long double;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define FORR(i, m, n) for (int i = (m); i >= (n); i--)
#define REP(i, n) FOR(i, 0, (n))
#define REPR(i, n) FORR(i, (n) - 1, 0)
#define REP1(i, n) FOR(i, 1, (n) + 1)
#define REPS(c, s) for (char c : s)
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REV(c) reverse(ALL(c))
#define sz(v) (int)v.size()
#define endl '\n'
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
template<class T> inline void printv(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << (i == n - 1 ? endl : ' ');}
const int MOD = 1000000007;
const int INF = 1000000001;
const ll LINF = 1000000001000000001LL;
 
void solve();
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(numeric_limits<double>::max_digits10);
    solve();
    return 0;
}

class Combination {
    vector<ll> factorial;
    vector<ll> fact_inverse;
    vector<ll> inverse;
    int mod;

    void init(int size) {
        factorial[0] = 1;
        factorial[1] = 1;
        fact_inverse[0] = 1;
        fact_inverse[1] = 1;
        inverse[1] = 1;

        for (int i = 2; i < size; i++) {
            factorial[i] = factorial[i - 1] * i % mod;
            inverse[i] = mod - inverse[mod % i] * (mod / i) % mod;
            fact_inverse[i] = fact_inverse[i - 1] * inverse[i] % mod;
        }
    }

    public:
        Combination(int size, int m) {
           factorial = vector<ll>(size);
           fact_inverse = vector<ll>(size);
           inverse = vector<ll>(size);
           mod = m;
           init(size);
        }
    
        ll calc(int n, int k) {
            if (n < k) {
                return 0;
            }
            if (n < 0 || k < 0) {
                return 0;
            }
            return factorial[n] * (fact_inverse[k] * fact_inverse[n - k] % mod) % mod;
        }

        // i.e. nHk
        ll with_repetition(int n, int k) {
            return calc(n + k - 1, k);
        }
};

void solve() {
    int n, k;
    cin >> n >> k;
    Combination c(200200, MOD);
    ll ans = 0;
    REP(i, min(n - 1, k) + 1) {
        ans += (c.with_repetition(n - i, i) * c.calc(n, i)) % MOD;
        ans %= MOD;
    }
    cout << ans << endl;
}


Measured memory_bytes: 4992
#include<bits/stdc++.h>
#define IOS ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define endl "\n"
#define pb push_back
#define mp make_pair
#define int long long
#define mod 1000000007
#define DEBUG cout<<"Hello1\n";
#define all(v) (v).begin(),(v).end()
#define clr(x) memset(x,0,sizeof(x))
#define deb(...) debug(#__VA_ARGS__, __VA_ARGS__);
const int N = 1e6 + 5;
const double pi =  acosl(-1);
const long long inf = 1e18 + 5;
using namespace std;
template<typename T> void debug(string s, T x)
{
	cout << s << " = " << x << "\n";
}
template<typename T, typename... Args> void debug(string s, T x, Args... args)
{
	cout << s.substr(0, s.find(',')) << " = " << x << " | ";
	debug(s.substr(s.find(',') + 2), args...);
}
template<class T> void print_container(T &container)
{
	for (auto &t : container)
	{
		cout << t << " ";
	}
	cout << endl;
}
template<class T> void print_pair_container(T &container)
{
	for (auto &t : container)
	{
		cout << t.first << " " << t.second << endl;
	}
	cout << endl;
}
template<class T> void printArr(T &a, int n)
{
	for (int i = 0; i < n; i++)
	{
		cout << a[i] << " ";
	}
	cout << endl;
}
typedef long long ll;
typedef pair<int, int> pii;

//Template Ends
int n;
double d, t, s;
void solve()
{
	cin >> d >> t >> s;

	if (t >= d / s) {
		cout << "Yes";
	} else {
		cout << "No";
	}
}

int32_t main()
{
	IOS;

	solve();

	return 0;
}




Measured memory_bytes: 3712
import itertools as itr
n, a, b, c = list(map(int, input().split()))
abc = [a, b ,c]
l = [int(input()) for _ in range(n)]
ans = float('inf')
for i in list(itr.product([0, 1, 2, 3], repeat=n)):
    tans = 0
    pd = [True]*3
    tabc = abc.copy()
    if 0 not in i or 1 not in i or 2 not in i:
        continue
    for j in range(len(i)):
        if i[j] != 3:
            tabc[i[j]] -= l[j]
            if pd[i[j]]:
                pd[i[j]] = False
            else:
                tans += 10
    for k in tabc:
        tans += abs(k)
    ans = min(ans, tans)
print(ans)

Measured memory_bytes: 10996
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
const ll MAXN=1e5+69;
ll n,m;
string s;
ll L[MAXN];
void bye(){
    cout<<-1;
    exit(0);
}
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    cin>>n>>m>>s;
    if(s[0]=='1'||s[n]=='1')bye();
    deque<ll>dq={0};
    for(ll i=1;i<=n;i++){
        if(s[i]=='1')continue;
        while(!dq.empty()&&i-dq.front()>m)dq.pop_front();
        if(dq.empty())bye();
        L[i]=dq.front();
        dq.push_back(i);
    }
    ll id=n;
    vector<ll>ans;
    while(id>0){
        ans.push_back(id-L[id]);
        id=L[id];
    }
    while(!ans.empty())cout<<ans.back()<<' ',ans.pop_back();
}

Measured memory_bytes: 5224
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	string s;cin >> s;
	string dream="maerd",dreamer="remaerd",erase="esare",eraser="resare";
	reverse(s.begin(),s.end());
	int i=0,len=s.size();
	while(i<len){
		if(i+5<=len){
			if(s.substr(i,5)==dream || s.substr(i,5)==erase){
				i+=5;
				continue;
			}
		}
		if(i+6<=len){
			if(s.substr(i,6)==eraser){
				i+=6;
				continue;
			}
		}
		if(i+7<=len){
			if(s.substr(i,7)==dreamer){
				i+=7;
				continue;
			}
		}
		cout << "NO" << endl;
		return 0;
	}
	cout << "YES" << endl;
}

Measured memory_bytes: 512
# import
import itertools

# input
S = input()
SS = []
CC = []

# LRの間でスライスして文字列に追加
p_cut = 0

for i in range(len(S) -1) : 
    if i == len(S) -2: 
        SS.append(S[p_cut:i+2])
    
    elif S[i] == "L" and S[i+1] == "R" : 
        SS.append(S[p_cut:i+1])
        p_cut = i+1
        
# CCの作成
CC = [[0 for _ in range(len(SS[i]))] for i in range(len(SS))]

# other_setting
for i in range(len(SS)) : 
    cnt_R = 0
    cnt_L = 0

    for j in range(len(SS[i])) : 
        if SS[i][j] == "R" : 
            cnt_R += 1
        else : 
            point_R = j-1
            point_L = j
            break
        
    cnt_L = len(SS[i]) -cnt_R
    # print(i, cnt_R, cnt_L)
    
    if cnt_R % 2 == 0 and cnt_L % 2 == 0 : 
        CC[i][point_R] = int((cnt_R+cnt_L)/2)
        CC[i][point_L] = int((cnt_R+cnt_L)/2)
    elif cnt_R % 2 == 0 and cnt_L % 2 == 1 : 
        CC[i][point_R] = int(cnt_R/2 + cnt_L - ((cnt_L + 1)/2))
        CC[i][point_L] = int(cnt_R/2 + ((cnt_L + 1)/2))
    elif cnt_R % 2 == 1 and cnt_L % 2 == 0 : 
        CC[i][point_R] = int(cnt_L/2 + ((cnt_R + 1)/2))
        CC[i][point_L] = int(cnt_L/2 + cnt_R - ((cnt_R + 1)/2))
    elif cnt_R % 2 == 1 and cnt_L % 2 == 1 : 
        CC[i][point_R] = int((cnt_R+cnt_L)/2)
        CC[i][point_L] = int((cnt_R+cnt_L)/2)

# # confirm
# print(SS)
# print(CC)

# output
print(*list(itertools.chain.from_iterable(CC)))

Measured memory_bytes: 60252
#include<bits/stdc++.h>
using namespace std;
#ifdef LOCAL_DEBUG
  #include "LOCAL_DEBUG.hpp"
#endif
#define int long long

signed main(){

  int n; cin >> n;

  string t[3] = {"Male", "Female", "Vacant"};
  vector<string> s(n);
  cout << 0 << endl;
  cin >> s[0];
  if(s[0] == t[2]){
    cout << 0 << endl;
    return 0;
  }

  int left = 0, right = n-1;
  while(right - left > 1){
    int mid = (left + right) / 2;
    cout << mid << endl;
    cin >> s[mid];
    if(s[mid] == t[2]) return 0;
    if((mid - left + 1) % 2 == 0){
      if(s[left] != s[mid]){
        left = mid;
      }else {
        right = mid;
      }
    }else {
      if(s[left] == s[mid]){
        left = mid;
      }else {
        right = mid;
      }
    }
  }
  cout << right << endl;

  return 0;
}


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

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

  for (int i = 1; i <= 9; i++) {
    for (int j = 1; j <= 9; j++) {
      if (i * j == N) {
        cout << "Yes" << endl;
        return 0;
      }
    }
  }
  cout << "No" << endl;
  return 0;
}

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

#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i <= n; i++)
#define FORR(i, m, n) for(int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define VSORTR(v) sort(v.rbegin(), v.rend());
#define ALL(v) (v).begin(),(v).end()
using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;
const ll mod = 1e9+7;


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

    string s;cin>>s;
    ll l = s.size();
    map<char, int>mp;
    REP(i,l){
        mp[s[i]]++;
    }
    for(auto p:mp){
        if (p.second!=2){
            cout<<"No"<<endl;
            return 0;
        }

    }
    cout<<"Yes"<<endl;
    return 0;
}

Measured memory_bytes: 256