akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

int maxi, n;
int d[256];
bool mas[256];

vector< vector<int> > G(256);

void dfs1(int x)
{
  if(mas[x]) return;
  mas[x] = true;
  for(int i = 1; i <= maxi; i++){
    dfs1(max(0, min(x + i + d[max(0, min(x + i, n+1))], n+1)));
    G[max(0, min(x + i + d[max(0, min(x + i, n+1))], n+1))].push_back(x);
  }
}

void dfs2(int x)
{
  if(!mas[x]) return;
  mas[x] = false;
  //if(d[x] != 0) return;
  for(int i = 0; i < G[x].size(); i++){
    dfs2(G[x][i]);
  }
}

bool check()
{
  for(int i = 1; i <= n; i++){
    if(mas[i]) return false;
  }
  return true;
}

int main()
{
  while(cin >> maxi, maxi){ 
    cin >> n;
    G.clear(); G.resize(n + 2);
    memset(mas, false, sizeof(mas));
    memset(d, 0, sizeof(d));
    for(int i = 1; i <= n; i++) cin >> d[i];
    dfs1(0);
    if(check() && !mas[n+1]) cout << "NG" << endl;
    else {
      dfs2(n+1);
      cout << (check() ? "OK" : "NG") << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 1244
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;


public class Main {
    public static void main(String[] args) {
        FastScanner fsc = new FastScanner();
        int n=fsc.nextInt();
        int a=fsc.nextInt();
        int b=fsc.nextInt();
        char[] s=fsc.next().toCharArray();
        int cnt=0;
        int os=0;
        StringBuilder sb = new StringBuilder();
        for(char c:s){
            if (c == 'a') {
                if (cnt < a + b) {
                    ++cnt;
                    sb.append("Yes\n");
                } else {
                    sb.append("No\n");
                }
            } else if (c == 'b') {
                if (cnt < a + b && os < b) {
                    ++cnt;
                    ++os;
                    sb.append("Yes\n");
                } else {
                    sb.append("No\n");
                }
            } else {
                sb.append("No\n");
            }
        }
        System.out.print(sb);
    }
}


class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }
    public double nextDouble() { return Double.parseDouble(next());}
}


Measured memory_bytes: 26196
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.NoSuchElementException;

public class Main {
    public static void main(String[] args) {
        PrintWriter out = new PrintWriter(System.out);
        FastScanner sc = new FastScanner();
        Strategy strategy = new MyStrategy();
        strategy.solve(out, sc);
        out.flush();
    }
}

class MyStrategy implements Strategy {
    @Override
    public void solve(PrintWriter out, FastScanner sc) {
        int X = sc.nextInt();
        int Y = sc.nextInt();

        int b = Y / 2 - X;
        int a = 2 * X - Y / 2;

        if (a >= 0 && b >= 0 && Y % 2 == 0) {
            out.println("Yes");
        } else {

            out.println("No");
        }
    }
}

interface Strategy {
    void solve(PrintWriter out, FastScanner sc);
}

class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }
    public double nextDouble() { return Double.parseDouble(next());}
}


Measured memory_bytes: 25556
#create date: 2020-05-03 21:02

import sys
stdin = sys.stdin

def ns(): return stdin.readline().rstrip()
def ni(): return int(ns())
def na(): return list(map(int, stdin.readline().split()))

def main():
    n, k = na()
    sunuke = [0] * n
    for i in range(k):
        d = ni()
        a = na()
        for b in a:
            sunuke[b-1] += 1
    print(sunuke.count(0))

if __name__ == "__main__":
    main()

Measured memory_bytes: 67456
package main

import "fmt"

func main() {
	var s string
	var m, h int
	for {
		fmt.Scan(&s)
		if s == "-" {
			break
		}
		fmt.Scan(&m)
		for i := 0; i < m; i++ {
			fmt.Scan(&h)
			s = s[h:] + s[:h]
		}
		fmt.Println(s)
	}
}



Measured memory_bytes: 1112
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <climits>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#define ALL(A)		(A).begin(),(A).end()
#define DUMP(A)    cout<<#A<<"="<<(A)<< endl
#define SIZE(A)    (int)((A).size())
using namespace std;
typedef long long ll;

int main(){
    int N,M;
    for(;;){
        double htoh[101][101];
        scanf("%d%d",&N,&M);
        if(N==0&&M==0) break;
        for(int i=0;i<N;i++){
            for(int j=0;j<N;j++){
                scanf("%lf",&htoh[i][j]);
            }
        }
        double dp[2][101];
        for(int i=0;i<N;i++){
            dp[0][i]=1;
        }
        for(int i=1;i<M;i++){
            for(int j=0;j<N;j++){
                dp[i%2][j]=dp[(i-1)%2][0]*htoh[0][j];
                for(int k=0;k<N;k++){
                    dp[i%2][j]=max(dp[i%2][j],dp[(i-1)%2][k]*htoh[k][j]);
                }
            }
        }
        double ma=dp[(M-1)%2][0];
        for(int i=0;i<N;i++){
            ma=max(ma,dp[(M-1)%2][i]);
        }
        printf("%.2f\n",ma);
    }
}

Measured memory_bytes: 0
#include <bits/stdc++.h> //library
#define rep(i, n) for(int i = 0; i < (int)(n); i++) //for-loop (from 0)
#define reps(i,n) for(int i = 1; i <= (int)(n); i++) //for-loop (from 1)
#define all(x) (x).begin(),(x).end() //start-to-end iteration, mainly in upper_bound, lower_bound
#define SZ(x) ((int)(x).size()) //unsigned to signed

using namespace std;
using ll = long long; //long long
ll M = 1000000000 + 7;
const ll INF = 1LL << 60;

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; } //compare a,b and replace by greater
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; } //compare a,b and replace by smaller
ll qp(int a, ll b) { int ans = 1; do { if (b & 1)ans = 1ll * ans*a; a = 1ll * a*a; } while (b >>= 1); return ans; } //power
ll qp(int a, ll b, ll Mod) { int ans = 1; do { if (b & 1)ans = 1ll * ans*a%Mod; a = 1ll * a*a%Mod; } while (b >>= 1); return ans; } //power(mod)
int gcd(int a, int b) { return b ? gcd(b, a%b) : a; } //gcd
int dx[4] = { 1,0,-1,0 }; //path
int dy[4] = { 0,1,0,-1 }; //path
ll RS(ll N, ll P) { if (P == 0)return 1; else if (P % 2 == 0) { ll sq = RS(N, P / 2); return sq*sq; } else { return N*RS(N, P - 1); } } //power(repeat-square,fast)
ll nPr(ll n, ll r) { ll ans = 1; rep(i, r) { ans = ans * (n - i); } return ans; } //permutation
ll nCr(ll n, ll r) { ll bunbo = 1; ll bunshi = 1; rep(i, r) { bunbo = bunbo * (i + 1); bunshi = bunshi * (n - i); } return bunshi / bunbo; } //combination
ll RS(ll N, ll P, ll Mod) { if (P == 0)return 1; else if (P % 2 == 0) { ll sq = RS(N, P / 2, Mod); return sq*sq%Mod; } else { return N*RS(N, P - 1, Mod) % Mod; } } //power(mod)(repeat-square,fast)
ll nPr(ll n, ll r, ll Mod) { ll ans = 1; rep(i, r) { ans = ans * (n - i) % Mod; } return ans; } //permutation
ll nCr(ll n, ll r, ll Mod) { ll bunbo = 1; ll bunshi = 1; rep(i, r) { bunbo = bunbo * (i + 1) % Mod; bunshi = bunshi * (n - i) % Mod; } return bunshi * RS(bunbo, Mod - 2, Mod) % Mod; } //combination

ll E_ruiseki[300300], W_ruiseki[300300];
ll N; string S;

int main(void) {
  cin >> N; cin >> S;
  reps(i,N){
    E_ruiseki[i] = E_ruiseki[i-1];
    W_ruiseki[i] = W_ruiseki[i-1];
    if (S[i-1]=='E') E_ruiseki[i]++;
    if (S[i-1]=='W') W_ruiseki[i]++;
  }
  ll res = INF;
  reps(i,N){
    chmin(res,W_ruiseki[i-1]-W_ruiseki[0]+E_ruiseki[N]-E_ruiseki[i]);
  }
  cout << res << "\n";
  return 0;
}


Measured memory_bytes: 5380
#include <stdio.h>
 
void putcolor(int[10][10],int,int);
 
int main(void) {
    int paper[10][10];
    int x,y,size;
    int nocolor,mostkoi;
    for(y=0;y<10;y++) {
        for(x=0;x<10;x++)paper[x][y]=0;
    }
    while(1) {
        if(scanf("%d,%d,%d",&x,&y,&size)==-1)break;
        switch(size) {
            case 3:
                putcolor(paper,x-2,y);
                putcolor(paper,x+2,y);
                putcolor(paper,x,y-2);
                putcolor(paper,x,y+2);
            case 2:
                putcolor(paper,x-1,y-1);
                putcolor(paper,x+1,y-1);
                putcolor(paper,x-1,y+1);
                putcolor(paper,x+1,y+1);
            case 1:
                putcolor(paper,x-1,y);
                putcolor(paper,x+1,y);
                putcolor(paper,x,y-1);
                putcolor(paper,x,y+1);
        }
        putcolor(paper,x,y);
    }
    mostkoi=0;nocolor=0;
    for(y=0;y<10;y++) {
        for(x=0;x<10;x++) {
            if(paper[x][y]==0)nocolor++;
            if(paper[x][y]>mostkoi)mostkoi=paper[x][y];
        }
    }
    printf("%d\n",nocolor);
    printf("%d\n",mostkoi);
    return 0;
}
 
void putcolor(int paper[10][10],int x,int y) {
    if(x<0 || x>=10 || y<0 || y>=10)return;
    paper[x][y]++;
}

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

#include <boost/range/adaptors.hpp>
#include <boost/range/irange.hpp>

using namespace std;
using namespace boost;
using namespace boost::adaptors;

using V = complex<double>;

void dft(vector<V>& f, int64_t dir = 1) {
    int64_t n = f.size();

    if (n == 1) {
        return;
    }

    assert(n % 2 == 0);

    int64_t d = round(log2(n));

    for (auto i : irange(0L, n)) {
        int64_t j = 0;

        for (auto l : irange(0L, d)) {
            j |= ((i >> l) & 1) << (d - l - 1);
        }

        if (i < j) {
            swap(f[i], f[j]);
        }
    }

    double pi = acos(-1);
    for (auto i : irange(0L, d)) {
        auto b = 1L << i;

        for (auto j : irange(0L, n / 2 / b)) {
            V z = polar(1.0, 2 * pi * dir / (2 * b));
            V p = 1;

            for (auto k : irange(0L, b)) {
                auto t1 = f[j * 2 * b + k];
                auto t2 = f[j * 2 * b + k + b];
                f[j * 2 * b + k] = t1 + p * t2;
                f[j * 2 * b + k + b] = t1 - p * t2;
                p *= z;
            }
        }
    }
}

void inv_dft(vector<V>& f) {
    int64_t n = f.size();

    dft(f, -1);
    for (auto&& x : f) {
        x /= V(n);
    }
}

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

    vector<V> p(1L << 18);
    for (auto i : irange(0L, n)) {
        int64_t a;
        cin >> a;
        p[a] += 1;
    }

    dft(p);

    vector<V> q(p.size());
    for (auto i : irange(0uL, p.size())) {
        q[i] = p[i] * p[i];
    }

    inv_dft(q);

    int64_t ans = 0, num = 0;
    for (auto i : irange(0uL, q.size()) | reversed) {
        int64_t qq = q[i].real() + 0.5;

        if (num + qq > m) {
            ans += (m - num) * i;
            break;
        }

        ans += qq * i;
        num += qq;
    }

    cout << ans << endl;
}

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

int main(void)
{
    int N, A, count = 0;

    std::cin >> N;
    
    for(int i = 0; i < N; ++i)
    {
        std::cin >> A;

        if(A % 2 == 1)
        {
            ++count;
        }
    }

    if(count % 2 == 0)
    {
        std::cout << "YES" << std::endl;
    }

    else
    {
        std::cout << "NO" << std::endl;
    }

    return 0;
}

Measured memory_bytes: 256
import math
from itertools import combinations
N,D = map(int,input().split())
X = [list(map(float, input().split())) for i in range(N)]
counter = [(sum([(a-b)**2 for a, b in zip(x0,x1)])**0.5).is_integer() for x0,x1 in combinations(X, 2)]
print(sum(counter))


Measured memory_bytes: 38384
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <cstdlib>
#include <iostream>
#include <list>
#include <numeric>
#include <queue>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define ll long long

int main() {
  string s;
  cin >> s;
  int plc = s.size() - 1;
  long N = 1 << plc;

  long sum = 0, sum_tmp = 0;
  for (int i = 0; i < N; i++) {
    sum_tmp = (long)s[0] - (long)'0';

    for (int j = 0; j < plc; j++) {

      /*bitが立ってたら+を加える  99999999 
        で3番目にbitが立ってたなら　999 + ~ となる*/
      if ((i >> j) & 1) {
        sum += sum_tmp;
        sum_tmp = (long)s[j + 1] - (long)'0';
      } else {
        //1ビット 9 - 9*10+9  - 99*10+9
        sum_tmp = 10 * sum_tmp + (long)s[j + 1] - (long)'0';
      }
    }
    sum += sum_tmp;
  }
  cout << sum << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
long long s=0,n,m,a[111111];
int main(){
	cin>>n>>m;
	for(int i=0;i<n;i++)
		cin>>a[i];
	for(int i=1;i<n;i++)
		if(a[i]+a[i-1]>m)
		{
			s+=a[i]+a[i-1]-m;
			a[i]-=a[i]+a[i-1]-m;
			if(a[i]<0)
				a[i]=0;
		}
	cout<<s<<endl;
	return 0;
}

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

using namespace std;

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

#define rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=int(a);i<(b);i++)
#define repr(i,b,a) for(int i=int(b);i>=(a);i--)
#define all(x) x.begin(),x.end()

const ll mod = 1e9+7;
const ll INF = 1e9;

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
bool valid(int lx,int ux,int ly,int uy,int x,int y){
	return lx<=x&&x<ux&&ly<=y&&y<uy; 
}
ll power(ll x,ll p){
	if(p==0)return 1;
	ll res=power(x*x%mod,p/2);
	if(p%2==1)res=res*x%mod;
	return res;
}

int main()
{
	int n,k;
	cin>>n>>k;
	n-=k;
	cout<<(k==1?0:n)<<endl;
	return 0;
}

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

s = s[::-1]
t = t[::-1]

ans = ""
for i in range(len(s) - len(t)+1):
    for j in range(len(t)):
        if s[i+j] != t[j] and s[i+j] != "?":
            break
    else:
        ans = s[:i] + t + s[i+j+1:]
        ans = ans[::-1]
        print(ans.replace("?", "a"))
        exit()
        
print("UNRESTORABLE")


Measured memory_bytes: 3064
# coding: utf-8
from heapq import heappop, heappush
from itertools import permutations

N,M,R=map(int,input().split())
town=list(map(int,input().split()))
INF=10**9
G=[[INF for i in range(N+1)] for j in range(N+1)]

for i in range(M):
    A,B,C=map(int,input().split())
    G[A][B]=C
    G[B][A]=C

d=[[INF*10 for i in range(N+1)] for j in range(R)]

for k in range(R):
    r=town[k]
    d[k][r]=0
    
    used=[False for i in range(N+1)]
    
    heap=[]
    heappush(heap,(d[k][r],r))
    
    while heap:
        d_u, u = heappop(heap)

        used[u] = True
        
        if d[k][u] < d_u:
            continue
        
        for v in range(N+1):
            if not(used[v]) and d_u + G[u][v] < d[k][v]:
                d[k][v] = d_u + G[u][v]
                heappush(heap,(d[k][v],v))

ans=INF

L=[i for i in range(R)]

for v in permutations(L,R):
    D=0
    for i in range(R-1):
        D+=d[v[i]][town[v[i+1]]]
    ans=min(ans,D)
    
print(ans)

Measured memory_bytes: 4212
#include<bits/stdc++.h>
using namespace std;
using ll = int64_t;
int main(){
    ll N, A, B;
    cin >> N >> A >> B;
    if(!(N <= A * B && A + B - 1 <= N)){
        cout << -1 << endl;
        return 0;
    }
    vector<ll> v[B];
    ll low = 1, up = N;
    for(ll i = B - 1; 0 <= i; i--){
        v[i].push_back(B - i);
        low = B - i;
    }
    for(ll i = N; v[0].size() < A; i--){
        v[0].push_back(i);
        up = i;
    }
    sort(v[0].begin(), v[0].end());
    ll index = B - 1;
    for(ll i = low + 1; i < up; i++){
        v[index].push_back(i);
        index--;
        if(!index) index = B - 1;
    }
    for(ll i = 0; i < B; i++) for(ll u : v[i]) cout << u << " ";
    cout << endl;
    return 0;
}

Measured memory_bytes: 12800
import math

a,b,h,m = map(int,input().split())
ah = 30 * h + m * 0.5
am = 6 * m
ang = abs(ah - am)
ang = min(ang, 360 - ang)
ans = (a*a+b*b-2*a*b*math.cos(math.radians(ang))) ** 0.5


print(ans)

Measured memory_bytes: 9508
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;


int main(){
	int W, H, x, y; cin >> W >> H >> x >> y;
	cout << setprecision(10) << ((double)W*H)/2 << " ";
	if(2*x == W && 2*y == H) cout << 1 << endl;
	else cout << 0 << endl;
	return 0;
}

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

int main() {
    ll A, B, N;
    cin >> A >> B >> N;
    ll t = max(B * (N/B) - 1, ll(0));
    ll ans=max((A*N/B)-A*(N/B), (A*t/B)-A*(t/B));
    cout << ans << endl;
}

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

#define ll long long
#define endl '\n'

const int N = 5e2 + 5;
ll a[N];

int main(){
        ios_base::sync_with_stdio(false);
        cin.tie(0);
        cout.tie(0);
        ll n, k;
        cin >> n >> k;
        if (k == 2) {
                ll x = n/2;
                ll y = n - x;
                cout << x * x * x + y * y * y;
        }
        else if ((k % 2)== 0){
                ll x = k / 2;
                ll y = n / x;
                ll z = n / k;
                ll t = y - z;
                cout << t * t * t + z * z * z;
        }
        else {
                ll x = n / k;
                cout << x * x * x;
        }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
#define int long long
#define P pair<long,long>
#define all(a) a.begin(),a.end()
using namespace std;
signed main(){
    int a,b,c,k; cin>>a>>b>>c>>k;
    cout<<(k%2==0?a-b:b-a)<<endl;
}

Measured memory_bytes: 256
H, W = map(int, input().split())
S = [0 for _ in range(H)]
ans=[[0 for _ in range(W)] for _ in range(H)]
for i in range(H):
    S[i] = input()
# ここまでが入力

dx = [1, 1, 1, 0, 0, -1, -1, -1]    # これらは移動を表すリスト
dy = [1, 0, -1, 1, -1, 1, 0 ,-1]    # 順番に、右上・右・右下・…となっている

for i in range(H):    
    for j in range(W):
        if S[i][j] == "#":
            ans[i][j] = "#"
            continue    # continueはループをスキップして次のループに進む　breakはループを終了
        counter = 0
        for d in range(8):    # S[i][j]に対して、隣接する8マスについて爆弾があるかを判定する
            di = i + dx[d]
            dj = j + dy[d]
            if di<0 or (H-1)<di or dj<0 or W-1<dj:
                continue
            if S[di][dj] == "#":
                counter += 1
        ans[i][j] = str(counter)
        
for i in range(H):
    ans[i] = "".join(ans[i])
    print(ans[i])

Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
#define lli long long int
#define rep(x,y) for(lli i=x;i<y;i++)
#define pb push_back
#define mp make_pair
#define bg() begin()
#define en() end()
#define ft first
#define sc second
#define vect_lli_it vector<lli>::iterator
#define set_lli_it set<lli>::iterator
#define inf 1e18
int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    lli n;
    cin>>n;
    set <lli> div;
    for(lli i=2;i*i<=n;i++){
    	if(n%i==0){
    		div.insert(i);
    		div.insert(n/i);
		}
	}
	if(n>=2)
	div.insert(n);
	//sort(div.bg(),div.en());
	lli choice=0;
	set_lli_it it;
	for(it=div.bg();it!=div.en();it++){
		lli x=n;
		while(x%*it==0){
			x=x/(*it);
		}
		if(x==1)
		choice++;
		else if((x-1)%(*it)==0)
		choice++;
	}
	set <lli> div2;
	for(lli i=2;i*i<=(n-1);i++){
    	if((n-1)%i==0){
    		div2.insert(i);
    		div2.insert(n/i);
		}
	}
	if(n-1>=2)
	div2.insert(n-1);
	//sort(div2.bg(),div2.en());
	choice+=div2.size();
	cout<<choice;
	return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define M ((ll)(1e9)+7)
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long ll;
void solve()
{
    ll n,k;
    cin>>k>>n;
    if(k*500>=n)
    cout<<"Yes"<<endl;
    else
    cout<<"No"<<endl;
}
int main()
{
    
    solve();
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a) for(int i = 0; i < a; i++)
#define all(v) v.begin(), v.end()
#define dcout cout << fixed << setprecision(15)
#define arep(i, a) for(auto i : a)
#define F first
#define S second
#define VE vector<int>
#define pb(x) push_back(x)
#define MOD 1000000007
#define INF 10000000000
const double EPS = 1e-10;
#define int unsigned long long
#define KETA(n) floor(log10(n) + 1)
using namespace std;
signed main() {
    double d;
    int i;
    cin >> i >> d;
    int a = d * 100 + EPS;
    cout << i * a / 100;
    return 0;
}

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

#define ll long long
#define INF 1<<31-1
#define LNF 9223372036854775807
#define PI 3.14159265358979
#define MIN(x,y) ((x)<(y)?(x):(y))
#define MAX(x,y) ((x)<(y)?(y):(x))
#define FOR(i,a,n) for(i=a;i<n;i++)
#define MOD 1000000007
//#define MOD 998244353
#define NUM 200010
 
void swap(int* a,int* b){int tmp=*a;*a=*b;*b=tmp;}
int abs(int a){if(a<0)return -a;return a;}
int dup(int a,int d){if(a%d==0)return a/d;else return a/d+1;}
int mod(int a,int m){if(a<0)return a%m+m;else return a%m;}

void swapl(ll* a,ll* b){ll tmp=*a;*a=*b;*b=tmp;}
ll absl(ll a){if(a<0)return -a;return a;}
ll dupl(ll a,ll d){if(a%d==0)return a/d;else return a/d+1;}
ll modl(ll a,ll m){if(a<0)return a%m+m;else return a%m;}

ll GCD(ll a,ll b){ll c=1,tmp=MAX(a,b);b=MIN(a,b);a=tmp;while(c!=0){c=a%b;a=b;b=c;}return a;}
ll LCM(ll a,ll b){return a*b/GCD(a,b);}

ll factorial(ll n, ll m) {return n < m ? 1 : n*factorial(n-1, m);}

int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}

int main(){
  ll X,Y,Z;
  

  scanf("%lld%lld%lld", &X, &Y, &Z);

  
    printf("%lld %lld %lld\n", Z, X, Y);
  
  
  return 0;
}

Measured memory_bytes: 128
#![allow(unused_mut)]
#![allow(non_snake_case)]
#![allow(unused_variables)]
#![allow(unused_imports)]
#![allow(dead_code)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
        N: usize,
        L: [f64; N],
    }
    let max = L.iter().fold(0.0/0.0, |m, v| v.max(m));
    let sum = L.iter().fold(0.0, |s, i| s + i);
    println!("{}", if sum - max > max {"Yes"} else {"No"});
}



Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> vvl;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvec;
typedef vector<vector<bool>> vveb;
typedef vector<vector<string>> vves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pb push_back
#define pp pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
typedef long long int64;
//const int64 INF = 1LL << 58;
#define dame { puts("-1"); return 0;}
#define YES { cout << "YES" << endl; return 0; }
#define NO { cout << "NO" << endl; return 0; }
#define Yes { cout << "Yes" << endl; return 0; }
#define No { cout << "No" << endl; return 0; }
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 (a>b) { a=b; return 1; } return 0; }
int dx[] = {0, 0, -1, 1};
int dy[] = {1, -1, 0, 0};

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
 
    ll n;
    cin >> n;
    vl a(n);
    vl b(61);
    vl c(61);
    rep(i,n){
        cin >> a[i];
        rep(j,61){
            ll t = (a[i] >> j);
            if(t&1) c[j]++;
        }
    }

    ll ans=0;
    rep(i,61){
        ll tmp = (1ll << i) % mod;
        b[i] = c[i] * (n-c[i])%mod;
        ans = (ans + b[i] *tmp) % mod ;
    }
 
    cout << ans <<endl;
    return 0;
}

Measured memory_bytes: 2560
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <cmath>
#include <set>
using namespace std;

#define REP(i,n) for(int i = 0; i < (int)(n); i++)

int main() {
  int N; cin >> N;
  set<int> s;
  REP(i,N) {
    int v; cin >> v;
    s.insert(v);
  }
  cout << s.size() << endl;
  return 0;
}


Measured memory_bytes: 256
# r:グー, s:チョキ, p:パー
N, K = map(int, input().split())
RSP = list(map(int, input().split()))
T = list(input())
win_hand = {'r': 2, 's': 0, 'p': 1}

score = 0
hands = []
for i in range(N):
  if len(hands) < K or hands[-K] != win_hand[T[i]]:
    score += RSP[win_hand[T[i]]]
    hands += [win_hand[T[i]]]
  else:
    hands += [""]
  
print(score)

Measured memory_bytes: 51596
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <queue>
#include <set>
#include <stack>
#include <map>
#include <unordered_map>
#include <cmath>
#include <utility> // pair make_pair
#include <algorithm>
#include <functional>
#include <iomanip>
#include <climits> // LLONG_MAX, LLONG_MIN, INT_MIN, INT_MAX
#include <assert.h>

#define m0(x) memset(x,0,sizeof(x))
#define m1(x) memset(x,63,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))
#define ll long long
#define int ll
#define INF INT_MAX/10
#define MOD 1000000007

using namespace std;
using Pi = pair<int, int>;
using Graph = vector<vector<int> >;
using WeightGraph = vector<vector<Pi> >;

int Input[100100];

signed main() {
  int r, D, x; cin >> r >> D >> x;
  for (int i = 1; i <= 10; i++) {
    x = r * x - D;
    cout << x << endl;
  }
}


Measured memory_bytes: 256
import sys
from itertools import product,combinations
from functools import reduce,lru_cache
import heapq

def vfunc(f): return lambda *lst, **kwargs: list(map(lambda *x:f(*x,**kwargs),*lst))

def rvfunc(f): return lambda *lst, **kwargs: list(map(lambda *x:rvfunc(f)(*x,**kwargs) if all(vfunc(lambda y:isinstance(y,list))(x)) else f(*x,**kwargs),*lst))

def reader():return vfunc(lambda l:l.split())(sys.stdin.readlines())

x,k,d=vfunc(int)(reader()[0])

x=abs(x)
if d*k<x:print(x-d*k)
else:
    k0 = int(x/d)+1
    x0 = abs(x-d*k0)
    print(x0 if (k-k0)%2==0 else (d-x0))


Measured memory_bytes: 67008
n,m=map(int,raw_input().split())
d=[input() for _ in xrange(n)]
c=[input() for _ in xrange(m)]
dp=[[float('inf')]*(m+1) for _ in xrange(n+1)]
for i in xrange(m+1):
    dp[0][i]=0
for i in xrange(n):
    for j in xrange(m):
        dp[i+1][j+1]=min(min(dp[i+1]),dp[i][j]+d[i]*c[j])
print(dp[n][m])

Measured memory_bytes: 17808
#define ll long long
#define ull unsigned long long
#define pb push_back
#define mp make_pair
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int isprime(int n){
    int count =0;
    for(int i=2;i<=sqrt(n);i++)
    if(n%i==0)count++;
    if(count)return 0;
    return 1;
}
int main()
{
    int n;
    cin>>n;
    int ac=0,wa=0,tle=0,re=0;
    string s;
    for(int i=0;i<n;i++){
        cin>>s;
        if(s=="AC")ac++;
        if(s=="WA")wa++;
        if(s=="TLE")tle++;
        if(s=="RE")re++;
    }
    cout<<"AC x "<<ac<<endl;
    cout<<"WA x "<<wa<<endl;
    cout<<"TLE x "<<tle<<endl;
    cout<<"RE x "<<re<<endl;
    return 0;
}


Measured memory_bytes: 3620
// ref. https://img.atcoder.jp/arc091/editorial.pdf

#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <unordered_map>
#include <vector>
#include <string.h>
#include <set>

using namespace std;

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

template<class T> void printvec(const vector<T>& v) {
  for (auto x : v) { cout << x << " "; }
  cout << endl;
}
template<class T> void printtree(const vector< vector<T> >& tree) {
  for (long long i = 0; i < tree.size(); ++i) {
    cout << i + 1 << ": "; printvec(tree[i]);
  }
}
template<class T, class U> void printmap(const map<T, U>& mp) {
  for (auto x : mp) { cout << x.first << "=>" << x.second << endl; }
}

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

#define rep(i, n) for(ll i = 0; i < n; ++i)
#define all(s) s.begin(), s.end()
#define fr first
#define sc second
#define mp make_pair
#define pb push_back

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> triple;
typedef double D;

const ll INF = 1e9;
const ll MOD = 1000000007;  // 1e9 + 7

int main(int argc, char** argv) {
  cin.tie(NULL);
  cout.tie(NULL);
  ios_base::sync_with_stdio(false);
  //cout << setprecision(10) << fixed;

  ll n, a, b;
  cin >> n >> a >> b;

  if (a+b-1 <= n && n <= a*b) { // ok
    vector<ll> ans;
    for (int i = b; i >= 1; --i) { ans.push_back(i); }

    ll cur = b+1; // current value
    // Here, we print additional b-1 in each step.
    ll remain = n-b-(a-1);
    rep(iter, a-1) {
      ll now = min(remain, b-1);
      remain -= now;
      for (int i = cur+now; i >= cur; --i) { ans.push_back(i); }
      cur += now + 1;
    }

    rep(i, n) {
      cout << ans[i];
      if (i < n-1) { cout << " "; }
    }
    cout << endl;
  } else {
    cout << -1 << endl;
  }
}


Measured memory_bytes: 6512
#include <iostream>

using namespace std;

int main()
{
	while (1){
		int a, b, c, n, r[310], data[4][1000] = {};
		for (int i = 0; i < 310; i++){
			r[i] = 2;
		}
		cin >> a >> b >> c;
		if (a == 0 && b == 0 && c == 0) return 0;
		cin >> n;
		for (int i = 0; i < n; i++){
			for (int j = 0; j < 4; j++){
				cin >> data[j][i];
			}
			if (data[3][i] == 1){
				for (int k = 0; k < 3; k++) r[data[k][i] - 1] = 1;
			}
		}
		
		for (int i = 0; i < n; i++){
			if (data[3][i] == 0){
				int cou = 0;
				for (int j = 0; j < 3; j++){
					if (r[data[j][i] - 1] == 1) cou++;
				}
				if (cou == 2){
					for (int j = 0; j < 3; j++){
						if (r[data[j][i] - 1] != 1) r[data[j][i] - 1] = 0;
					}
				}
			}
		}

		for (int i = 0; i < a + b + c; i++) cout << r[i] << endl;
	}
}		

Measured memory_bytes: 3084
#include<bits/stdc++.h>
using namespace std;
/*
дружочек, ты видимо не понял с кем общаешься.
вот эта манера речи "клоунская" меня не впечатляет.
давай встретимся и я объясню на понятном тебе языке - языке боли.
*/
int main(){
char c;
cin >> c;
if(c=='A') cout << "T";
if(c=='T') cout << "A";
if(c=='G') cout << "C";
if(c=='C') cout << "G";





}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fastio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long
#define pii make_pair
int ceil(int a, int b) { if(a%b==0) return a/b; else return a/b+1; }

main()
{
    int n, x, ans=0;
    map<int, int>mp;
    cin>>n;
    for(int i=0; i<n; i++) {
        cin>>x;
        mp[x]++;
    }
    for(auto i=mp.begin(); i!=mp.end(); i++) {
        if(i->first<i->second) ans+=i->second-i->first;
        else if(i->first>i->second) ans+=i->second;
    }
    cout<<ans;
}


Measured memory_bytes: 9524
//fifer a tak luboin
#include <iostream>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cassert>
#include <ctime>
#include <sstream>
#include <algorithm>
#include <functional>
#include <numeric>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <unordered_map>
#include <map>
#include <set>
 
#define ll long long
#define mp make_pair
#define pb push_back
#define s second
#define f first
#define endl "\n"
 
using namespace std; 
 
const ll inf = 1e14;
const int mod = 998244353;
const int N = (int)100100;
const double eps = 1e-10;                                     
const double pi = acos(-1.0);
int days[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

int main() { 
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); 
    //freopen("bacon.in", "r", stdin);
    //freopen("bacon.out", "w", stdout);
    int n, m;
    cin >> n >> m;
    int cnt = 0;
    for (int i = 1; i <= n; i++) {
        int x;
        cin >> x;
        if (x >= m) cnt++;
    }
    cout << cnt << endl;

    return 0;    
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#define MOD1 1000000007
#define MOD2 998244353
#define LIMIT1 200002
#define LIMIT2 500002
typedef long long ll;
typedef long double ld;
typedef const void cv;
#define rep(i,n) for((i)=0;(i)<(n);(i)++)
#define per(i,n) for((i)=(n)-1;(i)>=0;(i)--)
#define max(a,b) ((a)>(b) ? (a) : (b))
#define min(a,b) ((a)<(b) ? (a) : (b))
#define zt(a,b) (max((a),(b))-min((a),(b)))
#define absl(v) labs((v))
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll nPr(int n,int r){ll i,result=1;rep(i,r){result*=(ll)(n-i);}return result;}
ll nCr(int n,int r){ll i,result=1;if(n<r) return 0;rep(i,min(r,n-r)){result*=(ll)(n-i);result/=(ll)(i+1);}return result;}
#define nHr(n,r) nCr((int)((n)+(r)+1),(int)(r))
#define sankaku(x) (((x)*((x)+1))/2)
int dx[8]={1,0,-1,0,1,-1,-1,1},dy[8]={0,1,0,-1,1,1,-1,-1};
int upint(cv *a, cv *b) { return *(int *)a < *(int *)b ? -1 : *(int *)a > *(int *)b ? 1 : 0; }
int downint(cv *a, cv *b) { return *(int *)a < *(int *)b ? 1 : *(int *)a > *(int *)b ? -1 : 0; }
int upchar(cv *left, cv *right) {return strcmp((char *)left,(char *)right);}
int downchar(cv *left, cv *right) {return strcmp((char *)right,(char *)left);}
void tmpInit(int *c,ll m) {ll i;rep(i,m) c[i]=i;}
ll modpow(ll a, ll n, ll mod) {
    ll res = 1;
    while (n > 0) {
        if (n & 1){
            res *= a; if(mod>=1) res %= mod;
        }
        a *= a; if(mod>=1) a %= mod;
        n >>= 1;
    }
    return res;
}
void initialize(){
    
}
int x[LIMIT2]={0},d[LIMIT1]={0};
int tmp(cv *p,cv *q){
  int n=x[*(int *)p]-x[*(int *)q];
  if(n!=0) return n;
  else return d[*(int *)p]-d[*(int *)q];
}
std::vector<int> t[LIMIT1];
ll dfs(int v){
  ll res=1;
  for(int u : t[v]){
    res *= dfs(u);
    res %= MOD2;
  }
  return res+1;
}
int main(void){
  initialize();
  ll n,m,i,j,k,result=0;
  int c[LIMIT1];
  std::set<std::pair<int,int>> s;
  
  scanf("%lld",&n);
  rep(i,n) scanf("%d %d",&x[i],&d[i]);
  tmpInit(c,n);
  qsort(c,n,sizeof(int),tmp);
  
  per(i,n){
    while(!s.empty() && s.begin()->first < x[c[i]]+d[c[i]]){
      t[i].push_back(s.begin()->second);
      s.erase(s.begin());
    }
    s.emplace(x[c[i]],i);
  }
  
  result=1;
  for(auto x : s){
    int v = x.second;
    result *= dfs(v);
    result %= MOD2;
  }
  printf("%lld",result);
  return 0;
}



Measured memory_bytes: 22900
//in the name of allah
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1e5+10;
int ps[N] , a[N];

int main(){
	int n;
	scanf("%d" , &n);
	for(int i=0 ; i<n ; i++){		
		scanf("%d" , &a[i]);
		ps[i] = a[i];
		if(i)
			ps[i] += ps[i-1];
	}
	ll ans[2] = {0 , 0};
	ll l[2] = {0 , 0};
	for(int i=0 ; i<n ; i++){
			int d = (i&1);
			for(int j=0 ; j<2 ; j++)
				if(j ^ d){
					int cur = l[j] + ps[i];
					if(cur <= 0){
						ans[j] += 1 - cur;
						l[j] += 1-cur;
					}						
				}else{
					int cur = l[j] + ps[i];
					if(cur >= 0){						
						ans[j] += cur + 1;
						l[j] -= cur+1;
					}					
				}				
	}
	printf("%lld" , min(ans[0] , ans[1]));
}

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

int main(void)
{
	int W, H;
	int x, y, r;

	cin >> W >> H >> x >> y >> r;
	if (x-r >= 0 &&  x+r <= W && y-r >= 0 && y+r <= H)
	{
		cout << "Yes" << endl;
	}
	else
	{
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 3096
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <string>
#include <queue>
#include <numeric>
#include <ctype.h>
#include <limits>
#include <iomanip>

#define rep(i,n) for (int i = 0; i < n; i++)
#define all(x) (x).begin(),(x).end()
using namespace std;

typedef long long ll;

int main()
{
	/*int ans, x;
	rep(i, 5) {
		cin >> x;
		if (x == 0)ans = i + 1;
	}
	cout << ans;*/


	int x, y;
	cin >> x >> y;
	rep(i, x + 1) {
		int j = x - i;
		if (i * 2 + j * 4 == y) {
			puts("Yes");
			return 0;
		}
	}
	puts("No");
	return 0;
}

Measured memory_bytes: 3672
import java.util.*; import java.io.*; import java.math.*;
public class Main{
	static void solve(){//Here is the main function
		int N = nextInt();
		ArrayList<Integer> list = nextIntArray();
		list.add(0);
		int min = 24;
		Collections.sort(list);
		for(int i = 1; i <= N; i += 2){
			list.set(i, 24 - list.get(i));
		}
		Collections.sort(list);
		for(int i = 1; i <= N; i++){
			min = Math.min(min, list.get(i) - list.get(i - 1));
		}
		min = Math.min(min, 24 - list.get(N));
		myout(min);
	}
	//Method addition frame start



	//Method addition frame end

	//Don't have to see. start------------------------------------------
	static class InputIterator{
		ArrayList<String> inputLine = new ArrayList<>(1024);
		int index = 0; int max; String read;
		InputIterator(){
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			try{
				while((read = br.readLine()) != null){
					inputLine.add(read);
				}
			}catch(IOException e){}
			max = inputLine.size();
		}
		boolean hasNext(){return (index < max);}
		String next(){
			if(hasNext()){
				return inputLine.get(index++);
			}else{
				throw new IndexOutOfBoundsException("There is no more input");
			}
		}
	}
	static HashMap<Integer, String> CONVSTR = new HashMap<>();
	static InputIterator ii = new InputIterator();//This class cannot be used in reactive problem.
	static PrintWriter out = new PrintWriter(System.out);
	static void flush(){out.flush();}
	static void myout(Object t){out.println(t);}
	static void myerr(Object t){System.err.print("debug:");System.err.println(t);}
	static String next(){return ii.next();}
	static boolean hasNext(){return ii.hasNext();}
	static int nextInt(){return Integer.parseInt(next());}
	static long nextLong(){return Long.parseLong(next());}
	static double nextDouble(){return Double.parseDouble(next());}
	static ArrayList<String> nextStrArray(){return myconv(next(), 8);}
	static ArrayList<String> nextCharArray(){return myconv(next(), 0);}
	static ArrayList<Integer> nextIntArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Integer> ret = new ArrayList<>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Integer.parseInt(input.get(i)));
		}
		return ret;
	}
	static ArrayList<Long> nextLongArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Long> ret = new ArrayList<>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Long.parseLong(input.get(i)));
		}
		return ret;
	}
	static String myconv(Object list, int no){//only join
		String joinString = CONVSTR.get(no);
		if(list instanceof String[]){
			return String.join(joinString, (String[])list);
		}else if(list instanceof ArrayList){
			return String.join(joinString, (ArrayList)list);
		}else{
			throw new ClassCastException("Don't join");
		}
	}
	static ArrayList<String> myconv(String str, int no){//only split
		String splitString = CONVSTR.get(no);
		return new ArrayList<String>(Arrays.asList(str.split(splitString)));
	}
	public static void main(String[] args){
		CONVSTR.put(8, " "); CONVSTR.put(9, "\n"); CONVSTR.put(0, "");
		solve();flush();
	}
	//Don't have to see. end------------------------------------------
}


Measured memory_bytes: 32932
import sys
input=sys.stdin.readline
from collections import deque

def check(l0,l1,l2):
    return (l2[1]-l1[1])*(l1[0]-l0[0])>=(l1[1]-l0[1])*(l2[0]-l1[0])
def f(l,x):
    return l[0]*x+l[1]
def add_line(a,b):
    while len(deq)>=2 and check(deq[-2],deq[-1],(a,b)):
        deq.pop()
    deq.append((a,b))
def query(x):
    while len(deq)>=2 and f(deq[0],x)>=f(deq[1],x):
        deq.popleft()
    return f(deq[0],x)

n,c=map(int,input().split())
H=list(map(int,input().split()))
DP=[0]*n
deq=deque()
add_line(-2*H[0],H[0]**2+DP[0])
for i in range(1,n):
    DP[i]=query(H[i])+H[i]**2+c
    add_line(-2*H[i],H[i]**2+DP[i])
print(DP[-1])

Measured memory_bytes: 77772
n = gets.to_i
a = gets.chomp.split.map(&:to_i)

n.times do |i|
  a[i] -= i + 1
end
a.sort!

b = [a[n / 2]]
res = []
if n % 2 == 0
  b << a[n / 2 - 1]
end
puts b.map {|x| a.inject(0) {|acc, y| acc + (y - x).abs } }.min

Measured memory_bytes: 31408
#include<iostream>
#include<string>
#include<vector>
#include<numeric>
#include<math.h>
#include<algorithm>
#include<iomanip>
#include<bitset>
#include<list>
using namespace std;

int main() {

	int R;
	cin >> R;

	if (R < 1200) {
		cout << "ABC" << endl;
	}
	else if (2800 <= R) {
		cout << "AGC" << endl;
	}
	else {
		cout << "ARC" << endl;
	}

	return 0;
}


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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"
#define PI 3.14159265358979
#define MOD 1000000007 // = 10^9 + 7

using namespace std;
using ll = long long;

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

	deque<int> now = { 1 };
	for(int i = 1; i < n; ++i)
	{
		if (s[i - 1] == s[i]) now.back()++;
		else now.push_back(1);
	}

	while(k--)
	{
		if (now.size() == 1) break;
		if (now.size() == 2)
		{
			int v = now.front() + now.back();
			now.pop_front();
			now.pop_front();
			now.push_front(v);
			break;
		}

		int val = 0;
		val += now.front(); now.pop_front();
		val += now.front(); now.pop_front();
		val += now.front(); now.pop_front();
		now.push_front(val);
	}

	int ans = 0;
	while(!now.empty())
	{
		ans += now.front() - 1;
		now.pop_front();		
	}
	cout << ans;



}

int main()
{
	fastio;
	solve();

	return 0;
}

Measured memory_bytes: 3792
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <deque>
#include <utility>
using namespace std;


void solve(long long N, std::vector<long long> A){
    deque<int> q;
    sort(A.begin(), A.end());
    for(auto a:A)q.push_back(a);
    vector<pair<int, int>> steps;

    int ll = *q.begin(), rr = *q.rbegin();
    int ans = rr-ll; // max-min, >=0
    q.pop_back();
    q.pop_front();

    while(!q.empty()){
        int l = abs(*q.begin()), r = abs(*q.rbegin());
        if(l >= r){

            steps.emplace_back(make_pair(ans, *q.begin()));
            ans += l;
            q.pop_front();
        }else{

            steps.emplace_back(make_pair(ans, *q.rbegin()));
            ans += r;
            q.pop_back();
        }
    }

    cout << ans << endl;
    bool is_pos = true;


    vector<pair<int, int>> pros;
    for(auto it=steps.rbegin(); it<steps.rend(); it++){
        auto ans_ = (*it).first;
        auto b = (*it).second;
        if(is_pos && b>0)pros.emplace_back(make_pair(b, -ans_));
        if(is_pos && b<=0)pros.emplace_back(make_pair(ans_, b));
        if(!is_pos && b>0)pros.emplace_back(make_pair(-ans_, b));
        if(!is_pos && b<=0)pros.emplace_back(make_pair(b, ans_));
        is_pos = b<=0;
    }

    if(is_pos)pros.emplace_back(make_pair(rr, ll));
    else pros.emplace_back(make_pair(ll, rr));

    for(auto it=pros.rbegin(); it<pros.rend(); it++)
        cout << (*it).first << " " << (*it).second << endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> A(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&A[i]);
    }
    solve(N, std::move(A));
    return 0;
}


Measured memory_bytes: 5368
#include<bits/stdc++.h>
using namespace std;
int main()
{

    int k,l,a,b;
    cin>>k;
    cin>>l;

    map<int,int>s;
    for(int i = 0; i < l; i++)
    {
        cin>>a>>b;
        s[a]++;
        s[b]++;


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





Measured memory_bytes: 256