akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll inf=1000000000000000ll;
#define N 100010
int i,j,k,n,m,x,y,s,t;
int fi[N*2],ne[N*2],la[N*2],a[N*2],c1[N*2],c2[N*2],b[N];
ll d1[N],d2[N];
queue<int>q;
int read(){
	int x=0,f=1;
	char ch=getchar();
	while (ch<'0'||ch>'9'){f=ch=='-'?-f:f;ch=getchar();}
	while (ch>='0'&&ch<='9'){x=x*10+ch-48;ch=getchar();}
	return x*f;
}
void add(int x,int y,int t1,int t2){
	k++;a[k]=y;c1[k]=t1;c2[k]=t2;
	if (fi[x]==0)fi[x]=k;else ne[la[x]]=k;
	la[x]=k;
}
void spfa1(){
	for (i=1;i<=n;i++)d1[i]=inf;d1[s]=0;
	q.push(s);
	while (!q.empty()){
		x=q.front();b[x]=0;q.pop();
		for (int i=fi[x];i;i=ne[i])
			if (d1[a[i]]>d1[x]+c1[i]){
				d1[a[i]]=d1[x]+c1[i];
				if (!b[a[i]]){
					b[a[i]]=0;q.push(a[i]);
				}
			}
	}
}
void spfa2(){
    for (i=1;i<=n;i++)d2[i]=inf;d2[t]=0;
    q.push(t); 
    while (!q.empty()){ 
        x=q.front();b[x]=0;q.pop();
        for (int i=fi[x];i;i=ne[i])
            if (d2[a[i]]>d2[x]+c2[i]){
                d2[a[i]]=d2[x]+c2[i]; 
                if (!b[a[i]]){
                    b[a[i]]=0;q.push(a[i]); 
                } 
            } 
    } 
}
ll ans[N];
int main(){
	n=read();m=read();s=read();t=read();
	while (m--){
		int t1,t2;
		x=read();y=read();t1=read();t2=read();
		add(x,y,t1,t2);add(y,x,t1,t2);
	}
	spfa1();spfa2();
	for (i=n;i>=1;i--)ans[i]=max(ans[i+1],inf-d1[i]-d2[i]);
	for (i=1;i<=n;i++)printf("%lld\n",ans[i]);
	return 0;
}


Measured memory_bytes: 8832
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <bitset>
#include <map>
#include <tuple>
#include <unordered_set>
#include <unordered_map>
#include <list>
#include <numeric>
#include <utility>
#include <iterator>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <ctime>
#include <cassert>
#include <random>
#include <cstring>

#define rep(i,n) for(int i=0;i<int(n);i++)
#define all(x) (x).begin(),x.end()
#define pb push_back

using namespace std;
using ll = long long;

const ll mod = 1000000007;

int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
int ddx[8]={-1,-1,0,1,1,1,0,-1};
int ddy[8]={0,1,1,1,0,-1,-1,-1};
// bool debug=false;

/*---------------------------------------------------*/

int main() {
  int N, D;
  cin >> N >> D;
  cout << N / (2 * D + 1) + bool(N % (2 * D + 1)) << endl;
  return 0;
}


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

int main(){
    int n,k;
    string s;
    cin >> n >> s >> k;
    char c = s[k - 1];
    for (int i = 0; i < n; i++) {
        if (s[i] != c)
            s[i] = '*';
    }
    cout << s << endl;
}

Measured memory_bytes: 256
#pragma GCC optimize("O3")
#include <bits/stdc++.h>

using namespace std;

typedef int64_t  ll;
typedef uint64_t ull;
#define rep(i,n) for (int i = 0; i < (n); i++)

int n;
int main(void) {
    cin >> n;
    cout << n*n*n << endl;
    return 0;
}


Measured memory_bytes: 384
#include <iostream>
using namespace std;
//nullptrはc++11以降
struct Node
{
    int key;
    Node *parent, *right, *left;
};

//Node *NIL;
Node *root;

/*void Insert(int key)
{
    Node *y = NIL; //親
    Node *x = root;
    Node *z = new Node;
    z->key = key;
    z->right = NIL;
    z->left = NIL;

    //rootもNILも初めはnullptr
    while (x != NIL)
    {
        y = x;
        if (z->key < x->key)
        {
            x = x->left;
        }
        else
        {
            x = x->right;
        }
    }

    z->parent = y;

    if (y == NIL)
    {
        root = z;
    }
    else if (z->key < y->key)
    {
        y->left = z;
    }
    else
    {
        y->right = z;
    }
}*/

void Insert(int key)
{
    Node *y = nullptr;
    Node *x = root;
    Node *z = new Node;
    z->key = key;

    while (x != nullptr)
    {
        y = x;
        if (z->key < x->key)
        {
            x = x->left;
        }
        else
        {
            x = x->right;
        }
    }

    z->parent = y;
    if (z->parent == nullptr)
    {
        root = z;
    }
    else if (z->key < y->key)
    {
        y->left = z;
    }
    else
    {
        y->right = z;
    }
}

void inorder(Node *u)
{
    if (u == nullptr)
    {
        return;
    }
    inorder(u->left);
    cout << ' ' << u->key;
    inorder(u->right);
}

void preorder(Node *u)
{
    if (u == nullptr)
    {
        return;
    }
    cout << ' ' << u->key;
    preorder(u->left);
    preorder(u->right);
}

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

    int n, k;
    string com;

    cin >> n;
    for (int i = 0; i < n; i++)
    {
        cin >> com;
        if (com == "insert")
        {
            cin >> k;
            Insert(k);
        }
        else if (com == "print")
        {
            inorder(root);
            cout << endl;
            preorder(root);
            cout << endl;
        }
    }

    return 0;
}


Measured memory_bytes: 26624
#include <iostream>
#include <math.h>
#include <numeric>
#include <vector>
#include <map>
#include <algorithm>
#include <queue>
#include <tuple>
#include <functional>

#define PI 3.14159265359
#define INF 100100100100100100
#define rep(i,n) for(int i = 0; i < n; i++)
#define rep2(i,a,n) for(int i = a; i < n; i++)
#define in(a) cin >> a
#define out(a) cout << a << endl

using namespace std;

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

int main() 
{
    int k, n; cin >> n >> k;
    vector<int> a(n);
    int ans = 0;
    
    rep(i,n) { cin >> a[i]; }
    
    cout << ((n-1)+(k-2))/(k-1) << endl;

    return 0;
}




Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long

const int N = 3005;
const int MOD = 998244353;

int n, s;
int a[N], cache[N][N];

template <typename T>
T modpow(T base, T exp, T modulus) {
  base = base % modulus;
  T result = 1;
  while (exp > 0) {
    if (exp % 2 == 1) 
    	result = (result * base) % modulus;
    base = (base * base) % modulus;
    exp = exp/2;
  }
  return result;
}

int dp(int idx, int s)
{
	if(s == 0)
		return modpow(2LL,n - idx + 1,MOD);
	if(s < 0)
		return 0;
	if(idx > n)
		return 0;
	int &ans = cache[idx][s];
	if(ans != -1)
		return ans;
	ans = 2 * dp(idx + 1, s) + dp(idx + 1, s - a[idx]);
	ans %= MOD;
	return ans;
}

int32_t main()
{
	IOS;
	memset(cache, -1, sizeof(cache));
	cin >> n >> s;
	for(int i = 1; i <= n; i++)
		cin >> a[i];
	int ans = 0;
	for(int i = 1; i <= 1; i++)
		ans += dp(i, s);
	ans %= MOD;
	cout << ans;
	return 0;
}

Measured memory_bytes: 74408
n, m, q = map(int, input().split())
lst = [[0 for j in range(n)] for i in range(n+1)]
for i in range(m):
    li, ri = map(int, input().split())
    ri -= 1
    lst[li][ri] += 1
query = []
for i in range(q):
    pi, qi = map(int, input().split())
    pi -= 1; qi -= 1
    query.append([pi, qi])

for i in range(n):
    for j in range(n):
        lst[i+1][j] += lst[i][j]

for pi, qi in query:
    ans = 0
    for i in range(pi, qi+1):
        ans += lst[qi+1][i] - lst[pi][i]
    print(ans)

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

if C%B == 0:
    tak = C//B
else:
    tak = C//B + 1
if A%D == 0:
    aok = A//D
else:
    aok = A//D + 1

if tak <= aok:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 9180
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<set>
#include<map>
#include<queue>
#define REP(i,a) for (int i = 0;i < (a);++i)
#define FOR(i,a,b) for (int i = (a);i < (b); ++i)
#define FORR(i,a,b) for (int i = (a);i >= (b); --i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SORT(list) sort(ALL((list)));
#define MOD 1000000007
using namespace std;
using ll = long long;
int main(){
    string a,b,c;
    cin >> a >> b >> c;
    cout << "A" << b[0] << "C" << endl;
    return 0;
}

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

//#define int long long
#define DBG 1
#define dump(o) if(DBG){cerr<<#o<<" "<<o<<endl;}
#define dumpc(o) if(DBG){cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define each(it,c) for(auto it=(c).begin();it!=(c).end();it++)
#define all(c) c.begin(),c.end()
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9 + 7);

signed main() {
	char c; cin >> c;
	if (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u') {
		cout << "vowel" << endl;
	}
	else cout << "consonant" << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define LL long long
#define clr(x,i) memset(x,i,sizeof(x))
using namespace std;
const int N=200005;
const LL inf=1e17;
int n;
LL a[N],sum[N],v[5],fl[N],fr[N];
LL getv(LL x1,LL x2,LL x3,LL x4)
{
	v[0]=x1; v[1]=x2; v[2]=x3; v[3]=x4;
	sort(v,v+4);
	return v[3]-v[0];
}
LL getsum(int l,int r)
{
	return sum[r]-sum[l-1];
}
void getp()
{
	LL s0=0;
	for(int r=2,l=1;r<=n-2;r++){
		while(l<r&&abs( getsum(1,l+1)-getsum(l+2,r) )<abs( getsum(1,l)-getsum(l+1,r) )) 
		  l++;
		fl[r]=l;
	}
	for(int l=n-1,r=n;l>=3;l--){
		while(r>l&&abs( getsum(l,r-2)-getsum(r-1,n) )<abs( getsum(l,r-1)-getsum(r,n) )) 
		  r--;
		fr[l]=r;
	}
//	for(int i=1;i<=n;i++) cout<<fl[i]<<' '; cout<<endl;
//	for(int i=1;i<=n;i++) cout<<fr[i]<<' '; cout<<endl;
}
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	  scanf("%lld",&a[i]),sum[i]=sum[i-1]+a[i];
	getp();
	LL ans=inf;
	for(int i=2;i<=n-2;i++){
		int j=i+1,pl=0,pr=0;
		pl=fl[i]; pr=fr[i+1]-1;
//		pl=lower_bound(sum+1,sum+i+1,xl)-sum;
		/*
		LL now=inf;
		for(int k=1;k<i;k++)
		  if(abs(sum[k]-(sum[i]-sum[k]))<now)
		    now=abs(2*sum[k]-sum[i]),pl=k;
		now=inf;
		for(int k=j;k<n;k++)
		  if(abs((sum[k]-sum[i])-(sum[n]-sum[k]))<now)
		    now=abs(2*sum[k]-sum[i]-sum[n]),pr=k;*/ 
		LL v1=sum[pl],v2=sum[i]-sum[pl],v3=sum[pr]-sum[i],v4=sum[n]-sum[pr];
//		cout<<i<<' '<<pl<<' '<<pr<<"  "<<v1<<' '<<v2<<' '<<v3<<' '<<v4<<endl;
		ans=min(ans,getv(v1,v2,v3,v4));
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 6528
def rec(a, s, e, dp, ss):
    if dp[s][e] > 0:
        return dp[s][e]

    if e - s == 1:
        dp[s][e] = 0
        return 0
    
    cur_min = float('inf')
    for i in range(s + 1, e):
        lc = rec(a, s, i, dp, ss)
        rc = rec(a, i, e, dp, ss)
        test = lc + rc + ss[s][e]
        if test < cur_min:
            cur_min = test
    dp[s][e] = cur_min
    return cur_min


def submit():
    n = int(input())
    a = list(map(int, input().split()))
    dp = [[0 for _ in range(n + 1)] for _ in range(n + 1)]
    ss = [[0 for _ in range(n + 1)] for _ in range(n + 1)]

    for i in range(n + 1):
        for j in range(i, n + 1):
            ss[i][j] = sum(a[i:j])
    
    print(rec(a, 0, n, dp, ss))


submit()

Measured memory_bytes: 47836
import scala.io.{StdIn => in}

object Main extends App {
  var Array(a, b) = in.readLine.split(" ").map(_.toInt)

  def Buttons(a:Int, b:Int) = {
    var acc = 0
    var b1 = a
    var b2 = b
    (cnt:Int) => {
      for(i <- 0 until cnt) {
        if(b1 > b2) {
          acc += b1
          b1 -= 1
        }
        else {
          acc += b2
          b2 -= 1
        }
      }
      acc
    }
  }

  val push = Buttons(a, b)

  val ans = push(2)
  println(ans)
}

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

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

using namespace std;
using lint=long long;

int main(){
	int n,k; cin>>n>>k;
	lint ans=0;
	for(int a=1;a<=min(n,k);a++) if(2*a%k==0) {
		lint x=(n-a+k)/k;
		ans+=x*x*x;
	}
	cout<<ans<<endl;

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll read(){
	ll a=0,b=getchar(),c=1;
	while(!isdigit(b))c=b=='-'?-1:1,b=getchar();
	while(isdigit(b))a=a*10+b-'0',b=getchar();
	return a*c;
}
int k,a,b;
int main(){
	cin >> k >> a >> b;
	for(int i=a;i<=b;i++)
		if(i%k==0)return puts("OK"),0;
	puts("NG");
	return 0;
}

Measured memory_bytes: 3632
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func Scan() string {
	sc.Scan()
	return sc.Text()
}
func iScan() int {
	n, _ := strconv.Atoi(Scan())
	return n
}
func fScan() float64 {
	n, _ := strconv.ParseFloat(Scan(), 64)
	return n
}
func stringToInt(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}
func SScan(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = Scan()
	}
	return a
}
func iSScan(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = iScan()
	}
	return a
}
func abs(x int) int {
	if x < 0 {
		x = -x
	}
	return x
}
func larger(a, b int) int {
	if a < b {
		return b
	} else {
		return a
	}
}
func smaller(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}
func max(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x < a[i] {
			x = a[i]
		}
	}
	return x
}
func min(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x > a[i] {
			x = a[i]
		}
	}
	return x
}
func sum(a []int) int {
	x := 0
	for _, v := range a {
		x += v
	}
	return x
}

var mod int = 1000000007

func main() {
	buf := make([]byte, 0)
	sc.Buffer(buf, mod)
	sc.Split(bufio.ScanWords)
	t1, t2 := iScan(), iScan()
	a1, a2 := iScan(), iScan()
	b1, b2 := iScan(), iScan()
	d1 := a1*t1 - b1*t1
	d2 := (a1*t1 + a2*t2) - (b1*t1 + b2*t2)
	if d2 == 0 {
		fmt.Println("infinity")
	} else if (d2 > 0 && d1 > 0) || (d2 < 0 && d1 < 0) {
		fmt.Println(0)
	} else {
		d1, d2 = abs(d1), abs(d2)
		ans := d1/d2*2 + 1
		if d1%d2 == 0 {
			ans--
		}
		fmt.Println(ans)
	}
}


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

#define mod      1e9+7;
#define INF      1e9+9;
#define ps(x,y)  fixed<<setprecision(y)<<x
# define PI 3.14159265358979323846264338327950 L
typedef long long ll;
typedef unsigned long long ull;
int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
#endif
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	cout<<max(a*b,c*d)<<endl;

	return 0;
}

Measured memory_bytes: 3684
N,K=map(int,input().split())
R,S,P=map(int,input().split())
T=list(input())
for i in range(N-K):
    if T[K+i]==T[i]:
        T[K+i]=""
ans=T.count("r")*P+T.count("s")*R+T.count("p")*S
print(ans)

Measured memory_bytes: 4084
#include <cstdio>

#define MAX 10000
#define NIL -1
struct Node { int parent, left, right; };
Node T[MAX]; int n, D[MAX], H[MAX];

void setDepth(int u, int d) {
    if(u == NIL) return;
    D[u] = d;
    setDepth(T[u].left, d+1);
    setDepth(T[u].right, d+1);
}

int setHeight(int u) {
    int h1 = 0, h2 = 0;
    if(T[u].left != NIL) h1 = setHeight(T[u].left)+1;
    if(T[u].right != NIL) h2 = setHeight(T[u].right)+1;
    return H[u] = h1>h2?h1:h2;
}

int getSibling(int u) {
    if(T[u].parent == NIL) return NIL;
    if(T[T[u].parent].left!=u && T[T[u].parent].left!=NIL) return T[T[u].parent].left;
    if(T[T[u].parent].right!=u && T[T[u].parent].right!=NIL) return T[T[u].parent].right;
    return NIL;
}

void print(int u) {
    printf("node %d: parent = %d, sibling = %d, ", u, T[u].parent, getSibling(u));
    int deg = 0;
    if(T[u].left != NIL) ++deg;
    if(T[u].right != NIL) ++deg;
    printf("degree = %d, depth = %d, height = %d, ", deg, D[u], H[u]);
    if(T[u].parent == NIL) printf("root\n");
    else if(T[u].left==NIL && T[u].right==NIL) printf("leaf\n");
    else printf("internal node\n");
}

int main()
{
    #ifdef LOCAL
        freopen("E:\\Temp\\input.txt", "r", stdin);
        freopen("E:\\Temp\\output.txt", "w", stdout);
    #endif

    int i, v, l, r, root = 0;
    scanf("%d", &n);
    for(i=0; i<n; ++i) T[i].parent = NIL;
    for(i=0; i<n; ++i) {
        scanf("%d%d%d", &v, &l, &r);
        T[v].left = l, T[v].right = r;
        if(l != NIL) T[l].parent = v;
        if(r != NIL) T[r].parent = v;
    }

    for(i=0; i<n; ++i)
        if(T[i].parent == NIL) root = i;
    setDepth(root, 0); setHeight(root);

    for(i=0; i<n; ++i) print(i);

    return 0;
}


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

map<char, int> dict;

void init() {
  dict = map<char, int>();
  dict['m'] = 1000;
  dict['c'] = 100;
  dict['x'] = 10;
  dict['i'] = 1;
  
}

int MCXItoInt(string mcxi) {
  int num = 0;
  int i = 1;
  for (auto c : mcxi) {
    if (isdigit(c)) i = atoi(&c);
    else {
      num += dict[c] * i;
      i = 1;
    }
  }

  return num;
}

string InttoMCXI(int num) {
  string mcxi;
  char chars[] = {'m', 'c', 'x', 'i'};
  int div = 1000;
  
  for (int i = 0; i < 4; ++i) {
    auto f = (num / div) % 10;
    if (f > 1) mcxi += to_string(f) + chars[i];
    else if (f == 1) mcxi += chars[i];
    div /= 10;
  }

  return mcxi;
}

string solve(string s1, string s2) {
  auto n1 = MCXItoInt(s1);
  auto n2 = MCXItoInt(s2);
  return InttoMCXI(n1 + n2);
}

int main() {
  init();

  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    string s1, s2;
    cin >> s1 >> s2;
    cout << solve(s1, s2) << endl;
  }
  
  return 0;
}


Measured memory_bytes: 3240
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = pow(10, 9) + 7;
//const ll MOD = 998244353;
//const ll MOD = ;
ll mod(ll A, ll M) {return (A % M + M) % M;}
const ll INF = 1LL << 60;
template<class T> bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
ll divceil(ll A, ll B) {return (A + (B - 1)) / B;}
ll myctoi(char C) {return C - '0';}
char myitoc(ll N) {return '0' + N;}
#define FINALANS(A) {cout << (A) << endl; exit(0);}

int main()
{
  ll N;
  cin >> N;
  multiset<ll, greater<ll>> S;
  for (ll i = 0; i < 1LL << N; i++)
  {
    ll s;
    cin >> s;
    S.emplace(s);
  }

  vector<ll> T = {*S.begin()};
  S.erase(S.begin());
  //cerr << T.front() << endl;
  for (ll i = 0; i < N; i++)
  {
    for (ll j = 0; j < (1LL << i); j++)
    {
      auto itr = S.lower_bound(T.at(j) - 1);
      if (itr == S.end())
        FINALANS("No");
      //cerr << T.at(j) << " " << *itr << " " << S.size() << endl;
      T.push_back(*itr);
      S.erase(itr);
    }
  }
  FINALANS("Yes");
}

Measured memory_bytes: 14840
#include <stdio.h>

int main(void)
{
	int i,A[3],max,min,ans;
	
	for(i = 0; i < 3; i++)
	{
		scanf("%d", &A[i]);
	}
	
	max = A[0];
	min = A[2];
	
	for(i = 0; i < 3; i++)
	{
		if(A[i] > max){
			max = A[i];
		}else if(A[i] < min){
			min = A[i];
		}
	}
	
	ans = max - min;
	printf("%d",ans);
	
	return 0;
}


Measured memory_bytes: 128
import sys
read = sys.stdin.readline
import time
from heapq import heappush, heappop, heapify
import math
import itertools as it
from collections import deque 


def inp():
    return int(input())
def inpl():
    return list(map(int, input().split()))
start_time = time.perf_counter()
# ------------------------------

d, t, s = inpl()
if d <= t * s:
    print('Yes')
else:
    print('No')

# -----------------------------
end_time = time.perf_counter()
print('time:', end_time-start_time, file=sys.stderr)



Measured memory_bytes: 9472
N = int(input())

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

Wt1 = Weight
Wt2 = list(reversed(Weight))

ans = 100000

for T in range(N):

    sum1 = 0
    sum2 = 0
    for t in range(T):
        sum1 += Wt1[t]

    for tt in range(N - T):
        sum2 += Wt2[tt]

    dd = abs(sum1 - sum2)
    if ans > dd:
        ans = dd

print(ans)


Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <vector>
#include <complex>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <bitset>
#include <ctime>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cassert>
#include <cstddef>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <sstream>
#include <fstream>

using namespace std;
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define FOR(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define RREP(i, a) for(int (i) = (a) - 1; (i) >= 0; (i)--)
#define FORR(i, a, b) for(int (i) = (a) - 1; (i) >= (b); (i)--)
#define DEBUG(C) cerr << #C << " = " << C << endl;
using LL = long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<LL>;
using VVL = vector<VL>;
using VD = vector<double>;
using VVD = vector<VD>;
using PII = pair<int, int>;
using PDD = pair<double, double>;
using PLL = pair<LL, LL>;
using VPII = vector<PII>;
#define ALL(a) begin((a)), end((a))
#define RALL(a) rbegin((a)), rend((a))
#define SORT(a) sort(ALL((a)))
#define RSORT(a) sort(RALL((a)))
#define REVERSE(a) reverse(ALL((a)))
#define MP make_pair
#define FORE(a, b) for (auto &&a : (b))
#define FIND(s, e) ((s).find(e) != (s).end())
#define EB emplace_back

const int INF = 1e9;
const int MOD = INF + 7;
const LL LLINF = 1e18;

int main(void) {
    string s; cin >> s;
    int cnt = 0;
    char now = s[0];
    FOR(i, 1, s.length()) {
        if (now != s[i]) {
            now = s[i];
            cnt++;
        }
    }
    cout << cnt << endl;
}


Measured memory_bytes: 512
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
#define ll long long
using namespace std;
const ll INF=9999999999999LL;
const int maxn=200050;
ll a[maxn],pre[maxn];
int n;
inline ll q(int l,int r){
	return pre[r]-pre[l-1];
}
int main(){
	scanf("%d",&n);
	for(register int i=1;i<=n;i++){
		scanf("%lld",&a[i]);
		pre[i]=a[i]+pre[i-1];
	}
	ll ans=INF;
	int j1=1,j2=3;
	for(register int i=2;i<n-1;i++){
		ll cha1=abs(q(1,j1)-q(j1+1,i)),cha2=abs(q(i+1,j2)-q(j2+1,n));
		while(j1<i&&abs(q(1,j1+1)-q(j1+2,i))<cha1){
			cha1=abs(q(1,j1+1)-q(j1+2,i));
			j1++;
		}
		while(j2<n&&abs(q(i+1,j2+1)-q(j2+2,n))<cha2){
			cha2=abs(q(i+1,j2+1)-q(j2+2,n));
			j2++;
		}
		ll m1=max(q(1,j1),q(j1+1,i)),m2=max(q(i+1,j2),q(j2+1,n));
		ll mm1=min(q(1,j1),q(j1+1,i)),mm2=min(q(i+1,j2),q(j2+1,n));
		ll ma=max(m1,m2),mi=min(mm1,mm2);
		ans=min(ans,(ma-mi));
		//cout<<i<<' '<<j1<<' '<<j2<<endl;
		//cout<<ma<<' '<<mi<<endl;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
#define intMax 2147483647
#define rep(i, a, b) for (long long i = a; i < b; i++)
#define repp(i, a, b) for (long long i = a; i >= b; i--)
#define be(a) (a.begin(), a.end())
#define rbe(p) (p.rbegin(), p.rend())
#define pb push_back
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n, m;
    cin >> n >> m;
    vector<vector<int>> A(n);
    rep(i, 0, n)
    {
        rep(j, 0, m)
        {
            int a;
            cin >> a;
            A[i].pb(a);
        }
    }
    int ans = 0;
    rep(i, 0, n)
    {
        rep(j, i + 1, n)
        {
            int k = 0;
            rep(l, 0, m)
            {
                k += abs(A[i][l] - A[j][l]) * abs(A[i][l] - A[j][l]);
            }
            if (sqrt(k) == ceil((double)sqrt(k)))
            {
                ans++;
            }
        }
    }
    cout << ans;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std; 
typedef long long ll;
typedef long double ld;
#define fr first
#define sc second
#define pb push_back
const ll mod = 998244353;
const int N = 1e6+205;
void solve(){
	int a,b,t; 
	cin>>a>>b>>t; 
	cout<<(t/a)*b<<endl;
	
}
int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int t=1; 
//	cin>>t; 
	while(t--){
		solve();
	}
	return 0;
}


Measured memory_bytes: 3572
#include <cstdio>
#include <iostream>
#include <cstring>
#include <cstdlib>
#define travel(x, i) for (int i = fir[x]; i; i = e[i].nxt)
using namespace std;

const int N = 1005;

struct edge {
  int nxt, to;
}e[N];
int fir[N], cnt = 0;

int X[N], Y[N];

inline void add(int x, int y) {
  e[++ cnt] = (edge){fir[x], y};
  fir[x] = cnt;
}

inline void dfs(int x) {
  int judge = 0;
  travel(x, i) dfs(e[i].to), judge += min(Y[e[i].to], X[e[i].to]);
  if (judge > X[x]) {
    puts("IMPOSSIBLE");
    exit(0);
  }
  static int dp[2][5005];
  memset(dp[0], 0, sizeof(int) * (X[x] + 2));
  int cur = 0, nxt = 1, y;
  travel(x, i) {
    y = e[i].to;
    nxt = cur ^ 1;
    memset(dp[nxt], 0x7f, sizeof(int) * (X[x] + 2));
    for (int i = 0; i <= X[x]; i ++) {
      if (i + X[y] <= X[x]) dp[nxt][i + X[y]] = min(dp[nxt][i + X[y]], dp[cur][i] + Y[y]);
      if (i + Y[y] <= X[x]) dp[nxt][i + Y[y]] = min(dp[nxt][i + Y[y]], dp[cur][i] + X[y]);
    }
    cur = nxt;
  }
  Y[x] = 1000000;
  for (int i = 0; i <= X[x]; i ++) Y[x] = min(Y[x], dp[cur][i]);
}

int main() {
  int n, x;
  scanf("%d", &n);
  for (int i = 2; i <= n; i ++) {scanf("%d", &x); add(x, i);}
  for (int i = 1; i <= n; i ++) scanf("%d", &X[i]);
  dfs(1);
  puts("POSSIBLE");
  return 0;
}


Measured memory_bytes: 256
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
from bisect import bisect_right, bisect_left
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor, gamma, log
from operator import mul
from functools import reduce
from copy import deepcopy

sys.setrecursionlimit(2147483647)
INF = 10 ** 20
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): pass
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 10 ** 9 + 7

n, k = LI()
H = LI()
dp = [INF] * n
dp[0] = 0
for i in range(1, n):
    min_r = max(i - k, 0)
    for j in range(min_r, i):
        dp[i] = min(dp[i], dp[j] + abs(H[i] - H[j]))

print(dp[-1])

Measured memory_bytes: 98296
use std::str::FromStr;
use std::fmt::Debug;
use std::cmp;

#[allow(dead_code)]
fn read_as_vec<T>() -> Vec<T>
where T: FromStr, <T as FromStr>::Err : Debug{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().split_whitespace().map(|c| T::from_str(c).unwrap()).collect()

}

#[allow(dead_code)]
fn read_as_string() -> String{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

fn main(){
    let n: usize = read_as_vec()[0];
    let a: Vec<f64> = read_as_vec();

    let mut sum: f64 = 0.0;

    for elem in &a{
        sum += 1.0/(*elem);
    }

    println!("{}", 1.0/sum);
 }


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef	long long ll;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef set<int> si;
typedef map<int,int> mii;
typedef map<ll,ll> mll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef pair<ll, pll> plll;
typedef vector<pair<int, pii>> viii;
#define fi first
#define se second
#define pi 3.141592653589793
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define all(v) v.begin(),v.end()
#define tc int tt;cin>>tt;while(tt--)
#define pqmax priority_queue<int>
#define pqmin priority_queue<int,vi,greater<int>>
#define fio ios_base::sync_with_stdio(0), cin.tie(NULL)
#define tc_g int tt;cin>>tt;for(int ti=1;ti<=tt;ti++)
#define case_g "Case #"<<ti<<": "
#define RED "\033[31m"
#define GREEN "\033[32m"
#define RESET "\033[0m"
#define sleep for (int i = 1, a;i < 100000000;i++, a = a * a)
typedef tree<pii, null_type, less<pii>, rb_tree_tag, tree_order_statistics_node_update> ranked_pairset;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ranked_set;
typedef tree<int, int, less<int>, rb_tree_tag, tree_order_statistics_node_update> ranked_map;

int main() {
	fio;
	ll n, x, t;
	cin >> n >> x >> t;
	cout << (n + x - 1) / x * t << '\n';
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
#define int long long
#define uint unsigned int
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPR(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define FORR(i, a, b) for (int i = (a); i >= (b); --i)
#define ALL(a) (a).begin(), (a).end()
#define ALLR(a) (a).rbegin(), (a).rend()
#define SZ(a) ((int)(a).size())
#define PB(a) push_back(a)
#define EMP emplace
#define EMPB(...) emplace_back(__VA_ARGS__)
#define MP(a, b) make_pair(a, b)
#define MT(...) make_tuple(__VA_ARGS__)
#define Bit(n) (1LL << (n))
using namespace std;
using pii = pair<int, int>;
template <class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template <class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
const int MOD = 1000000007;
const int INF = 1LL << 30;
const double EPS = 1e-10;

const int MAX_N = 10000010;
int ext_gcd(int a,int b,int& x,int& y) {
  if(b==0){
    x=1;y=0;return a;
  }
  int q=a/b;
  int g=ext_gcd(b,a-q*b,x,y);
  int z=x-q*y;
  x=y;y=z;
  return g;
}
int inv_mod(int a,int m) {
  int x,y;
  ext_gcd(a,m,x,y);
  x%=m;
  return (m+x%m)%m;
}
int fac[MAX_N],finv[MAX_N],inv[MAX_N];
void make(){
  fac[0]=1%MOD;
  for(int i=1;i<MAX_N;i++)fac[i]=fac[i-1]*i%MOD;
  finv[MAX_N-1]=inv_mod(fac[MAX_N-1],MOD);
  for(int i=MAX_N-2;i>=0;i--)finv[i]=finv[i+1]*(i+1)%MOD;
  for(int i=1;i<MAX_N;i++)inv[i]=finv[i-1]%MOD;
}
int comb(int n, int k) {
  if (n < 0 || k < 0 || n < k) return 0;
  return fac[n]*finv[k]%MOD*finv[n-k]%MOD;
}

map<int, int> prime_factor(int n) {
  map<int, int> res;
  for (int i = 2; i*i <= n; i++) {
    while (n % i == 0) {
      res[i]++;
      n /= i;
    }
  }
  if (n != 1) res[n]++;
  return res;
}

int N, M;

signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  make();
  cin >> N >> M;
  auto mp = prime_factor(M);
  int ans = 1;
  for (auto p : mp) {
    (ans *= comb(N+p.second-1, p.second)) %= MOD;
  }
  cout << ans << endl;

  return 0;
}

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

void solve() {
  int n, k; cin >> n >> k;
  vector<int> a(n);
  for(auto &x : a) cin >> x;
  for(int i=k; i<n; ++i) {
    cout << (a[i-k] < a[i] ? "Yes" : "No") << '\n';
  }
}

signed main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  solve();
  return 0;
}


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

int main() {
    int n; cin >> n;
    vector<int> a(n);

    rep(i, n) {
        cin >> a.at(i);
    }

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

    int ans = 0;
    int sum = 1;
    int chk = a.at(0);
    for (int i = 1; i < n; i++) {
        if (a.at(i) == chk) {
            sum++;
            continue;
        }

        if (sum % 2 != 0)
            ans++;
        chk = a.at(i);
        sum = 1;
    }

    if (sum % 2 != 0)
        ans++;

    cout << ans << endl;
}

Measured memory_bytes: 640
def knapsack1(weight_value, w):
    cur = [0] * (w + 1)
    
    for weight, value in weight_value:
        for i in reversed(range(weight, w + 1)):
            cur[i] = max(cur[i], cur[i - weight] + value)

    return cur[w]


def main():
    n, w = [int(x) for x in input().split()]
    weight_value = [None] * n
    for i in range(n):
        weight_value[i] = [int(x) for x in input().split()]
    return knapsack1(weight_value, w)


print(main())


Measured memory_bytes: 41324
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <functional>
#include <iostream>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <stack>
#include <string>
#include <vector>
 
using namespace std;
typedef long long ll;
using gra = vector<vector<ll>>;
using gram = vector<unordered_map<ll,ll>>;
 
typedef unsigned long long ull;
 
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> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template <class T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template <class T> T dup(T a, T b) { return (a + b - 1) / b; }
template <class T> T modpow(T x, T p, T m) { T a=1; while(p){ if(p%2)a =a*x%m; x = x+x%m; p/=2; } return a; }
// template <class T> void prim(T a) { for(ll i=0;i<a.size();++i) { cout << a[i]; } cout << "\n"; }
 
#define mod 1000000007LL
#define INF 10000000000000000LL
 
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define rep1(i, n) for (int i = 1; i <= n; ++i)
#define rrep(i, n) for (int i = (n - 1); i >= 0; --i)
#define rrep1(i, n) for (int i = n; i > 0; --i)
 
#define pri(x) cout << (x) << "\n"
#define pri2(x, y) cout << (x) << " " << (y) << "\n"
#define pri3(x, y, z) cout << (x) << " " << (y) << " " << (z) << "\n"
//#define modpow(x, p, m) { ll a=1; while(p){ if(p%2)a =a*x%m; x = x+x%m; p/=2; } return a; }
 
#define m0(h) memset(h, 0, sizeof(h))
#define m1(h) memset(h, 1, sizeof(h))
#define m(h, n) memset(h, (n), sizeof(h))
#define all(n) (n).begin(),(n).end()
#define bit(n) (1LL << (n))
#define pb push_back
 
//#ifdef LOCAL
//
//#define dpri(...) fprintf(stderr, __VA_ARGS__)
//#define pria(g) rep(i,g.size()){ cout << i << "{"; rep(j,g[i].size()) cout << g[i][j] << " "; cout << "}" << "\n"; }
//#else
//#define dpri(...) 42
//#define pria(g) 42
//#endif
 
 
 
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  // ---------------------
  // コーディング開始
  // ---------------------
  ll n;
  cin >> n;
  gram g(n+1);
  ll a,b,c;
  rep(i,n-1){
    cin >> a >> b >> c;
    g[a][b]=c;
    g[b][a]=c;
  }
  ll q, k;
  cin >> q >> k;
  ll klist[n+1];

  ll co =0;
  function<void(const gram&,ll, ll,ll)> dfs = [&](const gram &g, ll p,ll v,ll cost) {
      co++;
      klist[v]=cost;
      for(auto next_v:g[v]){
          if(next_v.first==p)continue;
          dfs(g,v,next_v.first,cost + next_v.second);
      }
  };
  dfs(g,-1,k,0);
  ll x,y;
  rep(i,q){
    cin >> x >> y;
    pri(klist[x]+klist[y]);
  }

  return 0;
}



Measured memory_bytes: 28416
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<n+1;i++)
#define sort(A) sort(A.begin(),A.end())
#define reverse(A) reverse(A.begin(),A.end())
typedef long long ll;
typedef pair<int,int> P;

int main(){
  int a,b;
  cin >> a >> b;
  if(a%3 == 0 || b%3 == 0 || (a+b)%3 == 0) cout << "Possible" << endl;
  else cout << "Impossible" << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#define MOD 1000000007
typedef long long ll; 
ll dp[405][405][405]; 
int a[405], b[405], appa[405], appb[405], val[405][405]; 
int main()
{
	// freopen("CF17-QC-F.in", "r", stdin); 
	int n; 
	scanf("%d", &n); 
	for (int i = 1; i <= n; i++)
	{
		scanf("%d", a + i); 
		appa[a[i]] = i;
	}
	for (int i = 1; i <= n; i++)
	{
		scanf("%d", b + i); 
		appb[b[i]] = i; 
	}
	for (int i = 1; i <= n; i++)
	{
		for (int j = 1; j <= n; j++)
		{
			for (int k = 1; k <= n; k++)
				val[i][j] += appa[k] <= i || appb[k] <= j; 
		}
	}
	dp[0][0][0] = 1; 
	for (int i = 1; i <= n / 3; i++)
	{
		for (int j = 1; j <= n; j++)
		{
			for (int k = 1; k <= n; k++)
			{
				dp[i][j][k] = (dp[i][j - 1][k] + dp[i][j][k - 1] - dp[i][j - 1][k - 1]) % MOD; 
				if (appb[a[j]] > k && appa[b[k]] > j)
					(dp[i][j][k] += dp[i - 1][j - 1][k - 1] * (3 * i - val[j][k])) %= MOD; 
			}
		}
	}
	ll ans = dp[n / 3][n][n]; 
	for (int i = 0; i < n / 3; i++)
		ans = ans * (3 * i + 1) % MOD * (3 * i + 2) % MOD; 
	printf("%lld\n", (ans + MOD) % MOD);
	return 0;
}


Measured memory_bytes: 172928
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef long long ll;
const long long MOD=1e09+7;



#define rep(i,n) for(int i=0;i<n;i++)
#define rep2(i,m,n) for(int i=m;i<n;i++)
#define ALL(v) v.begin(), v.end()
#define pb push_back



      






int main(){
 
  int n,k;
  cin>>n>>k;
  string s;
  cin>>s;
  
  int count=0;
  rep(i,n){
    if (s.at(i)=='L'){
      if (i>=1 and s.at(i-1)=='L'){
        count++;
      }
    }
    else {
      if (i<=n-2 and s.at(i+1)=='R'){
        count++;
      }
    }
  }
  
  rep(i,k){
    count=min(count+2,n-1);
  }
  
  cout<<count<<endl;
  

}












Measured memory_bytes: 512
import sys
stdin = sys.stdin

sys.setrecursionlimit(10 ** 7)

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())

n = ni()
a = list(li())

odd = 0
ml2 = 0
ml4 = 0

for ai in a:
    if ai % 2:
        odd += 1
    elif ai % 4:
        ml2 = 1
    else:
        ml4 += 1

print("Yes" if (odd + ml2) <= (ml4 + 1) else "No")

Measured memory_bytes: 14168
N,H = map(int,input().split())
A = [list(map(int,input().split())) for _ in range(N)]
A = sorted(A,key=lambda x:x[1], reverse=True)
bmax = A[0][1]
A = sorted(A,key=lambda x:x[0],reverse=True)
for i in range(N):
    if i==0:
        A[i] = [A[i][0],A[i][1],1]
    else:
        A[i] = [A[i][0],A[i][1],0]
cnt = 0
tot = 0
ind = 0
a = A[0][0]
b = A[0][1]
if H<=bmax:
    cnt = 1
else:
    A = sorted(A,key=lambda x:x[1],reverse=True)
    for i in range(N):
        if tot+b>=H:
            cnt += 1
            ind=1
            break
        elif A[i][1]>=a and A[i][2]==0:
            tot += A[i][1]
            cnt += 1
        if tot>=H:
            ind = 1
            break
    if ind == 0:
        tot += b
        cnt += 1
        if tot<H:
            if (H-tot)%a==0:
                cnt += (H-tot)//a
            else:
                    cnt += (H-tot)//a+1
print(cnt)


Measured memory_bytes: 29780
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <sstream>
#include <string>
#define _repargs(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _repargs(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define inf 2000000007
#define mp make_pair
#define pb push_back
typedef long long ll;
using namespace std;
template <typename T>
inline void output(T a, int p = 0) {
    if(p) cout << fixed << setprecision(p)  << a << "\n";
    else cout << a << "\n";
}
// end of template

int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    // source code
    
    int N, M;
    cin >> N >> M;
    vector<int> cnt(100001);
    vector<int> A(M); // あまりがiの個数
    rep(i, N) {
        int a;
        cin >> a;
        cnt[a]++;
        A[a % M]++;
    }
    int ans = 0;
    ans += A[0] / 2;
    if(M % 2 == 0) ans += A[M / 2] / 2;
    
    vector<int> R(M); // 奇数個の個数
    vector<int> D(M);
    rep(i, cnt.size()){
        if(cnt[i] % 2 == 1) R[i % M]++;
    }
    rep(i, 1, M){
        if(i == M - i) continue;
        if(R[i] && R[M - i]){
            int m = min(R[i], R[M - i]);
            ans += m;
            R[i] -= m;
            R[M - i] -= m;
            D[i] += m;
            D[M - i] += m;
            A[i] -= m;
            A[M - i] -= m;
        }
    }
    rep(i, cnt.size()){
        if(cnt[i] % 2 == 1 && D[i % M] > 0){
            cnt[i]--, D[i % M]--;
        }
    }
    vector<int> P(M);
    
    rep(i, cnt.size()){
        
        P[i % M] += cnt[i] / 2;
    }
    
    rep(i, 1, M){
        if(i == M - i) continue;
        int m = min(A[i], A[M - i]);
        A[i] -= m;
        A[M - i] -= m;
        ans += m;
    }
    
    rep(i, 1, M){
        if(i != M - i) ans += min(P[i], A[i] / 2);
    }
    
    
    
//    rep(i, cnt.size()){
//        ans += cnt[i] / 2;
//    }
//    
//    rep(i, 1, M){
//        if(R[i] > 0 && A[M - i] > 0){
//            int m = min(R[i], A[M - i]);
//            A[M - i] -= m;
//            ans += m / 2;
//        }
//    }
    
    
    output(ans);
    
    
    
    return 0;
}

Measured memory_bytes: 2304
#include <algorithm>
#include <climits>
#include <iostream>
#include <string>
#include <utility>
#include<vector>
#include<iomanip>
#include<map>
#include <queue>
#include<cmath>

using namespace std;

int func(int n,int d){
    int a,b;
    for(int i=0;i<d;i++){
        a = n / 10;
        b = n % 10;
        n = a;
    }
    return b;
}

int ketasuu(int n){
    int digit = 0;
    while(n!=0){
        n /= 10;
        digit++;
    }
    return digit;
}

int main(void){

    int n;
    cin>>n;

    int ans = 0;
    int keta = 3;
    int x;
    int piv;
    int count[3];
    int judge=1;

    for(int i = 357;i<=n;i++){

        //cout<<"i : "<<i<<endl;

        int j=1;
        keta = ketasuu(i);
        // while(judge>0){
        //     cout<<i/pow(10,j)<<endl;
        //     if(i/pow(10, j)>=1) j++;
        //     else{
        //         keta = j;
        //         judge = -1;
        //     }
        //     //if(j>9)break;
        // }

        //cout<<"keta : "<< keta<< endl;

        x = keta;
        count[0] = 0;
        count[1] = 0;
        count[2] = 0;

        while(1){
            piv = func(i, x);//i/(pow(10, x-1));
            //cout<<piv<<endl;
            if(x > 0 && piv!= 3 && piv != 5 && piv!= 7){
                i += pow(10, x-1) - 1;
                break;
            }

            if(piv==3) count[0]++;
            else if(piv==5) count[1]++;
            else if(piv==7) count[2]++;
            x--;
            
            if(x==0 && count[0]!=0 && count[1]!=0 && count[2]!=0){
                ans++;
                //cout<<"ans : "<<i<<endl;
                break;
            }else if(x==0){
                break;
            }
        }
    }
    cout<<ans<<endl;
} 

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define rrep(i,a,b) for(ll i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()

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

    ll a[n];
    map<ll, ll> sum;
    ll su = 0;

    rep(i, 0, n){
        cin >> a[i];
        su += a[i];
        sum[su]++;
    }

    ll ans = 0;
    fore(i, sum){
        if(i.first == 0){
            ans += (i.second + 1) * i.second / 2;
        }else{
            ans += i.second * (i.second - 1) / 2;
        }
    }

    cout << ans << endl;
}


Measured memory_bytes: 14336
#include <iostream>
#include <vector>

using namespace std;

long long cnt;

vector<int> A;
vector<int> G;

void InsertionSort(int n, int g)
{
	for (int i = g;i < n;i++)
	{
		int v = A[i];

		int j = i - g;
		while (j >= 0 && A[j] > v)
		{
			A[j + g] = A[j];
			j -= g;
			cnt++;
		}
		A[j + g] = v;
	}
}

void ShellSort(int n)
{
	// ??°???G(0) = 1, G(n + 1) = 3G(n) + 1
	int h = 1;
	while (h <= n)
	{
		G.push_back(h);
		h = 3 * h + 1;
	}

	// ????????§??????
	for (int i = G.size() - 1;i >= 0;i--)
		InsertionSort(n, G[i]);
}

int main()
{
	int n;
	cnt = 0;

	// ??\???
	cin >> n;

	A.resize(n);
	for (int i = 0;i < n;i++)
		cin >> A[i];

	// ?????§????????????
	ShellSort(n);

	// ??????
	// ??´??°m
	cout << G.size() << endl;

	// G???????´?(?????¨???)
	for (int i = G.size() - 1;i >= 0;i--)
	{
		if (i != G.size() - 1)
			cout << " ";
		cout << G[i];
	}
	cout << endl;

	// ????????????
	cout << cnt << endl;

	// ?????????????????°???
	for (int i = 0;i < n;i++)
		cout << A[i] << endl;

	return 0;
}

Measured memory_bytes: 6740
from collections import Counter

n=int(input())
string_list=[input() for i in range(n)]
 
counter = Counter(string_list)

m = max(counter.values())

out_li = []

for k,v in counter.items():
  if v == m:
    out_li.append(k)

out_li.sort()
    
print('\n'.join(out_li))

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

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

using namespace std;

int calc(string s,int c){
	int n=s.length();
	if(count(s.begin(),s.end(),c)==n) return 0;

	string t;
	rep(i,n-1) t+=(s[i]==c?s[i]:s[i+1]);
	return calc(t,c)+1;
}

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

	int ans=100;
	for(char c='a';c<='z';c++) ans=min(ans,calc(s,c));
	cout<<ans<<'\n';

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define cs const 
#define fr first 
#define se second
#define ls (now<<1)
#define rs (now<<1|1)
#define mid ((l+r)>>1)
#define mp make_pair
#define pb push_back
#define ppb pop_back
#define low(i) (i&(-i))
#define par pair<int,int>
#define cn(x) memset(x, 0, sizeof(x))
#define rep(i, x, y) for(int i=x; i<=y; ++i)
#define sep(i, x, y) for(int i=x; i>=y; --i)
#define fore(i, x) for(int i=fir[x]; i; i=nex[i])
 
cs int G = 3;
cs int ff = 2e6 + 1;
cs int inf = 1e18 + 1;
cs int base = 2333;
cs int mod = 1e9 + 7;

int x, n, m;
int fa[ff];
int find(int x) { return fa[x] == x ? x : fa[x] = find(fa[x]); }
void init()
{
	int ans;
	cin >> n >> m;
	ans = n - 1;
	rep(i, 1, n) fa[i] = i;
	rep(i, 1, m)
	{
		int u, v; scanf("%lld %lld", &u, &v);
		u = find(u); v = find(v);
		if(u != v) fa[u] = v, ans --;
	}
	cout << ans;
}
signed main()
{
	int Ts = 1;
//	cin >> Ts;
	while(Ts--)
		init();
}

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

int main()
{
  int n;
  cin>>n;
  
  vector <pair <int,int> > v(n);
  for(int i=0;i<n;i++)
  {
    cin>>v[i].first>>v[i].second;
  }
  
  string ans="No";
  
  for(int i=0;i<=n-3;i++)
  {
    if(v[i].first==v[i].second and v[i+1].first==v[i+1].second and v[i+2].first==v[i+2].second)
    {
      ans="Yes";
    }
  }
  
  cout<<ans;
  
  return 0;
}

Measured memory_bytes: 3544
#include <bits/stdc++.h>
using namespace std;
  #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  #define int long long
  #define endl "\n"
  #define all(v) v.begin(),v.end()
  #define double long double
  #define trace1(x)                cerr<<#x<<": "<<x<<endl
  #define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
  #define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
  #define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
  #define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<< ": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
  #define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
  #define cases int testcases;cin>>testcases; while(testcases--)
  const int N = 200005;


int32_t main()
{


    IOS


    int n;
    cin >> n;

    int ans = 0;

    int k = (int)sqrt(n);

    
    for(int i = 1; i<= k; i++)
    {
    	ans += i * (i + floor(n/i))*(floor(n/i) + 1 - i);
    }


    cout << ans - k*(k+1)*(2*k+1)/6;


    return 0;
}


Measured memory_bytes: 3688
#include<bits/stdc++.h>
using namespace std;
bitset<10010> ok[2010];
pair<int,int> p[2][10010];
char s[2010][10010],ans[1000010];
int len[2010],n,k,cnt=0,ncnt=0;
int main()
{
    //freopen("H:\\c++1\\in.txt","r",stdin);
    //freopen("H:\\c++1\\out.txt","w",stdout);
    scanf("%d%d",&n,&k);
    for(int i=1;i<=n;i++){
        scanf("%s",s[i]+1);//
        len[i]=strlen(s[i]+1);//
    }
    ok[n+1][0]=1;
    for(int i=n;i>=1;i--){
        ok[i]=ok[i+1]|(ok[i+1]<<len[i]);
    }
    for(int i=1;i<=n;i++){
        if(ok[i+1][k-len[i]]){
            p[0][++cnt]=make_pair(i,1);//
        }
    }
    int f=0;
    for(int i=1;i<=k;i++){//
        char mi='z';
        for(int j=1;j<=cnt;j++){
            mi=min(mi,s[p[f][j].first][p[f][j].second]);
        }
        ans[i]=mi;
        //cout<<ans[i]<<endl;
        ncnt=0;
        int pp=n+1;
        for(int j=1;j<=cnt;j++){
            int id=p[f][j].first,pos=p[f][j].second;
            if(mi!=s[id][pos])continue;
            if(pos==len[id])pp=min(pp,id);//
            else p[f^1][++ncnt]=make_pair(id,pos+1);
        }
        for(int j=pp+1;j<=n;j++){
            if(k>=i+len[j]&&ok[j+1][k-i-len[j]])p[f^1][++ncnt]=make_pair(j,1);//
        }
        f^=1;
        cnt=ncnt;
    }
    printf("%s\n",ans+1);//
    return 0;
}

Measured memory_bytes: 22016