solution
stringlengths 11
983k
| difficulty
int64 0
21
| language
stringclasses 2
values |
---|---|---|
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int n(0);
cin >> n;
string s;
cin >> s;
vector<int> v(10);
for (int i = 0; s[i]; i++) {
v[s[i] - '0']++;
}
long long rem = n / 11;
long long num = v[8];
if (v[8] == 0) {
cout << 0 << endl;
} else if (n < 11) {
cout << 0 << endl;
} else if (rem == num) {
cout << rem << endl;
} else if (num < rem) {
cout << num << endl;
} else if (rem < num) {
cout << rem << endl;
}
return 0;
}
| 7 | CPP |
a=int(input())
b=input()
cnt=0
for i in b:
if i=='8':
cnt+=1
if a>=11:
if b.find('8')>=0:
x=a//11
print(min(cnt, x))
else:
print("0")
else:
print("0") | 7 | PYTHON3 |
#------------------------------warmup----------------------------
import os
import sys
from io import BytesIO, IOBase
import math
BUFSIZE = 8192
class FastIO(IOBase):
newlines = 0
def __init__(self, file):
self._fd = file.fileno()
self.buffer = BytesIO()
self.writable = "x" in file.mode or "r" not in file.mode
self.write = self.buffer.write if self.writable else None
def read(self):
while True:
b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
if not b:
break
ptr = self.buffer.tell()
self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
self.newlines = 0
return self.buffer.read()
def readline(self):
while self.newlines == 0:
b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
self.newlines = b.count(b"\n") + (not b)
ptr = self.buffer.tell()
self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
self.newlines -= 1
return self.buffer.readline()
def flush(self):
if self.writable:
os.write(self._fd, self.buffer.getvalue())
self.buffer.truncate(0), self.buffer.seek(0)
class IOWrapper(IOBase):
def __init__(self, file):
self.buffer = FastIO(file)
self.flush = self.buffer.flush
self.writable = self.buffer.writable
self.write = lambda s: self.buffer.write(s.encode("ascii"))
self.read = lambda: self.buffer.read().decode("ascii")
self.readline = lambda: self.buffer.readline().decode("ascii")
sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")
#-------------------game starts now----------------------------------------------------
n=(int)(input())
s=input()
c=n//11
cc=0
for i in range(n):
if(s[i]=='8'):
cc+=1
print(min(cc,c)) | 7 | PYTHON3 |
x = int(input())
s = input()
print(min(s.count('8'), x//11)) | 7 | PYTHON3 |
n = int(input())
s = input()
ans = min(s.count("8"), n // 11)
print(ans) | 7 | PYTHON3 |
n = int(input())
st = input()
count8 = 0
for k in st:
if k == "8":
count8 += 1
res = min( int(len(st)/11), count8 )
print(res) | 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
long long n;
cin >> n;
string s;
cin >> s;
long long arr[10] = {0};
for (long long i = 0; i < n; i++) {
arr[s[i] - '0']++;
}
long long v = arr[8];
long long sum = 0;
for (long long i = 0; i < 10; i++) {
if (i != 8) {
sum += arr[i];
}
}
long long x = sum / 10;
long long z = sum % 10;
if (v <= x) {
cout << v << "\n";
} else {
long long ans = x;
long long p = v - x;
if (p >= 11 - z) {
ans++;
p -= (11 - z);
}
ans += (p / 11);
cout << ans << "\n";
}
return 0;
}
| 7 | CPP |
#include <bits/stdc++.h>
using namespace std;
int main() {
long long int n, c = 0;
cin >> n;
string s;
cin >> s;
for (int i = 0; i < s.size(); i++) {
if (s[i] == '8') c++;
}
cout << min(n / 11, c) << endl;
}
| 7 | CPP |
#include <bits/stdc++.h>
using namespace std;
int n;
char s[101];
int main() {
while (scanf("%d", &n) != EOF) {
int count = 0;
scanf("%s", s);
for (int i = 0; i < n; i++) {
if (s[i] == '8') count++;
}
int ans = n / 11;
cout << min(count, ans) << endl;
}
return 0;
}
| 7 | CPP |
n = int(input())
k = (list(input()))
r = n//11
print(min(r,k.count('8'))) | 7 | PYTHON3 |
n=int(input())
num=input()
e=0
for x in num:
if x == '8':
e+=1
print(min(e,n//11)) | 7 | PYTHON3 |
from collections import Counter
n = int(input())
a = list(input())
c = Counter(a)
print(min(n // 11, c['8'])) | 7 | PYTHON3 |
def main():
n = int(input())
s = input()
if '8' not in s:
return 0
q = s.count('8')
return min(q, n//11)
if __name__=="__main__":
print(main()) | 7 | PYTHON3 |
n=int(input())
a=input()
cnt=a.count("8")
tot=0
if cnt==0 or n<11:
print(0)
else:
for i in range(cnt):
if (n-1)//10>0:
tot+=1
n=n-11
else:
break
print(tot) | 7 | PYTHON3 |
n = int(input())
a = list(input())
print(min((n//11), a.count('8')))
# HaPpY NoWrUz 1398
# UBCF
# CodeForcesian
# ♥
# تو چشام نگا کن و دستت و بذار تو دستم | 7 | PYTHON3 |
n=int(input())
s=input()
if s.count('8')==0 or len(s)<11:
print(0)
elif s.count('8')>=1 and len(s)>=11:
if s.count('8')==1 and len(s)>=11:
print(1)
else:
if s.count('8')<=len(s)//11:
print(s.count('8'))
else:
print(len(s)//11)
| 7 | PYTHON3 |
a=int(input())
b=input()
c=b.count("8")
d=a//11
if d<=c:
print(d)
else:
print(c)
| 7 | PYTHON3 |
n = int(input())
a = input()
k = 0
kk = 0
for x in a:
if x == '8':
k += 1
while n >= 11 and k:
k -= 1
n -= 11
kk += 1
print(kk) | 7 | PYTHON3 |
n = int(input())
l = list(input())
maxi = n // 11
e = l.count('8')
print(min(maxi, e)) | 7 | PYTHON3 |
# https://codeforces.com/problemset/problem/1060/A
n=int(input())
string = input()
string = string.replace('9','0')
arr = sorted(list(string))
i=0
j=n-1
ans=0
while i + 9 < j:
if arr[j]=='8':
j-=1
i+=10
ans+=1
else:
break
print(ans)
| 7 | PYTHON3 |
n = int(input())
s = input()
res = s.count('8')
print(min(n//11,res)) | 7 | PYTHON3 |
n, s = int(input()), input()
print(min(s.count('8'), n // 11)) | 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
const long long N = 1e5 + 5;
int32_t main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
;
string s;
long long n;
cin >> n >> s;
long long c = count(s.begin(), s.end(), '8');
cout << (c < (n / 11) ? c : (n / 11));
return 0;
}
| 7 | CPP |
#include <bits/stdc++.h>
using namespace std;
int main() {
int count = 0;
int num;
string y;
int x;
bool flag = false;
cin >> num;
cin >> y;
if (num < 11)
cout << "0" << endl;
else {
for (int j = 0; j < y.length(); j++) {
if (y.at(j) == '8') {
flag = true;
count++;
}
}
if (flag == false)
cout << "0" << endl;
else {
x = num / 11;
if (x < count)
cout << x << endl;
else
cout << count << endl;
}
}
return 0;
}
| 7 | CPP |
#include <bits/stdc++.h>
using namespace std;
string s;
int main() {
int n;
cin >> n;
cin >> s;
int m = 0;
for (int i = 0; i < s.size(); i++)
if (s[i] == '8') m++;
cout << min(m, n / 11) << endl;
return 0;
}
| 7 | CPP |
#include <bits/stdc++.h>
using namespace std;
int main() {
long long int t, k, cnt = 0;
string s;
cin >> t;
cin >> s;
k = ceil(t / 11);
for (int i = 0; i < t; i++) {
if (s[i] == '8') cnt++;
}
cout << min(k, cnt);
return 0;
}
| 7 | CPP |
a=int(input())
b=input()
c=b.count('8')
d=len(str(b))//11
if c>d:
print(d)
elif d>=c:
print(c)
else:
print(-1) | 7 | PYTHON3 |
def main():
n = int(input())
cards = input()
et_count = cards.count("8")
ph_no = n // 11
if et_count <= ph_no:
print(et_count)
elif ph_no <= et_count:
print(ph_no)
else:
print(0)
if __name__ == "__main__":
main() | 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, cnt = 0;
cin >> n;
string s;
cin >> s;
for (int i = 0; i < n; ++i)
if (s[i] == '8') ++cnt;
int ret = 0;
for (int i = 1; i <= cnt; ++i)
if ((n - i) / 10 >= i) ret = i;
cout << ret << endl;
return 0;
}
| 7 | CPP |
a = int(input())
l = input()
a1 = l.count("8")
a2 = a//11
if a2 > a1:
print(a1)
else:
print(a2)
| 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int main() {
string s;
int n, i, e = 0, t = 0, c = 0;
cin >> n >> s;
for (i = 0; i < n; i++)
if (s[i] == '8') e++;
cout << min(e, n / 11) << endl;
}
| 7 | CPP |
#include <bits/stdc++.h>
using namespace std;
const long long int MOD = 1e9 + 7;
const long long int MAXN = 1e6 + 1;
const long double PI = acos(-1);
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n;
cin >> n;
;
int counter = 0;
for (int i = 0; i < (n); ++i) {
char x;
cin >> x;
if (x == '8') counter++;
}
cout << min(n / 11, counter);
return 0;
}
| 7 | CPP |
n = int(input())
s = list(input())
d = 0
for i in range(n):
if (int(s[i])==8):
d = d + 1
if (d==0):
print (0)
else:
if (d<=(n//11)):
print (d)
else:
print (n//11)
| 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int N;
char S[105];
int main() {
scanf("%d", &N);
scanf("%s", S);
int cnt = 0;
for (int i = 0; i < N; i++)
if (S[i] == '8') cnt++;
printf("%d", min(cnt, N / 11));
return 0;
}
| 7 | CPP |
x=int(input())
s=input()
c=0
for i in s:
if i=="8":
c+=1
a=len(s)-c
if x<11 or c==0:
print(0)
elif c*10<=a:
print(c)
else:
print(int(len(s)/11))
| 7 | PYTHON3 |
#include <bits/stdc++.h>
long long cmpfunc(const void* a, const void* b) {
return (*(long long*)a - *(long long*)b);
}
int main(void) {
long long int test, i, j, n, count, flag = 0, o1 = 0, o2 = 0, b1, x, m, l,
max, sum2, min, f, c, r, o, sum1, sum = 0,
y;
char a[100000] = {0};
scanf("%lld%s", &n, a);
count = 0;
for (i = 0; i < n; i++) {
if (a[i] == '8') {
count++;
}
}
count = (count >= (n / 11)) ? n / 11 : count;
printf("%lld", count);
return 0;
}
| 7 | CPP |
#include <bits/stdc++.h>
using namespace std;
const int N = (int)(1e5 + 10);
bool isPowerOfTwo(long long int x) { return x && (!(x & (x - 1))); }
void solve() {
int n;
cin >> n;
string s;
cin >> s;
int cnte = 0;
for (int i = 0; i < n; i++) s[i] == '8' ? ++cnte : cnte;
if (cnte == 0) {
cout << 0 << endl;
return;
} else {
int div = n / 11;
cout << min(cnte, div) << endl;
return;
}
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
long long int t;
t = 1;
while (t--) {
solve();
}
return 0;
}
| 7 | CPP |
n = 0
a = input()
b = list(input())
for element in b:
if element == "8":
n += 1
if len(b) < 11:
print(0)
elif n < 1:
print(0)
elif (len(b) // 11) == n:
print(n)
elif (len(b) // 11) > n:
print(n)
elif (len(b) // 11) < n:
print(len(b) // 11) | 7 | PYTHON3 |
n=int(input())
l=list(input())
print(min(l.count('8'),n//11)) | 7 | PYTHON3 |
from collections import Counter
def ans(arr):
tmp = arr.count('8')
return(min(t // 11, tmp))
if __name__ == '__main__':
t = int(input())
n = input()
print(ans(n))
| 7 | PYTHON3 |
n = int(input())
s = [int(x) for x in input()]
c8 = s.count(8)
phone = 0
if n >= 11 and c8 > 0:
while n >= 11 and c8 > 0:
c8 -= 1
n -= 11
phone += 1
print(phone)
else:
print(0)
| 7 | PYTHON3 |
a = int(input())
b = list(''.join(input()))
g = b.count('8')
f = a // 11
print(min(g, f))
| 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, x, cnt = 0;
string s;
cin >> n;
cin >> s;
x = n / 11;
for (int i = 0; i < n; i++) {
if (s[i] == '8') {
cnt++;
}
if (cnt == x) {
break;
}
}
cout << min(x, cnt);
}
| 7 | CPP |
#include <bits/stdc++.h>
using namespace std;
long long n, i, j, k, m, x;
void solve() {
cin >> n;
string a;
cin >> a;
for (i = 0; i < a.size(); i++) {
if (a[i] == '8') {
m++;
}
}
if (n < 11) {
cout << "0";
} else {
int count = 0;
cout << min(n / 11, m);
}
}
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
;
int T = 1;
while (T--) {
solve();
cout << endl;
}
return 0;
}
| 7 | CPP |
n=int(input())
s=input()
l=list(s)
cnt=l.count('8')
length=n//11
if length>= cnt:
print(cnt)
elif length<= cnt:
print(length)
elif length== cnt:
print(lenght)
elif length<=1:
print(0)
| 7 | PYTHON3 |
n=int(input(""))
dizi=list(input(""))
sekiz=0
for j in range(n):
if(dizi[j]=="8"):
sekiz=sekiz+1
sayi=int(len(dizi)/11 )
if(sekiz==0):
print(0)
else:
if(sekiz>sayi):
print(int(sayi))
else:
print(int(sekiz)) | 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, phNum, eCount = 0;
cin >> n;
string s;
cin >> s;
if (n > 10) {
for (int i = 0; s[i]; i++) {
if (s[i] == '8') {
eCount++;
}
}
if (eCount == 0) {
cout << 0 << endl;
return 0;
}
phNum = n / 11;
if (phNum > eCount) {
cout << eCount << endl;
} else {
cout << phNum << endl;
}
} else {
cout << 0 << endl;
}
return 0;
}
| 7 | CPP |
n=int(input())
st=input()
if n<11:
print(0)
else:
num=st.count("8")
num2=n//11
print(min(num,num2))
| 7 | PYTHON3 |
n=int(input())//11
a=input().count("8")
print(min(n,a)) | 7 | PYTHON3 |
n=int(input())
s=input()
k=0
if('8' in s):
d=s.count('8')
if(d>=1):
while(n>=11 and d>0):
k+=1
d-=1
n-=11
print(k)
| 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, c8 = 0;
string s;
cin >> n;
cin >> s;
for (int i = 0; i < n; i++) {
if (s[i] == '8') {
c8++;
}
}
int a = n / 11;
cout << min(a, c8);
}
| 7 | CPP |
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n;
string second;
cin >> n >> second;
int i;
int p = 0;
for (i = 0; i < n; i++) {
if (second[i] == '8') p++;
}
int m = (n - p) / 10;
if (p > m) {
cout << n / 11;
} else
cout << min(p, m);
return 0;
}
| 7 | CPP |
n=int(input())
m=len(input().replace('8',''))
print(min(n//11, n-m)) | 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
scanf("%d", &n);
string str;
cin >> str;
int cnt[10];
memset(cnt, 0, sizeof cnt);
for (int i = 0; i < str.length(); i++) {
int p = str[i] - '0';
cnt[p]++;
}
int maxs = 0;
for (int i = 0; i <= cnt[8]; i++) {
int oth = i * 10;
int baki = n - i;
if (baki >= oth) maxs = max(maxs, i);
}
cout << maxs;
}
| 7 | CPP |
#include <bits/stdc++.h>
using namespace std;
int u[200];
int main() {
int n;
string s;
cin >> n >> s;
for (int i = 0; i < n; i++) u[s[i] - '0']++;
cout << min(u[8], (n / 11)) << endl;
}
| 7 | CPP |
n = int(input())
string = input()
length = len(string)
string = string.replace("8", "")
string += "8" * (length - len(string))
cnt = 0
while len(string) >= 11 and string[len(string) - 1] == "8":
string = string.replace("8", "", 1)
string = string[10:]
cnt += 1
print(cnt)
| 7 | PYTHON3 |
a = input()
b = input()
num = b.count("8")
num1 = int(a)//11
print(min(num, num1)) | 7 | PYTHON3 |
t=int(input())
st=input()
ct=0
for i in range(t):
if int(st[i])==8:
ct+=1
t-=ct
ans=0
while(1):
if ct==0:
break
if ct*10<=t:
ans=ct
break
else:
ct-=1
t+=1
print(ans)
| 7 | PYTHON3 |
n = int(input())
s = list(input())
if '8' not in s:
print(0)
exit()
print(min(s.count('8') , n // 11))
| 7 | PYTHON3 |
n = int(input())
str = input()
if n % 11 == 0 :
if str.count("8") > n // 11:
print(n // 11)
else:
print(str.count("8"))
else:
if str.count("8") > n // 11:
print(n // 11)
else:
print(str.count("8"))
| 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
long long ppow(long long a, long long b, long long mod) {
a %= mod;
long long ans = 1;
while (b) {
if (b & 1) ans = ans * a % mod;
a = a * a % mod;
b >>= 1;
}
return ans;
}
void ac() { cout << "YES" << endl; }
void wa() { cout << "NO" << endl; }
signed main() {
long long n;
cin >> n;
string s;
cin >> s;
long long ans = 0;
for (auto v : s) {
if (v == '8') {
ans++;
}
}
cout << min(ans, n / 11) << endl;
return 0;
}
| 7 | CPP |
input()
b=input()
c=b.count('8')
result=len(b)//11
if c < result:
print(c)
else:
print(result) | 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int main() {
float n;
cin >> n;
int x = 0;
string r;
cin >> r;
for (int i = 0; i < n; i++) {
if (r[i] == '8') x++;
}
int k = floor(n / 11);
cout << min(k, x);
return 0;
}
| 7 | CPP |
#include <bits/stdc++.h>
using namespace std;
char s[105];
int main() {
int n;
cin >> n;
cin >> s;
int cnt = 0;
for (int i = 0; i < n; i++) {
if (s[i] == '8') cnt++;
}
int ans = min(cnt, n / 11);
cout << ans << endl;
return 0;
}
| 7 | CPP |
#include <bits/stdc++.h>
using namespace std;
int n, A, B, Ans;
char s[105];
int main() {
scanf("%d%s", &n, s + 1);
for (int i = 1; i <= n; i++)
if (s[i] == '8')
A++;
else
B++;
while (A && n >= 11) Ans++, A--, n -= 11;
printf("%d\n", Ans);
return 0;
}
| 7 | CPP |
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, ans = 0;
cin >> n;
string s;
cin >> s;
for (int i = 0; i < n; i++)
if (s[i] == '8') ans++;
cout << min(ans, n / 11);
return 0;
}
| 7 | CPP |
#!/usr/bin/python3
from collections import Counter
def readint():
return int(input())
def readline():
return [int(c) for c in input().split()]
def main():
no_cards = readint()
cards = [int(c) for c in input()]
cnt = Counter(cards)
print(min(cnt[8], (sum(cnt.values())) // 11))
if __name__ == '__main__':
main()
| 7 | PYTHON3 |
#include <bits/stdc++.h>
int main() {
int a, i, count = 0, k;
scanf("%d", &a);
char b[a];
scanf("%s", &b);
for (i = 0; i < a; i++) {
if (b[i] == '8') {
count++;
}
}
k = a / 11;
if (count < k) {
k = count;
}
printf("%d", k);
}
| 7 | CPP |
n = int(input()); s = sorted(input())
print(min(s.count('8'), n//11))
| 7 | PYTHON3 |
a=0
n=int(input())
s=input()
for i in s:
if i == '8':
a+=1
print(min(n//11,a))
| 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
char s[1000];
int a[50];
int main() {
int n;
scanf("%d", &n);
scanf("%s", s + 1);
for (int i = 1; i <= n; ++i) {
a[s[i] - '0']++;
}
printf("%d\n", min(a[8], n / 11));
}
| 7 | CPP |
a=int(input())
b=(input())
ans=a//11
ans1=b.count('8')
print(min(ans,ans1))
| 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, ch = 0;
cin >> n;
string s;
cin >> s;
for (int i = 0; i < s.size(); i++) {
if (s[i] == '8') {
ch++;
}
}
int ch1 = s.size();
cout << min(ch, ch1 / 11);
}
| 7 | CPP |
n = int(input())
a = input()
print(min(a.count("8"),n//11)) | 7 | PYTHON3 |
n=int(input())
s=input()
c=0
for i in range(n):
if s[i]=='8':
c+=1
print(min(c,len(s)//11))
| 7 | PYTHON3 |
n = (int) (input())
l = input()
l = [int(list(l)[i]) for i in range(n)]
count=0
tel=0
for i in range(n):
if (l[i]==8):
count+=1
if(count==0):
print(0)
else:
for i in range(count):
if(i<(n-i)//10):
tel+=1
print(min(tel,(n-tel)//10)) | 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
string str;
int n, ans;
int main() {
scanf("%d", &n);
cin >> str;
for (int i = 0; i < n; i++)
if (str[i] == '8') ans++;
printf("%d", min(ans, (int)floor(n / 11.0)));
return 0;
}
| 7 | CPP |
def main():
n = int(input())
s = input()
count8 = s.count('8')
res = n // 11
if (res == count8):
print(res, end = ' ')
elif (res < count8):
print(res, end = ' ')
elif (res > count8):
print(count8, end = ' ')
if __name__ == '__main__':
main() | 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace ::std;
int n;
int q8;
string s;
int main() {
cin >> n >> s;
for (int i = 0; i < s.size(); i++) {
if (s[i] == '8') q8++;
}
int ans = q8;
ans = min(ans, n / 11);
cout << ans << endl;
return 0;
}
| 7 | CPP |
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
string s;
cin >> n >> s;
int m = count(s.begin(), s.end(), '8');
int ans = 0;
for (int i = 1; i <= m; ++i) {
ans = max(ans, min(i, (n - i) / 10));
}
cout << ans << endl;
}
| 7 | CPP |
from collections import Counter
n=int(input())
s=input()
f=s.count('8')
k=n//11
if f>=1 and k>=1:
print(min(f,k))
else:
print(0)
| 7 | PYTHON3 |
n=int(input())
s=input()
d={}
for i in s:
if(i in d):
d[i]+=1
else:
d[i]=1
if('8' in d):
x=d['8']
del d['8']
d['8']=x
c=0
while(True):
if('8' in d and d['8']>=1):
d['8']-=1
s=0
for k,v in d.items():
if(v>0):
# if(k=='8'):
# s+=1
# d[k]-=1
s+=v
if(s==10):
c+=1
d[k]=0
break
if(s>10):
d[k]=s-10
c += 1
break
else:
d[k]=0
else:
break
print(c)
| 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int n, nk;
char k;
int main() {
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> k;
if (k == '8') nk++;
}
cout << min(nk, n / 11) << endl;
return 0;
}
| 7 | CPP |
n=int(input())
sr=input()
sol=0
eights=sr.count("8")
while n>=11 and eights>0:
sol+=1
eights-=1
n-=11
print(sol) | 7 | PYTHON3 |
n = int(input())
s = input()
if n<11:
print(0)
else:
temp = n/11
if s.count('8') == temp or s.count('8')<temp:
print(s.count('8'))
else:
print(int(temp)) | 7 | PYTHON3 |
n=int(input())
s=input()
c=0
for i in range(n):
if(s[i]=='8'):
c=c+1
if(c>=(n//11)):
print(n//11)
else:
print(c)
| 7 | PYTHON3 |
a=int(input())
st=input()
eight=0
for i in range(0,len(st)):
if st[i]=='8':
eight+=1
banyak=len(st)//11
if banyak==0:
c=0
elif banyak<eight:
c=banyak
else :
c=eight
print(c) | 7 | PYTHON3 |
n=int(input())
str=input()
result=str.count('8')
ans=0
while n>=11 and result>0:
if n>=11 and result>0:
ans+=1
#print('ans: ',ans)
n-=11
#print('n: ',n)
result-=1
#print('result: ',result)
else:
break
print(ans) | 7 | PYTHON3 |
n = int(input())
s = input()
k = 0
for i in range(len(s)):
if s[i]=='8':
k+=1
def min(a, b):
if a < b:
return a
return b
print(min(n//11, k))
| 7 | PYTHON3 |
n = int(input())
a = input()
x = 0
for i in a:
if i == "8":
x += 1
print(min(x , n // 11))
| 7 | PYTHON3 |
n = int(input())
x = input()
num = 0
for i in x:
if i == '8':
num = num + 1
ans = 0
while num >= 1 and n >= 11:
num = num - 1
n = n - 11
ans = ans + 1
print(ans) | 7 | PYTHON3 |
def read():
return int(input())
def read_cards():
s = input()
return list(int(e) for e in s)
n = read()
arr = read_cards()
print(min(len(arr) // 11, arr.count(8))) | 7 | PYTHON3 |
n=int(input())
s=str(input())
print(min(s.count('8'),n//11)) | 7 | PYTHON3 |
length =int(input())
line = str(input())
len11 = int(length/11)
print(min(len11, line.count("8"))) | 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int main() {
string card;
int cnt = 0;
int n, i, ans = 0;
cin >> n;
cin >> card;
for (int i = 0; i < n; i++)
if (card[i] == '8') cnt++;
int other = n - cnt;
for (i = cnt; i > 0;) {
i--;
if (other >= 10) {
other -= 10;
ans++;
} else if (other + i >= 10) {
i -= (10 - other);
other = 0;
ans++;
}
}
cout << ans << "\n";
return 0;
}
| 7 | CPP |
n=int(input())
l=input()
u=l.count("8")
print(min(u,n//11)) | 7 | PYTHON3 |
n=int(input())
s=input()
m=len(s)
v=s.count('8')
out=min(v,m//11)
print(out)
| 7 | PYTHON3 |
n=int(input())
x=input()
k=0
m=0
z=0
for i in x:
if int(i)==8:
k+=1
for i in range(k):
m+=11
if n<m:
break
z+=1
print(z)
| 7 | PYTHON3 |
n=int(input())
s=input()
x=n//11
y=s.count("8")
print(min(x,y)) | 7 | PYTHON3 |
n = int(input())
s = input()
m = int(n / 11)
c = 0
for i in s:
if i == '8':
c += 1
print(min(c, m))
| 7 | PYTHON3 |