description stringlengths 171 4k | code stringlengths 94 3.98k | normalized_code stringlengths 57 4.99k |
|---|---|---|
You are given a string S of length N, which consists of digits from 0 to 9. You can apply the following operation to the string:
Choose an integer L with 1≤ L ≤ N and apply S_{i} = (S_{i} + 1) \mod 10 for each 1 ≤ i ≤ L.
For example, if S=39590, then choosing L=3 and applying the operation yields the string S=\underl... | def find(a):
return (10 - a) % 10
for t in range(int(input())):
N, K = map(int, input().split())
S = str(input())
ans = 0
for i in range(N):
temp = find(int(S[i]))
if temp > K:
break
ans += 1
K = temp + 10 * ((K - temp) // 10)
print(ans) | FUNC_DEF RETURN BIN_OP BIN_OP NUMBER VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR IF VAR VAR VAR NUMBER ASSIGN VAR BI... |
You are given a string S of length N, which consists of digits from 0 to 9. You can apply the following operation to the string:
Choose an integer L with 1≤ L ≤ N and apply S_{i} = (S_{i} + 1) \mod 10 for each 1 ≤ i ≤ L.
For example, if S=39590, then choosing L=3 and applying the operation yields the string S=\underl... | t = int(input())
for i in range(t):
n, k = map(int, input().split())
s = input()
limit = 0
n = n + 1
while n - limit > 1:
mid = (limit + n) // 2
operation = 0
i = mid - 1
while i >= 0:
w = (int(s[i]) + operation) % 10
if w != 0:
... | 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 ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER WHILE BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER WHILE VAR N... |
You are given a string S of length N, which consists of digits from 0 to 9. You can apply the following operation to the string:
Choose an integer L with 1≤ L ≤ N and apply S_{i} = (S_{i} + 1) \mod 10 for each 1 ≤ i ≤ L.
For example, if S=39590, then choosing L=3 and applying the operation yields the string S=\underl... | t = int(input())
for _ in range(t):
n, k = map(int, input().split())
s = input()
arr = -1
l = 0
b = (10 - int(s[0])) % 10
if k - b < 0:
print(0)
continue
m = (k - b) // 10
arr = b + m * 10
l += 1
for i in range(1, n):
b = (10 - int(s[i])) % 10
if a... | 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 ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP BIN_OP NUMBER FUNC_CALL VAR VAR NUMBER NUMBER IF BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP BIN_... |
You are given a string S of length N, which consists of digits from 0 to 9. You can apply the following operation to the string:
Choose an integer L with 1≤ L ≤ N and apply S_{i} = (S_{i} + 1) \mod 10 for each 1 ≤ i ≤ L.
For example, if S=39590, then choosing L=3 and applying the operation yields the string S=\underl... | for _ in range(int(input())):
n, k = map(int, input().split())
s = input()
c = 0
for i in s:
x = (10 - int(i)) % 10
t = k - x
if t < 0:
break
k = t // 10 * 10 + x
c += 1
print(c) | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR VAR ASSIGN VAR BIN_OP BIN_OP NUMBER FUNC_CALL VAR VAR NUMBER ASSIGN VAR BIN_OP VAR VAR IF VAR NUMBER ASSIGN VAR BIN_OP BIN_OP BIN_OP VAR NUMBER NUMBER VAR VAR NUM... |
You are given a string S of length N, which consists of digits from 0 to 9. You can apply the following operation to the string:
Choose an integer L with 1≤ L ≤ N and apply S_{i} = (S_{i} + 1) \mod 10 for each 1 ≤ i ≤ L.
For example, if S=39590, then choosing L=3 and applying the operation yields the string S=\underl... | def solve(n, k, li):
ans = 0
lo = 0
hi = n - 1
def check(mid):
opr = 0
last = prev = li[mid]
oldval = 0
for i in range(mid, -1, -1):
if (li[i] + oldval) % 10 <= prev:
prev = (li[i] + oldval) % 10
else:
if prev != 0:... | FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR VAR VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR NUMBER NUMBER IF BIN_OP BIN_OP VAR VAR VAR NUMBER VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR VAR NUMBER IF VAR NUMBER ASSIGN VAR BIN_OP NUMBER VAR IF VAR NUMB... |
You are given a string S of length N, which consists of digits from 0 to 9. You can apply the following operation to the string:
Choose an integer L with 1≤ L ≤ N and apply S_{i} = (S_{i} + 1) \mod 10 for each 1 ≤ i ≤ L.
For example, if S=39590, then choosing L=3 and applying the operation yields the string S=\underl... | case = int(input())
for r in range(case):
n, k = [int(x) for x in input().split()]
s = input()
count = 0
flag = 0
for i in s:
rem = (10 - int(i)) % 10
if k - rem < 0:
print(count)
flag = 1
break
k1 = (k - rem) // 10
val = 10 * k1 + ... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR ASSIGN VAR BIN_OP BIN_OP NUMBER FUNC_CALL VAR VAR NUMBER IF BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR VAR ASSIGN VAR NUMBE... |
You are given a string S of length N, which consists of digits from 0 to 9. You can apply the following operation to the string:
Choose an integer L with 1≤ L ≤ N and apply S_{i} = (S_{i} + 1) \mod 10 for each 1 ≤ i ≤ L.
For example, if S=39590, then choosing L=3 and applying the operation yields the string S=\underl... | for _ in range(int(input())):
n, k = map(int, input().split())
s = list(map(int, input()))
l = 0
h = n + 1
while h - l > 1:
m = (l + h) // 2
o = 0
for i in reversed(range(m)):
r = (o + s[i]) % 10
if r != 0:
o += 10 - r
if o <= k... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER WHILE BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR F... |
You are given a string S of length N, which consists of digits from 0 to 9. You can apply the following operation to the string:
Choose an integer L with 1≤ L ≤ N and apply S_{i} = (S_{i} + 1) \mod 10 for each 1 ≤ i ≤ L.
For example, if S=39590, then choosing L=3 and applying the operation yields the string S=\underl... | t = int(input())
for i in range(t):
n, k = input().split()
n = int(n)
k = int(k)
s = input()
A = []
for j in range(n):
if int(s[j]) != 0:
A.append(10 - int(s[j]))
else:
A.append(0)
flag = A[0]
if flag > k:
print(0)
continue
for ... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR IF FUNC_CALL VAR VAR VAR NUMBER EXPR FUNC_CALL VAR BIN_OP NUMBER FUNC_CALL VAR VAR VAR EXPR... |
You are given a string S of length N, which consists of digits from 0 to 9. You can apply the following operation to the string:
Choose an integer L with 1≤ L ≤ N and apply S_{i} = (S_{i} + 1) \mod 10 for each 1 ≤ i ≤ L.
For example, if S=39590, then choosing L=3 and applying the operation yields the string S=\underl... | for _ in range(int(input())):
n, k = map(int, input().split())
s = input()
def check(m, s):
add = 0
for i in range(m, -1, -1):
r = (int(s[i]) + add) % 10
if r == 0:
continue
add += 10 - r
return add
l, r = 0, n - 1
ans = 0... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_DEF ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR NUMBER NUMBER ASSIGN VAR BIN_OP BIN_OP FUNC_CALL VAR VAR VAR VAR NUMBER IF VAR NUMBER VAR BIN_OP NUMBER VAR RETURN VAR ASSIGN VAR VAR N... |
You are given a string S of length N, which consists of digits from 0 to 9. You can apply the following operation to the string:
Choose an integer L with 1≤ L ≤ N and apply S_{i} = (S_{i} + 1) \mod 10 for each 1 ≤ i ≤ L.
For example, if S=39590, then choosing L=3 and applying the operation yields the string S=\underl... | def func():
n, k = map(int, input().split())
s = input()
l = 0
r = n - 1
ans = 0
while l <= r:
mid = (l + r) // 2
op = 0
for i in range(mid, -1, -1):
value = (ord(s[i]) - ord("0") + op) % 10
if value == 0:
continue
op +=... | FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR NUMBER NUMBER ASSIGN VAR BIN_OP BIN_OP BIN_OP FUNC_CALL VAR VAR VA... |
You are given a string S of length N, which consists of digits from 0 to 9. You can apply the following operation to the string:
Choose an integer L with 1≤ L ≤ N and apply S_{i} = (S_{i} + 1) \mod 10 for each 1 ≤ i ≤ L.
For example, if S=39590, then choosing L=3 and applying the operation yields the string S=\underl... | for i in range(int(input())):
n, k = map(int, input().split())
s = list(input())
l = []
c = 0
for i in range(n):
l.append(int(s[i]))
ll = 0
for i in range(n):
if l[i] == 0:
ll = 0
c += 1
continue
if l[i] >= ll and ll != 0:
... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER ASSIGN VAR ... |
You are given a string S of length N, which consists of digits from 0 to 9. You can apply the following operation to the string:
Choose an integer L with 1≤ L ≤ N and apply S_{i} = (S_{i} + 1) \mod 10 for each 1 ≤ i ≤ L.
For example, if S=39590, then choosing L=3 and applying the operation yields the string S=\underl... | t = int(input())
def can_zero_upto_index_m(a, m, k):
num_ops_on_prev_elements = 0
for i in range(m, -1, -1):
x = a[i]
x += num_ops_on_prev_elements
x %= 10
if x == 0:
continue
if k >= 10 - x:
k -= 10 - x
num_ops_on_prev_elements += 10... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR NUMBER NUMBER ASSIGN VAR VAR VAR VAR VAR VAR NUMBER IF VAR NUMBER IF VAR BIN_OP NUMBER VAR VAR BIN_OP NUMBER VAR VAR BIN_OP NUMBER VAR RETURN NUMBER RETURN NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_C... |
You are given a string S of length N, which consists of digits from 0 to 9. You can apply the following operation to the string:
Choose an integer L with 1≤ L ≤ N and apply S_{i} = (S_{i} + 1) \mod 10 for each 1 ≤ i ≤ L.
For example, if S=39590, then choosing L=3 and applying the operation yields the string S=\underl... | def possible(S, ind, K):
total = 0
for i in reversed(range(ind)):
req = (10 - int(S[i])) % 10
total += (10 + req - total % 10) % 10
if total > K:
return False
return True
for _ in range(int(input())):
N, K = map(int, input().strip().split())
S = input().strip()
... | FUNC_DEF ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP BIN_OP NUMBER FUNC_CALL VAR VAR VAR NUMBER VAR BIN_OP BIN_OP BIN_OP NUMBER VAR BIN_OP VAR NUMBER NUMBER IF VAR VAR RETURN NUMBER RETURN NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL... |
You are given a string S of length N, which consists of digits from 0 to 9. You can apply the following operation to the string:
Choose an integer L with 1≤ L ≤ N and apply S_{i} = (S_{i} + 1) \mod 10 for each 1 ≤ i ≤ L.
For example, if S=39590, then choosing L=3 and applying the operation yields the string S=\underl... | def AbhiSolveKiya(s, N, k):
s = list(map(int, list(s)))
n = len(s)
if s[0] > 0 and k < 10 - s[0]:
return 0
low = 0
high = n - 1
best = -1
while low <= high:
n = (low + high) // 2
pre = [0] * (n + 1)
total = 0
for i in range(n, -1, -1):
x = ... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR IF VAR NUMBER NUMBER VAR BIN_OP NUMBER VAR NUMBER RETURN NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER BIN_OP V... |
You are given a string S of length N, which consists of digits from 0 to 9. You can apply the following operation to the string:
Choose an integer L with 1≤ L ≤ N and apply S_{i} = (S_{i} + 1) \mod 10 for each 1 ≤ i ≤ L.
For example, if S=39590, then choosing L=3 and applying the operation yields the string S=\underl... | try:
for tc in range(int(input())):
n, k = list(map(int, input().split()))
st = input()
cnt = 0
for i in range(n):
curr = 10 - int(st[i]) % 10
now = k // 10
to = 10 * now + curr
if to > k:
to -= 10
if to <= k... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP NUMBER BIN_OP FUNC_CALL VAR VAR VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP BIN_OP NUMBER VAR VAR ... |
You are given a string S of length N, which consists of digits from 0 to 9. You can apply the following operation to the string:
Choose an integer L with 1≤ L ≤ N and apply S_{i} = (S_{i} + 1) \mod 10 for each 1 ≤ i ≤ L.
For example, if S=39590, then choosing L=3 and applying the operation yields the string S=\underl... | t = int(input())
for i in range(0, t):
s = [int(i) for i in input().split()]
n, k = s[0], s[1]
l = list(input())
for i in range(0, n):
l[i] = int(l[i])
c = 0
for p in range(0, n):
f = 0
for i in range(k, -1, -1):
if (l[p] + i) % 10 == 0:
x = i
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR NUMBER VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBE... |
You are given a string S of length N, which consists of digits from 0 to 9. You can apply the following operation to the string:
Choose an integer L with 1≤ L ≤ N and apply S_{i} = (S_{i} + 1) \mod 10 for each 1 ≤ i ≤ L.
For example, if S=39590, then choosing L=3 and applying the operation yields the string S=\underl... | try:
def binarysearch(string, K):
X = string[::-1]
s = 0
p = 0
for i in range(0, len(X)):
if i == 0:
item = (10 - int(X[i])) % 10
s = s + item
else:
item = (10 - (s % 10 + int(X[i])) % 10) % 10
s... | FUNC_DEF ASSIGN VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR IF VAR NUMBER ASSIGN VAR BIN_OP BIN_OP NUMBER FUNC_CALL VAR VAR VAR NUMBER ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP BIN_OP NUMBER BIN_OP BIN_OP BIN_OP VAR NUMBER FUNC_CALL VAR VAR VAR NUMBER NUMBER ASSIG... |
You are given a string S of length N, which consists of digits from 0 to 9. You can apply the following operation to the string:
Choose an integer L with 1≤ L ≤ N and apply S_{i} = (S_{i} + 1) \mod 10 for each 1 ≤ i ≤ L.
For example, if S=39590, then choosing L=3 and applying the operation yields the string S=\underl... | for _ in range(int(input())):
n, k = map(int, input().split())
s = input()
a = [k]
m = int(k / 10)
t = 0
for i in range(n):
remainder = a[i] % 10
diff = 10 - int(s[i])
if remainder < diff:
num = diff + (m - 1) * 10
m = int(num / 10)
if ... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST VAR ASSIGN VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP NUMBER FUNC_CALL VAR VAR VAR I... |
You are given a string S of length N, which consists of digits from 0 to 9. You can apply the following operation to the string:
Choose an integer L with 1≤ L ≤ N and apply S_{i} = (S_{i} + 1) \mod 10 for each 1 ≤ i ≤ L.
For example, if S=39590, then choosing L=3 and applying the operation yields the string S=\underl... | for i in range(int(input())):
n, k = map(int, input().split())
s = input()
def calc_val(x):
ans = 0
for i in range(len(x) - 1, -1, -1):
num = (int(x[i]) + ans) % 10
if num != 0:
req = 10 - num
ans += req
return ans
low = 0... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_DEF ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER NUMBER ASSIGN VAR BIN_OP BIN_OP FUNC_CALL VAR VAR VAR VAR NUMBER IF VAR NUMBER ASSIGN VAR BIN_OP NUM... |
You are given a string S of length N, which consists of digits from 0 to 9. You can apply the following operation to the string:
Choose an integer L with 1≤ L ≤ N and apply S_{i} = (S_{i} + 1) \mod 10 for each 1 ≤ i ≤ L.
For example, if S=39590, then choosing L=3 and applying the operation yields the string S=\underl... | def calculate_flips(ss):
flips = 0
for i in range(len(ss) - 1, -1, -1):
num = int(ss[i])
num = (num + flips % 10) % 10
flips += (10 - num) % 10
return flips
t = int(input())
for _ in range(t):
n, k = list(map(int, input().split()))
s = input()
lo = 0
hi = len(s) - 1... | FUNC_DEF ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR BIN_OP VAR NUMBER NUMBER VAR BIN_OP BIN_OP NUMBER VAR NUMBER RETURN VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL V... |
You are given a string S of length N, which consists of digits from 0 to 9. You can apply the following operation to the string:
Choose an integer L with 1≤ L ≤ N and apply S_{i} = (S_{i} + 1) \mod 10 for each 1 ≤ i ≤ L.
For example, if S=39590, then choosing L=3 and applying the operation yields the string S=\underl... | for _ in range(int(input())):
n, k = map(int, input().split())
s = list(input())
res = 0
for i in range(n):
req = (10 - (ord(s[i]) - ord("0"))) % 10
if req > k:
break
res += 1
k = (k - req) // 10 * 10 + req
print(res) | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP BIN_OP NUMBER BIN_OP FUNC_CALL VAR VAR VAR FUNC_CALL VAR STRING NUMBER IF VAR VAR VAR NUMBER ASSIGN VAR BIN_OP B... |
You are given a string S of length N, which consists of digits from 0 to 9. You can apply the following operation to the string:
Choose an integer L with 1≤ L ≤ N and apply S_{i} = (S_{i} + 1) \mod 10 for each 1 ≤ i ≤ L.
For example, if S=39590, then choosing L=3 and applying the operation yields the string S=\underl... | import sys
def readInt():
x = int(sys.stdin.readline().rstrip())
return x
def readList(type=int):
x = sys.stdin.readline()
x = list(map(type, x.rstrip("\n\r").split()))
return x
write = sys.stdout.write
read = sys.stdin.readline
def solve():
n, k = readList()
s = read().rstrip("\n")
... | IMPORT FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR RETURN VAR FUNC_DEF VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING RETURN VAR ASSIGN VAR VAR ASSIGN VAR VAR FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR ... |
You are given a string S of length N, which consists of digits from 0 to 9. You can apply the following operation to the string:
Choose an integer L with 1≤ L ≤ N and apply S_{i} = (S_{i} + 1) \mod 10 for each 1 ≤ i ≤ L.
For example, if S=39590, then choosing L=3 and applying the operation yields the string S=\underl... | def bs(a, m, k):
s, p = 0, 0
for i in range(m - 1, -1, -1):
x = (a[i] + p) % 10
y = (10 - x) % 10
s = s + y
p += y
if s <= k:
return True
else:
return False
t = int(input())
for _ in range(t):
n, k = map(int, input().split())
a = input()
a = ... | FUNC_DEF ASSIGN VAR VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR VAR NUMBER ASSIGN VAR BIN_OP BIN_OP NUMBER VAR NUMBER ASSIGN VAR BIN_OP VAR VAR VAR VAR IF VAR VAR RETURN NUMBER RETURN NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASS... |
You are given a string S of length N, which consists of digits from 0 to 9. You can apply the following operation to the string:
Choose an integer L with 1≤ L ≤ N and apply S_{i} = (S_{i} + 1) \mod 10 for each 1 ≤ i ≤ L.
For example, if S=39590, then choosing L=3 and applying the operation yields the string S=\underl... | def find(a):
return (10 - a) % 10
def BS(x, S, K):
shift = 0
for i in range(x, -1, -1):
v = int(S[i])
v += shift
v %= 10
curr = find(v)
shift += curr
return shift <= K
for t in range(int(input())):
N, K = map(int, input().split())
S = str(input())
... | FUNC_DEF RETURN BIN_OP BIN_OP NUMBER VAR NUMBER FUNC_DEF ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR VAR VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR VAR RETURN VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CAL... |
You are given a string S of length N, which consists of digits from 0 to 9. You can apply the following operation to the string:
Choose an integer L with 1≤ L ≤ N and apply S_{i} = (S_{i} + 1) \mod 10 for each 1 ≤ i ≤ L.
For example, if S=39590, then choosing L=3 and applying the operation yields the string S=\underl... | def getop(s):
l = len(s)
curr = 0
idx = l - 1
while idx >= 0:
req = abs(curr + s[idx]) % 10
curr = curr + (10 - req) % 10
idx -= 1
return curr
def func():
n, k = map(int, input().split())
l = [int(i) for i in input()]
low = 0
high = n - 1
mx = 0
whil... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER WHILE VAR NUMBER ASSIGN VAR BIN_OP FUNC_CALL VAR BIN_OP VAR VAR VAR NUMBER ASSIGN VAR BIN_OP VAR BIN_OP BIN_OP NUMBER VAR NUMBER VAR NUMBER RETURN VAR FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CA... |
You are given a string S of length N, which consists of digits from 0 to 9. You can apply the following operation to the string:
Choose an integer L with 1≤ L ≤ N and apply S_{i} = (S_{i} + 1) \mod 10 for each 1 ≤ i ≤ L.
For example, if S=39590, then choosing L=3 and applying the operation yields the string S=\underl... | def chkFunction(ind, st):
prev = 0
for x in range(ind, -1, -1):
new = prev + int(st[x])
if new % 10 != 0:
prev += 10 - new % 10
return prev
for tc in range(int(input())):
ls = list(map(int, input().split()))
n, k = ls[0], ls[1]
s = input()
ans = -1
lo = 0
... | FUNC_DEF ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR NUMBER NUMBER ASSIGN VAR BIN_OP VAR FUNC_CALL VAR VAR VAR IF BIN_OP VAR NUMBER NUMBER VAR BIN_OP NUMBER BIN_OP VAR NUMBER RETURN VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VA... |
You are given a string S of length N, which consists of digits from 0 to 9. You can apply the following operation to the string:
Choose an integer L with 1≤ L ≤ N and apply S_{i} = (S_{i} + 1) \mod 10 for each 1 ≤ i ≤ L.
For example, if S=39590, then choosing L=3 and applying the operation yields the string S=\underl... | t = int(input())
def solve(s, m):
x = 0
for i in range(m, -1, -1):
v = (int(s[i]) + x) % 10
if v == 0:
continue
x += 10 - v
return x
def bsrch(s, n, k):
l, r = 0, n - 1
while l <= r:
m = (l + r) // 2
if solve(s, m) > k:
r = m - 1
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR NUMBER NUMBER ASSIGN VAR BIN_OP BIN_OP FUNC_CALL VAR VAR VAR VAR NUMBER IF VAR NUMBER VAR BIN_OP NUMBER VAR RETURN VAR FUNC_DEF ASSIGN VAR VAR NUMBER BIN_OP VAR NUMBER WHILE VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER IF FUN... |
You are given a string S of length N, which consists of digits from 0 to 9. You can apply the following operation to the string:
Choose an integer L with 1≤ L ≤ N and apply S_{i} = (S_{i} + 1) \mod 10 for each 1 ≤ i ≤ L.
For example, if S=39590, then choosing L=3 and applying the operation yields the string S=\underl... | def solve(n, k, arr):
def moves_needed(m):
offset = 0
for i in range(m, -1, -1):
num = (arr[i] + offset) % 10
if num != 0:
offset += 10 - num
return offset
l = 0
r = n - 1
while l < r:
m = (l + r) // 2
if moves_needed(m) >... | FUNC_DEF FUNC_DEF ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR NUMBER NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR VAR NUMBER IF VAR NUMBER VAR BIN_OP NUMBER VAR RETURN VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER WHILE VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER IF FUNC_CALL VAR VAR VAR ASSIGN VAR VAR ASSIGN VAR B... |
You are given a string S of length N, which consists of digits from 0 to 9. You can apply the following operation to the string:
Choose an integer L with 1≤ L ≤ N and apply S_{i} = (S_{i} + 1) \mod 10 for each 1 ≤ i ≤ L.
For example, if S=39590, then choosing L=3 and applying the operation yields the string S=\underl... | GI = lambda: int(input())
GIS = lambda: map(int, input().split())
LGIS = lambda: list(GIS())
def main():
for t in range(GI()):
n, k = GIS()
s = input()
print(solve(n, k, s))
def solve(n, k, s):
l = -1
r = n - 1
while l < r:
m = (l + r + 1) // 2
if can_prefix_f... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF FOR VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR VAR VAR FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR BIN_OP ... |
You are given a string S of length N, which consists of digits from 0 to 9. You can apply the following operation to the string:
Choose an integer L with 1≤ L ≤ N and apply S_{i} = (S_{i} + 1) \mod 10 for each 1 ≤ i ≤ L.
For example, if S=39590, then choosing L=3 and applying the operation yields the string S=\underl... | from sys import stdin, stdout
inp_num = lambda: int(input())
inp_lis = lambda: list(map(int, input().split()))
def cal(s, m):
tot = 0
for i in range(m, -1, -1):
n = (int(s[i]) + tot) % 10
if n == 0:
continue
tot = tot + (10 - n)
return tot
for _ in range(inp_num()):
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR NUMBER NUMBER ASSIGN VAR BIN_OP BIN_OP FUNC_CALL VAR VAR VAR VAR NUMBER IF VAR NUMBER ASSIGN VAR BIN_OP VAR BIN_OP NUMBER VAR RETURN VAR FOR VAR FUNC_CALL VAR FU... |
CodeChef admins went on shopping at a shopping mall.
There are N shops in the mall where the i^{th} shop has a capacity of A_{i} people. In other words, at any point in time, there can be at most A_{i} number of people in the i^{th} shop.
There are X admins. Each admin wants to visit each of the N shops exactly once... | for _ in range(int(input())):
n, x = map(int, input().split())
arr = list(map(int, input().split()))
minn = min(arr)
tmp = x // minn if x % minn == 0 else x // minn + 1
print(max(tmp, n)) | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN 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 NUMBER BIN_OP VAR VAR BIN_OP BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR VAR VAR |
CodeChef admins went on shopping at a shopping mall.
There are N shops in the mall where the i^{th} shop has a capacity of A_{i} people. In other words, at any point in time, there can be at most A_{i} number of people in the i^{th} shop.
There are X admins. Each admin wants to visit each of the N shops exactly once... | for i in range(int(input())):
n, x = map(int, input().split())
a = list(map(int, input().split()))
if min(a) * n >= x:
print(n)
else:
print((x + min(a) - 1) // min(a)) | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN 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 IF BIN_OP FUNC_CALL VAR VAR VAR VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR BIN_OP BIN_OP BIN_OP VAR FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR VAR |
CodeChef admins went on shopping at a shopping mall.
There are N shops in the mall where the i^{th} shop has a capacity of A_{i} people. In other words, at any point in time, there can be at most A_{i} number of people in the i^{th} shop.
There are X admins. Each admin wants to visit each of the N shops exactly once... | test = int(input())
for i in range(test):
n, x = map(int, input().split())
array = list(map(int, input().split()))
array.sort()
maa = array[0]
answer = x // maa + (x % maa != 0)
if n >= answer:
print(n)
else:
print(answer) | 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 ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR BIN_OP VAR VAR NUMBER IF VAR VAR EXPR FUNC_CALL VAR VAR E... |
CodeChef admins went on shopping at a shopping mall.
There are N shops in the mall where the i^{th} shop has a capacity of A_{i} people. In other words, at any point in time, there can be at most A_{i} number of people in the i^{th} shop.
There are X admins. Each admin wants to visit each of the N shops exactly once... | t = int(input())
while t > 0:
n, x = map(int, input().split())
l = list(map(int, input().split()))
t -= 1
a = min(l)
b = x / a
if b % 1 == 0:
b = int(b)
else:
b = int(b) + 1
if b > n:
print(b)
else:
print(n) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR NUMBER ASSIGN 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 VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR VAR IF BIN_OP VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP... |
CodeChef admins went on shopping at a shopping mall.
There are N shops in the mall where the i^{th} shop has a capacity of A_{i} people. In other words, at any point in time, there can be at most A_{i} number of people in the i^{th} shop.
There are X admins. Each admin wants to visit each of the N shops exactly once... | def ubounddiv(n, m):
if n % m == 0:
return int(n / m)
else:
return int(n / m + 1)
t = int(input())
for i in range(t):
n, x = map(int, input().split())
tmp = list(input().split())
lst = [int(v) for v in tmp]
z = ubounddiv(x, min(lst))
print(max(n, z)) | FUNC_DEF IF BIN_OP VAR VAR NUMBER RETURN FUNC_CALL VAR BIN_OP VAR VAR RETURN FUNC_CALL VAR BIN_OP BIN_OP VAR VAR NUMBER 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 ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ... |
CodeChef admins went on shopping at a shopping mall.
There are N shops in the mall where the i^{th} shop has a capacity of A_{i} people. In other words, at any point in time, there can be at most A_{i} number of people in the i^{th} shop.
There are X admins. Each admin wants to visit each of the N shops exactly once... | def minimum_time_required(activity, n, x):
min_capacity = min(capacity)
if x % min_capacity == 0:
result = x / min_capacity
else:
result = x / min_capacity + 1
return max(result, n)
t = int(input())
while t:
n_and_x = list(map(int, input().split()))
n = n_and_x[0]
x = n_and... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR IF BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER RETURN FUNC_CALL VAR VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER AS... |
CodeChef admins went on shopping at a shopping mall.
There are N shops in the mall where the i^{th} shop has a capacity of A_{i} people. In other words, at any point in time, there can be at most A_{i} number of people in the i^{th} shop.
There are X admins. Each admin wants to visit each of the N shops exactly once... | for t in range(int(input())):
n, x = map(int, input().split())
A = [int(i) for i in input().split()]
if x <= n or x <= min(A):
ans = n
else:
ans = x / min(A)
if ans != int(ans):
ans = int(ans) + 1
ans = int(ans)
print(max(n, ans)) | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR VAR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR ASSIGN VAR BIN_OP VAR FUNC_CALL VAR VAR IF VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP FUNC_CALL VAR VAR NUMBER ... |
CodeChef admins went on shopping at a shopping mall.
There are N shops in the mall where the i^{th} shop has a capacity of A_{i} people. In other words, at any point in time, there can be at most A_{i} number of people in the i^{th} shop.
There are X admins. Each admin wants to visit each of the N shops exactly once... | n = int(input())
while n:
n -= 1
N, x = map(int, input().split())
l = [int(k) for k in input().split()]
mini = min(l)
a = x // mini
if x % mini != 0:
a += 1
print(max(a, N)) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR VAR NUMBER ASSIGN 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 BIN_OP VAR VAR IF BIN_OP VAR VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR VAR VAR |
CodeChef admins went on shopping at a shopping mall.
There are N shops in the mall where the i^{th} shop has a capacity of A_{i} people. In other words, at any point in time, there can be at most A_{i} number of people in the i^{th} shop.
There are X admins. Each admin wants to visit each of the N shops exactly once... | def p():
n, x = map(int, input().split())
z = min(map(int, input().split()))
m = max(n, x // z + (x % z != 0))
print(m)
t = int(input())
while t:
t -= 1
p() | FUNC_DEF ASSIGN 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 BIN_OP BIN_OP VAR VAR BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR VAR NUMBER EXPR FUNC_CALL VAR |
CodeChef admins went on shopping at a shopping mall.
There are N shops in the mall where the i^{th} shop has a capacity of A_{i} people. In other words, at any point in time, there can be at most A_{i} number of people in the i^{th} shop.
There are X admins. Each admin wants to visit each of the N shops exactly once... | t = int(input())
def ceil(a, b):
if a % b == 0:
return a // b
else:
return a // b + 1
while t:
t -= 1
n, x = map(int, input().split())
ls = list(map(int, input().split()))
res = ceil(x, min(ls))
print(max(res, n)) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF IF BIN_OP VAR VAR NUMBER RETURN BIN_OP VAR VAR RETURN BIN_OP BIN_OP VAR VAR NUMBER WHILE VAR VAR NUMBER ASSIGN 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 FUNC_CALL VAR V... |
CodeChef admins went on shopping at a shopping mall.
There are N shops in the mall where the i^{th} shop has a capacity of A_{i} people. In other words, at any point in time, there can be at most A_{i} number of people in the i^{th} shop.
There are X admins. Each admin wants to visit each of the N shops exactly once... | test = int(input())
while test:
n, x = map(int, input().split())
a = [int(x) for x in input().split()]
print(max((x - 1) // min(a) + 1, n))
test -= 1 | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR ASSIGN 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 FUNC_CALL VAR BIN_OP BIN_OP BIN_OP VAR NUMBER FUNC_CALL VAR VAR NUMBER VAR VAR NUMBER |
CodeChef admins went on shopping at a shopping mall.
There are N shops in the mall where the i^{th} shop has a capacity of A_{i} people. In other words, at any point in time, there can be at most A_{i} number of people in the i^{th} shop.
There are X admins. Each admin wants to visit each of the N shops exactly once... | t = int(input())
for i in range(t):
n, x = map(int, input().split())
a = list(map(int, input().split()))
res = 0
if x % min(a) == 0:
res = x // min(a)
else:
res = x // min(a) + 1
print(max(n, res)) | 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 ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER IF BIN_OP VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR BIN_OP VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR FUNC_... |
There are $n$ cities and $m$ roads in Berland. Each road connects a pair of cities. The roads in Berland are one-way.
What is the minimum number of new roads that need to be built to make all the cities reachable from the capital?
New roads will also be one-way.
-----Input-----
The first line of input consists of ... | import sys
BigNum = 10**10
class DSU:
def __init__(self, count, stateInitializer, stateMerger):
self.vs = list(range(count))
self.states = [stateInitializer(i) for i in range(count)]
self.sizes = [1] * count
self.merger = stateMerger
def get(self, i):
if self.vs[i] =... | IMPORT ASSIGN VAR BIN_OP NUMBER NUMBER CLASS_DEF FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR VAR FUNC_DEF IF VAR VAR VAR RETURN VAR ASSIGN VAR FUNC_CALL VAR VAR VAR ASSIGN VAR VAR VAR RETURN VAR FUNC_DEF RETURN VAR F... |
There are $n$ cities and $m$ roads in Berland. Each road connects a pair of cities. The roads in Berland are one-way.
What is the minimum number of new roads that need to be built to make all the cities reachable from the capital?
New roads will also be one-way.
-----Input-----
The first line of input consists of ... | import sys
input = lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(50000)
def scc(N, G, RG):
order = []
used = [0] * N
group = [None] * N
def dfs(s):
used[s] = 1
for t in G[s]:
if not used[t]:
dfs(t)
order.append(s)
def rdfs(s, col... | IMPORT ASSIGN VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR NUMBER FUNC_DEF ASSIGN VAR LIST ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR BIN_OP LIST NONE VAR FUNC_DEF ASSIGN VAR VAR NUMBER FOR VAR VAR VAR IF VAR VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR FUNC_DEF ASSIGN VAR VAR VAR ASSIGN VAR VAR NUMBER FOR VAR... |
There are $n$ cities and $m$ roads in Berland. Each road connects a pair of cities. The roads in Berland are one-way.
What is the minimum number of new roads that need to be built to make all the cities reachable from the capital?
New roads will also be one-way.
-----Input-----
The first line of input consists of ... | import sys
input = sys.stdin.readline
n, m, s = list(map(int, input().split()))
s -= 1
adj = [[] for _ in range(n)]
rev = [[] for _ in range(n)]
for u, v in (list(map(int, input().split())) for _ in range(m)):
adj[u - 1].append(v - 1)
rev[v - 1].append(u - 1)
group = [-1] * n
group[s] = 0
stack = [s]
while sta... | IMPORT ASSIGN VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR VAR NUMBER ASSIGN VAR LIST VAR FUNC_CALL VAR VAR ASSIGN VAR LIST VAR FUNC_CALL VAR VAR FOR VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR NUMBER BIN_OP VA... |
There are $n$ cities and $m$ roads in Berland. Each road connects a pair of cities. The roads in Berland are one-way.
What is the minimum number of new roads that need to be built to make all the cities reachable from the capital?
New roads will also be one-way.
-----Input-----
The first line of input consists of ... | import sys
N = 5000 + 5
adj = [[] for i in range(N)]
mark = [(0) for i in range(N)]
topo = []
sys.setrecursionlimit(6000)
n, m, s = list(map(int, input().split()))
for i in range(m):
u, v = list(map(int, input().split()))
adj[u].append(v)
def topoSort(u):
mark[u] = 1
for j in range(len(adj[u])):
... | IMPORT ASSIGN VAR BIN_OP NUMBER NUMBER ASSIGN VAR LIST VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR LIST EXPR FUNC_CALL VAR NUMBER ASSIGN VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUN... |
There are $n$ cities and $m$ roads in Berland. Each road connects a pair of cities. The roads in Berland are one-way.
What is the minimum number of new roads that need to be built to make all the cities reachable from the capital?
New roads will also be one-way.
-----Input-----
The first line of input consists of ... | import sys
n, m, s = list(map(int, input().split()))
adj = [[] for i in range(500005)]
ar = []
vis = [(0) for i in range(500005)]
sys.setrecursionlimit(6000)
def dfs(s):
vis[s] = 1
for i in range(len(adj[s])):
if vis[adj[s][i]] == 0:
dfs(adj[s][i])
ar.append(s)
for i in range(m):
... | IMPORT ASSIGN VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST VAR FUNC_CALL VAR NUMBER ASSIGN VAR LIST ASSIGN VAR NUMBER VAR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR NUMBER FUNC_DEF ASSIGN VAR VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR IF VAR VAR VAR VAR NUMBER EXPR FUNC_C... |
There are $n$ cities and $m$ roads in Berland. Each road connects a pair of cities. The roads in Berland are one-way.
What is the minimum number of new roads that need to be built to make all the cities reachable from the capital?
New roads will also be one-way.
-----Input-----
The first line of input consists of ... | import sys
sys.setrecursionlimit(6000)
n, m, s = map(int, input().split())
s -= 1
g = [[] for _ in range(n)]
for _ in range(m):
a, b = map(int, input().split())
g[a - 1].append(b - 1)
used = [False] * 5010
topo = []
def topo_sort(node):
used[node] = True
for c in g[node]:
if not used[c]:
... | IMPORT EXPR FUNC_CALL VAR NUMBER ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR VAR NUMBER ASSIGN VAR LIST VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR BIN_OP VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER NUMBER AS... |
There are $n$ cities and $m$ roads in Berland. Each road connects a pair of cities. The roads in Berland are one-way.
What is the minimum number of new roads that need to be built to make all the cities reachable from the capital?
New roads will also be one-way.
-----Input-----
The first line of input consists of ... | import sys
sys.setrecursionlimit(5000**2)
def dfs(n):
global ans, l1, mask
for i in l1[n - 1]:
if not mask[i - 1]:
mask[i - 1] = True
dfs(i)
def dfs1(n):
global ans, l, visited
for i in l[n - 1]:
if not visited[i - 1]:
visited[i - 1] = True
... | IMPORT EXPR FUNC_CALL VAR BIN_OP NUMBER NUMBER FUNC_DEF FOR VAR VAR BIN_OP VAR NUMBER IF VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR VAR FUNC_DEF FOR VAR VAR BIN_OP VAR NUMBER IF VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR VAR VAR BIN_OP VAR NUMBER VAR B... |
Recently, you found a bot to play "Rock paper scissors" with. Unfortunately, the bot uses quite a simple algorithm to play: he has a string $s = s_1 s_2 \dots s_{n}$ of length $n$ where each letter is either R, S or P.
While initializing, the bot is choosing a starting index $pos$ ($1 \le pos \le n$), and then it can ... | def read_list():
return list(map(int, input().split(" ")))
def print_list(l):
print(" ".join(map(str, l)))
def judge():
if dic[0] >= dic[1] and dic[0] >= dic[2]:
return "P"
if dic[1] >= dic[0] and dic[1] >= dic[2]:
return "R"
return "S"
N = int(input())
for _ in range(N):
s... | FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING FUNC_DEF EXPR FUNC_CALL VAR FUNC_CALL STRING FUNC_CALL VAR VAR VAR FUNC_DEF IF VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER RETURN STRING IF VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER RETURN STRING RETURN STRING ASSIGN VAR FUNC_CALL VAR FUNC... |
Recently, you found a bot to play "Rock paper scissors" with. Unfortunately, the bot uses quite a simple algorithm to play: he has a string $s = s_1 s_2 \dots s_{n}$ of length $n$ where each letter is either R, S or P.
While initializing, the bot is choosing a starting index $pos$ ($1 \le pos \le n$), and then it can ... | for i in "*" * int(input()):
s = input()
l = [s.count("S"), s.count("P"), s.count("R")]
print(["S", "P", "R"][l.index(max(l)) - 1] * len(s)) | FOR VAR BIN_OP STRING FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST FUNC_CALL VAR STRING FUNC_CALL VAR STRING FUNC_CALL VAR STRING EXPR FUNC_CALL VAR BIN_OP LIST STRING STRING STRING BIN_OP FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR VAR |
Recently, you found a bot to play "Rock paper scissors" with. Unfortunately, the bot uses quite a simple algorithm to play: he has a string $s = s_1 s_2 \dots s_{n}$ of length $n$ where each letter is either R, S or P.
While initializing, the bot is choosing a starting index $pos$ ($1 \le pos \le n$), and then it can ... | t = int(input())
for _ in range(t):
st = input()
ar = dict()
for i in st:
ar[i] = ar.get(i, 0) + 1
s = ar.get("S", 0)
p = ar.get("P", 0)
r = ar.get("R", 0)
if s >= p and s >= r:
ans = len(st) * "R"
elif p >= r and p >= s:
ans = len(st) * "S"
else:
ans ... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FOR VAR VAR ASSIGN VAR VAR BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR STRING NUMBER ASSIGN VAR FUNC_CALL VAR STRING NUMBER ASSIGN VAR FUNC_CALL VAR STRING NUMBER IF VAR VAR VAR VAR ASS... |
Recently, you found a bot to play "Rock paper scissors" with. Unfortunately, the bot uses quite a simple algorithm to play: he has a string $s = s_1 s_2 \dots s_{n}$ of length $n$ where each letter is either R, S or P.
While initializing, the bot is choosing a starting index $pos$ ($1 \le pos \le n$), and then it can ... | t = int(input())
while t:
t -= 1
s = input()
R = s.count("R")
S = s.count("S")
P = s.count("P")
if R == max([R, S, P]):
print("P" * len(s))
elif S == max([R, S, P]):
print("R" * len(s))
else:
print("S" * len(s)) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR STRING IF VAR FUNC_CALL VAR LIST VAR VAR VAR EXPR FUNC_CALL VAR BIN_OP STRING FUNC_CALL VAR VAR IF VAR FUNC_CALL VAR LIST VAR VAR VAR EXPR FUNC_CA... |
Recently, you found a bot to play "Rock paper scissors" with. Unfortunately, the bot uses quite a simple algorithm to play: he has a string $s = s_1 s_2 \dots s_{n}$ of length $n$ where each letter is either R, S or P.
While initializing, the bot is choosing a starting index $pos$ ($1 \le pos \le n$), and then it can ... | for i in range(int(input())):
s = input()
n = len(s)
cnt1 = s.count("R")
cnt2 = s.count("P")
cnt3 = s.count("S")
m = max(cnt1, cnt2, cnt3)
if m == cnt1:
print(n * "P")
elif m == cnt2:
print(n * "S")
else:
print(n * "R") | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR VAR VAR IF VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR STRING IF VAR VAR EXPR FUNC_CALL VAR BIN_O... |
Recently, you found a bot to play "Rock paper scissors" with. Unfortunately, the bot uses quite a simple algorithm to play: he has a string $s = s_1 s_2 \dots s_{n}$ of length $n$ where each letter is either R, S or P.
While initializing, the bot is choosing a starting index $pos$ ($1 \le pos \le n$), and then it can ... | for _ in range(int(input())):
n = input()
scount = n.count("S")
pcount = n.count("P")
rcount = n.count("R")
if scount == max(scount, pcount, rcount):
print(len(n) * "R")
elif pcount == max(scount, rcount, pcount):
print(len(n) * "S")
else:
print(len(n) * "P") | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR STRING IF VAR FUNC_CALL VAR VAR VAR VAR EXPR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR STRING IF VAR FUNC_CALL VAR VAR VAR VAR EXPR FUNC_CALL VAR BIN_OP FUNC_C... |
Recently, you found a bot to play "Rock paper scissors" with. Unfortunately, the bot uses quite a simple algorithm to play: he has a string $s = s_1 s_2 \dots s_{n}$ of length $n$ where each letter is either R, S or P.
While initializing, the bot is choosing a starting index $pos$ ($1 \le pos \le n$), and then it can ... | def solve(s, ans):
n = len(s)
s1 = []
r = s.count("R")
p = s.count("P")
sc = s.count("S")
if sc == max(sc, p, r):
move = "R"
elif p == max(sc, p, r):
move = "S"
else:
move = "P"
for i in range(n):
s1.append(move)
ans.append(s1)
def main():
t ... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR LIST ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR STRING IF VAR FUNC_CALL VAR VAR VAR VAR ASSIGN VAR STRING IF VAR FUNC_CALL VAR VAR VAR VAR ASSIGN VAR STRING ASSIGN VAR STRING FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR E... |
Recently, you found a bot to play "Rock paper scissors" with. Unfortunately, the bot uses quite a simple algorithm to play: he has a string $s = s_1 s_2 \dots s_{n}$ of length $n$ where each letter is either R, S or P.
While initializing, the bot is choosing a starting index $pos$ ($1 \le pos \le n$), and then it can ... | for _ in " " * int(input()):
b = input()
r = len(b)
z = b.count("R")
z1 = b.count("P")
z2 = b.count("S")
if z == max(z, z1, z2):
print("P" * r)
elif z1 == max(z, z1, z2):
print("S" * r)
else:
print("R" * r) | FOR VAR BIN_OP STRING FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR STRING IF VAR FUNC_CALL VAR VAR VAR VAR EXPR FUNC_CALL VAR BIN_OP STRING VAR IF VAR FUNC_CALL VAR VAR VAR VAR EXPR FUNC_CALL VA... |
Recently, you found a bot to play "Rock paper scissors" with. Unfortunately, the bot uses quite a simple algorithm to play: he has a string $s = s_1 s_2 \dots s_{n}$ of length $n$ where each letter is either R, S or P.
While initializing, the bot is choosing a starting index $pos$ ($1 \le pos \le n$), and then it can ... | t = int(input())
for tt in range(t):
x = input()
d = {}
for i in range(len(x)):
d[x[i]] = d.get(x[i], 0) + 1
v = list(d.values())
u = list(d.keys())
k = u[v.index(max(v))]
if k == "R":
print("P" * len(x))
elif k == "P":
print("S" * len(x))
else:
print(... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR DICT FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR BIN_OP FUNC_CALL VAR VAR VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_... |
Recently, you found a bot to play "Rock paper scissors" with. Unfortunately, the bot uses quite a simple algorithm to play: he has a string $s = s_1 s_2 \dots s_{n}$ of length $n$ where each letter is either R, S or P.
While initializing, the bot is choosing a starting index $pos$ ($1 \le pos \le n$), and then it can ... | t = int(input())
for i in range(t):
s = input()
b = []
for j in s:
b.append(j)
n = len(b)
x = b.count("R")
y = b.count("P")
z = b.count("S")
m = max(x, y, z)
if x == m:
res = ["P"] * n
elif y == m:
res = ["S"] * n
elif z == m:
res = ["R"] * n
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR VAR VAR IF VAR VAR ASSIGN... |
Recently, you found a bot to play "Rock paper scissors" with. Unfortunately, the bot uses quite a simple algorithm to play: he has a string $s = s_1 s_2 \dots s_{n}$ of length $n$ where each letter is either R, S or P.
While initializing, the bot is choosing a starting index $pos$ ($1 \le pos \le n$), and then it can ... | t = int(input())
while t > 0:
t -= 1
ln = list(input())
alt = []
r, p, s = 0, 0, 0
for hand in ln:
if hand == "R":
p += 1
alt.append("P")
elif hand == "P":
s += 1
alt.append("S")
elif hand == "S":
r += 1
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR NUMBER VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR VAR VAR NUMBER NUMBER NUMBER FOR VAR VAR IF VAR STRING VAR NUMBER EXPR FUNC_CALL VAR STRING IF VAR STRING VAR NUMBER EXPR FUNC_CALL VAR STRING IF VAR STRING VAR NUMBER EXPR FUNC_CALL VAR ... |
Recently, you found a bot to play "Rock paper scissors" with. Unfortunately, the bot uses quite a simple algorithm to play: he has a string $s = s_1 s_2 \dots s_{n}$ of length $n$ where each letter is either R, S or P.
While initializing, the bot is choosing a starting index $pos$ ($1 \le pos \le n$), and then it can ... | for i in range(int(input())):
s = list(input())
d = {}
for i in range(len(s)):
if s[i] not in d:
d[s[i]] = 0
d[s[i]] += 1
mx = 0
for i in d:
if d[i] > mx:
mx = d[i]
ind = i
if ind == "R":
sol = len(s) * ["P"]
elif ind == "P"... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR DICT FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR VAR ASSIGN VAR VAR VAR NUMBER VAR VAR VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR IF VAR VAR VAR ASSIGN VAR VAR VAR ASSIGN VAR VAR IF VAR STRING ASSIGN VAR BIN_OP FUNC... |
Recently, you found a bot to play "Rock paper scissors" with. Unfortunately, the bot uses quite a simple algorithm to play: he has a string $s = s_1 s_2 \dots s_{n}$ of length $n$ where each letter is either R, S or P.
While initializing, the bot is choosing a starting index $pos$ ($1 \le pos \le n$), and then it can ... | keys = {"R": "P", "S": "R", "P": "S"}
for test in range(int(input())):
s = input()
counter = {s.count("R"): "R", s.count("S"): "S", s.count("P"): "P"}
m = max(counter.keys())
ans = keys[counter[m]] * len(s)
print(ans) | ASSIGN VAR DICT STRING STRING STRING STRING STRING STRING FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR DICT FUNC_CALL VAR STRING FUNC_CALL VAR STRING FUNC_CALL VAR STRING STRING STRING STRING ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP VAR VAR VAR FUNC_CALL VAR VAR ... |
Recently, you found a bot to play "Rock paper scissors" with. Unfortunately, the bot uses quite a simple algorithm to play: he has a string $s = s_1 s_2 \dots s_{n}$ of length $n$ where each letter is either R, S or P.
While initializing, the bot is choosing a starting index $pos$ ($1 \le pos \le n$), and then it can ... | t = int(input())
for hatt in range(t):
s = input()
nr, np, ns = 0, 0, 0
for i in s:
if i == "R":
nr += 1
elif i == "S":
ns += 1
else:
np += 1
m = max(nr, np, ns)
if m == nr:
c = "P"
elif m == ns:
c = "R"
else:
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR VAR NUMBER NUMBER NUMBER FOR VAR VAR IF VAR STRING VAR NUMBER IF VAR STRING VAR NUMBER VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR VAR IF VAR VAR ASSIGN VAR STRING IF VAR VAR ASSIGN VAR STRING ASSIGN VAR STRING EXPR... |
Recently, you found a bot to play "Rock paper scissors" with. Unfortunately, the bot uses quite a simple algorithm to play: he has a string $s = s_1 s_2 \dots s_{n}$ of length $n$ where each letter is either R, S or P.
While initializing, the bot is choosing a starting index $pos$ ($1 \le pos \le n$), and then it can ... | for _ in range(int(input())):
st = input()
le = len(st)
ro = 0
pa = 0
sc = 0
for i in st:
if i == "R":
ro += 1
elif i == "P":
pa += 1
else:
sc += 1
ma = max(ro, pa, sc)
if ro == ma:
print("P" * le)
elif pa == ma:
... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR IF VAR STRING VAR NUMBER IF VAR STRING VAR NUMBER VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR VAR IF VAR VAR EXPR FUNC_CALL VAR BIN_OP STRING VAR IF V... |
Recently, you found a bot to play "Rock paper scissors" with. Unfortunately, the bot uses quite a simple algorithm to play: he has a string $s = s_1 s_2 \dots s_{n}$ of length $n$ where each letter is either R, S or P.
While initializing, the bot is choosing a starting index $pos$ ($1 \le pos \le n$), and then it can ... | t = int(input())
for _ in range(t):
msg = input()
r, s, p = 0, 0, 0
for w in msg:
if w == "R":
r += 1
if w == "S":
s += 1
if w == "P":
p += 1
if max(r, s, p) == r:
print("P" * len(msg))
elif max(r, s, p) == s:
print("R" * le... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR VAR NUMBER NUMBER NUMBER FOR VAR VAR IF VAR STRING VAR NUMBER IF VAR STRING VAR NUMBER IF VAR STRING VAR NUMBER IF FUNC_CALL VAR VAR VAR VAR VAR EXPR FUNC_CALL VAR BIN_OP STRING FUNC_CALL VAR VAR IF FUNC_CALL VAR VA... |
Recently, you found a bot to play "Rock paper scissors" with. Unfortunately, the bot uses quite a simple algorithm to play: he has a string $s = s_1 s_2 \dots s_{n}$ of length $n$ where each letter is either R, S or P.
While initializing, the bot is choosing a starting index $pos$ ($1 \le pos \le n$), and then it can ... | for _ in range(int(input())):
s = list(input())
h = {"P": 0, "S": 0, "R": 0}
for i in s:
h[i] += 1
mi = 0
key = ""
for i in h.keys():
if h[i] > mi:
mi = h[i]
key = i
if h["P"] == 1 and h["S"] == 1 and h["R"] == 1:
print("PSR")
elif key == "... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR DICT STRING STRING STRING NUMBER NUMBER NUMBER FOR VAR VAR VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR STRING FOR VAR FUNC_CALL VAR IF VAR VAR VAR ASSIGN VAR VAR VAR ASSIGN VAR VAR IF VAR STRING NUMBER VAR STRING NUMBER ... |
Recently, you found a bot to play "Rock paper scissors" with. Unfortunately, the bot uses quite a simple algorithm to play: he has a string $s = s_1 s_2 \dots s_{n}$ of length $n$ where each letter is either R, S or P.
While initializing, the bot is choosing a starting index $pos$ ($1 \le pos \le n$), and then it can ... | import sys
input = sys.stdin.readline
I = lambda: list(map(int, input().split()))
(t,) = I()
for i in range(t):
s = input().strip()
r, si, p = s.count("R"), s.count("S"), s.count("P")
print(
len(s) * "P" if r > si and r > p else len(s) * "R" if si > p else len(s) * "S"
) | IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR STRING FUNC_CALL VAR STRING FUNC_CALL VAR STRING EXPR FUNC_CALL VAR VAR VAR VAR VAR BIN_OP FUNC_CALL VAR VAR STR... |
Recently, you found a bot to play "Rock paper scissors" with. Unfortunately, the bot uses quite a simple algorithm to play: he has a string $s = s_1 s_2 \dots s_{n}$ of length $n$ where each letter is either R, S or P.
While initializing, the bot is choosing a starting index $pos$ ($1 \le pos \le n$), and then it can ... | t = int(input())
for _ in range(t):
a = input()
d = {"R": 0, "S": 0, "P": 0}
for i in a:
d[i] += 1
if d["R"] >= d["S"] and d["S"] >= d["P"] or d["R"] >= d["P"] and d["P"] >= d["S"]:
d["R"] = len(a)
while d["R"] > 0:
print("P", end="")
d["R"] -= 1
elif ... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR DICT STRING STRING STRING NUMBER NUMBER NUMBER FOR VAR VAR VAR VAR NUMBER IF VAR STRING VAR STRING VAR STRING VAR STRING VAR STRING VAR STRING VAR STRING VAR STRING ASSIGN VAR STRING FUNC_CALL VAR VAR WHILE VAR STRING N... |
Recently, you found a bot to play "Rock paper scissors" with. Unfortunately, the bot uses quite a simple algorithm to play: he has a string $s = s_1 s_2 \dots s_{n}$ of length $n$ where each letter is either R, S or P.
While initializing, the bot is choosing a starting index $pos$ ($1 \le pos \le n$), and then it can ... | import sys
input = sys.stdin.readline
LI = lambda: list(map(int, input().split()))
MI = lambda: map(int, input().split())
SI = lambda: input().strip("\n")
II = lambda: int(input())
res = []
for _ in range(II()):
r, s, p = 0, 0, 0
S = SI()
n = len(S)
for c in S:
if c == "R":
r += 1
... | IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL 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 FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR NUMBER NUMBER NUMBER ASSIG... |
Recently, you found a bot to play "Rock paper scissors" with. Unfortunately, the bot uses quite a simple algorithm to play: he has a string $s = s_1 s_2 \dots s_{n}$ of length $n$ where each letter is either R, S or P.
While initializing, the bot is choosing a starting index $pos$ ($1 \le pos \le n$), and then it can ... | t = input()
for i in range(int(t)):
string = input()
frequency = [0, 0, 0]
for j in string:
if j == "R":
frequency[0] += 1
elif j == "S":
frequency[1] += 1
elif j == "P":
frequency[2] += 1
a = max(frequency)
if frequency.index(a) == 0:
... | ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST NUMBER NUMBER NUMBER FOR VAR VAR IF VAR STRING VAR NUMBER NUMBER IF VAR STRING VAR NUMBER NUMBER IF VAR STRING VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR VAR IF FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR BIN_OP ST... |
Recently, you found a bot to play "Rock paper scissors" with. Unfortunately, the bot uses quite a simple algorithm to play: he has a string $s = s_1 s_2 \dots s_{n}$ of length $n$ where each letter is either R, S or P.
While initializing, the bot is choosing a starting index $pos$ ($1 \le pos \le n$), and then it can ... | test_case = int(input())
for _ in range(test_case):
st = input()
x = [0, 0, 0]
for i in st:
if i == "R":
x[0] += 1
elif i == "S":
x[1] += 1
else:
x[2] += 1
y = {"P": x[0], "R": x[1], "S": x[2]}
y = sorted(y.items(), key=lambda m: m[1])
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST NUMBER NUMBER NUMBER FOR VAR VAR IF VAR STRING VAR NUMBER NUMBER IF VAR STRING VAR NUMBER NUMBER VAR NUMBER NUMBER ASSIGN VAR DICT STRING STRING STRING VAR NUMBER VAR NUMBER VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC... |
Recently, you found a bot to play "Rock paper scissors" with. Unfortunately, the bot uses quite a simple algorithm to play: he has a string $s = s_1 s_2 \dots s_{n}$ of length $n$ where each letter is either R, S or P.
While initializing, the bot is choosing a starting index $pos$ ($1 \le pos \le n$), and then it can ... | class Solution:
def __init__(self):
for t in range(int(input())):
s = list(input())
self.solve(s)
def solve(self, s):
win = {"R": "P", "P": "S", "S": "R"}
best = list(
map(lambda x: (sum([(1) for i in s if i == x]), win[x]), win.keys())
)
... | CLASS_DEF FUNC_DEF FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR EXPR FUNC_CALL VAR VAR FUNC_DEF ASSIGN VAR DICT STRING STRING STRING STRING STRING STRING ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR NUMBER VAR VAR VAR VAR VAR VAR FUNC_CALL VAR EXPR FUNC_CALL VAR BIN_O... |
Recently, you found a bot to play "Rock paper scissors" with. Unfortunately, the bot uses quite a simple algorithm to play: he has a string $s = s_1 s_2 \dots s_{n}$ of length $n$ where each letter is either R, S or P.
While initializing, the bot is choosing a starting index $pos$ ($1 \le pos \le n$), and then it can ... | def solve():
s = input()
ans = ""
d = {}
for i in s:
d[i] = d.get(i, 0) + 1
maxfreq = max(d.values())
for i in d:
if d[i] == maxfreq:
ans = i
break
if ans == "S":
return "R" * len(s)
if ans == "R":
return "P" * len(s)
return "S"... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR ASSIGN VAR STRING ASSIGN VAR DICT FOR VAR VAR ASSIGN VAR VAR BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR VAR IF VAR VAR VAR ASSIGN VAR VAR IF VAR STRING RETURN BIN_OP STRING FUNC_CALL VAR VAR IF VAR STRING RETURN BIN_OP STRING FUNC_CALL VAR VAR... |
Recently, you found a bot to play "Rock paper scissors" with. Unfortunately, the bot uses quite a simple algorithm to play: he has a string $s = s_1 s_2 \dots s_{n}$ of length $n$ where each letter is either R, S or P.
While initializing, the bot is choosing a starting index $pos$ ($1 \le pos \le n$), and then it can ... | from sys import stdin
t = int(stdin.readline().strip())
for i in range(t):
S = list(stdin.readline().strip())
r = len([c for c in S if c == "R"])
s = len([c for c in S if c == "S"])
p = len([c for c in S if c == "P"])
if r == max(r, s, p):
print("P" * len(S))
elif s == max(r, s, p):
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR VAR VAR STRING ASSIGN VAR FUNC_CALL VAR VAR VAR VAR VAR STRING ASSIGN VAR FUNC_CALL VAR VAR VAR VAR VAR STRING IF VAR FUNC_CALL VAR VAR VAR VAR EXPR FUNC_CALL VAR ... |
Recently, you found a bot to play "Rock paper scissors" with. Unfortunately, the bot uses quite a simple algorithm to play: he has a string $s = s_1 s_2 \dots s_{n}$ of length $n$ where each letter is either R, S or P.
While initializing, the bot is choosing a starting index $pos$ ($1 \le pos \le n$), and then it can ... | t = int(input())
for _ in range(t):
s = input()
c = max("RSP", key=s.count)
response = {"R": "P", "P": "S", "S": "R"}[c]
print(len(s) * response) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR STRING VAR ASSIGN VAR DICT STRING STRING STRING STRING STRING STRING VAR EXPR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR VAR |
Recently, you found a bot to play "Rock paper scissors" with. Unfortunately, the bot uses quite a simple algorithm to play: he has a string $s = s_1 s_2 \dots s_{n}$ of length $n$ where each letter is either R, S or P.
While initializing, the bot is choosing a starting index $pos$ ($1 \le pos \le n$), and then it can ... | import sys
sys.setrecursionlimit(10**5)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II():
return int(sys.stdin.readline())
def MI():
return map(int, sys.stdin.readline().split())
def LI():
return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number):
return [... | IMPORT EXPR FUNC_CALL VAR BIN_OP NUMBER NUMBER ASSIGN VAR BIN_OP FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR STRING FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC... |
Recently, you found a bot to play "Rock paper scissors" with. Unfortunately, the bot uses quite a simple algorithm to play: he has a string $s = s_1 s_2 \dots s_{n}$ of length $n$ where each letter is either R, S or P.
While initializing, the bot is choosing a starting index $pos$ ($1 \le pos \le n$), and then it can ... | t = input()
t = int(t)
def max(a, b):
if a > b:
return a
return b
while t > 0:
t -= 1
s = input()
l = [0, 0, 0]
for i in range(0, len(s)):
if s[i] == "R":
l[0] += 1
elif s[i] == "P":
l[1] += 1
else:
l[2] += 1
max1 = max(... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_DEF IF VAR VAR RETURN VAR RETURN VAR WHILE VAR NUMBER VAR NUMBER ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR IF VAR VAR STRING VAR NUMBER NUMBER IF VAR VAR STRING VAR NUMBER NUMBER VAR NUMBER NUMB... |
Recently, you found a bot to play "Rock paper scissors" with. Unfortunately, the bot uses quite a simple algorithm to play: he has a string $s = s_1 s_2 \dots s_{n}$ of length $n$ where each letter is either R, S or P.
While initializing, the bot is choosing a starting index $pos$ ($1 \le pos \le n$), and then it can ... | T = int(input())
for case in range(T):
value = input()
count = [0, 0, 0]
for v in value:
if v == "R":
count[0] += 1
elif v == "S":
count[1] += 1
elif v == "P":
count[2] += 1
if count[0] >= count[1] and count[0] >= count[2]:
print("P" * ... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST NUMBER NUMBER NUMBER FOR VAR VAR IF VAR STRING VAR NUMBER NUMBER IF VAR STRING VAR NUMBER NUMBER IF VAR STRING VAR NUMBER NUMBER IF VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR BIN_OP STRING FUNC_... |
Recently, you found a bot to play "Rock paper scissors" with. Unfortunately, the bot uses quite a simple algorithm to play: he has a string $s = s_1 s_2 \dots s_{n}$ of length $n$ where each letter is either R, S or P.
While initializing, the bot is choosing a starting index $pos$ ($1 \le pos \le n$), and then it can ... | t = int(input())
ans = []
for _ in range(t):
s = input()
R = 0
S = 0
P = 0
l = len(s)
for i in range(len(s)):
if s[i] == "R":
R += 1
elif s[i] == "S":
S += 1
else:
P += 1
m = max(R, S, P)
if S == m:
res = "R" * l
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR STRING VAR NUMBER IF VAR VAR STRING VAR NUMBER VAR NUMBER ASSIGN VAR FUNC_CALL V... |
Recently, you found a bot to play "Rock paper scissors" with. Unfortunately, the bot uses quite a simple algorithm to play: he has a string $s = s_1 s_2 \dots s_{n}$ of length $n$ where each letter is either R, S or P.
While initializing, the bot is choosing a starting index $pos$ ($1 \le pos \le n$), and then it can ... | def tell(a, n):
c = [[0, "R"], [0, "P"], [0, "S"]]
for i in range(n):
if a[i] == "R":
c[1][0] += 1
elif a[i] == "P":
c[2][0] += 1
else:
c[0][0] += 1
c.sort()
return c[-1][1] * n
number_o_v = int(input())
for i in range(number_o_v):
a = st... | FUNC_DEF ASSIGN VAR LIST LIST NUMBER STRING LIST NUMBER STRING LIST NUMBER STRING FOR VAR FUNC_CALL VAR VAR IF VAR VAR STRING VAR NUMBER NUMBER NUMBER IF VAR VAR STRING VAR NUMBER NUMBER NUMBER VAR NUMBER NUMBER NUMBER EXPR FUNC_CALL VAR RETURN BIN_OP VAR NUMBER NUMBER VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR... |
Recently, you found a bot to play "Rock paper scissors" with. Unfortunately, the bot uses quite a simple algorithm to play: he has a string $s = s_1 s_2 \dots s_{n}$ of length $n$ where each letter is either R, S or P.
While initializing, the bot is choosing a starting index $pos$ ($1 \le pos \le n$), and then it can ... | t = int(input())
while t:
n = input()
a, b, c = n.count("R"), n.count("P"), n.count("S")
d = max(a, b, c)
if d == a:
for x in range(len(n)):
print("P", end="")
elif d == b:
for x in range(len(n)):
print("S", end="")
elif d == c:
for x in range(len(... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR STRING FUNC_CALL VAR STRING FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR VAR VAR IF VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR STRING STRING IF VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL ... |
Recently, you found a bot to play "Rock paper scissors" with. Unfortunately, the bot uses quite a simple algorithm to play: he has a string $s = s_1 s_2 \dots s_{n}$ of length $n$ where each letter is either R, S or P.
While initializing, the bot is choosing a starting index $pos$ ($1 \le pos \le n$), and then it can ... | TC = int(input())
for tc in range(TC):
S = input()
P = "RSP"
r = 0
s = 0
p = 0
for l in S:
if l == "R":
r += 1
elif l == "S":
s += 1
else:
p += 1
maxi = max(r, p, s)
if maxi == r:
result = "P" * len(S)
elif maxi == p... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR STRING ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR IF VAR STRING VAR NUMBER IF VAR STRING VAR NUMBER VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR VAR IF VAR VAR ASSIGN VAR BIN_OP STRING FUNC_CALL VA... |
Recently, you found a bot to play "Rock paper scissors" with. Unfortunately, the bot uses quite a simple algorithm to play: he has a string $s = s_1 s_2 \dots s_{n}$ of length $n$ where each letter is either R, S or P.
While initializing, the bot is choosing a starting index $pos$ ($1 \le pos \le n$), and then it can ... | t = int(input())
while t:
s = input()
answ = ""
count_r, count_s, count_p = 0, 0, 0
for i in s:
if i == "R":
count_r += 1
elif i == "P":
count_p += 1
elif i == "S":
count_s += 1
max_count = max(count_r, count_s, count_p)
if max_count ==... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR STRING ASSIGN VAR VAR VAR NUMBER NUMBER NUMBER FOR VAR VAR IF VAR STRING VAR NUMBER IF VAR STRING VAR NUMBER IF VAR STRING VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR VAR IF VAR VAR ASSIGN VAR BIN_OP STRING FUNC_CALL VAR VAR IF VAR VAR... |
Recently, you found a bot to play "Rock paper scissors" with. Unfortunately, the bot uses quite a simple algorithm to play: he has a string $s = s_1 s_2 \dots s_{n}$ of length $n$ where each letter is either R, S or P.
While initializing, the bot is choosing a starting index $pos$ ($1 \le pos \le n$), and then it can ... | T = int(input())
for t in range(T):
s = input()
RPS = [0, 0, 0]
for c in s:
if c == "R":
RPS[0] += 1
elif c == "P":
RPS[1] += 1
else:
RPS[2] += 1
max_i = RPS.index(max(RPS))
if max_i == 0:
print("".join(["P" for x in range(len(s))])... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST NUMBER NUMBER NUMBER FOR VAR VAR IF VAR STRING VAR NUMBER NUMBER IF VAR STRING VAR NUMBER NUMBER VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL STRING STRING... |
Recently, you found a bot to play "Rock paper scissors" with. Unfortunately, the bot uses quite a simple algorithm to play: he has a string $s = s_1 s_2 \dots s_{n}$ of length $n$ where each letter is either R, S or P.
While initializing, the bot is choosing a starting index $pos$ ($1 \le pos \le n$), and then it can ... | def process(s):
n = len(s)
beat = {"R": "P", "P": "S", "S": "R"}
mapp = {"R": 0, "S": 0, "P": 0}
for ele in set(s):
for char in s:
if ele == char:
mapp[ele] += 1
inv_map = {num: ch for ch, num in mapp.items()}
e = beat[inv_map[max(inv_map)]]
print(e * n)
... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR DICT STRING STRING STRING STRING STRING STRING ASSIGN VAR DICT STRING STRING STRING NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR FOR VAR VAR IF VAR VAR VAR VAR NUMBER ASSIGN VAR VAR VAR VAR VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR BIN_O... |
Recently, you found a bot to play "Rock paper scissors" with. Unfortunately, the bot uses quite a simple algorithm to play: he has a string $s = s_1 s_2 \dots s_{n}$ of length $n$ where each letter is either R, S or P.
While initializing, the bot is choosing a starting index $pos$ ($1 \le pos \le n$), and then it can ... | t = int(input())
for _ in range(t):
list1 = input().strip()
r = list1.count("R")
p = list1.count("P")
s = list1.count("S")
winner = max(r, p, s)
if winner == r:
choice = "P"
elif winner == p:
choice = "S"
else:
choice = "R"
for i in range(len(list1)):
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR VAR VAR IF VAR VAR ASSIGN VAR STRING IF VAR VAR ASSIGN VAR STRING ASSIGN VAR STRING FOR VAR FUN... |
Recently, you found a bot to play "Rock paper scissors" with. Unfortunately, the bot uses quite a simple algorithm to play: he has a string $s = s_1 s_2 \dots s_{n}$ of length $n$ where each letter is either R, S or P.
While initializing, the bot is choosing a starting index $pos$ ($1 \le pos \le n$), and then it can ... | for _ in range(int(input())):
s = input()
d = {"R": 0, "S": 1, "P": 2}
cnt = [0, 0, 0]
ctr = ["P", "R", "S"]
for i in s:
cnt[d[i]] += 1
print(ctr[cnt.index(max(cnt))] * len(s)) | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR DICT STRING STRING STRING NUMBER NUMBER NUMBER ASSIGN VAR LIST NUMBER NUMBER NUMBER ASSIGN VAR LIST STRING STRING STRING FOR VAR VAR VAR VAR VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR |
Recently, you found a bot to play "Rock paper scissors" with. Unfortunately, the bot uses quite a simple algorithm to play: he has a string $s = s_1 s_2 \dots s_{n}$ of length $n$ where each letter is either R, S or P.
While initializing, the bot is choosing a starting index $pos$ ($1 \le pos \le n$), and then it can ... | import sys
input = lambda: sys.stdin.readline().rstrip()
for _ in range(int(input())):
s = input()
n = len(s)
r, s, p = s.count("R"), s.count("S"), s.count("P")
mx = max(r, s, p)
if mx == r:
print("P" * n)
elif mx == s:
print("R" * n)
else:
print("S" * n) | IMPORT ASSIGN VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR STRING FUNC_CALL VAR STRING FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR VAR VAR IF VAR VAR EXPR FUNC_CALL VAR BIN_OP STRING VAR IF VAR ... |
Recently, you found a bot to play "Rock paper scissors" with. Unfortunately, the bot uses quite a simple algorithm to play: he has a string $s = s_1 s_2 \dots s_{n}$ of length $n$ where each letter is either R, S or P.
While initializing, the bot is choosing a starting index $pos$ ($1 \le pos \le n$), and then it can ... | for _ in range(int(input())):
c = input()
p, r, s = 0, 0, 0
for i in range(len(c)):
if c[i] == "R":
r += 1
elif c[i] == "S":
s += 1
else:
p += 1
x = max({p, r, s})
if x == p:
for i in range(len(c)):
print("S", end="")
... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR VAR NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR STRING VAR NUMBER IF VAR VAR STRING VAR NUMBER VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR VAR IF VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUN... |
Recently, you found a bot to play "Rock paper scissors" with. Unfortunately, the bot uses quite a simple algorithm to play: he has a string $s = s_1 s_2 \dots s_{n}$ of length $n$ where each letter is either R, S or P.
While initializing, the bot is choosing a starting index $pos$ ($1 \le pos \le n$), and then it can ... | from sys import stdin, stdout
for _ in range(int(stdin.readline())):
s = stdin.readline().strip()
d = {"R": "P", "P": "S", "S": "R"}
dct = {"R": 0, "P": 0, "S": 0}
for i in s:
dct[d[i]] += 1
x = max(dct, key=dct.get)
stdout.write("".join([x] * len(s)))
stdout.write("\n") | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR DICT STRING STRING STRING STRING STRING STRING ASSIGN VAR DICT STRING STRING STRING NUMBER NUMBER NUMBER FOR VAR VAR VAR VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR FUNC_CALL STRING BIN_OP LIST VAR FUN... |
Recently, you found a bot to play "Rock paper scissors" with. Unfortunately, the bot uses quite a simple algorithm to play: he has a string $s = s_1 s_2 \dots s_{n}$ of length $n$ where each letter is either R, S or P.
While initializing, the bot is choosing a starting index $pos$ ($1 \le pos \le n$), and then it can ... | n = int(input())
for _ in range(n):
string = input()
R = [string.count("R"), "P"]
S = [string.count("S"), "R"]
P = [string.count("P"), "S"]
ans = max([P, S, R])[1] * len(string)
print(ans) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST FUNC_CALL VAR STRING STRING ASSIGN VAR LIST FUNC_CALL VAR STRING STRING ASSIGN VAR LIST FUNC_CALL VAR STRING STRING ASSIGN VAR BIN_OP FUNC_CALL VAR LIST VAR VAR VAR NUMBER FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR |
Recently, you found a bot to play "Rock paper scissors" with. Unfortunately, the bot uses quite a simple algorithm to play: he has a string $s = s_1 s_2 \dots s_{n}$ of length $n$ where each letter is either R, S or P.
While initializing, the bot is choosing a starting index $pos$ ($1 \le pos \le n$), and then it can ... | for _ in range(int(input())):
s = input()
n = len(s)
d = {}
p = ""
d["R"] = 0
d["P"] = 0
d["S"] = 0
for i in range(0, n):
if s[i] == "R":
if d.get("R") == None:
d["R"] = 1
else:
d["R"] += 1
elif s[i] == "P":
... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR DICT ASSIGN VAR STRING ASSIGN VAR STRING NUMBER ASSIGN VAR STRING NUMBER ASSIGN VAR STRING NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR VAR STRING IF FUNC_CALL VAR STRING NONE ASSIGN VAR STRING NUMBER VA... |
Recently, you found a bot to play "Rock paper scissors" with. Unfortunately, the bot uses quite a simple algorithm to play: he has a string $s = s_1 s_2 \dots s_{n}$ of length $n$ where each letter is either R, S or P.
While initializing, the bot is choosing a starting index $pos$ ($1 \le pos \le n$), and then it can ... | for _ in range(int(input())):
st = input()
res = ""
r = st.count("R")
s = st.count("S")
p = st.count("P")
m = max(r, p, s)
if m == r:
for _ in range(len(st)):
res += "P"
elif m == s:
for _ in range(len(st)):
res += "R"
else:
for _ in ra... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR STRING ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR VAR VAR IF VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR STRING IF VAR VAR FOR VAR FUNC_CALL VAR... |
Recently, you found a bot to play "Rock paper scissors" with. Unfortunately, the bot uses quite a simple algorithm to play: he has a string $s = s_1 s_2 \dots s_{n}$ of length $n$ where each letter is either R, S or P.
While initializing, the bot is choosing a starting index $pos$ ($1 \le pos \le n$), and then it can ... | t = int(input())
for _ in range(t):
rock, paper, scissors = 0, 0, 0
line = input()
for i in line:
if i == "R":
rock += 1
elif i == "P":
paper += 1
else:
scissors += 1
n = len(line)
if rock >= paper and rock >= scissors:
print(n * "P... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR NUMBER NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR FOR VAR VAR IF VAR STRING VAR NUMBER IF VAR STRING VAR NUMBER VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR STRING IF VAR VAR VAR VAR EXPR FUNC_CAL... |
Recently, you found a bot to play "Rock paper scissors" with. Unfortunately, the bot uses quite a simple algorithm to play: he has a string $s = s_1 s_2 \dots s_{n}$ of length $n$ where each letter is either R, S or P.
While initializing, the bot is choosing a starting index $pos$ ($1 \le pos \le n$), and then it can ... | n = int(input())
while n > 0:
n -= 1
s = input()
l = len(s)
r = sc = p = 0
r = s.count("R")
sc = s.count("S")
p = s.count("P")
if r >= sc and r >= p:
print("P" * l)
elif p >= sc and p >= r:
print("S" * l)
else:
print("R" * l) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR NUMBER VAR NUMBER ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR STRING IF VAR VAR VAR VAR EXPR FUNC_CALL VAR BIN_OP STRING VAR IF VAR VAR VAR VAR EX... |
Recently, you found a bot to play "Rock paper scissors" with. Unfortunately, the bot uses quite a simple algorithm to play: he has a string $s = s_1 s_2 \dots s_{n}$ of length $n$ where each letter is either R, S or P.
While initializing, the bot is choosing a starting index $pos$ ($1 \le pos \le n$), and then it can ... | class Main:
def main(self):
t = int(input())
for t1 in range(0, t):
s = input()
c1 = s.count("R")
c2 = s.count("S")
c3 = s.count("P")
if max(c1, c2, c3) == c1:
print("P" * len(s))
elif max(c1, c2, c3) == c2:
... | CLASS_DEF FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR STRING IF FUNC_CALL VAR VAR VAR VAR VAR EXPR FUNC_CALL VAR BIN_OP STRING FUNC_CALL VAR VAR IF FUNC_CALL VAR VAR VAR... |
Recently, you found a bot to play "Rock paper scissors" with. Unfortunately, the bot uses quite a simple algorithm to play: he has a string $s = s_1 s_2 \dots s_{n}$ of length $n$ where each letter is either R, S or P.
While initializing, the bot is choosing a starting index $pos$ ($1 \le pos \le n$), and then it can ... | from sys import stdin
T = int(stdin.readline().strip())
mp = dict()
mp["R"] = "P"
mp["S"] = "R"
mp["P"] = "S"
for caso in range(T):
s = stdin.readline().strip()
ans = ""
r = s.count("R")
s1 = s.count("S")
p = s.count("P")
n = len(s)
if r >= s1 and r >= p:
print("P" * n)
elif s1 ... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR STRING STRING ASSIGN VAR STRING STRING ASSIGN VAR STRING STRING FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR STRING ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR STR... |
Recently, you found a bot to play "Rock paper scissors" with. Unfortunately, the bot uses quite a simple algorithm to play: he has a string $s = s_1 s_2 \dots s_{n}$ of length $n$ where each letter is either R, S or P.
While initializing, the bot is choosing a starting index $pos$ ($1 \le pos \le n$), and then it can ... | def win(s):
l = len(s)
r = s.count("R")
S = s.count("S")
p = s.count("P")
m = max(r, S, p)
if r == m:
return "P" * l
if S == m:
return "R" * l
else:
return "S" * l
t = int(input())
for _ in range(t):
s = input()
print(win(s)) | FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR VAR VAR IF VAR VAR RETURN BIN_OP STRING VAR IF VAR VAR RETURN BIN_OP STRING VAR RETURN BIN_OP STRING VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_... |
Recently, you found a bot to play "Rock paper scissors" with. Unfortunately, the bot uses quite a simple algorithm to play: he has a string $s = s_1 s_2 \dots s_{n}$ of length $n$ where each letter is either R, S or P.
While initializing, the bot is choosing a starting index $pos$ ($1 \le pos \le n$), and then it can ... | for _ in range(int(input())):
t = input()
r, s, p = t.count("R"), t.count("S"), t.count("P")
b = max(r, s, p)
a = "P" if r == b else "R" if s == b else "S"
print(a * len(t)) | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR STRING FUNC_CALL VAR STRING FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR VAR VAR ASSIGN VAR VAR VAR STRING VAR VAR STRING STRING EXPR FUNC_CALL VAR BIN_OP VAR FUNC_CALL VAR VAR |
Recently, you found a bot to play "Rock paper scissors" with. Unfortunately, the bot uses quite a simple algorithm to play: he has a string $s = s_1 s_2 \dots s_{n}$ of length $n$ where each letter is either R, S or P.
While initializing, the bot is choosing a starting index $pos$ ($1 \le pos \le n$), and then it can ... | import sys
input = sys.stdin.readline
def ceil(x):
if x != int(x):
x = int(x) + 1
return x
def swaparr(arr, a, b):
temp = arr[a]
arr[a] = arr[b]
arr[b] = temp
def gcd(a, b):
if b == 0:
return a
return gcd(b, a % b)
def nCr(n, k):
if k > n - k:
k = n - k
... | IMPORT ASSIGN VAR VAR FUNC_DEF IF VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP FUNC_CALL VAR VAR NUMBER RETURN 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 VAR BIN_OP VAR VAR FUNC_DEF IF VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VA... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.