akhauriyash/Code-Regression huggingface dataset:
<?php

$diff = [];
$result = 0;

$input = explode(' ', trim(fgets(STDIN)));

$n = (int)$input[0];

$count = 0;
while($count < $n){
	$input = explode(' ', trim(fgets(STDIN)));
	foreach ($input as $value) {
		if (ctype_digit($value)) {
			$diff[$count] = $count + 1 - (int)$value;
			if ($count === 0) {
				++$count;
				continue;
			}
			if ($count + 1 === $n && $diff[$count] === 0) {
				++$count;
				++$result;
				break;
			}
			if ($diff[$count - 1] === 0) {
				++$result;
				if ($diff[$count] !== 1) {
					$diff[$count] -= 1;
				}
			}
			++$count;
		}
	}

}

echo $result;

Measured memory_bytes: 18932
#include<bits/stdc++.h>
using namespace std;
int main() {
  int a[3];
  int c5=0, c7=0;
  for(int i=0; i<3; i++) {
    cin >> a[i];
    if (a[i] == 5) {
      c5++;
    } else if (a[i]==7){
      c7++;
    }
  }
  
  if (c5==2 && c7==1) {
    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 input=new Scanner(System.in);
    int a=input.nextInt();
    int b=input.nextInt();
    if(a>=0 && b>=0 && a<=4500 && b<=4500)
    {
      System.out.println(2*b-a);
    }
  }
}

Measured memory_bytes: 21844
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <set> 
#include <map>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstring>
#include <iomanip>
#define REP(i,n) for(int i=0; i<(n); ++i)
#define FOR(i,a,b) for(int i=(a); i<(b); ++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

int main () {

    string s; cin >> s;

    s[3] = '8';

    cout << s << endl;

    return 0;
}



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

int sumOfDigits(int n)
{
    int sum = 0;
    while (n > 0)
    {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}

int main()
{
    int n, a, b;
    cin >> n >> a >> b;

    int ans = 0;
    for (size_t i = 1; i < n + 1; i++)
    {
        int sum = sumOfDigits(i);
        if (a <= sum && sum <= b)
        {
            ans += i;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(){
int x,y,z,zz;
long w;
int p[100][100];
int q[100][100];
for(int i=0;i<100;i++){
for(int j=0;j<100;j++){
p[i][j]=0;
q[i][j]=0;
 
}}
scanf("%d",&x);scanf("%d",&y);scanf("%d",&z);
for(int i=0;i<x;i++){
for(int j=0;j<y;j++){
scanf("%d",&zz);p[i][j]=zz;
}}
for(int i=0;i<y;i++){
for(int j=0;j<z;j++){
scanf("%d",&zz);q[i][j]=zz;
}}
w=0;
for(int i=0;i<x;i++){
for(int j=0;j<z;j++){
for(int k=0;k<y;k++){
w+=p[i][k]*q[k][j];
}
if(j<z-1)printf("%ld ",w);
else if(j==z-1)printf("%ld\n",w);
w=0;
}
}
return 0;
 
}

Measured memory_bytes: 1108
#! env/bin/local python3
# -*- coding:utf-8 -*-

# -- submit ----

# --- fetch input ---
inputs: list = []
while True:
    try:
        inputs.append(input().strip('\n'))
    except EOFError:
        break

# --- write code below ---
k = int(inputs[0])
a, b = [int(i) for i in inputs[1].split()]

for n in range(a, b+1):
    if n % k == 0:
        print('OK')
        break
    if n == b:
        print('NG')


Measured memory_bytes: 9180
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector> 
#include<limits>
#include<numeric>
#include<type_traits>
#include<math.h>
#include<fstream>
#include<set>
#include<queue>
using namespace std;
typedef long long ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i = (int)(a); i < (int)(b); i++)
#define out(str) cout << str << endl
#define ALL(a) (a).begin(),(a).end()
#define INF (1<<29)

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

const int N = 100100;
bool prime[100100];
void eratosthenes(){
    rep(i,N) prime[i] = 1;
    prime[0] = prime[1] = 0;
    rep(i,N){
        if(prime[i]){
            for(int j = i + i; j < N; j+=i){
                prime[j] = 0;
            }
        }
    }
}
int X;

int main(){
    eratosthenes();
    cin>>X;
    repi(i,X,100000000){
        if(prime[i]){
            out(i);
            return 0;
        }
    }
}


Measured memory_bytes: 384
import collections as co
n=int(input())
s=[input() for i in range(n)]

x=co.Counter(s)
x=x.most_common()
ans=[]
m=0

for i in x:
    if i[1]<m:
        break
    else:
        ans.append(i[0])
        m=i[1]

ans.sort()
for i in ans:
    print(i)

Measured memory_bytes: 49588
#include<bits/stdc++.h>
#define N 100
using namespace std;
int n, a[N];
 
int main() {
    cin >> n;
    for(int i = 1; i <= n; i++) cin >> a[i];
    int m = abs(a[1]), p = 1;
    for(int i = 2; i <= n; i++)
        if (abs(a[i]) > m) m = abs(a[i]), p = i;
    cout << 2 * n - 2 << endl;
    for(int i = 1; i <= n; i++)
            if (i != p) printf("%d %d\n", p, i);
    if (a[p] > 0) for(int i = 1; i < n; i++) printf("%d %d\n", i, i + 1);
    else for(int i = n; i > 1; i--) printf("%d %d\n", i, i - 1);
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <iomanip>

#include <vector>
#include <set>
#include <bitset>
#include <map>
#include <deque>
#include <string>

#include <algorithm>
#include <numeric>
#include <random>

#include <cstdio>
#include <cassert>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>

using namespace std;

#define forn(i, n) for (ll i = 0; i < (ll) (n); ++i)
#define sz(a) static_cast<int>((a).size())
#define endl '\n'

using ll = long long;

const ll INF = static_cast<ll>(1e9) + 7;
const int MAXN = static_cast<int>(1e6) + 17;

int n;
int a[MAXN], k[MAXN];

bool read() {
    if (!(cin >> n))
        return false;

    forn (i, n)
        cin >> a[i];

    return true;
}

void solve() {
    sort(a, a + n);

    for (int i = 1; i < n; ++i) {
        int j = upper_bound(a, a + n, a[i] / 2) - a;

        if (j == i)
            --j;

        k[i] = a[j];

        if (j > 0 && abs(a[i] / 2 - a[j - 1]) < abs(a[i] / 2 - a[j]))
            k[i] = a[j - 1];
    }

    cout << a[n - 1] << ' ' << k[n - 1] << endl;
}

int main() {
    cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    std::mt19937 rand('S' + 'E' + 'R' + 'E' + 'Z' + 'H' + 'K' + 'A');

    while (read())
        solve();

    return 0;
}



Measured memory_bytes: 4736
<?php
$n = (int)trim(fgets(STDIN));
$s = trim(fgets(STDIN));

// 累積和
$r_sum = [0];
$g_sum = [0];
$b_sum = [0];

for ($i=0; $i < $n; $i++) { 
	$c = $s[$i];
	$r_sum[$i+1] = $r_sum[$i];
	$g_sum[$i+1] = $g_sum[$i];
	$b_sum[$i+1] = $b_sum[$i];
	switch ($c) {
		case 'R':
			$r_sum[$i+1] += 1;
			break;
		case 'G':
			$g_sum[$i+1] += 1;
			break;
		case 'B':
			$b_sum[$i+1] += 1;
			break;
	}
}

// jを固定して、i, kの組み合わせの和を求めていく（i,j,kが等間隔に並ぶ組み合わせを除く）
$sum = 0;
for ($j=1; $j < $n-1; $j++) { 
	$c = $s[$j];
	switch ($c) {
		case 'R':
			$tmp_sum = ($g_sum[$j] * ($b_sum[$n] - $b_sum[$j])) + ($b_sum[$j] * ($g_sum[$n] - $g_sum[$j]));
			break;
		case 'G':
			$tmp_sum = ($r_sum[$j] * ($b_sum[$n] - $b_sum[$j])) + ($b_sum[$j] * ($r_sum[$n] - $r_sum[$j]));
			break;
		case 'B':
			$tmp_sum = ($r_sum[$j] * ($g_sum[$n] - $g_sum[$j])) + ($g_sum[$j] * ($r_sum[$n] - $r_sum[$j]));
			break;
	}
	$left = $j-1;
	$right = $j+1;
	while ($left >= 0 && $right < $n) {
		if ($s[$left] !== $c && $s[$right] !== $c && $s[$right] !== $s[$left]) {
			$tmp_sum -= 1;
		}
		$left -= 1;
		$right += 1;
	}
	$sum += $tmp_sum;
}

echo $sum;

Measured memory_bytes: 16412
#include <iostream>
#include <algorithm>
#include <functional>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <numeric>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>

using namespace std;

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

typedef long long ll;
typedef unsigned long long ull;

int main(void) {
  int K, S;
  cin >> K >> S;

  int cnt = 0;
  rep(x, K + 1) rep(y, K + 1) {
    if (S - (x + y) >= 0 && S - (x + y) <= K)
      cnt++;
  }

  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

func main() {
	var n int
	fmt.Scan(&n)

	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	x := make([]int, n)
	for i := range x {
		sc.Scan()
		x[i], _ = strconv.Atoi(sc.Text())
	}

	sx := make([]int, len(x))
	copy(sx, x)
	sort.Ints(sx)

	lm, rm := sx[len(sx)/2-1], sx[len(sx)/2]
	wr := bufio.NewWriter(os.Stdout)
	defer wr.Flush()
	for _, v := range x {
		if v <= lm {
			wr.WriteString(strconv.Itoa(rm) + "\n")
		} else {
			wr.WriteString(strconv.Itoa(lm) + "\n")
		}
	}
}


Measured memory_bytes: 8576
/*                    ___          |\    /|           ____   ____   ____  ____
   |     |    /\    /    \ |     | | \  / |    /\    |    \ |    \ |     |    \
   |_____|   /__\   \____  |_____| |  \/  |   /__\   |____/ |____/ |__   |____/
   |     |  /    \       \ |     | |      |  /    \  |      |      |     |   \
   |     | /      \ \____/ |     | |      | /      \ |      |      |____ |    \
*/
#include<bits/stdc++.h>
using namespace std;
#define lb lower_bound
#define ub upper_bound
#define pf push_front
#define pb push_back
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long
#define pi pair<int,int>
#define pl pair<long,long>
#define pll pair<long long,long long>
#define pld pair<long double,long double>
#define gc getchar_unlocked
#define pc putchar_unlocked
#define endl '\n'
#define loop(i,n) for(ll i=0;i<n;i++)
#define mod (ll)(1e9+7)
#define in(x) scanf("%lld",&x)
#define in2(x,y) scanf("%lld %lld",&x,&y)
#define vl vector<ll>
#define vpll vector<pair<ll,ll>>
#define INF 0x3f3f3f3f
#define mp make_pair

ll dp[1005][1005];

int main()
{
    ll n,ans=0;
    in(n);
    vl v(n);
    for(auto& i:v) in(i);
    for(ll i=0;i<n;i++) {
        for(ll j=i+1;j<n;j++) {
            ans+=v[i]*v[j];
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7
#s=input().rstrip()

x,y=MI()
count=0
for i in range(100):
    if x<=y:
        x*=2
        count+=1
    else:
        break
print(count)

Measured memory_bytes: 38384
/*         
               JAI SHREE RAM    */
 
 
 
#include<bits/stdc++.h>
using namespace std;
 
#define ff              first
#define ss              second
#define pb              push_back
#define int             long long
#define mp              make_pair
#define pr              pair<long long,long long>
#define vr              vector<long long>
#define mod            1000000007
#define mod2            998244353
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define ll              long long
#define ld	            long double
#define w(x)            int x; cin>>x; while(x--)
#define fill(a,b)       memset(a, b, sizeof(a))
#define ios ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
 
 int k;
const int N = 1000001;
  vector <int> a;
int power(int x, unsigned int y) 
{ 
    int res = 1;     
   
    while (y > 0) 
    { 
        
        if (y & 1) 
            res = res*x%1000000007; 
        y = y>>1; // y = y/2 
        x = x*x % 1000000007;  // Change x to x^2 
    } 
    return res; 
}
 
long long maxSubArray(long long a[], int sze)
{
   long long max_so_far = 0, max_ending = 0;
   for (int i = 0; i < sze; i++)
   {
       max_ending = max_ending + a[i];
       if (max_ending < 0)
           max_ending = 0;
       else if (max_so_far < max_ending)
           max_so_far = max_ending;
   }
   return max_so_far;
}
 
 
 
ll factorialNumInverse[N + 1]; 
ll naturalNumInverse[N + 1]; 
ll fact[N + 1]; 
  
 
void InverseofNumber(ll p) 
{ 
    naturalNumInverse[0] = naturalNumInverse[1] = 1; 
    for (int i = 2; i <= N; i++) 
        naturalNumInverse[i] = naturalNumInverse[p % i] * (p - p / i) % p; 
} 
void InverseofFactorial(ll p) 
{ 
    factorialNumInverse[0] = factorialNumInverse[1] = 1; 
  
    
    for (int i = 2; i <= N; i++) 
        factorialNumInverse[i] = (naturalNumInverse[i] * factorialNumInverse[i - 1]) % p; 
} 
void factorial(ll p) 
{ 
    fact[0] = 1; 
  
    // precompute factorials 
    for (int i = 1; i <= N; i++) { 
        fact[i] = (fact[i - 1] * i) % p; 
    } 
} 
  
ll Binomial(ll N, ll R, ll p) 
{ 
    // n C r = n!*inverse(r!)*inverse((n-r)!) 
    ll ans = ((fact[N] * factorialNumInverse[R]) 
              % p * factorialNumInverse[N - R]) 
             % p; 
    return ans; 
} 

 
void solve()
{
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    
    int ans=-1e18;
    int ans1=a*d;
    int ans2=a*c;
    int ans3=b*d;
    int ans4=b*c;
    ans=max(ans1,ans2);
    ans=max(ans,max(ans3,ans4));
    cout<<ans<<"\n";
}

 
int32_t main()
{ 
      
      ios;
      int test;
      
      
      test=1;
     // cin>>test;
    
      while(test--)
      {
          solve();
          
      }
       
    
    return 0;
	}

Measured memory_bytes: 3656
#include<bits/stdc++.h>
using namespace std ;
long long int a[1200000];
long long int b[1200000];
long long int n,m;
int cmp(int a ,int b){
	return a>b;
}
inline void read(int &x){
   int s = 0, w = 1; char ch = getchar();
   while(ch < '0' || ch > '9'){ if(ch == '-') w = -1; ch = getchar(); }
   while(ch >= '0' && ch <= '9') s = s * 10 + ch - '0', ch = getchar();
   x = s*w;
}
long long int check(long long int t){
	long long int sum=0;
	for(int i=0;i<n;i++){
		if(t/b[i]==0){
			sum+=a[i];
		}
		else {
			if(a[i]>=t/b[i]){
				sum+=a[i]-(t/b[i]);
			}
			else{
				sum+=0;
			}
		}
	}
	if(sum<=m){
		return 1;
	}
	else{
		return 0;
	}
}
int main()
{
	long long int ans=0;
	cin>>n>>m;
	for(int i=0;i<n;i++){
		scanf("%d",&a[i]);
		ans+=a[i];
	}
	for(int i=0;i<n;i++){
		scanf("%d",&b[i]);
	}
	if(m>=ans){
		printf("0\n");
		return 0;
	}
	sort(a,a+n);
	sort(b,b+n,cmp);
	long long int l=0,r=12000000000000;
	long long int daan=0; 
    while(l<=r) 
    {	
        long long int mid = (l + r) / 2;
        if(check(mid)) {
        daan=mid;
		r = mid-1;}
		 //检查mid是否符合题目要求
        else l = mid+1;
        
    }
    printf("%lld\n",l);
	return 0;
}

Measured memory_bytes: 5888
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        CoinChangeAizu solver = new CoinChangeAizu();
        solver.solve(1, in, out);
        out.close();
    }

    static class CoinChangeAizu {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            int m = in.nextInt();
            int[] c = new int[m];

            for (int i = 0; i < m; i++) {
                c[i] = in.nextInt();
            }

            int[] dp = new int[n + 1];
            for (int i = 1; i < n + 1; i++) {
                dp[i] = Integer.MAX_VALUE - 1;
                for (int j = 0; j < m; j++) {
                    if (i >= c[j]) {
                        dp[i] = Math.min(dp[i], 1 + dp[i - c[j]]);
                    }
                }
            }

            out.printf("%d\n", dp[n]);
        }

    }
}




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

int main(){
	int n;
	while(cin >> n,n){
		int grid[101][101] = {0};
		int w,h;
		cin >> w >> h;
		for(int i=0;i<n;i++){
			int x,y;
			cin >> x >> y;
			grid[x][y] = 1;
		}
		int s,t;
		cin >> s >> t;
		int ans = 0;
		for(int i = 1;i <= w-s+1;i++){
			for(int j = 1;j <= h-t+1;j++){
				int sum = 0;
				for(int k = 0;k < s;k++){
					for(int l = 0;l < t;l++){
						sum+=grid[i+k][j+l];
					}
				}
				ans = max(ans,sum);
			}
		}
		cout << ans << endl;
	}
	return 0;
}

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

#define _GLIBCXX_DEBUG
#define all(v) (v).begin(),(v).end()

using ll=long long;
using pii=pair<int, int>;
using vi=vector<int>;
using vii=vector<vector<int>>;

const ll LINF=1LL<<60;
const int INF=1<<29;
const ll MOD=998244353;

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


int main(){
    int N, K; cin >> N >> K;
    vi L(K), R(K);
    for(int i=0; i<K; i++){
        cin >> L[i] >> R[i];
    }
    vector<ll> dp(N+1, 0);
    dp[0]=1;
    dp[2]=-1;
    for(int i=1; i<=N; i++){
        dp[i]=(dp[i]+dp[i-1])%MOD;
        for(int j=0; j<K; j++){
            if(i+L[j] <= N) dp[i+L[j]]=(dp[i+L[j]]+dp[i])%MOD;
            if(i+R[j]+1 <= N) dp[i+R[j]+1]=(dp[i+R[j]+1]-dp[i])%MOD;
        }
    }


    if(dp[N] < 0) dp[N]+=MOD;
    cout << dp[N] << endl;
    return 0;
}

Measured memory_bytes: 4828
#pragma GCC optimize("O3")
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <bits/stdc++.h>

#define DEBUG
#ifdef DEBUG
    #define IFD(...) __VA_ARGS__
    #define IFN(...)
    #define L cout<<__LINE__<<"\n";
    #define PRINT(...) __VA_ARGS__ cout<<__LINE__<" : "<<#__VA_ARGS__<<"\n"
    #define PRT(x) cout<<__LINE__<<" : "<<#x<<" = "<<x<<"\n"
#else // DEBUG
    #define IFD(...)
    #define IFN(...) __VA_ARGS__
    #define L
    #define PRINT(...) __VA_ARGS__
    #define PRT(x)
#endif // DEBUG

#define it iterator
#define rit reverse_iterator
#define mp make_pair
#define mems(a,b) memset(a,b,sizeof(a))
#define mem0(a) mems(a,0)
#define mem1(a) mems(a,1)
#define mem255(a) mems(a,255)
#define halt exit(0)
#define all(c) (c).begin() , (c).end()
#define sz(c) ((long long)((c).size()))
#define phb push_back
#define ppb pop_back
#define phf push_front
#define ppf pop_front
#define fort0(i,a,b) for(ll i=a,i##_TO=b;i<i##_TO;i++)
#define for0(i,n) fort0(i,0,n)
#define fort1(i,a,b) for(ll i=a,i##_TO=b;i<=i##_TO;i++)
#define for1(i,n) fort1(i,1,n)
#define ford(i,a,b) for(ll i=a,i##_TO=b;i>=i##_TO;i--)

using namespace __gnu_pbds;
using namespace std;

#define int ll

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

template
<
    class key,
    class val=null_type,
    class comp=less<key>
>
using ord_set=tree
<
    key,
    val,
    comp,
    rb_tree_tag,
    tree_order_statistics_node_update
>;

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n;
    cin>>n;
    if(n<=999)
        cout<<"ABC\n";
    else
        cout<<"ABD\n";
}


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

#define PI 3.14159265359
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define bit(n,k) (((ll)n>>(ll)k)&1) /*nのk bit目*/
const long long INF= 1e+18+1;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll> >vvl;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> T;
const ll MOD=1000000007LL;
//const ll MOD=998244353LL;
//const ll MAX_V=114514LL;
const ll MAX = 510000LL;
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
vl dx={-1,-1,-1,0,0,1,1,1};
vl dy={1,-1,0,1,-1,1,0,-1};
//素因数分解O(√n)
map<ll,ll>prime_factor(ll n){
  map<ll,ll>res;
  for(ll i=2;i*i<=n;i++){
    while(n%i==0){
      res[i]++;
      n/=i;
    }
  }
  if(n!=1)res[n]=1;
  return res;
}
int main(){
  ll n;cin>>n;
  map<ll,ll>M=prime_factor(n);
  ll ans=0;
  for(auto p:M){
    ll d=p.second;
    ll i=1;
    while(d>=i){
      ans++;
      
      d-=i;
      i++;
    }
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 3632
#include <iostream>
#include <vector>
#include <cstdlib>
using namespace std;
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; }

const long long INF = 1LL << 60;

// 入力
int N;
long long h[100010];

// DP テーブル
long long dp[100010];

int main() {
    int N; cin >> N;
    for (int i = 0; i < N; ++i) cin >> h[i];

    // 初期化 (最小化問題なので INF に初期化)
    for (int i = 0; i < 100010; ++i) dp[i] = INF;

    // 初期条件
    dp[0] = 0;

    // ループ
    for (int i = 0; i < N; ++i) {
        chmin(dp[i + 1], dp[i] + abs(h[i] - h[i + 1]));
        chmin(dp[i + 2], dp[i] + abs(h[i] - h[i + 2]));
    }

    // 答え
    cout << dp[N-1] << endl;
}


Measured memory_bytes: 1792
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<bitset>
#include<vector>
#include<deque>
#include<queue>
#include<map>
#include<set>
#include<stack>
#include<cmath>
#include<iomanip>
#include <functional>
using namespace std;
typedef long long ll;
const int mod = 1000000007;
const int INF = 1 << 30;
const double EPS = 1e-10;
//cout << fixed << std::setprecision(9)
//memset(a, 0, sizeof(a));
//--------------------------

string s;
int a, b, c, d, x;

int main()
{
	cin >> a >> b >> x;

	if (a + b >= x && x >= a) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}

	return 0;
}


Measured memory_bytes: 256
s = input()
n = len(s)

if s != s[-1::-1]:
  print("No")
elif s[:(n-1)//2] != s[(n-1)//2-1::-1]:
  print("No")
elif s[(n+3)//2-1:] != s[-1:(n+3)//2-2:-1]:
  print("No")
else:
  print("Yes")

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

int main(){
	ll n,k;
	cin>>n>>k;

	ll res = 0;


	for(int i = k+1;i<=n;i++){
		res+=((n-n%i)/i)*(i-k);
		//cout<<"res:"<<i<<" "<<res<<endl;
		ll r = n%i;
		if(n%i>=k && n%i!=0 && k!=0) res+=(r - (k - 1));
		if(n%i>=k && n%i!=0 && k==0) res+=(r - (k));
	//	cout<<i<<" "<<res<<endl;
	}
	cout<<res;
}


 //i - k  i-1 


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define x first
#define y second

using namespace std;

typedef long long ll;

int find_dif(char a, char b, char c)
{
    if (a == b && b == c) return 0;
    if (a == b || b == c || c == a) return 1;
    return 2;
}

int main()
{
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    ios_base::sync_with_stdio(0); cin.tie(0);
    int n, ans = 0;
    string a, b, c;
    cin >> n >> a >> b >> c;
    for (int i = 0; i < n; i++)
    {
        int c1 = a[i], c2 = b[i], c3 = c[i];
        ans += find_dif(c1, c2, c3);
    }
    cout << ans;
    return 0;
}



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

Measured memory_bytes: 3096
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int n,m;
int main(){
    scanf("%d%d",&n,&m);
    int ans=0;
    for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++){
            if(j%10>=2&&j/10>=2&&j%10*(j/10)==i)ans++;
        }
    }
    printf("%d\n",ans);
    return 0;
}

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

int main() {
  
  // 変数定義
  double d_r, d_g, d_p;
  
  // 変数に入力値を代入
  cin >> d_r >> d_g;
  
  // 必要なパフォーマンスを演算
  d_p = d_g * 2 - d_r;
  
  // 必要なパフォーマンスを表示
  cout << d_p << endl;
  
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
long long max(long long a, long long b){
  if(a>b){
    return a;
  }else{
    return b;
  }
}
int main(){
  long long N,W;
  cin>>N>>W;
  
  long long dp[W+1];
  for(long long i=0;i<W+1;i++){
    dp[i]=-1;
  }
  dp[0]=0;
  
  for(long long i=0;i<N;i++){
    long long  w,v;
    cin>>w>>v;
    for(long long j=W-w;j>=0;j--){
      if(dp[j]!=-1){
        if(dp[j+w]<dp[j]+v){
          dp[j+w]=max(dp[j]+v,dp[j+w]);
        }
      }
    }
  }
  long long ans=0;
  for(long long i=0;i<W+1;i++){
    if(ans<dp[i]){
      ans=dp[i];
    }
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <sstream>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <numeric>
#include <cctype>
#include <tuple>
#include <array>
#include <climits>
#include <bitset>
#include <cassert>


// BEGIN CUT HERE
#ifdef _MSC_VER
#include <agents.h>
#endif
// END CUT HERE 

#define FOR(i, a, b) for(int i = (a); i < (int)(b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define REV(v) v.rbegin(), v.rend()
#define MEMSET(v, s) memset(v, s, sizeof(v))
#define UNIQUE(v) (v).erase(unique(ALL(v)), (v).end())
#define MP make_pair
#define MT make_tuple

using namespace std;

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

int main(){

	int n;
	cin >> n;
	vector<string> title(n), auther(n);
	vector<vector<int>> ymd(n);
	rep(i, n){
		cin >> title[i] >> auther[i];
		int yy, mm, dd;
		char cc;
		cin >> yy >> cc >> mm >> cc >> dd;
		ymd[i] = {yy, mm, dd};
	}


	int q;
	cin >> q;
	bool f = true;
	while (q--){
		if (!f) cout << '\n';
		f = false;
		vector<int> invalid(n);
		string a, b, c, d;
		cin >> a >> b >> c >> d;
		if (a != "*") rep(i, n){
			if (title[i].find(a) == string::npos) invalid[i] = 1;
		}
		if (b != "*") rep(i, n){
			if (auther[i].find(b) == -1) invalid[i] = 1;
		}
		if (c != "*"){
			stringstream ss(c);
			int yy, mm, dd;
			char cc;
			ss >> yy >> cc >> mm >> cc >> dd;
			vector<int> v = { yy, mm, dd };
			rep(i, n){
				if (ymd[i] < v) invalid[i] = 1;
			}
		}
		if (d != "*"){
			stringstream ss(d);
			int yy, mm, dd;
			char cc;
			ss >> yy >> cc >> mm >> cc >> dd;
			vector<int> v = { yy, mm, dd };
			rep(i, n){
				if (ymd[i] > v) invalid[i] = 1;
			}
		}
		rep(i, n){
			if (invalid[i]) continue;
			cout << title[i] << '\n';
		}
	}
	
	return 0;
}

Measured memory_bytes: 1248
//abc054_c.cpp
//Tue Jun  5 22:05:14 2018

#include <iostream>
#include <string>
#include <queue>
#include <unordered_map>
#include <vector>
#include <algorithm>
using namespace std;
using ll=long long;

int graph[8][8] = {};
int visit[8] = {};
int ans = 0;

void dfs(int v, int node, int c) {
	c++;
	visit[v] = 1;
	if (c == node){
		ans++;
	}
	for (int i=0;i<node;i++){
		if (graph[v][i] == 1 && visit[i]==0){
			dfs(i,node,c);
		}
	}
	c--;
	visit[v]--;
}

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

	for (int i=0;i<m;i++){
		int a, b;
		cin >> a >> b;
		a--;
		b--;
		graph[a][b] = 1;
		graph[b][a] = 1;
	}

	int count = 0;
	dfs(0,n,count);

	cout << ans << endl;
}

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

const int MAXN = 200010;
struct graph {
	int head[MAXN], nxt[MAXN << 1], to[MAXN << 1], tot;
	void addedge(int b, int e) {
		nxt[++tot] = head[b]; to[head[b] = tot] = e;
		nxt[++tot] = head[e]; to[head[e] = tot] = b;
	}
} A, B;
int * head, * nxt, * to;
void init(graph * X) { head = X->head, nxt = X->nxt, to = X->to; }
int dep[MAXN], fa[MAXN];
void dfs(int u) {
	for (int i = head[u]; i; i = nxt[i])
		if (to[i] != fa[u]) {
			dep[to[i]] = dep[u] + 1;
			fa[to[i]] = u;
			dfs(to[i]);
		}
}
int dis12(int u, int v) {
	if (dep[u] > dep[v]) std::swap(u, v);
	return fa[v] == u || fa[fa[v]] == u || fa[u] == fa[v];
}
int n, X, Y, ans;
void dfs2(int u, int fa = 0, int dep = 0) {
	if (fa && !dis12(fa, u))
		exit((std::cout << -1 << std::endl, 0));
	if (dep > ::dep[u]) return ;
	ans = std::max(ans, ::dep[u]);
	if (dep == ::dep[u]) return ;
	for (int i = head[u]; i; i = nxt[i])
		if (to[i] != fa)
			dfs2(to[i], u, dep + 1);
}
int main() {
	std::ios_base::sync_with_stdio(false), std::cin.tie(0);
	std::cin >> n >> X >> Y;
	for (int i = 1, t1, t2; i < n; ++i)
		std::cin >> t1 >> t2, A.addedge(t1, t2);
	for (int i = 1, t1, t2; i < n; ++i)
		std::cin >> t1 >> t2, B.addedge(t1, t2);
	init(&B); dfs(Y);
	init(&A); dfs2(X);
	std::cout << ans * 2 << std::endl;
	return 0;
}


Measured memory_bytes: 15616
/*错误答案 
#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;

int a[4000];

int main() {
	int n;
	cin >> n;
	for (int i = 1; i <= n; i++) {
		cin >> a[i];
	}
	sort(a, a+n+1);
	
	int maxn = -0x3f3f3f3f;
	for (int i = a[n]+1; i <= a[n]+100000; i++) {
		int cnt = 0;
		for (int j = 1; j <= n; j++) {
			cnt += i%a[j];
		} 
		maxn = max(cnt, maxn);
	}
	
	cout << maxn << endl;
	return 0;
}
------------------*/
#include <iostream>
using namespace std;

int a[100001];
int main() {
	int n;
	int cnt = 0;
	cin >> n;
	for (int i = 1; i <= n; i++) {
		cin >> a[i];
		cnt += a[i]-1;
	}
	
	cout << cnt << endl;
	return 0;
} 

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,c) for(int i=0;i<(int)c;i++)
const int inf = 1000000000;

int main(){
int N;
cin>>N;
vector<int> X(N);
rep(i,N)cin>>X[i];
int L =X[0],R=X[0];
rep(i,N){
L=min(L,X[i]);
R=max(R,X[i]);
}
int ans = inf;
for(int i=L;i<=R;i++){
  int cost=0;
  rep(j,N) cost+=(X[j]-i)*(X[j]-i);
  ans=min(ans,cost);
}
cout<<ans<<endl;
}


Measured memory_bytes: 3628
h, w = map(int, input().split())
s = [list(input()) for i in range(h)]

for i in range(h):
    for j in range(w):
        if s[i][j] == "#":
            if s[min(i + 1, h - 1)][j] != "#" and s[i][min(j + 1, w - 1)] != "#" and s[i - 1][j] != "#" and s[i][j - 1] != "#":
                print("No")

                exit()

print("Yes")

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
 
#define ld long double
#define ll long long
#define ALL(a)  (a).begin(),(a).end()
#define spa << " " <<
ll MOD = 1e9+7;
void chmin(ll &a, ll b) { if (a > b) a = b; }
void chmax(ll &a, ll b) { if (a < b) a = b; }
 
int main(){
  ll i, j;
  string s;
  cin >> s;
  bool judge = true;
  ll c = 0;
  for(i = 0; i < s.size() && judge; i++){
    if(i == 0 && s[i] != 'A')
      judge = false;
    
    else if(i == 0);
    else if(i >= 2 && i <= s.size() - 2 && s[i] == 'C'){
      if(c == 0)
        c++;
      else
        judge = false;
      
    }
    else if(s[i] < 'a' || s[i] > 'z')
      judge = false;
    
    /*if(!judge)
      cout << s[i] spa i << endl;*/
  }
  
  if(judge && c == 1)
    cout << "AC" << endl;
  else
    cout << "WA" << endl;
    
        
  return 0;
}

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

typedef pair<int,int>P;

int n,l,r,imos[100007],ans1,ans2,sum;

vector<P>v;
vector<int>v1,v2;

int main(){
  
  cin>>n;

  for(int i=0;i<n;i++){
    cin>>l>>r;
    v.push_back(P(l,r));
    v1.push_back(l);
    v2.push_back(r);
    imos[l]++;
    imos[r]--;
  }

  sort(v1.begin(),v1.end());
  sort(v2.begin(),v2.end());

  for(int i=0;i<n;i++){
    int sum1=upper_bound(v2.begin(),v2.end(),v[i].first)-v2.begin();
    int sum2=v1.end()-lower_bound(v1.begin(),v1.end(),v[i].second);
    ans1=max(ans1,n-sum1-sum2);
  }

  for(int i=0;i<100007;i++){
    sum+=imos[i];
    ans2=max(ans2,sum);
  }

  cout<< ans1 << ' ' << ans2 <<endl;
}

Measured memory_bytes: 7604
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)  //  repマクロ
#define leng(n) (int)(log10(n)+1)  //  桁数
using namespace std;

signed main() {
  int a, b, c;
  cin >> a >> b >> c;
  cout << max(a,max(b,c)) * 9 +a+b+c << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std; 
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define pp(...) "\033[94m [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define dg1(x) debug() << pp(x)
#define dg2(x,y) debug() << pp(x) pp(y)
#define dg3(x,y,z) debug() << pp(x) pp(y) pp(z)
#define dg4(w,x,y,z) debug() << pp(w) pp(x) pp(y) pp(z)
#define msg(x) debug() << x
#define int long long
const int xx = 1e8;
signed main(){
  ios::sync_with_stdio(false);cin.tie(0);

  int n;
  int a, b , c;
  cin >> a >> b >> c;
  if(a + b + c >=22){
    cout << "bust" << '\n';
  }
  else{
    cout << "win" << '\n';
  }
}

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

long long gcd(long long aaa,long long bbb) {
    if(bbb==0) {
        return aaa;
    }
    return gcd(bbb,aaa%bbb);
}

int main (){

    char S;
    int ans = 700;
    for(int i = 0; i < 3; i++) {
        cin >> S;
        if(S == 'o') {
            ans += 100;
        }
    }

    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    long long n,i,p=0;
    string s,t;
    cin>>s>>t;
    n=s.size();
    for(i=0;i<n;i++){
        if(s[i]!=t[i])
        p++;
    }cout<<p;return 0;
}


Measured memory_bytes: 3916
#include <stdio.h>

#define N 100
#define WHITE 0
#define GRAY 1
#define BLACK 2

int n, M[N][N], color[N], d[N], f[N], tt;

void dfs_visit(int u){
  int v;
  color[u] = GRAY;
  d[u] = ++tt;
  for(v=0; v<n; v++){
    if(M[u][v]==0) continue;
    if(color[v]==WHITE) dfs_visit(v);
  }
  color[u] = BLACK;
  f[u] = ++tt;
}

void dfs(){
  int u;
  for(u=0; u<n; u++) color[u]=WHITE;
  tt = 0;
  for(u=0; u<n; u++){
    if(color[u]==WHITE) dfs_visit(u);
  }
  for(u=0; u<n; u++) printf("%d %d %d\n", u+1, d[u], f[u]);
}

int main(){
  int u, v, k, i, j;

  scanf("%d", &n);

  for(i=0; i<n; i++){
    for(j=0; j<n; j++) M[i][j]=0;
  }

  for(i=0; i<n; i++){
    scanf("%d%d", &u, &k);
    u--;
    for(j=0; j<k; j++){
      scanf("%d", &v);
      v--;
      M[u][v] = 1;
    }
  }

  dfs();

  return 0;
}



Measured memory_bytes: 2148
#include <bits/stdc++.h>
#define pb push_back
#define cmin(a,b) (a>b?a=b:a)
#define cmax(a,b) (a<b?a=b:a)
#define lop(i,s,t) for(int i=s;i<(t);++i)
#define rep(i,s,t) for(int i=s;i<=(t);++i)
#define dec(i,s,t) for(int i=s;i>=(t);--i)
#define fore(i,v) for(int i=g[v],d=es[i].d;i;i=es[i].nxt,d=es[i].d)
using namespace std;

#define Pr(f,...) //fprintf(stderr,f,##__VA_ARGS__),fflush(stderr)

const int N=2005; 

void read(int &x){
	x=0; 
	char c=getchar(); 
	for(;!isdigit(c);c=getchar()); 
	for(;isdigit(c);c=getchar())x=x*10+c-'0'; 
}

int n,a[N],deg[N],vis[N];
vector<int> g[N]; 

int gcd(int a,int b){ return !b?a:gcd(b,a%b); } 

void dfs(int v){
	vis[v]=1; 
	rep(d,1,n)if(!vis[d]&&gcd(a[d],a[v])>1){
		g[v].pb(d);
		++deg[d];
		Pr("Link %d,%d\n",v,d); 
		dfs(d); 
	}
}

int main(int argc,char *argv[]){
#ifdef CURIOUSCAT
	//freopen("dat.in","r",stdin);
	//freopen("my.out","w",stdout);
#endif
	read(n); 
	rep(i,1,n)read(a[i]); 
	sort(a+1,a+n+1); 
	rep(i,1,n)if(!vis[i])dfs(i); 
	memset(vis,0,sizeof(vis)); 
	rep(i,1,n){
		dec(j,n,1){
			if(!vis[j]&&!deg[j]){
				vis[j]=1;
				printf("%d ",a[j]);
				for(int d:g[j])--deg[d];
				break;
			}
		}
	}
	return 0; 
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
using P = pair<int,int>;
int main(){
    int n,a;
    cin >> n;
    vector<P> v;
    for(int i=1;i<=n;i++){
        cin >> a;
        v.emplace_back(a,i);
    }
    sort(v.begin(), v.end());
    for(auto p: v){
        cout << p.second << " ";
    }
    cout << endl;
}

Measured memory_bytes: 1780
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <queue>
#include <cmath>
#include <map>
#include <set>
#include <deque>
#define rep(i, n) for(int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const int mod = 1e9+7;
struct mint {
  ll x;
  mint(ll x=0):x(x%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};

struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
} comb(2000050);

int main() {
  int X, Y; cin >> X >> Y;
  if((X+Y) % 3 != 0) {
    cout << 0 << endl;
    return 0;
  }
  int m = (2*X-Y)/3, n = (2*Y-X)/3;
  if(m < 0 || n < 0) {
    cout << 0 << endl;
    return 0;
  }
  combination c(2000050);
  mint ans = c(n+m, n);
  cout << ans.x << endl;

  return 0;
}


Measured memory_bytes: 62720
def SearchEqual(s, t)
	matched = []
	for i in 0..s.length-1
		for j in 0..t.length-1
			if s[i] == t[j]
				matched << t[j]
			end
		end
	end
	matched = matched.uniq
	return matched.length
end

#input sequence of numbers S
n = gets.chomp
n = gets.chomp
n = n.split().map(&:to_i)
#input of sequence of numbers T
q = gets.chomp
q = gets.chomp
q = q.split().map(&:to_i)
#output
p SearchEqual(n, q);

Measured memory_bytes: 8976
using System;
using System.IO;

namespace Contest
{
    class Program
    {
        public void Solve()
        {
            var sc = new Scanner();
            var s = sc.Next();

            int cnt = 0;
            foreach (var c in s)
            {
                if (c != 'o') cnt++;
            }

            if (cnt >= 8)
            {
                Console.WriteLine("NO");
            }
            else
            {
                Console.WriteLine("YES");
            }
        }




        static void Main() => new Program().Solve();
    }
}

class Scanner
{
    public Scanner()
    {
        _stream = new StreamReader(Console.OpenStandardInput());
        _pos = 0;
        _line = new string[0];
        _separator = ' ';
    }
    private char _separator;
    private StreamReader _stream;
    private int _pos;
    private string[] _line;
    #region get a element
    public string Next()
    {
        if (_pos >= _line.Length)
        {
            _line = _stream.ReadLine().Split(_separator);
            _pos = 0;
        }
        return _line[_pos++];
    }
    public int NextInt()
    {
        return int.Parse(Next());
    }
    public long NextLong()
    {
        return long.Parse(Next());
    }
    public double NextDouble()
    {
        return double.Parse(Next());
    }
    #endregion
    #region convert array
    private int[] ToIntArray(string[] array)
    {
        var result = new int[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = int.Parse(array[i]);
        }

        return result;
    }
    private long[] ToLongArray(string[] array)
    {
        var result = new long[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = long.Parse(array[i]);
        }

        return result;
    }
    private double[] ToDoubleArray(string[] array)
    {
        var result = new double[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = double.Parse(array[i]);
        }

        return result;
    }
    #endregion
    #region get array
    public string[] Array()
    {
        if (_pos >= _line.Length)
            _line = _stream.ReadLine().Split(_separator);
        _pos = _line.Length;
        return _line;
    }
    public int[] IntArray()
    {
        return ToIntArray(Array());
    }
    public long[] LongArray()
    {
        return ToLongArray(Array());
    }
    public double[] DoubleArray()
    {
        return ToDoubleArray(Array());
    }
    #endregion
}

Measured memory_bytes: 13140
#include<bits/stdc++.h>
using namespace std;
typedef  long long ll;
using vll=vector<ll>;
using vi=vector<int>;
using vvi=vector<vector<int>>;
using vb=vector<bool>;
using pii=pair<int,int>;

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

//pow(llpow,modpow)
template<class T> ll llpow(ll x,T n){ll ans=1;if(x==0)ans=0;while(n){if(n&1)ans*=x;x*=x;n>>=1;}return ans;}
long long modpow(long long a, long long n, long long mod) {long long res = 1;while (n > 0) {if (n & 1) res = res * a % mod;a = a * a % mod;n >>= 1;}return res;}
//最大公約数
template<class T> inline T gcd(T x,T y){if(y==0)return x; else {return gcd(y,x%y);}}
//最小公倍数
template<class T> inline T lcm(T x,T y){return x/gcd(x,y)*y;}
//逆元
long long modinv(long long a, long long m) {long long b = m, u = 1, v = 0;while (b) {long long t = a / b;a -= t * b; swap(a, b);u -= t * v; swap(u, v);}u %= m;if (u < 0) u += m;return u;}

#define rep(i, begin_i, end_i) for (ll i = (ll)begin_i; i < (ll)end_i; i++)

long long INF = 1LL<<60;
int main( ){
    int n;
    cin>>n;
    vi a(n);
    rep(i,0,n)cin>>a[i];
    sort(a.begin(),a.end());
    auto pos=lower_bound(a.begin(),a.end()-1,a[n-1]/2);
    int b=a[n-1]/2;
    if(pos!=a.end()-1){
        if(abs(*(pos-1)-b)>=abs(a[n-1]-*pos-b)){
            cout<<a[n-1]<<" "<<*pos<<endl;
        }
        else {
            cout<<a[n-1]<<" "<<*(pos-1)<<endl;
        }
        return 0;
    }
    else{
        cout<<a[n-1]<<" "<<*(pos-1)<<endl;
    }
    return 0;
}




Measured memory_bytes: 640
//C
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>

//C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>

//Others
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;
}
const int dx[8] = { -1, 0, 1, -1, 1, -1, 0, 1 };
const int dy[8] = { 1, 1, 1, 0, 0, -1, -1, -1 };
const int lr[4] = { 0, 1, 0, -1 };
const int ud[4] = { 1, 0, -1, 0 };



//LOVE Ayane Sakura



using namespace std;

int main() {
	int N;
	cin >> N;
	map<int, int>mp;
	for (int i = 0; i < N; i++) {
		int n;
		cin >> n;
		mp[n] = 1;
	}
	int ans = 0;
	for (auto it = mp.begin(); it != mp.end(); ++it) {
		ans += it->second;
	}
	if (ans == N) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}
}


Measured memory_bytes: 9600
/** 
 * Dont raise your voice, improve your argument.
 * --Desmond Tutu
 */

#include <bits/stdc++.h>
using namespace std;

#define DEBUG
#ifndef DEBUG
#define endl "\n"
#endif

const double PI=3.1415926535897932384626433;
typedef long long ll;
#define fori(n) for(ll i=0; i<(n); i++)

#define cins(s) string s; cin>>s;
#define cini(i) int i; cin>>i;
#define cinll(l) ll l; cin>>l;
#define cind(d) double d; cin>>d;
#define cinai(a, n) vi a(n); fori(n) { cin>>a[i]; }
#define cinall(a, n) vll a(n); fori(n) { cin>>a[i]; }
#define cinas(s, n) vs s(n); fori(n) { cin>>s[i]; }

typedef pair<int, int> pii;
typedef pair<double,double> pdd;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<string> vs;
typedef vector<ll> vll;

int main() {
cin.tie(nullptr);
std::ios::sync_with_stdio(false);
    cini(n);

    int ans=(n-1)/2;
    cout<<ans<<endl;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 100010*2;
const ll MOD = 1000000007;
int h, w, a, b;
ll fac[N], inv[N];
void init() {
    fac[0] = inv[0] = 1;
    for (int i = 1; i < N; i++) {
        fac[i] = fac[i-1] * i %MOD;
    }
    inv[1] = 1;
    for (int i = 2; i < N; i++) {
        inv[i] = 1ll * (MOD - MOD/i) * inv[MOD%i] %MOD;
    }
    for (int i = 1; i < N; i++) {
        inv[i] = inv[i-1] * inv[i] %MOD;
    }
}
inline ll C(int n, int k) {
    return fac[n] * inv[k] %MOD * inv[n-k] %MOD;
}
int main() {
    init();
    cin >> h >> w >> a >> b;
    ll ans = 0;
    for (int i = 1; i <= h-a; i++) {
        ans += 1ll * C(i+b-2, i-1) * C(h-i+w-b-1, h-i) %MOD;
        ans %= MOD;
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 3328
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define all(c) begin(c),end(c)

template<typename T1, typename T2>
inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }

template<typename T1, typename T2>
inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }

//改造
typedef long long int ll;
using namespace std;
#define INF (1 << 30) - 1
#define INFl (ll)5e15
#define DEBUG 0 //デバッグする時1にしてね
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007


//ここから編集する
class Solve {
public:
    void input() {

    }

    void solve() {
        input();
        int n, k;
        cin >> n >> k;
        vector<int> l(n);
        rep(i, 0, n) cin >> l[i];
        sort(all(l));
        int ans;
        for (int i = 0; i + k - 1 < n; ++i) {
            if (i == 0) ans = l[i + k - 1] - l[i];
            chmin(ans, l[i + k - 1] - l[i]);
        }

        cout << ans << endl;

    }
};


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

    Solve().solve();


    return 0;
}


Measured memory_bytes: 640