akhauriyash/Code-Regression huggingface dataset:
#include "iostream"
#include "algorithm"
#include "string"
#include "vector"
#include "cmath"
#include "bitset"
#include "queue"
#include "functional"
#include "map"
#include "unordered_map"
#include "set"
#include "stack"

#define lp(n) for (int i = 0; i < n; i++)
#define LP(n,i) for (int i = 0; i < n; i++)
#define mod 1000000007
#define sp ' '
#define intmax 2147483647
#define llmax 9223372036854775807
#define nyan "(=^･ω･^=)"
#define mkp make_pair
typedef long long ll;
using namespace std;

int n;
ll c, x[100000], v[100000], ans;
pair<ll, ll>r[100000], l[100000];

int main() {
	cin >> n >> c;
	lp(n)
		cin >> x[i] >> v[i];
	r[0] = mkp(v[0] - x[0], max(ll(0), v[0] - x[0]));
	lp(n - 1)
		r[i + 1] = mkp(r[i].first + v[i + 1] + x[i] - x[i + 1], max(r[i].second, r[i].first + v[i + 1] + x[i] - x[i + 1]));
	l[0] = mkp(v[n - 1] - (c - x[n - 1]), max(ll(0), v[n - 1] - (c - x[n - 1])));
	lp(n - 1)
		l[i + 1] = mkp(l[i].first + v[n - i - 2] + x[n - i - 2] - x[n - i - 1], max(l[i].second, l[i].first + v[n - i - 2] + x[n - i - 2] - x[n - i - 1]));
	ans = max(r[n - 1].second, l[n - 1].second);
	lp(n - 1)
		ans = max(ans, r[i].first - x[i] + l[n - i - 2].second);
	lp(n - 1)
		ans = max(ans, l[i].first - (c - x[n - i - 1]) + r[n - i - 2].second);
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 4992
#include <stdio.h> 
#include <algorithm>

#define BUF 100005

int N;
long A[BUF];

void input(void){
	scanf("%d",&N);
	int i=0;
	for(i=0;i<N;i++){
		scanf("%ld",A+i);
	}
}



int main(void){
	int count=1,ptr=0,ans=0;
	input();	
	std::sort(A,A+N);
	while(ptr<N){
		int cn=A[ptr],f=0;
		while(cn==A[ptr]&&ptr<N){
			f++;
			ptr++;
		}
		ans+=f%2;
	}
	printf("%d\r\n",ans);
	return 0;
}

Measured memory_bytes: 1280
H,W,K=map(int, input().split())
C = [ "" for _ in range(H) ]
cx = [ 0 for _ in range(H) ]
cy = [ 0 for _ in range(W) ]
for i in range(H):
  C[i] = input()
  for j in range(W):
    if C[i][j] == "#":
      cx[i] |= 1 << j
ans = 0
for y in range( 1<<H ):
  for x in range( 1<<W ):
    total = 0
    for i in range(H):
      if ( (y & (1<<i)) != 0 ):
        for j in range(W):
          if ((cx[i] & x) & (1<<j)) != 0:
            total += 1
    if total == K:
      ans += 1
print(ans)



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

using namespace std;

int n, m, q;
int cat[11][11][11];

int v[11];

int mx, sum;

void bkt(int k)
{
    if(k == n + 1)
    {
        mx = max(mx, sum);
        return;;
    }

    for(int i = v[k - 1]; i <= m; i ++)
    {
        v[k] = i;
        int ant = sum;

        for(int j = 1; j < k; j ++)
            sum += cat[j][k][i - v[j]];

        bkt(k + 1);

        sum = ant;

    }
}

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

    for(int i = 1; i <= q; i ++)
    {
        int a, b, c, d;
        cin >> a >> b >> c >> d;

        cat[a][b][c] += d;

    }

    v[1] = 1;

    bkt(2);

    cout << mx << "\n";

    return 0;
}


Measured memory_bytes: 3484
#include<iostream>
#include<string>
#include<algorithm>
#include <string.h>
#include <stdio.h>
#include <math.h>
#include <set>
#include <queue>
#include <stack>
#include <map>

using namespace std;
typedef int status;
typedef long long ll;
typedef unsigned long long ull;
const ull base = 343;
const int INF = int(1e9);
const int MAX = 200002;

int bai = 0,hei = 0;
int H,W;
 char Map[100][100];
struct S{
    int x,y;
    int n;
};

int fanx[] = {0,0,1,-1};
int fany[] = {1,-1,0,0};

int bfs(int x,int y)
{
    S temp;
    int vis[100][100] = {0};
    temp.x = x,temp.y = y,temp.n = 0;
    queue<S> Q;
    Q.push(temp);

    while(!Q.empty()){
        temp = Q.front();
        Q.pop();
        if(temp.x == H&&temp.y == W){
            return temp.n;
        }

        for(int i = 0;i < 4;i++){
                S temp2;
                temp2.x = temp.x + fanx[i];
                temp2.y = temp.y + fany[i];
                temp2.n = temp.n + 1;
                if(temp2.x<1||temp2.x>H||temp2.y<1||temp2.y>W||vis[temp2.x][temp2.y]==1||Map[temp2.x][temp2.y]=='#')continue;
                Q.push(temp2);
                vis[temp2.x][temp2.y] = 1;
        }
    }
    return -1;
}

int main()
{

    cin>>H>>W;
   
    for(int i = 1;i<=H;i++){
        for(int j = 1;j<=W;j++){
            cin>>Map[i][j];
            if(Map[i][j]=='#') hei++;
            else bai++;
        }
    }

    int temp = bfs(1,1);
    if(temp==-1)cout<<-1<<endl;
    else
    cout<<bai - (temp+1)<<endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <set>
#include <vector>
#include <string>
#include <algorithm>
#include <iterator>

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
#define repi(i, n) for(auto i = (n).begin(); i != (n).end(); i++)
#define in_arr(type, a, n) copy_n(istream_iterator<type>(cin), n, (a).begin());

using ll = long long int;

int main(){
    int n;
    string s;
    cin >> n >> s;
    int ret = 0;
    for(int i = 0; i < 1000; ++i) {
        vector<int> v = {i % 10, (i / 10) % 10, i / 100};
        int now = 0;
        for(string::iterator j = s.begin(); j != s.end(); ++j) {
            if(v[now] == *j - '0') {
                now++;
                if(now >= 3) {
                    ret++;
                    break;
                }
            }
        }
    }
    cout << ret << endl;
    return 0;
}


Measured memory_bytes: 256
while True:
    n,x=map(int,input().split())

    if n==0 and x==0:
        break
    
    a = 0
    
    for i in range(1,n+1):
        for j in range(1,i):
            for k in range(1,j):
                if i+j+k == x:
                    a+=1
    print(a)                


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

int main(void){
    
    ll n;
    ll a[200009]={};
    int b;
    
    cin >> n;
    
    for(ll i=2; i<=n; i++){
        
        cin >> b;
        a[b] += 1;
        
    }
    
    for(ll i=1; i<=n; i++){
        
        cout << a[i] << endl;
        
    }
    
    return 0;
    
}

Measured memory_bytes: 5184
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define all(x) x.begin(),x.end()
#define rep(i,j,n) for (long long i = j; i < (long long)(n); i++)
#define _GLIBCXX_DEBUG
const ll MOD = 1000000007;
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; }
//(a+b-1)/b
//priority_queue<ll, vector<ll>, greater<ll>> q;


signed main(){
	//cout << fixed << setprecision(10);
	string s; cin>>s;
	int n=s.size();
	ll ans=0;
	ll cnt=0;
	rep(i,0,n){
		if(s[i]=='R')cnt++;
		else{
			chmax(ans,cnt);
			cnt=0;
		}
	}
	chmax(ans,cnt);
	cout <<ans<<endl;

	return 0;
}

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

#if MYDEBUG
#include "lib/cp_debug.hpp"
#else
#define DBG(...) ;
#endif
#if __cplusplus <= 201402L
template <typename T>
T gcd(T a, T b) { return ((a % b == 0) ? b : gcd(b, a % b)); }
template <typename T>
T lcm(T a, T b) { return a / gcd(a, b) * b; }
#endif
using LL = long long;
constexpr LL LINF = 334ll << 53;
constexpr int INF = 15 << 26;
constexpr LL MOD = 1E9 + 7;

namespace Problem {
using namespace std;

class Solver {
 public:
  int n;
  vector<int> a;
  Solver(LL n) : n(n), a(n){};

  void solve() {
    vector<int> cnt(n), ans;
    vector<vector<int>> memo(n);
    set<int> rem;
    for (int i = 0; i < n; ++i) {
      cin >> a[i];
      a[i]--;
      cnt[a[i]]++;
      rem.insert(i);
    }
    for (int i = 0; i < n; ++i) {
      memo[cnt[i]].push_back(i);
    }
    for (int i = 0; i < n; ++i) {
      int nxt = -1;
      for (auto p : memo[n - i - 1]) {
        if (cnt[p] == n - i - 1) {
          //assert(nxt == -1);
          nxt = p;
        } else if (cnt[p] > 0) {
          memo[cnt[p]].push_back(p);
        }
      }
      if (nxt != -1) {
        ans.push_back(nxt);
        cnt[a[nxt]]--;
        cnt[nxt] = -1;
        rem.erase(nxt);
      } else {
        if (i == n - 3) {
          set<int> rem2(rem);
          if (ans.size() > 0) {
            rem2.erase(a[ans.back()]);
          }
          DBG(rem, rem2)
          vector<int> tmp;
          for (auto x : rem) {
            tmp.push_back(x);
          }
          sort(tmp.begin(), tmp.end());
          for (int i = 0; i < 3; ++i) {
            vector<int> pr;
            for (int j = 0; j < 3; ++j) {
              if (j == i) continue;
              pr.push_back(tmp[j]);
            }
            if (a[pr[0]] == pr[1] && a[pr[1]] == pr[0]) {
              if (rem2.count(tmp[i])) rem2.erase(tmp[i]);
            }
          }
          int nxt = *rem2.begin();
          ans.push_back(nxt);
          cnt[a[nxt]]--;
          cnt[nxt] = -1;
          rem.erase(nxt);
          continue;
        }
        auto it = rem.begin();
        if (ans.size() > 0 && *it == a[ans.back()])
          it++;
        if (it == rem.end()) {
          cout << -1 << endl;
          return;
        }
        int tmp = *it;
        ans.push_back(tmp);
        cnt[a[tmp]]--;
        cnt[tmp] = -1;
        rem.erase(tmp);
      }
    }

    for (int i = 0; i < n; ++i) {
      cout << ans[i] + 1 << ' ';
    }
    cout << endl;
  }
};

}  // namespace Problem

int main() {
  std::cin.tie(0);
  std::ios_base::sync_with_stdio(false);
  // std::cout << std::fixed << std::setprecision(12);
  long long n = 0;
  std::cin >> n;

  Problem::Solver sol(n);
  sol.solve();
  return 0;
}


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

int main(){
	int W,H,x,y,r;
	cin >> W;
	cin >> H;
	cin >> x;
	cin >> y;
	cin >> r;
	int min_x, min_y, max_x, max_y;
	min_x = r;
	min_y = r;
	max_x = W - r;
	max_y = H - r;

	if (min_x<=x&& x<=max_x && min_y <= y && y<=max_y) cout<<"Yes\n";
	else cout << "No\n";
	return 0;
}

Measured memory_bytes: 1124
#include<bits/stdc++.h>
using namespace std;
const int MOD = 1e9+7;
const int N = 1e5+5;
vector<int> g[N];
long long dp[3][N];
long long dfs(int u,int state,int p){
    if(dp[state][u]!=-1)    return dp[state][u];
    long long sum = 1;
    for(auto x : g[u]){
        if(x == p)  continue;
        if(state == 0)  sum = (sum * (dfs(x,0,u)+dfs(x,1,u)))%MOD;
        else            sum = (sum * dfs(x,0,u))%MOD;
    }
    return dp[state][u] = sum;
}
int main(){
    int n;
    scanf("%d",&n);
    for(int i=1;i<n;i++){
        int u,v;
        scanf("%d %d",&u,&v);
        g[u].push_back(v);
        g[v].push_back(u);
    }
    memset(dp,-1,sizeof dp);
    printf("%lld\n",(dfs(1,0,0)+dfs(1,1,0))%MOD);
    return 0;
}


Measured memory_bytes: 16384
import java.util.*;
public class Main{
	public static void main(String[] args)
	{
		 Scanner sc=new Scanner(System.in);
		 int i=sc.nextInt();
		 int j=sc.nextInt();
		 int arr[]=new int[j];
		 List li1=new ArrayList();
		 if(j==0)
		 {
			 System.out.println(i);
			 return;
		 }
		 for(int k=0;k<j;k++)
		 {
			 arr[k]=sc.nextInt();
			 li1.add(arr[k]);
		 }
		 if(!li1.contains(i))
		 {
			 System.out.println(i);
			 return;
		 }
		
		 for(int k=0;k<=j;k++)
		 {
			if((li1.contains(i+k))&&(li1.contains(i-k)))
			 { 
				 continue;
			 }
           
			 if(!li1.contains(i-k))
			 {
				 System.out.println(i-k);
                 break;
				 
			 }
			 if(!li1.contains(i+k))
			 {
				 System.out.println(i+k);
                 break;
				 
			 }	 
		 }
		 
		 
	}
 
}

Measured memory_bytes: 36172
n, k = map(int, input().split())
hs = []
for i in range(n):
    hs.append(int(input()))

hs.sort()

value_list = []

for i in range(len(hs)):
    try:
        value_list.append(hs[i+k-1] - hs[i])
    except:
        break

print(min(value_list))

Measured memory_bytes: 11288
import sys
#K=100000
K=int(input())

if K<=9:
    print(K)
    sys.exit(0)

LS=[0]*11
LS[1]=[1,1,1,1,1,1,1,1,1,1]
LS2=[]
for i in range(2,11):
    LS[i]=[0]*10
    for j in range(0,10):
        for k in range(max(j-1,0),min(j+2,10)):
            LS[i][j]+=LS[i-1][k]
for i in range(1,11):
    for j in range(1,10):
        LS2+=[LS[i][j]]
#print(LS)
#print(LS2)
ans=""
total=0
keta=0
first=0
bktotal=0
for i in range(90):
    bktotal=total
    total+=LS2[i]
    if K<=total:
        ans+=str((i%9)+1)
        keta=(i//9)+1
        first=(i%9)+1
        K-=bktotal
        break
#print(keta)
#print(first)
#print(K)
while keta>1:
    backtotal=0
    total=0
    for i in range(max(0,first-1),min(10,first+2)):
        backtotal=total
        total+=LS[keta-1][i]
        if total>=K:
            ans+=str(i)
            first=i
            K-=backtotal
            break
    keta-=1
print(ans)

# lun=[]
# for i in range(1,10000):
#     s=str(i)
#     L=len(s)
#     islun=True
#     for j in range(L-1):
#         if abs(int(s[j])-int(s[j+1]))>1:
#             islun=False
#             break
#     if islun:
#         lun+=[i]
# print(lun)
# print(len(lun))

Measured memory_bytes: 3064
! 2020.2.9
!
      program answer
      implicit none
      character(len=10) :: S,T,U
      integer :: A,B
!
      read(*,*) S,T
      read(*,*) A,B
      read(*,*) U
!
      if(S == U) A = A-1
      if(T == U) B = B-1
      write(*,*) A,B
      end program answer

Measured memory_bytes: 256
object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val isApprovable = List.fill(sc.nextInt())(sc.nextInt())
    .forall(i => i % 2 == 1 || i % 3 == 0 || i % 5 == 0)
  println(if (isApprovable) "APPROVED" else "DENIED")
}


Measured memory_bytes: 55376
a = int(input())
b = int(input())
c = int(input())
x = int(input())
count = 0
n = int(x/500)
if n>a:
    n = a
for i in range(n+1):
    y = x - 500*i
    m = int(y/100)
    if m>b:
        m = b
    for j in range(m+1):
        z = y - 100*j
        if z%50==0 and z/50<=c:
            count += 1
print(count)

Measured memory_bytes: 3064
import java.io.*;
import java.util.*;

public class Main{
	public static void main(String[] args){
		solve();
	}
	public static void solve(){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long[] l = new long[87];
		l[0] = 2;
		l[1] = 1;
		for(int i=2;i<87;i++){
			l[i] = l[i-1] + l[i-2];
		}
		System.out.println(l[n]);
	}
}


Measured memory_bytes: 23508
#include <stdio.h>

int main(void){
    int A,B;
    scanf("%d%d",&A,&B);
    int c = A + B;
    int a = A + (A-1);
    int b = B + (B-1);
    if (a>b && a>c){
        printf("%d",a);
    }else if (b>a && b>c){
        printf("%d",b);
    }else{
        printf("%d",c);
    };
    printf("\n");
};

Measured memory_bytes: 128
#C
S = str(input())
N = len(S)
b1 = ''
b2 = ''
for i in range(N):
    if i % 2 == 0:
        b1 = b1 + '1'
        b2 = b2 + '0'
    else:
        b1 = b1 + '0'
        b2 = b2 + '1'
bnum1 = int(b1, 2)
bnum2 = int(b2, 2)
bS = int(S, 2)
num1 = bnum1 ^ bS
num2 = bnum2 ^ bS
num1 = (bin(num1).replace('-','').replace('0b','').count('1'))
num2 = (bin(num2).replace('-','').replace('0b','').count('1'))
ans = min(num1, num2)
print(ans)


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

int main(){
  
   while(1){
   int x,y;
    cin>>x>>y;
   if(x == 0 && y == 0)break;
   if(x > y) swap(x,y);
   cout<<x<<" "<<y<<endl;
}
}


Measured memory_bytes: 3096
# your code goes here
N = int(input())
point = [0]
point.extend(list(map(int,input().split())))
point.append(0)

total = 0
for i in range(1,N+2):
	total += abs(point[i] - point[i-1])

for i in range(1,N+1):
	ans = total - abs(point[i]-point[i-1]) - abs(point[i+1]-point[i]) + abs(point[i+1]-point[i-1])
	print(ans)

Measured memory_bytes: 13920
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <queue>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double

const double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;
const int mod=1000000007;

// 再帰関数
static void Sub_QuickSort(int* pnData, int nFirst, int nLast);

// クイックソート
void QuickSort(int* pnData, int nNumOf)
{
    Sub_QuickSort(pnData, 0, nNumOf - 1);
}

// 再帰関数
// nFirst : ブロックの最初のインデックス
// nLast  : ブロックの最後のインデックス
static void Sub_QuickSort(int* pnData, int nFirst, int nLast)
{
    int iLess    = nFirst;  // 前半のインデックス
    int iGreater = nLast;   // 後半のインデックス
    int x;                  // 「ある値」

    // 「ある値」は両端の要素の平均値にする
    x = (pnData[nFirst] + pnData[nLast]) / 2;

    // 交換ループ
    // 位置が逆になると終了
    while(iLess < iGreater)
    {
        // x より小さい要素は無視
        while(pnData[iLess] < x)
            iLess++;
        // x より大きい要素は無視
        while(pnData[iGreater] > x)
            iGreater--;

        // 位置がちゃんとしているときは交換し、
        // iLess と iGreater を１つずつ進める
        if(iLess < iGreater)
            swap(pnData[iLess++], pnData[iGreater--]);
    }
    // iLess == iGreater で終わった時は、
    // iGreater < iLess になるようにする
    if(iLess == iGreater)
    {
        if(pnData[iLess] < x)
            iLess++;
        else if(pnData[iLess] > x)
            iGreater--;
    }

    // 次のブロックのサイズが２以上の時は再帰
    if(iLess >= nFirst + 2)
        Sub_QuickSort(pnData, nFirst, iLess - 1);
    if(iGreater <= nLast - 2)
        Sub_QuickSort(pnData, iGreater + 1, nLast);
}

int main(){
    int a[100000];
    int n;

    cin >> n;
    FOR(i,0,n)cin >> a[i];

    QuickSort(a,n);

    cout << a[n/2] - a[n/2 - 1];

    return 0;
}


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

int main(){
    ll count=0,size_1,size_2,max=0;
    string s;
    string t;
    cin>>s>>t;
    size_1=s.size();
    size_2=t.size();
    rep(i,size_1-size_2+1){
        count=0;
        rep(j,size_2){
            if(s[i+j]==t[j]){
                count++;
                if(max<count){
                    max=count;
                }
            }
        }
    }
    cout<<size_2-max;
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for(ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF (1ll << 60)
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
using vl = vector<ll>;
using vvl = vector<vl>;
typedef double db;
typedef string str;
typedef pair<ll, ll> p;
constexpr int MOD = 1000000007;
using ll = long long;
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

void print(const std::vector<int> &v) {
    std::for_each(v.begin(), v.end(), [](int x) { std::cout << x << " "; });
    std::cout << std::endl;
}
ll R, S, P;

ll add(char tmp) {
    if(tmp == 'r') {
        return P;
    } else if(tmp == 'p') {
        return S;
    } else if(tmp == 's') {
        return R;
    }
}

int main() {
    ll N, K;
    cin >> N >> K;
    cin >> R >> S >> P;
    string T;
    cin >> T;
    ll ans = 0LL;
    REP(i, N) {
        if(T[i] == 'r') {
            ans += P;
        } else if(T[i] == 'p') {
            ans += S;
        } else if(T[i] == 's') {
            ans += R;
        }
    }
    //とりあえず全部かつとして計算する
    //そして問題の起きたところはgreedyに解決していく？
    //解決する時に二つのペアだけみるのは良くない方法
    //つまり１個解決するともう１個問題がでるかもしれない
    //周期Kで最適な出し方を考えないと行けない
    //あいこや負けは0点なのでなのでなんとかなりそうな気がする
    for(int freq = 0; freq < K; freq++) {
        for(int i = freq + K; i < N; i += K) {
            if(T[i] == T[i - K]) {
                ans -= add(T[i]);

                i += K;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

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

#define ll long long int

int main()
{
	ll a;
	cin >> a;
	string s;
	cin >> s;
	ll b=0;
	for(int i=0;i<4;i++)
	{
		if(i==1)	continue;
		b*=10;
		b+=(s[i]-'0');
	}
	ll ans = a*b;
	ans /= 100ll;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
#define int long long
#undef int
#define mk make_pair
#define pb push_back
typedef pair<int, int> pii;
typedef pair<int, pii > ppi;
const int mod = 1000000007;
const int INF = 1000000009;

int N, H, W;

signed main()
{
    cin >> N >> H >> W;
    int ans = 0;
    for(int i = 0; i < N; i++){
        int a, b;
        cin >> a >> b;
        if(H <= a && W <= b){
            ans++;
        }
    }
    cout << ans << endl;


    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
void wf(vector<vector<int> > &dist, int n)
{
    for(int k = 0;k < n;k++)
    {
        for(int i = 0;i < n;i++)
        {
            for(int j = 0;j < n;j++)
            {
                dist[i][j] = min(dist[i][j],dist[i][k]+dist[k][j]);
            }
        }
    }
}
int main()
{
    int h,w;
    cin >> h >> w;
    const int size = 10;
    int c[size][size];
    vector<vector<int> > dist(size,vector<int>(size));
    for(int i = 0;i < size;i++)
    {
        for(int j = 0;j < size;j++)
        {
            cin >> dist[i][j];
        }
    }
    wf(dist,size);
    long long int sum = 0;
    for(int i = 0;i < h;i++)
    {
        for(int j = 0;j < w;j++)
        {
            int a;
            cin >> a;
            if(a >= 0)
            {
                sum += dist[a][1];
            }
        }
    }
    cout << sum;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(k,i,n) for(ll i=k;i<n;++i)
vector<ll> enum_div(ll n){
    vector<ll>ret;
    for(ll i=1;i*i<=n;++i){
        if(n%i==0){
            ret.push_back(i);
            if(i*i!=n){
                ret.push_back(n/i);
            }
        }
    }
    return ret;
}
int main(void){
    ll n;
    cin>>n;
    vector<ll>a(n);
    rep(0,i,n)cin>>a[i];
    sort(a.begin(),a.end());
    //rep(0,i,n)cout<<a[i]<<endl;
    vector<ll>pa;
    ll ans=0;
    rep(0,i,n){
        auto d=enum_div(a[i]);
        bool t=true;
        rep(0,j,(ll)d.size()){
            if(binary_search(pa.begin(),pa.end(),d[j]))t=false;
        }
        if(t&&a[i]!=a[i-1]&&a[i]!=a[i+1])++ans;
        pa.push_back(a[i]);
    }
    cout<<ans;
}

Measured memory_bytes: 6792
#include <bits/stdc++.h>
#define l_ength size
const int inf = (1<<30);
const int mod = 1000000007; // 998244353
using ll = long long;
using namespace std;

const int l2r = 0, r2l = 1;

int main(){
	int n; cin >> n;
	vector<int> a(n);
	for( auto &k : a ) cin >> k;
	int maxa = *max_element( a.begin(), a.end() );
	int maxp = max_element( a.begin(), a.end() ) - a.begin();
	int mina = *min_element( a.begin(), a.end() );
	int minp = min_element( a.begin(), a.end() ) - a.begin();
	if( maxa == 0 && mina == 0 ){
		cout << 0 << endl;
		return 0;
	}
	int mode = -1;
	if( mina >= 0 or maxa <= 0 ){
		cout << n-1 << endl;
		if( mina >= 0 ) mode = l2r;
		else mode = r2l;
	} else {
		cout << 2*(n-1) << endl;
		if( abs(maxa) >= abs(mina) ){
			for( int k = 0; k < n; ++k ){
				if( k == maxp ) continue;
				cout << maxp+1 << ' ' << k+1 << endl;
			}
			mode = l2r;
		} else {
			for( int k = 0; k < n; ++k ){
				if( k == minp ) continue;
				cout << minp+1 << ' ' << k+1 << endl;
			}
			mode = r2l;
		}
	}
	if( mode == l2r ){
		for( int i = 1; i < n; ++i ){
			cout << i << ' ' << i+1 << endl;
		}
	} else {
		for( int i = n; i > 1; --i ){
			cout << i << ' ' << i-1 << endl;
		}
	}
}

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

int main() {
  ll n, ans = 0; cin >> n;
  rep(i, n) {
    if ((i+1) % 3 == 0|| (i+1) % 5 == 0) continue;
    ans += i+1;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3636
class BinarySearchTree:
    def __init__(self):
        self.root = None
        self.nodes = []

    def insert(self, z):
        z = Node(z)
        self.nodes.append(z)
        y = None
        x = self.root
        while x is not None:
            y = x
            if z.key < x.key:
                x = x.left
            else:
                x = x.right
            z.parent = y

        if y is None:
            self.root = z
        elif z.key < y.key:
            y.left = z
        else:
            y.right = z
    
    def dfs(self, node):
        self.preorder.append(node.key)
        if node.left is not None:
            self.dfs(node.left)

        self.inorder.append(node.key)

        if node.right is not None:
            self.dfs(node.right)

    def out(self):
        self.preorder = []
        self.inorder = []
        self.dfs(self.root)

        print("", *self.inorder)
        print("", *self.preorder)


class Node:
    def __init__(self, v):
        self.key = v
        self.left = None
        self.right = None
        self.parent = None


def main():
    global preorder
    global inorder
    preorder = []
    inorder = []
    T = BinarySearchTree()
    n = int(input())
    for i in range(n):
        command = input().split()
        if command[0] == "print":
            T.out()
        else:
            T.insert(int(command[1]))



if __name__ == "__main__":
    main()


Measured memory_bytes: 124712
#include <bits/stdc++.h>
#define BIT(n) (1LL << (n))
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPB(i, n) for (int i = 0; i < BIT(n); i++)
#define REPS(i, x) for (int i = 1; i <= (int)(x); i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORA(i, n) for (auto &&i : n)
#define FORS(i, m, n) for (int i = m; i <= n; i++)
#define DEBUG(x) cerr << #x << ": " << x << "\n"
#define PRINTALL(V)    \
  for (auto v : (V)) { \
    cerr << v << " ";  \
  }                    \
  cerr << "\n";
#define ALL(v) v.begin(), v.end()
#define fst first
#define snd second
#define mp make_pair
#define pb push_back
#define epb emplace_back
#define int long long
using namespace std;
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;
}
template <class T> using vec = std::vector<T>;
template <class T> void print(const T &x) { cout << x << "\n"; }
const int MOD = 1000000007, INF = 1061109567;
const double EPS = 1e-10, PI = acos(-1.0);
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
signed main() {
  cin.tie(0), ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  string S;
  cin >> S;
  S[3]++;
  print(S);
}

Measured memory_bytes: 256
#include <stdio.h>
int main(){
    int a,b;
    scanf("%d %d",&a,&b);

    if (a>b){
        printf("%d\n",a-1);
    return 0;
    }
    else if (a<=b){
        printf("%d\n",a);
    }
    return 0;
    
}


Measured memory_bytes: 128
package main

import (
  "bufio"
  "bytes"
  "fmt"
  "os"
)

func main() {
  br := bufio.NewReader(os.Stdin)
  var buffer bytes.Buffer

  for {
    line, isPrefix, err := br.ReadLine()
    if err != nil {
      panic(err)
    }
    buffer.Write(line)
    if !isPrefix {
      break
    }
  }

  S := buffer.String()

  for {
    line, isPrefix, err := br.ReadLine()
    if err != nil {
      panic(err)
    }
    buffer.Write(line)
    if !isPrefix {
      break
    }
  }

  T := buffer.String()

  if len(S)+1 == len(T[len(S):len(T)]) {
    if S == T[len(S):len(T)-1] {
      fmt.Println("Yes")
    }else{
      fmt.Println("No")
    }
  }else{
    fmt.Println("No")
  }
}


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

int main(void){
    int n;
    cin >> n;
    vector<pair<int,int>> vec(n);
    for(int i=0;i<n;i++) cin >> vec[i].second >> vec[i].first;
    sort(vec.begin(),vec.end());

    bool ok = true;
    ll time  = 0;
    for(int i=0;i<n;i++){
        time += vec[i].second;
        if(time>vec[i].first) ok = false;
    }
    
    if(ok) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 1792
#!/usr/bin/env python

from collections import deque
import itertools as ite
import sys
import math

sys.setrecursionlimit(1000000)

INF = 10 ** 18
MOD = 10 ** 9 + 7

A, B, C, D = map(int, raw_input().split())
def GCD(a, b):
	dummy1 = max(a, b)
	dummy2 = min(a, b)
	while True:
		dummy = dummy1 % dummy2
		dummy1 = dummy2
		dummy2 = dummy
		if dummy == 0:
			break
	return dummy1

ans = 0

LCM = C * D / GCD(C, D)

ans += B
ans -= B / D
ans -= B / C
ans += B / LCM
A -= 1
ans -= A
ans += A / D
ans += A / C
ans -= A / LCM
print ans

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

int main()
{
    int a, b, c, d;
    cin >> a >> b >> c >> d;

    if (abs(c - a) <= d) cout << "Yes" << endl;
    else if (abs(b - a) <= d && abs(c - b) <= d) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

class Main {
	public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
      
      	int X = sc.nextInt();
      	if (X == 7 || X == 5 || X == 3) {
        	System.out.println("YES");
        } else {
        	System.out.println("NO");
        }
    }
}

Measured memory_bytes: 23636
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC042_B
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] info = Console.ReadLine()
                .Split(' ')
                .Select(str => int.Parse(str))
                .ToArray();

            int n = info[0];
            int l = info[1];

            List<string> strs = new List<string>();
            for (int i = 0; i < n; i++)
            {
                string str = Console.ReadLine();
                strs.Add(str);
            }

            strs.Sort();
            Console.WriteLine(string.Join("", strs));
            Console.ReadLine();
        }
    }
}

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

using namespace std;

#define int long long

template <typename T> T gcd(T m, T n) { return n == 0 ? m : gcd(n, m % n); }
template <typename T> T lcm(T m, T n) { return n * m / gcd(n, m); }
template <typename T> T fact(T n) { return (n == 0 ? 1 : n * fact(n - 1)); }
template <typename T> T modpow(T a, T e, T m) { return (e == (T)0 ? 1 : ((a % m) * modpow((a % m), e - 1, m)) % m); }

constexpr int MOD = 1e9 + 7;

signed main(void) {
  int n;
  cin >> n;
  vector<int> a(n);

  bool flag = false;
  for (int i = 0; i < n; ++i) {
    int a_i;
    cin >> a_i;
    if (a_i == 1) flag = true;
    a[i] = a_i;
  }

  int i = 1;
  int offset = 0;
  while (i - 1 + offset < n) {
    if (a[i - 1 + offset] == i) {
      i++;
      continue;
    } else {
      offset++;
    }
  }

  if (flag) {
    cout << offset << endl;
  } else
    cout << -1 << endl;
}


Measured memory_bytes: 1792
#include <stdio.h>

int main(void){
    int in_s, out_h, out_m, out_s;
    scanf("%d",&in_s);
    out_s = in_s % 60;
    out_m = in_s / 60;
    out_h = out_m /60;
    out_m %= 60;
    printf("%d:%d:%d\n",out_h,out_m,out_s);
    return 0;
}


Measured memory_bytes: 2148
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<cmath>
using namespace std;

template<typename A, typename B> bool chmin(A &a, const B &b){ return b < a && (a = b, true); }
template<typename A, typename B> bool chmax(A &a, const B &b){ return a < b && (a = b, true); }

int main(){
  int k,g,l;
  cin >> k;
  if (k % 2 == 1){
    g = k / 2;
    l = k / 2 + 1;
  }
  else{
    g = k / 2;
    l = k / 2;
  }
  cout << g * l << '\n';
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n); i >= 0; i--)
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define ALL(obj) begin(obj), end(obj)
using namespace std;
using ll = long long;
using ull = unsigned long long;

const int INF = 2100100100;
const int MOD = 1e9 + 7;

// 多次元 vector 生成
template <class T> vector<T> make_vec(size_t a) { return vector<T>(a); }
template <class T, class... Ts> auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

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

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

    ll n;
    cin >> n;
    vector<ll> a(n), b(n), c(n);
    REP(i, n) { cin >> a.at(i) >> b.at(i) >> c.at(i); }

    ll dp[100010][3]; // 0:sea, 1:mountain, 2: home
    memset(dp, -INF, sizeof(dp));
    dp[0][0] = a[0];
    dp[0][1] = b[0];
    dp[0][2] = c[0];
    FOR(i, 1, n) {
        chmax(dp[i][0], max(dp[i - 1][1], dp[i - 1][2]) + a[i]);
        chmax(dp[i][1], max(dp[i - 1][2], dp[i - 1][0]) + b[i]);
        chmax(dp[i][2], max(dp[i - 1][0], dp[i - 1][1]) + c[i]);
    }

    cout << max(dp[n - 1][0], max(dp[n - 1][1], dp[n - 1][2])) << endl;

    return 0;
}


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

char f(int a){
  char s;
  if(a == 0){ s = '0';}
  else if(a == 1){ s = '1';}
  else if(a == 2){ s = '2';}
  else if(a == 3){ s = '3';}
  else if(a == 4){ s = '4';}
  else if(a == 5){ s = '5';}
  else if(a == 6){ s = '6';}
  else if(a == 7){ s = '7';}
  else if(a == 8){ s = '8';}
  return s;
}

int main(){
  int x, y;
  cin >> x >> y;

  vector<string> v(x);
  for(int i = 0; i < x; i++){
    cin >> v[i];
  }

  vector<string> w(x);
  for(int i = 0; i < x; i++){
  for(int j = 0; j < y; j++){
    if(v[i][j] == '#'){
      w[i].push_back('#');
    }
    else{
      int sum = 0;
      if(i - 1 >= 0){
        if(v[i - 1][j] == '#'){ sum++; }
        if(j - 1 >= 0){
          if(v[i - 1][j - 1] == '#'){ sum++; }
        }
        if(j + 1 <= y - 1){
          if(v[i - 1][j + 1] == '#'){ sum++; }
        }
      }
      if(j - 1 >= 0){
        if(v[i][j - 1] == '#'){ sum++; }
      }
      if(j + 1 <= y - 1){
        if(v[i][j + 1] == '#'){ sum++; }
      }
      if(i + 1 <= x - 1){
        if(v[i + 1][j] == '#'){ sum++; }
        if(j - 1 >= 0){
          if(v[i + 1][j - 1] == '#'){ sum++; }
        }
        if(j + 1 <= y - 1){
          if(v[i + 1][j + 1] == '#'){ sum++; }
        }    
      }
    w[i].push_back(f(sum));
    }
  }
  }
  for(string str : w){
    cout << str << endl;
  }
}

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

int main()
{
    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    bool tacno=true;
    string s1,s2;
    cin >> s1 >> s2;
    for (int i=0;i<s1.size();i++)
    {
        if(s1[i]!=s2[i])
            tacno=false;
    }
    if(tacno)
        cout << "Yes";
    else
        cout << "No";
}


Measured memory_bytes: 3588
fun main(args: Array<String>) {
    abc071c()
}

fun abc071c() {
    val n = readLine()!!.toInt()
    val aList = readLine()!!.split(" ").map { it.toLong() }

    val grouped = aList.groupBy { it }.values.sortedByDescending { it.first() }

    val bars = mutableListOf<Long>()

    grouped.forEach {
        if (it.size >= 4) {
            return println(if (bars.isEmpty()) it.first() * it.first() else bars.first() * it.first())
        } else if (it.size >= 2) {
            bars.addAll(it.take(2))
            if (bars.size >= 4) {
                return println(bars.first() * bars.last())
            }
        }
    }

    return println(0)
}


Measured memory_bytes: 59752
#include <bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
#define pb push_back
#define pii pair < ll , ll >
#define F first
#define S second
#define int long long
#define sync ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#pragma GCC optimize ("Ofast")
#pragma GCC optimize ("unroll-loops")
using namespace std;
/// khodaya komak kon
/// ya navid navid
const int N=2e5+100;

ll vis[N];
int32_t main(){
    ll a,b;
    cin >> a >> b;
    ll z=__gcd(a,b);
    z=a*b/z;
    cout << z;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;

using namespace std;
using P = pair<double, double>;
using PP = pair<double, P>;

struct edge {
	P to;
	double cost;
};

void dijkstra(map<P, vector<edge>>& G, map<P, double>& d, P s) {
	priority_queue<PP, vector<PP>, greater<PP>> que;
	d[s] = 0;
	que.push(PP(0, s));

	while (!que.empty()) {
		PP q = que.top();
		que.pop();
		P v = q.second;
		if (d[v] < q.first) { continue; }

		for (int i = 0; i < G[v].size(); ++i) {
			edge e = G[v][i];
			if (d[e.to] > d[v] + e.cost) {
				d[e.to] = d[v] + e.cost;
				que.push(PP(d[e.to], e.to));
			}
		}
	}
}

int main() {
	const double INF = 1e18;
	double xs, ys, xt, yt;
	cin >> xs >> ys >> xt >> yt;
	int N;
	cin >> N;
	vector<double> x(N + 2);
	vector<double> y(N + 2);
	vector<double> r(N + 2);
	x[0] = xs; x[N + 1] = xt;
	y[0] = ys; y[N + 1] = yt;
	r[0] = 0.0; r[N + 1] = 0.0;
	for (int i = 1; i <= N; ++i) {
		cin >> x[i] >> y[i] >> r[i];
	}

	map<P, vector<edge>> G;
	for (int i = 0; i <= N + 1; ++i) {
		for (int j = 0; j <= N + 1; ++j) {
			if (j == i) { continue; }
			double dist = sqrt(pow(x[i] - x[j], 2) + pow(y[i] - y[j], 2));
			double cost = max(0.0, dist - (r[i] + r[j]));
			G[P(x[i], y[i])].push_back({P(x[j], y[j]), cost});
		}
	}

	map<P, double> d;
	for (int i = 0; i <= N + 1; ++i) {
		d[P(x[i], y[i])] = INF;
	}

	dijkstra(G, d, P(xs, ys));
	double res = d[P(xt, yt)];
	cout.precision(15);
	cout << fixed << res << endl;

	return 0;
}


Measured memory_bytes: 32752
import java.util.*;
import java.io.*;
 
class Main {
 
  
 
  public static void main(String[] args) {
    Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
    
    int n = in.nextInt();
    int[][] can = new int[n][n];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < n; j++) {
        can[i][j] = in.nextInt();
      }
    }

    int INF = (int) 1e9 + 7;

    int[] dp = new int[1 << n];
    dp[0] = 1;
    for (int mask = 0; mask < (1 << n) - 1; mask++) {
      int a = countSetBit(mask); // we are going to check assign a woman to (a+1)th man
      for (int b = 0; b < n; b++) {
        if (can[a][b] == 1 && ((mask & (1<<b)) == 0)) {
          dp[mask | (1 << b)] += dp[mask];
          if (dp[mask | 1 << b] >= INF) {dp[mask | (1 << b)] -= INF;}
        }
      }
    }

    System.out.println(dp[(1<<n) - 1]);
  }

  static int countSetBit(int a) {
    int count = 0; 
    while (a > 0) {
      count += (a & 1);
      a = a >> 1;
    }
    return count;
  }

 
}

Measured memory_bytes: 30548
#pragma GCC optimize("Ofast")

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

using namespace std;
using namespace __gnu_pbds;

typedef
tree<pair<int, int>, null_type, less<pair<int, int>>, rb_tree_tag, tree_order_statistics_node_update> orderedSet;

#define pb push_back
#define F first
#define S second
#define all(a) (a).begin(), (a).end()

#define for1(i0, l0, r0) for (int i0 = l0; i0 < r0; ++i0)
#define for2(i0, l0, r0) for (int i0 = l0; i0 <= r0; ++i0)
#define forn(i0, n0) for (int i0 = 0; i0 < n0; ++i0)
#define forn1(i0, n0) for (int i0 = 1; i0 < n0; ++i0)
#define forr(i0, n0) for (int i0 = n0; i0 >= 0; --i0)
#define forr1(i0, r0, l0) for (int i0 = r0; i0 > l0; --i0)
#define forr2(i0, r0, l0) for (int i0 = r0; i0 >= l0; --i0)

#define Sort(a) sort(all(a))
#define Reverse(a) reverse(all(a))
#define relaxMax(a, b) a = max(a, b)
#define relaxMin(a, b) a = min(a, b)

typedef long long ll;
typedef long double ld;
#define ui unsigned int
#define ull unsigned long long

typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
typedef pair<string, string> pss;

typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<double> vd;
typedef vector<ld> vld;
typedef vector<bool> vb;
typedef vector<string> vs;

typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<pdd> vpdd;

typedef vector<vi> vvi;
typedef vector<vd> vvd;
typedef vector<vll> vvll;
typedef vector<vb> vvb;

#define vpss vector<pss>
#define vvs vector<vs>
#define vvpii vector<vpii>
#define vvpll vector<vpll>
#define vpt vector<pt>
#define vvvi vector<vvi>
#define vsi vector<set<int>>
#define ss second
#define ff first

#define printvi(arr) for (int x0 : arr) cout << x0 << ' '; cout << '\n';
#define printvll(arr) for (ll x0 : arr) cout << x0 << ' '; cout << '\n';
#define printpair(pair0) cout << pair0.F << ' ' << pair0.S << '\n';
#define printvp(arr) for (auto pair0 : arr) printpair(pair0);
#define initArray(arr, N0, X0) memset(arr, X0, N0 * sizeof(int))
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

void init() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    //cout.precision(16);
    //freopen("amusing.in", "r", stdin);
    //freopen("amusing.out", "w", stdout);
}

void solve() {
    int x, y;
    cin >> x >> y;
    if (y % 2 == 1){
        cout << "No\n";
        return;
    }
    cout << (y >= 2 * x && y <= 4 * x ? "Yes" : "No") << '\n';
}

bool multitest = false;

int main() {
    init();
    int t = 1;
    if (multitest) cin >> t;
    forn(i, t) solve();
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n = 0, N;cin>>N;
	int *tp = new int[N];
	while(n < N){
		cin>>tp[n];n++;
	}
	int M;cin>>M;
	int m = M, a, b;
	queue < pair<int,int> > q;
	while(M--){
		cin>>a>>b;
		q.push({a,b});
	}
	int suma = 0, diferencia = 0;
	for(int i = 0; i < N; i++)suma+=tp[i];
	pair<int,int> p;
	while(q.size()){
		p = q.front();
		diferencia = p.second - tp[p.first-1];
		q.pop();
		cout<<suma+diferencia<<endl;
	}
}

Measured memory_bytes: 256
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <set>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cstring>
#include <iterator>
#include <bitset>
#include <unordered_set>
#include <unordered_map>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <utility>
#include <memory>
#include <functional>
#include <deque>
#include <cctype>
#include <ctime>
#include <numeric>
#include <list>
#include <iomanip>

#if __cplusplus >= 201103L
#include <array>
#include <tuple>
#include <initializer_list>
#include <forward_list>

#define cauto const auto&
#else

#endif

using namespace std;


typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll;
typedef vector<vector<long long> > vvll;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
    v.assign(a, vector<T>(b, t));
}

template <class F, class T>
void convert(const F &f, T &t){
    stringstream ss;
    ss << f;
    ss >> t;
}

#define GET_MACRO(_1, _2, _3, NAME, ...) NAME
#define _rep(i,n) _rep2((i),0,(n))
#define _rep2(i,a,b) for(int i=(a);i<(b);++i)
#define rep(...) GET_MACRO(__VA_ARGS__, _rep2, _rep)(__VA_ARGS__)
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define fi first
#define se second
#define mkp make_pair
#define DEBUG
#ifdef DEBUG
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#else
#define dump(x)
#define debug(x)
#endif

#define MOD 1000000007LL
#define EPS 1e-8
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
#define maxs(x,y) x=max(x,y)
#define mins(x,y) x=min(x,y)



void mainmain(){
    int N, T;
    cin >> N >> T;
    vint A(N), B(N);

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

    vvint dp;
    initvv(dp, 2, T);

    rep(i, N) {
        vvint next = dp;
        for(int j=T-1; j >= 0; j--) {
            if (j + A[i] >= T) continue;
            maxs(next[0][j + A[i]], dp[0][j] + B[i]);
            maxs(next[1][j + A[i]], dp[1][j] + B[i]);
        }
        rep(j, T) {
            maxs(next[1][j], dp[0][j] + B[i]);
        }

        dp = next;
    }

    int ans = 0;
    rep(i, 2) {
        rep(j, T) {
            maxs(ans, dp[i][j]);
        }
    }

    cout << ans << endl;
}


signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(20);
    mainmain();
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int main()
{
  	int n; cin >> n;
    string s; cin >> s;
    int cntr=0,cntb=0;
    for(int i=0; i < s.size(); i++)
    {
        if(s[i]=='R')
        {
            cntr++;
        }
        else
        {
            cntb++;
        }
    }
    if(cntr > cntb)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <string>
#include <queue>
#include <map>
#include <algorithm>
#include <cmath>
#include <iostream>
#include <sstream>
#include <set>
using namespace std;

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

  int res = 0;
  for (int i=0; i<s.size(); i++) {
    int tp = (s[i] == 'p');
    int mp = (i%2 == 1);
    res += mp - tp;
  }
  cout << res << endl;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
int M,N;
int R[111];
bool used[111];
int main(){
  vector<P> L[101];
  vector<P> U[101];
  cin >> M >> N;
  for(int i=0;i<M;i++){
    int K; cin >> K;
    for(int j=0;j<K;j++){
      int s,t; string c;
      cin >> s >> c >> t;
      --s;
      if( c[0] == '<' )
        L[i].push_back( P(s,t) );
      else 
        U[i].push_back( P(s,t) );      
    }    
  }
  
  for(int cnt=0;cnt<M;cnt++){
    int tmp[111];
    for(int i=0;i<M;i++){
      if(used[i]) continue;
      for(int j=0;j<N;j++)
        tmp[j] = R[j];    
      for(int j=0;j<(int)U[i].size();j++)
        tmp[U[i][j].first] = max( tmp[U[i][j].first], U[i][j].second );
      bool ok = true;
      for(int j=0;j<M;j++){
        if( used[j] ) continue;
        for(int k=0;k<(int)L[j].size();k++)
          if( tmp[L[j][k].first] > L[j][k].second ) {
            ok = false; break;
          }
        if( !ok ) break;
      }
      if( ok ){
        used[i] = true;
        for(int j=0;j<N;j++){
          R[j] = tmp[j];
        }
        break;
      }
    }
  }
  for(int i=0;i<M;i++)
    if( !used[i] ) {
      cout << "No" << endl; return 0;
    }
  cout << "Yes" << endl;
}

Measured memory_bytes: 1312
#include<iostream>
#include<vector>
#include<algorithm>
#include<cctype>
#include<utility>
#include<string>
#include<cmath>
#include <numeric>
 
 
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;
 
typedef long long int ll;
#define ARRAY_MAX 100005


int main(){

    ll a,b;
    cin >> a >> b;
    string s;

    if(a*b <= 0){
        //0をまたぐ
        s = "Zero";
    }else if(a > 0 && b > 0){
        s = "Positive";
    }else{

        if(abs(b-a) % 2 == 0){
            s = "Negative";
        }else{
            s = "Positive";
        }
    }
    cout << s << endl;

    return 0;
}

Measured memory_bytes: 384