akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
using namespace std;

int main(){
  int a,min=10000,min2=10000;
  for(int i=0;i<3;i++){
    cin>>a;
    if(a<min)min=a;
  }
  for(int i=0;i<2;i++){
    cin>>a;
    if(a<min2)min2=a;
  }
  cout<<min+min2-50<<endl;
  return 0;
}

Measured memory_bytes: 1160
using System;
using System.Collections.Generic;
using System.Linq;

namespace ABC167C
{
    class Program
    {
        static void Main(string[] args)
        {
            var NMX = ReadInt();
            int N = NMX[0];
            int M = NMX[1];
            int X = NMX[2];

            int[] c = new int[N];
            int[,] A = new int[N, M];

            for (int i = 0; i < N; i++)
            {
                var input = ReadInt();
                c[i] = input[0];
                for (int j = 0; j < M; j++)
                {
                    A[i, j] = input[j + 1];
                }
            }

            int ansCost = int.MaxValue;

            //bit全探索
            int n = N;
            for (int bit = 0; bit < (1 << n); ++bit)
            {
                List<int> S = new List<int>();
                for (int i = 0; i < n; i++)
                {
                    if ((bit & (1 << i)) != 0)
                    {
                        S.Add(i);
                    }
                }

                //計算で使う
                int cost = 0;
                int[] rikaido = new int[M];
                foreach (var i in S)
                {
                    for (int j = 0; j < M; j++)
                    {
                        rikaido[j] += A[i, j];
                    }
                    cost += c[i];
                }

                var a = rikaido.Where(x => x < X).ToArray().Count();
                if (a == 0)
                {
                    if (ansCost > cost) ansCost = cost;
                }
            }

            if (ansCost != int.MaxValue) Console.WriteLine(ansCost);
            else Console.WriteLine("-1");
            Console.ReadKey();
        }

        static int[] ReadInt()
        {
            int[] ret = Console.ReadLine().Split().Select(int.Parse).ToArray();
            return ret;
        }
        static long[] ReadLong()
        {
            long[] ret = Console.ReadLine().Split().Select(long.Parse).ToArray();
            return ret;
        }
    }
}


Measured memory_bytes: 21580
#include <iostream>
#include <ctype.h>
using namespace std;

int main()
{
    
    char C;
    cin >> C;
    
    bool check = isupper(C);
    
    if(check){
        cout << "A" << endl;
    }
    else{
        cout << "a" << endl;
    }
    
}


Measured memory_bytes: 3040
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

plus_list = []
ans = plus = minus = 0
for a, b in zip(A, B):
    if a - b >= 0:
        plus += (a - b)
        plus_list.append(a - b)
    else:
        ans += 1
        minus += (b - a)

if len(plus_list) == N:
    print(0)
elif minus > plus:
    print(-1)
elif minus == plus:
    print(N)
else:
    plus_list.sort(reverse=True)
    for plus_num in plus_list:
        minus -= plus_num
        ans += 1
        if minus <= 0:
            break
    print(ans)

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

using namespace std;

#define all(x) x.begin(), x.end()
#define sz(x) (int) x.size()
#define pb push_back
#define endl '\n'
#define snd second
#define fst first
#define fastio cin.tie(NULL),cout.sync_with_stdio(true)

typedef long long int ll;
typedef unsigned long long int ull;
typedef vector <int> vi;
typedef pair <ll,int> ii;
typedef pair <ii,int> iii;

const int mod = 1e9 + 7;
const int N = 200005;

int f[N], v[N];

int mul(int a, int b){
	return 1ll * a * b % mod;
}

int pwr(int a, int b){
	int r = 1;
	for(; b; b >>=1, a = mul(a,a))
		if(b&1)
			r = mul(r,a);
	return r;
}

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

void solve(){
	int n, k;
	cin >> n >> k;
	int x = pwr(10,100);
	for(int i = 0; i <= n; i++){
		v[i] = add(i, x);
		if(i)v[i] = add(v[i], v[i-1]);
	}
	int ans = 1;
	for(int i = k; i <= n; i++){
		ans = add(ans, ((v[n] - v[n-i] + mod)%mod - v[i-1] + mod)%mod + 1);
	}
	cout << ans << endl;
}

int main(){
	fastio;
	int t = 1;
	//cin >> t;
	while(t--)
		solve();
	return 0;
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int mod = 1e9 + 7;

int add(int a, int b)
{
    int c = (a % mod + b % mod);
    c += mod;
    c %= mod;
    return c;
}
int pw(int x, int y)
{
    int p = mod;
    int res = 1;
    x = x % p;
    if (x == 0)
        return 0;
    while (y > 0)
    {
        if (y & 1)
            res = (res * x) % p;
        y = y >> 1;
        x = (x * x) % p;
    }
    return res;
}

int32_t main()
{
    int n;
    cin >> n;
    cout << add(add(pw(10, n), -(2 * pw(9, n))), pw(8, n)) % mod;
}

Measured memory_bytes: 3580
n, k = map(int, input().split())
ls = list(map(int, input().split()))

res = 2 * (abs(ls[0]) + abs(ls[-1]))
for i in range(n - k + 1):
    a = ls[i]
    b = ls[i + k - 1]
    if b <= 0:
        res = min(res, -a)
    elif a >= 0:
        res = min(res, b)
    else:
        res = min(res, -2 * a + b, -a + 2 * b)
print(res)

Measured memory_bytes: 14384
n = int(input())

arr = map(int,raw_input().split())

ma = max(arr)
mi = min(arr)

ans = float("inf")

for i in range(mi,ma+1):
	count = 0
	for j in range(n):

		count += (i - arr[j]) * (i - arr[j])

	ans = min(ans,count)

print ans

Measured memory_bytes: 2568
PList = [2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97]
PNum  = len(PList)
Beki  = [0]*(PNum)

N = int(input())
for n in range(1,N+1):
    nn = n
    for i in range(PNum):
        while nn % PList[i] == 0:
            Beki[i]+=1
            nn //= PList[i]
'''
75 = (74+1)
   = (24+1)(2+1)
   = (14+1)(4+1)
   = (4+1)(4+1)(2+1)
'''

beki02 = 0
beki04 = 0
beki14 = 0
beki24 = 0
beki74 = 0

for i in Beki:
    if i >= 2:
        beki02+=1
    if i >= 4:
        beki04+=1
    if i >= 14:
        beki14+=1
    if i >= 24:
        beki24+=1
    if i >= 74:
        beki74+=1

ans = 0
ans += beki74
ans += beki24*(beki02-1)
ans += beki14*(beki04-1)
ans += beki04*(beki04-1)//2*(beki02-2)

print(ans)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
int main(){
  int n;
  cin >> n;
  
  int a[n];
  rep(i,n) cin >> a[i];
  
  int sum = 0;
  rep(i,n) sum += a[i];
  
  int ans = sum - n;
  
  cout << ans << endl;
  
  return 0;
}
                      
                      

Measured memory_bytes: 256
n = int(input())
a = list( map(int, input().split()) )

cnt = 1
ans = 0
flg = False
for i in range(n):
    if cnt == a[i]:
        flg = True
        cnt += 1
    else:
        ans += 1
print(ans) if ans >= 0 and flg else print(-1)

Measured memory_bytes: 77644
#include<bits/stdc++.h>
using namespace std;
long long h,w,ans=0x7fffffffffffffff,a,b,c,d,e,i,ans1,ans2;
long long f(long long h,long long w){
	for(i=0;i<=h/2;i++){
		a=w*i;b=w/2*(h-i);c=(h-i)/2*w;d=h*w-a-b;e=h*w-a-c;
		ans1=max(a,max(b,d))-min(a,min(b,d));
		ans2=max(a,max(c,e))-min(a,min(c,e));
		ans=min(ans,min(ans1,ans2));
	}
}
int main(){
  cin>>h>>w;
  f(h,w);
  f(w,h);
  cout<<ans;
  }

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

void func(int **a, int n, int m, int i, int j, int v)
{
	if(a[i][j] != v){
		return ;
	}
	a[i][j] = 0;
	
	if(i-1 >= 0){
		func(a, n, m, i-1, j, v);
	}
	if(i+1 < n){
		func(a, n, m, i+1, j, v);
	}
	if(j-1 >= 0){
		func(a, n, m, i, j-1, v);
	}
	if(j+1 < m){
		func(a, n, m, i, j+1, v);
	}
	
	return ;
}

int main(int argc, char **argv)
{
	char w;
	int **a, n, m, i, j, c;
	
	while(1){
		scanf("%d %d", &n, &m);
		if(n == 0){
			break;
		}
		scanf("%c", &w);
		a = (int **)calloc(n, sizeof(int));
		for(i = 0; i < n; i++){
			a[i] = (int *)calloc(m, sizeof(int));
			for(j = 0; j <= m; j++){
				scanf("%c", &w);
				if(w == '#'){
					a[i][j] = 1;
				} else if(w == '@'){
					a[i][j] = 2;
				} else if(w == '*'){
					a[i][j] = 3;
				}
			}
		}
		
		for(i = 0, c = 0; i < n; i++){
			for(j = 0; j < m; j++){
				if(a[i][j] != 0){
					func(a, n, m, i, j, a[i][j]);
					c++;
				}
			}
		}
		printf("%d\n", c);
		
		for(i = 0; i < n; i++){
			free(a[i]);
		}
		free(a);
	}
	
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define REP(i, n) for(int i=0; i<(int)(n); i++)
#define REP1(i,a,b) for(int i=a; i<=(int)(b); i++)
#define ALL(x) begin(x),end(x)
#define PB push_back
using namespace std;
typedef int64_t LL;
typedef vector<int> VI;
typedef pair<int,int> PII;

template<class T> inline bool chmax( T &a, const T &b ) { return b>a ? a=b,true : false; }
template<class T> inline bool chmin( T &a, const T &b ) { return b<a ? a=b,true : false; }
template<class T> using MaxHeap = priority_queue<T>;
template<class T> using MinHeap = priority_queue<T, vector<T>, greater<T>>;
template<class T, class F=less<T>> void sort_uniq( vector<T> &v, F f=F() ) {
    sort(begin(v),end(v),f);
    v.resize(unique(begin(v),end(v))-begin(v));
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int x,y;
    cin >> x >> y;
    bool f=false;
    for ( int a=0; a<=x; a++ ) {
        int b=x-a;
        if ( 2*a+4*b==y ) {
            f=true;
            break;
        }
    }
    if ( f ) cout << "Yes" << '\n';
    else cout << "No" << '\n';
    return 0;
}

Measured memory_bytes: 3548
from heapq import heappush, heappop

N, M = map(int, input().split())
*A, = map(int, input().split())
q = []
for i in A:
    heappush(q, -i)

for _ in range(M):
    a = -heappop(q)
    heappush(q, -(a//2))
print(-sum(q))

Measured memory_bytes: 67096
import java.util.ArrayList;
import java.util.Scanner;




class Main{


	static	ArrayList<Integer> one ;
	static	ArrayList<Integer> two ;
	static	ArrayList<Integer> three ;
	static	ArrayList<Integer> four ;

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);			//文字の入力
		String a = sc.next();
		String b = sc.next();

		if(a.length() > b.length()){
			System.out.println("GREATER");
		}else if(a.length() < b.length()){
			System.out.println("LESS");

		}else{
			for(int i = 0;i < a.length();i++){
				if(Character.getNumericValue(a.charAt(i)) > Character.getNumericValue(b.charAt(i))){
					System.out.println("GREATER");
					return;

				}else if(Character.getNumericValue(a.charAt(i)) < Character.getNumericValue(b.charAt(i))){
					System.out.println("LESS");
					return;

				}
				
			}
			
			System.out.println("EQUAL");

		}

	}

}

class Pair implements Comparable{
	Character from;
	int end;
	@Override
	public int compareTo(Object other) {
		Pair otherpair = (Pair)other;

		return end - otherpair.end;
	}
}




Measured memory_bytes: 21844
import java.util.Scanner;

class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

			for(int i=1;;i++){
				int n = scan.nextInt();
				if(n != 0)
					System.out.println("Case " + i + ": " + n);
				else if(n == 0){
					scan.close();
					break;
				}
			}
	}
}

Measured memory_bytes: 31328
#include <bits/stdc++.h>
#define pb push_back

using namespace std;
using ll = long long int;
const int MOD = 1e9 + 7;
ll C[2001][2001];

void solve()
{
	int n, k; cin >> n >> k;
	for (int i = 0; i < 2001; ++i) C[0][i] = 0;
	for (int i = 0; i < 2001; ++i) C[i][0] = 1;
	for (int i = 1; i < 2001; ++i)
		for (int j = 1; j < 2001; ++j)
			C[i][j] = (C[i-1][j-1] + C[i-1][j]) % MOD;
	for (int i = 1; i <= k; ++i) cout << (C[k-1][i-1] * C[n-k+1][i] ) %MOD << ' ';
	
}

//  ---------------------Template---------------------------
void InputSetup()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	#ifdef LOCAL
	freopen("in", "r", stdin);
	freopen("out", "w", stdout);
	#endif
}

int main(void)
{
	auto start = chrono::high_resolution_clock::now();

	InputSetup();
	solve();

	auto finish = chrono::high_resolution_clock::now();
	cerr << "Time elapsed: " << (chrono::duration<long double>(finish-start)).count() << "s\n";
}
//  ---------------------Template---------------------------

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

int main(){
  int N;
  cin >> N;
  vector<int> stairs(N);
  
  for(int n=0; n<N; n++){
   cin >> stairs.at(n);
  }
  int maximum=stairs.at(0);
  bool Noflag=false;
  for(int s: stairs){
    if (maximum-1>s){
      cout << "No" << endl;
      Noflag=true;
      break;
    }else{
      maximum = max(s,maximum);
    }
  }
  if(!Noflag){
    cout << "Yes" << endl;
  }
}

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

int main() {
    int n, k;
    cin >> n >> k;
    vector<int> l(n);
    for (int i=0; i<n; ++i) cin >> l[i];
    sort(l.begin(), l.end(), greater<int>());
    int ans = 0;
    for (int i=0; i<k; ++i) ans += l[i];
    cout << ans << endl;
}

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

using namespace std;

using VI = vector<int>;
using VVI = vector<VI>;
using VB = vector<bool>;
using VVB = vector<VB>;
using VD = vector<double>;
using VVD = vector<VD>;
using VS = vector<string>;
using PII = pair<int, int>;
using VPII = vector<PII>;
using VL = vector<long long>;
using VVL = vector<VL>;

#define sz(var) (int)var.size()
#define REP(var, start, end) for(int var = start; var < (int)end; ++var)
#define CLEAR(var, with) memset(var, with, sizeof(var))
#define ALL(x) x.begin(), x.end()
#define LL long long
#define ULL unsigned long long
#define TIME cout << "Time elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms" << endl;

const int MOD = (int)1e9 + 7, MAXN = (int)1e5 + 10;
int n;
VI A;

int mul(int a, int b) {
	return (1ll * a * b) % MOD;
}

int sub(int a, int b) {
	a -= b;
	return a < 0 ? a + MOD : a;
}

int exp(int b, int e)
{
	int ret = 1;
	while(e > 0)
	{
		if(e & 1)
			ret = mul(ret, b);
		b = mul(b, b); e /= 2;		
	}
	return ret;
}

int modinv(int v) {
	return exp(v, MOD - 2);
}


int fact[MAXN], finv[MAXN];
void precalc()
{
	fact[0] = fact[1] = 1;
	finv[0] = finv[1] = 1;
	for(LL i = 2; i < MAXN; ++i) {
		fact[i] = mul(fact[i - 1], i);
		finv[i] = modinv(fact[i]);
	}
}

int comb(int n, int r)
{
	if(n < r) return 0;
	return mul(fact[n], mul(finv[r], finv[n - r]));
}

void solve()
{
	precalc();

	int dist;
	VI pos(MAXN + 1, -1);
	for(int i = 0; i < n + 1; ++i) {
		if(pos[A[i]] != -1) {
			dist = i - pos[A[i]];
			break;
		}
		pos[A[i]] = i;
	}
	
	for(int len = 1; len <= n + 1; ++len) {
		int whole = comb(n + 1, len), remain = comb(n - dist, len - 1);
		cout << sub(whole, remain) << '\n';
	}
	cout << flush;
}

int main()
{
	ios_base::sync_with_stdio(false);
	cout.tie(0);
	cin.tie(0);
#ifndef ONLINE_JUDGE
	//freopen("tmp.in", "r", stdin);
//	freopen("tmp.out", "w", stderr);
#endif
    cin >> n;

	A = VI(n + 1, 0);
	REP(i, 0, n + 1) cin >> A[i];

	solve(); 

	return 0;
}

Measured memory_bytes: 2816
//=======================================================
// Contents    : AOJ ITP1_3_C
//               ２つの整数 x , y を読み込み、値が小さい順に出力
// Constraints : 0 ≤ x ≤ 10,000 、 0 ≤ y ≤ 10,000
//               データセットの数は3000以下
// Author      : 廣部智也
// LastUpdate  :
// Since       : 2020/05/23
//=======================================================

#include <stdio.h>

int main(){
    
    int i = 0, j = 0, tmp = 0;
    int x[3000] = {}, y[3000] = {};
    
    // データの入力
    while( i < 3000 ){
        
        scanf("%d %d", &x[i] , &y[i] );
        
        if( x[i] < 0 || x[i] > 10000 || y[i] < 0 || y[i] > 10000 ){
            return 0;
        }
        
        // x = 0 かつ y = 0 で入力終了
        if( x[i] == 0 && y[i] == 0 ){
            break;
        }
        
        i++;
    }
    
    // データの入力が1つも無い場合、ここで終了
    if( i == 0){
        return 0;
    }
    
    // データの出力
    for( j = 0 ; j < i ; j++ ){
        
        // データの処理：小さい順に並び替え
        if( y[j] < x[j] ){
            tmp  = y[j];
            y[j] = x[j];
            x[j] = tmp;
        }
        
        printf("%d %d\n", x[j] , y[j] );
    }
    
    return 0;
}


Measured memory_bytes: 2024
#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
int a[maxn];
int main() {
	int n;
	cin >> n;
	for (int i = 1; i <= n; i++) {
		cin >> a[i];
	}
	int ans = 0;
	for (int i = 2; i <= n - 1; i++) {
		int mx = max(a[i], max(a[i - 1], a[i + 1]));
		int mm = min(a[i], min(a[i - 1], a[i + 1]));
		if (a[i] != mm && a[i] != mx) ans++;
	}
	cout << ans << endl;
	return 0; 
}

Measured memory_bytes: 256
float q;
A,B,C,D,E,F,R;
M(a,b,c,d,e,f){
	e=c-a;
	f=d-b;
	q=fabs(-f*a+e*b)/hypot(e,f);
	return a*e+b*f<0&c*e+d*f>0&q<=R?q<R?2:1:0;
}
I(){
	q=E*B-F*A;
	return(C*F-D*E)*q>0&q*(A*D-B*C)>0;
}
main(v,w,o,c){
	for(;scanf("%d%d%d%d%d%d%d%d%d",&A,&B,&C,&D,&E,&F,&v,&w,&R),A;){
		A-=v,B-=w;
		C-=v,D-=w;
		E-=v,F-=w;
		o=(A*A+B*B>R*R)+(C*C+D*D>R*R)+(E*E+F*F>R*R);
		c=M(C,D,E,F)|M(E,F,A,B)|M(A,B,C,D);
		if(o){
			if(o-3){
				puts("c");
			}else{
				if(c&2)
					puts("c");
				else{
					if(I())
						puts("a");
					else{
						if(c&1){
							puts("c");
						}else{
							puts("d");
						}
					}
				}
			}
		}else{
			puts("b");
		}
	}
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
 
#define FLASH ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define ll long long int
#define MAX 1e9
#define MIN -1e9
#define mod 1000000007
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define debug(x) cerr<<#x<<'='<<(x)<<endl;
#define mxn 1000041
using namespace std;
 
ll mp[mxn];
int main()
{
    FLASH
    ll n;
    cin >> n;
    ll a[n];
    for(int i = 0; i < n; i++)
        cin >> a[i],mp[a[i]]++;
    ll cnt = n;
    if(mp[1] == 1)
    {
        cout << "1";
        return 0;
    }
    else if(mp[1] >= 2)
    {
        cout << "0";
        return 0;
    }
    for(int i = 0; i < n; i++)
    {
        ll x = a[i];
        if(mp[a[i]] >= 2)
        {
            cnt--;
            continue;
        }
        for(int j = 2; j * j <= x; j++)
        {
            if(x % j == 0)
            {
                if(mp[j] >= 1 || mp[x / j] >= 1)
                {
                    cnt--;
                    break;
                }
            }
        }
    }
    cout << cnt << '\n' ;
    return 0;
}

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

S = []
P = []

test_list = []

for i in range(N):
    x, y = map(str, input().split())
    test = []
    test.append(x)
    test.append(int(y))
    test.append(i + 1)
    test_list.append(test)

test_list.sort(key=lambda x: (x[0], -x[1]))

for i in test_list:
    print(i[2])


Measured memory_bytes: 3060
#include <iostream>
#include <string.h>

using namespace std;
typedef long long int ll;

int main(){

    int N;
    cin >> N;
    string name[N];
    int64_t q[5];
    memset(q, 0, sizeof(q));
    for(int i=0; i<N; i++){
        cin >> name[i];
        char first = name[i][0];
        if(first == 'M'){
            q[0] ++;
        }else if(first == 'A'){
            q[1] ++;
        }else if(first == 'R'){
            q[2] ++;
        }else if(first == 'C'){
            q[3] ++;
        }else if(first == 'H'){
            q[4] ++;
        }
    }

    int64_t total = 0;
    total = q[0] * q[1] * q[2] + q[0] * q[1] * q[3] + q[0] * q[1] * q[4] + q[0] * q[2] * q[3] + q[0] * q[2] * q[4] + q[0] * q[3] * q[4] + q[1] * q[2] * q[3] + q[1] * q[2] * q[4] + q[1] * q[3] * q[4] + q[2] * q[3] * q[4];
    

    cout << total << endl;

    return 0;
}

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

int	main() {
	/*
	for (int i=105; i<200; i +=2) {
		cout << i << ':';
		for (int j=1; j<=i/3;j++) {
			if (0==i%j) cout <<j <<' ';
		}
		cout << endl;
	}
	// 105, 135, 165, 189, 195
	*/
	int N;
	cin >>N;
	if (105>N) cout <<0;
	else if (135>N) cout <<1;
	else if (165>N) cout <<2;
	else if (189>N) cout <<3;
	else if (195>N) cout <<4;
	else cout <<5;
	cout <<endl;
	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define PI 3.14159265358979323846264338327
#define NUM 1000000007
#define ss second
#define ff first
using namespace std;
int main(){
	ios::sync_with_stdio(0);	
	int a, b;
	cin >> a >> b;
	if (a >= 13)
		cout << b <<"\n";
	else if (a >= 6)
		cout << b / 2 << "\n";
	else cout << "0\n";
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define db long double
#define fi first
#define se second
#define  pb push_back
#define  pob pop_back
#define W while
#define fn(i,x) for(int i=0;i<x;i++)
#define fs(i,s,x) for(int i=s;i<x;i++)
#define fr(i,x) for(int i=x;i>=0;i--)
#define fit(it,s) for(auto it=s.begin();it!=s.end();it++)
#define mp make_pair
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vii vector<int>
#define vll vector<ll>
#define mod 1000000007
#define MAX 1005
using namespace std;
int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);

    // freopen("in.txt","r",stdin);
    // freopen("out.txt","w",stdout);
    
    string g;
    cin >> g;
    ll rem = 15 - g.size();
    ll w = 0;
    fn(i,g.size()) if(g[i]=='o') w++;
    if(rem + w >= 8) cout << "YES";
    else cout << "NO";

    return 0;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#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
#define sz(x) ((int)(x).size())
using ll=long long;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define MOD  1000000007
const ll INF=1e18;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b){ a = b; return 1; } return 0; }



int main(int argc, char const *argv[]) {
  ll n,k;
  cin >> n >> k;
  vector<ll> a(n);
  rep(i,n){
    ll p; cin >> p; p--;
    a[i]=p;
  }

  vector<ll> s(n+1);//累積和
  rep(i,n) s[i+1]=(s[i]+a[i])%k;
  ll ans=0;
  map<ll,ll> mp;//頻度
  queue<ll> q;
  rep(j,n+1){
    ans+=mp[s[j]];
    mp[s[j]]++;
    q.push(s[j]);
    if(sz(q)==k){
      mp[q.front()]--;
      q.pop();
    }
  }
  //rep(i,n+1) cout << s[i] << endl;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 17536
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cstring>
#include <bitset>
#include <cmath>
#include <string>
#include <stdlib.h>

#define ll long long
#define repp(i,a,b) for(int i=(int)a;i<(int)b;++i)

using namespace std;
template<typename A, size_t N, typename T>
void Fill(A(&array)[N],const T&val){std::fill((T*)array,(T*)(array+N),val);}


int main() {
    int N, M; cin >> N >> M;
    vector<long long> A(M);
    vector<vector<int>> C(M);
    repp(i,0,M) {
        int b; cin >> A[i] >> b;
        repp(j,0,b) {
            int c; cin >> c;
            C[i].push_back(c);
        }
    }

    const long long INF = 1LL << 32;
    
    long long dp[1010][1<<12];
    Fill(dp, INF);
    dp[0][0] = 0;
    
    repp(i,0,M) {
        int bit = 0;
        repp(j,0,(int)C[i].size()) bit |= (1<<(C[i][j]-1));
        repp(j,0,1<<N) dp[i+1][j] = min(dp[i+1][j], dp[i][j]);
        repp(j,0,1<<N) dp[i+1][bit|j] = min(dp[i+1][bit|j], dp[i][j] + A[i]);
        
    }

    long long result = dp[M][(1<<N)-1] == INF ? -1:dp[M][(1<<N)-1];
    cout << result << endl;
}


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

int main() {
	int high[10];
	for (int i = 0; i < 10; i++)
		cin >> high[i];
	int max = high[0];
	sort(high, high + 10);
	for (int i = 9; i > 6; i--)
		cout << high[i] << endl;
	return 0;
}


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

int  main()
{
	string s;
	cin >> s;
	string pld = string(s.rbegin(), s.rend());
	int len = s.size() - 1;
	int cnt = 0;
	rep(i, s.size() / 2 )
	{
		if (s[i] != s[len - i])
		{
			s[i] = s[len - i];
			cnt++;
		}
	}
	cout << cnt;
	return (0);
}

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

int main(){
    int N;
    int res = 0;
    string S;

    cin >> N;
    cin >> S;

    for(int i=0;i<N;i++){
        if(i < N-1 && S[i] == 'A' && S[i+1] == 'B' && S[i+2] == 'C'){
            res++;
        }
    }
    cout << res;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
// define
#define int long long
#define UNIQUE(v) v.erase(unique(all(v)), v.end());
#define ZIP(v) sort(all(v)),UNIQUE(v)
#define ADD(a, b) a = (a + b) % mod
#define SUB(a, b) a = (a+mod-b)%mod
#define MUL(a, b) a = (((a)%mod) * ((b)%mod)) % mod
#define rollcall cout << "I'm Sucu." << endl;
#define repi(i,m,n) for(int i = m;i < n;i++)
#define drep(i,n,m) for(int i = n;i >= m;i--)
#define rep(i,n) repi(i,0,n)
#define rrep(i,n) repi(i,1,n+1)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(), v.rend()
#define dmp(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define pf(x) push_front(x)
#define fi first
#define se second
// debug
template <typename T, typename U>
ostream &operator<<(ostream &os, const pair<T, U> &p){
  os << "(" << p.first << "," << p.second << ")";return os;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v){
  for (auto it = v.begin();it != v.end();++it){
    if(it != v.begin())os << " ";os << *it;
      }return os;
}
template <typename T, typename U>
ostream &operator<<(ostream &os, const map<T, U> &mp){
  for(auto x: mp)os << "(" << x.first << "," << x.second << ")" << endl;
  return os;
}
template<typename T, int SIZE>
int array_length(const T (&)[SIZE]){return SIZE;}
template<typename T, int N>
void PRINTF(const T (&a)[N], int s = N, int t = -1, bool f = true){
	if(t == -1){rep(i,s){if(i)cout << " ";cout << a[i];}}
	else repi(i,s,t){if(i!=s)cout << " ";cout << a[i];}
	if(f)cout << "\n";
}
template<typename T, int N1, int N2>
void PRINTF(const T (&a)[N1][N2], int h = N1, int w = N2){
	rep(i,h){rep(j,w){cout << a[i][j] << " \n"[j==w-1];}}
}
string substr(const string &str, int S1, int S2 = -1){
  if(S2 == -1)return str.substr(S1);
  return str.substr(S1, S2-S1);
}
// typedef
typedef complex<double> Point;
typedef pair<int, int> P;
typedef pair<int, P> PP;
typedef pair<P, int> Pi;
typedef vector<int> vi;
typedef deque<int> dq;
const int inf = 1e9+7;
const int INF = 1e18+7;


int a[1000][1000], k[1000];
signed main(){
  int n, m;
  scanf("%lld%lld",&n, &m);
  rep(i,n){
    scanf("%lld", &k[i]);
    rep(j,k[i])scanf("%lld", &a[i][j]);
  }
  int ans = 0;
  rep(l,m){
    int food = l+1, cnt = 0;
    rep(i,n){
      rep(j,k[i])if(a[i][j] == food)cnt++;
    }
    if(cnt == n)ans++;
  }
  cout << ans << endl;
  return 0;
}








Measured memory_bytes: 384
#include <bits/stdc++.h>
long long d[1000000],l[1000000];
using namespace std;
int main(){
	long long n,x,res=0;
	cin>>n>>x;
	d[1]=0;
	res=1;
	for (int i=1;i<=n;i++) cin>>l[i];
	for (int i=2;i<=n+1;i++){
		d[i]=d[i-1]+l[i-1];
		if (d[i]<=x) res++;
	}
	cout<<res;
	return 0;
}

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

int main() {
    long long D, G;
    cin >> D >> G;
    vector<long long> P(D);
    vector<long long> C(D);
    for (int i = 0; i < D; i++) {
        cin >> P[i] >> C[i];
    }
    
    long long ans = 1000;
    for (int bit = 0; bit < (1 << D); bit++) {
        vector<int> S;
        vector<int> T;
        for (int i = 0; i < D; i++) {
            if (bit & (1 << i)) S.push_back(i);
            else T.push_back(i);
        }
      
        long long sum = 0;
        long long cnt = 0;
        for (int i = 0; i < S.size(); i++) {
            sum += (S[i] + 1) * 100 * P[S[i]] + C[S[i]];
            cnt += P[S[i]];
        }

        for (int i = T.size() - 1; i >= 0; i--) {
            if (sum >= G) break;
            for (int j = 1; sum < G && j < P[T[i]]; j++) {
                sum += (T[i] + 1) * 100;
                cnt++;
            }
        }
      
        if (sum >= G) ans = min(ans, cnt);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
x,y = map(int, input().split())

if x <= y:
    if abs(x) <= abs(y):
        ans = min(y-x, y-(-x)+1)
    else:
        ans = min(y-x, 1+abs(-y-x))
else:
    ans = abs(abs(x)-abs(y))+1
    if x*y > 0: ans += 1
print(ans)

Measured memory_bytes: 9196
def gcd(a, b):
    while b > 0:
        a, b = b, a%b
    return a

while True:
    try:
        a,b = map(int, raw_input().split())
        c = gcd(a, b)
        print "{0} {1}".format(c, a*b/c)
    except:
        break

Measured memory_bytes: 4220
#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
using namespace std;
int main() {
  
  int N;
  cin>>N;
  
  for(int i=100000;i>=0;i--){
    if((long long)i*i<=N){
      cout<<i*i<<endl;
      return 0;
    }
  }
}

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

namespace
{
const int MAX_N	= 100000;
bool bC[ 31 ][ MAX_N + 5 ];
}

int main( int argc, char *argv[] )
{
int i;
int j;
int N;
int C;
int s;
int t;
int c;
int iMax;
int iCnt;

	ios::sync_with_stdio( false );
	cin.tie( 0 );

	cin >> N;
	cin >> C;
	for( i = 1; i <= N; i++ )
	{
		cin >> s;
		cin >> t;
		cin >> c;
		for( j = s - 1; j < t; j++ )
			bC[ c ][ j ] = true;
	}

	iMax = 0;
	for( j = 1; j <= MAX_N; j++ )
	{
		iCnt = 0;
		for( i = 1; i <= C; i++ )
		{
			if( bC[ i ][ j ] ) iCnt++;
		}

		if( iMax < iCnt ) iMax = iCnt;
	}

	cout << iMax << endl;

	return 0;
}



Measured memory_bytes: 3200
n = int(input())
a =[]
b = []
for i in range(n):
    l= list(map(int,input().split()))
    a += [l[0]]
    b += [l[1]]

a = sorted(a)
b = sorted(b, reverse=True)

if n % 2 == 0:
    k = n//2 -1
    
    aa = (a[k] + a[k +1]) /2
    bb= (b[k] + b[k + 1]) /2
    
    r = (bb-aa) * 2 + 1
    
else:
    k = n//2
    
    aa = a[k]
    bb= b[k]
    
    r = (bb-aa)  + 1
    

print(int(r))

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

int main() {
  int K;
  cin >> K;
  int cnt = 0, now = 0;
  auto start = system_clock::now();
  while (++cnt) {
    now = (now * 10 + 7) % K;
    if (now == 0) return cout << cnt << "\n", 0;
    if (static_cast<double>(duration_cast<milliseconds>(system_clock::now() - start).count() / 1000.0) > 1.99) {
      return cout << -1 << "\n", 0;
    }
  }
}

Measured memory_bytes: 3600
#include <stdio.h>
#define MAX 100000

struct Node{
  int parent,left,right;
};

struct Node T[MAX];
int dep[MAX],h[MAX];

void SetDepth(int u,int d){
  if(u==-1)return;
  dep[u]=d;
  SetDepth(T[u].left,d+1);
  SetDepth(T[u].right,d+1);
}

int SetHeight(int u){
  int h1=0,h2=0;
  if(T[u].left!=-1)h1=SetHeight(T[u].left)+1;
  if(T[u].right!=-1)h2=SetHeight(T[u].right)+1;
  if(h1>h2)return h[u]=h1;
  else return h[u]=h2;
}

int GetSibling(int u){
  if(T[u].parent==-1)return -1;
  if(T[T[u].parent].left!=u && T[T[u].parent].left!=-1)return T[T[u].parent].left;
  if(T[T[u].parent].right!=u && T[T[u].parent].right!=-1)return T[T[u].parent].right;
  return -1;
}

int main(){
  int i,n,id,l,r,root,deg;
  scanf("%d",&n);
  for(i=0;i<n;i++)T[i].parent=-1;

  for(i=0;i<n;i++){
    scanf("%d",&id);
    scanf("%d",&l);
    scanf("%d",&r);
    T[id].left=l;
    T[id].right=r;
    if(l!=-1)T[l].parent=id;
    if(r!=-1)T[r].parent=id;
  }

  for(i=0;i<n;i++){
    if(T[i].parent==-1)root=i;
  }

  SetDepth(root,0);
  SetHeight(root);

  for(i=0;i<n;i++){
    deg=0;
    printf("node %d: ",i);
    printf("parent = %d, ",T[i].parent);
    printf("sibling = %d, ",GetSibling(i));
    if(T[i].left!=-1)deg++;
    if(T[i].right!=-1)deg++;
    printf("degree = %d, ",deg);
    printf("depth = %d, ",dep[i]);
    printf("height = %d, ",h[i]);

    if(T[i].parent==-1)printf("root\n");
    else if(T[i].left==-1 && T[i].right==-1)printf("leaf\n");
    else printf("internal node\n");
  }
  return 0;
}
      
  



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

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

sys.setrecursionlimit(1000000)

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

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

if N <= 10:
    print 0
    sys.stdout.flush()
    for _ in range(K):
        for j in range(1, N + 1):
            print j
            sys.stdout.flush()
            if raw_input() == "Yes":
                break
    exit()

E = []
for i in range(8):
    E += [(1, i + 2)]

for v in range(10, N + 1):
    num = v - 10
    for i in range(8):
        if num & (1 << i):
            E += [(v, i + 2)]

print len(E)
for u, v in E:
    print u, v

for _ in range(K):
    print 1
    sys.stdout.flush()
    S = raw_input()
    if S == "Yes":
        continue
    if S == "Near":
        for i in range(2, 10):
            print i
            sys.stdout.flush()
            if raw_input() == "Yes":
                break
        continue
    ans = 10
    for i in range(2, 10):
        print i
        sys.stdout.flush()
        if raw_input() == "Near":
            ans += (1 << (i - 2))
    print ans
    sys.stdout.flush()
    S = raw_input()


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

int main() {

	int n,q,k,x; cin>>n>>k>>q;
	int a[n]; 
	for(int i=0;i<n;i++) { a[i]=k-q; }
	for(int i=0;i<q;i++) {
		cin>>x; a[x-1]++;
	}
	for(int i=0;i<n;i++) {
		if(a[i]>0) cout<<"Yes"<<endl;
		else cout<<"No"<<endl;
	}
	
	return 0;
}

Measured memory_bytes: 1024
// Template from https://techracho.bpsinc.jp/jhonda/2019_08_05/78537

// input macro for competive-programming from https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

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

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

#[allow(unused_macros)]
macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

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

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

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

    ($iter:expr, bytes) => {
        read_value!($iter, String).into_bytes()
    };

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

fn main() {
    use std::io::Read;
    let mut s = String::new();
    std::io::stdin().read_to_string(&mut s).unwrap();

    println!("{}", solve(&s));
}

macro_rules! test {
    ($($input:expr => $output:expr),* $(,)*) => {
        #[test]
        fn solve_test() {
            $(
                assert_eq!(solve($input), $output);
            )*
        }
    };
}

test! {
r#"22"# => r#"Christmas Eve Eve Eve"#,
r#"23"# => r#"Christmas Eve Eve"#,
r#"24"# => r#"Christmas Eve"#,
r#"25"# => r#"Christmas"#,
}

fn solve(src: &str) -> String {
    input! {
        source = src,
        d: isize,
    }

    let mut ans = "".to_string();

    if d <= 25 {
        ans.push_str("Christmas");
    }

    if d <= 24 {
        ans.push_str(" Eve");
    }

    if d <= 23 {
        ans.push_str(" Eve");
    }

    if d <= 22 {
        ans.push_str(" Eve");
    }

    ans
}

Measured memory_bytes: 4352
while True:
    a, op, b = list(map(str, input().split()))
    if(op == '?'):
        break
    elif (op == '+'):
        print(int(a) + int(b))
    elif (op == '-'):
        print(int(a) - int(b))
    elif (op == '*'):
        print(int(a) * int(b))
    else:
        print(int(a) // int(b))


Measured memory_bytes: 5596
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define REP(i, n) rep(i, 0, n)
#define int long long
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e18;

signed main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	int h, n;
	cin >> h >> n;
	vector<int> a(n);
	rep(i, 0, n) cin >> a[i];
	int sum = 0;
	rep(i, 0, n) sum += a[i];
	if(sum >= h) cout << "Yes" << endl;
	else cout << "No" << endl;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define vl vector<ll>
#define pl pair<ll,ll>
#define TC int t;cin>>t;while(t--)
#define in(n) ll n;cin>>n;
#define inarr(n) ll n;cin>>n;vector<ll>arr;
int main(void){
    ios_base::sync_with_stdio(false);cin.tie(NULL);
    in(a);in(b);in(c);
    // a->red;b->green;c->blue
    in(k);
    string ans="No";
    for(int i=0;i<=k;i++){
        for(int j=0;j<=k;j++){
            for(int l=0;l<=k;l++){
                ll x= a* (1<<i);
                ll y= b* (1<<j);
                ll z= c* (1<<l);
                if(i+j+l<=k && x<y && y<z) ans="Yes";
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3612
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <cassert>
#include <bitset>

//#include <boost/multiprecision/cpp_int.hpp>
//using namespace boost::multiprecision;

//std::cout << std::fixed << std::setprecision(10)
//std::ios::sync_with_stdio(false);
constexpr long long MOD = 1000000007;

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

int main()
{
  int N;
  std::cin >> N;
  bool ans = true;
  while(N--)
  {
    int a;
    std::cin >> a;
    ans &= (a%2 ? true : (a%3==0 || a%5==0));
  }
  std::cout << (ans ? "APPROVED" : "DENIED") << std::endl;
  return 0;
}



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

int main() {
    int n;
    scanf("%d", &n);
    vector<int> a(n);
    vector<int> b(n-1);
    rep(i, n-1) {
        scanf("%d", &b[i]);
    }
    int sum = 0;
    rep(i, n-1) {
        if (i == 0) continue;
        a[i] = min(b[i-1], b[i]);
        sum += a[i];
    }
    if (n != 2) {
        a[0] = b[0];
        a[n-1] = b[n-2];
        sum += a[0] + a[n-1];
    } else {
        sum = 2 * b[0];
    }
    // rep(i, n) {
    //     printf("%d", a[i]);
    //     if (n != n-1) printf(" ");
    //     else printf("\n");
    // }
    printf("%d\n", sum);
}

Measured memory_bytes: 3708
/*
  GOOD is not Enough
  You've got to be GREAT.
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
// #include<boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision;
using namespace __gnu_pbds;
using namespace std;
#define int long long
#define mod 1000000007
#define FAST ios: :sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define f(i,n) for(int i=0;i<n;i++)
#define fp(i,k,n) for(int i=k;i<=n;i++)
#define fr(i,k,n) for(int i=k;i>=n;i--)
#define pb push_back
#define F first
#define S second
#define all(a) a.begin(),a.end()
typedef tree<int,null_type,less_equal<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;


void solve()
{ 
  int k;
  cin >> k;
  int sum=0;
  fp(i,1,k)
  {
      fp(j,1,k)
      {
          fp(l,1,k)
          {
              sum+=__gcd(i,__gcd(j,l));
          }
      }
  }
 cout << sum << '\n';
 return;
}

signed main()
{
  int T=1;
//   cin >> T;
  while(T--)
  {
    solve();
	}
  return 0;
}

Measured memory_bytes: 3624
import sys
stdin = sys.stdin
 
ri = lambda: int(rs())
rl = lambda: list(map(int, stdin.readline().split()))
rs = lambda: stdin.readline().rstrip()  # ignore trailing spaces

S = rs()
cnt = [S.count('a'), S.count('b'), S.count('c')]
bool = min(cnt) >= max(cnt) - 1
print('YES' if bool else 'NO')

Measured memory_bytes: 3188
a = [1, 3, 5, 7, 8, 10, 12]
b = [4, 6, 9, 11]
c = [2]

i, j = map(int, input().split())

l = [a, b, c]
for d in l:
  if i in d:
    if j in d:
      print("Yes")
      quit()
    else:
      print("No")
      quit()

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

int main() {
  int A, B;
  cin >> A >> B;
  int x=A;
  int counter=0;
  
  for ( int i=0; i < B-A+1; i++) {
    int y = x%100;
      if ( x/1000 == y%10*10+y/10) {
        counter++;}
    x++;
  }
  cout << counter << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int h = sc.nextInt();
		int w = sc.nextInt();
		
		int[][] a = new int[h][w];
		for(int i = 0; i < h; i++) {
			for(int j = 0; j < w; j++) {
				a[i][j] = sc.nextInt();
			}
		}
		
		int[][][] dp = new int[h][w][h * w];
		for(int i = 0; i < h; i++) {
			for(int j = 0; j < w; j++) {
				for(int k = 0; k < h * w; k++) {
					dp[i][j][k] = 100000000;
				}
			}
		}
		dp[0][0][0] = 0;
		
		int[] dx = {1, -1, 0, 0};
		int[] dy = {0, 0, 1, -1};
		for(int k = 0; k < h * w - 1; k++) {
			for(int i = 0; i < h; i++) {
				for(int j = 0; j < w; j++) {
					for(int v = 0; v < 4; v++) {
						int x = i + dx[v];
						int y = j + dy[v];
						if(x >= 0 && x < h && y >= 0 && y < w) {
							dp[x][y][k + 1] = Math.min(dp[x][y][k + 1], dp[i][j][k] + (2 * k + 1) * a[x][y]);
						}
					}
				}
			}
		}
		
		int ans = Integer.MAX_VALUE;
		for(int k = 0; k < h * w; k++) {
			ans = Math.min(ans, dp[h - 1][w - 1][k]);
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 34916
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef double ld;
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define gsort(arr) sort(arr, arr+n, greater<ll>()); 
#define sync ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define sync2 cout<<fixed<<setprecision(10)
const ll inf=1e9+7;
const ll inf2=inf*inf;
#define pi 3.14159265358979323846
#define for0(i,n) for (int i = 0; i <(int)n; i++)
#define for1(i,n) for (int i = 1; i<=(int)n; i++)
#define all(vv) vv.begin(),vv.end()
priority_queue <ll, vector<ll>, greater<ll>> mnheap;
priority_queue <ll> mxheap;
#define vc(vv) vector<ll> vv;
ll gcd(ll x,ll y){if (x == 0)return y;return gcd(y%x, x);}
int is_prime(ll x) {if(x<2)return 0;for(ll i=2;i*i<=x;i++){if(x%i==0)return 0;}return 1;}
inline ll modpw(ll x, ll y, ll z) {ll res=1;x=x%z;while(y){if(y&1) res=(res*x)%z;x=(x*x)%z;y/=2;}return res;}
inline ll modinv(ll x,ll z){return modpw(x,z-2,z);}
ll lcm(ll x,ll y){return (x*y)/gcd(x,y);}
#define pYES cout<<"YES"<<endl
#define pNO cout<<"NO"<<endl

ll dp[3005][3005];
int main()
{
     sync;
     int t;
     //cin>>t;
     t=1;
     while(t--)
     {
          string a,b;
          cin>>a>>b;
          int n=a.length(),m=b.length();
          for(int i=1;i<=n;i++)
          {
               for(int j=1;j<=m;j++)
               {
                    if(a[i-1]==b[j-1])
                    {
                         dp[i][j]=dp[i-1][j-1]+1;
                    }
                    else
                    {
                         dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
                    }         
               }
          }
          string ans="";
          if(dp[n][m]==0)
          {
               cout<<ans<<endl;
               continue;
          }
          int i=n,j=m;
          while(i>=1 and j>=1)
          {
               if(a[i-1]==b[j-1])
               {
                    ans+=a[i-1];
                    i=i-1;
                    j=j-1;
               }
               else 
               {
                    if(dp[i-1][j]>dp[i][j-1])
                         i-=1;
                    else
                         j-=1;
               }
          }
          reverse(all(ans));
          cout<<ans<<endl;
     }
}

Measured memory_bytes: 74012
import java.util.*;

public class Main {
	public static void printArray(int[] a) {
		for (int i = 0; i < a.length; i++) {
			System.out.print(a[i] + ", ");
		}
		System.out.println();
	}

	// public static<T> void printArrayT(T[] a) {
	// 	for (int i = 0; i < a.length; i++) {
	// 		System.out.print(a[i] + ", ");
	// 	}
	// 	System.out.println();
	// }

	// public static class Triple implements Comparable<Triple> {
	// 	public int A, B, C;
	// 	Triple(int A, int B, int C) {
	// 		this.A = A;
	// 		this.B = B;
	// 		this.C = C;
	// 	}

	// 	@Override
	// 	public String toString() {
	// 		return String.format("(%d, %d, %d)", A, B, C);
	// 	}

	// 	@Override
	// 	public int compareTo(Triple o) {
	// 		int a = this.A - o.A;
	// 		if (a != 0) return a;
	// 		int b = this.B - o.B;
	// 		if (b != 0) return b;
	// 		return this.C - o.C;
	// 	}
	// }

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int H = sc.nextInt();
		int W = sc.nextInt();
		char[][] map = new char[H][];
		for (int i = 0; i < H; i++) {
			String s = sc.next();
			map[i] = s.toCharArray();
		}
		int[][] LEFT = new int[H][W];
		for (int y = 0; y < H; y++) {
			if (map[y][0] == '.') LEFT[y][0] = 1;
			for (int x = 1; x < W; x++) {
				if (map[y][x] == '.') LEFT[y][x] = LEFT[y][x - 1] + 1;
			}
		}
		int[][] RIGHT = new int[H][W];
		for (int y = 0; y < H; y++) {
			if (map[y][W-1] == '.') RIGHT[y][W-1] = 1;
			for (int x = W-2; x >= 0; x--) {
				if (map[y][x] == '.') RIGHT[y][x] = RIGHT[y][x + 1] + 1;
			}
		}
		int[][] TOP = new int[H][W];
		for (int x = 0; x < W; x++) {
			if (map[0][x] == '.') TOP[0][x] = 1;
			for (int y = 1; y < H; y++) {
				if (map[y][x] == '.') TOP[y][x] = TOP[y - 1][x] + 1;
			}
		}
		int[][] BOTTOM = new int[H][W];
		for (int x = 0; x < W; x++) {
			if (map[H-1][x] == '.') BOTTOM[H-1][x] = 1;
			for (int y = H-2; y >= 0; y--) {
				if (map[y][x] == '.') BOTTOM[y][x] = BOTTOM[y + 1][x] + 1;
			}
		}


		int max = 0;
		for (int y = 0; y < H; y++) {
			for (int x = 0; x < W; x++) {
				if (map[y][x] != '.') continue;
				// int cnt = 1;
				// for (int x2 = x - 1; x2 >= 0; x2--) {
				// 	if (map[y][x2] != '.') break;
				// 	cnt++;
				// }
				// for (int x2 = x + 1; x2 < W; x2++) {
				// 	if (map[y][x2] != '.') break;
				// 	cnt++;
				// }
				// for (int y2 = y - 1; y2 >= 0; y2--) {
				// 	if (map[y2][x] != '.') break;
				// 	cnt++;
				// }
				// for (int y2 = y + 1; y2 < H; y2++) {
				// 	if (map[y2][x] != '.') break;
				// 	cnt++;
				// }
				int sum = LEFT[y][x] + RIGHT[y][x] + TOP[y][x] + BOTTOM[y][x] - 3;
				// assert cnt == sum : "assert";

				max = Math.max(max, sum);
			}
		}
		System.out.println(max);
	}
}


Measured memory_bytes: 110408
#include <bits/stdc++.h>
using namespace std;
 int A[200005],B[200005],dp[100005][1],i,n,sum,say,k,m1,m2,j;
vector<int> v;
int main()
{
	
	
	
	scanf("%d",&n);
	for(i=1;i<=n;i++){
		scanf("%d",&A[i] );
		
	}
	for(i=n;i>=1;i--){
		sum=0;
		for(j=2*i;j<=n;j+=i){
		sum=sum^B[j];
		
		}
		B[i]=A[i]^sum;	
		say+=B[i];
		if(B[i] ){
			v.push_back(i);
		}
		
	}
	printf("%d\n",say);
	for(i=0;i<v.size();i++ ){
		printf("%d ",v[i] );
	}

	
	return 0;
}

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



int main() {
  int n;
  cin>>n;
  vector<int>dp(100010);
  dp.at(0)=0;
  for(int n=1;n<=100000;n++){
    dp.at(n)=1<<30;
    int pow=1;
    while(pow<=n){
      dp[n]=min(dp[n],dp[n-pow]+1);
      pow*=6;
    }
    pow =1;
    while(pow<=n){
      dp[n]=min(dp[n],dp[n-pow]+1);
      pow*=9;
    }
  }
  cout << dp[n];
                
    
}

Measured memory_bytes: 640
fn main() {
    let n = read::<usize>();
    let mut abcde: Vec<usize> = vec![0; 5];
    let mut idx = 0;
    let mut mi = usize::max_value();
    for i in 0..5 {
        let tmp = read::<usize>();
        if mi > tmp {
            mi = tmp;
            idx = i;
        }
    }

    let ret = if n % mi == 0 {
        (n / mi)
    } else {
        (n / mi) + 1
    };
    println!("{}", ret + 4);
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().parse().ok().unwrap()
}


Measured memory_bytes: 4352