akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>

using namespace std;

constexpr int MIN = -1000000;
constexpr int MAX = 1000000;

int main() {
  int K, X;
  cin >> K >> X;

  vector<int> result;

  for (int i = (X + 1 - K); i < X + K; i++) {
    if (i < MIN) continue;
    if (i > MAX) break;
    result.emplace_back(i);
  }

  for (size_t i = 0; i < result.size() - 1; i++) {
    cout << result[i] << " ";
  }
  cout << result[result.size() - 1] << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
template <typename A, typename B>
string to_string(pair<A, B> p);

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);

string to_string(const string &s)
{
    return '"' + s + '"';
}

string to_string(const char *s)
{
    return to_string((string)s);
}

string to_string(bool b)
{
    return (b ? "true" : "false");
}

string to_string(vector<bool> v)
{
    bool first = true;
    string res = "{";
    for (int i = 0; i < static_cast<int>(v.size()); i++)
    {
        if (!first)
        {
            res += ", ";
        }
        first = false;
        res += to_string(v[i]);
    }
    res += "}";
    return res;
}

template <size_t N>
string to_string(bitset<N> v)
{
    string res = "";
    for (size_t i = 0; i < N; i++)
    {
        res += static_cast<char>('0' + v[i]);
    }
    return res;
}

template <typename A>
string to_string(A v)
{
    bool first = true;
    string res = "{";
    for (const auto &x : v)
    {
        if (!first)
        {
            res += ", ";
        }
        first = false;
        res += to_string(x);
    }
    res += "}";
    return res;
}

template <typename A, typename B>
string to_string(pair<A, B> p)
{
    return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p)
{
    return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p)
{
    return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}

void debug_out() { cerr << endl; }

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T)
{
    cerr << " " << to_string(H);
    debug_out(T...);
}

typedef long long ll;
typedef pair<int, int> pii;
#define mp make_pair
#define fst first
#define snd second
#define fr(i, a, b) for(int i=a; i<b; i++)
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;

int main() {
    cin.tie(nullptr); ios::sync_with_stdio(false);
    int n; cin >> n;
    map<ll, ll> m; 
    ll ss = 0;
    for(int i=0; i<n; i++){
        int a; cin >> a; m[a]++; ss+=a;
    }
    int q; cin >> q;
    for(int i=0; i<q; i++) {
        ll b, c; cin >> b>> c;
        ss = ss - m[b] * b + m[b] * c;
        m[c] += m[b]; m[b] = 0;
        cout << ss << endl;
    }
}


Measured memory_bytes: 9520
import java.util.Scanner;
public class Main{

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		
		int n = stdIn.nextInt();
		int T = stdIn.nextInt();
		
		int[] t = new int[n];
		
		for(int i = 0; i < n; i++) {
			t[i] = stdIn.nextInt();
		}
		
		long time = 0;
		
		for(int i = 0; i< n-1; i++) {
			if(t[i]+T <= t[i+1]) {
				time += T;
			}else {
				time += t[i+1]-t[i];
			}
			
			
			
		}
		
		time += T;
		
		System.out.println(time);
		
		
		
	}

}


Measured memory_bytes: 64520
#include<iostream>
#include<math.h>
#include<vector>
#include<algorithm>
#include<numeric>
#include<map>
using namespace std;

int main(){
    int a,b,k,M,m,i;
    vector<int>v(1,0);
    cin>>a>>b>>k;
    M=max(a,b);
    m=min(a,b);
    i=m;
    while(i>=1){
        if(M%i==0&&m%i==0)v.push_back(i);
        --i;
    }
    cout<<v[k]<<endl;
    return 0;
}

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

using namespace std;
typedef long long ll;

int sum(ll n) {
    if (n < 10) { return n; }
    return sum(n / 10) + n % 10;
}

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

    ll wa = sum(N);

    if (N % wa == 0) {
        cout << "Yes";
    } else {
        cout << "No";
    }

    return 0;
}


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

#define ll long long

template<typename T> void drop(const T &x){cout<<x<<endl;exit(0);}

void solve() {
  uint64_t n; cin >> n;

  uint64_t a, i=1;
  while(i*i <= n) {
    if(n%i==0) a=i;
    ++i;
  }
  uint64_t b = n/a, ans=0;
  while(b) {
    b/=10; ++ans;
  }
  cout << ans << '\n';

  return;
}

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int T=1;
  //cin >> T;
  while(T--) solve();

  return 0;
}


Measured memory_bytes: 3632
using System;
using System.Linq;

class Program
{
    static void Main(string[] args)
    {
		const int COIN = 500;
		var input = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();
		var _K = input[0];
		var _X = input[1];
		Console.WriteLine(COIN * _K >= _X ? "Yes" : "No");
	}
}

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

#define EPS (1e-10)
#define equals(a, b) (fabs((a) - (b)) < EPS)

class Point {
    public:
    double x, y;
    
    Point(double x = 0, double y = 0): x(x), y(y) {}

    Point operator + (Point p) { return Point(x + p.x, y + p.y); }
    Point operator - (Point p) { return Point(x - p.x, y - p.y); }
    Point operator * (double a) { return Point(a * x, a * y); }
    Point operator / (double a) { return Point(x / a, y / a); }

    double abs() {
        return sqrt(norm());
    }
    double norm() {
        return x * x + y * y;
    }

    bool operator < (const Point &p) const {
        return x != p.x ? x < p.x : y < p.y;
    }

    bool operator == (const Point &p) const {
        return fabs(x - p.x) < EPS && fabs(y - p.y) < EPS;
    }
};

typedef Point Vector;

double dot(Vector a, Vector b) {
    return a.x * b.x + a.y * b.y;
}

double cross(Vector a, Vector b) {
    return a.x * b.y - a.y * b.x;
}

struct Segment {
    Point p1, p2;
};

typedef Segment Line;

class Circle {
    public:
        Point c;
        double r;
        Circle(Point c = Point(), double r = 0.0): c(c), r(r) {}
};

typedef vector<Point> Polygon;

bool isParallel(Segment s1, Segment s2) {
    return equals(cross((s1.p2 - s1.p1), (s2.p2 - s2.p1)), 0.0);
}

bool isOrthogonal(Segment s1, Segment s2) {
    return equals(dot((s1.p2 - s1.p1), (s2.p2 - s2.p1)), 0.0);
}

int main() {
    int q;
    cin >> q;
    Segment s1, s2;
    double x1, y1, x2, y2, x3, y3, x4, y4;
    for (int i = 0; i < q; i++) {
        cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3>> x4 >> y4;
        Point p1 = {x1, y1};
        Point p2 = {x2, y2};
        s1 = {p1, p2};
        Point p3 = {x3, y3};
        Point p4 = {x4, y4};
        s2 = {p3, p4};

        if (isParallel(s1, s2)) {
            cout << "2" << endl;
        } else if (isOrthogonal(s1, s2)) {
            cout << "1" << endl;
        } else {
            cout << "0" << endl;
        }
    }
}


Measured memory_bytes: 3224
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
using namespace std;

int count_lrl(string s) {
    int len = s.length();
    bool on_l = false;
    bool on_lr = false;
    int pos = 0;
    int cnt = 0;

    while (pos < len) {
        if (s[pos] == 'R') {
            if (on_l)
                on_lr = true;
            on_l = false;
            pos++;
            continue;
        }
        if (s[pos] == 'L') {
            if (on_lr)
                cnt++;
            on_l = true;
            on_lr = false;
            pos++;
        }
    }
    return cnt;
}

int count_happy(string s) {
    int len = s.length();
    int cnt = 0;
    if (len == 1) return 0;

    if (s[0] == 'R' && s[1] == 'R')
        cnt++;
    if (s[len - 1] == 'L' && s[len - 2] == 'L')
        cnt++;

    for (int i = 1; i < len - 1; i++) {
        if (s[i] == 'L' && s[i - 1] == 'L')
            cnt++;
        if (s[i] == 'R' && s[i + 1] == 'R')
            cnt++;
    }

    return cnt;
}

int main() {
    int n, k;
    cin >> n >> k;
    string s;
    cin >> s;
    int lrl = count_lrl(s);
    string r(s);
    for (int i = 0; i < n; i++) {
        r[i] = (r[i] == 'R') ? 'L' : 'R';
    }
    int rlr = count_lrl(r);
    int cnt = count_happy(s);

    int rem_turn = k;
    if (lrl > rlr) {
        cnt += min(lrl, k) * 2;
        rem_turn -= min(lrl, k);
    } else {
        cnt += min(rlr, k) * 2;
        rem_turn -= min(rlr, k);
    }

    if (rem_turn > 0)
        cnt = n - 1;

    cout << cnt << endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#include <cmath>
#include <iostream>
#include <numeric>
#define ll long long
using namespace std;
int main() {
  ll ans=0,ANS=0,N,cnt=0,A;
  cin>>N;
  ll a=N;
  while(a){
    a/=10;
    cnt++;
  }
  a=N;
  A=pow(10,cnt-1);
  N=N/A*A-1;
  while(N){
    ans+=N%10;
    N/=10;
  }
  while(a){
    ANS+=a%10;
    a/=10;
  }
  cout<<max(ans,ANS)<<endl;
}



Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#define rep(i,n) for(int i=0;i<(n);i++)
#define psortsecond(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.second<b.second;});
#define psortfirst(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.first<b.first;});
#define All(x) (x).begin(),(x).end()
using namespace std;
using pii  = pair<int,int>;
long long gcd(long long a, long long b){return (b == 0 ? a : gcd(b, a%b));}
long long lcm(long long a, long long b){return a*b/gcd(a,b);}
typedef long long ll;
#define MOD 1000000007
#define EPS 10e-8

int main() {
    ll A[4];
    rep(i,1){
        cin >> A[i];
    }
    //sort(A,A+3);
    cout << (A[0]/100==A[0]%10 ? "Yes" : "No") << endl;
}

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

constexpr int lim = 1005;
int cum[2][lim+1][lim+1];
char c[lim+1];
int n, k;

void init(){
  REP(l, 2)REP(y, k)REP(x, k){
    cum[l][y+1][x+1] += cum[l][y][x+1] + cum[l][y+1][x] - cum[l][y][x];
  }
}

int solve(){
  int ans = 0;
  REP(l, 2)REP(y, k+1)REP(x, k+1){
    int sc = cum[l][k][k] - cum[l][y][k] - cum[l][k][x] + 2*cum[l][y][x]
      + cum[(l+1)%2][y][k] + cum[(l+1)%2][k][x] - 2*cum[(l+1)%2][y][x];
    ans = max(ans, sc);
  }

  return ans;
}

int main(){
  cin >> n >> k;
  
  int x, y; char c;

  REP(i, n){
    cin >> x >> y >> c;
    int cc = ((c == 'B' ? 0 : 1) + x/k + y/k)&1;
    cum[cc][y%k + 1][x%k + 1]++;
  }  

  init();

  cout << solve() << endl;

  return 0;
}


Measured memory_bytes: 8192
#pragma GCC optimize(2)
#include<bits/stdc++.h>
#define ll long long
#define maxn 2000005
#define inf 1e9
#define pb push_back
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define per(i,a,b) for(int i=a;i>=b;i--)
using namespace std;

inline int read()
{
	int x=0,w=1; char c=getchar();
	while(c<'0'||c>'9') {if(c=='-') w=-1; c=getchar();}
	while(c<='9'&&c>='0') {x=(x<<1)+(x<<3)+c-'0'; c=getchar();}
	return w==1?x:-x;
}

int main()
{
	string s; cin>>s;
	if(s[1]=='R'&&s[0]=='R'&&s[2]=='R') puts("3");
	else if(s[1]=='S'&&s[0]=='S'&&s[2]=='S') puts("0");
	else if((s[1]=='R'&&s[0]=='R')||(s[1]=='R'&&s[2]=='R')) puts("2");
	else puts("1");
	return 0;
}

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

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

template<typename T,typename V>
typename enable_if<is_class<T>::value==0>::type
fill_v(T &t,const V &v){t=v;}

template<typename T,typename V>
typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t,const V &v){
  for(auto &e:t) fill_v(e,v);
}

//INSERT ABOVE HERE
signed main(){
  Int n,m;
  cin>>n>>m;

  const Int MOD = 1e9+7;
  auto dp=make_v<Int>(m+1,n+1,n+1);
  fill_v(dp,0);
  dp[0][1][n-1]=1;
  for(Int i=0;i<m;i++){
    for(Int j=0;j<=n;j++){
      for(Int k=0;k<=n;k++){
	if(j+k>n) continue;
	dp[i][j][k]%=MOD;
	dp[i+1][n-k][k]+=dp[i][j][k]*j%MOD;
	dp[i+1][j][k-1]+=dp[i][j][k]*k%MOD;
	dp[i+1][j][k]+=dp[i][j][k]*(n-(j+k))%MOD;	
      }
    }
  }
  dp[m][n][0]%=MOD;
  cout<<dp[m][n][0]<<endl;
  return 0;
}


Measured memory_bytes: 216832
#include <stdio.h>

int main(void) {
	int n = 0, num[10] = {0};
	while(scanf("%d", &num[n]) != EOF){
		if(num[n] == 0){
			n--;
			printf("%d\n", num[n]);
		}
		else{
			n++;
		}
	}
	return 0;
}

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

int main(){
	int n,y;
  	cin >> n >> y;
  	y/=1000;
  	for(int i = 0; i <= n && i*10 <= y; i++) {
    	for(int j = 0; j <= n-i && i*10+j*5 <= y; j++) {
        	if(i*10+j*5+(n-i-j) == y) {
            	printf("%d %d %d\n", i, j, n-i-j);
              	return 0; 
            }
        }
    }
  	printf("-1 -1 -1\n");
}

Measured memory_bytes: 256
lines = []
while line = gets
    lines << line.chomp.split(' ').map(&:to_i)
end

N = lines[0][0]

cand = []
for i in 1..10**5 do
  if lines[1][0] % i == 0 then
    cand.push(i)
    cand.push(lines[1][0] / i)
  end
  if lines[1][1] % i == 0 then
    cand.push(i)
    cand.push(lines[1][1] / i)
  end
end
cand.uniq!.sort!

ans = 0
cand.each do |i|
  num_div = 0
  for j in 1..N do
    if lines[1][j-1] % i == 0 then
      num_div += 1
    end
  end
  if num_div >= N-1 then
    ans = i
  end
end
    
puts ans

Measured memory_bytes: 21720
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,n-1,0)
#define all(v) v.begin(), v.end()
#define endk '\n'
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;
const ld eps = 1e-10;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n; cin >> n;
  vector<ll> A(n), sum(n+1);
  rep(i, n) {
    cin >> A[i];
    sum[i+1] = sum[i]+A[i];
  }
  ll mn = longinf;
  rep(i, n-1) {
    mn = min(abs(sum[n]-2*sum[i+1]), mn);
  }
  cout << mn << endk;
  return 0;
}


Measured memory_bytes: 6152
#include <iostream>
#include <string>
#include <algorithm>
#include <math.h>
#include <map>
#include <set>
using namespace std;
typedef long long ll;
#define rep(i,s,n)for(ll i = s;i<n;i++)
#define repe(i,s,n)for(ll i = s;i<=n;i++)

int main() {
	string s, t; cin >> s >> t;
	sort(s.begin(), s.end());
	sort(t.begin(), t.end());
	reverse(t.begin(), t.end());

	cout << (s < t ? "Yes" : "No") << endl;
	return 0;
}

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

typedef long long ll;

using namespace std;

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

	ll old_n = 1;
	n -= 1;
	string ans = "";
	if (n == 0) ans = "a";
	else {
		while (n >= 0 && old_n > 0) {
			old_n = n;
			int result = n % 26;
			ans += string(1, (char)(result + 97));
			n /= 26;
			n -= 1;
		}
		reverse(ans.begin(), ans.end());
	}
	cout << ans << endl;
	return 0;


}


Measured memory_bytes: 3632
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) {
		FastReader sc = new FastReader();
		int n = sc.nextInt();
		System.out.println(3*n*n);
	}
	
	static class FastReader 
    { 
        BufferedReader br; 
        StringTokenizer st; 
  
        public FastReader() 
        { 
            br = new BufferedReader(new
                     InputStreamReader(System.in)); 
        } 
  
        String next() 
        { 
            while (st == null || !st.hasMoreElements()) 
            { 
                try
                { 
                    st = new StringTokenizer(br.readLine()); 
                } 
                catch (IOException  e) 
                { 
                    e.printStackTrace(); 
                } 
            } 
            return st.nextToken(); 
        } 
  
        int nextInt() 
        { 
            return Integer.parseInt(next()); 
        } 
  
        long nextLong() 
        { 
            return Long.parseLong(next()); 
        } 
  
        double nextDouble() 
        { 
            return Double.parseDouble(next()); 
        } 
  
        String nextLine() 
        { 
            String str = ""; 
            try
            { 
                str = br.readLine(); 
            } 
            catch (IOException e) 
            { 
                e.printStackTrace(); 
            } 
            return str; 
        } 
    } 
}


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

int main() {
  int x,y;
  cin>>x>>y;
  bool ans=0;
  rep(i,x+1){
    if(i*2+(x-i)*4==y)ans=1;
  }
  if(ans){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
}

Measured memory_bytes: 3648
n, t = map(int, input().split())
a = list(map(int, input().split()))
thenumberofgoodpairs = 0
maxpricedifference = 0
minimumprice = float("inf")
for appleprice in a :
    if minimumprice > appleprice :
        minimumprice = appleprice
    elif appleprice - minimumprice == maxpricedifference :
        thenumberofgoodpairs += 1
    elif appleprice - minimumprice > maxpricedifference :
        maxpricedifference = appleprice - minimumprice
        thenumberofgoodpairs = 1
print(thenumberofgoodpairs)

Measured memory_bytes: 14244
import heapq
n, m = map(int, input().split())
l = [tuple(map(int, input().split())) for _ in range(n)]
l = sorted(l, key=lambda x:x[0], reverse=True)
res = 0
q = []
for i in range(1, m+1):
    while l and l[-1][0] <= i:
        heapq.heappush(q, -1 * l.pop()[1])
    if q:
        res += -1 * heapq.heappop(q)
print(res)

Measured memory_bytes: 18952
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <queue>
#include <numeric>
#include <string>
#include <string.h>
#include <map>
#include <set>
#include <functional>
#include <complex>
#include <stack>
#include <tuple>
#include <array>
using namespace std;
#define rep(i,n) for (int i=0; i < (n); i++)


typedef long long int ll;
typedef double D;      // ??§?¨?????????????double???long double?????????
typedef complex<D> P;  // Point
typedef pair<P, P> L;  // Line
typedef vector<P> VP;


const int INF = (1<<30) - 1;
const D EPS = 1e-9;

#define X real()
#define Y imag()
#define LE(n,m) ((n) < (m) + EPS)
#define GE(n,m) ((n) + EPS > (m))
#define EQ(n,m) (abs((n)-(m)) < EPS)

int N, M;

//g++ -std=c++0x -msse4.2 -O3
//#include <bits/stdc++.h>
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    //cout.precision(16);
    //cout.setf(ios::fixed);
    
    cin >> N >> M;
    vector<int> s(N), t(N);
    vector<int> p(M);
    
    for(int i=0; i<N; i++)
        cin >> s[i] >> t[i];
    for(int i=0; i<M; i++)
        cin >> p[i];
    sort(p.begin(), p.end());
    
    vector<int> odd_sum(M);
    vector<int> even_sum(M);
    for(int i=1; i<M; i++){
        odd_sum[i] += odd_sum[i-1];
        even_sum[i] += even_sum[i-1];
        
        if(i%2 == 1){
            odd_sum[i] += p[i]-p[i-1];
        }else{
            even_sum[i] += p[i]-p[i-1];
        }
    }
    
    ll ans = 0;
    for(int i=0; i<N; i++){
        bool change = false;
        if(s[i] > t[i]){
            swap(s[i], t[i]);
            change = true;
        }
        
        int lb = lower_bound(p.begin(), p.end(), s[i]) - p.begin();
        int ub = lower_bound(p.begin(), p.end(), t[i]) - p.begin() - 1;
        
        int d = 0;
        if(ub < lb){
            d = t[i] - s[i];
        }else{
            if(change? ub%2 == 1: lb%2 == 0)
                d += even_sum[ub] - even_sum[lb];
            else
                d += odd_sum[ub] - odd_sum[lb];
           
            if((ub - lb)%2 == 1){
                d += p[lb] - s[i] + t[i] - p[ub];
            }else{
                if(change)
                    d += t[i] - p[ub];
                else
                    d += p[lb] - s[i];
            }
        }
        ans += d;
    }
    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 3112
#include <algorithm>
#include <bitset>
#include <cmath>
#include <complex>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <vector>

const int MOD = 1e9 + 7;
const int iINF = 2147483647 / 2;
const long long int llINF = 9223372036854775807 / 2;

using namespace std;
using ll = long long int;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vvvl = vector<vector<vector<ll>>>;

typedef pair<ll, ll> pll;
bool paircomp(const pll &a, const pll &b) {
  if (a.first == b.first)
    return a.second < b.second;
  return a.first < b.first;
}

#define REP(i, n) for (ll i = 0; i < (n); i++)
#define RREP(i, n) for (ll i = (n)-1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define AUTO(i, m) for (auto &i : m)
#define ALL(a) (a).begin(), (a).end()
#define MAX(vec) *std::max_element(vec.begin(), vec.end())
#define MIN(vec) *std::min_element(vec.begin(), vec.end())
#define ARGMAX(vec)                                                            \
  std::distance(vec.begin(), std::max_element(vec.begin(), vec.end()))
#define ARGMIN(vec)                                                            \
  std::distance(vec.begin(), std::min_element(vec.begin(), vec.end()))
#define REV(T) greater<T>()
#define PQ(T) priority_queue<T, vector<T>, greater<T>>
#define VVL(a, b, c) vector<vector<ll>>(a, vector<ll>(b, c))
#define VVVL(a, b, c, d)                                                       \
  vector<vector<vector<ll>>>(a, vector<vector<ll>>(b, vector<ll>(c, d)))
#define SP(a) setprecision(a)
#define SQRT(a) sqrt((long double)(a))
#define DPOW(a, b) pow((long double)(a), (long double)(b))
#define UNIQUE(vec)                                                            \
  do {                                                                         \
    sort(ALL((vec)));                                                          \
    (vec).erase(std::unique(ALL((vec))), (vec).end());                         \
  } while (0)

ll POW(ll n, ll m) {
  if (m == 0) {
    return 1;
  } else if (m % 2 == 0) {
    ll tmp = POW(n, m / 2);
    return (tmp * tmp);
  } else {
    return (n * POW(n, m - 1));
  }
}

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

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ll N;
  cin >> N;
  vl A(N), B(N), C(N - 1);
  REP(i, N) cin >> A[i];
  REP(i, N) cin >> B[i];
  REP(i, N - 1) cin >> C[i];

  ll ans = 0;
  REP(i, N) {
    ans += B[A[i] - 1];
    if (i >= 1 && A[i] - 1 == A[i - 1]) {
      ans += C[A[i - 1] - 1];
    }
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string.h>
#include <math.h>
#include <stdio.h>
using namespace std;
int main() {
    int n,i,a,b,c,d;
    char s[100000][3];
    a=0;
    b=0;
    c=0;
    d=0;
    cin>>n;
    for (i = 0; i < n; ++i) {
        cin>>s[i];
        if (s[i][0]=='A')
        {
            a++;
        }
        if (s[i][0]=='W')
        {
            b++;
        }
        if (s[i][0]=='T')
        {
            c++;
        }
        if (s[i][0]=='R')
        {
            d++;
        }
    }
    cout<<"AC"<<" "<<"x"<<" "<<a<<endl;
    cout<<"WA"<<" "<<"x"<<" "<<b<<endl;
    cout<<"TLE"<<" "<<"x"<<" "<<c<<endl;
    cout<<"RE"<<" "<<"x"<<" "<<d<<endl;
    return 0;
}

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

int main() {
    string s;
    cin >> s;
    int n = s.size();
    int ans = n;
    for (int i = 0; i < n - 1; i++) {
        if (s[i] != s[i + 1]) {
            ans = min(ans, max(i + 1, n - i - 1));
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 512
#include <stdio.h>

int main(void) 
{
	int i,n,k=0;
	long seisuu[210]={0};	
	int hantei = 0;
	
	scanf("%d", &i );
	
	for (n = 0 ; n < i ; n++)
		scanf("%ld",&seisuu[n]);
		

	while (hantei == 0)	
	{
		
		for (n = 0 ; n < i ; n++)
		{
			if (seisuu[n] % 2 != 0) 
			{hantei = 1;
			break;}
			else	seisuu[n] /= 2	;	
		} 
		if (hantei == 0)
			k++;	
	}
	
	printf("%d",k);
	return 0;
}

/*配列の中の数字を全部2で割った後入れなおす*/

Measured memory_bytes: 128
str1 = input()
count = int(input())

for i in range(count):
    args = input().split()
    (a,b) = [int(x) for x in args[1:3]]
    if args[0] == 'print':
        print(str1[a:b + 1])
    elif args[0] == 'reverse':
        str1 = str1[0:a] + str1[a:b + 1][::-1] + str1[b + 1:]
    elif args[0] == 'replace':
        str1 = str1[0:a] + args[3] + str1[b + 1:]

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

char c;

int main(){
	cin>>c;
	c++;
	cout<<c<<endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <string>
using namespace std;
#define PI 3.14159265359
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
  string S;
  cin >> S;
  int ans[4];
  int b = 0;
  rep(i, 4) { ans[i] = 0; }

  rep(i, 4) {
    int a = 0;
    rep(j, 4) {
      if (S[i] == S[j]) a += 1;
    }
    if (a == 2) b++;
  }

  if (b == 4)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;

  return 0;
}


Measured memory_bytes: 256
cards = {
        'S': [0] * 13,
        'H': [0] * 13,
        'C': [0] * 13,
        'D': [0] * 13
}
 
n = int(input())
 
for i in range(n):
    s,num = input().split()
    num = int(num)
    cards[s][num - 1] = 1
 
for c in ["S","H","C","D"]:
    for i in range(13):
        if cards[c][i] == 0:
            print(c, str(i + 1))


Measured memory_bytes: 5600
#include <math.h>
#include <ctype.h>
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, n) for (int i = a; i < n; i++)
#define REP(i, n) for(int i = 0; i < n; i++)
struct omt{omt(){ios::sync_with_stdio(false);cin.tie(0);}}star;

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


    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define pb push_back
#define endl '\n'
#define MOD 1000000007
#define MOD2 998244353

using namespace std;
typedef long long int ll;

vector<ll> dp[101];
ll a[100010][2];
int lim;
int n;

int main(void)
{
	fast;
	#ifndef ONLINE_JUDGE
	// freopen("in", "r", stdin);
	// freopen("out", "w", stdout);
	#endif

	cin >> n;
	ll w; cin >> w;
	for (int i = 0; i < n; ++i)
	{
		cin >> a[i][0] >> a[i][1];
		dp[i] = vector<ll>(100010, 1000000000000000000);
	}
	dp[0][a[0][1]] = a[0][0];
	dp[0][0] = 0;
	for (int pos = 1; pos < n; ++pos)
	{
		dp[pos] = dp[pos-1];
		for (int val = 0; val <= 100000-a[pos][1]; ++val)
		{
			if (dp[pos-1][val] + a[pos][0] <= w)
				dp[pos][val+a[pos][1]] = min(dp[pos][val+a[pos][1]], dp[pos-1][val] + a[pos][0]);
		}
	}
	for (int val = 100000; val >= 0; --val)
	{
		if (dp[n-1][val] < 1000000000000000000)
		{
			cout << val;
			return 0;
		}
	}
}

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

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

#ifdef LOCAL_DEBUG
  #include "LOCAL_DEBUG.hpp"
#endif

signed main(){

  int a,b; cin >> a >> b;
  int cnt = 0;
  int c = 1;
  while(c < b){
    c = (c-1) + a;
    cnt++;
  }
  cout << cnt << endl;


  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(){
	char a[5];
	int count=0;
	scanf("%s",a);
	for(int i=0;i<4;++i){
		for(int j=i+1;j<4;++j){
			if(a[i]==a[j])
				count ++;
		}
	}
	if(count==2)
		printf("Yes");
	else
		printf("No");
		return 0;
	}
	
				

Measured memory_bytes: 128
// AUTHOR:: MOHAMMAD FAISAL
// BEGINNING WITH THE NAME OF ALMIGHTY GOD ALLAH
#include<bits/stdc++.h>
using namespace std;
int main(){
 
    int n;
    cin >> n;
    string s;
    cin >> s;
    vector<char> v;
    for(int i=0;i<n;i++)
        v.push_back((char)s[i]);
    
    vector<char>::iterator it;
    it = unique(v.begin(),v.end());
    v.resize(distance(v.begin(),it));
//    for(auto &k: v){
//        cout<<k<<" ";
//    }
//    cout<<endl;
    cout<<(int)v.size()<<endl;
    return 0;
}
      
// 1,2,4,8,16,32,64...


Measured memory_bytes: 640
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#define PI 3.141592653589793
#define MOD 1000000007
//#define DEBUG

//qsort用、昇順
int compare_int(const void *a, const void *b)
{
	return *(int*)a-*(int*)b;
}
//qsort(array, 10, sizeof(int), compare_int)

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

	int tt, ft, s, tmp, syo;
	tt = -1;
	ft = -1;
	s = -1;

	if(y%1000 != 0) printf("%d %d %d\n", tt, ft, s);
	else{
		for(int i=0;i<=n; i++){
			tmp = i*10000;
			if(tmp>y) break;
			for(int j=0;j<=n;j++){
				if(i+j>n) break;
				tmp = i*10000+j*5000;

				syo = (y-tmp)/1000;
				if(i+j+syo == n){
					tt = i;
					ft = j;
					s = syo;

					i = n+1;
					j = n+1;
				}
			
			}
		}
	
		printf("%d %d %d\n", tt, ft, s);
	}
	
	return 0;
}


Measured memory_bytes: 1692
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n: usize = read();
    let mut ac: u64 = 0;
    let mut wa: u64 = 0;
    let mut tle: u64 = 0;
    let mut re: u64 = 0;

    for _ in 0..n {
        let mes:String = read();
        match &mes[..] {
            "AC" =>{
                ac += 1;
            }
            "WA" =>{
                wa += 1;
            }
            "TLE" =>{
                tle += 1;
            }
            "RE" =>{
                re += 1;
            }
            _ => (),
        }
    }
    print!("AC x {}\n" , ac);
    print!("WA x {}\n" , wa);
    print!("TLE x {}\n" , tle);
    print!("RE x {}\n" , re);
}


Measured memory_bytes: 2124
#include<stdio.h>


int main(void)
{
  for(;;){
  int p,q;

  int x, y, s;
  int n;
  int i,j,t=0;
  int go;

    

  scanf("%d %d %d",&x,&y,&s);
  // 前率,後率,前合計
  if(x==0)
	break;

  for(i=1;i<=s-1;i++)
    {
      for(j=1;j<=s-1;j++)
	{
            p=i*(100+x)/100;
	    q=j*(100+x)/100;
	    if(p+q==s)
	      {
                  go=i*(100+y)/100+j*(100+y)/100;
                  if(go>t)
                   {
	              t=go;
                   }
	      }
	}
   }
   printf("%d\n",t);
    }
      






  
   /*
  n = 100*s/(100+x);

  for(i=1;i<=n-1;i++)
   {
     go[i]=i*(100+y)/100+(n-i)*(100+y)/100;
     if(go[i]>go[i-1])
       {
	 t=go[i];
       }
   }
   printf("%d\n",t);
   */	 
    return 0;
}

Measured memory_bytes: 600
function check(y,x){
   if(y<0 || x<0){return Infinity;}
   else {return yx[y][x];}
}
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var Arr=(input.trim()).split("\n");
var hw=(Arr.shift()).split(" ").map(Number);
var h=hw[0];
var w=hw[1];
var yx=[];
for(var i=0;i<h;i++){
   var arr=(Arr.shift()).split("").map(Number);
   yx.push(arr);
}
for(var i=0;i<h;i++){
   for(var j=0;j<w;j++){
      if(i==0 && j==0)continue;
      yx[i][j]=Math.min(check(i-1,j),check(i,j-1))+yx[i][j];
   }
}
console.log(yx[h-1][w-1]);

Measured memory_bytes: 8540
def gene_swap_perm(n)
  return [[0]] if n==1
  return [[0,1],[1,0]] if n==2
  return [[0,1,2],[1,0,2],[0,2,1]] if n==3
  ret=gene_swap_perm(n-1)
  ret.map!{|perm|perm<<(n-1)}
  gsp=gene_swap_perm(n-2)
  gsp.each{|perm|ret<<(perm<<(n-1)<<(n-2))}
  ret
end

M=1_000_000_007
h,w,k=gets.split.map(&:to_i)
gsp=gene_swap_perm(w)
dp=Array.new(w,0)
dp[0]=1
h.times{
  _dp=Array.new(w,0)
  gsp.each{|perm|
    perm.each_with_index{|i,j|
      _dp[i]=(_dp[i]+dp[j])%M
    }
  }
  dp=_dp
}

puts dp[k-1]

Measured memory_bytes: 1788
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    N, a, b = map(int, readline().split())

    ans = pow(2, N, MOD) - 1
    ans %= MOD

    def comb_mod(n, r):
        res = 1
        r = min(n - r, r)

        for i in range(r):
            res *= (n - i)
            res %= MOD
            res *= pow((r - i), MOD - 2, MOD)

        return res

    ans -= comb_mod(N, a)
    ans -= comb_mod(N, b)
    ans %= MOD

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 67604
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

fn read_vec2<T: std::str::FromStr>(n: usize) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}

fn read_col<T: std::str::FromStr>(n: usize) -> Vec<T> {
    (0..n).map(|_| read()).collect()
}

fn main() {
    let nk: Vec<u64> = read_vec();
    let n = nk[0];
    let k = nk[1];

    if k % 2 == 0 {
        let h = k / 2;
        let x = n / h;
        let e = x / 2;
        let o = (x + 1) / 2;
        println!("{}", o * o * o + e * e * e);
    } else {
        let t = n / k;
        println!("{}", t * t * t);
    }
}


Measured memory_bytes: 4352
#include<iostream>
using namespace std;
int main(){
  int n,m,l,r,a,b,ans;
  cin >> n >> m;
  for(int i=0;i<m;i++){
    cin >> l >> r;
    if(i==0){
      a=l;
      b=r;
    }
    if(l>a) a=l;
    if(r<b) b=r;
  }
  if(b-a<0) ans=0;
  else      ans=b-a+1;
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <utility>
#include <cmath>
#include <functional>
#include <queue>
//#include <stack>
#include <climits>
#include <map>
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,n1,n2) for(int i=n1;i<n2;i++)
#define put(a) cout<<a<<endl;
#define all(a)  (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
using namespace std;
typedef long long ll;
//typedef unsigned long long ull;
typedef pair<int, int> P;

int n;
int evc = 0;
ll cnt = 0;
const int m = 100001;

void c(int& a){
    if(a){
        cnt++;
        if(a%2==0){
            evc++;
            a=1;
        }else{
            a=2;
        }
    }
}

int main() {
    cin >> n;
    vector<int> a(m,0);
    REP(i,n){
        int b;
        cin >> b;
        a[b]++;
    }
    REP(i,m){
        c(a[i]);
    }
    if(evc%2==1){
        cnt--;
    }
    put(cnt);
    return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long n,i,ans;
	ans=0;
	string s;
	cin>>n;
	cin>>s;
	for(i=0;i<n-1;i++)
	{
		if (s[i]!=s[i+1])
		{
			ans++;
		}
	}
	cout<<ans+1<<endl;
}

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int n,i,j,k,it,lst,cyc,d[200200],cnt[11][11],dig[11][11],fin[11][11],fc[11][11],fd[11][11],was[11],posc[11],posd[11];
long long c[200200],r;
int main() {
  scanf("%d",&n);
  for (i=0; i<n; i++) {
    scanf("%d%lld",&d[i],&c[i]);
  }
  for (i=0; i<10; i++) {
    for (j=0; j<10; j++) {
      was[j]=++it;
      posc[j]=posd[j]=0;
      k=i+j;
      cnt[i][j]=1;
      dig[i][j]=1;
      while (k>=10 || was[k]!=it) {
       //if (i==2)  printf(" %d..%d",i,k);
        if (k<10) {
          was[k]=it;
          posc[k]=cnt[i][j];
          posd[k]=dig[i][j];
        }
        if (k<10) {
          k=i+k;
          dig[i][j]++;
        } else k=k/10+k%10;
        //printf(" -> %d\n",k);
        cnt[i][j]++;
      }
      fin[i][j]=k;
      fc[i][j]=posc[k]; cnt[i][j]-=posc[k];
      fd[i][j]=posd[k]; dig[i][j]-=posd[k];
      //if (dig[i][j]==0)
      //printf("%d %d = %d %d | %d %d (%d)\n",i,j,cnt[i][j],dig[i][j],fc[i][j],fd[i][j],fin[i][j]);
      //if (i==2) printf("%d %d\n",d[n-1],int(c[n-1]));
    }
  }
  lst=d[n-1]; c[n-1]--;
  for (i=n-1; i>=0; i--) if (c[i]!=0) {
    //printf("%d %d\n",i,lst);
    if (c[i]>=fd[d[i]][lst]) {
      //printf("%d %d cc=%d r=%d\n",dig[d[i]][lst],cnt[d[i]][lst],int(c[i]),int(r));
      //fflush(stdout);
      c[i]-=fd[d[i]][lst];
      r+=fc[d[i]][lst];
      lst=fin[d[i]][lst];
      //printf("=%d\n",lst);
      cyc=dig[d[i]][lst];
      r+=(c[i]/cyc)*cnt[d[i]][lst];
      c[i]%=cyc;
      //printf("%d %d cc=%d r=%d\n",dig[d[i]][lst],cnt[d[i]][lst],int(c[i]),int(r));
      //fflush(stdout);
    }
    //printf("iters: %d\n",int(c[i]));
    //fflush(stdout);
    for (j=0; j<c[i]; j++) {
      lst=d[i]+lst;
      r++;
      while (lst>=10) {
        lst=lst/10+lst%10;
        r++;
      }
    }
  }
  printf("%lld\n",r);
  return 0;
}


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

#define INF (1LL<<60)

long long Solve(long long H, long long W){
	long long ans=INF;

	for(long long h=1;	h<H; h++){
		long long w=W/2,	Sa,Sb,Sc,M,m;
		Sa=h*W;

		// 1.
		Sb=(H-h)*w;
		Sc=(H-h)*(W-w);

		M=max(Sa, max(Sb,Sc));	m=min(Sa, min(Sb,Sc));
		ans=min(ans,M-m);

		//2,
		long long tmp=(H-h)/2;
		Sb=tmp*W;
		Sc=(H-h-tmp)*W;

		M=max(Sa, max(Sb,Sc));	m=min(Sa, min(Sb,Sc));
		ans=min(ans,M-m);
	}
	return ans;
}

int main(){
	long long H,W;	cin>>H>>W;
	
	cout<<min(Solve(H,W), Solve(W,H))<<endl;

	return 0;
}


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG//TLEの原因になるので注意！！！！！！！！！！！
#include<cmath>
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
vector<int> arr;
stack<int> st;
queue<int> qu;
queue<pair<int,int> > qu2;
priority_queue<int> pq;
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define rep2(i,n) for(int i=1; i<=(int)(n); i++)
#define mins(x,y) x=min(x,y)
#define maxs(x,y) x=max(x,y)
typedef set<int> set_t;
typedef set<string> set_g;
typedef complex<double> xy_t;
static const int NIL = -1;
static const int INF = 1000000007;
#define mp make_pair
#define sz(x) int(x.xise())
#define mod 1000000007
#define reps(i,s,n) for(int i = s; i < n; i++)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
deque<int> deq;
#define fi first
#define se second
//#define int long long

//cerrはコメントアウトしなくても通る//ただしTLEを引き起こすことがある

ll N,M,H,W,K,Q,A,B;
string S;
//const ll MOD = 998244353;
const ll MOD = (1e+9) + 7;
//const ll INF = 1LL << 60;
//typedef pair<ll,ll> P;
typedef pair<int, int> P;
bool chmx(int &a, int b) {
	if (b > a) {
		a = b;
		return true;
	}
	return false;
}

bool chmn(int &a, int b) {
	if (b < a) {
		a = b;
		return true;
	}
	return false;
}

int main(){
    int k,x;
    cin >> k>>x;
    if(k*500>=x){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
    return 0;
}



Measured memory_bytes: 256
# -*- coding: utf-8 -*-
#ABC143A
import sys
import math
import collections
#sys.setrecursionlimit(100000)


#n=int(input())

tmp = input().split()
a,b = list(map(lambda a: int(a), tmp))



sum = a
sum -=b
sum -=b
if (sum<0):
	sum=0


print(sum)



Measured memory_bytes: 3436
#include <stdio.h>

int main(void)
{
    long long x, y, z, N;
    long long tmp, count[10000];
    scanf("%lld",&N);
    for(int i=0; i<N; i++) count[i] = 0;
    for(z=1; z<100; z++){
        for(y=1; y<=z; y++){
            for(x=1; x<=y; x++){

                tmp = x*x+y*y+z*z+x*y+y*z+z*x;

                if(tmp <= N) {
                    if(x==y && y==z){
                        count[tmp-1]++;
                    } else if(x==y || y==z || z==x){
                        count[tmp-1]+=3;
                    } else {
                        count[tmp-1]+=6;
                    }
                }

            }
        }
    }

    for(int i=0; i<N; i++) {
        printf("%lld\n",count[i]);
    }

    return 0;
}

Measured memory_bytes: 1744
#include<iostream>
#include<vector>
#include<set>
using namespace std;
#define inRange(x,a,b) (a <= x && x < b)

int main(){
    int n, caseNum = 1;
    while(cin >> n, n){
        vector<vector<vector<int>>> v(5, vector<vector<int>>(5, vector<int>(5)));
        for(int i = 0; i < 5; i++){
            for(int j = 0; j < 5; j++){
                for(int k = 0; k < 5; k++){
                    char c; cin >> c;
                    v[i][j][k] = c-'0';
                }
            }
        }
        set<int> death, alive;
        int k, x;
        cin >> k;
        while(k-- > 0)  cin >> x, death.insert(x);
        cin >> k;
        while(k-- > 0)  cin >> x, alive.insert(x);

        for(int i = 0; i < n; i++){
            vector<vector<vector<int>>> next(5, vector<vector<int>>(5, vector<int>(5)));
            vector<vector<vector<int>>> around(5, vector<vector<int>>(5, vector<int>(5, 0)));
            for(int j = 0; j < 5; j++){
                for(int k = 0; k < 5; k++){
                    for(int l = 0; l < 5; l++){
                        if(v[j][k][l] == 0) continue;
                        for(int dj = -1; dj <= 1; dj++){
                            for(int dk = -1; dk <= 1; dk++){
                                for(int dl = -1; dl <= 1; dl++){
                                    if(dj==0 && dk==0 && dl==0) continue;
                                    if(inRange(j+dj,0,5)&&inRange(k+dk,0,5)&&inRange(l+dl,0,5)){
                                        around[j+dj][k+dk][l+dl]++;
                                    }
                                }
                            }
                        }
                    }
                }
            }
            for(int j = 0; j < 5; j++){
                for(int k = 0; k < 5; k++){
                    for(int l = 0; l < 5; l++){
                        if(v[j][k][l]){
                            next[j][k][l] = alive.count(around[j][k][l]);
                        }else{
                            next[j][k][l] = death.count(around[j][k][l]);
                        }
                    }
                }
            }
            v = next;
        }

        if(caseNum-1)   cout << endl;
        cout << "Case " << caseNum++ << ":" << endl;
        for(int i= 0; i < 5; i++){
            if(i)   cout << endl;
            for(int j = 0; j < 5; j++){
                for(int k = 0; k < 5; k++){
                    cout << v[i][j][k];
                }
                cout << endl;
            }
        }

    }
    return 0;
}


Measured memory_bytes: 3184
import java.util.*;

class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int[][] A = new int[3][N+1];
    for(int row=1; row<=2;row++){
      for(int col=1;col<=N;col++){
        A[row][col] = sc.nextInt();
      }
    }
    int[][] record = new int[3][N+2];
    for(int col=N;col>=1;col--){
      record[2][col] = A[2][col] + record[2][col+1];
    }
    for(int col=1;col<=N;col++){
      record[1][col] = record[1][col-1] + A[1][col];
    }
    int max = Integer.MIN_VALUE;
    for(int i=1;i<=N;i++){
      int cur = record[1][i]+record[2][i];
      max = Math.max(cur,max);
    }
    System.out.println(max);
  }
}


Measured memory_bytes: 23892
#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll A,B,C,X,Y;
ll mini=1000000,dap=0,maxi;
int main()
{
    scanf("%lld %lld %lld %lld %lld",&A,&B,&C,&X,&Y); C*=2;
    dap = A*X+B*Y;
    mini=min(X,Y); maxi = max(X,Y);
    dap = min(dap,(C*mini)+(A*(X-mini))+(B*(Y-mini)));
    dap = min(dap,(C*maxi));
    printf("%lld",dap);
}


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

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

int main() {
  int n,r;
  cin >> n >> r;
  int ans=0;
  if(n<=9){
    ans=r+100*(10-n);
  }
  else{
    ans=r;
  }
  cout << ans << endl;
  

  return 0;

}


Measured memory_bytes: 3600
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <iomanip>
using namespace std;

typedef long long ll;

int main() {
	int M,D;cin>>M>>D;

	int ans = 0;
	for (int i = 1; i <= M; i++)
	{
		for (int j = 1; j <= D; j++)
		{
			int d1,d10;
			d1 = j%10;
			d10 = j/10;
			if(d1<2||d10<2)continue;

			if(i==d1*d10)ans++;
		}
	}

	cout<<ans<<endl;

	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <climits>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <vector>
#include <complex>
#include <numeric>
#define _for(i,n) for(int i = 0; i < n; i++)

typedef long long ll;
typedef unsigned long long ull;

using namespace std;

template <typename T>
vector<size_t> sort_indexes(const vector<T> &v) {
  vector<size_t> idx(v.size());
  iota(idx.begin(), idx.end(), 0);
  sort(idx.begin(), idx.end(), [&v](size_t i1, size_t i2) {return v[i1] < v[i2];});
  return idx;
}

int main() {
  int a,b,t;
  cin >> a >> b >> t;
  cout << (t/a)*b << endl;
  return 0;
}

Measured memory_bytes: 256
n = int(input(''))
alist = input('').split(' ')

h = {}
for i in range(1,n):
    a = int(alist[i-1])
    if not a in h.keys():
        h[a]=0
    h[a]+=1

for i in range(1,n+1):
    if i in h.keys():
        print(h[i])
    else:
        print(0)


Measured memory_bytes: 44976
#include <bits/stdc++.h>
#define deb(x) cout<<#x<<" "<<x<<endl;
#define ll long long int
#define ld long double
#define fo(i, n) for(ll i = 0; i<n; i++)
#define Fo(i, a, n) for(ll i = a; i<n; i++)
#define vi vector<int>
#define vl vector<ll>
#define pb push_back
#define pi pair<int, int>
#define pl pair<ll, ll>
#define u_m unordered_map
#define u_s unordered_set
#define p_q priority_queue
using namespace std;
const int N = 1e3+2;
const int W = 1e5+2;
ll dp[W][N];
const ll MOD = 1e9+7;
void solve()
{
	int n, w;
	cin>>n>>w;
	vl a(n+1, 0);
	vi v(n+1, 0);
	Fo(i, 1, n+1) cin>>v[i]>>a[i];	
	Fo(i, 0, n+1)
	{
		Fo(x, 0, w+1)
		{
			if(x==0 || i==0) dp[x][i] = 0;
			else if(x-v[i]<0) dp[x][i] = dp[x][i-1];
			else dp[x][i] = max(dp[x-v[i]][i-1]+a[i], dp[x][i-1]);
			//deb(x); deb(i);
			//cout<<dp[x][i]<<endl;
		}
	}	
	cout<<dp[w][n]<<endl;
}
int main()
{
    ios::sync_with_stdio(NULL);
    cin.tie(NULL); cout.tie(NULL);
    int t;
    //cin>>t;
    //while(t--)
		solve();	
    return 0;
}


Measured memory_bytes: 782080
#include <iostream>
#include <algorithm>
#include <math.h>

using namespace std;

const int N = 1000 * 100 + 1000; 
int T[N];
int H[N];

#define INF 10000000001

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

	for(int i = 1; i <= n; i ++){
		T[i] = INF;
		int hi; 
		cin >> hi;
		H[i] = hi;
	}
	T[1] = 0;

	for(int i = 1; i <= n; i++){
		for(int j = 1; j <=k; j ++){
		T[i+j] = min(T[i+j], abs(H[i +j] - H[i]) + T[i]);
		}
	}

	cout << T[n];

	int s; cin >> s;
	return 0;
}

Measured memory_bytes: 1024
#include<stdio.h>
int main(void)
{
        int a[100],x,n,i,j,tmp;
        scanf("%d%d",&n,&x);
        for(i=0;i<n;i++) scanf("%d",&a[i]);
        for(i=1;i<n;i++){
                j=i;
                while((j>0)&&(a[j]>a[j-1])){
                        tmp=a[j]; a[j]=a[j-1]; a[j-1]=tmp;
                        j=j-1;
                }
        }
        for(i=0;i<n;i++) x-=a[i];
        printf("%d\n",n+x/a[n-1]);
        return 0;
}


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

using namespace std;


int main()
{
    string S;
    int ans0=0;
    int ans1=0;
    
    cin >> S;

    for(int i=0;i<S.length();i++){
            if(S[i]!=(i%2==0 ? '0':'1'))ans0+=1;
            if(S[i]!=(i%2==0 ? '1':'0'))ans1+=1;            
    }

    cout << min(ans0,ans1) <<endl;
	return 0;
}

Measured memory_bytes: 512