akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> iint;
typedef pair<ll,ll> llll;
#define ALL(x) (x).begin(),(x).end()
const ll zero = 0;
const ll INF = 3000000000000000000; //10^18
const int inINF = 1000000000; //10^9
const ll MOD = 1000000007; //10^9+7
const ll MOD2 = 998244353;

void solve(int s, vector<double> &d, vector<vector<double>> cost, int V){
    fill(ALL(d), 10000000000.0);
    d[s] = 0;

    vector<bool> used(V);
    fill(ALL(used), false);

    priority_queue<pair<double, int>, vector<pair<double, int>>, greater<pair<double, int>>> pq;
    pq.push(make_pair(0.0, s));

    pair<double, int> v;
    while(!pq.empty()){
        v = pq.top();
        pq.pop();
        if(used[v.second] == true){
            continue;
        }
        used[v.second] = true;
        d[v.second] = v.first;
        for (int i = 0; i < V; i++) {
            if(d[v.second] + cost[v.second][i] < d[i]){
                d[i] = d[v.second] + cost[v.second][i];
                pq.push(make_pair(d[i], i));
            }
        }
    }
}

int main(){
    double xs, ys, xt, yt;
    int N;
    cin >> xs >> ys >> xt >> yt >> N;
    vector<double> x(N), y(N), r(N);
    for (int i = 0; i < N; i++) {
        cin >> x[i] >> y[i] >> r[i];
    }

    vector<vector<double>> cost(N+2, vector<double> (N+2));
    vector<double> d(N+2);

    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
            cost[i][j] = max(sqrt((x[i] - x[j])*(x[i] - x[j]) + (y[i] - y[j])*(y[i] - y[j])) - r[i] - r[j], 0.0);
            cost[j][i] = max(sqrt((x[i] - x[j])*(x[i] - x[j]) + (y[i] - y[j])*(y[i] - y[j])) - r[i] - r[j], 0.0);
        }
    }
    for (int i = 0; i < N; i++) {
        cost[i][N] = max(sqrt((x[i] - xs)*(x[i] - xs) + (y[i] - ys)*(y[i] - ys)) - r[i], 0.0);
        cost[N][i] = max(sqrt((x[i] - xs)*(x[i] - xs) + (y[i] - ys)*(y[i] - ys)) - r[i], 0.0);
    }
    for (int i = 0; i < N; i++) {
        cost[i][N+1] = max(sqrt((x[i] - xt)*(x[i] - xt) + (y[i] - yt)*(y[i] - yt)) - r[i], 0.0);
        cost[N+1][i] = max(sqrt((x[i] - xt)*(x[i] - xt) + (y[i] - yt)*(y[i] - yt)) - r[i], 0.0);
    }
    cost[N][N+1] = sqrt((xs - xt)*(xs - xt) + (ys - yt)*(ys - yt));
    cost[N+1][N] = sqrt((xs - xt)*(xs - xt) + (ys - yt)*(ys - yt));

    solve(N, d, cost, N+2);


    printf("%32.18lf\n", d[N+1]);

}


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

int main() {
int a,b,c,d,e;
cin>>a>>b;
c = a+b;
d = a-b;
e = a*b;
  if(c>=d){
    if(c>=e)
      cout<<c<<endl;
    else if(e>=c)
      cout<<e<<endl;}
  else if(d>=c){
    if(d>=e)
      cout<<d<<endl;
    else if(e>=d)
      cout<<e<<endl;}
}

Measured memory_bytes: 256
import java.io.*;
import java.util.*;


public class Main {

    public static void main(String[] args) {
        FastScanner sc = new FastScanner(System.in);
        int l = sc.nextInt();
        int r = sc.nextInt();
        int mini = 2018;
        if (Math.abs(l - r) >= 2019) {
            mini = 0;
        }
        l %= 2019;
        r %= 2019;
        int tmp = l;
        if (l > r) {
            l = r;
            r = tmp;
        }
        for (int i = l + 1; i <= r; i++) {
            for (int j = l; j < i; j++) {
                if ((j * i) % 2019 < mini) {
                    mini = (j * i) % 2019;
                }
            }
        }
        System.out.println(mini);
    }


    static class FastScanner {
        private BufferedReader reader;
        private StringTokenizer tokenizer;

        public FastScanner(InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
            tokenizer = null;
        }

        public String next() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public String nextLine() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    return reader.readLine();
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }

            return tokenizer.nextToken("\n");
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public double nextDouble() {
            return Double.parseDouble(next());
        }


        public long[] nextLongArray(int n) {
            long[] a = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = nextLong();
            return a;
        }
    }
}

Measured memory_bytes: 20692
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a=0,b=0;
	char c;
	c=getchar();
	while(c!='\n')
	{
		if(c=='1')
			a++;
		else if(c=='0')
			b++;
		c=getchar();
	}
	printf("%d",min(a,b)*2);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <fstream>
#include <iomanip>

typedef long double ld;
typedef long long ll;
const ll INF = (ll)1e18 + 1;
const ll MOD = 1e9 + 7;

// Split
namespace util {

std::vector< std::string > split(std::string s, char delimiter)
{
  std::vector< std::string > vs;
  std::string sub;
  for (auto c : s) {
    if (c == delimiter) vs.push_back(sub), sub.clear();
    else sub += c;
  }
  vs.push_back(sub);
  return vs;
}

} // namespace util

// Minimum, Maximum
template<class T> T minimum(T head, T tail) { return std::min(head, tail); }
template<class H, class... T> H minimum(H head, T... tail) { return std::min(head, minimum(tail...)); }
template<class T> T maximum(T head, T tail) { return std::max(head, tail); }
template<class H, class... T> H maximum(H head, T... tail) { return std::max(head, maximum(tail...)); }

// Output
template<class T> std::ostream& operator << (std::ostream& os, std::vector< T > v)
{
  for (ll i = 0; i < (ll)v.size(); i++){ os << " [" << i << "]" << v[i]; if (i % 10 == 0) os << std::endl; }
  return os;
}

template<class T, class S> std::ostream& operator << (std::ostream& os, std::vector< std::pair<T, S> > vp)
{
  ll i = 0;
  for (auto p : vp){os << " [" << i++ << "]" << p.first << " " << p.second; if (i % 10 == 0) os << std::endl;}
  return os;
}

void print(){ std::cout << std::endl; }
template<typename H> void print(H head) { std::cout << head << std::endl; }
template<typename H, typename... T> void print(H head, T... tail){ std::cout << head << " ", print(tail...); }

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

  ll X;
  std::cin >> X;

  std::vector<ll> va;
  for (ll b = 1; b <= 1000; b++) {
    for (ll p = 2; p <= 1000; p++) {
      ll calc = std::pow(b, p);
      if (calc > X) break;
      va.push_back(calc);
    }
  }

  ll ans = *std::max_element(va.begin(), va.end());
  print(ans);

  return 0;
}


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

using namespace std;
int main() {
	int N;
	cin >> N;
	vector<int>P(N);
	vector<int>Q(N);
	for (int n = 0; n < N; ++n) {
		cin >> P[n];
	}
	for (int n = 0; n < N; ++n) {
		cin >> Q[n];
	}
	vector<int> v;
	int num1;
	int num2;
	for (int n = 0;n < N;++n) {
		v.push_back(n + 1);
	}
	map<vector<int>, int>mp;
	do {
		mp[v] = mp.size();
	} while (next_permutation(v.begin(), v.end()));

	cout << abs(mp[P]-mp[Q])<<endl;
	return 0;
}


Measured memory_bytes: 8640
#include<bits/stdc++.h>
using namespace std;
// -----------------<fast IO>------------------
#define IOS             ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define FLSH             fflush(stdout)
#define fileIO(name) \
    freopen(name".in", "r", stdin); \
    freopen(name".out", "w", stdout);
#define PRECISION(x)     cout << fixed << setprecision(x);
#define endl             "\n"
// -----------------<Container manipulation / traversal macros>------------------
#define mp                 make_pair
#define pb                 push_back
#define ff                 first
#define ss                 second
#define sz(x)             ((int)((x).size()))
#define all(x)             (x).begin(),(x).end()
#define rep(i,n)         for(ll (i)=0;(i)<(n);(i)++)
#define forn(i,a,b)     for(ll (i)=(a);(i)<=(b);(i)++)
#define fill(l,a)        memset((l) , (a) , sizeof(l))
// -----------------<Some common useful functions>------------------
#define maX(a,b)        ( (a) > (b) ? (a) : (b))
#define miN(a,b)        ( (a) < (b) ? (a) : (b))
#define checkbit(n,b)   ( (n >> b) & 1)
#define INDEX(arr,i)      ( lower_bound(all(arr),i)-arr.begin())
#define in(b,a)         ( (b).find(a) != (b).end())
// -----------------<TypeDef Start>------------------
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> pii;
typedef vector<ll> vi;
typedef vector< std::vector<ll> > matrix;
typedef map<ll,ll> mii;
typedef vector<pii> vpii;
// -----------------<Constants>------------------
const int MAXN = 1000005;
const int SQRTN = 1003;
const int LOGN = 22;
const double PI=acos(-1);

const int INF=1e9;

int MOD = 1000000007;
const int FMOD = 998244353;
const double eps = 1e-9;
ll gcd(ll a,ll b)
{
    if(a==0)
    return(b);
    return(gcd(b%a,a));
}
ll lcm(ll a,ll b)
{
    return(a/gcd(a,b)*b);
}
/*ll power(ll a,ll b,ll p)
{
    ll res=1;
    a%=p;
    while(b>0)
    {
        if(b&1)
        res=res*a%p;
        a=a*a%p;
        b>>=1;
    }
    return(res);
}
ll modInverse(ll a, ll m)
{
    ll g = gcd(a, m);
    return(power(a,m-2,m));
}*/
/*ll b_search(ll arr[],ll n,ll s)
{
    ll l=0,r=n-1;
    while(l<=r)
    {
        ll mid=l+(r-l)/2;
        if(arr[mid]==s)
        return(mid);
        if(arr[mid]<s)
        l=mid+1;
        else
        r=mid-1;
    }
    return(-1);
}*/
bool isprime(ll x)
{
    if(x==1)
        return(false);
    for(ll i=2;i*i<=x;i++)
    {
        if(x%i==0)
            return(false);
    }
    return(true);
}
//vector<ll> v[100005];
void solve()
{
    double a,b,h,m;
    cin>>a>>b>>h>>m;
    double hAngle = 0.5 * (h * 60 + m);
    double mAngle = 6 * m;
    double angle = abs(hAngle - mAngle);
    angle = min(angle, 360 - angle);
    //cout<<cos(angle)<<endl;
    double ans=sqrt(pow(a,2)+pow(b,2)-2*a*b*cos((angle/180)*M_PI));
    cout<<fixed<<setprecision(16)<<ans<<endl;
}

int main()
{
    IOS
    ll t=1;
    //cin>>t;
    while(t--)
    {
        solve();
    }
    return(0);
}


Measured memory_bytes: 4244
/*  -*- coding: utf-8 -*-
 *
 * a.cc: A - Painting
 */

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

using namespace std;

/* constant */

/* typedef */

/* global variables */

/* subroutines */

/* main */

int main() {
  int h, w, n;
  scanf("%d%d%d", &h, &w, &n);

  int d = max(h, w);
  printf("%d\n", (n + d - 1) / d);
  return 0;
}


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

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc =new Scanner(System.in);
		int n=sc.nextInt();
		int m=sc.nextInt();
		long x[]=new long[n];
		long y[]=new long[n];
		long z[]=new long[n];
		long y2[]=new long[n];
		long z2[]=new long[n];
		long p1[]=new long[n];
		long p2[]=new long[n];
		long p3[]=new long[n];
		long p4[]=new long[n];
		for(int i=0;i<n;i++) {
			x[i]=sc.nextLong();
			y[i]=sc.nextLong();
			z[i]=sc.nextLong();
			y2[i]=-y[i];
			z2[i]=-z[i];
			p1[i]=x[i]+y[i]+z[i];
			p2[i]=x[i]+y2[i]+z[i];
			p3[i]=x[i]+y[i]+z2[i];
			p4[i]=x[i]+y2[i]+z2[i];
			
		}
		
		Arrays.sort(p1);
		Arrays.sort(p2);
		Arrays.sort(p3);
		Arrays.sort(p4);
		
		long sum[]=new long[8];
		for(int i=0;i<m;i++) {
			sum[0]+=p1[i];
			sum[1]+=p1[n-1-i];
			sum[2]+=p2[i];
			sum[3]+=p2[n-1-i];
			sum[4]+=p3[i];
			sum[5]+=p3[n-1-i];
			sum[6]+=p4[i];
			sum[7]+=p4[n-1-i];
		}
		for(int i=0;i<8;i++) {
			sum[i]=Math.abs(sum[i]);
		}
		Arrays.sort(sum);
		System.out.println(sum[7]);
	}
	
}





Measured memory_bytes: 27200
n, k = map(int, input().split())
x = list(map(int, input().split()))
i = 0
while i < n and x[i] < 0:
    i += 1
jl = i - 1
cl = []
cr = []
for l in range(k):
    if jl - l < 0:break
    cl.append(-x[jl - l])
for l in range(k):
    if i + l >= n:break
    cr.append(x[i + l])
la = 10**18
lb = 10**18
for l in range(len(cl)):
    c = k - l - 2
    if c >= len(cr):continue
    if c < 0:
        la = min(la, cl[l])
    else:
        la = min(la, cl[l] + cr[c] * 2)
for l in range(len(cr)):
    c = k - l - 2
    if c >= len(cl):continue
    if c < 0:
        lb = min(lb, cr[l])
    else:
        lb = min(lb, cr[l] + cl[c] * 2)
print(min(la, lb))

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

typedef long long ll;
int N;
ll C;

int main(){
	cin >> N >> C;
	ll X[N+2] = {0},V[N+1] = {0},Y[N+2] = {0};
	X[N+1] = C;
	for(int i=1;i<=N;i++){
		cin >> X[i] >> V[i];
		Y[i] = C - X[i];
	}
	ll ans = 0;
	ll T[N+1] = {0};
	for(int i=1;i<=N;i++){
		T[i] = T[i-1] + V[i] -(X[i]-X[i-1]);
		ans = max(ans,T[i]);
	}
	ll S[N+2] = {0};
	X[N+1] = C;
	for(int i=1;i<=N;i++){
		S[N+1-i] = S[N+2-i] + V[N+1-i] + (X[N+1-i]-X[N+2-i]);
		ans = max(ans,S[N+1-i]);
	}
	ll G[N+1] = {0};
	ll H[N+2] = {0};
	for(int i=1;i<=N;i++){
		G[i] = max(G[i-1],T[i]-X[i]);
		H[N+1-i] = max(H[N+2-i],S[N+1-i]-Y[N+1-i]);
	}
	/*cout << ans << endl;
	cout << G[0] << endl;
	cout << G[1] << endl;
	cout << G[2] << endl;
	cout << G[3] << endl;*/
	for(int i=1;i<=N;i++){
		ans = max(ans,S[i] + G[i-1]);
		ans = max(ans,T[i] + H[i+1]);
	}
	cout << ans << endl;
}


Measured memory_bytes: 5760
package main

import "fmt"

func main(){
	var N int
	fmt.Scan(&N)

	ans := 1
	for i := 0; i < N; i++{
		var tmp int
		fmt.Scan(&tmp)
		if tmp == 0 {
			ans = 0
			break
		}

		if ans == -1 {
			continue
		}

		if ans > 1000000000000000000 / tmp {
			ans = -1
			continue
		}
    ans *= tmp

	}

	fmt.Println(ans)
}

Measured memory_bytes: 6332
def f(x, y, z):
    return x**2 + y**2 + z**2 + x*y + y*z + x*z

def main():
    n = int(input())
    ans = [0]*(10**4+1)
    tmp = 0
    for i in range(1, int(n**.5)+1):
        for j in range(i, int(n**.5)+1):
            for k in range(j, int(n**.5)+1):
                tmp = f(i, j, k)
                if tmp > n:
                    break
                if i == j and j == k:
                    ans[tmp] += 1
                elif i != j and j != k and k != i:
                    ans[tmp] += 6
                else:
                    ans[tmp] += 3

    for i in range(1, n+1):
        print(ans[i])

if __name__ == '__main__':
    main()

Measured memory_bytes: 9688
import java.io.*;
public class Main {
	public static void main(String[] args)throws IOException {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		String str=br.readLine();
		String[] i=str.split(" ");
		int a=Integer.parseInt(i[0]);
		int b=Integer.parseInt(i[1]);
		int x=a/b;int y=a%b;double z=(double)a/(double)b;
		System.out.print(x+" "+y+" ");
		System.out.printf("%.8f\n",z);
	}
}

Measured memory_bytes: 17080
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cctype>
#include<iostream>
#include<string>
#include<vector>
#include<queue>
#include<deque>
#include<algorithm>
#include<utility>

#define REP(i,x) for(int i=0; i<(int)(x); i++)       // 0 <= i < x
#define REPS(i,x) for(int i=1; i<=(int)(x); i++)     // 0 < i <= x
#define RREP(i,x) for(int i=((int)(x)-1); i>=0; i--) // x > i >= 0
#define RREPS(i,x) for(int i=((int)(x)); i>0; i--)   // x >= i > 0
#define INF 999999999
typedef long long ll;

using namespace std;

int dx[] = {1, -1, 0, 0};
int dy[] = {0, 0, 1, -1};

int main(void){
	int x, y, z;
	cin >> x >> y >> z;
	cout << (x - z) / (y + z) << endl;

	return 0;
}


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

using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define ll long long int

int main(){
  int A,B,T;
  cin>>A>>B>>T;
  int time=0,count=0;
  for(int i=1;i<T+0.5;i++){
    if(i%A==0)
      count+=B;
  }
  cout<<count<<endl;

  return 0;
}


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

int main() {
	int N,K, count = 1, sum = 0;
	string S;
	vector<int> vec;
	cin >> N >> K;
	cin >> S;
	char c = S[0]; 
	rep(i, N-1){
		if(c == S[i+1]){
			count++;
		}else{
			vec.push_back(count);
			count = 1;
			c = S[i+1];
		}
	}
	vec.push_back(count);

	rep(i, vec.size()){
		sum += vec[i]-1;
	}
	cout << min(N-1, sum+K*2);
}

Measured memory_bytes: 1020
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n, k;
    scanf("%d%d", &n, &k);
    int g, maxx = -1;
    for(int i = 0; i<n; i++)
    {
        int x;
        scanf("%d", &x);
        if(i == 0)  g = x;
        g = __gcd(g, x);
        maxx = max(maxx, x);
    }
    if(g == 1 || (k % g == 0 && k <= maxx))
    {
        puts("POSSIBLE");
    }
    else puts("IMPOSSIBLE");
    return 0;
}


Measured memory_bytes: 384
#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def S(): return input().rstrip()
def LS(): return S().split()
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float("INF")

#solve
def solve():
    n, k = LI()
    ans = [1] * n
    for _ in range(k):
        d = II()
        a = LI_()
        for ai in a:
            ans[ai] = 0
    print(sum(ans))
    return


#main
if __name__ == '__main__':
    solve()


Measured memory_bytes: 77520
import math
import collections
import sys
 
#input = sys.stdin.readline
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
 
a,b=MI()
ans=a*b-a-b+1
print(ans)

Measured memory_bytes: 3316
from fractions import gcd
def Comon_divisor(a,b):
    GCD=gcd(a,b)
    num=int(GCD**0.5)
    Cd=[1]
    for i in range(2,num+2):
        if GCD%i == 0:
            Cd.append(i)
        while True:
            if GCD%i == 0:
                GCD //= i
            else:break

    if GCD != 1:
        Cd.append(GCD)
    return Cd
a,b = map(int, input().split())
Divisor = Comon_divisor(a, b)
print(len(Divisor))
#print(Divisor)

Measured memory_bytes: 5048
s_all = input()
# s_all = "keyofscience"
for i in range(8):
    if i < 7:
        if s_all[:i] + s_all[-(7-i):] == "keyence":
            print("YES")
            break
    else:
        if s_all[:i] == "keyence":
            print("YES")
            break
else:
    print("NO")


Measured memory_bytes: 3060
#include <bits/stdc++.h>
typedef long long int lli;
using namespace std;
#pragma region DEBUG
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
#pragma endregion DEBUG
#define MOD 1000000007
#define MAX 500005
#define endl "\n"
lli arr[MAX];
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);    
   // freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    lli t;
    t =1 ;
    while(t--){
        lli d,t,s;
        cin>>d>>t>>s;
        if(s*t >=d)
            cout<<"Yes"<<endl;
        else
        {
            cout<<"No"<<endl;
        }
        
    }
}

Measured memory_bytes: 3652
def solve():
    a = read()
    result = think(a)
    write(result)


def read():
    n = read_int(1)[0]
    return read_int(n)


def read_int(n):
    return list(map(lambda x: int(x), read_line().split(' ')))[:n]


def read_float(n):
    return list(map(lambda x: float(x), read_line().split(' ')))[:n]


def read_line(n=0):
    if n == 0:
        return input().rstrip()
    else:
        return input().rstrip()[:n]


def think(a):
    buf = 0
    for d in a:
        buf += 1 / d
    return 1 / buf


def write(result):
    print(result)


if __name__ == '__main__':
    solve()

Measured memory_bytes: 38256
#include <bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

using namespace std;

#define rep(i, a, b) for (int i = a; i < b; i++)
#define rrep(i, a, b) for (int i = a; i <= b; i++)
#define all(a)  begin((a)),end((a))
#define uniq(c) (c).erase(unique(all((c))), end((c)))

int main()
{
    int Z, X, Y; cin >> X >> Y >> Z;
    cout << Z << " " << X << " " << Y << endl;
}

Measured memory_bytes: 256
#![allow(unused_imports)]

use proconio::{input, fastout};
use proconio::marker::*;


#[fastout]
fn main() {
    input! {
    mut s: Chars
    }
    s.sort();
    let ans = if s[0] == s[1] && s[2] == s[3] && s[1] != s[2] {"Yes"} else {"No"};
    println!("{}", ans);
}


Measured memory_bytes: 2168
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <cmath>
#include <complex>
#include <map>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cassert>
#include <iomanip>
using namespace std;

#define Rep(b, e, i) for(int i = b; i <= e; i++)
#define Repr(e, b, i) for(int i = e; i >= b; i--)
#define rep(n, i) Rep(0, n-1, i)
#define repr(n, i) Repr(n-1, 0, i)
#define all(v) (v).begin(), (v).end()
#define pb(v) push_back(v)
#define uniq(v) (v).erase(unique(all(v)),(v).end())
#define bitcnt(x) __builtin_popcount(x)
#define fst first
#define snd second
#define Pqaz(T) priority_queue<T,vector<T>,greater<T>>
#define Pqza(T) priority_queue<T>
#define put(x) cout << x;
#define putsp(x) cout << x << ' ';
#define putbd cout << "---------------------------------------------" << endl;
#define putln(x) cout << x << endl;
#define debug(x) cerr << #x << "=" << x << endl;
#define ENJYU std::ios::sync_with_stdio(false);std::cin.tie(0);

typedef long long ll;
typedef pair<ll, ll> llP;
typedef pair<int, int> intP;
typedef complex<double> comp;
typedef vector <int> vec;
typedef vector <ll> vecll;
typedef vector <double> vecd;
typedef vector <vec> mat;
typedef vector <vecll> matll;
typedef vector <vecd> matd;

//vector の中身を出力
template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

const int MAX = 200020;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<29;
const ll INFL = 1e18;
const ll MOD = 1000000007;

const int dx[]={1,0,-1,0},dy[]={0,1,0,-1};
//const int dx[]={-1,-1,-1,0,1,1,1,0},dy[]={-1,0,1,1,1,0,-1,-1};

//********************************template END****************************************//

ll N, K;

bool check(ll p, vecll &ws)
{
	ll cnt = 1, tmp = 0;
	rep(N, i)
	{
		if (ws[i] > p) return false;
		if (tmp+ws[i]<=p)
		{
			tmp += ws[i];
		}
		else
		{
			tmp = ws[i];
			cnt++;
		}
	}

	return cnt <= K;
}

void solve(void)
{
	cin >> N >> K;
	vecll ws(N);
	rep(N, i) cin >> ws[i];

	ll ng = 0, ok = INFL;
	while(abs(ok-ng)>1)
	{
		ll mid = (ok+ng)/2;
		(check(mid, ws) ? ok : ng) = mid;
	}

	cout << ok << endl;

}

int main(void)
{
	solve();
	//cout << "yui(*-v・)yui" << endl;
	return 0;
}



Measured memory_bytes: 3628
#include <fstream>
#include <vector>

using namespace std;

//ifstream cin("tema.in");
//ofstream cout("tema.out");

const int MAXN = 100000;
const int MOD = 1000000007;

int after[1 + MAXN], inDegree[1 + MAXN], tail[1 + MAXN], cycles[1 + MAXN], dp[1 + MAXN];
int cycle[1 + MAXN];
bool seen[1 + MAXN];

int Tail(int before, int now, int down, int length) {
    int delta = (before < now ? now - before : length - before + now);
    if (delta < down)
        return 0;
    if (delta == down)
        return 1;
    return 2;
}

int Ways(int l, int n) {
    dp[0] = 1;
    int single = 1;
    if (l % 2 && l > 1)
        single++;
    dp[1] = single;
    for (int i = 2; i <= n; i++)
        dp[i] = (1LL * ((1LL * l * (i - 1)) % MOD) * dp[i - 2] + 1LL * single * dp[i - 1]) % MOD;
    return dp[n];
}

int main() {
    //freopen("tema.in", "r", stdin);
    //freopen("tema.out", "w", stdout);
    int n;
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) {
        scanf("%d", &after[i]);
        inDegree[after[i]]++;
    }
    for (int i = 1; i <= n; i++)
        if (inDegree[i] > 2) {
            printf("0\n");
            return 0;
        }
    for (int i = 1; i <= n; i++)
        if (!inDegree[i]) {
            int j = i, length = 0;
            while (inDegree[j] < 2) {
                seen[j] = true;
                length++;
                j = after[j];
            }
            tail[j] = length;
        }
    int answer = 1;
    for (int i = 1; i <= n; i++)
        if (!seen[i]) {
            int j = i, length = 0;
            bool hasTail = false;
            while (!seen[j]) {
                length++;
                cycle[length] = j;
                if (tail[j])
                    hasTail = true;
                seen[j] = true;
                j = after[j];
            }
            if (i != j) {
                printf("0\n");
                return 0;
            }
            if (!hasTail) {
                cycles[length]++;
                continue;
            }
            j = 1;
            while (!tail[cycle[j]])
                j++;
            int before = j;
            for (int k = (j == length ? 1 : j + 1); k != j; k == length ? k = 1 : k++)
                if (tail[cycle[k]]) {
                    answer = (1LL * answer * Tail(before, k, tail[cycle[k]], length)) % MOD;
                    before = k;
                }
            answer = (1LL * answer * Tail(before, j, tail[cycle[j]], length)) % MOD;
        }
    for (int i = 1; i <= n; i++)
        answer = (1LL * answer * Ways(i, cycles[i])) % MOD;
    printf("%d\n", answer);
    return 0;
}


Measured memory_bytes: 1664
#include <iostream>
#include <string>

using namespace std;

int main(void) {
    string S;
    cin >> S;
    int N = S.size() - 1;

    int64_t ans = 0;
    for(int bit=0; bit<(1<<N); bit++) {
        int s = 0;
        for(int i=0; i<N; i++) {
            if((bit>>i) & 1) {
                ans += stol(S.substr(s, i-s+1));
                s = i+1;
            }
        }
        ans += stol(S.substr(s, N-s+1));
    }

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
char a[11], b[11], c[11];
int main()
{
	
	scanf("%s%s%s", a, b, c);
	printf("%c%c%c\n", a[0] - 32, b[0] - 32, c[0] - 32);
}

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

using namespace std;

int h[100001];

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

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

	int cnt = 0;
	for (int i = 0;i < n-1;i++) {
		if (h[i] >= h[i+1]) cnt++;
		else m = max(cnt, m), cnt = 0;
		m = max(cnt, m);
	}

	cout << m << endl;

	return 0;
}

Measured memory_bytes: 640
#include <iostream>

using namespace std;

int main()
{
  int n;
  double sum;

  cin >> n;

  sum = 0.0;
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    sum += 1.0/a;
  }

  cout << 1.0/sum << endl;

  return 0;
}


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

int main(){
    string s,t;
    cin >> s >> t;
    bool yes = false;
    for(int i=0; i<(int)s.length(); i++){
        if(s==t){
            yes = true;
            break;
        }
        s.push_back(s[0]);
        s.erase(s.begin());
    }
    if(yes){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
    int n;
    scanf("%d",&n);
    int d[n];
    for(int i = 0;i<n;i++){
        scanf("%d",&d[i]);
    }
    int health = 0;
    for(int i = 0;i<n;i++){
        for(int j = 0;j<n;j++){
            if(j != i){
                health += (d[i]*d[j]);
            }   
        }
    }
    printf("%d",health / 2);
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <algorithm>
#include <climits>

using namespace std;

int main() {
    while(true) {
        int n, m; cin >> n >> m;
        if(n == 0 && m == 0) break;

        vector<int> code_block;
        vector<int> pulse_array;
        vector<vector<int>> dp;
        for(int i = 0; i < m; i++) {
            int tmp; cin >> tmp;
            code_block.push_back(tmp);
        }
        for(int i = 0; i < n; i++) {
            int tmp; cin >> tmp;
            pulse_array.push_back(tmp);
            dp.emplace_back(256, INT_MAX);
        }
        int p = 128;
        for(int code : code_block) {
            int c = p + code;
            if(c > 255) c = 255;
            else if(c < 0) c = 0;
            int diff = c - pulse_array[0];
            dp[0][c] = diff*diff;
        }
        for(int i = 1; i < n; i++) {
            for(p = 0; p < 256; p++) {
                if(dp[i-1][p] == INT_MAX) continue;
                for(int code : code_block) {
                    int c = p + code;
                    if(c > 255) c = 255;
                    else if(c < 0) c = 0;
                    int diff = c - pulse_array[i];
                    if(dp[i][c] > diff*diff + dp[i-1][p]) {
                        dp[i][c] = diff*diff + dp[i-1][p];
                    }
                }
            }
        }
        cout << *min_element(dp[n-1].begin(), dp[n-1].end()) << endl;
    }
    return 0;
}

// [Problem] Differential Pulse Code Modulation
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=2199&lang=jp


Measured memory_bytes: 23784
H, W = map(int, input().split())
S = [input() for _ in range(H)]

A = [''] * H

di = [(1,0),(-1,0),(0,1),(0,-1),(1,1),(1,-1),(-1,1),(-1,-1)]

for h in range(H):
    for w in range(W):
        if S[h][w] == '#':
            A[h] += '#'
        else:
            c = 0
            for d in di:
                h1 = h + d[0]
                w1 = w + d[1]
                if 0 <= h1 < H and 0 <= w1 < W:
                    if S[h1][w1] == '#':
                        c += 1
            A[h] += str(c)

for i in range(H):
    print(A[i])


Measured memory_bytes: 3064
N=int(input())
count=0
a=list(map(int,input().split()))
w=[]
s=[]
num=[0]*N
maxi=max(a)
for i in range(N):
  s.append(1+i-a[i])
  if 1+i+a[i]<N:
    num[1+i+a[i]]+=1
for i in range(N):
  if s[i]>=0:
    count+=num[s[i]]
print(count)

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



#define ll long long
#define pb push_back
#define all(n) n.begin(),n.end()
#define eb emplace_back
#define endl "\n"
#define pll pair<ll,ll>
#define YES cout <<"YES"<<endl;
#define NO cout <<"NO"<<endl;
#define ff first
#define ss second
//do not use "\n" in interactive problem
//#define ((x|y)-y) (x&(~y))
//#define __gcd(fibo(x),fibo(y)=fibo(__gcd(x,y))
using namespace std;
const ll maxn=5e5+50;

const ll mod=1000000007;
const ll mod1=998244353;
ll a[maxn];


int main()
{
    //freopen("test.txt","r",stdin);
    // freopen("CHEMIST.OUT","w",stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
   ll n;
    cin>>n ;
    ll ans=0;

    for (int i=1;i<=n-1;i++)
    {
        ll x, y;
         cin>>x>>y;
         if (x>y) swap(x,y);
         ll t= n-y+1;

        ans=ans -x*t;
       // cout<<x<<" "<<t<<endl;
    }
    for (ll i=1;i<=n;i++)
    {

      ans=ans+(i)*(i+1)/2;

    }
    cout <<ans;

}


Measured memory_bytes: 3580
N = gets.to_i
a = N.times.map{gets.to_i}
ne = a[0]
cnt = 1
hash = {}
while hash[ne] == nil && ne != 2
  hash[ne] = 1
  cnt += 1
  ne = a[ne-1]
end
if ne == 2
  puts cnt
else
  puts -1
end

Measured memory_bytes: 19832
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define pi pair<int,int>
#define ff first
#define ss second
#define boost ios_base::sync_with_stdio(false);cin.tie(nullptr)
#include "string"

const int N = 1001;
const int inf = 1e9;
int g[N][N];

void print(int n){
	for(int i=1;i<=n;i++){
		for(int j=1;j<=n;j++)
			cout<<g[i][j]<<" ";
		cout<<endl;
	}
}

int32_t main() { 
	boost;
	int n,m;
	cin>>n>>m;
	memset(g,1,sizeof g);
	vector<int>adj[n+1];
	for(int i=0,u,v;i<m;i++){
		cin>>u>>v;
		g[u][v] = 1;
		adj[u].push_back(v);
	}

	for(int k=1;k<=n;k++){
		for(int i=1;i<=n;i++){
			for(int j=1;j<=n;j++)
				g[i][j] = min(g[i][j],g[i][k]+g[k][j]);
		}
	}
	int mx = g[1][1],root=1;
	for(int i=1;i<=n;i++){
		if(g[i][i]<mx){
			mx = g[i][i];
			root = i;
		}
	}

	if(mx > 2002){
		cout<<-1<<endl;
		return 0;
	}
	cout<<mx<<endl;
	for(int i=1;i<=mx;i++){
		cout<<root<<endl;
		for(int v:adj[root]){
			if(g[v][v] == mx){
				root = v;
				break;
			}
		}
	}
}	

Measured memory_bytes: 4352
#include <algorithm>
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <string>
#include <sstream>
#include <vector>
#include <stack>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using namespace std;
typedef long long int ll;


int main()
{
	int n;
	map<int,int> numMap;
	cin>>n;
	rep(i,n){
		int a;
		cin>>a;
		if( numMap.count(a) == 0){
			numMap.insert(make_pair(a,1));
		}else{
			numMap[a]++;
		}
	}
	int ans = 0;
	for(auto iter = numMap.begin(); iter != numMap.end(); iter++){
		int key,value;
		key = iter->first;
		value = iter->second;
		if( value >= key){
			ans += value - key;
		}else{
			ans += value;
		}
	}
	cout<<ans<<endl;
	return 0;
}



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

const ll MOD=1e9+7;

int main(){
    ll n,x; cin>>n>>x;
    vector<ll> a(n);
    for(ll i=0; i<n; i++){
        cin>>a[i];
    }
    ll ans=0;
    for(ll i=0; i<n-1; i++){
        if(a[i]+a[i+1]>x){
            ans+=a[i]+a[i+1]-x;
            a[i+1]=max(0LL,x-a[i]);
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <cstring>

using namespace std;
// ascending order
#define vsort(v) sort(v.begin(), v.end())
// descending order
#define vsort_r(v) sort(v.begin(), v.end(), greater<int>())
#define vunique(v) unique(v.begin(), v.end())
#define mp make_pair
#define ts(x) to_string(x)
#define rep(i, a, b) for(int i = (int)a; i < (int)b; i++)
#define repm(i, a, b) for(int i = (int)a; i > (int)b; i--)
#define bit(a) bitset<8>(a)
#define des_priority_queue priority_queue<int, vector<int>, greater<int> >
typedef long long ll;
typedef pair<int, int> P;
const ll INF = 1e18;

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

	int N, x;
	cin >> N >> x;

	int a[N];
	rep(i, 0, N) cin >> a[i];
	ll ans = 0;
	rep(i, 0, N - 1) {
		int left = a[i], right = a[i + 1];
		if(left + right <= x) continue;
		if(left > x) {
			ans += (left - x);
			ans += right;
			a[i] = x;
			a[i + 1] = 0;
		} else {
			ans += right - (x - left);
			a[i + 1] = x - left;
		}
	}

	cout << ans << endl;

}


Measured memory_bytes: 640
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

sys.setrecursionlimit(100005)

n, k = na()
g = [[] for _ in range(n)]
for _ in range(n - 1):
    a, b = na()
    g[a - 1].append(b - 1)
    g[b - 1].append(a - 1)

mod = 10**9 + 7


def dfs(cur, par, k, g):
    ret = 1
    nc = 0 if par == -1 else 1
    for e in g[cur]:
        if e == par: continue
        nc += 1
        ret = ret * (k - nc) % mod
        ret = ret * dfs(e, cur, k, g) % mod
    return ret % mod


print(dfs(0, -1, k, g) * k % mod)


Measured memory_bytes: 91672
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String s = scanner.nextLine();
        String t = scanner.nextLine();
        int ns = s.length(), nt = t.length();
        int ans = Integer.MAX_VALUE;
        for (int i = 0; i + nt <= ns; i++) {
            int diff = 0;
            for (int j = 0; j < nt; j++) {
                if (s.charAt(i + j) != t.charAt(j)) {
                    diff++;
                }
            }
            ans = Math.min(diff, ans);
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 35772
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int x = sc.nextInt();
		int cnt = 0;
		for (int i = 0; i <= a; i++) {
			for (int j = 0; j <= b; j++) {
				for (int k = 0; k <= c; k++) {
					if (i * 500 + j * 100 + k * 50 == x) {
						cnt++;
					}
				}
			}
		}
		System.out.println(cnt);
	}
}


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

using namespace std;

typedef long long ll;

vector<pair<int,int> > v;

int main()
{
	std::ios::sync_with_stdio(false);
    cin.tie(0);
    ll n,k;
    cin >> n >> k;
    k--; // Logic loc -> Machine loc
    int a,b;
	for(int i=0;i<n;i++){
		cin >> a >> b;
		v.push_back({a,b});
	}
	sort(v.begin(),v.end());
	ll cnt = 0;
	ll down,up;
	for(int i=0;i<n;i++){
		down = cnt;
		up = down+v[i].second-1;
		if(down<=k && up>=k){
			cout << v[i].first << "\n";
			return 0;
		}
		cnt = up+1;
	}
	
	return 0;
}

Measured memory_bytes: 1400
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String x = sc.next();
        int len = x.length();
        int sstack = 0;
        int c = 0;
        for (int i = 0; i < len; i++) {
            if (x.charAt(i) == 'S') {
                sstack ++;
            }
            if (x.charAt(i) == 'T') {
                if (sstack > 0) {
                    sstack --;
                    c += 2;
                }
            }
        }
        System.out.println(len - c);
    }
}


Measured memory_bytes: 14220
#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() {
  ios::sync_with_stdio(false);
  cin.tie(0);

  int n; cin >> n;
  int n_len = to_string(n).size();
  vector<int> n_753(3);
  n_753[0] = 7; n_753[1] = 5; n_753[2] = 3;
  stack<P> s;
  rep(i, 3) s.push(make_pair(n_753[i], 1));
  
  int ans = 0;
  while(!s.empty()) {
    P p = s.top(); s.pop();
    int num = p.first;
    int len = p.second;

    if(len < n_len) {
      rep(i, 3) {
	int x; x = 10*num+n_753[i];
	if(x <= n) {
	  s.push(make_pair(10*num+n_753[i], len+1));
	}
      }
    }
    
    vector<int> cnt_753(3, 0);
    for(int i = num; i > 0; i/=10) {
      rep(j, 3) {
	if(i%10 == n_753[j]) {
	  ++cnt_753[j];
	}
      }
    }
    
    bool flag = 1;
    rep(i, 3) {
      bool f = (cnt_753[i] > 0);
      if(!f) {
	flag = 0;
	break;
      }
    }
    ans += flag;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
#include <cmath>
#include <iomanip>
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 int mod=1e9+7;
const int INF=1001001001;
int main() {
 int H,W;
 cin>>H>>W;
 vector<string>s(H);
 for(int i=0;i<H;i++){
   cin>>s[i];
 }
 vector<vector<int>>dp(H,vector<int>(W,INF));
 if(s[0][0]=='#'){dp[0][0]=1;}
 else{dp[0][0]=0;}

 vector<int>dx={0,1};
 vector<int>dy={1,0};

 for(int i=0;i<H;i++){
   for(int j=0;j<W;j++){
     for(int k=0;k<2;k++){
       int nextx=j+dx[k],nexty=i+dy[k];
       if(nextx>=W||nexty>=H){continue;}
       if(s[nexty][nextx]=='#'&&s[i][j]=='.'){chmin(dp[nexty][nextx],dp[i][j]+1);}
       else{chmin(dp[nexty][nextx],dp[i][j]);}
     }
   }
 }
 cout<<dp[H-1][W-1]<<endl;
 return 0;  
}

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

char alpha[2][52];

int main() {
    int N;
    long long pattern = 1;
    cin >> N;
    for (int i = 0; i < 2; i++) {
        for (int j = 0; j < N; j++) cin >> alpha[i][j];
    }
    int idx = 0;
    while (idx < N) {
        if (idx == 0) {
            if (alpha[0][idx] == alpha[1][idx]) {
                pattern *= 3;
                idx++;
            }
            else {
                pattern *= 3 * 2;
                idx += 2;
            }
        }
        else {
            if (alpha[0][idx - 1] == alpha[1][idx - 1]) {
                if (alpha[0][idx] == alpha[1][idx]) {
                    pattern *= 2;
                    idx++;
                }
                else {
                    pattern *= 2;
                    idx += 2;
                }
            }
            else {
                if (alpha[0][idx] == alpha[1][idx]) {
                    pattern *= 1;
                    idx++;
                }
                else {
                    pattern *= 3;
                    idx += 2;
                }
            }
        }
    }
    cout << pattern % 1000000007 << endl;
    return 0;
}

Measured memory_bytes: 256
N, A, B = map( int, input().split())
X = list( map( int, input().split()))
now = X[0]
ans = 0
for i in range(1,N):
    x = X[i]
    if (x-now)*A >= B:
        ans += B
    else:
        ans += A*(x-now)
    now = x
print(ans)

Measured memory_bytes: 14252
// abc133_a
#include <iostream>
using namespace std;

int main(void) {
	int N, A, B;
	cin >> N >> A >> B;
	int train = N * A;
	int taxi = B;
	if (train > taxi) {
		cout << taxi << endl;
	}
	else {
		cout << train << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <vector>
#include <numeric>
#define PI 3.14159265358979323846
#define MAXINF (1e18L)
#define INF (1e9L)
#define EPS (1e-9)
#define MOD ((ll)(1e9+7))
#define REP(i, n) for(int i=0;i<int(n);++i)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define ALL(v) v.begin(),v.end()
#define FIND(v,x) (binary_search(ALL(v),(x)))
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(ALL(v));reverse(ALL(v))
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
#define YES(n) cout<<((n)?"YES":"NO")<<endl
#define pb push_back
#define fi first
#define se second
using namespace std;
template<class A>void pr(A a){cout << (a) << endl;}
template<class A,class B>void pr(A a,B b){cout << a << " "  ;pr(b);}
template<class A,class B,class C>void pr(A a,B b,C c){cout << a << " " ;pr(b,c);}
template<class A,class B,class C,class D>void pr(A a,B b,C c,D d){cout << a << " " ;pr(b,c,d);}
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;}
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll,ll> pll;

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

    auto f = [](ll n){
        int ret = 1;
        while((n/10) != 0) {
            n /= 10;
            ret++;
        }
        return ret;
    };

    int ans = INF;
    for (ll i = 1; i*i <= N; i++) {
        ll j = N/i;
        if(i*j != N) continue;
        ans = min(ans, max(f(i), f(j)));
    }

    pr(ans);
    
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <set>
#include <vector>
#include <cmath>
#define ll long long
#define read(x) scanf("%d",&x);
#define readll(x) cin>>x;
#define FOR(x,a,b) for(int x=a;x<b;x++)
#define MP make_pair
#define PB push_back
#define pii pair<int,int>
#define readN(N,X) for(int i=0;i<N;i++) cin>>X[i];
#define pff pair<double,double>
#define inf 1152921504606846976LL

using namespace std;
long long fastpow(int a, int b, int MOD)
{
    long long x=1,y=a; 
    while(b > 0)
    {
        if(b%2 == 1)
        {
            x=(x*y) % MOD;
        }
        y = (y*y) % MOD;
        b /= 2;
    }
    return x;
}

long long InverseEuler(int n, int MOD)
{
    return fastpow(n,MOD-2,MOD);
}
 
long long f[300000];
bool init;

int a[55];
int b[55];

long long C(int n, int r, int MOD)
{
    if (!init){
        init=1;
        f[0]=1;
        for (int i=1; i<300000;i++)
            f[i]= (f[i-1]*i) % MOD;
        
    }
    return (f[n]*((InverseEuler(f[r], MOD) * InverseEuler(f[n-r], MOD)) % MOD)) % MOD;
}

int N;

long long path[55][55];

set<long long> opsi[55][55];
void coba(int from, int x, long long cost){
    opsi[from][x].insert(cost);
    for (long long i=1;i<=x;i++){
        coba(from, x % i, cost | (1LL<<i));
    }
}

vector<int> ans;
int sum;
bool valid() {
    for (int x: ans){
        if (__gcd(sum - x, x) == 1) return 0;
    }

    return 1;
}

int main(){
   std::ios::sync_with_stdio(false); 
    
   ans.push_back(2);
   ans.push_back(4);
   ans.push_back(3);
   ans.push_back(9);

   sum = 2 + 4 + 3 + 9;
   int gan = 9;
   cin>>N;
   if (N == 3) {
    cout<<"2 5 63"<<endl;
    return 0;
   }
   while (ans.size() + 2 <= N && gan <= 30000 - 12) {
        gan += 6; ans.push_back(gan); sum+=gan;
        gan += 6; ans.push_back(gan); sum+=gan;
   }
  
    int wow = 6;
    while (ans.size() + 2 <= N && wow <= 30000 - 4) {
        wow += 2; ans.push_back(wow); sum+=wow;
        wow += 2; ans.push_back(wow); sum+=wow;
        wow += 2;
    }
    
  
   int gen = 0;
   while (ans.size() + 1 <= N && gen <= 30000 - 6) {
        gen += 6; ans.push_back(gen); sum+=gen; 
   }

   for (int i:ans) cout<<i<<endl;

}


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

int main() {
  int x,a,b,c,d;
  cin >> x >> a >> b;
  c = (a - x)*(a - x);
  d = (b - x)*(b - x);
  if(c > d){
    cout << "B" << endl;
  }else{
  cout << "A" << endl;
  }
}


Measured memory_bytes: 256
abs = lambda x:x if x > 0 else -x

N = int(input())
txt = "Yes"

t,x,y = [0,0,0]

for nanachi in range(N):
  T,X,Y = map(int,input().split())
  d = abs(X-x) + abs(Y-y)
  if not((T - t >= d) and (d - T + t)%2 == 0):
    txt = "No"
    break
  t,x,y = [T,X,Y]
print(txt)
  

Measured memory_bytes: 3064
#include<iostream>
using namespace std;
int digit(int n){
  int ans=0;
  while(n!=0){
	ans+=n%10;
    n=n/10;
   }
  return ans;
}
int main(){
  int n,a,b,i;
  cin >> n >> a >> b;
  int ans=0;
  for(i=1;i<=n;i++){
    if(digit(i)>=a && digit(i)<=b){
      ans+=i;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3632