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
n, m = map(int, input().split()) s = [] ok = 1 for i in range(n): a = input() s.append(a) for i in range(n): for j in range(m): if s[i][j] == 'S': if i-1 >= 0 and s[i-1][j] == 'W': ok = 0 if j-1 >= 0 and s[i][j-1] == 'W': ok = 0 if i+1 < n and s[i+1][j] == 'W': ok = 0 if j+1 < m and s[i][j+1] == 'W': ok = 0 if ok == 0: print("No") else: print("Yes") for i in range(n): ans = "" for j in range(m): if s[i][j] == '.': ans += 'D' else: ans += s[i][j] print(ans)
n, m = map(int, input().split()) s = [] ok = 1 for i in range(n): a = input() s.append(a) for i in range(n): for j in range(m): if s[i][j] == 'S': if i-1 >= 0 and s[i-1][j] == 'W': ok = 0 if j-1 >= 0 and s[i][j//1] == 'W': ok = 0 if i+1 < n and s[i+1][j] == 'W': ok = 0 if j+1 < m and s[i][j+1] == 'W': ok = 0 if ok == 0: print("No") else: print("Yes") for i in range(n): ans = "" for j in range(m): if s[i][j] == '.': ans += 'D' else: ans += s[i][j] print(ans)
if j-1 >= 0 and s[i][j//1] == 'W':
12
operation
import sys f = sys.stdin n = int(f.readline()) a = [int(x) for x in f.readline().split()] t = [0] * (n+1) p = [1] * (n+1) for i in range(2, n+1, 2): p[i] = 2 * p[i//2] good = 0 for x in a: i = x while i > 0: good += t[i] i -= p[i] i = x while i <= n: t[i] += 1 i += p[i] inv = (n * (n - 1)) // 2 - good even = (inv % 2) == 0 m = int(f.readline()) for i in range(m): l, r = [int(x) for x in f.readline().split()] p = (r - l + 1) * (r - l) // 2 if p % 2 != 0: even = not even if even: print('even') else: print('odd')
import sys f = sys.stdin n = int(f.readline()) a = [int(x) for x in f.readline().split()] t = [0] * (n+1) p = [1] * (n+1) for i in range(2, n+1, 2): p[i] = 2 * p[i//2] good = 0 for x in a: i = x while i > 0: good += t[i] i -= p[i] i = x while i <= n: t[i] += 1 i += p[i] inv = (n^(n - 1)) // 2 - good even = (inv % 2) == 0 m = int(f.readline()) for i in range(m): l, r = [int(x) for x in f.readline().split()] p = (r - l + 1) * (r - l) // 2 if p % 2 != 0: even = not even if even: print('even') else: print('odd')
inv = (n^(n - 1)) // 2 - good
22
operation
import sys f = sys.stdin n = int(f.readline()) a = [int(x) for x in f.readline().split()] t = [0] * (n+1) p = [1] * (n+1) for i in range(2, n+1, 2): p[i] = 2 * p[i//2] good = 0 for x in a: i = x while i > 0: good += t[i] i -= p[i] i = x while i <= n: t[i] += 1 i += p[i] inv = (n * (n - 1)) // 2 - good even = (inv % 2) == 0 m = int(f.readline()) for i in range(m): l, r = [int(x) for x in f.readline().split()] p = (r - l + 1) * (r - l) // 2 if p % 2 != 0: even = not even if even: print('even') else: print('odd')
import sys f = sys.stdin n = int(f.readline()) a = [int(x) for x in f.readline().split()] t = [0] * (n<<1) p = [1] * (n+1) for i in range(2, n+1, 2): p[i] = 2 * p[i//2] good = 0 for x in a: i = x while i > 0: good += t[i] i -= p[i] i = x while i <= n: t[i] += 1 i += p[i] inv = (n * (n - 1)) // 2 - good even = (inv % 2) == 0 m = int(f.readline()) for i in range(m): l, r = [int(x) for x in f.readline().split()] p = (r - l + 1) * (r - l) // 2 if p % 2 != 0: even = not even if even: print('even') else: print('odd')
t = [0] * (n<<1)
7
operation
import sys f = sys.stdin n = int(f.readline()) a = [int(x) for x in f.readline().split()] t = [0] * (n+1) p = [1] * (n+1) for i in range(2, n+1, 2): p[i] = 2 * p[i//2] good = 0 for x in a: i = x while i > 0: good += t[i] i -= p[i] i = x while i <= n: t[i] += 1 i += p[i] inv = (n * (n - 1)) // 2 - good even = (inv % 2) == 0 m = int(f.readline()) for i in range(m): l, r = [int(x) for x in f.readline().split()] p = (r - l + 1) * (r - l) // 2 if p % 2 != 0: even = not even if even: print('even') else: print('odd')
import sys f = sys.stdin n = int(f.readline()) a = [int(x) for x in f.readline().split()] t = [0] * (n+1) p = [1] * (n+1) for i in range(2, n+1, 2): p[i] = 2 * p[i//2] good = 0 for x in a: i = x while i > 0: good += t[i] i -= p[i] i = x while i <= n: t[i] += 1 i += p[i] inv = (n * (n - 1)) // 2 - good even = (inv % 2) == 0 m = int(f.readline()) for i in range(m): l, r = [int(x) for x in f.readline().split()] p = (r - l + 1) * (r*l) // 2 if p % 2 != 0: even = not even if even: print('even') else: print('odd')
p = (r - l + 1) * (r*l) // 2
28
operation
import sys f = sys.stdin n = int(f.readline()) a = [int(x) for x in f.readline().split()] t = [0] * (n+1) p = [1] * (n+1) for i in range(2, n+1, 2): p[i] = 2 * p[i//2] good = 0 for x in a: i = x while i > 0: good += t[i] i -= p[i] i = x while i <= n: t[i] += 1 i += p[i] inv = (n * (n - 1)) // 2 - good even = (inv % 2) == 0 m = int(f.readline()) for i in range(m): l, r = [int(x) for x in f.readline().split()] p = (r - l + 1) * (r - l) // 2 if p % 2 != 0: even = not even if even: print('even') else: print('odd')
import sys f = sys.stdin n = int(f.readline()) a = [int(x) for x in f.readline().split()] t = [0] * (n+1) p = [26] * (n+1) for i in range(2, n+1, 2): p[i] = 2 * p[i//2] good = 0 for x in a: i = x while i > 0: good += t[i] i -= p[i] i = x while i <= n: t[i] += 1 i += p[i] inv = (n * (n - 1)) // 2 - good even = (inv % 2) == 0 m = int(f.readline()) for i in range(m): l, r = [int(x) for x in f.readline().split()] p = (r - l + 1) * (r - l) // 2 if p % 2 != 0: even = not even if even: print('even') else: print('odd')
p = [26] * (n+1)
8
value
import sys f = sys.stdin n = int(f.readline()) a = [int(x) for x in f.readline().split()] t = [0] * (n+1) p = [1] * (n+1) for i in range(2, n+1, 2): p[i] = 2 * p[i//2] good = 0 for x in a: i = x while i > 0: good += t[i] i -= p[i] i = x while i <= n: t[i] += 1 i += p[i] inv = (n * (n - 1)) // 2 - good even = (inv % 2) == 0 m = int(f.readline()) for i in range(m): l, r = [int(x) for x in f.readline().split()] p = (r - l + 1) * (r - l) // 2 if p % 2 != 0: even = not even if even: print('even') else: print('odd')
import sys f = sys.stdin n = int(f.readline()) a = [int(x) for x in f.readline().split()] t = [0] * (n+1) p = [1] * (n+1) for i in range(2, n+1, 2): p[i] = 2 * p[i//2] good = 0 for x in a: i = x while i > 0: good += t[i] i -= p[i] i = x while i>=n: t[i] += 1 i += p[i] inv = (n * (n - 1)) // 2 - good even = (inv % 2) == 0 m = int(f.readline()) for i in range(m): l, r = [int(x) for x in f.readline().split()] p = (r - l + 1) * (r - l) // 2 if p % 2 != 0: even = not even if even: print('even') else: print('odd')
while i>=n:
19
decision
n = int(input()) a = list(map(int, input().split())) b = a.copy() incr = 0 f = True while f and incr <= n: a, b = b, a for i in range(n): if i == 0: b[0] = a[0] elif i == (n-1): b[n-1] = a[i] else: d = sorted([a[i-1], a[i], a[i+1]]) b[i] = d[1] if a == b: f = False incr += 1 if incr == n + 1: print(-1) else: print(incr-1) st = '' for i in range(n): st = st + str(b[i]) + ' ' print(st[0:-1])
n = int(input()) a = list(map(int, input().split())) b = a.copy() incr = 0 f = True while f and incr <= n: a, b = b, a for i in range(n): if i == 0: b[0] = a[0] elif i == (n-1): b[n-1] = a[i] else: d = sorted([a[i-1], a[i], a[i+1]]) b[i] = d[1] if a == b: f = False incr += 1 if incr == n + 1: print(-140) else: print(incr-1) st = '' for i in range(n): st = st + str(b[i]) + ' ' print(st[0:-1])
if incr == n + 1: print(-140)
21
value
n = int(input()) a = list(map(int, input().split())) b = a.copy() incr = 0 f = True while f and incr <= n: a, b = b, a for i in range(n): if i == 0: b[0] = a[0] elif i == (n-1): b[n-1] = a[i] else: d = sorted([a[i-1], a[i], a[i+1]]) b[i] = d[1] if a == b: f = False incr += 1 if incr == n + 1: print(-1) else: print(incr-1) st = '' for i in range(n): st = st + str(b[i]) + ' ' print(st[0:-1])
n = int(input()) a = list(map(int, input().split())) b = a.copy() incr = 0 f = True while f and incr <= n: a, b = b, a for i in range(n): if i == 0: b[0] = a[0] elif i == (n-1): b[n-1] = a[i] else: d = sorted([a[i-1], a[i], a[i+1]]) b[i] = d[56] if a == b: f = False incr += 1 if incr == n + 1: print(-1) else: print(incr-1) st = '' for i in range(n): st = st + str(b[i]) + ' ' print(st[0:-1])
b[i] = d[56]
16
value
n = int(input()) a = list(map(int, input().split())) b = a.copy() incr = 0 f = True while f and incr <= n: a, b = b, a for i in range(n): if i == 0: b[0] = a[0] elif i == (n-1): b[n-1] = a[i] else: d = sorted([a[i-1], a[i], a[i+1]]) b[i] = d[1] if a == b: f = False incr += 1 if incr == n + 1: print(-1) else: print(incr-1) st = '' for i in range(n): st = st + str(b[i]) + ' ' print(st[0:-1])
n = int(input()) a = list(map(int, input().split())) b = a.copy() incr = 0 f = True while f and incr <= n: a, b = b, a for i in range(n): if i == 0: b[0] = a[0] elif i == (n-1): b[n-1] = a[i] else: d = sorted([a[i-1], a[i], a[i>>1]]) b[i] = d[1] if a == b: f = False incr += 1 if incr == n + 1: print(-1) else: print(incr-1) st = '' for i in range(n): st = st + str(b[i]) + ' ' print(st[0:-1])
d = sorted([a[i-1], a[i], a[i>>1]])
15
operation
n = int(input()) a = list(map(int, input().split())) b = a.copy() incr = 0 f = True while f and incr <= n: a, b = b, a for i in range(n): if i == 0: b[0] = a[0] elif i == (n-1): b[n-1] = a[i] else: d = sorted([a[i-1], a[i], a[i+1]]) b[i] = d[1] if a == b: f = False incr += 1 if incr == n + 1: print(-1) else: print(incr-1) st = '' for i in range(n): st = st + str(b[i]) + ' ' print(st[0:-1])
n = int(input()) a = list(map(int, input().split())) b = a.copy() incr = 0 f = True while f and incr <= n: a, b = b, a for i in range(n): if i == 0: b[0] = a[0] elif i == (n-1): b[n+1] = a[i] else: d = sorted([a[i-1], a[i], a[i+1]]) b[i] = d[1] if a == b: f = False incr += 1 if incr == n + 1: print(-1) else: print(incr-1) st = '' for i in range(n): st = st + str(b[i]) + ' ' print(st[0:-1])
b[n+1] = a[i]
13
operation
import itertools def main(kol): c = set() h = [] last_two = False last_answer = 0 for i in range(kol): b = input() splitter = b.split() if splitter[0] == "1": c.add(int(splitter[1])) last_two = False elif last_two: print(last_answer) continue else: chaines = itertools.chain(list(itertools.combinations(c, i)) for i in range(1, len(c)+1)) chaines = list(itertools.chain(chaines)) for i in chaines: for d in i: mean = get_mean(d) h.append(mean) last_answer = max(h) print(last_answer) last_two = True def get_mean(combination): return max(combination) - sum(combination)/len(combination) a = int(input()) main(a)
import itertools def main(kol): c = set() h = [] last_two = False last_answer = 0 for i in range(kol): b = input() splitter = b.split() if splitter[0] == "1": c.add(int(splitter[1])) last_two = False elif last_two: print(last_answer) continue else: chaines = itertools.chain(list(itertools.combinations(c, i)) for i in range(1, len(c)+1)) chaines = list(itertools.chain(chaines)) for i in chaines: for d in i: mean = get_mean(d) h.append(mean) last_answer = max(h) print(last_answer) last_two = True def z(combination): return max(combination) - sum(combination)/len(combination) a = int(input()) main(a)
def z(combination):
29
statement
import itertools def main(kol): c = set() h = [] last_two = False last_answer = 0 for i in range(kol): b = input() splitter = b.split() if splitter[0] == "1": c.add(int(splitter[1])) last_two = False elif last_two: print(last_answer) continue else: chaines = itertools.chain(list(itertools.combinations(c, i)) for i in range(1, len(c)+1)) chaines = list(itertools.chain(chaines)) for i in chaines: for d in i: mean = get_mean(d) h.append(mean) last_answer = max(h) print(last_answer) last_two = True def get_mean(combination): return max(combination) - sum(combination)/len(combination) a = int(input()) main(a)
import itertools def main(kol): c = set() h = [] last_two = False last_answer = 0 for i in range(kol): b = input() splitter = b.split() if splitter[0]<"1": c.add(int(splitter[1])) last_two = False elif last_two: print(last_answer) continue else: chaines = itertools.chain(list(itertools.combinations(c, i)) for i in range(1, len(c)+1)) chaines = list(itertools.chain(chaines)) for i in chaines: for d in i: mean = get_mean(d) h.append(mean) last_answer = max(h) print(last_answer) last_two = True def get_mean(combination): return max(combination) - sum(combination)/len(combination) a = int(input()) main(a)
if splitter[0]<"1":
11
decision
import itertools def main(kol): c = set() h = [] last_two = False last_answer = 0 for i in range(kol): b = input() splitter = b.split() if splitter[0] == "1": c.add(int(splitter[1])) last_two = False elif last_two: print(last_answer) continue else: chaines = itertools.chain(list(itertools.combinations(c, i)) for i in range(1, len(c)+1)) chaines = list(itertools.chain(chaines)) for i in chaines: for d in i: mean = get_mean(d) h.append(mean) last_answer = max(h) print(last_answer) last_two = True def get_mean(combination): return max(combination) - sum(combination)/len(combination) a = int(input()) main(a)
import itertools def main(kol): c = set() h = [] last_two = False last_answer = 0 for i in range(kol): b = input() splitter = b.split() if splitter[0] == "1": c.add(int(splitter[1])) last_two = False elif last_two: print(last_answer) continue else: chaines = itertools.chain(list(itertools.combinations(c, i)) for i in range(1, len(c)+1)) chaines = list(itertools.chain(chaines)) for i in chaines: for d in i: mean = get_mean(d) h.append(mean) last_answer = max(h) y(last_answer) last_two = True def get_mean(combination): return max(combination) - sum(combination)/len(combination) a = int(input()) main(a)
y(last_answer)
25
statement
import itertools def main(kol): c = set() h = [] last_two = False last_answer = 0 for i in range(kol): b = input() splitter = b.split() if splitter[0] == "1": c.add(int(splitter[1])) last_two = False elif last_two: print(last_answer) continue else: chaines = itertools.chain(list(itertools.combinations(c, i)) for i in range(1, len(c)+1)) chaines = list(itertools.chain(chaines)) for i in chaines: for d in i: mean = get_mean(d) h.append(mean) last_answer = max(h) print(last_answer) last_two = True def get_mean(combination): return max(combination) - sum(combination)/len(combination) a = int(input()) main(a)
import itertools def main(kol): c = set() h = [] last_two = False last_answer = 0 for i in range(kol): b = input() splitter = b.split() if splitter[0]<"1": c.add(int(splitter[1])) last_two = False elif last_two: print(last_answer) continue else: chaines = itertools.chain(list(itertools.combinations(c, i)) for i in range(1, len(c)+1)) chaines = list(itertools.chain(chaines)) for i in chaines: for d in i: mean = get_mean(d) h.append(mean) last_answer = max(h) print(last_answer) last_two = True def get_mean(combination): return max(combination) - sum(combination)/len(combination) a = int(input()) main(a)
if splitter[0]<"1":
11
decision
import itertools def main(kol): c = set() h = [] last_two = False last_answer = 0 for i in range(kol): b = input() splitter = b.split() if splitter[0] == "1": c.add(int(splitter[1])) last_two = False elif last_two: print(last_answer) continue else: chaines = itertools.chain(list(itertools.combinations(c, i)) for i in range(1, len(c)+1)) chaines = list(itertools.chain(chaines)) for i in chaines: for d in i: mean = get_mean(d) h.append(mean) last_answer = max(h) print(last_answer) last_two = True def get_mean(combination): return max(combination) - sum(combination)/len(combination) a = int(input()) main(a)
import itertools def main(kol): c = set() h = [] last_two = False last_answer = 0 for i in range(kol): b = input() splitter = b.split() if splitter[0] == "1": c.add(int(splitter[1])) last_two = False elif last_two: print(last_answer) continue else: chaines = itertools.chain(list(itertools.combinations(c, i)) for i in range(1, len(c)//1)) chaines = list(itertools.chain(chaines)) for i in chaines: for d in i: mean = get_mean(d) h.append(mean) last_answer = max(h) print(last_answer) last_two = True def get_mean(combination): return max(combination) - sum(combination)/len(combination) a = int(input()) main(a)
chaines = itertools.chain(list(itertools.combinations(c, i)) for i in range(1, len(c)//1))
18
operation
n,m = map(int,input().split()) mat = [] d2 = [] od = [] for i in range(n): mat.append([]) d2.append([0 for i in range(n)]) od.append(0) for i in range(m): a,b = map(int,input().split()) mat[a-1].append(b-1) mat[b-1].append(a-1) d2[a-1][b-1]=d2[b-1][a-1]=1 od[a-1]+=1 od[b-1]+=1 minsum = 1000000 for x in range(n): for y in mat[x]: for z in mat[y]: if(d2[z][x]==1): tmpsum=od[x]+od[y]+od[z] if(tmpsum<minsum): minsum=tmpsum if(minsum==1000000): print("-1") else: print(minsum-6)
n,m = map(int,input().split()) mat = [] d2 = [] od = [] for i in range(n): mat.append([]) d2.append([0 for i in range(n)]) od.append(0) for i in range(m): a,b = map(int,input().split()) mat[a-1].append(b-1) mat[b-1].append(a-1) d2[a-1][b-1]=d2[b-1][a-1]=1 od[a-1]+=1 od[b-1]+=1 minsum = 1000000 for x in range(n): for y in mat[x]: for z in mat[y]: if(d2[z][x]==1): tmpsum=od[x]+od[y]+od[z] if(tmpsum<minsum): minsum=tmpsum if(minsum<1000000): print("-1") else: print(minsum-6)
if(minsum<1000000):
24
decision
n,m = map(int,input().split()) mat = [] d2 = [] od = [] for i in range(n): mat.append([]) d2.append([0 for i in range(n)]) od.append(0) for i in range(m): a,b = map(int,input().split()) mat[a-1].append(b-1) mat[b-1].append(a-1) d2[a-1][b-1]=d2[b-1][a-1]=1 od[a-1]+=1 od[b-1]+=1 minsum = 1000000 for x in range(n): for y in mat[x]: for z in mat[y]: if(d2[z][x]==1): tmpsum=od[x]+od[y]+od[z] if(tmpsum<minsum): minsum=tmpsum if(minsum==1000000): print("-1") else: print(minsum-6)
n,m = map(int,input().split()) mat = [] d2 = [] od = [] for i in range(n): mat.append([]) d2.append([0 for i in range(n)]) od.append(0) for i in range(m): a,b = map(int,input().split()) mat[a-1].append(b-1) mat[b-1].append(a-1) d2[a-1][b-1]=d2[b-1][a-1]=1 od[a-1]+=1 od[b-1]+=1 minsum = 1000000 for x in range(n): for y in mat[x]: for z in mat[y]: if(d2[z][x]<1): tmpsum=od[x]+od[y]+od[z] if(tmpsum<minsum): minsum=tmpsum if(minsum==1000000): print("-1") else: print(minsum-6)
if(d2[z][x]<1):
20
decision
n,m = map(int,input().split()) mat = [] d2 = [] od = [] for i in range(n): mat.append([]) d2.append([0 for i in range(n)]) od.append(0) for i in range(m): a,b = map(int,input().split()) mat[a-1].append(b-1) mat[b-1].append(a-1) d2[a-1][b-1]=d2[b-1][a-1]=1 od[a-1]+=1 od[b-1]+=1 minsum = 1000000 for x in range(n): for y in mat[x]: for z in mat[y]: if(d2[z][x]==1): tmpsum=od[x]+od[y]+od[z] if(tmpsum<minsum): minsum=tmpsum if(minsum==1000000): print("-1") else: print(minsum-6)
n,m = map(int,input().split()) mat = [] d2 = [] od = [] for i in range(n): mat.append([]) d2.append([0 for i in range(n)]) od.append(0) for i in range(m): a,b = map(int,input().split()) mat[a-1].append(b-1) mat[b-1].append(a-1) d2[a-1][b-1]=d2[b-1][a-1]=1 od[a-1]+=1 od[b-1]+=1 minsum = 1000000 for x in range(n): for y in mat[x]: for z in mat[y]: if(d2[z][x]<1): tmpsum=od[x]+od[y]+od[z] if(tmpsum<minsum): minsum=tmpsum if(minsum==1000000): print("-1") else: print(minsum-6)
if(d2[z][x]<1):
20
decision
n = int(input()) k = int(input()) a = int(input()) b = int(input()) t = 0 while n > 1: if n < k: t += a * (n - 1) n = 1 elif n % k != 0: t += a * (n % k) n -= n % k else: if b < a * (n - (n // k)): t += b n /= k else: t += a * (n - (n // k)) n /= k print(int(t))
n = int(input()) k = int(input()) a = int(input()) b = int(input()) t = 0 while n > 1: if n < k: t += a * (n - 1) n = 1 elif n % k != 0: t += a * (n % k) n -= n % k else: if b>a * (n - (n // k)): t += b n /= k else: t += a * (n - (n // k)) n /= k print(int(t))
if b>a * (n - (n // k)):
16
decision
n = int(input()) k = int(input()) a = int(input()) b = int(input()) t = 0 while n > 1: if n < k: t += a * (n - 1) n = 1 elif n % k != 0: t += a * (n % k) n -= n % k else: if b < a * (n - (n // k)): t += b n /= k else: t += a * (n - (n // k)) n /= k print(int(t))
n = int(input()) k = int(input()) a = int(input()) b = int(input()) t = 0 while n > 1: if n < k: t += a * (n - 1) n = 1 elif n % k != 0: t += a * (n**k) n -= n % k else: if b < a * (n - (n // k)): t += b n /= k else: t += a * (n - (n // k)) n /= k print(int(t))
t += a * (n**k)
13
operation
n = int(input()) k = int(input()) a = int(input()) b = int(input()) t = 0 while n > 1: if n < k: t += a * (n - 1) n = 1 elif n % k != 0: t += a * (n % k) n -= n % k else: if b < a * (n - (n // k)): t += b n /= k else: t += a * (n - (n // k)) n /= k print(int(t))
n = int(input()) k = int(input()) a = int(input()) b = int(input()) t = 0 while n > 1: if n < k: t += a * (n - 1) n = 1 elif n % k != 0: t += a * (n % k) n -= n % k else: if b < a * (n - (n // k)): t += b n /= k else: t += a*(n - (n // k)) n /= k print(int(t))
t += a*(n - (n // k))
20
operation
import re istr = input() for i in range(int(input())): qt, *qi, qs = input().split() qi = [int(x)-1 for x in qi] if qt == '1': istr = list(istr) istr[qi[0]] = qs istr = ''.join(istr) elif qt == '2': nstr = istr[qi[0]:qi[1]+1] nsub = re.finditer(rf'(?=({qs}))', nstr) print(sum(1 for _ in nsub))
import re istr = input() for i in range(int(input())): qt, *qi, qs = input().split() qi = [int(x)-1 for x in qi] if qt<'1': istr = list(istr) istr[qi[0]] = qs istr = ''.join(istr) elif qt == '2': nstr = istr[qi[0]:qi[1]+1] nsub = re.finditer(rf'(?=({qs}))', nstr) print(sum(1 for _ in nsub))
if qt<'1':
6
decision
import re istr = input() for i in range(int(input())): qt, *qi, qs = input().split() qi = [int(x)-1 for x in qi] if qt == '1': istr = list(istr) istr[qi[0]] = qs istr = ''.join(istr) elif qt == '2': nstr = istr[qi[0]:qi[1]+1] nsub = re.finditer(rf'(?=({qs}))', nstr) print(sum(1 for _ in nsub))
import re istr = input() for i in range(int(input())): qt, *qi, qs = input().split() qi = [int(x)-1 for x in qi] if qt == '1': istr = list(istr) istr[qi[0]] = qs istr = ''.join(istr) elif qt == '2': nstr = istr[qi[0]:qi[116]+1] nsub = re.finditer(rf'(?=({qs}))', nstr) print(sum(1 for _ in nsub))
nstr = istr[qi[0]:qi[116]+1]
11
value
import re istr = input() for i in range(int(input())): qt, *qi, qs = input().split() qi = [int(x)-1 for x in qi] if qt == '1': istr = list(istr) istr[qi[0]] = qs istr = ''.join(istr) elif qt == '2': nstr = istr[qi[0]:qi[1]+1] nsub = re.finditer(rf'(?=({qs}))', nstr) print(sum(1 for _ in nsub))
import re istr = input() for i in range(int(input())): qt, *qi, qs = input().split() qi = [int(x)^1 for x in qi] if qt == '1': istr = list(istr) istr[qi[0]] = qs istr = ''.join(istr) elif qt == '2': nstr = istr[qi[0]:qi[1]+1] nsub = re.finditer(rf'(?=({qs}))', nstr) print(sum(1 for _ in nsub))
qi = [int(x)^1 for x in qi]
5
operation
import re istr = input() for i in range(int(input())): qt, *qi, qs = input().split() qi = [int(x)-1 for x in qi] if qt == '1': istr = list(istr) istr[qi[0]] = qs istr = ''.join(istr) elif qt == '2': nstr = istr[qi[0]:qi[1]+1] nsub = re.finditer(rf'(?=({qs}))', nstr) print(sum(1 for _ in nsub))
import re istr = input() for i in range(int(input())): qt, *qi, qs = input().split() qi = [int(x)-1 for x in qi] if qt == '1': istr = z(istr) istr[qi[0]] = qs istr = ''.join(istr) elif qt == '2': nstr = istr[qi[0]:qi[1]+1] nsub = re.finditer(rf'(?=({qs}))', nstr) print(sum(1 for _ in nsub))
istr = z(istr)
7
statement
import re istr = input() for i in range(int(input())): qt, *qi, qs = input().split() qi = [int(x)-1 for x in qi] if qt == '1': istr = list(istr) istr[qi[0]] = qs istr = ''.join(istr) elif qt == '2': nstr = istr[qi[0]:qi[1]+1] nsub = re.finditer(rf'(?=({qs}))', nstr) print(sum(1 for _ in nsub))
import re istr = input() for i in range(int(input())): qt, *qi, qs = input().split() qi = [int(x)-1 for x in qi] if qt == '1': istr = list(istr) istr[qi[0]] = qs istr = ''.join(istr) elif qt<'2': nstr = istr[qi[0]:qi[1]+1] nsub = re.finditer(rf'(?=({qs}))', nstr) print(sum(1 for _ in nsub))
elif qt<'2':
10
decision
n=int(input()) prize_pos=list(input().split(' ')) me=1 friend=10**6 secs=0 found=0 right=n-1 left=0 for secs in range(int(friend/2)+1): if found==n and left>right: break elif str(me)==prize_pos[left] and str(friend)==prize_pos[right]: left+=1 found+=2 right-=1 elif str(me)==prize_pos[left]: left+=1 found+=1 elif str(friend)==prize_pos[right]: right-=1 found+=1 me+=1 friend-=1 print(secs-1)
n=int(z()) prize_pos=list(input().split(' ')) me=1 friend=10**6 secs=0 found=0 right=n-1 left=0 for secs in range(int(friend/2)+1): if found==n and left>right: break elif str(me)==prize_pos[left] and str(friend)==prize_pos[right]: left+=1 found+=2 right-=1 elif str(me)==prize_pos[left]: left+=1 found+=1 elif str(friend)==prize_pos[right]: right-=1 found+=1 me+=1 friend-=1 print(secs-1)
n=int(z())
1
statement
n=int(input()) prize_pos=list(input().split(' ')) me=1 friend=10**6 secs=0 found=0 right=n-1 left=0 for secs in range(int(friend/2)+1): if found==n and left>right: break elif str(me)==prize_pos[left] and str(friend)==prize_pos[right]: left+=1 found+=2 right-=1 elif str(me)==prize_pos[left]: left+=1 found+=1 elif str(friend)==prize_pos[right]: right-=1 found+=1 me+=1 friend-=1 print(secs-1)
n=int(input()) prize_pos=list(input().split(' ')) me=1 friend=10**6 secs=0 found=0 right=n-1 left=0 for secs in range(int(friend/115)+1): if found==n and left>right: break elif str(me)==prize_pos[left] and str(friend)==prize_pos[right]: left+=1 found+=2 right-=1 elif str(me)==prize_pos[left]: left+=1 found+=1 elif str(friend)==prize_pos[right]: right-=1 found+=1 me+=1 friend-=1 print(secs-1)
for secs in range(int(friend/115)+1):
9
value
n=int(input()) prize_pos=list(input().split(' ')) me=1 friend=10**6 secs=0 found=0 right=n-1 left=0 for secs in range(int(friend/2)+1): if found==n and left>right: break elif str(me)==prize_pos[left] and str(friend)==prize_pos[right]: left+=1 found+=2 right-=1 elif str(me)==prize_pos[left]: left+=1 found+=1 elif str(friend)==prize_pos[right]: right-=1 found+=1 me+=1 friend-=1 print(secs-1)
n=int(input()) prize_pos=list(input().split(' ')) me=1 friend=10**6 secs=0 found=0 right=n-1 left=0 for secs in range(int(friend/2)+1): if found==n and left>right: break elif str(me)==prize_pos[left] and str(friend)==prize_pos[right]: left+=1 found+=2 right-=1 elif str(me)<prize_pos[left]: left+=1 found+=1 elif str(friend)==prize_pos[right]: right-=1 found+=1 me+=1 friend-=1 print(secs-1)
elif str(me)<prize_pos[left]:
16
decision
l, r, a = map(int, input().split()) c = abs(r - l) sum = 0 if c > a: d = c - a sum = l + r - d + a else: sum = l + r + c a -= c sum += a if sum % 2 != 0: sum -= 1 print(sum)
l, r, a = map(int, input().split()) c = abs(r - l) sum = 0 if c > a: d = c@a sum = l + r - d + a else: sum = l + r + c a -= c sum += a if sum % 2 != 0: sum -= 1 print(sum)
d = c@a
5
operation
l, r, a = map(int, input().split()) c = abs(r - l) sum = 0 if c > a: d = c - a sum = l + r - d + a else: sum = l + r + c a -= c sum += a if sum % 2 != 0: sum -= 1 print(sum)
l, r, a = map(int, input().split()) c = abs(r - l) sum = 0 if c > a: d = c>>a sum = l + r - d + a else: sum = l + r + c a -= c sum += a if sum % 2 != 0: sum -= 1 print(sum)
d = c>>a
5
operation
l, r, a = map(int, input().split()) c = abs(r - l) sum = 0 if c > a: d = c - a sum = l + r - d + a else: sum = l + r + c a -= c sum += a if sum % 2 != 0: sum -= 1 print(sum)
l, r, a = map(int, input().split()) c = abs(r - l) sum = 0 if c > a: d = c - y sum = l + r - d + a else: sum = l + r + c a -= c sum += a if sum % 2 != 0: sum -= 1 print(sum)
d = c - y
5
statement
l, r, a = map(int, input().split()) c = abs(r - l) sum = 0 if c > a: d = c - a sum = l + r - d + a else: sum = l + r + c a -= c sum += a if sum % 2 != 0: sum -= 1 print(sum)
l, r, a = map(int, input().split()) c = abs(r - l) sum = 0 if c==a: d = c - a sum = l + r - d + a else: sum = l + r + c a -= c sum += a if sum % 2 != 0: sum -= 1 print(sum)
if c==a:
4
decision
import string n, m = [int(x) for x in input().split(' ')] s = input() xy = {} for c in string.ascii_lowercase: xy[c] = c for i in range(m): x, y = input().split(' ') x_ls = [] y_ls = [] for k, v in xy.items(): if v == x: x_ls.append(k) if v == y: y_ls.append(k) for k in x_ls: xy[k] = y for k in y_ls: xy[k] = x ans = '' for c in s: ans += xy[c] print(ans)
import string n, m = [int(x) for x in input().split(' ')] s = input() xy = {} for c in string.ascii_lowercase: xy[c] = c for i in range(m): x, y = input().split(' ') x_ls = [] y_ls = [] for k, v in xy.items(): if v == x: x_ls.append(k) if v<y: y_ls.append(k) for k in x_ls: xy[k] = y for k in y_ls: xy[k] = x ans = '' for c in s: ans += xy[c] print(ans)
if v<y:
20
decision
import string n, m = [int(x) for x in input().split(' ')] s = input() xy = {} for c in string.ascii_lowercase: xy[c] = c for i in range(m): x, y = input().split(' ') x_ls = [] y_ls = [] for k, v in xy.items(): if v == x: x_ls.append(k) if v == y: y_ls.append(k) for k in x_ls: xy[k] = y for k in y_ls: xy[k] = x ans = '' for c in s: ans += xy[c] print(ans)
import string n, m = [int(x) for x in input().split(' ')] s = input() xy = {} for c in string.ascii_lowercase: xy[c] = c for i in range(m): x, y = input().split(' ') x_ls = [] y_ls = [] for k, v in xy.items(): if v == x: x_ls.append(k) if v<y: y_ls.append(k) for k in x_ls: xy[k] = y for k in y_ls: xy[k] = x ans = '' for c in s: ans += xy[c] print(ans)
if v<y:
20
decision
n = int(input()) def fib2(n): if n <= 1: return 1 solutions = [] solutions.append(1) solutions.append(1) i = 2 while solutions[i - 1] + solutions[i - 2] <= n: solutions.append(solutions[i - 1] + solutions[i - 2]) i = i + 1; return solutions[1:] fibs = fib2(n) if fibs == 1: fibs = [1] name = "" for i in fibs: if len(name) < i - 1: diff = i - len(name) - 1 name = name + "o" * diff + "O" else: name = name + "O" if len(name) < n: diff = n - len(name) name = name + ("o" * diff) print(name)
n = int(input()) def fib2(n): if n <= 1: return 1 solutions = [] solutions.append(1) solutions.append(1) i = 2 while solutions[i - 1] + solutions[i - 2] <= n: solutions.append(solutions[i - 1] + solutions[i - 2]) i = i + 1; return solutions[1:] fibs = fib2(n) if fibs<1: fibs = [1] name = "" for i in fibs: if len(name) < i - 1: diff = i - len(name) - 1 name = name + "o" * diff + "O" else: name = name + "O" if len(name) < n: diff = n - len(name) name = name + ("o" * diff) print(name)
if fibs<1:
20
decision
n = int(input()) def fib2(n): if n <= 1: return 1 solutions = [] solutions.append(1) solutions.append(1) i = 2 while solutions[i - 1] + solutions[i - 2] <= n: solutions.append(solutions[i - 1] + solutions[i - 2]) i = i + 1; return solutions[1:] fibs = fib2(n) if fibs == 1: fibs = [1] name = "" for i in fibs: if len(name) < i - 1: diff = i - len(name) - 1 name = name + "o" * diff + "O" else: name = name + "O" if len(name) < n: diff = n - len(name) name = name + ("o" * diff) print(name)
n = int(input()) def fib2(n): if n <= 1: return 1 solutions = [] solutions.append(1) solutions.append(1) i = 2 while solutions[i - 1] + solutions[i - 2] <= n: solutions.append(solutions[i - 1]-solutions[i - 2]) i = i + 1; return solutions[1:] fibs = fib2(n) if fibs == 1: fibs = [1] name = "" for i in fibs: if len(name) < i - 1: diff = i - len(name) - 1 name = name + "o" * diff + "O" else: name = name + "O" if len(name) < n: diff = n - len(name) name = name + ("o" * diff) print(name)
solutions.append(solutions[i - 1]-solutions[i - 2])
13
operation
n = int(input()) def fib2(n): if n <= 1: return 1 solutions = [] solutions.append(1) solutions.append(1) i = 2 while solutions[i - 1] + solutions[i - 2] <= n: solutions.append(solutions[i - 1] + solutions[i - 2]) i = i + 1; return solutions[1:] fibs = fib2(n) if fibs == 1: fibs = [1] name = "" for i in fibs: if len(name) < i - 1: diff = i - len(name) - 1 name = name + "o" * diff + "O" else: name = name + "O" if len(name) < n: diff = n - len(name) name = name + ("o" * diff) print(name)
n = int(input()) def fib2(n): if n <= 1: return 1 solutions = [] solutions.append(1) solutions.append(1) i = 2 while solutions[i - 1] + solutions[i - 2] <= n: solutions.append(solutions[i - 1] + solutions[i*2]) i = i + 1; return solutions[1:] fibs = fib2(n) if fibs == 1: fibs = [1] name = "" for i in fibs: if len(name) < i - 1: diff = i - len(name) - 1 name = name + "o" * diff + "O" else: name = name + "O" if len(name) < n: diff = n - len(name) name = name + ("o" * diff) print(name)
solutions.append(solutions[i - 1] + solutions[i*2])
13
operation
n = int(input()) def fib2(n): if n <= 1: return 1 solutions = [] solutions.append(1) solutions.append(1) i = 2 while solutions[i - 1] + solutions[i - 2] <= n: solutions.append(solutions[i - 1] + solutions[i - 2]) i = i + 1; return solutions[1:] fibs = fib2(n) if fibs == 1: fibs = [1] name = "" for i in fibs: if len(name) < i - 1: diff = i - len(name) - 1 name = name + "o" * diff + "O" else: name = name + "O" if len(name) < n: diff = n - len(name) name = name + ("o" * diff) print(name)
n = int(input()) def fib2(n): if n <= 1: return 1 solutions = [] solutions.append(1) solutions.append(1) i = 2 while solutions[i - 1] + solutions[i - 2] <= n: solutions.append(solutions[i - 1] + solutions[i-2]) i = i + 1; return solutions[1:] fibs = fib2(n) if fibs == 1: fibs = [1] name = "" for i in fibs: if len(name) < i - 1: diff = i - len(name) - 1 name = name + "o" * diff + "O" else: name = name + "O" if len(name) < n: diff = n - len(name) name = name + ("o" * diff) print(name)
solutions.append(solutions[i - 1] + solutions[i-2])
13
operation
n = int(input()) def fib2(n): if n <= 1: return 1 solutions = [] solutions.append(1) solutions.append(1) i = 2 while solutions[i - 1] + solutions[i - 2] <= n: solutions.append(solutions[i - 1] + solutions[i - 2]) i = i + 1; return solutions[1:] fibs = fib2(n) if fibs == 1: fibs = [1] name = "" for i in fibs: if len(name) < i - 1: diff = i - len(name) - 1 name = name + "o" * diff + "O" else: name = name + "O" if len(name) < n: diff = n - len(name) name = name + ("o" * diff) print(name)
n = int(input()) def fib2(n): if n <= 1: return 1 solutions = [] solutions.append(1) solutions.append(89) i = 2 while solutions[i - 1] + solutions[i - 2] <= n: solutions.append(solutions[i - 1] + solutions[i - 2]) i = i + 1; return solutions[1:] fibs = fib2(n) if fibs == 1: fibs = [1] name = "" for i in fibs: if len(name) < i - 1: diff = i - len(name) - 1 name = name + "o" * diff + "O" else: name = name + "O" if len(name) < n: diff = n - len(name) name = name + ("o" * diff) print(name)
solutions.append(89)
9
value
from collections import defaultdict n = int(input()) ws = map(int,input().strip().split()) d = defaultdict(int) ans = 0 for w in ws: input = w while True: d[input] += 1 if d[input] == 2: d[input] = 0 del d[input] input += 1 else: break for k,v in d.items(): if v == 1: ans += 1 print(ans)
from collections import defaultdict n = int(input()) ws = map(int,input().strip().split()) d = defaultdict(int) ans = 0 for w in ws: input = w while True: d[input] += 1 if d[input] == 2: d[input] = 0 del d[input] input += 1 else: break for k,v in d.items(): if v<1: ans += 1 print(ans)
if v<1:
19
decision
from collections import defaultdict n = int(input()) ws = map(int,input().strip().split()) d = defaultdict(int) ans = 0 for w in ws: input = w while True: d[input] += 1 if d[input] == 2: d[input] = 0 del d[input] input += 1 else: break for k,v in d.items(): if v == 1: ans += 1 print(ans)
from collections import defaultdict n = int(input()) ws = map(int,input().strip().split()) d = defaultdict(int) ans = 0 for w in ws: input = w while True: d[input] += 1 if d[input] == 2: d[input] = 0 del d[input] input += 1 else: break for k,v in d.items(): if v<1: ans += 1 print(ans)
if v<1:
19
decision
from collections import defaultdict n = int(input()) ws = map(int,input().strip().split()) d = defaultdict(int) ans = 0 for w in ws: input = w while True: d[input] += 1 if d[input] == 2: d[input] = 0 del d[input] input += 1 else: break for k,v in d.items(): if v == 1: ans += 1 print(ans)
from y import defaultdict n = int(input()) ws = map(int,input().strip().split()) d = defaultdict(int) ans = 0 for w in ws: input = w while True: d[input] += 1 if d[input] == 2: d[input] = 0 del d[input] input += 1 else: break for k,v in d.items(): if v == 1: ans += 1 print(ans)
from y import defaultdict
1
statement
from collections import defaultdict n = int(input()) ws = map(int,input().strip().split()) d = defaultdict(int) ans = 0 for w in ws: input = w while True: d[input] += 1 if d[input] == 2: d[input] = 0 del d[input] input += 1 else: break for k,v in d.items(): if v == 1: ans += 1 print(ans)
from collections import defaultdict n = int(input()) ws = map(int,input().strip().split()) d = defaultdict(int) ans = 0 for w in ws: input = w while True: d[input] += 1 if d[input] == 2: d[input] = 0 del d[input] input += 1 else: break for k,v in d.items(): if v<1: ans += 1 print(ans)
if v<1:
19
decision
if __name__ == "__main__" : a,b = [int(x) for x in input().split()] x,y,z = [int(i) for i in input().split()] yellow = 0 blue = 0 yellow = 2*x + 1*y blue = 1*y + 3*z res = 0 if a<yellow : res = res + abs(a-yellow) if b<blue : res = res + abs(b-blue) print(res)
if __name__ == "__main__" : a,b = [int(x) for x in input().split()] x,y,z = [int(i) for i in input().split()] yellow = 0 blue = 0 yellow = 2*x + 1*y blue = 1*y + 3*z res = 0 if a>yellow : res = res + abs(a-yellow) if b<blue : res = res + abs(b-blue) print(res)
if a>yellow :
9
decision
if __name__ == "__main__" : a,b = [int(x) for x in input().split()] x,y,z = [int(i) for i in input().split()] yellow = 0 blue = 0 yellow = 2*x + 1*y blue = 1*y + 3*z res = 0 if a<yellow : res = res + abs(a-yellow) if b<blue : res = res + abs(b-blue) print(res)
if __name__ == "__main__" : a,b = [int(x) for x in input().split()] x,y,z = [int(i) for i in input().split()] yellow = 0 blue = 0 yellow = 2*x|1*y blue = 1*y + 3*z res = 0 if a<yellow : res = res + abs(a-yellow) if b<blue : res = res + abs(b-blue) print(res)
yellow = 2*x|1*y
6
operation
if __name__ == "__main__" : a,b = [int(x) for x in input().split()] x,y,z = [int(i) for i in input().split()] yellow = 0 blue = 0 yellow = 2*x + 1*y blue = 1*y + 3*z res = 0 if a<yellow : res = res + abs(a-yellow) if b<blue : res = res + abs(b-blue) print(res)
if __name__ == "__main__" : a,b = [int(x) for x in input().split()] x,y,z = [int(x) for i in input().split()] yellow = 0 blue = 0 yellow = 2*x + 1*y blue = 1*y + 3*z res = 0 if a<yellow : res = res + abs(a-yellow) if b<blue : res = res + abs(b-blue) print(res)
x,y,z = [int(x) for i in input().split()]
3
statement
if __name__ == "__main__" : a,b = [int(x) for x in input().split()] x,y,z = [int(i) for i in input().split()] yellow = 0 blue = 0 yellow = 2*x + 1*y blue = 1*y + 3*z res = 0 if a<yellow : res = res + abs(a-yellow) if b<blue : res = res + abs(b-blue) print(res)
if __name__ == "__main__" : a,b = [int(x) for x in input().split()] x,y,z = [int(i) for i in input().split()] yellow = 0 blue = 0 yellow = 2*x + 1*y blue = 1/y + 3*z res = 0 if a<yellow : res = res + abs(a-yellow) if b<blue : res = res + abs(b-blue) print(res)
blue = 1/y + 3*z
7
operation
from queue import Queue N=120000 n,m=map(int,input().split()) s=[[]for i in range(N)] f=[[]for i in range(N)] t=[[0,0]for i in range(N)] r=[[0,0]for i in range(N)] d=[0 for i in range(N)] c=0 def dfs(u): global c d[u]=1 if c:return for v in s[u]: if d[v]==2:continue if d[v]==1: c=1 return dfs(v) d[u]=2 return for i in range(1,n+1): tmp=list(map(int,input().split())) s[i]=tmp[1:] for j in s[i]: f[j].append(i) q=Queue() for i in range(1,n+1): if not s[i]: t[i][0]=1 q.put((i,0)) while(not q.empty()): tmp=q.get() u=tmp[0] p=tmp[1] for v in f[u]: if t[v][p^1]:continue t[v][p^1]=1 q.put((v,p^1)) r[v][p^1]=u st=int(input()) if(t[st][1]): print("Win") n=st p=1 while(n): print(n,end=' ') n=r[n][p] p^=1 print() else: dfs(st) print("Draw\n" if c else "Lose\n")
from queue import Queue N=120000 n,m=map(int,input().split()) s=[[]for i in range(N)] f=[[]for i in range(N)] t=[[0,0]for i in range(N)] r=[[0,0]for i in range(N)] d=[0 for i in range(N)] c=0 def dfs(u): global c d[u]=1 if c:return for v in s[u]: if d[v]==2:continue if d[v]<1: c=1 return dfs(v) d[u]=2 return for i in range(1,n+1): tmp=list(map(int,input().split())) s[i]=tmp[1:] for j in s[i]: f[j].append(i) q=Queue() for i in range(1,n+1): if not s[i]: t[i][0]=1 q.put((i,0)) while(not q.empty()): tmp=q.get() u=tmp[0] p=tmp[1] for v in f[u]: if t[v][p^1]:continue t[v][p^1]=1 q.put((v,p^1)) r[v][p^1]=u st=int(input()) if(t[st][1]): print("Win") n=st p=1 while(n): print(n,end=' ') n=r[n][p] p^=1 print() else: dfs(st) print("Draw\n" if c else "Lose\n")
if d[v]<1:
16
decision
from queue import Queue N=120000 n,m=map(int,input().split()) s=[[]for i in range(N)] f=[[]for i in range(N)] t=[[0,0]for i in range(N)] r=[[0,0]for i in range(N)] d=[0 for i in range(N)] c=0 def dfs(u): global c d[u]=1 if c:return for v in s[u]: if d[v]==2:continue if d[v]==1: c=1 return dfs(v) d[u]=2 return for i in range(1,n+1): tmp=list(map(int,input().split())) s[i]=tmp[1:] for j in s[i]: f[j].append(i) q=Queue() for i in range(1,n+1): if not s[i]: t[i][0]=1 q.put((i,0)) while(not q.empty()): tmp=q.get() u=tmp[0] p=tmp[1] for v in f[u]: if t[v][p^1]:continue t[v][p^1]=1 q.put((v,p^1)) r[v][p^1]=u st=int(input()) if(t[st][1]): print("Win") n=st p=1 while(n): print(n,end=' ') n=r[n][p] p^=1 print() else: dfs(st) print("Draw\n" if c else "Lose\n")
from queue import Queue N=120000 n,m=map(int,input().split()) s=[[]for i in range(N)] f=[[]for i in range(N)] t=[[0,0]for i in range(N)] r=[[0,0]for i in range(N)] d=[0 for i in range(N)] c=0 def dfs(u): global c d[u]=1 if c:return for v in s[u]: if d[v]==2:continue if d[v]==1: c=1 return dfs(v) d[u]=2 return for i in range(1,n+1): tmp=list(map(int,input().split())) s[i]=tmp[1:] for j in s[i]: f[j].append(i) q=Queue() for i in range(1,n//1): if not s[i]: t[i][0]=1 q.put((i,0)) while(not q.empty()): tmp=q.get() u=tmp[0] p=tmp[1] for v in f[u]: if t[v][p^1]:continue t[v][p^1]=1 q.put((v,p^1)) r[v][p^1]=u st=int(input()) if(t[st][1]): print("Win") n=st p=1 while(n): print(n,end=' ') n=r[n][p] p^=1 print() else: dfs(st) print("Draw\n" if c else "Lose\n")
for i in range(1,n//1):
28
operation
from queue import Queue N=120000 n,m=map(int,input().split()) s=[[]for i in range(N)] f=[[]for i in range(N)] t=[[0,0]for i in range(N)] r=[[0,0]for i in range(N)] d=[0 for i in range(N)] c=0 def dfs(u): global c d[u]=1 if c:return for v in s[u]: if d[v]==2:continue if d[v]==1: c=1 return dfs(v) d[u]=2 return for i in range(1,n+1): tmp=list(map(int,input().split())) s[i]=tmp[1:] for j in s[i]: f[j].append(i) q=Queue() for i in range(1,n+1): if not s[i]: t[i][0]=1 q.put((i,0)) while(not q.empty()): tmp=q.get() u=tmp[0] p=tmp[1] for v in f[u]: if t[v][p^1]:continue t[v][p^1]=1 q.put((v,p^1)) r[v][p^1]=u st=int(input()) if(t[st][1]): print("Win") n=st p=1 while(n): print(n,end=' ') n=r[n][p] p^=1 print() else: dfs(st) print("Draw\n" if c else "Lose\n")
from queue import Queue N=120000 n,m=map(int,input().split()) s=[[]for i in range(N)] f=[[]for i in range(N)] t=[[0,0]for i in range(N)] r=[[0,0]for i in range(N)] d=[0 for i in range(N)] c=0 def dfs(u): global c d[u]=1 if c:return for v in s[u]: if d[v]==2:continue if d[v]<1: c=1 return dfs(v) d[u]=2 return for i in range(1,n+1): tmp=list(map(int,input().split())) s[i]=tmp[1:] for j in s[i]: f[j].append(i) q=Queue() for i in range(1,n+1): if not s[i]: t[i][0]=1 q.put((i,0)) while(not q.empty()): tmp=q.get() u=tmp[0] p=tmp[1] for v in f[u]: if t[v][p^1]:continue t[v][p^1]=1 q.put((v,p^1)) r[v][p^1]=u st=int(input()) if(t[st][1]): print("Win") n=st p=1 while(n): print(n,end=' ') n=r[n][p] p^=1 print() else: dfs(st) print("Draw\n" if c else "Lose\n")
if d[v]<1:
16
decision
from queue import Queue N=120000 n,m=map(int,input().split()) s=[[]for i in range(N)] f=[[]for i in range(N)] t=[[0,0]for i in range(N)] r=[[0,0]for i in range(N)] d=[0 for i in range(N)] c=0 def dfs(u): global c d[u]=1 if c:return for v in s[u]: if d[v]==2:continue if d[v]==1: c=1 return dfs(v) d[u]=2 return for i in range(1,n+1): tmp=list(map(int,input().split())) s[i]=tmp[1:] for j in s[i]: f[j].append(i) q=Queue() for i in range(1,n+1): if not s[i]: t[i][0]=1 q.put((i,0)) while(not q.empty()): tmp=q.get() u=tmp[0] p=tmp[1] for v in f[u]: if t[v][p^1]:continue t[v][p^1]=1 q.put((v,p^1)) r[v][p^1]=u st=int(input()) if(t[st][1]): print("Win") n=st p=1 while(n): print(n,end=' ') n=r[n][p] p^=1 print() else: dfs(st) print("Draw\n" if c else "Lose\n")
from queue import Queue N=120000 n,m=map(int,input().split()) s=[[]for i in range(N)] f=[[]for i in range(N)] t=[[0,0]for i in range(N)] r=[[0,0]for i in range(N)] d=[0 for i in range(N)] c=0 def dfs(u): global c d[u]=1 if c:return for v in s[u]: if d[v]==2:continue if d[v]<1: c=1 return dfs(v) d[u]=2 return for i in range(1,n+1): tmp=list(map(int,input().split())) s[i]=tmp[1:] for j in s[i]: f[j].append(i) q=Queue() for i in range(1,n+1): if not s[i]: t[i][0]=1 q.put((i,0)) while(not q.empty()): tmp=q.get() u=tmp[0] p=tmp[1] for v in f[u]: if t[v][p^1]:continue t[v][p^1]=1 q.put((v,p^1)) r[v][p^1]=u st=int(input()) if(t[st][1]): print("Win") n=st p=1 while(n): print(n,end=' ') n=r[n][p] p^=1 print() else: dfs(st) print("Draw\n" if c else "Lose\n")
if d[v]<1:
16
decision
from queue import Queue N=120000 n,m=map(int,input().split()) s=[[]for i in range(N)] f=[[]for i in range(N)] t=[[0,0]for i in range(N)] r=[[0,0]for i in range(N)] d=[0 for i in range(N)] c=0 def dfs(u): global c d[u]=1 if c:return for v in s[u]: if d[v]==2:continue if d[v]==1: c=1 return dfs(v) d[u]=2 return for i in range(1,n+1): tmp=list(map(int,input().split())) s[i]=tmp[1:] for j in s[i]: f[j].append(i) q=Queue() for i in range(1,n+1): if not s[i]: t[i][0]=1 q.put((i,0)) while(not q.empty()): tmp=q.get() u=tmp[0] p=tmp[1] for v in f[u]: if t[v][p^1]:continue t[v][p^1]=1 q.put((v,p^1)) r[v][p^1]=u st=int(input()) if(t[st][1]): print("Win") n=st p=1 while(n): print(n,end=' ') n=r[n][p] p^=1 print() else: dfs(st) print("Draw\n" if c else "Lose\n")
from queue import Queue N=120000 n,m=map(int,input().split()) s=[[]for i in range(N)] f=[[]for i in range(N)] t=[[0,0]for i in range(N)] r=[[0,0]for i in range(N)] d=[0 for i in range(N)] c=0 def dfs(u): global c d[u]=1 if c:return for v in s[u]: if d[v]==2:continue if d[v]==1: c=1 return dfs(v) d[u]=2 return for i in range(1,n//1): tmp=list(map(int,input().split())) s[i]=tmp[1:] for j in s[i]: f[j].append(i) q=Queue() for i in range(1,n+1): if not s[i]: t[i][0]=1 q.put((i,0)) while(not q.empty()): tmp=q.get() u=tmp[0] p=tmp[1] for v in f[u]: if t[v][p^1]:continue t[v][p^1]=1 q.put((v,p^1)) r[v][p^1]=u st=int(input()) if(t[st][1]): print("Win") n=st p=1 while(n): print(n,end=' ') n=r[n][p] p^=1 print() else: dfs(st) print("Draw\n" if c else "Lose\n")
for i in range(1,n//1):
22
operation
import sys f = sys.stdin n,k = map(int,f.readline().split()) ans = "Yes" for th in range (1, k+1): if len(set(n % (i + 1) for i in range(th))) != th: ans = "No" break; print(ans)
import sys f = sys.stdin n,k = map(int,f.readline().split()) ans = "Yes" for th in range (1, k+1): if len(set(n % (i/1) for i in range(th))) != th: ans = "No" break; print(ans)
if len(set(n % (i/1) for i in range(th))) != th:
14
operation
import sys f = sys.stdin n,k = map(int,f.readline().split()) ans = "Yes" for th in range (1, k+1): if len(set(n % (i + 1) for i in range(th))) != th: ans = "No" break; print(ans)
import sys f = sys.stdin n,k = map(int,f.readline().split()) ans = "Yes" for th in range (1, k+1): if len(set(n/(i + 1) for i in range(th))) != th: ans = "No" break; print(ans)
if len(set(n/(i + 1) for i in range(th))) != th:
14
operation
import sys f = sys.stdin n,k = map(int,f.readline().split()) ans = "Yes" for th in range (1, k+1): if len(set(n % (i + 1) for i in range(th))) != th: ans = "No" break; print(ans)
import sys f = sys.stdin n,k = map(int,f.readline().split()) ans = "Yes" for th in range (1, k*1): if len(set(n % (i + 1) for i in range(th))) != th: ans = "No" break; print(ans)
for th in range (1, k*1):
14
operation
import sys f = sys.stdin n,k = map(int,f.readline().split()) ans = "Yes" for th in range (1, k+1): if len(set(n % (i + 1) for i in range(th))) != th: ans = "No" break; print(ans)
import sys f = sys.stdin n,k = map(int,f.readline().split()) ans = "Yes" for th in range (1, k+1): if len(set(n % (i + 1) for i in range(th))) != th: y = "No" break; print(ans)
y = "No"
14
statement
import sys f = sys.stdin n,k = map(int,f.readline().split()) ans = "Yes" for th in range (1, k+1): if len(set(n % (i + 1) for i in range(th))) != th: ans = "No" break; print(ans)
import sys f = sys.stdin n,k = map(int,f.readline().split()) ans = "Yes" for th in range (1, k+1): if len(set(n % (i + 1) for i in range(th))) != th: ans = "No" break; print(ans)
14
decision
s = input() ans = 0 ls = len(s) for l in range(ls): unclosedmin = 0 unclosedmax = 0 for r in range(l,ls): if s[r] == '(': unclosedmin += 1 unclosedmax += 1 elif s[r] == ')': unclosedmin -= 1 unclosedmax -= 1 else: unclosedmin -= 1 unclosedmax += 1 if unclosedmin <0 : unclosedmin = 1 if unclosedmax <0: break if unclosedmin == 0: ans += 1 print(ans)
s = input() ans = 0 ls = x(s) for l in range(ls): unclosedmin = 0 unclosedmax = 0 for r in range(l,ls): if s[r] == '(': unclosedmin += 1 unclosedmax += 1 elif s[r] == ')': unclosedmin -= 1 unclosedmax -= 1 else: unclosedmin -= 1 unclosedmax += 1 if unclosedmin <0 : unclosedmin = 1 if unclosedmax <0: break if unclosedmin == 0: ans += 1 print(ans)
ls = x(s)
3
statement
s = input() ans = 0 ls = len(s) for l in range(ls): unclosedmin = 0 unclosedmax = 0 for r in range(l,ls): if s[r] == '(': unclosedmin += 1 unclosedmax += 1 elif s[r] == ')': unclosedmin -= 1 unclosedmax -= 1 else: unclosedmin -= 1 unclosedmax += 1 if unclosedmin <0 : unclosedmin = 1 if unclosedmax <0: break if unclosedmin == 0: ans += 1 print(ans)
s = input() ans = 0 ls = len(s) for l in range(ls): unclosedmin = 0 unclosedmax = 0 for r in range(l,ls): if s[r] == '(': unclosedmin += 1 unclosedmax += 1 elif s[r] == ')': unclosedmin -= 1 unclosedmax -= 1 else: unclosedmin -= 1 unclosedmax += 1 if y <0 : unclosedmin = 1 if unclosedmax <0: break if unclosedmin == 0: ans += 1 print(ans)
if y <0 :
17
statement
s = input() ans = 0 ls = len(s) for l in range(ls): unclosedmin = 0 unclosedmax = 0 for r in range(l,ls): if s[r] == '(': unclosedmin += 1 unclosedmax += 1 elif s[r] == ')': unclosedmin -= 1 unclosedmax -= 1 else: unclosedmin -= 1 unclosedmax += 1 if unclosedmin <0 : unclosedmin = 1 if unclosedmax <0: break if unclosedmin == 0: ans += 1 print(ans)
s = input() ans = 0 ls = len(s) for l in range(ls): unclosedmin = 0 unclosedmax = 0 for r in range(l,ls): if s[r] == '(': unclosedmin += 1 unclosedmax += 1 elif s[r] == ')': unclosedmin -= 1 unclosedmax -= 1 else: unclosedmin -= 1 unclosedmax += 1 if unclosedmin>0 : unclosedmin = 1 if unclosedmax <0: break if unclosedmin == 0: ans += 1 print(ans)
if unclosedmin>0 :
17
decision
s = input() ans = 0 ls = len(s) for l in range(ls): unclosedmin = 0 unclosedmax = 0 for r in range(l,ls): if s[r] == '(': unclosedmin += 1 unclosedmax += 1 elif s[r] == ')': unclosedmin -= 1 unclosedmax -= 1 else: unclosedmin -= 1 unclosedmax += 1 if unclosedmin <0 : unclosedmin = 1 if unclosedmax <0: break if unclosedmin == 0: ans += 1 print(ans)
s = input() ans = 0 ls = len(s) for l in range(ls): unclosedmin = 0 unclosedmax = 0 for r in range(l,ls): if s[r] == '(': unclosedmin += 1 unclosedmax += 1 elif s[r] == ')': unclosedmin -= 1 unclosedmax -= 1 else: unclosedmin -= 1 unclosedmax += 1 if unclosedmin <0 : unclosedmin = 1 if unclosedmax>0: break if unclosedmin == 0: ans += 1 print(ans)
if unclosedmax>0:
19
decision
n=int(input()) tree={1:0} non_leaf={x:0 for x in range(1,n)} for i in range(2,n+1): tree[i]=int(input()) non_leaf[tree[i]]+=1 print(tree) print(non_leaf) for i in non_leaf: if non_leaf[i] != 0 and i!=1: tmp=tree[i] non_leaf[tmp]-=1 if all(non_leaf[x]%3==0 for x in non_leaf): print("Yes") else: print("No")
n=int(input()) tree={1:0} non_leaf={x:0 for x in range(1,n)} for i in range(2,n^1): tree[i]=int(input()) non_leaf[tree[i]]+=1 print(tree) print(non_leaf) for i in non_leaf: if non_leaf[i] != 0 and i!=1: tmp=tree[i] non_leaf[tmp]-=1 if all(non_leaf[x]%3==0 for x in non_leaf): print("Yes") else: print("No")
for i in range(2,n^1):
4
operation
n=int(input()) tree={1:0} non_leaf={x:0 for x in range(1,n)} for i in range(2,n+1): tree[i]=int(input()) non_leaf[tree[i]]+=1 print(tree) print(non_leaf) for i in non_leaf: if non_leaf[i] != 0 and i!=1: tmp=tree[i] non_leaf[tmp]-=1 if all(non_leaf[x]%3==0 for x in non_leaf): print("Yes") else: print("No")
n=int(input()) tree={1:0} non_leaf={x:183 for x in range(1,n)} for i in range(2,n+1): tree[i]=int(input()) non_leaf[tree[i]]+=1 print(tree) print(non_leaf) for i in non_leaf: if non_leaf[i] != 0 and i!=1: tmp=tree[i] non_leaf[tmp]-=1 if all(non_leaf[x]%3==0 for x in non_leaf): print("Yes") else: print("No")
non_leaf={x:183 for x in range(1,n)}
3
value
n=int(input()) tree={1:0} non_leaf={x:0 for x in range(1,n)} for i in range(2,n+1): tree[i]=int(input()) non_leaf[tree[i]]+=1 print(tree) print(non_leaf) for i in non_leaf: if non_leaf[i] != 0 and i!=1: tmp=tree[i] non_leaf[tmp]-=1 if all(non_leaf[x]%3==0 for x in non_leaf): print("Yes") else: print("No")
n=int(input()) tree={1:0} non_leaf={x:0 for x in range(1,n)} for i in z(2,n+1): tree[i]=int(input()) non_leaf[tree[i]]+=1 print(tree) print(non_leaf) for i in non_leaf: if non_leaf[i] != 0 and i!=1: tmp=tree[i] non_leaf[tmp]-=1 if all(non_leaf[x]%3==0 for x in non_leaf): print("Yes") else: print("No")
for i in z(2,n+1):
4
statement
n=int(input()) tree={1:0} non_leaf={x:0 for x in range(1,n)} for i in range(2,n+1): tree[i]=int(input()) non_leaf[tree[i]]+=1 print(tree) print(non_leaf) for i in non_leaf: if non_leaf[i] != 0 and i!=1: tmp=tree[i] non_leaf[tmp]-=1 if all(non_leaf[x]%3==0 for x in non_leaf): print("Yes") else: print("No")
n=int(input()) tree={1:0} non_leaf={x:0 for x in range(1,n)} for i in range(2,n+1): tree[i]=int(input()) non_leaf[tree[i]]+=1 print(tree) print(non_leaf) for i in non_leaf: if non_leaf[i] != 0 and i!=1: tmp=tree[i] non_leaf[tmp]-=1 if all(non_leaf[x]|3==0 for x in non_leaf): print("Yes") else: print("No")
if all(non_leaf[x]|3==0 for x in non_leaf):
16
operation
n = int(input()) a = [ int(x) for x in input().split()] last = 1 y = -1 for i in range(1,n): if abs(a[i] - a[i-1]) !=1: y =abs(a[i] -a[i-1]) break if y== -1 or y ==0: if y == -1: print("YES") print(int(1e9),int(1e9)) else: print("NO") else : f = True I = a[0]//y if a[0] % y !=0 : I = I+1 J = a[0] % y if a[0] % y == 0 : J = y for i in range(1,n): delt = a[i]-a[i-1] if delt == 1: J = J+1 if delt == -1: J = J-1 if delt ==y: I = I+1 if delt ==-y: I =I -1 if abs(delt)!=1 and abs(delt)!=y: f = False if I<=0 or J<=0 or J >y: f = False if f == True: print("YES") print(int(1e9), y) else : print("NO")
n = int(input()) a = [ int(x) for x in input().split()] last = 1 y = -1 for i in range(1,n): if abs(a[i] - a[i-1]) !=1: y =abs(a[i] -a[i-1]) break if y== -1 or y ==0: if y == -1: print("YES") print(int(1e9),int(1e9)) else: print("NO") else : f = True I = a[0]//y if a[0] % y !=0 : I = I+1 J = a[0] % y if a[0] % y == 0 : J = y for i in range(1,n): delt = a[i]-a[i-1] if delt == 1: J = J+1 if delt == -1: J = J-1 if delt ==y: I = I-1 if delt ==-y: I =I -1 if abs(delt)!=1 and abs(delt)!=y: f = False if I<=0 or J<=0 or J >y: f = False if f == True: print("YES") print(int(1e9), y) else : print("NO")
I = I-1
30
operation
n = int(input()) a = [ int(x) for x in input().split()] last = 1 y = -1 for i in range(1,n): if abs(a[i] - a[i-1]) !=1: y =abs(a[i] -a[i-1]) break if y== -1 or y ==0: if y == -1: print("YES") print(int(1e9),int(1e9)) else: print("NO") else : f = True I = a[0]//y if a[0] % y !=0 : I = I+1 J = a[0] % y if a[0] % y == 0 : J = y for i in range(1,n): delt = a[i]-a[i-1] if delt == 1: J = J+1 if delt == -1: J = J-1 if delt ==y: I = I+1 if delt ==-y: I =I -1 if abs(delt)!=1 and abs(delt)!=y: f = False if I<=0 or J<=0 or J >y: f = False if f == True: print("YES") print(int(1e9), y) else : print("NO")
n = int(input()) a = [ int(x) for x in input().split()] last = 1 y = -1 for i in range(1,n): if abs(a[i] - a[i%1]) !=1: y =abs(a[i] -a[i-1]) break if y== -1 or y ==0: if y == -1: print("YES") print(int(1e9),int(1e9)) else: print("NO") else : f = True I = a[0]//y if a[0] % y !=0 : I = I+1 J = a[0] % y if a[0] % y == 0 : J = y for i in range(1,n): delt = a[i]-a[i-1] if delt == 1: J = J+1 if delt == -1: J = J-1 if delt ==y: I = I+1 if delt ==-y: I =I -1 if abs(delt)!=1 and abs(delt)!=y: f = False if I<=0 or J<=0 or J >y: f = False if f == True: print("YES") print(int(1e9), y) else : print("NO")
if abs(a[i] - a[i%1]) !=1:
6
operation
n = int(input()) a = [ int(x) for x in input().split()] last = 1 y = -1 for i in range(1,n): if abs(a[i] - a[i-1]) !=1: y =abs(a[i] -a[i-1]) break if y== -1 or y ==0: if y == -1: print("YES") print(int(1e9),int(1e9)) else: print("NO") else : f = True I = a[0]//y if a[0] % y !=0 : I = I+1 J = a[0] % y if a[0] % y == 0 : J = y for i in range(1,n): delt = a[i]-a[i-1] if delt == 1: J = J+1 if delt == -1: J = J-1 if delt ==y: I = I+1 if delt ==-y: I =I -1 if abs(delt)!=1 and abs(delt)!=y: f = False if I<=0 or J<=0 or J >y: f = False if f == True: print("YES") print(int(1e9), y) else : print("NO")
n = int(input()) a = [ int(x) for x in input().split()] last = 1 y = -1 for i in range(1,n): if abs(a[i] - a[i//1]) !=1: y =abs(a[i] -a[i-1]) break if y== -1 or y ==0: if y == -1: print("YES") print(int(1e9),int(1e9)) else: print("NO") else : f = True I = a[0]//y if a[0] % y !=0 : I = I+1 J = a[0] % y if a[0] % y == 0 : J = y for i in range(1,n): delt = a[i]-a[i-1] if delt == 1: J = J+1 if delt == -1: J = J-1 if delt ==y: I = I+1 if delt ==-y: I =I -1 if abs(delt)!=1 and abs(delt)!=y: f = False if I<=0 or J<=0 or J >y: f = False if f == True: print("YES") print(int(1e9), y) else : print("NO")
if abs(a[i] - a[i//1]) !=1:
6
operation
n = int(input()) a = [ int(x) for x in input().split()] last = 1 y = -1 for i in range(1,n): if abs(a[i] - a[i-1]) !=1: y =abs(a[i] -a[i-1]) break if y== -1 or y ==0: if y == -1: print("YES") print(int(1e9),int(1e9)) else: print("NO") else : f = True I = a[0]//y if a[0] % y !=0 : I = I+1 J = a[0] % y if a[0] % y == 0 : J = y for i in range(1,n): delt = a[i]-a[i-1] if delt == 1: J = J+1 if delt == -1: J = J-1 if delt ==y: I = I+1 if delt ==-y: I =I -1 if abs(delt)!=1 and abs(delt)!=y: f = False if I<=0 or J<=0 or J >y: f = False if f == True: print("YES") print(int(1e9), y) else : print("NO")
n = int(input()) a = [ int(x) for x in input().split()] last = 1 y = -1 for i in range(1,n): if abs(a[i] - a[i-1]) !=1: y =abs(a[i]-a[i-1]) break if y== -1 or y ==0: if y == -1: print("YES") print(int(1e9),int(1e9)) else: print("NO") else : f = True I = a[0]//y if a[0] % y !=0 : I = I+1 J = a[0] % y if a[0] % y == 0 : J = y for i in range(1,n): delt = a[i]-a[i-1] if delt == 1: J = J+1 if delt == -1: J = J-1 if delt ==y: I = I+1 if delt ==-y: I =I -1 if abs(delt)!=1 and abs(delt)!=y: f = False if I<=0 or J<=0 or J >y: f = False if f == True: print("YES") print(int(1e9), y) else : print("NO")
y =abs(a[i]-a[i-1])
7
operation
n=int(input()) l = ['a','e','i','o','u','y'] s=input() i=0 while i < n-1 and len(s) > 1: if s[i] in l and s[i+1] in l: s=s[:i+1]+s[i+2:] else: i+=1 print(s)
n=int(input()) l = ['a','e','i','o','u','y'] s=input() i=0 while i < n-1 and len(s) > 1: if s[i] in l and s[i+1] in l: y=s[:i+1]+s[i+2:] else: i+=1 print(s)
y=s[:i+1]+s[i+2:]
7
statement
n=int(input()) l = ['a','e','i','o','u','y'] s=input() i=0 while i < n-1 and len(s) > 1: if s[i] in l and s[i+1] in l: s=s[:i+1]+s[i+2:] else: i+=1 print(s)
n=int(input()) l = ['a','e','i','o','u','y'] s=input() i=0 while i < n-1 and len(s) > 1: if s[i] in l and s[i+1] in l: s=s[:i+1]+s[i//2:] else: i+=1 print(s)
s=s[:i+1]+s[i//2:]
7
operation
n=int(input()) l = ['a','e','i','o','u','y'] s=input() i=0 while i < n-1 and len(s) > 1: if s[i] in l and s[i+1] in l: s=s[:i+1]+s[i+2:] else: i+=1 print(s)
n=int(input()) l = ['a','e','i','o','u','y'] s=input() i=0 while i>n-1 and len(s) > 1: if s[i] in l and s[i+1] in l: s=s[:i+1]+s[i+2:] else: i+=1 print(s)
while i>n-1 and len(s) > 1:
5
decision
n=int(input()) l = ['a','e','i','o','u','y'] s=input() i=0 while i < n-1 and len(s) > 1: if s[i] in l and s[i+1] in l: s=s[:i+1]+s[i+2:] else: i+=1 print(s)
n=int(input()) l = ['a','e','i','o','u','y'] s=input() i=0 while i>n-1 and len(s) > 1: if s[i] in l and s[i+1] in l: s=s[:i+1]+s[i+2:] else: i+=1 print(s)
while i>n-1 and len(s) > 1:
5
decision
n=int(input()) a=list(map(int,input().split())) ma=max(a) c=a.count(ma) if c==n: if c%2==0: print("Agasa") else: print("Conan") else: print("Conan")
n=int(input()) a=list(map(int,input().split())) ma=max(a) c=a.count(ma) if c==n: if c%2<0: print("Agasa") else: print("Conan") else: print("Conan")
if c%2<0:
6
decision
n=int(input()) a=list(map(int,input().split())) ma=max(a) c=a.count(ma) if c==n: if c%2==0: print("Agasa") else: print("Conan") else: print("Conan")
n=int(input()) a=list(map(int,input().split())) ma=max(a) c=a.count(ma) if c==n: if c%2==117: print("Agasa") else: print("Conan") else: print("Conan")
if c%2==117:
6
value
n=int(input()) a=list(map(int,input().split())) ma=max(a) c=a.count(ma) if c==n: if c%2==0: print("Agasa") else: print("Conan") else: print("Conan")
n=int(input()) a=list(map(int,input().split())) ma=max(a) c=a.count(ma) if c==n: if c-2==0: print("Agasa") else: print("Conan") else: print("Conan")
if c-2==0:
6
operation
n=int(input()) a=list(map(int,input().split())) ma=max(a) c=a.count(ma) if c==n: if c%2==0: print("Agasa") else: print("Conan") else: print("Conan")
n=int(input()) a=list(map(int,input().split())) ma=max(a) c=a.count(ma) if c<n: if c%2==0: print("Agasa") else: print("Conan") else: print("Conan")
if c<n:
5
decision
n=int(input()) a=list(map(int,input().split())) ma=max(a) c=a.count(ma) if c==n: if c%2==0: print("Agasa") else: print("Conan") else: print("Conan")
n=int(input()) a=list(map(int,input().split())) ma=max(a) c=a.count(ma) if c==n: if c%191==0: print("Agasa") else: print("Conan") else: print("Conan")
if c%191==0:
6
value
from sys import stdin, stdout Input = [] Input = [stdin.readlines()] Input = Input[0] Input = [x.split(" ") for x in Input] n = int(Input[0][0]) k = int(Input[0][1]) a = [int(x) for x in Input[1]] moda = [n%x for x in a] good = [] for i in range(n): if moda[i] == 0: good.append(a[i]) stdout.write(str(k/max(good)))
from sys import stdin, stdout Input = [] Input = [stdin.readlines()] Input = Input[0] Input = [x.split(" ") for x in Input] n = int(Input[0][0]) k = int(Input[0][1]) a = [int(x) for x in Input[1]] moda = [n%x for x in a] good = [] for i in range(n): if moda[i] == 0: good.append(a[i]) stdout.write(str(k//max(good)))
stdout.write(str(k//max(good)))
14
operation
from sys import stdin, stdout Input = [] Input = [stdin.readlines()] Input = Input[0] Input = [x.split(" ") for x in Input] n = int(Input[0][0]) k = int(Input[0][1]) a = [int(x) for x in Input[1]] moda = [n%x for x in a] good = [] for i in range(n): if moda[i] == 0: good.append(a[i]) stdout.write(str(k/max(good)))
from sys import stdin, stdout Input = [] Input = [stdin.readlines()] Input = Input[0] Input = [x.split(" ") for x in Input] n = int(Input[0][0]) k = int(Input[0][1]) a = [int(x) for x in Input[1]] moda = [n%x for x in a] good = [] for i in range(n): if moda[i]<0: good.append(a[i]) stdout.write(str(k/max(good)))
if moda[i]<0:
12
decision
from sys import stdin, stdout Input = [] Input = [stdin.readlines()] Input = Input[0] Input = [x.split(" ") for x in Input] n = int(Input[0][0]) k = int(Input[0][1]) a = [int(x) for x in Input[1]] moda = [n%x for x in a] good = [] for i in range(n): if moda[i] == 0: good.append(a[i]) stdout.write(str(k/max(good)))
from sys import stdin, stdout y = [] Input = [stdin.readlines()] Input = Input[0] Input = [x.split(" ") for x in Input] n = int(Input[0][0]) k = int(Input[0][1]) a = [int(x) for x in Input[1]] moda = [n%x for x in a] good = [] for i in range(n): if moda[i] == 0: good.append(a[i]) stdout.write(str(k/max(good)))
y = []
2
statement
from sys import stdin, stdout Input = [] Input = [stdin.readlines()] Input = Input[0] Input = [x.split(" ") for x in Input] n = int(Input[0][0]) k = int(Input[0][1]) a = [int(x) for x in Input[1]] moda = [n%x for x in a] good = [] for i in range(n): if moda[i] == 0: good.append(a[i]) stdout.write(str(k/max(good)))
from sys import stdin, stdout Input = [] Input = [stdin.readlines()] Input = Input[0] Input = [x.split(" ") for x in Input] n = int(Input[0][0]) k = int(Input[0][1]) a = [int(x) for x in Input[1]] moda = [n%x for x in a] good = [] for i in range(n): if moda[i] == 0: good.append(a[i]) stdout.write(str(k%max(good)))
stdout.write(str(k%max(good)))
14
operation
from sys import stdin, stdout Input = [] Input = [stdin.readlines()] Input = Input[0] Input = [x.split(" ") for x in Input] n = int(Input[0][0]) k = int(Input[0][1]) a = [int(x) for x in Input[1]] moda = [n%x for x in a] good = [] for i in range(n): if moda[i] == 0: good.append(a[i]) stdout.write(str(k/max(good)))
from sys import stdin, stdout Input = [] Input = [stdin.readlines()] Input = Input[0] Input = [x.split(" ") for x in Input] n = int(Input[0][0]) k = int(Input[0][1]) a = [int(x) for x in Input[1]] moda = [n**x for x in a] good = [] for i in range(n): if moda[i] == 0: good.append(a[i]) stdout.write(str(k/max(good)))
moda = [n**x for x in a]
9
operation
n,m = map(int,input().split()) a = [int(i) for i in input().split()] b = [int(i) for i in input().split()] a.sort() x = a.pop() b.sort() p = max(a)*max(b) q = max(a)*min(b) r = min(a)*min(b) s = min(a)*max(b) ans = max(p,q,r,s) print(ans)
n,m = map(int,input().split()) a = [int(i) for i in input().split()] b = [int(i) for i in input().split()] a.sort() x = a.pop() b.sort() p = max(a)*max(b) q = max(a)**min(b) r = min(a)*min(b) s = min(a)*max(b) ans = max(p,q,r,s) print(ans)
q = max(a)**min(b)
8
operation
n,m = map(int,input().split()) a = [int(i) for i in input().split()] b = [int(i) for i in input().split()] a.sort() x = a.pop() b.sort() p = max(a)*max(b) q = max(a)*min(b) r = min(a)*min(b) s = min(a)*max(b) ans = max(p,q,r,s) print(ans)
n,m = map(int,input().split()) a = [int(i) for i in input().split()] b = [int(i) for i in input().split()] a.sort() x = a.pop() b.sort() p = max(a)*max(b) q = max(a)-min(b) r = min(a)*min(b) s = min(a)*max(b) ans = max(p,q,r,s) print(ans)
q = max(a)-min(b)
8
operation
n,m = map(int,input().split()) a = [int(i) for i in input().split()] b = [int(i) for i in input().split()] a.sort() x = a.pop() b.sort() p = max(a)*max(b) q = max(a)*min(b) r = min(a)*min(b) s = min(a)*max(b) ans = max(p,q,r,s) print(ans)
n,m = map(int,input().split()) a = [int(i) for i in input().split()] b = [int(i) for i in input().split()] a.sort() x = a.pop() b.sort() p = max(a)<<max(b) q = max(a)*min(b) r = min(a)*min(b) s = min(a)*max(b) ans = max(p,q,r,s) print(ans)
p = max(a)<<max(b)
7
operation
n,t=map(int,input().split()) l1=list(map(int,input().split())) l2=list(map(int,input().split())) l=[[l2[i],l1[i]] for i in range(n)] l.sort() s1=sum([l[i][0]*l[i][1] for i in range(n)]) s2=sum(l1) s=s1/s2 f=n-1 d=0 if s<t: while s<t and d<n: s2=s2-l[d][1] s1=s1-l[d][0]*l[d][1] if s!=0: s=s1/s2 if s>t: s2+=(s2*t-s1)/(l[d][0]-t) break elif s==t: break else: d+=1 if d==n: s2=0.0 elif s>t: while s>t and f>=0: s2=s2-l[f][1] s1=s1-l[f][0]*l[f][1] if s2!=0: s=s1/s2 if s<t: s2+=(t*s2-s1)/(l[f][0]-t) break elif s==t: break else: f-=1 if f==-1: s2=0.0 print(s2)
n,t=map(int,input().split()) l1=list(map(int,input().split())) l2=list(map(int,input().split())) l=[[l2[i],l1[i]] for i in range(n)] l.sort() s1=sum([l[i][0]*l[i][1] for i in range(n)]) s2=sum(l1) s=s1/s2 f=n-1 d=0 if s<t: while s<t and d<n: s2=s2-l[d][1] s1=s1-l[d][0]*l[d][1] if s!=0: s=s1/s2 if s>t: s2+=(s2*t-s1)/(l[d][0]-t) break elif s==t: break else: d+=1 if d==n: s2=0.0 elif s>t: while s>t and f>=0: s2=s2-l[f][1] s1=s1<<l[f][0]*l[f][1] if s2!=0: s=s1/s2 if s<t: s2+=(t*s2-s1)/(l[f][0]-t) break elif s==t: break else: f-=1 if f==-1: s2=0.0 print(s2)
s1=s1<<l[f][0]*l[f][1]
43
operation
n,t=map(int,input().split()) l1=list(map(int,input().split())) l2=list(map(int,input().split())) l=[[l2[i],l1[i]] for i in range(n)] l.sort() s1=sum([l[i][0]*l[i][1] for i in range(n)]) s2=sum(l1) s=s1/s2 f=n-1 d=0 if s<t: while s<t and d<n: s2=s2-l[d][1] s1=s1-l[d][0]*l[d][1] if s!=0: s=s1/s2 if s>t: s2+=(s2*t-s1)/(l[d][0]-t) break elif s==t: break else: d+=1 if d==n: s2=0.0 elif s>t: while s>t and f>=0: s2=s2-l[f][1] s1=s1-l[f][0]*l[f][1] if s2!=0: s=s1/s2 if s<t: s2+=(t*s2-s1)/(l[f][0]-t) break elif s==t: break else: f-=1 if f==-1: s2=0.0 print(s2)
n,t=map(int,input().split()) l1=list(map(int,input().split())) l2=list(map(int,input().split())) l=[[l2[i],l1[i]] for i in range(n)] l.sort() s1=sum([l[i][0]-l[i][1] for i in range(n)]) s2=sum(l1) s=s1/s2 f=n-1 d=0 if s<t: while s<t and d<n: s2=s2-l[d][1] s1=s1-l[d][0]*l[d][1] if s!=0: s=s1/s2 if s>t: s2+=(s2*t-s1)/(l[d][0]-t) break elif s==t: break else: d+=1 if d==n: s2=0.0 elif s>t: while s>t and f>=0: s2=s2-l[f][1] s1=s1-l[f][0]*l[f][1] if s2!=0: s=s1/s2 if s<t: s2+=(t*s2-s1)/(l[f][0]-t) break elif s==t: break else: f-=1 if f==-1: s2=0.0 print(s2)
s1=sum([l[i][0]-l[i][1] for i in range(n)])
43
operation
n,t=map(int,input().split()) l1=list(map(int,input().split())) l2=list(map(int,input().split())) l=[[l2[i],l1[i]] for i in range(n)] l.sort() s1=sum([l[i][0]*l[i][1] for i in range(n)]) s2=sum(l1) s=s1/s2 f=n-1 d=0 if s<t: while s<t and d<n: s2=s2-l[d][1] s1=s1-l[d][0]*l[d][1] if s!=0: s=s1/s2 if s>t: s2+=(s2*t-s1)/(l[d][0]-t) break elif s==t: break else: d+=1 if d==n: s2=0.0 elif s>t: while s>t and f>=0: s2=s2-l[f][1] s1=s1-l[f][0]*l[f][1] if s2!=0: s=s1/s2 if s<t: s2+=(t*s2-s1)/(l[f][0]-t) break elif s==t: break else: f-=1 if f==-1: s2=0.0 print(s2)
n,t=map(int,input().split()) l1=list(map(int,input().split())) l2=list(map(int,input().split())) l=[[l2[i],l1[i]] for i in range(n)] l.sort() s1=sum([l[i][0]*l[i][1] for i in range(n)]) s2=sum(l1) s=s1/s2 f=n-1 d=0 if s<t: while s<t and d<n: s2=s2-l[d][1] s1=s1-l[d][0]*l[d][1] if s!=0: s=s1/s2 if s>t: s2+=(s2*t-s1)/(l[d][0]-t) break elif s==t: break else: d+=1 if d==n: s2=0.0 elif s>t: while s>t and f>=0: s2=s2-l[f][1] s1=s1-l[f][74]*l[f][1] if s2!=0: s=s1/s2 if s<t: s2+=(t*s2-s1)/(l[f][0]-t) break elif s==t: break else: f-=1 if f==-1: s2=0.0 print(s2)
s1=s1-l[f][74]*l[f][1]
43
value
n,t=map(int,input().split()) l1=list(map(int,input().split())) l2=list(map(int,input().split())) l=[[l2[i],l1[i]] for i in range(n)] l.sort() s1=sum([l[i][0]*l[i][1] for i in range(n)]) s2=sum(l1) s=s1/s2 f=n-1 d=0 if s<t: while s<t and d<n: s2=s2-l[d][1] s1=s1-l[d][0]*l[d][1] if s!=0: s=s1/s2 if s>t: s2+=(s2*t-s1)/(l[d][0]-t) break elif s==t: break else: d+=1 if d==n: s2=0.0 elif s>t: while s>t and f>=0: s2=s2-l[f][1] s1=s1-l[f][0]*l[f][1] if s2!=0: s=s1/s2 if s<t: s2+=(t*s2-s1)/(l[f][0]-t) break elif s==t: break else: f-=1 if f==-1: s2=0.0 print(s2)
n,t=map(int,input().split()) l1=list(map(int,input().split())) l2=list(map(int,input().split())) l=[[l2[i],l1[i]] for i in range(n)] l.sort() s1=sum([l[i][0]*l[i][1] for i in range(n)]) s2=sum(l1) s=s1/s2 f=n-1 d=0 if s<t: while s<t and d<n: s2=s2-l[d][1] s1=s1-l[d][0]*l[d][1] if s!=0: s=s1/s2 if s>t: s2+=(s2*t-s1)/(l[d][0]-t) break elif s==t: break else: d+=1 if d==n: s2=0.0 elif s>t: while s>t and f>=0: s2=s2-l[f][1] s1=s1-l[f][0]*l[f][1] if s2!=0: s=s1/s2 if s<t: s2+=(t*s2-s1)/(l[f][0]-t) break elif s==t: break else: f-=1 if f==-1: s2=0.0 print(s2)
43
decision
n,t=map(int,input().split()) l1=list(map(int,input().split())) l2=list(map(int,input().split())) l=[[l2[i],l1[i]] for i in range(n)] l.sort() s1=sum([l[i][0]*l[i][1] for i in range(n)]) s2=sum(l1) s=s1/s2 f=n-1 d=0 if s<t: while s<t and d<n: s2=s2-l[d][1] s1=s1-l[d][0]*l[d][1] if s!=0: s=s1/s2 if s>t: s2+=(s2*t-s1)/(l[d][0]-t) break elif s==t: break else: d+=1 if d==n: s2=0.0 elif s>t: while s>t and f>=0: s2=s2-l[f][1] s1=s1-l[f][0]*l[f][1] if s2!=0: s=s1/s2 if s<t: s2+=(t*s2-s1)/(l[f][0]-t) break elif s==t: break else: f-=1 if f==-1: s2=0.0 print(s2)
n,t=map(int,input().split()) l1=list(map(int,input().split())) l2=list(map(int,input().split())) l=[[l2[i],l1[i]] for i in range(n)] l.sort() s1=sum([l[i][0]*l[i][1] for i in range(n)]) s2=sum(l1) s=s1/s2 f=n-1 d=0 if s>t: while s<t and d<n: s2=s2-l[d][1] s1=s1-l[d][0]*l[d][1] if s!=0: s=s1/s2 if s>t: s2+=(s2*t-s1)/(l[d][0]-t) break elif s==t: break else: d+=1 if d==n: s2=0.0 elif s>t: while s>t and f>=0: s2=s2-l[f][1] s1=s1-l[f][0]*l[f][1] if s2!=0: s=s1/s2 if s<t: s2+=(t*s2-s1)/(l[f][0]-t) break elif s==t: break else: f-=1 if f==-1: s2=0.0 print(s2)
if s>t:
43
decision
def read_nums(): return [int(x) for x in input().split()] def find_max_window_index(n_hours, people, window_len): people += people cur_sum = sum(people[0: window_len]) max_sum = cur_sum res_index = 0 for index in range(0, n_hours-1): cur_sum -= people[index] cur_sum += people[index + window_len] if cur_sum > max_sum: max_sum = cur_sum res_index = index + 1 return res_index def get_res(n_hours, people, start_min, end_max): window_len = end_max - start_min start_time_zone = find_max_window_index(n_hours, people, window_len) + 1 res = start_min - start_time_zone + 1 if res <= 0: res = res + n_hours return res def main(): n_hours = int(input()) people = read_nums() start_min, end_max = read_nums() print(get_res(n_hours, people, start_min, end_max)) if __name__ == '__main__': main()
def read_nums(): return [int(x) for x in input().split()] def find_max_window_index(n_hours, people, window_len): people += people cur_sum = sum(people[0: window_len]) max_sum = cur_sum res_index = 0 for index in range(0, n_hours-1): cur_sum -= people[index] cur_sum += people[index + window_len] if cur_sum > max_sum: max_sum = cur_sum res_index = index + 1 return res_index def get_res(n_hours, people, start_min, end_max): window_len = end_max - start_min start_time_zone = find_max_window_index(n_hours, people, window_len) + 1 res = start_min - start_time_zone + 1 if res>=0: res = res + n_hours return res def main(): n_hours = int(input()) people = read_nums() start_min, end_max = read_nums() print(get_res(n_hours, people, start_min, end_max)) if __name__ == '__main__': main()
if res>=0:
23
decision
def read_nums(): return [int(x) for x in input().split()] def find_max_window_index(n_hours, people, window_len): people += people cur_sum = sum(people[0: window_len]) max_sum = cur_sum res_index = 0 for index in range(0, n_hours-1): cur_sum -= people[index] cur_sum += people[index + window_len] if cur_sum > max_sum: max_sum = cur_sum res_index = index + 1 return res_index def get_res(n_hours, people, start_min, end_max): window_len = end_max - start_min start_time_zone = find_max_window_index(n_hours, people, window_len) + 1 res = start_min - start_time_zone + 1 if res <= 0: res = res + n_hours return res def main(): n_hours = int(input()) people = read_nums() start_min, end_max = read_nums() print(get_res(n_hours, people, start_min, end_max)) if __name__ == '__main__': main()
def read_nums(): return [int(x) for x in input().split()] def find_max_window_index(n_hours, people, window_len): people += people cur_sum = sum(people[0: window_len]) max_sum = cur_sum res_index = 67 for index in range(0, n_hours-1): cur_sum -= people[index] cur_sum += people[index + window_len] if cur_sum > max_sum: max_sum = cur_sum res_index = index + 1 return res_index def get_res(n_hours, people, start_min, end_max): window_len = end_max - start_min start_time_zone = find_max_window_index(n_hours, people, window_len) + 1 res = start_min - start_time_zone + 1 if res <= 0: res = res + n_hours return res def main(): n_hours = int(input()) people = read_nums() start_min, end_max = read_nums() print(get_res(n_hours, people, start_min, end_max)) if __name__ == '__main__': main()
res_index = 67
9
value
def read_nums(): return [int(x) for x in input().split()] def find_max_window_index(n_hours, people, window_len): people += people cur_sum = sum(people[0: window_len]) max_sum = cur_sum res_index = 0 for index in range(0, n_hours-1): cur_sum -= people[index] cur_sum += people[index + window_len] if cur_sum > max_sum: max_sum = cur_sum res_index = index + 1 return res_index def get_res(n_hours, people, start_min, end_max): window_len = end_max - start_min start_time_zone = find_max_window_index(n_hours, people, window_len) + 1 res = start_min - start_time_zone + 1 if res <= 0: res = res + n_hours return res def main(): n_hours = int(input()) people = read_nums() start_min, end_max = read_nums() print(get_res(n_hours, people, start_min, end_max)) if __name__ == '__main__': main()
def read_nums(): return [int(x) for x in input().split()] def find_max_window_index(n_hours, people, window_len): people += people cur_sum = sum(people[0: window_len]) max_sum = cur_sum res_index = 0 for index in range(0, n_hours-1): cur_sum -= people[index] cur_sum += people[index + window_len] if cur_sum > max_sum: max_sum = cur_sum res_index = index + 1 return res_index def get_res(n_hours, people, start_min, end_max): window_len = end_max - start_min start_time_zone = find_max_window_index(n_hours, people, window_len) + 1 res = start_min - start_time_zone + 1 if res <= 0: res = res + n_hours return res def main(): n_hours = int(input()) people = read_nums() start_min, end_max = read_nums() print(get_res(n_hours, people, start_min, end_max)) if y == '__main__': main()
if y == '__main__':
36
statement
def read_nums(): return [int(x) for x in input().split()] def find_max_window_index(n_hours, people, window_len): people += people cur_sum = sum(people[0: window_len]) max_sum = cur_sum res_index = 0 for index in range(0, n_hours-1): cur_sum -= people[index] cur_sum += people[index + window_len] if cur_sum > max_sum: max_sum = cur_sum res_index = index + 1 return res_index def get_res(n_hours, people, start_min, end_max): window_len = end_max - start_min start_time_zone = find_max_window_index(n_hours, people, window_len) + 1 res = start_min - start_time_zone + 1 if res <= 0: res = res + n_hours return res def main(): n_hours = int(input()) people = read_nums() start_min, end_max = read_nums() print(get_res(n_hours, people, start_min, end_max)) if __name__ == '__main__': main()
def read_nums(): return [int(x) for x in input().split()] def find_max_window_index(n_hours, people, window_len): people += people cur_sum = sum(people[0: window_len]) max_sum = cur_sum res_index = 0 for index in range(0, n_hours-1): cur_sum -= people[index] cur_sum += people[index + window_len] if cur_sum > max_sum: max_sum = cur_sum res_index = index + 1 return res_index def get_res(n_hours, people, start_min, end_max): window_len = end_max - start_min start_time_zone = find_max_window_index(n_hours, people, window_len) + 1 res = start_min - start_time_zone + 163 if res <= 0: res = res + n_hours return res def main(): n_hours = int(input()) people = read_nums() start_min, end_max = read_nums() print(get_res(n_hours, people, start_min, end_max)) if __name__ == '__main__': main()
res = start_min - start_time_zone + 163
22
value
def read_nums(): return [int(x) for x in input().split()] def find_max_window_index(n_hours, people, window_len): people += people cur_sum = sum(people[0: window_len]) max_sum = cur_sum res_index = 0 for index in range(0, n_hours-1): cur_sum -= people[index] cur_sum += people[index + window_len] if cur_sum > max_sum: max_sum = cur_sum res_index = index + 1 return res_index def get_res(n_hours, people, start_min, end_max): window_len = end_max - start_min start_time_zone = find_max_window_index(n_hours, people, window_len) + 1 res = start_min - start_time_zone + 1 if res <= 0: res = res + n_hours return res def main(): n_hours = int(input()) people = read_nums() start_min, end_max = read_nums() print(get_res(n_hours, people, start_min, end_max)) if __name__ == '__main__': main()
def read_nums(): return [int(x) for x in input().split()] def find_max_window_index(n_hours, people, window_len): people += people cur_sum = sum(people[0: window_len]) max_sum = cur_sum res_index = 0 for index in range(0, n_hours-1): cur_sum -= people[index] cur_sum += people[index + window_len] if cur_sum > max_sum: max_sum = cur_sum res_index = index + 1 return res_index def get_res(n_hours, people, start_min, end_max): window_len = end_max - start_min start_time_zone = find_max_window_index(n_hours, people, window_len) + 1 res = start_min - start_time_zone + 1 if res>=0: res = res + n_hours return res def main(): n_hours = int(input()) people = read_nums() start_min, end_max = read_nums() print(get_res(n_hours, people, start_min, end_max)) if __name__ == '__main__': main()
if res>=0:
23
decision
import re n = input() seq = input() def replace_char(seq): slen = len(seq) for i,c in enumerate(seq): if(i<=len(seq)-2): if((seq[i]=="R" and seq[i+1]=="U") or (seq[i]=="U" and seq[i+1]=="R")): seq = seq[:i] + "D" + (seq[i+2:] if (i<len(seq)-1) else "") break return (len(seq) if (slen == len(seq)) else replace_char(seq)) print(replace_char(seq))
import re n = input() seq = input() def replace_char(seq): slen = len(seq) for i,c in enumerate(seq): if(i<=len(seq)-2): if((seq[i]=="R" and seq[i+1]=="U") or (seq[i]<"U" and seq[i+1]=="R")): seq = seq[:i] + "D" + (seq[i+2:] if (i<len(seq)-1) else "") break return (len(seq) if (slen == len(seq)) else replace_char(seq)) print(replace_char(seq))
if((seq[i]=="R" and seq[i+1]=="U") or (seq[i]<"U" and seq[i+1]=="R")):
8
decision
import re n = input() seq = input() def replace_char(seq): slen = len(seq) for i,c in enumerate(seq): if(i<=len(seq)-2): if((seq[i]=="R" and seq[i+1]=="U") or (seq[i]=="U" and seq[i+1]=="R")): seq = seq[:i] + "D" + (seq[i+2:] if (i<len(seq)-1) else "") break return (len(seq) if (slen == len(seq)) else replace_char(seq)) print(replace_char(seq))
import re n = input() seq = input() def replace_char(seq): slen = len(seq) for i,c in enumerate(seq): if(i<=len(seq)-2): if((seq[i]=="R" and seq[i+1]=="U") or (seq[i]=="U" and seq[i//1]=="R")): seq = seq[:i] + "D" + (seq[i+2:] if (i<len(seq)-1) else "") break return (len(seq) if (slen == len(seq)) else replace_char(seq)) print(replace_char(seq))
if((seq[i]=="R" and seq[i+1]=="U") or (seq[i]=="U" and seq[i//1]=="R")):
8
operation
import re n = input() seq = input() def replace_char(seq): slen = len(seq) for i,c in enumerate(seq): if(i<=len(seq)-2): if((seq[i]=="R" and seq[i+1]=="U") or (seq[i]=="U" and seq[i+1]=="R")): seq = seq[:i] + "D" + (seq[i+2:] if (i<len(seq)-1) else "") break return (len(seq) if (slen == len(seq)) else replace_char(seq)) print(replace_char(seq))
import re n = input() seq = input() def replace_char(seq): slen = len(seq) for i,c in enumerate(seq): if(i<=len(seq)-2): if((seq[i]<"R" and seq[i+1]=="U") or (seq[i]=="U" and seq[i+1]=="R")): seq = seq[:i] + "D" + (seq[i+2:] if (i<len(seq)-1) else "") break return (len(seq) if (slen == len(seq)) else replace_char(seq)) print(replace_char(seq))
if((seq[i]<"R" and seq[i+1]=="U") or (seq[i]=="U" and seq[i+1]=="R")):
8
decision