akhauriyash/Code-Regression huggingface dataset:
#pragma target("avx")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef unordered_map<ll, ll> U_MAP;
typedef priority_queue<ll> pq;
typedef priority_queue<ll, vector<ll>, greater<ll>> rpq;
const int INF = 1e9, MOD = 1e9 + 7, ohara = 1e6 + 10;
const ll LINF = 1e18;

#define rep(i, n) for (ll(i) = 0; (i) < (int)(n); (i)++)
#define rrep(i, a, b) for (ll i = (a); i < (b); i++)
#define rrrep(i, a, b) for (ll i = (a); i >= (b); i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout << (x) << endl
#define doublecout(a) cout << fixed << setprecision(15) << a << endl;
#define fi first
#define se second
#define m_p make_pair
#define p_b push_back
string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string)s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto& x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

//------ Believe yourself as a genius!!!!!! ------

struct pair_equal {
  bool operator()(const pair<ll, ll>& x, const pair<ll, ll>& y) const {
    return x.se == y.se;
  }
};

int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
// int dy[]={-1,0,1,-1,1,-1,0,1};int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"), s;
ll n, cnt, ans, a[ohara], b, c, d, tmp, m, h, w, x, y, sum, k, q;
pair<pair<ll, ll>, pair<ll, ll>> dp[ohara];

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

  // dp[i]={i, j, index_i, index_j}
  cin >> n;
  ll length = (1LL << n);
  rep(i, length) {
    cin >> a[i];
    dp[i] = m_p(m_p(a[i], 0), m_p(i + 1, -1));
  }

  rep(i, length) {
    rep(j, n) {
      if (i & (1LL << j)) continue;
      vector<P> sorted;
      sorted.p_b({dp[i].fi.fi, dp[i].se.fi});
      sorted.p_b({dp[i].fi.se, dp[i].se.se});
      sorted.p_b({dp[(i | (1LL << j))].fi.fi, dp[(i | (1LL << j))].se.fi});
      sorted.p_b({dp[(i | (1LL << j))].fi.se, dp[(i | (1LL << j))].se.se});
      sort(all(sorted));
      reverse(all(sorted));
      sorted.erase(unique(all(sorted), pair_equal()), sorted.end());
      dp[(i | (1LL << j))] =
          m_p(m_p(sorted[0].fi, sorted[1].fi), m_p(sorted[0].se, sorted[1].se));
    }
  }
  rrep(i, 1, length) {
    ans = max(ans, dp[i].fi.fi + dp[i].fi.se);
    Cout(ans);
  }
  return 0;
}

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

int main(){
	string s;
	cin >> s;
	bool flag = true;
	
	int cnt = 0;
	for(int i=0; i<s.size(); i++){
		if(s[0]!='A') flag = false;
		if(i>=2 && i<=s.size()-2 && s[i]=='C') cnt++;
		if(i!=0 && s[i]!='C' && isupper(s[i])) flag = false;
	}
	
	if(flag && cnt==1) cout << "AC" << endl;
	else cout << "WA" << endl;
	
	
	return 0;
}

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

int N,K;
int S[101];
int B;

int main(){
	while(cin >> N >> K,N != 0){
		for(int i = 0;i < K; i++){
			cin >> S[i];
		}
		for(int i = 0; i < N; i++){
			for(int j = 0; j < K; j++){
				cin >> B;
				S[j] -= B;
			}
		}
		bool f = true;
		for(int i = 0; i < K; i++){
			if(S[i] < 0){
				cout << "No" << endl;
				f = false;
				break;
			}
		}
		if(f){
			cout << "Yes" << endl;
		}
	}

	return 0;
}



Measured memory_bytes: 3104
#pragma GCC target ("avx2")
#pragma GCC optimize ("unroll-loops")
#pragma GCC optimize ("O3")
#include "bits/stdc++.h"
#include <unordered_set>
#include <unordered_map>
#include <random>
using namespace std;
typedef long long ll;
const ll MOD = 1'000'000'007LL; /*998'244'353LL;*/
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int (i)=0; (i)<(n); (i)++)
const int dx[4]={ 1,0,-1,0 };
const int dy[4]={ 0,1,0,-1 };

template<typename T>
T power(T x, long long n, const T &m){
    if(n == 0) return 1;
    if(n == 1) return x;
    T tmp = power(x, n/2, m);
    if(n%2 == 0) return tmp * tmp % m;
    else return tmp * tmp % m * x % m;
}

template<typename T>
T inverse(T x, const T &m){
    return power(x, m-2, m);
}

struct Combination{
private:
    int N;
    long long M;
    vector<long long> f, i;
public:
    void init(int n, long long m){
        N = n; M = m;
        f.resize(N+1); f[0] = 1;
        for(long long j=1; j<=N; j++){
            f[j] = f[j-1] * j % M;
        }
        i.resize(N+1); i[N] = inverse(f[N], M);
        for(long long j=N-1; j>=0; j--){
            i[j] = i[j+1] * (j+1) % M;
        }
    }
    long long fact(int n){
        return f[n];
    }
    long long P(int n, int r){
        return f[n] * i[n-r] % M;
    }
    long long C(int n, int r){
        return f[n] * i[r] % M * i[n-r] % M;
    }
};

int N, M;
Combination C;

signed main(){
    cin >> N >> M;
    C.init(M, MOD);
    ll ans = 0;
    rep(i, N+1){
        if(i%2 == 0) ans += C.C(N, i) * C.P(M, i) % MOD
            * C.P(M-i, N-i) % MOD * C.P(M-i, N-i) % MOD;
        else ans -= C.C(N, i) * C.P(M, i) % MOD
            * C.P(M-i, N-i) % MOD * C.P(M-i, N-i) % MOD;
        ans = (ans + 2*MOD) % MOD;
    }
    cout << ans << endl;
}

Measured memory_bytes: 11040
import sys
sys.setrecursionlimit(10**6)
from math import floor,ceil,sqrt,factorial,log
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from operator import itemgetter
from fractions import gcd
mod = 10 ** 9 + 7
 
#整数input
def ii(): return int(sys.stdin.readline().rstrip()) #int(input())
def mii(): return map(int,sys.stdin.readline().rstrip().split())
def limii(): return list(mii()) #list(map(int,input().split()))
def lin(n:int): return [ii() for _ in range(n)]
def llint(n: int): return [limii() for _ in range(n)]
#文字列input
def ss(): return sys.stdin.readline().rstrip() #input()
def mss(): return sys.stdin.readline().rstrip().split()
def limss(): return list(mss()) #list(input().split())
def lst(n:int): return [ss() for _ in range(n)]
def llstr(n: int): return [limss() for _ in range(n)]

#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？

n=ii()
arr=limii()
b =[]
for i in range(n):
    if arr[i]%2==0:
        b.append(arr[i])
cnt=0
for i in b:
    if i%3==0 or i%5==0:
        cnt+=1

if cnt==len(b):
    print("APPROVED")
else:
    print("DENIED")
    



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

int main(void){
    int n,k,i,cnt;
    cnt = 0;

    cin >> n >> k;

    vector<int> h(n);

    for(i=0; i<n; i++){
        cin >> h.at(i);
    }

    sort(h.begin(),h.end());

    for(i=0; i<n; i++){
        if(h.at(i) < k){
            cnt++;
        }else{
            break;
        }
    }

    cout << n - cnt << endl;

    return 0;
}

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

namespace IO {
    template <typename Tp> inline Tp input() {
        Tp x = 0, y = 1;
        char c = getchar();
        while ((c < '0' || '9' < c) && c != EOF) {
            if (c == '-')
                y = -1;
            c = getchar();
        }
        if (c == EOF)
            return 0;
        while ('0' <= c && c <= '9')
            x = x * 10 + c - '0', c = getchar();
        return x *= y;
    }
    template <typename Tp> inline void read(Tp &x) { x = input<Tp>(); }
}; // namespace IO
using namespace IO;

namespace modular {
    const int MOD = 1000000007;
    inline int add(int x, int y) { return (x += y) >= MOD ? x -= MOD : x; }
    inline void inc(int &x, int y) { (x += y) >= MOD ? x -= MOD : 0; }
    inline int mul(int x, int y) { return 1LL * x * y % MOD; }
    inline int qpow(int x, int y) {
        int ans = 1;
        for (; y; y >>= 1, x = mul(x, x))
            if (y & 1)
                ans = mul(ans, x);
        return ans;
    }
}; // namespace modular

#define reg register
#define MAX_N 1007
#define FIN(s) freopen(s, "r", stdin)
#define FOUT(s) freopen(s, "w", stdout)
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define rep(i, l, r) for (int i = l; i <= r; ++i)
#define lep(i, l, r) for (int i = l; i < r; ++i)
#define irep(i, r, l) for (int i = r; i >= l; --i)
#define ilep(i, r, l) for (int i = r; i > l; --i)
typedef long long ll;

int N, tot, top, bs;
ll d[MAX_N];

struct point {
    ll x, y;
} p[MAX_N];
typedef point P;

void print(ll x, ll y, int k) {
    if (k <= 0)
        return;
    if (y >= 0) {
        if (std::abs(x) <= y)
            putchar('U'), print(x, y - d[k], k - 1);
        else {
            if (x < 0)
                putchar('L'), print(x + d[k], y, k - 1);
            else
                putchar('R'), print(x - d[k], y, k - 1);
        }
    } else {
        if (std::abs(x) <= -y)
            putchar('D'), print(x, y + d[k], k - 1);
        else {
            if (x < 0)
                putchar('L'), print(x + d[k], y, k - 1);
            else
                putchar('R'), print(x - d[k], y, k - 1);
        }
    }
}

void solve() {
    ll mx = 0;
    rep(i, 1, N) mx = std::max(mx, p[i].x + p[i].y);
    while ((1LL << tot) + 1 + bs < mx)
        tot++;
    if (bs)
        d[++top] = 1;
    rep(i, 0, tot) d[++top] = (1LL << i);
    printf("%d\n", top);
    irep(i, top, 1) printf("%lld ", d[i]);
    puts("");
    rep(i, 1, N) print(p[i].x, p[i].y, top), puts("");
}

int main() {
#ifdef LOCAL
    FIN("in");
#endif
    read(N);
    rep(i, 1, N) read(p[i].x), read(p[i].y);
    int k = p[1].x + p[1].y;
    k &= 1;
    rep(i, 1, N) if (((p[i].x + p[i].y) & 1) != k) return puts("-1"), 0;
    if (!k)
        bs = 1;
    solve();
    return 0;
}


Measured memory_bytes: 256
import sys
import math
from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN
from collections import deque
from bisect import bisect_left
from itertools import product
def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def LSI(): return list(map(int, list(sys.stdin.readline().rstrip())))

def LSI2(N): return [list(map(int, list(sys.stdin.readline().rstrip()))) for i in range(N)]
def S(): return sys.stdin.readline().rstrip()
def LS(): return sys.stdin.readline().split()
def LS2(N): return [sys.stdin.readline().split() for i in range(N)]
def FILL(i,h): return [i for j in range(h)]
def FILL2(i,h,w): return [FILL(i,w) for j in range(h)]
def FILL3(i,h,w,d): return [FILL2(i,w,d) for j in range(h)]
def FILL4(i,h,w,d,d2): return [FILL3(i,w,d,d2) for j in range(h)]
def sisha(num,digit): return Decimal(str(num)).quantize(Decimal(digit),rounding=ROUND_HALF_UP)
#'0.01'や'1E1''などで指定、整数に戻すならintをかます
MOD = 998244353
INF = float("inf")
sys.setrecursionlimit(10**6+10)
input = sys.stdin.readline

import sys
import math
from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN
from collections import deque
from bisect import bisect_left
from itertools import product
def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def LSI(): return list(map(int, list(sys.stdin.readline().rstrip())))

def LSI2(N): return [list(map(int, list(sys.stdin.readline().rstrip()))) for i in range(N)]
def S(): return sys.stdin.readline().rstrip()
def LS(): return sys.stdin.readline().split()
def LS2(N): return [sys.stdin.readline().split() for i in range(N)]
def FILL(i,h): return [i for j in range(h)]
def FILL2(i,h,w): return [FILL(i,w) for j in range(h)]
def FILL3(i,h,w,d): return [FILL2(i,w,d) for j in range(h)]
def FILL4(i,h,w,d,d2): return [FILL3(i,w,d,d2) for j in range(h)]
def sisha(num,digit): return Decimal(str(num)).quantize(Decimal(digit),rounding=ROUND_HALF_UP)
#'0.01'や'1E1'などで指定、整数に戻すならintをかます
MOD = 998244353
INF = float("inf")
sys.setrecursionlimit(10**6+10)
input = sys.stdin.readline

N,K = MI()
A = [0]+LI()
ans_l = [1]
next = A[1]
done = [0]*(N+1)
done[1] = 1
while done[next]==0:
    ans_l.append(next)
    done[next]=1
    next = A[next]
idx = ans_l.index(next)
repeat = ans_l[idx:]
if K<idx:
    print(ans_l[K])
else:
    print(repeat[(K-idx)%len(repeat)])


Measured memory_bytes: 104404
# -*- coding: utf-8 -*-
n = int(input())
a_list = list(map(int, input().split()))

search_num = 1
count = 0

for i in range(n):
    if a_list[i] == search_num:
        search_num = search_num + 1
        count = count + 1

if search_num == 1:
    print(-1)
else:
    print(n-count)


Measured memory_bytes: 24744
n = int(input())
p = input().split(" ")
q = input().split(" ")
for i in range(0, len(p)):
    p[i] = int(p[i])
for i in range(0, len(q)):
    q[i] = int(q[i])

def to_ordinal(num):
    global n
    nums = []
    all = 1
    for i in range(1, n+1):
        nums.append(i)
        all *= i
    
    result = 0
    for i in range(0, n):
        result += nums.index(num[i]) * all / (n-i)
        all /= n-i
        nums.remove(num[i])
    
    return int(result+1)

print(abs(to_ordinal(p) - to_ordinal(q)))


Measured memory_bytes: 3064
#include <iostream> // cout, endl, cin
#include <cmath> //sqrt pow
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // dequef
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower

#define rep(i,n) for(int i = 0; i < n; i++)
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int, int>
#define all(a) (a).begin(), (a).end()
#define mod 1000000007
using ll = long long;
using namespace std;
int main(){
  int A,B,C,k;
  cin >> A >> B >> C >> k;
  for(int i = 0; i <= k; i++){
    for(int j = 0; j <= k - i; j++){
      int a = A, b = B, c = C;
      int l = k - i - j;
      a *= pow(2, i);
      b *= pow(2, j);
      c *= pow(2, l);
      if(b > a && c > b){
        cout << "Yes" << endl;
        return 0;
      }
    }
  }
  cout << "No" << endl;
}

Measured memory_bytes: 4092
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define prtd(var, i) cout << fixed << setprecision(i) << var << endl;
#define ll long long
using namespace std;
#define INF 100000

int main(){
    ll a, b;
    cin >> a >> b;
    if(a <= 0 && b >= 0){
        cout << "Zero" << endl;
    }else if(b < 0 && (b - a + 1) % 2 != 0){
        cout << "Negative" << endl;
    }else{
        cout << "Positive" << endl;
    }
}

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

typedef long long ll;
#define pa pair<int, int> 
#define pal pair<long long, long long>
#define pad pair<double, double>
#define pb push_back
#define mp make_pair
#define VIN(v) for(int64_t i=0;i<(v).size();i++){cin >> (v).at(i);}

typedef vector<bool> bvec;
typedef vector<int> ivec;
typedef vector<long long> lvec;
typedef vector<double> dvec;
typedef vector<pa> pvec;

typedef vector< vector<bool> > bmat;
typedef vector< vector<int> > imat;
typedef vector<string> svec;
typedef vector< vector<string> > smat;

ll C(int n, int r) {
    if(r > n - r) r = n - r; 
    ll ans = 1;
    int i;

    for(i = 1; i <= r; i++) {
        ans *= n - r + i;
        ans /= i;
    }

    return ans;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int  h, n;
    cin >> h >> n;
    ivec a(n), b(n);
    for (int i = 0; i < n; i++) cin >> a[i] >> b[i];
    int ma = *max_element(a.begin(), a.end());
    int nh = h+ma;
    imat dp(h+1, ivec(n));
    dp[0][0] = 0;
    for (int i = 0; i < n; i++) dp[0][i] = 0;
    for (int i = 1; i < h+1; i++) dp[i][0] = b[0] * ( 1 + (i)/a[0] - !((i) % a[0]));
    for (int i = 1; i < h+1; i++){
        for (int j = 1; j < n; j++) dp[i][j] = fmin(dp[i][j-1], dp[fmax(i-a[j], 0)][j] + b[j]);
    }
    cout << dp[h][n-1] << endl;
}


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

using namespace std;

#define lli long long
#define ld long double
#define mod 1000000007 
#define set(n) cout << fixed << setprecision(n)    
#define fi first
#define se second
#define mp make_pair
#define pll pair<lli, lli>
#define endl '\n'

const double PI = acos(-1);
const double epsilon = 1e-7;  // floating point precision

signed main(void) {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int k;
    cin >> k;
    vector<bool> seen(k);
    int md = 0;
    int pos = 0;
    while(true) {
        md = (md * 10 + 7) % k;
        pos ++;
        if(md == 0) {
            cout << pos << endl; 
            break;
        }
        if(seen[md]) {
            cout << -1 << endl;
            break;
        }
        seen[md] = true;
    }
    return 0;
}
 

Measured memory_bytes: 3732
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,A,B,F;
  cin>>N>>A>>B;
  F=N*A;
  
  if(F>=B){
    cout<<B<<endl;
  }
  
  else{
    cout<<F<<endl;
  }
}

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

int main(){
  int n;
  cin >> n;
  if(n<105){
    cout << 0 << endl;
  }else if(n<135){
    cout << 1 << endl;
  }else if(n<165){
    cout << 2 << endl;
  }else if(n<189){
    cout << 3 << endl;
  }else if(n<195){
    cout << 4 << endl;
  }else{
    cout << 5 << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <math.h>
#include <numeric>
#include <set>
#include <list>
#include <bitset>
using namespace std;

int main()
{
    int N, M, X;
    cin >> N >> M >> X;
    vector<int> A(N, 0);
    for (int i = 0; i < M; i++)
    {
        int tmp;
        cin >> tmp;
        A[tmp - 1] = 1;
    }
    cout << min(accumulate(A.begin(), A.begin() + X, 0), accumulate(A.begin() + X, A.end(), 0)) << endl;

    return 0;
}

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

char mas[111][111];
int dx[4]={0,1,0,-1};
int dy[4]={1,0,-1,0};
int sx,sy;
int w,h,cou;

int dfs(int x,int y);
int main(){
  while(1){
    cou=0;
    cin>>w>>h;
    if(w==0 && h==0) break;
    for(int i=0;i<h;i++){
      for(int j=0;j<w;j++){
	cin>>mas[i][j];
	if(mas[i][j]=='@'){
	  sx=j;
	  sy=i;
	}
      }
    }
    dfs(sx,sy);
    cout<<cou<<endl;
  }
}
int dfs(int x,int y){
  mas[y][x]='#';
  cou++;
  for(int i=0;i<4;i++){
    int nextx=x+dx[i];
    int nexty=y+dy[i];
    if(0<=nextx && nextx<w && 0<=nexty && nexty<h && mas[nexty][nextx]=='.'){
      dfs(nextx,nexty);
    }
  }
}

Measured memory_bytes: 1168
#include <iostream>
#include <iterator>
#include <algorithm>
#include <map>
using namespace std;

int main(void){
    // Your code here!
    int a,b;
    cin >> a >> b;
    if(max(a,b) > 8){
        cout << ":(" << endl;
    }else{
        cout << "Yay!" << endl;
    }
}


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

int main(){
    const int MAX_N = 10;
    const int MAX_M = 10;
    int N, M, m[MAX_M][MAX_N], p[MAX_M];
    cin >> N >> M;
    for (int i = 0; i < M; ++i){
    	for (int j = 0; j < N; ++j){
    		m[i][j] = 0;
    	}
    }
    for (int i = 0; i < M; ++i){
    	int k;
    	cin >> k;
    	for (int j = 0; j < k; ++j){
    		int t;
    		cin >> t;
    		m[i][t-1] = 1;
    	}
    }
    
    for (int i = 0; i < M; ++i){
    	cin >> p[i];
    }

    int ans = 0;
    // bit : 
    for (int bit = 0; bit < (1<<N); ++bit){    	
    	bool all_on = true;
    	for (int i = 0; i < M; ++i){
    		int sum = 0;
    		for (int j = 0; j < N; ++j){
    			if ( (bit & (1<<j)) > 0 && m[i][j] == 1) ++sum;
    		}
    		if (sum%2 != p[i]) {
    			all_on = false;
    			// break;
    		}
		}
		if (all_on)ans++;
	}

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

Measured memory_bytes: 256
fn solve() {
    let s = std::io::stdin();
    let mut sc = Scanner { stdin: s.lock() };
    let a: usize = sc.read();
    let b: usize = sc.read();
    if a >= 10 || b >= 10 {
        println!("-1");
        return;
    }
    println!("{}", a * b);
}

fn main() {
    std::thread::Builder::new()
        .stack_size(64 * 1024 * 1024) // 64MB
        .spawn(|| solve())
        .unwrap()
        .join()
        .unwrap();
}

//snippet from kenkoooo
pub struct Scanner<R> {
    stdin: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn read_line(&mut self) -> String {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b'\n' || b == b'\r')
            .take_while(|&b| b != b'\n' && b != b'\r')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }

    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


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

/* メモリ食い過ぎ注意 */
#define int long long

typedef long long ll;

ll gcd(ll a, int b)
{
    if (a < b)
        gcd(b, a);
    if (b == 0)
        return a;
    int r;
    while ((r = a % b))
    {
        a = b;
        b = r;
    }
    return b;
}

/* define const */
const ll INF = (1ll << 60);
const ll MOD = (ll)1e9 + 7;
/* end defineing */

signed main()
{
    int n;
    int d[100];
    int tmp[101] = {};
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        cin >> d[i];
        tmp[d[i]]++;
    }
    int sum = 0;
    for (int i = 0; i <= 100; i++)
    {
        if (tmp[i] > 0)
            sum++;
    }
    cout << sum << endl;
}


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

int main(){
	int n, a, b, c, i, x;
	cin >> n;
	for(i = 1; i <= n; i++){
		 cin >> a >> b >> c;
		 if(a > b){
		 	x = a;
		 	a = b;
		 	b = x;
		 }
		 if(b > c){
		 	x = b;
		 	b = c;
		 	c = x;
		 }
		 if(sqrt(a*a+b*b) == c){
		 	cout << "YES" << endl;
		 }else{
		 	cout << "NO" << endl;
		 }
	}
	return 0;
}

Measured memory_bytes: 1152
import sys

def debug(x, table):
    for name, val in table.items():
        if x is val:
            print('DEBUG:{} -> {}'.format(name, val), file=sys.stderr)
            return None

def solve():
    N = int(input())
    A = [int(i) for i in input().split()]
    K, r = divmod(sum(A), N * (N+1) // 2)

    if r != 0:
        print('NO')
        return None

    dif = [A[(i + 1) % N] - A[i] for i in range(N)]

    for i in range(N):
        if dif[i] > K or (K - dif[i]) % N != 0:
            print('NO')
            return None

    print('YES')


if __name__ == '__main__':
    solve()

Measured memory_bytes: 14484
#include<bits/stdc++.h>
 
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i,n) for(int i = 0; i < n; i++)
#define for1(i,n) for(int i = 1; i <= n; i++)
#define ford(i,n) for(int i = n-1; i >= 0; i--)
#define fore(i,a,b) for(int i = a; i <= b; i++)
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<ll> vll;
 
 
const  int MAXn= 3e5+5;
const  long long INF= 1e18;
const long long mod= 1e9+7;
 
 
int main(){
	int n;
	cin >> n;
	vi v(n);
	forn(i, n) cin >> v[i];
	
	int ans = 0;
	int val = 1;
	for(int i = 0; i < n; i++) {
		if(v[i] == val) val++;
		else ans++;
	}
	if(ans == n) cout << -1 << endl;
	else cout << ans << endl;
}


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

int main() {
    string s;
    cin >> s;
    bool check = true;
    if (s.size() % 2 == 1) check = false;
    for (int i = 0; i < s.size(); i++) {
        if (i % 2 == 0 && s[i] != 'h') check = false;
        if (i % 2 == 1 && s[i] != 'i') check = false;
    }
    cout << (check ? "Yes" : "No") << endl;
}

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

using namespace std;
void amin(long long  &x,long long  y)
{
    if ( y < x ) {
        x   =   y;
    }
}

int main()
{
    int N;//,a;
    long long sum[200001];
    sum[0] = 0;
    long long min_num = 2 * 10000000000;//pow(10, 9.0);

    cin >> N;

    for (int i = 1; i <= N; i++) {
        //cin >> a;
        cin >> sum[i];
        sum[i] += sum[i - 1];// + a;
    }
    
    for ( int i = 1; i < N; i++) {
        //min_num = min(min_num, abs(sum[N] - (2 * sum[i])));
        amin(min_num, abs(sum[N] - (2 * sum[i])));
    }
    cout << min_num << '\n';

}

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

int main(int argc, char *argv[]) {
  ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
  string s;
  cin>>s;
  for(char c='a';c<='z';c++){
    if ( count(s.begin(), s.end(), c) == 0 ) {
      cout<<c<<endl;
      return 0;
    }
  }
  cout<<"None"<<endl;

  return 0;
}


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

#define DEBUG(x) cout<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cout<<#v<<":";for(int i=0;i<v.size();i++) cout<<" "<<v[i]; cout<<endl

typedef long long ll;
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
const int inf=1000000001;
const ll INF=1e16;
#define MOD 1000000007
#define mod 1000000009
#define pi 3.14159265358979323846
#define Sp(p) cout<<setprecision(15)<<fixed<<p<<endl;
int dx[4]={1,0,-1,0}, dy[4]={0,1,0,-1};

int main() {
	int n, i, j;
	cin >> n;
	cout << "ABC" << n << endl;
	return 0;
}

Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const int N = 3000 + 5;
ld dp[N][N];
ld arr[N];
bool vis[N][N];
int n;

int main() {
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    cin >> n;
    for (int i = 0; i < n; i++)
        cin >> arr[i];
    for (int i = 0; i <= n; i++) {
        for (int j = 0; j <= n; j++) {
            if (i == 0) {
                if (n - j > j)
                    dp[i][j] = 1.0;
                else
                    dp[i][j] = 0;
                continue;
            }
            dp[i][j] = arr[i - 1] * dp[i - 1][j - 1] + (1 - arr[i - 1]) * dp[i - 1][j];
        }
    }
    cout << fixed << setprecision(10) << dp[n][n];
    return 0;
}


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

struct edge {
    int a;
    int b;
    int color;
    edge(int a, int b, int color) : a(a), b(b), color(color) {}
    int other(int i) {
        if (i == a) return b;
        return a;
    }
};

int main(int argc, char *argv[])
{
    int N;
    cin >> N;
    vector<vector<int>> g(N, vector<int>());
    vector<edge> edges;
    for (int i = 0; i < N - 1; i++) {
        int a, b;
        cin >> a >> b;
        a--; b--;
        g[a].push_back(i);
        g[b].push_back(i);
        edges.emplace_back(a, b, -1);
    }
    function<void(int, int, int)> dfs = [&](int u, int parent, int color) {
        int c = -1;
        for (int i : g[u]) {
            edge& e = edges[i];
            int v = e.other(u);
            if (v == parent) continue;
            c++;
            if (c == color) c++;
            e.color = c;
            dfs(v, u, c);
        }
    };
    dfs(0, -1, -1);
    int k = 0;
    for (int i = 0; i < N - 1; i++) {
        k = max(k, edges[i].color);
    }
    cout << k + 1 << endl;
    for (int i = 0; i < N - 1; i++) {
        cout << edges[i].color + 1 << endl;
    }
    return 0;
}


Measured memory_bytes: 9656
#include <stdio.h>

int main(void) {
	int ans = 0;
	while (1) {
		char c;
		scanf("%c", &c);
		int x = c - '0';
		if (x < 0 || x > 9) {
			break;
		}
		ans = (ans + x) % 9;
	}
	printf("%s\n", ans ? "No" : "Yes");
	return 0;
}


Measured memory_bytes: 1596
#include <iostream>
#include <string>
#include <math.h>
#include <list>
#include <stack>
#include <set>
#include <iomanip>
#include <random>
#include <time.h>
#include <vector>
#include <queue>
#include <functional>
#include <map>
#include <cstdlib>
#include <typeinfo>
#include <algorithm>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
int main() {
	string s;
	cin >> s;
	ll n = s.size(), ans = n;
	for (ll i = 0; i < n - 1; i++)if (s[i] != s[i + 1]) ans = min(ans, max(i + 1, n - i - 1));
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 512
# あらかじめ全ての区間における答えを求めておく
# 累積和が使える。
# 2次元累積和に関しては、下記のサイトを参照。
# https://paiza.hatenablog.com/entry/2014/05/28/もし女子大生プログラマに『アルゴリズム』を図
# p,qの値に関しての2次元座標系で考えると、値が存在するマスは限られてる
#
#
n, m, q = map(int, input().split())
ll = [[0, 0] for i in range(m)]
p = [[0, 0] for i in range(q)]
for i in range(m):
    ll[i][0], ll[i][1] = map(int, input().split())
for i in range(q):
    p[i][0], p[i][1] = map(int, input().split())
# for i in range(m):
#     print(ll[i])
# for i in range(q):
#     print(p[i])
sum = [[0 for i in range(n)] for i in range(n)]
# sum上でlをy成分＝行、rをx成分=列とする。
# 各区間の値を取り込み
for j in range(m):
    x = ll[j][0]-1
    y = ll[j][1]-1
    sum[y][x] += 1
# 2次元累積和の計算
# for j in range(n):
#     print(sum[j])
# print('-'*30)
for i in range(n):
    for j in range(1, n):
        sum[i][j] += sum[i][j-1]
for i in range(n):
    for j in range(1, n):
        sum[j][i] += sum[j-1][i]
# ans = [[0 for i in range(n)] for i in range(n)]
# for i in range(n):
#    for j in range(i, n):
#        for i2 in range(i, j+1):
#            for j2 in range(i, j+1):
#                ans[i][j] += sum[j2][i2]
# for j in range(n):
#     print(sum[j])


for i in range(q):
    x = p[i][0]-1
    y = p[i][1]-1
    if x != 0:
        print(sum[y][y] - sum[y][x-1] - sum[x-1][y]+sum[x-1][x-1])
    else:
        print(sum[y][y])


Measured memory_bytes: 53784
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,a,n) for(int i=(a); i<(n); i++)
#define ALL(v) v.begin(), v.end()
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

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

	string ans = "";
	rep(i, s.size()) {
		if (s[i] == '0') ans += '0';
		if (s[i] == '1') ans += '1';
		if (s[i] == 'B' && ans.size()) ans.pop_back();
	}

	cout << ans << endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
int d[14][14];
int dp[1<<14][14];//巡回セールスマン問題の最大路を管理
//すでに訪れた頂点集合がs、今いる頂点がv、最初にいた頂点がinit
int rec(int s,int v,int init,int n)
{
	//すでに計算終了している
	if(dp[s][v]<=0)
		return dp[s][v];

	//すべての頂点を訪れた
	if(s==(1<<n)-1)
	{
		return dp[s][v]=0;
	}

	int res=99999;
	for(int u=0;u<n;u++)
	{
		//まだuを訪れていない
		if((s&(1<<u))==0)
		{
			//次にuに移動する
			//cerr<<v<<" "<<u<<endl;
			res=min(res,rec(s|(1<<u),u,init,n)+d[v][u]);
		}
	}
	return dp[s][v]=res;
}

int main()
{
	while(1)
	{
		int n;
		cin>>n;
		if(n==0)
			break;
		vector<string> c;
		int sum=0;
		int ans=99999;
		for(int i=0;i<n;i++)
		{
			string s;
			cin>>s;
			c.push_back(s);
		}
		//完全に含まれる文字列が合った場合その文字列を消す
		bool f[14];
		fill(f,f+14,false);
		for(int i=0;i<n;i++)
		{
			for(int j=0;j<n;j++)
			{
				if(i==j || f[j])
					continue;
				//含まれていた場合は消す
				if(c[j].find(c[i])!=string::npos)
				{
					f[i]=true;
					break;
				}
			}
		}
		for(int i=n-1;i>-1;i--)
		{
			if(f[i])
				c.erase(c.begin()+i);
		}
		n=c.size(); //消した分を除いて再定義
		fill(d[0],d[14],99999);
		//c[i]の最後とc[j]の最初の一致を調べる
		for(int i=0;i<n;i++)
		{
			sum+=c[i].size();
			for(int j=0;j<n;j++)
			{
				if(i==j)
					continue;
				//iのすべてを調べる
				for(int a=0;a<c[i].size();a++)
				{
					//これはc[i]の開始位置
					//ここにc[j]を重ねる
					bool f=true;
					//実現した場合の長さはc[i]の最後までかc[j]すべて
					int len=min(c[i].size()-a,c[j].size());
					for(int b=0;b<c[j].size();b++)
					{
						//終了条件
						if(a+b==c[i].size())
							break;
						if(c[i][a+b]!=c[j][b])
						{
							f=false;
							break;
						}
					}
					if(f)
						d[i][j]=min(d[i][j],-len);
					else
						d[i][j]=min(d[i][j],0);
				}
			}
		}

		//fordebug
		/*
		for(int i=0;i<n;i++)
		{
			for(int j=0;j<n;j++)
				cerr<<min(d[i][j],25)<<" ";
			cerr<<endl;
		}*/
		//ここから巡回セールスマン問題
		for(int i=0;i<n;i++)
		{
			fill(dp[0],dp[1<<14],99999);
			ans=min(ans,rec(1<<i,i,i,n));
		}
		//cerr<<ans<<endl;
		cout<<sum+ans<<endl;
	}
	return 0;
}



Measured memory_bytes: 4112
#include<bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep2(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep_inv(i, n, m) for(int i = (int)(n); i > (int)(m); i--)
using namespace std;
using ll = long long;
using vl = vector<ll>;
using vc = vector<char>;
using vvl = vector<vl>;
using vvc = vector<vc>;
using pll = pair<ll, ll>;
using vpii = vector<pll>;

int main(){
  string s;
  cin >> s;
  ll N = s.size();

  ll left = -1, right = -1;

  rep(i, N){
    if(i < N -1){
      if(s[i] == s[i+1]){
		left = i + 1;
		right = i + 2;
		break;
      }
    }

    if(i < N - 2){
      if(s[i] == s[i + 2]){
        left = i + 1;
        right = i + 3;
        break;
      }
    }
  }

  cout << left << ' ' << right << endl;
  
  return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i <(n); ++i)
#define REP2(i,x,n) for (int i = x; i <(n); ++i)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
using namespace std;
using ll = long long;
using P = pair<int,int>;
static const double PI = acos(-1);



int main(){
  int n;
  cin >> n;
  map<int, int> mp;

  REP(i,n){
    int a;
    cin >> a;
    ++mp[a];
  }

  int cnt = 0;

  for( auto x: mp){
    if(x.second % 2) ++cnt;
  }

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


Measured memory_bytes: 8100
// #pragma GCC target("avx,avx2,fma")
// #pragma GCC optimization ("Ofast")
// #pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>

using namespace std;
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// template <typename T>
// using ordered_set = tree <T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
// #define sfind(i) (*find_by_order(i))
// #define ord(i) order_of_key(i)
typedef long long ll;
typedef pair<int , int> pii;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
#define mod 1000000007
#define rep(i, a, b) for(ll i = a; i < b; i++)
#define repc(i, a, b, c) for (ll i = a; (c > 0 ? i < b : i > b) and c != 0; i += c)
#define vi vector<int>
#define vl vector<ll>
#define _max(vec) (*max_element(all(vec)))
#define _min(vec) (*min_element(all(vec)))
#define fi first
#define si second
#define pb push_back
#define all(name) name.begin(), name.end()
#define ral(name) name.rbegin(), name.rend()
#define fact(n) rep(i, 1, n+1)ft.pb((ft[i-1]*i)%mod)
#define mod_in(a) power(a, mod - 2)
#define ncr(n, r) (n>=r?((ft[n]*mod_in((ft[r]*ft[(n)-(r)])%mod))%mod):0LL)
#define deb(x) cerr << "[" << #x << " " << x << "]" << endl;
#define endl '\n'  //....????
#define int ll
vector<ll> ft(1, 1LL);
/*======================================================================*/
__int128 a = 1;
void solve() {
    int n;
    cin >> n;
    vi v(n);
    rep(i, 0, n){
        cin >> v[i];
        if(v[i] == 0){cout << 0; return;}
    }
    rep(i, 0, n){
        a *= v[i];
        if(a > (ll)1e18){cout << -1; return;}
    }
    int x = a;
    cout << x;
}
signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    ll t = 1;
    //cin >> t;
    while(t--){
        solve();
    }
}

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

int main(){
  int A,B,C,K;
  cin >> A >> B >> C >> K;
  int sum = A+B+C;
  int count=0;
  while(A>0 && K>0){
    A--;
    K--;
    count++;
  }
  while(B>0 && K>0){
    B--;
    K--;
  }
  while(K>0){
    K--;
    count--;
  }
  
  cout << count << endl;
}
    

Measured memory_bytes: 3656
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <tuple>
#include <numeric>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;

struct Edge {
    ll to, cost;
    Edge(ll to, ll cost): to(to), cost(cost) {}
};

struct Data {
    ll v, x, y;  // いまいる頂点v, 補給回数x, 満タンの状態から使用した燃料の量y
    Data(ll v, ll x, ll y): v(v), x(x), y(y) {}
    bool operator<(const Data& hoge) const {
        return make_pair(x, y) > make_pair(hoge.x, hoge.y);
    }
};

int main() {
    ll n, m, L;
    cin >> n >> m >> L;    
    
    vector<vector<Edge>> G(n);
    rep(i, m) {
        ll a, b, c;
        cin >> a >> b >> c;
        a--;  b--;
        G[a].emplace_back(b, c);
        G[b].emplace_back(a, c);
    }
    
    vector<vector<P>> dp(n, vector<P>(n, make_pair(INF, INF)));  /* dp[sv][v] : 頂点svを始点として頂点vに到達するときの 
                                                                                (補給回数の最小値(到達できないときINF), 満タンの状態から使用した燃料の量) */
    
    rep(sv, n) {
        priority_queue<Data> Q;
        auto push = [&](ll v, ll x, ll y) {
            if(dp[sv][v] <= make_pair(x, y)) {
                return;
            }
            dp[sv][v] = make_pair(x, y);
            Q.emplace(v, x, y);
        };
        // 拡張ダイクストラ法。計算量はO((V+E)*log(V))
        push(sv, 0, 0);
        while(!Q.empty()) {
            Data hoge = Q.top();  Q.pop();
            ll v = hoge.v, x = hoge.x, y = hoge.y;
            if(dp[sv][v] != make_pair(x, y)) {
                continue;
            }
            for(Edge e : G[v]) {
                ll c = e.cost;
                if(y+c <= L) {
                    push(e.to, x, y+c);
                }
                else if(c <= L) {
                    push(e.to, x+1, c);
                }
            }
        }
    }

    ll q;
    cin >> q;
    vl ans(q);
    rep(i, q) {
        ll s, t;
        cin >> s >> t;
        s--;  t--;
        if(dp[s][t].first == INF) {
            ans[i] = -1;
        }
        else {
            ans[i] = dp[s][t].first;
        }
    }
    
    rep(i, q) {
        out(ans[i]);
    }
    
    re0;
}

Measured memory_bytes: 8444
#include <bits/stdc++.h>
using namespace std;
#define repr(i, a, b) for (int i = a; i < b; i++)
#define rep(i, n) for (int i = 0; i < n; i++)
typedef long long ll;
#define mod 1000000007

ll gcd(ll x,ll y) {return y ? gcd(y,x%y) : x;} 
ll lcm(ll x,ll y) {return x/gcd(x,y)*y;}

int main(){
    string s;
    cin >> s;
    int cnt=0;
    for(int i=0;i<s.size();i++){
        if(s[i]=='x') cnt++;
    }
    if(cnt>7) cout << "NO" << endl;
    else cout << "YES" << endl;
    return 0;
}











Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
#define mod 1000000007
#define endl '\n'

int main() {

    fast
    
    int n, l;
    cin>>n>>l;
    int ans=INT_MAX;
    int sum=0;
    int res;
    for(int i=1; i<=n; ++i){
        //cout<<"i: "<<i;
        int t=i-1+l;
        //cout<<" t:"<<t<<endl;
        sum+=t;
        //cout<<"sum: "<<sum<<endl;
        if(abs(t)<ans){
            ans=min(abs(t), ans);
            res=t;
            //cout<<endl<<"ans: "<<ans<<endl;
        }
        
    }
    cout<<sum-res;
	    

#ifndef ONLINE_JUDGE
    cerr << "\nTime elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
}

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

public class Main {

	public static String Y = "Yes";
	public static String N = "No";
	public static long MOD = (long) (Math.pow(10, 9) + 7);
	public static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		char[] c = nc();

		int sum = 700;

		if (c[0] == 'o') {
			sum += 100;
		}
		if (c[1] == 'o') {
			sum += 100;
		}
		if (c[2] == 'o') {
			sum += 100;
		}
		out(sum);
	}

	/*
	 * 以下メソッド集
	 */
	static double[] sort(double[] r) {
		Arrays.sort(r);
		return r;
	}

	static void debug() {
		out("---");
	}

	static void debug(long a) {
		out("-------");
		out(a);
		out("-------");
	}

	static void debug(String a) {
		out("-------");
		out(a);
		out("-------");
	}

	static long[] sort(long[] n) {
		Arrays.sort(n);
		return n;
	}

	static int ketasuu(int n) {
		String str = "" + n;
		return str.length();
	}

	static int account(String str) {
		String target = "AC";
		int count = 0;
		int len = str.length();
		for (int i = 0; i < len - 1; i++) {
			if (target.equals(str.substring(i, i + target.length()))) {
				count++;
			}
		}
		return count;
	}

	static int ni() {
		return sc.nextInt();
	}

	static long nl() {
		return sc.nextLong();
	}

	static double nd() {
		return sc.nextDouble();
	}

	static String n() {
		return sc.next();
	}

	static char[] nc() {
		return sc.next().toCharArray();
	}

	static int kaijo(int n) {
		if (n == 0 || n == 1) {
			return 1;
		} else {
			return n * kaijo(n - 1);
		}
	}

	static int fib(int n) {
		return (n == 1 || n == 0) ? n : fib(n - 2) + fib(n - 1);
	}

	static long lcm(long m, long n) {

		return m * n / gcd(m, n);
	}

	static int lcm(int m, int n) {

		return m * n / gcd(m, n);
	}

	static long gcd(long a, long b) {
		return (b == 0) ? a : gcd(b, a % b);
	}

	static int gcd(int a, int b) {
		return (b == 0) ? a : gcd(b, a % b);
	}

	static void out(String info) {
		System.out.println(info);
	}

	static void out(int info) {
		System.out.println(info);
	}

	static void out(double info) {
		System.out.println(info);
	}

	static void out(long info) {
		System.out.println(info);
	}

	static void out(char info) {
		System.out.println(info);
	}

	static void out(Object obj) {
		System.out.println(obj.toString());
	}

	static void outn(String info) {
		System.out.print(info);
	}

	static void outn(int info) {
		System.out.print(info);
	}

	static void outn(double info) {
		System.out.print(info);
	}

	static void outn(long info) {
		System.out.print(info);
	}

	static void outn(char info) {
		System.out.print(info);
	}

	static double max(double d, double e) {
		return Math.max(d, e);
	}

	static long max(long a, long b) {
		return Math.max(a, b);
	}

	static long min(long d, long e) {
		return Math.min(d, e);
	}

	static int min(int a, int b) {
		return (int) Math.min(a, b);
	}
}

class XY {
	int h;
	int c;

	XY(int h, int c) {
		this.h = h;
		this.c = c;
	}
}


Measured memory_bytes: 35616
import std.stdio, std.string, std.conv;

void main() {
	readln;
	auto d = new int[][][](4,3,10);
	foreach (string l; lines(stdin)) {
		auto r = l.chomp.split.to!(int[]);
		d[r[0]-1][r[1]-1][r[2]-1] += r[3];
	}
	foreach (j; 0..4) {
		foreach (i; d[j]) {
			" %s".writefln(i.to!(string[]).join(" "));
		}
		if (j != 3) "####################".writeln;
	}
}

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

using namespace std;
using i64 = long long;
using u64 = unsigned long long;
#define REP(i, n) for (int i = 0; (i64)(i) < (i64)(n); ++i)
#define SZ(a) int((a).size())

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

template <typename T>
using V = std::vector<T>;
template <typename T>
vector<T> make_vec(size_t n, T a) {
  return vector<T>(n, a);
}
template <typename... Ts>
auto make_vec(size_t n, Ts... ts) {
  return vector<decltype(make_vec(ts...))>(n, make_vec(ts...));
}

struct ZAlgorithm {
  const int n;
  vector<int> Z;
  const string_view S;

  explicit ZAlgorithm(string_view s) : n(s.size()), Z(s.size()), S(move(s)) {}

  void calc() {
    Z[0] = n;
    int i = 1, j = 0;
    while (i < n) {
      while (i + j < n and S[j] == S[i + j]) ++j;
      Z[i] = j;
      if (j == 0) {
        ++i;
        continue;
      }
      int k = 1;
      for (; k < j and k + Z[k] < j; ++k) {
        Z[i + k] = Z[k];
      }
      i += k;
      j -= k;
    }
  }
};

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

  int n;
  string s;
  cin >> n >> s;
  string_view sv(s);

  int ans = 0;
  REP(i, n) {
    ZAlgorithm za(sv.substr(i));
    za.calc();
    REP(j, n - i) { chmax(ans, min(za.Z[j], j)); }
  }
  cout << ans << endl;
}


Measured memory_bytes: 3688
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(ll i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
#define sp(x) fixed << setprecision(x)
#define pb(x) push_back(x)
#define all(x) x.begin(), x.end()
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const int inf = 1e9;
const ll INF = 1e18;
const ld EPS = 1e-10;

int main(){
    ll N;
    cin >> N;
    //dp[i]:=i項を決める方法
    ll dp[N+1], sum[N+1];
    dp[0] = 1, dp[1] = N;
    sum[0] = 1, sum[1] = N+1;
    rep2(i, 2, N){
        dp[i] = sum[i-1]+MOD-dp[i-2]+(N-i+1)+(N-1)*(N-1);
        dp[i] %= MOD;
        sum[i] = (sum[i-1]+dp[i])%MOD;
    }
    cout << dp[N] << endl;
}

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

int main(void){
    ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
    int n;
    cin>>n;
    vector<int> v(n);
    FOR(i, n) cin>>v[i];
    int ans = 0;
    FOR(i, n){
        for(int j=i+1;j<n;j++){
            ans += v[i]*v[j];
        }
    }
    cout<<ans;
}

Measured memory_bytes: 256
#include <iostream>


using namespace std;


int main(){

	int L[10], v1, v2, sum, buf, ans;
	float point;
	char c;


	while (1){
		sum = 0;
		ans = 0;
		buf = 0;

		for (int i = 0; i < 10; i++){
			cin >> L[i];
			cin >> c;
			sum += L[i];
		}
		cin >> v1 >> c >> v2;

		if (cin.eof()) break;

		point = (float)sum * v1 / (v1 + v2);

		for (int i = 0; i < 10; i++){
			buf += L[i];
			if ((float)buf >= point){
				ans = i + 1;
				break;
			}
		}

		cout << ans << endl;

	}


	return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
const int MOD = 1e9 + 7;
const int INF = 1e9;
const ll INFF = 1e18;

int main(int argc, char const *argv[])
{
	int n; cin >> n;
	vector<int> h(n); rep(i, n) cin >> h[i];
	int max = 0;
	int ans = 0;
	rep(i, n) {
		if (max <= h[i]) {
			ans++;
			max = h[i];
		}
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 256
N = gets.to_i

h = Hash.new
for i in 0...N
    s = gets.split(/\s*/).sort.join("")
    
    if h[s]
        h[s] += 1
    else
        h[s] = 1
    end
end

ans = 0
h.each{ |key, val|
    if val >= 2
        ans += (val * (val - 1)) / 2
    end
}

puts ans

Measured memory_bytes: 17276