akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
//C++ as C#
#define var auto
#define Max std::max
#define Min std::min

#ifdef _MSC_VER
#define getchar_unlocked getchar
#define putchar_unlocked putchar
#define fseek_unlocked fseek
#endif

inline uint32_t read()
{
	uint32_t x = 0;
	int k;
	while (true)
	{
		k = getchar_unlocked();
		if (k < '0') break;
		x = x * 10 + k - '0';
	}
	return x;
}

void writeline(uint32_t x) {
	int s = 0;
	char f[8];
	while (x) {
		f[s++] = x % 10;
		x /= 10;
	}
	while (s--)
		putchar_unlocked(f[s] + '0');
	putchar_unlocked('\n');
}

int rowMax[2000];
int columnAccum[2000];
int main()
{
	int h = read(), w = read();
	int max = 0;
	for (size_t i = 0; i < h; i++)
	{
		int currentChain = 0;
		for (size_t j = 0; j < w; j++)
		{
			if (getchar_unlocked() & 1) 
			{
				max = Max(max, columnAccum[j] + rowMax[j]);
				if (currentChain)
					for (size_t k = j - currentChain; k < j; k++)
						rowMax[k] = Max(rowMax[k], currentChain);
				currentChain = 0;
				rowMax[j] = 0;
				columnAccum[j] = 0;
			}
			else
			{
				currentChain++;
				columnAccum[j]++;
			}
		}
		if (currentChain)
			for (size_t j = w - currentChain; j < w; j++)
				rowMax[j] = Max(rowMax[j], currentChain);
		getchar_unlocked();
	}
	for (size_t i = 0; i < w; i++)
		max = Max(max, columnAccum[i] + rowMax[i]);
	writeline(max - 1);
	return 0;
}


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


def main():
    n, m = map(int, input().split())
    x = list(map(int, input().split()))
    y = list(map(int, input().split()))
    
    X = [x[i+1]-x[i] for i in range(n-1)]
    Y = [y[i+1]-y[i] for i in range(m-1)]
    
    mod = pow(10, 9)+7
    for i in range(n-1):
        X[i] = X[i]*(n-i-1)*(i+1)%mod
    
    sum_x = sum(X)%mod
    
    ans = 0
    for j in range(m-1):
        ans += sum_x*Y[j]*(m-j-1)*(j+1)%mod
        ans %= mod
    
    print(ans)
    
    
    
if __name__ == "__main__":
    main()


Measured memory_bytes: 102784
#include <iostream>
#include <math.h>

using namespace std;
int N;

int main()
{
	int N0, N1, N2, min;

	while( 1 )
	{
		cin >> N;
		if(N==0) break;

		N0 = N * N * N;
		min = 2000000000;
		for(int n=1; n<N; n++)
		{
			N1 = N0 - n * n * n;
			int b = floor(pow((double)N1, 1.0 / 3.0));
			N2 = N1 - b * b * b;
			if(min > N2)
				min = N2;
		}
		printf("%d\n", min);
	}
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#include <math.h>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n,t,t_med1,t_med2;
  vector<int> nums;
  vector<int> t_nums;

  cin >> n;
  for(int i = 0;i < n;i++){
    cin >> t;
    nums.push_back(t);
  }
  t_nums = nums;
  sort(t_nums.begin(),t_nums.end());
  t_med1 = t_nums[t_nums.size()/2-1];
  t_med2 = t_nums[t_nums.size()/2];
  for(int i = 0;i < n;i++){
    if(nums[i] <= t_med1){
      cout << t_med2 << endl;
    }
    else{
      cout << t_med1 << endl;
    }
  }
  return 0;
}


Measured memory_bytes: 3956
n = int(input())
d = list(map(int, input().split()))
mod = 998244353

a = [0] * n
for d_ in d:
    a[d_] += 1

res = d[0] == 0 and a[0] == 1
pre = 1
for a_ in a:
    res = res * pre ** a_ % mod
    pre = a_

print(res)

Measured memory_bytes: 14396
// 01ナップザック問題 http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DPL_1_B&lang=jp
/* 入力例
4 5
4 2
5 2
2 1
8 3
// →出力　13
*/
#include <bits/stdc++.h>
using namespace std;
int main(void) {
    int N, W;
    cin >> N >> W;
    long long int v[N], w[N], dp[N][W + 1];
    for(int i = 0; i < N; i++) {
        cin >> w[i] >> v[i];
    }
    for(int i = 0; i < N; i++) {
        for(int j = 0; j <= W; j++) {
            if(i == 0) {
                if(j >= w[i])
                    dp[i][j] = v[i];
                else
                    dp[i][j] = 0;
            } else {
                if(j >= w[i])
                    dp[i][j] = max(dp[i - 1][j], dp[i - 1][j - w[i]] + v[i]);
                else
                    dp[i][j] = dp[i - 1][j];
            }
        }
    }
    cout << dp[N - 1][W] << endl;
    return 0;
}


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

#define REP(i,n) for(int i=0; i < (n); ++i)
#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)

using ll = long long;
#define INF 1e9

int N, M, Q;
vector<int> L, R, p, q;
vector<vector<int>> dp;
int main(){
  cin >> N >> M >> Q;
  L.resize(M), R.resize(M), p.resize(Q), q.resize(Q);
  vector<vector<int>> sum(N+1, vector<int>(N+1, 0));

  REP(i, M){
    cin >> L[i] >> R[i];
    sum[L[i]][R[i]]++;
  }  
  REP(i, Q){
    cin >> p[i] >> q[i];
  }
  REP(i, N+1){
    REP(j, N){
      sum[i][j+1] += sum[i][j];
    }
  }
  REP(i, Q){
    int ans = 0;
    FOR(j, p[i], q[i]+1){
      ans += sum[j][q[i]] - sum[j][p[i]-1];
    }
    cout << ans << endl;
  }
  return 0;
}


Measured memory_bytes: 4224
#include <bits/stdc++.h>
using ll = long long;
#define FOR(i, k, n) for(ll i = (k); i < (n); i++)
#define FORe(i, k, n) for(ll i = (k); i <= (n); i++)
#define FORr(i, k, n) for(ll i = (k)-1; i > (n); i--)
#define FORre(i, k, n) for(ll i = (k)-1; i >= (n); i--)
#define REP(i, n) FOR(i, 0, n)
#define REPr(i, n) FORre(i, n, 0)
#define ALL(x) (x).begin(), (x).end()
#define ALLr(x) (x).rbegin(), (x).rend()
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
using namespace std;

const int INF = 1001001001;

int main(void){
  ll x;
  cin >> x;
  REP(i, 1001){
    ll b = pow(i, 5) - x;
    if(b == 0){
      printf("%lld %lld\n", i, 0ll);
      return 0;
    }
    if(b > 0){
      for(ll j = 1; j*j*j*j*j <= b; j++){
        if(j*j*j*j*j == b){
          printf("%lld %lld\n", i, j);
          return 0;
        }
      }
    }
    if(b < 0){
      for(ll j = -1; j*j*j*j*j >= b; j--){
        if(j*j*j*j*j == b){
          printf("%lld %lld\n", i, j);
          return 0;
        }
      }
    }
  }
  return 0;
}

Measured memory_bytes: 4168
#include <iostream>
#include <cmath>
#include <algorithm>
#include <cstdlib>
#include <complex>
using namespace std;
int main(void){
  int a,b,c,d;
  cin >> a >> b >> c >> d;
  
  if(abs(a - c) <= d)
    cout << "Yes" << endl;
  else if
    (abs(a - b) <= d && abs(b - c) <= d)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  
  return 0;
}


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

typedef long long ll;

using namespace std;

int main(){
	int N, W;
	cin >> N >> W;
	vector<vector<ll>> items(N, {0, 0});
	for(int i =0 ; i < N; i++){
		cin >> items[i][0] >> items[i][1];
	}

	vector<ll> dp(W+1, 0);
	for(int i =0; i<N; i++){
		ll weight = items[i][0];
		ll value = items[i][1];
		for(ll w = W; w >= 0; w--){
			if (w - weight >= 0) {
				dp[w] = max(dp[w], dp[w-weight] + value);
			}
		}
	}

	cout << dp[W] << endl;

	return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>
#include <stdlib.h>
#define MAX 2000001
#define VMAX 10000

int main(){
  unsigned short *A, *B;
  int C[VMAX+1];
  int n, i, j;

  scanf("%d", &n);

  A = malloc(sizeof(short)*n+1);
  B = malloc(sizeof(short)*n+1);

  /* your code */
  for(i=0;i<=VMAX;i++)
    {
      C[i]=0;
    }

  for(i=0;i<n;i++)
    {
      scanf("%d",&A[i+1]);
      C[A[i+1]]++;
    }

  for(i=1;i<=VMAX;i++)
    {
      C[i]=C[i]+C[i-1];
    }

  for(j=1;j<=n;j++)
    {
      B[C[A[j]]]=A[j];
      C[A[j]]--;
    }

  for(i=1;i<=n;i++)
    {
      if(i>1) printf(" ");
      printf("%d",B[i]);
    }
  printf("\n");


  return 0;
}



Measured memory_bytes: 9656
c = []
for i in range(3):
    tmp = list(map(int, input().split()))
    c.append(tmp)

flag = True
abs_a = []
for i in range(3):
    abs_a.append(abs(c[0][i] - c[1][i]))
    abs_a.append(abs(c[1][i] - c[2][i]))
    abs_a.append(abs(c[0][i] - c[2][i]))
    
if abs_a[0] == abs_a[3] and abs_a[0] == abs_a[6]:
    pass
else:
    flag = False

if abs_a[1] == abs_a[4] and abs_a[1] == abs_a[7]:
    pass
else:
    flag = False

if abs_a[2] == abs_a[5] and abs_a[2] == abs_a[8]:
    pass
else:
    flag = False

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

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

typedef long long ll;

inline ll read()
{
    ll x=0,f=1;char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}

#define maxn 100100
ll a[maxn],b[maxn];
ll ans,cur;
int n;

int main()
{
	n=read();
	for(int i=1;i<=n;i++)
		a[i]=read();
	for(int i=1;i<=n;i++)
		b[i]=read();
	priority_queue<ll,vector<ll>,greater<ll> > q;
	for(int i=1;i<=n;i++)
	{
		cur+=b[i]-a[i];
		if (cur>0)
		{
			q.push(0);
			q.push(0);
		}
		else
		{
			q.push(cur);
			q.push(cur);
		}
		ans+=cur-q.top();q.pop();
	}
	while (!q.empty() && q.top()<=cur)
	{
		ans+=cur-q.top();
		q.pop();
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 2936
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define o(a) cout << a << endl
#define int long long
#define fi first
#define se second
using namespace std;
typedef pair<int, int> P;

const int MAX_N = 200010;
int prime[MAX_N];
bool is_prime[MAX_N + 1];
void sieve(int n){
    int p = 0;
    for(int i = 0; i <= n; i++) is_prime[i] = true;
    is_prime[0] = is_prime[1] = false;
    for(int i = 2; i <= n; i++){
        if(is_prime[i]){
            prime[p++] = i;
            for(int j = 2*i; j <= n; j += i) is_prime[j] = false;
        }
    }
}

signed main(){
    int n, p;
    sieve(MAX_N);
    while(1){
        cin >> n >> p;
        if(n + p == -2) break;
        int id = -1;
        rep(i, 0, MAX_N) if(prime[i] > n){ id = i; break;}
        vector<int> d;
        rep(i, 0, 100) rep(j, i, 100) d.push_back(prime[id + i] + prime[id + j]);
        sort(all(d));
        cout << d[p - 1] << endl;
    }
}

Measured memory_bytes: 3532
#include<bits/stdc++.h>
#define int long long
//#include<ext/pb_ds/assoc_container.hpp>
using namespace std;
//using namespace __gnu_pbds;
const int inf=0x3f3f3f3f;
const long long inf2=0x3f3f3f3f3f3f3f3f;
const double eps=1e-6;
const int mod=1000000007;
typedef long long ll;
#define SZ 100005
int n;
struct thing{
	int a,b;
	int dif;
	void input(){
		scanf("%lld%lld",&a,&b);
		dif=a+b;
	}
};
bool operator<(thing a,thing b){
	return a.dif!=b.dif?a.dif>b.dif:a.a>b.a;
}
multiset<thing>th;
signed main(){
	scanf("%lld",&n);
	for(int i=0;i<n;i++){
		thing t;
		t.input();
		th.insert(t);
	}
	cerr<<"ok init\n";
	int ans=0;
	for(int i=0;i<n;i++){
		if(i&1){
			ans-=(*th.begin()).b;
		}else{
			ans+=(*th.begin()).a;
		}
		th.erase(th.begin());
	}
	cout<<ans<<endl;
	return 0;
}
/////////////

Measured memory_bytes: 6528
#73 素因数分解

import math
n = int(input())

a = n
ans = []
i = 2
while i <= math.sqrt(n):
    if n % i == 0:
        n = n //i
        ans.append(str(i))
    else:
        i += 1
if n != 1:
    ans.append(str(n))
print(str(a) + ":" + " " + " ".join(ans))


Measured memory_bytes: 5664
#include <cstdio>
#include <iostream>
#include <string>
#include <sstream>
#include <stack>
#include <algorithm>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>
#include <tuple>
#include <assert.h>
#include <deque>
#include <bitset>
#include <iomanip>
#include <limits>
#include <chrono>
#include <random>
#include <array>
#include <unordered_map>
#include <functional>
#include <complex>
#include <numeric>
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

constexpr long long MAX = 5100000;
constexpr long long INF = 1LL << 60;
constexpr int inf = 1 << 28;
//constexpr long long mod = 1000000007LL;
//constexpr long long mod = 998244353LL;

using namespace std;
typedef unsigned long long ull;
typedef long long ll;


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

	int kkt = 1;
	while (kkt--) {
		string s, t; cin >> s >> t;
		queue<char> ss, tt;
		for (int i = 0; i < s.size(); i++) ss.push(s[i]);
		for (int i = 0; i < t.size(); i++) tt.push(t[i]);
		bool ok = false;
		{
			queue<char> sq = ss, tq = tt;

			bool flag = true;
			for (int i = 0; i < s.size(); i++) {
				bool check = false;
				if (i % 2 == 0) {
					while (!sq.empty()) {
						if (sq.front() == s[i]) {
							check = true;
							sq.pop();
							break;
						}
						sq.pop();
					}
				}
				else {
					while (!tq.empty()) {
						if (tq.front() == s[i]) {
							check = true;
							tq.pop();
							break;
						}
						tq.pop();
					}
				}
				if (!check) flag = false;
			}
			if (flag) ok = true;
		}
		{
			queue<char> sq = ss, tq = tt;

			bool flag = true;
			for (int i = 0; i < s.size(); i++) {
				bool check = false;
				if (i % 2 == 1) {
					while (!sq.empty()) {
						if (sq.front() == s[i]) {
							check = true;
							sq.pop();
							break;
						}
						sq.pop();
					}
				}
				else {
					while (!tq.empty()) {
						if (tq.front() == s[i]) {
							check = true;
							tq.pop();
							break;
						}
						tq.pop();
					}
				}
				if (!check) flag = false;
			}
			if (flag) ok = true;
		}
		if (ok) puts("Yes");
		else puts("No");
	}
	return 0;

}



Measured memory_bytes: 3244
#include<iostream>
#include<stdlib.h>
#include<vector>
#include<algorithm>
#include<stdio.h>
#include<string>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<limits.h>
#include<cmath>
#include<queue>
#include<stack>
#define rep(i,n) for(ll i = 0; i < (ll)n; i++)
#define swap(a,b) a^=b;b^=a;a^=b;
#define chmax(a,b) {if(a < b) a = b;}
#define chmin(a,b) {if(a > b) a = b;}
using namespace std;
typedef long long ll;
ll gcd(ll, ll);
vector<bool> to_binary(int);
int sum(vector<int>);
int min(vector<int>);
int max(vector<int>);
ll nCr(ll n, ll r);

const ll INF = 1LL << 60;

typedef tuple<ll, ll> mtupl;

bool mycomp(mtupl x, mtupl y) {
	return get<1>(x) < get<1>(y);
}

vector<vector<ll>> memo;

ll get(int x, int y) {
	if (memo[x][y] != -1)
		return memo[x][y];

	if (x == 0) return 1;
	if (y < x) return 0;

	memo[x][y] = get(x, y - 1) + get(x - 1, y - 1);
	return memo[x][y];
}

ll mpow(ll a, ll b) {
	ll ans = 1;
	for (ll i = 0; i < b; i++) {
		ans *= a;
		ans %= 1000000007;
	}
	return ans;
}

ll nCr(ll n, ll r) {
	ll res = 1;
	for (int i = 0; i < r; i++) {
		res *= (n - i);
	}
	for (int i = 1; i <= r; i++) {
		res /= i;
	}
	return res;
}

int vsum(vector<int> v) {
	int res = 0;
	for (auto it = v.begin(); it != v.end(); it++)
		res += *it;
	return res;
}
int vmin(vector<int> v) {
	int min = INT32_MAX;
	for (auto it = v.begin(); it != v.end(); it++)
		min = std::min(min, *it);
	return min;
}
int vmax(vector<int> v) {
	int max = INT32_MIN;
	for (auto it = v.begin(); it != v.end(); it++)
		max = std::max(max, *it);
	return max;
}

ll gcd(ll A, ll B) {
	if (A == 0 || B == 0) return max(A, B);
	int r = A % B;
	while (r != 0) {
		A = B;
		B = r;
		r = A % B;
	}
	return B;
}

ll _gcd(ll A, ll B) {
	return (B == 0) ? A : gcd(A % B, B);
}

vector<bool> to_binary(int x) {
	vector<bool> res;
	while (x != 0) {
		res.push_back(x % 2);
		x /= 2;
	}
	return res;
}

template<int index>
bool comp(tuple<ll, ll, ll, ll> a, tuple<ll, ll, ll, ll> b) {
	return get<index>(a) < get<index>(b);
}

int vector_finder(std::vector<ll> vec, ll number) {
	auto itr = std::find(vec.begin(), vec.end(), number);
	size_t index = std::distance(vec.begin(), itr);
	if (index != vec.size()) { // 発見できたとき
		return index;
	}
	else { // 発見できなかったとき
		return 0;
	}
}


int len(int x) {
	return (int)log10(x) + 1;
}

int same_vec(vector<int> a, vector<int> b) {
	int res = 1, num = a.size();
	for (int i = 0; i < num; i++) {
		if (a[i] != b[i]) {
			res = 0;
			break;
		}
	}
	return res;
}


ll fibs[100] = { 0 };
ll fib(int n) {
	if (fibs[n] == 0) {
		return fibs[n] = fib(n - 1) + fib(n - 2);
	}
	return fibs[n];
}



int main(void) {
	cin.tie(0);
	ios::sync_with_stdio(false);
	//Program Start	

	int A, B;
	cin >> A >> B;
	if (A <= 9 && B <= 9) {
		cout << A * B << endl;
	}
	else {
		cout << -1 << endl;
	}

ProgramEndPointLabel:;

	//Program End
#ifndef DEBUG
	system("pause");
#endif // !DEBUG


	return 0;
}




Measured memory_bytes: 504
S=input()
ans=0
opsize=len(S)-1
for i in range(2**opsize):
    ins=[""]*opsize
    for j in range(opsize):
        if((i>>j)&1):
            ins[j]="+"
    tmp=""
    ins+=[""]
    for k,p in zip(S,ins):
        tmp+=(k+p)
    ans+=eval(tmp)
print(ans)

Measured memory_bytes: 3064
#include "iostream"
#include "cstdlib"
using namespace std;

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



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

#define int long long
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define REP(i, n) for (int i = 0; i < n; ++i)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x) cout << #x << " = " << (x) << endl;
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define SP << " " <<

typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;
typedef vector<int> vec;
typedef vector<P> pvec;
typedef vector<vector<int>> vvec;
typedef vector<vector<P>> pvvec;
typedef priority_queue<int> PQI;
typedef priority_queue<P> PQP;
typedef priority_queue<int,vector<int>,greater<int>> PQIG;
typedef priority_queue<P,vector<P>,greater<P>> PQPG;

const vector<int> DX = {0, -1, 0, 1, 1, 1, -1, -1};
const vector<int> DY = {1, 0, -1, 0, 1, -1, 1, -1};
constexpr int MOD = (1000000007);
// const int MOD = (998244353);
// const int INF = (1 << 30); // 1073741824
const ll INF = (1LL << 60); // 1152921504606846976
const double PI = (3.141592653589794);
const double EPS = (0.0000000001); // 10^(-10)

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return 1;} return 0;}
template<class T> inline T ceil(T a, T b) {return T((a + b - 1) / b);}
template<class T> inline T round(T a, T b) {return T(a / b);}
template< typename T1, typename T2 > istream &operator>>(istream &is, pair< T1, T2 > &p) { is >> p.first >> p.second; return is; }
template <class T> inline void out(T &a) { bool flag=true; for(auto&x:a){if(flag) {flag=false;} else{ cout << ' '; } cout<<x; } cout << endl; }



//----------------------------------------------------------------
int nmax=200000; // 2*(10^5)
vvec G(nmax);





void solve4ts()
{
  
  
  
  int x;
  cin>>x;
  if(x>=30){
    cout<<"Yes";
  }
  else{
    cout<<"No";
  }
  
}
//-----------------------------------------------------------------

signed main(){ ios::sync_with_stdio(false); cin.tie(0); cout << fixed << setprecision(15);
    int repeat = 1;
    // cin >> repeat;
    while(repeat--) solve4ts();
}

/*

g++ -std=c++1z code.cpp
./a.out

*/

Measured memory_bytes: 7812
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <array>
#include <set>
#include <map>
#include <cmath>
#include <complex>
#include <algorithm>
#include <numeric>
#include <utility>
#include <tuple>
#include <bitset>
#include <cstdint>
#include <cassert>
#include <random>
#include <iterator>

using namespace std;
using i64 = int64_t;
using i32 = int32_t;

const i64 mod = 1e9 + 7;
i64 ipow(i64 a, i64 b) {
    i64 x = a, y = 1;
    for (; b > 0; b >>= 1) {
        if (b & 1) (y *= x) %= mod;
        (x *= x) %= mod;
    }
    return y;
}
i64 inv(i64 x) {
    return ipow(x, mod - 2);
}
i64 fact(i64 x) {
    static vector<i64> f;
    i64 i = f.size();
    if (x >= i) {
        f.resize(x + 1);
        for (; i <= x; ++i) {
            f[i] = i == 0 ? 1 : i * f[i - 1] % mod;
        }
    }
    return f[x];
}
i64 perm(i64 n, i64 k) {
    return k <= n ? fact(n) * inv(fact(n - k)) % mod : 0;
}
i64 conb(i64 n, i64 k) {
    return k <= n ? fact(n) * inv(fact(k) * fact(n - k) % mod) % mod : 0;
}

i64 dp[102][2][5];
string s;
int k, n;
i64 f(int i, bool b, int c) {
    if (c == 0) return 1;
    if (i == n) return 0;
    if (dp[i][b][c] > 0) return dp[i][b][c];
    int d = s[i] - '0';
    i64 res = 0;
    if (b) {
        if (d == 0) {
            res = f(i + 1, true, c);
        } else {
            res = f(i + 1, true, c - 1) + (d - 1) * f(i + 1, false, c - 1) + f(i + 1, false, c);
        }
    } else {
        res = 9 * f(i + 1, false, c - 1) + f(i + 1, false, c);
    }
    return dp[i][b][c] = res;
}

int main() {
    /*
    i64 r1, c1, r2, c2;
    cin >> r1 >> c1 >> r2 >> c2;
    */
    cin >> s >> k;
    n = s.size();
    i64 ans = f(0, true, k);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
N, M = map(int, input().split())
a = [list(map(int, input().split())) for _ in range(M)]

ans = [None] * N

for i in a:
    if ans[i[0]-1] is None:
        ans[i[0]-1] = i[1]
    elif ans[i[0]-1] != i[1]:
        print(-1)
        exit()
        
if N == 1:
    if ans[0] is None:
        print(0)
    else:
        print(ans[0])
    exit()

if ans[0] == 0:
    print(-1)
    exit()

for i, v in enumerate(ans):
    if v is None:
        ans[i] = 0

if ans[0] == 0:
    ans[0] = 1

print(''.join(list(map(str,ans))))



Measured memory_bytes: 3064
#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<cstring>
#include<string>
using namespace std;
map<int,int> mp;
int main(){
	int n;
	cin>>n;
	while(n--){
		int x;
		cin>>x;
		if(mp[x])return puts("NO"),0;
		mp[x]=1;
	}
	puts("YES");
}


Measured memory_bytes: 9600
# -*- coding: utf-8 -*-

cities, roads = map(int, input().split())
connections = []
for i in range(roads):
    x, y = map(int, input().split())
    connections.append((x, y))

road_count = {}
for i in range(cities):
    road_count[i] = 0

for (x, y) in connections:
    # print("{}, {}".format(x, y))
    road_count[x - 1] += 1
    road_count[y - 1] += 1

# print(road_count)

for i in road_count.values():
    print(i)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,A;
  cin >> N >> A;
 
  if (A > 498) {
    cout << "Yes" << endl;
  }
  
  else {
    if (N % 500 > A){
      cout << "No" << endl;
    }
    else {
      cout << "Yes" << endl;
    }
  }
}

Measured memory_bytes: 256
package main

import "fmt"

func main() {

	var N int
	fmt.Scan(&N)

	var flag int = 0

	S := make([]int, N)

	for i:= 0 ; i < N ; i++ {
		fmt.Scan(&S[i])
		if S[i] != i + 1 {
			flag++
		}
		if flag > 2 {
			break
		}
	}

	if flag == 0 || flag == 2 {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}

}



Measured memory_bytes: 512
#include "bits/stdc++.h"
 
#define REP(i,n) for(ll i=0;i<n;++i)
#define RREP(i,n) for(ll i=n-1;i>=0;--i)
#define FOR(i,m,n) for(ll i=m;i<n;++i)
#define RFOR(i,m,n) for(ll i=n-1;i>=m;--i)
#define ALL(v) (v).begin(),(v).end()
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());
#define DUMP(v) REP(aa, (v).size()) { cout << v[aa]; if (aa != v.size() - 1)cout << " "; else cout << endl; }
#define INF 1000000001ll
#define MOD 1000000007ll
#define EPS 1e-9
 
const int dx[8] = { 1,1,0,-1,-1,-1,0,1 };
const int dy[8] = { 0,1,1,1,0,-1,-1,-1 };
 
 
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
ll max(ll a, int b) { return max(a, ll(b)); }
ll max(int a, ll b) { return max(ll(a), b); }
ll min(ll a, int b) { return min(a, ll(b)); }
ll min(int a, ll b) { return min(ll(a), b); }
///(´・ω・`)(´・ω・`)(´・ω・`)(´・ω・`)(´・ω・`)(´・ω・`)///
 
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int h, w, n;
	cin >> h >> w >> n;
	vi v(n);
 
	REP(i, n)cin >> v[i];
	int k = 0;
	REP(i, h) {
		if (i % 2 == 0) {
			REP(j, w) {
				cout << k+1;
				v[k]--;
				if (v[k] == 0)k++;
				if (j == w - 1)cout << endl;
				else cout << " ";
			}
		}
		else {
			stack<int> st;
			REP(j, w) {
				st.push(k + 1);
				v[k]--;
				if (v[k] == 0)k++;
			}
			REP(j, w) {
				cout << st.top();
				st.pop();
				if (j == w - 1)cout << endl;
				else cout << " ";
			}
		}
	}
 
}

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

using namespace std;

typedef long long lo;
typedef pair< lo,lo > PII;

#define fi first
#define int long long
#define se second
#define mp make_pair
#define pb push_back
#define fio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define FOR for(int i=1;i<=n;i++)
#define mid ((start+end)/2)
#define ort ((bas+son)/2)

const lo MAX = -1000000000000000000;
const lo MIN = 1000000000000000000;
const lo inf = 1000000000000000000;
const lo KOK = 100000;
const lo LOG = 30;
const lo li = 405;
const lo mod = 1000000007;

int n,m,b[li],a[li],flag,t,PS[li],dp[li][li];
int cev;
string s;
vector<int> v;

inline int f(int l,int r){
	int cevv=inf;
	if(r-l<2)return 0;
	if(~dp[l][r])return dp[l][r];
	//~ if(l==r-1)return 0;
	//~ cout<<l<<r<<endl;
	int cev1=0;
	for(int i=l;i<r;i++){
		cev1+=a[i];
	}
	for(int i=l+1;i<r;i++){
		cevv=min(cevv,f(l,i)+f(i,r));
	}
	return dp[l][r]=cevv+cev1;
}

main(void){
	memset(dp,-1,sizeof(dp));
	scanf("%lld",&n);
	FOR{
		scanf("%lld",&a[i]);
		PS[i]=PS[i-1]+a[i];
	}
	
	printf("%lld\n",f(1,n+1));
	return 0;
}



Measured memory_bytes: 1536
#include <vector>
#include <iostream>
#include <cmath>

using namespace std;
using ll = long long;
const double 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 rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
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<vector<T>>& v) {
    REP(i,v.size()){if(i)os<<endl;os<<v[i];}return os;}


int main() {

    int N;

    cin>>N;

    int i = 0,p[N],max = 0,sum = 0;
    while(i < N)
    {
        cin >> p[i];
        if(max < p[i]){
            max = p[i];
        }
        sum = sum + p[i];
        i++;
    }

    cout<<sum-max/2<<endl;

}

Measured memory_bytes: 256
import java.util.*;

class Main{

    void solve(){
        Scanner sc = new Scanner(System.in);

        long INF = Long.MAX_VALUE;

        while(true){
            long a = sc.nextLong();
            long b = sc.nextLong();
            long d = sc.nextLong();
            if(a==0 && b==0 && d==0) break;

            long minx = INF, miny = INF;
            for(long i=-100000; i<=100000; i++){
                long num = d - a * i;
                num = Math.max(num, -num);
                if(num%b==0){
                    long x = Math.max(i, -i);
                    long y = num/b;
                    if(minx==INF || x+y<minx+miny){
                        minx = x;
                        miny = y;
                    }else if(x+y==minx+miny){
                        if(a*x+b*y<a*minx+b*miny){
                            minx = x;
                            miny = y;
                        }
                    }
                }
            }

            System.out.println(minx+" "+miny);
        }
    }

    public static void main(String[] args){
        new Main().solve();
    }
}

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

using namespace std;
#define rep(i, n) for (int i = 0; i < (n); ++i)
typedef long long ll;
int INF = INT_MAX / 2;

int main() {

    int n, m, l;
    cin >> n >> m >> l;
    vector<vector<int>> dist(n, vector<int>(n, INF));
    rep(i, n) dist[i][i] = 0;
    rep(i, m) {
        int a, b, c;
        cin >> a >> b >> c;
        a--;
        b--;
        dist[b][a] = dist[a][b] = c;
    }

    rep(k, n) rep(i, n) rep(j, n) {
                dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
            }
    vector<vector<int>> dist2(n, vector<int>(n, INF));
    rep(i, n) dist[i][i] = 0;


    rep(i, n) rep(j, n) {
            if (dist[i][j] <= l) {
                dist2[i][j] = 1;
            }
        }
    rep(k, n) rep(i, n) rep(j, n) {
                dist2[i][j] = min(dist2[i][j], dist2[i][k] + dist2[k][j]);
            }

    int q;
    cin >> q;

    rep(i, q) {
        int s, t;
        cin >> s >> t;
        s--;
        t--;
        int dis = dist2[s][t] - 1;
        if (dist2[s][t] == INF) dis = -1;
        cout << dis << endl;

    }


}


Measured memory_bytes: 1280
#include <cstdio>
#include <algorithm>
#include <cstring>

int n;
char s[111];

int main(void)
{
	char x;
	int i,j;
	int t,w;
	int answer = 1000000000;

	//freopen("x.in","r",stdin);

	scanf("%s",s);
	n = strlen(s);
	for(x = 'a';x <= 'z';++x)
	{
		w = -1;
		t = 0;
		for(i = n - 1;i >= 0;--i)
			if(s[i] == x)
				w = std::max(w,t),t = 0;
			else
				++t;
		w = std::max(w,t);
		answer = std::min(answer,w);
	}
	printf("%d\n",answer);

	return 0;
}

Measured memory_bytes: 128
$n = gets().chomp!.to_i

small = []
$n.times { 
	x,y = gets().split.map{ |p|
		p.to_i
	}
	small <<[x,y]
}
big = []
$n.times { 
	x,y = gets().split.map{ |p|
		p.to_i
	}
	big <<[x,y]
}

$G = Array.new(2* $n)
0.upto(2* $n-1) do |i|
	$G[i] = []
end
# $G.each { |e| 
# 	e = 6  
# }
0.upto($n-1) do |i|
	0.upto($n-1) do |j|
		if small[i][0] < big[j][0] and  small[i][1] < big[j][1] then
			$G[i] << j+$n
			$G[j+$n] <<  i
		end
	end
end

$match = Array.new(2*$n, -1)
$used = Array.new(2*$n)

# p $G

# 増加パスをDFSでさがす
def dfs(v)
#	p v
#	p $used
	$used[v] = true
	$G[v].each do |jj|
		u = jj
		w = $match[u]
		if (w<0 || (!$used[w] && dfs(w)) )   then
			$match[v] = u
			$match[u] = v
#			puts "pair: #{u}, #{v}"
			return true
		end
	end
	return false
end

def bipa_match()
	res = 0

	$match.each do |pp|
		pp = -1
	end
	0.upto(2*$n-1) do |v|
		if $match[v] < 0 then
			# $used.each do |pp|
			# 	pp = false
			# end
			0.upto(2*$n - 1) do |kk|
				$used[kk] = false
			end
			if dfs(v) then
				res+=1
#				p $match
			end
		end
	end
return res

end

puts bipa_match()


Measured memory_bytes: 1916
// In the name of God

#include <bits/stdc++.h>

using namespace std;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	int n;
	cin >> n;

	cout << (1000 - (n % 1000)) % 1000;

	return 0;
}


Measured memory_bytes: 3652
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define ft first
#define sd second
#define fr(i,n) for(int i=0;i<(n);++i)
#define Fr(i,n) for(int i=1;i<=(n);++i)
#define ifr(i,n) for(int i=(n)-1;i>=0;--i)
#define iFr(i,n) for(int i=(n);i>0;--i)

struct modint{
    ll a;
    const ll MOD=1e9+7;
    modint(ll a_=0){
        a=((a_%MOD)+MOD)%MOD;
    }
    modint inv()const{
        ll n=1,m=MOD-2,A=a;
        while(m){
            if(m&1)(n*=A)%=MOD;
            (A*=A)%=MOD;
            m>>=1;
        }
        modint y(n);
        return y;
    }
    bool operator==(const modint& x){
        return a==x.a;
    }
    bool operator!=(const modint& x){
        return a!=x.a;
    }
    modint& operator=(const modint& x){
        a=x.a;
        return *this;
    }
    modint operator+(const modint& x){
        modint y(a+x.a);
        return y;
    }
    modint operator-(const modint& x){
        modint y(a-x.a);
        return y;
    }
    modint operator*(const modint& x){
        modint y(a*x.a);
        return y;
    }
    modint operator/(const modint& x){
        return *this * x.inv();
    }
    modint& operator+=(const modint& x){
        *this=*this+x;
        return *this;
    }
    modint& operator-=(const modint& x){
        *this=*this-x;
        return *this;
    }
    modint& operator*=(const modint& x){
        *this=*this*x;
        return *this;
    }
    modint& operator/=(const modint& x){
        *this=*this/x;
        return *this;
    }
};
istream& operator>>(istream &in,modint& x){
    ll a_;
    in>>a_;
    modint y(a_);
    x=y;
    return in;
}
ostream& operator<<(ostream &out,const modint& x){
    out<<x.a;
    return out;
}
modint pwr(ll a,ll b){
    modint n(1),A(a);
    while(b){
        if(b&1) n*=A;
        A*=A;
        b>>=1;
    }
    return n;
}

vector<modint> fc;
modint fct(ll x) {
    if(fc.empty()) fc.resize(200010);
    if(x==0) return 1;
    if(fc[x]==0) fc[x]=fct(x - 1)*x;
    return fc[x];
}

vector<modint> ifc;
modint ifct(ll x) {
    if(ifc.empty()) ifc.resize(200010);
    if(x==200010-1) return ifc[x]=fct(x).inv();
    if(ifc[x] == 0) ifc[x]=ifct(x+1)*(x+1);
    return ifc[x];
}

modint comb(ll n, ll r) {
    if (n < 0 || r < 0 || n < r) return 0;
    return fct(n)*ifct(r)*ifct(n-r);
}

class DBlueAndRedBalls {
public:
    void solve(istream& in, ostream& out) {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        int k,n;
        in>>n>>k;
        Fr(i,k) out<<comb(k-1,i-1)*comb(n-k+1,i)<<endl;
    }
};

int main() {
    DBlueAndRedBalls solver;
    std::istream& in(std::cin);
    std::ostream& out(std::cout);
    solver.solve(in, out);
    return 0;
}


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

int main() {
  int h, w;
  cin >> h >> w;
  vector<string> s(h);
  for (int i = 0; i < h; i++) {
    cin >> s[i];
  }

  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      if (s[i][j] == '.') {
        int cnt = 0;
        for (int k = -1; k <= 1; k++) {
          for (int l = -1; l <= 1; l++) {
            if (i + k >= 0 && i + k < h && j + l >= 0 && j + l < w) {
              if (s[i+k][j+l] == '#') {
                cnt++;
              }
            }
          }
        }
        s[i].replace(j, 1, to_string(cnt));
      }
    }
  }

  for (int i = 0; i < h; i++) {
    cout << s[i] << endl;
  }

  return 0;
}

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

int a[5], k;

int main()
{
    int ind = 0, m = 10;
    for (int i = 0; i < 5; i++)
    {
        cin >> a[i];
        if (a[i] % 10 != 0)
        {
            if (m > a[i] % 10)
                ind = i, m = a[i] % 10;
        }
    }
    int ans = 0;
    for (int i = 0; i < 5; i++)
    {
        if (i == ind)
            ans += a[i];
        else
        {
            if (a[i] % 10 == 0)
                ans += a[i];
            else
                ans += a[i] + 10 - a[i] % 10;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
/*
 A0056
 Factorial II
*/
#include <stdio.h>

main()
{	long n;
	long sum;

	while(EOF != scanf("%ld",&n) && n > 0)
	{	sum = 0L;
                do{
			sum += (n /= 5);}
		while(n > 0);
		printf("%ld\n",sum);
	}
return(0);
}

Measured memory_bytes: 0
s=input()
a=s[:2]
b=s[2:]

if int(a) >= 1 and int(a) <= 12 and int(b) >= 1 and int(b) <= 12:
    print("AMBIGUOUS")
elif int(a) >= 1 and int(a) > 12 and int(b) >= 1 and int(b) <= 12:
  print("YYMM")
elif int(a) >= 1 and int(a) <= 12 and int(b) >= 1 and  int(b) > 12:
  print("MMYY")
elif a == "00" and int(b) >= 1 and int(b) <= 12:
  print("YYMM")
elif int(a) >= 1 and int(a) <= 12 and b == "00":
  print("MMYY")
else:
    print("NA")


Measured memory_bytes: 3064
#define _USE_MATH_DEFINES
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <string>
#include <vector>
#include <utility>
#include <complex>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>
#include <tuple>
#include <bitset>
#include <limits>
#include <algorithm>
#include <array>
#include <random>
#include <complex>
#include <regex>
#include <iomanip>
using namespace std;
typedef long double ld;
typedef long long ll;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define fcout cout << fixed << setprecision(10)
#define rep(i,n)    for(int i=0; i<(int)n; i++)
#define mp(a,b) make_pair(a,b)
#define pb push_back
#define all(x) x.begin(), x.end()
#define F first
#define S second
const ll inf = 1e18;
const ll mod = 1e9 + 7;

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

// mod. m での a の逆元 a^(-1) を計算する。
ll modinv(ll a, ll m) {
    ll b = m, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

int main(){
    int k;
    string s;
    cin >> k >> s;
    string ans;
    if(s.size() > k){
        ans = s.substr(0, k);
        ans += "...";
    }else{
        ans = s;
    }
    cout << ans << endl;
}



Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define mp make_pair
const ll inf=1e9+2;
int32_t main()
{
	IOS
	ll n,i,j;
	cin>>n;
	vector<ll>v(n),dp(n,inf);
	for(auto &x:v)
		cin>>x;
	dp[0]=0;
	dp[1]=abs(v[1]-v[0]);
	for(i=2;i<n;i++)
	{
		dp[i]=min(dp[i-1]+abs(v[i]-v[i-1]),dp[i-2]+abs(v[i]-v[i-2]));
	}
	cout<<dp[n-1];
}

Measured memory_bytes: 1792
A,B,K=map(int,input().split())
l=[]

for i in range(K):
    if (A<=(A+i))and((A+i)<=B):
        l.append(A+i)
    if (A<=(B-i))and((B-i)<=B):
        l.append(B-i)
l=list(set(l))
l.sort()

for i in range(len(l)):
    print(l[i])

Measured memory_bytes: 38256
#include <bits/stdc++.h>
#define rep(i,n) for (int (i) = 0; (i) < (n); i++)
#define ll long long
using namespace std;
int main() {
  ll N = 0,K,ans = 0;
  cin >> N >> K;
  vector<ll>A(N);
  rep(i,N){
    cin >> A[i];
  }
  rep(i,N){
    if(A[i] >= K){
      ans++;
    }
  }
  cout << ans;
}
  

Measured memory_bytes: 3900
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <memory>
#include <complex>
#include <numeric>
#include <cstdio>
#include <iomanip>
#include <random>

#define REP(i,m,n) for(int i=int(m);i<int(n);i++)
#define RREP(i,m,n) for(int i=int(n)-1;i>=int(m);--i)
#define EACH(i,c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
//#define int long long

#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR 
#endif
using namespace std;

using UI = unsigned int;
using UL = unsigned long;
using LL = long long;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VVLL = vector<VLL>;
using VS = vector<string>;
using PII = pair<int,int>;
using VP = vector<PII>;
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; }



void solve() {
    int x,y;
    cin >> x >> y;
    if ((y - 2 * x) % 2 != 0 || (4 * x - y) % 2 != 0 || (y - 2 * x) < 0 || (4 * x - y) < 0) {
        cout << "No" << endl;
        return;
    }
    cout << "Yes" << endl;
}

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

Measured memory_bytes: 3636
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		long S = Long.parseLong(sc.next());

		int x1 = 0; // x1=0 確定
		int y1 = 0;
		int x2 = 0;
		int y2 = 0; // y2=0 確定
		int x3 = 0;
		int y3 = 0;

		// 平方根求める, ceil(平方根)をy3(高さ)にする
		Double y3d = Math.sqrt((double) S);
		y3 = new Double(Math.ceil(y3d)).intValue();

		// x3はceil(S/y3), x2はx3-1
		// y1 はS%y3、但し余り0のときはy3とする
		x3 = (int) (S / y3);
		y1 = (int) (S % y3);
		if (y1 != 0) {
			x3 += 1;
		} else {
			y1 = y3;
		}
		x2 = x3 - 1;

		// output
		System.out.println(x1 + " " + y1 + " "
				+ x2 + " " + y2 + " "
				+ x3 + " " + y3);

	}

}


Measured memory_bytes: 23892
func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}

func main() {
    let k = Int(readLine()!)!
    let line = readInts()
    let a = line[0]
    let b = line[1]
    
    for i in 1...1000 {
        if a <= i * k && i * k <= b {
            print("OK")
            return
        }
    }
    print("NG")
}

main()


Measured memory_bytes: 8200
#!/usr/bin/env python3
from collections import deque, Counter
from heapq import heappop, heappush
from bisect import bisect_right

def main():
    N, K = map(int, input().split())
    S = input()
    ans = 0# 初期幸福な人数
    for i in range(N-1):
        if S[i] == S[i+1]:
            ans += 1
    M = []# 'RL'の位置を格納
    if S[0] == 'L':
        M.append(1)
        # ans -= 1
    for i in range(1,N-1):
        if S[i:i+2] == 'RL':
            M.append(2)
            # ans -= 2
    if S[N-1] == 'R':
        M.append(1)
        # ans -= 2
    M.sort(reverse=True)
    # print(M,ans)
    print(min(N-1,ans + sum(M[:K])))
    

if __name__ == "__main__":
    main()


Measured memory_bytes: 4212
import java.util.Scanner;

/**
 *
 * @author kke2
 */
public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int math[];
        int temp = 0;
        int j = 0;
        int tempo = 0;
        math = new int[4];
        int n = sc.nextInt();
        math[0] = n / 1000;
        n = n % 1000;
        math[1] = n / 100;
        n = n % 100;
        math[2] = n / 10;
        n = n % 10;
        math[3] = n;
        for (int i = 0; i <= 3; i++) {
            if (i == 0) {
                temp = math[0];
                continue;
            }
            if (temp == math[i]) {
                j++;
            } else {
                temp = math[i];
                tempo = j;
                j = 0;
            }
        }
        if (tempo < j) {
            tempo = j;
        }
        if (tempo >= 2) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}

Measured memory_bytes: 21972
#include <bits/stdc++.h>
using namespace std;
int main() {
    ios::sync_with_stdio(0); 
    cin.tie(0); 
    char turn = 'a';
    string a, b, c;
    int i = 0, j = 0, k = 0;
    cin >> a >> b >> c;
    while (i <= a.size() && j <= b.size() && k <= c.size()) 
    {
        if (turn == 'a') 
            turn = a[i++];
        else if (turn == 'b') 
            turn = b[j++];
        else 
            turn = c[k++];
    }
    if (i > a.size()) cout << "A" << endl;
    else if (j > b.size()) cout << "B" << endl;
    else cout << "C" << endl;
}

Measured memory_bytes: 3660
#include <iostream>
#include <algorithm>
#include <queue>
using namespace std;

long long n, m, j = 1, t = 0;
pair<long long, long long> w[100000];
priority_queue<long long> P;

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

	for (long long i = 0; i < n; i++)
		cin >> w[i].first >> w[i].second;

	sort(w, w + n);

	long long i = 0;

	while (j <= m) {
		while (i < n && w[i].first == j) {
			P.push(w[i].second);
			i++;
		}

		if (!P.empty()) {
			t += P.top();
			P.pop();
		}

		j++;
	}

	cout << t << endl;

	return 0;
}

Measured memory_bytes: 2936
import scala.io.StdIn

object Main extends App {

  val Array(a, b, n) = StdIn.readLine().split(" ").map(_.toLong)
  val x = if (b > 1) n / (b - 1) * (b - 1) else 0
  println(if (x > 0) f(x) else f(n))

  def f(x: Long) = (a * x) / b - a * (x / b)

  def readIntPair: (Int, Int) = {
    val Array(x, y) = StdIn.readLine().split(" ").map(_.toInt)
    (x, y)
  }

  def readIntArr = StdIn.readLine().split(" ").map(_.toInt)
}

Measured memory_bytes: 54752
#include <stdio.h>
int main(int argc, const char *argv[]){
    int a=0;
    int count=0;
    
    while(1){
        count++;
        scanf("%d",&a);
        if(a==0){
            break;
        }
        printf("Case %d: %d\n",count,a);
        }
        return 0;
}

Measured memory_bytes: 600
prsint(x)=parse(Int,x)

function main()
    N=prsint(readline())
    ans=N*(N+1) ÷ 2
    _n=div(N,3)
    ans-=3_n*(_n+1) ÷ 2
    _n=div(N,5)
    ans-=5_n*(_n+1) ÷ 2
    _n=div(N,15)
    ans+=15_n*(_n+1) ÷ 2
    println(ans)

end

main()

Measured memory_bytes: 156648
#include <utility>
#include <vector>
#include <iostream>
#include <algorithm>
#include <functional>
#include <map>
#include <set>
#include <list>
#include <string>
#define REP(i, n) for (int i = 0; i < n; i++)
using namespace std;

typedef long long ll;
typedef pair<ll, ll> Pll;

int main() {
    string b;
    cin >> b;

    string ret;
    if (b == "A") ret = "T";
    if (b == "T") ret = "A";
    if (b == "G") ret = "C";
    if (b == "C") ret = "G";

    cout << ret << endl;
}

void cheatsheet()
{
    // loop
    // vector<int> vec(10);
    vector<int> vecloop;
    REP(i, 10)
    {
        vecloop.push_back(i);
    }

    // swap
    int a = 1;
    int b = 5;
    swap(a, b); // -> a = 5, b = 1

    // sort
    int arr[] = {1, 2, 3, 4, 5, 6, 7, 8, 9};
    sort(arr, arr + 9, greater<int>()); // 9 8 7 6 5 4 3 2 1

    // lower
    vector<int> vec(arr, end(arr));
    sort(vec.begin(), vec.end());
    cout << lower_bound(vec.begin(), vec.end(), 2)[0]; // 2

    // map
    map<Pll, ll> m;
    m[Pll(10, 100)] = 100;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  vector<int> a={1,1,1,2,1,2,1,5,2,2,1,5,1,2,1,14,1,5,1,5,2,2,1,15,2,2,5,4,1,4,1,51};
  int k;
  cin>>k;
  cout<<a.at(k-1)<<endl;
}

Measured memory_bytes: 3604
n,m = map(int, input().split())
switch = []
for i in range(m):
    s = list(map(int, input().split()))
    switch.append(s[1:])

p = list(map(int, input().split()))
ans = 0

def dfs(swi):
    global  ans
    #最後まで決めた
 
    if len(swi) == n:
        flag = True
        for i in range(m):
            cnt = 0
            for pos in switch[i]:
                if swi[pos-1] == "1":
                    cnt += 1
            if cnt % 2 != p[i]:
                flag = False
        if flag == True:
            ans += 1
    else:

        dfs(swi+"1")

        dfs(swi+"0")




dfs("")
print(ans)    


Measured memory_bytes: 3064