akhauriyash/Code-Regression huggingface dataset:
# include <bits/stdc++.h>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
const double PI = acos(-1);
template<class T>constexpr T INF() { return ::std::numeric_limits<T>::max(); }
template<class T>constexpr T HINF() { return INF<T>() / 2; }
template <typename T_char>T_char TL(T_char cX) { return tolower(cX); };
template <typename T_char>T_char TU(T_char cX) { return toupper(cX); };
template<typename T>vector<T> make_v(size_t a){ return vector<T>(a); }
template<typename T,typename... Ts>auto make_v(size_t a, Ts... ts){ return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...)); }
template<typename T,typename V>typename enable_if<is_class<T>::value==0>::type fill_v(T &t, const V &v){ t = v; }
template<typename T,typename V>typename enable_if<is_class<T>::value!=0>::type fill_v(T &t, const V &v){ for(auto &e : t) fill_v(e, v); }
const int vy[] = { -1, -1, -1, 0, 1, 1, 1, 0 }, vx[] = { -1, 0, 1, 1, 1, 0, -1, -1 };
const int dx[4] = { 0,1,0,-1 }, dy[4] = { 1,0,-1,0 };
int popcnt(unsigned long long n) { int cnt = 0; for (int i = 0; i < 64; i++)if ((n >> i) & 1)cnt++; return cnt; }
int d_sum(LL n) { int ret = 0; while (n > 0) { ret += n % 10; n /= 10; }return ret; }
int d_cnt(LL n) { int ret = 0; while (n > 0) { ret++; n /= 10; }return ret; }
LL gcd(LL a, LL b) { if (b == 0)return a; return gcd(b, a%b); };
LL lcm(LL a, LL b) { LL g = gcd(a, b); return a / g*b; };
# define ALL(qpqpq)           (qpqpq).begin(),(qpqpq).end()
# define UNIQUE(wpwpw)        sort(ALL((wpwpw)));(wpwpw).erase(unique(ALL((wpwpw))),(wpwpw).end())
# define LOWER(epepe)         transform(ALL((epepe)),(epepe).begin(),TL<char>)
# define UPPER(rprpr)         transform(ALL((rprpr)),(rprpr).begin(),TU<char>)
# define FOR(i,tptpt,ypypy)   for(LL i=(tptpt);i<(ypypy);i++)
# define REP(i,upupu)         FOR(i,0,upupu)
# define INIT                 std::ios::sync_with_stdio(false);std::cin.tie(0)

int n;
int v[1010], c[1010];
vector<int> ve;

int main(){
    cin >> n;
    REP(i, n)cin >> v[i];
    REP(i, n)cin >> c[i];
    REP(i, n){
        ve.emplace_back(v[i] - c[i]);
    }
    sort(ALL(ve));
    reverse(ALL(ve));
    int ans = 0;
    REP(i, n){
        if(ve[i] > 0){
            ans += ve[i];
        }
    }
    cout << ans << endl;
}

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

out=False
w=set([])
tmp=input()
end=tmp[-1]
w.add(tmp)

for i in range(N-1):
  tmp=input()
  if end!=tmp[0]:
    out=True
  end=tmp[-1]
  w.add(tmp)

if out or len(w)!=N:
  print("No")
else:
  print("Yes")

Measured memory_bytes: 3064
item=list(map(int,input().split()))
item.sort()
times=0
while sum(item)/3!=item[0]:
  if item[1]==item[2]:
    item[0]+=2
    times+=1
    item.sort()
  else:
    item[0]+=1
    item[1]+=1
    times+=1
    item.sort()
print(times)

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

int n;
vector<int> A;

void insertionSort(int n)
{
    for (int i = 0; i < n; ++i) {
        int v = A[i];
        int j = i - 1;
        while (j >= 0 && A[j] > v) {
            A[j+1] = A[j];
            j--;
        }
        A[j+1] = v;
        
        for (int k = 0; k < n-1; ++k) {
            cout << A[k] <<" ";
        }
        cout << A[n-1] << endl;
   }

    return;
}

int main ()
{
    cin >> n;

    for (int i = 0; i < n; ++i) {
        int tmp;
        cin >> tmp;
        A.push_back(tmp);
    }

    insertionSort(n);

    return 0;
}

Measured memory_bytes: 3108
def findsum(n):
    sum = 0 # 各桁の和
    while True:
        q, mod = divmod(n, 10)
        sum += mod
        n = q
        if n == 0:
            break

    return sum

N, A, B = map(int, input().split())

arr = range(1,N+1)

sum = 0 # 条件内の各桁の和の合計
for i in range(N):
    a = findsum(arr[i])

    if A <= a <= B:
        sum += arr[i]

print(sum)

Measured memory_bytes: 3064
/*
ID: anonymo14
TASK: wormhole
LANG: C++                 
*/
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pair<int,int>> vpii;

#define F first
#define S second
#define PU push
#define PUF push_front
#define PUB push_back
#define PO pop
#define POF pop_front
#define POB pop_back

#define REP(i,a,b) for(int i=a; i<=b; i++)

#define MOD 1000000007

void solve(int test_case) {
	ll h,w;
	cin>>h>>w;
	if(h==1||w==1){cout<<1;return;}
	h*=w;
	h+=1;
	h>>=1;
	cout<<h;
}

int main() {
	
	////// FILE BASED IO////
	//freopen("wormhole.in", "r", stdin);
	//freopen("wormhole.out", "w", stdout);
	///////////////
	
	ios::sync_with_stdio(0);
	cin.tie(0);
	int t=1;
	//cin>>t;
	REP(i,1,t) {
		solve(i);
	}
	return 0;
}	


Measured memory_bytes: 3584
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
typedef vector<ll> VI;
typedef vector<VI> VVI;
const ll MOD = 998244353;
const ll INF = 4611686018427387903;
#define REP(i, n) for (int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()

VVI edge(114514, VI(0));
VI ans(114514,-1);
vector<bool> f(114514,0);

int main(){
	int n, m; cin >> n >> m;
	int a, b;
	REP(i,m) {
		cin >> a >> b;
		a--; b--;
		edge[a].push_back(b);
		edge[b].push_back(a);
	}
	f[0]=1;
	queue<int> q; q.push(0);
	while(!q.empty()){
		int v=q.front();
		q.pop();
		for (auto to:edge[v]) {
			if (!f[to]){
				ans[to]=v;
				f[to]=1;
				q.push(to);
			}
		}
	}
	bool no=0;
	REP(i,n){
		if(!f[i]){
			no=1;
			break;
		}
	}
	if(no)
		cout << "No" << endl;
	else{
		cout << "Yes" << endl;
		for(int i=1;i<n;i++)
			cout << ans[i]+1 << endl;
 	}
	return 0;
}

Measured memory_bytes: 13136
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef pair<int,int> pint;

#define DE 1
#define FI first
#define SE second
#define PB push_back
#define MP make_pair
#define ALL(s) (s).begin(),(s).end()
#define REP(i,n) for (int i = 0; i < (int)(n); ++i)
#define EACH(i,s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define COUT(x) cout<<#x<<" = "<<(x)<<" (L"<<__LINE__<<")"<<endl

template<class T1, class T2> ostream& operator<<(ostream &s, pair<T1,T2> P){return s<<'<'<<P.first<<", "<<P.second<<'>';}
template<class T> ostream& operator<<(ostream &s, vector<T> P) {s<<"{ ";for(int i=0;i<P.size();++i){if(i>0)s<<", ";s<<P[i];}return s<<" }"<<endl;}
template<class T1, class T2> ostream& operator<<(ostream &s, map<T1,T2> P) {s<<"{ ";for(__typeof__(P.begin()) it=P.begin();it!=P.end();++it){if(it!=P.begin())s<<", ";s<<'<'<<it->first<<"->"<<it->second<<'>';}return s<<" }"<<endl;}



int n, m;
vint a;

vint parity;

int dp[10][10];

int wa(int n) {
    if (n < 10) return n;
    else {
        int a = n/10, b = n%10;
        return a + b;
    }
}

int main() {
    cin >> n;
    string str; cin >> str;
    parity.clear(); a.clear();
    reverse(ALL(str));
    int temp = 0;
    for (int i = 0; i < str.size(); ++i) {
        if (i & 1) {
            if (str[i] == '*') parity.PB(0);
            else temp += wa((int)(str[i] - '0')*2);
        }
        else {
            if (str[i] == '*') parity.PB(1);
            else temp += (int)(str[i] - '0');
        }
    }
    cin >> m;
    for (int i = 0; i < m; ++i) {
        int num; cin >> num; a.PB(num);
    }
    memset(dp, 0, sizeof(dp));
    dp[0][0] = 1;
    
    for (int i = 0; i <= parity.size(); ++i) {
        for (int j = 0; j <= 9; ++j) {
            for (int k = 0; k < a.size(); ++k) {
                if (parity[i] & 1) {
                    dp[i+1][(j+a[k])%10] += dp[i][j];
                }
                else {
                    dp[i+1][(j+wa(a[k]*2))%10] += dp[i][j];
                }
            }
        }
    }
    int rem = (10 - temp%10) % 10;
    cout << dp[(int)parity.size()][rem] << endl;
    
    return 0;
}


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

using namespace std;

#define ll long long

//#define TEST

/* kの約数を求める. 時間計算量O(√k) */
vector<ll> divisor(ll k){
    vector<ll> d;
    for (ll i = 1;i * i <= k;++i){
        if (k % i == 0){
            d.push_back(i);
            if (i * i != k)
                d.push_back(k / i);
        }
    }
    sort(d.begin(),d.end());
    return d;
}

signed main(){
    int n,k;
    cin >> n >> k;
    ll* a = new ll[n];
    for (int i = 0;i < n;++i)
        cin >> a[i];
    ll sum_a = accumulate(a,a + n,0); // aの合計

    /* sum_aの正の約数をすべて求める. */
    auto ds = divisor(sum_a);

    /* dsの確認(TEST時のみ) */
#ifdef TEST
    cout << "-------ds-------" << endl;
    for (auto d : ds)
        cout << d << " ";
    cout << endl;
#endif

    /*
        sum_aの正の約数dについて、
            1. 各a[i]について、最低いくら加算するとdの倍数になるか求める
            2. 1の結果をb[i]として、配列bをソート
            3. 配列bの累積和を求める
            4. 3を利用しながら、
                b[0]+b[1]+...b[i]=d*(n-i-1)-(b[i+1]+b[i+2]+...+b[n-1])
                    かつ
                b[0]+b[1]+...+b[i]<=k
               なるiが存在するか調べる
        を、dが大きい方から実行する.
        4の結果存在するならばそのdが求める答え. 
     */
    for (int j = ds.size() - 1;j >= 0;--j){
        ll d = ds[j];
#ifdef TEST
        cout << "-------d=" << d << "------" << endl;
#endif
        /* 上記の1 */
        vector<ll> b;
        for (int i = 0;i < n;++i){
            b.push_back((d - (a[i] % d)) % d);
        }
        /* 上記の2 */
        sort(b.begin(),b.end());
#ifdef TEST
        cout << "b" << endl << "    ";
        for (auto bi : b)
            cout << bi << " ";
        cout << endl;
#endif
        /* 上記の3 */
        ll* sum = new ll[n + 1];
        sum[0] = 0;
        for (int i = 0;i < n;++i){
            sum[i + 1] = sum[i] + b[i];
        }
#ifdef TEST
        cout << "sum" << endl << "    ";
        for (int i = 0;i <= n;++i)
            cout << sum[i] << " ";
        cout << endl;
#endif
        /* 上記の4 */
        bool f = false; // 存在するかのフラグ
        for (int i = 0;i < n;++i){
            ll s1 = sum[i + 1] - sum[0];
            ll s2 = d * (n - i - 1) - (sum[n] - sum[i + 1]);
            f = s1 == s2 && s1 <= k;
            if (f) break;
        }
        if (f){
#ifdef TEST
            cout << "-------ans------" << endl;
#endif
            cout << d << endl;
            goto End;
        }
    }

    End:;
    delete[] a;
	return 0;
}

Measured memory_bytes: 4736
n = int(input())

cnt = 0

for _ in range(n):
    t, x, y = map(int, input().split())
    if t%2!=0 and (x+y)%2!=0 and x+y<=t:
        cnt += 1
    elif t%2==0 and (x+y)%2==0 and x+y<=t:
        cnt += 1
    else:
        break

if cnt == n:
    print('Yes')
else:
    print('No')


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

class Proc{
public:
  string nam;
  int tim;
  Proc(){nam="";tim=0;}
};

Proc Q[100001];

class Queue{
private:
  int fp;
  int rp;
public:
  Queue(){fp=0;rp=0;}
  int next(int p) const {return (p+1)%100001;}
  bool isFull() const {return (next(rp)==fp);}
  bool isEmpty() const {return (rp==fp);}
  void push(Proc d);
  Proc front();
  void pop();
};

void Queue::push(Proc d){

  if(isFull())
  return ;

  Q[rp]=d;
  rp=next(rp);
}

Proc Queue::front(){

  if(isEmpty()){
    Proc er;
    er.tim=-1;
    return er;
  }
  return Q[fp];
}

void Queue::pop(){
  if(isEmpty())
  return ;

  fp=next(fp);
}

int main(){
  Queue que;

  int n,q;
  cin>>n>>q;

  for(int i=0;i<n;i++){
    Proc p;
    cin>>p.nam>>p.tim;

    que.push(p);
  }

  int total_tim=0;

  while(!que.isEmpty()){
    Proc p=que.front(); que.pop();

    if(p.tim<=q){
      total_tim+=p.tim;

      cout<<p.nam<<' '<<total_tim<<endl;
    }
    else{
      total_tim+=q;
      p.tim-=q;

      que.push(p);
    }
    }

    return 0;
  }

Measured memory_bytes: 6904
#include<bits/stdc++.h>
using namespace std;
/**
******************* Author:Bisnu sarkar ****************************
**/
/*
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
*/
#define fRead(x)       freopen(x,"r",stdin)
#define fWrite(x)      freopen (x,"w",stdout)
#define ull            unsigned long long
#define ll             long long
#define pii            pair<int,int>
#define sit            set<int> :: iterator
#define vrit           vector<int> :: reverse iterator
#define ff             first
#define ss             second
#define endl           '\n';
#define sz(s)          (int)s.size()
#define all(s)         s.begin(),s.end()
#define IO             ios_base::sync_with_stdio(false),cin.tie(NULL);  
#define what_is(x)     cerr << #x << " is " << x << endl;
///*....Debugger....*///
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {cout << endl;}
template<typename T, typename... Args> void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << ", ";
  err(++it, args...);
}
///*....Input....*///
template <typename T> inline void Int(T &n) {
  n = 0; int f = 1; register int ch = getchar();
  for (; !isdigit(ch); ch = getchar()) if (ch == '-') f = -1;
  for (; isdigit(ch); ch = getchar()) n = (n << 3) + (n << 1) + ch - '0';
  n = n * f;
}
 
template <typename T, typename TT> inline void Int(T &n, TT &m) { Int(n); Int(m); }
template <typename T, typename TT, typename TTT> inline void Int(T &n, TT &m, TTT &l) { Int(n, m); Int(l);}
double ind(){double x; scanf("%lf",&x);return x;}

///*....Bitmask....*///
int set_1(int n,int pos){return n = (n | (1<<pos));}
int reset_0(int n,int pos){return n= n & ~(1<<pos);}
bool check_bit(int n,int pos){return n = n & (1<<pos);}

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

///*....Constraints....*///
const int N = (int) 1e6 + 5;
const int M = (int) 1e9 + 7;
const double pi=2* acos(0.0);
const double eps=1e-9;


int main()
{
    int t=1,te=0;
    //Int(t);
    while(t--){
        int n;
        Int(n);
        int r=n%10;

        if(r==3)printf("bon\n");
        else if(r==0 or r==1 or r==6 or r==8)printf("pon\n");
        else{
            printf("hon\n");
        }

        //printf("Case %d: ",++te);
    }
    return 0;
}






Measured memory_bytes: 3620
#include <stdio.h>
int main(){
  int i,j,minh,maxh,minw,maxw,n,m,w,cube[200][2];
  
  while(1){
    scanf("%d",&m);
    if(m == 0) break;
    cube[0][0] = 0;
    cube[0][1] = 0;
    minh = 0;
    minw = 0;
    maxh = 0;
    maxw = 0;
    
    for(i=1;i<m;i++){
      scanf("%d %d",&n,&w);
      if(w == 0){
	cube[i][0] = cube[n][0]+1;
	cube[i][1] = cube[n][1];
	if(cube[i][0]>maxw) maxw=cube[i][0];
      }
      else if(w == 1){
	cube[i][1] = cube[n][1]+1;
	cube[i][0] = cube[n][0];
	if(cube[i][1]>maxh) maxh=cube[i][1];
      }
      else if(w == 2){
	cube[i][0] = cube[n][0]-1;
	cube[i][1] = cube[n][1];
	if(cube[i][0]<minw) minw=cube[i][0];
      }
      else if(w == 3){
	cube[i][1] = cube[n][1]-1;
	cube[i][0] = cube[n][0];
	if(cube[i][1]<minh) minh=cube[i][1];
      }
    }
    printf("%d %d\n",maxw-minw+1,maxh-minh+1);
  }
  return 0;
}

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

string s;

bool cek(int l, int r){
	string tmp = "";
	for(int i=l;i<=r;i++) tmp.push_back(s[i]);
	sort(tmp.begin(),tmp.end());
	return (tmp[0] == tmp[1]) || (tmp[1] == tmp[2]);
}

int main(){
	cin >> s;
	for(int i=1;i<s.size();i++){
		if(cek(i-1,i)){
			cout << i << " " << i+1 << endl;
			return 0;
		}
	}
	for(int i=2;i<s.size();i++){
		if(cek(i-2,i)){
			cout << i-1 << " " << i+1 << endl;
			return 0;
		}
	}
	cout << "-1 -1" << endl;
	return 0;
}

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

using namespace std;

#define int long long
#define MOD 1000000007

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define all(i) (i).begin(), (i).end()
#define rall(i) (i).begin(), (i).end(), greater<int>()

#define elif else if
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define fst first
#define sec second
template <typename T>
void print(T x)
{
    std::cout << x << '\n';
}

//typedef long long ll;
#define TENNINE 1000000005
#define TENFIVE 100005
//#define int long long

int N;
vector<int> a;

signed main()
{
    cin >> N;
    a.reserve(N);

    rep(i, N)
    {
        cin >> a[i];
    }

    int max_l[N];
    int max_r[N];

    max_l[0] = a[0];
    max_r[N - 1] = a[N - 1];

    for (int i = 1; i < N; i++)
    {
        max_l[i] = max(a[i], max_l[i - 1]);
        max_r[N - 1 - i] = max(a[N - 1 - i], max_r[N - i]);
    }

    cout << max_r[1] << endl;

    for (int i = 1; i < N - 1; i++)
    {
        cout << max(max_l[i - 1], max_r[i + 1]) << endl;
    }

    cout << max_l[N - 2] << endl;

    return 0;
}


Measured memory_bytes: 6272
/* Simplicity and Goodness */

#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>

// using namespace __gnu_pbds;
using namespace std;
// typedef tree<int, null_type, less<int>, rb_tree_tag,
//             tree_order_statistics_node_update> indexed_set;

void my_dbg() { cout << endl; }
template<typename Arg, typename... Args> void my_dbg(Arg A, Args... B)
{ cout << ' ' << A; my_dbg(B...); }
#define dbg(...)  cout << "(" << #__VA_ARGS__ << "):", my_dbg(__VA_ARGS__)

#define scn(n) scanf("%d", &n)
#define lscn(n) scanf("%lld", &n)
#define pri(n) printf("%d ", (int)(n))
#define prin(n) printf("%d\n", (int)(n))
#define lpri(n) printf("%lld ", n)
#define lprin(n) printf("%lld\n", n)
#define rep(i,a,b) for(int i=(int)(a); i<(int)(b); i++)
#define pb push_back
#define mp make_pair
#define F first
#define S second

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;

const int inf = INT_MAX;
const int ninf = INT_MIN;
const int mod = 1e9+7;
const int N = 2e5+2;


void solve()
{
    string s; int k;
    cin >> s >> k;

    int n = (int) s.size();

    set<string> fnd;

    rep(st, 0, n) {
        rep(len, 1, k+1) {
            fnd.insert(s.substr(st, len));
        }
    }

    rep(i, 0, k-1)
        fnd.erase(*fnd.begin());

    cout << *fnd.begin() << '\n';
}

int main()
{
    int t = 1;
    // scn(t);
    
    while(t --) {
        solve();
    }
    return 0;
}

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

using namespace std;

int main() {
        int n, a, sum;

        cin >> n;
        while (n-->0) {
                cin >> a;
                sum = (sum + a) % 2;
        }
        if (sum == 0)
                cout << "YES" << endl;
        else
                cout << "NO" << endl;
        return 0;
}


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

int main(){
int a[3];
scanf("%d %d %d",&a[0],&a[1],&a[2]);
sort(a,a+3);
printf("%d %d %d\n",a[0],a[1],a[2]);


return 0;


}

Measured memory_bytes: 1040
/*
#1140935 Solution for 0515: School Road by ryogo
Source Code Status Test Cases     Policy: public     Reviewed: 59    
*/
#include<iostream>
 
using namespace std;
 
int dp[20][20];
 
int main(){
    int a,b;
    while(cin>>a>>b && a&&b){
        int n;
        cin>>n;
        for(int i=0;i<20;i++)for(int j=0;j<20;j++)dp[i][j]=0;
        for(int i=0;i<n;i++){
            int x,y;
            cin>>x>>y;
            dp[y][x]=-1;
        }
        dp[1][1]=1;
        for(int i=1;i<=b;i++){
            for(int j=1;j<=a;j++){
                if(i==1 && j==1)continue;
                if(dp[i][j]!=-1){
                    dp[i][j]=dp[i][j-1]+dp[i-1][j];
                }
                else dp[i][j]=0;
            }
        }
 
        cout<<dp[b][a]<<endl;
    }
}


Measured memory_bytes: 3080
#include<iostream>
#include<vector>
#include<stdlib.h>
#include<time.h>
#include<math.h>
#include<string.h>
#include<algorithm>
#include<queue>
#include<map>
#include<iomanip>
using namespace std;

int A,B,C,N;
vector<int> L;
#define INF 100000000

int enumeration(int n,int a,int b, int c){
 int ret0,ret1,ret2,ret3;
 if(n==N){
  if(min({a,b,c})>0){
   return abs(a-A)+abs(b-B)+abs(c-C)-30; 
  }
  else return INF;
 }
  
 ret0=enumeration(n+1,a,b,c);
 ret1=enumeration(n+1,a+L[n],b,c)+10;
 ret2=enumeration(n+1,a,b+L[n],c)+10;
 ret3=enumeration(n+1,a,b,c+L[n])+10;

 return min({ret0,ret1,ret2,ret3});
}

int main(void){
 int l;
 cin>>N;
 cin>>A>>B>>C;

 for(int i=0; i<N; i++){
  cin>>l;
  L.push_back(l);
 }

 cout<<enumeration(0,0,0,0)<<endl;
 

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define mod 998244353
#define MOD 1000000007
#define inf 0x3f3f3f3f
#define linf 0x3f3f3f3f3f3f3f3fll
#define eps 1e-6
typedef long long ll;
typedef pair<int,int> pii;
typedef unsigned long long ull;
ll dp[110][4][2];
bool vis[110][4][2];
string s;
int k,n;
inline ll solve(int dig,int cnt,int sma)
{
//	cout<<dig<<" "<<cnt<<" "<<sma<<endl;
	if(cnt>k)return 0;
	if(vis[dig][cnt][sma])return dp[dig][cnt][sma];
	vis[dig][cnt][sma]=1;
	dp[dig][cnt][sma]=0;
	if(dig==n)
	{
		return dp[dig][cnt][sma]=(cnt==k);
	}
	if(sma)
	{
		dp[dig][cnt][sma]+=solve(dig+1,cnt,1)+9ll*solve(dig+1,cnt+1,1);
	}
	else
	{
		dp[dig][cnt][sma]+=solve(dig+1,cnt,s[dig]>'0');
		for(char c='1';c<s[dig];c++)
			dp[dig][cnt][sma]+=solve(dig+1,cnt+1,1);
		if(s[dig]!='0')dp[dig][cnt][sma]+=solve(dig+1,cnt+1,0);
	}
//	cout<<dp[dig][cnt][sma]<<endl;
	return dp[dig][cnt][sma];
}
int main()
{
	cin>>s>>k;
	n=s.length();
	cout<<(ll)solve(0,0,0)<<endl;
	return 0;
}

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

int main() {
  int n;cin>>n;
  if(n%1000==0)cout<<0<<endl;
  else cout<<1000-n%1000<<endl;
}

Measured memory_bytes: 3624
/*
    Sk arman Hossain
    University of Barisal

    Problem name :
    Algorithm :
 */

#include<bits/stdc++.h>
#define nl printf("\n");
#define N 200001
#define PR pair<int,int>
#define sf(n) scanf("%d", &n)
#define sff(n, m) scanf("%d %d",&n,&m)
#define sfl(n) scanf("%lld", &n)
#define sfu(n) scanf("%llu", &n)
#define sffl(n, m) scanf("%lld %lld",&n,&m)
#define pfn(n) printf("%d\n",n)
#define pf(n) printf("%d ",n)
#define pfl(n) printf("%lld ",n)
#define pfln(n) printf("%lld\n",n)
#define pfu(n) printf("%llu\n",n)
#define pfs(s) printf("%s",s)
#define YES printf("YES\n")
#define NO printf("NO\n")
#define PB push_back
#define PI 3.1415926536
#define VST(v) sort(v.begin(),v.end())
#define fori(i,n) for(;i<n;i++)
#define fast ios_base::sync_with_stdio(0);cin.tie(0)
#define MP make_pair
int dx[]= {0,0,1,-1};
int dy[]= {1,-1,0,0};
typedef long long int ll;
typedef unsigned long long int ull;
using namespace std;
vector<ll>V,V2,V3;
vector<ll> :: iterator it1,it2;
void CLEAR(){
    V.clear();
    V2.clear();
    V3.clear();
}
int main()
{
    ///freopen("1input.txt","r",stdin);
    int tcase=1;
    //sf(tcase);
    for(int test=1;test<=tcase;test++)
    {

       int a,ma=0,cnt=0,x,pre;
       sf(a);
       sf(x);
       pre=x;
       for(int i=1;i<a;i++){
         int x;
         sf(x);
         if(x<=pre){
            cnt++;
            pre=x;
         }
         else{
            cnt=0;
            pre=x;
         }
         ma=max(cnt,ma);
       }
       printf("%d\n",ma);
    }
///*****************************  ALHAMDULILLAH  *****************************/
}



Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#define MOD 1000000007
using namespace std;
inline void add(int &x,int a)
{
	x+=a;
	if(x>=MOD)x-=MOD;
}
struct Mat{
	int a[7][7],n;
	Mat operator * (const Mat &b)const 
	{
		Mat ret;
		memset(ret.a,0,sizeof(ret.a));
		ret.n=n;
		for(int k=1;k<=n;++k)
			for(int i=1;i<=n;++i)
				for(int j=1;j<=n;++j)
					add(ret.a[i][j],(long long)a[i][k]*b.a[k][j]%MOD);
		return ret;
	}
};
long long k;
int n,m,mp[1005][1005],bcnt;
char s[1005];
bool hor[1005],ver[1005];
inline int ksm(int x,long long k)
{
	int ret=1;
	while(k){
		if(k&1)ret=(long long)ret*x%MOD;
		x=(long long)x*x%MOD;
		k>>=1;
	}
	return ret;
}
inline Mat ksm(Mat x,long long k)
{
	Mat ret;
	ret.n=x.n;
	memset(ret.a,0,sizeof(ret.a));
	for(int i=1;i<=ret.n;++i)ret.a[i][i]=1;
	while(k){
		if(k&1)ret=ret*x;
		x=x*x;
		k>>=1;
	}
	return ret;
}
int main()
{
	scanf("%d%d%lld",&n,&m,&k);
	int horcnt=0,vercnt=0;
	for(int i=1;i<=n;++i){
		scanf("%s",s+1);
		for(int j=1;j<=m;++j){
			mp[i][j]=(s[j]=='#');
			bcnt+=mp[i][j];
		}
		hor[i]=(mp[i][1]&&mp[i][m]);
		horcnt+=hor[i];
	}
	for(int i=1;i<=m;++i)
		ver[i]=(mp[1][i]&&mp[n][i]),vercnt+=ver[i];	
	if(vercnt && horcnt || k<=1){puts("1");return 0;}
	else if(!(vercnt || horcnt)){printf("%d\n",ksm(bcnt,k-1));}
	else{
		int val=vercnt+horcnt;
		Mat x;
		x.n=2;
		int adj=0;
		if(horcnt){
			for(int i=1;i<=n;++i)
				for(int j=1;j<m;++j)
					if(mp[i][j] && mp[i][j+1])++adj;
		}else{
			for(int j=1;j<=m;++j)
				for(int i=1;i<n;++i)
					if(mp[i+1][j] && mp[i][j])++adj;
		}
		memset(x.a,0,sizeof(x.a));
		x.a[1][1]=bcnt,x.a[1][2]=adj;
		x.a[2][1]=0,x.a[2][2]=val;
		Mat ans=ksm(x,k-1);
		cout<<(ans.a[1][1]-ans.a[1][2]+MOD)%MOD<<endl;
	}
	return 0;
}

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

int main(){
  int N, M, X, A[100], left, right;
  left = 0;
  right = 0;
  std::cin >> N >> M >> X;
  for (int i = 0; i < M; i++) {
    std::cin >> A[i];
    if (A[i] < X) {
      left += 1;
    }
    else {
      right += 1;
    }
  }
  std::cout << std::min(left, right) << std::endl;
}

Measured memory_bytes: 3628
#include <stdio.h>

#define RANKS 13
#define CARDS 5

int scanCards(int a[]){
	return scanf("%d,%d,%d,%d,%d",a, a+1, a+2, a+3, a+4);
}

int isStraight(int a[]){
	for (int i=0; i<=10; i++){
		int flg = 1;
		for (int j=0; j<5; j++){
			if (a[i+j] != 1){
				flg=0;
				break;
			}
		}
		if (flg) return 1;
	}
	return 0;
}


int main(void){
	int rank[CARDS];
	int count[RANKS+1]; // count[13] = count[0]
	int pair, trio, quod;
	
	while (scanCards(rank) != EOF){
		pair = trio = quod = 0;
		for (int i=0; i<RANKS; i++) count[i] = 0;
		for (int i=0; i<CARDS; i++) count[rank[i]-1]++;
		count[RANKS] = count[0];
		for (int i=0; i<RANKS; i++){
			if (count[i]==2) pair++;
			if (count[i]==3) trio++;
			if (count[i]==4) quod++;
		}
		
		if (quod==1) puts("four card");
		else if (pair==1 && trio==1) puts("full house");
		else if (isStraight(count)) puts("straight");
		else if (trio==1) puts("three card");
		else if (pair==2) puts("two pair");
		else if (pair==1) puts("one pair");
		else puts("null");
	}
	
	return 0;
}

Measured memory_bytes: 1008
program ABC087B
    implicit none
    integer(8)::i,j,k
    integer(8)::A,B,C,X
    integer(8)::result=0
    read(5,*)A,B,C,X

    do i=0,A
        do j=0,B
            do k=0,C
                if(i*500+j*100+k*50==X)then
                    result=result+1
                end if
            end do
        end do
    end do
    print'(i0)',result
end program ABC087B

Measured memory_bytes: 256
s=input()
t=input()

if s==t:
    print("No")
else:
    flg=(len(s)<len(t))
    for a in s:
        if not(a in t):
            flg=False
            break
    if flg:
        print("Yes")
    else:
        flg=False
        for a in s:
            for b in t:
                if ord(a)<ord(b):
                    flg=True
                    break
            if flg:
                break
        if flg:
            print("Yes")
        else:
            print("No")

Measured memory_bytes: 9132
//author : 'Amit Singh Sansoya @amit3200'
//it was all meant to happen as i was all talk!
#include<bits/stdc++.h>
using namespace std;
string xs,ys;
vector<vector<int>> dp;
void dfs(int x,int y){
	for(int i=1;i<=x;i++){
		for(int j=1;j<=y;j++){
			if(xs[i-1]==ys[j-1]){
				dp[i][j]=dp[i-1][j-1]+1;
			}
			else{
				dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
			}
		}
	}
}
string lcs_formed(int x,int y){
	string temp="";
	int i=x,j=y;
	while(i>0 && j>0){
		if(xs[i-1]==ys[j-1]){
			temp=xs[i-1]+temp;
			i--;
			j--;
		}
		else if(dp[i-1][j]>=dp[i][j-1]){
			i--;
		}
		else{
			j--;
		}
	}
	return temp;
}
int main(){
	cin>>xs>>ys;
	dp.resize(xs.size()+1,vector<int>(ys.size()+1,0));
	dfs(xs.size(),ys.size());
//	cout<<dp[xs.size()][ys.size()]<<"\n";
//	for(int i=1;i<=xs.size();i++){
//		for(int j=1;j<=ys.size();j++){
//			cout<<dp[i][j]<<" ";
//		}
//		cout<<"\n";
//	}
	cout<<lcs_formed(xs.size(),ys.size());
}

//zabtaxaqer
//zbtxar

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

namespace AtCoder
{
	public class Program
	{

		static void Main(string[] args)
		{
			int N = int.Parse(Console.ReadLine());
			int[] V = Console.ReadLine().Split().Select(p => int.Parse(p)).ToArray();
			int[] C = Console.ReadLine().Split().Select(p => int.Parse(p)).ToArray();
			int sum = 0;
			for (int i = 0; i < N; i++) {
				if (V[i] > C[i]) {
					sum += V[i] - C[i];
				}
			}
			Console.WriteLine(sum);
		}
	}
}


Measured memory_bytes: 13268
using System;
using System.Linq;
using System.Collections.Generic;
using System.IO;

public class Program{
    public static void Main(){
        TextReader reader;
        string filename = "";

        if(filename.Count()==0) reader = Console.In;
        else reader = new StreamReader(filename);
        /*
        0-1???????????¶????????????
        ???????????§?????????
        */
        var input = reader.ReadLine().Split().Select(int.Parse).ToArray();
        var N = input[0];
        var M = input[1];
        var Products_Weights = new int[N];
        var Products_Values = new int[N];
        var dp = new int[N+1, M+1];
        // dp[i, j]: i???????????§??????????????\???????????????j???????????¨???????????§?????????
        for(int i=0; i<N+1; i++) dp[i, 0] = 0;
        for(int j=0; j<M+1; j++) dp[0, j] = 0;
        //???????????????????????????
        for(int i=0; i<N; i++){
            var info = reader.ReadLine().Split().Select(int.Parse).ToArray();
            Products_Values[i] = info[0];
            Products_Weights[i] = info[1];
        }

        //?????????????????????dp??????????????????????????????
        /*
        dp[i, j] = i????????????????????\?????????, i????????????????????\??????
        ??? dp[i-1, j], dp[i-1, j-Weights[i]]+Values[i]
        */
        for(int i=1; i<dp.GetLength(0); i++){
            for(int j=0; j<dp.GetLength(1); j++){
                //?????§??????M????¶?????????????????????????
                //????????§???j???????????§??????j?????§??\?????????????????§i???????????????????????????j????????§????????¨??????????????\???????????¨?????§?????????
                if(j>=Products_Weights[i-1]){
                    dp[i, j] = Math.Max(dp[i-1, j], dp[i-1, j-Products_Weights[i-1]]+Products_Values[i-1]);
                }else{
                    dp[i, j] = dp[i-1, j];
                }
            }
        }
        Console.WriteLine(dp[N, M]);
    }
}

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

#define MAX 10000
#define INF (1<<20)
#define WHITE 0
#define GRAY 1
#define BLACK 2

int n;
vector<pair<int,int> > adj[MAX];

void dijkstra(int s){
    priority_queue<pair<int,int> > PQ;
    int d[MAX], color[MAX];

    rep(i,n){
        color[i] = WHITE;
        d[i] = INF;
    }

    d[s] = 0;
    PQ.push(make_pair(0, s));

    while(!PQ.empty()){
        pair<int,int> f = PQ.top(); PQ.pop();
        int u = f.second;
        color[u] = BLACK;

        //if(d[u] < f.first * (-1)) continue;

        for(int i = 0; i < adj[u].size(); i++){
            int v = adj[u][i].first;
            int c = adj[u][i].second;
            if(color[v] == BLACK) continue;
            if(d[v] > d[u] + c){
                d[v] = d[u] + c;
                PQ.push(make_pair((-1)*d[v], v));
            }
        }
    }

    for(int i = 0; i < n; i++){
        cout << i << " " << d[i] << endl;
    }
}

int main(){
    cin >> n;
    int u, k, v, c;
    rep(i,n){
        cin >> u >> k;
        rep(j,k){
            cin >> v >> c;
            adj[u].push_back(make_pair(v, c)); 
        }
    }

    dijkstra(0);

    return 0;
}


Measured memory_bytes: 8004
import sys
input=sys.stdin.readline
f=lambda:map(int,input().split())
n,m=f()
g=[[] for _ in range(n)]
for _ in range(m):
  a,b=f()
  g[a-1].append(b-1)
  g[b-1].append(a-1)
d=[-1]*n
from collections import deque
q=deque([0])
d[0]=0
while q:
  p=q.popleft()
  for c in g[p]:
    if d[c]<0:
      d[c]=p
      q.append(c)
if -1 in d: print('No')
else:
  print('Yes')
  for i in range(1,n): print(d[i]+1)

Measured memory_bytes: 34044
n = int(input())
ms = list(map(int, input().split()))
iter_ms = iter(ms) 
r = 1
if 0 in ms:
  r = 0
else:
    for i in range(n):
        x = next(iter_ms)
        r *= x
        if r > 10 ** 18:
            r = -1
            break
        
print(r)

Measured memory_bytes: 21736
#include<stdio.h>

int main(void)
{
        char s[100];
        char r = 'R';
        char u = 'U';
        char l = 'L';
        char d = 'D';
        int flag = 1;
        int i;

        scanf("%s", s);

        for(i = 0; i < 100; i++){
                if((i + 1) % 2 == 1){
                        if(s[i] == 'L'){
                                flag = 0;
                        }
                }else{
                        if(s[i] == 'R'){
                                flag = 0;
                        }
                }
        }

        if(flag == 1){
                printf("Yes\n");
        }else{
                printf("No\n");
        }

        return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
bool check(int x,int a,int b)
{
	int num_sum=0;
	while(x)
	{
		int r = x%10;
		num_sum+=r;
		x/=10;
	}
	bool ans = false;
	if(num_sum>=a && num_sum<=b)
		ans = true;
	else
		ans = false;
	return ans;
}
int main()
{
	int n,a,b;
	cin>>n>>a>>b;
	int sum=0;
	for(int i=1;i<=n;i++)
	{
		if(check(i,a,b))
			sum+=i;
	}
	cout<<sum<<"\n";
}

Measured memory_bytes: 256
#include <stdio.h>

int main ( void )
{
	int a;
	int b;
	
	scanf ( "%d%d", &a, &b );
	
	if ( a < b ) {
		printf ( "a < b\n" );
	} else if ( b < a ) {
		printf ( "a > b\n" );
	} else {
		printf ( "a == b\n" );
	}
	
	return 0;
}

Measured memory_bytes: 580
n = gets.to_i
red = Array.new(n) { gets.split.map(&:to_i) }.sort_by { |_, y| -y }
blue = Array.new(n) { gets.split.map(&:to_i) }.sort
count = 0

blue.each do |x, y|
  if (e = red.find { |u, v| u <= x && v <= y })
    red.delete(e)
    count += 1
  end
end

puts count

Measured memory_bytes: 14336
n = int(input())
h = list(map(int, input().split()))
#高さ。0~n-1でアクセス

#足場Nにたどり着くまでの最小コストを格納。アクセスは[N-1]
dp = [float("inf")] * n

dp[0] = 0
dp[1] = abs(h[0] - h[1])

import sys
sys.setrecursionlimit(10000000)
#足場x（0～n-1）にたどり着くまでの最小コストを返す関数。
def getdp(x):
    global dp #これでいいのか？
    if dp[x] != float("inf"): return dp[x] #0,1の場合と、既に求めた場合は値を返す
    dp[x] = min(getdp(x-2) + abs(h[x]-h[x-2]), getdp(x-1) + abs(h[x]-h[x-1]))
    #2つ左から飛ぶか1つ左から飛ぶかの最小値がxのdp。
    return(dp[x])

print(getdp(n-1))


Measured memory_bytes: 51328
import numpy as np
N, M = map(int, input().split())
mat = np.zeros((M,N))
for i in range(M):
    slist = list(map(int, input().split()))
    for j in slist[1:]:
        mat[i,j-1] = 1
plist = list(map(int, input().split()))
mat = np.append(mat, np.array([plist]).T, axis=1)

def power_set(N):
    p_sets = [[]]
    item = [i for i in range(N)]
    for i in item:
        temp = []
        for j in p_sets:
            temp += [ j+[i] ]
        p_sets += temp
    return p_sets

ret = 0
for swi in power_set(N):
    tm_mat = mat[:,swi+[N]]
    if sum([(np.sum(i) % 2) == 0 for i in tm_mat]) == M:
        ret += 1
print(ret)

Measured memory_bytes: 12432
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
#define rep(i,n) for (ll i=0;i<n;++i)
#define rep2(i,a,b) for (ll i=a;i<b;++i)
const ll MOD=1000000007;
const ll INF=1e9;
const ll IINF=1e18;
const double EPS=1e-8;
const double pi=acos(-1);

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

int main(){
    int a,b;
    cin >> a >> b;
    if (a>9||b>9) cout << -1 << endl;
    else cout << a*b << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    double i,n,c=0;
    double ans=0;
    cin>>n;
    for(i=1; i<=n; i=i+2)
    {
        c++;
    }

ans=c/n;
//cout<<ans<<endl;
printf("%.10lf\n",ans);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <iostream>
#include <numeric>
#include <math.h>
#define ll  long long
#define ull unsigned long
#define mpa make_pair
#define pb push_back
#define ff first
#define pii pair<ll,ll>
#define dd double
#define trace(x) cerr << #x << " : " << x << endl
#define ss second
#define boost ios_base::sync_with_stdio(0)
#define forp(i,a,b) for(ll i=a;i<=b;i++)
#define rep(i,n)    for(ll i=0;i<n;++i)
#define ren(i,n)    for(ll i=n-1;i>=0;i--)
#define forn(i,a,b) for(ll i=a;i>=b;i--)
#define all(c) (c).begin(),(c).end()
#define tr(c,i) for(typeof((c).begin()) i = (c).begin(); i != (c).end();
#define sc(x) scanf("%lld",&x)
#define clr(x,val) memset(x,val,sizeof(x))
#define pr(x) printf("%lld\n",x) 
#define gc getchar
#define pdd pair<dd,dd>
#define prec(x) cout<<fixed<<setprecision(x)
using namespace std;
ll a[1000005];
ll n,k;
ll sol(ll x){
	ll len=0;
	for(ll i=1;i<=n;i++){
		if(len%2==0 && a[i]<=x)len++;
		else if(len%2)len++;
	}
	if(len>=k)return 1;
	len=0;
	for(ll i=1;i<=n;i++){
		if(len%2 && a[i]<=x)len++;
		else if(len%2==0) len++;
	}
	return(len>=k);
}
int main(){
	
    
    char ch;
    cin>>ch;
    if(ch>='A' && ch<='Z')cout<<"A";
    else cout<<"a";
}
    


	
	
    



Measured memory_bytes: 3592
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define all(x) x.begin(),x.end()
#define dbg(x) cout<<#x<<":"<<x<<endl
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<ll,P> PP;

int main(){
  ll k;
  cin>>k;
  vector<ll> a(k);
  for(int i=0;i<k;i++){
    cin>>a[i];
  }

  reverse(all(a));
  if(a[0]!=2){
    cout<<-1<<endl;
    return 0;
  }
  
  int f=0;
  ll mi=2;
  ll ma=2;
  for(int i=0;i<k;i++){
    if(a[i]>=mi*2)f=1;
    ll ni=(mi/a[i])*a[i];
    if(ni<mi)ni+=a[i];
    mi=ni;
  }
  for(int i=0;i<k;i++){
    ma-=ma%a[i];
    ll na=(ma/a[i])*a[i];
    na+=a[i]-1;
    ma=na;
  }
  
  reverse(all(a));
  ll m=mi;
  for(int i=0;i<k;i++){
    m-=m%a[i];
  }
  
  if(f||m!=2){
    cout<<-1<<endl;
    return 0;
  }
  
  cout<<mi<<" "<<ma<<endl;
  
  return 0;
}


Measured memory_bytes: 1024
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.ListIterator;
import java.util.Map.Entry;


import java.util.PriorityQueue;
import java.util.Random;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.TreeSet;


public class Main {
	
	public static void main(String[] args) throws IOException {	
		try(final Scanner sc = new Scanner(System.in)){
			final int X = sc.nextInt();
			final int Y = sc.nextInt();
			
			boolean ok = false;
			for(int kame = 0; kame <= 100; kame++) {
				for(int turu = 0; turu <= 100; turu++) {
					if(kame + turu != X) { continue; }
					if(kame * 4 + turu * 2 != Y) { continue; }
					
					ok = true;
				}
			}
			
			System.out.println(ok ? "Yes" : "No");
		}
	}

	public static class Scanner implements Closeable {
		private BufferedReader br;
		private StringTokenizer tok;

		public Scanner(InputStream is) throws IOException {
			br = new BufferedReader(new InputStreamReader(is));
		}

		private void getLine() throws IOException {
			while(!hasNext()){
				tok = new StringTokenizer(br.readLine());
			}
		}

		private boolean hasNext() {
			return tok != null && tok.hasMoreTokens();
		}

		public String next() throws IOException {
			getLine();
			return tok.nextToken();
		}

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

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

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

		public int[] nextIntArray(int n) throws IOException {
			final int[] ret = new int[n];
			for(int i = 0; i < n; i++){
				ret[i] = this.nextInt();
			}
			return ret;
		}

		public long[] nextLongArray(int n) throws IOException {
			final long[] ret = new long[n];
			for(int i = 0; i < n; i++){
				ret[i] = this.nextLong();
			}
			return ret;
		}

		public void close() throws IOException {
			br.close();
		}
	}
}


Measured memory_bytes: 32828
#include <bits/stdc++.h>
using namespace std;
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef pair<int, int> Pint;
typedef pair<int64_t, int64_t> Pll;

int main() {
    int N, sum = 0, res = 1000;
    cin >> N;
    for (int i = 0; i < N; i++){
        int a;
        cin >> a;
        sum += a;
        if (a % 10 != 0) {
            res = min(res, a);
        }
    }
    if (sum % 10 != 0) {
        cout << sum << endl;
    }
    else {
        if (res % 10 != 0) {
            cout << sum - res << endl;
        }
        else {
            cout << 0 << endl;
        }
    }
}


Measured memory_bytes: 256
import java.util.*;
import java.lang.*;
import java.math.*;

public class Main {
	Scanner sc = new Scanner(System.in);
	void run(){
		int[] dp = new int[51];
		Arrays.fill(dp, Integer.MAX_VALUE - 3000);
		dp[0] = 0;
		int price[] ={380,550,850,380*4,(int)(550*4*0.85 + 0.4),(int)(850*3*0.88 + 0.4)} ;
		int weigh[] ={  2,  3,  5, 10,12,15} ;
		for(int i = 0;i < 6;i++){
			for(int j=0;weigh[i]+j < 51;j++){
				dp[j+weigh[i]] = Math.min(dp[j] + price[i],dp[j+weigh[i]]);
			}
		}
		for(;;){
			int n = sc.nextInt()/100;
			if(n==0) break;
			System.out.println(dp[n]);
		}
	}
	public static void main(String[] args){
		Main m = new Main();
		m.run();
	}
}

Measured memory_bytes: 0
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>

using namespace std;

struct edge {
    int to, cost;
    edge() {}
    edge(int to_, int cost_): to(to_), cost(cost_) {}
};

struct state {
    int pos, cost;
    state (){}
    state (int pos_, int cost_): pos(pos_), cost(cost_) {}

    bool operator < (const state& o) const {
        return cost > o.cost;
    }
};

constexpr int INF = 1 << 29;

int C, M, N, S, D;

const int W = 100;
vector<edge> graph[1100];

int min_cost[1100];

bool solve() {
    cin >> C >> N >> M >> S >> D;
    if (C+N+M+S+D == 0) { return false; }
    --S; --D;

    for (int j = 0; j < 1100; ++j) {
        graph[j] = vector<edge>();
    }
    fill(min_cost, min_cost+1100, INF);
    min_cost[S] = 0;


    for (int j = 0; j < M; ++j) {
        int a, b, f; cin >> a >> b >> f;
        --a; --b;
        for (int j = 0; j < C; ++j) {
            graph[a+j*W].emplace_back(b+j*W, f);
            graph[b+j*W].emplace_back(a+j*W, f);

            graph[a+j*W].emplace_back(b+(j+1)*W, f/2);
            graph[b+j*W].emplace_back(a+(j+1)*W, f/2);
        }
        graph[a+C*W].emplace_back(b+C*W, f);
        graph[b+C*W].emplace_back(a+C*W, f);
    }

    priority_queue<state, vector<state>> que;
    que.emplace(S, 0);

    while (!que.empty()) {
        state st = que.top(); que.pop();
        int pos = st.pos;
        int cost = st.cost;
        if (cost > min_cost[st.pos]) { continue; }

        for (edge& e : graph[pos]) {
            int next_cost = cost + e.cost;
            if (next_cost < min_cost[e.to]) {
                min_cost[e.to] = next_cost;
                que.emplace(e.to, next_cost);
            }
        }
    }

    int ans = INF;
    for (int j = 0; j <= C; ++j) {
        ans = min(ans, min_cost[D+j*W]);
    }
    cout << ans << endl;

    return true;
}

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

Measured memory_bytes: 3224
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        String[] lines = getStdin();
        
        String[] input = lines[0].split(" ");
        int a = Integer.parseInt(input[0]);
        int b = Integer.parseInt(input[1]);
        int c = Integer.parseInt(input[2]);
        
        System.out.println(Math.min(c,b/a));
    }
    
    private static String[] getStdin() {
        Scanner scanner = new Scanner(System.in);
        ArrayList<String> lines = new ArrayList<>();
        while (scanner.hasNext()) {
            lines.add(scanner.nextLine());
        }
        return lines.toArray(new String[lines.size()]);
    }
}

Measured memory_bytes: 21972
#include <stdio.h>
#include <stdlib.h>

int main(){
  int n;
  int a[200001];
  int b[200001] = {};
  scanf("%d",&n);
  int i;
  for(i=1;i<=n;i++){
    scanf("%d",&a[i]);
    if(i > n/2){
      b[i] = a[i];
    }
  }
  int j;
  for(i=n/2;i>=1;i--){
    for(j=2;j*i<=n;j++){
      b[i] += b[j*i];
    }
    b[i] += a[i];
    b[i] = b[i] % 2;
  }
  int m=0;
  for(i=1;i<=n;i++){
    m += b[i];
  }
  printf("%d\n",m);
  for(i=1;i<=n;i++){
    if(b[i] == 1){
      printf("%d ",i);
    }
  }
  return 0;
}

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

using namespace std;
typedef long long ll;
#define rep(i, s, e) for (int(i) = (s); (i) <= (e); ++(i))
#define all(x) x.begin(),x.end()


int main()
{
	int k, x; cin >> k >> x;
	rep(i, x - (k - 1), x + (k - 1))cout << i << " ";
	cout << "" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
char M[1001][1001];
int M1[1002][1002];
int abc[3][1002][1002]={0};
int f[1002][1002]={0};
int main(void){
	int m,n;
	int z;
	int x,y,x1,y1;
	int i,j,k,l;
	int cnt;
	cin>>m>>n;
	cin>>z;
	for(i=0;i<m;i++){
		for(j=0;j<n;j++){
			cin>>M[i][j];
		}
	}
	//マップの置換え
	for(i=0;i<m;i++){
		for(j=0;j<n;j++){
			if(M[i][j]=='J'){
				M1[i+2][j+2]=0;
			} 
			else if(M[i][j]=='O'){
				M1[i+2][j+2]=1;
			}
			else{
				M1[i+2][j+2]=2;
			}
		}
	}
	//for(i=1;i<=m+1;i++){	for(j=1;j<=n+1;j++)cout<<M1[i][j];	cout<<endl;}
	
	for(k=0;k<3;k++){
		for(i=2;i<=m+1;i++){
			cnt=0;
			for(j=2;j<=n+1;j++){
				//cout<<"K="<<k<<" "<<"I="<<i<<" "<<"J="<<j<<" "<<M1[i][j]<<endl;
				if(k==0&&M1[i][j]==0)	cnt++;
				else if(k==1&&M1[i][j]==1)	cnt++;
				else if(k==2&&M1[i][j]==2)	cnt++;
				abc[k][i][j]=cnt;
			}
		}
	}
	/*for(k=0;k<3;k++){
		for(i=1;i<=m+1;i++){
			for(j=1;j<=n+1;j++){
				cout<<abc[k][i][j];
			}
			cout<<endl;
		}
		cout<<endl;
	}*/
	
	for(k=0;k<3;k++){
		for(j=2;j<=n+1;j++){
			f[2][j]=abc[k][2][j];
		}
		for(j=2;j<=n+1;j++){
			for(i=3;i<=m+1;i++){
				f[i][j]=abc[k][i][j]+f[i-1][j];
			}
		}
		/*for(i=1;i<=m+1;i++){
			for(j=1;j<=n+1;j++){
				cout<<f[i][j];
			}
			cout<<endl;
		}*/
		for(i=1;i<=m+1;i++){
			for(j=1;j<=n+1;j++){
				abc[k][i][j]=f[i][j];
			}
		}
		/*for(i=1;i<=m+1;i++){
			for(j=1;j<=n+1;j++){
				cout<<abc[k][i][j];
			}
			cout<<endl;
		}
		cout<<endl;*/
	}
	int xx,a,b,c,d,q,o;
	int ans[3];
	for(l=0;l<z;l++){
		cin>>y>>x>>y1>>x1;
		for(k=0;k<3;k++){
			xx=abc[k][y1+1][x1+1];
			o=abc[k][y][x1+1];
			q=abc[k][y1+1][x];
			c=abc[k][y][x];
			b=o-c;
			d=q-c;
			//cout<<"XX="<<xx<<" "<<"O="<<o<<" "<<"Q="<<q<<" ";
			//cout<<"C="<<c<<" "<<"B="<<b<<" "<<"D="<<d<<endl;
			a=xx-b-c-d;
			//cout<<"A="<<a<<endl;
			ans[k]=a;
		}
		cout<<ans[0];
		for(k=1;k<3;k++){
			cout<<" "<<ans[k];
		}
		cout<<endl;
	}
	return 0;
}


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

using namespace std;
typedef long long ll;

int main() {
	string s;
	string t;
	cin >> s >> t;
	int ans = 0;
	if(s[0]==t[0]) ans++;
	if(s[1]==t[1]) ans++;
	if(s[2]==t[2]) ans++;
	cout << ans << endl;
}

Measured memory_bytes: 256