description stringlengths 171 4k | code stringlengths 94 3.98k | normalized_code stringlengths 57 4.99k |
|---|---|---|
You are playing another computer game, and now you have to slay $n$ monsters. These monsters are standing in a circle, numbered clockwise from $1$ to $n$. Initially, the $i$-th monster has $a_i$ health.
You may shoot the monsters to kill them. Each shot requires exactly one bullet and decreases the health of the targe... | import sys
def solve():
t = int(sys.stdin.readline())
for _ in range(t):
n = int(sys.stdin.readline())
blast = 0
minb = 0
s = 0
a0 = 0
for i in range(n):
ai, bi = map(int, sys.stdin.readline().split())
bbigger = False
if i != ... | IMPORT FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER IF VAR NUMBER IF VAR NUMBER... |
You are playing another computer game, and now you have to slay $n$ monsters. These monsters are standing in a circle, numbered clockwise from $1$ to $n$. Initially, the $i$-th monster has $a_i$ health.
You may shoot the monsters to kill them. Each shot requires exactly one bullet and decreases the health of the targe... | import sys
input = sys.stdin.buffer.readline
t = int(input())
for _ in range(t):
n = int(input())
a, b = [], []
for i in range(n):
x, y = map(int, input().split())
a.append(x)
b.append(y)
c = [(0) for _ in range(n)]
c_sum = 0
for i in range(n):
if i == 0:
... | IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR LIST LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR ... |
You are playing another computer game, and now you have to slay $n$ monsters. These monsters are standing in a circle, numbered clockwise from $1$ to $n$. Initially, the $i$-th monster has $a_i$ health.
You may shoot the monsters to kill them. Each shot requires exactly one bullet and decreases the health of the targe... | import sys
readline = sys.stdin.buffer.readline
T = int(readline())
Ans = [None] * T
inf = 1 << 60
for qu in range(T):
N = int(readline())
AB = [tuple(map(int, readline().split())) for _ in range(N)]
A, B = map(list, zip(*AB))
CA = [0] * N
CA[0] = max(0, A[0] - B[N - 1])
for i in range(N):
... | IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NONE VAR ASSIGN VAR BIN_OP NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CAL... |
You are playing another computer game, and now you have to slay $n$ monsters. These monsters are standing in a circle, numbered clockwise from $1$ to $n$. Initially, the $i$-th monster has $a_i$ health.
You may shoot the monsters to kill them. Each shot requires exactly one bullet and decreases the health of the targe... | import sys
input = sys.stdin.buffer.readline
t = int(input())
for _ in range(t):
n = int(input())
x, y = map(int, input().split())
a, b = x, y
suma = 0
mini = float("inf")
for __ in range(n - 1):
x, y = map(int, input().split())
dmg = max(x - b, 0)
suma += dmg
mi... | IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR VAR ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR STRING FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR VAR FUNC_CALL... |
You are playing another computer game, and now you have to slay $n$ monsters. These monsters are standing in a circle, numbered clockwise from $1$ to $n$. Initially, the $i$-th monster has $a_i$ health.
You may shoot the monsters to kill them. Each shot requires exactly one bullet and decreases the health of the targe... | import sys
input = sys.stdin.buffer.readline
t = int(input())
ans = []
for _ in range(t):
n = int(input())
a = []
b = []
for _ in range(n):
a_, b_ = map(int, input().split())
a.append(a_)
b.append(b_)
cost = a[0]
for i in range(n - 1):
next_i = i + 1
if b... | IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR VAR NU... |
You are playing another computer game, and now you have to slay $n$ monsters. These monsters are standing in a circle, numbered clockwise from $1$ to $n$. Initially, the $i$-th monster has $a_i$ health.
You may shoot the monsters to kill them. Each shot requires exactly one bullet and decreases the health of the targe... | import sys
input = sys.stdin.buffer.readline
t = int(input())
ans = []
for _ in range(t):
n = int(input())
a = [0] * n
b = [0] * n
total = 0
minA = -1
for i in range(n):
a1, b1 = map(int, input().split())
a[i] = a1
b[i] = b1
if not i == 0:
x = max(0, ... | IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_... |
You are playing another computer game, and now you have to slay $n$ monsters. These monsters are standing in a circle, numbered clockwise from $1$ to $n$. Initially, the $i$-th monster has $a_i$ health.
You may shoot the monsters to kill them. Each shot requires exactly one bullet and decreases the health of the targe... | import sys
def data():
return sys.stdin.buffer.readline().strip()
def mdata():
return map(int, data().split())
for t in range(int(data())):
n = int(data())
a, b = mdata()
a1, b1 = a, b
k = s = a1
for i in range(n - 1):
x, y = mdata()
if x > b:
s = s + x - b
... | IMPORT FUNC_DEF RETURN FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR ASSIGN VAR VAR VAR VAR ASSIGN VAR VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR VAR ... |
You are playing another computer game, and now you have to slay $n$ monsters. These monsters are standing in a circle, numbered clockwise from $1$ to $n$. Initially, the $i$-th monster has $a_i$ health.
You may shoot the monsters to kill them. Each shot requires exactly one bullet and decreases the health of the targe... | import sys
input = sys.stdin.buffer.readline
t = int(input())
for k in range(t):
arr = []
ls = []
n = int(input())
for j in range(n):
h, d = map(int, input().split())
arr.append(h)
ls.append(d)
for i in range(n - 1):
ls[i] = min(ls[i], arr[i + 1])
ls[-1] = min(ls... | IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR ... |
You are playing another computer game, and now you have to slay $n$ monsters. These monsters are standing in a circle, numbered clockwise from $1$ to $n$. Initially, the $i$-th monster has $a_i$ health.
You may shoot the monsters to kill them. Each shot requires exactly one bullet and decreases the health of the targe... | import sys
from itertools import islice
stdin = sys.stdin
T = int(stdin.readline())
def kill_mon(arr):
last_explosion = arr[-1][1]
bullets = 0
mini = 100000000000000000000
for hp, exp in arr:
if hp > last_explosion:
bullets += hp - last_explosion
candidate = last_explosion... | IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF ASSIGN VAR VAR NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR VAR IF VAR VAR VAR BIN_OP VAR VAR ASSIGN VAR VAR VAR VAR VAR IF VAR VAR ASSIGN VAR VAR ASSIGN VAR VAR RETURN BIN_OP VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VA... |
You are playing another computer game, and now you have to slay $n$ monsters. These monsters are standing in a circle, numbered clockwise from $1$ to $n$. Initially, the $i$-th monster has $a_i$ health.
You may shoot the monsters to kill them. Each shot requires exactly one bullet and decreases the health of the targe... | from sys import stdin
input = stdin.buffer.readline
for _ in range(int(input())):
n = int(input())
a, b = [0] * n, [0] * n
for i in range(n):
a[i], b[i] = map(int, input().split())
mini, minb = -1, 1e18
for i in range(n):
e = a[i] - max(0, a[i] - b[i - 1])
if e < minb:
... | ASSIGN VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR BIN_OP LIST NUMBER VAR BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VA... |
You are playing another computer game, and now you have to slay $n$ monsters. These monsters are standing in a circle, numbered clockwise from $1$ to $n$. Initially, the $i$-th monster has $a_i$ health.
You may shoot the monsters to kill them. Each shot requires exactly one bullet and decreases the health of the targe... | from sys import gettrace, stdin
def input():
return stdin.buffer.readline()
def main():
def solve():
n = int(input())
aa = []
bb = []
mins = int(100000000000000.0)
sum = 0
for i in range(n):
a, b = map(int, input().split())
aa.append(a... | FUNC_DEF RETURN FUNC_CALL VAR FUNC_DEF FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR ... |
You are playing another computer game, and now you have to slay $n$ monsters. These monsters are standing in a circle, numbered clockwise from $1$ to $n$. Initially, the $i$-th monster has $a_i$ health.
You may shoot the monsters to kill them. Each shot requires exactly one bullet and decreases the health of the targe... | import sys
input = sys.stdin.buffer.readline
t = int(input())
for _ in range(t):
n = int(input())
count = 0
a = [0] * n
b = [0] * n
minimum = 10**12 + 1
for l in range(n):
a[l], b[l] = map(int, input().split())
for i in range(n):
if a[i] - b[i - 1] > 0:
count += ... | IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR VAR FUNC_CALL VAR... |
You are playing another computer game, and now you have to slay $n$ monsters. These monsters are standing in a circle, numbered clockwise from $1$ to $n$. Initially, the $i$-th monster has $a_i$ health.
You may shoot the monsters to kill them. Each shot requires exactly one bullet and decreases the health of the targe... | import sys
input = sys.stdin.buffer.readline
def gift():
for _ in range(t):
n = int(input())
inamo = []
for i in range(n):
mosnteri = list(map(int, input().split()))
inamo.append(mosnteri)
dingding = [max(inamo[0][0] - inamo[n - 1][1], 0)]
biu = din... | IMPORT ASSIGN VAR VAR FUNC_DEF FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR LIST FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER VAR BIN_OP VAR NUMBER NUMBER NUMBER A... |
You are playing another computer game, and now you have to slay $n$ monsters. These monsters are standing in a circle, numbered clockwise from $1$ to $n$. Initially, the $i$-th monster has $a_i$ health.
You may shoot the monsters to kill them. Each shot requires exactly one bullet and decreases the health of the targe... | import sys
input = sys.stdin.buffer.readline
t = int(input())
for _ in range(t):
n = int(input())
a = []
b = []
for __ in range(n):
aa, bb = [int(x) for x in input().split()]
a.append(aa)
b.append(bb)
if n == 1:
print(a[0])
continue
total = 0
for i in... | IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR IF VAR NUMBER EXPR FUNC_CALL ... |
You are playing another computer game, and now you have to slay $n$ monsters. These monsters are standing in a circle, numbered clockwise from $1$ to $n$. Initially, the $i$-th monster has $a_i$ health.
You may shoot the monsters to kill them. Each shot requires exactly one bullet and decreases the health of the targe... | from sys import stdin, stdout
t = int(stdin.readline())
ans = []
for s in range(t):
n = int(stdin.readline())
least, bs = map(int, stdin.readline().split())
start = least
total = 0
for i in range(n - 1):
a, b = map(int, stdin.readline().split())
least = min(least, a, bs)
tot... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FU... |
You are playing another computer game, and now you have to slay $n$ monsters. These monsters are standing in a circle, numbered clockwise from $1$ to $n$. Initially, the $i$-th monster has $a_i$ health.
You may shoot the monsters to kill them. Each shot requires exactly one bullet and decreases the health of the targe... | import sys
input = sys.stdin.buffer.readline
a = int(input())
for x in range(a):
d = int(input())
j = []
h = 0
mi = 0
p = 0
for y in range(d):
b, c = map(int, input().split())
j.append([b, c])
if y == 0:
h += b
elif p - b >= 0:
pass
... | IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR LIST VAR VAR IF VAR NU... |
You are playing another computer game, and now you have to slay $n$ monsters. These monsters are standing in a circle, numbered clockwise from $1$ to $n$. Initially, the $i$-th monster has $a_i$ health.
You may shoot the monsters to kill them. Each shot requires exactly one bullet and decreases the health of the targe... | import sys
def main():
res = ""
input = sys.stdin.readline
print = sys.stdout.write
t = int(input())
for _ in range(t):
sub_res = 0
n = int(input())
hp_f, boom_f = map(int, input().split())
boom_last = boom_f
min_hp = hp_f
for __ in range(n - 1):
... | IMPORT FUNC_DEF ASSIGN VAR STRING ASSIGN VAR VAR ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR ASSIGN VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN ... |
You are playing another computer game, and now you have to slay $n$ monsters. These monsters are standing in a circle, numbered clockwise from $1$ to $n$. Initially, the $i$-th monster has $a_i$ health.
You may shoot the monsters to kill them. Each shot requires exactly one bullet and decreases the health of the targe... | import sys
def main():
import sys
input = sys.stdin.buffer.readline
for _ in range(int(input())):
n = int(input())
l = []
for i in range(n):
a, b = map(int, input().split())
l.append([a, b])
ans = 0
for i in range(n - 1):
if l[i]... | IMPORT FUNC_DEF IMPORT ASSIGN VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR LIST VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER IF B... |
You are playing another computer game, and now you have to slay $n$ monsters. These monsters are standing in a circle, numbered clockwise from $1$ to $n$. Initially, the $i$-th monster has $a_i$ health.
You may shoot the monsters to kill them. Each shot requires exactly one bullet and decreases the health of the targe... | import sys
input = sys.stdin.buffer.readline
t = int(input())
for _ in range(t):
n = int(input())
a = []
b = []
for i in range(0, n):
ai, bi = list(map(int, input().split()))
a.append(ai)
b.append(bi)
extra = []
for i in range(0, n):
extra.append(max(0, a[i] - b[... | IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR L... |
You are playing another computer game, and now you have to slay $n$ monsters. These monsters are standing in a circle, numbered clockwise from $1$ to $n$. Initially, the $i$-th monster has $a_i$ health.
You may shoot the monsters to kill them. Each shot requires exactly one bullet and decreases the health of the targe... | import sys
input = sys.stdin.buffer.readline
MI = 10**12 + 1
t = int(input())
for _ in range(t):
n = int(input())
nums = [tuple(map(int, input().split())) for _ in range(n)]
ans = 0
mi = MI
for i, num in enumerate(nums):
_, before_b = nums[i - 1]
a, _ = num
damage = max(0, a... | IMPORT ASSIGN VAR VAR ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR VAR FOR VAR VAR FUNC_CALL VAR ... |
You are playing another computer game, and now you have to slay $n$ monsters. These monsters are standing in a circle, numbered clockwise from $1$ to $n$. Initially, the $i$-th monster has $a_i$ health.
You may shoot the monsters to kill them. Each shot requires exactly one bullet and decreases the health of the targe... | import sys
input = sys.stdin.buffer.readline
for _ in range(int(input())):
n = int(input())
a, b, d, s_d = [0] * n, [0] * n, [0] * n, 0
for i in range(n):
a[i], b[i] = map(int, input().split())
d[i] = a[i] if i == 0 else max(0, a[i] - b[i - 1])
s_d += d[i]
ans, s_m = s_d, s_d - ... | IMPORT ASSIGN VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR VAR BIN_OP LIST NUMBER VAR BIN_OP LIST NUMBER VAR BIN_OP LIST NUMBER VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR ... |
You are playing another computer game, and now you have to slay $n$ monsters. These monsters are standing in a circle, numbered clockwise from $1$ to $n$. Initially, the $i$-th monster has $a_i$ health.
You may shoot the monsters to kill them. Each shot requires exactly one bullet and decreases the health of the targe... | import sys
input = sys.stdin.buffer.readline
t = int(input())
for _ in range(t):
n = int(input())
ans = 0
c = []
mn = 10**15
for i in range(n):
a, b = map(int, input().split())
c.append((a, b))
for i in range(n):
k = max(0, c[i][0] - c[i - 1][1])
ans += k
... | IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR LIST ASSIGN VAR BIN_OP NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR VAR VAR FOR VAR FUNC_CALL ... |
You are playing another computer game, and now you have to slay $n$ monsters. These monsters are standing in a circle, numbered clockwise from $1$ to $n$. Initially, the $i$-th monster has $a_i$ health.
You may shoot the monsters to kill them. Each shot requires exactly one bullet and decreases the health of the targe... | import sys
input = sys.stdin.buffer.readline
def solution():
n = int(input())
a = []
m = 1e18
b = []
ans = 0
for i in range(n):
x, y = map(int, input().split())
a.append(x)
b.append(y)
for i in range(n):
z = (i + 1) % n
val = min(a[z], b[i])
... | IMPORT ASSIGN VAR VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP BIN_OP VA... |
You are playing another computer game, and now you have to slay $n$ monsters. These monsters are standing in a circle, numbered clockwise from $1$ to $n$. Initially, the $i$-th monster has $a_i$ health.
You may shoot the monsters to kill them. Each shot requires exactly one bullet and decreases the health of the targe... | import sys
input = sys.stdin.buffer.readline
for _ in range(int(input())):
n = int(input())
h, d = [0] * n, [0] * n
for i in range(n):
x, y = map(int, input().split())
h[i], d[i] = x, y
for i in range(n - 1):
d[i] = min(d[i], h[i + 1])
d[-1] = min(d[-1], h[0])
print(sum(... | IMPORT ASSIGN VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR BIN_OP LIST NUMBER VAR BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR VAR VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR N... |
You are playing another computer game, and now you have to slay $n$ monsters. These monsters are standing in a circle, numbered clockwise from $1$ to $n$. Initially, the $i$-th monster has $a_i$ health.
You may shoot the monsters to kill them. Each shot requires exactly one bullet and decreases the health of the targe... | import sys
read = sys.stdin.buffer.read
input = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
t = int(input())
for i in range(t):
n = int(input())
a = []
b = []
for j in range(n):
c = list(map(int, input().split()))
a.append(c[0])
b.append(c[1])
for j in r... | IMPORT ASSIGN VAR VAR ASSIGN VAR VAR ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR VAR NUMBER EXPR FUNC... |
You are playing another computer game, and now you have to slay $n$ monsters. These monsters are standing in a circle, numbered clockwise from $1$ to $n$. Initially, the $i$-th monster has $a_i$ health.
You may shoot the monsters to kill them. Each shot requires exactly one bullet and decreases the health of the targe... | import sys
I = sys.stdin.buffer.readline
for _ in range(int(I())):
n = int(I())
a = []
b = []
c = [0]
sumi = 0
ans = int(1e17)
for i in range(n):
ai, bi = map(int, I().split())
a.append(ai)
b.append(bi)
if i != 0:
c.append(max(0, a[i] - b[(i - 1) ... | IMPORT ASSIGN VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR LIST NUMBER ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR VA... |
You are playing another computer game, and now you have to slay $n$ monsters. These monsters are standing in a circle, numbered clockwise from $1$ to $n$. Initially, the $i$-th monster has $a_i$ health.
You may shoot the monsters to kill them. Each shot requires exactly one bullet and decreases the health of the targe... | from sys import stdin
def input():
return stdin.buffer.readline()
for _ in range(int(input())):
n = int(input())
a, b = list(), list()
for __ in range(n):
ai, bi = map(int, input().split())
a.append(ai)
b.append(bi)
gain = [0] * n
gain[0] = min(a[0], b[n - 1])
imi... | FUNC_DEF RETURN FUNC_CALL VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER... |
You are playing another computer game, and now you have to slay $n$ monsters. These monsters are standing in a circle, numbered clockwise from $1$ to $n$. Initially, the $i$-th monster has $a_i$ health.
You may shoot the monsters to kill them. Each shot requires exactly one bullet and decreases the health of the targe... | import sys
input = sys.stdin.buffer.readline
for _ in range(int(input())):
n = int(input())
health, damage = [], []
a, b, _min = 0, 0, 10**15
for i in range(n):
h, d = map(int, input().split())
a += h
health.append(h)
damage.append(d)
for i in range(n):
damag... | IMPORT ASSIGN VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR LIST LIST ASSIGN VAR VAR VAR NUMBER NUMBER BIN_OP NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL V... |
You are playing another computer game, and now you have to slay $n$ monsters. These monsters are standing in a circle, numbered clockwise from $1$ to $n$. Initially, the $i$-th monster has $a_i$ health.
You may shoot the monsters to kill them. Each shot requires exactly one bullet and decreases the health of the targe... | import sys
read = sys.stdin.buffer.read
input = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
t = int(input())
for case in range(t):
n = int(input())
a = [0] * n
b = [0] * n
c = [0] * n
min_c = 10**13
sum_a = 0
sum_c = 0
for i in range(n):
a[i], b[i] = map(int... | IMPORT ASSIGN VAR VAR ASSIGN VAR VAR ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR BIN_OP NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR N... |
You are playing another computer game, and now you have to slay $n$ monsters. These monsters are standing in a circle, numbered clockwise from $1$ to $n$. Initially, the $i$-th monster has $a_i$ health.
You may shoot the monsters to kill them. Each shot requires exactly one bullet and decreases the health of the targe... | import sys
input = sys.stdin.buffer.readline
def swaparr(arr, a, b):
temp = arr[a]
arr[a] = arr[b]
arr[b] = temp
def gcd(a, b):
if a == 0:
return b
return gcd(b % a, a)
def primefs(n):
primes = {}
while n % 2 == 0:
primes[2] = primes.get(2, 0) + 1
n = n // 2
... | IMPORT ASSIGN VAR VAR FUNC_DEF ASSIGN VAR VAR VAR ASSIGN VAR VAR VAR VAR ASSIGN VAR VAR VAR FUNC_DEF IF VAR NUMBER RETURN VAR RETURN FUNC_CALL VAR BIN_OP VAR VAR VAR FUNC_DEF ASSIGN VAR DICT WHILE BIN_OP VAR NUMBER NUMBER ASSIGN VAR NUMBER BIN_OP FUNC_CALL VAR NUMBER NUMBER NUMBER ASSIGN VAR BIN_OP VAR NUMBER FOR VAR F... |
You are playing another computer game, and now you have to slay $n$ monsters. These monsters are standing in a circle, numbered clockwise from $1$ to $n$. Initially, the $i$-th monster has $a_i$ health.
You may shoot the monsters to kill them. Each shot requires exactly one bullet and decreases the health of the targe... | from sys import stdin
input = stdin.buffer.readline
N = int(input())
for Num in range(N):
num1 = int(input())
list1 = []
bull = 0
prev = 0
for _ in range(num1):
p, q = map(int, input().split())
list1.append([p, q])
if len(list1) != 1:
if p > prev:
... | ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR LIST VAR VAR IF FUNC_CALL VAR VAR NUMBER IF VAR... |
You are playing another computer game, and now you have to slay $n$ monsters. These monsters are standing in a circle, numbered clockwise from $1$ to $n$. Initially, the $i$-th monster has $a_i$ health.
You may shoot the monsters to kill them. Each shot requires exactly one bullet and decreases the health of the targe... | import sys
input = sys.stdin.buffer.readline
T = int(input())
for iTest in range(T):
w = int(input())
a = [0] * w
b = [0] * w
for i in range(w):
a[i], b[i] = map(int, input().split())
b[w - 1] = min(a[0], b[w - 1])
for i in range(w - 1):
b[i] = min(b[i], a[i + 1])
print(sum(... | IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP VAR NUMBER FUNC_C... |
You are playing another computer game, and now you have to slay $n$ monsters. These monsters are standing in a circle, numbered clockwise from $1$ to $n$. Initially, the $i$-th monster has $a_i$ health.
You may shoot the monsters to kill them. Each shot requires exactly one bullet and decreases the health of the targe... | import sys
input = sys.stdin.readline
INF = 1001002003004005006
def main():
t = int(input())
for _ in range(t):
n = int(input())
ans, mi, blast = 0, INF, 0
for i in range(n):
a, b = map(int, input().split())
if i:
if a > blast:
... | IMPORT ASSIGN VAR VAR ASSIGN VAR NUMBER FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR NUMBER VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR IF VAR VAR VAR BIN_OP VAR VAR ASSIGN VAR... |
You are playing another computer game, and now you have to slay $n$ monsters. These monsters are standing in a circle, numbered clockwise from $1$ to $n$. Initially, the $i$-th monster has $a_i$ health.
You may shoot the monsters to kill them. Each shot requires exactly one bullet and decreases the health of the targe... | from sys import stdin, stdout
t = int(stdin.readline())
for _ in range(t):
n = int(stdin.readline())
a, b = map(int, stdin.readline().split())
ttt = a
mn = a
if n == 1:
print(a)
else:
ans = 0
for i in range(n - 1):
x, y = map(int, stdin.readline().split())
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR ASSIGN VAR VAR IF VAR NUMBER EXPR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR VAR F... |
You are playing another computer game, and now you have to slay $n$ monsters. These monsters are standing in a circle, numbered clockwise from $1$ to $n$. Initially, the $i$-th monster has $a_i$ health.
You may shoot the monsters to kill them. Each shot requires exactly one bullet and decreases the health of the targe... | from sys import stdin, stdout
input = stdin.buffer.readline
t = int(input())
for _ in range(t):
n = int(input())
a = []
b = []
for __ in range(n):
x, y = list(map(int, input().split()))
a.append(x)
b.append(y)
sm = max(0, a[0] - b[-1])
a[0] -= max(0, a[0] - b[-1])
fo... | ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR N... |
You are playing another computer game, and now you have to slay $n$ monsters. These monsters are standing in a circle, numbered clockwise from $1$ to $n$. Initially, the $i$-th monster has $a_i$ health.
You may shoot the monsters to kill them. Each shot requires exactly one bullet and decreases the health of the targe... | import sys
input = sys.stdin.buffer.readline
def kot(a, b):
if a > b:
return a - b
else:
return 0
def sol():
n = int(input())
mon = [[0, 0]] * n
for x in range(0, n):
mon[x] = list(map(int, input().split()))
a = mon[0][0]
for x in range(1, n):
if mon[x][0... | IMPORT ASSIGN VAR VAR FUNC_DEF IF VAR VAR RETURN BIN_OP VAR VAR RETURN NUMBER FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST LIST NUMBER NUMBER VAR FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR NUMBER NUMBER FOR VAR FUNC_CA... |
You are playing another computer game, and now you have to slay $n$ monsters. These monsters are standing in a circle, numbered clockwise from $1$ to $n$. Initially, the $i$-th monster has $a_i$ health.
You may shoot the monsters to kill them. Each shot requires exactly one bullet and decreases the health of the targe... | from sys import stdin, stdout
input = stdin.buffer.readline
t = int(input())
while t > 0:
n = int(input())
a = []
b = []
for i in range(n):
p, c = [int(x) for x in input().split()]
a.append([p, c])
if n > 1:
if a[0][0] - a[n - 1][1] > 0:
b.append(a[0][0] - a[n - ... | ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR LIST VAR VAR IF VAR NUMBER IF BIN_OP VAR NUMBER NUMBER VAR BIN_OP VAR NU... |
You are playing another computer game, and now you have to slay $n$ monsters. These monsters are standing in a circle, numbered clockwise from $1$ to $n$. Initially, the $i$-th monster has $a_i$ health.
You may shoot the monsters to kill them. Each shot requires exactly one bullet and decreases the health of the targe... | import sys
input = sys.stdin.buffer.readline
tests = int(input())
for ii in range(tests):
n = int(input())
a = []
b = []
for i in range(1, n + 1):
x, y = map(int, input().split())
a.append(x)
b.append(y)
sum = 0
a.append(a[0])
b.append(b[0])
for i in range(1, n +... | IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR N... |
You are playing another computer game, and now you have to slay $n$ monsters. These monsters are standing in a circle, numbered clockwise from $1$ to $n$. Initially, the $i$-th monster has $a_i$ health.
You may shoot the monsters to kill them. Each shot requires exactly one bullet and decreases the health of the targe... | import sys
input = sys.stdin.buffer.readline
for _ in range(int(input())):
n = int(input())
c = []
for i in range(n):
a, b = list(map(int, input().split()))
c.append([a, b])
sum = 0
for i in range(n):
x = c[i][0]
y = max(0, c[i][0] - c[i - 1][1])
sum += y
... | IMPORT ASSIGN VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR LIST VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR N... |
You are playing another computer game, and now you have to slay $n$ monsters. These monsters are standing in a circle, numbered clockwise from $1$ to $n$. Initially, the $i$-th monster has $a_i$ health.
You may shoot the monsters to kill them. Each shot requires exactly one bullet and decreases the health of the targe... | import sys
input = sys.stdin.buffer.readline
def solve():
n = int(input())
if n == 0:
return 0
if n == 1:
a, b = map(int, input().split())
return a
a_first, b_first = map(int, input().split())
a_prev, b_prev = a_first, b_first
remainder = float("inf")
base_shots = ... | IMPORT ASSIGN VAR VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR IF VAR NUMBER RETURN NUMBER IF VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR RETURN VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR VAR ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR NUMBER FOR VAR FU... |
You are playing another computer game, and now you have to slay $n$ monsters. These monsters are standing in a circle, numbered clockwise from $1$ to $n$. Initially, the $i$-th monster has $a_i$ health.
You may shoot the monsters to kill them. Each shot requires exactly one bullet and decreases the health of the targe... | import sys
I = sys.stdin.buffer.readline
for _ in [0] * int(I()):
a, b = zip(*(map(int, I().split()) for _ in [0] * int(I())))
b = [min(x, y) for x, y in zip(b, a[1:] + a[:1])]
print(sum(a) - sum(b) + min(b)) | IMPORT ASSIGN VAR VAR FOR VAR BIN_OP LIST NUMBER FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR VAR BIN_OP LIST NUMBER FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR VAR VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP ... |
You are playing another computer game, and now you have to slay $n$ monsters. These monsters are standing in a circle, numbered clockwise from $1$ to $n$. Initially, the $i$-th monster has $a_i$ health.
You may shoot the monsters to kill them. Each shot requires exactly one bullet and decreases the health of the targe... | import sys
input = sys.stdin.buffer.readline
def getInts():
return [int(s) for s in input().split()]
def getInt():
return int(input())
def getStrs():
return [s for s in input().split()]
def getStr():
return input()
def listStr():
return list(input())
def solve():
N = getInt()
su... | IMPORT ASSIGN VAR VAR FUNC_DEF RETURN FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF RETURN VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ... |
You are playing another computer game, and now you have to slay $n$ monsters. These monsters are standing in a circle, numbered clockwise from $1$ to $n$. Initially, the $i$-th monster has $a_i$ health.
You may shoot the monsters to kill them. Each shot requires exactly one bullet and decreases the health of the targe... | import sys
def LI():
return tuple(map(int, sys.stdin.readline().split()))
def I():
return int(sys.stdin.readline())
def JA(a, sep):
return sep.join(map(str, a))
def main():
t = I()
rr = []
for _ in range(t):
n = I()
ab = [LI() for _ in range(n)]
r = 0
t = ... | IMPORT FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR VAR VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL VAR V... |
You are playing another computer game, and now you have to slay $n$ monsters. These monsters are standing in a circle, numbered clockwise from $1$ to $n$. Initially, the $i$-th monster has $a_i$ health.
You may shoot the monsters to kill them. Each shot requires exactly one bullet and decreases the health of the targe... | import sys
I = sys.stdin.buffer.readline
input = lambda: stdin.readline()
for _ in range(int(I())):
n = int(I())
ans, mn = 0, 100000000000000
ai, bi = map(int, I().split())
for i in range(n - 1):
na, nb = map(int, I().split())
if na > bi:
ans += na - bi
mn = min(... | IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR NUMBER NUMBER ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR I... |
You are playing another computer game, and now you have to slay $n$ monsters. These monsters are standing in a circle, numbered clockwise from $1$ to $n$. Initially, the $i$-th monster has $a_i$ health.
You may shoot the monsters to kill them. Each shot requires exactly one bullet and decreases the health of the targe... | import sys
input = sys.stdin.buffer.readline
t = int(input())
for qw in range(t):
n = int(input())
cc = 0
pepe = 0
iff = 0
els = 0
counts = 0
for i in range(n):
a, b = map(int, input().split())
if i != 0:
count = bb - a
if count < 0:
i... | IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER ASSIGN ... |
You are playing another computer game, and now you have to slay $n$ monsters. These monsters are standing in a circle, numbered clockwise from $1$ to $n$. Initially, the $i$-th monster has $a_i$ health.
You may shoot the monsters to kill them. Each shot requires exactly one bullet and decreases the health of the targe... | import sys
input = sys.stdin.buffer.readline
for _ in range(int(input())):
n = int(input())
l1 = []
l2 = []
total = 0
min_index = 10**12 + 1
min_prev = 10**12 + 1
a1, b1 = map(int, input().split())
l1.append(a1)
l2.append(b1)
for i in range(n):
if i == 0:
con... | IMPORT ASSIGN VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_... |
You are playing another computer game, and now you have to slay $n$ monsters. These monsters are standing in a circle, numbered clockwise from $1$ to $n$. Initially, the $i$-th monster has $a_i$ health.
You may shoot the monsters to kill them. Each shot requires exactly one bullet and decreases the health of the targe... | import sys
input = sys.stdin.buffer.readline
t = int(input())
while t:
t -= 1
n = int(input())
x = []
y = []
for i in range(n):
a, b = map(int, input().split())
x.append(a)
y.append(b)
count = 0
for i in range(n):
if x[i] - y[i - 1] > 0:
count += ... | IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VA... |
You are playing another computer game, and now you have to slay $n$ monsters. These monsters are standing in a circle, numbered clockwise from $1$ to $n$. Initially, the $i$-th monster has $a_i$ health.
You may shoot the monsters to kill them. Each shot requires exactly one bullet and decreases the health of the targe... | from sys import stdin
input = stdin.buffer.readline
for _ in range(int(input())):
n = int(input())
a = [[int(i) for i in input().split()] for j in range(n)]
s = max(0, a[0][0] - a[-1][1])
mn = min(
a[0][0] - s, min(a[i][0] - max(0, a[i][0] - a[i - 1][1]) for i in range(1, n))
)
print(s ... | ASSIGN VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER NUMBER VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER VAR FUNC_CAL... |
You are playing another computer game, and now you have to slay $n$ monsters. These monsters are standing in a circle, numbered clockwise from $1$ to $n$. Initially, the $i$-th monster has $a_i$ health.
You may shoot the monsters to kill them. Each shot requires exactly one bullet and decreases the health of the targe... | from sys import stdin, stdout
sprint = stdout.write
sinput = stdin.buffer.readline
def func():
n = int(sinput())
health = []
exp = []
for i in range(n):
[h, e] = [int(x) for x in sinput().split()]
health.append(h)
exp.append(e)
bullet = 0
for i in range(n):
te ... | ASSIGN VAR VAR ASSIGN VAR VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN LIST VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR NUM... |
You are playing another computer game, and now you have to slay $n$ monsters. These monsters are standing in a circle, numbered clockwise from $1$ to $n$. Initially, the $i$-th monster has $a_i$ health.
You may shoot the monsters to kill them. Each shot requires exactly one bullet and decreases the health of the targe... | import sys
input = sys.stdin.buffer.readline
def solve(n, arr):
total = 0
for i in range(n - 1):
total += max(arr[i + 1][0] - arr[i][1], 0)
total += max(arr[0][0] - arr[n - 1][1], 0)
minv = float("inf")
for i in range(1, n):
t = arr[i][0] - max(arr[i][0] - arr[i - 1][1], 0) + tota... | IMPORT ASSIGN VAR VAR FUNC_DEF ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR BIN_OP VAR NUMBER NUMBER VAR VAR NUMBER NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER VAR BIN_OP VAR NUMBER NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR STRING FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR ... |
You are playing another computer game, and now you have to slay $n$ monsters. These monsters are standing in a circle, numbered clockwise from $1$ to $n$. Initially, the $i$-th monster has $a_i$ health.
You may shoot the monsters to kill them. Each shot requires exactly one bullet and decreases the health of the targe... | import sys
input = sys.stdin.buffer.readline
def main():
t = int(input())
ans = [0] * t
for j in range(t):
n = int(input())
l = [list(map(int, input().split())) for _ in range(n)]
s = 0
m = 100000000000000.0
fb = l[-1][-1]
for a, b in l:
t = max... | IMPORT ASSIGN VAR VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR NUMBER NUMB... |
You are playing another computer game, and now you have to slay $n$ monsters. These monsters are standing in a circle, numbered clockwise from $1$ to $n$. Initially, the $i$-th monster has $a_i$ health.
You may shoot the monsters to kill them. Each shot requires exactly one bullet and decreases the health of the targe... | from sys import gettrace, stdin
def input():
return stdin.buffer.readline()
def main():
def solve():
n = int(input())
li = []
for i in range(n):
temp = [int(x) for x in input().split()]
li.append(temp)
if i == 0:
ans = li[0][0]
... | FUNC_DEF RETURN FUNC_CALL VAR FUNC_DEF FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR VAR IF VAR NUMBER ASSIGN VAR VAR NUMBER NUMBER VAR FUNC_CALL VAR NUMBER BIN_OP VAR VAR NUMBER VAR BIN_OP VAR NUMBER... |
You are playing another computer game, and now you have to slay $n$ monsters. These monsters are standing in a circle, numbered clockwise from $1$ to $n$. Initially, the $i$-th monster has $a_i$ health.
You may shoot the monsters to kill them. Each shot requires exactly one bullet and decreases the health of the targe... | from sys import stdin
case = int(stdin.buffer.readline())
for iiiiiiiii in range(case):
n = int(stdin.buffer.readline())
a = [0] * n
b = [0] * n
c = [0] * n
c_all = 0
ans = float("inf")
for i in range(n):
s = stdin.buffer.readline().split()
a[i] = int(s[0])
b[i] = in... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR STRING FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASS... |
You are playing another computer game, and now you have to slay $n$ monsters. These monsters are standing in a circle, numbered clockwise from $1$ to $n$. Initially, the $i$-th monster has $a_i$ health.
You may shoot the monsters to kill them. Each shot requires exactly one bullet and decreases the health of the targe... | import sys
input = sys.stdin.buffer.readline
t = int(input())
for i in range(t):
n = int(input())
a = []
b = []
for j in range(n):
a_, b_ = [int(s) for s in input().split()]
a.append(a_)
b.append(b_)
min_ = 1000000000000
if b[-1] < a[0]:
ans = a[0] - b[-1]
... | IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR NUMBER IF VAR NUMB... |
You are playing another computer game, and now you have to slay $n$ monsters. These monsters are standing in a circle, numbered clockwise from $1$ to $n$. Initially, the $i$-th monster has $a_i$ health.
You may shoot the monsters to kill them. Each shot requires exactly one bullet and decreases the health of the targe... | import sys
input = sys.stdin.buffer.readline
t = int(input())
for f in range(t):
n = int(input())
a = [0] * n
b = [0] * n
s1 = 0
s2 = 0
s3 = 100000000000000000
c = [0] * n
b[-1] = s3
for i in range(n):
a[i], b[i] = map(int, input().split())
s1 += a[i]
c[i] = ... | IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER VAR FOR VAR FUNC_CAL... |
You are playing another computer game, and now you have to slay $n$ monsters. These monsters are standing in a circle, numbered clockwise from $1$ to $n$. Initially, the $i$-th monster has $a_i$ health.
You may shoot the monsters to kill them. Each shot requires exactly one bullet and decreases the health of the targe... | import sys
input, print = sys.stdin.buffer.readline, sys.stdout.write
for _ in range(int(input())):
n = int(input())
a1, b1 = map(int, input().split())
a, b = [a1], [0]
s = 0
for _ in range(n - 1):
a2, b2 = map(int, input().split())
a.append(a2)
b.append(max(a2 - b1, 0))
... | IMPORT ASSIGN VAR VAR VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR LIST VAR LIST NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CA... |
You are playing another computer game, and now you have to slay $n$ monsters. These monsters are standing in a circle, numbered clockwise from $1$ to $n$. Initially, the $i$-th monster has $a_i$ health.
You may shoot the monsters to kill them. Each shot requires exactly one bullet and decreases the health of the targe... | import sys
from itertools import accumulate
def input():
return sys.stdin.buffer.readline().strip()
def list2d(a, b, c):
return [([c] * b) for i in range(a)]
def list3d(a, b, c, d):
return [[([d] * c) for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e):
return [[[([e] * d) for j in r... | IMPORT FUNC_DEF RETURN FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN BIN_OP LIST VAR VAR VAR FUNC_CALL VAR VAR FUNC_DEF RETURN BIN_OP LIST VAR VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR FUNC_DEF RETURN BIN_OP LIST VAR VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR FUNC_DEF NUMBER RETURN FUNC_CALL ... |
You are playing another computer game, and now you have to slay $n$ monsters. These monsters are standing in a circle, numbered clockwise from $1$ to $n$. Initially, the $i$-th monster has $a_i$ health.
You may shoot the monsters to kill them. Each shot requires exactly one bullet and decreases the health of the targe... | import sys
input = sys.stdin.buffer.readline
T = int(input())
for _ in range(T):
n = int(input())
la, lb = [], []
for _ in range(n):
a, b = map(int, input().split())
la.append(a)
lb.append(b)
sm, mn = 0, 0
for i in range(n):
add = max(0, la[i] - lb[i - 1])
sm... | IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR LIST LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR VAR NUMBER NUMBER FOR VAR FUN... |
You are playing another computer game, and now you have to slay $n$ monsters. These monsters are standing in a circle, numbered clockwise from $1$ to $n$. Initially, the $i$-th monster has $a_i$ health.
You may shoot the monsters to kill them. Each shot requires exactly one bullet and decreases the health of the targe... | import sys
input = sys.stdin.buffer.readline
for _ in range(int(input())):
n, best, best_i = int(input()), float("inf"), -1
vals = [[int(i) for i in input().split()] for j in range(n)]
vals.append(vals[0])
for i in range(n):
if vals[i + 1][0] - max(0, vals[i + 1][0] - vals[i][1]) < best:
... | IMPORT ASSIGN VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR STRING NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF BIN_OP VAR BIN_OP VAR NUMBER NUMBER... |
You are playing another computer game, and now you have to slay $n$ monsters. These monsters are standing in a circle, numbered clockwise from $1$ to $n$. Initially, the $i$-th monster has $a_i$ health.
You may shoot the monsters to kill them. Each shot requires exactly one bullet and decreases the health of the targe... | import sys
input = sys.stdin.buffer.readline
t = int(input())
for k in range(t):
n = int(input())
a = [[int(el) for el in input().split()] for i in range(n)]
s = 0
for i in range(n):
s += max(0, a[i][0] - a[i - 1][1])
m = 10**20
for i in range(n):
m = min(m, s + a[i][0] - max(0,... | IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR NUMBER BIN_OP VAR VAR NUMBER VAR BIN_OP VAR NUMBER NU... |
You are playing another computer game, and now you have to slay $n$ monsters. These monsters are standing in a circle, numbered clockwise from $1$ to $n$. Initially, the $i$-th monster has $a_i$ health.
You may shoot the monsters to kill them. Each shot requires exactly one bullet and decreases the health of the targe... | import sys
input = sys.stdin.buffer.readline
for _ in range(int(input())):
n = int(input())
ans, x, y = 0, 10**13, (0, 0)
a0, b0 = map(int, input().split())
for i in range(1, n):
a, b = map(int, input().split())
k = max(0, a - b0)
ans += k
if a - k < x:
x = a... | IMPORT ASSIGN VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR NUMBER BIN_OP NUMBER NUMBER NUMBER NUMBER ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR A... |
You are playing another computer game, and now you have to slay $n$ monsters. These monsters are standing in a circle, numbered clockwise from $1$ to $n$. Initially, the $i$-th monster has $a_i$ health.
You may shoot the monsters to kill them. Each shot requires exactly one bullet and decreases the health of the targe... | import sys
def main():
import sys
input = sys.stdin.buffer.readline
mod = 998244353
def GCD(x, y):
while y:
x, y = y, x % y
return x
def lcm(a, b):
return a * b // GCD(a, b)
def merge(a, start, mid, end, d):
p = start
q = mid + 1
... | IMPORT FUNC_DEF IMPORT ASSIGN VAR VAR ASSIGN VAR NUMBER FUNC_DEF WHILE VAR ASSIGN VAR VAR VAR BIN_OP VAR VAR RETURN VAR FUNC_DEF RETURN BIN_OP BIN_OP VAR VAR FUNC_CALL VAR VAR VAR FUNC_DEF ASSIGN VAR VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER BIN_OP BIN_OP VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR... |
You are playing another computer game, and now you have to slay $n$ monsters. These monsters are standing in a circle, numbered clockwise from $1$ to $n$. Initially, the $i$-th monster has $a_i$ health.
You may shoot the monsters to kill them. Each shot requires exactly one bullet and decreases the health of the targe... | import sys
input = sys.stdin.buffer.readline
def calc(i, sub):
i = n - 1
while i >= 0:
if i == n - 1:
dp[i] = max(0, l[i][0] - l[i - 1][1])
i -= 1
continue
if i == 0:
dp[i] = l[i][0] + dp[i + 1]
break
if l[i - 1][1] < l[i][0]... | IMPORT ASSIGN VAR VAR FUNC_DEF ASSIGN VAR BIN_OP VAR NUMBER WHILE VAR NUMBER IF VAR BIN_OP VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR NUMBER BIN_OP VAR VAR NUMBER VAR BIN_OP VAR NUMBER NUMBER VAR NUMBER IF VAR NUMBER ASSIGN VAR VAR BIN_OP VAR VAR NUMBER VAR BIN_OP VAR NUMBER IF VAR BIN_OP VAR NUMBER NUMBER VAR VAR NUMBER ... |
You are playing another computer game, and now you have to slay $n$ monsters. These monsters are standing in a circle, numbered clockwise from $1$ to $n$. Initially, the $i$-th monster has $a_i$ health.
You may shoot the monsters to kill them. Each shot requires exactly one bullet and decreases the health of the targe... | import sys
input = sys.stdin.buffer.readline
T = int(input())
for t in range(T):
n = int(input())
hp = []
bomb = []
bomb.append(0)
for i in range(n):
x, y = map(int, input().split())
hp.append(x)
bomb.append(y)
bomb[0] = bomb.pop(-1)
for i in range(n):
bomb[i... | IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST EXPR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN ... |
You are playing another computer game, and now you have to slay $n$ monsters. These monsters are standing in a circle, numbered clockwise from $1$ to $n$. Initially, the $i$-th monster has $a_i$ health.
You may shoot the monsters to kill them. Each shot requires exactly one bullet and decreases the health of the targe... | import sys
input = sys.stdin.buffer.readline
t = int(input())
for qw in range(t):
n = int(input())
l1 = []
l = []
hoe = 0
cc = 0
pepe = 0
iff = 0
els = 0
l2 = []
counts = 0
for i in range(n):
a, b = map(int, input().split())
l.append(a)
if i != 0:
... | IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR V... |
You are playing another computer game, and now you have to slay $n$ monsters. These monsters are standing in a circle, numbered clockwise from $1$ to $n$. Initially, the $i$-th monster has $a_i$ health.
You may shoot the monsters to kill them. Each shot requires exactly one bullet and decreases the health of the targe... | import sys
input = sys.stdin.buffer.readline
T = int(input())
for _ in range(T):
n = int(input())
A = []
for i in range(n):
a, b = map(int, input().split())
A.append([a, b])
if i == 0:
fb = A[0][0]
else:
fb = fb + max(A[i][0] - A[i - 1][1], 0)
fa ... | IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR LIST VAR VAR IF VAR NUMBER ASSIGN VAR VAR NUMBER NUMBER ASSIGN VAR BIN_OP VA... |
You are playing another computer game, and now you have to slay $n$ monsters. These monsters are standing in a circle, numbered clockwise from $1$ to $n$. Initially, the $i$-th monster has $a_i$ health.
You may shoot the monsters to kill them. Each shot requires exactly one bullet and decreases the health of the targe... | import sys
input = sys.stdin.buffer.readline
def main():
t = int(input())
for _ in range(t):
n = int(input())
A = [0] * n
B = [0] * n
for i in range(n):
a, b = map(int, input().split())
A[i] = a
B[i] = b
R = [0] * n
for i in ... | IMPORT ASSIGN VAR VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR ASSIGN VAR VAR ... |
You are playing another computer game, and now you have to slay $n$ monsters. These monsters are standing in a circle, numbered clockwise from $1$ to $n$. Initially, the $i$-th monster has $a_i$ health.
You may shoot the monsters to kill them. Each shot requires exactly one bullet and decreases the health of the targe... | input = __import__("sys").stdin.buffer.readline
t = int(input())
output = []
for tc in range(t):
n = int(input())
a = [(0) for i in range(n)]
b = [(0) for i in range(n)]
for i in range(n):
a[i], b[i] = map(int, input().split())
a += a
b += b
p, xp = 0, min(b[0], a[1])
for i in ra... | ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL V... |
You are playing another computer game, and now you have to slay $n$ monsters. These monsters are standing in a circle, numbered clockwise from $1$ to $n$. Initially, the $i$-th monster has $a_i$ health.
You may shoot the monsters to kill them. Each shot requires exactly one bullet and decreases the health of the targe... | import sys
I = sys.stdin.buffer.readline
input = lambda: stdin.readline()
t = int(I())
while t > 0:
n = int(I())
add = 1000000000006
ans = 0
a0, b0 = map(int, I().split())
for i in range(n - 1):
a, b = map(int, I().split())
ans += max(0, a - b0)
add = min(add, min(a, b0))
... | IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FU... |
You are playing another computer game, and now you have to slay $n$ monsters. These monsters are standing in a circle, numbered clockwise from $1$ to $n$. Initially, the $i$-th monster has $a_i$ health.
You may shoot the monsters to kill them. Each shot requires exactly one bullet and decreases the health of the targe... | import sys
input = sys.stdin.buffer.readline
def prog():
for _ in range(int(input())):
n = int(input())
circle = [list(map(int, input().split())) for i in range(n)]
shot = 0
for i in range(n):
curr = circle[i]
j = (i - 1) % n
previous = circle[j... | IMPORT ASSIGN VAR VAR FUNC_DEF FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR NUMBER VAR ASSIGN V... |
You are playing another computer game, and now you have to slay $n$ monsters. These monsters are standing in a circle, numbered clockwise from $1$ to $n$. Initially, the $i$-th monster has $a_i$ health.
You may shoot the monsters to kill them. Each shot requires exactly one bullet and decreases the health of the targe... | import sys
input = sys.stdin.buffer.readline
for _ in range(int(input())):
n = int(input())
A = [0] * n
B = [0] * n
for i in range(n):
a, b = map(int, input().split())
A[i] = a
B[i] = b
v = 10**13
ans = 0
for i in range(n):
e = max(0, A[i] - B[i - 1])
... | IMPORT ASSIGN VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR ASSIGN VAR VAR VAR ASSIGN VAR BIN_OP NU... |
You are playing another computer game, and now you have to slay $n$ monsters. These monsters are standing in a circle, numbered clockwise from $1$ to $n$. Initially, the $i$-th monster has $a_i$ health.
You may shoot the monsters to kill them. Each shot requires exactly one bullet and decreases the health of the targe... | from sys import stdin, stdout
def main():
t = int(stdin.readline())
for _ in range(t):
n = int(stdin.readline())
big = 1000000000001
answer = 0
a_init, b = map(int, stdin.readline().split())
for _ in range(n - 1):
a, b_new = map(int, stdin.readline().split()... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_C... |
You are given an integer $n$ from $1$ to $10^{18}$ without leading zeroes.
In one move you can swap any two adjacent digits in the given number in such a way that the resulting number will not contain leading zeroes. In other words, after each move the number you have cannot contain any leading zeroes.
What is the mi... | n = input()
a = n[:]
p = len(n) - 1
count1, count2 = 0, 0
i = p
flag1, flag2 = 0, 0
while i > -1:
if n[i] == "5" and flag1 == 0:
count1 = p - i
n = n[:i] + n[i + 1 :] + "5"
flag1 = 1
if a[i] == "0" and flag2 == 0:
count2 = p - i
a = a[:i] + a[i + 1 :] + "0"
flag2 ... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR ASSIGN VAR BIN_OP FUNC_CALL VAR VAR NUMBER ASSIGN VAR VAR NUMBER NUMBER ASSIGN VAR VAR ASSIGN VAR VAR NUMBER NUMBER WHILE VAR NUMBER IF VAR VAR STRING VAR NUMBER ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR VAR BIN_OP VAR NUMBER STRING ASSIGN VAR NUMBER IF VAR VAR S... |
You are given an integer $n$ from $1$ to $10^{18}$ without leading zeroes.
In one move you can swap any two adjacent digits in the given number in such a way that the resulting number will not contain leading zeroes. In other words, after each move the number you have cannot contain any leading zeroes.
What is the mi... | def func(l, x, y):
ans = 0
ll = l.copy()
i = ll.index(x)
ans = ans + i
ll = [ll[i]] + ll[:i] + ll[i + 1 :]
i = ll.index(y, 1)
ans = ans + (i - 1)
ll = ll[:1] + [ll[i]] + ll[1:i] + ll[i + 1 :]
i = len(ll) - 1
while ll[i] == 0:
i = i - 1
ans = ans + len(l) - 1 - i
l... | FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP BIN_OP LIST VAR VAR VAR VAR VAR BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR BIN_OP VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP BIN_OP BIN_OP VAR NUMBER LIST VAR VAR VAR NUMBER VA... |
You are given an integer $n$ from $1$ to $10^{18}$ without leading zeroes.
In one move you can swap any two adjacent digits in the given number in such a way that the resulting number will not contain leading zeroes. In other words, after each move the number you have cannot contain any leading zeroes.
What is the mi... | def finder(n, ind):
i = ind - 1
while i >= 0:
if n[i] == "0":
break
else:
i = i - 1
return i
def zeros(n):
count = 0
pol = 1
while pol < l:
if n[pol] == "0":
count = count + 1
else:
break
pol = pol + 1
... | FUNC_DEF ASSIGN VAR BIN_OP VAR NUMBER WHILE VAR NUMBER IF VAR VAR STRING ASSIGN VAR BIN_OP VAR NUMBER RETURN VAR FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR IF VAR VAR STRING ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER RETURN VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR FUNC_CALL... |
You are given an integer $n$ from $1$ to $10^{18}$ without leading zeroes.
In one move you can swap any two adjacent digits in the given number in such a way that the resulting number will not contain leading zeroes. In other words, after each move the number you have cannot contain any leading zeroes.
What is the mi... | INF = 1e18
def replace_zero(s, n):
for i in range(1, n + 1):
if s[i] != "0":
return i - 1
return None
def find_number(c, s, end=1):
n = len(s) - end
cnt = 0
for i in range(n, -1, -1):
if s[i] == c:
if i == 0 and s[i + 1] == "0":
cnt = repla... | ASSIGN VAR NUMBER FUNC_DEF FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER IF VAR VAR STRING RETURN BIN_OP VAR NUMBER RETURN NONE FUNC_DEF NUMBER ASSIGN VAR BIN_OP FUNC_CALL VAR VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR NUMBER NUMBER IF VAR VAR VAR IF VAR NUMBER VAR BIN_OP VAR NUMBER STRING ASSIGN VAR FUNC_CAL... |
You are given an integer $n$ from $1$ to $10^{18}$ without leading zeroes.
In one move you can swap any two adjacent digits in the given number in such a way that the resulting number will not contain leading zeroes. In other words, after each move the number you have cannot contain any leading zeroes.
What is the mi... | INF = 1000
def compute_pair(s, pair):
n = len(s)
try:
l2 = s.rindex(pair[1])
l1 = s.rindex(pair[0])
if pair[0] == "0":
l1 = s[:l2].rindex(pair[1])
except:
return INF
steps = abs(n - 2 - l1) + abs(n - 1 - l2)
if l1 > l2 and l1 != n - 1:
steps += 1... | ASSIGN VAR NUMBER FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER IF VAR NUMBER STRING ASSIGN VAR FUNC_CALL VAR VAR VAR NUMBER RETURN VAR ASSIGN VAR BIN_OP FUNC_CALL VAR BIN_OP BIN_OP VAR NUMBER VAR FUNC_CALL VAR BIN_OP BIN_OP VAR NUMBER VAR IF VAR VAR VAR B... |
You are given an integer $n$ from $1$ to $10^{18}$ without leading zeroes.
In one move you can swap any two adjacent digits in the given number in such a way that the resulting number will not contain leading zeroes. In other words, after each move the number you have cannot contain any leading zeroes.
What is the mi... | n = list(input())
ends = ["00", "25", "50", "75"]
res = -1
def can_be_result(indeces):
if -1 in indeces:
return False
t = [x for i, x in enumerate(n) if i not in indeces]
if len(t) == 0:
return True
if len([x for x in t if x != "0"]) == 0:
return False
return True
for end... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST STRING STRING STRING STRING ASSIGN VAR NUMBER FUNC_DEF IF NUMBER VAR RETURN NUMBER ASSIGN VAR VAR VAR VAR FUNC_CALL VAR VAR VAR VAR IF FUNC_CALL VAR VAR NUMBER RETURN NUMBER IF FUNC_CALL VAR VAR VAR VAR VAR STRING NUMBER RETURN NUMBER RETURN NUMBER FOR VAR VAR ASSI... |
You are given an integer $n$ from $1$ to $10^{18}$ without leading zeroes.
In one move you can swap any two adjacent digits in the given number in such a way that the resulting number will not contain leading zeroes. In other words, after each move the number you have cannot contain any leading zeroes.
What is the mi... | maxint = 2147483647
class mylist(list):
def index(self, obj, *args):
try:
if len(args) == 0:
return super(mylist, self).index(obj)
if len(args) == 1:
return super(mylist, self).index(obj, args[0])
return super(mylist, self).index(obj, ar... | ASSIGN VAR NUMBER CLASS_DEF VAR FUNC_DEF IF FUNC_CALL VAR VAR NUMBER RETURN FUNC_CALL FUNC_CALL VAR VAR VAR VAR IF FUNC_CALL VAR VAR NUMBER RETURN FUNC_CALL FUNC_CALL VAR VAR VAR VAR VAR NUMBER RETURN FUNC_CALL FUNC_CALL VAR VAR VAR VAR VAR NUMBER VAR NUMBER VAR RETURN NUMBER FUNC_DEF IF VAR NUMBER VAR NUMBER RETURN VA... |
You are given an integer $n$ from $1$ to $10^{18}$ without leading zeroes.
In one move you can swap any two adjacent digits in the given number in such a way that the resulting number will not contain leading zeroes. In other words, after each move the number you have cannot contain any leading zeroes.
What is the mi... | def swap(N, a, b):
A = N[a]
B = N[b]
N[a] = B
N[b] = A
def getToEnd(N, a, b):
bInd = -1
for i in range(len(N) - 1, -1, -1):
if N[i] == b:
bInd = i
break
total = 0
if bInd == -1:
return q
for i in range(bInd, len(N) - 1):
total += 1
... | FUNC_DEF ASSIGN VAR VAR VAR ASSIGN VAR VAR VAR ASSIGN VAR VAR VAR ASSIGN VAR VAR VAR FUNC_DEF ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER NUMBER IF VAR VAR VAR ASSIGN VAR VAR ASSIGN VAR NUMBER IF VAR NUMBER RETURN VAR FOR VAR FUNC_CALL VAR VAR BIN_OP FUNC_CALL VAR VAR NUMBER VAR NUMBE... |
You are given an integer $n$ from $1$ to $10^{18}$ without leading zeroes.
In one move you can swap any two adjacent digits in the given number in such a way that the resulting number will not contain leading zeroes. In other words, after each move the number you have cannot contain any leading zeroes.
What is the mi... | s = input()
n = len(s)
def i(c, o=0):
try:
return s[::-1].index(str(c), o)
except:
return -1
oo = 0
while oo < n - 1 and s[oo + 1] == "0":
oo += 1
o5 = i(5)
o7 = i(7)
o2 = i(2)
o01 = i(0)
o02 = i(0, o01 + 1) if o01 >= 0 else -1
r = 100
if o01 >= 0 and o02 >= 0:
r = min(r, o01 + o02 -... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_DEF NUMBER RETURN FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR VAR RETURN NUMBER ASSIGN VAR NUMBER WHILE VAR BIN_OP VAR NUMBER VAR BIN_OP VAR NUMBER STRING VAR NUMBER ASSIGN VAR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR NUMBER ASSI... |
You are given an integer $n$ from $1$ to $10^{18}$ without leading zeroes.
In one move you can swap any two adjacent digits in the given number in such a way that the resulting number will not contain leading zeroes. In other words, after each move the number you have cannot contain any leading zeroes.
What is the mi... | def solve1():
n = m
try:
x = n.index("0")
n = n[x] + n[:x] + n[x + 1 :]
x += len(n) - len(n.rstrip("0"))
y = n.index("5")
return x + y - 1
except:
return float("inf")
def solve2():
n = m
try:
x = n.index("0")
y = n.find("0", x + 1)
... | FUNC_DEF ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR BIN_OP BIN_OP VAR VAR VAR VAR VAR BIN_OP VAR NUMBER VAR BIN_OP FUNC_CALL VAR VAR FUNC_CALL VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR STRING RETURN BIN_OP BIN_OP VAR VAR NUMBER RETURN FUNC_CALL VAR STRING FUNC_DEF ASSIGN VAR VAR ASSIGN VAR FUNC_C... |
You are given an integer $n$ from $1$ to $10^{18}$ without leading zeroes.
In one move you can swap any two adjacent digits in the given number in such a way that the resulting number will not contain leading zeroes. In other words, after each move the number you have cannot contain any leading zeroes.
What is the mi... | import sys
n = input()
num = ["25", "50", "75", "00"]
minn = sys.maxsize
step = 0
length = len(n)
for x in num:
if x[0] == x[1] and n.count("0") > 1:
first = n.rfind(x[0])
second = n[:first].rfind(x[1])
step = length - 1 - second + length - 2 - first
minn = min(step, minn)
elif ... | IMPORT ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST STRING STRING STRING STRING ASSIGN VAR VAR ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR FOR VAR VAR IF VAR NUMBER VAR NUMBER FUNC_CALL VAR STRING NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR NUMBER ASSIGN VAR BIN_OP BIN_OP BIN_OP BIN_OP BI... |
You are given an integer $n$ from $1$ to $10^{18}$ without leading zeroes.
In one move you can swap any two adjacent digits in the given number in such a way that the resulting number will not contain leading zeroes. In other words, after each move the number you have cannot contain any leading zeroes.
What is the mi... | n = input()[::-1]
c0 = n.count("0")
c2 = n.count("2")
c5 = n.count("5")
c7 = n.count("7")
s = 1000000000.0
if c0 > 1:
i = n.find("0")
j = n.find("0", i + 1)
s = min(s, i + j - 1)
if c2 and c5:
i = n.find("2")
j = n.find("5")
r = j + i - 1 + (j > i)
i, j = sorted([i, j])
m = n[:i] + n[i +... | ASSIGN VAR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR NUMBER IF VAR NUMBER ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR STRING BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR BIN_OP BIN_OP VAR... |
You are given an integer $n$ from $1$ to $10^{18}$ without leading zeroes.
In one move you can swap any two adjacent digits in the given number in such a way that the resulting number will not contain leading zeroes. In other words, after each move the number you have cannot contain any leading zeroes.
What is the mi... | n = input()
ans = 10000
n1 = list(n)
n2 = list(n)
l = len(n2)
curr = 0
for i in range(l - 1, -1, -1):
if n1[i] == "0":
curr += l - 1 - i
for j in range(i, l - 1):
n1[j], n1[j + 1] = n1[j + 1], n1[j]
for j in range(l - 2, -1, -1):
if n1[j] == "5" or n1[j] == "0":
... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER IF VAR VAR STRING VAR BIN_OP BIN_OP VAR NUMBER VAR FOR VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER ASSIGN VAR VAR VAR BIN_... |
You are given an integer $n$ from $1$ to $10^{18}$ without leading zeroes.
In one move you can swap any two adjacent digits in the given number in such a way that the resulting number will not contain leading zeroes. In other words, after each move the number you have cannot contain any leading zeroes.
What is the mi... | n = input().rstrip()
l = len(n)
c0 = 0
ii = 1
while ii < l and n[ii] == "0":
c0 += 1
ii += 1
ans = 10**9
if n.count("0") >= 2:
idx = []
for i in range(l)[::-1]:
if n[i] == "0":
idx.append(l - 1 - i)
if len(idx) >= 2:
break
c00 = idx[0] + idx[1] - 1
ans = m... | ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR VAR VAR STRING VAR NUMBER VAR NUMBER ASSIGN VAR BIN_OP NUMBER NUMBER IF FUNC_CALL VAR STRING NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR NUMBER IF VAR VAR STRING EXPR FUNC_CALL VAR BIN_OP BIN_OP VAR NU... |
You are given an integer $n$ from $1$ to $10^{18}$ without leading zeroes.
In one move you can swap any two adjacent digits in the given number in such a way that the resulting number will not contain leading zeroes. In other words, after each move the number you have cannot contain any leading zeroes.
What is the mi... | z = input()
n = len(z)
maxa = 10**18
y = int(z)
if y % 25 == 0:
print(0)
quit()
if n == 1:
print(-1)
quit()
for i in range(n):
for j in range(n):
if i == j:
continue
copy = list(z)
swaps = 0
for k in range(i, n - 1):
copy[k], copy[k + 1] = copy... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR IF VAR VAR ASSIGN VAR... |
You are given an integer $n$ from $1$ to $10^{18}$ without leading zeroes.
In one move you can swap any two adjacent digits in the given number in such a way that the resulting number will not contain leading zeroes. In other words, after each move the number you have cannot contain any leading zeroes.
What is the mi... | inf = float("inf")
def find_right(s, c, j=-1):
for i in range(len(s) - 1, -1, -1):
if i != j and s[i] == c:
return i
return inf
def swaps(s, c1, c2):
if len(s) > 1 and s[-2:] == c1 + c2:
return 0
if len(s) > 1 and s[-2:] == c2 + c1:
return 1
i2 = find_right(s,... | ASSIGN VAR FUNC_CALL VAR STRING FUNC_DEF NUMBER FOR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER NUMBER IF VAR VAR VAR VAR VAR RETURN VAR RETURN VAR FUNC_DEF IF FUNC_CALL VAR VAR NUMBER VAR NUMBER BIN_OP VAR VAR RETURN NUMBER IF FUNC_CALL VAR VAR NUMBER VAR NUMBER BIN_OP VAR VAR RETURN NUMBER ASSIGN VAR FUN... |
You are given an integer $n$ from $1$ to $10^{18}$ without leading zeroes.
In one move you can swap any two adjacent digits in the given number in such a way that the resulting number will not contain leading zeroes. In other words, after each move the number you have cannot contain any leading zeroes.
What is the mi... | INF = float("inf")
def count_min_steps(num_str):
result = INF
for i, c1 in enumerate(num_str):
suffix = num_str[:i] + num_str[i + 1 :]
for j, c2 in enumerate(suffix):
swap_str = suffix[:j] + suffix[j + 1 :] + c2 + c1
if swap_str[0] != "0" and int(swap_str) % 25 == 0:
... | ASSIGN VAR FUNC_CALL VAR STRING FUNC_DEF ASSIGN VAR VAR FOR VAR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR VAR VAR BIN_OP VAR NUMBER FOR VAR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP BIN_OP BIN_OP VAR VAR VAR BIN_OP VAR NUMBER VAR VAR IF VAR NUMBER STRING BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR V... |
You are given an integer $n$ from $1$ to $10^{18}$ without leading zeroes.
In one move you can swap any two adjacent digits in the given number in such a way that the resulting number will not contain leading zeroes. In other words, after each move the number you have cannot contain any leading zeroes.
What is the mi... | def check():
res = 0
if cnt[0] > 1:
res += 1
if cnt[0] > 0 and cnt[5] > 0:
res += 2
if cnt[5] > 0 and (cnt[2] > 0 or cnt[7] > 0):
res += 4
return res
num = int(input())
cnt = []
str = []
for i in range(10):
cnt.append(0)
while num != 0:
i = num % 10
str.append(i... | FUNC_DEF ASSIGN VAR NUMBER IF VAR NUMBER NUMBER VAR NUMBER IF VAR NUMBER NUMBER VAR NUMBER NUMBER VAR NUMBER IF VAR NUMBER NUMBER VAR NUMBER NUMBER VAR NUMBER NUMBER VAR NUMBER RETURN VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR NUMBER WHILE ... |
You are given an integer $n$ from $1$ to $10^{18}$ without leading zeroes.
In one move you can swap any two adjacent digits in the given number in such a way that the resulting number will not contain leading zeroes. In other words, after each move the number you have cannot contain any leading zeroes.
What is the mi... | import sys
k = input()
Min = sys.maxsize
if "5" in k and "0" in k:
temp = len(k) - 2 - k.rfind("5") + (len(k) - 1) - k.rfind("0")
if k.rfind("5") > k.rfind("0"):
temp += 1
if temp < Min:
Min = temp
if "2" in k and "5" in k:
temp = len(k) - 2 - k.rfind("2") + (len(k) - 1) - k.rfind("5")
... | IMPORT ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR IF STRING VAR STRING VAR ASSIGN VAR BIN_OP BIN_OP BIN_OP BIN_OP FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR STRING BIN_OP FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR STRING IF FUNC_CALL VAR STRING FUNC_CALL VAR STRING VAR NUMBER IF VAR VAR ASSIGN VAR VAR IF STRING VAR STRING VAR ASS... |
You are given an integer $n$ from $1$ to $10^{18}$ without leading zeroes.
In one move you can swap any two adjacent digits in the given number in such a way that the resulting number will not contain leading zeroes. In other words, after each move the number you have cannot contain any leading zeroes.
What is the mi... | def g(qw, a, i=0):
return a.find(str(qw), i) + 1 or 50
def main():
a = input()[::-1]
s = len(a)
z, r = g(0, a), g(5, a)
x = min(g(0, a, z), r)
q = z + x + (x < z)
x = min(g(2, a), g(7, a))
c = r + x + (x < r)
if r == s:
while a[r - 2] == "0":
r -= 1
c +=... | FUNC_DEF NUMBER RETURN BIN_OP FUNC_CALL VAR FUNC_CALL VAR VAR VAR NUMBER NUMBER FUNC_DEF ASSIGN VAR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR NUMBER VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR NUMBER VAR VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR VAR VAR ASSIGN... |
You are given an integer $n$ from $1$ to $10^{18}$ without leading zeroes.
In one move you can swap any two adjacent digits in the given number in such a way that the resulting number will not contain leading zeroes. In other words, after each move the number you have cannot contain any leading zeroes.
What is the mi... | s = input()[::-1]
m = I = 41
f = s.find("5") + 1
i = s.find("0") + 1
t = len(s)
if i:
j = min(s.find("0", i) + 1 or I, f or I)
if j < I:
m = i + j - 3
if j < i:
m += 1
if f:
j = min(s.find("2") + 1 or I, s.find("7") + 1 or I)
if j < I:
l = f + j - 3
if j < f:
... | ASSIGN VAR FUNC_CALL VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR BIN_OP FUNC_CALL VAR STRING NUMBER ASSIGN VAR BIN_OP FUNC_CALL VAR STRING NUMBER ASSIGN VAR FUNC_CALL VAR VAR IF VAR ASSIGN VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR STRING VAR NUMBER VAR VAR VAR IF VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER IF VAR VAR ... |
You are given an integer $n$ from $1$ to $10^{18}$ without leading zeroes.
In one move you can swap any two adjacent digits in the given number in such a way that the resulting number will not contain leading zeroes. In other words, after each move the number you have cannot contain any leading zeroes.
What is the mi... | num = str(input())
endings = [[0, 0], [5, 2], [0, 5], [5, 7]]
lenght = len(num)
candidate = []
if lenght == 2:
if [int(num[1]), int(num[0])] in endings:
print(0)
elif [int(num[0]), int(num[1])] in endings:
print(1)
else:
print(-1)
exit()
for tup in endings:
poss = []
ind ... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST LIST NUMBER NUMBER LIST NUMBER NUMBER LIST NUMBER NUMBER LIST NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR LIST IF VAR NUMBER IF LIST FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR VAR NUMBER VAR EXPR FUNC_CALL VAR NUMBER IF LIST FUNC_CALL VAR VAR NUMBER FUNC_CALL... |
You are given an integer $n$ from $1$ to $10^{18}$ without leading zeroes.
In one move you can swap any two adjacent digits in the given number in such a way that the resulting number will not contain leading zeroes. In other words, after each move the number you have cannot contain any leading zeroes.
What is the mi... | num = input()[::-1]
case1 = False
case2 = False
case3 = False
case4 = False
zero1 = num.find("0")
zero2 = num.find("0", num.find("0") + 1)
five = num.find("5")
seven = num.find("7")
two = num.find("2")
if zero1 != -1:
if five != -1:
case1 = True
if five != -1:
if two != -1:
case2 = True
if zero1... | ASSIGN VAR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR STRING BIN_OP FUNC_CALL VAR STRING NUMBER ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR STRING IF VAR NUMBER IF VAR ... |
You are given an integer $n$ from $1$ to $10^{18}$ without leading zeroes.
In one move you can swap any two adjacent digits in the given number in such a way that the resulting number will not contain leading zeroes. In other words, after each move the number you have cannot contain any leading zeroes.
What is the mi... | def go():
s = input()
n = len(s)
if "5" not in s and "0" not in s:
return -1
k = ["00", "25", "50", "75"]
m = float("inf")
for x in k:
if x == "00" and s.count("0") > 1:
first = s.rfind("0")
second = s[:first].rfind("0")
d = n - 1 - first + n -... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR IF STRING VAR STRING VAR RETURN NUMBER ASSIGN VAR LIST STRING STRING STRING STRING ASSIGN VAR FUNC_CALL VAR STRING FOR VAR VAR IF VAR STRING FUNC_CALL VAR STRING NUMBER ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR STRING ASSIGN VAR BIN_OP BI... |
You are given an integer $n$ from $1$ to $10^{18}$ without leading zeroes.
In one move you can swap any two adjacent digits in the given number in such a way that the resulting number will not contain leading zeroes. In other words, after each move the number you have cannot contain any leading zeroes.
What is the mi... | s = input().strip()
def find(a, b):
if a not in s or b not in s:
return 40
j = s.rindex(b)
i = -1
for t, v in enumerate(s):
if t != j and v == a:
i = t
if i < 0:
return 40
o = 0
if not (i and j) and len(s) > 2:
for t in range(len(s)):
... | ASSIGN VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF IF VAR VAR VAR VAR RETURN NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR ASSIGN VAR VAR IF VAR NUMBER RETURN NUMBER ASSIGN VAR NUMBER IF VAR VAR FUNC_CALL VAR VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR... |
You are given an integer $n$ from $1$ to $10^{18}$ without leading zeroes.
In one move you can swap any two adjacent digits in the given number in such a way that the resulting number will not contain leading zeroes. In other words, after each move the number you have cannot contain any leading zeroes.
What is the mi... | s = input()[::-1]
l = len(s)
def f(c, i=0):
return s.find(c, i) + 1 or 50
i0_1 = f("0")
i5 = f("5")
i05 = min(f("0", i0_1), i5)
m1 = i0_1 + i05 + (i05 < i0_1) - 3
i27 = min(f("2"), f("7"))
m2 = i5 + i27 + (i27 < i5) - 3
if l == i5:
while s[i5 - 2] == "0":
i5 -= 1
m2 += l - i5
m = min(m1, m2)
pri... | ASSIGN VAR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR FUNC_DEF NUMBER RETURN BIN_OP FUNC_CALL VAR VAR VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR STRING VAR VAR ASSIGN VAR BIN_OP BIN_OP BIN_OP VAR VAR VAR VAR NUMBER ASSIGN VAR FUNC_CALL... |
You are given an integer $n$ from $1$ to $10^{18}$ without leading zeroes.
In one move you can swap any two adjacent digits in the given number in such a way that the resulting number will not contain leading zeroes. In other words, after each move the number you have cannot contain any leading zeroes.
What is the mi... | def go(n, c1, c2):
l = len(n)
pos2 = n.rfind(c2)
pos1 = n.rfind(c1)
if c1 == c2:
pos1 = n[:pos2].rfind(c1)
if pos1 == -1 or pos2 == -1:
return 10**10
nxt = 0
if min(pos1, pos2) == 0:
nxt = 1
if max(pos1, pos2) == 1:
nxt = 2
ans = 0
if nxt !... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR IF VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR IF VAR NUMBER VAR NUMBER RETURN BIN_OP NUMBER NUMBER ASSIGN VAR NUMBER IF FUNC_CALL VAR VAR VAR NUMBER ASSIGN VAR NUMBER IF FUNC_CALL VAR VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VA... |
You are given an integer $n$ from $1$ to $10^{18}$ without leading zeroes.
In one move you can swap any two adjacent digits in the given number in such a way that the resulting number will not contain leading zeroes. In other words, after each move the number you have cannot contain any leading zeroes.
What is the mi... | def main():
ar = list(input())
size = len(ar)
ans = 100000.0
for i in range(size):
for j in range(size):
if i == j:
continue
s = list(ar)
cost = 0
for k in range(i, size - 1):
tmp = s[k]
s[k] = s[k + ... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR IF VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER ASSIGN VAR VAR VAR ASSIGN VAR VAR VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.