akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <map>
#include <queue>
#include <string>
#include <algorithm>

using namespace std;
typedef pair<int, int> P;

void solve()
{
	int N;
	cin >> N;
	bool color[8] = { false };
	vector<int> a(N);
	int redCoder = 0;
	for (int i = 0; i < N; ++i)
	{
		cin >> a[i];
		if (a[i] >= 3200)
		{
			++redCoder;
			continue;
		}
		if (a[i] < 400)
		{
			color[0] = true;
		}
		else if (a[i] < 800)
		{
			color[1] = true;
		}
		else if (a[i] < 1200)
		{
			color[2] = true;
		}
		else if (a[i] < 1600)
		{
			color[3] = true;
		}
		else if (a[i] < 2000)
		{
			color[4] = true;
		}
		else if (a[i] < 2400)
		{
			color[5] = true;
		}
		else if (a[i] < 2800)
		{
			color[6] = true;
		}
		else if (a[i] < 3200)
		{
			color[7] = true;
		}
	}
	int minColor = 0;
	int maxColor = 0;
	for (int i = 0; i < 8; ++i)
	{
		if (color[i])
		{
			++minColor;
		}
	}
	maxColor = minColor + redCoder;
	if (minColor == 0)
	{
		minColor = 1;
	}
	cout << minColor << " " << maxColor << endl;
}

int main()
{
	solve();
	return(0);
}

Measured memory_bytes: 256
N, K, Q = map(int, input().split())
A = [int(input()) for i in range(Q)]
score = [0] * N
for i in A:
    score[i-1] += 1
for j in range(N):
    res = K - Q + score[j]
    if res > 0:
        print('Yes')
    else:
        print('No')

Measured memory_bytes: 8592
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;
const double PI = 3.141592653589793238;
const double EPS = 1e-10;
ll fact[100001];
ll inv_fact[100001];
ll mod_pow(ll a, ll b) {
	if (b == 0) return 1;
	if (b % 2 == 0) {
		ll x = mod_pow(a, b / 2);
		return (x*x) % MOD;
	}
	return (a*mod_pow(a, b - 1)) % MOD;
}
ll comb(ll n, ll k) {
	if (n < k) return 0;
	ll ret = fact[n];
	(ret *= inv_fact[k]) %= MOD;
	(ret *= inv_fact[n - k]) %= MOD;
	return ret;
}
vector<int> pos[100001];
int main() {
	int n;
	cin >> n;
	fact[0] = inv_fact[0] = 1;
	for (int i = 1; i <= n; i++) {
		fact[i] = (fact[i - 1] * i) % MOD;
		inv_fact[i] = (inv_fact[i - 1] * mod_pow(i, MOD - 2)) % MOD;
	}
	for (int i = 0; i < n + 1; i++) {
		int a;
		cin >> a;
		pos[a].push_back(i);
	}
	int l, r;
	for (int i = 1; i <= n; i++) {
		if (pos[i].size() == 2) {
			l = pos[i][0];
			r = pos[i][1];
			break;
		}
	}
	for (int k = 1; k <= n + 1; k++) {
		ll ans = comb(n - 1, k);
		if (k >= 2) (ans += comb(n - 1, k - 2)) %= MOD;
		(ans += 2 * comb(n - 1, k - 1)) %= MOD;
		(ans += MOD - comb(l + n - r, k - 1)) %= MOD;
		cout << ans << endl;
	}
 }

Measured memory_bytes: 8192
#include <ctype.h>
#include <limits.h>
#include <math.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(int argc, char **argv)
{
    int a, b;
    scanf("%d", &a);
    scanf("%d", &b);
    if (a * b % 2 == 0) {
        printf("Even\n");
    } else {
        printf("Odd\n");
    }
    return EXIT_SUCCESS;
}


Measured memory_bytes: 128
fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val (x, y, h) = Triple(IntArray(n), IntArray(n), IntArray(n))
    for (i in 0 until n) {
        val (xt, yt, ht) = readLine()!!.split(' ').map(String::toInt)
        x[i] = xt
        y[i] = yt
        h[i] = ht
    }
    for (xi in 0..100) {
        for (yi in 0..100) {
            var top = 0
            var flag = true
            for (i in 0 until n) {
                if (h[i] != 0) top = h[i] + Math.abs(x[i] - xi) + Math.abs(y[i] - yi)
            }
            for (i in 0 until n) {
                if (h[i] != Math.max(top - Math.abs(x[i] - xi) - Math.abs(y[i] - yi), 0)) {
                    flag = false
                }
            }
            if (flag) {
                println("$xi $yi $top")
                return
            }
        }
    }
}

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

using namespace std;

int arr[22];
int n;

int main()
{
	cin >> n;
	for(int i=0;i<n;i++) cin >> arr[i];
	int ans=0;
	for(int i=1;i<n-1;i++)
	{
		int mn=min(arr[i-1],min(arr[i],arr[i+1]));
		int mx=max(arr[i-1],max(arr[i],arr[i+1]));
		if(arr[i]!=mn&&arr[i]!=mx)
			ans++;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <climits>
#include <cmath>
#include <algorithm>
using namespace std;
typedef long long ll;

#define FOR(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
#define REP(i,n) FOR(i,0,n)
	
void change_min(ll* p_dpi,ll dpj_absh){
	if(*p_dpi > dpj_absh) *p_dpi = dpj_absh;
	return;
}

int main(){
	
	//入力;
	int N;
	cin >> N;
	
	vector<vector<int>> value; //value[i][0]:a_i, value[i][1]:b_i,value[i][2]:c_i;
	value.resize(N);
	int tmp;
	REP(i,N){
		REP(j,3){
			cin >> tmp;
			value[i].push_back(tmp);
		}
	}
	
	//DPの初期化;
	vector<vector<ll>> dp; //dp[i][0]:i日目にaを選んだときの効用の合計の最大値;
	dp.resize(N);
	
	REP(i,N){
		REP(j,3) dp[i].push_back(LLONG_MIN);
	}
	//初日の初期化;
	REP(j,3) dp[0][j] = value[0][j];
	
	//DPの更新;
	FOR(i,1,N){
			dp[i][0] = max(dp[i-1][1],dp[i-1][2]) + value[i][0];
			dp[i][1] = max(dp[i-1][0],dp[i-1][2]) + value[i][1];
			dp[i][2] = max(dp[i-1][0],dp[i-1][1]) + value[i][2];
	}
	
	cout << max(max(dp[N-1][0] , dp[N-1][1] ),dp[N-1][2] )<< endl;
	
	return 0;
}

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

#include <iostream>
using namespace std;
int main() {
  vector<int> x(5);
  for (auto& xi : x) {
    cin >> xi;
  }
  for (int i = 0; i < 5; ++i) {
    if (x[i] == 0) {
      cout << i + 1 << endl;
    }
  }
  return 0;
}


Measured memory_bytes: 3588
#include <iostream>

void call(int n){
  using namespace std;
  int i = 1;

  do {
      int x = i;
      if ( x % 3 == 0 ){
        cout << " " << i;
        continue;
      }
    
      do {
        if ( x % 10 == 3 ){
          cout << " " << i;
          break;
        }
        x /= 10;
      } while ( x );
  } while ( ++i <= n );

  cout << endl;
}
#include <stdio.h>
int main(void) {
    int n;
    ::scanf("%d", &n);
    call(n);
    return 0;
}


Measured memory_bytes: 3156
#include <bits/stdc++.h>
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end() 
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define INF 1000000000
using namespace std;
typedef long long ll;

int main() {
    ll A, B, K;
    cin >> A >> B >> K;

    ll ans_a = 0, ans_b = 0;
    if (A-K < 0){
        ans_a = 0;
        if (B - K + A < 0){
            ans_b = 0;
        }
        else{
            ans_b = B - K + A;
        }
    }
    else{
        ans_a = A - K;
        ans_b = B;
    }

    cout << ans_a << " " << ans_b << endl;
}

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

int main(){
	int a, b, c;
  	cin >> a >> b >> c;
  	
  	if((a==b&&b==c) || (a!=b&&b!=c&&c!=a)){
    	cout<<"No"<<endl;
    }else {
    	cout<<"Yes"<<endl;
    }
  	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int gcd(int x, int y);

int main(void)
{
	int x, y;
	
	scanf("%d %d", &x, &y);
	printf("%d\n", gcd(x, y));
	
	return (0);
}

int gcd(int x, int y)
{
	if (y == 0){
		return (x);
	}
	else {
		return (gcd(y, x % y));
	}
}

Measured memory_bytes: 592
#include <iostream>
#include <vector>
#include <array>
#include <set>
#include <cmath>
#include <string>
#include <queue> 
#include <list>
#include <stack>
#include <unordered_map>
#include <algorithm> 
#include <numeric>  
#include <functional>
#include <cassert>
#include <bitset>
#include <cctype>  
#include <iomanip> 
#include <limits>  
// std::numeric_limits<int>::max(), min()
// std::setprecision(X)
// std::islower(), std::isupper(), std::tolower, std::toupper
// std::accumulate(m.begin(), m.end(), 0LL);
// std::sort(begin(),end()) // 0, 1, 2, 3 ,4 (default, less);
// std::priority_queue<int, vector<int>, less<int>> que; // 4, 3, 2, 1 (defualt, less) : 
 
#define rep(i, n) for(int i = 0; i < (int)(n);    i++)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()

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; }
typedef long long ll;

ll gcd ( ll a, ll b ) { if ( b == 0 ) return a; else return gcd ( b, a%b ); }
ll lcm ( ll a, ll b ) { return a * b / gcd(a, b); }


int main (void) {
  std::cin.tie(0);  std::ios::sync_with_stdio(false);
  int n; std::cin >> n;
  std::vector<std::string> s(n); rep(i,n) std::cin >> s[i];

  std::vector<std::vector<int>> S(n, std::vector<int>(26));

  rep(i,n) rep(j, sz(s[i])) S[i][s[i][j]-'a']++;

  std::string ans;
  for(int i=0; i<=('z'-'a'); i++) {
    char c = 'a'+i;
    int k = 51;
    rep(j, n) k = std::min(k, S[j][i]);
    rep(j, k) ans.push_back(c);
  }
  std::cout << ans << std::endl;

  return 0;
}


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

//typedef
//------------------------------------------
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef vector<string> VS;
typedef pair<LL, LL> PLL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define PB push_back
#define MP make_pair
#define SORT(c) sort((c).begin(),(c).end())
#define COUT(x) cout<<x<<endl

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double PI = acos(-1.0);
const LL MOD = 1e9 + 7;
const ULL INF = 1e18;
const int dx[]{ 1,-1,0,0 }, dy[]{ 0,0,1,-1 };

//function
//--------------------------------------------
LL gcd(LL, LL);
bool isEven(LL);
void coutY();
void coutN();
LL ave(LL, LL);

int main() {
	VLL a(3); REP(i, 3)cin >> a[i];
	SORT(a);
	cout << a[0] + a[1];
}

LL gcd(LL a, LL b) {
	if (a == 0 || b == 0)return 0;
	if (a < b)swap(a, b);
	if (a % b == 0)return b;
	else gcd(b, a % b);
}
bool isEven(LL a) {
	return !((bool)(a % 2));
}
void coutY() {
	cout << "Yes" << endl;
	return;
}
void coutN() {
	cout << "No" << endl;
	return;
}
LL ave(LL a, LL b) {
	return (a + b) / 2;
}

Measured memory_bytes: 256
import java.util.Scanner;
import java.util.Arrays;

public class Main
{

	public static void main(String[] args)
	{	Scanner s = new Scanner(System.in);
                String r = s.next();
                int n = r.length();
                int i=0,j=0,k=0,z=0,t=0;
                for(i=0;i<n;i++){

                  int l = r.charAt(i);
                     if(r.charAt(0)=='A'){
                        j=1;
                     }
                     if((i>=2 && i<n-1) && r.charAt(i)=='C'){
                        k=1;
                        t++;
                     }
                     if(l==65 || l==67 || (l>=97 && l<=122)){
                        z=1;
                     }else{
                        z=0;
                        break;
                     }
                     

                }
                if(j==1 && k==1 && z==1 && t==1){
                  System.out.println("AC");
                }else{
                  System.out.println("WA");
                }
                
	}
}


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

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

#define ones(x) __builtin_popcount(x)
#define onesl(x) __builtin_popcountl(x)
#define onesll(x) __builtin_popcountll(x)

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define scn(n) scanf("%d",&n)
#define scnll(n) scanf("%lld",&n)
#define scn2(n,m) scanf("%d%d",&n,&m)
#define scn3(n,m,w) scanf("%d%d%d",&n,&m,&w)
#define scn2ll(n,m) scanf("%lld%lld",&n,&m)
#define atoz(v) v.begin(),v.end()
#define ratoz(v) v.rbegin(),v.rend()
#define Fill(a,v) memset(a,v,sizeof(a))
#define sz(v) v.size()
#define fi first
#define se second
#define inf 1e9
#define pi acos(-1.0)
#define sqr(x) x*x
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define ten(n) (int)1e##n
#define tenll(n) (lli)1e##n
#define mod 1000000007
#define FastIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

int Set(int N,int pos)
{
    return N=N | (1<<pos);
}
int reset(int N,int pos)
{
    return N = N & ~(1<<pos);
}
bool check(int N,int pos)
{
    return (bool)(N & (1<<pos));
}

void we_r_done()
{
    cout<<"NO";
    exit(0);
}

void debug(string mssg)
{
    cout<<mssg;
    exit(0);
}

using minHeap = priority_queue< int, vector< int >, greater< int > >;

inline int addmod(int x,int y)
{
    return (x%mod + y%mod)%mod;
}
inline int submod(int x,int y)
{
    return (x%mod - y%mod + mod)%mod;
}
inline int mulmod(int x,int y)
{
    return (x%mod *1LL* y%mod)%mod;
}

const int N = 1<<22;
int dp[N];
int n;
int a[23][23];

int fun(int row = 0, int mask = 0)
{

    if(mask == (1<<n) - 1)
        return 1;

    if(row == n)
        return 0;

    if(dp[mask] != -1)
        return dp[mask];

    dp[mask] = 0;

    for(int i=0; i<n; i++)
    {

        if(check(mask,i) || a[row][i] == 0)
            continue;

        dp[mask] = addmod(dp[mask], fun(row+1,mask | (1<<i)));
    }

    return dp[mask];
}

int main()
{
    ///freopen("output.txt","w",stdout);
    ///freopen("input.txt","r",stdin);

    ///FastIO;
    scn(n);

    for(int i=0; i<n; i++)
    {
        for(int j=0; j<n; j++)
            scn(a[i][j]);
    }
    Fill(dp,-1);
    cout<<fun();
    return 0;
}

///sin and cos expect input in radians not degrees. so use , sin(degrees * pi / 180)
///using bs = bitset<MX>; // how many distinct number can be form?


Measured memory_bytes: 16768
// #pragma GCC target("avx")  // CPU 処理並列化
// #pragma GCC optimize("O3")  // CPU 処理並列化
// #pragma GCC optimize("unroll-loops")  // 条件処理の呼び出しを減らす
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
#include<numeric>
#include<unordered_set>
#include<complex>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const double EPS=1e-10;
const double INF=1e+10;
const double PI=acos(-1.0);
const int C_SIZE = 3100000;
const int UF_SIZE = 3100000;
namespace{
	long long fact[C_SIZE];
	long long finv[C_SIZE];
	long long inv[C_SIZE];
	long long Comb(int a,int b){
	 	if(a<b||b<0)return 0;
	 	return fact[a]*finv[b]%mod*finv[a-b]%mod;
	}
	void init_C(int n){
		fact[0]=finv[0]=inv[1]=1;
		for(int i=2;i<n;i++){
			inv[i]=(mod-(mod/i)*inv[mod%i]%mod)%mod;
		}
		for(int i=1;i<n;i++){
			fact[i]=fact[i-1]*i%mod;
			finv[i]=finv[i-1]*inv[i]%mod;
		}
	}
	long long pw(long long a,long long b){
		if(a<0LL)return 0;
		if(b<0LL)return 0;
		long long ret=1;
		while(b){
			if(b%2)ret=ret*a%mod;
			a=a*a%mod;
			b/=2;
		}
		return ret;
	}
	long long pw_mod(long long a,long long b,long long M){
		if(a<0LL)return 0;
		if(b<0LL)return 0;
		long long ret=1;
		while(b){
			if(b%2)ret=ret*a%M;
			a=a*a%M;
			b/=2;
		}
		return ret;
	}
	int pw_mod_int(int a,int b,int M){
		if(a<0)return 0;
		if(b<0)return 0;
		int ret=1;
		while(b){
			if(b%2)ret=(long long)ret*a%M;
			a=(long long)a*a%M;
			b/=2;
		}
		return ret;
	}
	int ABS(int a){return max(a,-a);}
	long long ABS(long long a){return max(a,-a);}
	double ABS(double a){return max(a,-a);}
	int sig(double r) { return (r < -EPS) ? -1 : (r > +EPS) ? +1 : 0; }
	int UF[UF_SIZE];
	void init_UF(int n){
		for(int i=0;i<n;i++)UF[i]=-1;
	}
	int FIND(int a){
		if(UF[a]<0)return a;
		return UF[a]=FIND(UF[a]);
	}
	void UNION(int a,int b){
		a=FIND(a);b=FIND(b);if(a==b)return;
		if(UF[a]>UF[b])swap(a,b);
		UF[a]+=UF[b];UF[b]=a;
	}
}
// ここから編集しろ
int dp[1<<18][55];
int p[20];
int q[20];
int main(){
	int a;scanf("%d",&a);
	for(int i=0;i<a;i++)scanf("%d",p+i);
	for(int i=0;i<a;i++)scanf("%d",q+i);
	for(int i=0;i<(1<<a);i++)for(int j=0;j<55;j++){
		dp[i][j]=mod;
	}
	dp[0][0]=0;
	for(int i=0;i<(1<<a)-1;i++){
		int at=__builtin_popcount(i);
		for(int j=0;j<55;j++){
			if(dp[i][j]==mod)continue;
			// printf("%d %d: %d\n",i,j,dp[i][j]);
			int toc=0;
			for(int k=0;k<a;k++){
				if(i&(1<<k))continue;

				int now=p[k];
				if(at%2!=k%2)now=q[k];
				if(j<=now){
					dp[i+(1<<k)][now]=min(dp[i+(1<<k)][now],dp[i][j]+toc);
				}
				toc++;
			}
		}
	}
	int ret=mod;
	for(int i=0;i<55;i++)ret=min(ret,dp[(1<<a)-1][i]);
	if(ret==mod)ret=-1;
	printf("%d\n",ret);
}

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

int main() {

  int n,k,b,c;
  cin >> n >> k;
  vector<int> a(n);

  for (int i = 0; i < k; i++) {
    
    cin >> b;

    for (int j = 0; j < b; j++) {
      cin >> c;
        a.at(c-1) += 1;
    }

  }
  c = 0;
  for (int i = 0; i < n; i++) {
    if (a.at(i) == 0) {
      c += 1;
    }
  }
  cout << c << endl;

  }



Measured memory_bytes: 3612
# O(M + 4^N) 解
# 参考: https://twitter.com/ei1333/status/1177951676818325504

import sys
input = sys.stdin.readline
N, M = map(int, input().split())
dp = [float("inf")] * (1<<N)
for _ in range(M):
    a, _ = map(int, input().split())
    C = list(map(int, input().split()))
    s = 0
    for c in C:
        s |= 1 << c-1
    dp[s] = min(dp[s], a)
for i in range(1<<N):
    for j in range(1<<N):
        dp[i|j] = min(dp[i|j], dp[i]+dp[j])
ans = dp[-1]
print(ans if ans!=float("inf") else -1)


Measured memory_bytes: 46044
// C - Multiple Clocks

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// const int INF = 2147483647;
// const ll INF = 9223372036854775807;
// const ll MOD = 1e9 + 7;

ll T[100];

ll get_lcm(ll a, ll b) {
	return a / __gcd(a, b) * b;
}

int main() {
	ll N;
	cin >> N;

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

	ll lcm = 1;

	for (int i=0; i<N; i++) {
		lcm = get_lcm(lcm, T[i]);
	}

	cout << lcm << endl;

	return 0;
}

Measured memory_bytes: 256
import java.util.*;

class Main{
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[n];
        Map<Integer, Long> maps = new HashMap<>();
        for(int i=0;i<n;i++){
            a[i] = sc.nextInt();
            if(maps.containsKey(a[i])){
                maps.put(a[i], maps.get(a[i])+1L);
            }
            else{
                maps.put(a[i], 1L);
            }
        }

        long total = 0;
        for(Integer key : maps.keySet()){
            Long count = maps.get(key);
            // System.out.print(key);
            // System.out.println(" " + count);
            total += (count*(count-1)/2);
        }

        for(int i=0;i<n;i++){
            System.out.println(total-(maps.get(a[i])-1));
        }

    }

}


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

int main(){
	int h, w, k, cnt, h_begin;
	bool flag;
	cin >> h >> w >> k;

	char s[h][w];
	int pnum[h][w];

	for(int i=0; i<h; i++){
		for(int j=0; j<w; j++){
			cin >> s[i][j];
		}
	}

	h_begin = -1;
	for(int i=0; i<h; i++){
		for(int j=0; j<w; j++){
			if(s[i][j]=='#'){
				h_begin = i;
				break;
			}
		}
		if(h_begin!=-1){
			break;
		}
	}

	cnt = 1;
	for(int i=h_begin; i<h; i++){
		flag = false;
		for(int j=0; j<w; j++){
			if(s[i][j]=='#'){
				if(flag){
					cnt++;
				}else{
					flag = true;
				}
			}
			pnum[i][j] = cnt;
		}
		if(flag == false){
			for(int j=0; j<w; j++){
				pnum[i][j] = pnum[i-1][j];
			}
		}else{
			cnt++;
		}
	}

	for(int i=h_begin-1; i>=0; i--){
		for(int j=0; j<w; j++){
			pnum[i][j] = pnum[h_begin][j];
		}
	}

	for(int i=0; i<h; i++){
		for(int j=0; j<w; j++){
			cout << pnum[i][j] << " ";
		}
		cout << endl;
	}
	return 0;

}

Measured memory_bytes: 1152
#include <iostream>
#include <cmath>
#include <vector>

using namespace std;


int main() {
    int n, m;
    cin >> n >> m;
    vector<int> a;
    int temp;
    for (int i = 0; i < m; i++) {
        cin >> temp;
        a.push_back(temp);
    }

    vector<long long int> fib;
    long long int f0, f1, f2, temp_f2;

    f0 = 0;
    f1 = 1;
    fib.push_back(1);
    for (int i = 0; i < 100000; i++) {
        f2 = f1 + f0;
        f2 = f2 % 1000000007;
        fib.push_back(f2);
        f0 = f1;
        f1 = f2;
    }

    long long int ans = 0;
    for (int i = 0; i < m + 1; i++) {
        if (i == 0) {
            if (m == 0) {
                cout << fib[n];
                return 0;
            }
            else ans = fib[a[i] - 1];
        }
        else if (0 < i && i < m) {
            if (a[i] - a[i - 1] == 1) {
                cout << 0;
                return 0;
            }
            ans *= fib[a[i] - a[i - 1] - 2];
            ans = ans % 1000000007;
        }
        else
        {
            if (n == a[i - 1]) {
                cout << 0;
                return 0;
            }
            ans *= fib[n - a[i-1] - 1];
        }
    }
    ans = ans % 1000000007;
    cout << ans;
    

    

    return 0;
}

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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

int N;
int X[111111];

signed main(){
    cin>>N;
    rep(i,N)cin>>X[i+1];

    int ans=0;
    rep(i,N+1)ans+=abs(X[i+1]-X[i]);

    for(int i=1;i<=N;i++){
        int tmp=ans;
        tmp-=abs(X[i]-X[i-1]);
        tmp-=abs(X[i+1]-X[i]);
        tmp+=abs(X[i+1]-X[i-1]);
        cout<<tmp<<endl;
    }
    return 0;
}


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

public class Main{

	private static final int mod =(int)1e9+7;
	public static void main(String[] args) throws Exception  {
	      Scanner  sc=new Scanner(System.in);
	      PrintWriter out=new PrintWriter(System.out);
	     int n=sc.nextInt();
	     int count=0;
	     int max=0;
	     for(int i=0;i<n;i++) {
	       int x=sc.nextInt();
	       int y=sc.nextInt();
	       if(x==y) {
	         count++;
	       }else {
	         max=Math.max(count,max);
	         count=0;
	       }
	     }
	     max=Math.max(count,max);
	     System.out.println(max>=3?"Yes":"No");

	}
static long nCr(int n, int r, 
    int p) 
{ 


if (r == 0) 
return 1; 


int[] fac = new int[n + 1]; 
fac[0] = 1; 

for (int i = 1; i <= n; i++) 
fac[i] = fac[i - 1] * i % p; 

return (fac[n] * modInverse(fac[r], p) 
% p * modInverse(fac[n - r], p) 
% p) 
% p; 
} 
static long modInverse(int n, int p) 
{ 
    return pow(n, p - 2)%mod; 
} 
static long pow(long x,long y) {
  long res=1l;
  while(y!=0) {
    if(y%2==1) {
      res=x*res%mod;
    }
    y/=2;
    x=x*x%mod;
  }
  return res;
} 
}




Measured memory_bytes: 36128
#include<stdio.h>
#include<stdlib.h>
#define NIL NULL

struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;

Node root;

void insert(int k){
 
  Node y = NIL;
  Node x = root;
  Node z;

  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;

  while( x != NIL ){
    y = x;
    if ( z->key < x->key ){
      x = x->left;
    } else {
      x = x->right;
    }
  }

  z->parent = y;

  if ( y == NIL ){
    root = z;
  } else {
    if (z->key < y->key) {
      y->left = z;
    } else {
      y->right = z;
    }
  }
}


void inorder(Node u){
  if ( u == NIL ) return;
  inorder(u->left);
  printf(" %d", u->key);
  inorder(u->right);
}

void preorder(Node u){
  if ( u == NIL ) return;
  printf(" %d", u->key);
  preorder(u->left);
  preorder(u->right);
}


int main(){
  int num, i, x;
  char s[20];

  scanf("%d", &num);

  for ( i = 0; i < num; i++ ){
    scanf("%s", s);

    if ( strcmp(s, "insert") == 0 ){
      scanf("%d", &x);
      insert(x);

    } else if ( strcmp(s, "print") == 0 ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
  }

  return 0;
}

Measured memory_bytes: 24040
import java.util.Scanner;
public class Main {
	public static void main(String[] args) throws Exception {
		Scanner scan=new Scanner(System.in);
		int a=scan.nextInt();
		int b=scan.nextInt();
		if(a==b) {
			System.out.println(a+b);
		}
		else {
			int c=Math.max(a, b);
			System.out.println(c+c-1);
		}
	}
}

Measured memory_bytes: 23508
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int Nmax = 1e5 + 5;
const int mod = 1e9 + 7;
vector <int> adj[Nmax];

int n;
int dp[Nmax][2];

void add(int &a, int b)
{
    a += b;
    if (a >= mod) a -= mod;
}

void mul(int &a, int b)
{
    a *= b;
    if (a >= mod) a %= mod;
}

int solve(int u, int pre, int p)
{
    int &res = dp[u][pre];
    if (res != -1) return res;
    if (adj[u].size() == 1 && p != -1) return pre + 1;
    res = 0;
    for (int cur = 0; cur <= 1; cur++)
    {
        if (cur | pre)
        {
            int sum = 1;
            for (int v : adj[u])
            {
                if (v == p) continue;
                mul(sum, solve(v, cur, u));
            }
            add(res, sum);
        }
    }
    return res;
}

signed main()
{
    //freopen("file.inp","r",stdin);
    cin >> n;
    for (int i = 1; i < n; i++)
    {
        int u,v;
        cin >> u >> v;
        adj[u].push_back(v);
        adj[v].push_back(u);
    }
    memset(dp, -1, sizeof(dp));
    if (n == 1) return cout << 2, 0;
    cout << solve(1, 1, -1);
    return 0;
}


Measured memory_bytes: 20188
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <utility>
#include <vector>
#define REP(i, n) for(int i = 0; i < (n); ++i)
typedef long long ll;
const int MOD = 1000000007;
using namespace std;

int main(){
    int n; cin >> n;
    cout << "ABC" << n << "\n";
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main(){
 int N;
 int i;
 cin >> N;
 int a[N];
 long long int odd=0;
 for(i=0;i<N;i++)cin >> a[i];
 for(i=0;i<(N-1)/2;i++){
   odd += a[2*i];
   odd -= a[2*i+1];
 }
 odd += a[N-1];
 for(i=0;i<(N-1)/2;i++){
   cout << odd << " " << 2*a[2*i]-odd << " ";
   odd -= 2*a[2*i];
   odd += 2*a[2*i+1];
   }
 cout << odd << endl;
 }

Measured memory_bytes: 1664
count = 0
N, M, C = map(int, input().split())
B = [int(i) for i in input().split()]
A = [list(map(int, input().split())) for l in range(N)]

for i in range(N):
  c = C
  for j in range(M):
    c += A[i][j] * B[j]
  if c > 0:
    count += 1
print(count)

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

#define rep(i,x,y) for(ll i=(x);i<(y);i++)
#define rrep(i,x,y) for(ll i=(ll)(y)-1;i>=(x);i--)
#define all(x) (x).begin(),(x).end()
#ifdef LOCAL
#define dump(x)  cerr << #x << " = " << (x) << endl
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl
#define dassert(...) assert(__VA_ARGS__)
#else
#define dump(x)
#define debug(x)
#define dassert(...)
#endif
//#define int long long

typedef long long ll;
const ll MOD = 1e9 + 7;
const long double EPS = 1e-8;

void solve(long long N, long long K){
    ll answer = 0;
    vector<ll> minSum(N+2);
    vector<ll> maxSum(N+2);
    rep(i,1,N+2) minSum[i] = minSum[i-1] + (i-1);
    rep(i,1,N+2) maxSum[i] = maxSum[i-1] + (N - i + 1);
    rep(k,K,N+2) {
        answer += (maxSum[k] - minSum[k] + 1);
        answer %= MOD;
    }
    cout << answer << endl;
}

signed main(){
    // ios_base::sync_with_stdio(false);
    // cin.tie(NULL);
    long long N;
    scanf("%lld",&N);
    long long K;
    scanf("%lld",&K);
    solve(N, K);
    return 0;
}


Measured memory_bytes: 6304
# D - Water Bottle
import math
a,b,x = map(int, input().split())

tmp = x/(a**2)
# tmp2 = x/(b**2)
tmp2 = (2*x)/(a*b)

if tmp2 < a:
    print(90-math.degrees(math.atan2(tmp2,b)))
else:
    #print(tmp)
    tmp3 = (2*b-((2*x)/(a*a)))
    #print(tmp3)
    print(90-math.degrees(math.atan2(a,tmp3)))
    

Measured memory_bytes: 3060
#include<stdio.h>
#include<iostream>
using namespace std;
int main()
{
    int x,count=0,count1=0;

    cin >> x;

    int y = x;

    while(y!=0){

        int rem=y%10;

        count++;

        y=y/10;
    }

    if(count==1){

        for(int i=1;i<=x;i++){

            count1++;
        }
        cout<<count1<<endl;
    }

    else if(count==2){

        cout<<9<<endl;
    }
    else if(count==3){

        for(int i=100;i<=x;i++){

            count1++;
        }
        cout<<count1+9<<endl;
    }
    else if(count==4){

        for(int i=1000;i<=x;i++){

            count1++;
        }
        cout<<909<<endl;
    }
    else if(count==5){

        for(int i=10000; i<=x; i++){

            count1++;
        }
        cout<<count1+909<<endl;
    }
    else if(count==6){

        cout<<90909<<endl;
    }
    return 0;
}



Measured memory_bytes: 3588
#include <bits/stdc++.h>
 
typedef long long ll;
using namespace std;
const int MOD = 1e9+7;
ll cache[123456];
ll calc(int cnt[], int n) {
	if(n==0) {
		return 0;
	}
	if(n==1) {
		return cnt[n];
	}
	
	if(cache[n]!=-1) {
		return cache[n];
	}
	// if we select nth element, then we cant get previous(n-1) result, 
	// we need to get it from prevoious of the previous(n-2) result
	// because previous(n-1) was removed according to game rules
	ll point = 1ll*n*cnt[n];
	cache[n] = max(calc(cnt, n-1), calc(cnt, n-2) + point);
	return cache[n];
}
int main() {
	int n;
	cin>>n;
	ll sum = 0;
	for (int i=1;i<=n; i++) {
		for (int j=1; j<=n; j++) {
			for (int k=1; k<=n; k++) {
				sum+=__gcd(i, __gcd(j,k));
			}
		}
	}
	cout << sum;
	return 0;
}

Measured memory_bytes: 3636
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N,Q = map(int,readline().split())
ABPX = list(map(int,read().split()))
AB = iter(ABPX[:N+N-2])
PX = iter(ABPX[N+N-2:])

graph = [[] for _ in range(N+1)]
for a,b in zip(AB,AB):
    graph[a].append(b)
    graph[b].append(a)

val = [0] * (N+1)
for p,x in zip(PX,PX):
    val[p] += x

stack = [1]

parent = [0] * (N+1)
while stack:
    x = stack.pop()
    for y in graph[x]:
        if y == parent[x]:
            continue
        parent[y] = x
        stack.append(y)
        val[y] += val[x]

print(' '.join(map(str,val[1:])))

Measured memory_bytes: 85876
#include <iostream>
#include <fstream>
#include <unistd.h>
#include <sys/stat.h>
#include <stdio.h>
#include <vector>
#include <cmath>
#include <random>
#include <string.h>//文字列の代入に使う                                                                                                 
#include <bits/stdc++.h>//piの利用で必要(M_PI)                                                                                          
#include <algorithm>


int main() {

  long long int N, A, B, countA = 0, sumA = 0;

  std::cin >> N >> A >> B;

  sumA += N / (A + B) * A;
  if(N % (A + B) <= A) sumA += N % (A + B);
  else sumA += A;

  std::cout << sumA << std::endl;

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
 
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define en '\n'
 
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    ll n, sum = 0;
    cin >> n;
    for(int i = 1; i <= n;++i){
        if(!(i % 3 == 0 or i % 5 == 0)){
            sum += i;
        }
    }
    cout << sum << en;
}

Measured memory_bytes: 3648
import java.util.*;

public class Main {
	Scanner sc = new Scanner(System.in);
	final int MOD = 1000000007;
	final int MAX = Integer.MAX_VALUE;
	final long LMAX = Long.MAX_VALUE;


	void doIt() {
		int n = sc.nextInt();
		int k = sc.nextInt();
		int q = sc.nextInt();
		int num[] = new int[n];
		Arrays.fill(num, 0);
		for(int i = 0; i < q; i++) 
			num[sc.nextInt() - 1]++;
		for(int i = 0; i < n; i++) {
			System.out.println((k - q + num[i] > 0)?"Yes":"No");
		}
		
	}
		
	
	

	public static void main(String[] args) {
		new Main().doIt();
	}
}


Measured memory_bytes: 56880
//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx")
//#undef LOCAL
#include <bits/stdc++.h>

using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n - 1); }
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;

#ifdef LOCAL
#define show(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl
#else
#define show(x) true
#endif

template <class T, class U>
ostream& operator<<(ostream& os, const pair<T, U>& p) {
    return os << "P(" << p.first << ", " << p.second << ")";
}

template <class T> ostream& operator<<(ostream& os, const V<T>& v) {
    os << "[";
    for (auto d : v) os << d << ", ";
    return os << "]";
}

const int MN = 100100;
using P = pair<int, int>;
V<P> edges;
V<int> g[MN];
int dps[MN];
bool vis[MN];

bool dfs(int p, int b, int ndp = 0) {
    assert(!vis[p]);
    vis[p] = true;
    dps[p] = ndp;
    V<int> unused;
    for (int d: g[p]) {
        if (d == b) continue;
        if (vis[d]) {
            if (dps[d] > dps[p]) continue;
            // back edge
//            cerr << p << " b> " << d << endl;
            unused.push_back(d);
            continue;
        }
        if (!dfs(d, p, ndp + 1)) {
//            cerr << p << " -> " << d << endl;
            unused.push_back(d);
        }
    }

    int k = int(unused.size());
    for (int i = 0; i + 1 < k; i += 2) {
        edges.push_back({p, unused[i]});
        edges.push_back({p, unused[i + 1]});
    }
    if (k % 2 == 0) return false;
    edges.push_back({p, unused.back()});
    edges.push_back({p, b});
    return true;
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    int n, m;
    cin >> n >> m;
    if (m % 2) {
        cout << -1 << endl;
        return 0;
    }

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

    assert(!dfs(0, -1, 0));

    for (auto p: edges) {
        cout << p.first + 1 << " " << p.second + 1 << endl;
    }
    return 0;
}



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

ll ans = 0;

void dfs(ll x, ll limit, bool three, bool five, bool seven) {
    if (x > limit) return;
    if (three && five && seven) {
        ans++;
    }
    dfs(10 * x + 3, limit, true, five, seven);
    dfs(10 * x + 5, limit, three, true, seven);
    dfs(10 * x + 7, limit, three, five, true);
}

int main() {
    ll n;
    cin >> n;
    dfs(0, n, false, false, false);
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <tuple>
#include <vector>
#include <limits>

using namespace std;

#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define REP(i,n) FOR(i,0,n)
#define FORCLS(i,a,b) for(int i = (a); i <= (b); i++)
#define REPCLS(i,n) FORCLS(i,1,n)
template<typename T>
T extGcdRec(T r1, T r2, T x1, T x2, T y1, T y2, T &x, T &y) {
    if (r2 == 0) {
        x = x1; y = y1;
        return r1;
    }
    T r3 = r1 / r2;
    return extGcdRec(r2, r1 % r2, x2, x1 - r3 * x2, y2, y1 - r3 * y2, x, y);
}
template<typename T>
T extGcd(T a, T b, T &x, T &y) {
    if (a < b) return extGcd(b, a, y, x);
    return extGcdRec<T>(a, b, 1, 0, 0, 1, x, y);
}
template<typename T>
T invMod(T a, T m){ // Zm上乗法逆数
    T x, y;
    if (extGcd<T>(a, m, x, y) == 1) return (x + m) % m;
    return 0;
}


const int N_MAX = 2001;
int N;
int K;
int numB, numR;
long invM[N_MAX] = {};
long nCr[N_MAX][N_MAX] = {};
const long MOD = 1000000000 + 7;

void init() {
    // invM
    REP(n, N_MAX) {
        invM[n] = invMod<long>(n, MOD);
    }
    // nCr
    REP(n, N_MAX) {
        nCr[n][0] = 1;
    }
    REP(r, N_MAX) {
        nCr[0][r] = 1;
    }
    FOR(r, 1, N_MAX) {
        FOR(n, r, N_MAX) {
            nCr[n][r] = (((n * invM[r]) % MOD) * nCr[n-1][r-1]) % MOD;
        }
    }
}

inline long sub(int sectionNumB, int sectionNumR) {
    // n(num) を s(section)個の自然数に分ける分け方の個数は (n-1)C(s-1)
    if (sectionNumB == 0 || sectionNumR == 0) return 0;
    return (nCr[numB-1][sectionNumB-1] * nCr[numR-1][sectionNumR-1]) % MOD;
}
void solve() {
    cin >> N >> K;
    numB = K;
    numR = N-K;

    init();
    
    if (numR == 0) { // 赤がないパタン
        cout << 1 << endl;
        FOR(i, 2, K+1) {
            cout << 0 << endl;
        }
        return;
    }
    
    FOR(i, 1, K+1) {
        long res = 0;
        const int sectionNumB = i;
        for (int sectionNumR : {i-1, i, i, i+1} /* B-B, B-R, R-B, R-R */) {
            res = (res + sub(sectionNumB, sectionNumR)) % MOD;
        }
        cout << res << endl;
    }
}

int main() {
    solve();
    
    return 0;
}


Measured memory_bytes: 30080
import java.util.*;
 
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int len = sc.next().length();
		long MOD = 1000000007;
		long[][] dp = new long[N+1][N+1];
		dp[0][0] = 1;
		
		for(int i=1;i<=N;i++){
			dp[i][0] = dp[i-1][0];
			if(i>=2) dp[i][0] += dp[i-1][1];
			dp[i][0] %= MOD;
			for(int j=1;j<=N;j++){
				dp[i][j] = dp[i-1][j-1]*2;
				if(j+2<=i) dp[i][j] += dp[i-1][j+1];
				while(dp[i][j]>=MOD) dp[i][j] -= MOD;
			}
		}
		
		long ans = dp[N][len];
		for(int i=0;i<len;++i){
			ans = (ans*500000004)%MOD;
		}
		System.out.println(ans);
		return;
	}
}

Measured memory_bytes: 245840
N = int(input())
CSFs = []
for i in range(N-1):
  C, S, F = map(int, input().split())
  CSFs.append((C, S, F))
for i in range(N):
  r = 0
  L = CSFs[i:]
  for C, S, F in L:
    if r < S:
      r = S
    else:
      r = (r-S +F-1)//F*F+S
    r += C
  print(r)


Measured memory_bytes: 3188
process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', function (chunk) {
    var nums = chunk.split(" ");
    for(var i = 0; i < nums.length; i ++){
        nums[i] = Number(nums[i]);
    }
    var output = "No";
    var length = nums.length;
    while(length > 0){
       for (var i = 0; i < nums.length; i ++){
            // console.log("i = " + i);
            if (nums[i] > nums[i + 1]){
                var temp = nums[i];
                nums[i] = nums[i + 1];
                nums[i + 1] = temp;
            }
       }
       length --;
    }
    output = nums[0] + " " + nums[1] + " " + nums[2];
    console.log(output);
});

Measured memory_bytes: 7648
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <memory>
#include <complex>
#include <numeric>
#include <cstdio>
#include <iomanip>

#define REP(i,m,n) for(int i=int(m);i<int(n);i++)
#define RREP(i,m,n) for(int i=int(n)-1;i>=int(m);--i)
#define EACH(i,c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR 
#endif
using namespace std;

using UI = unsigned int;
using UL = unsigned long;
using LL = long long int;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VS = vector<string>;
using PII = pair<int,int>;
using VP = vector<PII>;

//struct edge {int from, to, cost;};

constexpr double EPS = 1e-10;
//constexpr double PI  = acos(-1.0);
//constexpr int INF = INT_MAX;

template<class T> inline T sqr(T x) {return x*x;}

void solve() {
    int k,s;
    cin >> k >> s;
    LL cnt = 0;
    REP(x,0,k+1) {
        REP(y,0,k+1) {
            int z = s - x - y;
            if (z >= 0 && z <= k) ++cnt;
        }
    }
    cout << cnt << endl;
}

int main() {
    solve();
    
    return 0;
}

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

int main(void){
	int N =0;
	scanf("%d",&N);
	int flag =1;
	int t[N]={0};
	int x[N]={0};
	int y[N]={0};
	for(int i=0;i<N;i++){
		scanf("%d",&t[i]);
		scanf("%d",&x[i]);
		scanf("%d",&y[i]);
	}
	for(int j=0;j<N;j++){
		int waste = t[j]-x[j]-y[j];
		if(waste<0)	
		{
			flag =0;
			break;
		}
		else{
			if(waste%2==0){
				continue;
			}else{
				flag =0;
				break;
			}
		
		}
	}
	if(flag) printf("Yes\n");
	else printf("No\n");
	return 0;

}


Measured memory_bytes: 1280
#include <iostream>
#include <string>
#include <vector>
#define rep(i, n) for(int i = 0; i < (n); ++i)
using namespace std;

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

  int n, m; cin >> n >> m;
  vector<string> a(n), b(m);
  rep(i, n) cin >> a[i];
  rep(i, m) cin >> b[i];

  bool judge = false;
  for(int i = 0; i <= n-m; ++i) {
    for(int j = 0; j <= n-m; ++j) {
      if(b[0][0]==a[i][j]) {
        bool flag = true;
        rep(p, m) rep(q, m) {
          if(b[p][q] != a[i+p][j+q]) flag = false;
        }
        if(flag) judge = true;
      }
    }
  }
  cout << (judge ? "Yes" : "No") << '\n';
  return 0;
}


Measured memory_bytes: 256
#include"bits/stdc++.h"
#include<cassert>
#define fr first
#define sc second
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
const long long mod = 998244353;
const long long inf = 1ll << 62;
typedef pair<int, int> P;
typedef pair<int, P> PP;
vector<int>G[30];
signed main() {
	string s, t; cin >> s >> t;
	rep(i, s.size()) {
		G[s[i] - 'a'].push_back(i);
	}
	int now = -1,sum=0;
	rep(i, t.size()) {
		int n = t[i] - 'a';
		if (G[n].size() == 0) {
			cout << -1 << endl; return 0;
		}
		auto x = upper_bound(G[n].begin(), G[n].end(), now);
		if (x == G[n].end()) {
			now = G[n][0]; sum++;
		}
		else now = *x;
	}
	int Z = s.size();
	cout << sum*Z + now+1 << endl;
}

Measured memory_bytes: 1724
# MERGE IT


'''n=int(input())
for i in range(0,n):
    o=int(input())
    p=input().rstrip().split(' ')
    l=[0]*3;
    for j in range(0,len(p)):
        l[(int(p[j])%3)]+=1;
    s=0;
    s+=l[0];
    s+=min(l[1],l[2])
    if min(l[1],l[2])==l[2]:
        l[1]-=l[2]
        s+=(l[1]//3)
    elif min(l[1],l[2])==l[1]:
        l[2]-=l[1]
        s+=(l[2]//3)
    print(s)'''

# LOSE IT

s=input().rstrip()
x=list(s)
T=0;
for i in range(0,len(x)):
    if x[i]=='o':
        T+=1;
T+=(15-len(x))
if T>=8:
    print("YES")
else:
    print("NO")


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,c=0,d=0;
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        if(i%2!=0)
        {
            c=0;
            //cout<<i<<"=";
            for(int j=1;j<=i;j++)
            {
                if(i%j==0)
                {
                   c++;
                }
            }
            if(c==8)
            {
                //cout<<i<<endl;
                d++;
            }
            //cout<<c<<endl;
        }
    }
    cout<<d<<endl;
    /*if(d>=1)
    {
        printf("Among the numbers between 1 and %d, the only number that is odd and has exactly eight divisors is 105.")
    }*/

}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>


int main(void)
{
	
	int n;
	long int ans = 1;
	long int max;
	long int min;
	long int kou_max;
	long int a[100000];
	long int i, j, k;
	int flg;
	int count = 0;
	
	scanf("%d", &n);
	
	scanf("%ld%ld", &a[0], &a[1]);
	
	if(a[0] > a[1]) {
		max = a[0];
		min = a[1];
	} else {
		max = a[1];
		min = a[0];
	}
	
	for(i = 2; i < n; i++) {
		scanf("%ld", &a[i]);
		if(min > a[i]) {
			max = min;
			min = a[i];
		} else if(max > a[i]) {
			max = a[i];
		}
	}
	
	for(j = max; j >= 1; j--) {
		count = 0;
		for(k = 0; k < n; k++) {
			if(a[k] % j != 0) {
				count++;
			}
			if(count >= 2) {
				break;
			}
		}
		if(count <= 1) {
			printf("%ld\n", j);
			return 0;
		}
	}
	
	return 0;
}

Measured memory_bytes: 896
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b,c,d;cin >> a >> b >> c >> d;
  if(abs(b-a)<=d&&abs(c-b)<=d) cout << "Yes" << endl;
  else if(abs(c-a)<=d) cout << "Yes" << endl;
  else cout << "No" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5+5;

int dp[N],a[] = {100,101,102,103,104,105};

int main()
{
	int x;
	cin >> x;
	memset(dp,0,sizeof(dp));
	dp[0] = 1;
	for(int i = 0;i < 6;++i){
		for(int j = a[i];j <= x;++j){
			dp[j] += dp[j-a[i]];
		}
	}
	
	if(dp[x]) printf("1\n");
	else printf("0\n");
	return 0;
}

Measured memory_bytes: 640
import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

void scan(T...)(ref T a) {
    string[] ss = readln.split;
    foreach (i, t; T) a[i] = ss[i].to!t;
}
T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;

void main() {
    readint;
    auto a = readints;

    int n = a.reduce!max;
    // n を候補から取り除く
    auto b = a.dup.remove(a.countUntil!(e => e == n));
    int d = b.reduce!((a, b) => abs(a - n/2) <= abs(b - n/2) ? a : b);
    writeln(n, " ", d);
}


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


void solve(std::string S, std::string T){
    int ans = 1e9;
    for (int i = 0; i + T.size() - 1 < S.size(); i++) {
        int cnt = 0;
        for (int j = 0; j < T.size(); j++) {
            if (S[i + j] != T[j]) {
                cnt++;
            }
        }
        ans = min(ans, cnt);
    }
    cout << ans << endl;
}

// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    std::string S;
    std::cin >> S;
    std::string T;
    std::cin >> T;
    solve(S, T);
    return 0;
}


Measured memory_bytes: 3624
#include <stdio.h>

int main(void)
{
	int n, a, b, sum_a, sum_b;
	int i;
	
	while (scanf("%d", &n) != EOF && n != 0){
		sum_a = sum_b = 0;
		for (i = 0; i < n; i++){
			scanf("%d %d", &a, &b);
			if (a > b){
				sum_a += a + b;
			}
			else if (a < b){	
				sum_b += a + b;
			}
			else {
				sum_a += a;
				sum_b += b;
			}
		}
		printf("%d %d\n", sum_a, sum_b);
	}
	
	return (0);
}

Measured memory_bytes: 600
s = input()
space = len(s) - 1
total = []
for i in range(2 ** space):
    pluses = [''] * space
    for j in range(space):
        if (i >> j) & 1:
            pluses[j] = '+'
    re = ''
    for a, b in zip(s, pluses + ['']):
        re += (a + b)
    total.append(eval(re))
ans = sum(total)
print(ans)

Measured memory_bytes: 3064
Public Class Program
  Shared Sub Main()
    Dim nk As Long() = Array.ConvertAll(Of String, Long)(Console.ReadLine().Split(" "), AddressOf Long.Parse)
    Dim n As Long = nk(0)
    Dim k As Long = nk(1)
    Dim arrayH As Long() = Array.ConvertAll(Of String, Long)(Console.ReadLine().Split(" "), AddressOf Long.Parse)
    Dim dp(0 To n - 1) As Long
    dp(0) = 0
    For j As Long = 1 To n - 1
      If j = 1 Then
        ' j = 1 
        dp(j) = Math.Abs(arrayH(j - 1) - arrayH(j))
      Else
        Dim jumpMin As Long = -1
        For i As Integer = 1 To k
          If i > j Then Exit For
          Dim jumpK As Long = Math.Abs(arrayH(j - i) - arrayH(j)) + dp(j - i)
          If jumpMin = -1 Then
            jumpMin = jumpK
          Else
            jumpMin = If(jumpK < jumpMin, jumpK, jumpMin)
          End If
        Next
        dp(j) = jumpMin
      End If
    Next
    Console.WriteLine(dp(n - 1).ToString())
  End Sub
End Class

Measured memory_bytes: 19424