Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p02996 (python)

Fixed submission:
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

def LI(): return list(map(int, sys.stdin.readline().split()))

N = int(input())
BA = [[] for i in range(N)]
for i in range(N):
    A,B = LI()
    BA[i] = [B,A]


BA.sort()
part_A = [0 for i in range(N)]
for i in range(N):
    B,A = BA[i]
    part_A[i] = A + part_A[i-1]

for i in range(N):
    B,A = BA[i]
    if B - part_A[i]>= 0:
        pass
    else:
        print("No")
        break
else:
    print("Yes")

Buggy submission (verdict: Runtime Error):
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

def LI(): return list(map(int, sys.stdin.readline().split()))

N = int(input())
BA = [[] for i in range(N)]
for i in range(N):
    a,b = LI()
    BA[i] = (b,a)

BA.sort()

part_A = [0 for i in range(N)]
tmp  = 0
for i in range(N):
    b,a = BA[i]
    tmp += a
    if B - tmp < 0:
        print("No")
        break
else:
    print("Yes")

Buggy submission (verdict: Runtime Error):
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

def LI(): return list(map(int, sys.stdin.readline().split()))

N = int(input())
BA = [[] for i in range(N)]
for i in range(N):
    a,b = LI()
    BA[i] = (b,a)

BA.sort()
part_A = [0 for i in range(N)]
for i in range(N):
    B,A = BA[i]
    part_A[i] = A + part_A[i-1]

for i in range(N):
    B,A = BA[i]
    if B - part_A < 0:
        print("No")
        break
else:
    print("Yes")
Problem p03006 (python)

Fixed submission:
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys
import numpy as np

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

N = int(input())
xy = [[] for i in range(N)]
for i in range(N):
    xy[i] = [int(i) for i in input().split()]

xy = np.array(xy)

count_dic = {}
for i in range(N):
    for j in range(i+1,N):
        diff = xy[i] - xy[j]
        p,q = diff
        if p == 0 and q == 0:
            pass
        else:
            p = int(p)
            q = int(q)
            pq = str(p)+str(q)
            pq2 = str(-p)+str(-q)
            if pq in count_dic:
                count_dic[pq] += 1
            else:
                count_dic[pq] = 1
            if pq2 in count_dic:
                count_dic[pq2] += 1
            else:
                count_dic[pq2] = 1
# print(count_dic)
ans = 1
for k,v in sorted(count_dic.items(), key = lambda x:-x[1]):
    ans = N - v
    break
print(max(1,ans))

Buggy submission (verdict: Runtime Error):
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys
import numpy as np

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

N = int(input())
xy = [[] for i in range(N)]
for i in range(N):
    xy[i] = [int(i) for i in input().split()]

xy = np.array(xy)

count_dic = {}
for i in range(N):
    for j in range(i+1,N):
        diff = xy[i] - xy[j]
        p,q = diff
        pq = str(p)+str(q)
        if pq in count_dic:
            count_dic[pq] += 1
        else:
            count_dic[pq] = 1

for k,v in sorted(count_dic.items(), key = lambda x:x[-1]):
    ans = N - v - 1
    break
print(max(1,ans))
Problem p03106 (python)

Fixed submission:
# encoding:utf-8
import copy
import numpy as np
import random


a,b,k = map(int,input().split())

cds = []
for i in range(1,min(a,b)+1):
    if ((a%i==0) and (b%i==0)):
        cds.append(i)

cds.reverse()
print(cds[k-1])

Buggy submission (verdict: Runtime Error):
# encoding:utf-8
import copy
import numpy as np
import random
import pandas as pd
import torch

a,b,k = map(int,input().split())

cds = []
for i in range(1,min(a,b)+1):
    if a%i==0 and b%i==0:
        cds.append(i)

cds.reverse()
print(cds[k-1])
Problem p03131 (python)

Fixed submission:
# encoding:utf-8

import copy
import numpy as np
import random

k,a,b = map(int,input().split())

cookie = 1

if b-a < 2:
    cookie += k

else:
    k -= (a-cookie)
    cookie = a

    cookie += (k//2)*(b-a)

    if k % 2 == 1:
        cookie += 1
    else:
        pass

print(cookie)

Buggy submission (verdict: Runtime Error):
# encoding:utf-8

import copy
import numpy as np
import random

a = []
b = []

for i in range(3):
    a_now,b_now = map(int, input().split())
    a.append(a_now)
    b.append(b_now)

town_dic = {1:0,2:0,3:0,4:0}

for i in range(3):
    town_dic[a[i]] += 1
    town_dic[b[i]] += 1

answer = "YES"
for i in range(4):
    if town_dic[i+1] == 3:
        answer = "NO"


print(answer)
Problem p03192 (python)

Fixed submission:
#encoding:utf-8

n = list(input())

count = 0
for i in range(4):
    if n[i] == "2":
        count += 1


print(count)

Buggy submission (verdict: Runtime Error):
#encoding:utf-8

import math

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

def factorint(N):
    table = {}
    while(N > 1):
        for i in range(2,N+1):
            if N%i == 0:
                while N%i == 0:
                    N = N//i
                    if i in table.keys():
                        table[i] += 1
                    else:
                        table[i] = 1
                break
    return table
ans = 1
if N == 1:
    ans = P
elif 1 < N < 40:
    #Nが２以上なのでpをｓｑｒｔしても良い
    facters = factorint(P)
    # print(facters)

    ans = 1
    for key in facters.keys():
        if facters[key]/N >= 1:
            ans *= key**(facters[key]//N)
else:
    pass

print(int(ans))
# print(type(ans))
Problem p03194 (python)

Fixed submission:
#encoding:utf-8

import math

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

def factorint(N):
    table = {}
    while(N > 1):
        for i in range(2,N+1):
            if N%i == 0:
                while N%i == 0:
                    N = N//i
                    if i in table.keys():
                        table[i] += 1
                    else:
                        table[i] = 1
                break
    return table

ans = 1
if N == 1:
    ans = P
elif 1 < N < 40:
    for i in range(2,round(P**(1/N))+1):
        if P % i**N == 0:
            ans = i

else:
    pass

print(int(ans))
# print(type(ans))

Buggy submission (verdict: Runtime Error):
#encoding:utf-8

import math
import sympy

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

facters = sympy.factorint(P)

ans = 1
for key in facters.keys():
    if facters[key]/N >= 1:
        ans *= key**(facters[key]//N)
print(ans)

Buggy submission (verdict: Runtime Error):
#encoding:utf-8

import math
import sympy

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

facters = sympy.factorint(P)

ans = 1
for key in facters.keys():
    if facters[key]/N >= 1:
        ans *= key**(facters[key]//N)

print(ans)
Problem p03238 (python)

Fixed submission:
#encoding utf-8

n = int(input())


if n == 1:
    print("Hello World")

elif n == 2:
    a = int(input())
    b = int(input())
    print(a+b)

Buggy submission (verdict: Runtime Error):
#encoding utf-8

n = int(input())
data = []
for i in range(n):
    x,y,h=map(int,input().split())
    data.append([x,y,h])

def calH(cx,cy,data):
    return data[2]+abs(data[0]-cx)+abs(data[1]-cy)

def conh(temH,cx,cy,data):
    return temH-abs(data[0]-cx)-abs(data[1]-cy)


for i in range(101):
    for j in range(101):
        clear = 0
        count = 0
        for k in range(n):
            if clear == 0:
                temH = calH(i,j,data[k])
                if data[k][2] != 0:
                    clear = 1
                else:
                    if conh(temH,i,j,data[k]) < 0:
                        count += 1
                    else:
                        count += 1
                        clear = 1

        for k in range(count,n):
            print(k)
            ignore_flag = 0
            if data[k][2] == 0:
                if conh(temH,i,j,data[k]) < 0:
                    ignore_flag = 1
                    count += 1

            if ignore_flag == 0:
                if calH(i,j,data[k]) != temH:
                    break
                else:
                    count += 1
            if count == n:
                answer=[i,j,calH(i,j,data[0])]

print(answer[0],answer[1],answer[2])

Buggy submission (verdict: Runtime Error):
#encoding utf-8

n = int(input())
data = []
for i in range(n):
    x,y,h=map(int,input().split())
    data.append([x,y,h])

def calH(cx,cy,data):
    return data[2]+abs(data[0]-cx)+abs(data[1]-cy)

def conh(temH,cx,cy,data):
    return temH-abs(data[0]-cx)-abs(data[1]-cy)


for i in range(101):
    for j in range(101):
        clear = 0
        count = 0
        for k in range(n):
            if clear == 0:
                temH = calH(i,j,data[k])
                if data[k][2] != 0:
                    clear = 1
                else:
                    if conh(temH,i,j,data[k]) < 0:
                        count += 1
                    else:
                        count += 1
                        clear = 1

        for k in range(count,n):
            print(k)
            ignore_flag = 0
            if data[k][2] == 0:
                if conh(temH,i,j,data[k]) < 0:
                    ignore_flag = 1
                    count += 1

            if ignore_flag == 0:
                if calH(i,j,data[k]) != temH:
                    break
                else:
                    count += 1
            if count == n:
                answer=[i,j,calH(i,j,data[0])]

print(answer[0],answer[1],answer[2])
Problem p03260 (python)

Fixed submission:
a,b = map(int, input().split())

if a*b%2 == 0:
  print("No")

else:
  print("Yes")

Buggy submission (verdict: Runtime Error):
a,b = int(input().split())

if a*b%2 == 0:
	print("No")
  
else:
	print("Yes")

Buggy submission (verdict: Runtime Error):
a,b = int(input().split())


if a*b%2 == 0:
  print("No")
  
else:
  print("Yes")
Problem p03262 (python)

Fixed submission:
#encoding utf-8

import math
from functools import reduce

#複数の最大コゥ約数
def gcd(a,b):
    l = max(a,b)
    m = min(a,b)
    while m != 0:
        extra = l%m
        l = m
        m = extra
    return l

def gcd_multi(numbers):
    return reduce(gcd,numbers)

n,X = map(int, input().split())

x = [int(i) for i in input().split()]

x.append(X)

x.sort()

minus=[]

for i in range(len(x)-1):
    minus.append(x[i+1]-x[i])


D = gcd_multi(minus)

print(int(D))

Buggy submission (verdict: Runtime Error):
#encoding utf-8

import math
from functools import reduce

#複数の最大コゥ約数
def gcd(numbers):
    return reduce(math.gcd, numbers)

n,X = map(int, input().split())

x = [int(i) for i in input().split()]

x.append(X)

x.sort()

minus=[]

for i in range(len(x)-1):
    minus.append(x[i+1]-x[i])

D = gcd(minus)

print(int(D))

Buggy submission (verdict: Runtime Error):
#encoding utf-8

import math
from functools import reduce


#複数の最大コゥ約数
def gcd(numbers):
    return reduce(math.gcd, numbers)

n,X = map(int, input().split())

x = [int(i) for i in input().split()]

x.append(X)

x.sort()

minus=[]

for i in range(len(x)-1):
    minus.append(x[i+1]-x[i])

D = gcd(minus)

print(int(D))

Buggy submission (verdict: Runtime Error):
#encoding utf-8

import math
from functools import reduce


#複数の最大コゥ約数
def gcd(numbers):
    return reduce(math.gcd, numbers)

n,X = map(int, input().split())

x = [int(i) for i in input().split()]

x.append(X)

x.sort()

minus=[]

for i in range(len(x)-1):
    minus.append(x[i+1]-x[i])

D = gcd(minus)

print(D)

Buggy submission (verdict: Runtime Error):
#encoding utf-8

import math
from functools import reduce


#複数の最大コゥ約数
def gcd(numbers):
    return reduce(math.gcd, numbers)

n,X = map(int, input().split())

x = [int(i) for i in input().split()]

x.append(X)

x.sort()

minus=[]
for i in range(len(x)-1):
    minus.append(x[i+1]-x[i])

D = gcd(minus)

print(D)
Problem p03274 (python)

Fixed submission:
#encoding utf 8

n, k = map(int, input().split())

pos = list(int(i) for i in input().split())

ans = abs(pos[0])+abs(pos[0]-pos[k-1])

for i in range(n-k+1):
    val = 0
    val += abs(pos[i] - pos[i+k-1])
    val += min(abs(pos[i]), abs(pos[i+k-1]))

    if val < ans:
        ans = val
print(ans)

Buggy submission (verdict: Runtime Error):
# encoding utf-8

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

x = list(int(i) for i in input().split())


for i in range(N):
    if 0 <= x[i]:
        border = i
        break

len_run = 100000

if border == 0:
    len_run = min(abs(x[K-1]), len_run)

if border == N-1:
    len_run = min(abs(x[N-K]), len_run)

for i in range(K):
    if border-K+i >= 0 and border+i <= N:
        len_run = min(abs(2*x[border-K+i])+abs(x[border+i-1]), len_run)
        len_run = min(abs(x[border-K+i])+abs(2*x[border+i-1]), len_run)

print(len_run)













# #最終的に右に進む
# def right(K):
#     runlen = 0
#     y = x_pos
#     for i in range(len(x_neg)):
#         y.append(x_neg[i]*(-2))
#     y.sort()
#     max = y[K-1]
#     if max in x_pos:
#         runlen += max
#         y_neg = [i for i in x_neg if i >= (-max)/2]
#         runlen += y_neg[-1]*-2
#     else:
#         runlen += max/2
#         y_pos = [i for i in x_pos if i <= max]
#         runlen += y_pos[-1]
#     return runlen
#
#
# def left(K):
#     runlen = 0
#     z = []
#     for j in range(len(x_neg)):
#         z.append(x_neg[j]*-1)
#     for i in range(len(x_pos)):
#         z.append(x_pos[i]*(2))
#     z.sort()
#     max = -z[K-1]
#     if max in x_neg:
#         runlen -= max
#         z_pos = [i for i in x_pos if i <= (-max)/2]
#         runlen += z_pos[-1]*2
#     else:
#         runlen -= max/2
#         z_neg = [i for i in x_neg if i <= -max]
#         runlen += z_neg[-1]
#     return runlen
#
# if len(x_neg) == 0:
#     runlen = x[K-1]
# elif len(x_pos) == 0:
#     x.sort().reverse()
#     runlen = x[K-1]
# else:
#     runlen = min(right(K),left(K))
#     print(right(K),left(K))
#
# print(runlen)
Problem p03280 (python)

Fixed submission:
#encoding utf-8

a, b = map(int, input().split())

area = (a-1)*(b-1)
print(area)

Buggy submission (verdict: Runtime Error):
#encoding utf-8

a = int(input())
b = int(input())

area = (a-1)*(b-1)
print(area)
Problem p03283 (python)

Fixed submission:

N, M, Q = map(int, input().split())
rail = []
for i in range(M):
    r = list(map(int, input().split()))
    rail.append(r)
 
query = []
for i in range(Q):
    q = list(map(int, input().split()))
    query.append(q)
 
f = [[0 for i in range(N)] for j in range(N)]
g = [[0 for i in range(N)] for j in range(N)]
 
for i in range(M):
    f[rail[i][0]-1][rail[i][1]-1] += 1
 
for i in range(N):
    j = 0
    while j + i < N:
        if i == 0:
            g[j][j+i] = f[j][j+i]
        else:
            g[j][j+i] = f[j][j+i] + g[j+1][j+i] + g[j][j+i-1] - g[j+1][j+i-1]
        j += 1
 
for i in range(Q):
    print(g[query[i][0]-1][query[i][1]-1])

Buggy submission (verdict: Runtime Error):
    N, M, Q = map(int, input().split())
    rail = []
    for i in range(M):
        r = list(map(int, input().split()))
        rail.append(r)
     
    query = []
    for i in range(Q):
        q = list(map(int, input().split()))
        query.append(q)
     
    f = [[0 for i in range(N)] for j in range(N)]
    g = [[0 for i in range(N)] for j in range(N)]
     
    for i in range(M):
        f[rail[i][0]-1][rail[i][1]-1] += 1
     
    for i in range(N):
        j = 0
        while j + i < N:
            if i == 0:
                g[j][j+i] = f[j][j+i]
            else:
                g[j][j+i] = f[j][j+i] + g[j+1][j+i] + g[j][j+i-1] - g[j+1][j+i-1]
            j += 1
     
    for i in range(Q):
        print(g[query[i][0]-1][query[i][1]-1])
Problem p03284 (python)

Fixed submission:
#encoding utf-8

n, k = map(int, input().split())

if n % k == 0:
    print("0")
else:
    print("1")

Buggy submission (verdict: Runtime Error):
#encoding utf-8

n, m = map(int, input().split())
a = [int(i)%m for i in input().split()]

count = 0
for i in range(n):
    candy = a[i]
    if candy % m == 0:
        count += 1
    for rest in range(1,n-i):
        candy += a[i+rest]
        if candy % m == 0:
            count += 1

print(count)
Problem p03308 (python)

Fixed submission:
#encoding: utf-8

n = int(input())
A = [int(i) for i in input().split()]
A.sort()
print(A[-1]-A[0])

Buggy submission (verdict: Runtime Error):
n = int(input())
A = [int(i) for i in input().split()]
A=A.sort()
print(A[-1]-A[0])
Problem p03323 (python)

Fixed submission:
#encoding:utf-8

a,b=map(int,input().split())

if a<=8 and b<=8:
    print("Yay!")

else:
    print(":(")

Buggy submission (verdict: Runtime Error):
#encoding:utf-8

a=int(input())
b=int(input())

if a<=8 and b<=8:
    print("Yay!")

else:
    print(":(")
Problem p03324 (python)

Fixed submission:
# encoding:utf-8

import copy
import numpy as np
import random

#n==100の時のコーナーケースに手間取った

d,n = map(int, input().split())
if n == 100:
    print(100**d*101)
    exit()
else:
    print(100**d*n)

Buggy submission (verdict: Runtime Error):
d=int(input())

n=int(input())

r=(100**d)*n

print(r)

Buggy submission (verdict: Runtime Error):
#encoding:utf-8

d=int(input())

n=int(input())

r=(100**d)*n

print(r)
Problem p03353 (python)

Fixed submission:
#encoding utf-8

import copy
import numpy as np
import random


s = list(str(input()))
k = int(input())

substrings = []
for length in range(1,len(s)+1):
    if length > 5:
        break
    for i in range(len(s)-length+1):
        word = "".join(s[i:i+length])
        # print(word)
        if word in substrings:
            pass
        else:
            substrings.append(str(word))

substrings.sort()
# print(substrings)
print(substrings[k-1])

Buggy submission (verdict: Runtime Error):
#encoding utf-8

import copy
import numpy as np
import random


s = list(str(input()))
k = int(input())

substrings = []
for length in range(1,len(s)+1):
    if length >= 5:
        break
    for i in range(len(s)-length+1):
        word = "".join(s[i:i+length])
        # print(word)
        if word in substrings:
            pass
        else:
            substrings.append(str(word))

substrings.sort()
# print(substrings)
print(substrings[k-1])
Problem p03425 (python)

Fixed submission:
#encoding:utf-8

import math
import itertools

n = int(input())
s = []
for i in range(n):
    s.append(str(input()))

chosen_names = {"m":0,"a":0,"r":0,"c":0,"h":0}

for name in s:
    if name[0] == "M":
        chosen_names["m"] += 1
    elif name[0] == "A":
        chosen_names["a"] += 1
    elif name[0] == "R":
        chosen_names["r"] += 1
    elif name[0] == "C":
        chosen_names["c"] += 1
    elif name[0] == "H":
        chosen_names["h"] += 1

answer = 0
capitals = list("march")
capital_set = itertools.combinations(capitals,3)
for capital in capital_set:
    answer += chosen_names[capital[0]] * chosen_names[capital[1]] * chosen_names[capital[2]]


print(answer)



# def combinations_count(n,r):
#     return math.factorial(n) // (math.factorial(r) * math.factorial(n-r))

Buggy submission (verdict: Runtime Error):
#encoding:utf-8

import math
import itertools

n = int(input())
s = []
for i in range(n):
    s.append(str(input()))

chosen_names = {"m":0,"a":0,"r":0,"c":0,"h":0}

for name in s:
    if name[0] == "M":
        chosen_names["m"] += 1
    elif name[0] == "A":
        chosen_names["a"] += 1
    elif name[0] == "R":
        chosen_names["r"] += 1
    elif name[0] == "C":
        chosen_names["c"] += 1
    elif name[0] == "H":
        chosen_names["h"] += 1

answer = 0
capitals = list("march")
capital_set = itertools.com
binations(capitals,3)
for capital in capital_set:
    answer += chosen_names[capital[0]] * chosen_names[capital[1]] * chosen_names[capital[2]]


print(answer)



# def combinations_count(n,r):
#     return math.factorial(n) // (math.factorial(r) * math.factorial(n-r))
Problem p03501 (python)

Fixed submission:
# encoding:utf-8
import copy
import numpy as np
import random

n,a,b = map(int, input().split())


ans = min(b,a*n)

print(ans)

Buggy submission (verdict: Runtime Error):
N,C = map(int,input().split())
tv_times = [[int(j) for j in input().split()] for i in range(N)]

channells = {}
for i in range(C+1):
    channells[i] = []
max_end = -1

for i in range(N):
    s,g,c = tv_times[i]
    max_end = max(max_end,g)
    channells[c] += [s,g]

tv_times = []
f = [0 for i in range(max_end+1)]
for cha in channells.keys():
    remove_list = []
    time = channells[cha]
    for i in range(len(time)//2-1):
        if time[2*i+1] == time[2*i+2]:
            remove_list.append(time[2*i+1])
    time = list(set(time)-set(remove_list))
    time.sort()
    # print(time)
    # print(time)
    # print(f)
    for i in range(len(time)//2):
        f[max(time[2*i]-1,0)] += 1
        f[time[2*i+1]] -= 1

ans = -1
for i in range(1,max_end):
    f[i] += f[i-1]
    if ans < f[i]:
        ans = f[i]

# print(f)
print(ans)
Problem p03503 (python)

Fixed submission:
# encoding:utf-8
import copy
import numpy as np
import random

n = int(input())
F = []
for i in range(n):
    f = [int(i) for i in input().split()]
    F.append(f)



P = []
for i in range(n):
    P.append([int(i) for i in input().split()])

F = np.array(F)
P = np.array(P)


def cal_val(shop_num,open_time):
    same_time = int(np.dot(F[shop_num],open_time.T))
    # print(open_time)
    return P[shop_num,same_time]
#
# def to2digit(i):
#     open_time = np.zeros([10])
#     for count in range(10):
#         if i%2==1:
#             open_time[count] = 1
#         i = i//2
#     return open_time



values = []
ans = -10**10
for i in range(1,2**10):
    open_time = np.zeros([10])
    for j in range(10):
        if i%2==1:
            open_time[j] = 1
        i = i//2
    value = 0
    for shop_num in range(n):
        value += cal_val(shop_num,open_time)
    values.append(value)
    ans = max(ans,value)


print(ans)
# print(max(values))

Buggy submission (verdict: Runtime Error):
# encoding:utf-8
import copy
import numpy as np
import random

n = int(input())
F = []
for i in range(n):
    f = [int(i) for i in input().split()]
    F.append(f)



P = []
for i in range(n):
    P.append([int(i) for i in input().split()])

F = np.array(F)
P = np.array(P)


def cal_val(shop_num,open_time):
    same_time = int(np.dot(F[shop_num],open_time.T))
    # print(open_time)
    return P[shop_num,same_time+1]
#
# def to2digit(i):
#     open_time = np.zeros([10])
#     for count in range(10):
#         if i%2==1:
#             open_time[count] = 1
#         i = i//2
#     return open_time



values = []

for i in range(1,2**10):
    open_time = np.zeros([10])
    for j in range(10):
        if i%2==1:
            open_time[j] = 1
        i = i//2
    value = 0
    for shop_num in range(n):
        value += cal_val(shop_num,open_time)
    values.append(value)

print(max(values))