akhauriyash/Code-Regression huggingface dataset:
h, w = map(int, input().split())

matrix = [input() for _ in range(h)]

cond = True
for i in range(h):
    for j in range(w):
        if matrix[i][j] == '#':
            tmp_cond = False
            try:
                if matrix[i - 1][j] == '#':
                    tmp_cond = True
            except:
                pass
            try:
                if matrix[i + 1][j] == '#':
                    tmp_cond = True
            except:
                pass
            try:
                if matrix[i][j - 1] == '#':
                    tmp_cond = True                    
            except:
                pass            
            try:
                if matrix[i][j + 1] == '#':
                    tmp_cond = True 
            except:
                pass
            
            if tmp_cond == False:
                cond = False
                
if cond:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define ll long long
#define mp make_pair
#define pb push_back
void solve(){
	int n;
	cin>>n;
	if(n>=30)
		cout<<"Yes\n";
	else
		cout<<"No\n";
}
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);	
	int T=1;
	//cin>>T;
	while(T--)
		solve();
}



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

// syntax sugar: `for (int i = 0; i < N; ++i)`
#define rep(i, N) for (int i = 0; i < (int)(N); ++i)
#define rep2(i, startValue, N) for (int i = (int)(startValue); i < (int)(N); ++i)
// syntax sugar: `for (int i = 0; i < N; ++i)`
#define REP(type, name, beginValue, endCondValue) \
  for (type name = beginValue; name < endCondValue; ++name)
// syntax sugar: 多次元vector
#define VECTOR_DIM3(T, name, d1, d2, d3, initValue) \
    std::vector<std::vector<std::vector<T>>> name(d1, std::vector<std::vector<T>>(d2, std::vector<int>(d3, initValue)));
#define VECTOR_DIM2(T, name, d1, d2, initValue) \
    std::vector<std::vector<T>> name(d1, std::vector<T>(d2, initValue));
#define VECTOR_DIM1(T, name, d1, initValue) \
    std::vector<T> name(d1, initValue);
#define ll long long
#define ld long double
#define DUMP(v) "," #v ":" << v

// 最大公約数
template <typename T>
T greatestCommonDivisor(T m, T n) {
  return m == 0 ? std::abs(n)
	: n == 0 ? std::abs(m)
	: greatestCommonDivisor(n, m % n);
}

// 最小公倍数
template <typename T>
T leastCommonMultiple(T m, T n) {
  return (m != 0 && n != 0)
	? (std::abs(m) / greatestCommonDivisor(m, n)) * std::abs(n)
	: 0;
}

// ABC131 C - Anti-Division
int main(){
  ll a, b, c, d;
  cin >> a >> b >> c >> d;
  const ll am = a - 1;

  const ll lcm_cd = leastCommonMultiple(c,d);

  const ll tob = b - b / c - b / d + b / lcm_cd;
  const ll fromam = am - am / c - am / d + am / lcm_cd;

  const ll ans = tob - fromam;
  cout << ans << endl;

  return 0;
}


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

ans = sum(B)
for i in range(1,N):
    if A[i] - 1 == A[i-1]:
        ans += C[A[i]-2]

print(ans)

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

void print(std::vector<long long> readVec){
    std::for_each(readVec.begin(), readVec.end(), [](long long i){
        std::cout << i << std::endl;
    });

    std::cout << "------" << std::endl;
}
int main(){
    int n;
    std::cin >> n;

    std::vector<long long> a(n), b(n);
    std::cin >> a.at(0);
    b.at(0) = a.at(0);
    for(int i = 1; i < n; ++i){
        std::cin >> a.at(i);
        b.at(i) = a.at(i) + b.at(i - 1);
    }

//    print(b);

    std::vector<long long> c(n - 1);
    for(int i = 0; i < n - 1; ++i){
        c.at(i) = std::abs(b.at(n - 1) - 2 * b.at(i));
    }

//    print(c);

    std::cout << *min_element(c.begin(), c.end()) << std::endl;

    return 0;
}

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

namespace ConsoleApp8 {
    class Program {
        static void Main(string[] args) {
            string S = Console.ReadLine();

            int ans = 0;

            int L = S.Length;

            for (int i = 0; i < L / 2; i++) {
                if (S[i] != S[L - i - 1]) {
                    ans++;
                }
            }

            Console.WriteLine(ans);

        }
    }
}


Measured memory_bytes: 13140
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
using namespace std;

const int MaxN = 1e5, MaxM = 2e5;
int n, m, all, ans[MaxN + 5];
int pre[MaxM + 5], last[MaxN + 5], other[MaxM + 5];
bool flag = false, vis[MaxN + 5];

void Build(int x, int y)
{
	pre[++all] = last[x];
	last[x] = all;
	other[all] = y;
}

void Init()
{
	all = -1; memset(last, -1, sizeof(last));
	for (int i = 1; i <= m; i++) {
		int u, v;
		scanf("%d%d", &u, &v);
		Build(u, v);
		Build(v, u);
	}
}

void Dfs_1(int x)
{
	int ed = last[x], dr;	
	vis[x] = true;
	while (ed != -1) {
		dr = other[ed];
		if (!vis[dr]) {
			Dfs_1(dr);
			if (flag) break;
		}
		ed = pre[ed];
	}
	flag = true;
	ans[++ans[0]] = x;
}

void Dfs_2(int x)
{
	int ed = last[x], dr;	
	vis[x] = true;
	ans[++ans[0]] = x;
	while (ed != -1) {
		dr = other[ed];
		if (!vis[dr]) {
			Dfs_2(dr);
			if (flag) break;
		}
		ed = pre[ed];
	}
	flag = true;
}

void Solve()
{
	ans[0] = 0;
	memset(vis, 0, sizeof(vis));
	flag = false;
	Dfs_1(1);
	ans[0]--;
	flag = false;
	Dfs_2(1);
	printf("%d\n", ans[0]);
	for (int i = 1; i <= ans[0]; i++) printf("%d ", ans[i]);
	printf("\n");
}

int main()
{
	while (~scanf("%d%d", &n, &m)) {
		Init();	
		Solve();
	}	
	return 0;
}

Measured memory_bytes: 4480
#include<stdio.h>
int main()
{
	int k,s;
	scanf("%d %d",&k,&s);
	int x,y,z;
	int ans=0;
	for(x=0;x<=k;x++)
	{
		for(y=0;y<=k;y++)
		{
			z=s-x-y;
			if(0<=z && z<=k)
			  ans++;
		}
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 128
import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;

int calc(int[] xs) {
    auto left = new int[xs.length];
    auto right = new int[xs.length];

    left[0] = xs[0];
    for (int i = 1; i < xs.length; i++)
        left[i] = gcd(xs[i], left[i-1]);

    right[$-1] = xs[$-1];
    for (int i = cast(int)xs.length-2; i >= 0; i--) {
        right[i] = gcd(xs[i], right[i+1]);
    }

    int ans = max(left[$-2], // 右端を消す
                  right[1]); // 左端を消す
    for (int i = 1; i <= xs.length - 2; i++) {
        // 両端以外を消す
        int g = gcd(left[i-1], right[i+1]);
        ans = max(ans, g);
    }
    return ans;
}

void main() {
    readint;
    auto xs = readints;
    writeln(calc(xs));
}

T gcd(T)(T a, T b) {
    if (b == 0) return a;
    return gcd(b, a % b);
}


Measured memory_bytes: 4296
import java.util.ArrayList;
import java.util.Comparator;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] a = new int[N - 1];
		int[] b = new int[N - 1];
		long[] c = new long[N - 1];
		for(int i = 0; i < N - 1; i++) {
			a[i] = sc.nextInt() - 1;
			b[i] = sc.nextInt() - 1;
			c[i] = sc.nextLong();
		}
		int Q = sc.nextInt();
		int K = sc.nextInt() - 1;
		int[] x = new int[Q];
		int[] y = new int[Q];
		for(int i = 0; i < Q; i++) {
			x[i] = sc.nextInt() - 1;
			y[i] = sc.nextInt() - 1;
		}
		sc.close();
		long[] d = dijkstra(N, K, a, b, c, true);
		StringBuilder sb = new StringBuilder();
		for(int i = 0; i < Q; i++) {
			long ans = d[x[i]] + d[y[i]];
			sb.append(ans).append("\n");
		}
		System.out.print(sb.toString());
	}
	/**
	 * ダイクストラ法 (優先度付きキュー)
	 * @param N 頂点数 (0 ~ N-1)
	 * @param t 始点
	 * @param from, to 辺
	 * @param cost 辺のコスト
	 * @param flag true なら無向辺、 false なら有向辺
	 * @return d t から各頂点への最短距離
	 */
	public static long[] dijkstra(int N, int t, int[] from, int[] to, long[] cost, boolean flag) {
		final int WHITE = 0;
	    final int GRAY = 1;
	    final int BLACK = 2;
	    final long INF = 100000000000000l;
		long[] d = new long[N];
		int[] color = new int[N];
		@SuppressWarnings("unchecked")
		ArrayList<Node>[] adj = new ArrayList[N];
		for(int i = 0; i < N; i++) {
			d[i] = INF;
			color[i] = WHITE;
			adj[i] = new ArrayList<Node>();
		}
		int E = from.length;
		for(int i = 0; i < E; i++) {
			adj[from[i]].add(new Node(to[i], cost[i]));
			if(flag)adj[to[i]].add(new Node(from[i], cost[i]));

		}
		Queue<Node> pq = new PriorityQueue<Node>(new MyComparator());
		d[t] = 0;
		pq.add(new Node(t, 0l));
		while(!pq.isEmpty()) {
			Node f = pq.poll();
			int u = f.id;
			color[u] = BLACK;
			if(d[u] < f.cost) continue;
			for(int j = 0; j < adj[u].size(); j++) {
				int v = adj[u].get(j).id;
				if(color[v] == BLACK) continue;
				if(d[v] > d[u] + adj[u].get(j).cost) {
					d[v] = d[u] + adj[u].get(j).cost;
					pq.add(new Node(v, d[v]));
					color[v] = GRAY;
				}
			}
		}
		return d;
	}
	static class Node{
		int id;
		long cost;
		public Node(int id, long cost) {
			this.id = id;
			this.cost = cost;
		}
	}
	static class MyComparator implements Comparator<Node>{
		@Override
        public int compare(Node v1, Node v2) {
			if(v1.cost < v2.cost) {
				return -1;
			}else if(v1.cost == v2.cost) {
				return 0;
			}else {
				return 1;
			}
		}
	}
}

Measured memory_bytes: 166684
#include <bits/stdc++.h>
using namespace std;
int main(){
  int data[10000];
  int n;
  cin >> n;
  for(int i = 0;i < n;i++){
    cin >> data[i];
  }
  int m;
  int hogee;
  int sum = 0;
  cin >> m;
  for(int i = 0;i < m;i++){
    cin >> hogee;
    for(int j = 0;j < n;j++){
      if(data[j] == hogee){sum++;break;}
    }
  }
  cout << sum << endl;
  return 0;
}
			 

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

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

    int ans = 0;

    for (int i = 0; i < S.size()-1; ++i) {
        vector<bool> alpL(26), alpR(26);
        int cnt = 0;
        for (int j = 0; j < i+1 ; ++j) alpL[(int)S[j] - 'a'] = true;
        for (int k = i+1; k < S.size(); ++k) alpR[(int)S[k] - 'a'] = true;

        for (int l = 0; l < 26; ++l) {
            if (alpL[l] == 1 && alpR[l] == 1) cnt++;
        }
        ans = max(ans, cnt);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
using System;
public class Hello
{
  public static void Main()
{
  int n =int.Parse(Console.ReadLine());
  string[] a = Console.ReadLine().Split(' ');
  int[] hp = new int[n];
  int i = 0;
  for( i = 0; i <n; i++)hp[i] = int.Parse(a[i]);
  Array.Sort(hp);
  while(true)
  {
    for(int j = 1; j<n;j++) 
    {
      for(i =0;i<n-1;i++)
      {
        if(hp[i]!=0&&j!=i)
        {
          hp[j]=hp[j]%hp[i];
          break;
        }
      }
    } Array.Sort(hp);
    if(hp[n-2]==0)break;
   }
  Array.Reverse(hp); 
  Console.WriteLine(hp[0]);
    
  
  
}
}

Measured memory_bytes: 20448
#include <bits/stdc++.h>
#define rep(i, n) for(long long int i = 0; i < n; i++)
#define _rep(i, m, n) for(long long int i = m; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
//const int N = 1000000;
const ll mod = 1000000007;
//using Graph = vector<vector<int>>;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
  
ll gcd(ll A, ll B){
    if(B == 0)return A;
    return gcd(B, A % B);
}
ll lcm(ll A, ll B){
    return A * (B / gcd(A, B));
}
using Edge = pair<int,int>;
using Graph = vector<vector<Edge>>;
Graph G;
  
/*------------------------------------------------------------------*/

int main(){
    int h, w; cin >> h >> w;
    vector<vector<int>> c(10, vector<int>(10, INFINITY));
    rep(i, 10) rep(j, 10) cin >> c[i][j];

    rep(k, 10){
        rep(i, 10){
            rep(j, 10){
                c[i][j] = min(c[i][j], c[i][k] + c[k][j]);
            }
        }
    }
    ll ans = 0;
    rep(i, h){
        rep(j, w){
            int num; cin >> num;
            if(num == -1) continue;
            ans += c[num][1];
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
long long MOD=1000000000+7;
int pow_with_mod(long long a, long long n){//aのn乗を計算します。
  long long k=a;
  long long x = 1;
  long long m=n;
  while(m > 0){//全てのbitが捨てられるまで。
    if(m&1){//1番右のbitが1のとき。
      x = (x*k)%MOD;
    }
    k = (k*k)%MOD;
    m >>= 1;//bit全体を右に1つシフトして一番右を捨てる。
  }
  return x%MOD;
}
int main(){
  long long n, a, b;
  cin>>n>>a>>b;
  long long all=pow_with_mod(2, n)-1;
  long long prod=1;
  for(long long i=0;i<=a-1;i++){
    prod=(prod*(n-i))%MOD;
  }
  long long frac=1;
  for(long long i=1;i<=a;i++){
    frac=(frac*i)%MOD;
  }
  prod=(prod*pow_with_mod(frac, MOD-2))%MOD;
  
  all=(all-prod)%MOD;
  prod=1;
  frac=1;
  for(long long i=0;i<=b-1;i++){
    prod=(prod*(n-i))%MOD;
  }
  for(long long i=1;i<=b;i++){
    frac=(frac*i)%MOD;
  }
  prod=(prod*pow_with_mod(frac, MOD-2))%MOD;

  all=(all-prod)%MOD;
  if(all<0){
    all+=MOD;
  }
  cout<<all;
  return 0;
}

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

public struct Point
{
    public int X;
    public int Y;

    public Point(Point p)
    {
        X = p.X;
        Y = p.Y;
    }

    public Point(int x, int y)
    {
        X = x;
        Y = y;
    }

    public static bool operator ==(Point a, Point b)
    {
        return (a.X == b.X && a.Y == b.Y);
    }

    public static bool operator !=(Point a, Point b)
    {
        return !(a == b);
    }

    //objと自分自身が等価のときはtrueを返す
    public override bool Equals(object obj)
    {
        if (!(obj is Point))
        {
            return false;
        }

        Point p = (Point)obj;
        return (X == p.X && Y == p.Y);
    }

    //Equalsがtrueを返すときに同じ値を返す
    public override int GetHashCode()
    {
        return (X << 16) ^ Y;
    }

    public Point Clone()
    {
        return new Point(X, Y);
    }

    public void Reverse()
    {
        X = -X;
        Y = -Y;
    }

    public static Point operator +(Point a, Point b)
    {
        return new Point(a.X + b.X, a.Y + b.Y);
    }

    public static Point operator -(Point a, Point b)
    {
        return new Point(a.X - b.X, a.Y - b.Y);
    }

    public static Point operator *(Point a, int i)
    {
        return new Point(a.X * i, a.Y * i);
    }

    public static Point operator /(Point a, int i)
    {
        return new Point(a.X / i, a.Y / i);
    }
    public static Point operator +(Point a)
    {
        return new Point(+a.X, +a.Y);
    }

    public static Point operator -(Point a)
    {
        return new Point(-a.X, -a.Y);
    }

    public override string ToString()
    {
        return string.Format("({0},{1})", X, Y);
    }
}

public class Solution
{
    public static void Main()
    {
        var N = int.Parse(Console.ReadLine());
        var balls = new HashSet<Point>();
        for (int i = 0; i < N; i++)
        {
            var vals = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            balls.Add(new Point(vals[0], vals[1]));
        }

        var diffs = new HashSet<Point>();
        for (int i = 0; i < N; i++)
        {
            for (int j = i + 1; j < N; j++)
            {
                var diff = balls.ElementAt(i) - balls.ElementAt(j);
                if (diff.Y < 0)
                {
                    diff *= -1;
                }
                diffs.Add(diff);
            }
        }

        var min = N;
        foreach (var diff in diffs)
        {
            var cost = N - balls.Count(b => balls.Contains(b + diff));
            min = Math.Min(cost, min);
        }

        Console.WriteLine(min);
    }
}

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

int main(){
    int n;
    cin >> n;
    vector<int> ans(n);
    for(int i=0;i<n;i++){
        int a;
        cin >> a;
        ans.at(a-1)=i+1;
    }
    for(int i=0;i<n;i++){
        if(i!=n-1)cout << ans.at(i) << " ";
        else cout << ans.at(i) << endl;
    }
    return 0;
}

Measured memory_bytes: 3728
import java.util.Scanner;


public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while(sc.hasNext()){
			int n = sc.nextInt();
			if(n==0){
				break;
			}
			int[][] ten = new int[n][3];//n→人数,0→数学,1→英語,2→国語
			//点数の入力
			for(int i=0;i<n;i++){
				for(int j=0;j<3;j++){
					ten[i][j] = sc.nextInt();
				}
			}
			//条件の判定
			for(int i=0;i<n;i++){
				//100点の科目があればAクラス
				if(ten[i][0]==100 | ten[i][1]==100 | ten[i][2]==100){
					System.out.println('A');
				//数学と英語の平均点が90点以上であればAクラス
				}else if((ten[i][0]+ten[i][1])/2 >= 90){
					System.out.println('A');
				}
				//3教科の平均点が80点以上であればAクラス
				else if((ten[i][0]+ten[i][1]+ten[i][2])/3 >= 80){
					System.out.println('A');
				}
				//3教科の平均点が70点以上であればBクラス
				else if((ten[i][0]+ten[i][1]+ten[i][2])/3 >= 70){
					System.out.println('B');
				}
				//3 科目の平均点が50点以上で、数学か英語が80点以上であればBクラス
				else if((ten[i][0]+ten[i][1]+ten[i][2])/3 >= 50 & ten[i][0] >= 80 | ten[i][1] >= 80){
					System.out.println('B');
				}
				//上の条件を満たさない満たさなければCクラス
				else{
					System.out.println('C');
				}
			}
		}
	}
}

Measured memory_bytes: 12000
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define FASTIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define pii pair<int, int>
#define ff first
#define ss second
#define PI acos(-1)
#define ld long double
//mt19937 rng((uint32_t)chrono::steady_clock::now().time_since_epoch().count());
const int mod = 1e9+7, N = 2e5+5;

int  n, m, k;

void solve(int test_case){
	int i, j;
	int a, b ,c ,d ;
	cin >> a >> b >> c >> d;
	cout << max(max(a*c, a*d), max(b*c, b*d));
	return;
}

signed main(){
	FASTIO;
#define MULTITEST 0
#if MULTITEST
	int ___T;
	cin >> ___T;
	for(int T_CASE = 1; T_CASE <= ___T; T_CASE++)
		solve(T_CASE);
#else
	solve(1);
#endif
	return 0;
}



Measured memory_bytes: 3644
#include<bits/stdc++.h>
using namespace std;
#define maxn 25020
#define rep(i,l,r) for(register int i = l ; i <= r ; i++)
#define repd(i,r,l) for(register int i = r ; i >= l ; i--)
#define rvc(i,S) for(register int i = 0 ; i < (int)S.size() ; i++)
#define rvcd(i,S) for(register int i = ((int)S.size()) - 1 ; i >= 0 ; i--)
#define fore(i,x)for (register int i = head[x] ; i ; i = e[i].next)
#define pb push_back
#define prev prev_
#define stack stack_
#define mp make_pair
#define fi first
#define se second
#define inf 0x3f3f3f3f
typedef long long ll;
typedef pair<int,int> pr;

const ll mod = 1e9 + 7;
int a[maxn],n,m,k,vis[maxn];
ll sum[420],f[maxn][420],g[maxn][420],fac[maxn],totl[maxn],totr[maxn],sum2[420];

inline ll power(ll x,ll y){
	ll res = 1;
	while ( y ){
		if ( y & 1 ) res = res * x % mod;
		x = x * x % mod;
		y >>= 1;
	}
	return res;
}
inline void up(ll &x,ll y){ x = (x + y + mod) % mod; }
int main(){
	scanf("%d %d %d",&n,&k,&m);
	rep(i,1,m) scanf("%d",&a[i]);
	int lmx = m,rmx = m,mx = 0,last = 1;
	fac[0] = 1;
	rep(i,1,k) fac[i] = fac[i - 1] * i % mod;
	rep(i,1,m){
		if ( vis[a[i]] ){ lmx = i - 1; break; }
		vis[a[i]] = 1;
	}
	repd(i,m,1){
		if ( vis[a[i]] == 2 ){ rmx = m - i; break; }
		vis[a[i]] = 2;
	}
	rep(i,1,k) vis[i] = 0;
	rep(i,1,m){
		if ( vis[a[i]] ){
			mx = max(mx,i - last);
			last = max(last,vis[a[i]] + 1);
		}
		vis[a[i]] = i;
	}
	mx = max(mx,m - last + 1);
	ll ans = power(k,n - m) * (n - m + 1) % mod;
	if ( mx == k ) cout<<ans<<endl;
	else if ( lmx == m ){
		f[0][0] = 1;
		rep(i,1,n){
			rep(j,1,k){
				sum[j] = (sum[j - 1] + f[i - 1][j]) % mod;
				sum2[j] = (sum2[j - 1] + g[i - 1][j]) % mod;
			}
			rep(j,1,k - 1){
				f[i][j] = (f[i - 1][j - 1] * (k - j + 1) + sum[k - 1] - sum[j - 1] + mod) % mod;
				g[i][j] = (g[i - 1][j - 1] * (k - j + 1) + sum2[k - 1] - sum2[j - 1] + mod) % mod;
				if ( j >= m ) up(g[i][j],f[i][j]);
			}
		}
		ll tmp = 0;
		rep(i,1,k - 1) up(tmp,g[n][i]);
		tmp = tmp * fac[k - m] % mod * power(fac[k],mod - 2) % mod;
		up(ans,-tmp);
		cout<<ans<<endl;
	}
	else{
		f[lmx][lmx] = 1;
		rep(i,lmx + 1,n){
			rep(j,1,k) sum[j] = (sum[j - 1] + f[i - 1][j]) % mod;
			rep(j,1,k - 1){
				f[i][j] = (f[i - 1][j - 1] * (k - j + 1) + sum[k - 1] - sum[j - 1] + mod) % mod;
			}
		}
		rep(i,lmx,n){
			rep(j,1,k - 1) up(totl[i],f[i][j]);
		}
		rep(i,0,n) rep(j,0,k) f[i][j] = 0;
		memset(sum,0,sizeof(sum));
		f[rmx][rmx] = 1;
		rep(i,rmx + 1,n){
			rep(j,1,k) sum[j] = (sum[j - 1] + f[i - 1][j]) % mod;
			rep(j,1,k - 1){
				f[i][j] = (f[i - 1][j - 1] * (k - j + 1) + sum[k - 1] - sum[j - 1] + mod) % mod;
			}
		}
		rep(i,rmx,n){
			rep(j,1,k - 1) up(totr[i],f[i][j]);
		}
		rep(i,lmx,n){
			int r = n - i - (m - lmx - rmx);
			if ( r < rmx ) break;
			up(ans,-totr[r] * totl[i] % mod);
		}
		cout<<ans<<endl;
	}
}


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

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


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define what_is(x) cerr<<#x <<" is "<<x<<endl;
#define ll long long
#define gcd(a,b) __gcd(a,b)
#define pi 2*acos(0.0)
//use emplace_back() instead of push_back()
template<typename T>
void print(T t)
{
    for(const auto& e:t)cout<<e<<" ";
    cout<<endl;
}
ll power(ll x, ll y, ll p)
{
    int res = 1;
    x = x % p;
    while (y > 0)
    {
        if (y & 1)
            res = (res*x) % p;
        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    ll a,b,c,d,e;
    cin>>a>>b>>c>>d>>e;
    if(a==0)
        cout<<1<<endl;
    else if(b==0)
        cout<<2<<endl;
    else if(c==0)
        cout<<3<<endl;
    else if(d==0)
            cout<<4<<endl;
    else
        cout<<5<<endl;
    return 0;
}



Measured memory_bytes: 3648
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <stdio.h>
#include <time.h>
#include <numeric>
#include <random>
#include <unordered_map>
#include <unordered_set>

using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int,int>;
#define rep(i,n) for(ll i = 0;i < (ll)n;i++)
#define ALL(x) (x).begin(),(x).end()
#define MOD 1000000007


int main(){
  
  int n;
  cin >> n;
  vector<ll> v(n);
  rep(i,n)cin >> v[i];
  vector<ll> s(n+1,0);
  rep(i,n)s[i+1] = (s[i]+v[i])%MOD;
  ll res = 0;
  rep(i,n){
    ll k = (s[n]-s[i+1]+MOD)%MOD;
    res = (res+k*v[i])%MOD;
  }
  cout << res << "\n";


  return 0;
}

Measured memory_bytes: 6424
#include <iostream>
#include <vector>
#include <array>
#include <set>
#include <cmath>
#include <string>
#include <queue>
#include <list>
#include <stack>
#include <unordered_map>
#include <algorithm>
#include <numeric>  // std::accumulate(m.begin(), m.end(), 0LL);
#include <functional>
#include <cassert>
#include <cctype>  // std::islower(), std::isupper(), std::tolower, std::toupper
#include <iomanip> // std::std::setprecision(X)
#include <limits>  //std::numeric_limits<int>::max(), min()

typedef long long ll;

int main (void) {
  int A, B, C, D; std::cin >> A >> B >> C >> D;

  int k = 0;
  for(int i=0; i<=100; i++) {
    if ( i >= A && i <= B && i >= C && i <= D ) k++;
  }
  std::cout << std::max(0,k - 1) << std::endl;
  return 0;
}


Measured memory_bytes: 256
#include <cassert>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>
#include <random>
#include <memory>
#include <utility>
#include <limits>
#include "limits.h"
 
#define rep(i, a, b) for (long long (i) = (a); i < (b); i++)
#define all(i) i.begin(), i.end()
#define debug(...) std::cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

void debug_out(){std::cerr<<std::endl;}

template<typename Head,typename... Tail>
void debug_out(Head h,Tail... t){
  std::cerr<<" "<<h;
  debug_out(t...);
}

 
template <typename T1, typename T2>
std::ostream& operator<<(std::ostream& os, std::pair<T1, T2> pa) {
  return os << pa.first << " " << pa.second;
}
 
template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
  for (int i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
  return os;
}
 
template<typename T1,typename T2>
inline bool chmax(T1& a,T2 b){return a<b && (a=b,true);}
 
template<typename T1,typename T2>
inline bool chmin(T1& a,T2 b){return a>b && (a=b,true);}
 
long long pow_mod(long long a, long long b, long long mod=-1) {
  if(b==0)return 1;

  if ((a == 0)||(mod!=-1&&(a+mod)%mod==0)) {
    return 0;
  }
 
  long long x = 1;
 
  while (b > 0) {
    if (b & 1) {
      x = (mod!=-1)?(x * a) % mod:x*a;
    }
    a = (mod!=-1)?(a * a) % mod:a*a;
    b >>= 1;
  }
  return x;
}
 
// const long long MOD = 998244353;
const long long MOD = 1e9 + 7;

using ll = long long;
using P = std::pair<long long, long long>;

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

  ll n;
  std::cin>>n;

  std::vector<std::vector<ll>> graph(n);

  rep(i,1,n){
    ll p;
    std::cin>>p;
    p--;
    graph[p].push_back(i);
  }

  std::vector<ll> weight(n),min(n);
  rep(i,0,n)std::cin>>weight[i];

  auto f=[&](auto f,ll now)->bool{
    ll sum=0;
    std::bitset<5001> dp;
    dp[0]=1;
    for(ll next:graph[now]){
      if(!f(f,next))return false;
      dp=(dp<<weight[next])|(dp<<min[next]);
      sum+=weight[next]+min[next];
    }
    bool isok=false;
    for(ll i=weight[now];i>=0;i--){
      if(dp[i]){
        isok=true;
        min[now]=sum-i;
        break;
      }
    }
    if(!isok){
      return false;
    }
    return true;
  };

  if(f(f,0))std::cout<<"POSSIBLE\n";
  else std::cout<<"IMPOSSIBLE\n";

  return 0;
}

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

xy = [list(map(int,input().split()))+[i] for i in range(N)]

#Union Find
#xの根を求める
def find(x):
    if par[x] < 0:
        return x
    else:
        par[x] = find(par[x])
        return par[x]
#xとyの属する集合の併合
def unite(x,y):
    x = find(x)
    y = find(y)
    
    if x == y:
        return False
    else:
        #sizeの大きいほうがx
        if par[x] > par[y]:
            x,y = y,x
        par[x] += par[y]
        par[y] = x
        return True

#xとyが同じ集合に属するかの判定
def same(x,y):
    return find(x) == find(y)

#xが属する集合の個数
def size(x):
    return -par[find(x)]


V = N#頂点の数、辺の数
v=[]

xy.sort()
for i in range(1,N):#[0][1]つなぐところ[2]距離
    v.append([xy[i-1][2],xy[i][2],min(abs(xy[i][0]-xy[i-1][0]),abs(xy[i][1]-xy[i-1][1]))])
xy.sort(key = lambda x:x[1])
for i in range(1,N):#[0][1]つなぐところ[2]距離
    v.append([xy[i-1][2],xy[i][2],min(abs(xy[i][0]-xy[i-1][0]),abs(xy[i][1]-xy[i-1][1]))])

v.sort(key = lambda x:x[2])

#初期化
#根なら-size,子なら親の頂点
par = [-1]*V

cost = 0

for i in range(0,len(v),1):
    if not same(v[i][0],v[i][1]):
        unite(v[i][0],v[i][1])
        cost+=v[i][2]

print(cost)

Measured memory_bytes: 130980
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
  long long a,b,c,k;
  cin >> a >> b >> c >> k;
  long long i;
  long long cnt = 0;
  for(i=1;i<=k;i++){
    if(a>k){
      cout << k << "\n";
      return 0;
    }
    else if(a+b>k){
      cout << a << "\n";
      return 0;
    }
    else{
      cout << a-(k-a-b) << "\n";
      return 0;
    }
  }
}


Measured memory_bytes: 3640
N = int(input())
X = [[] for i in range(N)]
for i in range(N-1):
    x, y = map(int, input().split())
    X[x-1].append(y-1)
    X[y-1].append(x-1)

P = [-1] * N
DE = [0] * N
Q = [0]
while Q:
    i = Q.pop()
    for a in X[i][::-1]:
        if a != P[i]:
            P[a] = i
            DE[a] = DE[i] + 1
            X[a].remove(i)
            Q.append(a)

def lp(u, v):
    t = 0
    while u != v:
        if DE[u] > DE[v]:
            t += 1 << u-1
            u = P[u]
        elif DE[u] < DE[v]:
            t += 1 << v-1
            v = P[v]
        else:
            t += 1 << u-1
            t += 1 << v-1
            u = P[u]
            v = P[v]
    
    return t

Y = []
M = int(input())
for _ in range(M):
    a, b = map(int, input().split())
    a, b = a-1, b-1
    Y.append(lp(a, b))

D = {1<<i: i for i in range(50)}
Z = [0] * (1<<M)
ans = 0
CC = [0] * N
for m in range(1<<M):
    a = m & (-m)
    if a == m:
        if a == 0:
            Z[m] = 0
        else:
            Z[m] = Y[D[a]]
    else:
        Z[m] = Z[m^a] | Y[D[a]]
    
    CC[N - 1 - bin(Z[m]).count("1")] += (1 if bin(m).count("1") % 2 == 0 else -1)

print(sum([2 ** i * CC[i] for i in range(N)]))

Measured memory_bytes: 49344
#pragma GCC optimize("Ofast")
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//typedef tree < int , null_type, less <int>, rb_tree_tag, tree_order_statistics_node_update> TREE;
#define ll long long
#define ull unsigned long long int
#define pb push_back
#define mp make_pair
#define vi vector<int>
#define pii pair<int,int>
#define pss pair<short,short>
#define pld pair<long double,long double >
#define ld long double
#define piii  pair<pii,int>
#define vii vector<pair<int,int> >
#define st first
#define nd second
#define pll pair<ll,ll>
#define speed ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define M_PI 3.14159265358979323846
//#define int long long
//const int mod=1000000007;
const int mod=998244353;
const int inf=1000000009;
const long long INF=1000000000000000009;
const long long big=1000000000000000;
const long double eps=0.000000000000000000001;
using namespace std;
int D[1000005],S[1000005],T[1000005],N[1000005];
int n;
bool funkcja()
{
    int l=S[n-1];
    int suma=0;
    for(int i=0;i<n;i++)
    {
        int a=N[i];
        int x=S[i],y=S[n-1-i];
        int c=1;
        if(x+y<l)
            c=2;
        c*=a;
        suma+=c;
    }
    suma%=2;
    return suma;
}
int main()
{
    speed
    cin>>n;
    for(int i=0;i<n;i++)
    {
        char z;
        cin>>z;
        T[i]=z-'0';
    }
    int jed=0;
    for(int i=0;i<n-1;i++)
    {
        N[i]=abs(T[i]-T[i+1]);
        if(N[i]==1)
            jed++;
    }
    n--;
    for(int i=2;i<=1000000;i*=2)
    {
        for(int j=i;j<=1000000;j+=i)
            D[j]++;
    }
    for(int i=1;i<=1000000;i++)
    {
        S[i]=S[i-1]+D[i];
    }
    int x=funkcja();
    if(x==1)
    {
        cout<<1;
        return 0;
    }
    if(jed>0)
    {
        cout<<0;
        return 0;
    }
    for(int i=0;i<n;i++)
        N[i]/=2;
    x=funkcja();
    if(x==1)
    {
        cout<<2;
    }
    else cout<<0;
    return 0;
}


Measured memory_bytes: 16000
#include<bits/stdc++.h>
#include <cstring>
using namespace std;
#define ll  long long
#define endl '\n'
const ll mod = 1000000007;
const double PI = 3.141592653589793238463;
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    int x;
    cin>>x;
    int y[x];
    for (int i=0;i<x;i++)
        cin>>y[i];
    ll alice=0,bob=0;
    sort(y,y+x);
    for (int i=x-1;i>=0;i-=2)
    {
        alice+=y[i];
    }
    for (int i=x-2;i>=0;i-=2)
        bob+=y[i];
    cout<<alice-bob<<endl;
    return 0;
}


Measured memory_bytes: 256
import numpy as np
I = np.array([int(_) for _ in open(0).read().split()])
N, K = I[0], I[1]
A, F = I[2:2 + N], I[2 + N:2 + 2 * N]
A = np.sort(A)
F = np.sort(F)[::-1]
lb = -1
rb = 10**13


# Min x for check(x) == True
def check(x):
    if np.sum(np.maximum(A - np.array([x]) // F, 0)) <= K:
        return 1
    else:
        return 0


while rb - lb > 1:
    mid = (rb + lb) // 2
    if check(mid):
        rb = mid
    else:
        lb = mid
print(rb)


Measured memory_bytes: 56160
#include <cstdio>
#include <vector>
#include <algorithm>

using namespace std;

using i64=long long;
using vx=vector<i64>;
using vvx=vector<vx>;

i64 numways(const vx &cards, i64 ave) {
    int n=cards.size();
    i64 x=ave;
    vx y(n);

    for (int i=0; i<n; ++i) {
        y[i] = cards[i] - ave;
        if (x < cards[i])
            x = cards[i];
    }

    vvx dp(n+1, vx((n*x)<<1|1)); dp[0][n*x]=1;
    for (int j=1; j<=n; ++j)
        for (int t=0; t<=2*n*x; ++t)
            if (t-y[j-1]>=0 && t-y[j-1]<=2*n*x) {
                dp[j][t] = dp[j-1][t] + dp[j-1][t-y[j-1]];
            } else {
                dp[j][t] = dp[j-1][t];
            }

    return dp[n][n*x]-1LL;
}

int main() {
    int n;
    i64 a;
    scanf("%d %lld", &n, &a);

    vx x(n);
    for (int i=0; i<n; ++i)
        scanf("%lld", &x[i]);

    printf("%lld\n", numways(x, a));
    return 0;
}


Measured memory_bytes: 2304
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <iterator>
#include <map>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;
using ull = unsigned long long;
using P = pair<int, int>;


ull E = 1000000007;

int main() {
    string A, B, C;
    cin >> A >> B >> C;

    char turn = 'a';
    int apos = 0, bpos = 0, cpos = 0;
    while (true) {
        switch (turn) {
            case 'a':
                if (apos == A.size()) {
                    cout << "A" << endl;
                    return 0;
                }
                turn = A[apos++];
                break;
            case 'b':
                if (bpos == B.size()) {
                    cout << "B" << endl;
                    return 0;
                }
                turn = B[bpos++];
                break;
            case 'c':
                if (cpos == C.size()) {
                    cout << "C" << endl;
                    return 0;
                }
                turn = C[cpos++];
                break;
        }
    }
}


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

using namespace std;

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

    string str;
    cin >> str;

    vector<vector<int>> dp(n + 1, vector<int>(n + 1, 0));
    int result = 0;

    for (int i = 1; i <= n; i++)
    {
        for (int j = 1; j <= n; j++)
        {
            // cout << i << " " << j << endl;
            if (str[i - 1] == str[j - 1] && i < j)
            {
                if (j - dp[i - 1][j - 1] == i)
                {
                    // cout << "Here" << endl;
                    dp[i][j] = 0;
                }
                else
                {
                    // cout << "Inside" << endl;
                    dp[i][j] = dp[i - 1][j - 1] + 1;
                    result = max(result, dp[i][j]);
                }
            }
        }
    }

    // for(int i = 0; i <= n; i++)
    // {
    //     for(int j = 0; j <= n; j++)
    //     {
    //         cout << dp[i][j] << " ";
    //     }
    //     cout << endl;
    // }
    cout << result << endl;
    return 0;
}

Measured memory_bytes: 98176
#define _DEBUG
#include "bits/stdc++.h"
#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0,a1,a2,a3,a4,x,...) x
#define debug_1(x1) cout<<#x1<<": "<<x1<<endl
#define debug_2(x1,x2) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<endl
#define debug_3(x1,x2,x3) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<endl
#define debug_4(x1,x2,x3,x4) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<", "#x4<<": "<<x4<<endl
#define debug_5(x1,x2,x3,x4,x5) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<", "#x4<<": "<<x4<<", "#x5<<": "<<x5<<endl
#ifdef _DEBUG
#define debug(...) CHOOSE((__VA_ARGS__,debug_5,debug_4,debug_3,debug_2,debug_1,~))(__VA_ARGS__)
#else
#define debug(...)
#endif
#define rep(index,num) for(int index=0;index<(int)num;index++)
#define rep1(index,num) for(int index=1;index<=(int)num;index++)
#define brep(index,num) for(int index=(int)num-1;index>=0;index--)
#define brep1(index,num) for(int index=(int)num;index>0;index--)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-7
#define mp(a1,a2) make_pair(a1,a2)
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef long long ll;
typedef long double ld;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=(ll)1e+18+1;
int INF=1e+9+1;
int main(){
	int N;
	scan(N);
	int a[10]={2,4,5,7,9,0,1,6,8,3};
	rep(i,10){
		if(N%10==a[i]){
			if(i<=4) prin("hon");
			else if(i<=8) prin("pon");
			else prin("bon");
			return 0;
		}
	}
	return 0;
}


Measured memory_bytes: 3636
#include<iostream>
#include<algorithm>
#include<functional>
using namespace std;

#if 0
このプログラムでは、襲われる期待値の高い区間から順に、予算の許す限り護衛を雇うようにすれば良い。
区間距離Dと襲われる期待値Pでペアとし、期待値Pが大きい順に並び変えを行う。
#endif

int N, M;
pair<int, int> PD[10000+5];

int main(){
  while (cin >> N >> M && N) {
    int d, p, S=0;
    for(int i=0; i < N;++i){
      cin >> d >> p;
      PD[i] = make_pair(p,d);
    }
    sort(PD, PD+N);
    // for(int i=0; i < N;++i) cout << "PD[" << i << "]= (" << PD[i].first << ", "  << PD[i].second << ")" << endl;

  for(int i=0; i<N; ++i) S += PD[i].first * PD[i].second;

  for (int i = N-1; i >= 0; --i) {
    if (M <= 0) break;
    int guarded = min(M,PD[i].second);
    S -= PD[i].first * guarded;
    M -= guarded;
  }

  cout << S << endl;
  }
}



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

typedef long long int lli;
typedef long int li;


int main(){
    ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	long long a, b;
    cin >> a >> b;
    cout << a * b << endl;
}	

/*
	check for corner cases.
	When using log check for zeros.
	Use queues and stacks if they are helping.           
                            
    (___)           
    . . )____________ 
   _|__/\           |\
  (o_o_) \__________| \
           /|     ||   )     
          < |     ||  
*/



Measured memory_bytes: 3648
#include <bits/stdc++.h>
#include <string.h>
//#include <queue>
using namespace std;
#define ll long long
#define ld long double

vector<int> ST;


void update(int id,int l, int r, int i, int v)
{
    if (i<l|| i>r) return;
    if (l==r)
    {
        ST[id]=v;
        return;
    }
    int mid =(l+r) /2;
    update(id*2, l, mid, i, v);
    update(id*2+1, mid+1, r, i, v);

    ST[id]=min(ST[id*2],ST[id*2+1]);
}

int get(int id, int l, int r, int u, int v)
{
    if (v<l || u>r) return(2000000000);
    if (u<=l && r<=v) return(ST[id]);
    int mid = (l+r)/2;
    int res = min(get (id*2, l, mid, u, v),
                   get (id*2+1, mid+1, r, u, v));
    return(res);
}

int main()
{
    char a,b,c,d;
    cin >> a >>b >>c >> d;
  	if (a==b && b==c && c==d) cout << "No"; else
    if (a==b && c==d) cout << "Yes" ; else
    if (a==c && b==d) cout << "Yes" ; else
    if (a==d && b==c) cout << "Yes" ; else cout << "No";
    return(0);
}


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

int main() {
	string s;
	cin >> s;
	int count = 0;
	for (int i = 0; i < 3; i++) {
		if(s.at(i) == 'o') {
			count++;
		}
	}
	int ans = 700 + count * 100;
	cout << ans << endl;
	return 0;
}

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

int seiyaku_check(long i,int Min,long Max){
	if(Min <= i && i <= Max){
		return 1;
	}else{
		exit(1);
	}
}

int main(){
	
	long a,b;
	
	cin >> a >> b;
	
	seiyaku_check(a,0,100);
	seiyaku_check(b,0,100000);
	
	if(a*500 >= b){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}
return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <unordered_map>
#include <math.h>
#include <algorithm>
#include <deque>
#include <queue>
#include <climits>
using namespace std;
#define rep(i,l,r) for(int i=l;i<r;i++)
#define repb(i,r,l) for(int i=r;i>l;i--)
#define ll long long
#define ull unsigned long long
#define ve vector
#define umap unordered_map
#define iter iterator 

void solve() {
    string s;cin>>s;
    for(int i=s.length()-2;i>=0;i--) {
        if(i&1) {
            int j;
            for(j=0;j<(i+1)/2;j++)
                if(s[j]!= s[(i+1)/2 +j]) break; 
            if(j >= (i+1)/2) {
                cout << i+1 << endl;
                return;
            }
        }
    }
    cout << 0 << endl;
}

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

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

using namespace std;

int main(){
  long int x,i;
  cin >> x;
  
  long int yokin = 100;
  
  for(i=0;yokin<x;i++){
    yokin=yokin+yokin*0.01;
  }
  
  cout << i << endl;
}

Measured memory_bytes: 3640
N = int(input())
H = list(map(int, input().split()))
H.reverse()
curr = 0
ans = 0
prev = H[0]
for h in H[1:]:
	if prev <= h:
		curr += 1
	else:
		ans = max(curr, ans)
		curr = 0
	prev = h
ans = max(ans, curr)
print(ans)

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

#ifdef LOCAL
#include "dump.hpp"
#else
#define dump(...)
#define dumpv(...)
#endif

#define rep(i, n) for (int i = 0; i < (n); i++)
#define mins(x, y) (x = min(x, y))
#define maxs(x, y) (x = max(x, y))
typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
const int MOD = 1e9 + 7;
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;

void solve() {
  int n, m;
  cin >> n >> m;
  vvi to(n);
  rep(i, m) {
    int s, t;
    cin >> s >> t;
    s--, t--;
    to[s].push_back(t);
  }
  vector<double> dp(n);
  for (int u = n - 2; 0 <= u; u--) {
    double sum = 0.0;
    for (int v : to[u]) {
      sum += dp[v];
    }
    dp[u] = sum / to[u].size() + 1;
  }
  dump(dp);
  double ans = dp[0];
  for (int u = 0; u < n - 1; u++) {
    if (to[u].size() == 1) continue;
    int cu = u, cv = -1;
    for (int v : to[u]) {
      if (cv < 0 || dp[cv] < dp[v]) cv = v;
    }
    auto calc = [&]() {
      vector<double> dp2(n);
      for (int u = cu; 0 <= u; u--) {
        double sum = 0.0;
        for (int v : to[u]) {
          if (u == cu && v == cv) continue;
          sum += (v <= cu ? dp2[v] : dp[v]);
        }
        dp2[u] = sum / (u == cu ? to[u].size() - 1 : to[u].size()) + 1;
      }
      dump(cu, cv, dp2);
      return dp2[0];
    };
    ans = min(ans, calc());
  }
  cout << ans << endl;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  // freopen("temp.1", "r", stdin);
  solve();
  return 0;
}

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

typedef long long ll;

/* メモリ食い過ぎ注意 */
#define int ll
#define ALL(v) v.begin(), v.end()
#define _REP(i, n) for (int i = 0; i < n; i++)
#define REP(n) _REP(i, n)

/* define const */
const ll INF = (1ll << 60);
const ll MOD = (ll)1e9 + 7;
/* end defineing */

signed main()
{
    ll n, nn;
    cin >> n;
    nn = n;
    int digit = 0;
    while (n)
    {
        digit++;
        n /= 10;
    }
    ll ans = 0;
    ll sum = 0;
    for (int i = 0; i < digit - 1; i++)
    {
        ans += 9;
        sum += 9 * pow(10, i);
    }

    // cout << sum << "," << ans << endl;
    // cout << nn << endl;
    // cout << pow(10, digit - 1) << endl;
    // cout << lldiv(nn, pow(10, digit - 1)).quot << endl;
    // cout << ll(nn / pow(10, digit - 1)) % 10 << endl;
    for (int i = ll(lldiv(nn, pow(10, digit - 1)).quot) % 10; i >= 0; i--)
    {
        if (sum + i * pow(10, digit - 1) <= nn)
        {
            // cout << "i" << i << endl;
            cout << ans + i << endl;
            break;
        }
        // cout << "=" << sum + i * pow(10, digit - 1) << endl;
    }
}

Measured memory_bytes: 256
package main
import "fmt"
func main() {
  var s,t string
  fmt.Scan(&s,&t)
  n := len(s)
  m := len(t)
  set := make(map[string]struct{})
  for i:=0;i<n;i++ { set[s[i:i+1]] = struct{}{} }
  for i:=0;i<m;i++ {
    if _,ok := set[t[i:i+1]];!ok { fmt.Println(-1);return }
  }
  nxt := make([][]int,n)
  for i:=0;i<n;i++ { nxt[i] = make([]int,26) }
  idx := make([]int,26)
  for i:=0;i<26;i++ { idx[i] = -1 }
  for i:=n-1;i>=0;i-- { idx[ord(s[i:i+1])] = n+i }
  now := int64(-1)
  for i:=n-1;i>=0;i-- {
    for j:=0;j<26;j++ {
      if idx[j] < 0 { continue }
      nxt[i][j] = idx[j]-i
    }
    idx[ord(s[i:i+1])] = i
    if s[i:i+1] == t[0:1] { now = int64(i) }
  }
  for i:=1;i<m;i++ {
    now += int64(nxt[(now)%int64(n)][ord(t[i:i+1])])
  }
  fmt.Println(now+1)
}
func ord(s string) int {
  return int([]rune(s)[0])-97
}

Measured memory_bytes: 24704
#include<bits/stdc++.h>
using namespace std;
int main(){
	int a,b;
	cin>>a>>b;
	if(a + b > 0){
		cout<<1<<endl;
	}
	else if(a + b <0){
		cout<<-1<<endl;
	}
	else if(a > 0 && a+b == 0 || a<0 && a+b == 0){
		cout<<0<<endl;
	}
}


Measured memory_bytes: 3136
#include<stdio.h>
#include<stdlib.h>
#include<string.h>


int x,S[1000],top=0;
void push(int);
int pop();

int main(){
  int y,z;
  char s[100];

  while( scanf("%s", s) != EOF ){
    if ( s[0] == '+' ){
      y=pop(),z=pop();
      push(y+z);
    } else if ( s[0] == '-' ){
      y=pop(),z=pop();
      push(z-y);
    } else if ( s[0] == '*' ){
      y=pop(),z=pop();
      push(y*z);
    } else {
      x = atoi(s);
      push(x);
    }
  }
  printf("%d\n",pop());
  return 0;
}


void push(int x){
top++;
S[top]=x;
}

int pop(){
top--;
return S[top+1];
}

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

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

template<class T>
inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

template<class T>
inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}

# define EPS (1e-7)
# define INF (1e9)
# define PI (acos(-1))
//const ll mod = 1000000007;

string s;
int K;

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

    vector<string> substrings;
    for (int i = 0; i < s.length(); ++i) {
        for (int j = 1; j <= K; ++j) {
            substrings.push_back(s.substr(i, j));
        }
    }
    sort(substrings.begin(), substrings.end());

    unique(substrings.begin(), substrings.end());
    cout << substrings[K-1] << endl;
    return 0;
}

Measured memory_bytes: 1660
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    int n,T;cin>>n>>T;
    vector<int> t(n);
    ll ans=0;
    for(int i=0;i<n;i++){
        cin>>t[i];
    }
    for(int i=0;i<n-1;i++){
        ans+=min(T,t[i+1]-t[i]);
    }
    ans+=T;
    cout<<ans<<endl;
}

Measured memory_bytes: 1024
N, X, Y = map(int, input().split())


counts = [0] * N
for i in range(1, N):
    for j in range(i+1, N+1):
        # i -> x 直接
        d1 = abs(j-i)
        # i -> X -> Y -> j
        d2 = abs(i-X) + abs(Y-j) + 1

        d = min(d1, d2)
        counts[d] += 1


for i in range(1, N):
    print(counts[i])

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

using namespace std;

int main(){
 string s;
  long k;
  cin >> s >> k;
  
 for(int i=0;i<s.size();i++){
  if((s[i]-'a')&&k>=('z'+1-s[i])) {
    k-='z'+1-s[i];
    s[i]='a';
  }
 }
  k%=26;
  s[s.size()-1]+=k;
   
  cout << s << endl;
}


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

int main() {
  string s; cin >> s;
  string odd, even;
  for (int i = 0; i < s.size(); i++) {
    if ((i + 1) % 2 == 0) even += s[i];
    else odd += s[i];
  }
  
  int L_num = count(odd.begin(), odd.end(), 'L');
  int R_num = count(even.begin(), even.end(), 'R');
  
  if (L_num + R_num == 0) cout << "Yes" << endl;
  else cout << "No" << endl;
  
  return 0;
}

Measured memory_bytes: 256