akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<vector>
#include<functional>
#include<iomanip>
#include<queue>
#include<cassert>
#include<tuple>
#include<set>
#include<map>
#include<list>
#include<bitset>

#define PB push_back
#define ALL(a)  (a).begin(),(a).end()
#define all(v) begin(v), end(v)
#define DWN(a)  (a).begin(),(a).end(), greater<int>()
#define rep(i, m) for (int i = 0; i < m; i++)
#define REP(i, n, m) for (int i = n; i < m; i++)

using namespace std;

typedef long long ll;
typedef pair<int, int> P;

const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };
const int INF = (int)1e9;
const ll MOD{ (ll)1e9 + 7 };

int n;
ll a, b, h[100010];

bool enough(ll t) { //判定
	ll cnt = 0;
	rep(i, n) {
		if (h[i] > b * t) {
			cnt += (h[i] - b * t + a - b - 1) / (a - b);
		}
	}
	return (cnt <= t ? true : false);
}

int binary() { //にぶたん
	int ok = INF, ng = 0;

	while (abs(ok - ng) > 1) {
		int mid = (ok + ng) / 2;
		if (enough(mid)) ok = mid;
		else ng = mid;
	}
	
	return ok;
}

int main() {
	cin >> n;
	cin >> a >> b;
	rep(i, n) cin >> h[i];
	cout << binary() << endl;
	return 0;
}

Measured memory_bytes: 1024
use std::io;
use std::io::BufRead;

fn main() {
    let stdin = io::stdin();
    for (i, line) in stdin.lock().lines().enumerate() {
        let x: u16 = line.unwrap().trim().parse().unwrap();
        match x {
            0 => break,
            _ => println!("Case {}: {}", i+1, x),
        }
    }
}


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

bool isPalindrome(string str) {
    bool flag = true;
    int n = str.length();
    for (int i = 0; i < n/2; ++i) {
        if (str[i] != str[n-i-1]) {
            flag = false;
        }
    }
    return flag;
}

int main() {
    string s; cin >> s;
    int n = s.length();
    string sub1 = s.substr(0, (n-1)/2);
    string sub2 = s.substr((n+3)/2-1, n-(n+3)/2+1);
    cerr << "sub1: " << sub1 << endl;
    cerr << "sub2: " << sub2 << endl;
    if (isPalindrome(s) and isPalindrome(sub1) and isPalindrome(sub2)) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#![allow(non_snake_case)]
#![allow(unused_variables)]

fn main() {
    let (N, K): (usize, usize) = {
        let mut line: String = String::new();
        std::io::stdin().read_line(&mut line).unwrap();
        let mut iter = line.split_whitespace();
        (
            iter.next().unwrap().parse().unwrap(),
            iter.next().unwrap().parse().unwrap()
        )
    };
    let A: Vec<i64> = {
        let mut line: String = String::new();
        std::io::stdin().read_line(&mut line).unwrap();
        line.split_whitespace()
            .map(|x| x.parse().unwrap())
            .collect()
    };

    let mut c = vec![0; N + 1];
    for a in A {
        c[a as usize] += 1;
    }
    let mut b: Vec<_> = c.iter().filter(|&&z| z > 0).map(|&z| z).collect();
    b.sort();
    let m = b.len();
    let ans = if m <= K {
        0
    } else {
        let mut res = 0;
        for i in 0..(m - K) {
            res += b[i];
        }
        res
    };

    println!("{}", ans);
}


Measured memory_bytes: 10492
import java.util.Scanner;

class Main{
   private static int n,min,max,ip;
   private static long sum;

    
  public static void main(String[] args){
    
    Scanner s= new Scanner(System.in);
   
     n=s.nextInt();
    ip=s.nextInt();

     min=ip;
      max=ip;
      sum=ip;
  for(int i=1;i<n;i++){
      
      ip=s.nextInt();
      
      
       if(max<ip){
          max=ip;
      }
      
      if(min>ip){
          min=ip;
      }
     sum+=ip;
      
  }
      System.out.println(min+" "+max+" "+sum);
      
      
  }}


Measured memory_bytes: 41528
import sys
from collections import Counter, deque, defaultdict
from itertools import accumulate, permutations, combinations, takewhile, compress, cycle
from functools import reduce
from math import ceil, floor, log10, log2, factorial
from pprint import pprint

sys.setrecursionlimit(1000000)
# MOD = 10 ** 9 + 7
# N = int(input())
# A = [int(x) for x in input().split()]
# V = [[0] * 100 for _ in range(100)]
# A = [int(input()) for _ in range(N)]

S = input()


def f(c):
    s = list(S)
    cnt = 0
    while s.count(c) != len(s):
        newS = [None] * (len(s) - 1)
        for i in range(len(s) - 1):
            if s[i] == c or s[i + 1] == c:
                newS[i] = c
            else:
                newS[i] = s[i]
        s = newS
        cnt += 1
    return cnt


ans = float('inf')
for s in set(S):
    ans = min(ans, f(s))

print(ans)

Measured memory_bytes: 4072
#include <iostream>
#include <map>

using namespace std;
using ll = long long;

#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=(a);i<(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)

#define out(v) cout<<v<<"\n"

int main() {
  cin.tie(0); ios::sync_with_stdio(false);
  string S;
  cin >> S;
  int N = S.size();

  map<char, int> m;
  rep(i, N) ++m[S[i]];
  int sum = N;
  ll ans = 1;
  for (const auto& v : m) {
    sum -= v.second;
    ans += (ll)sum * v.second;
  }
  out(ans);

  return 0;
}


Measured memory_bytes: 720
#include <bits/stdc++.h>
#define int long long
#define vi vector <int>
#define si set <int>
#define mii map <int,int>
#define pii pair <int,int>
#define endl "\n"
#define ZERO 0ll
#define FOR(P,Q) for(int P=0;P<(Q);P++)
#define FORR(P,Q) for(int P=1;P<=(Q);P++)
#define rep(P,R,Q) for(int P=(R);P<=(Q);P++)
#define repb(P,R,Q) for(int P=(R);P>=(Q);P--)
#define pb push_back
#define eb emplace_back
#define bug(j) cerr<<j<<" "
#define NL cerr<<endl
#define D1(arr,a) rep(i,1,a) bug(arr[i]) 
typedef long long ll;
typedef long double ld;
using namespace std;


    
int32_t main()
{
	ios_base::sync_with_stdio(0);
	cout.tie(0);
	cin.tie(0);
	#ifndef ONLINE_JUDGE
	freopen("error.txt","w",stderr);
	#endif
	//change ll to int before using string builtin operations
	int tces=1;
	//cin>>tces;
	while(tces--){
    int n;
    cin>>n;
    vi a(n+5), b(n+5), c(n+5), ans1(n+5), ans2(n+5), ans3(n+5);
    FORR(i,n){
    	cin>>a[i]>>b[i]>>c[i];
    }
    ans1[1] = a[1];
    ans2[1] = b[1];
    ans3[1] = c[1];
    rep(i,2,n){
    	ans1[i]=a[i]+max(ans2[i-1],ans3[i-1]);
    	ans2[i]=b[i]+max(ans1[i-1],ans3[i-1]);
    	ans3[i]=c[i]+max(ans2[i-1],ans1[i-1]);
    }
    cout<<max(ans1[n],max(ans2[n],ans3[n]));

  }
	
return 0;
}

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

using namespace std;

int N;

double distance(double x1, double x0, double y1, double y0) {
  return sqrt((x1-x0)*(x1-x0)+(y1-y0)*(y1-y0));
}


int main() {
  cin >> N;
  int x[N], y[N];
  rep(i, N) {
    cin >> x[i] >> y[i];
  }
  int arr[N];
  rep(i, N) arr[i] = i;

  
  double sum1 = 0;
  double sum2 = 0;
  int Npaths = 0;
  do {
    Npaths++;
    sum2 = 0;
    rep1(i, N) {
      sum2 += distance(x[arr[i]], x[arr[i-1]], y[arr[i]], y[arr[i-1]]);
    }
    sum1 += sum2;
  } while (next_permutation(arr, arr+N));
  sum1 = sum1 / Npaths;
  printf("%.8lf", sum1);
  
}

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

using namespace std;

int n;
int a[1000];

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

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

    bool ok=true;
    for(int i=0;i<n;i++)
        if(a[i]%2==0 && a[i]%3!=0 && a[i]%5!=0)
            ok=false;
    if(ok)
        cout<<"APPROVED";
    else
        cout<<"DENIED";
	return 0;
}


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

int main(){
    long long N;
    long long A;
    map<long long, int> m;
    cin >> N;
    
    for(int i=0; i<N; i++){
        cin >> A;
        if (m.count(A) == 0){
            m[A] = 1;
        }
        else{
            cout << "NO";
            return 0;
        }
    }
    cout << "YES";
    return 0;
}

Measured memory_bytes: 12800
n = gets.to_i
tree = Array.new(n) { [] }
(0...(n - 1)).each do
  a, b, c = gets.chomp.split(' ').map(&:to_i)
  tree[a - 1] << [b - 1, c]
  tree[b - 1] << [a - 1, c]
end

q, k = gets.chomp.split(' ').map(&:to_i)
visited = Hash.new(false)
visited[k - 1] = true
queue = [k - 1]
distances = Array.new(n, 0)

while queue.count > 0
  node_index = queue.shift
  visited[node_index] = true
  tree[node_index].each do |target|
    next if visited[target[0]]
    distances[target[0]] = distances[node_index] + target[1]
    queue << target[0]
  end
end

(0...q).each do
  x, y = gets.chomp.split(' ').map{ |i| i.to_i - 1 }
  puts distances[x] + distances[y]
end

Measured memory_bytes: 34940
#include<bits/stdc++.h>
using namespace std;
typedef long t;
t N,K,i,num,min_value,p,tmp;
vector<pair<t,t> >td;
bool used[1<<17];
priority_queue<t,vector<t>,greater<t>>d;
int main(){
  cin>>N>>K;
  td.resize(N);
  for(i=0;i<N;i++)cin>>td[i].second>>td[i].first;
  sort(td.rbegin(),td.rend());
  for(i=0;i<K;i++){
    tmp+=td[i].first;
    if(used[td[i].second]){
      d.push(td[i].first);
    }else{
      used[td[i].second]=true;
      num++;
    }
  }
  p=tmp+num*num;
  for(i=K;i<N;i++){
    if(!used[td[i].second]){
      if(!d.size())break;
      used[td[i].second]=true;
      num++;
      tmp+=td[i].first;
      min_value=d.top();d.pop();
      tmp-=min_value;
      p=max(p,tmp+num*num);
    }
  }
  cout<<p<<endl;
  return 0;
}


Measured memory_bytes: 2556
#include <stdio.h>
#include <string.h>

#define ABS(x, y) ((x) > (y) ? ((x) - (y)) : ((y) - (x)))

typedef struct {
	int max;
	int min;
	int hade;
} CLOTH;

CLOTH cloth[200];


int main(void)
{
    int D, N;
	int i, j, k;
    int temp[200];
    int hade[101], hade_tmp[101];
    int max;
    
	scanf("%d%d", &D, &N);
	
	for (i = 0; i < D; i++){
		scanf("%d", &temp[i]);
	}
    
	for (i = 0; i < N; i++){
		scanf("%d%d%d", &cloth[i].min, &cloth[i].max, &cloth[i].hade);
	}
	
    memset(hade, -1, sizeof(hade));
    for (i = 0; i < N; i++){
        if (cloth[i].min <= temp[0] && temp[0] <= cloth[i].max){
            hade[cloth[i].hade] = 0;
        }
    }
    
    for (i = 1; i < D; i++){
        memset(hade_tmp, -1, sizeof(hade_tmp));
        for (j = 0; j <= 100; j++){
            if (hade[j] >= 0){
                for (k = 0; k < N; k++){
                    if (cloth[k].min <= temp[i] && temp[i] <= cloth[k].max){
                        if (hade_tmp[cloth[k].hade] <= hade[j] + ABS(j, cloth[k].hade)){
                            hade_tmp[cloth[k].hade] = hade[j] + ABS(j, cloth[k].hade);
                        }
                    }
                }
            }
        }
        memcpy(hade, hade_tmp, sizeof(hade));
    }
    
    max = 0;
	for (i = 0; i <= 100; i++){
        if (max < hade[i]){
		    max = hade[i];
        }
	}
	
    printf("%d\n", max);

	return (0);
}

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

void solve(long long a, long long b) {
  if (a == b) {
    cout<< a + b - 2<<endl;
    return;
  }

  if (a < b) swap(a, b);
  long long ans = b - 1;
  long long s = sqrt(a * b);
  if (s * (s + 1) < a * b) {
    ans += s + min(s - b, a - s);
  } else if (s * s < a * b) {
    ans += s + min(s - b - 1, a - s - 1);
  } else {
    ans += s - 1 + min(s - b - 1, a - s - 1);
  }
  cout<<ans<<endl;
}
int main() {
  int n;
  cin>>n;
  for (int i=0; i<n; i++) {
    long long a, b;
    cin>>a>>b;
    solve(a, b);
  }
}

Measured memory_bytes: 256
def gcd(x, y):
    m = max(x, y)
    n = min(x, y)
    while n != 0:
        tmp = n
        n = m % n
        m = tmp
    return m


def resolve():
    x, y = [int(i) for i in input().split()]
    print(gcd(x, y))


resolve()



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

using namespace std;

int main(){
    int n;
    cin >> n;
    vector <int> a(n);
    vector <pair <long long,long long>> pre(n),suf(n);
    for(int i=0;i<n;i++){
        cin >> a[i];
    }
    pre[1]={a[0],a[1]};
    int ind=0;
    long long sum = a[0]+a[1], isum=a[0];
    for(int i=2;i<n;i++){
        sum+=a[i];
        while(ind<i) {
            long long cur = max(sum - isum, isum) - min(sum - isum, isum);
            long long upd = max(sum - isum - a[ind + 1], isum + a[ind + 1]) - min(sum - isum - a[ind + 1], isum + a[ind + 1]);
            if (upd < cur) {
                ind++;
                isum += a[ind];
            }
            else{
                break;
            }
        }
        pre[i]={isum,sum-isum};
    }
    suf[n-2] = {a[n-1],a[n-2]};
    ind=n-1;
    sum = a[n-1]+a[n-2], isum=a[n-1];
    for(int i=n-3;i>=0;i--){
        sum+=a[i];
        while(ind>i) {
            long long cur = max(sum - isum, isum) - min(sum - isum, isum);
            long long upd = max(sum - isum - a[ind - 1], isum + a[ind - 1]) - min(sum - isum - a[ind - 1], isum + a[ind - 1]);
            if (upd < cur) {
                ind--;
                isum += a[ind];
            }
            else{
                break;
            }
        }
        suf[i]={isum,sum-isum};
    }
    long long ans=sum;
    for(int i=1;i<=n-3;i++){
        long long mx1=max(pre[i].first,pre[i].second),mx2=max(suf[i+1].first,suf[i+1].second),mx=max(mx1,mx2);
        long long mi1=min(pre[i].first,pre[i].second),mi2=min(suf[i+1].first,suf[i+1].second),mi=min(mi1,mi2);
        ans=min(ans,mx-mi);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 7296
#include<bits/stdc++.h>
using namespace std;
int main()
{
ios::sync_with_stdio(false);
cin.tie(NULL);
  long long n,val;
  cin>>n;
  vector<long long>dp(n,1);
 vector<long long>vect(n);

    for(long long i=0;i<n;i++)
    {
        cin>>val;
        vect[i]=val;
    }
    long long ans=0,c=0;
    for(long long i=0;i<n-1;i++)
    {  
            if(vect[i+1]<=vect[i])
           {
               c++;
               ans=max(ans,c);
           }
           else
           {
               c=0;
           }
           
           //ans=max(ans,c);
    }
    cout<<ans;
 return 0; 
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1e18;
const ll MOD = 1e9 + 7;
#define all(v) v.begin(), v.end()
#define repi(i, n, init) for (ll i = init; i < (n); i++)
#define repd(i, n, init) for (ll i = (n); i >= init; i--)
#define repm(i, m) for (auto i = m.begin(); i != m.end(); i++)
#define repb(bit, n, init) for (ll bit = init; bit < (1 << n); ++bit)

class Dice
{
public:
    Dice()
    {
        number = new int[6];
        tmp = new int[6];
    };
    ~Dice()
    {
        delete[] number;
        delete[] tmp;
    };
    void setLabel(int index, int num)
    {
        number[index] = num;
    };

    void roll(char dst)
    {
        repi(i, 6, 0)
        {
            tmp[i] = number[i];
        }
        switch (dst)
        {
        case 'E':
            setNumber(tmp[3], tmp[1], tmp[0], tmp[5], tmp[4], tmp[2]);
            break;
        case 'S':
            setNumber(tmp[4], tmp[0], tmp[2], tmp[3], tmp[5], tmp[1]);
            break;
        case 'W':
            setNumber(tmp[2], tmp[1], tmp[5], tmp[0], tmp[4], tmp[3]);
            break;
        case 'N':
            setNumber(tmp[1], tmp[5], tmp[2], tmp[3], tmp[0], tmp[4]);
            break;

        default:
            break;
        }
    };
    int peek()
    {
        return number[0];
    };

private:
    void setNumber(int n0, int n1, int n2, int n3, int n4, int n5)
    {
        number[0] = n0;
        number[1] = n1;
        number[2] = n2;
        number[3] = n3;
        number[4] = n4;
        number[5] = n5;
    };
    //declar variables
    int *number;
    int *tmp;
};

int
main()
{
    Dice dice;
    repi(i, 6, 0)
    {
        int tmp;
        cin >> tmp;
        dice.setLabel(i,tmp);
    }
    string op;
    cin >> op;
    repi(i,op.length(),0){
        dice.roll(op.at(i));
    }
    cout << dice.peek() << endl;;

    return 0;
}


Measured memory_bytes: 3204
#include <bits/stdc++.h>
using namespace std;
int main() {
  int a; cin >> a;
  if(a==25) cout << "Christmas" << endl;
  if(a==24) cout << "Christmas Eve" << endl;
  if(a==23) cout << "Christmas Eve Eve" << endl;
  if(a==22) cout << "Christmas Eve Eve Eve" << endl;
}



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

double dp[3005][3005];
double p[3005],q[3005];

double def(int N);

int main(void){
  int N,i;
  char str[20000],*P;
  
  fgets(str,sizeof(str),stdin);
  N=atoi(str);
  
  fgets(str,sizeof(str),stdin);
  P=strtok(str," \n");
  p[1]=atof(P);
  q[1]=1.0-p[1];
  for(i=2;i<N+1;i++){
   P=strtok(NULL," \n");
    p[i]=atof(P);
    q[i]=1.0-p[i];
  }
  
  printf("%.10f\n",def(N));
  
  
  return 0;
}


double def(int N){
  int i,j;
  double ans;
  dp[0][0]=1.00;
  for(i=1;i<N+1;i++){
    for(j=0;j<N+1;j++){
      if(j==0){
        dp[i][j]=q[i]*dp[i-1][j];
      }else{
        dp[i][j]=p[i]*dp[i-1][j-1]+q[i]*dp[i-1][j];
      }
    }
  }
  
  for(i=N/2+1,ans=0.0;i<N+1;i++){
    ans+=dp[N][i];
  }
  
  return ans;
  
}

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

using namespace std;

#define inf 1<<30
#define llong long long
#define usd unsigned
#define pqueue priority_queue
#define mp make_pair
#define pb push_back
#define fn fill_n
typedef pair<int, int> P;
int nw[9] = {0, 1, 0, -1, -1, 1, 1, -1, 0};
int nh[9] = {1, 0, -1, 0, 1, 1, -1, -1, 0};

int ruiW[300001] = {};
int ruiE[300001] = {};

int n;
string s;

void rui(){
	for(int i = 0; i < s.size(); i++){
		ruiW[i+1] = ruiW[i] + (s[i] == 'W'?1:0);
		ruiE[i+1] = ruiE[i] + (s[i] == 'E'?1:0);
	}
	return;
}

int main(){
	cin >> n >> s;
	rui();
	int ans = inf;
	for(int i = 1; i <= s.size(); i++){
		int w, e, sum;

		if(i == 1){
			w = 0;
			e = ruiE[s.size()]-ruiE[1];
		}else if(i == s.size()){
			w = ruiW[s.size()-1];
			e = 0;
		}else{
			w = ruiW[i];
			e = ruiE[s.size()]-ruiE[i];
		}
		// cout << w << " " << e << endl;
		sum = w+e;
		ans = min(ans, sum);
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3076
def main():
    n, s = int(input()), input()
    r, g, b = 0, 0, 0
    for i in s:
        if i == 'R':
            r += 1
        if i == 'G':
            g += 1
        if i == 'B':
            b += 1

    ans = r * g * b
    s = tuple(s)
    v = {'R', 'G', 'B'}
    for i in range(n - 2):
        for j in range(n // 2 + 1):
            if i + j + j < n:
                if v == {s[i], s[i + j], s[i + j + j]}:
                    ans -= 1
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 9156
#include<cstdio>
using namespace std;

int h,w;
char field[105][105];
int main(){
	scanf("%d%d",&h,&w);
	for(int i=0;i<h;++i) scanf("%s",field[i]);
	for(int i=0;i<h;++i){
		int lastPos=-1;
		for(int j=0;j<w;++j){
			if(field[i][j]=='c') lastPos=j;
			
			int res=-1;
			if(lastPos!=-1) res=j-lastPos;
			printf("%d%c",res,j==w-1?'\n':' ');
		}
	}

	return 0;
}

Measured memory_bytes: 2728
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		String s = in.nextLine();
		for(int i=0;i<s.length();i++) {
			char ch = s.charAt(i);
			if(Character.isLowerCase(ch) == true) {
				ch = Character.toUpperCase(ch);
			} else if(Character.isUpperCase(ch) == true) {
				ch = Character.toLowerCase(ch);
			}
			System.out.print(ch);
		}
		System.out.println("");
	}
}

Measured memory_bytes: 27012
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main()
{
  int N;
  cin >> N;
  string S;
  cin >> S;
  
  int count = 1;
  char current = S[0];
  FOR(i, 1, N) {
    if(current == S[i]) continue;
    current = S[i];
    count++;
  }
  
  cout << count << endl;
}


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

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

const int INF = 1<<30;

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


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

using namespace std;


void Main(void) {
	int n;
	int k;
	int i;
	int temp;
	int res = 0;
	vector<int> h;

	cin >> n >> k;
	for (i = 0; i < n; i++) {
		cin >> temp;
		h.push_back(temp);
	}


	for (i = 0; i < n; i++) {
		if (h[i] >= k) {
			res += 1;
		}
	}

	cout << res;

	return;
}




int main(void) {
	Main();
	return 0;
}

Measured memory_bytes: 892
import math

def main():
    # 余弦定理
    # a^2 = b^2 + c^2 − 2bc * cos(α)
    math.radians(180)
    A, B, H, M = [int(x) for x in input().split()]
    m_rad = math.radians(M / 60 * 360)
    h_rad = math.radians((H*60 + M) / 720 * 360)
    c2 = A**2 + B**2 - (2 * A * B * math.cos(m_rad - h_rad))
    print(math.sqrt(c2))

if __name__ == "__main__":
    main()


Measured memory_bytes: 9496
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <vector>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define Sort(Array) sort(Array.begin(), Array.end())
#define Reverse(a) reverse(a.begin(), a.end())
#define out(ans) cout << ans << endl;
const int MOD = 1000000007;
const int INF = 2147483647;
const ld PI = 3.14159265358979323846;

//------------↓------------- M -------------- E ---------------- M --------------- O ---------------↓--------------//
// コンパイル 
// g++ -std=c++1z
//
// -------型変換--------
// int を string に変換
// string s = to_string(n);
// string を int に変換
// int n = stoi(s);
//
// -------二分探索---------
// k以上の値が最初に現れる時のイテレータ
// lower_bound(data.begin(), data.end(), k)
// kより大きい値が最初の現れる時のイテレータ O(logN)
// upper_bound(data.begin(), data.end(), k)
// kがdataに存在するかをtrue or falseで返す O(logN)
// binary_search(data.begin(), data.end(), k)
// 
//
//
//
//
//
// 
//------------↑------------- M -------------- E ---------------- M --------------- O ---------------↑--------------//






int main(void) {

    ll a, v, b, w, t;
    cin >> a >> v >> b >> w >> t;
    bool flag;
    if (a < b) {
        a += v * t;
        b += w * t;
        if (a < b) {
            flag = false;
        } else {
            flag = true;
        }
    } else if (a == b) {
        flag = true;
    } else {
        a -= v * t;
        b -= w * t;
        if (a > b) {
            flag = false;
        } else {
            flag = true;
        }
    }

    if (flag) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }

    
    return 0;
}









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

int h,w;
char t[102][102];

int main(void){
	while(cin>>h>>w,h||w){
		for(int i=0;i<h;i++){
			cin>>t[i];
		}
		int i=0,j=0;
		while(t[i][j] != '.' && t[i][j] != 'x'){
			int ti = i;
			int tj = j;
			if(t[i][j] == '>')
				j++;
			else if(t[i][j] == '<')
				j--;
			else if(t[i][j] == 'v')
				i++;
			else
				i--;

			t[ti][tj] = 'x';
		}
		if(t[i][j] == 'x'){
			cout<<"LOOP\n";
		}
		else{
			cout<<j<<" "<<i<<endl;
		}
	}

	return 0;
}

Measured memory_bytes: 0
#define LOCAL
#define _USE_MATH_DEFINES
#include <array>
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>
#include <random>
#include <ctime>
#include <climits>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define bit(n) (1LL<<(n))

int main() {
  int N;
  cin >> N;
  vector<int> a(N);
  rep(i,N)cin>>a[i];

  int ans = 0;
  rep(i,N) {
    if (a[i] % 2 != 0 && (i+1) %2 != 0) ans++;
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 3144
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>

using namespace std;


int main() {

    int N;
    cin >> N;

    bool exist = false;

    for(int a = 0; a <= (N/4); a++) {
        for(int b = 0; b <= (N/7);b++) {
            if ((4*a + b*7) == N) {
                exist = true;
            }
        }
    }

    if (exist) {
        cout << "Yes" << "\n";
    } else {
        cout << "No" << "\n";
    }

    return 0;
}

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

class Program
{
    static string InputPattern = "InputX";

    static List<string> GetInputList()
    {
        var WillReturn = new List<string>();

        if (InputPattern == "Input1") {
            WillReturn.Add("12");
            //Yes
        }
        else if (InputPattern == "Input2") {
            WillReturn.Add("101");
            //No
        }
        else if (InputPattern == "Input3") {
            WillReturn.Add("999999999");
            //Yes
        }
        else {
            string wkStr;
            while ((wkStr = Console.ReadLine()) != null) WillReturn.Add(wkStr);
        }
        return WillReturn;
    }

    static void Main()
    {
        List<string> InputList = GetInputList();
        int N = int.Parse(InputList[0]);

        int wkN = N;
        int SumNum = 0;
        while (wkN > 0) {
            SumNum += wkN % 10;
            wkN /= 10;
        }
        if (N % SumNum == 0) Console.WriteLine("Yes");
        else Console.WriteLine("No");
    }
}


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

int n,ans=0;

signed main()
{
	cin>>n;
	if (n==1)  return cout<<0<<endl,0;
	
	for (int i=2;i*i<=n;i++)
	{
		if (n%i==0)
		{
			int pos=0;
			while (n%i==0)  n=n/i,pos++;
			
			int now=sqrt(pos*2);
			if (now*(now+1)>pos*2)  now--;
			
			ans+=now;
		}
	}
	if (n>1)  ans++;
	cout<<ans<<endl;
	
	return 0;
}

Measured memory_bytes: 3676
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) debug(x) debug(y);
#define repn(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, a) for(int i = 0; i < (int)(a); i++)
#define all(v) v.begin(), v.end() 
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define sq(x) ((x) * (x))

template<class T> T gcd(T a, T b){ return ((b == 0) ? a : gcd(b, a % b)); }

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	//freopen("input.in", "r", stdin);
	//freopen("output.out", "w", stdout);
	int a, b, c, x, y;
	cin >> a >> b >> c >> x >> y;
	int ans = 0;
	if((c * 2) < (a + b)){
		//cheaper to buy AB's
		ans = min(x, y) * (c * 2);
		int mn = min(x, y);
		x -= mn;
		y -= mn;
	}
	else{
		ans = min(x, y) * (a + b);
		int mn = min(x, y);
		x -= mn;
		y -= mn;
	}
	if(x){
		//we need to buy this many more a's, no more b's
		if((c * 2) < a) ans += c * 2 * x;
		else ans += a * x;
	}
	if(y){
		if((c * 2) < b) ans += c * 2 * y;
		else ans += b * y;
	}
	cout << ans << endl;
	return 0;
}
/*
Things to look out for:
	- Integer overflows
	- Array bounds
	- Special cases
Be careful!
*/


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <queue>
#include <set>
#include <map>
#include <iomanip>
#include <fstream>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    //a^5-b^5=(a-b)(a^4+a^3b+a^2b^2+ab^3+b^4)
    ll x;
    cin >> x;
    for (ll i = -1000; i <= 1000; i++) {
        for (ll j = -1000; j <= 1000; j++) {
            if (i * i * i * i * i - j * j * j * j * j == x) {
                cout << i << ' ' << j;
                return 0;
            }
        }
    }
}


Measured memory_bytes: 3652
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int n = sc.nextInt();
		// 身長の入力
      	int[] tall = new int[n];
		for(int i=0;i<n;i++){
          tall[i]= sc.nextInt();
        }
    
    /*--------------------------------*/
      long ans =0;
      for(int l = 0; l<n-1;l++){
    	if(tall[l] > tall[l+1]){
      		ans += tall[l] - tall[l+1];
      		tall[l+1] = tall[l];
     	}
      }
      System.out.println(ans);
	}
}



Measured memory_bytes: 61032
#include <bits/stdc++.h>
#define ALL(v) v.begin(), v.end()
#define SORT(c) sort((c).begin(),(c).end())
#define dbug(x) cout<<#x<<"="<<x<<endl
#define m0(x) memset(x,0,sizeof(x))
#define rep(i, n) for(int i = 0; i < n; i++)
#define repr(i, n) for(int i = n; i > 0; i--)
#define reps(i, m, n) for(int i = m; i <= n; i++)
#define reprs(i, m, n) for(int i = n; i >= m; i--)
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
using namespace std;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef long long ll;
typedef pair<ll, ll> pl;
template<typename T>
istream& operator >> (istream& is, vector<T>& vec){
  for(T& x: vec) is >> x;
  return is;
}

int ct;

struct UnionFind {
    vector<int> par; // 親ノード
    vector<int> rank; // ランク

    UnionFind(int n) {
        init(n);
    }

    void init(int n) {
        par.resize(n); rank.resize(n);
        for (int i = 0; i < n; ++i) par[i] = i, rank[i] = 0;
    }

    int root(int x) {
        if (par[x] == x) {
            return x;
        }
        else {
            int r = root(par[x]);
            return par[x] = r;
        }
    }

    bool issame(int x, int y) {
        return root(x) == root(y);
    }

    void merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return;
        if (rank[x] < rank[y]) swap(x, y);
        if (rank[x] == rank[y]) ++rank[x];
        par[y] = x;
        ct--;
    }
};



int main(){


  int N,M;
  cin >> N>>M;

  ct=N;

  UnionFind tree(N);

  rep(i,M){
    int x,y,z;
    cin>>x>>y>>z;

  tree.merge(x-1,y-1);

  }

  cout << ct <<endl;
  return 0;
}


Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int k = Integer.parseInt(sc.next());
        String s = sc.next();
        char[] charArray = s.toCharArray();

        if (charArray[k - 1] == 'A') {
            charArray[k - 1] = 'a';
        } else if (charArray[k - 1] == 'B') {
            charArray[k - 1] = 'b';
        } else {
            charArray[k - 1] = 'c';
        }

        System.out.println(String.valueOf(charArray));
    }
}


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

using namespace std;

string s;
vector<string> v;
int k;

void solve() {
	int len = s.size();
	for (int i = 0; i < len; ++i) {
		string a = "";
		for (int j = 0; j < k; j++) {
			if (i + j >= len) break;
			a += s[i + j];
			v.push_back(a);
		}
	}
	sort(v.begin(), v.end());
	unique(v.begin(), v.end());
	cout << v[k - 1] << endl;
}

int main() {
	cin >> s >> k;
	solve();
	return 0;
}

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

const int N = 1e5+5;
vector<int> F[N];
vector<int> B[N];
vector<int> Par(N);
vector<int> Sz(N);

void init(){
    for(int i = 1; i < N; i++){
        Par[i] = i;
        Sz[i] = 1;
    }
}

int find_set(int v){
    if(v == Par[v]) return v;
    return Par[v] = find_set(Par[v]);
}

void union_set(int a, int b){
  a = find_set(a);
  b = find_set(b);
  if(a != b){
      if(Sz[a]<Sz[b]) swap(a,b);
      Par[b] = a;
      Sz[a]+=Sz[b];
  }
}

int main(){
    ios_base::sync_with_stdio(false);
cin.tie(NULL);
    int n,m,k;cin>>n>>m>>k;
    init();
    for(int i = 0; i < m; i++){
        int a,b; cin>>a>>b;
        F[a].push_back(b);
        F[b].push_back(a);
        union_set(a,b);
    }
    for(int i = 0; i < k; i++){
        int a,b;cin>>a>>b;
        B[a].push_back(b);
        B[b].push_back(a);
    }

    for(int i = 1; i <= n; i++){
        int p = find_set(i);
        int tot = Sz[p]-1;
        tot -= (int)F[i].size();
        for(int j: B[i]) {
            if (find_set(j) == p) tot-=1;
        }
        cout<<tot<<" ";
    }

}


Measured memory_bytes: 12664
#include <bits/stdc++.h>
using namespace std;
#define pi acos(-1.0)
#define pb push_back
#define mp make_pair
#define ll long long
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define testcase ll T; cin >> T; for (ll tc = 1; tc <= T; tc++)
#define M 1000000007
#define MM 998244353
#define eps 1e-8
#define eq(x,y) (fabs((x)-(y)) < eps)
#define r2 1.41421356237
ll powmod(ll a,ll b,ll mod) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}

int main()
{
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  //testcase {
  int n,x,t;
  cin>>n>>x>>t;
  cout<<t*((n+x-1)/x);
  //}
  return 0;
}

Measured memory_bytes: 3612
N = int(input())
X = [int(x) for x in input().split()]
M = int(input())
A = [int(x) for x in input().split()]

peace = {x: 0 for x in range(1, N + 1)}  # 駒
square = {x: 0 for x in range(1, 2020)}  # マス

for i in range(N):
    peace[i + 1] = X[i]
    square[X[i]] = i + 1

for i in range(M):
    if peace[A[i]] < 2019 and square[peace[A[i]] + 1] == 0:
        square[peace[A[i]] + 1] = A[i]
        square[peace[A[i]]] = 0
        peace[A[i]] += 1

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



Measured memory_bytes: 5728
#include<stdio.h>

int main(void)
{
   int a,b,c,d;

   scanf("%d %d %d",&a,&b,&c);

   if(a>b){
      d=a;
      a=b;
      b=d;
   }
   if(b>c){
      d=b;
      b=c;
      c=d;
   }
   if(a>b){
      d=a;
      a=b;
      b=d;
   }

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

   return 0;
}

Measured memory_bytes: 1024
n = int(input())
txy = [list(map(int, input().split())) for i in range(n)]

txy.insert(0, [0,0,0])
able =True

for i in range(1, n+1):
    dt = txy[i][0] - txy[i-1][0]
    dx = txy[i][1] - txy[i-1][1]
    dy = txy[i][2] - txy[i-1][2]
    if dt < abs(dx) + abs(dy):
        able = False
        break
    if dt%2==0 and (abs(dx) + abs(dy))%2==1:
        able = False
        break
    if dt%2==1 and (abs(dx) + abs(dy))%2==0:
        able = False
        break

if able:
    print("Yes")
else:
    print("No")

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

int main(){
  int n,k,array[200000],array2[200001]={},kakikae=0,ans=0;
  vector<int> ball;
  cin>>n>>k;
  for(int i=0;i<n;i++){
    cin>>array[i];
    array2[array[i]]++;
  }
  for(int i=1;i<=n;i++){
    if(array2[i]){
      ball.push_back(array2[i]);
    }
  }
  sort(ball.begin(),ball.end());
  int i=0;
  while(ball.size()-kakikae>k){
    ans+=ball[i];
    i++;
    kakikae++;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 2936
I=lambda:[int(i) for i in input().split()]
F=1<<65
n,m=I()
X=set([0,F,-F])
Y=set(X)
R=[]
H=[]
for i in range(n):
    a,b,c=I()
    R.append(((a,b),c))
    Y.add(c)
    X.add(a)
    X.add(b)
 
n+=2
R+=[((-F,F),F),((-F,F),-F)]
 
for i in range(m):
    a,b,c=I()
    H.append((a,(b,c)))
    X.add(a)
    Y.add(b)
    Y.add(c)
 
m+=2
H+=[(F,(-F,F)),(-F,(-F,F))]

xdc={}
c=1
for j in sorted(X):
    xdc[c]=j
    c+=1
nx=c-1
 
ydc={}
c=1
for j in sorted(Y):
    ydc[c]=j
    c+=1
ny=c-1
 
xdcr=dict(zip(xdc.values(),xdc.keys()))
ydcr=dict(zip(ydc.values(),ydc.keys()))
 
V=[[0]*(nx+1+1) for i in range(ny+1+1)]
U=[i[:]for i in V]

for (a,b),c in R:
    U[ydcr[c]][xdcr[a]]+=1
    U[ydcr[c]][xdcr[b]]+=-1
for i in range(ny+1):
    for j in range(nx):
        U[i][j+1]+=U[i][j]
        
for d,(e,f) in H:
    V[ydcr[e]][xdcr[d]]+=1
    V[ydcr[f]][xdcr[d]]+=-1
for j in range(nx+1):
    for i in range(ny):
        V[i+1][j]+=V[i][j]

v=[[0]*(nx+1) for i in range(ny+1)]
q=[(xdcr[0],ydcr[0])]
v[ydcr[0]][xdcr[0]]=1

a=0
while q:
    cx,cy=q.pop()
    a+=(xdc[cx]-xdc[cx+1])*(ydc[cy]-ydc[cy+1])
    for dx,dy in [(-1,0),(1,0),(0,1),(0,-1)]:
        nbx=cx+dx
        nby=cy+dy
        if (0>nbx>=nx)or(0>nby>=ny)or v[nby][nbx]==1:
            continue
        if dy!=0:
            if U[-~dy//2+cy][cx]==0:
                q.append((nbx,nby))
                v[nby][nbx]=1
        else:
            if V[cy][-~dx//2+cx]==0:
                q.append((nbx,nby))
                v[nby][nbx]=1
if a>=F:a='INF'
print(a)


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

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

  vector<int> p(n);
  rep(i, n) cin >> p.at(i);

  int k = 0;
  int min = n+1;
  for(int x : p){
    if(x < min){
      k++;
      min = x;
    }
  }

  cout << k << endl;

}


Measured memory_bytes: 1024
import qualified Data.ByteString.Char8         as BC
import           Data.Maybe                     ( fromJust )
import           Control.Applicative

readInts = map (fst . fromJust . BC.readInt) . BC.words <$> BC.getLine

main :: IO ()
main = do
    [a, b] <- readInts
    putStrLn (show (a * b) ++ " " ++ show (2 * a + 2 * b))



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

using namespace std;

typedef vector<int> vi;

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

int main()
{
	int D, N, M;
	vi d;
	while (scanf("%d", &D), D) {
		scanf("%d%d", &N, &M);
		d.resize(N + 1); d[N - 1] = 0; d[N] = D;

		rep(i, N - 1) scanf("%d", &d[i]);

		sort(all(d));

		int sum = 0;

		rep(i, M) {
			int k; scanf("%d", &k);
			int pos1 = lower_bound(all(d), k) - d.begin() - 1;
			int pos2 = lower_bound(all(d), k) - d.begin();
			if (pos1 == -1) pos1 = 0;
			sum += min(abs(k - d[pos1]), abs(k - d[pos2]));
		}

		printf("%d\n", sum);
	}
}

Measured memory_bytes: 1268
#include "bits/stdc++.h"
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a),i##_len=(b);i<i##_len;++i)
#define MSVC_UNKO(x) x
#define rep(...) MSVC_UNKO(_overload3(__VA_ARGS__,repi,_rep,_rep)(__VA_ARGS__))
#define all(c) c.begin(),c.end()
#define mp make_pair
#define write(x) cout<<(x)<<"\n"
using namespace std; typedef long long ll;
typedef vector<int> vi; typedef vector<ll> vll; template<class T>using vv = vector<vector<T>>;
template<class T>vv<T> vvec(size_t n, size_t m, T v) { return vv<T>(n, vector<T>(m, v)); }
template<class T>bool chmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }
template<class T>bool chmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
constexpr int INF = 1 << 28, MOD = 1e9 + 7; constexpr ll LINF = 1ll << 60;
struct aaa { aaa() { cin.tie(0); ios::sync_with_stdio(0); }; }aaaa;

int main() {
    ll N;
    cin >> N;
    vector<int> bit;
    {
        ll n = N;
        while (n) {
            if (n % 2) bit.push_back(1);
            else bit.push_back(0);
            n /= 2;
        }
        reverse(all(bit));
    }
    int L = bit.size();

    vv<ll> dp = vvec(L, 3, 0LL);
    dp[0][0] = 1;
    dp[0][1] = 1;
    rep(i, 1, L) {
        if (bit[i]) {
            dp[i][0] = (1 * dp[i - 1][0]) % MOD;
            dp[i][1] = (1 * dp[i - 1][0] + 1 * dp[i - 1][1]) % MOD;
            dp[i][2] = (2 * dp[i - 1][1] + 3 * dp[i - 1][2]) % MOD;
        }
        else {
            dp[i][0] = (1 * dp[i - 1][0] + 1 * dp[i - 1][1]) % MOD;
            dp[i][1] = (1 * dp[i - 1][1]) % MOD;
            dp[i][2] = (1 * dp[i - 1][1] + 3 * dp[i - 1][2]) % MOD;
        }
    }
    ll ans = (dp[L - 1][0] + dp[L - 1][1] + dp[L - 1][2]) % MOD;
    write(ans);
}

Measured memory_bytes: 256
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <bitset>
#include <list>
#include <stdexcept>
#include <functional>
#include <utility>
#include <ctime>
#include <random>
#include <cassert>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
#define MEM(a,b) memset((a),(b),sizeof(a))
const LL INF = 1e9 + 7;
const int N = 5e5 + 10;

int main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	int a, b;
	cin >> a >> b;
	if (a > b) cout << a - 1 << endl;
	else cout << a << endl;
	return 0;
}


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

static const int64_t mod = 1000000007;

int64_t mpow(int64_t a, int64_t p)
{
  if (p == 0) return 1;
  if (p == 1) return a;
  if (p % 2 == 0) {
    auto t = mpow(a, p / 2);
    return t * t % mod;
  } else {
    return a * mpow(a, p - 1) % mod;
  }
}

int64_t mcomb(int64_t n, int64_t k)
{
  if (k == 0) return 1;
  if (n - k < k) return mcomb(n, n - k);
  int64_t numer = 1;
  int64_t denom = 1;
  for (int i = 0; i < k; i++) {
    numer *= n - i;
    denom *= i + 1;
    numer %= mod;
    denom %= mod;
  }
  return numer * mpow(denom, mod - 2) % mod;
}

int main()
{
  int64_t n, k;
  cin >> n >> k;
  for (int i = 1; i <= k; i++) {
    if (n - k + 1 < i) {
      cout << 0 << endl;
    } else {
      cout << (mcomb(n - k + 1, i) * mcomb(k - 1, i - 1) % mod) << endl;
    }
  }
}


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

const int N = 1e5+10;
const int INF = 1e18+10;
int h[N];
int dp[N];

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

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

  fill(dp,dp+N,INF);
  dp[0] = 0;
  for(int i = 0; i < n; i++){
    dp[i+1] = min(dp[i+1],dp[i] + abs(h[i+1]-h[i]));
    if(i+2 < n) dp[i+2] = min(dp[i+2],dp[i] + abs(h[i+2]-h[i]));
  }
  cout << dp[n-1] << endl;

  return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define lowbit(a) ((a)&-(a))
#define clean(a,b) memset(a,b,sizeof(a))
const int mod = 1e9 + 7;
const int inf=0x3f3f3f3f;
const int maxn = 1e6+9;

int _;

//========================================================================


//========================================================================

int main()
{
    int n;
    scanf("%d",&n);
    n=n%10;
    if(n==2||n==4||n==5||n==7||n==9) puts("hon");
    else if(n==0||n==1||n==6||n==8) puts("pon");
    else puts("bon"); 
    return 0;
}


Measured memory_bytes: 3612
import sys
import heapq, math
from itertools import zip_longest, permutations, combinations, combinations_with_replacement
from itertools import accumulate, dropwhile, takewhile, groupby
from functools import lru_cache
from copy import deepcopy

X, Y = input().split()

if X == Y:
    print('=')
elif X < Y:
    print("<")
else:
    print(">")

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

main(){
  int n,q;
  cin>>n;
  vector<int>v(n);
  r(i,n)cin>>v[i];
  cin>>q;
  while(q--){
    int a,l,r,s=0;
    cin>>l>>r>>a;
    for(;l<r;l++)s+=v[l]==a;
      cout<<s<<endl;
  }
}


Measured memory_bytes: 3104
#include <iostream>
#include <vector>
#include <cstdlib>  
#include <algorithm>
#include <string>

using namespace std;
 
int main() {
    string s;cin>>s;
    int ss = 10000;
    for(int i = 0;i<s.length()-2;i++){
      string a = s.substr(i,3);
      int sa = abs(753 -stoi(a));
      ss = min(ss,sa);
    }
    cout<<ss;
    return 0;
}

Measured memory_bytes: 3620
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
int INF = 1LL << 30;
int MOD = 1e9+7;
main(){
    int N,M,X;
    cin >> N >> M >> X;
    int cnt = 0;
    for(int i = 0;i < M;i++){
        int a;
        cin >> a;
        if(a > X)break;
        cnt++;
    }
    cout << min(M-cnt,cnt) << endl;
}

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

const long mod = 998244353;
int n, m, k;
long mpow(long b, long e) {
  if (e == 0) return 1;
  if (e % 2 == 1) return b * mpow(b, e - 1) % mod;
  long t = mpow(b, e / 2);
  return t * t % mod;
}

long inv(long n) {
  return mpow(n, mod - 2);
}

long f[200001];
long comb(long n, long r) {
  return f[n] * inv(f[r] * f[n - r] % mod) % mod;
}

int main() {
  cin >> n >> m >> k;
  
  f[0] = 1;
  for (int i = 1; i <= n; ++i) {
    f[i] = f[i - 1] * i % mod;
  }
  
  long sum = 0;
  for (int i = 0; i <= k; ++i) {
    long res = m * mpow(m - 1, n - i - 1) % mod * comb(n - 1, i) % mod;
    sum = (sum + res) % mod;
  }
  cout << sum << endl;
}

Measured memory_bytes: 5120
N=int(input())
ab = [tuple(map(int, input().split())) for i in range(N)]
a,b = zip(*ab)
res = 0
ma = max(b)+1

def solve_left(idx):
    left = sum([1 for l,r in ab if idx<l])
    if left > N//2:
        return False
    return True

def solve_right(idx):
    right = sum([1 for l,r in ab if idx>r])
    if right > N//2:
        return False
    return True
def solve_left2(idx):
    left = sum([1 for l,r in ab if idx<l])
    if left > N//2-1:
        return False
    return True

def solve_right2(idx):
    right = sum([1 for l,r in ab if idx>r])
    if right > N//2-1:
        return False
    return True

ok = ma
ng = 0
while abs(ok-ng) > 1:
    cnt = (ok + ng) // 2
    if solve_left(cnt):
        ok = cnt
    else:
        ng = cnt
res_left = ok

ok = 0
ng = ma
while abs(ok-ng) > 1:
    cnt = (ok + ng) // 2
    if solve_right(cnt):
        ok = cnt
    else:
        ng = cnt
res_right = ok

if N%2==0:
    ok = ma
    ng = 0
    while abs(ok - ng) > 1:
        cnt = (ok + ng) // 2
        if solve_left2(cnt):
            ok = cnt
        else:
            ng = cnt
    res_left2 = ok
    
    ok = 0
    ng = ma
    while abs(ok - ng) > 1:
        cnt = (ok + ng) // 2
        if solve_right2(cnt):
            ok = cnt
        else:
            ng = cnt
    res_right2 = ok

if N%2==1:
    res = (res_right-res_left) + 1
else:
    # print((res_left,res_left2),(res_right,res_right2))
    res = (res_right+res_right2)-(res_left+res_left2) + 1
print(res)

Measured memory_bytes: 171136
n, T = [int(i) for i in input().split()]
c = [0 for i in range(n)]
t = [0 for i in range(n)]

min = 10000

for i in range(n):
    c[i], t[i] = [int(i) for i in input().split()]
    if t[i] <= T:
        if c[i] < min:
            min = c[i]
if min == 10000:
    print("TLE")
else:
    print(min)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll mod = 1e9 + 7;
const ll inf = (1 << 30) - 1;
const ll infll = (1LL << 61) - 1;

string s;

int main()
{
    cin >> s;
    if (s[0] == s[s.size() - 1])
    {
        cout << (s.size() % 2 == 1 ? "Second" : "First") << "\n";
    }
    else
    {
        cout << (s.size() % 2 == 0 ? "Second" : "First") << "\n";
    }
}

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

#define MAX_N 100010

struct arrow {int v, w;};
vector <arrow> adj[MAX_N];
int64_t dis[MAX_N] = {0};
bool vis[MAX_N] = {0};
int n, k ,q;

void dfs(int v)
{
    vis[v] = true;
    for (int i = 0; i < adj[v].size(); i++) {
        int u = adj[v][i].v;
        if (!vis[u]) {
            dis[u] = dis[v] + adj[v][i].w;
            dfs(u);
        }
    }
}

int main(void)
{
    scanf("%d", &n);
    for (int i = 1; i < n; i++) {
        int a, b, c;
        scanf("%d%d%d", &a, &b, &c);
        arrow s = {b, c}, t = {a, c};
        adj[a].push_back(s);
        adj[b].push_back(t);
    }
    scanf("%d%d", &q, &k);
    dfs(k);
    while (q--) {
        int x, y;
        scanf("%d%d", &x, &y);
        int64_t ans = dis[x] + dis[y];
        printf("%lld\n", ans);
    }
    return 0;
}


Measured memory_bytes: 12800