akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int paper[10][10];
int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};
int dx2[] = {1, 1, 1, 0, -1, -1, -1, 0};
int dy2[] = {1, 0, -1, -1, -1, 0, 1, 1};
void make_spot(int x, int y, int s){
	paper[x][y]++;
	int nx, ny;
	if(s == 1){
		for(int i = 0; i < 4; i++){
			nx = x + dx[i], ny = y + dy[i];
			if(nx < 0 || nx >= 10 || ny < 0 || ny >= 10) continue;
			paper[nx][ny]++;
		}
	}else if(s == 2){
		for(int i = 0; i < 8; i++){
			nx = x + dx2[i], ny = y + dy2[i];
			if(nx < 0 || nx >= 10 || ny < 0 || ny >= 10) continue;
			paper[nx][ny]++;
		}
	}else if(s == 3){
		for(int i = 0; i < 8; i++){
			nx = x + dx2[i], ny = y + dy2[i];
			if(nx < 0 || nx >= 10 || ny < 0 || ny >= 10) continue;
			paper[nx][ny]++;
		}
		for(int i = 0; i < 4; i++){
			nx = x + 2 * dx[i], ny = y + 2 * dy[i];
			if(nx < 0 || nx >= 10 || ny < 0 || ny >= 10) continue;
			paper[nx][ny]++;
		}
	}
	return ;
}
int main(){
	fill(paper[0], paper[10], 0);
	for(;;){
		int x, y, s;
		if(scanf("%d,%d,%d", &x, &y, &s) == EOF) break;
		make_spot(x, y, s);
	}
	int cnt = 0, max_density = 0;
	for(int i = 0; i < 10; i++){
		for(int j = 0; j < 10; j++){
			if(paper[i][j] == 0) cnt++;
			if(paper[i][j] > max_density) max_density = paper[i][j];
		}
	}
	cout << cnt << endl << max_density << endl;
	return 0;
}


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

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second

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

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

const ll INF = 1ll<<29;
const ll MOD = 1000000007;
const bool debug = 0;

int main() {
	int p, m, c;
	cin >> p >> m >> c;
	
	cout << p + m + c << endl;
	return 0;
}

Measured memory_bytes: 3092
#include <bits/stdc++.h>
/*
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cstring>
#include <complex>
#include <stack>
#include <queue>
#include <unordered_map>
#include <map>
 */
#define INF 10e9
#define rep(i, a) for (int i = 0; i < (a); i++)
using namespace std;
 
int main() {
    int n;
    int W;
    cin >> n >> W;

    int v[110];
    vector<int> w(n);

    int i, j;
    for(i = 0; i < n; i++){
        cin >> v[i];
        cin >> w[i];
    }

    int dp[110][10010];

    //dp[i+1][j]: i番目までの中から重さがjを超えないように選んだ時の価値の最大値
    //dp[i+1][j] = max(dp[i][j], dp[i][j-w[i]]+v[i])

    for(j = 0; j <= W; j++){
        dp[0][j] = 0;
    }

    for(i = 0; i < n; i++){
        for(j = 0; j <= W; j++){
            if(j >= w[i]){
                dp[i+1][j] = max(dp[i][j], dp[i][j-w[i]] + v[i]);
            }else{
                dp[i+1][j] = dp[i][j];
            }
        }
    }

    cout << dp[n][W] << endl;



}


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

#define fre(i,a,b)  for(int (i)=(a);(i)<=(b);++(i))
#define fer(i,a,b)  for(int (i)=(a);(i)>=(b);--(i))

    string s1,s2;
    int N;
bool check(int step,int li,char a,char b)
{
    int L=1,R=li;
    if(s1[N-1]==a)  L++;
    if(s1[N-1]==b)  R--;
    fer(i,N-2,0)
    {
        if(L>R)   return true;
        if(s2[i]==a)    R=min(R+1,li);
        if(s2[i]==b)    L=max(1,L-1);
        if(s1[i]==a)    L++;
        if(s1[i]==b)    R--;
    }
    if(L>R||step>R||step<L) return true;
    return false;
}
int main()
{
    int H,W,x,y;
    ios::sync_with_stdio(false);
    cin>>H>>W>>N>>x>>y;
    cin>>s1>>s2;
    bool ans=check(y,W,'L','R')||check(x,H,'U','D');
    if(!ans) cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
    return 0;
}

Measured memory_bytes: 920
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;

int main()
{
    string ans = "Yes";
    int h, w;
    cin >> h >> w;
    vector<string> S(h);
    for (int i = 0; i < h; ++i)
    {
        cin >> S[i];
    }
    int dx[4] = {1, -1, 0, 0};
    int dy[4] = {0, 0, 1, -1};
    for (int i = 0; i < h; ++i)
    {
        for (int j = 0; j < w; ++j)
        {
            if (S[i][j] == '#')
            {
                bool can = false;
                for (int k = 0; k < 4; ++k)
                {
                    int ni = i + dx[k];
                    int nj = j + dy[k];
                    if (ni < 0 || ni > h - 1)
                    {
                        continue;
                    }
                    if (nj < 0 || nj > w - 1)
                    {
                        continue;
                    }
                    if (S[ni][nj] == '#')
                    {
                        can = true;
                    }
                }
                if (can == false)
                {
                    ans = "No";
                }
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <vector>
#include <string>
using namespace std;
typedef double  dbl;
typedef long long int lld;
#define PI 3.14159265358979323
#define foi(i,n) for(i = 0; i < n; i+=1)
#define fod(i,n) for(i=n-1; i >=0; i-=1)
#define MAX std::numeric_limits<lld>::max()
#define MIN std::numeric_limits<lld>::min()
#define FastIO  ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
int main ()
{
	FastIO
	lld n;
	string s;
	cin >> n >> s;
	if (n >= 3200)
		cout << s;
	else
		cout << "red";
	return 0;
}

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

typedef long long ll;
const long long LINF = 1LL << 60;
const long long LMINF = 1LL << 63;
const int INF = 1 << 30;

#define REP(i,n) for(int i = 0;i < n;++i)
#define REPS(i,x) for(int i = 1;i <= (int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i >= 0;i--)
#define RREPS(i,x) for(int i=((int)(x));i > 0;i--)
#define PB push_back
#define F first
#define S second
#define MP make_pair
#define ALL(obj) (obj).begin(),(obj).end()
#define debug(x) cerr << #x << ": " << x << "\n"

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(){
    ios::sync_with_stdio(false);cin.tie(0);
    int n,m,c;
    cin >> n >> m >> c;
    vector<short> b(m);
    REP(i,m)cin >> b[i];
    vector<vector<short>> a(n,vector<short>(m));
    REP(i,n){
        REP(j,m){
            cin >> a[i][j];
        }
    }

    unsigned int cnt = 0;
    REP(i,n){
        int pl = 0;
        REP(j,m){
            pl += (a[i][j] * b[j]);
        }
        if(pl + c > 0)cnt++;
    }

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

Measured memory_bytes: 3644
#include<cstring>
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<utility>
#include<queue>
#include<cmath>
#include<functional>
#include<vector>
#define int long long
#define N 100005
#define INF 1e7
using namespace std;
int n,h[N],f[N];
signed main()
{
	scanf("%lld",&n);
	for(int i=1;i<=n;i++)scanf("%lld",&h[i]);
	f[0]=INF;
	f[1]=0;
	for(int i=2;i<=n;i++)f[i]=min(f[i-1]+abs(h[i-1]-h[i]),f[i-2]+abs(h[i-2]-h[i]));
	printf("%lld",f[n]);
}


Measured memory_bytes: 1792
n = int(input())
a, b = map(int,input().split())
p = list(map(int, input().split()))
ca, cb, cc = 0, 0, 0
for i in range(n):
    if p[i] <= a:
        ca += 1
    elif a < p[i] <= b:
        cb += 1
    else:
        cc += 1
print(min(ca,cb,cc))

Measured memory_bytes: 3064
#include<iostream>
#include<algorithm>
using namespace std;
static const int MAX = 200000;

int main(){
int R[MAX],n;

cin >> n;
for(int i = 0;i < n;i++) cin >> R[i];

int maxv = -2000000000;
int minv = R[0];

for(int i = 1;i < n;i++){
maxv = max(maxv,R[i] - minv);
minv = min(minv,R[i]);
}
cout << maxv << endl;

return 0;
}


Measured memory_bytes: 3848
import sys
import copy
import math
import itertools
import numpy as np
S=input()
for i in range(1,len(S)):
    l = len(S[0:len(S)-i]) 
    if l%2==0:
        if S[0:len(S)-i] == S[0:int(l/2)]+S[0:int(l/2)]:
            print(l)
            sys.exit(0)

Measured memory_bytes: 27032
def col(n):
  if 1<=n<400:
    return 1
  if 400<=n<800:
    return 2
  if 800<=n<1200:
    return 3
  if 1200<=n<1600:
    return 4
  if 1600<=n<2000:
    return 5
  if 2000<=n<2400:
    return 6
  if 2400<=n<2800:
    return 7
  if 2800<=n<3200:
    return 8
  if n>=3200:
    return 9

n=int(input())
l=list(map(int,input().split()))
list=[]
for i in l:
  list.append(col(i))
p=list.count(9)
if p==0:
  print(len(set(list)),len(set(list)))
elif len(set(list))==1:
  print(1,p)
else:
  print(len(set(list))-1,len(set(list))+p-1)

Measured memory_bytes: 3064
#!/usr/bin/env python3
import sys
#sys.setrecursionlimit(150000)


def solve(A: int, B: int, N: int):
    print((A*min(N,(B-1))//B))
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    N = int(next(tokens))  # type: int
    solve(A, B, N)

if __name__ == '__main__':
    main()


Measured memory_bytes: 9192
#include<iostream>
using namespace std;
int main(){
	long long n,d,x,y;
	cin>>n>>d;
	int ans=0;
	for(int i=1;i<=n;i++){
		cin>>x>>y;
		if(x*x+y*y<=d*d) ans++;
	}
	cout<<ans;
}

Measured memory_bytes: 3620
import java.util.*;

public class Main 
{
    static int dfs(int n , LinkedList<Integer> arr[] , boolean visited[])
    {
        visited[n] = true;
        int tot = 0;
        for(Integer i : arr[n])
        {
            if(!visited[i])
            {
               tot += dfs(i,arr,visited); 
            }
        }
        return tot+1;
    }
    public static void main(String []args)
    {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        
        TreeMap<edge,Integer> map = new TreeMap<edge,Integer>(new Compare());
        LinkedList<Integer> arr[] = new LinkedList[n+1];
        boolean visited[] = new boolean[n+1];
        for(int i = 1 ; i <= n ; i++)
        {
            visited[i] = false;
            arr[i] = new LinkedList<Integer>();
        }
        for(int i = 0 ; i < m ; i++)
        {
             int x = sc.nextInt();
             int y = sc.nextInt();
             
             edge temp = new edge(x,y);
             
             if(map.containsKey(temp))
             continue;
             
             else
             {
                 map.put(temp,1);
                 arr[x].add(y);
                 arr[y].add(x);
             }
        }
        int max = 0;
        for(int i = 1 ; i <= n ; i++)
        {
            if(!visited[i])
            {
                max = Math.max(max , dfs(i,arr,visited));
            }
        }
        System.out.println(max);
    }
}

class edge
{
    int x , y;
    public edge(int x , int y)
    {
        this.x = x;
        this.y = y;
    }
}

class Compare implements Comparator<edge>
{
    public int compare(edge a , edge b)
    {
        if(a.x != b.x)
        return a.x-b.x;
        
        
        return a.y-b.y;
    }
}

Measured memory_bytes: 143048
#include <iostream>
#include <string>

using namespace std;

int main() {
	string s;
	cin >> s;
	int counter = 0;
	if (s[0] == '1')counter++;
	if (s[1] == '1')counter++;
	if (s[2] == '1')counter++;
	cout << counter << endl;
	return 0;
}

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

int main() {
  string input;
  cin >> input;
  
  int cnt = 0;
  int prevCnt = 0;
  size_t len = input.length();
  for(int i=0; i < len; ++i) {
    if(input[i] == 'A' || input[i] == 'T'
       || input[i] == 'C' || input[i] == 'G') {
      ++cnt;
    }
    else{
      prevCnt = cnt > prevCnt ? cnt : prevCnt;
      cnt = 0;
    }
  }
  
  cout << (cnt > prevCnt ? cnt : prevCnt) << endl;
  
}


Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <queue>
using namespace std;
const int N=200005;
int n,m;
struct People{
    int l,r,id;
    friend bool operator < (People a,People b){
        return a.r>b.r;
    }
}a[N],b[N];
bool inq[N];
int cnt;
priority_queue<People> q;
bool cmpl(const People &a,const People &b){
    return a.l<b.l;
}
bool cmpr(const People &a,const People &b){
    return a.r>b.r;
}
int main(){
    scanf("%d%d",&n,&m);
    for(int i=1;i<=n;i++)
        scanf("%d%d",&a[i].l,&a[i].r);
    sort(a+1,a+1+n,cmpl);
    int nowl=0,nowr=m+1,last;
    for(int i=1;i<=n;i++){
        a[i].id=i;
        if(nowl+1<=a[i].l){
            nowl++;
            q.push(a[i]);
            inq[i]=true;
        }
        else if(!q.empty()){
            People best=q.top();
            if(a[i].r>best.r){
                q.pop();
                inq[best.id]=false;
                q.push(a[i]);
                inq[i]=true;
            }
        }
    }
    for(int i=1;i<=n;i++)
        if(!inq[i])
            b[++cnt]=a[i];
    sort(b+1,b+1+cnt,cmpr);
    for(int i=1;i<=cnt&&nowr-1!=nowl;i++)
        if(nowr-1>=b[i].r)
            nowr--;
    printf("%d\n",n-(nowl+(m-nowr+1)));
    return 0;
}

Measured memory_bytes: 7924
import math

NUM = 10 ** 9 + 7

N, K = map(int, input().split())


def comb(a, b):
    return math.factorial(a) // (math.factorial(a - b) * math.factorial(b))


c = N - K + 1
d = K - 1
for i in range(1, K + 1):
    if c < i:
        print(0)
    else:
        print((comb(c, i) * comb(d, i - 1)) % NUM)


Measured memory_bytes: 3316
MOD = 10**9+7
n = int(input())
a = list(map(int, input().split()))
s = 0
for x in a:
	s += x
	s %= MOD
ans = 0
for x in a:
	ans += x * (s-x)
	ans %= MOD
ans *= pow(2, MOD-2, MOD)
print(ans%MOD)

Measured memory_bytes: 94156
#pragma GCC optimize(3)
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define mod 1000000007
#define int long long
#define inf (1LL << 30)
const int maxnodes=1005;
#define LL long long
#define N 1001
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int32_t main()
{
    IOS;
   
    int n,k;
    cin >> n >> k;
    if((n+1)/2 >= k)
        cout <<"YES";
    else
        cout << "NO";
    return 0;
}

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

typedef long long LL;
typedef pair<int, int> II;

const int N = (int) 1e5 + 10;
int n, a, b, x[N];

int main() {
    #ifdef LOCAL
        freopen("Data.inp", "r", stdin);
        freopen("Data.out", "w", stdout);
    #endif

    scanf("%d%d%d", &n, &a, &b);
    for (int i = 1; i <= n; ++i) scanf("%d", &x[i]);

    LL ans = 0;
    for (int i = 2; i <= n; ++i) ans += min((LL) a * (x[i] - x[i - 1]), (LL) b);

    cout << ans;
    return 0;
}


Measured memory_bytes: 640
#include <algorithm>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <set>
#include <stdio.h>
#include <string>
#include <utility>
#include <vector>

using namespace std;

int main() {
  int n, k;
  cin >> n >> k;
  vector<long long> a(n), sum(n + 1), psum(n + 1);
  for (int i = 0; i < n; i++)
    cin >> a[i];
  for (int i = 0; i < n; i++) {
    sum[i + 1] = sum[i] + a[i];
    psum[i + 1] = psum[i] + (a[i] > 0 ? a[i] : 0);
  }
  int maxId = 0;
  for (int i = 0; i <= n - k; i++) {
    if (psum[n] - (psum[maxId + k] - psum[maxId]) +
            max(sum[maxId + k] - sum[maxId], 0ll) <
        psum[n] - (psum[i + k] - psum[i]) + max(sum[i + k] - sum[i], 0ll)) {
      maxId = i;
    }
  }
  cout << psum[n] - (psum[maxId + k] - psum[maxId]) +
              max(sum[maxId + k] - sum[maxId], 0ll)
       << endl;
  return 0;
}


Measured memory_bytes: 2688
#include<bits/stdc++.h>
using namespace std;
const int N = 100005;
int n, dt[N];
vector<int> adj[N];

void calc (int C, int P) {
	for(auto &T : adj[C]) {
		if(T == P) continue;
		calc(T, C);
		dt[C] ^= (dt[T] + 1);
	}
}

int main()
{
	scanf("%d",&n);
	for(int i=1;i<n;i++) {
		int A, B;
		scanf("%d%d",&A,&B);
		adj[A].push_back(B);
		adj[B].push_back(A);
	}
	calc(1, 0);
	puts(dt[1]?"Alice":"Bob");
}


Measured memory_bytes: 10752
#include <iostream>
#include <algorithm>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define pb push_back
#define ll long long
int lst[200005][33];
int bf[33];
int a[200005];
int main(int argc, char** argv) {
	int n;
	scanf("%d",&n);
	rep(i,1,n)
	{
		scanf("%d",&a[i]);
	}
	rep(i,1,n)
	{
		rep(j,0,20)
		{
			if((1<<j)&a[i])
			{
				lst[i][j]=bf[j];
				bf[j]=i;
			//	cout<<i<<" "<<j<<endl;
			}
		}
	}

	//cout<<lst[3][2]<<endl;
	ll ans=0;	
	int mn=0;
	rep(i,1,n)
	{
	
		rep(j,0,20)
		{
			if((1<<j)&a[i])
			{
				mn=max(mn,lst[i][j]);
			}
		}
	//	cout<<i<<" "<<mn<<endl;
		ans+=1ll*(i-mn);
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 26752
#include <stdio.h>
#define N 2000
int solve(int,int);
int n,A[N];
int main(){
  int i,q,M[N];
  scanf("%d",&n);
  for(i = 0;i<n;i++){
    scanf("%d",&A[i]);
  }
  scanf("%d",&q);
  for(i = 0;i<q;i++){
    scanf("%d",&M[i]);
  }
  for(i = 0;i<q;i++){
    if(solve(0,M[i]) == 1){
    printf("yes\n");
    }else{
      printf("no\n");
    }
  }
  return 0;
}
int solve(int i,int m){
  int res;
  if (m == 0){
    return 1;
  }
  if (i >= n){
    return 0;
  }
  res = solve(i + 1, m) || solve(i + 1, m - A[i]);
  return res;
}



Measured memory_bytes: 2108
// -*- coding:utf-8-unix -*-

use proconio::input;
use proconio::marker::Chars;

fn main() {
    input! {
        s: Chars,
        t: Chars
    }
    if s.len() + 1 != t.len() {
        println!("No");    
    } else {
        let mut flag = 0;
        for (i, c) in s.iter().enumerate() {
            if *c != t[i] {
                flag = 1;
                break;
            }
        }
        if flag == 0 {
            println!("Yes");
        } else {
            println!("No");
        }
    }
}


Measured memory_bytes: 2120
#include <stdio.h>

int main() {
  int h, w;
  while(1) {
    scanf("%d %d", &h, &w);
    if (h == 0 && w == 0) {
      break;
    }
    for (int y = 0; y < h; y++) {
      for (int x = 0; x < w; x++ ) {
        printf("#");
      }
      printf("\n");
    }
    printf("\n");
  }
}



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

string s;
int ans, res;
int main() {
	ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	cin >> s;
	for (int i = 0; i < s.size(); i++)
		if (s[i] - '0' != i % 2)
			res++;
	ans = res;
	res = 0;
	for (int i = 0; i < s.size(); i++)
		if (s[i] - '0' == i % 2)
			res++;
	ans = min(ans, res);
	cout << ans;
}


Measured memory_bytes: 512
#include <iostream>
#include <tuple>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;

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

    long long seq = x;
    long long count = 1;
    for (long long a_i = 2 * x; a_i <= y; a_i *= 2) {
        seq += a_i;
        count++;
    }

    cout << count << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define ALL(x) (x).begin(), (x).end()
#define REP(i ,n) for(int i = 0; i < (int)(n); i++)
#define pb push_back
typedef vector<int>vint;
typedef vector<ll>vll;
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
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 main()
{
    int N;
    cin >> N;
    vll A(N);
    vll B(N);
    cin >> A;
    REP(i,N){
        B[i] = A[i];
    }
    int half = N/2;
    sort(B.begin(),B.end());
    REP(i,N){
        if(A[i] < B[half]){
            cout << B[half] << endl;
        }else{
            cout << B[half-1] << endl;
        }
    }
}

Measured memory_bytes: 6364
S = input()
mae = S[0:2]
ato = S[2:4]
smae = int(mae)
sato = int(ato)

if 0 < smae <13 and 0 < sato < 13:
  print("AMBIGUOUS")
  
elif 0 < smae <13 and (sato == 0 or sato > 12):
    print("MMYY")
    
elif(smae == 0 or smae > 12) and 0 < sato < 13:
  print("YYMM")
  
else:
  print("NA")


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

using pii = pair<int, int>;
using ll  = long long;
#define rep(i, j) for (int i = 0; i < (int)(j); i++)
#define repeat(i, j, k) for (int i = (j); i < (int)(k); i++)
#define all(v) v.begin(), v.end()
#define debug(x) cerr << #x << " : " << x << endl

template <class T>
bool set_min(T &a, const T &b) {
    return a > b ? a = b, true : false;
}
template <class T>
bool set_max(T &a, const T &b) {
    return a < b ? a = b, true : false;
}
// vector
template <class T>
istream &operator>>(istream &is, vector<T> &v) {
    for (T &a : v) is >> a;
    return is;
}
template <class T>
ostream &operator<<(ostream &os, const vector<T> &v) {
    for (const T &t : v) os << "\t" << t;
    return os << endl;
}
// pair
template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &v) {
    return os << "<" << v.first << ", " << v.second << ">";
}

const int INF = 1 << 30;
const ll INFL = 1LL << 60;

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

    ll N, M;
    cin >> N >> M;
    vector<ll> A(M);
    cin >> A;
    ll sum = accumulate(all(A), 0ll);

    cout << (N >= sum ? N - sum : -1) << endl;

    return 0;
}


Measured memory_bytes: 3700
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <iterator>
#include <assert.h>
#pragma warning(disable:4996) 
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
using namespace std;



int main(int argc, char* argv[])
{
    int n;
    scanf("%d", &n);

    vector<int> a(n);
    int i;
    for(i=0; i<n; i++) {
        int tmp;
        scanf("%d", &tmp);
        a[tmp-1]=i;
    }
    for(i=0; i<n; i++) {
        printf("%d ", a[i]+1);
    }
    printf("\n");

    return 0;
}


Measured memory_bytes: 1152
#include<bits/stdc++.h>
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int n;
    cin >> n;
    vector<long long> v(n);
    for(int i=0; i<n; i++){
        cin >> v[i];
    }
    long long cnt=0, maxi=max(v[0],v[1]);
    for(int i=1; i<n; i++){
        maxi = (v[i]>maxi) ? v[i] : maxi;
        if(v[i] >= v[i-1]) continue;
        else {
            cnt += (maxi-v[i]);
//            cout << cnt <<endl;
            v[i] = maxi;
        }
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 4776
'''
自宅用PCでの解答
'''
import math
#import numpy as np
import itertools
import queue
import bisect
from collections import deque,defaultdict
import heapq as hpq
from sys import stdin,setrecursionlimit
#from scipy.sparse.csgraph import dijkstra
#from scipy.sparse import csr_matrix
ipt = stdin.readline
setrecursionlimit(10**7)
mod = 10**9+7 #998244353
dir = [(-1,0),(0,-1),(1,0),(0,1)]
alp = "abcdefghijklmnopqrstuvwxyz"

#nまでの素数の配列を返す関数
def primes(n):
    if n == 1:
        return []
    else:
        tbl = [True]*(n+1)
        pri = set([2])
        for i in range(2,n+1,2):
            tbl[i] = False
        k = 3
        while k <= n:
            if tbl[k]:
                pri.add(k)
                for i in range(k,n+1,k):
                    tbl[i] = False
            k += 2
        return pri

def main():
    n = int(ipt())
    ps = primes(10**3)
    d = defaultdict(bool)
    nm = 0
    a = []
    b = False
    for i in map(int,ipt().split()):
        if i != 1:
            a.append(i)
        else:
            b = True
    n = len(a)
    if n == 0:
        print("pairwise coprime")
        exit()
    g = a[0]
    if b:
        g = 1
    f = True
    if n > 78500:
        f = False

    for i in a:
        g = math.gcd(g,i)
        if f:
            ni = i
            for j in ps:
                ff = True
                while ni%j == 0:
                    if ff and d[i]:
                        f = False
                    d[i] = True
                    ff = False
                    ni //= j
                    if ni == 1:
                        break
            if ni == 1:
                continue
            if d[ni]:
                f = False
            d[ni] = True
        if g == 1 and not f:
            break

    if f:
        print("pairwise coprime")
    elif g == 1:
        print("setwise coprime")
    else:
        print("not coprime")




    return None

if __name__ == '__main__':
    main()


Measured memory_bytes: 189704
N = int(input())

ss = dict()
sss = dict()
for i in range(N):
    s, p = input().split()
    sss[s, p] = i + 1
    if s in ss:
        ss[s] = ss[s] + ',' + p
    else:
        ss[s] = p

ss_sorted = sorted(ss.items())

for tmp_ss in ss_sorted:
    s = tmp_ss[0]
    ps = list(map(int, tmp_ss[1].split(',')))
    ps.sort(reverse=True)
    for p in ps:
        print(sss[s, str(p)])

Measured memory_bytes: 9168
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
using Graph = vector<vector<int>>;
const int INT_INF = 1001001001;
//stoi(s) : string→int stoll(s) :string→longlong  int→string to_string(i)
const double PI = acos(-1.0);
//小数点の表し方 cout << fixed << setprecision(5);

int yoriooki(ll a,vector<ll> vec){ //aより大きい数の要素数
    ll len = vec.size();
    auto iter_upper = upper_bound(vec.begin(), vec.end(), a);
    ll idx_upper = distance(vec.begin(), iter_upper);
    return len - idx_upper;
}

int yoritisai(ll a,vector<ll> vec){ //aより小さい要素数
    ll len = vec.size();
    auto iter_lower = lower_bound(vec.begin(), vec.end(), a);
    ll idx_lower = distance(vec.begin(), iter_lower); 
    return idx_lower;
}

int main(){
    int n;
    cin >> n;
    vector<ll> a(n),b(n),c(n);map<ll,int> ma,mb,mc; 
    for(int i=0;i<n;i++){
        cin >> a[i];
    }
    for(int i=0;i<n;i++){
        cin >> b[i];
    }
    for(int i=0;i<n;i++){
        cin >> c[i];
    }
    sort(a.begin(),a.end());
    sort(b.begin(),b.end());
    sort(c.begin(),c.end());
    ll ans = 0;
    for(int i=0;i<n;i++){
        ll now_b = b[i];
        ll now_a = 0;
        ll now_c = 0;
        auto itrA = lower_bound(a.begin(),a.end(),now_b);
        ll idxA = itrA - a.begin();
        auto itrB = upper_bound(c.begin(),c.end(),now_b);
        ll idxB = itrB - c.begin();
        idxB = n - idxB;

        ans += idxA * idxB;


    }
    cout << ans << endl;

}



Measured memory_bytes: 2560
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		int n = 0;
		Scanner stdin = new Scanner(System.in);
		n = stdin.nextInt();		
		long[] a = new long[n];
		for (int i = 0; i < n; i++) {
			a[i] = stdin.nextLong();
		}
		
		long min = a[0];
		for (int j = 1; j < a.length; j++) {
	        if (a[j]<min) {
	        	min = a[j];
	        }
	    }
		
		long max = a[0];
		for (int i = 1; i < a.length; i++) {
	        if (a[i]>max) {
	        	max = a[i];
	        }
	    }
		
		long sum = a[0];
		for (int i = 1; i < a.length; i++) {	       
	        	sum += a[i];
	    }
		
		System.out.println( min+ " " + max + " " + sum );
	}
}

Measured memory_bytes: 41856
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); ++i
#define all(x) (x).begin(),(x).end()
#define pb push_back
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>; // グラフ型

int main()
{
  int a,b; cin >> a >> b;
  int tot=16;
  if(a<=8 && b<=8) printf("Yay!");
  else printf(":(");
}


Measured memory_bytes: 3772
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
int main(){
  int n,k;
  cin>>n>>k;
  string s;
  cin>>s;
  int score=0;
  rep(i,n-1){
    if(s[i]==s[i+1]){
      score+=1;
    }
  }
  int ans=min(score+2*k,n-1);
  cout<<ans<<endl;
}

Measured memory_bytes: 512
from fractions import gcd
# from math import gcd
from functools import reduce
N, M = map(int, input().split())
nums = set([num // 2 for num in list(map(int, input().split()))])
# 1<=X<=Mの範囲で、半公倍数の数を求める。
# 但し、Xは、num*(p+0.5)でなければならない
# Mが10**9なので、全部やるのは無理。
# n.5倍なので、numsのあたいは全て偶数になっている。

# nums一つ一つ、答えになりうるXの配列を作って、重複したものを残せばそれが答えになる。
# Nが10**5なので、どうだろう


def half_multiple(x, y):
    return (x * y) // gcd(x, y)


def run():
    half_multiple_num = reduce(half_multiple, nums, 1)

    # print(half_multiple_num)
    for num in nums:
        if (half_multiple_num // num) % 2 == 0:
            print(0)
            return

    pmax = M // half_multiple_num
    pmax = pmax - 1 if pmax % 2 == 0 else pmax

    print((pmax + 1) // 2)


run()


Measured memory_bytes: 89580
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
typedef vector<ll> VI;
typedef vector<VI> VVI;
const ll MOD = 1000000007;
const ll INF = 4611686018427387903;
#define REP(i, n) for (int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()

int main(){
	int n, m; cin >> n >> m;
	VI a(n), b(m);
	REP(i,n) cin >> a[i];
	REP(i,m) cin >> b[i];
	VVI dp(n,VI(m,0)), s(n,VI(m,0));
	REP(i,n)REP(j,m){
		if(i>0)
			s[i][j]+=s[i-1][j];
		if(j>0)
			s[i][j]+=s[i][j-1];
		if(i>0&&j>0)
			s[i][j]-=s[i-1][j-1];
		s[i][j]=(s[i][j]+2*MOD)%MOD;
		if(a[i]==b[j]){
			if(i>0&&j>0)
				dp[i][j]=s[i-1][j-1]+1;
			else
				dp[i][j]=1;
			dp[i][j]%=MOD;
			s[i][j]+=dp[i][j];
		}
		s[i][j]%=MOD;
	}
	ll ans=0;
	REP(i,n)REP(j,m)
		ans=(ans+dp[i][j])%MOD;
	cout << (ans+1)%MOD << endl;
	return 0;
}


Measured memory_bytes: 65968
#include <iostream>
#include <cstdio>
#include <vector>
#include <math.h>

using namespace std;

typedef long long int ll;
typedef long double ld;

#define rep(i,n) for(int i = 0; i < (n); ++i)
#define vsort(a) sort(a.begin(), a.end())
#define rev(a) reverse(a.begin(), a.end())

const int MOD = 1000000007;
const int INF = INT_MAX;


int main(){

    int n;
    cin >> n;
    int t[n], x[n], y[n];
    rep(i, n) cin >> t[i] >> x[i] >> y[i];

    int flag = 1;
    rep(i, n){
        if (t[i] >= x[i]+y[i] && (t[i]-x[i]-y[i]) % 2 == 0) ;
        else flag = 0;
    }

    if (flag) cout << "Yes" << endl;
    else cout << "No" << endl;


    return 0;
}





//              g++ -std=c++1z

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

#define rep(...) repN((__VA_ARGS__,rep3,rep2,loop,~))(__VA_ARGS__)
#define loop(n) rep2(_loop_,n)
#define rep2(i,n) rep3(i,0,n)
#define rep3(i,begin,end) for(int i = (int)(begin), i##_end = (int)(end); i < i##_end; ++i)
#define repN(a) repX a
#define repX(a0,a1,a2,x,...) x

int f(int n){
	int res = 0;
	while(n){
		res += n % 10;
		n /= 10;
	}
	return res;
}

int main(void){
	int N;
	cin >> N;
	bool ans = (N % f(N) == 0);
	puts(ans ? "Yes" : "No");
	return 0;
}


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

#define rep(i,a) for(int i = 0 ; i < a ; i ++)
#define loop(i,a,b) for(int i = a ; i < b ; i ++)
#define vi vector<int>
#define vs vector<string>
#define pii pair<int, int>
#define f first
#define s second
#define pb push_back
using namespace std;

int main(void){
  int n;
  cin>>n;
  vi a(n);
  int r = 0;
  rep(i,n){
    cin>>a[i];
    r = (r>a[i]?r:a[i]);
  }

  rep(i,n){
    int c = 0;
    while(a[i]%2==0){
      c ++;
      a[i] /= 2;
    }
    r = min(r,c);
  }
  cout<<r<<endl;
}

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

long long cnt;
int l;
int A[1000000];
int n;
vector<int> G;

void insertionSort(int A[], int n, int g){
    for(int i=g; i<n; i++){
        int v=A[i];
        int j=i-g;
        while( j>= 0 && A[j]>v){
            A[j+g] = A[j];
            j -= g;
            cnt++;
        }
        A[j+g] = v;
        
    }
}

void shellSort(int A[], int n){
    for(int h=1;;){
        if(h>n) break;
        G.push_back(h);
        h= 3*h +1;
    }
    
    for(int i= G.size()-1; i>= 0; i--){
        insertionSort(A,n,G[i]);
    }
}

int main(){
    cin >> n;
    for(int i=0; i<n; i++) scanf("%d", &A[i]);
    cnt = 0;
    
    shellSort(A,n);
    
    cout << G.size() << endl;
    for(int i=G.size() -1; i>=0; i--){
        printf("%d", G[i]);
        if( i )printf(" ");
    }
    printf("\n");
    printf("%d\n",cnt);
    for(int i=0; i<n; i++)printf("%d\n",A[i] );
    
    return 0;
}


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

T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;

int calc(int n) {

    bool isValid(long m) {
        bool b3, b5, b7;
        while (m > 0) {
            int x = m % 10;
            m /= 10;
            switch (x) {
            case 3: b3 = true; break;
            case 5: b5 = true; break;
            case 7: b7 = true; break;
            default: break;
            }
        }
        return b3 && b5 && b7;
    }

    auto stack = DList!long();
    stack.insertBack(0);

    int ans = 0;
    while (!stack.empty) {
        long x = stack.back;
        stack.removeBack();
        if (x > n) continue;

        if (isValid(x)) ans++;

        stack.insertBack(10 * x + 3);
        stack.insertBack(10 * x + 5);
        stack.insertBack(10 * x + 7);
    }
    return ans;
}

void main() {
    int n = readint;
    writeln(calc(n));
}


Measured memory_bytes: 1276
#include<stdio.h>

int main(void)
{
	int n;
	scanf("%d",&n);
	if(n%4==0)
		printf("Yes");
	else if(n%4==1 && n>=21)
		printf("Yes");
	else if(n%4==2 && n>=14)
		printf("Yes");
	else if(n%4==3 && n>=7)
		printf("Yes");
	else
		printf("No");
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int str[120];
int main()
{
    int k;
    cin>>k;
    int cnt=1;
    while(k--)
    {
        for(int i=0; i<cnt; ++i)
        {
            if(i==cnt-1)
            {
                if(str[i]==9)
                {
                    str[cnt]=1;
                    for(int j=cnt-1; j>=0; --j)
                    {
                        str[j]=0;
                    }
                    ++cnt;
                    break;
                }
                else
                {
                    ++str[i];
                    for(int j=i-1; j>=0; --j)
                    {
                        str[j]=max(0,str[j+1]-1);
                    }
                    break;
                }
            }
            else
            {
                if(str[i]<=str[i+1]&&str[i]!=9)
                {
                    ++str[i];
                    for(int j=i-1;j>=0;--j)
                    {
                        str[j]=max(0,str[j+1]-1);
                    }
                    break;
                }
            }
        }
    }
        for(int i=cnt-1; i>=0; --i)
            cout<<str[i];
        cout<<endl;
    return 0;
}


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

public class Main{
    public static void main(String[] args)throws IOException{
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt(); //宿泊数
        int k = scan.nextInt(); //料金プラン切替日
        int x = scan.nextInt(); //前半料金
        int y = scan.nextInt(); //後半料金
        
        int ryokin = 0;
        
        if(n > k){
            ryokin = x * k + y * (n -k);
        }
        else{
            ryokin = x * n;
        }
        System.out.println(ryokin);
    }
}

Measured memory_bytes: 10064
import math

mod = 10 ** 9 + 7
n, k = map(int, input().split())
a1 = n - k + 1
a2 = 1
for i in range(1, k + 1):
    print(a1 * a2 % mod)
    a1 = a1 * (n - k + 1 - i) // (i + 1)
    a2 = a2 * (k - i) // i


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

int main()
{
  int n;
  cin >> n;
  vector<string> s(n);
  int i;
  for(i = 0; i < n; i++)
  {
    cin>>s.at(i);
  }
  for(i = 0; i < n; i++)sort(s.at(i).begin(), s.at(i).end());
  sort(s.begin(), s.end());
  long long ans = 0;
  long long count = 1;
  for(i = 1; i < n; i++)
  {
    if(s.at(i) == s.at(i-1))
    {
      ans += count;
      count++;
    }
    else
    {
      count = 1;
    }
  }
  cout << ans << endl;
}

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

using namespace std;

const int N = 24*60*60;

string s;
int ans;

int main()
{
  cin >> s;
  int n = s.size();
  for (int i = 0; i < n / 2; i++)
    if (s[i] != s[n - i - 1])
      ans++;
  cout << ans;
  return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;

namespace atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var array = Console.ReadLine().Split(' ').Select(num => int.Parse(num)).ToArray();
            var num = 0;
            for (var i = 0; i < n; i++)
            {
                if (array[i] == num + 1)
                {
                    num++;
                }
            }

            Console.WriteLine(num == 0 ? -1 : n - num);
        }
    }
}

Measured memory_bytes: 43828
N = int(input())
AB, ans = [], 0
for _ in range(N):
    a, b = map(int, input().split())
    AB.append([a+b, a, b])    
AB = sorted(AB, reverse=True)

for i in range(N):
    ans += (-1)**(i%2) * AB[i][i%2 + 1]
print(ans)

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

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	long long health, ans = 0, attacks = 1;
	
	cin >> health;
	
	while(health > 0) {
		ans += attacks;
		attacks *= 2;
		health /= 2;
	}
	
	cout << ans << endl;
}


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

int h, w;
char a[8][8];
bool search(int i, int j) {
	if (i >= h || j >= w || a[i][j] == '.') {
		return false;
	}
	if (i == h - 1 && j == w - 1) {
		return true;
	}
	if (search(i + 1, j) || search(i, j + 1)) {
		return true;
	}
}

int main(){
	cin >> h >> w;
	int count = 0;
	for (int i = 0;i < h;i++) {
		for (int j = 0;j < w;j++) {
			cin >> a[i][j];
			if (a[i][j] == '#') {
				count++;
			}
		}
	}

	if (search(0, 0) && count == h + w - 1) {
		cout << "Possible" << endl;
	}
	else {
		cout << "Impossible" << endl;
	}
	return 0;
}

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

int main()
{
    int n,a[100000];
    int suma;
    int i,j;

    scanf("%d",&n);
    a[0] = 0;
    for (i = 1; i <= n; i++)scanf("%d",&a[i]);
    a[i] = 0;

    suma = 0;
    for (i = 0; i < n + 2; i++)
    {
        suma += abs(a[i + 1] - a[i]);
    }

    for (i = 1; i <= n; i++)
    {
        printf("%d\n",suma - abs(a[i + 1] - a[i]) - abs(a[i - 1] - a[i]) + abs(a[i + 1] - a[i - 1]));
    }
}

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

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

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

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

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

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

fn main() {
    input!{
        A: usize,
        B: usize,
    }
    println!("{}", if B%A==0 {A+B} else {B-A});
}



Measured memory_bytes: 4476
import collections

N = int(input())
S = []
for _ in range(N):
    inpt = input()
    S.append(inpt)

c = collections.Counter(S)
m = c.most_common()

ans = m[0][1]
ans_list = [i[0] for i in c.items() if i[1] >= ans]
ans_list.sort()
for i in ans_list:
    print(i)


Measured memory_bytes: 47640
#include <cstdio>
#include <algorithm>
#include <vector>
#include <set>
#include <queue>
#include <algorithm>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <utility>
#include <random>
#include <chrono>

using namespace std;

#define ll long long

int n, k;

int main()
{
    scanf("%d%d", &n, &k);
    ll ans = 0;
    for (ll i = k; i <= n + 1; i++) {
        ll minv = (i * (i - 1LL)) / 2;
        ll maxv = ((ll)(n - i + 1 + n) * i) / 2LL;
        ans += maxv - minv + 1;
        ans %= 1000000007;
    }
    printf("%lld", ans);
    return 0;
}


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

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
	int a,b,c;
	int x;
	
	cin >> a >> b >> c;
	
	x = a*100+b*10+c;

	if(x % 4 == 0){
		cout << "YES" << endl;
	}
	else{
		cout << "NO" << endl;
	}

	return 0;
}


Measured memory_bytes: 256
n,m = map(int,input().split())
h = list(map(int,input().split()))
l = [0] * n

for i in range(m):
    a,b = map(int,input().split())

    l[a-1] = max(l[a-1], h[b-1])
    l[b-1] = max(l[b-1], h[a-1])

result = 0

for j in range(n):
    if h[j] > l[j]:
        result += 1
print(result)

Measured memory_bytes: 20120
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define ld long double
#define fo(i,start,end) for(int i=start;start<end?i<end:i>end;start<end?i+=1:i-=1)
#define pb push_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define F first
#define S second
#define vll vector<ll>
#define pll pair<ll,ll>
#define vop vector<pll>
#define vov vector<vector<ll>>
using namespace std;
const ld pi=3.14159265358979323;

const long long mod1=1e9+7;
const long long mod2=1e18;
const ll mod3=9e18;

long long power(ll  x, ll n){if(n==0)return 1;ll temp=power(x,n/2);if(n%2==0)return temp*temp;else return x*temp*temp;}
ll MAX(ll a,ll b){return a>b?a:b;}
ll MAX(ll a,ll b,ll c){return max(max(a,b),c);}
ll MIN(ll x,ll  y){return x+y-max(x,y);}
ll MIN(ll x,ll y,ll z){return min(min(x,y),z);}
void swap(int* a, int* b){int t = *a;*a = *b;*b = t;}
bool f(ll x,ll y){return x>y;}

ll pmod(ll a, ll b)//a^b%mod1
{
    ll ans=1;
    while(b)
    {
        if(b&1)
            ans=(ans*a)%mod1;
        b/=2;
        a=(a*a)%mod1;
    }
    return ans;
}




vll adj[100001];
ll vis[100001];
ll sssp[100001];






void solve(){
    ll n,m;
    cin>>n>>m;
    ll arr[n+1];
    fo(i,1,n+1)cin>>arr[i];
    fo(i,0,m){
        ll a,b;
        cin>>a>>b;
        adj[a].pb(b);
        adj[b].pb(a);


    }
    ll c=0;
    fo(i,1,n+1){
        if(adj[i].size()==0)c++;
        else{
            ll f=1;
            for(auto x:adj[i]){
                if(arr[x]>=arr[i])f=0;


            }

            if(f)c++;

        }



    }


    cout<<c;

}




int main() {

    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.txt" , "r" , stdin) ;
    freopen("output.txt" , "w" , stdout) ;
    //freopen("error.txt" , "w" , stderr) ;
#endif

    ll t;
    t=1;
    //cin>>t;
    while(t--){

        solve();
    }

    return 0;


}


Measured memory_bytes: 10264
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iomanip>
using namespace std;

typedef long long ll;

#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define per(i,a,b) for(ll i=(b-1);i>=(a);--i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(c) string(1,c)
#define print(x) cout<<#x<<" = "<<x<<endl;

#define MOD 1000000007

ll dd[100][100];

int main() {
	ll W,B;
	cin>>W>>B;
	W--;
	B--;
	rep(y,0,50){
		rep(x,0,100){
			dd[y][x] = 0;
		}
	}
	rep(y,50,100){
		rep(x,0,100){
			dd[y][x] = 1;
		}
	}
	for(ll y = 0; y < 50; y+=2){
		for(ll x = 0; x < 100; x+= 2){
			if(B>0){
				dd[y][x] = 1;
				B--;
			}
		}
	}
	for(ll y = 51; y < 100; y+=2){
		for(ll x = 0; x < 100; x+= 2){
			if(W>0){
				dd[y][x] = 0;
				W--;
			}
		}
	}
	cout << 100 << " " << 100 << endl;
	rep(y,0,100){
		rep(x,0,100){
			if(dd[y][x]==0){
				cout << ".";
			}
			else{
				cout << "#";
			}
		}
		cout << endl;
	}
	return 0;
}

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

using namespace std;

char str[112345];
int cont[30];

int main() {

	scanf("%s", str);

	int tam = strlen(str);

	for (int i=0; i<tam; ++i) {
		cont[str[i]-'a']++;
	}

	int flag = 0;
	for (int i=0; i<26; ++i) {
		if (!cont[i]) {
			printf("%c\n", i+'a');
			flag = 1;
			break;
		}
	}

	if (!flag) {
		puts("None");
	}
	return 0;
}

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

#define N 405

typedef long long ll;

ll m[N][N], res[N][N], n;

void print_m() {
	for (int i = 0;i < n;i++) {
		cout << "i: " << i << "      ";
		for (int j = 0;j < n;j++) {
			cout << m[i][j] << " ";
		}
		cout << endl;
	}
}

void print_res() {
	for (int i = 0;i < n;i++) {
		cout << "i: " << i << "      ";
		for (int j = 0;j < n;j++) {
			cout << res[i][j] << " ";
		}
		cout << endl;
	}
}

void get_ans(int I, int J) {
	int i = J, j = J - 1;

	while (j != I - 1) {
		ll p = m[I][j]	+ m[i][J] + res[I][j] + res[i][J];

		if (m[I][J] == 0 || m[I][J] > p) { 
			m[I][J] = p; 
			res[I][J] = res[I][j] + res[i][J];
		}

		j--; i--;
	}	
}

int main() {

	cin >> n;

	int enter[n];

	for (int i = 0;i < n;i++) {
		cin >> enter[i];

		res[i][i] = enter[i];
	}

	int J = 1, I = 0;

	for (int j = 1;j < n;j++) {
		res[I][j] = res[I][j - 1] + res[I + 1][j];
		m[I][j] = res[I][j];
		I++;	
	}

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

		I = 0; J = 2 + i;

		while (I < n - 2 - i && J < n) {
			get_ans(I, J);
			I++; J++;
		}

	}	

	cout << m[0][n - 1];

}


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

int main() {
  int N, sum = 0;
  cin >> N;

  int a;
  cin >> a;
  if(a % 2 == 0) {
	sum++;
    while(true){
      a /= 2;
      if(a % 2 == 1) break;
      sum++;
    }

    for(; N > 1;N--) {
      int a;
      cin >> a;
      if(a % 2 == 1) {
        sum = 0;
        break;
      }

      int count = 1;
      while(sum > count){
        a /= 2;
        if(a % 2 == 1) break;
        count++;
      }

        sum = count;
    }
  }
  cout << sum << endl;
}


Measured memory_bytes: 3644
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int bit = 0;
        for (int i=0; i<N; i++) {
            bit |= sc.nextInt();
        }
        System.out.println(Integer.numberOfTrailingZeros(bit));
    }
}

Measured memory_bytes: 21712
N, K = [int(i) for i in input().rstrip().split(' ')]
H = [int(i) for i in input().rstrip().split(' ')]
H.sort(reverse=True)
if len(H) <= K:print(0)
else:
    lst = [h for k, h in enumerate(H) if k >= K]
    print(sum(lst))


Measured memory_bytes: 26180