akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
#define inf (int)(1e9+7)
#define abs(x) (x >= 0 ? x : -(x))
#define ceil(a, b) a / b + !!(a % b)
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }




const int MAX = 2000005;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}


int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    
    
    /*
    int a, b, c;
    cin >> a >> b >> c;
    */
    
    /*
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    */
    
   
    int n, m;
    cin >> n >> m;
    ll ans = 0;
    
    COMinit();
    
    rep(i, n + 1) { // 1個目を何回使うか
        int x = i * 2;
        int y = i;
        if ((n - x) * 2 != (m - y)) continue;
        
        (ans += COM(i + n - x, i)) %= inf;
    }
    
    cout << ans << endl;
}


Measured memory_bytes: 47232
fn main() {
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).ok();
    let v: Vec<i64> = buf.split_whitespace().map(|x| x.parse().unwrap()).collect();
    println!("{}", ((v[0] - 2) * (v[1] - 2)).abs());
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    ll n,m,i,s=0,x,y;

    cin>>n>>m;

    ll h[n+5];

    map<ll,ll>c,d;

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

    for(i=1;i<=m;i++){

        cin>>x>>y;

        d[x]=1;
        d[y]=1;


        if(h[x]>h[y]){
            c[y]=1;
        }
        else if(h[x]<h[y]){
            c[x]=1;
        }
        else{
            c[x]=1;
            c[y]=1;
        }

    }

    for(i=1;i<=n;i++){

      if(d[i]==0){
        s++;

      }
      else if(c[i]==0){
        s++;
      }
    }

    cout<<s<<endl;
}




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

int main(){
	int a,b,c;
	cin >> a;
	cin >> b;
	cin >> c;
	if (a > c) swap(a, c);
	if (a > b) swap(a, b);
	if (b > c) swap(b, c);
	cout << a << " " << b << " " << c << "\n";
	return 0;
}

Measured memory_bytes: 1164
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, e) for (int i = (int)(s); i <= (int)(e); i++)
#define printYesNo(is_ok) puts(is_ok ? "Yes" : "No");
#define SORT(v) sort(v.begin(), v.end());
#define RSORT(v) sort(v.rbegin(), v.rend());
#define REVERSE(v) reverse(v.begin(), v.end());

template <typename T>
void printlnVector(T v)
{
  rep(i, v.size())
  {
    cout << v[i] << endl;
  }
}

template <typename T>
void printVector(T v)
{
  rep(i, v.size())
  {
    cout << v[i] << " ";
  }
  cout << endl;
}

int main()
{
  int N;
  cin >> N;
  vector<int> a(N);
  rep(i, N)
  {
    cin >> a[i];
  }
  int ans = 0;
  rep(i, N - 1)
  {
    if (a[i] == a[i + 1])
    {
      ans++;
      a[i + 1] = 0;
    }
  }
  cout << ans << endl;
  return 0;
}

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

using namespace std;

struct NODE {
	int now, cost, ticket;
	NODE(int now, int cost, int ticket) : now(now), cost(cost), ticket(ticket) {}
	NODE () {}
};

bool operator < (const NODE &a, const NODE &b)
{
	return a.cost > b.cost;
}

int main(void)
{
	int c, n, m, s, d;
	while (cin >> c >> n >> m >> s >> d, n){
		vector <NODE> edge[150];
		int a, b, f;
		for (int i = 0; i < m; i++){
			cin >> a >> b >> f;
			edge[a].push_back(NODE(b, f, -1));
			edge[b].push_back(NODE(a, f, -1));
		}

		bool visited[150][20] = {};
		priority_queue <NODE> Q;
		Q.push(NODE(s, 0, c));
		while (Q.size()){
			NODE q = Q.top();
			Q.pop();
			if (visited[q.now][q.ticket]) continue;
			visited[q.now][q.ticket] = true;
			if (q.now == d){
				cout << q.cost << endl;
				break;
			}
			for (int i = 0; i < edge[q.now].size(); i++){
				Q.push(NODE(edge[q.now][i].now, q.cost + edge[q.now][i].cost, q.ticket));
				if (q.ticket){
					Q.push(NODE(edge[q.now][i].now, q.cost + (edge[q.now][i].cost / 2), q.ticket - 1));
				}
			}
		}
	}

	return 0;
}

Measured memory_bytes: 1316
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <bitset>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <utility>
#include <set>
#include <map>
#include <tuple> 
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <list>
using namespace  std;
using ll = long long;
using P = pair<ll, ll>;
#define REP(i, n) for(long long (i)=0, i_bound = (long long)(n); (i)<i_bound; ++i)
#define FOR(i, a, b) for(long long (i)=(a); (i)<(b); ++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
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)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
const long long MOD = static_cast<long long>(1e9) + 7LL;
const long long INF = 1234567891234567890LL;
int main(){
    cin.tie(0);
    cout.sync_with_stdio(false);
    ll x, y, a, b, c;
    cin >> x >> y >> a >> b >>c;
    vector<ll> p(a);
    vector<ll> q(b);
    vector<ll> r(c);
    REP(i, a){
        cin >> p[i];
    }
    REP(i, b){
        cin >> q[i];
    }
    REP(i, c){
        cin >> r[i];
    }
    sort(ALL(p));
    sort(ALL(q));
    sort(ALL(r));
    reverse(ALL(p));
    reverse(ALL(q));
    reverse(ALL(r));
    priority_queue<ll, vector<ll>, greater<ll>> pqa;
    priority_queue<ll, vector<ll>, greater<ll>> pqb;
    REP(i, x) pqa.push(p[i]); 
    REP(i, y) pqb.push(q[i]); 
    REP(i, c){
        ll e = pqa.top();
        ll f = pqb.top();
        ll g = r[i];
        if(g <= min(e, f)) break;
        if(g >= e and e <= f) {
            pqa.pop();
            pqa.push(g);
        }
        else if(g >= f and f <= e){
            pqb.pop();
            pqb.push(g);
        }
    }
    ll res = 0;
    while(pqa.size()){
        res += pqa.top();
        //cout << pqa.top() << endl;
        pqa.pop();
    }
    while(pqb.size()){
        res += pqb.top();
        //cout << pqb.top() << endl;
        pqb.pop();
    }

    cout << res << endl;
    return 0;
}

Measured memory_bytes: 4852
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <queue>
#include <map>
#include <bitset>
using namespace std;
typedef long long ll;
const int INF = 1<<30; 
const int MOD = 1e9 + 7;
const int dy[] = {1, 0, -1, 0};
const int dx[] = {0, 1, 0, -1};
ll calc(ll n)
{
    ll cnt = (n + 1) / 2;
    ll res = cnt % 2;
    if(n % 2 == 0) res ^= n;
    return res;
}
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll a, b; cin >> a >> b;
    ll ans = calc(b) ^ calc(a - 1);
    cout << ans << endl;
    return 0;
}



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

int main()
{
    int n,k; cin>>n>>k;
    int arr[n];
    int jump;
    for(int i=0;i<n;i++) cin>>arr[i];
    int dp[n+1]={0};
    dp[0]=0;
    dp[1]= abs(arr[0]-arr[1]);
    for(int i=2;i<n;i++)
    {
        dp[i]=dp[i-1]+abs(arr[i]-arr[i-1]);
        for(int j=i-1,jump=0;j>=0 && jump<k;j--,jump++)
        {
            dp[i]=min(dp[i],dp[j]+abs(arr[j]-arr[i]));
        }
    }
    cout<<dp[n-1];
    //return dp[n-1];
}

Measured memory_bytes: 1024
import java.util.ArrayList;
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		ArrayList<String> x = new ArrayList<String>();

		while(sc.hasNextInt()){
			int a=sc.nextInt();
			int b=sc.nextInt();
			int d=0;
			int r=0;
			double f=0;
			
			d=a/b;
			r=a%b;
			f=(double)a/(double)b;
			
				System.out.print(d+" "+r+" ");
				System.out.printf("%.5f",f);
			}
			
		}
	}


Measured memory_bytes: 26504
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <utility>
#include <string>

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

using namespace std;

typedef long long int lli;
typedef pair<int,int> pii;

int main () {
    int n;
    cin >> n;
    while (n--) {
        string kings;
        cin >> kings;
        string message;
        cin >> message;
        for (int i = kings.size() - 1; i >= 0; i--) {
            if (kings[i] == 'J' && message.size() > 1) {
                message = message.substr(message.size() - 1, 1) + message.substr(0, message.size() - 1);
            }
            if (kings[i] == 'C' && message.size() > 1) {
                message = message.substr(1) + message.substr(0, 1);
            }
            if (kings[i] == 'E') {
                if (message.size() % 2) {
                    message = message.substr((message.size() + 1) / 2) + message[message.size() / 2] + message.substr(0, message.size() / 2);
                } else {
                    message = message.substr((message.size() + 1) / 2) + message.substr(0, message.size() / 2);
                }
            }
            if (kings[i] == 'A') {
                reverse(message.begin(), message.end());
            }
            if (kings[i] == 'P') {
                REP (j, 0, message.size()) {
                    if ('0' <= message[j] && message[j] <= '9') {
                        message[j]--;
                        if (message[j] < '0') message[j] = '9';
                    }
                }
            }
            if (kings[i] == 'M') {
                REP (j, 0, message.size()) {
                    if ('0' <= message[j] && message[j] <= '9') {
                        message[j]++;
                        if (message[j] > '9') message[j] = '0';
                    }
                }
            }
        }
        cout << message << endl;
    }

    return 0;
}

Measured memory_bytes: 3044
import sys
from collections import deque

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

Q, H, S, D = lr()
N = ir()

H = min(Q * 2, H)
S = min(H * 2, S)
if S * 2 <= D:
    print(S * N)
else:
    print((N // 2) * D + (N % 2) * S)


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

int main() {
  int N, x;
  cin >> N >> x;
  vector<int>data(N);
  for(int i=0;i<N;i++){
    cin >> data.at(i);
  }
  sort(data.begin(),data.end());
  int count=0;
  for(int i=0;i<N-1;i++){
    if(x>=data.at(i)){
      count++;
      x-=data.at(i);
    }
  }
  if(x==data.at(N-1)) count++;
  cout << count << endl;
}


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

using namespace std;

struct edge {
	int from, to;
	edge(int from, int to) : from(from), to(to) {}
};
using node = vector<edge>;
using graph = vector<node>;
void addedge(graph& g, int from, int to, bool bidirectional = false) {
	g[from].emplace_back(edge(from, to));
	if (bidirectional) g[to].emplace_back(edge(to, from));
}

class Solution {
public:
	void solve() {
		int n, x, y;
		cin >> n >> x >> y;
		x--, y--;
		cout << "\n";
		graph g(n);
		for (int i = 0; i < n - 1; i++) addedge(g, i, i + 1, true);
		addedge(g, x, y, true);
		vector<int> ans(n);
		for (int i = 0; i < n; i++) {
			queue<int> q;
			q.push(i);
			vector<int> d(n, 0x3f3f3f3f);
			d[i] = 0;
			while (!q.empty()) {
				int u = q.front();
				q.pop();
				for (auto e : g[u]) {
					if (d[e.to] == 0x3f3f3f3f) {
						d[e.to] = d[u] + 1;
						q.push(e.to);
					}
				}
			}
			for (int j = i + 1; j < n; j++) {
				ans[d[j]]++;
			}
		}
		for (int i = 1; i < n; i++) cout << ans[i] << "\n";
		cout << "\n";

		return;
	};
};

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	Solution solution;
	solution.solve();
	return 0;
}

Measured memory_bytes: 384
import java.util.Scanner;

//Course Planning for Lazy Students
public class Main{

	int n, u;
	int[] c, r;
	int ans;
	boolean[] v;
	
	void dfs(int s, int sum, int depth){
		if(u<=sum)ans = depth;
		if(ans<=depth)return;
		for(int i=0;i<n;i++){
			if((s&(1<<i))>0)continue;
			if((r[i]&s)!=r[i])continue;
			int x = s|1<<i;
			if(v[x])continue;
			v[x] = true;
			dfs(x, sum+c[i], depth+1);
		}
	}
	
	void run(){
		Scanner sc = new Scanner(System.in);
		while(true){
			n = sc.nextInt();
			u = sc.nextInt();
			if((n|u)==0)break;
			c = new int[n];
			r = new int[n];
			for(int i=0;i<n;i++){
				c[i] = sc.nextInt();
				int x = 0;
				int k = sc.nextInt();
				for(int j=0;j<k;j++)x|=1<<sc.nextInt();
				r[i] = x;
			}
			ans = n;
			v = new boolean[1<<n];
			for(int i=0;i<n;i++)if(r[i]==0){v[1<<i]=true;dfs(1<<i,c[i],1);}
			System.out.println(ans);
		}
	}
	
	public static void main(String[] args) {
		new Main().run();
	}
}

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

int a, b, c, sum;
vector<int> v;

void f(int x) {
  c = x;
  sum += abs(c - b);
  v.push_back(2 * max({b - max(a, c), min(a, c) - b, 0}));
  a = b; b = c;
}

int main() {
  int N; cin >> N;
  f(0);
  for (int i = 0; i < N; i++) {
    int t; cin >> t;
    f(t);
  }
  f(0);
  for (int i = 0; i < N; i++) {
    cout << sum - v[i+2] << endl;
  }
}

Measured memory_bytes: 1784
#include <iostream>
#include <cmath>
#include <vector>
#include <bitset>
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <climits>
#include <set>
#include <map>
#include <iomanip>
#include <cassert>
#include <functional>
#include <cstring>

using namespace std;

#define mp make_pair
#define FOR(i, a, b) for(int (i)=a;(i)<=(b);++(i))
#define rep(i, n)  FOR(i,0,n-1)
#define FFOR(i, a, b) for(int (i)=a;(i)>(b);--(i))
#define rrep(i,n) FFOR(i,0,n)
#define vsort(v) sort((v).begin(), (v).end());					//小さい順
#define rvsort(v) sort(v.begin(), v.end(),greater<>());		//大きい順
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define all(c) (c).begin(),(c).end()
#define ll long long
#define lb long double
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define vs vector<string>
#define vc vector<char>
#define vvc vector<vector<char>>
#define Print(p) cout<<(p)<<endl
#define F first
#define S second
#define pb push_back
#define ll long long
#define mod 1000000007LL
#define INF 123456789012345
typedef pair<int, int> P;
typedef pair<int, P> PP;

const int maxn =1e5 + 10;

bool isPrime[maxn];
int x[100005];

void calcPrime()
{
	rep(i,maxn) isPrime[i]=true;
	isPrime[0] = false;
	isPrime[1] = false;
	FOR(i,2,maxn-5)if(isPrime[i])
	{
		int cnt = i*2;
		while(cnt < maxn)
		{
			isPrime[cnt] = false;
			cnt+=i;
		}
	}
}

int main() {
	calcPrime();
	int q;cin>>q;
	x[0]=0;
	x[1]=0;
	FOR(i,2,100000)
	{
		if(isPrime[i] && isPrime[(i+1)/2] && i%2) x[i] = x[i-1]+1;
		else x[i] = x[i-1];
	}

	rep(i,q)
	{
		int l,r;cin>>l>>r;
		cout << x[r] - x[l-1] << endl;
	}

	return 0;
}

Measured memory_bytes: 1152
#include "bits/stdc++.h"
using namespace std;

class DisjointSet {
public:
	vector<int> rank, p;

	DisjointSet() {}
	DisjointSet(int size) {
		rank.resize(size, 0);
		p.resize(size, 0);
		for (int i = 0; i < size; i++) makeSet(i);
	}

	void makeSet(int x) {
		p[x] = x;
		rank[x] = 0;
	}

	bool same(int x, int y) {
		return findSet(x) == findSet(y);
	}

	void unite(int x, int y) {
		link(findSet(x), findSet(y));
	}

	void link(int x, int y) {
		if (rank[x] > rank[y]) {
			p[y] = x;
		}
		else {
			p[x] = y;
			if (rank[x] == rank[y]) {
				rank[y]++;
			}
		}
	}

	int findSet(int x) {
		if (x != p[x]) {
			p[x] = findSet(p[x]);
		}
		return p[x];
	}
};

int main() {
	int N, M;
	cin >> N >> M;
	vector<int> p(N);
	for(int i=0; i<N; i++) cin >> p[i];

	DisjointSet ds = DisjointSet(N+1);

	for (int i = 0; i < M; i++) {
		int x, y; cin >> x >> y;
		ds.unite(x,y);
	}

	int ans=0;
	for (int i = 0; i < N; i++) {
		if (ds.same(p[i], i + 1)) {
			ans++;
		}
	}

	cout << ans << endl;
}


Measured memory_bytes: 1408
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <climits>
#include <cmath>
#include <utility>
#include <string>
#include <cstring>
#include <functional>
using namespace std;

const int mo = 1e9 + 7;

int main() {

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

    int n, d;
    string s;
    cin >> s >> d;
	
    n = s.length();
    if (n == 1) {
        int tmp = (s[0] - '0' >= d) ? 1 : 0;
        cout << tmp << endl;
        return 0;
    }

    vector<int> lim(n);
    for (int i = 0; i < n; ++i)
        lim[i] = s[i] - '0';

    vector<vector<int> > f(n, vector<int>(d));
    for (int i = 0; i < lim[0]; ++i)
        ++f[0][i % d];

    int sum = 0;

    for (int i = 0; i < n-1; ++i) {
        for (int j = 0; j < d; ++j)
            if (f[i][j] != 0) {
                for (int t = 0; t < 10; ++t) {
                    int k = (j + t) % d;
                    f[i+1][k] = (f[i+1][k] + f[i][j]) % mo;
                }
            }

        sum = (sum + lim[i]) % d;
        for (int t = 0; t < lim[i+1]; ++t) {
            int k = (sum + t) % d;
            f[i+1][k] = (f[i+1][k] + 1) % mo;
        }
    }

    int res = (f[n-1][0] - 1 + mo) % mo;

    sum = (sum + lim[n-1]) % d;
    if (sum == 0)
        res = (res + 1) % mo;

    cout << res << endl;
	return 0;
}

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

int main()
{
int i;
int A;
int N;
int t;
int x;
int y;
int iT;
int iX;
int iY;

	ios::sync_with_stdio( false );
	cin.tie( 0 );

	cin >> N;

	iT = 0;
	iX = 0;
	iY = 0;
	for( i = 0; i < N; i++ )
	{
		cin >> t;
		cin >> x;
		cin >> y;

		A = abs( x - iX ) + abs( y - iY );
		A -= ( t - iT );
		if( A > 0 ) break;
		if( A % 2 != 0 ) break;

		iT = t;
		iX = x;
		iY = y;
	}

	if( i == N )
		cout << "Yes" << endl;
	else
		cout << "No" << endl;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <iomanip>
#include <stack>
#include <queue>
#include <numeric>
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define mod 1000000007
typedef long long ll;
using namespace std;

int main(){
  string S;
  cin >> S;
  int l = (int)S.size();
  int preans=0;
  for(int i=1;i<l/2;i++){
    int p1=0;
    int p2=i;
    string s1="",s2="";
    for(int j=0;j<i;j++){
      s1 += S[j];
      s2 += S[j+i];
    }
    //cout << s1 << " " << s2 << endl;
    if(s1==s2) preans = i;
  }
  cout << preans*2 << endl;
  return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long LL;
LL n,a,b,c,d;
int main(){
	scanf("%lld%lld%lld%lld%lld",&n,&a,&b,&c,&d);
	bool can=0;
	for(int i=0;i<=n;i++)
	if(c*(n-1-i)-d*i<=a-b&&a-b<=d*(n-1-i)-c*i){can=1;break;}
	printf("%s",can?"YES":"NO");
	return 0;
}

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

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    K,S=MI()
    ans=0
    for x in range(K+1):
        for y in range(K+1):
            z=S-(x+y)
            if 0<=z<=K:
                ans+=1
    print(ans)

main()


Measured memory_bytes: 40940
N = int(input())
count = 0
if N % 2 == 0:
	for i in range(0,100):
		if N >= (10*(5**i)):
			#print((N//(10*(5**i)))*(i+1))
			count += ((N//10)//(5**i))
		else:
			break;
	print(count)
else:
	print(0)

Measured memory_bytes: 3060
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
using namespace std;

#define Ms(s, n) memset(s, n, sizeof(s))
#define Rp(i,l,m) for(int i=l; i<m; ++i)
#define Rpd(i,l,m) for(int i=l; i>=m; --i)
#define Rpp(i,l,m) for(int i=l; i<=m; i++)
#define RpAll(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define All(a) (a).begin(), (a).end()
#define Fi first
#define Se second
#define Pb push_back
#define Pf push_front
#define Is insert
#define Sz(a) int((a).size())
#define ooi INT_MAX
#define ool LLONG_MAX
typedef long long ll;
typedef unsigned long long int ull;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpii;
const int MOD = (int) 1e9 + 7;
const ld PI = acos((ld) -1);
inline ll gcd(ll a,ll b) {ll r;while(b){r=a%b;a=b;b=r;}return a;}
inline ll lcm(ll a,ll b) {return a/gcd(a,b)*b;}
inline ll fpow(ll n,ll k){ll r=1; for(;k;k>>=1){if(k&1)r=r*n%MOD;n=n*n%MOD;}return r;}
const int base = 311;
const int N = 2e5 + 5;

ll n, m, k, test, a[N], F[N][3];

void Solve(){
    cin >> m >> n >> k;
    cout << max(0LL, k - m + n);
}

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    Solve();
    return 0;
}



















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

int main(){
    int N,K,T,U,V,L;
    cin>>N>>K>>T>>U>>V>>L;
    vector<int> D(N);
    for(auto &d:D) cin>>d;
    int ite=0;
    int boost=0;
    double ans=0;
    int k=0;
    for(int x=1;x<=L;x++){
        ans+=(boost>0?1.0/V:1.0/U);
        if(boost>0) boost-=1;
        if(ite<N&&D[ite]==x){
            if(boost>0&&k==K||boost==0){
                boost=V*T;
            }else{
                k++;
            }
            ite++;
        }else if(boost==0&&k>0){
            boost=V*T;
            k--;
        }
    }
    cout<<fixed;
    cout.precision(9);
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3256
#include<iostream>
#include<cmath>
#include<vector>
#include<algorithm>
#include<map>
#include<string>
#define ll long long
using namespace std;
string S;
int main(){
     cin >> S;
     vector<char> T;
     int counter = 0;
     int result = 0;
     int counterB = 0;
     int resultB = 0;
     T.resize(S.size());
     T[0] = S[0];
     for(int i = 1; i < S.size(); i++){
          if(counter%2 == 0 && S[0] == '0'){
               T[i] = '1';
          }else if(counter%2 == 1 && S[0] == '0'){
               T[i] = '0';
          }else if(counter%2 == 0 && S[0] == '1'){
               T[i] = '0';
          }else if(counter%2 == 1 && S[0] == '1'){
               T[i] = '1';
          }
          if(T[i] != S[i]){
               result++;
          }
          counter++;
     }
     if(S[0] == '0'){
          T[0] = '1';
     }else{
          T[0] = '0';
     }
     resultB = 1;
     for(int i = 1; i < S.size(); i++){
          if(T[i-1] == '0'){
               T[i] = '1';
          }else{
               T[i] = '0';
          }
          if(T[i] != S[i]){
               resultB++;
          }
          counterB++;
     }
     cout << min(result,resultB) << endl;
     return 0;
}

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

using ll = long long;

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

    sort(v.begin(), v.end());

    ll ans1, ans2;
    for(int i = 0; i < N; i++) {
        ans1 += abs(v[i] - v[N/2]);
        ans2 += abs(v[i] - v[N/2+1]);
    }

    cout << min(ans1, ans2) << endl;

    return 0;
}  

Measured memory_bytes: 1792
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;

string s;

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	cin >> s;
	if (s[2] == s[3] && s[4] == s[5])
		cout << "Yes";
	else cout << "No";
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std ;
int main ()
{
    int A, B;
    cin >> A>>B;
    if (A==B)
        cout << "Draw" ;

    else if (B==1 )
        cout << "Bob" ;
    else if (A==1)
        cout << "Alice";
    else  if  (A<B)
        cout << "Bob" ;


    else if  (A>B)

        cout << "Alice" ;

    return 0 ;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
int a,b;
scanf("%d %d",&a,&b);
if(a < b){
printf("a < b\n");
}
else if(a > b)
{
printf("a > b\n");
}
else
{
printf("a == b\n");
}
return 0;
}


Measured memory_bytes: 2580
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"strconv"
	"strings"
)

var (
	readString func() string
	stdout     *bufio.Writer
)

func init() {
	readString = newReadString(os.Stdin)
	stdout = bufio.NewWriter(os.Stdout)
}

func newReadString(ior io.Reader) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = readInt()
	}
	return b
}

func readLengthAndSlice() (int, []int) {
	n := readInt()
	return n, readIntSlice(n)
}

func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(stdout, f, args...)
}

func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(stdout, args...)
}

func eprintln(args ...interface{}) (int, error) {
	return fmt.Fprintln(os.Stderr, args...)
}

// readString() string
// readInt() int
// readIntSlice(n int) []int
// readLengthAndSlice() []int

// -----------------------------------------------------------------------------

//func rev(s string) string {
//	b := []byte(s)
//	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
//		b[i], b[j] = b[j], b[i]
//	}
//	return string(b)
//}

func main() {
	defer stdout.Flush()

	s := readString()
	//ts := []string{rev("dream"), rev("dreamer"), rev("erase"), rev("eraser")}
	ts := []string{"dream", "dreamer", "erase", "eraser"}

outer:
	for len(s) > 0 {
		for _, t := range ts {
			if strings.HasSuffix(s, t) {
				s = s[:len(s)-len(t)]
				continue outer
			}
		}
		println("NO")
		return
	}

	println("YES")
}

// -----------------------------------------------------------------------------


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

int main() {
	string s;
  cin >> s;
  int sum=0, ans=0;
  for(int i=0; i<3; i++)
  {
    if(s[i]=='R') sum+=1;
    else{
      ans=max(sum,ans);
      sum=0;
    }
  }
    ans=max(sum,ans);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3624
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.lang.Math;

/*Question
/FX????????§????????°?????????????????¨????????????????????¨??§????????????????????????????????¨?????§????????????
/????????°????????????100???????????? 1000???????????????????????????????????? 1?????? 108???????????£??????????£??????¨???(108??? ??? 100???) ?? 1000?????? =
8000??????????????????????????¨?????§????????????
/???????????¨????????????????????? t?????????????????? Rt (t=0,1,2,,,n???1)?????\?????¨??????????????????????????§??????????????? Rj???Ri (????????????j>i??¨??????) ????????§???????±??????????????????????
*/

/*Input
/?????????????????´??° n?????????????????????????¶???? n ????????´??° Rt (t=0,1,2,,,n???1) ????????????????????????????????? 
*/

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader sc = new BufferedReader(new InputStreamReader(System.in));
		//????????¨
		long k;
		/*??\???
		/??????????´???°?????\???????¬??????°????????\???
		*/
		int n = Integer.parseInt(sc.readLine());
		long[] r = new long[n];
		for(int i = 0;i < n;i++){
			r[i] = Long.parseLong(sc.readLine());
		}
		/*??°??????fxariganetokasu???????????????
		/??????????????£??????????????§??????
		*/
		k = fxariganetokasu(r);
		System.out.println(k);
	}

	/*fxariganetokasu????????????
	/????????????????????????????????§????±???????
	/@return long
	*/

	public static long fxariganetokasu(long[] r) {
		//????????¨?????¨??????????????\???????????????????????????????????\????????????????????????int???????°??????§??????????????????????????????
		long s = r[1] - r[0];
		//????°??????\????????¨????????????????????\????????????
		long minn = r[0];
		for (int i = 1;i < r.length;i++) {
			s = Math.max(s,r[i] - minn);
			minn = Math.min(minn,r[i]);
		}
		return s;
	}
}

Measured memory_bytes: 43936
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.TreeSet;

class Main {
    public static void main(final String[] args) throws Exception {

        try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in));) {
            int N = Integer.parseInt(br.readLine());
            List<String> inputNumberString = Arrays.asList(br.readLine().split(" "));
            List<Integer> numbers = new ArrayList<>();
            for (String str : inputNumberString) {
                numbers.add(Integer.parseInt(str));
            }

            int ans = 0;
            while (checkOdd(numbers, N)) {
                for (int i = 0; i < N; i++) {
                    numbers.set(i, numbers.get(i) / 2);
                }
                ans++;
            }

            System.out.println(ans);
        } catch (IOException | NumberFormatException e) {
            e.printStackTrace();
            System.exit(0);
        } catch (final Exception e) {
            e.printStackTrace();
            System.exit(0);
        }
    }

    private static boolean checkOdd(List<Integer> numbers, int N) {
        int j = 0;
        for (int i = 0; i < N; i++) {
            if (numbers.get(i) % 2 != 0) {
                break;
            } else {
                j++;
            }
        }
        
        return j == N;
    }
}

Measured memory_bytes: 20692
#include <iostream>
#include <iomanip>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <complex>
#include <map>
#include<unordered_map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include<bitset>
#include<deque>
#include<string>
#include<list>
#include<iterator>
#include<sstream>
#include <algorithm>
#include <numeric>
#include <math.h>

#define user spaesk
#define lli long long int
#define ld long double
#define ff first
#define ss second
#define lower(a) transform(a.begin(),a.end(),a.begin(),::tolower);

using namespace std;

const int N = 3e5 + 500;
const long long mod = 1e9 + 7;
const long long cmod = 998244353 ;
const long long inf = 1LL << 61;
const int M = 1e6 + 500;
const lli ths = 1LL << 40;
const int NN = 5e3 + 6;

void solve()
{
    lli n, m;
    cin>>n >> m;
    lli a[n];
    lli s = 0;
    for(int i = 0; i < n; i ++ ) {
        cin>>a[i];
        s += a[i];
    }
    lli x = ceil(s / (ld)(4 * m) );
    sort(a, a + n);
    reverse(a, a + n);
    bool ok = 1;
    for(int i = 0; i < m; i ++) {
        if(a[i] >= x) {
            ;
        }
        else {
            ok = 0;
        }
    }
    if(ok)
        cout<<"Yes";
    else
        cout<<"No";
    cout<<"\n";
    return ;
}

/*
*/

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

    int t = 1;
//    cin>>t;
    while(t --)
    {
        solve();
    }
    return 0;
}


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

int main() {
  int n;
  cin >> n;
  vector<string> w(n);
  for (int i=0; i<n; i++){
    cin >> w[i];
  }
  
  set<string> st;
  for (int i=0; i<n; i++){
    if (st.count(w[i]) == 1){
      cout << "No" << endl;
      return 0;
    }
    st.insert(w[i]);
  }
  
  for (int i=0; i<n-1; i++){
    if (w[i].at(w[i].size()-1) != w[i+1].at(0)){
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  return 0;
}

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

namespace ABC064_B_Traveling_AtCoDeer_Problem
{
	internal class Program
	{
		public static void Main(string[] args)
		{
			int n = int.Parse(Console.ReadLine());
			string[] input = Console.ReadLine().Split(' ');
			List<int> aList = new List<int>(n);
			for (int i = 0; i < n; i++)
				aList.Add(int.Parse(input[i]));
			
			aList.Sort();
			int length = 0;
			for (int i = 0; i < n - 1; i++)
				length += aList[i + 1] - aList[i];
			
			Console.Write(length);
		}
	}
}

Measured memory_bytes: 11092
#include<iostream>
#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;
typedef long long ll;

int main(){
    int sx, sy, tx, ty;
    cin >> sx >> sy >> tx >> ty;
    int subx = tx-sx;
    int suby = ty-sy;
    rep(i,subx) cout << "R";
    rep(i,suby) cout << "U";
    rep(i,subx) cout << "L";
    rep(i,suby+1) cout << "D";
    rep(i,subx+1) cout << "R";
    rep(i,suby+1) cout << "U";
    cout << "L";
    cout << "U";
    rep(i,subx+1) cout << "L";
    rep(i,suby+1) cout << "D";
    cout << "R";
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;
#define ll long long
#define ld long double
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repo(i,n) for(int i = 1; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define np next_permutation
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define uniq(v) v.erase(unique(v.begin(),v.end()),v.end())
#define lb(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define ub(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
using Pair = pair<ll,pair<int,int>>;
#define pq priority_queue<Pair, vector<Pair>, greater<Pair>> 
const ll mod=1000000007;
//const ll mod=998244353;
const ld pi=acos(-1.0);
const ll INF = 1LL<<61;
template<class T>bool chmax(T &a, const T &b) { 
  if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) {
  if (b<a) { a=b; return 1; } return 0; }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'大文字'+=32;    で小文字に
//  cout << fixed << setprecision (20);   小数点以下2０桁まで
//実行時間制約2秒では２×10^8回くらいまで計算できる




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

  string s;
  cin>>s;
  int n=s.size();

  ll ans=0;
  int k=0;
  for(int i=n-1;i>=0;i--){
    int x=(int)(s[i]-'0')+k;
    if(x<=4) {
      ans+=x;
      k=0;
    }
    else if (x==5) {
      int y=0;
      if(i>0) y=s[i-1]-'0';
      if(y<=4) {
        ans+=x;
        k=0;
      }
      else {
        ans+=10-x;
        k=1;
      }
    }
    else {
      ans+=10-x;
      k=1;
    }
  }

  if(k==1) ans++;

  cout << ans << endl;
}


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

int main() {
  cin.tie(0);
  std::ios::sync_with_stdio(false);
  int A,B,K;
  cin>>A>>B>>K;
  set<int> S;
  for (int i=0; i<K && A+i<=B; i++) {
    S.insert(A+i);
  }
  for (int i=0; i<K && B-i>=A; i++) {
    S.insert(B-i);
  }
  for (auto itr=S.begin(); itr!=S.end(); itr++) {
    cout<<*itr<<endl;
  }
  return 0;
}



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

using namespace std;

vector<int> func(int n) {
    vector<int> fac, sub;

    for (int i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            fac.push_back(i);
            if (n / i != i)
                sub.push_back(n/i);
        }
    }

    int l = sub.size();
    for (int i = 0; i < l; i++)
        fac.push_back(sub[l-1-i]);
    
    return fac;
}

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

    int *count = new int[n+1];
    for (int i = 0; i <= n; i++)
        count[i] = 0;

    vector<int> ans(n+1, 0);
    int sum = 0;

    for (int i = n; i > 0; i--) {
        if (count[i] % 2 == 1 && a[i] == 1) {
            ans[i] = 0;
        }
        else if (count[i] % 2 == 1 && a[i] == 0) {
            ans[i] = 1;
            sum++;
            vector<int> fac = func(i);
            for (int j = 0; j < fac.size(); j++)
                count[fac[j]]++;
        }
        else if (count[i] % 2 == 0 && a[i] == 1) {
            ans[i] = 1;
            sum++;
            vector<int> fac = func(i);
            for (int j = 0; j < fac.size(); j++)
                count[fac[j]]++;
        }
        else {
            ans[i] = 0;
        }
    }

    cout << sum << endl;

    if (sum) {
        for (int i = 1; i <= n; i++) {
            if (ans[i] == 1)
                cout << i << " ";
        }
        cout << endl;
    }

    return 0;
}

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

typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
const int INF = int (1e9) + int (1e5);
const ll INFL = ll(2e18) + ll(1e10);
const ui MOD = 1E9 + 7;
const double EPS = 1e-9;
#define FOR(i,n) for (int i=0;i<(n);++i)
#define ROF(i,x) for(int i = (x) ; i >= 0 ; --i)
#define MP make_pair
#define ALL(a) (a).begin(),(a).end()
#define ODD(x) (((x)&1)==0?(0):(1))
#define sign(x) ((x > 0) - (x < 0))
std::mt19937_64  generator(std::chrono::system_clock::now().time_since_epoch().count());

inline ll powmod(ll a,ll b,ll mod) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a, ll b) { return a ? gcd(b%a, a): b; }
ll lcm(ll a, ll b) { return a / gcd(a,b) * b; }


void READ(bool _local){
    ios_base::sync_with_stdio(false); cin.tie(0);
#ifdef _DEBUG
    if (_local)
        freopen ("in.txt", "r", stdin);
#endif
}

int main() {
    READ(0);
    double a,b,x;cin>>a>>b>>x;
    double mid = a*a*b/2;
    double alfa;
    if (x>mid-EPS)
        alfa=atan((b-x/(a*a)) * (double)2/a);
    else{
        alfa=atan(a*b*b/(x*2));
    }
    cout << setprecision(10) << fixed << alfa*180/acos(-1);
    return 0;
}



Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define repi(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define repdi(i,a,b) for(ll i=(a)-1;i>=(b);--i)
#define repd(i,a) repdi(i,a,0)
#define itr(it,a) for( auto it = (a).begin(); it != (a).end(); ++it )
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()

using ll = long long;
using P = std::pair<ll, ll>;

constexpr ll INF = 1ll<<60;

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; }

template<class S, class T>
std::ostream& operator<< ( std::ostream& out, const std::pair<S,T>& a )
{ std::cout << '(' << a.first << ", " << a.second << ')'; return out; }

template<class T>
std::ostream &operator<< ( std::ostream& out, const std::vector<T>& a )
{ std::cout << '['; rep( i, a.size() ){ std::cout << a[i]; if( i != a.size()-1 ) std::cout << ", "; } std::cout << ']'; return out; }

ll N;
std::string C;
ll S[2000100];

int main()
{
  std::cin >> N >> C;

  ll cnt = 0;

  rep( i, N ) {
    cnt += C[i]=='R';
    S[i+1] = S[i]+(C[i]=='W');
  }

  ll ans = INF;

  repi( r, cnt, N+1 ) {
    chmin( ans, S[r] );
  }

  std::cout << ans << std::endl;

  return 0;
}

Measured memory_bytes: 5320
//#include "IntMod.h"
//typedef IntMod<1000000007> MInt;

//#include "Union_Find.h"

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <algorithm>
#include <functional>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <iomanip>
#include <sstream>
#include <numeric>
#include <array>

using namespace std;
#define REP(i,a,n) for(int i = (a); i < (int)(n); ++i)
#define REPM(i,n,a) for(int i = ((n) - 1); i >= (a); --i)
#define EPS 0.0001
#define INF 0x3FFFFFFF
#define INFLL 0x3FFFFFFF3FFFFFFF
#define INFD 1.0e+308
#define FLOAT setprecision(16)
typedef long long LL;
typedef unsigned long long ULL;
typedef pair<LL, LL> PP;

#if 1
#include <unordered_set>
#include <unordered_map>
template<typename T>
using PriorityQ = priority_queue<T, vector<T>, greater<T> >;	// コスト小を優先
#endif

int a, s, d;
int main() {
	cin >> a >> s >> d;
	cout << ((s * 10 + d) % 4 == 0 ? "YES" : "NO") << endl;
	return 0;
}

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

using namespace std;

typedef pair<int, int> P;
#define int long long
#define ll long long
#define mod 1000000007
#define INF (1LL<<60)


void bfs(int s, vector<vector<int>>& g, vector<int>& visited){
	queue<int> q;
	q.push(s);
	visited[s] = s;
	while (!q.empty()){
		int u = q.front(); q.pop();
		for (int v : g[u]){
			if (visited[v] < 0){
				visited[v] = s;
				q.push(v);
			}
		}
	}
}

signed main(){

	int N, K, L;
	vector<vector<int>> road, train;
	cin >> N >> K >> L;
	road.assign(N, vector<int>());
	train.assign(N, vector<int>());
	for (int i = 0; i < K; i++){
		int p, q;
		cin >> p >> q; p--; q--;
		road[p].push_back(q);
		road[q].push_back(p);
	}
	for (int i = 0; i < L; i++){
		int p, q;
		cin >> p >> q; p--; q--;
		train[p].push_back(q);
		train[q].push_back(p);
	}

	vector<int> visited_road(N), visited_train(N);
	visited_road.assign(N, -1);
	visited_train.assign(N, -1);

	for (int i = 0; i < N; i++){
		if (visited_road[i] < 0) bfs(i, road, visited_road);
		if (visited_train[i] < 0) bfs(i, train, visited_train);
	}

	map<pair<int, int>, int> cnt;
	for (int i = 0; i < N; i++){
		cnt[pair<int, int>(visited_road[i], visited_train[i])]++;
	}

	for (int i = 0; i < N; i++){
		cout << cnt[pair<int, int>(visited_road[i], visited_train[i])] << " ";
	}


	return 0;
}


Measured memory_bytes: 30312
//#include<bits/stdc++.h>
#define _CRT_SBCURE_NO_DEPRECATE
#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <stack>
#include <vector>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <functional>
//#define UP(i,x,y) for(int i=x;i<=y;i++)
//#define DOWN(i,x,y) for(int i=x;i>=y;i--)
#define sdddd(x,y,z,k) scanf("%d%d%d%d", &x, &y, &z, &k)
#define sddd(x,y,z) scanf("%d%d%d", &x, &y, &z)
#define sdd(x,y) scanf("%d%d", &x, &y)
#define sd(x) scanf("%d", &x)
#define mp make_pair
#define pb push_back
#define lson k<<1
#define rson k<<1|1
#define mid (l+r)/2
#define ms(x, y) memset(x, y, sizeof x)
using namespace std;
typedef long long ll;
//typedef unsigned long long ull;
#define MOD 142857
const int maxn = 10100;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3f;
int n, m, s, t;
int len;
struct road
{
	int u, v, len, cost;
	int next;
};
struct node
{
    int v;
    int len;
    int cost;
    node(int v, int l, int c):v(v),len(l),cost(c){}
    friend bool operator <(node a, node b)
    {
        return a.len>b.len;
    }
};
road G[maxn*5];
int h[maxn];
int mx = -INF;
int d[maxn];
int c[maxn];
int path[maxn];
void dij()
{
    fill(d, d+n+1, INF);
    fill(path, path+n+1, -1);
    fill(c, c+n+1, 0);
    d[1] = 0;
    priority_queue<node> pque;
    pque.push(node(1, 0, 0));
    while(pque.size())
    {
        node p = pque.top(); pque.pop();
        int v = p.v;
        if(d[v] < p.len) continue;
        for(int i = h[v]; i != -1; i = G[i].next)
        {
            road e = G[i];
            if(d[e.v] > d[e.u] + e.len)
            {
                d[e.v] = d[e.u] + e.len;
                c[e.v] = c[e.u] + e.cost;
                path[e.v] = i;
                pque.push(node(e.v, d[e.v], c[e.v]));
            }
            else if(d[e.v] == d[e.u] + e.len)
            {
                if(path[e.v] != -1 && G[path[e.v]].cost > e.cost)
                {
                    path[e.v] = i;
                    pque.push(node(e.v, d[e.v], c[e.v]));
                }
            }
        }
    }
}
int main()
{
	//freopen("out.txt", "w", stdout);
    while(~sdd(n, m) && (n||m))
    {
        int ta, tb, tc, td;
        int len = 0;
        fill(h, h+n+1, -1);
        for(int i = 0; i < m; i++)
        {
            sdddd(ta, tb, tc, td);
            G[len].u = ta;
            G[len].v = tb;
            G[len].len = tc;
            G[len].cost = td;
            G[len].next = h[ta];
            h[ta] = len++;

            G[len].u = tb;
            G[len].v = ta;
            G[len].len = tc;
            G[len].cost = td;
            G[len].next = h[tb];
            h[tb] = len++;
        }
        dij();
        int ans = 0;
        for(int i = 1; i <= n; i++)
        {
            if(path[i]!=-1)
            {
                ans += G[path[i]].cost;
            }
        }
        printf("%d\n",ans);
    }

	return 0;
}



Measured memory_bytes: 4268
#include <algorithm>
#include<iostream>
#include<vector>
#include<string>
#include<map>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<limits.h>

using namespace std;
int main(){
  int n;
  cin >> n;
  int red[n][3],blue[n][3];
  int ii,jj;
  int cnt = 0;
  int tmpx,tmpy;
  map<int,vector<int>*> fmap;
  vector<int>* fvec[n];
  for(ii=0;ii<n;ii++){
	cin >> red[ii][0] >> red[ii][1];
	red[ii][2] = 0;
	fvec[ii] = new vector<int>();
  }

  for(ii=0;ii<n;ii++){
	cin >> blue[ii][0] >> blue[ii][1];
	blue[ii][2] = 0;
  }

  // blueをX軸で昇順に並べる
  for(ii=0;ii<n;ii++){
	for(jj=ii;jj<n;jj++){
	  if(blue[ii][0] > blue[jj][0]){
		tmpx = blue[ii][0];
		tmpy = blue[ii][1];
		blue[ii][0] = blue[jj][0];
		blue[ii][1] = blue[jj][1];
		blue[jj][0] = tmpx;
		blue[jj][1] = tmpy;
	  }
	}
  }
  //redをY軸で降順に並べる
  for(ii=0;ii<n;ii++){
	for(jj=ii;jj<n;jj++){
	  if(red[ii][1] < red[jj][1]){
		tmpx = red[ii][0];
		tmpy = red[ii][1];
		red[ii][0] = red[jj][0];
		red[ii][1] = red[jj][1];
		red[jj][0] = tmpx;
		red[jj][1] = tmpy;
	  }
	}
  }
  
  long tmpDis,miniDis,pos;
  
  for(ii=0;ii<n;ii++){
	tmpDis = LONG_MAX;
	miniDis = LONG_MAX;
	pos = -1;

	for(jj=0;jj<n;jj++){

	  //tmpDis = (blue[jj][0] - red[ii][0]) + (blue[jj][1] - red[ii][1]);

	  //cout << "jj:" << blue[jj][2] << endl;

	  if(blue[ii][0] > red[jj][0] &&
		 blue[ii][1] > red[jj][1] &&
		 red[jj][2] != 1){
		//cout << "pos:" << pos << "dis" << tmpDis << endl;

		cnt += 1;
		red[jj][2] = 1;
		break;

	  }
	  
	}

  }


  long max =0;


  // fvecをsize順の昇順に並べる
  //vector<int>* tmp;
  //
  //for(ii=0;ii<n;ii++){
  //	for(jj=ii;jj<n;jj++){
  //	  if(fvec[ii]->size() > fvec[jj]->size()){
  //		tmp =fvec[ii];
  //		fvec[ii] = fvec[jj];
  //		fvec[jj] = tmp;
  //	  }
  //	}
  //}
  //
  ////for(auto it : fmap){
  ////	cout << "key:" << it.first ;
  ////	vector<int>* vec = fmap[it.first];
  ////	for(int val : *(it.second)){
  ////	
  ////	  cout << "val:" << val;
  ////	}
  ////	cout << endl;
  ////	if(it.second->size() > max){
  ////	  max = it.second->size();
  ////	}
  ////}
  //
  //for(ii=0;ii<n;ii++){
  //	for(int pair : *(fvec[ii])){
  //	  //  cout << "pair:" << pair ;
  //	}
  //	//cout << endl;
  //}
  //
  ////仲良しになれる数が少ない順にペアを決めていく
  //for(ii=0;ii<n;ii++){
  //	for(int pair : *(fvec[ii])){
  //	  if(blue[pair][2] != 1){
  //		cnt += 1;
  //		blue[pair][2] = 1;
  //		break;
  //	  }
  //	}
  //}
  cout << cnt << endl;
  
  return 0;
}


Measured memory_bytes: 256