akhauriyash/Code-Regression huggingface dataset:
package main

import (
	"fmt"
)

func main() {
	var n int
	var m int

	fmt.Scan(&n)
	fmt.Scan(&m)
	arr := make([]int, n)
	total := 0
	for i := range arr {
		fmt.Scan(&arr[i])
		total += arr[i]
	}

	cnt := 0
	for _, e := range arr {
		if 4 * m * e >= total {
			cnt++
		}
	}
	if cnt >= m {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


Measured memory_bytes: 512
#include<iostream>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <climits>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <iomanip>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
const long long int mod1=1000000007;
const long long int mod2 = -1;
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pb push_back
#define pp pop_back                                       
#define ff first
#define ss second
#define ll long long int
#define ull unsigned long long int
#define ordered_set tree<ll,null_type,less_equal<ll>,rb_tree_tag,tree_order_statistics_node_update>
#define ordered1 tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>
#define inf mod1
#define all(x) x.begin(),x.end()
ll gcd(ll a, ll b){
    ll c;
     while(b){
        c = b;
        b = a % b;
        a = c;
     }
     return a;
}
ll power1(ll a, ll b){
     if(b == 0) return 1;
     else if(b % 2) return a * power1(a, b - 1);
     else {
        ll temp = power1(a, b / 2);
        return temp * temp;
     }
}
ll power2(ll a, ll b, ll m){
     a %= m;
     if(b == 0) return 1;
     else if(b % 2) return (a * power2(a, b - 1, m)) % m;
     else{
        ll temp = power2(a, b / 2, m);
        return (temp * temp) % m;
     }
}
ll mod(ll x, ll p){
return (x % p + p) % p;
}
ll lcm(ll x, ll y){
return (x * y)/gcd(x, y);
}
int main(){
    fast;
    ll h = 1;
    //scanf("%lld", &h);
    while(h--){
        ll n;
        cin >> n;
        ll o = 0;
        for(int i = 1; i <= n; i++){
            if(i % 3 != 0 && i % 5 != 0){
                o += i;
            }
        }
        cout << o << endl;
}
}

Measured memory_bytes: 3652
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
  vector<int> v(3);
  cin>>v[0]>>v[1]>>v[2];
  sort(v.begin(),v.end());
  if(v[0]==5&&v[1]==5&&v[2]==7)cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
}

Measured memory_bytes: 256
if __name__ == '__main__':
    B = str(input())
    A = ''
    for b in B:
        if b =='A':
            A += 'T'
        elif b == 'T':
            A += 'A'
        elif b == 'C':
            A += 'G'
        elif b =='G':
            A += 'C'
            
    print(A)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define loop(i,a,n) for(int i=a;i<n;i++)
int main(){
	long long int n;
  	scanf("%lld",&n);
    
    long long int ans = 0;
    
    loop(i,1,n+1){
        loop(j,1,n+1){
            loop(k,1,n+1){
                ans += __gcd(i,__gcd(j,k));
            }
        }
    }
    
  	printf("%lld",ans);
  	puts("");
}

Measured memory_bytes: 3812
import java.util.*;

public class Main
{
  public static void main(String args[])
  {
    Scanner scan = new Scanner(System.in);
	int pair=0;
	String s1 = new String();
	String s2 = new String();
	s1=scan.nextLine();
	s2=scan.nextLine();
	char[] ch1 = s1.toCharArray();
	char[] ch2 = s2.toCharArray();
	for(int i=0;i<ch1.length;i++)
	{
		if(ch1[i]==ch2[i])
		{
			pair++;
		}
	}
	System.out.println(pair);
  }
}

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

int main(){
  long long D,N;
  cin >> D >> N;
  if(D ==0){
    if(N == 100)
      cout << 101 << endl;
    else
      cout << N << endl;
  }
  else{
    if(N == 100){
      int ans=pow(100,D)*101;
      cout << ans<<endl;
    }
    else
      cout << pow(100,D)*N<<endl;
  }
}
  


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define stoi stoll
using pii=pair<int,int>;
using vi = vector<int>;
using vvi = vector<vi>;
#define all(c) begin(c),end(c)
#define rall(c) rbegin(c),rend(c)
#define fore(x,c) for(auto &&x:c)
#define rep(i,a,n) for(int i=a,i##len=(int)(n);i<i##len;++i)
#define rrep(i, a, n) for(int i=(int)(n-1);i>=a;--i)
#define sz(c) ((int)c.size())
#define contains(c,x) (c.find(x)!=end(c))
#define inseg(l,x,r) ((l)<=(x)&&(x)<(r))
#define dump(...)
#define pb push_back
#define _ 0
const signed INF_=1001001001; const long long INF=1001001001001001001LL;
const int DX[9]={0,1,0,-1,1,1,-1,-1,0},DY[9]={-1,0,1,0,-1,1,1,-1,0};
template<class T> ostream& operator<<(ostream &os,const vector<T> &v) {
    for (auto i = begin(v); i != end(v); i++) os<<*i<<(i==end(v)-1?"":" ");return os;}
template<class T> istream& operator>>(istream &is,vector<T> &v) {
    for (auto i = begin(v); i != end(v); i++) is>>*i;return is;}
template<class T,class U> istream& operator>>(istream &is, pair<T,U> &p) {
    is>>p.first>>p.second;return is;}
template<class T, class U> bool chmax(T &a,const U &b){return a<b?a=b,1:0;}
template<class T, class U> bool chmin(T &a,const U &b){return a>b?a=b,1:0;}
template <class T> void psum(T& c) {partial_sum(begin(c), end(c), begin(c));}
template<class T> using heap=priority_queue<T,vector<T>,greater<T>>;
struct before_main_function {
    before_main_function() {
        cin.tie(nullptr); ios::sync_with_stdio(0);
        cout << setprecision(15) << fixed;
        // #define endl "\n"
    }
} before_main_function;
//------------------8<------------------------------------8<--------------------

signed main() {
    int N;
    cin >> N;
    vector<int> A(N);
    cin >> A;
    vector<int> cnt;
    int s = 0;
    {
        map<int, int> tmp;
        for (int x : A) tmp[x]++;
        for (pii x : tmp) {
            cnt.emplace_back(x.second);
            s += x.second;
        }
        sort(all(cnt));
    }
    vi p = cnt;
    psum(p);
    // dump(s, cnt, p);
    vi S(N + 1);
    rep(x, 1, N + 1) {
        int bg = lower_bound(all(cnt), x) - cnt.begin();
        int tmp = p.back();
        if (bg > 0) tmp -= p[bg - 1];
        S[x] = s - (tmp - (sz(p) - bg) * x);
    }

    rep(K, 1, N + 1) {
        auto check = [&](int x) {
            return (S[x] >= K * x);
        };

        int ok = 0;
        int ng = N + 1;
        while (abs(ok - ng) > 1) {
            int x = (ok + ng) / 2;
            if (check(x)) {
                ok = x;
            } else {
                ng = x;
            }
        }
        cout << ok << endl;
    }
    return (0^_^0);
}



Measured memory_bytes: 25708
#include<iostream>
using namespace std;
int main(){
  int N,M;
  cin >> N >> M;
  int ans[N],pena[N];
  for(int i=0;i<N;i++){
    ans[i]=0;pena[i]=0;
  }

  for(int i=0;i<M;i++){
    int p;string S;
    cin >> p >> S;
    if(S=="AC"){
      if(ans[p-1]==0){
        ans[p-1]=1;
      }
    }
    else{
      if(ans[p-1]==0){
        pena[p-1]++;
      }
    }
  }
  int A=0,P=0;
  for(int i=0;i<N;i++){
    if(ans[i]==1){
      A++;P+=pena[i];
    }
  }
  cout << A << " " << P << endl;
  return 0;
}

Measured memory_bytes: 1024
K = int(input())

run = [i for i in range(10)]

for keta in range(10):
    for i in range(len(run)):
        x = run[i] // 10**keta
        if x == 0:
            if int(str(run[i])[0]) > 1:
                continue
        for j in range(max(x-1, 1), min(10, x+2)):
            run.append(run[i] + j*10**(keta+1))


run.sort()
print(run[K])

Measured memory_bytes: 31464
#include <bits/stdc++.h>
#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)
typedef long long ll;
long long MOD = 1e9 + 7;
const long long INF = 1LL << 60;
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;
}

int main() {
  int n;
  cin >> n;
  vector<int> p, q, v;

  rep(i, n) {
    int p_i;
    cin >> p_i;
    p.push_back(p_i);
  }

  rep(i, n) {
    int q_i;
    cin >> q_i;
    q.push_back(q_i);
  }

  rep(i, n) { v.push_back(i + 1); }

  int p_count = 0;
  int q_count = 0;

  int p_val = 0;
  int q_val = 0;

  rep(i, n) {
    p_val += p[i] * pow(10, n - 1 - i);
    q_val += q[i] * pow(10, n - 1 - i);
  }

  do {
    int val = 0;
    rep(i, n) { val += v[i] * pow(10, n - 1 - i); }

    if (p_val > val)
      p_count++;
    if (q_val > val)
      q_count++;
  } while (next_permutation(v.begin(), v.end()));

  cout << abs(q_count - p_count) << endl;
  return 0;
}


Measured memory_bytes: 256
package main

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

func main() {
	fsc := NewFastScanner()
	a,b := fsc.NextInt(),fsc.NextInt()
	if a * b % 2 == 0 {
		fmt.Println("Even")
	}else{
		fmt.Println("Odd")
	}
}

//template
type FastScanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewFastScanner() *FastScanner {
	rdr := bufio.NewReaderSize(os.Stdin, 1024)
	return &FastScanner{r: rdr}
}
func (s *FastScanner) Next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *FastScanner) NextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *FastScanner) NextInt() int {
	v, _ := strconv.Atoi(s.Next())
	return v
}
func (s *FastScanner) NextInt64() int64 {
	v, _ := strconv.ParseInt(s.Next(), 10, 64)
	return v
}

func (s *FastScanner) NextIntArray() []int {
	s.pre()
	start := s.p
	result := []int{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 0)
			result = append(result, int(v))
			start = s.p + 1
		}
	}

	return result
}

func (s *FastScanner) NextInt64Array() []int64 {
	s.pre()
	start := s.p
	result := []int64{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 64)
			result = append(result, v)
			start = s.p + 1
		}
	}
	return result
}

func (s *FastScanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *FastScanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}

//Max,Min
func IntMax(a, b int) int {
	if a < b {
		return b
	}
	return a
}

func Int64Max(a, b int64) int64 {
	if a < b {
		return b
	}
	return a
}
func Float64Max(a, b float64) float64 {
	if a < b {
		return b
	}
	return a
}

func IntMin(a, b int) int {
	if a > b {
		return b
	}
	return a
}

func Int64Min(a, b int64) int64 {
	if a > b {
		return b
	}
	return a
}
func Float64Min(a, b float64) float64 {
	if a > b {
		return b
	}
	return a
}

//Gcd
func IntGcd(a, b int) int {
	if a < b {
		b, a = a, b
	}
	if b == 0 {
		return a
	}
	return IntGcd(b, a%b)
}
func Int64Gcd(a, b int64) int64 {
	if a < b {
		b, a = a, b
	}
	if b == 0 {
		return a
	}
	return Int64Gcd(b, a%b)
}

func IntAbs(a int) int {
	if a < 0 {
		a *= -1
	}
	return a
}

func Int64Abs(a int64) int64 {
	if a < 0 {
		a *= -1
	}
	return a
}


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

typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;
#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev
#define dump(x)  cout << #x << " = " << (x) << endl;	//debug
#define SZ(x) ((int)(x).size())
#define REP(i, n) for(ll i = 0; i < (n); i++)
#define REPR(i, n) for (ll i = (n); i >= 0; i--)
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)

int main() {
	string s, t;
	cin >> s >> t;
	cout << t + s << endl;
	return(0);
}

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

using namespace std;

int main()
{
    int n,n1;
    string s,t;
    cin >> n >> s >> t;
    n1=n*2;
    char f[n1];
    for(int i=0,j=0;i<n1;i+=2,j++)
    {
        f[i]=s[j];
    }
    for(int i=1,j=0;i<n1;i+=2,j++)
    {
        f[i]=t[j];
    }

    for(int i=0;i<n1;i++){ cout << f[i]; }
    cout << endl;
    return 0;
}


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

int main(){

  int n;
  bool b = false;

  cin >> n;

  for(int cake=0; cake <= 100; cake += 4){
    for(int donut=0; donut + cake <= 100; donut += 7){
      if(cake + donut == n) b = true;
    }
  }

  if(b){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }

  return 0;
}


Measured memory_bytes: 888
#include <algorithm>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
/* #include <regex> */

using namespace std;

/* g++ -g -fsanitize=address -lasan -std=c++11 -Dfoo_ */

/* freopen("input.txt", "rt", stdin); */
/* freopen("output.txt", "wt", stdout); */

#define ALL(c)          (c).begin(), (c).end()
#define ALLR(c)         (c).rbegin(), (c).rend()
#define FOR(i,a,b)      for (int i=(a); i < (b); ++i)
#define FORR(i,a,b)     for (int i=(a); i > (b); --i)
#define FOR_ALL(i,c)    for (__typeof((c).begin()) i=(c).begin();   \
                             i != (c).end(); ++i)
#define FOR_ALLR(i,c)   for (__typeof((c).rbegin()) i=(c).rbegin(); \
                             i != (c).rend(); ++i)
#define SZ(array)       (sizeof(array)/sizeof(array[0]))
#define lc(x)           (x<<1)     /* 2*x */
#define rc(x)           (x<<1 | 1) /* 2*x+1 */
#define lowbit(x)       (x & (-x)) /* 0b10100 -> 0b100 */

typedef long long       LL;
typedef map<int,int>    MII;
typedef pair<int,int>   PII;
typedef set<int>        SI;
typedef vector<bool>    VB;
typedef vector<double>  VD;
typedef vector<int>     VI;
typedef vector<string>  VS;

/* check if a key is in container C */
template <class C>
inline bool in_(const typename C::key_type& k, const C& A)
{ return A.find(k) != A.end(); }
inline bool in_(const string& s, const string& S)
{ return S.find(s) != string::npos; }

const int inf = 1e9;
const int maxn = 1e6;
int n, dp[maxn][2]; string s;

bool isW(const int i)
{ return s[i] == '.'; }
bool isB(const int i)
{ return !isW(i); }

int main()
{
#ifdef foo_
    freopen("foo", "rt", stdin);
#endif
    ios::sync_with_stdio(false);
    while (cin >> n >> s) {
        s = '.' + s; n++;
        FOR(i,0,n) FOR(j,0,2)
            dp[i][j] = inf;
        dp[0][0] = 0;
        FOR(i,1,n) FOR(j,0,2) {
            if (j) {
                dp[i][j] = min(dp[i][j], dp[i-1][0] + !isB(i));
                dp[i][j] = min(dp[i][j], dp[i-1][1] + !isB(i));
            }
            else {
                dp[i][j] = min(dp[i][j], dp[i-1][0] + !isW(i));
            }
        }        
        const int ans = min(dp[n-1][0], dp[n-1][1]);
        cout << ans << endl;
    }
	return 0;
}


Measured memory_bytes: 2128
import sys
import math

#num = [int(i) for i in sys.argv[2:]]
n = input()
num = [int(i) for i in sys.stdin.readlines()]
count = 0

for i in num:
    if i == 1:
        continue
    elif i == 2:
        #print(i)
        count += 1
        continue

    square = int(math.sqrt(i))

    for j in range(2, square+1):
        if i % j == 0:
            break
    else:
        #print(i)
        count += 1

print(count)


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

using namespace std;

using ll = long long;

template <typename T>
struct fenwick{
  vector<T> fenw;
  int n;

  fenwick(int n): n(n){
    fenw.resize(n);
  }
  
  void modify(int x, T val){
    for( ; x < n; x |= (x + 1)){
      fenw[x] += val;
    }
  }

  T get(int x){
    T res {};
    for(; x >= 0; x = (x & (x + 1)) - 1){
      res += fenw[x];
    }
    return res;
  }
};

int main(){
  ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  cout.setf(ios::fixed); cout.precision(17);
  
  int n;
  cin >> n;
  vector<int> a(n), data;
  for(int i = 0; i < n; i++){
    cin >> a[i];
    data.push_back(a[i]);
  }
  sort(data.begin(), data.end());
  int m = unique(data.begin(), data.end()) - data.begin();
  data.resize(m);
  int l = 0, h = m;
  ll all_medians = (n * 1ll * (n + 1))/2;
  while(h - l > 1){
    int mid = (l + h)>>1;
    ll sum = 0;
    int at = n;
    fenwick<ll> fenw(n + n);
    fenw.modify(n, 1);
    for(int i = 0; i < n; i++){
      if(a[i] >= data[mid]) at++;
      else at--;
      sum += fenw.get(at);
      fenw.modify(at, 1);
    }
    if(2 * sum >= all_medians){
      l = mid;
    } else {
      h = mid;
    }
  }
  cout << data[l] << "\n";
  return 0;
}



Measured memory_bytes: 2680
#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair <int, ll> P;
const ll INF = 1ll << 60;

void bellman_ford(
        vector<vector<P>> &edge,
        vector<ll> &dist,
        vector<bool> &loop,
        int s) {
    int n = edge.size();
    dist.resize(n, INF);
    dist[s] = 0;
    for (int i = 1; i < n; i++) {
        for (int from = 0; from < n; from++) {
            if (dist[from] == INF) continue;
            for (P e : edge[from]) {
                int to = e.first;
                dist[to] = min(dist[to], dist[from] + e.second);
            }
        }
    }

    loop.resize(n, false);
    for (int i = 0; i < n; i++) {
        for (int from = 0; from < n; from++) {
            if (dist[from] == INF) continue;
            for (P &e : edge[from]) {
                int to = e.first;
                if (dist[to] > dist[from] + e.second) {
                    dist[to] = dist[from] + e.second;
                    loop[from] = true;
                    loop[to] = true;
                }
            }
        }
    }
}


// verified
//   http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=GRL_1_B&lang=jp
void AOJ_GRL_1_B() {
    int V, E, r;
    cin >> V >> E >> r;
    vector<vector<P>> edge(V);
    for (int i = 0; i < E; i++) {
        int s, t, d;
        cin >> s >> t >> d;
        edge[s].push_back({t, d});
    }
    vector<ll> dist;
    vector<bool> loop;
    bellman_ford(edge, dist, loop, r);
    for (int i = 0; i < V; i++) {
        if (loop[i]) {
            cout << "NEGATIVE CYCLE" << "\n";
            return;
        }
    }
    for (ll d : dist) {
        if (d == INF) cout << "INF\n";
        else cout << d << "\n";
    }
}


// verified
//  https://atcoder.jp/contests/abc061/tasks/abc061_d
void AtCoder_2017_05_13_D() {
    int n, m;
    cin >> n >> m;
    vector<vector<P>> edge(n);
    for (int i = 0; i < m; i++) {
        int a, b; ll c;
        cin >> a >> b >> c;
        edge[--a].push_back({--b, -c});
    }
    vector<ll> dist;
    vector<bool> loop;
    bellman_ford(edge, dist, loop, 0);
    if (loop[n - 1]) cout << "inf" << endl;
    else cout << -dist[n - 1] << endl;
}

int main() {
    AOJ_GRL_1_B();
    // AtCoder_2017_05_13_D();
    return 0;
}


Measured memory_bytes: 3168
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <algorithm>
using namespace std;



int main(void)
{
    int n;
    long long k; cin >> n >> k;
    vector<int> p(n);
    for (int i = 0; i < n; i++) cin >> p[i];
    vector<long long> c(n);
    for (int i = 0; i < n; i++) cin >> c[i];

    vector<vector<long long>> scores(n, vector<long long>(0));
    for (int i = 0; i < n; i++)
    {
        int s = p[i] - 1;
        long long score = c[s];
        scores[i].push_back(score);
        while (s != i)
        {
            s = p[s] - 1;
            score += c[s];
            scores[i].push_back(score);
        }
    }
    long long ans = -1234567890;
    for (long long i = 0; i < n; i++)
    {
        if (scores[i].back() > 0)
        {
            long long t = k / scores[i].size();
            long long v = k % scores[i].size();
            long long u = t * scores[i].back();
            for (long long j = 0; j < v; j++) ans = max(ans, u + scores[i][j]);
            if (t > 0)
            {
                u -= scores[i].back();
                for (long long j = v; j < (long long) scores[i].size(); j++) ans = max(ans, u + scores[i][j]);
            }
        }
        else
        {
            long long v = min(k, (long long) scores[i].size());
            for (long long j = 0; j < v; j++) ans = max(ans, scores[i][j]);
        }
    }
    cout << ans << endl;
}


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

int main() {
  long n,a,b,ans=1,m=2,nca=1,ncb=1,mod=1000000007;
  cin >> n >> a >> b;
  if(a>n/2) a=n-a;
  if(b>n/2) b=n-b;
  for(long i=1;i<=n;i=i*2) {
    if(n/i%2==1) ans=ans*m%mod;
    m=m*m%mod;
  }
  ans=ans-1;
  if(ans<0) ans+=mod;

  for(long i=0;i<a;i++) {
    nca=nca*(n-i)%mod;
    m=i+1;
    long c=1;
    for(long j=1;j<=(mod-2);j=j*2) {
      if((mod-2)/j%2==1) c=c*m%mod;
      m=m*m%mod;
    }
    nca=nca*c%mod;
  };
  
  for(long i=0;i<b;i++) {
    ncb=ncb*(n-i)%mod;
    m=i+1;
    long c=1;
    for(long j=1;j<=(mod-2);j=j*2) {
      if((mod-2)/j%2==1) c=c*m%mod;
      m=m*m%mod;
    }
    ncb=ncb*c%mod;
  };

  ans=ans-nca;
  if(ans<0) ans+=mod;
  ans=ans-ncb;
  if(ans<0) ans+=mod;
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include<string>
#include<cmath>
#include<stack>
#include <vector>
#include<queue>
#include <random>
#include <cstdint>
#include <bitset>
#include <iomanip>
#include<utility>
using namespace std;
using ll = long long;

int main() {
	int k, n, amin,ans=1000000;
	cin >> n >> k;
	for (int i = 0; i < n; i++) {
		int a;
		cin >> a;
		if (a == 1)amin = i+1;
	}
	for (int i = 0; i < k; i++) {
	ans = min(ans, (amin -k+ i+k-2) / (k - 1) + (n - amin+k-2 - i) / (k - 1)+1);
}
	cout << ans << endl;
	return 0;
}

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

int main() {
    int n,m,ans=0;
    queue<int> q;
    cin >> n >> m;
    vector<int> a(m);
    rep(i,m) a.at(i)=0;
    vector<vector<int>> b(n,vector<int>(0)),c(n,vector<int>(0));
    int t,y;
    rep(i,m){
        cin >> t >> y;
        b.at(t-1).push_back(i);
        c.at(y-1).push_back(i);
    }
    for(int i=0;i<n;i++){
        rep(j,c.at(i).size()) {
            if (a.at(c.at(i).at(j))==0){
                ans++;
                while(!q.empty()){
                    a.at(q.front())=1;
                    q.pop();
                }
                break;
            }
        }
        rep(j,b.at(i).size()){
            q.push(b.at(i).at(j));
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 10752
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
 
int main(void){
	int r;
	char str[1000];
 
	fgets(str, sizeof(str), stdin);
	r=atoi(str);
  
	printf("%lf\n",6.28318*r);
 
	return 0;
}

Measured memory_bytes: 2152
N,K = map(int,input().split())
answer=0

if K%2==0: #余りK/2と0の２パターン
    rem_0=N//K
    rem_K2=(N//(K/2))-rem_0
    answer=int(rem_0**3+rem_K2**3)
else: #余りが0のみのパターン
    answer=int((N//K)**3)

print(answer)

Measured memory_bytes: 38384
#include "bits/stdc++.h"
#pragma GCC optimize("Ofast")

// Begin {{{
using namespace std;

#ifndef DEBUG
#define dump(...)
#endif

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

template <class T>
inline vector<T> make_v(const T &initvalue, size_t sz) {
    return vector<T>(sz, initvalue);
}

template <class T, class... Args>
inline auto make_v(const T &initvalue, size_t sz, Args... args) {
    return vector<decltype(make_v<T>(initvalue, args...))>(sz, make_v<T>(initvalue, args...));
}

constexpr int INF = 0x3f3f3f3f;
constexpr int64_t LINF = 0x3f3f3f3f3f3f3f3fLL;

constexpr size_t    operator""_sz(unsigned long long value) { return value; };
constexpr intmax_t  operator""_im(unsigned long long value) { return value; };
constexpr uintmax_t operator""_um(unsigned long long value) { return value; };
// }}} End

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    intmax_t N;
    cin >> N;

    intmax_t res = 0;
    for (intmax_t i = 1; i * i <= N; ++i) {
        if (N / i == N % i) {
            res += i;
        } else if (N / i - 1 != 0 && N / (N / i - 1) == (N % (N / i - 1))) {
            res += (N / i - 1);
        }
    }

    cout << res << "\n";

    return 0;
}


Measured memory_bytes: 256
import java.util.*; 
import java.lang.*; 

public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		
		long N = scan.nextLong();
		long K = scan.nextLong();
		
		if(N>=K){
		if(N%K==0){
			System.out.println(0);
		}
		else{
			if((K/2.0) >= N%K){
			N = N-K*(N/K);
			System.out.println(N);
			if(N<=0){
				N=N*(-1);
			}
			}
			
			else{
			N = N-(K*((N/K)+1));
			
			if(N<=0){
				N=N*(-1);
			}
			System.out.println(N);
			}
		}
		}
		
		else{
			if(K>=N*2){
				System.out.println(N);
			}
			
			else{
				System.out.println(K-N);
			}
		}
	}
}

Measured memory_bytes: 23124
#include<bits/stdc++.h>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<algorithm>
#include<map>
#include<cmath>
#include<complex>
using namespace std;

typedef complex<double> P;

#define X real()
#define Y imag()
typedef int kz;

kz gcd(kz a,kz b) { if(b==0) return a; else gcd(b,a%b); }

int main(){
    int n;
    char s[2];
    int ans[4]={0};
    while (scanf("%d,%s",&n,s)!=EOF){
        if(!strcmp(s,"A")) {
            ans[0]++;
        } else if(!strcmp(s,"B")) {
            ans[1]++;
        } else if(!strcmp(s,"AB")) {
            ans[2]++;
        } else {
            ans[3]++;
        }
    }
    for (int i=0;i<4;++i) {
        printf("%d\n",ans[i]);
    }
    return 0;
}

Measured memory_bytes: 3180
/*#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>*/
#include <bits/stdc++.h>

using namespace std;
//using namespace __gnu_pbds;
 
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

#define FOR(i, a, b) for (int i=a; i<b; i++)
#define F0R(i, a) for (int i=0; i<a; i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
 
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound

const int MOD = 1000000007;
double PI = 4*atan(1);

vi adj[100001];
int N, pre[100001], dist[100001], col[100001];

void dfs(int p, int n) {
    pre[n] = p;
    for (int x: adj[n]) if (x != p) {
        dist[x] = dist[n]+1;
        dfs(n,x);
    }
}

int get(int p, int n) {
    int ret = 1;
    for (int a: adj[n]) if (a != p && col[a] == 0) ret += get(n,a);
    return ret;
}

int main() {
	ios_base::sync_with_stdio(0);cin.tie(0);
	cin >> N; 
	FOR(i,1,N) {
	    int a,b; cin >> a >> b;
	    adj[a].pb(b);
	    adj[b].pb(a);
	}
	
	dfs(1,1);
	int distn = dist[N], c = N;
	while (c != 1) {
	    if (dist[c] >= distn/2+1) col[c] = 2;
	    else col[c] = 1;
	    c = pre[c];
	}
	col[c] = 1;
	
	ll A = 0, B = 0;
	FOR(i,1,N+1) if (col[i] == 1) A += get(i,i);
	else if (col[i] == 2) B += get(i,i);
	
	if (A > B) cout << "Fennec";
	else cout << "Snuke";
}

Measured memory_bytes: 11648
#include<bits/stdc++.h>
using namespace std;
#define MAXN	1005
#define INF	1e9
int n, m, k;
char mp[MAXN][MAXN];
int dist[MAXN][MAXN];
void work(int sx, int sy) {
	int l = 0, r = 0;
	static int qx[MAXN * MAXN], qy[MAXN * MAXN];
	qx[0] = sx, qy[0] = sy;
	memset(dist, -1, sizeof(dist));
	dist[sx][sy] = 0;
	while (l <= r) {
		if (dist[qx[l]][qy[l]] == k) return;
		int tx, ty;
		tx = qx[l] - 1, ty = qy[l];
		if (mp[tx][ty] == '.' && dist[tx][ty] == -1) {
			dist[tx][ty] = dist[qx[l]][qy[l]] + 1;
			qx[++r] = tx;
			qy[r] = ty;
		}
		tx = qx[l] + 1, ty = qy[l];
		if (mp[tx][ty] == '.' && dist[tx][ty] == -1) {
			dist[tx][ty] = dist[qx[l]][qy[l]] + 1;
			qx[++r] = tx;
			qy[r] = ty;
		}
		tx = qx[l], ty = qy[l] - 1;
		if (mp[tx][ty] == '.' && dist[tx][ty] == -1) {
			dist[tx][ty] = dist[qx[l]][qy[l]] + 1;
			qx[++r] = tx;
			qy[r] = ty;
		}
		tx = qx[l], ty = qy[l] + 1;
		if (mp[tx][ty] == '.' && dist[tx][ty] == -1) {
			dist[tx][ty] = dist[qx[l]][qy[l]] + 1;
			qx[++r] = tx;
			qy[r] = ty;
		}
		l++;
	}
}
int main() {
	scanf("%d%d%d", &n, &m, &k);
	for (int i = 1; i <= n; i++)
		scanf("\n%s", mp[i] + 1);
	for (int i = 1; i <= n; i++)
	for (int j = 1; j <= m; j++)
		if (mp[i][j] == 'S') work(i, j);
	int ans = INF;
	for (int i = 1; i <= n; i++)
	for (int j = 1; j <= m; j++) {
		if (dist[i][j] == -1) continue;
		int tmp;
		tmp = i - 1;
		if (tmp == 0) ans = 0;
		else ans = min(ans, (tmp - 1) / k + 1);
		tmp = j - 1;
		if (tmp == 0) ans = 0;
		else ans = min(ans, (tmp - 1) / k + 1);
		tmp = n - i;
		if (tmp == 0) ans = 0;
		else ans = min(ans, (tmp - 1) / k + 1);
		tmp = m - j;
		if (tmp == 0) ans = 0;
		else ans = min(ans, (tmp - 1) / k + 1);
	}
	cout << ans + 1 << endl;
	return 0;
}

Measured memory_bytes: 12544
import java.util.*;
import java.lang.Math;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    boolean judge = true;
    boolean cex = true;
    
    for(int i = 0; i < s.length() && judge;i++){
      if(i == 0){
      	if(!(s.charAt(i) == 'A')) judge = false;
      }
      else if(i > 1 && i < s.length()-1 && cex){
        if(s.charAt(i) == 'C') cex = false;
        else if((int)s.charAt(i) < 96 || 122 < (int)s.charAt(i)) judge = false; 
      }
      else{
        if((int)s.charAt(i) < 96 || 122 < (int)s.charAt(i)) judge = false;
      }
    }
  	
    if(!cex && judge) System.out.println("AC");
    else System.out.println("WA");
  }
}


Measured memory_bytes: 35628
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<long long> vll;
typedef vector<pair<int,int>> vpi;
typedef vector<pair<long long, long long>> vpl;
typedef pair<int,int> pii;
typedef pair<long long, long long> pll;
#define INF (int)(1e9)
#define MAXX 1.1529215e+18
#define inf 999999
#define EPS (1e-7)
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define REP(i,n) for(int i=1;i<=(int)(n);i++)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define ALL(a)  a.begin(),a.end()
#define RALL(a) a.begin(),a.end(),greater<int>()
#define ROT(a) a.begin(),a.begin()+1,a.end()
#define RROT(a) a.begin(),a.end()-1,a.end()
#define PB push_back
#define MP make_pair
#define PI acos(-1.0)
#define sz(a) a.size()
const ll MOD = 1e9+7;
const int MAX = 10000000;
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }
//cout << 'H' << endl;
/*--------------------------------------------*/

int main(){
    //cout << fixed << setprecision(10)
    cin.tie(0);
    ios::sync_with_stdio(false);

    string s;
    cin >> s;

    rep(i,sz(s)){
        if(i%2 == 0){
            cout << s[i];
        }
    }
}

Measured memory_bytes: 592
#![allow(unused_imports)]

#[macro_use]
mod _input {
    use std::fmt;
    use std::io::{self, Read};
    use std::str::{self, FromStr};

    macro_rules! input {
        ($($name:ident : $t:tt),*,) => {
            input!($($name: $t),*)
        };
        ($($name:ident : $t:tt),*) => {
            let mut _scanned = ::_input::Scanned::new(::std::io::stdin(), 1024);
            $(
                let $name = _read_value!(_scanned, $t);
            )*
        };
    }

    macro_rules! _read_value {
        ($scanned:expr, ($($t:tt),*)) => {
            ($(_read_value!($scanned, $t)),*)
        };
        ($scanned:expr, [$t:tt; $n:expr]) => {
            (0..$n).map(|_| _read_value!($scanned, $t)).collect::<Vec<_>>()
        };
        ($scanned:expr, _bytes) => {
            _read_value!($scanned, String).into_bytes()
        };
        ($scanned:expr, _1based) => {
            _read_value!($scanned, usize) - 1
        };
        ($scanned:expr, $t:ty) => {
            $scanned.next::<$t>()
        };
    }

    #[derive(Default)]
    pub struct Scanned {
        buf: Vec<u8>,
        pos: usize,
    }

    impl Scanned {
        pub fn new<R: Read>(mut input: R, estimated: usize) -> Self {
            let mut buf_ = Vec::with_capacity(estimated);
            let _ = io::copy(&mut input, &mut buf_).unwrap();
            if buf_.last() != Some(&b'\n') {
                buf_.push(b'\n');
            }
            debug_assert!(str::from_utf8(&buf_).is_ok());
            debug_assert!(buf_.iter().all(|&c| u32::from(c) <= 0x7F));
            Scanned { buf: buf_, pos: 0 }
        }

        #[inline]
        pub fn next<T: FromStr>(&mut self) -> T
        where
            T::Err: fmt::Debug,
        {
            let mut start = None;
            loop {
                match (self.buf[self.pos], start.is_some()) {
                    (b' ', true) | (b'\n', true) => break,
                    (_, true) | (b' ', false) | (b'\n', false) => self.pos += 1,
                    (_, false) => start = Some(self.pos),
                }
            }
            let target = &self.buf[start.unwrap()..self.pos];
            unsafe { str::from_utf8_unchecked(target) }.parse().unwrap()
        }
    }
}

use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
use std::io::{self, BufWriter, Read, Stderr, StderrLock, Stdout, StdoutLock, Write};
use std::num::{ParseFloatError, ParseIntError};
use std::ops::{
    Add, AddAssign, BitAnd, BitAndAssign, BitOr, BitOrAssign, BitXor, BitXorAssign, Div, DivAssign,
    Mul, MulAssign, Neg, Not, Rem, RemAssign, Sub, SubAssign,
};
use std::str::{self, FromStr};
use std::{char, cmp, f32, f64, fmt, i16, i32, i64, i8, mem, thread, u16, u32, u64, u8};

fn main() {
    input! {
        n: usize,
        m: usize,
        xs: [i64; m],
    }
    let mut xs = xs;
    xs.sort();
    let mut ds = xs.windows(2).map(|w| w[1] - w[0]).collect::<Vec<_>>();
    ds.sort();
    let k = cmp::max(m, n) - n;
    let r = ds.into_iter().take(k).sum::<i64>();
    println!("{}", r);
}


Measured memory_bytes: 8444
#include <bits/stdc++.h>
#include <boost/foreach.hpp>
#define rep3(i, s, n, a) for (int i = (s); i < (int)(n); i += a)
#define rep2(i, s, n) rep3(i, s, n, 1)
#define rep(i, n) rep2(i, 0, n)

using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int, int>;

typedef std::pair<int, int> value_type;

struct second_order {
    bool operator()(const value_type& x, const value_type& y) const {
        return x.second < y.second;
    }
};

int main(){
    int n;
    cin >> n;
    map<int, int> vodd, veve;
    rep(i, n){
        int v;
        cin >> v;
        if(i%2){
            veve[v]++;
        }else{
            vodd[v]++;
        }
    }

    priority_queue<value_type, std::vector<value_type>, second_order> qo, qe;
    pair<int, int> p;
    BOOST_FOREACH(p, vodd) {
        qo.push(p);
    }
    BOOST_FOREACH(p, veve) {
        qe.push(p);
    }
    value_type otop = qo.top();
    value_type etop = qe.top();
    qo.pop();
    qe.pop();
    if(otop.first!=etop.first){
        cout << n - otop.second - etop.second << endl;
    }else{
        int o = otop.second, e = etop.second;
        if(o > e){
            if(!qe.empty()){
                etop = qe.top();
            }else{
                etop.second = 0;
            }
        }else{
            if(o < e){
                if(!qo.empty()){
                    otop = qo.top();
                }else{
                    otop.second = 0;
                }
            }else{
                value_type otmp = qo.top(), etmp = qe.top();
                int o2 = otmp.second, e2 = etmp.second;
                if(o2 > e2){
                    otop.second = o2;
                    if(qo.empty()){
                        otop.second = 0;
                    }
                }else{
                    etop.second = e2;
                    if(qe.empty()){
                        etop.second = 0;
                    }
                }
            }
        }
        cout << n - otop.second - etop.second << endl;
    }
    return 0;
}

Measured memory_bytes: 8944
#include <iostream>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <string>
#include <bitset>
#include <map>
#include <vector>
#include <chrono>
#include <random>
#include <stack>
#include <ctime>
#include <queue>
#include <list>
#include <set>
#include <cstring>
#include <cstdlib>
#include <cctype>

#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 chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (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;

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

void swap(int *X, int *Y){
    int t = *X; *X = *Y; *Y = t;
}

const static int MAX_N = 100000;

class UnionFind {
private:
    int par[MAX_N], rank_t[MAX_N];

public:
    UnionFind(int n) { //コンストラクタ
        for (int i = 0; i <= n; ++i) {
            par[i] = i;
            rank_t[i] = 0;
        }
    }

    int root(int x) {
        return par[x] == x ? x : par[x] = root(par[x]);
    }

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

    void unite(int x, int y) {
        x = root(x);
        y = root(y);
        if (x == y) return;

        if (rank_t[x] < rank_t[y]) {
            par[x] = y;
        } else {
            par[y] = x;
            if (rank_t[x] == rank_t[y]) rank_t[x]++;
        }
    }
};

int main() { // AtCoder Typical B
    int n, m, p[MAX_N], x, y;
    cin >> n >> m;
    rep(i, n) {
        cin >> p[i];
    }
    UnionFind UF(n);
    rep(j, m) {
        cin >> x >> y;
        UF.unite(x, y);
    }

    llong cnt = 0;
    rep(i, n) {
        if (UF.same(p[i], p[p[i] - 1])) ++cnt;
    }

    cout << cnt << endl;

    return 0;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
#define all(vec) vec.begin(),vec.end()
#define mp make_pair
using namespace std;
using ll=long long;
using P=pair<int,int>;
const ll INF=1LL<<30;
const ll LINF=1LL<<60;
const double eps=1e-9;
const ll MOD=1000000007LL;
template<typename T>void chmin(T &a,T b){a=min(a,b);};
template<typename T>void chmax(T &a,T b){a=max(a,b);};
template<typename T>vector<T> make_v(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>auto make_v(size_t a,Ts... ts){return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));}
template<typename T,typename V>typename enable_if<is_class<T>::value==0>::type fill_v(T& t,const V& v){t=v;}
template<typename T,typename V>typename enable_if<is_class<T>::value!=0>::type fill_v(T& t,const V& v){for(auto &e:t)fill_v(e,v);};
int dx[4]={0,1,0,-1};
int dy[4]={1,0,-1,0};
int main(){
    int k,n;cin>>k>>n;
    vector<int> ans;
    if(k%2==0){
        for(int i=0;i<n;i++){
            if(i==0){
                ans.push_back(k/2);
            }else{
                ans.push_back(k);
            }
        }
    }else{
        for(int i=0;i<n;i++)ans.push_back(k/2+1);
        int co=(n-1)/2+(n-1)%2;
        while(co--){
            if(ans.back()==1){
                ans.pop_back();
            }else{
                ans.back()--;
                while(ans.size()<n)ans.push_back(k);
            }
        }
    }
    for(int i=0;i<ans.size();i++){
        cout<<ans[i]<<" "; 
    }
    cout<<endl;
}

Measured memory_bytes: 3568
#include <iostream>

using namespace std;

int main(int argc, char const *argv[])
{
    int k, x;
    cin >> k >> x;
    for (int i = 0; i < 2 * k - 1; i++)
    {
        cout << x - k + 1 + i << "\t";
    }
    cout << endl;
    return 0;
}


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back
#define ppb pop_back
#define INF 1e18
typedef long long ll;

using namespace std;

int main(int argc,char* argv[])
{
    ios::sync_with_stdio(false);
    cin.tie(0);

    int n;cin>>n;
    vector<int>l(n);
    rep(i,n)cin>>l[i];

    sort(all(l));

    ll sum = 0;
    rep(i,n-2)
    {
        for(int j = i+1;j<n-1;j++)
        {
            for(int k = j+1;k<n;k++)
            {
                if(l[k] < l[i]+l[j])sum++;
                
            }
        }
    }

    cout<<sum<<endl;

    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=1;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin,(a).rend()
#define dunk(a) cout << (a) << endl
using namespace std;
typedef long long ll;
const int inf = 1001001001;
const int mod = 1000000007;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int k, s;
	cin >> k >> s;
	int ans = 0;
	rep(x, k + 1)rep(y, k + 1) {
		ans += s - x - y >= 0 && s - x - y <= k ? 1 : 0;
	}

	dunk(ans);

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
using namespace std;
using ll = long long;
using ld = long double;

const int MOD=(int)1e9+7;

int main(){
  ios_base::sync_with_stdio(false);cin.tie(0);
  int H,W;
  cin >> H >> W;
  vector<string> S(H+1,"");
  for(int i=0;i<H;i++)  cin >> S.at(i);
  for(int i=0;i<H;i++)  S.at(i)+='#';
  for(int i=0;i<=W;i++) S.at(H)+='#';

  vector<vector<ll>> dp(H+1,vector<ll>(W+1,0));
  dp.at(0).at(0)=1;
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      if(S.at(i).at(j)=='#')  continue;
      if(S.at(i+1).at(j)=='.'){
        dp.at(i+1).at(j)+=dp.at(i).at(j);
        dp.at(i+1).at(j)%=MOD;
      }
      if(S.at(i).at(j+1)=='.'){
        dp.at(i).at(j+1)+=dp.at(i).at(j);
        dp.at(i).at(j+1)%=MOD;
      }
    }
  }
  cout << dp.at(H-1).at(W-1) << endl;

  return 0;
}

Measured memory_bytes: 10112
#include <bits/stdc++.h>
using namespace std;
#define what_is(x) cerr << #x << " is " << x << endl;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
typedef long long ll;
const int N = 1e5+5;
const int INF = 1e9;
const int MOD = 1e9+7;
int n;
int h[N];
int main()
{
	IOS
	// freopen("input.txt", "r", stdin);
	cin >> n;
	for(int i=0; i<n; i++){
		cin >> h[i];
	}
	int ans = 1;
	int cur = 1;
	for(int i=1; i<n; i++){
		if (h[i] <= h[i-1]) cur++;
		else cur = 1;
		ans = max(cur, ans);
	}
	cout << ans - 1 << endl;

	return 0;
}


Measured memory_bytes: 640
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = sc.nextInt();
		}
		int result = Integer.MIN_VALUE;
		for (int i = 0; i < n; i++)
			for (int j = 0; j < n; j++) {
				result = Math.max(a[i] - a[j], result);
			}
		System.out.println(result);
	}
}

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

int ac[100005];
signed main(){
  int n , m , l , r ;
  string s;
  cin>>n>>m;
  cin>>s;
  
  s='!'+s;
  
  for(int i=1;i<=n;i++){
    if(s[i-1]=='A' && s[i]=='C'){
      ac[i]++;
    }
    ac[i]+=ac[i-1];
  }
  
  for(int i=0;i<m;i++){
    cin>>l>>r;
    cout<<ac[r]-ac[l]<<endl;
  }
  
  return(0);
}

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

using namespace std;

const int N = 200000 + 10;

int a[N];

int main()
{
	int n, i;
	cin>>n;
	for (i=0; i<n; i++) cin>>a[i];
	sort(a, a + n);
	for (i=1; i<n; i++)
		if (a[i-1] == a[i]) break;
	if (i < n) cout<<"NO"<<endl; else cout<<"YES"<<endl;	 
	return 0;
}

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

#define rep(i, a, b) for(int i = (a); i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define endl '\n'

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;

const ll mod = 1000000007;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
// head

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

    int x;
    cin >> x;
    cout << (x == 0 ? 1 : 0) << endl;
    return 0;
}


Measured memory_bytes: 3544
<?php
$S = trim(fgets(STDIN));
//list($a1,$a2,$a3) =  explode(" ",trim(fgets(STDIN)));
//$A =  explode(" ",trim(fgets(STDIN)));

$len = strlen($S);
$a = substr($S,0,intdiv($len,2));
$b = substr(strrev($S),0,intdiv($len,2));
$ret=0;
for($i=0;$i<intdiv($len,2);$i++) {
  if ($a[$i]!=$b[$i]) {
    $ret++;
  }
}
printf("%d\n",$ret);


Measured memory_bytes: 4728
#include <iostream>
#include <vector>
#include <array>
#include <deque>
#include <stack>
#include <queue>
#include <list>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <numeric>
#include <utility>
#include <cmath>
#include <iomanip>

using namespace std;
using ll=long long int;

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

    for (auto &c: n) {
        if (c == '1') cout << '9';
        else if (c == '9') cout << '1';
        else cout << c;
    }
    cout << endl;

    return 0;
}


Measured memory_bytes: 256
#define STOPIT
#include <bits/stdc++.h>
#define loop(n) for (lint ngtkana_is_a_genius = 0; ngtkana_is_a_genius < lint(n); ngtkana_is_a_genius++)
#define rep(i, begin, end) for (lint i = lint(begin); (i) < lint(end); i++)
#define all(v) v.begin(), v.end()
#define rand(l, r) std::uniform_int_distribution<>(l, r)(mt)
using lint = long long;
auto mt = std::mt19937_64(std::random_device{}());
auto cmn = [](auto&& a, auto b){ if (a > b) {a = b; return true;} return false; };
auto cmx = [](auto&& a, auto b){ if (a < b) {a = b; return true;} return false; };
void debug_impl() { std::cerr << std::endl; }
template <typename Head, typename... Tail>
void debug_impl(Head head, Tail... tail) { std::cerr << " " << head; debug_impl(tail...); }
#ifndef STOPIT
#define debug(...)\
  do {\
    std::cerr << std::boolalpha << "[" << #__VA_ARGS__ << "]:";\
    debug_impl(__VA_ARGS__);\
    std::cerr << std::noboolalpha;\
  } while (false)
#else
#define debug(...) {}
#endif

int main() {
  std::cin.tie(0); std::cin.sync_with_stdio(false);
  int q; std::cin >> q;
  loop(q) {
    lint X, Y; std::cin >> X >> Y;
    lint Z = 4 * X * Y;
    lint l = 0, r = std::sqrt(Z) + 3;
    while (1 < r - l) {
      lint mid = (l + r) / 2;
      (mid*mid < Z ? l : r) = mid;
    }
    lint W = l;
    debug(X,Y,W,Z);
    lint ans = W - 2 + (X==Y);
    std::cout << ans << std::endl;
  }
  return 0;
}

/*
入力を X, Y とします。
xy < XY の中を見るのですが、それに含まれる接する直線 x + y = W の中で W が最大のものをとると、
W - 2 + (X==Y)が答えです。
*/

Measured memory_bytes: 256