akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
#define per(i,n) for(int i = n-1; i >= 0; i--)
typedef long long ll;
typedef pair<int, int> P;
typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<ll> vll;
const long long mod = 1000000007LL;

int main() {
  int T;
  cin >> T;
  vll ans;
  rep(j,T) {
    int n;
    cin >> n;
    vll a(n);
    rep(i,n) cin >> a[i];
    string s;
    cin >> s;
    vll b;
    bool ok = true;
    per(i,n) {
      ll v = a[i];
      for(auto x : b) v = min(v,v^x);
      if(v) {
        if(s[i]=='1') ok = false;
        b.push_back(v);
      }
    }
    if(ok) ans.push_back(0);
    else ans.push_back(1);
  }
  rep(j,T) cout << ans[j] << endl;
  return 0;
}

Measured memory_bytes: 3556
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int count = 0;
        for(int i = a;i<=b;i++){
            int aa = i%10;
            int bb = (i%100-aa)/10;
            int cc = i%1000;
            int dd = (i%10000-cc)/1000;
            int ee = (i%100000-cc-dd)/10000;
            if(aa == ee && bb == dd){
                count++;
            }
        }
        System.out.println(count);
    }
}

Measured memory_bytes: 21844
Module Main
    Sub Main(args As String())
        Dim S As String = Console.ReadLine
        If S.Substring(2, 1) = S.Substring(3, 1) Then
            If S.Substring(4, 1) = S.Substring(5, 1) Then
                Console.WriteLine("Yes")
                End
            End If
        End If
        Console.WriteLine("No")
    End Sub
End Module

Measured memory_bytes: 19792
#include<bits/stdc++.h>
#define forr(i, a, b) for(int i = (a); i < (b); i++)
#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = 1; i <= (n); i++)
#define ALL(a) (a.begin()),(a.end())
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll, ll> LP;
const ll LINF = 1LL<<60;
const int INF = 1001001001;
const int MOD = 1000000007;

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

int main() {
    int n;
    cin >> n;
    vector<vector<int>> X(n), Y(n);
    rep(i, n) {
        int a;
        cin >> a;
        int x, y;
        rep(j, a) {
            cin >> x >> y;
            x--;
            X[i].push_back(x);
            Y[i].push_back(y);
        }
    }
    
    int ans = 0;
    for(int bit = 0; bit < (1 << n); bit++) {
        int tot = 0;
        rep(i, n) {
            if((bit >> i) & 1) {
                bool check = true;
                rep(j, X[i].size()) {
                    if(Y[i][j] == 1) {
                        if(!((bit >> X[i][j]) & 1)) check = false;
                    } else {
                        if((bit >> X[i][j]) & 1) check = false;
                    }
                }
                if(check) tot++;
                else {
                    tot = 0;
                    break;
                }
            } 
        }
        ans = max(tot, ans);
    }
    cout << ans << endl;
    return 0;
}

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

namespace contest_Csharp
{
    class Program
    {


        static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            var vals = Console.ReadLine();//.Split(' ').
                //Select(x => int.Parse(x)).ToList();
           
            var ans = Char.IsUpper(vals[0])?"A":"a";


            Console.WriteLine(ans);
            Console.Out.Flush();
        }




    }
}




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

int main(){
  string s; cin >>s;
  if(s[s.size()-1]=='s') cout << s << "es" << endl;
  else cout << s << 's' << endl;
  return 0;
}

Measured memory_bytes: 3620
s=list(map(int,input().split()))
t=list(map(int,input().split()))
t.sort(reverse=True)
a=s[1]
b=0
if s[0]<=s[1]:
  print(0)
else:
  for i in range(s[1],s[0]):
    b+=t[i]
  print(b)

Measured memory_bytes: 26764
// vvvvvvvvvvvv TEMPLATE vvvvvvvvvvvv
#include <bits/stdc++.h>
using namespace std; using ll = long long; using P = pair<ll, ll>;
const ll linf = 1e18; const double eps = 1e-12, pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define each(i,a) for (auto&& i : a)
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
#define pb push_back
#define eb emplace_back
#define all(a) begin(a),end(a)
#define chmin(x,v) x = min(x, v)
#define chmax(x,v) x = max(x, v)
#define min(x,y) (x < y ? x : y)
#define max(x,y) (x < y ? y : x)
template<typename Head> void out(Head h) { cout << h << endl; } template<typename Head, typename... Tail>void out(Head h, Tail... t) { cout << h << " "; out(t...); }
template<typename T> istream& operator>>(istream& is, vector<T>& v) { each(x,v) is >> x; return is; }
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) { rep(i,v.size()) { if (i) os << " "; os << v[i]; } return os; }
template<typename T> ostream& operator<<(ostream& os, const vector<string>& v) { rep(i,v.size()) { if (i) os << endl; os << v[i]; } return os; }
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) { rep(i,v.size()) { if (i) os << endl; os << v[i]; } return os; }
struct yes_no : std::numpunct<char> { string_type do_truename() const { return "Yes"; } string_type do_falsename() const { return "No"; } };
void solve(); int main() {
  ios::sync_with_stdio(false); cin.tie(0); locale loc(locale(), new yes_no); cout.imbue(loc); cout << fixed << setprecision(10) << boolalpha;
  solve();
}
// ^^^^^^^^^^^^ TEMPLATE ^^^^^^^^^^^^

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/tag_and_trait.hpp>
using namespace __gnu_pbds;
template<class T>
class Set : public tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update> {
public:
  // 小さい方からidx番目の要素
  const T& operator[](size_t idx) { return *this->find_by_order(idx); }
  // keyが小さい方から何番目か
  size_t order(const T& key) const { return this->order_of_key(key); }
  size_t order(typename Set<T>::iterator it) const {
    if (it == end(*this)) return this->size();
    return this->order_of_key(*it);
  }
};


void solve() {
  ll n;
  while (cin >> n, n) {
    Set<P> s;
    vector<P> v;
    rep(i, n) {
      ll x; cin >> x;
      s.insert(P(x, i));
      v.eb(x, i);
    }
    vector<ll> sorted(n);
    each(p, v) {
      sorted[s.order(p)] = p.first;
    }
    ll ans = 0;
    rep(i, n) {
      ans += (n-i-1) * sorted[i];
    }
    cout << ans << endl;
  }
}



Measured memory_bytes: 4016
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
const int mx=107;
bool vis[mx][100007];
int w[mx],v[mx],n,wi;
ll dp[mx][100007];
ll solve (int i,ll CW)
{
    if(i>=n)
        return 0;
    if(vis[i][CW])
        return dp[i][CW];

    ll ans1=0,ans2=0;
    if(w[i]+CW<=wi)
        ans1=v[i]+solve(i+1,w[i]+CW);
    ans2=solve(i+1,CW);

    vis[i][CW]=1;

    return dp[i][CW]= max(ans1,ans2);
}


int main()
{
 cin>>n>>wi;
 memset(vis,0,sizeof vis);
 for(int i=0;i<n;i++)
  cin>>w[i]>>v[i];
  cout<<solve(0,0)<<endl;


return 0;}


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

#define ll long long
#define pb push_back
#define MP make_pair
#define F first
#define S second
#define MAX 1e9
#define MIN -1e9
#define MOD 1000000007
#define println(x) cout << "[" << #x << ":" << x << "]\n"; 
#define print(x) cout << "[" << #x << ":" << x << "] "; 

int main(){
	ios::sync_with_stdio(0); 
    cin.tie(0); 
	#ifndef ONLINE_JUDGE
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif
	int n; cin >> n;
	int a[n], b[n], c[n];
	int dp[n][3];	

	for(int i=0; i<n; i++)
		cin >> a[i] >> b[i] >> c[i];
	
	dp[0][0] = a[0];
	dp[0][1] = b[0];
	dp[0][2] = c[0];

	for(int i=1; i<n; i++){
		dp[i][0] = a[i] + max(dp[i-1][1], dp[i-1][2]);
		dp[i][1] = b[i] + max(dp[i-1][0], dp[i-1][2]);
		dp[i][2] = c[i] + max(dp[i-1][1], dp[i-1][0]);	
	}
	
	cout << max({dp[n-1][0], dp[n-1][1], dp[n-1][2]}) << "\n";
	return 0;
}

Measured memory_bytes: 5888
#include<iostream>
#include <algorithm>
#include <string>
#include<math.h>
#define rep(i,n)for(int i=0;i<n;i++)
using namespace std;
int main() {
    int a=0, b=0, c=0;
    string s;
    cin >> s;
    switch (s[0])
    {
    case 'a':a++; break;
    case 'b':b++; break;
    case 'c':c++; break;
    }
    switch (s[1])
    {
    case 'a':a++; break;
    case 'b':b++; break;
    case 'c':c++; break;
    }
    switch (s[2])
    {
    case 'a':a++; break;
    case 'b':b++; break;
    case 'c':c++; break;
    }
    if (a == 1 && b == 1 && c == 1) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
    return 0;
}


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

bool path[10][10];
ll n;
ll c = 0;

void dfs(ll s, bool* check){
    if(check[s] == true){
        return;
    }

    check[s] = true;

    bool ch = true;
    rep(i, n){
        if(check[i] == false) ch = false;
    }
    if(ch == true){
        c++;
    }

    rep(i, n){
        if(path[s][i]) dfs(i, check);
    }

    check[s] = false;
    return;
}

int main(void){
    ll m;
    cin >> n >> m;
    rep(i, m){
        ll tmp_a, tmp_b;
        cin >> tmp_a >> tmp_b;
        tmp_a--;
        tmp_b--;
        path[tmp_a][tmp_b] = true;
        path[tmp_b][tmp_a] = true;
    }

    bool check[n];
    rep(i, n) check[i] = false;

    dfs(0, check);

    cout << c << endl;
    return 0;
}


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

int main(){
	int n;
	char num[5];
	bool isPalindromicNumber;
	cin >> n;

	for(int i=0;; i++){
		isPalindromicNumber = true;
		sprintf(num, "%d", n-i);
		for(int j=0; j < strlen(num); j++){
			if(num[j] != num[strlen(num)-j-1]) isPalindromicNumber = false;
		}
		if(isPalindromicNumber){
			cout << n-i << endl;
			return 0;
		}

		isPalindromicNumber = true;
		sprintf(num, "%d", n+i);
		for(int j=0; j < strlen(num); j++){
			if(num[j] != num[strlen(num)-j-1]) isPalindromicNumber = false;
		}
		if(isPalindromicNumber){
			cout << n+i << endl;
			return 0;
		}
	}
}

Measured memory_bytes: 1200
from collections import deque
import heapq        

N, M = map(int, input().split())
edges = {i: [] for i in range(N)}
for _ in range(M):
    x, y, _ = map(int, input().split())
    edges[x-1].append(y-1)
    edges[y-1].append(x-1)

ans = 0
visited = [False]*N
for i in range(N):
    if visited[i]:
        continue
    stack = [i]
    while stack:
        v = stack.pop()
        for u in edges[v]:
            if not visited[u]:
                visited[u] = True
                stack.append(u)
    ans += 1
print(ans)

Measured memory_bytes: 32704
#include <cstdio>
#include <vector>
#include <map>
#include <functional>
#include <cassert>
#define repeat(i,n) for (int i = 0; (i) < int(n); ++(i))
using namespace std;
template <typename X, typename T> auto vectors(X x, T a) { return vector<T>(x, a); }
template <typename X, typename Y, typename Z, typename... Zs> auto vectors(X x, Y y, Z z, Zs... zs) { auto cont = vectors(y, z, zs...); return vector<decltype(cont)>(x, cont); }

int main() {
    // input
    int n; scanf("%d", &n);
    auto g = vectors(n, n, false);
    int e = 0;
    repeat (y, n) repeat (x, n) {
        char c; scanf(" %c", &c);
        e += c == 'Y';
        if (c == 'Y') {
            g[y][x] = true;
            g[x][y] = true;
        }
    }
    e /= 2;
    // solve
    bool result;
    if (n % 2 == 1) {
        result = (n*(n-1)/2 - e) % 2;
    } else {
        vector<bool> used(n);
        function<int (int)> go = [&](int i) {
            used[i] = true;
            int size = 1;
            repeat (j, n) if (g[i][j]) {
                if (not used[j]) {
                    size += go(j);
                }
            }
            return size;
        };
        int even = 0;
        int odd = 0;
        repeat (i, n) {
            if (not used[i]) {
                int size = go(i);
                (size % 2 == 0 ? even : odd) += 1;
            }
        }
        map<pair<int, int>, bool> memo;
        function<bool (int, int)> dp = [&](int a, int b) {
            pair<int, int> key = { a, b };
            if (memo.count(key)) return memo[key];
            bool result = false;
            assert (a + b >= 2);
            assert (not (a == 1 and b == 1));
            if (a == 2 and b == 0) {
                if ((n*(n-1)/2 + e + odd + even) % 2 == 1) result = true;
            } else if (a == 0 and b == 2) {
                if ((n*(n-1)/2 + e + odd + even) % 2 == 0) result = true;
            } else {
                if (a >= 2            and not dp(a-1, b  )) result = true;
                if (a >= 1 and b >= 1 and not dp(a-1, b  )) result = true;
                if (           b >= 2 and not dp(a+1, b-2)) result = true;
            }
            return memo[key] = result;
        };
        result = dp(even, odd);
    }
    // output
    printf("%s\n", result ? "Taro" : "Hanako");
    return 0;
}

Measured memory_bytes: 10588
#include <bits/stdc++.h>
#define FOR(v, a, b) for(int v = (a); v < (b); ++v)
#define REP(v, n) FOR(v, 0, n)
#define UNWORDS(vec, str) for(int i = 0; i < (vec).size(); ++i) cout << (i ? str : "") << (vec)[i]
#define UNLINES(vec) for(int i = 0; i < (vec).size(); ++i) cout << (vec)[i] << endl
#define RS resize
#define CLR clear
#define PB push_back
using namespace std;

int main(){
	int n, m, s, t, e, l;
	vector< map< int, int > > a;
	vector< int > b, c;
	
	cin >> n >> m;
	b.RS(m);
	a.RS(n);
	c.RS(n);
	
	while(cin >> s >> t >> e, s){
		a[s - 1][t - 1] = e;
	}
	
	cin >> l;
	
	REP(i, l){
		
		REP(j, m) cin >> b[j];
		
		REP(j, n){
			c[j] = 0;
			
			for(map< int, int >::iterator it = a[j].begin(); it != a[j].end(); ++it){
				c[j] += (it->second) * b[it->first];
			}
		}
		
		UNWORDS(c, " ");
		cout << endl;
	}
	
	return 0;
}

Measured memory_bytes: 3908
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<ll,ll>
#define FOR(I,A,B) for(ll I = (A); I < (B); ++I)
#define FORR(I,A,B) for(ll I = (B-1); I >= (A); --I)
const ll INF=1e18+7;
const ll MOD=1e9+7;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int k[26]={0};
	string s;
	cin >> s;
	FOR(i,0,s.size())k[s[i]-'a']++;
	FOR(i,0,26){
		if(k[i]%2){
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
typedef long long ll;
#define rep(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define REP(i,num,n) for(ll i=num, i##_len=(n); i<i##_len; ++i)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
const ll LLINF = 1LL<<60;
const int INTINF = 1<<30;
const int MOD = 1000000007;

void add(long long &a, long long b) {
  a += b;
  if (a >= MOD) a -= MOD;
}

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

ll dp[210000][5];

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string S;
    cin >> S;
    memset(dp, 0, sizeof(dp));
    dp[0][0] = 1;
    rep(i,S.size()){
        rep(j,4){
            if (S[i] != '?') add(dp[i+1][j], dp[i][j]);
            else add(dp[i+1][j], dp[i][j] * 3 % MOD);
        }
        if (S[i] == 'A' || S[i] == '?') add(dp[i+1][1], dp[i][0]);
        if (S[i] == 'B' || S[i] == '?') add(dp[i+1][2], dp[i][1]);
        if (S[i] == 'C' || S[i] == '?') add(dp[i+1][3], dp[i][2]);
    }
    cout << dp[S.size()][3] << endl;
}

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

using namespace std;
using int64 = long long;
const int mod = 1e9 + 7;
const int inf = (1 << 30) - 1;
const int64 infll = (1LL << 61) - 1;

struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    cerr << fixed << setprecision(10);
  }
} iosetup;

template< typename T >
ostream &operator<<(ostream &os, const vector< T > &v) {
  for(int i = 0; i < (int) v.size(); i++) {
    os << v[i] << (i + 1 != v.size() ? " " : "");
  }
  return os;
}

template< typename T >
istream &operator>>(istream &is, vector< T > &v) {
  for(T &in : v) is >> in;
  return is;
}

template< typename T1, typename T2 >
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }

template< typename T1, typename T2 >
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

template< typename T = int64 >
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);
}

int main() {
  int N, Q;
  cin >> N >> Q;
  string S;
  cin >> S;
  vector< char > t(Q), d(Q);
  for(int i = 0; i < Q; i++) {
    cin >> t[i] >> d[i];
  }

  auto check = [&](int pos, bool f) {
    for(int i = 0; i < Q; i++) {
      if(d[i] == 'L') {
        if(S[pos] == t[i]) --pos;
      } else {
        if(S[pos] == t[i]) ++pos;
      }
      if(pos < 0) {
        if(f) return true;
        else return false;
      }
      if(pos >= N) {
        if(!f) return true;
        else return false;
      }
    }
    return true;
  };
  int ok = -1, ng = N; // 落ちない →
  while(ng - ok > 1) {
    int mid = (ok + ng) / 2;
    if(check(mid, true)) ok = mid;
    else ng = mid;
  }

  int ok2 = N, ng2 = -1;
  while(ok2 - ng2 > 1) {
    int mid2 = (ok2 + ng2) / 2;
    if(check(mid2, false)) ok2 = mid2;
    else ng2 = mid2;
  }

  cout << max(0, ok - ok2 + 1) << endl;
}


Measured memory_bytes: 976
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Diagnostics;
using System.Numerics;

public class Program
{
    public static void Main(string[] args)
    {
        //string[] line = Console.ReadLine().Split(' ');

        string s = Console.ReadLine();
        n = int.Parse(s);

        int ans = func("", s.Length);

        Console.WriteLine(ans);
        Console.ReadLine();
    }

    static int n;

    static int func(string s, int d)
    {
        if (d < 0) return 0;

        if (s.Contains('3') && s.Contains('5') && s.Contains('7'))
        {
            int x = int.Parse(s);

            if(x <= n)
            {
                d--;

                int r2 = 1;
                r2 += func(s + '3', d);
                r2 += func(s + '5', d);
                r2 += func(s + '7', d);

                return r2;
            }
        }

        int r = 0;

        d--;
        r += func(s + '3', d);
        r += func(s + '5', d);
        r += func(s + '7', d);

        return r;
    }
}


Measured memory_bytes: 17356
N =int(input())
now = 0
max_list = [1]
min_list = [0]

def show_binary(now_val , now_idx):
    # print(now_val , now_idx)
    if now_idx == 0:
        print(now_val,end = "")
        return
    if now_val == 0:
        print("0", end='')
        show_binary(now_val, now_idx - 1)
    elif now_idx % 2 == 1:
        if min_list[now_idx - 1] > now_val >= min_list[now_idx]:
            print("1" , end = "")
            show_binary(now_val - (-2) ** now_idx, now_idx - 1)
        else:
            print("0" , end = '')
            show_binary(now_val, now_idx - 1)
    else:
        if max_list[now_idx - 1] < now_val <= max_list[now_idx]:
            print("1" , end = "")
            show_binary(now_val - (-2) ** now_idx, now_idx - 1)
        else:
            print("0" , end = '')
            show_binary(now_val, now_idx - 1)

for i in range(1,35):
    # iが奇数の時
    if i % 2 == 1:
        min_list.append(min_list[-1] - 2 ** i)
        max_list.append(max_list[-1])
        if min_list[i-1] >= N >= min_list[i]:
            break
    # 偶数の時
    else:
        min_list.append(min_list[-1])
        max_list.append(max_list[-1] + 2 ** i)
        if max_list[i-1] <= N <= max_list[i]:
            break
#print("max_list : ",max_list)
#print("min_list : ",min_list)
#print(i)
if 0 <= N <= 1:
    i = 0
show_binary(N,i)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define t(x) cerr<<#x<<":"<<x<<'\n';
#define t2(a,n) { cerr<<#a<<" = "; for(int i=0; i<n; ++i){ cerr << a[i] << ' '; } ; cerr <<'\n'; }
#define t3(a){ cerr<<#a<<" = "; for(auto i: a){ cerr<<i<<" "; } cerr<<'\n'; }



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

	int x,y;
	cin>>x>>y;
	int a,b;
	cin>>a>>b;
	int mx = x * b + a * y - a * b;
	cout<<x*y-mx<<endl;

	#ifdef LOL
	    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
	#endif
	return 0;
}


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

#define ll long long
#define M 1000000007
using namespace std;
int main() 
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); 
	int n,m,a,b;
    cin>>n;
    int arr[n];
    ll dp[n][n]={0 };
    for(int i=0;i<n;i++)
    {
        cin>>arr[i];
    }
    a=0;b=n-1;m=0;long long sum=0;
    for(int i=0;i<n;i++)
    {
        dp[i][i]=arr[i];
    }
    for(int i=1;i<n;i++)
    {
        for(int j=0;j+i<n;j++)
        {   
            if(i%2)
            {dp[j][j+i]=min(dp[j+1][j+i]-arr[j],dp[j][j+i-1]-arr[j+i]);}
            else
            {
                dp[j][j+i]=max(dp[j+1][j+i]+arr[j],dp[j][j+i-1]+arr[j+i]);
            }
            
        }
    }
    /*for(int i=0;i<n;i++)
    {
        for(int j=0;j<n;j++)
        {   
            cout<<dp[i][j]<<" ";
        }
    cout<<endl;
    }*/
    if(n%2)
    {
        cout<<dp[0][n-1];
    }else
    {
         cout<<dp[0][n-1]*-1;
    }
    
}

Measured memory_bytes: 70528
n,x = map(int,input().split())
a = list(map(int,input().split()))
ans = 0
for i in range(n-1):
    if abs(a[i]+a[i+1]) <= x:
        continue
    elif abs(a[i]+a[i+1]) > x and i < n-2:
        y = abs(x-a[i+1]-a[i])
        if a[i+1] <= y:
            ans += a[i+1]
            a[i+1] = 0
            ans += max(0,abs(a[i]-x))
        else:
            ans += y
            a[i+1] -= y
    else:
        ans += a[i+1]+a[i]-x
print(ans)


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


int main()
  {
      int i,c=0;
      char s[3],j[3];
      scanf("%s",s);
      scanf("%s",j);
    for(i=0;i<3;i++)
      {
        if(s[i]==j[i])
          c++;
      }
  printf("%d\n",c);
  
  return 0;
  }

Measured memory_bytes: 128
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))

total = 0
for i in range(n):
    total += min(a[i], b[i])
    total += min(a[i+1], b[i]-min(a[i], b[i]))
    a[i+1] = a[i+1] - min(a[i+1], b[i]-min(a[i], b[i]))
    
print(total)

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

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

	bool dp[2001] = {true, false};
	for (int i=0; i<n; ++i) {
		cin >> a;
		for (int j=2000; j>=0; --j) {
			dp[j+a] |= (dp[j] && j+a<2001);
		}
	}

	cin >> q;
	for (int i=0; i<q; ++i) {
		cin >> m;
		cout << (dp[m] ? "yes" : "no") << endl;
	}
}



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

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

string str;
int win[29];

int main(void){
	cin >> str;
	int cnt=0;
	for(int i=0;i<str.size();i++){
		if(str[i]>='a' && str[i]<='z'){
			cnt++;
		}
	}
	for(int i=0;i<cnt;i++){
		string a;
		int b;
		cin >> a >> b;
		char d=a[0];
		win[(d-'a')]=b;
	}
	bool flag=true;
	stack<int> st;
	for(int i=0;i<str.size();i++){
		if(str[i]>='a' && str[i]<='z'){
			st.push((str[i]-'a'));
		}
		if(str[i]==']'){
			int a=st.top();
			st.pop();
			int b=st.top();
			st.pop();
			if(win[a]>0 && win[b]>0){
				flag=false;
				st.push(a);
			}
			if(win[a]==0 && win[b]==0){
				flag=false;
				st.push(a);
			}
			if(win[a]>0 && win[b]==0){
				win[a]--;
				st.push(a);
			}
			if(win[a]==0 && win[b]>0){
				win[b]--;
				st.push(b);
			}
		}
	}
	int a=st.top();
	if(win[a]>0)flag=false;
	printf("%s\n",flag?"Yes":"No");
	return 0;
}

Measured memory_bytes: 3208
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <chrono>

using namespace __gnu_pbds;
using namespace std;

#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
// order_of_key (val): returns the no. of values less than val
// find_by_order (k): returns the kth largest element.(0-based)

#define ll long long int
#define ld long double
#define ff first
#define ss second
#define pb push_back
#define pi pair<ll,ll>
#define pii pair<ll,pi >
#define ppi pair<pi,ll>
#define ppp pair<pi,pi >
#define ex(str,a,b) str.substr((int)(a),min((int)str.size()-a,(int)(b-a+1))) 
#define all(X) X.begin(),X.end()
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

// for pair comparison function(ascending order) use return (i1.ff < i2.ff);

/* string operations :
   str.substr (x,y) : returns a substring str[x],str[x+1],...str[x+y-1]
   __builtin_popcount(n) : no. of set bits in n.
*/

const int M = (1<<20)+5;
const int md = 1e9+7;

priority_queue<ll,vector<ll >,greater<ll > > pq;

ll pwr(ll a,ll n,ll m)
{
	ll p=1;
	while(n>0)
	{
		if(n%2==1)
			p=(p*a)%m;
		a=(a*a)%m;
		n=n/2;
	}
	return p;
}

string str;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	ll n,i,w = 0,c = 0;
	cin >> n;
	cin >> str;
	for(i=0;i<n;++i)
	{
		if(str[i] == 'W')
			w++;
	}
	for(i=0;i<n-w;++i)
	{
		if(str[i] == 'W')
			c++;
	}
	cout << c << "\n";
}

	

Measured memory_bytes: 3740
import sys
input = sys.stdin.readline

h, w = map(int, input().split())
a = [tuple(map(int, input().split())) for _ in range(h)]
b = [tuple(map(int, input().split())) for _ in range(h)]
c = [[abs(a[i][j] - b[i][j]) for j in range(w)] for i in range(h)]

CONST = 80 * 80 * 2 + 100000
dp = [[0] * w for _ in range(h)]
dp[0][0] = 1 << (c[0][0] + CONST)

for i in range(h):
    for j in range(w):
        if i < h - 1:
            dp[i + 1][j] |= (dp[i][j] << c[i + 1][j])
            dp[i + 1][j] |= (dp[i][j] >> c[i + 1][j])
        if j < w - 1:
            dp[i][j + 1] |= (dp[i][j] << c[i][j + 1])
            dp[i][j + 1] |= (dp[i][j] >> c[i][j + 1])

for k in range(CONST):
    if dp[h - 1][w - 1] & (1 << (CONST + k)) != 0 or dp[h - 1][w - 1] & (
            1 << (CONST - k)) != 0:
        ans = k
        break

print(ans)


Measured memory_bytes: 104692
#include <bits/stdc++.h>
#include <math.h>
#define ALL(a)    a.begin(), a.end()
using namespace std;

int main() {
int X, Y;cin >> X >> Y;
bool C = 0;
 for(int i = 0; i < 100; i++){
for(int j = 0; j < 100; j++){
if(i + j == X && 2*i + 4*j == Y){cout << "Yes";C = 1;break;}

}
}

if(!C)cout << "No";

}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#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<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define VIEW(x) do {cerr << #x << ": "; for(auto i : x) cerr << i << " "; cerr << endl;} while(0)
#define ALL(x) (x).begin(),(x).end()
template<class T>bool umax(T &a, const T &b) {if(a<b){a=b;return 1;}return 0;}
template<class T>bool umin(T &a, const T &b) {if(b<a){a=b;return 1;}return 0;}

template<typename A,size_t N,typename T> void FILL(A (&array)[N],const T &val){fill((T*)array,(T*)(array+N),val);}
template<typename T> void FILL(vector<T> &v, const T &x) {fill(v.begin(), v.end(), x);}
template<typename T> void FILL(vector<vector<T>> &v, const T &x) {for(auto &i:v)fill(i.begin(), i.end(), x);}

struct sieve {
  int n;
  vector<int> f, primes;
  sieve(int n) : n(n), f(n+1, 0) {
    /* O(n log log n) */
    f[0] = f[1] = -1;
    for(int i=2; i<=n; i++) {
      if(f[i]) continue;
      primes.push_back(i); f[i] = i;
      for(long long k=(long long)i*i; k<=n; k+=i) if(!f[k]) f[k] = i;
    }
  }
  bool is_prime(int x) {return f[x]==x;}
  template <typename T>
  vector<pair<T,int>> factors(T x) {
    assert((long long)n*n >= x);
    vector<pair<T,int>> fc;
    if( x>n ) {
      /* O(sqrt(x)) */
      for (int p : primes) {
        int c = 0;
        while (x%p == 0) x /= p, ++c;
        if (c != 0) fc.emplace_back(p,c);
      }
      if(x!=1) fc.emplace_back(x,1);
    } else {
      /* O(log x) */
      while (x != 1) {
        if (fc.size() && fc.back().first == f[x]) fc.back().second++;
        else fc.emplace_back(f[x], 1);
        x /= f[x];
      }
    }
    return fc;
  }
};

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

  map<int,int> nf;
  rep(i, 2, n+1) {
    for(auto [a,b] : s.factors(i)) nf[a] += b;
  }

  ll ans = 0;
  rep(i,2, n+1) rep(j, 2, n+1) rep(k, j+1, n+1) {
    if(i==j || i==k) continue;
    if(nf[i] < 2) continue;
    if(nf[j] < 4) continue;
    if(nf[k] < 4) continue;
    ans++;
  }
  
  rep(i, 2, n+1) rep(j, 2, n+1) {
    if(i==j) continue;
    if(nf[i] < 14) continue;
    if(nf[j] < 4) continue;
    ans++;
  }
  rep(i, 2, n+1) rep(j, 2, n+1) {
    if(i==j) continue;
    if(nf[i] < 24) continue;
    if(nf[j] < 2) continue;
    ans++;
  }
  rep(i, 2, n+1) {
    if(nf[i] < 74) continue;
    ans++;
  }

  cout << ans << endl;
}


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

typedef long long ll;
using namespace std;

void solver() {
    int n;
    int money = 100000;
    cin >> n;
    for (int i = 0; i < n; ++i) {
        money *= 1.05;
        if (money % 1000 != 0) {
            money = money - (money % 1000);
            money += 1000;
        }
    }
    cout << money << endl;
}

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

Measured memory_bytes: 3076
#include <stdio.h>

int main(void)
{
  int score;
  int sum = 0;
  int i;

  for (i = 0; i < 5; i++){
    scanf("%d", &score);
    if (score < 40){
      score = 40;
    }
    sum += score;
  }

  printf("%d\n", sum / 5);

  return (0);
}

Measured memory_bytes: 600
N,M = map(int,input().split())
Hlist = list(map(int,input().split()))

Tlist = []

for count in range(N):
    Tlist.append([])

for count in range(M):
    A,B = map(int,input().split())
    Tlist[A-1].append(B)
    Tlist[B-1].append(A)

ans = 0
for count in range(N):
    flag = True
    for count2 in range(len(Tlist[count])):
        if Hlist[count] <= Hlist[Tlist[count][count2]-1]:
            flag = False
            break
    if flag == True:
        ans = ans + 1

print(ans)

Measured memory_bytes: 29540
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;

#define MAXK 4010
int ct[2][MAXK][MAXK];
int s[2][MAXK][MAXK];

//vector<vector<vector<int>>> ct, s;

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

	int n, k, i, j, x, y, ans = 0, c, id, xx, yy, ss, aa, bb;
	char ch;
	cin >> n >> k;
	//ct.assign(2, vector<vector<int>>(k * 4 + 1, vector<int>(k * 4 + 1, 0)));
	//s.assign(2, vector<vector<int>>(k * 4 + 1, vector<int>(k * 4 + 1, 0)));
	for (i = 0; i < n; i++) {
		cin >> x >> y >> ch;
		if (ch == 'W') id = 1;
		else id = 0;
		xx = x % (2 * k) + 1;
		yy = y % (2 * k) + 1;
		ct[id][xx][yy]++;
		ct[id][xx][yy + 2 * k]++;
		ct[id][xx + 2 * k][yy]++;
		ct[id][xx + 2 * k][yy + 2 * k]++;
	}

	for (id = 0; id < 2; id++) {
		for (i = 1; i <= k * 4; i++) {
			ss = 0;
			for (j = 1; j <= k * 4; j++) {
				ss += ct[id][i][j];
				s[id][i][j] = s[id][i - 1][j] + ss;
			}
		}
	}

	ans = 0;
	for (i = 1; i <= k * 2; i++) {
		for (j = 1; j <= k * 2; j++) {
			aa = 0;

			x = i; y = j;
			xx = x + k - 1; yy = y + k - 1;
			aa += s[0][xx][yy] - s[0][x - 1][yy] - s[0][xx][y - 1] + s[0][x - 1][y - 1];

			x = i + k; y = j + k;
			xx = x + k - 1; yy = y + k - 1;
			aa += s[0][xx][yy] - s[0][x - 1][yy] - s[0][xx][y - 1] + s[0][x - 1][y - 1];

			x = i; y = j + k;
			xx = x + k - 1; yy = y + k - 1;
			aa += s[1][xx][yy] - s[1][x - 1][yy] - s[1][xx][y - 1] + s[1][x - 1][y - 1];

			x = i + k; y = j;
			xx = x + k - 1; yy = y + k - 1;
			aa += s[1][xx][yy] - s[1][x - 1][yy] - s[1][xx][y - 1] + s[1][x - 1][y - 1];

			ans = max(ans, aa);
		}
	}


	cout << ans << "\n";

	return 0;
}



Measured memory_bytes: 251392
n, a, b = map(int, input().split())

def check():
    if a > b:
        return 0
    elif a != b and n == 1:
        return 0
    elif n <= 2:
        return 1

    else:
        ba = b - a
        return 1 + ba * (n - 2)

print(check())

Measured memory_bytes: 38256
n = int(input())
cnt = 0
m = [1]*n
m[0] = 0
ans = 0
for i in range(2,n):
    tmp = i
    for j in range(i,n,i):
        m[j]+=1

for i in range(n):
    if m[i]%2==1:
        ans += 2*(m[i]//2)+1
    else:
        ans += m[i]
print(ans)

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

int main() {
  string s;
  cin >> s;
  bool is_ac = false;
  for (int i=0; i<s.size()-1; i++)
    if (s.substr(i, 2) == "AC") {
      is_ac = true;
      break;
    }
  if (is_ac) cout << "Yes" << endl;
  else cout << "No" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ALL(a)  (a).begin(),(a).end()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
template <typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template <typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
const int INT_INF = 1 << 30;
#define MOD 1000000007LL
#define endl "\n"

int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll S, W;
  cin >> S >> W;
  if(S <= W) cout << "unsafe" << endl;
  else cout << "safe" << endl;
}

Measured memory_bytes: 3640
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int bit = 0;
        for (int i=0; i<N; i++) {
            bit |= sc.nextInt();
        }
        System.out.println(Integer.numberOfTrailingZeros(bit));
    }
}

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

using namespace std;

void solve() {
    int w, a, b;
    cin >> w >> a >> b;
    int ans;
    if (abs(b - a) <= w) {
        ans = 0;
    } else if (b < a) {
        ans = a - (b + w);
    } else
        ans = b - (a + w);

    cout << ans;

}

int main() {

    solve();
    return 0;
}



Measured memory_bytes: 3168
# coding: utf-8
# input place number
s = input()
#print(s[0], s[1], s[2])
 
def main():
    count = 0
    for i in range(3):
        #print(s[i])
        if s[i] == '1':
            count = count + 1
 
    print(count)
 
if __name__ == '__main__':
    main()

Measured memory_bytes: 2940
#include <stdio.h>
#define I 10000000
int main()
{
  int n, i, m1[101], m[101][101], j, k, a, l;

  scanf("%d",&n);
  for (i = 1; i <= n; i++){
    scanf("%d%d",&m1[i-1],&m1[i]);
  }
  for (i = 1; i <= n; i++)
    m[i][i] = 0;
  for (l = 2; l <= n; l++){
    for (i = 1; i <= n-l+1; i++){
      j = i + l - 1;
      m[i][j] = I;
      for (k = i; k < j; k++){
	a = m[i][k] + m[k+1][j] + m1[i-1]*m1[k]*m1[j];
	if (a < m[i][j])
	  m[i][j] = a;
      }
    }
  }
  printf("%d\n",m[1][n]);

  return 0;
}



Measured memory_bytes: 2112
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define F first
#define S second
#define pi acos(-1)
using ll = long long;
using namespace std;
using namespace __gnu_pbds;
using vl = vector<ll>;
using pll =  pair<ll,ll>;
const ll mod = 1000000007;
const ll infi = 1000000000000000;
const ll md = 998244353;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;


ll power(ll x,ll y){
    ll res = 1;
    while(y){
        if(y&1)
            res = (res*x)%md;
        x = (x*x)%md;
        y = y/2;
    }
    return res;
}

void solve(){
    string s;
    cin>>s;
    if(s.size() == 2 && s[0] == s[1]){
        cout<<1<<" "<<2;
        return;
    }
    for(int i=0;i<s.size()-2;i++){
      //  cout<<s[i];
        if(s[i] == s[i+1] || s[i]==s[i+2] || s[i+1] == s[i+2]){
            cout<<i+1<<" "<<i+3;
            return;
        }
    }
    cout<<-1<<" "<<-1;
}
 
int main()
{
    
 
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    //int n; cin>>n; for (int i = 0; i < n; ++i)
    solve();
    return 0;
}


Measured memory_bytes: 512
#include <iostream>

using namespace std;

#define pi 3.1415926535
#define ll long long

int main() {
	ll n, m;
	ll i, j;
	ll a[20000];
	ll ans;
	ll sum = 0;
	cin >> n >> m;
	for (i = 0; i < m; i++) {
		cin >> a[i];
		sum += a[i];
	}
	if (sum > n)ans = -1;
	else ans = n - sum;
	cout << ans;
	return 0;

}

Measured memory_bytes: 3724
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>

using namespace std;


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


    int ans = -1;
    for (int i = 1;i <= n;i++)
    {
        if ((int)(i * 1.08) == n)
        {
            ans = i;
            break;
        }
    }

    if (ans != -1)
    {
        cout << ans << endl;
    }
    else
    {
        cout << ":(" <<endl;
    }
    
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
constexpr int MOD = 1e9+7;
int K, M, N;

constexpr int fpm(int base, int index, int power = 1) {
    if (!index) return power;
    int nb = 1LL * base * base % MOD;
    int ni = index >> 1;
    int np = (index & 1) ? 1LL * base * power % MOD : power;
    return fpm(nb, ni, np);
}
constexpr int inv2 = fpm(2, MOD-2);

int ncr(int r) {
    // (N x M - 2) choose (K - 2)
    int n = (1LL * N * M % MOD + MOD - 2) % MOD;
    int c = 1;
    for (int i = 1; i <= r; ++i) {
        c = 1LL * c * (n - (i - 1)) % MOD * fpm(i, MOD-2) % MOD;
    }
    return c;
}

int sum(int n) { return 1LL * n * (n + 1) % MOD * inv2 % MOD; }

int main() {
    scanf(" %d%d%d", &N, &M, &K);
    int ret = 0;
    for (int i = 0; i < N; ++i) {
        for (int j = 0; j < M; ++j) {
            int b = N-i;
            ret = (1LL * sum(M-j-1) * b % MOD + ret) % MOD; // Forwards (>= i)
            ret = (1LL * sum(j) * (b-1) % MOD + ret) % MOD; // Backwards (> i)
            ret = (1LL * sum(b - 1) * M % MOD + ret) % MOD; // Downwards (all)
        }
    }
    ret = 1LL * ret * ncr(K-2) % MOD;
    printf("%d\n", ret);
    return 0;
}


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

using namespace std;

long long triangle(int n) {
	return (long long) n * (n + 1) / 2;
}

int main() {
	int n; cin >> n;
	cout << triangle(n) - triangle(n / 3) * 3 - triangle(n / 5) * 5 + triangle(n / 15) * 15 << '\n';
	return 0;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define inp(X) cin >> X
#define out(X) cout << X << endl
#define out16(X) cout << setprecision(16) << X << endl
#define rep(i,n) for(int i=0;i<n;i++ )
#define rep2(i,f,n) for(int i=f;i<n;i++ )
#define MAX(A) *max_element(A.begin(),A.end())
#define MIN(A) *min_element(A.begin(),A.end())
#define SORT(A) sort(A.begin(),A.end())
#define REV(A) reverse(A.begin(),A.end())
typedef long long int ll;
using vi = std::vector<int>;
using vvi = std::vector<std::vector<int>>;
using vd = std::vector<double>;
using vvd = std::vector<std::vector<double>>;
using vll = std::vector<ll>;
using vvll = std::vector<std::vector<ll>>;
using namespace std;
#define MOD 1000000007
#define INF 1000000001
#define LL_INF 1001001001001001001

int main(void) {
	int k,x; cin >> k >> x;
	if(500*k>=x) out("Yes");
	else out("No");

}




Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    int n;
    long long k;
    cin>>n>>k;
    unordered_set<int> map;
    int arr[n+1];
    for(int i=1;i<=n;i++) cin>>arr[i];
    int pres=1;
    int pos[n+2];
    pos[0]=1;
    int i=1;
    while(map.find(pres)==map.end()){
        map.insert(pres);
        pos[i]=arr[pres];
        pres=arr[pres];
        i++;
    }
    i--;
    int initial=0;;
    for(int j=0;j<n;j++){
        if(pos[j]==pres){
            initial=j;
            break;
        }
    }
    if(k<=initial){
        cout<<pos[k]<<endl;
        return 0;
    }
    k-=initial;
    int size=i-initial;
    long long p=k%size;
    cout<<pos[((int)(initial+p))]<<endl;
    return 0;
}

Measured memory_bytes: 12876
#include <bits/stdc++.h>
#define ALL(A) (A).begin(), (A).end()
#define ll long long
#define rep(i, n) for (int i = 0; i < (n); i++)

using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }

const ll mod = 1e9 + 7;
const ll INF = -1 * ((1LL << 63) + 1);
const int inf = -1 * ((1 << 31) + 1);

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    int n,k;
    cin >> n >> k;
    int cnt = (n+1)/2;
    if(cnt>=k)cout << "YES" << endl;
    else cout << "NO" << endl;
}

Measured memory_bytes: 256
update [] _ = Nothing
update (h:hs) (x:xs)
  | h == x = (x:) <$> update hs xs
  | h > x  = Just $ grow (h:hs) (x:xs)
  where
    grow [] _ = []
    grow (h:hs) (x:xs)
      | h == x = x:xs
      | h > x = (x + 1) : grow hs xs

solv hs = go hs (repeat 0) 0 where
  go hs xs i =
    case update hs xs of
      Nothing -> i
      Just updated -> go hs updated (succ i)

main = do
  getLine
  hs <- map read . words <$> getLine
  print $ solv hs


Measured memory_bytes: 1020
#include<bits/stdc++.h>
using namespace std;
#define reg register
#define ll long long
#define maxn 605
#define mo 1000000007
inline ll read()
{
	ll x=0,w=0;char ch=getchar();
	while(!isdigit(ch))w|=ch=='-',ch=getchar();
	while(isdigit(ch))x=(x<<3)+(x<<1)+(ch^48),ch=getchar();
	return w?-x:x;
}
inline void Add(int &x,int y){x+=y;x-=(x>=mo?mo:0);}
inline int add(int x,int y){x+=y;return x>=mo?x-mo:x;}
inline void Max(int &x,int y){x=x>y?x:y;}
int n,m,ans;
int dp[maxn][maxn];
int gs[maxn][maxn];
int vis[maxn],to[maxn],sum[maxn];
int main()
{
    reg int T=1;
    reg int i,j,l,x,u,v,tmp,nxt,cnt;
    sum[0]=1;
    for(i=2;i<=600;i+=2)
        sum[i]=1ll*sum[i-2]*(i-1)%mo;
    while(T--)
    {
        n=read(),m=read();
        memset(vis,0,sizeof vis);
        memset(to,0,sizeof to);
        for(i=1;i<=m;++i)
        {
            u=read(),v=read();
            if(u>v)swap(u,v);
            to[u]=v;to[v]=u;
            vis[u]=1,vis[v]=1;
        }
        memset(gs,-1,sizeof gs);
        for(i=1;i<=n*2;++i)
        {
            nxt=0;cnt=0;
            for(j=i;j<=n*2;++j)
            {
                if(vis[j])
                {
                    if(to[j]<i)break;
                    Max(nxt,to[j]);++cnt;
                }
                if(j>=nxt)gs[i][j]=cnt;
            }
        }
        ans=0;
        memset(dp,0,sizeof dp);
        for(l=2;l<=n*2;l+=2)
        {
            for(i=1;i+l-1<=n*2;++i)
            {
                j=i+l-1;
                if(gs[i][j]==-1)continue;
                dp[i][j]=sum[l-gs[i][j]];
                tmp=0;
                for(x=i+1;x<j;x+=2)
                    if(gs[x+1][j]>=0&&dp[i][x])
                        Add(tmp,1ll*dp[i][x]*sum[j-x-gs[x+1][j]]%mo);
                Add(dp[i][j],mo-tmp);
                Add(ans,1ll*dp[i][j]*sum[2*n-l-2*m+gs[i][j]]%mo);
            }
        }
        printf("%d\n",ans);
    }
	return 0;
}

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

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

    int res = 0;
    bool is_ok = false;
    int j = 1;
    rep(i, n) {
        int a;
        cin >> a;
        if (a == j) {
            is_ok = true;
            j++;
        }
        else {
            res++;
        }
    }

    if (is_ok) cout << res << endl;
    else cout << -1 << endl;

    return 0;
}

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

long double s, x;
int y;
int main() {
    s = 100;
    cin >> x;
    for (y = 0; s < x; y++) {
        s = floor(s * 1.01);
    }
    cout << y << endl;
    return 0;
}

Measured memory_bytes: 3728
use proconio::{fastout, input};

#[fastout]
fn main() {
    input!(n: usize, a: [usize; n]);

    const A_SIZE: usize = 1_000_002;
    let mut do_continue = true;
    let mut ans = "pairwise coprime";
    let mut aaa: Vec<usize> = vec![0usize; A_SIZE];
    for v in &a {
        aaa[*v] += 1;
    }

    for i in 2..A_SIZE {
        let mut count = 0;
        for j in (0..A_SIZE).skip(i).step_by(i) {
            count += aaa[j];
        }
        if count > 1 {
            do_continue = false;
            ans = "not coprime";
            break;
        }
    }

    if !do_continue {
        let mut c = a[0];
        for i in a.iter().skip(1) {
            c = num::integer::gcd(c, *i);
        }
        if c == 1 {
            ans = "setwise coprime";
        }
    }

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


Measured memory_bytes: 24420
#include <bits/stdc++.h>
using namespace std;
#define mp(a,b) make_pair(a,b)
#define ff first
#define setp(a) setprecision(a)<<fixed
#define ss second
#define fori(v) for(ll i=0; i<v; i++)
#define forj(v) for(ll j=0; j<v; j++)
#define fork(v) for(ll k=0; k<v; k++)
#define forl(v) for(ll l=0; l<v; l++)
#define fort(v) for(ll t=0; t<v; t++)
#define forz(v) for(ll z=0; z<v; z++)	
#define forx(v) for(ll x=0; x<v; x++)
#define fory(v) for(ll y=0; y<v; y++)
#define ll int
#define double long double
#define MAX 530100
#define pb(a) push_back(a)
const ll INF = 0x3f3f3f3f;
const ll inf = INF;
ll modulo = pow(10,9)+7;
#define MAX (int)(pow(10,6)+ 10)

ll arr[MAX];
ll ans[MAX];

void deal(){
	ll n;
	cin>>n;
	fori(n)
		cin>>arr[i+1];
	vector<ll> ball;
	for(ll i =n; i; i--){
		ll s = 0;
		for(ll j = 2*i; j<=n; j+=i)
			s+=ans[j];
		if((s&1) != (arr[i]&1))
			ans[i] = 1, ball.pb(i); 
	}
	cout<<ball.size()<<'\n';
	for(auto i : ball)
		cout<<i<<' ';
}

int main(){
	cin.tie(0);
	ios_base::sync_with_stdio(0);
	deal();
}

/*

4 6
4 8 7 8
1 2 4
2 1 2 2
1 3 4
2 1 1 8
1 1 3
1 1 4

*/

Measured memory_bytes: 6392
#include <stdio.h>

int main(void){
	
	int a,b,c,d,e,f;
	int g;
	int h,i,j,k,l,m;
	
	
	scanf("%d %d %d %d %d %d",&a,&b,&c,&d,&e,&f);
	
	h=a*1;
	i=b*5;
	j=c*10;
	k=d*50;
	l=e*100;
	m=f*500;
	
	g=h+i+j+k+l+m;
	
	if(1000<=g){
		printf("%d\n",1);
	}else{
		printf("%d\n",0);
	}
	return 0;
}

Measured memory_bytes: 1028