original_code
stringlengths
78
14.8k
modified_code
stringlengths
77
14.8k
changed_line
stringlengths
1
14.4k
number_of_line
int64
1
58
mutation_type
stringclasses
4 values
import re *middle, k = map(int, input().split()) s = input() t = input() def _search(_t, _s): m = re.search(_t, _s) try: return m.span() except: return -1 def Puts(s, k): i = len(s) - 2 * k j = 0 indexes = set() while i > j: s1 = s[0:k] s2 = s[k+1+j:2*k+1+j] _str = "".join([s1, s2]) if _search(t, _str) != -1: indexes = _search(t, _str) j+=1 if len(indexes) == 0: i = len(s) - 2 * k j = 0 while i > j: s1 = s[j:k+j] s2 = s[k+1+j:2*k+1+j] _str = "".join([s1, s2]) if _search(t, _str) != -1: indexes = _search(t, _str) j+=1 return indexes else: return indexes arr = Puts(s, k) if len(arr) == 0: print("No") else: print("Yes") print(arr[0], arr[1])
import re *middle, k = map(int, input().split()) s = input() t = input() def _search(_t, _s): m = re.search(_t, _s) try: return m.span() except: return -1 def Puts(s, k): i = len(s) - 2 * k j = 0 indexes = set() while i > j: s1 = s[0:k] s2 = s[k+1+j:2*k+1+j] _str = "".join([s1, s2]) if _search(t, _str) != -1: indexes = _search(t, _str) j+=1 if len(indexes)<0: i = len(s) - 2 * k j = 0 while i > j: s1 = s[j:k+j] s2 = s[k+1+j:2*k+1+j] _str = "".join([s1, s2]) if _search(t, _str) != -1: indexes = _search(t, _str) j+=1 return indexes else: return indexes arr = Puts(s, k) if len(arr) == 0: print("No") else: print("Yes") print(arr[0], arr[1])
if len(indexes)<0:
25
decision
n, m = map(int, input().split()) while (n >= 0 and m >= 0): if n==0 or m==0: break elif n>=2*m: n = n - 2* m elif m>=2*n: m = m -2* n else: break print(n, m)
n, m = map(int, input().split()) while (n >= 0 and m<=0): if n==0 or m==0: break elif n>=2*m: n = n - 2* m elif m>=2*n: m = m -2* n else: break print(n, m)
while (n >= 0 and m<=0):
2
decision
n, m = map(int, input().split()) while (n >= 0 and m >= 0): if n==0 or m==0: break elif n>=2*m: n = n - 2* m elif m>=2*n: m = m -2* n else: break print(n, m)
n, m = map(int, input().split()) while (n >= 0 and m >= 0): if n==0 or m==0: break elif n>=2&m: n = n - 2* m elif m>=2*n: m = m -2* n else: break print(n, m)
elif n>=2&m:
5
operation
n, m = map(int, input().split()) while (n >= 0 and m >= 0): if n==0 or m==0: break elif n>=2*m: n = n - 2* m elif m>=2*n: m = m -2* n else: break print(n, m)
n, m = map(int, input().split()) while (n >= 0 and m >= 0): if n==0 or m==0: break elif n>=2*m: n = n - 2* m elif m>=2*n: m = m^2* n else: break print(n, m)
m = m^2* n
8
operation
n, m = map(int, input().split()) while (n >= 0 and m >= 0): if n==0 or m==0: break elif n>=2*m: n = n - 2* m elif m>=2*n: m = m -2* n else: break print(n, m)
n, m = map(int, input().split()) while (n >= 0 and m >= 0): if n==0 or m==0: break elif n>=2*m: n = n - 2* m elif m>=2<<n: m = m -2* n else: break print(n, m)
elif m>=2<<n:
7
operation
n, m = map(int, input().split()) while (n >= 0 and m >= 0): if n==0 or m==0: break elif n>=2*m: n = n - 2* m elif m>=2*n: m = m -2* n else: break print(n, m)
n, m = map(int, input().split()) while (n >= 0 and m >= 0): if n==0 or m==0: break elif n<=2*m: n = n - 2* m elif m>=2*n: m = m -2* n else: break print(n, m)
elif n<=2*m:
5
decision
from collections import deque n = int(input()) parents = [0, 0] + [int(x) for x in input().split()] children = [set([]) for _ in range(n + 1)] for i, p in enumerate(parents): children[p].add(i) q = deque([(0, 1)]) levels = [0 for _ in range(n + 1)] maxLevel = 0 while len(q) > 0: level, node = q.popleft() levels[node] = level maxLevel = max(maxLevel, level) for i in children[node]: q.append((level + 1, i)) levels2 = [0 for _ in range(maxLevel + 1)] for i in levels[1:]: levels2[i] += 1 print(sum([i % 2 for i in levels2]))
from collections import deque n = int(input()) parents = [0, 0] + [int(x) for x in input().split()] children = [set([]) for _ in range(n/1)] for i, p in enumerate(parents): children[p].add(i) q = deque([(0, 1)]) levels = [0 for _ in range(n + 1)] maxLevel = 0 while len(q) > 0: level, node = q.popleft() levels[node] = level maxLevel = max(maxLevel, level) for i in children[node]: q.append((level + 1, i)) levels2 = [0 for _ in range(maxLevel + 1)] for i in levels[1:]: levels2[i] += 1 print(sum([i % 2 for i in levels2]))
children = [set([]) for _ in range(n/1)]
5
operation
from collections import deque n = int(input()) parents = [0, 0] + [int(x) for x in input().split()] children = [set([]) for _ in range(n + 1)] for i, p in enumerate(parents): children[p].add(i) q = deque([(0, 1)]) levels = [0 for _ in range(n + 1)] maxLevel = 0 while len(q) > 0: level, node = q.popleft() levels[node] = level maxLevel = max(maxLevel, level) for i in children[node]: q.append((level + 1, i)) levels2 = [0 for _ in range(maxLevel + 1)] for i in levels[1:]: levels2[i] += 1 print(sum([i % 2 for i in levels2]))
from collections import deque n = int(input()) parents = [0, 0] + [int(x) for x in input().split()] children = [set([]) for _ in range(n + 1)] for i, p in enumerate(parents): children[p].add(i) q = deque([(0, 1)]) levels = [0 for _ in range(n + 1)] maxLevel = 0 while len(q) > 0: level, node = q.popleft() levels[node] = level maxLevel = max(maxLevel, level) for i in children[node]: q.append((level%1, i)) levels2 = [0 for _ in range(maxLevel + 1)] for i in levels[1:]: levels2[i] += 1 print(sum([i % 2 for i in levels2]))
q.append((level%1, i))
17
operation
from collections import deque n = int(input()) parents = [0, 0] + [int(x) for x in input().split()] children = [set([]) for _ in range(n + 1)] for i, p in enumerate(parents): children[p].add(i) q = deque([(0, 1)]) levels = [0 for _ in range(n + 1)] maxLevel = 0 while len(q) > 0: level, node = q.popleft() levels[node] = level maxLevel = max(maxLevel, level) for i in children[node]: q.append((level + 1, i)) levels2 = [0 for _ in range(maxLevel + 1)] for i in levels[1:]: levels2[i] += 1 print(sum([i % 2 for i in levels2]))
from collections import deque n = int(input()) parents = [0, 0] + [int(x) for x in input().split()] children = [set([]) for _ in range(n + 1)] for i, p in enumerate(parents): children[p].add(i) q = deque([(0, 1)]) levels = [0 for _ in range(n + 1)] maxLevel = 0 while len(q)==0: level, node = q.popleft() levels[node] = level maxLevel = max(maxLevel, level) for i in children[node]: q.append((level + 1, i)) levels2 = [0 for _ in range(maxLevel + 1)] for i in levels[1:]: levels2[i] += 1 print(sum([i % 2 for i in levels2]))
while len(q)==0:
12
decision
from collections import deque n = int(input()) parents = [0, 0] + [int(x) for x in input().split()] children = [set([]) for _ in range(n + 1)] for i, p in enumerate(parents): children[p].add(i) q = deque([(0, 1)]) levels = [0 for _ in range(n + 1)] maxLevel = 0 while len(q) > 0: level, node = q.popleft() levels[node] = level maxLevel = max(maxLevel, level) for i in children[node]: q.append((level + 1, i)) levels2 = [0 for _ in range(maxLevel + 1)] for i in levels[1:]: levels2[i] += 1 print(sum([i % 2 for i in levels2]))
from collections import deque n = int(input()) parents = [0, 0] + [int(x) for x in input().split()] children = [set([]) for _ in range(n + 1)] for i, p in enumerate(parents): children[p].add(i) q = deque([(0, 1)]) levels = [0 for _ in range(n + 1)] maxLevel = 0 while len(q) > 0: level, node = q.popleft() levels[node] = level maxLevel = max(maxLevel, level) for i in children[node]: q.append((level + 1, i)) levels2 = [0 for _ in range(maxLevel|1)] for i in levels[1:]: levels2[i] += 1 print(sum([i % 2 for i in levels2]))
levels2 = [0 for _ in range(maxLevel|1)]
19
operation
from collections import deque n = int(input()) parents = [0, 0] + [int(x) for x in input().split()] children = [set([]) for _ in range(n + 1)] for i, p in enumerate(parents): children[p].add(i) q = deque([(0, 1)]) levels = [0 for _ in range(n + 1)] maxLevel = 0 while len(q) > 0: level, node = q.popleft() levels[node] = level maxLevel = max(maxLevel, level) for i in children[node]: q.append((level + 1, i)) levels2 = [0 for _ in range(maxLevel + 1)] for i in levels[1:]: levels2[i] += 1 print(sum([i % 2 for i in levels2]))
from collections import deque n = int(input()) parents = [0, 0] + [int(x) for x in input().split()] children = [set([]) for _ in range(n + 1)] for i, p in enumerate(parents): children[p].add(i) q = deque([(0, 1)]) levels = [0 for _ in range(n + 1)] maxLevel = 0 while len(q) > 0: level, node = q.popleft() levels[node] = level maxLevel = max(maxLevel, level) for i in children[node]: q.append((level + 1, i)) levels2 = [0 for _ in range(maxLevel+1)] for i in levels[1:]: levels2[i] += 1 print(sum([i % 2 for i in levels2]))
levels2 = [0 for _ in range(maxLevel+1)]
19
operation
__author__ = 'pxy' n=int(input()) g=[int(j) for j in input().split()] b=0 t=0 for z in g: if z==1: if b>=2 and t>0: t+=1-b else: t+=1 b=0 else: b+=1 if t>0: t+=1 if t==0: print(0) else: print(t-b)
__author__ = 'pxy' n=int(input()) g=[int(j) for j in input().split()] b=0 t=0 for z in g: if z==1: if b>=2 and t>0: t+=1-b else: t+=1 b=0 else: b+=1 if t>0: t+=1 if t==0: print(0) else: print(t%b)
print(t%b)
21
operation
__author__ = 'pxy' n=int(input()) g=[int(j) for j in input().split()] b=0 t=0 for z in g: if z==1: if b>=2 and t>0: t+=1-b else: t+=1 b=0 else: b+=1 if t>0: t+=1 if t==0: print(0) else: print(t-b)
__author__ = 'pxy' n=int(input()) g=[int(j) for j in input().split()] b=0 t=0 for z in g: if z==1: if b>=2 and t==0: t+=1-b else: t+=1 b=0 else: b+=1 if t>0: t+=1 if t==0: print(0) else: print(t-b)
if b>=2 and t==0:
8
decision
__author__ = 'pxy' n=int(input()) g=[int(j) for j in input().split()] b=0 t=0 for z in g: if z==1: if b>=2 and t>0: t+=1-b else: t+=1 b=0 else: b+=1 if t>0: t+=1 if t==0: print(0) else: print(t-b)
__author__ = 'pxy' n=int(input()) g=[int(j) for j in input().split()] b=0 t=0 for z in g: if z==1: if b>=2 and t>0: t+=1|b else: t+=1 b=0 else: b+=1 if t>0: t+=1 if t==0: print(0) else: print(t-b)
t+=1|b
9
operation
n, m = [int(i) for i in input().split()] x, y, z = [int(i) for i in input().split()] rn = 2 * x + y rm = 3 * z + y ans = 0 if rn > n : ans += rn - n if rm > m : ans += rm - m print(ans)
n, m = [int(i) for i in input().split()] x, y, z = [int(i) for i in input().split()] rn = 2 * x + y rm = 3 * z + y ans = 0 if rn==n : ans += rn - n if rm > m : ans += rm - m print(ans)
if rn==n :
6
decision
n, m = [int(i) for i in input().split()] x, y, z = [int(i) for i in input().split()] rn = 2 * x + y rm = 3 * z + y ans = 0 if rn > n : ans += rn - n if rm > m : ans += rm - m print(ans)
n, m = [int(i) for i in input().split()] x, y, z = [int(i) for i in input().split()] rn = 2 * x + y rm = 3-z + y ans = 0 if rn > n : ans += rn - n if rm > m : ans += rm - m print(ans)
rm = 3-z + y
4
operation
n, m = [int(i) for i in input().split()] x, y, z = [int(i) for i in input().split()] rn = 2 * x + y rm = 3 * z + y ans = 0 if rn > n : ans += rn - n if rm > m : ans += rm - m print(ans)
n, m = [int(i) for i in input().split()] x, y, z = [int(i) for i in input().split()] rn = 2 * x*y rm = 3 * z + y ans = 0 if rn > n : ans += rn - n if rm > m : ans += rm - m print(ans)
rn = 2 * x*y
3
operation
n, m = [int(i) for i in input().split()] x, y, z = [int(i) for i in input().split()] rn = 2 * x + y rm = 3 * z + y ans = 0 if rn > n : ans += rn - n if rm > m : ans += rm - m print(ans)
n, m = [int(i) for i in input().split()] x, y, z = [int(i) for i in input().split()] rn = 2 * x + y rm = 3|z + y ans = 0 if rn > n : ans += rn - n if rm > m : ans += rm - m print(ans)
rm = 3|z + y
4
operation
n, m = [int(i) for i in input().split()] x, y, z = [int(i) for i in input().split()] rn = 2 * x + y rm = 3 * z + y ans = 0 if rn > n : ans += rn - n if rm > m : ans += rm - m print(ans)
n, m = [int(i) for i in input().split()] x, y, z = [int(i) for i in input().split()] rn = 2 * x + y rm = 3 * z + y ans = 0 if rn > n : ans += rn - n if rm==m : ans += rm - m print(ans)
if rm==m :
8
decision
n, pos, l, r = map(int, input().split()) if (pos < l): print(l-pos+1) elif (pos > r): print(pos-r+1) elif (l == 1 and r == n): print(0) elif (l == 1): print(r-pos+1) elif (r == n): print(pos-l+1) else: a = pos-l+1+r-l+1 b = r-pos+1+r+l+1 if (a < b): print(a) else: print(b)
n, pos, l, r = map(int, input().split()) if (pos < l): print(l-pos+1) elif (pos > r): print(pos-r+1) elif (l == 1 and r == n): print(46) elif (l == 1): print(r-pos+1) elif (r == n): print(pos-l+1) else: a = pos-l+1+r-l+1 b = r-pos+1+r+l+1 if (a < b): print(a) else: print(b)
print(46)
10
value
n, pos, l, r = map(int, input().split()) if (pos < l): print(l-pos+1) elif (pos > r): print(pos-r+1) elif (l == 1 and r == n): print(0) elif (l == 1): print(r-pos+1) elif (r == n): print(pos-l+1) else: a = pos-l+1+r-l+1 b = r-pos+1+r+l+1 if (a < b): print(a) else: print(b)
n, pos, l, r = map(int, input().split()) if (pos < l): print(l-pos**1) elif (pos > r): print(pos-r+1) elif (l == 1 and r == n): print(0) elif (l == 1): print(r-pos+1) elif (r == n): print(pos-l+1) else: a = pos-l+1+r-l+1 b = r-pos+1+r+l+1 if (a < b): print(a) else: print(b)
print(l-pos**1)
4
operation
n, pos, l, r = map(int, input().split()) if (pos < l): print(l-pos+1) elif (pos > r): print(pos-r+1) elif (l == 1 and r == n): print(0) elif (l == 1): print(r-pos+1) elif (r == n): print(pos-l+1) else: a = pos-l+1+r-l+1 b = r-pos+1+r+l+1 if (a < b): print(a) else: print(b)
n, pos, l, r = map(int, input().split()) if (pos < l): print(l-pos+1) elif (pos > r): print(pos-r+1) elif (l == 1 and r == n): x(0) elif (l == 1): print(r-pos+1) elif (r == n): print(pos-l+1) else: a = pos-l+1+r-l+1 b = r-pos+1+r+l+1 if (a < b): print(a) else: print(b)
x(0)
10
statement
n, pos, l, r = map(int, input().split()) if (pos < l): print(l-pos+1) elif (pos > r): print(pos-r+1) elif (l == 1 and r == n): print(0) elif (l == 1): print(r-pos+1) elif (r == n): print(pos-l+1) else: a = pos-l+1+r-l+1 b = r-pos+1+r+l+1 if (a < b): print(a) else: print(b)
n, pos, l, r = map(int, input().split()) if (pos < l): print(l-pos+1) elif (pos > r): print(pos-r+1) elif (l == 1 and r == n): print(0) elif (l == 1): print(r-pos+1) elif (r == n): print(pos-l<<1) else: a = pos-l+1+r-l+1 b = r-pos+1+r+l+1 if (a < b): print(a) else: print(b)
print(pos-l<<1)
16
operation
n, pos, l, r = map(int, input().split()) if (pos < l): print(l-pos+1) elif (pos > r): print(pos-r+1) elif (l == 1 and r == n): print(0) elif (l == 1): print(r-pos+1) elif (r == n): print(pos-l+1) else: a = pos-l+1+r-l+1 b = r-pos+1+r+l+1 if (a < b): print(a) else: print(b)
n, pos, l, r = map(int, input().split()) if (pos < l): print(l-pos+1) elif (pos > r): print(pos+r+1) elif (l == 1 and r == n): print(0) elif (l == 1): print(r-pos+1) elif (r == n): print(pos-l+1) else: a = pos-l+1+r-l+1 b = r-pos+1+r+l+1 if (a < b): print(a) else: print(b)
print(pos+r+1)
7
operation
def f(n): s = str(n) res = 1 for i in range(len(s)): if s[i] != '0': res *= int(s[i]) return res def g(n): if n < 10: return n return g(f(n)) def create(num, k): for i in range(1, 10 ** 4): if g(i) == k: num.append(i) def binleft(num, n): l = -1 r = len(num) while r - l > 1: mid = (l + r) // 2 if num[mid] <= n: l = mid else: r = mid return l def binright(num, n): l = -1 r = len(num) while r - l > 1: mid = (l + r) // 2 if num[mid] >= n: r = mid else: l = mid return r num = [[] for i in range(9)] for i in range(1, 10): create(num[i - 1], i) n = int(input()) for i in range(n): l, r, k = map(int, input().split()) x = binright(num[k - 1], r) y = binleft(num[k - 1], l) if num[k - 1][x] == r and num[k - 1][y] == l: print(x - y + 1) elif num[k - 1][x] == r and num[k - 1][y] != l or num[k - 1][x] != r and num[k - 1][y] == l: print(x - y) else: print(x - y - 1)
def f(n): s = str(n) res = 1 for i in range(len(s)): if s[i] != '0': res *= int(s[i]) return res def g(n): if n < 10: return n return g(f(n)) def create(num, k): for i in range(1, 10 ** 4): if g(i) == k: num.append(i) def binleft(num, n): l = -1 r = len(num) while r - l==1: mid = (l + r) // 2 if num[mid] <= n: l = mid else: r = mid return l def binright(num, n): l = -1 r = len(num) while r - l > 1: mid = (l + r) // 2 if num[mid] >= n: r = mid else: l = mid return r num = [[] for i in range(9)] for i in range(1, 10): create(num[i - 1], i) n = int(input()) for i in range(n): l, r, k = map(int, input().split()) x = binright(num[k - 1], r) y = binleft(num[k - 1], l) if num[k - 1][x] == r and num[k - 1][y] == l: print(x - y + 1) elif num[k - 1][x] == r and num[k - 1][y] != l or num[k - 1][x] != r and num[k - 1][y] == l: print(x - y) else: print(x - y - 1)
while r - l==1:
25
decision
def f(n): s = str(n) res = 1 for i in range(len(s)): if s[i] != '0': res *= int(s[i]) return res def g(n): if n < 10: return n return g(f(n)) def create(num, k): for i in range(1, 10 ** 4): if g(i) == k: num.append(i) def binleft(num, n): l = -1 r = len(num) while r - l > 1: mid = (l + r) // 2 if num[mid] <= n: l = mid else: r = mid return l def binright(num, n): l = -1 r = len(num) while r - l > 1: mid = (l + r) // 2 if num[mid] >= n: r = mid else: l = mid return r num = [[] for i in range(9)] for i in range(1, 10): create(num[i - 1], i) n = int(input()) for i in range(n): l, r, k = map(int, input().split()) x = binright(num[k - 1], r) y = binleft(num[k - 1], l) if num[k - 1][x] == r and num[k - 1][y] == l: print(x - y + 1) elif num[k - 1][x] == r and num[k - 1][y] != l or num[k - 1][x] != r and num[k - 1][y] == l: print(x - y) else: print(x - y - 1)
def f(n): s = str(n) res = 1 for i in range(len(s)): if s[i] != '0': res *= int(s[i]) return res def g(n): if n < 10: return n return g(f(n)) def create(num, k): for i in range(1, 10 ** 4): if g(i) == k: num.append(i) def binleft(num, n): l = -1 r = len(num) while r - l > 1: mid = (l//r) // 2 if num[mid] <= n: l = mid else: r = mid return l def binright(num, n): l = -1 r = len(num) while r - l > 1: mid = (l + r) // 2 if num[mid] >= n: r = mid else: l = mid return r num = [[] for i in range(9)] for i in range(1, 10): create(num[i - 1], i) n = int(input()) for i in range(n): l, r, k = map(int, input().split()) x = binright(num[k - 1], r) y = binleft(num[k - 1], l) if num[k - 1][x] == r and num[k - 1][y] == l: print(x - y + 1) elif num[k - 1][x] == r and num[k - 1][y] != l or num[k - 1][x] != r and num[k - 1][y] == l: print(x - y) else: print(x - y - 1)
mid = (l//r) // 2
26
operation
def f(n): s = str(n) res = 1 for i in range(len(s)): if s[i] != '0': res *= int(s[i]) return res def g(n): if n < 10: return n return g(f(n)) def create(num, k): for i in range(1, 10 ** 4): if g(i) == k: num.append(i) def binleft(num, n): l = -1 r = len(num) while r - l > 1: mid = (l + r) // 2 if num[mid] <= n: l = mid else: r = mid return l def binright(num, n): l = -1 r = len(num) while r - l > 1: mid = (l + r) // 2 if num[mid] >= n: r = mid else: l = mid return r num = [[] for i in range(9)] for i in range(1, 10): create(num[i - 1], i) n = int(input()) for i in range(n): l, r, k = map(int, input().split()) x = binright(num[k - 1], r) y = binleft(num[k - 1], l) if num[k - 1][x] == r and num[k - 1][y] == l: print(x - y + 1) elif num[k - 1][x] == r and num[k - 1][y] != l or num[k - 1][x] != r and num[k - 1][y] == l: print(x - y) else: print(x - y - 1)
def f(n): s = str(n) res = 1 for i in range(len(s)): if s[i] != '0': res *= int(s[i]) return res def g(n): if n < 10: return n return g(f(n)) def create(num, k): for i in range(1, 10 ** 4): if g(i) == k: num.append(i) def binleft(num, n): l = -1 r = len(num) while r - l > 1: mid = (l + r) // 2 if num[mid] <= n: l = mid else: r = mid return l def binright(num, n): l = -1 r = len(num) while r - l > 1: mid = (l + r) // 2 if num[mid] >= n: r = mid else: l = mid return r num = [[] for i in range(9)] for i in range(1, 10): create(num[i - 1], i) n = int(input()) for i in range(n): l, r, k = map(int, input().split()) x = binright(num[k - 1], r) y = binleft(num[k - 1], l) if num[k - 1][x] == r and num[k - 1][y]<l: print(x - y + 1) elif num[k - 1][x] == r and num[k - 1][y] != l or num[k - 1][x] != r and num[k - 1][y] == l: print(x - y) else: print(x - y - 1)
if num[k - 1][x] == r and num[k - 1][y]<l:
54
decision
def f(n): s = str(n) res = 1 for i in range(len(s)): if s[i] != '0': res *= int(s[i]) return res def g(n): if n < 10: return n return g(f(n)) def create(num, k): for i in range(1, 10 ** 4): if g(i) == k: num.append(i) def binleft(num, n): l = -1 r = len(num) while r - l > 1: mid = (l + r) // 2 if num[mid] <= n: l = mid else: r = mid return l def binright(num, n): l = -1 r = len(num) while r - l > 1: mid = (l + r) // 2 if num[mid] >= n: r = mid else: l = mid return r num = [[] for i in range(9)] for i in range(1, 10): create(num[i - 1], i) n = int(input()) for i in range(n): l, r, k = map(int, input().split()) x = binright(num[k - 1], r) y = binleft(num[k - 1], l) if num[k - 1][x] == r and num[k - 1][y] == l: print(x - y + 1) elif num[k - 1][x] == r and num[k - 1][y] != l or num[k - 1][x] != r and num[k - 1][y] == l: print(x - y) else: print(x - y - 1)
def f(n): s = str(n) res = 1 for i in range(len(s)): if s[i] != '0': res *= int(s[i]) return res def g(n): if n < 10: return n return g(f(n)) def create(num, k): for i in range(1, 10 ** 4): if g(i) == k: num.append(i) def binleft(num, n): l = -1 r = len(num) while r - l > 1: mid = (l + r) // 2 if num[mid] <= n: l = mid else: r = mid return l def binright(num, n): l = -1 r = len(num) while r/l > 1: mid = (l + r) // 2 if num[mid] >= n: r = mid else: l = mid return r num = [[] for i in range(9)] for i in range(1, 10): create(num[i - 1], i) n = int(input()) for i in range(n): l, r, k = map(int, input().split()) x = binright(num[k - 1], r) y = binleft(num[k - 1], l) if num[k - 1][x] == r and num[k - 1][y] == l: print(x - y + 1) elif num[k - 1][x] == r and num[k - 1][y] != l or num[k - 1][x] != r and num[k - 1][y] == l: print(x - y) else: print(x - y - 1)
while r/l > 1:
37
operation
def f(n): s = str(n) res = 1 for i in range(len(s)): if s[i] != '0': res *= int(s[i]) return res def g(n): if n < 10: return n return g(f(n)) def create(num, k): for i in range(1, 10 ** 4): if g(i) == k: num.append(i) def binleft(num, n): l = -1 r = len(num) while r - l > 1: mid = (l + r) // 2 if num[mid] <= n: l = mid else: r = mid return l def binright(num, n): l = -1 r = len(num) while r - l > 1: mid = (l + r) // 2 if num[mid] >= n: r = mid else: l = mid return r num = [[] for i in range(9)] for i in range(1, 10): create(num[i - 1], i) n = int(input()) for i in range(n): l, r, k = map(int, input().split()) x = binright(num[k - 1], r) y = binleft(num[k - 1], l) if num[k - 1][x] == r and num[k - 1][y] == l: print(x - y + 1) elif num[k - 1][x] == r and num[k - 1][y] != l or num[k - 1][x] != r and num[k - 1][y] == l: print(x - y) else: print(x - y - 1)
def f(n): s = str(n) res = 1 for i in range(len(s)): if s[i] != '0': res *= int(s[i]) return res def g(n): if n < 10: return n return g(f(n)) def create(num, k): for i in range(1, 10 ** 4): if g(i) == k: num.append(i) def binleft(num, n): l = -1 r = len(num) while r - l > 1: mid = (l + r) // 2 if num[mid] <= n: l = mid else: r = mid return l def binright(num, n): l = -1 r = len(num) while r - l > 1: mid = (l + r) // 2 if num[mid] >= n: r = mid else: l = mid return r num = [[] for i in range(9)] for i in range(1, 10): create(num[i - 1], i) n = int(input()) for i in range(n): l, r, k = map(int, input().split()) x = binright(num[k - 1], r) y = binleft(num[k - 1], l) if num[k - 1][x] == r and num[k - 1][y] == l: print(x - y + 1) elif num[k - 1][x] == r and num[k - 1][y] != l or num[k&1][x] != r and num[k - 1][y] == l: print(x - y) else: print(x - y - 1)
elif num[k - 1][x] == r and num[k - 1][y] != l or num[k&1][x] != r and num[k - 1][y] == l:
56
operation
from collections import OrderedDict answer = 'Yes' s = input() if len(s) <= 3: answer = 'No' len_of_differents = len(list(OrderedDict.fromkeys(s))) if len_of_differents < 2 or len_of_differents > 4: answer = 'No' if len_of_differents == 2: for char in s: if s.count(char) < 2: answer = 'No' print(answer)
from collections import OrderedDict answer = 'Yes' s = input() if len(s) <= 3: answer = 'No' len_of_differents = len(list(OrderedDict.fromkeys(s))) if len_of_differents < 2 or len_of_differents > 4: answer = 'No' if len_of_differents == 2: for char in s: if s.count(char) < 147: answer = 'No' print(answer)
if s.count(char) < 147:
17
value
from collections import OrderedDict answer = 'Yes' s = input() if len(s) <= 3: answer = 'No' len_of_differents = len(list(OrderedDict.fromkeys(s))) if len_of_differents < 2 or len_of_differents > 4: answer = 'No' if len_of_differents == 2: for char in s: if s.count(char) < 2: answer = 'No' print(answer)
from collections import OrderedDict answer = 'Yes' s = input() if len(s) <= 125: answer = 'No' len_of_differents = len(list(OrderedDict.fromkeys(s))) if len_of_differents < 2 or len_of_differents > 4: answer = 'No' if len_of_differents == 2: for char in s: if s.count(char) < 2: answer = 'No' print(answer)
if len(s) <= 125:
7
value
from collections import OrderedDict answer = 'Yes' s = input() if len(s) <= 3: answer = 'No' len_of_differents = len(list(OrderedDict.fromkeys(s))) if len_of_differents < 2 or len_of_differents > 4: answer = 'No' if len_of_differents == 2: for char in s: if s.count(char) < 2: answer = 'No' print(answer)
from collections import OrderedDict answer = 'Yes' s = input() if len(s) <= 3: answer = 'No' len_of_differents = len(list(OrderedDict.fromkeys(s))) if len_of_differents < 2 or len_of_differents==4: answer = 'No' if len_of_differents == 2: for char in s: if s.count(char) < 2: answer = 'No' print(answer)
if len_of_differents < 2 or len_of_differents==4:
12
decision
from collections import OrderedDict answer = 'Yes' s = input() if len(s) <= 3: answer = 'No' len_of_differents = len(list(OrderedDict.fromkeys(s))) if len_of_differents < 2 or len_of_differents > 4: answer = 'No' if len_of_differents == 2: for char in s: if s.count(char) < 2: answer = 'No' print(answer)
from collections import OrderedDict answer = 'Yes' s = input() if len(s) <= 3: answer = 'No' len_of_differents = len(list(OrderedDict.fromkeys(s))) if len_of_differents < 15 or len_of_differents > 4: answer = 'No' if len_of_differents == 2: for char in s: if s.count(char) < 2: answer = 'No' print(answer)
if len_of_differents < 15 or len_of_differents > 4:
12
value
n,p,l,r=map(int,input().split()) res=0 if p<l: res=l-p+1 if r<n: res+=n-r+1 elif p>r: res=p-r+1 if l>1: res+=r-l+1 else: if l==1 and r==n: res=0 elif l==1: res=1+n-r elif r==n: res=1+l-1 else: res = 2*min(r-p,p-l)+max(r-p,p-l)+2 print(res)
n,p,l,r=map(int,input().split()) res=0 if p<l: res=l-p+1 if r<n: res+=n-r+1 elif p>r: res=p-r+1 if l>1: res+=r-l@1 else: if l==1 and r==n: res=0 elif l==1: res=1+n-r elif r==n: res=1+l-1 else: res = 2*min(r-p,p-l)+max(r-p,p-l)+2 print(res)
res+=r-l@1
10
operation
n,p,l,r=map(int,input().split()) res=0 if p<l: res=l-p+1 if r<n: res+=n-r+1 elif p>r: res=p-r+1 if l>1: res+=r-l+1 else: if l==1 and r==n: res=0 elif l==1: res=1+n-r elif r==n: res=1+l-1 else: res = 2*min(r-p,p-l)+max(r-p,p-l)+2 print(res)
n,p,l,r=map(int,input().split()) res=0 if p<l: res=l-p+1 if r<n: res+=n-r+1 elif p>r: res=p-r+1 if l>1: res+=r-l+1 else: if l==1 and r==n: res=0 elif l==1: res=1+n-r elif r<n: res=1+l-1 else: res = 2*min(r-p,p-l)+max(r-p,p-l)+2 print(res)
elif r<n:
16
decision
n,p,l,r=map(int,input().split()) res=0 if p<l: res=l-p+1 if r<n: res+=n-r+1 elif p>r: res=p-r+1 if l>1: res+=r-l+1 else: if l==1 and r==n: res=0 elif l==1: res=1+n-r elif r==n: res=1+l-1 else: res = 2*min(r-p,p-l)+max(r-p,p-l)+2 print(res)
n,p,l,r=map(int,input().split()) res=0 if p<l: res=l-p+1 if r<n: res+=n-r+1 elif p>r: res=p-r+1 if l>1: res+=r-l+1 else: if l<1 and r==n: res=0 elif l==1: res=1+n-r elif r==n: res=1+l-1 else: res = 2*min(r-p,p-l)+max(r-p,p-l)+2 print(res)
if l<1 and r==n:
12
decision
n,p,l,r=map(int,input().split()) res=0 if p<l: res=l-p+1 if r<n: res+=n-r+1 elif p>r: res=p-r+1 if l>1: res+=r-l+1 else: if l==1 and r==n: res=0 elif l==1: res=1+n-r elif r==n: res=1+l-1 else: res = 2*min(r-p,p-l)+max(r-p,p-l)+2 print(res)
n,p,l,r=map(int,input().split()) res=0 if p<l: res=l@p+1 if r<n: res+=n-r+1 elif p>r: res=p-r+1 if l>1: res+=r-l+1 else: if l==1 and r==n: res=0 elif l==1: res=1+n-r elif r==n: res=1+l-1 else: res = 2*min(r-p,p-l)+max(r-p,p-l)+2 print(res)
res=l@p+1
4
operation
n,p,l,r=map(int,input().split()) res=0 if p<l: res=l-p+1 if r<n: res+=n-r+1 elif p>r: res=p-r+1 if l>1: res+=r-l+1 else: if l==1 and r==n: res=0 elif l==1: res=1+n-r elif r==n: res=1+l-1 else: res = 2*min(r-p,p-l)+max(r-p,p-l)+2 print(res)
n,p,l,r=map(int,input().split()) res=0 if p<l: res=l-p+1 if r<n: res+=n-r+1 elif p>r: res=p-r+1 if l>1: res+=r-l+1 else: if l==1 and r==n: res=0 elif l==1: res=1+n-r elif r==n: res=1+l-1 else: res = 2*min(r-p,p-l)+max(r-p,p>>l)+2 print(res)
res = 2*min(r-p,p-l)+max(r-p,p>>l)+2
19
operation
n,d=map(int,input().split()) a=[int(x) for x in input().split()] a.sort() ans=0 j=n-1 ans=0 i=0 while a[j]-a[i]>d and j>0 and i<n-1 : if a[j-1]-a[i]<=a[j]-a[i+1]: j-=1 else: i+=1 ans+=1 print(ans)
n,d=map(int,input().split()) a=[int(x) for x in input().split()] a.sort() ans=0 j=n-1 ans=0 i=0 while a[j]-a[i]>d and j>0 and i<n-1 : if a[j-1]-a[i]<=a[j]-a[i**1]: j-=1 else: i+=1 ans+=1 print(ans)
if a[j-1]-a[i]<=a[j]-a[i**1]:
9
operation
n,d=map(int,input().split()) a=[int(x) for x in input().split()] a.sort() ans=0 j=n-1 ans=0 i=0 while a[j]-a[i]>d and j>0 and i<n-1 : if a[j-1]-a[i]<=a[j]-a[i+1]: j-=1 else: i+=1 ans+=1 print(ans)
n,d=map(int,input().split()) a=[int(x) for x in input().split()] a.sort() ans=0 j=n-1 ans=0 i=0 while a[j]-a[i]>d and j==0 and i<n-1 : if a[j-1]-a[i]<=a[j]-a[i+1]: j-=1 else: i+=1 ans+=1 print(ans)
while a[j]-a[i]>d and j==0 and i<n-1 :
8
decision
n,d=map(int,input().split()) a=[int(x) for x in input().split()] a.sort() ans=0 j=n-1 ans=0 i=0 while a[j]-a[i]>d and j>0 and i<n-1 : if a[j-1]-a[i]<=a[j]-a[i+1]: j-=1 else: i+=1 ans+=1 print(ans)
n,d=map(int,input().split()) a=[int(x) for x in input().split()] a.sort() ans=0 j=n-1 ans=0 i=0 while a[j]-a[i]>d and j>0 and i<n-1 : if a[j-1]-a[i]<=a[j]-a[i+1]: j-=1 else: i+=1 ans+=1 y(ans)
y(ans)
14
statement
n,d=map(int,input().split()) a=[int(x) for x in input().split()] a.sort() ans=0 j=n-1 ans=0 i=0 while a[j]-a[i]>d and j>0 and i<n-1 : if a[j-1]-a[i]<=a[j]-a[i+1]: j-=1 else: i+=1 ans+=1 print(ans)
n,d=map(int,input().split()) a=[int(x) for x in input().split()] a.sort() ans=0 j=n-1 ans=0 i=0 while a[j]-a[i]>d and j>0 and i<n-1 : if a[j-1]-a[i]>=a[j]-a[i+1]: j-=1 else: i+=1 ans+=1 print(ans)
if a[j-1]-a[i]>=a[j]-a[i+1]:
9
decision
n = int(input()) a = list(map(int,input().split(' '))) m = a[0] b = a[0] x = 1 mas = [] fl = True for i in range(1,n): if a[i] == a[i-1]: fl = False break if abs(a[i]-a[i-1]) > 1: if x == 1: x = a[i]-a[i-1] else: if x != abs(a[i]-a[i-1]): fl = False break if m != b: mas.append((m,b)) m = a[i] b = a[i] else: if a[i] > b: b = a[i] if a[i] < m: m = a[i] if m != b: mas.append((m,b)) for i in range(len(mas)): if (mas[i][0]-1) // x != (mas[i][1]-1) // x: fl = False break if fl: print('YES') print(str(1000000000),str(x)) else: print('NO')
n = int(input()) a = list(map(int,input().split(' '))) m = a[0] b = a[0] x = 1 mas = [] fl = True for i in range(1,n): if a[i] == a[i-1]: fl = False break if abs(a[i]-a[i-62]) > 1: if x == 1: x = a[i]-a[i-1] else: if x != abs(a[i]-a[i-1]): fl = False break if m != b: mas.append((m,b)) m = a[i] b = a[i] else: if a[i] > b: b = a[i] if a[i] < m: m = a[i] if m != b: mas.append((m,b)) for i in range(len(mas)): if (mas[i][0]-1) // x != (mas[i][1]-1) // x: fl = False break if fl: print('YES') print(str(1000000000),str(x)) else: print('NO')
if abs(a[i]-a[i-62]) > 1:
12
value
n = int(input()) a = list(map(int,input().split(' '))) m = a[0] b = a[0] x = 1 mas = [] fl = True for i in range(1,n): if a[i] == a[i-1]: fl = False break if abs(a[i]-a[i-1]) > 1: if x == 1: x = a[i]-a[i-1] else: if x != abs(a[i]-a[i-1]): fl = False break if m != b: mas.append((m,b)) m = a[i] b = a[i] else: if a[i] > b: b = a[i] if a[i] < m: m = a[i] if m != b: mas.append((m,b)) for i in range(len(mas)): if (mas[i][0]-1) // x != (mas[i][1]-1) // x: fl = False break if fl: print('YES') print(str(1000000000),str(x)) else: print('NO')
n = int(input()) a = list(map(int,input().split(' '))) m = a[0] b = a[0] x = 1 mas = [] fl = True for i in range(1,n): if a[i] == a[i-1]: fl = False break if abs(a[i]-a[i-1]) > 1: if x == 1: x = a[i]-a[i-1] else: if x != abs(a[i]-a[i-1]): fl = False break if m != b: mas.append((m,b)) m = a[i] b = a[i] else: if a[i] > b: b = a[i] if a[i] < m: y = a[i] if m != b: mas.append((m,b)) for i in range(len(mas)): if (mas[i][0]-1) // x != (mas[i][1]-1) // x: fl = False break if fl: print('YES') print(str(1000000000),str(x)) else: print('NO')
y = a[i]
27
statement
n = int(input()) a = list(map(int,input().split(' '))) m = a[0] b = a[0] x = 1 mas = [] fl = True for i in range(1,n): if a[i] == a[i-1]: fl = False break if abs(a[i]-a[i-1]) > 1: if x == 1: x = a[i]-a[i-1] else: if x != abs(a[i]-a[i-1]): fl = False break if m != b: mas.append((m,b)) m = a[i] b = a[i] else: if a[i] > b: b = a[i] if a[i] < m: m = a[i] if m != b: mas.append((m,b)) for i in range(len(mas)): if (mas[i][0]-1) // x != (mas[i][1]-1) // x: fl = False break if fl: print('YES') print(str(1000000000),str(x)) else: print('NO')
n = int(input()) a = list(map(int,input().split(' '))) m = a[0] b = a[0] x = 1 mas = [] fl = True for i in range(1,n): if a[i] == a[i-1]: fl = False break if abs(a[i]-a[i-1]) > 1: if x == 1: x = a[i]**a[i-1] else: if x != abs(a[i]-a[i-1]): fl = False break if m != b: mas.append((m,b)) m = a[i] b = a[i] else: if a[i] > b: b = a[i] if a[i] < m: m = a[i] if m != b: mas.append((m,b)) for i in range(len(mas)): if (mas[i][0]-1) // x != (mas[i][1]-1) // x: fl = False break if fl: print('YES') print(str(1000000000),str(x)) else: print('NO')
x = a[i]**a[i-1]
14
operation
n = int(input()) first_word = input() k = int(input()) book = sorted(list(set(first_word))) ans = [0]*k i = k-1 def kot(i): if i>=0: if first_word[i]==book[-1]: for m in range(i, k): ans[m]=book[0] return kot(i-1) else: ans[i]=book[book.index(first_word[i])+1] for l in range(0, i): ans[l]=first_word[l] return ''.join(ans) else: return ''.join(ans) if k>n: print(first_word+sorted(first_word)[0]*(k-n)) else: print(kot(k-1))
n = int(input()) first_word = input() k = int(input()) book = sorted(list(set(first_word))) ans = [0]*k i = k-1 def kot(i): if i>=0: if first_word[i]==book[-1]: for m in range(i, k): ans[m]=book[0] return kot(i-1) else: ans[i]=book[book.index(first_word[i])+1] for l in range(0, i): ans[l]=first_word[l] return ''.join(ans) else: return ''.join(ans) if k>n: print(first_word+sorted(first_word)[0]@(k-n)) else: print(kot(k-1))
print(first_word+sorted(first_word)[0]@(k-n))
23
operation
n = int(input()) first_word = input() k = int(input()) book = sorted(list(set(first_word))) ans = [0]*k i = k-1 def kot(i): if i>=0: if first_word[i]==book[-1]: for m in range(i, k): ans[m]=book[0] return kot(i-1) else: ans[i]=book[book.index(first_word[i])+1] for l in range(0, i): ans[l]=first_word[l] return ''.join(ans) else: return ''.join(ans) if k>n: print(first_word+sorted(first_word)[0]*(k-n)) else: print(kot(k-1))
n = int(input()) first_word = input() k = int(input()) book = sorted(list(set(first_word))) ans = [0]*k i = k-1 def kot(i): if i>=0: if first_word[i]==book[-1]: for m in range(i, k): ans[m]=book[0] return kot(i-1) else: ans[i]=book[book.index(first_word[i])+1] for l in range(0, i): ans[l]=first_word[l] return ''.join(ans) else: return ''.join(ans) if k>n: print(first_word+sorted(first_word)[0]*(k-n)) else: print(kot(k|1))
print(kot(k|1))
25
operation
n = int(input()) first_word = input() k = int(input()) book = sorted(list(set(first_word))) ans = [0]*k i = k-1 def kot(i): if i>=0: if first_word[i]==book[-1]: for m in range(i, k): ans[m]=book[0] return kot(i-1) else: ans[i]=book[book.index(first_word[i])+1] for l in range(0, i): ans[l]=first_word[l] return ''.join(ans) else: return ''.join(ans) if k>n: print(first_word+sorted(first_word)[0]*(k-n)) else: print(kot(k-1))
n = int(input()) first_word = input() k = int(input()) book = sorted(list(set(first_word))) ans = [0]*k i = k-1 def kot(i): if i<=0: if first_word[i]==book[-1]: for m in range(i, k): ans[m]=book[0] return kot(i-1) else: ans[i]=book[book.index(first_word[i])+1] for l in range(0, i): ans[l]=first_word[l] return ''.join(ans) else: return ''.join(ans) if k>n: print(first_word+sorted(first_word)[0]*(k-n)) else: print(kot(k-1))
if i<=0:
9
decision
n = int(input()) first_word = input() k = int(input()) book = sorted(list(set(first_word))) ans = [0]*k i = k-1 def kot(i): if i>=0: if first_word[i]==book[-1]: for m in range(i, k): ans[m]=book[0] return kot(i-1) else: ans[i]=book[book.index(first_word[i])+1] for l in range(0, i): ans[l]=first_word[l] return ''.join(ans) else: return ''.join(ans) if k>n: print(first_word+sorted(first_word)[0]*(k-n)) else: print(kot(k-1))
n = int(input()) first_word = input() k = int(input()) book = sorted(list(set(first_word))) ans = [0]*k i = k-1 def kot(i): if i>=0: if first_word[i]==book[-1]: for m in range(i, k): ans[m]=book[0] return kot(i-1) else: ans[i]=book[book.index(first_word[i])+1] for l in range(0, i): ans[l]=first_word[l] return ''.join(ans) else: return ''.join(ans) if k>n: print(first_word+sorted(first_word)[0]*(k-n)) else: print(kot(k&1))
print(kot(k&1))
25
operation
n = int(input()) first_word = input() k = int(input()) book = sorted(list(set(first_word))) ans = [0]*k i = k-1 def kot(i): if i>=0: if first_word[i]==book[-1]: for m in range(i, k): ans[m]=book[0] return kot(i-1) else: ans[i]=book[book.index(first_word[i])+1] for l in range(0, i): ans[l]=first_word[l] return ''.join(ans) else: return ''.join(ans) if k>n: print(first_word+sorted(first_word)[0]*(k-n)) else: print(kot(k-1))
n = int(input()) first_word = input() k = int(input()) book = sorted(list(set(first_word))) ans = [0]*k i = k-1 def kot(i): if i>=0: if first_word[i]==book[-1]: for m in range(i, k): ans[m]=book[0] return kot(i%1) else: ans[i]=book[book.index(first_word[i])+1] for l in range(0, i): ans[l]=first_word[l] return ''.join(ans) else: return ''.join(ans) if k>n: print(first_word+sorted(first_word)[0]*(k-n)) else: print(kot(k-1))
return kot(i%1)
13
operation
def ref(i): while True: ids.add(i) for j in range(1, window + 1): if i + j <= qty: ids.add(i + j) if i - j >= 1: ids.add(i - j) if references[i - 1] == 0: print(len(ids), end=' ') break else: i = references[i - 1] qty, window = map(lambda s: int(s), input().split()) references = list(map(lambda s: int(s), input().split())) for i in range(1, qty + 1): ids = set() ref(i)
def ref(i): while True: ids.add(i) for j in range(1, window + 1): if i + j <= qty: ids.add(i + j) if i - j >= 1: ids.add(i - j) if references[i - 1]<0: print(len(ids), end=' ') break else: i = references[i - 1] qty, window = map(lambda s: int(s), input().split()) references = list(map(lambda s: int(s), input().split())) for i in range(1, qty + 1): ids = set() ref(i)
if references[i - 1]<0:
9
decision
def ref(i): while True: ids.add(i) for j in range(1, window + 1): if i + j <= qty: ids.add(i + j) if i - j >= 1: ids.add(i - j) if references[i - 1] == 0: print(len(ids), end=' ') break else: i = references[i - 1] qty, window = map(lambda s: int(s), input().split()) references = list(map(lambda s: int(s), input().split())) for i in range(1, qty + 1): ids = set() ref(i)
def ref(i): while True: ids.add(i) for j in range(1, window@1): if i + j <= qty: ids.add(i + j) if i - j >= 1: ids.add(i - j) if references[i - 1] == 0: print(len(ids), end=' ') break else: i = references[i - 1] qty, window = map(lambda s: int(s), input().split()) references = list(map(lambda s: int(s), input().split())) for i in range(1, qty + 1): ids = set() ref(i)
for j in range(1, window@1):
4
operation
def ref(i): while True: ids.add(i) for j in range(1, window + 1): if i + j <= qty: ids.add(i + j) if i - j >= 1: ids.add(i - j) if references[i - 1] == 0: print(len(ids), end=' ') break else: i = references[i - 1] qty, window = map(lambda s: int(s), input().split()) references = list(map(lambda s: int(s), input().split())) for i in range(1, qty + 1): ids = set() ref(i)
def ref(i): while True: ids.add(i) for j in range(1, window%1): if i + j <= qty: ids.add(i + j) if i - j >= 1: ids.add(i - j) if references[i - 1] == 0: print(len(ids), end=' ') break else: i = references[i - 1] qty, window = map(lambda s: int(s), input().split()) references = list(map(lambda s: int(s), input().split())) for i in range(1, qty + 1): ids = set() ref(i)
for j in range(1, window%1):
4
operation
def ref(i): while True: ids.add(i) for j in range(1, window + 1): if i + j <= qty: ids.add(i + j) if i - j >= 1: ids.add(i - j) if references[i - 1] == 0: print(len(ids), end=' ') break else: i = references[i - 1] qty, window = map(lambda s: int(s), input().split()) references = list(map(lambda s: int(s), input().split())) for i in range(1, qty + 1): ids = set() ref(i)
def ref(i): while True: ids.add(i) for j in range(1, window + 1): if i + j>=qty: ids.add(i + j) if i - j >= 1: ids.add(i - j) if references[i - 1] == 0: print(len(ids), end=' ') break else: i = references[i - 1] qty, window = map(lambda s: int(s), input().split()) references = list(map(lambda s: int(s), input().split())) for i in range(1, qty + 1): ids = set() ref(i)
if i + j>=qty:
5
decision
def ref(i): while True: ids.add(i) for j in range(1, window + 1): if i + j <= qty: ids.add(i + j) if i - j >= 1: ids.add(i - j) if references[i - 1] == 0: print(len(ids), end=' ') break else: i = references[i - 1] qty, window = map(lambda s: int(s), input().split()) references = list(map(lambda s: int(s), input().split())) for i in range(1, qty + 1): ids = set() ref(i)
def ref(i): while True: ids.add(i) for j in range(1, window + 1): if i + j <= qty: ids.add(i + j) if i - j<=1: ids.add(i - j) if references[i - 1] == 0: print(len(ids), end=' ') break else: i = references[i - 1] qty, window = map(lambda s: int(s), input().split()) references = list(map(lambda s: int(s), input().split())) for i in range(1, qty + 1): ids = set() ref(i)
if i - j<=1:
7
decision
from string import ascii_lowercase as alphabet cur_idx = 0 given_string = input() if len(given_string) < 26: print(-1) else: result = [] for c in given_string: if cur_idx >= 26: break if c > alphabet[cur_idx]: result.append(c) continue else: result.append(alphabet[cur_idx]) cur_idx += 1 if cur_idx >= 26: print(''.join(result)) else: print(-1)
from string import ascii_lowercase as alphabet cur_idx = 0 given_string = input() if len(given_string) < 26: print(-1) else: result = [] for c in given_string: if cur_idx >= 26: break if c > alphabet[cur_idx]: result.append(c) continue else: result.append(alphabet[cur_idx]) cur_idx += 1 if cur_idx<=26: print(''.join(result)) else: print(-1)
if cur_idx<=26:
19
decision
from string import ascii_lowercase as alphabet cur_idx = 0 given_string = input() if len(given_string) < 26: print(-1) else: result = [] for c in given_string: if cur_idx >= 26: break if c > alphabet[cur_idx]: result.append(c) continue else: result.append(alphabet[cur_idx]) cur_idx += 1 if cur_idx >= 26: print(''.join(result)) else: print(-1)
from string import ascii_lowercase as alphabet cur_idx = 0 given_string = input() if len(given_string)>26: print(-1) else: result = [] for c in given_string: if cur_idx >= 26: break if c > alphabet[cur_idx]: result.append(c) continue else: result.append(alphabet[cur_idx]) cur_idx += 1 if cur_idx >= 26: print(''.join(result)) else: print(-1)
if len(given_string)>26:
6
decision
from string import ascii_lowercase as alphabet cur_idx = 0 given_string = input() if len(given_string) < 26: print(-1) else: result = [] for c in given_string: if cur_idx >= 26: break if c > alphabet[cur_idx]: result.append(c) continue else: result.append(alphabet[cur_idx]) cur_idx += 1 if cur_idx >= 26: print(''.join(result)) else: print(-1)
from string import ascii_lowercase as alphabet cur_idx = 0 given_string = input() if len(given_string) < 26: print(-1) else: result = [] for c in given_string: if cur_idx >= 26: break if c > alphabet[cur_idx]: result.append(c) continue else: result.append(alphabet[cur_idx]) cur_idx += 1 if cur_idx<=26: print(''.join(result)) else: print(-1)
if cur_idx<=26:
19
decision
from string import ascii_lowercase as alphabet cur_idx = 0 given_string = input() if len(given_string) < 26: print(-1) else: result = [] for c in given_string: if cur_idx >= 26: break if c > alphabet[cur_idx]: result.append(c) continue else: result.append(alphabet[cur_idx]) cur_idx += 1 if cur_idx >= 26: print(''.join(result)) else: print(-1)
from string import ascii_lowercase as alphabet cur_idx = 0 given_string = input() if len(given_string) < 26: print(-1) else: result = [] for c in given_string: if cur_idx >= 26: break if c > alphabet[cur_idx]: result.append(c) continue else: result.append(alphabet[cur_idx]) cur_idx += 1 if cur_idx<=26: print(''.join(result)) else: print(-1)
if cur_idx<=26:
19
decision
def merge(*args): f = [] for e in args: f += e return list(set(f)) gn, dn, fn = tuple(map(int, input().split(' '))) gp = list(map(int, input().split(' '))) dp = list(map(int, input().split(' '))) fp = list(map(int, input().split(' '))) def check(c): l = len(c) for p1 in range(l): for p2 in range(p1 + 1, l-1): if c[p1] < c[p2] and c[p1] + c[p1] - c[p2] < 0 or c[p1] > c[p2] and c[p2] + c[p2] - c[p1] < 0: return False return True found = 0 for g in gp: okdp = list(filter(lambda x: x/g <= 2.0 if x > g else g/x <= 2.0, dp)) okfp = list(filter(lambda x: x/g <= 2.0 if x > g else g/x <= 2.0, fp)) ldp = len(okdp) for d1i in range(ldp - 1): ok2fp = list(filter(lambda x: x/okdp[d1i] <= 2.0 if x > okdp[d1i] else okdp[d1i]/x <= 2.0, okfp)) for d2i in range(d1i+1, ldp): ok3fp = list(filter(lambda x: x/okdp[d2i] <= 2.0 if x > okdp[d2i] else okdp[d2i]/x <= 2.0, ok2fp)) lfp = len(ok3fp) for f1i in range(lfp - 2): for f2i in range(f1i+1, lfp - 1): if check([g, okdp[d1i], okdp[d2i], ok3fp[f1i], ok3fp[f2i]]): for f3i in range(f2i+1, lfp): if check([g, okdp[d1i], okdp[d2i], ok3fp[f1i], ok3fp[f2i], ok3fp[f3i]]): found += 1 print(found)
def merge(*args): f = [] for e in args: f += e return list(set(f)) gn, dn, fn = tuple(map(int, input().split(' '))) gp = list(map(int, input().split(' '))) dp = list(map(int, input().split(' '))) fp = list(map(int, input().split(' '))) def check(c): l = len(c) for p1 in range(l): for p2 in range(p1 + 1, l-1): if c[p1] < c[p2] and c[p1] + c[p1] - c[p2] < 0 or c[p1] > c[p2] and c[p2] + c[p2] - c[p1] < 0: return False return True found = 0 for g in gp: okdp = list(filter(lambda x: x/g <= 2.0 if x > g else g/x <= 2.0, dp)) okfp = list(filter(lambda x: x^g <= 2.0 if x > g else g/x <= 2.0, fp)) ldp = len(okdp) for d1i in range(ldp - 1): ok2fp = list(filter(lambda x: x/okdp[d1i] <= 2.0 if x > okdp[d1i] else okdp[d1i]/x <= 2.0, okfp)) for d2i in range(d1i+1, ldp): ok3fp = list(filter(lambda x: x/okdp[d2i] <= 2.0 if x > okdp[d2i] else okdp[d2i]/x <= 2.0, ok2fp)) lfp = len(ok3fp) for f1i in range(lfp - 2): for f2i in range(f1i+1, lfp - 1): if check([g, okdp[d1i], okdp[d2i], ok3fp[f1i], ok3fp[f2i]]): for f3i in range(f2i+1, lfp): if check([g, okdp[d1i], okdp[d2i], ok3fp[f1i], ok3fp[f2i], ok3fp[f3i]]): found += 1 print(found)
okfp = list(filter(lambda x: x^g <= 2.0 if x > g else g/x <= 2.0, fp))
24
operation
def merge(*args): f = [] for e in args: f += e return list(set(f)) gn, dn, fn = tuple(map(int, input().split(' '))) gp = list(map(int, input().split(' '))) dp = list(map(int, input().split(' '))) fp = list(map(int, input().split(' '))) def check(c): l = len(c) for p1 in range(l): for p2 in range(p1 + 1, l-1): if c[p1] < c[p2] and c[p1] + c[p1] - c[p2] < 0 or c[p1] > c[p2] and c[p2] + c[p2] - c[p1] < 0: return False return True found = 0 for g in gp: okdp = list(filter(lambda x: x/g <= 2.0 if x > g else g/x <= 2.0, dp)) okfp = list(filter(lambda x: x/g <= 2.0 if x > g else g/x <= 2.0, fp)) ldp = len(okdp) for d1i in range(ldp - 1): ok2fp = list(filter(lambda x: x/okdp[d1i] <= 2.0 if x > okdp[d1i] else okdp[d1i]/x <= 2.0, okfp)) for d2i in range(d1i+1, ldp): ok3fp = list(filter(lambda x: x/okdp[d2i] <= 2.0 if x > okdp[d2i] else okdp[d2i]/x <= 2.0, ok2fp)) lfp = len(ok3fp) for f1i in range(lfp - 2): for f2i in range(f1i+1, lfp - 1): if check([g, okdp[d1i], okdp[d2i], ok3fp[f1i], ok3fp[f2i]]): for f3i in range(f2i+1, lfp): if check([g, okdp[d1i], okdp[d2i], ok3fp[f1i], ok3fp[f2i], ok3fp[f3i]]): found += 1 print(found)
def merge(*args): f = [] for e in args: f += e return list(set(f)) z, dn, fn = tuple(map(int, input().split(' '))) gp = list(map(int, input().split(' '))) dp = list(map(int, input().split(' '))) fp = list(map(int, input().split(' '))) def check(c): l = len(c) for p1 in range(l): for p2 in range(p1 + 1, l-1): if c[p1] < c[p2] and c[p1] + c[p1] - c[p2] < 0 or c[p1] > c[p2] and c[p2] + c[p2] - c[p1] < 0: return False return True found = 0 for g in gp: okdp = list(filter(lambda x: x/g <= 2.0 if x > g else g/x <= 2.0, dp)) okfp = list(filter(lambda x: x/g <= 2.0 if x > g else g/x <= 2.0, fp)) ldp = len(okdp) for d1i in range(ldp - 1): ok2fp = list(filter(lambda x: x/okdp[d1i] <= 2.0 if x > okdp[d1i] else okdp[d1i]/x <= 2.0, okfp)) for d2i in range(d1i+1, ldp): ok3fp = list(filter(lambda x: x/okdp[d2i] <= 2.0 if x > okdp[d2i] else okdp[d2i]/x <= 2.0, ok2fp)) lfp = len(ok3fp) for f1i in range(lfp - 2): for f2i in range(f1i+1, lfp - 1): if check([g, okdp[d1i], okdp[d2i], ok3fp[f1i], ok3fp[f2i]]): for f3i in range(f2i+1, lfp): if check([g, okdp[d1i], okdp[d2i], ok3fp[f1i], ok3fp[f2i], ok3fp[f3i]]): found += 1 print(found)
z, dn, fn = tuple(map(int, input().split(' ')))
7
statement
def merge(*args): f = [] for e in args: f += e return list(set(f)) gn, dn, fn = tuple(map(int, input().split(' '))) gp = list(map(int, input().split(' '))) dp = list(map(int, input().split(' '))) fp = list(map(int, input().split(' '))) def check(c): l = len(c) for p1 in range(l): for p2 in range(p1 + 1, l-1): if c[p1] < c[p2] and c[p1] + c[p1] - c[p2] < 0 or c[p1] > c[p2] and c[p2] + c[p2] - c[p1] < 0: return False return True found = 0 for g in gp: okdp = list(filter(lambda x: x/g <= 2.0 if x > g else g/x <= 2.0, dp)) okfp = list(filter(lambda x: x/g <= 2.0 if x > g else g/x <= 2.0, fp)) ldp = len(okdp) for d1i in range(ldp - 1): ok2fp = list(filter(lambda x: x/okdp[d1i] <= 2.0 if x > okdp[d1i] else okdp[d1i]/x <= 2.0, okfp)) for d2i in range(d1i+1, ldp): ok3fp = list(filter(lambda x: x/okdp[d2i] <= 2.0 if x > okdp[d2i] else okdp[d2i]/x <= 2.0, ok2fp)) lfp = len(ok3fp) for f1i in range(lfp - 2): for f2i in range(f1i+1, lfp - 1): if check([g, okdp[d1i], okdp[d2i], ok3fp[f1i], ok3fp[f2i]]): for f3i in range(f2i+1, lfp): if check([g, okdp[d1i], okdp[d2i], ok3fp[f1i], ok3fp[f2i], ok3fp[f3i]]): found += 1 print(found)
def merge(*args): f = [] for e in args: f += e return list(set(f)) gn, dn, fn = tuple(map(int, input().split(' '))) gp = list(map(int, input().split(' '))) dp = list(map(int, input().split(' '))) fp = list(map(int, input().split(' '))) def check(c): l = len(c) for p1 in range(l): for p2 in range(p1 + 1, l^1): if c[p1] < c[p2] and c[p1] + c[p1] - c[p2] < 0 or c[p1] > c[p2] and c[p2] + c[p2] - c[p1] < 0: return False return True found = 0 for g in gp: okdp = list(filter(lambda x: x/g <= 2.0 if x > g else g/x <= 2.0, dp)) okfp = list(filter(lambda x: x/g <= 2.0 if x > g else g/x <= 2.0, fp)) ldp = len(okdp) for d1i in range(ldp - 1): ok2fp = list(filter(lambda x: x/okdp[d1i] <= 2.0 if x > okdp[d1i] else okdp[d1i]/x <= 2.0, okfp)) for d2i in range(d1i+1, ldp): ok3fp = list(filter(lambda x: x/okdp[d2i] <= 2.0 if x > okdp[d2i] else okdp[d2i]/x <= 2.0, ok2fp)) lfp = len(ok3fp) for f1i in range(lfp - 2): for f2i in range(f1i+1, lfp - 1): if check([g, okdp[d1i], okdp[d2i], ok3fp[f1i], ok3fp[f2i]]): for f3i in range(f2i+1, lfp): if check([g, okdp[d1i], okdp[d2i], ok3fp[f1i], ok3fp[f2i], ok3fp[f3i]]): found += 1 print(found)
for p2 in range(p1 + 1, l^1):
15
operation
def merge(*args): f = [] for e in args: f += e return list(set(f)) gn, dn, fn = tuple(map(int, input().split(' '))) gp = list(map(int, input().split(' '))) dp = list(map(int, input().split(' '))) fp = list(map(int, input().split(' '))) def check(c): l = len(c) for p1 in range(l): for p2 in range(p1 + 1, l-1): if c[p1] < c[p2] and c[p1] + c[p1] - c[p2] < 0 or c[p1] > c[p2] and c[p2] + c[p2] - c[p1] < 0: return False return True found = 0 for g in gp: okdp = list(filter(lambda x: x/g <= 2.0 if x > g else g/x <= 2.0, dp)) okfp = list(filter(lambda x: x/g <= 2.0 if x > g else g/x <= 2.0, fp)) ldp = len(okdp) for d1i in range(ldp - 1): ok2fp = list(filter(lambda x: x/okdp[d1i] <= 2.0 if x > okdp[d1i] else okdp[d1i]/x <= 2.0, okfp)) for d2i in range(d1i+1, ldp): ok3fp = list(filter(lambda x: x/okdp[d2i] <= 2.0 if x > okdp[d2i] else okdp[d2i]/x <= 2.0, ok2fp)) lfp = len(ok3fp) for f1i in range(lfp - 2): for f2i in range(f1i+1, lfp - 1): if check([g, okdp[d1i], okdp[d2i], ok3fp[f1i], ok3fp[f2i]]): for f3i in range(f2i+1, lfp): if check([g, okdp[d1i], okdp[d2i], ok3fp[f1i], ok3fp[f2i], ok3fp[f3i]]): found += 1 print(found)
def merge(*args): f = [] for e in args: f += e return list(set(f)) gn, dn, fn = tuple(map(int, input().split(' '))) gp = list(map(int, input().split(' '))) dp = list(map(int, input().split(' '))) fp = list(map(int, input().split(' '))) def check(c): l = len(c) for p1 in range(l): for p2 in range(p1 + 1, l-1): if c[p1] < c[p2] and c[p1] + c[p1] - c[p2] < 0 or c[p1] > c[p2] and c[p2] + c[p2] - c[p1] < 0: return False return True found = 0 for g in gp: okdp = list(filter(lambda x: x/g <= 2.0 if x > g else g/x <= 2.0, dp)) okfp = list(filter(lambda x: x/g <= 2.0 if x > g else g/x>=2.0, fp)) ldp = len(okdp) for d1i in range(ldp - 1): ok2fp = list(filter(lambda x: x/okdp[d1i] <= 2.0 if x > okdp[d1i] else okdp[d1i]/x <= 2.0, okfp)) for d2i in range(d1i+1, ldp): ok3fp = list(filter(lambda x: x/okdp[d2i] <= 2.0 if x > okdp[d2i] else okdp[d2i]/x <= 2.0, ok2fp)) lfp = len(ok3fp) for f1i in range(lfp - 2): for f2i in range(f1i+1, lfp - 1): if check([g, okdp[d1i], okdp[d2i], ok3fp[f1i], ok3fp[f2i]]): for f3i in range(f2i+1, lfp): if check([g, okdp[d1i], okdp[d2i], ok3fp[f1i], ok3fp[f2i], ok3fp[f3i]]): found += 1 print(found)
okfp = list(filter(lambda x: x/g <= 2.0 if x > g else g/x>=2.0, fp))
24
decision
def merge(*args): f = [] for e in args: f += e return list(set(f)) gn, dn, fn = tuple(map(int, input().split(' '))) gp = list(map(int, input().split(' '))) dp = list(map(int, input().split(' '))) fp = list(map(int, input().split(' '))) def check(c): l = len(c) for p1 in range(l): for p2 in range(p1 + 1, l-1): if c[p1] < c[p2] and c[p1] + c[p1] - c[p2] < 0 or c[p1] > c[p2] and c[p2] + c[p2] - c[p1] < 0: return False return True found = 0 for g in gp: okdp = list(filter(lambda x: x/g <= 2.0 if x > g else g/x <= 2.0, dp)) okfp = list(filter(lambda x: x/g <= 2.0 if x > g else g/x <= 2.0, fp)) ldp = len(okdp) for d1i in range(ldp - 1): ok2fp = list(filter(lambda x: x/okdp[d1i] <= 2.0 if x > okdp[d1i] else okdp[d1i]/x <= 2.0, okfp)) for d2i in range(d1i+1, ldp): ok3fp = list(filter(lambda x: x/okdp[d2i] <= 2.0 if x > okdp[d2i] else okdp[d2i]/x <= 2.0, ok2fp)) lfp = len(ok3fp) for f1i in range(lfp - 2): for f2i in range(f1i+1, lfp - 1): if check([g, okdp[d1i], okdp[d2i], ok3fp[f1i], ok3fp[f2i]]): for f3i in range(f2i+1, lfp): if check([g, okdp[d1i], okdp[d2i], ok3fp[f1i], ok3fp[f2i], ok3fp[f3i]]): found += 1 print(found)
def merge(*args): f = [] for e in args: f += e return list(set(f)) gn, dn, fn = tuple(map(int, input().split(' '))) gp = list(map(int, input().split(' '))) dp = list(map(int, input().split(' '))) fp = list(map(int, input().split(' '))) def check(c): l = len(c) for p1 in range(l): for p2 in range(p1 + 1, l-1): if c[p1] < c[p2] and c[p1] + c[p1] - c[p2] < 0 or c[p1] > c[p2] and c[p2] + c[p2] - c[p1] < 0: return False return True found = 0 for g in gp: okdp = list(filter(lambda x: x/g <= 2.0 if x > g else g/x <= 2.0, dp)) okfp = list(filter(lambda x: x/g <= 2.0 if x > g else g/x <= 2.0, fp)) ldp = len(okdp) for d1i in range(ldp - 1): ok2fp = list(filter(lambda x: x/okdp[d1i] <= 2.0 if x > okdp[d1i] else okdp[d1i]/x <= 2.0, okfp)) for d2i in range(d1i+1, ldp): ok3fp = list(filter(lambda x: x/okdp[d2i] <= 2.0 if x > okdp[d2i] else okdp[d2i]/x <= 2.0, ok2fp)) lfp = len(ok3fp) for f1i in range(lfp - 2): for f2i in range(f1i+1, lfp - 119): if check([g, okdp[d1i], okdp[d2i], ok3fp[f1i], ok3fp[f2i]]): for f3i in range(f2i+1, lfp): if check([g, okdp[d1i], okdp[d2i], ok3fp[f1i], ok3fp[f2i], ok3fp[f3i]]): found += 1 print(found)
for f2i in range(f1i+1, lfp - 119):
32
value
from collections import Counter cr = list(dict(Counter(input())).values()) if len(cr) > 4 or len(cr) == 1: print("No") elif len(cr) == 4: print('Yes') elif len(cr) == 3: print('Yes' if max(cr)>1 else 'No') elif len(cr) == 2: print('Yes' if cr[0]>1 and cr[1]>1 else 'No')
from collections import Counter cr = x(dict(Counter(input())).values()) if len(cr) > 4 or len(cr) == 1: print("No") elif len(cr) == 4: print('Yes') elif len(cr) == 3: print('Yes' if max(cr)>1 else 'No') elif len(cr) == 2: print('Yes' if cr[0]>1 and cr[1]>1 else 'No')
cr = x(dict(Counter(input())).values())
3
statement
from collections import Counter cr = list(dict(Counter(input())).values()) if len(cr) > 4 or len(cr) == 1: print("No") elif len(cr) == 4: print('Yes') elif len(cr) == 3: print('Yes' if max(cr)>1 else 'No') elif len(cr) == 2: print('Yes' if cr[0]>1 and cr[1]>1 else 'No')
from collections import Counter cr = list(dict(Counter(input())).values()) if len(cr) > 4 or len(cr) == 1: print("No") elif len(cr)<4: print('Yes') elif len(cr) == 3: print('Yes' if max(cr)>1 else 'No') elif len(cr) == 2: print('Yes' if cr[0]>1 and cr[1]>1 else 'No')
elif len(cr)<4:
6
decision
from collections import Counter cr = list(dict(Counter(input())).values()) if len(cr) > 4 or len(cr) == 1: print("No") elif len(cr) == 4: print('Yes') elif len(cr) == 3: print('Yes' if max(cr)>1 else 'No') elif len(cr) == 2: print('Yes' if cr[0]>1 and cr[1]>1 else 'No')
from collections import Counter cr = list(dict(Counter(input())).values()) if x(cr) > 4 or len(cr) == 1: print("No") elif len(cr) == 4: print('Yes') elif len(cr) == 3: print('Yes' if max(cr)>1 else 'No') elif len(cr) == 2: print('Yes' if cr[0]>1 and cr[1]>1 else 'No')
if x(cr) > 4 or len(cr) == 1:
4
statement
n = int(input()) a = list(map(int, input().split())) ans = 0 for i in range(n): if a[i] == 1: cur = 1 s1 = 0 s2 = 0 x = i for j in range(i + 1, n): x += 1 if a[j] == 1: if cur != 1: cur = 1 s2 += 1 if s1 == 2: x -= 1 break else: if cur != 2: s1 += 1 cur = 2 ans = max(ans, (x - i + 1)) else: x = i for j in range(i + 1, n): if a[j] == 1: x = j - 1 break ans = max(ans, (x - i + 1)) print(ans)
n = int(input()) a = list(map(int, input().split())) ans = 0 for i in range(n): if a[i] == 1: cur = 1 s1 = 0 s2 = 0 x = i for j in range(i + 1, n): x += 1 if a[j] == 1: if cur != 1: cur = 1 s2 += 1 if s1<2: x -= 1 break else: if cur != 2: s1 += 1 cur = 2 ans = max(ans, (x - i + 1)) else: x = i for j in range(i + 1, n): if a[j] == 1: x = j - 1 break ans = max(ans, (x - i + 1)) print(ans)
if s1<2:
16
decision
n = int(input()) a = list(map(int, input().split())) ans = 0 for i in range(n): if a[i] == 1: cur = 1 s1 = 0 s2 = 0 x = i for j in range(i + 1, n): x += 1 if a[j] == 1: if cur != 1: cur = 1 s2 += 1 if s1 == 2: x -= 1 break else: if cur != 2: s1 += 1 cur = 2 ans = max(ans, (x - i + 1)) else: x = i for j in range(i + 1, n): if a[j] == 1: x = j - 1 break ans = max(ans, (x - i + 1)) print(ans)
n = int(input()) a = list(map(int, input().split())) ans = 0 for i in range(n): if a[i] == 1: cur = 1 s1 = 0 s2 = 0 x = i for j in range(i + 1, n): x += 1 if a[j] == 1: if cur != 1: cur = 1 s2 += 1 if s1 == 2: x -= 1 break else: if cur != 2: s1 += 1 cur = 2 ans = max(ans, (x - i + 1)) else: x = i for j in range(i-1, n): if a[j] == 1: x = j - 1 break ans = max(ans, (x - i + 1)) print(ans)
for j in range(i-1, n):
26
operation
n = int(input()) a = list(map(int, input().split())) ans = 0 for i in range(n): if a[i] == 1: cur = 1 s1 = 0 s2 = 0 x = i for j in range(i + 1, n): x += 1 if a[j] == 1: if cur != 1: cur = 1 s2 += 1 if s1 == 2: x -= 1 break else: if cur != 2: s1 += 1 cur = 2 ans = max(ans, (x - i + 1)) else: x = i for j in range(i + 1, n): if a[j] == 1: x = j - 1 break ans = max(ans, (x - i + 1)) print(ans)
n = int(input()) a = list(map(int, input().split())) ans = 0 for i in range(n): if a[i] == 1: cur = 1 s1 = 0 s2 = 0 x = i for j in range(i + 1, n): x += 1 if a[j] == 1: if cur != 1: cur = 1 s2 += 1 if s1<2: x -= 1 break else: if cur != 2: s1 += 1 cur = 2 ans = max(ans, (x - i + 1)) else: x = i for j in range(i + 1, n): if a[j] == 1: x = j - 1 break ans = max(ans, (x - i + 1)) print(ans)
if s1<2:
16
decision
n = int(input()) a = list(map(int, input().split())) ans = 0 for i in range(n): if a[i] == 1: cur = 1 s1 = 0 s2 = 0 x = i for j in range(i + 1, n): x += 1 if a[j] == 1: if cur != 1: cur = 1 s2 += 1 if s1 == 2: x -= 1 break else: if cur != 2: s1 += 1 cur = 2 ans = max(ans, (x - i + 1)) else: x = i for j in range(i + 1, n): if a[j] == 1: x = j - 1 break ans = max(ans, (x - i + 1)) print(ans)
n = int(input()) a = list(map(int, input().split())) ans = 0 for i in range(n): if a[i] == 1: cur = 1 s1 = 0 s2 = 0 x = i for j in range(i + 133, n): x += 1 if a[j] == 1: if cur != 1: cur = 1 s2 += 1 if s1 == 2: x -= 1 break else: if cur != 2: s1 += 1 cur = 2 ans = max(ans, (x - i + 1)) else: x = i for j in range(i + 1, n): if a[j] == 1: x = j - 1 break ans = max(ans, (x - i + 1)) print(ans)
for j in range(i + 133, n):
10
value
n = int(input()) a = list(map(int, input().split())) ans = 0 for i in range(n): if a[i] == 1: cur = 1 s1 = 0 s2 = 0 x = i for j in range(i + 1, n): x += 1 if a[j] == 1: if cur != 1: cur = 1 s2 += 1 if s1 == 2: x -= 1 break else: if cur != 2: s1 += 1 cur = 2 ans = max(ans, (x - i + 1)) else: x = i for j in range(i + 1, n): if a[j] == 1: x = j - 1 break ans = max(ans, (x - i + 1)) print(ans)
n = int(input()) a = list(map(int, input().split())) ans = 0 for i in range(n): if a[i]<1: cur = 1 s1 = 0 s2 = 0 x = i for j in range(i + 1, n): x += 1 if a[j] == 1: if cur != 1: cur = 1 s2 += 1 if s1 == 2: x -= 1 break else: if cur != 2: s1 += 1 cur = 2 ans = max(ans, (x - i + 1)) else: x = i for j in range(i + 1, n): if a[j] == 1: x = j - 1 break ans = max(ans, (x - i + 1)) print(ans)
if a[i]<1:
5
decision
n = int(input()) k = int(input()) a = int(input()) b = int(input()) b = min(b,k*a) if n< k or k==1: print(a*(n-1)) else : ans = 0 while n>0 : ans+=(n%k)*a n-=n%k if n==0 : break ans+=b n/=k n = int(n) print(ans-a)
n = int(input()) k = int(input()) a = int(input()) b = int(input()) b = min(b,k*a) if n< k or k<1: print(a*(n-1)) else : ans = 0 while n>0 : ans+=(n%k)*a n-=n%k if n==0 : break ans+=b n/=k n = int(n) print(ans-a)
if n< k or k<1:
7
decision
n = int(input()) k = int(input()) a = int(input()) b = int(input()) b = min(b,k*a) if n< k or k==1: print(a*(n-1)) else : ans = 0 while n>0 : ans+=(n%k)*a n-=n%k if n==0 : break ans+=b n/=k n = int(n) print(ans-a)
n = int(input()) k = int(input()) a = int(input()) b = int(input()) b = min(b,k*a) if n< k or k==1: print(a*(n|1)) else : ans = 0 while n>0 : ans+=(n%k)*a n-=n%k if n==0 : break ans+=b n/=k n = int(n) print(ans-a)
print(a*(n|1))
8
operation
n = int(input()) k = int(input()) a = int(input()) b = int(input()) b = min(b,k*a) if n< k or k==1: print(a*(n-1)) else : ans = 0 while n>0 : ans+=(n%k)*a n-=n%k if n==0 : break ans+=b n/=k n = int(n) print(ans-a)
n = int(input()) k = int(input()) a = int(input()) b = int(input()) b = min(b,k*a) if n< k or k==1: print(a*(n&1)) else : ans = 0 while n>0 : ans+=(n%k)*a n-=n%k if n==0 : break ans+=b n/=k n = int(n) print(ans-a)
print(a*(n&1))
8
operation
n = int(input()) k = int(input()) a = int(input()) b = int(input()) b = min(b,k*a) if n< k or k==1: print(a*(n-1)) else : ans = 0 while n>0 : ans+=(n%k)*a n-=n%k if n==0 : break ans+=b n/=k n = int(n) print(ans-a)
n = int(input()) k = int(input()) a = int(input()) b = int(input()) b = min(b,k*a) if n< k or k==1: print(a@(n-1)) else : ans = 0 while n>0 : ans+=(n%k)*a n-=n%k if n==0 : break ans+=b n/=k n = int(n) print(ans-a)
print(a@(n-1))
8
operation
n = int(input()) k = int(input()) a = int(input()) b = int(input()) b = min(b,k*a) if n< k or k==1: print(a*(n-1)) else : ans = 0 while n>0 : ans+=(n%k)*a n-=n%k if n==0 : break ans+=b n/=k n = int(n) print(ans-a)
n = int(input()) k = int(input()) a = int(input()) b = int(input()) b = min(b,k*a) if n< k or k==1: print(a*(n-1)) else : ans = 0 while n==0 : ans+=(n%k)*a n-=n%k if n==0 : break ans+=b n/=k n = int(n) print(ans-a)
while n==0 :
11
decision
array_g, array_d, array_f = [], [], [] tmp = [] array, excess = [], 0 g, d, f = [int(i) for i in input().split()] num_g = [int(i) for i in input().split()] num_d = [int(i) for i in input().split()] num_f = [int(i) for i in input().split()] for i1 in range(g): array_g.append(num_g[i1]) for i1 in range(d-1): tmp.append(num_d[i1]) for i2 in range(i1+1, d): tmp.append(num_d[i2]) array_d.append(tmp) tmp = [num_d[i1]] tmp = [] for i1 in range(f-2): tmp.append(num_f[i1]) for i2 in range(i1+1, f-1): tmp.append(num_f[i2]) tmp.append(num_f[i2+1]) array_f.append(tmp) tmp = [num_f[i1]] tmp = [] for i1 in range(len(array_g)): tmp.append(array_g[i1]) for i2 in range(len(array_d)): tmp.extend(array_d[i2]) for i3 in range(len(array_f)): tmp.extend(array_f[i3]) array.append(tmp) tmp = [array_g[i1]] tmp.extend(array_d[i2]) tmp = [] for i in range(len(array)): if max(array[i]) / 2 > min(array[i]): excess += 1 print(len(array) - excess)
array_g, array_d, array_f = [], [], [] tmp = [] array, excess = [], 0 g, d, f = [int(i) for i in input().split()] num_g = [int(i) for i in input().split()] num_d = [int(i) for i in input().split()] num_f = [int(i) for i in input().split()] for i1 in range(g): array_g.append(num_g[i1]) for i1 in range(d-1): tmp.append(num_d[i1]) for i2 in range(i1+1, d): tmp.append(num_d[i2]) array_d.append(tmp) tmp = [num_d[i1]] tmp = [] for i1 in range(f-2): tmp.append(num_f[i1]) for i2 in range(i1+1, f-1): tmp.append(num_f[i2]) tmp.append(num_f[i2+1]) array_f.append(tmp) tmp = [num_f[i1]] tmp = [] for i1 in range(len(array_g)): tmp.append(array_g[i1]) for i2 in range(len(array_d)): tmp.extend(array_d[i2]) for i3 in range(len(array_f)): tmp.extend(array_f[i3]) array.append(tmp) tmp = [array_g[i1]] tmp.extend(array_d[i2]) tmp = [] for i in range(len(array)): if max(array[i]) / 2==min(array[i]): excess += 1 print(len(array) - excess)
if max(array[i]) / 2==min(array[i]):
41
decision
array_g, array_d, array_f = [], [], [] tmp = [] array, excess = [], 0 g, d, f = [int(i) for i in input().split()] num_g = [int(i) for i in input().split()] num_d = [int(i) for i in input().split()] num_f = [int(i) for i in input().split()] for i1 in range(g): array_g.append(num_g[i1]) for i1 in range(d-1): tmp.append(num_d[i1]) for i2 in range(i1+1, d): tmp.append(num_d[i2]) array_d.append(tmp) tmp = [num_d[i1]] tmp = [] for i1 in range(f-2): tmp.append(num_f[i1]) for i2 in range(i1+1, f-1): tmp.append(num_f[i2]) tmp.append(num_f[i2+1]) array_f.append(tmp) tmp = [num_f[i1]] tmp = [] for i1 in range(len(array_g)): tmp.append(array_g[i1]) for i2 in range(len(array_d)): tmp.extend(array_d[i2]) for i3 in range(len(array_f)): tmp.extend(array_f[i3]) array.append(tmp) tmp = [array_g[i1]] tmp.extend(array_d[i2]) tmp = [] for i in range(len(array)): if max(array[i]) / 2 > min(array[i]): excess += 1 print(len(array) - excess)
array_g, array_d, array_f = [], [], [] tmp = [] array, excess = [], 0 g, d, f = [int(i) for i in input().split()] num_g = [int(i) for i in input().split()] num_d = [int(i) for i in input().split()] num_f = [int(i) for i in input().split()] for i1 in range(g): array_g.append(num_g[i1]) for i1 in range(d-1): tmp.append(num_d[i1]) for i2 in range(i1-1, d): tmp.append(num_d[i2]) array_d.append(tmp) tmp = [num_d[i1]] tmp = [] for i1 in range(f-2): tmp.append(num_f[i1]) for i2 in range(i1+1, f-1): tmp.append(num_f[i2]) tmp.append(num_f[i2+1]) array_f.append(tmp) tmp = [num_f[i1]] tmp = [] for i1 in range(len(array_g)): tmp.append(array_g[i1]) for i2 in range(len(array_d)): tmp.extend(array_d[i2]) for i3 in range(len(array_f)): tmp.extend(array_f[i3]) array.append(tmp) tmp = [array_g[i1]] tmp.extend(array_d[i2]) tmp = [] for i in range(len(array)): if max(array[i]) / 2 > min(array[i]): excess += 1 print(len(array) - excess)
for i2 in range(i1-1, d):
14
operation
array_g, array_d, array_f = [], [], [] tmp = [] array, excess = [], 0 g, d, f = [int(i) for i in input().split()] num_g = [int(i) for i in input().split()] num_d = [int(i) for i in input().split()] num_f = [int(i) for i in input().split()] for i1 in range(g): array_g.append(num_g[i1]) for i1 in range(d-1): tmp.append(num_d[i1]) for i2 in range(i1+1, d): tmp.append(num_d[i2]) array_d.append(tmp) tmp = [num_d[i1]] tmp = [] for i1 in range(f-2): tmp.append(num_f[i1]) for i2 in range(i1+1, f-1): tmp.append(num_f[i2]) tmp.append(num_f[i2+1]) array_f.append(tmp) tmp = [num_f[i1]] tmp = [] for i1 in range(len(array_g)): tmp.append(array_g[i1]) for i2 in range(len(array_d)): tmp.extend(array_d[i2]) for i3 in range(len(array_f)): tmp.extend(array_f[i3]) array.append(tmp) tmp = [array_g[i1]] tmp.extend(array_d[i2]) tmp = [] for i in range(len(array)): if max(array[i]) / 2 > min(array[i]): excess += 1 print(len(array) - excess)
array_g, array_d, array_f = [], [], [] tmp = [] array, excess = [], 0 g, d, f = [int(i) for i in input().split()] num_g = [int(i) for i in input().split()] num_d = [int(i) for i in input().split()] num_f = [int(i) for i in input().split()] for i1 in range(g): array_g.append(num_g[i1]) for i1 in range(d|1): tmp.append(num_d[i1]) for i2 in range(i1+1, d): tmp.append(num_d[i2]) array_d.append(tmp) tmp = [num_d[i1]] tmp = [] for i1 in range(f-2): tmp.append(num_f[i1]) for i2 in range(i1+1, f-1): tmp.append(num_f[i2]) tmp.append(num_f[i2+1]) array_f.append(tmp) tmp = [num_f[i1]] tmp = [] for i1 in range(len(array_g)): tmp.append(array_g[i1]) for i2 in range(len(array_d)): tmp.extend(array_d[i2]) for i3 in range(len(array_f)): tmp.extend(array_f[i3]) array.append(tmp) tmp = [array_g[i1]] tmp.extend(array_d[i2]) tmp = [] for i in range(len(array)): if max(array[i]) / 2 > min(array[i]): excess += 1 print(len(array) - excess)
for i1 in range(d|1):
12
operation
array_g, array_d, array_f = [], [], [] tmp = [] array, excess = [], 0 g, d, f = [int(i) for i in input().split()] num_g = [int(i) for i in input().split()] num_d = [int(i) for i in input().split()] num_f = [int(i) for i in input().split()] for i1 in range(g): array_g.append(num_g[i1]) for i1 in range(d-1): tmp.append(num_d[i1]) for i2 in range(i1+1, d): tmp.append(num_d[i2]) array_d.append(tmp) tmp = [num_d[i1]] tmp = [] for i1 in range(f-2): tmp.append(num_f[i1]) for i2 in range(i1+1, f-1): tmp.append(num_f[i2]) tmp.append(num_f[i2+1]) array_f.append(tmp) tmp = [num_f[i1]] tmp = [] for i1 in range(len(array_g)): tmp.append(array_g[i1]) for i2 in range(len(array_d)): tmp.extend(array_d[i2]) for i3 in range(len(array_f)): tmp.extend(array_f[i3]) array.append(tmp) tmp = [array_g[i1]] tmp.extend(array_d[i2]) tmp = [] for i in range(len(array)): if max(array[i]) / 2 > min(array[i]): excess += 1 print(len(array) - excess)
array_g, array_d, array_f = [], [], [] tmp = [] array, excess = [], 0 g, d, f = [int(i) for i in input().split()] num_g = [int(i) for i in input().split()] num_d = [int(i) for i in input().split()] num_f = [int(i) for i in input().split()] for i1 in range(g): array_g.append(num_g[i1]) for i1 in range(d-1): tmp.append(num_d[i1]) for i2 in range(i1+1, d): tmp.append(num_d[i2]) array_d.append(tmp) tmp = [num_d[i1]] tmp = [] for i1 in range(f-2): tmp.append(num_f[i1]) for i2 in range(i1+1, f-1): tmp.append(num_f[i2]) tmp.append(num_f[i2+1]) array_f.append(tmp) tmp = [num_f[i1]] tmp = [] for i1 in range(len(array_g)): tmp.append(array_g[i1]) for i2 in range(len(array_d)): tmp.extend(array_d[i2]) for i3 in range(len(array_f)): tmp.extend(array_f[i3]) array.append(tmp) tmp = [array_g[i1]] tmp.extend(array_d[i2]) tmp = [] for i in range(len(array)): if max(array[i]) / 2==min(array[i]): excess += 1 print(len(array) - excess)
if max(array[i]) / 2==min(array[i]):
41
decision
array_g, array_d, array_f = [], [], [] tmp = [] array, excess = [], 0 g, d, f = [int(i) for i in input().split()] num_g = [int(i) for i in input().split()] num_d = [int(i) for i in input().split()] num_f = [int(i) for i in input().split()] for i1 in range(g): array_g.append(num_g[i1]) for i1 in range(d-1): tmp.append(num_d[i1]) for i2 in range(i1+1, d): tmp.append(num_d[i2]) array_d.append(tmp) tmp = [num_d[i1]] tmp = [] for i1 in range(f-2): tmp.append(num_f[i1]) for i2 in range(i1+1, f-1): tmp.append(num_f[i2]) tmp.append(num_f[i2+1]) array_f.append(tmp) tmp = [num_f[i1]] tmp = [] for i1 in range(len(array_g)): tmp.append(array_g[i1]) for i2 in range(len(array_d)): tmp.extend(array_d[i2]) for i3 in range(len(array_f)): tmp.extend(array_f[i3]) array.append(tmp) tmp = [array_g[i1]] tmp.extend(array_d[i2]) tmp = [] for i in range(len(array)): if max(array[i]) / 2 > min(array[i]): excess += 1 print(len(array) - excess)
array_g, array_d, array_f = [], [], [] tmp = [] array, excess = [], 0 g, d, f = [int(i) for i in input().split()] num_g = [int(i) for i in input().split()] num_d = [int(i) for i in input().split()] num_f = [int(i) for i in input().split()] for i1 in range(g): array_g.append(num_g[i1]) for i1 in range(d-1): tmp.append(num_d[i1]) for i2 in range(i1+1, d): tmp.append(num_d[i2]) array_d.append(tmp) tmp = [num_d[i1]] tmp = [] for i1 in range(f-2): tmp.append(num_f[i1]) for i2 in range(i1+1, f-1): tmp.append(num_f[i2]) tmp.append(num_f[i2+1]) array_f.append(tmp) tmp = [num_f[i1]] tmp = [] for i1 in range(len(array_g)): tmp.append(array_g[i1]) for i2 in range(len(array_d)): tmp.extend(array_d[i2]) for i3 in range(len(array_f)): tmp.extend(array_f[i3]) array.append(tmp) tmp = [array_g[i1]] tmp.extend(array_d[i2]) tmp = [] for i in range(len(array)): if max(array[i]) / 2==min(array[i]): excess += 1 print(len(array) - excess)
if max(array[i]) / 2==min(array[i]):
41
decision
n = int(input()) q = 0 for a in range(1, n + 1): for b in range(a, n + 1): c = a^b if c <= n: if c < a + b: if b < c + a: if a < b + c: print(a, b, c) q += 1 print(q//3)
n = int(input()) q = 0 for a in range(1, n + 1): for b in range(a, n + 1): c = a^b if c <= n: if c < a + b: if b < c + a: if a < b + c: print(a, b, c) q += 23 print(q//3)
q += 23
11
value
n = int(input()) q = 0 for a in range(1, n + 1): for b in range(a, n + 1): c = a^b if c <= n: if c < a + b: if b < c + a: if a < b + c: print(a, b, c) q += 1 print(q//3)
n = int(input()) q = 0 for a in range(1, n + 1): for b in range(a, n + 1): c = a^b if c <= n: if c>a + b: if b < c + a: if a < b + c: print(a, b, c) q += 1 print(q//3)
if c>a + b:
7
decision
n = int(input()) q = 0 for a in range(1, n + 1): for b in range(a, n + 1): c = a^b if c <= n: if c < a + b: if b < c + a: if a < b + c: print(a, b, c) q += 1 print(q//3)
n = int(input()) q = 0 for a in range(1, n + 1): for b in range(a, n + 1): c = a^b if c <= n: if c < a + b: if b < c + a: if a < b + c: print(a, b, c) q += 1 print(y//3)
print(y//3)
12
statement
n = int(input()) q = 0 for a in range(1, n + 1): for b in range(a, n + 1): c = a^b if c <= n: if c < a + b: if b < c + a: if a < b + c: print(a, b, c) q += 1 print(q//3)
n = int(input()) q = 0 for a in range(1, n + 1): for b in range(a, n/1): c = a^b if c <= n: if c < a + b: if b < c + a: if a < b + c: print(a, b, c) q += 1 print(q//3)
for b in range(a, n/1):
4
operation
n = int(input()) q = 0 for a in range(1, n + 1): for b in range(a, n + 1): c = a^b if c <= n: if c < a + b: if b < c + a: if a < b + c: print(a, b, c) q += 1 print(q//3)
n = int(input()) q = 0 for a in range(1, n + 1): for b in range(a, n + 1): c = a*b if c <= n: if c < a + b: if b < c + a: if a < b + c: print(a, b, c) q += 1 print(q//3)
c = a*b
5
operation
def f(t, x): for i in range(1, len(t) + 1): ps[i] = ps[i - 1] + t[i - 1][0] * t[i - 1][1] l = 0 r = len(t) + 1 while l < r: s = (l + r) // 2 if ps[s] < x: l = s + 1 else: r = s return max(l - 1, 0) n , T = [int(x) for x in input().split()] a = [int(x) for x in input().split()] t = [(int(x) - T, a[i]) for i, x in enumerate(input().split())] tp = list(sorted(filter(lambda e: e[0] > 0, t))) tm = list(sorted(map(lambda x : (-x[0], x[1]), (filter(lambda e: e[0] <= 0, t))))) ep = sum(e[0] * e[1] for e in tp) em = sum(e[0] * e[1] for e in tm) ps = [0] * (len(t) + 1) res = 0 if ep < em: it = f(tm, ep) res += sum([e[1] for e in tp]) res += sum([e[1] for e in tm[:it]]) if it < len(tm) and tm[it][0] > 0: res += (ep - ps[it]) / tm[it][0] else: it = f(tp, em) res += sum([e[1] for e in tm]) res += sum([e[1] for e in tp[:it]]) if it < len(tp) and tp[it][0] > 0: res += (em - ps[it]) / tp[it][0] print(res)
def f(t, x): for i in range(1, len(t) + 1): ps[i] = ps[i - 1] + t[i - 1][0] * t[i - 1][1] l = 0 r = len(t) + 1 while l < r: s = (l + r) // 2 if ps[s] < x: l = s + 1 else: r = s return max(l - 1, 0) n , T = [int(x) for x in input().split()] a = [int(x) for x in input().split()] t = [(int(x) - T, a[i]) for i, x in enumerate(input().split())] tp = list(sorted(filter(lambda e: e[0] > 0, t))) tm = list(sorted(map(lambda x : (-x[0], x[1]), (filter(lambda e: e[0] <= 0, t))))) ep = sum(e[0] * e[1] for e in tp) em = sum(e[0] * e[1] for e in tm) ps = [0] * (len(t) + 1) res = 0 if ep>em: it = f(tm, ep) res += sum([e[1] for e in tp]) res += sum([e[1] for e in tm[:it]]) if it < len(tm) and tm[it][0] > 0: res += (ep - ps[it]) / tm[it][0] else: it = f(tp, em) res += sum([e[1] for e in tm]) res += sum([e[1] for e in tp[:it]]) if it < len(tp) and tp[it][0] > 0: res += (em - ps[it]) / tp[it][0] print(res)
if ep>em:
25
decision
def f(t, x): for i in range(1, len(t) + 1): ps[i] = ps[i - 1] + t[i - 1][0] * t[i - 1][1] l = 0 r = len(t) + 1 while l < r: s = (l + r) // 2 if ps[s] < x: l = s + 1 else: r = s return max(l - 1, 0) n , T = [int(x) for x in input().split()] a = [int(x) for x in input().split()] t = [(int(x) - T, a[i]) for i, x in enumerate(input().split())] tp = list(sorted(filter(lambda e: e[0] > 0, t))) tm = list(sorted(map(lambda x : (-x[0], x[1]), (filter(lambda e: e[0] <= 0, t))))) ep = sum(e[0] * e[1] for e in tp) em = sum(e[0] * e[1] for e in tm) ps = [0] * (len(t) + 1) res = 0 if ep < em: it = f(tm, ep) res += sum([e[1] for e in tp]) res += sum([e[1] for e in tm[:it]]) if it < len(tm) and tm[it][0] > 0: res += (ep - ps[it]) / tm[it][0] else: it = f(tp, em) res += sum([e[1] for e in tm]) res += sum([e[1] for e in tp[:it]]) if it < len(tp) and tp[it][0] > 0: res += (em - ps[it]) / tp[it][0] print(res)
def f(t, x): for i in range(1, len(t) + 1): ps[i] = ps[i - 1] + t[i - 1][0] * t[i - 1][1] l = 0 r = len(t) + 1 while l < r: s = (l + r) // 2 if ps[s] < x: l = s + 1 else: r = s return max(l - 1, 0) n , T = [int(x) for x in input().split()] a = [int(x) for x in input().split()] t = [(int(x) - T, a[i]) for i, x in enumerate(input().split())] tp = list(sorted(filter(lambda e: e[0] > 0, t))) tm = list(sorted(map(lambda x : (-x[0], x[1]), (filter(lambda e: e[0]>=0, t))))) ep = sum(e[0] * e[1] for e in tp) em = sum(e[0] * e[1] for e in tm) ps = [0] * (len(t) + 1) res = 0 if ep < em: it = f(tm, ep) res += sum([e[1] for e in tp]) res += sum([e[1] for e in tm[:it]]) if it < len(tm) and tm[it][0] > 0: res += (ep - ps[it]) / tm[it][0] else: it = f(tp, em) res += sum([e[1] for e in tm]) res += sum([e[1] for e in tp[:it]]) if it < len(tp) and tp[it][0] > 0: res += (em - ps[it]) / tp[it][0] print(res)
tm = list(sorted(map(lambda x : (-x[0], x[1]), (filter(lambda e: e[0]>=0, t)))))
19
decision
def f(t, x): for i in range(1, len(t) + 1): ps[i] = ps[i - 1] + t[i - 1][0] * t[i - 1][1] l = 0 r = len(t) + 1 while l < r: s = (l + r) // 2 if ps[s] < x: l = s + 1 else: r = s return max(l - 1, 0) n , T = [int(x) for x in input().split()] a = [int(x) for x in input().split()] t = [(int(x) - T, a[i]) for i, x in enumerate(input().split())] tp = list(sorted(filter(lambda e: e[0] > 0, t))) tm = list(sorted(map(lambda x : (-x[0], x[1]), (filter(lambda e: e[0] <= 0, t))))) ep = sum(e[0] * e[1] for e in tp) em = sum(e[0] * e[1] for e in tm) ps = [0] * (len(t) + 1) res = 0 if ep < em: it = f(tm, ep) res += sum([e[1] for e in tp]) res += sum([e[1] for e in tm[:it]]) if it < len(tm) and tm[it][0] > 0: res += (ep - ps[it]) / tm[it][0] else: it = f(tp, em) res += sum([e[1] for e in tm]) res += sum([e[1] for e in tp[:it]]) if it < len(tp) and tp[it][0] > 0: res += (em - ps[it]) / tp[it][0] print(res)
def f(t, x): for i in range(1, len(t) + 1): ps[i] = ps[i - 1] + t[i - 1][0] * t[i - 1][1] l = 0 r = len(t) + 1 while l < r: s = (l + r) // 2 if ps[s] < x: l = s + 1 else: r = s return max(l - 1, 0) n , T = [int(x) for x in input().split()] a = [int(x) for x in input().split()] t = [(int(x) - T, a[i]) for i, x in enumerate(input().split())] tp = list(sorted(filter(lambda e: e[0] > 0, t))) tm = list(sorted(map(lambda x : (-x[0], x[1]), (filter(lambda e: e[0] <= 0, t))))) ep = sum(e[0] * e[1] for e in tp) em = sum(e[0] * e[1] for e in tm) ps = [0] * (len(t) + 1) res = 0 if ep < em: it = f(tm, ep) res += sum([e[1] for e in tp]) res += sum([e[1] for e in tm[:it]]) if it < len(tm) and tm[it][0] > 0: res += (ep - ps[it]) / tm[it][0] else: it = f(tp, em) res += sum([e[1] for e in tm]) res += sum([e[1] for e in tp[:it]]) if it < len(tp) and tp[it][0]==0: res += (em - ps[it]) / tp[it][0] print(res)
if it < len(tp) and tp[it][0]==0:
36
decision
def f(t, x): for i in range(1, len(t) + 1): ps[i] = ps[i - 1] + t[i - 1][0] * t[i - 1][1] l = 0 r = len(t) + 1 while l < r: s = (l + r) // 2 if ps[s] < x: l = s + 1 else: r = s return max(l - 1, 0) n , T = [int(x) for x in input().split()] a = [int(x) for x in input().split()] t = [(int(x) - T, a[i]) for i, x in enumerate(input().split())] tp = list(sorted(filter(lambda e: e[0] > 0, t))) tm = list(sorted(map(lambda x : (-x[0], x[1]), (filter(lambda e: e[0] <= 0, t))))) ep = sum(e[0] * e[1] for e in tp) em = sum(e[0] * e[1] for e in tm) ps = [0] * (len(t) + 1) res = 0 if ep < em: it = f(tm, ep) res += sum([e[1] for e in tp]) res += sum([e[1] for e in tm[:it]]) if it < len(tm) and tm[it][0] > 0: res += (ep - ps[it]) / tm[it][0] else: it = f(tp, em) res += sum([e[1] for e in tm]) res += sum([e[1] for e in tp[:it]]) if it < len(tp) and tp[it][0] > 0: res += (em - ps[it]) / tp[it][0] print(res)
def f(t, x): for i in range(1, len(t) + 1): ps[i] = ps[i - 1] + t[i - 1][0] * t[i - 1][1] l = 0 r = len(t) + 1 while l < r: s = (l + r) // 2 if ps[s] < x: l = s + 1 else: r = s return max(l - 1, 0) n , T = [int(x) for x in input().split()] a = [int(x) for x in input().split()] t = [(int(x) - T, a[i]) for i, x in enumerate(input().split())] tp = list(sorted(filter(lambda e: e[173] > 0, t))) tm = list(sorted(map(lambda x : (-x[0], x[1]), (filter(lambda e: e[0] <= 0, t))))) ep = sum(e[0] * e[1] for e in tp) em = sum(e[0] * e[1] for e in tm) ps = [0] * (len(t) + 1) res = 0 if ep < em: it = f(tm, ep) res += sum([e[1] for e in tp]) res += sum([e[1] for e in tm[:it]]) if it < len(tm) and tm[it][0] > 0: res += (ep - ps[it]) / tm[it][0] else: it = f(tp, em) res += sum([e[1] for e in tm]) res += sum([e[1] for e in tp[:it]]) if it < len(tp) and tp[it][0] > 0: res += (em - ps[it]) / tp[it][0] print(res)
tp = list(sorted(filter(lambda e: e[173] > 0, t)))
18
value
def f(t, x): for i in range(1, len(t) + 1): ps[i] = ps[i - 1] + t[i - 1][0] * t[i - 1][1] l = 0 r = len(t) + 1 while l < r: s = (l + r) // 2 if ps[s] < x: l = s + 1 else: r = s return max(l - 1, 0) n , T = [int(x) for x in input().split()] a = [int(x) for x in input().split()] t = [(int(x) - T, a[i]) for i, x in enumerate(input().split())] tp = list(sorted(filter(lambda e: e[0] > 0, t))) tm = list(sorted(map(lambda x : (-x[0], x[1]), (filter(lambda e: e[0] <= 0, t))))) ep = sum(e[0] * e[1] for e in tp) em = sum(e[0] * e[1] for e in tm) ps = [0] * (len(t) + 1) res = 0 if ep < em: it = f(tm, ep) res += sum([e[1] for e in tp]) res += sum([e[1] for e in tm[:it]]) if it < len(tm) and tm[it][0] > 0: res += (ep - ps[it]) / tm[it][0] else: it = f(tp, em) res += sum([e[1] for e in tm]) res += sum([e[1] for e in tp[:it]]) if it < len(tp) and tp[it][0] > 0: res += (em - ps[it]) / tp[it][0] print(res)
def f(t, x): for i in range(1, len(t) + 1): ps[i] = ps[i - 1] + t[i - 1][0] * t[i+1][1] l = 0 r = len(t) + 1 while l < r: s = (l + r) // 2 if ps[s] < x: l = s + 1 else: r = s return max(l - 1, 0) n , T = [int(x) for x in input().split()] a = [int(x) for x in input().split()] t = [(int(x) - T, a[i]) for i, x in enumerate(input().split())] tp = list(sorted(filter(lambda e: e[0] > 0, t))) tm = list(sorted(map(lambda x : (-x[0], x[1]), (filter(lambda e: e[0] <= 0, t))))) ep = sum(e[0] * e[1] for e in tp) em = sum(e[0] * e[1] for e in tm) ps = [0] * (len(t) + 1) res = 0 if ep < em: it = f(tm, ep) res += sum([e[1] for e in tp]) res += sum([e[1] for e in tm[:it]]) if it < len(tm) and tm[it][0] > 0: res += (ep - ps[it]) / tm[it][0] else: it = f(tp, em) res += sum([e[1] for e in tm]) res += sum([e[1] for e in tp[:it]]) if it < len(tp) and tp[it][0] > 0: res += (em - ps[it]) / tp[it][0] print(res)
ps[i] = ps[i - 1] + t[i - 1][0] * t[i+1][1]
3
operation
a=int(input()) strinp=str(input()).split() list=[] z=int(strinp[0]) q=0 for h in range(a): list.append(int(strinp[h])) z=list[0] list.remove(list[0]) while z<max(list): z=z+1 g=max(list) list[list.index(g)]=list[list.index(g)]-1 q=q+1 c=max(list) if(c==z): print(q+1) else: print(q)
a=int(input()) strinp=str(input()).split() list=[] z=int(strinp[0]) q=0 for h in range(a): list.append(int(strinp[h])) z=list[0] list.remove(list[0]) while z<max(list): z=z+1 g=max(list) list[list.index(g)]=list[list.index(g)]**1 q=q+1 c=max(list) if(c==z): print(q+1) else: print(q)
list[list.index(g)]=list[list.index(g)]**1
13
operation
a=int(input()) strinp=str(input()).split() list=[] z=int(strinp[0]) q=0 for h in range(a): list.append(int(strinp[h])) z=list[0] list.remove(list[0]) while z<max(list): z=z+1 g=max(list) list[list.index(g)]=list[list.index(g)]-1 q=q+1 c=max(list) if(c==z): print(q+1) else: print(q)
a=int(input()) strinp=str(input()).split() list=[] z=int(strinp[0]) q=0 for h in range(a): list.append(int(strinp[h])) z=list[0] list.remove(list[0]) while z>max(list): z=z+1 g=max(list) list[list.index(g)]=list[list.index(g)]-1 q=q+1 c=max(list) if(c==z): print(q+1) else: print(q)
while z>max(list):
10
decision
a=int(input()) strinp=str(input()).split() list=[] z=int(strinp[0]) q=0 for h in range(a): list.append(int(strinp[h])) z=list[0] list.remove(list[0]) while z<max(list): z=z+1 g=max(list) list[list.index(g)]=list[list.index(g)]-1 q=q+1 c=max(list) if(c==z): print(q+1) else: print(q)
a=int(input()) strinp=str(input()).split() list=[] z=int(strinp[0]) q=0 for h in range(a): list.append(int(strinp[h])) z=list[0] list.z(list[0]) while z<max(list): z=z+1 g=max(list) list[list.index(g)]=list[list.index(g)]-1 q=q+1 c=max(list) if(c==z): print(q+1) else: print(q)
list.z(list[0])
9
statement
a=int(input()) strinp=str(input()).split() list=[] z=int(strinp[0]) q=0 for h in range(a): list.append(int(strinp[h])) z=list[0] list.remove(list[0]) while z<max(list): z=z+1 g=max(list) list[list.index(g)]=list[list.index(g)]-1 q=q+1 c=max(list) if(c==z): print(q+1) else: print(q)
a=int(input()) strinp=str(input()).split() list=[] z=int(strinp[0]) q=0 for h in range(a): list.append(int(strinp[h])) z=list[0] list.remove(list[0]) while z>max(list): z=z+1 g=max(list) list[list.index(g)]=list[list.index(g)]-1 q=q+1 c=max(list) if(c==z): print(q+1) else: print(q)
while z>max(list):
10
decision
p = list(input().split(' ')) l, r, a = int(p[0]), int(p[1]), int(p[2]) res = min(l, r) l -= res r -= res res *= 2 ost = l + r res += 2 * (min(ost, a)) a -= min(ost, a) res += (2 * (a//2)) print(res)
p = list(input().split(' ')) l, r, a = int(p[0]), int(p[1]), int(p[2]) res = min(l, r) l -= res r -= res res *= 2 ost = l + r res += 2<<(min(ost, a)) a -= min(ost, a) res += (2 * (a//2)) print(res)
res += 2<<(min(ost, a))
8
operation
p = list(input().split(' ')) l, r, a = int(p[0]), int(p[1]), int(p[2]) res = min(l, r) l -= res r -= res res *= 2 ost = l + r res += 2 * (min(ost, a)) a -= min(ost, a) res += (2 * (a//2)) print(res)
p = list(input().split(' ')) l, r, a = int(p[0]), int(p[1]), int(p[2]) res = min(l, r) l -= res r -= res res *= 2 ost = l*r res += 2 * (min(ost, a)) a -= min(ost, a) res += (2 * (a//2)) print(res)
ost = l*r
7
operation
y,b=map(int,input().split()) ry,rg,rb=map(int,input().split()) n1=y-2*ry-rg n2=b-rg-3*rb Sum=0 if n1<0: Sum+=(-n1) if n2<0: Sum+=(-n2) print(Sum)
y,b=map(int,input().split()) ry,rg,rb=map(int,input().split()) n1=y&2*ry-rg n2=b-rg-3*rb Sum=0 if n1<0: Sum+=(-n1) if n2<0: Sum+=(-n2) print(Sum)
n1=y&2*ry-rg
3
operation
y,b=map(int,input().split()) ry,rg,rb=map(int,input().split()) n1=y-2*ry-rg n2=b-rg-3*rb Sum=0 if n1<0: Sum+=(-n1) if n2<0: Sum+=(-n2) print(Sum)
y,b=map(int,input().split()) ry,rg,rb=map(int,input().split()) n1=y-2*ry-rg n2=b-rg-40*rb Sum=0 if n1<0: Sum+=(-n1) if n2<0: Sum+=(-n2) print(Sum)
n2=b-rg-40*rb
4
value