solution
stringlengths
11
983k
difficulty
int64
0
21
language
stringclasses
2 values
#include <bits/stdc++.h> int main() { int n; scanf("%d", &n); char num[10000]; int i, sum = 0; scanf("%s", num); int max = n / 11; for (i = 0; i < n; i++) { if (num[i] == '8') sum++; } if (max > sum) max = sum; printf("%d", max); return 0; }
7
CPP
a =int(input()) b = input() delapan = b.count('8') sisa = (len(b)-delapan) while delapan*10 > sisa: delapan = delapan -1 sisa = sisa +1 print(delapan)
7
PYTHON3
n=int(input()) s=input() add1=0 for i in s: if int(i)==8: add1+=1 print(min(add1,n//11))
7
PYTHON3
#include <bits/stdc++.h> using namespace std; char s[200]; int main() { int n; int ans = 0; scanf("%d", &n); scanf("%s", s); for (int i = 0; i < n; ++i) if (s[i] == '8') ++ans; for (int i = ans; i >= 0; --i) if (i * 11 <= n) { printf("%d", i); return 0; } return 0; }
7
CPP
n = int(input()) s = input() c = 0 for i in s: if i == '8': c -= -1 t = n // 11 print(min(c, t))
7
PYTHON3
#include <bits/stdc++.h> using namespace std; char card[105]; int noe, noo; int main() { int n; while (~scanf("%d", &n)) { scanf("%s", card); noe = 0; noo = 0; for (int i = 0; i < n; i++) { if (card[i] == '8') noe++; else noo++; } int res = 0; while (noe && n > 10) { noe--; if (noo >= 10) noo -= 10; else if (noo + noe >= 10) { noe -= (10 - noo); noo = 0; } res++; if (noo + noe < 11) break; } printf("%d\n", res); } return 0; }
7
CPP
n=int(input()) l=[int(x) for x in input()].count(8) n-=l res=min(n//10,l) l-=res n-=res*10 if l!=0: res+=(l+n)//11 print(res)
7
PYTHON3
n = int(input()) // 11 numbers = input() count_8 = 0 for i in numbers: count_8 += 1 if i == '8' else 0 print(min(n, count_8))
7
PYTHON3
#include <bits/stdc++.h> using namespace std; const double PI = acos(-1.0); int main() { int n; string s; cin >> n; cin >> s; int cnt = 0; int ans = 0; for (int i = 0; i < (int)s.size(); i++) { if (s[i] == '8') { cnt++; } int local = min(cnt, ((int)s.size() - cnt) / 10); ans = max(ans, local); } cout << ans; return 0; }
7
CPP
n=int(input()) s=input() x=s.count("8") y=n//11 if x>=y: print(y) else: print(x)
7
PYTHON3
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n, ctr{}; cin >> n; string vec; cin >> vec; int likh = count(vec.begin(), vec.end(), '8'); if (likh > 0) { int m = min(likh, n % 11); int len = n - m; len = len / 10; ctr = min(len, likh); } cout << ctr << "\n"; return 0; }
7
CPP
N = int(input()) ipt = input() def checker(ipt): if "8" in ipt: if len(ipt) >= 11: return min(len(ipt)//11, ipt.count("8")) return 0 print(checker(ipt))
7
PYTHON3
#include <bits/stdc++.h> using namespace std; long long power(long long n, long long p, long long mod) { if (p == 0) return 1; if (p % 2 == 0) { long long c = power(n, p / 2, mod); return (c % mod * c % mod) % mod; } return (n % mod * power(n, p - 1, mod) % mod) % mod; } unsigned long long gcd(unsigned long long a, unsigned long long b) { if (b == 0) return a; return gcd(b, a % b); } int n, i; string s; int cnt[11] = {0}; int main() { ios_base::sync_with_stdio(false); cin >> n >> s; for (i = 0; i < n; i++) cnt[s[i] - '0']++; if (n < 11) return cout << 0, 0; int num = n / 11; cout << min(num, cnt[8]); return 0; }
7
CPP
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); ; int n, e8 = 0, ans; cin >> n; string s; ans = n / 11; cin >> s; for (int i = 0; i < n; i++) { if (s[i] - '0' == 8) e8++; } if (e8 < ans) ans = e8; cout << ans << endl; return 0; }
7
CPP
n = int(input()) s = input() def count(str): k=0 for i in str: if i =='8': k+=1 return k if count(s)==0: print(0) else: if (n//11)>=count(s): print(count(s)) else: print(n//11)
7
PYTHON3
n = int(input()) str = input() num = int(n//11) for i in range(len(str)): n8 = str.count(f"{8}") min = min(num,n8) print(min)
7
PYTHON3
count = int(input()) digits = input() max_8 = digits.count('8') max_dig = int(count/11) print (min(max_8, max_dig))
7
PYTHON3
n = int(input()) s = input() c8 = s.count('8') re = n-c8 t = n//11 print(min(c8,t))
7
PYTHON3
n = int(input()) s = input() ctx=s.count('8') ans=0 if ctx>0: possi = n // 11 ans = min (ctx,possi) print(ans)
7
PYTHON3
n=int(input()) ch=input() x=n//11 y=ch.count('8') if y>=x: print(x) else: print(y)
7
PYTHON3
n = int(input()) ; num = input() a = n // 11 ; b = 0 ; p = 0 while p < len(num): x = num[p] if x == '8': b += 1 p += 1 if b == 0: print(0) else: if a > b: print(b) else: print(a)
7
PYTHON3
def ii(): return int(input()) def mi(): return map(int, input().split()) def li(): return list(mi()) n = ii() s = input().strip() eight = s.count('8') rem = len(s) - eight cnt, extra = divmod(rem, 10) if eight <= cnt: ans = eight else: ans = cnt eight -= cnt if eight + extra >= 11: ans += 1 eight -= 11 - extra ans += eight // 11 print(ans)
7
PYTHON3
count=0 n=int(input()) number=str(input()) for i in range(n): if (number[i]=="8"): count+=1; if (n//11 > count): print(count); else: print(n//11)
7
PYTHON3
# your code goes here n = int(input()) s = input() print(min(n//11, s.count('8')))
7
PYTHON3
a=int(input()) b=input() print(min(b.count('8'),(a)//11))
7
PYTHON3
n=int(input()) a=input() b=list(map(int,list(str(a)))) import itertools if 8 not in b or n<11:print(0);exit() l=b.count(8) l1=n//11 print(min(l,l1))
7
PYTHON3
#include <bits/stdc++.h> using namespace std; int main() { int n, t = 0; cin >> n; string s; cin >> s; for (int i = 0; i < n; i++) { if (s[i] == '8') t++; } if (n >= 11 && t > 0) cout << min(t, n / 11); else cout << 0; }
7
CPP
n = int(input()) s = input() eight = s.count("8") if eight == n: ans=eight//11 print(ans) else: all_except_eight = n-eight tmp = all_except_eight//10 remaining=all_except_eight%10 ans=0 if eight>=tmp: ans=tmp eight-=tmp if eight==0: print(ans) else: if remaining+eight>=11: ans+=1 eight-=(11-remaining) if eight>=0: ans+=eight//11 print(ans) else: print(eight)
7
PYTHON3
n=int(input()) s=input().rstrip() x=list(s) l=[] i=0; Y=0; while(i<len(x)): if x[i]=='8': l.append(x[i]) del(x[i]) else: i+=1; if len(l)==0: print(0) else: while(1): if len(l)==0 or len(x)+len(l)<10: break; else: del(l[0]) if len(x)+len(l)<10: break; elif len(x)>=10: for i in range(0,10): del(x[0]) Y+=1; elif len(x)<10 and len(l)+len(x)>=10: G=len(x) for i in range(0,len(x)): del(x[0]) t=11-G-1 for i in range(0,t): del(l[0]) Y+=1; else: break; print(Y)
7
PYTHON3
#include <bits/stdc++.h> using namespace std; int main() { int i, j, k, cnt, n; string s; cin >> n >> s; cnt = 0; for (i = 0; s[i]; i++) { if (s[i] == '8') cnt++; } k = n / 11; k = (k < cnt) ? k : cnt; cout << k << endl; return 0; }
7
CPP
n = int(input()) if n != 0: s = input() else: s = '' k = s.count('8') count = n // 11 print(min(k, count))
7
PYTHON3
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; string st; cin >> st; map<int, int> mp; for (int i = 0; i < n; i++) { mp[(int)st[i] - 48]++; } if (mp[8] == 0) { cout << 0 << endl; return 0; } int s = 0, e = mp[8]; for (int i = 0; i < 10; i++) s += mp[i]; s /= 11; if (e >= s) cout << s << endl; else cout << e << endl; return 0; }
7
CPP
n=int(input()) s=input() k1=0 k2=0 if '8' in s and n>10: k1=s.count('8') k2=n//11 print(min(k1,k2)) else: print(0)
7
PYTHON3
def main(): n = int(input()) s = input() cnt = 0 for i in s: if i == '8': cnt += 1 print(min(cnt, n // 11)) main()
7
PYTHON3
try: n=int(input()) s=input() l=list(s) x=int(n/11) if l.count("8")>=x: print(x) elif l.count("8")==0: print("0") else: print(l.count("8")) except EOFError: pass
7
PYTHON3
def solve(n, s): x = s.count(8) m = len(s)//11 return min(m, x) def main(): n = int(input()) s = list(map(int, input())) print(solve(n, s)) main()
7
PYTHON3
n=int(input()) z=input() sol=0 k=z.count('8') while n>=11 and k>=1: if n>=11 and k>=1: sol+=1 k-=1 n-=11 else: break print(sol)
7
PYTHON3
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(NULL); int n, cnt = 0; char c; cin >> n; for (int i = 0; i < n; i++) { cin >> c; if (c == '8') cnt++; } cout << min(cnt, (n - (n / 10)) / 10) << "\n"; return 0; }
7
CPP
#include <bits/stdc++.h> using namespace std; int n; char a[105]; int main(void) { int x = 0; cin >> n; for (int i = 1; i <= n; i++) { cin >> a[i]; if (a[i] == '8') x++; } cout << min(x, n / 11) << endl; return 0; }
7
CPP
n = int(input()) s = input() maxnum = n//11 eights = 0 for i in range(0,n): if s[i] == '8': eights += 1 if maxnum<eights: print(maxnum) else: print(eights)
7
PYTHON3
def rahul(string): return[char for char in string] a=int(input()) b=rahul(input()) print(min((a//11),b.count('8')))
7
PYTHON3
n=int(input()) s = input() l=[] for i in range(len(s)): l.append(int(s[i])) #print(l) cnt = l.count(8) dcnt = int(n/11) #print(cnt,dcnt) if(dcnt==0 or cnt==0): print(0) elif(dcnt!=0 and cnt!=0): print(min(dcnt,cnt)) elif(dcnt==0 and cnt!=0): print(0) else: print(0)
7
PYTHON3
n = int(input()) s = input() a = [0] * 10 m = 0 for i in range(n): a[int(s[i])-1] += 1 x = a[7] s = sum(a)//11 print(min(x,s))
7
PYTHON3
#!/usr/bin/env python3 strlen = int(input()) eights = strlen - len(input().replace('8', '')) strlen -= eights res = 0 while True: if strlen >= 10 and eights > 0: res += 1 strlen -= 10 eights -= 1 elif strlen + eights >= 11 and eights > 0: res += 1 eights -= 11 - strlen strlen = 0 else: break print(res)
7
PYTHON3
n = int(input()) c = sum(map(lambda x: x == '8', input())) print(min(n//11, c))
7
PYTHON3
n = int(input()) s = input() eight = s.count('8') notEight = n - eight res = 0 for i in range(1, eight + 1): res = max(min(i, (notEight + eight - i) // 10), res) print(res)
7
PYTHON3
dat = [0] * 10 n = int(input()) s = input() num8 = s.count("8") print(min(num8, n // 11))
7
PYTHON3
n = int(input()) l = input() N = 0 for x in l: if x == '8': N += 1 n //= 11 n = min(N, n) print (n)
7
PYTHON3
import sys # from copy import deepcopy def main(): inp = sys.stdin.readlines() amount_of_no = int(inp[0]) string_of_no = str(inp[1]).strip() if amount_of_no < 11 \ or not string_of_no.\ __contains__("8"): print(0) return number_of_8 = string_of_no.count("8") no_set = set() no_list = [x for x in string_of_no] possibilities_len = int(len(no_list) / 11) possibilities_8 = number_of_8 possibilities = min(possibilities_8, possibilities_len) print(possibilities) main()
7
PYTHON3
if __name__ == '__main__': n= int(input()) ss= input() numbers= n// 11 #print('numbers: '+str(numbers)) count= 0 while('8' in ss): index= ss.index('8') ss= ss[:index]+ ss[index+1:] count+= 1 #print('index: '+str(index)+' count: '+str(count)+' ss: '+str(ss)) print(min(numbers, count))
7
PYTHON3
n = int(input()) if n < 11: print(0) else: ss = input() count = 0 for i in range(0, n): if int(ss[i]) == 8: count += 1 temp = n // 11 if temp < count: print(temp) else: print(count)
7
PYTHON3
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; string s; cin >> s; int cnt8 = 0; for (int i = 0; i <= n - 1; i++) { if (s[i] == '8') cnt8++; } int left = n; int cnt = 0; while (cnt8) { if (left >= 11) { left -= 11; cnt8 -= 1; cnt++; } else break; } cout << cnt << "\n"; return 0; }
7
CPP
n = int(input()) s = input() eight, other = 0, 0 for i in range(len(s)): if s[i] == '8': eight += 1 else: other += 1 res = 0 for i in range(1, 100): if i <= eight and (eight - i + other) >= i*10: res = i else: break print(res)
7
PYTHON3
def count8(x): return str(x).count("8") n = int(input()) s = input() c8 = count8(s) bolum = n // 11 if c8 >= bolum: print(bolum) else: print(c8)
7
PYTHON3
n=int(input()) m=input() p=0 for i in range (len(m)): if m[i]=='8' and n>=(p+1)*11: p=p+1 else: p=p print(p)
7
PYTHON3
#include <bits/stdc++.h> int main() { int n, eight = 0, m, i; char a[100]; scanf("%d", &n); scanf("%s", &a); m = n / 11; for (i = 0; i < n; i++) { if (a[i] == '8') { eight++; } } if (eight <= m) { printf("%d", eight); } else { printf("%d", m); } return 0; }
7
CPP
n = int(input()) num = input() if n%11<=11 and '8' in num: if num.count('8')<=n//11: print(num.count('8')) else: print(n//11) else: print(0)
7
PYTHON3
n, s = int(input()), input() e = s.count('8') m = 0 for i in range(e+1): m = max(m, min(i, (n-i)//10)) print(m)
7
PYTHON3
import collections n=int(input()) m=input() L=list(m) e=L.count('8') if ((e==0)or (n<11)) : print(0) else : print (min((n//11),e))
7
PYTHON3
""" instagram : essipoortahmasb2018 telegram channel : essi_python """ n = int(input()) s = input() a = s.count("8") #number of 8 if a==0: print(0) exit() nn = n - a # number of digit without 8 b = a*10 if b <= nn: print(a) else: h = nn // 10 #number of code with one 8 h+=((nn%10)+(a-h))//11 print(h) #097167815527663544905782574817314139311067328533970663873718450545467450059059869618211361469505108 #88202862851852449384524888870888714570989458744869886984687883814173328428889281886888876411321949560 #1976473621569903172721407763737179639055561746310369779167351419713916160700096173622427077757986026
7
PYTHON3
#include <bits/stdc++.h> using namespace std; char a[110]; int main() { int n; scanf("%d", &n); cin >> a; int t = n / 11; int m = 0; for (int i = 0; i < n; i++) { if (a[i] == '8') m++; } t = min(t, m); printf("%d", t); return 0; }
7
CPP
nbCards = int(input()) cards = input() eights = 0 otherDigits = 0 for card in cards: if card == "8": eights += 1 else: otherDigits += 1 nbNumbers = 0 for loop in range(eights): toTake = min(10, otherDigits) taken = toTake otherDigits -= toTake if toTake != 10: toTake = min(10-toTake, eights-1) eights -= toTake taken += toTake if taken == 10: eights -= 1 nbNumbers += 1 else: break print(nbNumbers)
7
PYTHON3
n = int(input()) l = input() a = len(l)%11 p = len(l)-a if n<11: print(0) else: for i in range(p): if l.count("8")>=p//11: print(p//11) break elif l.count("8")<p//11: print(l.count("8")) break else:print(0) break
7
PYTHON3
def test(n, string): eight = string.count('8') n = n //11 if eight >= n: return n else: return eight print(test(int(input()), input()))
7
PYTHON3
n = int(input()) tel_str = input() print(min(tel_str.count('8'), n // 11))
7
PYTHON3
n = int(input()) digits = input() num_eights = sum(1 for x in digits if x == '8') num_not_eights = len(digits) - num_eights num_phones = None while True: num_phones = min(num_eights, num_not_eights // 10) if num_eights > num_phones: num_eights -= 1 num_not_eights += 1 else: break print(num_phones)
7
PYTHON3
#include <bits/stdc++.h> using namespace std; int main() { int n; scanf("%d", &n); int cnt = 0; getchar(); for (int i = 1; i <= n; i++) { char c; scanf("%c", &c); if (c == '8') cnt++; } printf("%d\n", min(cnt, n / 11)); return 0; }
7
CPP
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cout.tie(0); cin.tie(0); int n, i, j, k, x, y, z; string s; cin >> n >> s; x = 0; for (i = 0; s[i]; ++i) x += (s[i] == '8'); cout << min(x, n / 11) << endl; return 0; }
7
CPP
n = int(input()) s = input() k = 0 for i in s: if i == "8": k += 1 print(min(n // 11, k))
7
PYTHON3
n=int(input()) c=n//11 s=input() x=s.count('8') print(min(c,x))
7
PYTHON3
#include <bits/stdc++.h> int n, cnt, len; char c[10001]; int main() { scanf("%d", &n); while ((c[0] = getchar()) < 32 || c[0] > 126) ; while ((c[++len] = getchar()) >= 32 && c[len] <= 126) ; for (int i = 0; i <= n; i++) if (c[i] == '8') cnt++; printf("%d", (n / 11 < cnt ? n / 11 : cnt)); }
7
CPP
""" β–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘ β•šβ•β•β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•”β•β–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•— β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β–ˆβ–ˆβ•‘β•šβ–ˆβ–ˆβ•‘β•šβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•”β•β•β•β• β–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘ β•šβ•β•β•β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β•šβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β•šβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β• β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β• β•šβ•β• β•šβ•β•β•β•β•β• β•šβ•β• β•šβ•β•β•β•β•β•β• β•šβ•β•β•β•β•β• β•šβ•β• β•šβ•β•β•β•β• """ __author__ = "Dilshod" n = int(input()) s = input() a = n // 11 b = s.count("8") if b >= a: print(a) elif b == 0 or a == 0: print(0) elif b < a: print(b)
7
PYTHON3
n=int(input()) s=input() c=s.count('8') print(min(c//1,n//11))
7
PYTHON3
#include <bits/stdc++.h> const long long inf = 1e9 + 7; using namespace std; long long read() { long long x = 0, f = 1; char ch = getchar(); while (!isdigit(ch)) { if (ch == '-') f = -1; ch = getchar(); } while (isdigit(ch)) x = x * 10 + ch - '0', ch = getchar(); return f * x; } int n, k; char s[100005]; int main() { n = read(); scanf("%s", s + 1); for (int i = 1; i <= n; i++) if (s[i] == '8') k++; n -= k; if (k < n / 10) printf("%d\n", k); else printf("%d\n", (k + n) / 11); return 0; }
7
CPP
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); const int sz = 11; const char start = '8'; int n; string s; cin >> n >> s; int cnt = n, cntStart = 0; for (int i = 0; i < n; i++) { if (s[i] == start) { cntStart++; } } long long ans = 0; while (cntStart > 0 && cnt >= sz) { cntStart--; cnt -= sz; ans++; } cout << ans << endl; }
7
CPP
n = int(input()) num = input() # print(num) if '8' not in num: print(0) else: print(min(num.count('8') , n//11))
7
PYTHON3
# coding: utf-8 # In[9]: import collections n = int(input()) s = input() c= collections.Counter(s) print(min(c['8'], len(s)//11))
7
PYTHON3
a = int(input("")) b = input("") occurences_of_eight = 0 for i in range(len(b)): if b[i] == "8": occurences_of_eight = occurences_of_eight + 1 max_phone_numbers = int(len(b) / 11) print(min(occurences_of_eight, max_phone_numbers))
7
PYTHON3
n= int (input()) str = input() solution=0 eights= str.count("8") Num=n//11 while n>=11 and eights >0: if n>=11 and eights >0: solution += 1 eights-=1 if Num==solution: break else: break print (solution)
7
PYTHON3
n = int(input()) s = input() print(min(n//11, s.count("8")))
7
PYTHON3
#include <bits/stdc++.h> using namespace std; int n, l; string s; int main() { cin >> n >> s; for (int i = 0; i < s.size(); i++) if (s[i] == '8') l++; cout << min(n / 11, l); }
7
CPP
from collections import defaultdict, deque from heapq import heappush, heappop from math import inf ri = lambda : map(int, input().split()) def solve(): n = int(input()) s = input() eights = 0 for c in s: if c == "8": eights += 1 print(min(eights, n // 11)) t = 1 #t = int(input()) while t: t -= 1 solve()
7
PYTHON3
#include <bits/stdc++.h> using namespace std; int main() { int n, i, ret = 0, count = 0; char s[10000]; cin >> n; getchar(); scanf("%s", s); for (i = 0; i < n; i++) { if (s[i] == '8') { ret = 1; count++; } } if (ret == 0 || n < 11) cout << "0"; else { for (i = count; i >= 1; i--) { if ((n - i) >= 10 * i) { cout << i; break; } } } return 0; }
7
CPP
#include <bits/stdc++.h> using namespace std; int main() { int n, count = 0; cin >> n; string s; cin >> s; for (int i = 0; i < n; i++) { if (s[i] == '8') { count++; } } if (n < 11 || count == 0) { cout << 0 << endl; } else { cout << min(n / 11, count) << endl; } return 0; }
7
CPP
#include <bits/stdc++.h> using namespace std; int main() { int n, a = 0, i; cin >> n; char ch[n + 5]; for (i = 0; i < n; i++) { cin >> ch[i]; if (ch[i] == '8') a++; } cout << min(a, n / 11) << endl; return 0; }
7
CPP
n=int(input()) s=input() e=s.count("8") if(e<1): print(0) else: k=len(s)//11 print(min(k,e))
7
PYTHON3
def solve(): n = int(input()) digits = input() c = digits.count("8") if c < 1 or n < 11: return 0 return min(c, n // 11) print (solve())
7
PYTHON3
#include <bits/stdc++.h> using namespace std; const long long MOD = 1000000007; const long long INF = 1000000000; template <class T> T read(T &x) { char c; int flag = 1; while ((c = getchar()) < '0' || c > '9') if (c == '-') flag *= -1; x = c - '0'; while ((c = getchar()) >= '0' && c <= '9') x = x * 10 + c - '0'; x *= flag; return x; } int freq[10]; int main() { ios::sync_with_stdio(false); cin.tie(0); int n; cin >> n; for (int i = 0; i < n; ++i) { char x; cin >> x; freq[x - 48]++; } cout << min(n / 11, freq[8]) << endl; }
7
CPP
#include <bits/stdc++.h> using namespace std; int day[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; struct edge { int to, cost; }; bool isupper(char c) { if ('A' <= c && c <= 'Z') return 1; return 0; } bool islower(char c) { if ('a' <= c && c <= 'z') return 1; return 0; } bool isPrime(int x) { if (x == 1) return 0; if (x == 2) return 1; if (x % 2 == 0) return 0; for (int i = 3; i * i <= x; i++) if (x % i == 0) return 0; return 1; } bool iskaibun(string s) { for (int i = 0; i < s.size() / 2; i++) if (s[i] != s[s.size() - i - 1]) return 0; return 1; } bool isnumber(char c) { return ('0' <= c && c <= '9'); } bool isalpha(char c) { return (isupper(c) || islower(c)); } void printvi(vector<int> v) { for (int i = (int)0; i < (int)v.size(); i++) { if (i) cout << " "; cout << v[i]; } cout << endl; } void printvil(vector<int> v) { for (int i = (int)0; i < (int)v.size(); i++) { cout << v[i] << endl; } } void printvvi(vector<vector<int>> v) { for (int i = (int)0; i < (int)v.size(); i++) { for (int j = (int)0; j < (int)v[i].size(); j++) { if (j) cout << " "; cout << v[i][j]; } cout << endl; } } void printvstr(vector<string> v) { for (int i = (int)0; i < (int)v.size(); i++) { cout << v[i] << endl; } } int gcd(int a, int b) { if (b == 0) return a; else return gcd(b, a % b); } struct S { int idx, value; }; signed main() { int n; cin >> n; string s; cin >> s; int v[20] = {0}; for (int i = (int)0; i < (int)n; i++) { v[s[i] - '0']++; } int ans = v[8]; int anss = 0; for (int i = (int)1; i < (int)ans + 1; i++) { if ((n - i) / 10 >= i) anss = i; } cout << anss << endl; }
7
CPP
n=int(input()) p=input() a=[] for i in range(n): a.append(int(p[i])) x=a.count(8) y=(len(a))//11 print(min(x,y))
7
PYTHON3
n = input() s = input() n = int(n) inp = [] length = len(s) for i in range(0, length): inp.append(int(s[i])) count = inp.count(8) from math import * total = floor(length/11) if total < count: print(total, end='') else: print(count, end='')
7
PYTHON3
#include <bits/stdc++.h> using namespace std; int main() { int n; string s; cin >> n >> s; int cnt = 0; for (int i = 0; s[i]; i++) { if (s[i] == '8') cnt++; } cout << min(cnt, (int)s.size() / 11) << endl; }
7
CPP
n=int(input()) s=input() a=s.count('8') print(min(a,n//11))
7
PYTHON3
#include <bits/stdc++.h> using namespace std; int main() { char s[101]; int n, i, sum8 = 0, sum = 0, total = 0; cin >> n; cin >> s; for (i = 0; i < n; i++) { if (s[i] == '8') sum8++; sum++; } if (sum8 >= sum / 11) total = sum / 11; else total = sum8; cout << total << endl; return 0; }
7
CPP
n = int(input()) phone = input() count = 0 for i in range(n): if (phone[i] == '8'): count += 1 print(int(min(count, n / 11)))
7
PYTHON3
n=int(input()) s=input() a=s.count('8') b=int(n/11) print(min(a,b))
7
PYTHON3
while True: try: n = int(input()) a = input() b = a.count('8') ans = min(b,n//11) print(int(ans)) except: break
7
PYTHON3
n = int(input()) str = input() print(min(str.count('8'),n // 11))
7
PYTHON3
#include <bits/stdc++.h> using namespace std; const long long mod = 1e9 + 7; const int MAX = 100005; long long modexp(long long x, long long n) { if (n == 0) return 1LL; if (n % 2 == 0) { long long y = modexp(x, n / 2) % mod; return (y * y) % mod; } return (x * modexp(x, n - 1) % mod) % mod; } long long powr(long long x, long long n) { long long ans = 1; for (int i = 1; i <= n; i++) ans = ans * x; return ans; } int main() { int n; scanf("%d", &n); string s; cin >> s; int f[10] = {0}; for (int i = 0; i < n; i++) { f[s[i] - '0']++; } int ans = 0; while (f[8]) { int len = 1; f[8]--; for (int i = 0; i < 10; i++) { if (i == 8 || f[i] == 0) continue; if (f[i] < (11 - len)) { len += f[i]; f[i] = 0; } else { f[i] -= (11 - len); len = 11; break; } } if (len == 11) ans++; else if (f[8] >= (11 - len)) { f[8] -= (11 - len); ans++; } else break; } printf("%d\n", ans); return 0; }
7
CPP
n=int(input()) a=str(input()) a1=n//11 s=a.count("8") print(min(a1,s))
7
PYTHON3