description stringlengths 171 4k | code stringlengths 94 3.98k | normalized_code stringlengths 57 4.99k |
|---|---|---|
Alice and Bob play 5-in-a-row game. They have a playing field of size 10 × 10. In turns they put either crosses or noughts, one at a time. Alice puts crosses and Bob puts noughts.
In current match they have made some turns and now it's Alice's turn. She wonders if she can put cross in such empty cell that she wins imm... | field = []
def full_line(x, y, vx, vy):
global field
summ = 0
for k in range(0, 5):
if (
x == len(field)
or y == len(field[x])
or x == -1
or y == -1
or "O" == field[x][y]
):
return False
if "X" == field[x][y]:
... | ASSIGN VAR LIST FUNC_DEF ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER NUMBER IF VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR VAR VAR NUMBER VAR NUMBER STRING VAR VAR VAR RETURN NUMBER IF STRING VAR VAR VAR VAR NUMBER VAR VAR VAR VAR RETURN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR... |
Alice and Bob play 5-in-a-row game. They have a playing field of size 10 × 10. In turns they put either crosses or noughts, one at a time. Alice puts crosses and Bob puts noughts.
In current match they have made some turns and now it's Alice's turn. She wonders if she can put cross in such empty cell that she wins imm... | r = [input() for _ in range(10)]
c = []
for i in range(10):
t = ""
for j in range(10):
t += r[j][i]
c.append(t)
for x in r:
if any(s in x for s in [".XXXX", "X.XXX", "XX.XX", "XXX.X", "XXXX."]):
print("YES")
quit()
else:
for y in c:
if any(s in y for s in [".XXXX", "X... | ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL VAR NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR STRING FOR VAR FUNC_CALL VAR NUMBER VAR VAR VAR VAR EXPR FUNC_CALL VAR VAR FOR VAR VAR IF FUNC_CALL VAR VAR VAR VAR LIST STRING STRING STRING STRING STRING EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR FOR VAR VAR I... |
Alice and Bob play 5-in-a-row game. They have a playing field of size 10 × 10. In turns they put either crosses or noughts, one at a time. Alice puts crosses and Bob puts noughts.
In current match they have made some turns and now it's Alice's turn. She wonders if she can put cross in such empty cell that she wins imm... | a = [
["", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", ""],
]
for i in range(10):
a.append(list(" " + input() + " "))
a.append(["", "", "", "", "", "", "", "", "", "", "", "", "", ""])
a.append(["", "", "", "", "", "", "", "", "", "", "", "", "... | ASSIGN VAR LIST LIST STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING LIST STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING FOR VAR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR BIN_OP BIN_OP STRING FUNC_CALL VAR S... |
Alice and Bob play 5-in-a-row game. They have a playing field of size 10 × 10. In turns they put either crosses or noughts, one at a time. Alice puts crosses and Bob puts noughts.
In current match they have made some turns and now it's Alice's turn. She wonders if she can put cross in such empty cell that she wins imm... | import sys
table = [line.strip() for line in sys.stdin]
def check_position(table, row, column):
if table[row][column] != ".":
return False
left_sum = 0
tmp = column - 1
while tmp >= 0 and table[row][tmp] == "X":
left_sum += 1
tmp -= 1
right_sum = 0
tmp = column + 1
... | IMPORT ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_DEF IF VAR VAR VAR STRING RETURN NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER WHILE VAR NUMBER VAR VAR VAR STRING VAR NUMBER VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER WHILE VAR NUMBER VAR VAR VAR STRING VAR NUMBER VAR NUMBER IF BIN_OP VAR VAR NUMBER ... |
Alice and Bob play 5-in-a-row game. They have a playing field of size 10 × 10. In turns they put either crosses or noughts, one at a time. Alice puts crosses and Bob puts noughts.
In current match they have made some turns and now it's Alice's turn. She wonders if she can put cross in such empty cell that she wins imm... | from sys import stdin
def myInput():
board = [[], [], [[] for _ in range(20)], [[] for _ in range(20)]]
for line in stdin:
board[0].append(list(line.rstrip()))
board[1] = map(list, zip(*board[0]))
for i in range(len(board[0])):
for j in range(len(board[0])):
board[2][i + j]... | FUNC_DEF ASSIGN VAR LIST LIST LIST LIST VAR FUNC_CALL VAR NUMBER LIST VAR FUNC_CALL VAR NUMBER FOR VAR VAR EXPR FUNC_CALL VAR NUMBER FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER FUNC_CALL VAR VAR FUNC_CALL VAR VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER EXPR... |
Alice and Bob play 5-in-a-row game. They have a playing field of size 10 × 10. In turns they put either crosses or noughts, one at a time. Alice puts crosses and Bob puts noughts.
In current match they have made some turns and now it's Alice's turn. She wonders if she can put cross in such empty cell that she wins imm... | a = [list(input()) for i in range(10)]
flag = True
for i in range(10):
for j in range(10):
l, r = j - 1, j + 1
cnt_lr = 0
while 0 <= l and a[i][l] == "X":
l -= 1
cnt_lr += 1
while r < 10 and a[i][r] == "X":
r += 1
cnt_lr += 1
d,... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR VAR BIN_OP VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR NUMBER WHILE NUMBER VAR VAR VAR VAR STRING VAR NUMBER VAR NUMBER WHILE VAR NUMBER VAR VAR VAR STRING VAR NUMBER VAR NU... |
Alice and Bob play 5-in-a-row game. They have a playing field of size 10 × 10. In turns they put either crosses or noughts, one at a time. Alice puts crosses and Bob puts noughts.
In current match they have made some turns and now it's Alice's turn. She wonders if she can put cross in such empty cell that she wins imm... | matriz = [[letra for letra in input()] for i in range(10)]
flag = False
for i in range(10):
for j in range(6):
m = [
matriz[i][j],
matriz[i][j + 1],
matriz[i][j + 2],
matriz[i][j + 3],
matriz[i][j + 4],
]
if m.count(".") == 1 and m.... | ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR LIST VAR VAR VAR VAR VAR BIN_OP VAR NUMBER VAR VAR BIN_OP VAR NUMBER VAR VAR BIN_OP VAR NUMBER VAR VAR BIN_OP VAR NUMBER IF FUNC_CALL VAR STRING NUMBER FUNC_CALL VAR STRING NU... |
Alice and Bob play 5-in-a-row game. They have a playing field of size 10 × 10. In turns they put either crosses or noughts, one at a time. Alice puts crosses and Bob puts noughts.
In current match they have made some turns and now it's Alice's turn. She wonders if she can put cross in such empty cell that she wins imm... | field = []
for _ in range(10):
field.append(input())
rows = [row for row in field]
columns = []
for i in range(10):
s = ""
for j in range(10):
s += field[j][i]
columns.append(s)
maindiags = []
for k in range(-9, 10):
s = ""
if k >= 0:
for i in range(10 - k):
for j in ... | ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR STRING FOR VAR FUNC_CALL VAR NUMBER VAR VAR VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR STRING IF VAR NUMBER FOR ... |
Alice and Bob play 5-in-a-row game. They have a playing field of size 10 × 10. In turns they put either crosses or noughts, one at a time. Alice puts crosses and Bob puts noughts.
In current match they have made some turns and now it's Alice's turn. She wonders if she can put cross in such empty cell that she wins imm... | def check(par):
if (
par.find(".XXXX") != -1
or par.find("X.XXX") != -1
or par.find("XX.XX") != -1
or par.find("XXX.X") != -1
or par.find("XXXX.") != -1
):
print("YES")
quit()
arr = []
for i in range(10):
arr.append(input())
for string in arr:
ch... | FUNC_DEF IF FUNC_CALL VAR STRING NUMBER FUNC_CALL VAR STRING NUMBER FUNC_CALL VAR STRING NUMBER FUNC_CALL VAR STRING NUMBER FUNC_CALL VAR STRING NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR FOR VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR... |
Alice and Bob play 5-in-a-row game. They have a playing field of size 10 × 10. In turns they put either crosses or noughts, one at a time. Alice puts crosses and Bob puts noughts.
In current match they have made some turns and now it's Alice's turn. She wonders if she can put cross in such empty cell that she wins imm... | s = []
h = 0
h1 = 0
z = 0
x = 0
f1 = 0
while h < 10:
a = list(input())
s.append(a)
a = []
h = h + 1
while h1 < 60:
w = s[z][x] + s[z][x + 1] + s[z][x + 2] + s[z][x + 3] + s[z][x + 4]
if w.count("X") == 4 and w.count(".") == 1:
f1 = 1
break
x = x + 1
if x == 6:
z =... | ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR LIST ASSIGN VAR BIN_OP VAR NUMBER WHILE VAR NUMBER ASSIGN VAR BIN_OP BIN_OP BIN_OP BIN_OP VAR VAR VAR VAR VAR BIN_OP VAR NUM... |
Alice and Bob play 5-in-a-row game. They have a playing field of size 10 × 10. In turns they put either crosses or noughts, one at a time. Alice puts crosses and Bob puts noughts.
In current match they have made some turns and now it's Alice's turn. She wonders if she can put cross in such empty cell that she wins imm... | a = [[x for x in input()] for i in range(10)]
def f():
global a
for i in range(10):
for j in range(6):
q = 0
for k in range(5):
q += int(a[i][j + k] == "X")
if q == 5:
return 1
for j in range(10):
for i in range(6):
... | ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL VAR NUMBER FUNC_DEF FOR VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR FUNC_CALL VAR VAR VAR BIN_OP VAR VAR STRING IF VAR NUMBER RETURN NUMBER FOR VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR NUM... |
Alice and Bob play 5-in-a-row game. They have a playing field of size 10 × 10. In turns they put either crosses or noughts, one at a time. Alice puts crosses and Bob puts noughts.
In current match they have made some turns and now it's Alice's turn. She wonders if she can put cross in such empty cell that she wins imm... | def check(r0, c0, dr, dc):
cntx = 0
cnte = 0
for i in range(5):
r = r0 + dr * i
c = c0 + dc * i
if r < 0 or 9 < r or c < 0 or 9 < c:
break
elif cells[r][c] == "X":
cntx += 1
elif cells[r][c] == ".":
cnte += 1
return cntx == 4 an... | FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR BIN_OP VAR VAR IF VAR NUMBER NUMBER VAR VAR NUMBER NUMBER VAR IF VAR VAR VAR STRING VAR NUMBER IF VAR VAR VAR STRING VAR NUMBER RETURN VAR NUMBER VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_... |
Alice and Bob play 5-in-a-row game. They have a playing field of size 10 × 10. In turns they put either crosses or noughts, one at a time. Alice puts crosses and Bob puts noughts.
In current match they have made some turns and now it's Alice's turn. She wonders if she can put cross in such empty cell that she wins imm... | def check(i, j):
i1 = i
j1 = j
i2 = i
j2 = j
while j1 + 1 <= m - 1 and mat[i][j1 + 1] == "X":
j1 += 1
while j2 - 1 >= 0 and mat[i][j2 - 1] == "X":
j2 -= 1
if abs(j2 - j1) >= 4:
return True
i1 = i
j1 = j
i2 = i
j2 = j
while i1 + 1 <= n - 1 and mat[i... | FUNC_DEF ASSIGN VAR VAR ASSIGN VAR VAR ASSIGN VAR VAR ASSIGN VAR VAR WHILE BIN_OP VAR NUMBER BIN_OP VAR NUMBER VAR VAR BIN_OP VAR NUMBER STRING VAR NUMBER WHILE BIN_OP VAR NUMBER NUMBER VAR VAR BIN_OP VAR NUMBER STRING VAR NUMBER IF FUNC_CALL VAR BIN_OP VAR VAR NUMBER RETURN NUMBER ASSIGN VAR VAR ASSIGN VAR VAR ASSIGN ... |
Alice and Bob play 5-in-a-row game. They have a playing field of size 10 × 10. In turns they put either crosses or noughts, one at a time. Alice puts crosses and Bob puts noughts.
In current match they have made some turns and now it's Alice's turn. She wonders if she can put cross in such empty cell that she wins imm... | def check(a, b, c, d, e):
countX = 0
countD = 0
if a == "X":
countX += 1
elif a == ".":
countD += 1
if b == "X":
countX += 1
elif b == ".":
countD += 1
if c == "X":
countX += 1
elif c == ".":
countD += 1
if d == "X":
countX += 1... | FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR NUMBER IF VAR STRING VAR NUMBER IF VAR STRING VAR NUMBER IF VAR STRING VAR NUMBER IF VAR STRING VAR NUMBER IF VAR STRING VAR NUMBER IF VAR STRING VAR NUMBER IF VAR STRING VAR NUMBER IF VAR STRING VAR NUMBER IF VAR STRING VAR NUMBER IF VAR STRING VAR NUMBER RETURN VAR NUMBER VAR NUM... |
Alice and Bob play 5-in-a-row game. They have a playing field of size 10 × 10. In turns they put either crosses or noughts, one at a time. Alice puts crosses and Bob puts noughts.
In current match they have made some turns and now it's Alice's turn. She wonders if she can put cross in such empty cell that she wins imm... | a = []
for i in range(10):
a.append([])
p = [c for c in input()]
for j in range(10):
if p[j] == "X":
a[i].append(1)
elif p[j] == "O":
a[i].append(-1)
elif p[j] == ".":
a[i].append(0)
f = True
for i in range(10):
for j in range(10):
s1, ... | ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR LIST ASSIGN VAR VAR VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER IF VAR VAR STRING EXPR FUNC_CALL VAR VAR NUMBER IF VAR VAR STRING EXPR FUNC_CALL VAR VAR NUMBER IF VAR VAR STRING EXPR FUNC_CALL VAR VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBE... |
Alice and Bob play 5-in-a-row game. They have a playing field of size 10 × 10. In turns they put either crosses or noughts, one at a time. Alice puts crosses and Bob puts noughts.
In current match they have made some turns and now it's Alice's turn. She wonders if she can put cross in such empty cell that she wins imm... | mat1 = [input() for l in range(10)]
mat2 = list(reversed(mat1))
mat3 = []
for l in mat1:
mat3.append(l[::-1])
def horizontal(inp, i, j):
s = ""
for k in range(j, j + 5):
s = s + inp[i][k]
return s
def vertical(inp, i, j):
s = ""
for k in range(i, i + 5):
s = s + inp[k][j]
... | ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR LIST FOR VAR VAR EXPR FUNC_CALL VAR VAR NUMBER FUNC_DEF ASSIGN VAR STRING FOR VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR VAR VAR VAR RETURN VAR FUNC_DEF ASSIGN VAR STRING FOR VAR FUNC_CALL VAR VAR ... |
Alice and Bob play 5-in-a-row game. They have a playing field of size 10 × 10. In turns they put either crosses or noughts, one at a time. Alice puts crosses and Bob puts noughts.
In current match they have made some turns and now it's Alice's turn. She wonders if she can put cross in such empty cell that she wins imm... | a = []
for i in range(10):
a.append(input())
def valid(x, y):
if 0 <= x <= 9 and 0 <= y <= 9:
return True
return False
def check(x, y, direction):
ans = 1
curr_x = x + direction[0]
curr_y = y + direction[1]
while valid(curr_x, curr_y) and a[curr_x][curr_y] == "X":
ans += ... | ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF IF NUMBER VAR NUMBER NUMBER VAR NUMBER RETURN NUMBER RETURN NUMBER FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP VAR VAR NUMBER WHILE FUNC_CALL VAR VAR VAR VAR VAR VAR STRING VAR NUMBER VAR VAR NUMBER ... |
Alice and Bob play 5-in-a-row game. They have a playing field of size 10 × 10. In turns they put either crosses or noughts, one at a time. Alice puts crosses and Bob puts noughts.
In current match they have made some turns and now it's Alice's turn. She wonders if she can put cross in such empty cell that she wins imm... | def solve():
grid = [input() for r in range(10)]
def win(arr):
return arr.count("X") == 4 and arr.count(".") == 1
for i in range(10):
for j in range(10):
if win(grid[i][j : j + 5]):
return True
elif win([grid[k][j] for k in range(i, min(i + 5, 10))])... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL VAR NUMBER FUNC_DEF RETURN FUNC_CALL VAR STRING NUMBER FUNC_CALL VAR STRING NUMBER FOR VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER IF FUNC_CALL VAR VAR VAR VAR BIN_OP VAR NUMBER RETURN NUMBER IF FUNC_CALL VAR VAR VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL VAR BIN_O... |
Alice and Bob play 5-in-a-row game. They have a playing field of size 10 × 10. In turns they put either crosses or noughts, one at a time. Alice puts crosses and Bob puts noughts.
In current match they have made some turns and now it's Alice's turn. She wonders if she can put cross in such empty cell that she wins imm... | def main():
Map = []
for i in range(10):
Map += [input()]
for i in range(10):
for j in range(10):
count = 0
count2 = 0
if i <= 5:
for k in range(5):
if Map[i + k][j] == "X":
count += 1
... | FUNC_DEF ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER VAR LIST FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER IF VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER IF VAR BIN_OP VAR VAR VAR STRING VAR NUMBER IF VAR BIN_OP VAR VAR VAR STRING VAR NUMBER IF VAR NUMBER VAR ... |
Alice and Bob play 5-in-a-row game. They have a playing field of size 10 × 10. In turns they put either crosses or noughts, one at a time. Alice puts crosses and Bob puts noughts.
In current match they have made some turns and now it's Alice's turn. She wonders if she can put cross in such empty cell that she wins imm... | t = []
for i in range(10):
t.append(input())
for i in range(10):
s = ""
for j in range(10):
s = s + t[j][i]
t.append(s)
for i in range(6):
s = ""
for j in range(10 - i):
s = s + t[i + j][j]
t.append(s)
for i in range(1, 6):
s = ""
for j in range(10 - i):
s = s... | ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR STRING FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP VAR VAR VAR VAR EXPR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR STRING FOR VAR FUNC_CALL VAR BIN_OP NUMBER VAR ASSIGN VAR BIN_OP VAR ... |
Alice and Bob play 5-in-a-row game. They have a playing field of size 10 × 10. In turns they put either crosses or noughts, one at a time. Alice puts crosses and Bob puts noughts.
In current match they have made some turns and now it's Alice's turn. She wonders if she can put cross in such empty cell that she wins imm... | l = [input() for _ in range(10)]
for c in range(5):
t = ["X"] * 5
t[c] = "."
for i in range(10):
for j in range(6):
cnt = 0
for k in range(5):
if l[i][j + k] == ".":
cnt += 1
elif l[i][j + k] == "O":
cnt ... | ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP LIST STRING NUMBER ASSIGN VAR VAR STRING FOR VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER IF VAR VAR BIN_OP VAR VAR STRING VAR NUMBER IF VAR VAR BIN_OP VAR VAR STRING ... |
Alice and Bob play 5-in-a-row game. They have a playing field of size 10 × 10. In turns they put either crosses or noughts, one at a time. Alice puts crosses and Bob puts noughts.
In current match they have made some turns and now it's Alice's turn. She wonders if she can put cross in such empty cell that she wins imm... | def find(r, c, s1, s2):
combo = 0
while a[r][c] == "X":
r += s1
c += s2
combo += 1
return combo
a = ["@@@@@@@@@@@@"]
marks = []
dots = []
ans = 1
for i in range(10):
a.append("@" + input() + "@")
a.append("@@@@@@@@@@@@")
for i in range(1, 11):
for j in range(1, 11):
... | FUNC_DEF ASSIGN VAR NUMBER WHILE VAR VAR VAR STRING VAR VAR VAR VAR VAR NUMBER RETURN VAR ASSIGN VAR LIST STRING ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP STRING FUNC_CALL VAR STRING EXPR FUNC_CALL VAR STRING FOR VAR FUNC_CALL VAR NUMBER NUMBER FOR V... |
Alice and Bob play 5-in-a-row game. They have a playing field of size 10 × 10. In turns they put either crosses or noughts, one at a time. Alice puts crosses and Bob puts noughts.
In current match they have made some turns and now it's Alice's turn. She wonders if she can put cross in such empty cell that she wins imm... | k = []
for i in range(10):
s = str(input())
k.append(s)
def krestik(mast, nom_str, nom_symvol):
x = 1
y = 1
z = 1
v = 1
if mast[nom_str][nom_symvol] == ".":
lov = 1
else:
lov = 0
if nom_symvol <= 5:
for i in range(4):
if (
mast[no... | ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR EXPR FUNC_CALL VAR VAR FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER IF VAR VAR VAR STRING ASSIGN VAR NUMBER ASSIGN VAR NUMBER IF VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER IF VAR VAR BIN_OP VAR VAR STRIN... |
Alice and Bob play 5-in-a-row game. They have a playing field of size 10 × 10. In turns they put either crosses or noughts, one at a time. Alice puts crosses and Bob puts noughts.
In current match they have made some turns and now it's Alice's turn. She wonders if she can put cross in such empty cell that she wins imm... | s = []
def check():
for i in range(10):
for j in range(10):
if j + 4 < 10:
th = ""
for k in range(5):
th += s[i][j + k]
if th == "XXXXX":
return True
for i in range(10):
for j in range(10):
... | ASSIGN VAR LIST FUNC_DEF FOR VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER IF BIN_OP VAR NUMBER NUMBER ASSIGN VAR STRING FOR VAR FUNC_CALL VAR NUMBER VAR VAR VAR BIN_OP VAR VAR IF VAR STRING RETURN NUMBER FOR VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER IF BIN_OP VAR NUMBER NUMBER ASSIGN VAR STRING FOR... |
Alice and Bob play 5-in-a-row game. They have a playing field of size 10 × 10. In turns they put either crosses or noughts, one at a time. Alice puts crosses and Bob puts noughts.
In current match they have made some turns and now it's Alice's turn. She wonders if she can put cross in such empty cell that she wins imm... | a = []
f = False
for i in range(10):
s = input()
a.append(s)
if (
s.find("XXXX.") != -1
or s.find("XXX.X") != -1
or s.find("XX.XX") != -1
or s.find("X.XXX") != -1
or s.find(".XXXX") != -1
):
f = True
for i in range(10):
s = ""
for j in range(10):
... | ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR EXPR FUNC_CALL VAR VAR IF FUNC_CALL VAR STRING NUMBER FUNC_CALL VAR STRING NUMBER FUNC_CALL VAR STRING NUMBER FUNC_CALL VAR STRING NUMBER FUNC_CALL VAR STRING NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR STRING F... |
Alice and Bob play 5-in-a-row game. They have a playing field of size 10 × 10. In turns they put either crosses or noughts, one at a time. Alice puts crosses and Bob puts noughts.
In current match they have made some turns and now it's Alice's turn. She wonders if she can put cross in such empty cell that she wins imm... | l = [""] * 12
flag = False
for i in range(10):
x = input()
cnt = int(0)
if "XX.XX" in x or "X.XXX" in x or ".XXXX" in x or "XXX.X" in x or "XXXX." in x:
flag = True
x = list(x)
for j in range(10):
l[j] += x[j]
for i in range(12):
x = "".join(l[i])
cnt = int(0)
if "XX.XX" ... | ASSIGN VAR BIN_OP LIST STRING NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR NUMBER IF STRING VAR STRING VAR STRING VAR STRING VAR STRING VAR ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR NUMBER VAR VAR VAR VAR FOR VAR FUNC_CALL VAR NUMBER ... |
Alice and Bob play 5-in-a-row game. They have a playing field of size 10 × 10. In turns they put either crosses or noughts, one at a time. Alice puts crosses and Bob puts noughts.
In current match they have made some turns and now it's Alice's turn. She wonders if she can put cross in such empty cell that she wins imm... | a = [input() for i in range(10)]
gg = False
def checkAns(b):
dot = 0
x = 0
for i in b:
if i == "X":
x += 1
if i == ".":
dot += 1
if x == 4 and dot == 1 or x == 5:
return True
def find(b):
if len(b) < 5:
return
global gg
ans = 0
... | ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR IF VAR STRING VAR NUMBER IF VAR STRING VAR NUMBER IF VAR NUMBER VAR NUMBER VAR NUMBER RETURN NUMBER FUNC_DEF IF FUNC_CALL VAR VAR NUMBER RETURN ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP FUNC... |
Alice and Bob play 5-in-a-row game. They have a playing field of size 10 × 10. In turns they put either crosses or noughts, one at a time. Alice puts crosses and Bob puts noughts.
In current match they have made some turns and now it's Alice's turn. She wonders if she can put cross in such empty cell that she wins imm... | import sys
input = sys.stdin.readline
s = [
list(map(lambda x: 1 if x == "X" else 2 if x == "O" else 0, input().rstrip()))
for _ in range(10)
]
def check(sx, sy):
return (
all(x < 10 and s[sy][x] == 1 for x in range(sx, sx + 5))
or all(y < 10 and s[y][sx] == 1 for y in range(sy, sy + 5))
... | IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR STRING NUMBER VAR STRING NUMBER NUMBER FUNC_CALL FUNC_CALL VAR VAR FUNC_CALL VAR NUMBER FUNC_DEF RETURN FUNC_CALL VAR VAR NUMBER VAR VAR VAR NUMBER VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER FUNC_CALL VAR VAR NUMBER VAR VAR VAR NUMBER VAR FUNC_CALL VAR VAR B... |
Alice and Bob play 5-in-a-row game. They have a playing field of size 10 × 10. In turns they put either crosses or noughts, one at a time. Alice puts crosses and Bob puts noughts.
In current match they have made some turns and now it's Alice's turn. She wonders if she can put cross in such empty cell that she wins imm... | mat = []
n = 10
m = 10
for i in range(n):
s = input()
s = list(s)
mat.append(s)
f = 0
def check(mat):
for i in range(10):
for j in range(10):
for k in range(5):
if i + k >= 10 or mat[i + k][j] != "X":
break
else:
retur... | ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FUNC_DEF FOR VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER IF BIN_OP VAR VAR NUMBER VAR BIN_OP VAR VAR VAR STR... |
Alice and Bob play 5-in-a-row game. They have a playing field of size 10 × 10. In turns they put either crosses or noughts, one at a time. Alice puts crosses and Bob puts noughts.
In current match they have made some turns and now it's Alice's turn. She wonders if she can put cross in such empty cell that she wins imm... | matrix = list()
for _ in range(10):
matrix.append(list(input()))
for i in range(10):
for j in range(6):
temp = matrix[i][j : j + 5]
if temp.count("X") == 4 and "." in temp:
print("YES")
quit()
for j in range(10):
for i in range(6):
temp = list()
for k ... | ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR VAR VAR VAR BIN_OP VAR NUMBER IF FUNC_CALL VAR STRING NUMBER STRING VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER FOR ... |
Alice and Bob play 5-in-a-row game. They have a playing field of size 10 × 10. In turns they put either crosses or noughts, one at a time. Alice puts crosses and Bob puts noughts.
In current match they have made some turns and now it's Alice's turn. She wonders if she can put cross in such empty cell that she wins imm... | import itertools
def main():
global MAP
MAP = []
for i in range(10):
MAP.append(list(input()))
for i, j in itertools.product(range(10), range(10)):
if check(i, j):
print("YES")
return
print("NO")
def check(i, j):
for a, b in [(0, 1), (1, 0), (1, 1), (1... | IMPORT FUNC_DEF ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR VAR FUNC_CALL VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR NUMBER IF FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR STRING RETURN EXPR FUNC_CALL VAR STRING FUNC_DEF FOR VAR VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER... |
Alice and Bob play 5-in-a-row game. They have a playing field of size 10 × 10. In turns they put either crosses or noughts, one at a time. Alice puts crosses and Bob puts noughts.
In current match they have made some turns and now it's Alice's turn. She wonders if she can put cross in such empty cell that she wins imm... | matrix = []
for i in range(10):
matrix.append(list(input()))
alllines = matrix.copy()
for i in range(10):
line = []
for j in range(10):
line.append(matrix[j][i])
alllines.append(line)
for i in range(6):
line = []
x = i
y = 0
while x < 10 and y < 10:
line.append(matrix[y][... | ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR VAR VAR VAR EXPR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR LIST ASSIGN VAR VAR ASSIGN VAR NUMB... |
Alice and Bob play 5-in-a-row game. They have a playing field of size 10 × 10. In turns they put either crosses or noughts, one at a time. Alice puts crosses and Bob puts noughts.
In current match they have made some turns and now it's Alice's turn. She wonders if she can put cross in such empty cell that she wins imm... | def check(a, x, y):
left = 0
right = 0
for i in range(1, 11):
if x - i >= 0:
if a[x - i][y] == "X":
left += 1
else:
break
else:
break
for i in range(1, 11):
if x + i < 10:
if a[x + i][y] == "X":
... | FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER NUMBER IF BIN_OP VAR VAR NUMBER IF VAR BIN_OP VAR VAR VAR STRING VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER NUMBER IF BIN_OP VAR VAR NUMBER IF VAR BIN_OP VAR VAR VAR STRING VAR NUMBER IF BIN_OP VAR VAR NUMBER RETURN NUMBER ASSIGN VAR NUMBER ASSIGN V... |
Alice and Bob play 5-in-a-row game. They have a playing field of size 10 × 10. In turns they put either crosses or noughts, one at a time. Alice puts crosses and Bob puts noughts.
In current match they have made some turns and now it's Alice's turn. She wonders if she can put cross in such empty cell that she wins imm... | a = []
for i in range(10):
s = input()
a.append(s)
ans = 0
for i in range(10):
for j in range(10):
if a[i][j] == ".":
k = i - 1
c = 1
while k >= 0 and a[k][j] == "X":
c += 1
k -= 1
k = i + 1
while k < 10 and ... | ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER IF VAR VAR VAR STRING ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER WHILE VAR NUMBER VAR VAR VAR STRING VAR NUMBER VAR NUMBER ASSIGN VAR BIN_OP VAR NU... |
Alice and Bob play 5-in-a-row game. They have a playing field of size 10 × 10. In turns they put either crosses or noughts, one at a time. Alice puts crosses and Bob puts noughts.
In current match they have made some turns and now it's Alice's turn. She wonders if she can put cross in such empty cell that she wins imm... | import sys
def check(x):
t, p = 0, 0
for i in range(5):
if x[i] == "X":
t += 1
elif x[i] == ".":
p += 1
if t == 4 and p == 1:
return True
return False
def main():
x = []
for i in range(10):
x.append(sys.stdin.readline().rstrip())
fl... | IMPORT FUNC_DEF ASSIGN VAR VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER IF VAR VAR STRING VAR NUMBER IF VAR VAR STRING VAR NUMBER IF VAR NUMBER VAR NUMBER RETURN NUMBER RETURN NUMBER FUNC_DEF ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VA... |
Alice and Bob play 5-in-a-row game. They have a playing field of size 10 × 10. In turns they put either crosses or noughts, one at a time. Alice puts crosses and Bob puts noughts.
In current match they have made some turns and now it's Alice's turn. She wonders if she can put cross in such empty cell that she wins imm... | matrix = [None] * 10
for i in range(10):
matrix[i] = input()
for i in range(10):
for j in range(10):
if 0 <= j and j <= 5:
count_x = 0
has_o = False
for k in range(5):
if matrix[i][j + k] == "X":
count_x += 1
elif ma... | ASSIGN VAR BIN_OP LIST NONE NUMBER FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER IF NUMBER VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER IF VAR VAR BIN_OP VAR VAR STRING VAR NUMBER IF VAR VAR BIN_OP VAR VAR STRING AS... |
Alice and Bob play 5-in-a-row game. They have a playing field of size 10 × 10. In turns they put either crosses or noughts, one at a time. Alice puts crosses and Bob puts noughts.
In current match they have made some turns and now it's Alice's turn. She wonders if she can put cross in such empty cell that she wins imm... | T = [[] for i in range(10)]
for i in range(10):
a = list(input())
T[i] = a
flag = False
for i in range(10):
for j in range(10):
if T[i][j] == "X":
for dx, dy in [
(0, -1),
(-1, 0),
(0, 1),
(1, 0),
(1, 1),
... | ASSIGN VAR LIST VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER IF VAR VAR VAR STRING FOR VAR VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER ... |
Alice and Bob play 5-in-a-row game. They have a playing field of size 10 × 10. In turns they put either crosses or noughts, one at a time. Alice puts crosses and Bob puts noughts.
In current match they have made some turns and now it's Alice's turn. She wonders if she can put cross in such empty cell that she wins imm... | grid = []
for i in range(10):
grid.append(input())
s2 = set(list(map(tuple, ".XXXX X.XXX XX.XX XXX.X XXXX.".split())))
s = set()
for i in range(10):
for j in range(10):
r, d, d1, d2 = None, None, None, None
if j + 4 < 10:
r = tuple([grid[i][j + x] for x in range(5)])
if i + 4... | ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL STRING ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR VAR VAR VAR NONE NONE NONE NONE IF BIN_OP VAR NUMBER NUMBER ASSIGN VAR FUN... |
Alice and Bob play 5-in-a-row game. They have a playing field of size 10 × 10. In turns they put either crosses or noughts, one at a time. Alice puts crosses and Bob puts noughts.
In current match they have made some turns and now it's Alice's turn. She wonders if she can put cross in such empty cell that she wins imm... | def din(matx):
for i in range(10):
for j in range(10):
dd = False
x = [[i, j], [i - 1, j - 1], [i - 2, j - 2], [i - 3, j - 3], [i - 4, j - 4]]
for p in x:
if p[0] > 9 or p[0] < 0 or p[1] > 9 or p[1] < 0:
dd = True
br... | FUNC_DEF FOR VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR LIST LIST VAR VAR LIST BIN_OP VAR NUMBER BIN_OP VAR NUMBER LIST BIN_OP VAR NUMBER BIN_OP VAR NUMBER LIST BIN_OP VAR NUMBER BIN_OP VAR NUMBER LIST BIN_OP VAR NUMBER BIN_OP VAR NUMBER FOR VAR VAR IF VAR NUMBER NUMBER VAR NUMBE... |
Alice and Bob play 5-in-a-row game. They have a playing field of size 10 × 10. In turns they put either crosses or noughts, one at a time. Alice puts crosses and Bob puts noughts.
In current match they have made some turns and now it's Alice's turn. She wonders if she can put cross in such empty cell that she wins imm... | import sys
a = (
[(["."] * 20) for _ in range(5)]
+ [list("." * 5 + input() + "." * 5) for _ in range(10)]
+ [(["."] * 20) for _ in range(5)]
)
def judge(y, x, dy, dx):
return all(a[y + dy * d][x + dx * d] == "X" for d in range(5))
def solve(y, x):
a[y][x] = "X"
for delta in range(-4, 5):
... | IMPORT ASSIGN VAR BIN_OP BIN_OP BIN_OP LIST STRING NUMBER VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR BIN_OP BIN_OP BIN_OP STRING NUMBER FUNC_CALL VAR BIN_OP STRING NUMBER VAR FUNC_CALL VAR NUMBER BIN_OP LIST STRING NUMBER VAR FUNC_CALL VAR NUMBER FUNC_DEF RETURN FUNC_CALL VAR VAR BIN_OP VAR BIN_OP VAR VAR BIN_OP VAR BIN_OP... |
Alice and Bob play 5-in-a-row game. They have a playing field of size 10 × 10. In turns they put either crosses or noughts, one at a time. Alice puts crosses and Bob puts noughts.
In current match they have made some turns and now it's Alice's turn. She wonders if she can put cross in such empty cell that she wins imm... | N = 10
A = []
for _ in range(N):
A += [list(input())]
result = "NO"
for i in range(N // 2 + 1):
for j in range(N // 2 + 1):
cross, dots = 0, 0
for k in range(N // 2):
if A[i + k][j + k] == ".":
dots += 1
elif A[i + k][j + k] == "X":
cross +... | ASSIGN VAR NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR VAR LIST FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR STRING FOR VAR FUNC_CALL VAR BIN_OP BIN_OP VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR BIN_OP BIN_OP VAR NUMBER NUMBER ASSIGN VAR VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER IF VAR BIN_OP VAR VAR BIN_OP... |
Alice and Bob play 5-in-a-row game. They have a playing field of size 10 × 10. In turns they put either crosses or noughts, one at a time. Alice puts crosses and Bob puts noughts.
In current match they have made some turns and now it's Alice's turn. She wonders if she can put cross in such empty cell that she wins imm... | def is_good(matrix):
for i in range(10):
for j in range(10):
if matrix[i][j] == "X":
if (
matrix[i][j - 2]
== matrix[i][j - 1]
== matrix[i][j]
== matrix[i][j + 1]
== matrix[i][j + ... | FUNC_DEF FOR VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER IF VAR VAR VAR STRING IF VAR VAR BIN_OP VAR NUMBER VAR VAR BIN_OP VAR NUMBER VAR VAR VAR VAR VAR BIN_OP VAR NUMBER VAR VAR BIN_OP VAR NUMBER VAR BIN_OP VAR NUMBER VAR VAR BIN_OP VAR NUMBER VAR VAR VAR VAR VAR BIN_OP VAR NUMBER VAR VAR BIN_OP VAR NUMBER ... |
Alice and Bob play 5-in-a-row game. They have a playing field of size 10 × 10. In turns they put either crosses or noughts, one at a time. Alice puts crosses and Bob puts noughts.
In current match they have made some turns and now it's Alice's turn. She wonders if she can put cross in such empty cell that she wins imm... | def diagL(coor, arr):
tmp = coor
opt = 1
while tmp - 11 >= 0 and tmp // 10 - 1 == (tmp - 11) // 10:
tmp -= 11
if arr[tmp] == "X":
opt += 1
else:
break
tmp = coor
while tmp + 11 < 100 and tmp // 10 + 1 == (tmp + 11) // 10:
tmp += 11
if a... | FUNC_DEF ASSIGN VAR VAR ASSIGN VAR NUMBER WHILE BIN_OP VAR NUMBER NUMBER BIN_OP BIN_OP VAR NUMBER NUMBER BIN_OP BIN_OP VAR NUMBER NUMBER VAR NUMBER IF VAR VAR STRING VAR NUMBER ASSIGN VAR VAR WHILE BIN_OP VAR NUMBER NUMBER BIN_OP BIN_OP VAR NUMBER NUMBER BIN_OP BIN_OP VAR NUMBER NUMBER VAR NUMBER IF VAR VAR STRING VAR ... |
Alice and Bob play 5-in-a-row game. They have a playing field of size 10 × 10. In turns they put either crosses or noughts, one at a time. Alice puts crosses and Bob puts noughts.
In current match they have made some turns and now it's Alice's turn. She wonders if she can put cross in such empty cell that she wins imm... | matrix = []
N = 10
for i in range(N):
matrix.append(list(input()))
won = False
def check_alice_won(matrix):
maxScore = 0
for i in range(N):
curScore = 0
for j in range(N):
if matrix[i][j] == "X":
curScore += 1
else:
if curScore > maxS... | ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER FUNC_DEF ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR STRING VAR NUMBER IF VAR VAR ASSIGN VAR VAR ASSIGN VAR NUMBER IF VAR VAR ASSIGN VAR... |
— Oh my sweet Beaverette, would you fancy a walk along a wonderful woodland belt with me?
— Of course, my Smart Beaver! Let us enjoy the splendid view together. How about Friday night?
At this point the Smart Beaver got rushing. Everything should be perfect by Friday, so he needed to prepare the belt to the upcom... | n = int(input())
a = tuple(map(int, input().split()))
c = {}
p = {}
s = x = y = 0
m = -1e18
for i in range(0, len(a)):
d = c.get(a[i])
if d != None and s - d + a[i] * 2 > m:
m = s - d + a[i] * 2
x, y = p.get(a[i]), i
if a[i] > 0:
s += a[i]
if p.get(a[i]) == None:
p[a[i]] ... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR DICT ASSIGN VAR DICT ASSIGN VAR VAR VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR IF VAR NONE BIN_OP BIN_OP VAR VAR BIN_OP VAR VAR NUMBER VA... |
— Oh my sweet Beaverette, would you fancy a walk along a wonderful woodland belt with me?
— Of course, my Smart Beaver! Let us enjoy the splendid view together. How about Friday night?
At this point the Smart Beaver got rushing. Everything should be perfect by Friday, so he needed to prepare the belt to the upcom... | n, t = int(input()), list(map(int, input().split()))
a, b = {}, {}
for i, j in enumerate(t):
if not j in a:
a[j] = i
else:
b[j] = i
p = [(a[j], b[j] - 1) for j in b]
s = [(j if j > 0 else 0) for j in t]
u = v = 2 * t[p[0][0]] - 1
for i in range(n - 1):
s[i + 1] += s[i]
for i, j in p:
u =... | ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR DICT DICT FOR VAR VAR FUNC_CALL VAR VAR IF VAR VAR ASSIGN VAR VAR VAR ASSIGN VAR VAR VAR ASSIGN VAR VAR VAR BIN_OP VAR VAR NUMBER VAR VAR ASSIGN VAR VAR NUMBER VAR NUMBER VAR VAR ASSIGN VAR VAR BIN_OP BIN_O... |
— Oh my sweet Beaverette, would you fancy a walk along a wonderful woodland belt with me?
— Of course, my Smart Beaver! Let us enjoy the splendid view together. How about Friday night?
At this point the Smart Beaver got rushing. Everything should be perfect by Friday, so he needed to prepare the belt to the upcom... | length = int(input())
array = [int(a) for a in input().split()]
maxSum = -1e21
resIndexes = []
for i in range(length):
for j in range(length - 1, -1, -1):
if j > i and array[i] == array[j]:
tmp = sum(array[i : j + 1])
indexes = []
for index in range(i + 1, j):
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER IF VAR VAR VAR VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR BIN_OP VAR NUMBER ASSIGN VAR LIST FOR VAR FUNC_CAL... |
— Oh my sweet Beaverette, would you fancy a walk along a wonderful woodland belt with me?
— Of course, my Smart Beaver! Let us enjoy the splendid view together. How about Friday night?
At this point the Smart Beaver got rushing. Everything should be perfect by Friday, so he needed to prepare the belt to the upcom... | N = int(input())
def sum_pos(L):
n = len(L)
ans = L[0] + L[-1]
for i in range(1, n - 1):
if L[i] > 0:
ans += L[i]
return ans
A = input().split()
Removed = []
Positive = []
cost = 0
for i in range(N):
A[i] = int(A[i])
k = True
for i in range(N):
for j in range(N - 1, i, -1... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR NUMBER VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER IF VAR VAR NUMBER VAR VAR VAR RETURN VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSI... |
— Oh my sweet Beaverette, would you fancy a walk along a wonderful woodland belt with me?
— Of course, my Smart Beaver! Let us enjoy the splendid view together. How about Friday night?
At this point the Smart Beaver got rushing. Everything should be perfect by Friday, so he needed to prepare the belt to the upcom... | def main():
n, aa = int(input()), list(map(int, input().split()))
partialsum, s, d, ranges = [0] * n, 0, {}, []
for hi, a in enumerate(aa):
if a in d:
base = s + a * 2
for lo in d[a]:
ranges.append((base - partialsum[lo], lo, hi))
d[a].append(hi)
... | FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR VAR BIN_OP LIST NUMBER VAR NUMBER DICT LIST FOR VAR VAR FUNC_CALL VAR VAR IF VAR VAR ASSIGN VAR BIN_OP VAR BIN_OP VAR NUMBER FOR VAR VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR VAR VAR VAR VAR EXPR F... |
— Oh my sweet Beaverette, would you fancy a walk along a wonderful woodland belt with me?
— Of course, my Smart Beaver! Let us enjoy the splendid view together. How about Friday night?
At this point the Smart Beaver got rushing. Everything should be perfect by Friday, so he needed to prepare the belt to the upcom... | n = int(input())
v = list(map(int, input().split()))
valmax = max(v) + 100
valmin = min(v) - 100
sol = -(10**18)
first = {}
last = {}
s = [(0) for i in range(-2, n + 5)]
s[0] = max(v[0], 0)
for i in range(1, len(v)):
s[i] = s[i - 1]
if v[i] > 0:
s[i] += v[i]
for i in range(0, len(v)):
last[str(v[i])... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP FUNC_CALL VAR VAR NUMBER ASSIGN VAR BIN_OP FUNC_CALL VAR VAR NUMBER ASSIGN VAR BIN_OP NUMBER NUMBER ASSIGN VAR DICT ASSIGN VAR DICT ASSIGN VAR NUMBER VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER ASS... |
— Oh my sweet Beaverette, would you fancy a walk along a wonderful woodland belt with me?
— Of course, my Smart Beaver! Let us enjoy the splendid view together. How about Friday night?
At this point the Smart Beaver got rushing. Everything should be perfect by Friday, so he needed to prepare the belt to the upcom... | import sys
fin = sys.stdin
n = int(fin.readline())
a = list(map(int, fin.readline().split()))
table = dict()
s = [0] * (n + 1)
for i in range(n):
rec = table.setdefault(a[i], {"begin": i, "end": i, "sum": a[i]})
rec["end"] = i
if a[i] >= 0:
s[i + 1] = s[i] + a[i]
rec["sum"] = s[rec["end"] +... | IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR DICT STRING STRING STRING VAR VAR VAR VAR ASSIGN VAR STRING ... |
Every superhero has been given a power value by the Felicity Committee. The avengers crew wants to maximize the average power of the superheroes in their team by performing certain operations.
Initially, there are $n$ superheroes in avengers team having powers $a_1, a_2, \ldots, a_n$, respectively. In one operation, t... | def solve():
n, k, m = map(int, input().split(" "))
a = [0] + sorted(map(int, input().split(" ")))
for _ in range(1, n + 1):
a[_] = a[_] + a[_ - 1]
ans = 0
for _ in range(min(n, m + 1)):
n_, m_ = n - _, m - _
ans = max((a[-1] - a[_] + min(m_, k * n_)) / n_, ans)
print("%.... | FUNC_DEF ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR BIN_OP LIST NUMBER FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR VAR BIN_OP VAR VAR VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL V... |
Every superhero has been given a power value by the Felicity Committee. The avengers crew wants to maximize the average power of the superheroes in their team by performing certain operations.
Initially, there are $n$ superheroes in avengers team having powers $a_1, a_2, \ldots, a_n$, respectively. In one operation, t... | n, k, m = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
a = sorted(a)[::-1]
su = [0]
for i in range(1, n + 1):
su.append(su[i - 1] + a[i - 1])
ans = 0.0
for i in range(max(1, n - m), n + 1):
ans = max(ans, (su[i] + min(m - (n - i), i * k)) / i)
print(ans) | ASSIGN VAR VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR LIST NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR BIN_OP VAR NUMBER VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER FOR ... |
Every superhero has been given a power value by the Felicity Committee. The avengers crew wants to maximize the average power of the superheroes in their team by performing certain operations.
Initially, there are $n$ superheroes in avengers team having powers $a_1, a_2, \ldots, a_n$, respectively. In one operation, t... | n, k, m = map(int, input().split())
t = list(map(int, input().split()))
s = sum(t)
if n == 1:
print("{0:.6f}".format(min(s + k, s + m)))
elif k * n <= m:
print("{0:.6f}".format(max(t) + k))
else:
t.sort()
t = [0] + t
max_avg = s / n
remove = 0
for i in range(min(n, m + 1)):
remove +=... | ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR IF VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL STRING FUNC_CALL VAR BIN_OP VAR VAR BIN_OP VAR VAR IF BIN_OP VAR VAR VAR EXPR FUNC_CALL VAR FUNC_CALL STRING BIN_OP FUNC... |
Every superhero has been given a power value by the Felicity Committee. The avengers crew wants to maximize the average power of the superheroes in their team by performing certain operations.
Initially, there are $n$ superheroes in avengers team having powers $a_1, a_2, \ldots, a_n$, respectively. In one operation, t... | def read_nums():
return [int(x) for x in input().split()]
def count_deletes(nums, m, k):
pass
def main():
n, k, m = read_nums()
nums = sorted(read_nums())
cum_nums = [nums[0]]
for i in range(1, len(nums)):
cum_nums.append(nums[i] + cum_nums[i - 1])
total_sum = cum_nums[-1]
re... | FUNC_DEF RETURN FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF FUNC_DEF ASSIGN VAR VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR VAR VAR BIN_OP VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR LIST ... |
Every superhero has been given a power value by the Felicity Committee. The avengers crew wants to maximize the average power of the superheroes in their team by performing certain operations.
Initially, there are $n$ superheroes in avengers team having powers $a_1, a_2, \ldots, a_n$, respectively. In one operation, t... | n, k, m = map(int, input().split())
a = [int(i) for i in input().split()]
a.sort()
rs = sum(a)
cnt = n
for i in range(n):
if (
cnt == 1
or (rs + min(m, k * cnt)) / cnt
> (rs - a[i] + min(m - 1, k * (cnt - 1))) / (cnt - 1)
or m == 0
):
break
else:
rs -= a[i]
... | ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FOR VAR FUNC_CALL VAR VAR IF VAR NUMBER BIN_OP BIN_OP VAR FUNC_CALL VAR VAR BIN_OP VAR VAR VAR BIN_OP BIN_OP BIN_OP VAR VAR VAR FUNC_CALL V... |
Every superhero has been given a power value by the Felicity Committee. The avengers crew wants to maximize the average power of the superheroes in their team by performing certain operations.
Initially, there are $n$ superheroes in avengers team having powers $a_1, a_2, \ldots, a_n$, respectively. In one operation, t... | n, k, m = map(int, input().split())
a = sorted(list(map(int, input().split())))
ans, i, j, x = 0, 0, 0, sum(a)
length = n
while i < n and j <= m:
avg = (x + min((k * length, max(0, m - i)))) / length
if avg > ans:
ans = avg
x -= a[i]
length -= 1
j += 1
i += 1
print(ans) | ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR VAR NUMBER NUMBER NUMBER FUNC_CALL VAR VAR ASSIGN VAR VAR WHILE VAR VAR VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR FUNC_CALL VAR BIN_OP VAR VAR FUNC_CALL VAR NUMBER ... |
Every superhero has been given a power value by the Felicity Committee. The avengers crew wants to maximize the average power of the superheroes in their team by performing certain operations.
Initially, there are $n$ superheroes in avengers team having powers $a_1, a_2, \ldots, a_n$, respectively. In one operation, t... | n, k, m = [int(c) for c in input().split()]
a = [int(c) for c in input().split()]
a.sort()
sm = sum(a)
pref = [i for i in range(n + 1)]
for i in range(1, n + 1):
pref[i] = pref[i - 1] + a[i - 1]
avg, mx = 0, -1
for i in range(min(m, n - 1) + 1):
sm_of_left = sm - pref[i]
avg = (sm_of_left + min(m - i, k * (... | ASSIGN VAR VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR VAR BIN_OP VAR BIN_OP VAR NUMBER VAR BIN_... |
Every superhero has been given a power value by the Felicity Committee. The avengers crew wants to maximize the average power of the superheroes in their team by performing certain operations.
Initially, there are $n$ superheroes in avengers team having powers $a_1, a_2, \ldots, a_n$, respectively. In one operation, t... | def func(OpCount, n, k, s):
if n is 1:
return min(OpCount, k) + li[0]
Max = (s + min(m, n * k)) / n
SumOfM = 0
for i in range(n - 1):
if i >= m:
break
SumOfM = SumOfM + li[i]
t = s - SumOfM + min(OpCount - (i + 1), (n - (i + 1)) * k)
t = t / (n - (i + ... | FUNC_DEF IF VAR NUMBER RETURN BIN_OP FUNC_CALL VAR VAR VAR VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR FUNC_CALL VAR VAR BIN_OP VAR VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER IF VAR VAR ASSIGN VAR BIN_OP VAR VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR FUNC_CALL VAR BIN_OP VAR BIN_OP VAR NUMBER BIN_OP BI... |
Every superhero has been given a power value by the Felicity Committee. The avengers crew wants to maximize the average power of the superheroes in their team by performing certain operations.
Initially, there are $n$ superheroes in avengers team having powers $a_1, a_2, \ldots, a_n$, respectively. In one operation, t... | n, k, m = map(int, input().split())
aa = [int(i) for i in input().split()]
aa.sort()
ss = sum(aa)
maxi = (ss + min(n * k, m)) / n
for i in range(1, min(m + 1, n)):
ss -= aa[i - 1]
left = m - i
can_add = (n - i) * k
to_add = min(left, can_add)
maxi = max(maxi, (ss + to_add) / (n - i))
print(maxi) | ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR FUNC_CALL VAR BIN_OP VAR VAR VAR VAR FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR BIN_OP VAR NUMBER VAR VAR VAR BIN_OP VAR NUMB... |
Every superhero has been given a power value by the Felicity Committee. The avengers crew wants to maximize the average power of the superheroes in their team by performing certain operations.
Initially, there are $n$ superheroes in avengers team having powers $a_1, a_2, \ldots, a_n$, respectively. In one operation, t... | n, k, m = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
s = sum(a)
ans = 0
i = 0
while i < n and i <= m:
r = n - i
ans = max(ans, (s + min(r * k, m - i)) / r)
s -= a[i]
i += 1
print("%.18f" % ans) | ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR VAR VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR FUNC_CALL VAR VAR BIN_OP BIN_OP VAR FUNC_CALL VAR... |
Every superhero has been given a power value by the Felicity Committee. The avengers crew wants to maximize the average power of the superheroes in their team by performing certain operations.
Initially, there are $n$ superheroes in avengers team having powers $a_1, a_2, \ldots, a_n$, respectively. In one operation, t... | n, k, m = map(int, input().split())
arr = list(map(int, input().split()))
a = []
a.append(0)
for i in arr:
a.append(i)
a = sorted(a)
mm = (sum(arr) + min(m, n * k)) / n
ss = sum(arr)
for i in range(1, min(n - 1, m) + 1):
ss -= a[i]
baaki = ss + min(m - i, (n - i) * k)
mm = max(mm, baaki / (n - i))
print... | ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST EXPR FUNC_CALL VAR NUMBER FOR VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP BIN_OP FUNC_CALL VAR VAR FUNC_CALL VAR VAR BIN_OP VAR VAR VAR ASSIGN... |
Every superhero has been given a power value by the Felicity Committee. The avengers crew wants to maximize the average power of the superheroes in their team by performing certain operations.
Initially, there are $n$ superheroes in avengers team having powers $a_1, a_2, \ldots, a_n$, respectively. In one operation, t... | def main():
n, k, m = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
total_sum = sum(a)
ret = (total_sum + min(m, n * k)) / n
for i in range(min(n - 1, m)):
total_sum -= a[i]
temp = total_sum + min(m - i - 1, (n - i - 1) * k)
ret = max(ret, temp / ... | FUNC_DEF ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR FUNC_CALL VAR VAR BIN_OP VAR VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR VAR VAR VAR... |
Every superhero has been given a power value by the Felicity Committee. The avengers crew wants to maximize the average power of the superheroes in their team by performing certain operations.
Initially, there are $n$ superheroes in avengers team having powers $a_1, a_2, \ldots, a_n$, respectively. In one operation, t... | n, k, m = map(int, input().split())
a = map(int, input().split())
b = sorted(a)
sum_b = sum(b)
len_b = len(b)
res = sum_b / len_b + min(m, len_b * k) / len_b
for i in range(min(m, n - 1)):
sum_b -= b[i]
len_b -= 1
res = max(res, sum_b / len_b + min(m - i - 1, len_b * k) / len_b)
print(res) | ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR BIN_OP FUNC_CALL VAR VAR BIN_OP VAR VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR BI... |
Every superhero has been given a power value by the Felicity Committee. The avengers crew wants to maximize the average power of the superheroes in their team by performing certain operations.
Initially, there are $n$ superheroes in avengers team having powers $a_1, a_2, \ldots, a_n$, respectively. In one operation, t... | n, k, m = map(int, input().split())
a = sorted(list(map(int, input().split())))
s = [0] * n
s[-1] = a[-1]
for i in range(n - 2, -1, -1):
s[i] = s[i + 1] + a[i]
if len(a) != 1 and m != k and len(set(a)) == 1:
print((s[0] + m) / n)
elif m >= n:
if n != 1:
print(float(a[-1] + min(k, m - n + 1)))
el... | ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER ASSIGN VAR VAR BIN_OP VAR BIN_OP VAR NUMBER VAR VAR IF FUNC_C... |
Every superhero has been given a power value by the Felicity Committee. The avengers crew wants to maximize the average power of the superheroes in their team by performing certain operations.
Initially, there are $n$ superheroes in avengers team having powers $a_1, a_2, \ldots, a_n$, respectively. In one operation, t... | def main():
[n, k, m] = list(map(int, input().split(" ")))
ar = list(map(int, input().split(" ")))
ar.sort()
length = len(ar)
prevSum = sum(ar)
prev = sum(ar) / length
maxAvg = prev
while True:
toadd = min(length * k, m)
newAvg = (prevSum + toadd) / length
if newA... | FUNC_DEF ASSIGN LIST VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING EXPR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP FUNC_CALL VAR VAR VAR ASSIGN VAR VAR WHILE NUMBER ASSIG... |
Every superhero has been given a power value by the Felicity Committee. The avengers crew wants to maximize the average power of the superheroes in their team by performing certain operations.
Initially, there are $n$ superheroes in avengers team having powers $a_1, a_2, \ldots, a_n$, respectively. In one operation, t... | import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline
N, K, M = map(int, input().split())
L = list(map(int, input().split()))
S = sum(L)
L = sorted(L)
ans = -float("inf")
ans = (S + min(M, K * N)) / N
for i in range(0, min(M, N - 1)):
rM = M - i - 1
rN = N - i - 1
S -= L[i]
tmpA = (S + min... | IMPORT EXPR FUNC_CALL VAR BIN_OP NUMBER NUMBER ASSIGN VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR BIN_OP BIN_OP VAR FUNC_CALL V... |
Every superhero has been given a power value by the Felicity Committee. The avengers crew wants to maximize the average power of the superheroes in their team by performing certain operations.
Initially, there are $n$ superheroes in avengers team having powers $a_1, a_2, \ldots, a_n$, respectively. In one operation, t... | def main():
n, k, m = map(int, input().split())
a = sorted([int(i) for i in input().split()])
s = sum(a)
ans = (min(m, n * k) + s) / n
for i in range(1, min(n, m + 1)):
s -= a[i - 1]
ans = max((s + min(m - i, (n - i) * k)) / (n - i), ans)
print(ans)
main() | FUNC_DEF ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP BIN_OP FUNC_CALL VAR VAR BIN_OP VAR VAR VAR VAR FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR BIN_OP VAR NUMBER VAR VAR BIN_OP VAR ... |
Every superhero has been given a power value by the Felicity Committee. The avengers crew wants to maximize the average power of the superheroes in their team by performing certain operations.
Initially, there are $n$ superheroes in avengers team having powers $a_1, a_2, \ldots, a_n$, respectively. In one operation, t... | from sys import stdin, stdout
def inp():
return stdin.readline()
def minp():
return map(int, stdin.readline().rstrip().split())
def linp():
return list(minp())
def main():
n, k, m = minp()
lst = linp()
lst.sort()
l = 0
if n * k > m:
ss = m
else:
ss = n * k
... | FUNC_DEF RETURN FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF ASSIGN VAR VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR NUMBER IF BIN_OP VAR VAR VAR ASSIGN VAR VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR ... |
Every superhero has been given a power value by the Felicity Committee. The avengers crew wants to maximize the average power of the superheroes in their team by performing certain operations.
Initially, there are $n$ superheroes in avengers team having powers $a_1, a_2, \ldots, a_n$, respectively. In one operation, t... | n, k, m = map(int, input().split())
a = sorted(list(map(int, input().split())))
av = (sum(a) + min(n * k, m)) / n
r = 0
l = sum(a)
for i in range(min(n - 1, m)):
r += a[i]
av = max(av, (l - r + min(m - i - 1, (n - i - 1) * k)) / (n - i - 1))
print(av) | ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP BIN_OP FUNC_CALL VAR VAR FUNC_CALL VAR BIN_OP VAR VAR VAR VAR ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR BIN_OP VAR NUMB... |
Every superhero has been given a power value by the Felicity Committee. The avengers crew wants to maximize the average power of the superheroes in their team by performing certain operations.
Initially, there are $n$ superheroes in avengers team having powers $a_1, a_2, \ldots, a_n$, respectively. In one operation, t... | import sys
sys.setrecursionlimit(200000)
input = sys.stdin.readline
n, k, m = map(int, input().split())
a = list(map(int, input().split()))
a.sort(key=lambda x: -x)
go = sum(a)
ans = (go + min(n * k, m)) / n
for i in range(n - 1):
ke = a.pop()
m -= 1
go -= ke
if m < 0:
break
ans = max(ans, ... | IMPORT EXPR FUNC_CALL VAR NUMBER ASSIGN VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR FUNC_CALL VAR BIN_OP VAR VAR VAR VAR FOR VAR FUNC_CALL VAR BIN_... |
Every superhero has been given a power value by the Felicity Committee. The avengers crew wants to maximize the average power of the superheroes in their team by performing certain operations.
Initially, there are $n$ superheroes in avengers team having powers $a_1, a_2, \ldots, a_n$, respectively. In one operation, t... | n, k, m = map(int, input().split())
arr = map(int, input().split())
arr = sorted(arr, reverse=True)
sub_s = [0, arr[0]]
for e in arr[1:]:
sub_s.append(sub_s[-1] + e)
M = -1
for i in range(0, min(n - 1, m) + 1):
l_s = (sub_s[n - i] + min((n - i) * k, m - i)) / (n - i)
M = max(l_s, M)
print(M) | ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR LIST NUMBER VAR NUMBER FOR VAR VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR NUMBER VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP FUNC_CALL VAR BIN_OP V... |
Every superhero has been given a power value by the Felicity Committee. The avengers crew wants to maximize the average power of the superheroes in their team by performing certain operations.
Initially, there are $n$ superheroes in avengers team having powers $a_1, a_2, \ldots, a_n$, respectively. In one operation, t... | n, k, m = map(int, input().split())
a = list(map(int, input().split()))
a.sort(reverse=True)
partial = [0]
for val in a:
partial.append(partial[-1] + val)
best = 0.0
for num_remove in range(0, min(n, m + 1)):
num_operations = m - num_remove
num_remain = n - num_remove
num_increase = min(num_operations, ... | ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR LIST NUMBER FOR VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR NUMBER VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR BIN_OP VAR NUMBER ASSIGN ... |
Every superhero has been given a power value by the Felicity Committee. The avengers crew wants to maximize the average power of the superheroes in their team by performing certain operations.
Initially, there are $n$ superheroes in avengers team having powers $a_1, a_2, \ldots, a_n$, respectively. In one operation, t... | n, k, m = map(int, input().split())
arr = list(map(int, input().split()))
arr.sort()
sum = 0
for i in arr:
sum = sum + i
mx = 0
for i in range(len(arr)):
if i > m:
break
mx = max(mx, (sum + min(m - i, (n - i) * k)) / (n - i))
sum = sum - arr[i]
print(mx) | ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR ASSIGN VAR FUNC_CALL VAR VAR BIN_OP BIN_OP VAR F... |
Every superhero has been given a power value by the Felicity Committee. The avengers crew wants to maximize the average power of the superheroes in their team by performing certain operations.
Initially, there are $n$ superheroes in avengers team having powers $a_1, a_2, \ldots, a_n$, respectively. In one operation, t... | n, k, m = map(int, input().split())
a = sorted(list(map(int, input().split())), reverse=True)
p = [0] * (n + 1)
for i in range(1, n + 1):
p[i] = p[i - 1] + a[i - 1]
ans = 0
for i in range(0, min(n - 1, m) + 1):
ans = max(ans, (p[n - i] + min(m - i, (n - i) * k)) / (n - i))
print(ans) | ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR VAR BIN_OP VAR BIN_OP VAR NUMBER VAR BIN_OP VAR NUMBER ASSIGN VAR... |
Every superhero has been given a power value by the Felicity Committee. The avengers crew wants to maximize the average power of the superheroes in their team by performing certain operations.
Initially, there are $n$ superheroes in avengers team having powers $a_1, a_2, \ldots, a_n$, respectively. In one operation, t... | n, k, m = map(int, input().split())
arr = [int(x) for x in input().split()]
k = min(k, m)
arr.sort()
s = [sum(arr)]
for i in range(1, len(arr)):
s.append(s[i - 1] - arr[i - 1])
r = [0] * len(s)
for i in range(len(s)):
f = m - i
if f < 0:
break
r[i] = s[i] + min(k * (n - i), f)
r[i] /= n - i
... | ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR ASSIGN VAR LIST FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR BIN_OP VAR NUMBER VAR BIN_OP VAR NUMBER... |
Every superhero has been given a power value by the Felicity Committee. The avengers crew wants to maximize the average power of the superheroes in their team by performing certain operations.
Initially, there are $n$ superheroes in avengers team having powers $a_1, a_2, \ldots, a_n$, respectively. In one operation, t... | N, K, M = map(int, input().split())
a = sorted(map(int, input().split()))
total = sum(a)
ans = (total + min(K * N, M)) / N
for n in a:
if not M or N == 1:
break
M -= 1
N -= 1
total -= n
ans = max(ans, (total + min(K * N, M)) / N)
print(ans) | ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR FUNC_CALL VAR BIN_OP VAR VAR VAR VAR FOR VAR VAR IF VAR VAR NUMBER VAR NUMBER VAR NUMBER VAR VAR ASSIGN VAR FUNC_CALL VAR VAR BIN_OP B... |
Every superhero has been given a power value by the Felicity Committee. The avengers crew wants to maximize the average power of the superheroes in their team by performing certain operations.
Initially, there are $n$ superheroes in avengers team having powers $a_1, a_2, \ldots, a_n$, respectively. In one operation, t... | n, k, m = (int(i) for i in input().strip().split())
arr = [int(x) for x in input().split()]
arr = sorted(arr)
sum = sum(arr)
for i in range(n):
mid1 = (
0
if n - i - 1 == 0
else (sum - arr[i] + min(k * (n - i - 1), m - 1)) / (n - i - 1)
)
mid2 = (sum + min(k * (n - i), m)) / (n - i)
... | ASSIGN VAR VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER NUMBER NUMBER BIN_OP BIN_OP BIN_OP VAR VAR VAR FUNC_CALL VAR BIN... |
Every superhero has been given a power value by the Felicity Committee. The avengers crew wants to maximize the average power of the superheroes in their team by performing certain operations.
Initially, there are $n$ superheroes in avengers team having powers $a_1, a_2, \ldots, a_n$, respectively. In one operation, t... | n, k, m = input().split()
n = int(n)
k = int(k)
m = int(m)
a = [int(x) for x in input().split()]
a.sort()
avg = []
s = sum(a)
for i in range(0, n):
if i > 0:
s = s - a[i - 1]
if i > m:
break
if (m - i) / k <= n - i:
avg.append((s + m - i) / (n - i))
else:
avg.append((s + ... | ASSIGN VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR NUMBER ASSIGN VAR BIN_OP VAR ... |
Every superhero has been given a power value by the Felicity Committee. The avengers crew wants to maximize the average power of the superheroes in their team by performing certain operations.
Initially, there are $n$ superheroes in avengers team having powers $a_1, a_2, \ldots, a_n$, respectively. In one operation, t... | n, k, m = map(int, input().split())
a = [int(i) for i in input().split()]
a = sorted(a)
s = sum(a)
ans = 0
for i in range(min(n, m + 1)):
s += min(k * (n - i), m - i)
ans = max(s / (len(a) - i), ans)
s -= min(k * (n - i), m - i)
s -= a[i]
print(ans) | ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR BIN_OP VAR VAR BIN_OP VAR VAR ASSIGN VA... |
Every superhero has been given a power value by the Felicity Committee. The avengers crew wants to maximize the average power of the superheroes in their team by performing certain operations.
Initially, there are $n$ superheroes in avengers team having powers $a_1, a_2, \ldots, a_n$, respectively. In one operation, t... | n, k, m = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
s = 0
for i in range(n):
s += a[i]
mx = (s + min(m, k * n)) / n
for i in range(min(m, n - 1)):
s -= a[i]
mx = max(mx, (s + min(m - 1 - i, k * (n - 1 - i))) / (n - i - 1))
print(round(mx, 6)) | ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR FUNC_CALL VAR VAR BIN_OP VAR VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR BIN_OP VAR ... |
Every superhero has been given a power value by the Felicity Committee. The avengers crew wants to maximize the average power of the superheroes in their team by performing certain operations.
Initially, there are $n$ superheroes in avengers team having powers $a_1, a_2, \ldots, a_n$, respectively. In one operation, t... | n, k, m = map(int, input().split())
arr = sorted(list(map(int, input().split())))
csum = [0]
for i in arr:
csum.append(csum[-1] + i)
def f(i):
return (csum[-1] - csum[i] + min(m - i, k * (n - i))) / (n - i)
max = 0
for i in range(min(m + 1, n)):
if f(i) > max:
max = f(i)
print(max) | ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST NUMBER FOR VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR NUMBER VAR FUNC_DEF RETURN BIN_OP BIN_OP BIN_OP VAR NUMBER VAR VAR FUNC_CALL VAR BIN_OP VAR VAR BIN_OP VAR BIN_OP... |
Every superhero has been given a power value by the Felicity Committee. The avengers crew wants to maximize the average power of the superheroes in their team by performing certain operations.
Initially, there are $n$ superheroes in avengers team having powers $a_1, a_2, \ldots, a_n$, respectively. In one operation, t... | n, k, m = list(map(int, input().split()))
l = list(map(int, input().split()))
res = 0
avg = sum(l) / n
s = sum(l)
l.sort()
for i in range(min(n, m + 1)):
if i > 0:
s -= l[i - 1]
left = m - i
temp = min(left, k * (n - i))
res = max(res, (s + temp) / (n - i))
print(res) | ASSIGN VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP FUNC_CALL VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER IF VAR NUMBER ... |
Every superhero has been given a power value by the Felicity Committee. The avengers crew wants to maximize the average power of the superheroes in their team by performing certain operations.
Initially, there are $n$ superheroes in avengers team having powers $a_1, a_2, \ldots, a_n$, respectively. In one operation, t... | n, k, m = list(map(int, input().split()))
A = list(map(int, input().split()))
A.sort()
sum_A = sum(A)
avg = sum_A / n
i = 0
potential = lambda n, k, m: min(k * n, m) / n
avg_subtracted = lambda s, n, a: (s - a) / (n - 1)
while (
n > 1
and m > 0
and i < len(A)
and avg_subtracted(sum_A, n, A[i]) + potenti... | ASSIGN VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP FUNC_CALL VAR BIN_OP VAR VAR VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VA... |
Every superhero has been given a power value by the Felicity Committee. The avengers crew wants to maximize the average power of the superheroes in their team by performing certain operations.
Initially, there are $n$ superheroes in avengers team having powers $a_1, a_2, \ldots, a_n$, respectively. In one operation, t... | n, k, m = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
res = 0
if m < n:
res = (sum(a) + m) / n
for i in range(1, m + 1):
res = max(res, (sum(a[i:]) + (m - i)) / (n - i))
else:
res = a[-1] + min(m - n + 1, k)
print(res) | ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR NUMBER IF VAR VAR ASSIGN VAR BIN_OP BIN_OP FUNC_CALL VAR VAR VAR VAR FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR BIN_OP BIN_OP FUN... |
Every superhero has been given a power value by the Felicity Committee. The avengers crew wants to maximize the average power of the superheroes in their team by performing certain operations.
Initially, there are $n$ superheroes in avengers team having powers $a_1, a_2, \ldots, a_n$, respectively. In one operation, t... | import sys
input = sys.stdin.readline
n, k, m = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
s = sum(a)
ans = (min(k * n, m) + s) / n
for i in range(n - 1):
if i + 1 > m:
break
s -= a[i]
ans = max(ans, (min(k * (n - i - 1), m - i - 1) + s) / (n - i - 1))
print(ans) | IMPORT ASSIGN VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP BIN_OP FUNC_CALL VAR BIN_OP VAR VAR VAR VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER IF BIN_OP VAR NU... |
Every superhero has been given a power value by the Felicity Committee. The avengers crew wants to maximize the average power of the superheroes in their team by performing certain operations.
Initially, there are $n$ superheroes in avengers team having powers $a_1, a_2, \ldots, a_n$, respectively. In one operation, t... | n, k, m = map(int, input().split())
a = sorted(map(int, input().split()))
s = sum(a)
ans = s / n
for i in range(min(n, m + 1)):
x = s + min((n - i) * k, m - i)
ans = max(ans, x / (n - i))
s -= a[i]
print("%.17f" % ans) | ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR FUNC_CALL VAR BIN_OP BIN_OP VAR VAR VAR BIN_OP VAR VAR AS... |
Every superhero has been given a power value by the Felicity Committee. The avengers crew wants to maximize the average power of the superheroes in their team by performing certain operations.
Initially, there are $n$ superheroes in avengers team having powers $a_1, a_2, \ldots, a_n$, respectively. In one operation, t... | n, k, m = map(int, input().split())
arr = list(map(int, input().split()))
arr.sort()
s = sum(arr)
i = 0
ans = -1
if n == 1:
print(arr[0] + min(k, m))
else:
elements = n
while i < n - 1 and m > 0:
avg1 = s + min(elements * k, m)
avg1 = avg1 / elements
avg2 = s - arr[i] + min((elements... | ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR NUMBER FUNC_CALL VAR VAR VAR ASSIGN VAR VAR WHILE VAR BIN_OP VAR... |
Every superhero has been given a power value by the Felicity Committee. The avengers crew wants to maximize the average power of the superheroes in their team by performing certain operations.
Initially, there are $n$ superheroes in avengers team having powers $a_1, a_2, \ldots, a_n$, respectively. In one operation, t... | n, k, m = map(int, input().split())
players = list(map(int, input().split()))
players.sort()
s = sum(players)
ans = 0
for i in range(n):
if i <= m:
gain = min(m - i, k * (n - i))
avg = (s + gain) / (n - i)
if avg > ans:
ans = avg
else:
break
s -= players[i]
print(... | ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR ASSIGN VAR FUNC_CALL VAR BIN_OP VAR VAR BIN_OP VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP BIN_O... |
Every superhero has been given a power value by the Felicity Committee. The avengers crew wants to maximize the average power of the superheroes in their team by performing certain operations.
Initially, there are $n$ superheroes in avengers team having powers $a_1, a_2, \ldots, a_n$, respectively. In one operation, t... | R = lambda: map(int, input().split())
n, k, m = R()
L = sorted(R(), reverse=True)
s = sum(L)
s1 = 0
i = n - 1
ma = 0
j = 0
while i >= 0 and j <= m:
ma = max(ma, (s + min(m - j, k * (n - j))) / (n - j))
s -= L[i]
j += 1
i -= 1
print(ma) | ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR NUMBER VAR VAR ASSIGN VAR FUNC_CALL VAR VAR BIN_OP BIN_OP VAR FUNC... |
Every superhero has been given a power value by the Felicity Committee. The avengers crew wants to maximize the average power of the superheroes in their team by performing certain operations.
Initially, there are $n$ superheroes in avengers team having powers $a_1, a_2, \ldots, a_n$, respectively. In one operation, t... | n, k, m = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
curn, curs = n, sum(a)
ans = (curs + min(k * curn, m)) / curn
for i in range(n - 1):
if i + 1 > m:
break
curn -= 1
curs -= a[i]
ans = max(ans, (curs + min(k * curn, m - i - 1)) / curn)
print("%.8f" % ans) | ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR FUNC_CALL VAR BIN_OP VAR VAR VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER IF BIN_OP VAR NUMBER VAR VAR N... |
Every superhero has been given a power value by the Felicity Committee. The avengers crew wants to maximize the average power of the superheroes in their team by performing certain operations.
Initially, there are $n$ superheroes in avengers team having powers $a_1, a_2, \ldots, a_n$, respectively. In one operation, t... | def solve(a, n, k, m):
a.sort(reverse=True)
sm = sum(a)
avg = float((sm + min(len(a) * k, m)) / len(a))
while len(a) > 1 and m > 0:
m -= 1
sm -= a.pop()
avg = max(avg, (sm + min(len(a) * k, m)) / len(a))
return avg
n, k, m = map(int, input().split())
a = list(map(int, input... | FUNC_DEF EXPR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR BIN_OP BIN_OP VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR VAR VAR FUNC_CALL VAR VAR WHILE FUNC_CALL VAR VAR NUMBER VAR NUMBER VAR NUMBER VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR BIN_OP BIN_OP VAR FUNC_CALL VAR BIN_OP FUNC_CALL... |
Every superhero has been given a power value by the Felicity Committee. The avengers crew wants to maximize the average power of the superheroes in their team by performing certain operations.
Initially, there are $n$ superheroes in avengers team having powers $a_1, a_2, \ldots, a_n$, respectively. In one operation, t... | def main():
n, k, m = [int(v) for v in input().split()]
vals = [int(v) for v in input().split()]
vals.sort()
data = [vals[0]]
for i in range(1, n):
data.append(data[i - 1] + vals[i])
max_v = 0
total = data[-1]
for i in range(0, min(m + 1, n)):
s = total - (data[i - 1] if ... | FUNC_DEF ASSIGN VAR VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR LIST VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR EXPR FUNC_CALL VAR BIN_OP VAR BIN_OP VAR NUMBER VAR VAR ASSIGN VAR NUMBER ASSIGN VAR VAR NUMBER FOR VAR FUNC_C... |
Every superhero has been given a power value by the Felicity Committee. The avengers crew wants to maximize the average power of the superheroes in their team by performing certain operations.
Initially, there are $n$ superheroes in avengers team having powers $a_1, a_2, \ldots, a_n$, respectively. In one operation, t... | n, k, m = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
b = sum(a)
ans = (b + min(n * k, m)) / len(a)
for i in range(min(n - 1, m)):
b = b - a[i]
ans = max(ans, (b + min((n - 1 - i) * k, m - 1 - i)) / (n - 1 - i))
print(ans) | ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR FUNC_CALL VAR BIN_OP VAR VAR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR ASSIGN... |
Every superhero has been given a power value by the Felicity Committee. The avengers crew wants to maximize the average power of the superheroes in their team by performing certain operations.
Initially, there are $n$ superheroes in avengers team having powers $a_1, a_2, \ldots, a_n$, respectively. In one operation, t... | import sys
data = sys.stdin.read().splitlines()
n, k, m = map(int, data[0].split())
nums = list(map(int, data[1].split()))
nums.sort()
s = sum(nums)
mx = (s + min(m, k * n)) / n
for idx, num in enumerate(nums):
if idx == n - 1:
break
if idx < m:
s -= num
add = min((n - idx - 1) * k, m -... | IMPORT ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR FUNC_CALL VAR VAR BIN_OP VAR VAR VAR FOR VAR VAR FUNC_CALL VAR VAR IF VAR BIN_O... |
Every superhero has been given a power value by the Felicity Committee. The avengers crew wants to maximize the average power of the superheroes in their team by performing certain operations.
Initially, there are $n$ superheroes in avengers team having powers $a_1, a_2, \ldots, a_n$, respectively. In one operation, t... | n, k, m = input().split()
k = int(k)
m = int(m)
n = int(n)
niz = [int(n) for n in input().split()]
niz.sort()
suma = sum(niz)
curMax = (suma + min(m, n * k)) / n
for i in range(1, min(n - 1, m) + 1):
suma -= niz[i - 1]
tempMax = (suma + min(m - i, (n - i) * k)) / (n - i)
if tempMax > curMax:
curMax ... | ASSIGN VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR FUNC_CALL VAR VAR BIN_OP VAR VAR VAR FOR VAR FUNC_CALL V... |
Every superhero has been given a power value by the Felicity Committee. The avengers crew wants to maximize the average power of the superheroes in their team by performing certain operations.
Initially, there are $n$ superheroes in avengers team having powers $a_1, a_2, \ldots, a_n$, respectively. In one operation, t... | n, k, m = list(map(int, input().split()))
l = sorted(list(map(int, input().split())))
tot = 0
prefix = []
ans = 0.0
for i in range(n):
tot += l[i]
prefix.append(tot)
prefix.insert(0, 0)
for i in range(n + 1):
if m > 0:
t = prefix[n] - prefix[i]
if i != 0:
m -= 1
if m <= (... | ASSIGN VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR VAR VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR NUMBER NUMBER FOR VAR FUNC_CALL ... |
Every superhero has been given a power value by the Felicity Committee. The avengers crew wants to maximize the average power of the superheroes in their team by performing certain operations.
Initially, there are $n$ superheroes in avengers team having powers $a_1, a_2, \ldots, a_n$, respectively. In one operation, t... | n, k, m = map(int, input().split())
a = sorted(map(int, input().split()))
s = sum(a)
ans = 0.0
for i in range(n):
ans = max(ans, (s + min((n - i) * k, m)) / (n - i))
s -= a[i]
if m == 0:
break
m -= 1
print("%.8f" % ans) | ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR BIN_OP BIN_OP VAR FUNC_CALL VAR BIN_OP BIN_OP VAR VAR VAR VAR BIN_OP VAR VAR VAR VAR VAR I... |
Every superhero has been given a power value by the Felicity Committee. The avengers crew wants to maximize the average power of the superheroes in their team by performing certain operations.
Initially, there are $n$ superheroes in avengers team having powers $a_1, a_2, \ldots, a_n$, respectively. In one operation, t... | n, k, m = map(int, input().split())
power_list = list(map(float, input().split()))
power_list.sort()
sum_list = [0]
for i in range(n):
sum_list.append(sum_list[i] + power_list[i])
ans = -1.0
for i in range(min(m + 1, n)):
ans = max(
ans,
float(sum_list[n] - sum_list[i] + float(min(m - i, (n - i)... | ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR LIST NUMBER FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR VAR VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR ASSIGN... |
Every superhero has been given a power value by the Felicity Committee. The avengers crew wants to maximize the average power of the superheroes in their team by performing certain operations.
Initially, there are $n$ superheroes in avengers team having powers $a_1, a_2, \ldots, a_n$, respectively. In one operation, t... | n, k, m = map(int, input().split())
a = sorted(map(int, input().split()), reverse=True)
best = 0
summation = sum(a)
while n > 0 and m >= 0:
best = max(best, (summation + min(m, k * n)) / n)
summation -= a[-1]
n -= 1
m -= 1
a.pop()
print(best) | ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR WHILE VAR NUMBER VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR BIN_OP BIN_OP VAR FUNC_CALL VAR VAR BIN_OP VAR VAR VAR VAR VAR NUMBER VAR NUMBER ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.