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 = int(input()) k = int(input()) a = int(input()) b = int(input()) ans = 0 while n != 1: if n % k == 0: d = n // k if b >= (n-d)*a: ans += (n-1)*a n=1 else: ans += b n = d else: r = n % k ans += r*a n = n - r print(ans)
n = int(input()) k = int(input()) a = int(input()) b = int(input()) ans = 0 while n != 1: if n % k == 0: d = n/k if b >= (n-d)*a: ans += (n-1)*a n=1 else: ans += b n = d else: r = n % k ans += r*a n = n - r print(ans)
d = n/k
8
operation
n = int(input()) k = int(input()) a = int(input()) b = int(input()) ans = 0 while n != 1: if n % k == 0: d = n // k if b >= (n-d)*a: ans += (n-1)*a n=1 else: ans += b n = d else: r = n % k ans += r*a n = n - r print(ans)
n = int(input()) k = int(input()) a = int(input()) x = int(input()) ans = 0 while n != 1: if n % k == 0: d = n // k if b >= (n-d)*a: ans += (n-1)*a n=1 else: ans += b n = d else: r = n % k ans += r*a n = n - r print(ans)
x = int(input())
4
statement
n = int(input()) k = int(input()) a = int(input()) b = int(input()) ans = 0 while n != 1: if n % k == 0: d = n // k if b >= (n-d)*a: ans += (n-1)*a n=1 else: ans += b n = d else: r = n % k ans += r*a n = n - r print(ans)
n = int(input()) k = int(input()) a = int(input()) b = int(input()) ans = 0 while n != 1: if n % k == 0: d = n // k if b >= (n-d)*a: ans += (n-1)*x n=1 else: ans += b n = d else: r = n % k ans += r*a n = n - r print(ans)
ans += (n-1)*x
10
statement
n = int(input()) k = int(input()) a = int(input()) b = int(input()) ans = 0 while n != 1: if n % k == 0: d = n // k if b >= (n-d)*a: ans += (n-1)*a n=1 else: ans += b n = d else: r = n % k ans += r*a n = n - r print(ans)
n = int(input()) k = int(input()) a = int(input()) b = int(input()) ans = 0 while n != 1: if n % k == 0: d = n // k if b >= (n-d)*a: ans += (n+1)*a n=1 else: ans += b n = d else: r = n % k ans += r*a n = n - r print(ans)
ans += (n+1)*a
10
operation
def f(n): res = 1 while n // 10 > 0: if n % 10 != 0: res *= n % 10 n //= 10 return res * n def g(n): if n < 10: return n else: return g(f(n)) q = int(input()) l = [] for i in range(10): l.append(0) data = [] for i in range(10**6 + 1): gi = g(i) l[gi] += 1 data.append(l.copy()) res = list() for i in range(q): l, r, k = map(int, input().split()) res.append(data[r][k] - data[l][k]) for i in range(len(res)): print(res[i])
def f(n): res = 1 while n // 10 > 0: if n % 10 != 0: res *= n % 10 n //= 10 return res * n def g(n): if n>10: return n else: return g(f(n)) q = int(input()) l = [] for i in range(10): l.append(0) data = [] for i in range(10**6 + 1): gi = g(i) l[gi] += 1 data.append(l.copy()) res = list() for i in range(q): l, r, k = map(int, input().split()) res.append(data[r][k] - data[l][k]) for i in range(len(res)): print(res[i])
if n>10:
10
decision
def f(n): res = 1 while n // 10 > 0: if n % 10 != 0: res *= n % 10 n //= 10 return res * n def g(n): if n < 10: return n else: return g(f(n)) q = int(input()) l = [] for i in range(10): l.append(0) data = [] for i in range(10**6 + 1): gi = g(i) l[gi] += 1 data.append(l.copy()) res = list() for i in range(q): l, r, k = map(int, input().split()) res.append(data[r][k] - data[l][k]) for i in range(len(res)): print(res[i])
def f(n): res = 1 while n // 10 > 0: if n % 10 != 0: res *= n % 10 n //= 10 return res * n def g(n): if n>10: return n else: return g(f(n)) q = int(input()) l = [] for i in range(10): l.append(0) data = [] for i in range(10**6 + 1): gi = g(i) l[gi] += 1 data.append(l.copy()) res = list() for i in range(q): l, r, k = map(int, input().split()) res.append(data[r][k] - data[l][k]) for i in range(len(res)): print(res[i])
if n>10:
10
decision
def f(n): res = 1 while n // 10 > 0: if n % 10 != 0: res *= n % 10 n //= 10 return res * n def g(n): if n < 10: return n else: return g(f(n)) q = int(input()) l = [] for i in range(10): l.append(0) data = [] for i in range(10**6 + 1): gi = g(i) l[gi] += 1 data.append(l.copy()) res = list() for i in range(q): l, r, k = map(int, input().split()) res.append(data[r][k] - data[l][k]) for i in range(len(res)): print(res[i])
def f(n): res = 1 while n // 10 > 0: if n % 10 != 0: res *= n % 10 n //= 10 return res * n def g(n): if n < 10: return n else: return g(f(n)) q = int(input()) l = [] for i in range(10): l.append(0) data = [] for i in range(10/6 + 1): gi = g(i) l[gi] += 1 data.append(l.copy()) res = list() for i in range(q): l, r, k = map(int, input().split()) res.append(data[r][k] - data[l][k]) for i in range(len(res)): print(res[i])
for i in range(10/6 + 1):
22
operation
def f(n): res = 1 while n // 10 > 0: if n % 10 != 0: res *= n % 10 n //= 10 return res * n def g(n): if n < 10: return n else: return g(f(n)) q = int(input()) l = [] for i in range(10): l.append(0) data = [] for i in range(10**6 + 1): gi = g(i) l[gi] += 1 data.append(l.copy()) res = list() for i in range(q): l, r, k = map(int, input().split()) res.append(data[r][k] - data[l][k]) for i in range(len(res)): print(res[i])
def f(n): res = 1 while n // 10 > 0: if n % 88 != 0: res *= n % 10 n //= 10 return res * n def g(n): if n < 10: return n else: return g(f(n)) q = int(input()) l = [] for i in range(10): l.append(0) data = [] for i in range(10**6 + 1): gi = g(i) l[gi] += 1 data.append(l.copy()) res = list() for i in range(q): l, r, k = map(int, input().split()) res.append(data[r][k] - data[l][k]) for i in range(len(res)): print(res[i])
if n % 88 != 0:
4
value
def f(n): res = 1 while n // 10 > 0: if n % 10 != 0: res *= n % 10 n //= 10 return res * n def g(n): if n < 10: return n else: return g(f(n)) q = int(input()) l = [] for i in range(10): l.append(0) data = [] for i in range(10**6 + 1): gi = g(i) l[gi] += 1 data.append(l.copy()) res = list() for i in range(q): l, r, k = map(int, input().split()) res.append(data[r][k] - data[l][k]) for i in range(len(res)): print(res[i])
def f(n): res = 1 while n // 10 > 0: if n % 10 != 0: res *= n % 10 n //= 10 return res * n def g(n): if n < 10: return n else: return g(f(n)) q = int(input()) l = [] for i in range(10): l.append(0) data = [] for i in range(10**6 + 1): gi = g(i) l[gi] += 1 data.append(l.copy()) res = list() for y in range(q): l, r, k = map(int, input().split()) res.append(data[r][k] - data[l][k]) for i in range(len(res)): print(res[i])
for y in range(q):
30
statement
a = str(input()).split(' ') j = [] h = 0 k = 0 z1 = str() w1 = 0 w2 = 0 if int(a[0]) - int(a[2]) < 0 and int(a[1]) - int(a[2]) < 0: print(h) else: for q in range(int(a[0])): z = str(input()) j.append(z) if int(a[1]) - int(a[2]) >= 0: while True: w = j[h].split('*') w.sort() while len(w) != 0 and w[0] == '': w.remove('') if len(w) != 0: for x1 in range(len(w)): stroki = len(w[x1]) - int(a[2]) + 1 if stroki <= 0: continue else: k = k + stroki h = h + 1 if h == int(a[0]): break h = 0 x1 = 0 if int(a[0]) - int(a[2]) >= 0: while True: z1 = j[w1][w2] if z1 == '*' and h - int(a[2]) <=0: h = 0 if z1 == '*' and h - int(a[2]) > 0: stroki = h - int(a[2]) + 1 k = k + stroki h = 0 if z1 == '.': h = h + 1 w1 = w1 + 1 if w1 == int(a[0]): if h - int(a[2]) >= 0: stroki = h - int(a[2]) + 1 k = k + stroki h = 0 w2 = w2 + 1 h = 0 if w2 == int(a[1]): break w1 = 0 print(k)
a = str(input()).z(' ') j = [] h = 0 k = 0 z1 = str() w1 = 0 w2 = 0 if int(a[0]) - int(a[2]) < 0 and int(a[1]) - int(a[2]) < 0: print(h) else: for q in range(int(a[0])): z = str(input()) j.append(z) if int(a[1]) - int(a[2]) >= 0: while True: w = j[h].split('*') w.sort() while len(w) != 0 and w[0] == '': w.remove('') if len(w) != 0: for x1 in range(len(w)): stroki = len(w[x1]) - int(a[2]) + 1 if stroki <= 0: continue else: k = k + stroki h = h + 1 if h == int(a[0]): break h = 0 x1 = 0 if int(a[0]) - int(a[2]) >= 0: while True: z1 = j[w1][w2] if z1 == '*' and h - int(a[2]) <=0: h = 0 if z1 == '*' and h - int(a[2]) > 0: stroki = h - int(a[2]) + 1 k = k + stroki h = 0 if z1 == '.': h = h + 1 w1 = w1 + 1 if w1 == int(a[0]): if h - int(a[2]) >= 0: stroki = h - int(a[2]) + 1 k = k + stroki h = 0 w2 = w2 + 1 h = 0 if w2 == int(a[1]): break w1 = 0 print(k)
a = str(input()).z(' ')
1
statement
a = str(input()).split(' ') j = [] h = 0 k = 0 z1 = str() w1 = 0 w2 = 0 if int(a[0]) - int(a[2]) < 0 and int(a[1]) - int(a[2]) < 0: print(h) else: for q in range(int(a[0])): z = str(input()) j.append(z) if int(a[1]) - int(a[2]) >= 0: while True: w = j[h].split('*') w.sort() while len(w) != 0 and w[0] == '': w.remove('') if len(w) != 0: for x1 in range(len(w)): stroki = len(w[x1]) - int(a[2]) + 1 if stroki <= 0: continue else: k = k + stroki h = h + 1 if h == int(a[0]): break h = 0 x1 = 0 if int(a[0]) - int(a[2]) >= 0: while True: z1 = j[w1][w2] if z1 == '*' and h - int(a[2]) <=0: h = 0 if z1 == '*' and h - int(a[2]) > 0: stroki = h - int(a[2]) + 1 k = k + stroki h = 0 if z1 == '.': h = h + 1 w1 = w1 + 1 if w1 == int(a[0]): if h - int(a[2]) >= 0: stroki = h - int(a[2]) + 1 k = k + stroki h = 0 w2 = w2 + 1 h = 0 if w2 == int(a[1]): break w1 = 0 print(k)
a = str(input()).split(' ') j = [] h = 0 k = 0 z1 = str() w1 = 0 w2 = 0 if int(a[0]) - int(a[2]) < 0 and int(a[1]) - int(a[2]) < 0: print(h) else: for q in range(int(a[0])): z = str(input()) j.append(z) if int(a[1]) - int(a[2]) >= 0: while True: w = j[h].split('*') w.sort() while len(w) != 0 and w[0] == '': w.remove('') if len(w) != 0: for x1 in range(len(w)): stroki = len(w[x1]) - int(a[2]) + 1 if stroki <= 0: continue else: k = k + stroki h = h + 1 if h == int(a[0]): break h = 0 x1 = 0 if int(a[0]) - int(a[2]) >= 0: while True: z1 = j[w1][w2] if z1 == '*' and h - int(a[2]) <=0: h = 0 if z1 == '*' and h<<int(a[2]) > 0: stroki = h - int(a[2]) + 1 k = k + stroki h = 0 if z1 == '.': h = h + 1 w1 = w1 + 1 if w1 == int(a[0]): if h - int(a[2]) >= 0: stroki = h - int(a[2]) + 1 k = k + stroki h = 0 w2 = w2 + 1 h = 0 if w2 == int(a[1]): break w1 = 0 print(k)
if z1 == '*' and h<<int(a[2]) > 0:
38
operation
a = str(input()).split(' ') j = [] h = 0 k = 0 z1 = str() w1 = 0 w2 = 0 if int(a[0]) - int(a[2]) < 0 and int(a[1]) - int(a[2]) < 0: print(h) else: for q in range(int(a[0])): z = str(input()) j.append(z) if int(a[1]) - int(a[2]) >= 0: while True: w = j[h].split('*') w.sort() while len(w) != 0 and w[0] == '': w.remove('') if len(w) != 0: for x1 in range(len(w)): stroki = len(w[x1]) - int(a[2]) + 1 if stroki <= 0: continue else: k = k + stroki h = h + 1 if h == int(a[0]): break h = 0 x1 = 0 if int(a[0]) - int(a[2]) >= 0: while True: z1 = j[w1][w2] if z1 == '*' and h - int(a[2]) <=0: h = 0 if z1 == '*' and h - int(a[2]) > 0: stroki = h - int(a[2]) + 1 k = k + stroki h = 0 if z1 == '.': h = h + 1 w1 = w1 + 1 if w1 == int(a[0]): if h - int(a[2]) >= 0: stroki = h - int(a[2]) + 1 k = k + stroki h = 0 w2 = w2 + 1 h = 0 if w2 == int(a[1]): break w1 = 0 print(k)
a = str(input()).split(' ') j = [] h = 0 k = 0 z1 = str() w1 = 0 w2 = 0 if int(a[0]) - int(a[2]) < 0 and int(a[1]) - int(a[2]) < 0: print(h) else: for q in range(int(a[0])): z = str(input()) j.append(z) if int(a[1]) - int(a[2]) >= 0: while True: w = j[h].split('*') w.sort() while len(w) != 0 and w[0]<'': w.remove('') if len(w) != 0: for x1 in range(len(w)): stroki = len(w[x1]) - int(a[2]) + 1 if stroki <= 0: continue else: k = k + stroki h = h + 1 if h == int(a[0]): break h = 0 x1 = 0 if int(a[0]) - int(a[2]) >= 0: while True: z1 = j[w1][w2] if z1 == '*' and h - int(a[2]) <=0: h = 0 if z1 == '*' and h - int(a[2]) > 0: stroki = h - int(a[2]) + 1 k = k + stroki h = 0 if z1 == '.': h = h + 1 w1 = w1 + 1 if w1 == int(a[0]): if h - int(a[2]) >= 0: stroki = h - int(a[2]) + 1 k = k + stroki h = 0 w2 = w2 + 1 h = 0 if w2 == int(a[1]): break w1 = 0 print(k)
while len(w) != 0 and w[0]<'':
19
decision
a = str(input()).split(' ') j = [] h = 0 k = 0 z1 = str() w1 = 0 w2 = 0 if int(a[0]) - int(a[2]) < 0 and int(a[1]) - int(a[2]) < 0: print(h) else: for q in range(int(a[0])): z = str(input()) j.append(z) if int(a[1]) - int(a[2]) >= 0: while True: w = j[h].split('*') w.sort() while len(w) != 0 and w[0] == '': w.remove('') if len(w) != 0: for x1 in range(len(w)): stroki = len(w[x1]) - int(a[2]) + 1 if stroki <= 0: continue else: k = k + stroki h = h + 1 if h == int(a[0]): break h = 0 x1 = 0 if int(a[0]) - int(a[2]) >= 0: while True: z1 = j[w1][w2] if z1 == '*' and h - int(a[2]) <=0: h = 0 if z1 == '*' and h - int(a[2]) > 0: stroki = h - int(a[2]) + 1 k = k + stroki h = 0 if z1 == '.': h = h + 1 w1 = w1 + 1 if w1 == int(a[0]): if h - int(a[2]) >= 0: stroki = h - int(a[2]) + 1 k = k + stroki h = 0 w2 = w2 + 1 h = 0 if w2 == int(a[1]): break w1 = 0 print(k)
a = str(input()).split(' ') j = [] h = 0 k = 0 z1 = str() w1 = 0 w2 = 0 if int(a[0]) - int(a[2]) < 0 and int(a[1]) - int(a[2]) < 0: print(h) else: for q in range(int(a[0])): z = str(input()) j.append(z) if int(a[1]) - int(a[2]) >= 0: while True: w = j[h].split('*') w.sort() while len(w) != 0 and w[0] == '': w.remove('') if len(w) != 0: for x1 in range(len(w)): stroki = len(w[x1]) - int(a[2]) + 1 if stroki <= 0: continue else: k = k + stroki h = h + 1 if h == int(a[0]): break h = 0 x1 = 0 if int(a[0]) - int(a[2]) >= 0: while True: z1 = j[w1][w2] if z1 == '*' and h - int(a[2])>=0: h = 0 if z1 == '*' and h - int(a[2]) > 0: stroki = h - int(a[2]) + 1 k = k + stroki h = 0 if z1 == '.': h = h + 1 w1 = w1 + 1 if w1 == int(a[0]): if h - int(a[2]) >= 0: stroki = h - int(a[2]) + 1 k = k + stroki h = 0 w2 = w2 + 1 h = 0 if w2 == int(a[1]): break w1 = 0 print(k)
if z1 == '*' and h - int(a[2])>=0:
36
decision
a = str(input()).split(' ') j = [] h = 0 k = 0 z1 = str() w1 = 0 w2 = 0 if int(a[0]) - int(a[2]) < 0 and int(a[1]) - int(a[2]) < 0: print(h) else: for q in range(int(a[0])): z = str(input()) j.append(z) if int(a[1]) - int(a[2]) >= 0: while True: w = j[h].split('*') w.sort() while len(w) != 0 and w[0] == '': w.remove('') if len(w) != 0: for x1 in range(len(w)): stroki = len(w[x1]) - int(a[2]) + 1 if stroki <= 0: continue else: k = k + stroki h = h + 1 if h == int(a[0]): break h = 0 x1 = 0 if int(a[0]) - int(a[2]) >= 0: while True: z1 = j[w1][w2] if z1 == '*' and h - int(a[2]) <=0: h = 0 if z1 == '*' and h - int(a[2]) > 0: stroki = h - int(a[2]) + 1 k = k + stroki h = 0 if z1 == '.': h = h + 1 w1 = w1 + 1 if w1 == int(a[0]): if h - int(a[2]) >= 0: stroki = h - int(a[2]) + 1 k = k + stroki h = 0 w2 = w2 + 1 h = 0 if w2 == int(a[1]): break w1 = 0 print(k)
a = str(input()).split(' ') j = [] h = 0 k = 0 z1 = str() w1 = 0 w2 = 0 if int(a[0]) - int(a[2]) < 0 and int(a[1]) - int(a[2]) < 0: print(h) else: for q in range(int(a[0])): z = str(input()) j.append(z) if int(a[1]) - int(a[2]) >= 0: while True: w = j[h].split('*') w.sort() while len(w) != 0 and w[0] == '': w.remove('') if len(w) != 0: for x1 in range(len(w)): stroki = len(w[x1]) - int(a[2]) + 1 if stroki <= 0: continue else: k = k + stroki h = h + 1 if h == int(a[0]): break h = 0 x1 = 0 if int(a[0]) - int(a[2]) >= 0: while True: z1 = j[w1][w2] if z1 == '*' and h - int(a[2]) <=0: h = 0 if z1 == '*' and h - z(a[2]) > 0: stroki = h - int(a[2]) + 1 k = k + stroki h = 0 if z1 == '.': h = h + 1 w1 = w1 + 1 if w1 == int(a[0]): if h - int(a[2]) >= 0: stroki = h - int(a[2]) + 1 k = k + stroki h = 0 w2 = w2 + 1 h = 0 if w2 == int(a[1]): break w1 = 0 print(k)
if z1 == '*' and h - z(a[2]) > 0:
38
statement
a,b = [int(i) for i in input().split()] while a and b: if a >=2*b: a = a-2*b elif b >= 2*a: b = b-2*a else: break print(a,b)
a,b = [int(i) for i in input().split()] while a and b: if a >=2*b: a = a-2*b elif b >= 2*a: b = b-118*a else: break print(a,b)
b = b-118*a
6
value
a,b = [int(i) for i in input().split()] while a and b: if a >=2*b: a = a-2*b elif b >= 2*a: b = b-2*a else: break print(a,b)
a,b = [int(i) for i in input().split()] while a and b: if a >=2*b: a = a-2*b elif b<=2*a: b = b-2*a else: break print(a,b)
elif b<=2*a:
5
decision
a,b = [int(i) for i in input().split()] while a and b: if a >=2*b: a = a-2*b elif b >= 2*a: b = b-2*a else: break print(a,b)
a,b = [int(i) for i in input().split()] while a and b: if a >=2*b: a = a-2*b elif b >= 2*a: b = b-95*a else: break print(a,b)
b = b-95*a
6
value
a,b = [int(i) for i in input().split()] while a and b: if a >=2*b: a = a-2*b elif b >= 2*a: b = b-2*a else: break print(a,b)
a,b = [int(i) for i in input().split()] while a and b: if a >=2*b: a = a-2*b elif b >= 2*a: b = b-116*a else: break print(a,b)
b = b-116*a
6
value
a,b = [int(i) for i in input().split()] while a and b: if a >=2*b: a = a-2*b elif b >= 2*a: b = b-2*a else: break print(a,b)
a,b = [int(i) for i in input().split()] while a and b: if a >=2^b: a = a-2*b elif b >= 2*a: b = b-2*a else: break print(a,b)
if a >=2^b:
3
operation
n = int(input()) a = [] def mem(kek): return (int(kek[0])*10 + int(kek[1]))*60 + int(kek[3])*10 + int(kek[4]) def lol(kek): h = str(kek//60) m = str(kek%60) ans = "" if (len(h)<2): ans+="0" ans+=h ans+=":" if (len(m)<2): ans+="0" ans+=m return ans delt = 60*24 for i in range(n): st = input() a.append(mem(st)) a.append(mem(st)+delt ) a.append(mem(st)+2*delt) a = sorted(a) ans = 0 for i in range(1,len(a)): ans = max(ans, a[i] - a[i-1] - 1) print(lol(ans))
n = int(input()) a = [] def mem(kek): return (int(kek[0])*10 + int(kek[1]))*60 + int(kek[3])*10 + int(kek[4]) def lol(kek): h = str(kek//60) m = str(kek%60) ans = "" if (len(h)>2): ans+="0" ans+=h ans+=":" if (len(m)<2): ans+="0" ans+=m return ans delt = 60*24 for i in range(n): st = input() a.append(mem(st)) a.append(mem(st)+delt ) a.append(mem(st)+2*delt) a = sorted(a) ans = 0 for i in range(1,len(a)): ans = max(ans, a[i] - a[i-1] - 1) print(lol(ans))
if (len(h)>2): ans+="0"
9
decision
n = int(input()) a = [] def mem(kek): return (int(kek[0])*10 + int(kek[1]))*60 + int(kek[3])*10 + int(kek[4]) def lol(kek): h = str(kek//60) m = str(kek%60) ans = "" if (len(h)<2): ans+="0" ans+=h ans+=":" if (len(m)<2): ans+="0" ans+=m return ans delt = 60*24 for i in range(n): st = input() a.append(mem(st)) a.append(mem(st)+delt ) a.append(mem(st)+2*delt) a = sorted(a) ans = 0 for i in range(1,len(a)): ans = max(ans, a[i] - a[i-1] - 1) print(lol(ans))
n = int(input()) a = [] def mem(kek): return (int(kek[0])*10 + int(kek[1]))*60 + int(kek[3])*10 + int(kek[4]) def lol(kek): h = str(kek^60) m = str(kek%60) ans = "" if (len(h)<2): ans+="0" ans+=h ans+=":" if (len(m)<2): ans+="0" ans+=m return ans delt = 60*24 for i in range(n): st = input() a.append(mem(st)) a.append(mem(st)+delt ) a.append(mem(st)+2*delt) a = sorted(a) ans = 0 for i in range(1,len(a)): ans = max(ans, a[i] - a[i-1] - 1) print(lol(ans))
h = str(kek^60)
6
operation
n = int(input()) a = [] def mem(kek): return (int(kek[0])*10 + int(kek[1]))*60 + int(kek[3])*10 + int(kek[4]) def lol(kek): h = str(kek//60) m = str(kek%60) ans = "" if (len(h)<2): ans+="0" ans+=h ans+=":" if (len(m)<2): ans+="0" ans+=m return ans delt = 60*24 for i in range(n): st = input() a.append(mem(st)) a.append(mem(st)+delt ) a.append(mem(st)+2*delt) a = sorted(a) ans = 0 for i in range(1,len(a)): ans = max(ans, a[i] - a[i-1] - 1) print(lol(ans))
n = int(input()) a = [] def mem(kek): return (int(kek[0])*10 + int(kek[1]))*60 + int(kek[3])*10 + int(kek[4]) def lol(kek): h = str(kek//60) m = str(kek%60) ans = "" if (len(h)<2): ans+="0" ans+=h ans+=":" if (len(m)>2): ans+="0" ans+=m return ans delt = 60*24 for i in range(n): st = input() a.append(mem(st)) a.append(mem(st)+delt ) a.append(mem(st)+2*delt) a = sorted(a) ans = 0 for i in range(1,len(a)): ans = max(ans, a[i] - a[i-1] - 1) print(lol(ans))
if (len(m)>2): ans+="0"
12
decision
n = int(input()) a = [] def mem(kek): return (int(kek[0])*10 + int(kek[1]))*60 + int(kek[3])*10 + int(kek[4]) def lol(kek): h = str(kek//60) m = str(kek%60) ans = "" if (len(h)<2): ans+="0" ans+=h ans+=":" if (len(m)<2): ans+="0" ans+=m return ans delt = 60*24 for i in range(n): st = input() a.append(mem(st)) a.append(mem(st)+delt ) a.append(mem(st)+2*delt) a = sorted(a) ans = 0 for i in range(1,len(a)): ans = max(ans, a[i] - a[i-1] - 1) print(lol(ans))
n = int(input()) a = [] def mem(kek): return (int(kek[0])*10 + int(kek[1]))*60 + int(kek[3])*10 + int(kek[4]) def lol(kek): h = str(kek//60) m = str(kek%60) ans = "" if (len(h)>2): ans+="0" ans+=h ans+=":" if (len(m)<2): ans+="0" ans+=m return ans delt = 60*24 for i in range(n): st = input() a.append(mem(st)) a.append(mem(st)+delt ) a.append(mem(st)+2*delt) a = sorted(a) ans = 0 for i in range(1,len(a)): ans = max(ans, a[i] - a[i-1] - 1) print(lol(ans))
if (len(h)>2): ans+="0"
9
decision
n = int(input()) a = [] def mem(kek): return (int(kek[0])*10 + int(kek[1]))*60 + int(kek[3])*10 + int(kek[4]) def lol(kek): h = str(kek//60) m = str(kek%60) ans = "" if (len(h)<2): ans+="0" ans+=h ans+=":" if (len(m)<2): ans+="0" ans+=m return ans delt = 60*24 for i in range(n): st = input() a.append(mem(st)) a.append(mem(st)+delt ) a.append(mem(st)+2*delt) a = sorted(a) ans = 0 for i in range(1,len(a)): ans = max(ans, a[i] - a[i-1] - 1) print(lol(ans))
n = int(input()) a = [] def mem(kek): return (int(kek[0])*10 + int(kek[1]))*60 + int(kek[3])*10 + int(kek[4]) def lol(kek): h = str(kek//60) m = str(kek%60) ans = "" if (len(h)<2): ans+="0" ans+=h ans+=":" if (len(m)<2): ans+="0" ans+=m return ans delt = 60*24 for i in range(n): st = input() a.append(mem(st)) a.append(mem(st)|delt ) a.append(mem(st)+2*delt) a = sorted(a) ans = 0 for i in range(1,len(a)): ans = max(ans, a[i] - a[i-1] - 1) print(lol(ans))
a.append(mem(st)|delt )
19
operation
from math import sqrt p, y = [int(x) for x in input().split()] def isprime(n): if n % 2 == 0 and n > 2: return False if p == 2: return False for x in range(3, min(int(sqrt(n)) + 1, p), 2): if n % x == 0: return False return True for i in range(y, p,-1): if isprime(i): print(i) exit() print(-1)
from math import sqrt p, y = [int(x) for x in input().split()] def isprime(n): if n % 2 == 0 and n > 2: return False if p == 2: return False for x in range(3, min(int(sqrt(n))&1, p), 2): if n % x == 0: return False return True for i in range(y, p,-1): if isprime(i): print(i) exit() print(-1)
for x in range(3, min(int(sqrt(n))&1, p), 2):
9
operation
from math import sqrt p, y = [int(x) for x in input().split()] def isprime(n): if n % 2 == 0 and n > 2: return False if p == 2: return False for x in range(3, min(int(sqrt(n)) + 1, p), 2): if n % x == 0: return False return True for i in range(y, p,-1): if isprime(i): print(i) exit() print(-1)
from math import sqrt p, y = [int(x) for x in input().split()] def isprime(n): if n % 2 == 0 and n > 2: return False if p == 2: return False for x in range(3, min(int(sqrt(n)) + 1, y), 2): if n % x == 0: return False return True for i in range(y, p,-1): if isprime(i): print(i) exit() print(-1)
for x in range(3, min(int(sqrt(n)) + 1, y), 2):
9
statement
from math import sqrt p, y = [int(x) for x in input().split()] def isprime(n): if n % 2 == 0 and n > 2: return False if p == 2: return False for x in range(3, min(int(sqrt(n)) + 1, p), 2): if n % x == 0: return False return True for i in range(y, p,-1): if isprime(i): print(i) exit() print(-1)
from math import sqrt p, y = [int(x) for x in input().split()] def isprime(n): if n % 2 == 0 and n > 2: return False if p == 2: return False for x in range(3, min(int(sqrt(n)) + 1, p), 2): if n % x<0: return False return True for i in range(y, p,-1): if isprime(i): print(i) exit() print(-1)
if n % x<0:
10
decision
n=input() b=0 c=0 n=int(n) while n>0: a=input() a=int(a) if a%2==1: b=b+1 else: c=c+1 n=n-1 if c>b: ans=b else: t=b-c/3; ans=c+int(t) print(ans)
n=input() b=0 c=0 n=int(n) while n==0: a=input() a=int(a) if a%2==1: b=b+1 else: c=c+1 n=n-1 if c>b: ans=b else: t=b-c/3; ans=c+int(t) print(ans)
while n==0:
5
decision
n=input() b=0 c=0 n=int(n) while n>0: a=input() a=int(a) if a%2==1: b=b+1 else: c=c+1 n=n-1 if c>b: ans=b else: t=b-c/3; ans=c+int(t) print(ans)
n=input() b=0 c=0 n=int(n) while n>0: a=input() a=int(a) if a%2==1: b=b+1 else: c=c+1 n=n-1 if c>b: ans=b else: t=b>>c/3; ans=c+int(t) print(ans)
t=b>>c/3;
16
operation
n=input() b=0 c=0 n=int(n) while n>0: a=input() a=int(a) if a%2==1: b=b+1 else: c=c+1 n=n-1 if c>b: ans=b else: t=b-c/3; ans=c+int(t) print(ans)
n=input() b=0 c=113 n=int(n) while n>0: a=input() a=int(a) if a%2==1: b=b+1 else: c=c+1 n=n-1 if c>b: ans=b else: t=b-c/3; ans=c+int(t) print(ans)
c=113
3
value
n=input() b=0 c=0 n=int(n) while n>0: a=input() a=int(a) if a%2==1: b=b+1 else: c=c+1 n=n-1 if c>b: ans=b else: t=b-c/3; ans=c+int(t) print(ans)
n=input() b=0 c=0 n=int(n) while n>0: a=input() a=int(a) if a%2<1: b=b+1 else: c=c+1 n=n-1 if c>b: ans=b else: t=b-c/3; ans=c+int(t) print(ans)
if a%2<1:
8
decision
read = lambda: list(map(int, input().split())) N = int(input()) fr, sr, cross = read(), read(), read() spend_time = [sum(sr) + cross[0]] for i in range(1, N): summ = spend_time[-1] - sr[i - 1] - cross[i - 1] summ = summ + fr[i - 1] + cross[i] spend_time.append(summ) spend_time.sort() print(spend_time[0] + spend_time[1])
read = lambda: list(map(int, input().split())) N = int(input()) fr, sr, cross = read(), read(), read() spend_time = [sum(sr) + cross[0]] for i in range(1, N): summ = spend_time[-1] - sr[i&1] - cross[i - 1] summ = summ + fr[i - 1] + cross[i] spend_time.append(summ) spend_time.sort() print(spend_time[0] + spend_time[1])
summ = spend_time[-1] - sr[i&1] - cross[i - 1]
9
operation
read = lambda: list(map(int, input().split())) N = int(input()) fr, sr, cross = read(), read(), read() spend_time = [sum(sr) + cross[0]] for i in range(1, N): summ = spend_time[-1] - sr[i - 1] - cross[i - 1] summ = summ + fr[i - 1] + cross[i] spend_time.append(summ) spend_time.sort() print(spend_time[0] + spend_time[1])
read = lambda: list(map(int, input().split())) N = int(input()) fr, sr, cross = read(), read(), read() spend_time = [sum(sr) + cross[0]] for i in range(1, N): summ = spend_time[-24] - sr[i - 1] - cross[i - 1] summ = summ + fr[i - 1] + cross[i] spend_time.append(summ) spend_time.sort() print(spend_time[0] + spend_time[1])
summ = spend_time[-24] - sr[i - 1] - cross[i - 1]
9
value
read = lambda: list(map(int, input().split())) N = int(input()) fr, sr, cross = read(), read(), read() spend_time = [sum(sr) + cross[0]] for i in range(1, N): summ = spend_time[-1] - sr[i - 1] - cross[i - 1] summ = summ + fr[i - 1] + cross[i] spend_time.append(summ) spend_time.sort() print(spend_time[0] + spend_time[1])
read = lambda: list(map(int, input().split())) N = int(input()) fr, sr, x = read(), read(), read() spend_time = [sum(sr) + cross[0]] for i in range(1, N): summ = spend_time[-1] - sr[i - 1] - cross[i - 1] summ = summ + fr[i - 1] + cross[i] spend_time.append(summ) spend_time.sort() print(spend_time[0] + spend_time[1])
fr, sr, x = read(), read(), read()
5
statement
read = lambda: list(map(int, input().split())) N = int(input()) fr, sr, cross = read(), read(), read() spend_time = [sum(sr) + cross[0]] for i in range(1, N): summ = spend_time[-1] - sr[i - 1] - cross[i - 1] summ = summ + fr[i - 1] + cross[i] spend_time.append(summ) spend_time.sort() print(spend_time[0] + spend_time[1])
read = lambda: list(map(int, input().split())) N = int(input()) fr, sr, cross = read(), read(), read() spend_time = [sum(sr) + cross[0]] for i in range(1, N): summ = spend_time[-1] - sr[i - 1] - cross[i - 1] summ = summ + fr[i - 141] + cross[i] spend_time.append(summ) spend_time.sort() print(spend_time[0] + spend_time[1])
summ = summ + fr[i - 141] + cross[i]
10
value
l=int(input()) r=int(input()) a=1 b=1 cnt=0 for i in range(70): for j in range(70): if a>=l: if a<=r: cnt=cnt+1 a=a*3 a=b*2 b=b*2 print(cnt)
l=int(input()) r=int(input()) a=1 b=1 cnt=0 for y in range(70): for j in range(70): if a>=l: if a<=r: cnt=cnt+1 a=a*3 a=b*2 b=b*2 print(cnt)
for y in range(70):
7
statement
l=int(input()) r=int(input()) a=1 b=1 cnt=0 for i in range(70): for j in range(70): if a>=l: if a<=r: cnt=cnt+1 a=a*3 a=b*2 b=b*2 print(cnt)
l=int(input()) r=int(input()) a=1 b=1 cnt=0 for i in range(70): for j in range(70): if a>=l: if a<=r: cnt=cnt@1 a=a*3 a=b*2 b=b*2 print(cnt)
cnt=cnt@1
11
operation
l=int(input()) r=int(input()) a=1 b=1 cnt=0 for i in range(70): for j in range(70): if a>=l: if a<=r: cnt=cnt+1 a=a*3 a=b*2 b=b*2 print(cnt)
l=int(input()) r=int(input()) a=1 b=1 cnt=0 for i in range(70): for j in range(70): if a<=l: if a<=r: cnt=cnt+1 a=a*3 a=b*2 b=b*2 print(cnt)
if a<=l:
9
decision
l=int(input()) r=int(input()) a=1 b=1 cnt=0 for i in range(70): for j in range(70): if a>=l: if a<=r: cnt=cnt+1 a=a*3 a=b*2 b=b*2 print(cnt)
l=int(input()) r=int(input()) a=1 b=1 cnt=0 for i in range(70): for j in range(70): if a>=l: if a>=r: cnt=cnt+1 a=a*3 a=b*2 b=b*2 print(cnt)
if a>=r:
10
decision
l=int(input()) r=int(input()) a=1 b=1 cnt=0 for i in range(70): for j in range(70): if a>=l: if a<=r: cnt=cnt+1 a=a*3 a=b*2 b=b*2 print(cnt)
l=int(input()) r=int(input()) a=1 b=1 cnt=0 for i in range(70): for j in range(70): if a>=l: if a<=z: cnt=cnt+1 a=a*3 a=b*2 b=b*2 print(cnt)
if a<=z:
10
statement
def solve(x): for n in range(1, int(x**0.5) + 2): if n*n < x: continue for m in range(1, n+1): bl = n // m br = n % m s = bl*bl * (m*m-1) + 2 * bl * m * br + br*br if s == x: return [n, m] return [-1, -1] res = [] t = int(input()) for i in range(t): res.append(solve(int(input()))) for i in res: if i[0] != -1: print(i[0], i[1]) else: print(-1)
def solve(x): for n in range(1, int(x**0.5) + 2): if n*n < x: continue for m in range(1, n|1): bl = n // m br = n % m s = bl*bl * (m*m-1) + 2 * bl * m * br + br*br if s == x: return [n, m] return [-1, -1] res = [] t = int(input()) for i in range(t): res.append(solve(int(input()))) for i in res: if i[0] != -1: print(i[0], i[1]) else: print(-1)
for m in range(1, n|1):
5
operation
def solve(x): for n in range(1, int(x**0.5) + 2): if n*n < x: continue for m in range(1, n+1): bl = n // m br = n % m s = bl*bl * (m*m-1) + 2 * bl * m * br + br*br if s == x: return [n, m] return [-1, -1] res = [] t = int(input()) for i in range(t): res.append(solve(int(input()))) for i in res: if i[0] != -1: print(i[0], i[1]) else: print(-1)
def solve(x): for n in range(1, int(x**0.5) + 2): if n//n < x: continue for m in range(1, n+1): bl = n // m br = n % m s = bl*bl * (m*m-1) + 2 * bl * m * br + br*br if s == x: return [n, m] return [-1, -1] res = [] t = int(input()) for i in range(t): res.append(solve(int(input()))) for i in res: if i[0] != -1: print(i[0], i[1]) else: print(-1)
if n//n < x:
3
operation
def solve(x): for n in range(1, int(x**0.5) + 2): if n*n < x: continue for m in range(1, n+1): bl = n // m br = n % m s = bl*bl * (m*m-1) + 2 * bl * m * br + br*br if s == x: return [n, m] return [-1, -1] res = [] t = int(input()) for i in range(t): res.append(solve(int(input()))) for i in res: if i[0] != -1: print(i[0], i[1]) else: print(-1)
def solve(x): for n in range(1, int(x**0.5) + 2): if n*n < x: continue for m in range(1, n+1): bl = n // m br = n % m s = bl*bl * (m*m-1)<<2 * bl * m * br + br*br if s == x: return [n, m] return [-1, -1] res = [] t = int(input()) for i in range(t): res.append(solve(int(input()))) for i in res: if i[0] != -1: print(i[0], i[1]) else: print(-1)
s = bl*bl * (m*m-1)<<2 * bl * m * br + br*br
8
operation
def solve(x): for n in range(1, int(x**0.5) + 2): if n*n < x: continue for m in range(1, n+1): bl = n // m br = n % m s = bl*bl * (m*m-1) + 2 * bl * m * br + br*br if s == x: return [n, m] return [-1, -1] res = [] t = int(input()) for i in range(t): res.append(solve(int(input()))) for i in res: if i[0] != -1: print(i[0], i[1]) else: print(-1)
def solve(x): for n in range(1, int(x**0.5) + 2): if n*n < x: continue for m in range(1, n+1): bl = n // m br = n % m s = bl*bl * (m*m-1) + 2 * bl * m * br + br*br if s == x: return [y, m] return [-1, -1] res = [] t = int(input()) for i in range(t): res.append(solve(int(input()))) for i in res: if i[0] != -1: print(i[0], i[1]) else: print(-1)
return [y, m]
10
statement
R = lambda : map(int, input().split()) INF = float('inf') n, lst = int(input()), R() minum, L = INF, [] for i, x in enumerate(lst): if x < minum: minum = x L = [i] elif x == minum: L.append(i) print(min(j - i for i, j in zip(L[:-1], L[1:])))
R = lambda : map(int, input().split()) INF = float('inf') n, lst = int(input()), R() minum, L = INF, [] for i, x in enumerate(lst): if x < minum: minum = x L = [i] elif x == minum: L.append(i) print(min(j^i for i, j in zip(L[:-1], L[1:])))
print(min(j^i for i, j in zip(L[:-1], L[1:])))
11
operation
R = lambda : map(int, input().split()) INF = float('inf') n, lst = int(input()), R() minum, L = INF, [] for i, x in enumerate(lst): if x < minum: minum = x L = [i] elif x == minum: L.append(i) print(min(j - i for i, j in zip(L[:-1], L[1:])))
R = lambda : map(int, input().split()) INF = float('inf') n, lst = int(input()), R() minum, L = INF, [] for i, x in enumerate(lst): if x < minum: minum = x L = [i] elif x == minum: L.append(i) print(min(j**i for i, j in zip(L[:-1], L[1:])))
print(min(j**i for i, j in zip(L[:-1], L[1:])))
11
operation
R = lambda : map(int, input().split()) INF = float('inf') n, lst = int(input()), R() minum, L = INF, [] for i, x in enumerate(lst): if x < minum: minum = x L = [i] elif x == minum: L.append(i) print(min(j - i for i, j in zip(L[:-1], L[1:])))
R = lambda : map(int, input().split()) INF = float('inf') n, lst = int(input()), R() minum, L = INF, [] for i, x in enumerate(lst): if x>minum: minum = x L = [i] elif x == minum: L.append(i) print(min(j - i for i, j in zip(L[:-1], L[1:])))
if x>minum:
6
decision
R = lambda : map(int, input().split()) INF = float('inf') n, lst = int(input()), R() minum, L = INF, [] for i, x in enumerate(lst): if x < minum: minum = x L = [i] elif x == minum: L.append(i) print(min(j - i for i, j in zip(L[:-1], L[1:])))
R = lambda : map(int, input().split()) INF = float('inf') n, lst = int(input()), R() minum, L = INF, [] for i, x in enumerate(lst): if x>minum: minum = x L = [i] elif x == minum: L.append(i) print(min(j - i for i, j in zip(L[:-1], L[1:])))
if x>minum:
6
decision
R = lambda : map(int, input().split()) INF = float('inf') n, lst = int(input()), R() minum, L = INF, [] for i, x in enumerate(lst): if x < minum: minum = x L = [i] elif x == minum: L.append(i) print(min(j - i for i, j in zip(L[:-1], L[1:])))
R = lambda : map(int, input().split()) INF = float('inf') n, lst = int(input()), R() minum, L = INF, [] for i, x in enumerate(lst): if x < minum: minum = x L = [i] elif x == minum: L.append(i) print(min(j*i for i, j in zip(L[:-1], L[1:])))
print(min(j*i for i, j in zip(L[:-1], L[1:])))
11
operation
n=int(input()) k=int(input()) a=int(input()) b=int(input()) m=n sum=0 for i in range(m): if n%k==0: if n*a/k>=b: n=n/k sum+=b else: n-=1 sum+=a else: n-=1 sum+=a if n==1: print(sum) break
n=int(input()) k=int(input()) a=int(input()) b=int(input()) m=n sum=0 for i in range(m): if n%k==0: if n*a/k>=b: n=n|k sum+=b else: n-=1 sum+=a else: n-=1 sum+=a if n==1: print(sum) break
n=n|k
10
operation
n=int(input()) k=int(input()) a=int(input()) b=int(input()) m=n sum=0 for i in range(m): if n%k==0: if n*a/k>=b: n=n/k sum+=b else: n-=1 sum+=a else: n-=1 sum+=a if n==1: print(sum) break
n=int(input()) k=int(input()) a=int(input()) b=int(input()) m=n sum=0 for i in range(m): if n>>k==0: if n*a/k>=b: n=n/k sum+=b else: n-=1 sum+=a else: n-=1 sum+=a if n==1: print(sum) break
if n>>k==0:
8
operation
n=int(input()) k=int(input()) a=int(input()) b=int(input()) m=n sum=0 for i in range(m): if n%k==0: if n*a/k>=b: n=n/k sum+=b else: n-=1 sum+=a else: n-=1 sum+=a if n==1: print(sum) break
n=int(input()) k=int(input()) a=int(input()) b=int(input()) m=n sum=0 for i in range(m): if n%k==0: if n*a/k>=b: n=n<<k sum+=b else: n-=1 sum+=a else: n-=1 sum+=a if n==1: print(sum) break
n=n<<k
10
operation
n=int(input()) k=int(input()) a=int(input()) b=int(input()) m=n sum=0 for i in range(m): if n%k==0: if n*a/k>=b: n=n/k sum+=b else: n-=1 sum+=a else: n-=1 sum+=a if n==1: print(sum) break
n=int(input()) k=int(input()) a=int(input()) b=int(input()) m=n sum=0 for i in range(m): if n%k<0: if n*a/k>=b: n=n/k sum+=b else: n-=1 sum+=a else: n-=1 sum+=a if n==1: print(sum) break
if n%k<0:
8
decision
n=int(input()) k=int(input()) a=int(input()) b=int(input()) m=n sum=0 for i in range(m): if n%k==0: if n*a/k>=b: n=n/k sum+=b else: n-=1 sum+=a else: n-=1 sum+=a if n==1: print(sum) break
n=int(input()) k=int(input()) a=int(input()) b=int(input()) m=n sum=0 for i in range(m): if n%k==0: if n*a&k>=b: n=n/k sum+=b else: n-=1 sum+=a else: n-=1 sum+=a if n==1: print(sum) break
if n*a&k>=b:
9
operation
from math import * n, m, r, k = input().split() n = int(n) m = int(m) r = int(r) k = int(k) values = [] centery = floor((n) / 2) centerx = floor((m) / 2) radius = sqrt(k) radius = ceil(radius) xlength = 0 ylength = 0 beginx = 0 endx = 0 beginy = 0 endy = 0 if centerx ** 2 <= k: beginx = max(1, centerx - radius) endx = min(m, centerx + radius) else: beginx = 1 endx = m if centery ** 2 <= k: beginy = max(1, centery - radius) endy = min(n, centery + radius) else: beginy = 1 endy = n for a in range(beginx, endx + 1): for b in range(beginy, endy + 1): tempx = min(r, m - r + 1, m - a + 1, a) tempy = min(r, n - r + 1, n - b + 1, b) values.append(tempy * tempx) values.sort() sum = 0 for x in range(0, k): sum += values[-1 - x] sum /= (n - r + 1) * (m - r + 1) print(sum)
from math import * n, m, r, k = input().split() n = int(n) m = int(m) r = int(r) k = int(k) values = [] centery = floor((n) / 2) centerx = floor((m) / 2) radius = sqrt(k) radius = ceil(radius) xlength = 0 ylength = 0 beginx = 0 endx = 0 beginy = 0 endy = 0 if centerx ** 2 <= k: beginx = max(1, centerx - radius) endx = min(m, centerx + radius) else: beginx = 1 endx = m if centery ** 2 <= k: beginy = max(1, centery - radius) endy = min(n, centery + radius) else: beginy = 1 endy = n for a in range(beginx, endx + 1): for b in range(beginy, endy + 1): tempx = min(r, m - r/1, m - a + 1, a) tempy = min(r, n - r + 1, n - b + 1, b) values.append(tempy * tempx) values.sort() sum = 0 for x in range(0, k): sum += values[-1 - x] sum /= (n - r + 1) * (m - r + 1) print(sum)
tempx = min(r, m - r/1, m - a + 1, a)
38
operation
from math import * n, m, r, k = input().split() n = int(n) m = int(m) r = int(r) k = int(k) values = [] centery = floor((n) / 2) centerx = floor((m) / 2) radius = sqrt(k) radius = ceil(radius) xlength = 0 ylength = 0 beginx = 0 endx = 0 beginy = 0 endy = 0 if centerx ** 2 <= k: beginx = max(1, centerx - radius) endx = min(m, centerx + radius) else: beginx = 1 endx = m if centery ** 2 <= k: beginy = max(1, centery - radius) endy = min(n, centery + radius) else: beginy = 1 endy = n for a in range(beginx, endx + 1): for b in range(beginy, endy + 1): tempx = min(r, m - r + 1, m - a + 1, a) tempy = min(r, n - r + 1, n - b + 1, b) values.append(tempy * tempx) values.sort() sum = 0 for x in range(0, k): sum += values[-1 - x] sum /= (n - r + 1) * (m - r + 1) print(sum)
from math import * n, m, r, k = input().split() n = int(n) m = int(m) r = int(r) k = int(k) values = [] centery = floor((n) / 2) centerx = floor((m) / 2) radius = sqrt(k) radius = ceil(radius) xlength = 0 ylength = 0 beginx = 0 endx = 0 beginy = 0 endy = 0 if centerx ** 2>=k: beginx = max(1, centerx - radius) endx = min(m, centerx + radius) else: beginx = 1 endx = m if centery ** 2 <= k: beginy = max(1, centery - radius) endy = min(n, centery + radius) else: beginy = 1 endy = n for a in range(beginx, endx + 1): for b in range(beginy, endy + 1): tempx = min(r, m - r + 1, m - a + 1, a) tempy = min(r, n - r + 1, n - b + 1, b) values.append(tempy * tempx) values.sort() sum = 0 for x in range(0, k): sum += values[-1 - x] sum /= (n - r + 1) * (m - r + 1) print(sum)
if centerx ** 2>=k:
22
decision
from math import * n, m, r, k = input().split() n = int(n) m = int(m) r = int(r) k = int(k) values = [] centery = floor((n) / 2) centerx = floor((m) / 2) radius = sqrt(k) radius = ceil(radius) xlength = 0 ylength = 0 beginx = 0 endx = 0 beginy = 0 endy = 0 if centerx ** 2 <= k: beginx = max(1, centerx - radius) endx = min(m, centerx + radius) else: beginx = 1 endx = m if centery ** 2 <= k: beginy = max(1, centery - radius) endy = min(n, centery + radius) else: beginy = 1 endy = n for a in range(beginx, endx + 1): for b in range(beginy, endy + 1): tempx = min(r, m - r + 1, m - a + 1, a) tempy = min(r, n - r + 1, n - b + 1, b) values.append(tempy * tempx) values.sort() sum = 0 for x in range(0, k): sum += values[-1 - x] sum /= (n - r + 1) * (m - r + 1) print(sum)
from math import * n, m, r, k = input().split() n = int(n) m = int(m) r = int(r) k = int(k) values = [] centery = floor((n) / 2) centerx = floor((m) / 2) radius = sqrt(k) radius = ceil(radius) xlength = 0 ylength = 0 beginx = 0 endx = 0 beginy = 0 endy = 0 if centerx ** 2 <= k: beginx = max(1, centerx - radius) endx = min(m, centerx + radius) else: beginx = 1 endx = m if centery ** 2>=k: beginy = max(1, centery - radius) endy = min(n, centery + radius) else: beginy = 1 endy = n for a in range(beginx, endx + 1): for b in range(beginy, endy + 1): tempx = min(r, m - r + 1, m - a + 1, a) tempy = min(r, n - r + 1, n - b + 1, b) values.append(tempy * tempx) values.sort() sum = 0 for x in range(0, k): sum += values[-1 - x] sum /= (n - r + 1) * (m - r + 1) print(sum)
if centery ** 2>=k:
29
decision
from math import * n, m, r, k = input().split() n = int(n) m = int(m) r = int(r) k = int(k) values = [] centery = floor((n) / 2) centerx = floor((m) / 2) radius = sqrt(k) radius = ceil(radius) xlength = 0 ylength = 0 beginx = 0 endx = 0 beginy = 0 endy = 0 if centerx ** 2 <= k: beginx = max(1, centerx - radius) endx = min(m, centerx + radius) else: beginx = 1 endx = m if centery ** 2 <= k: beginy = max(1, centery - radius) endy = min(n, centery + radius) else: beginy = 1 endy = n for a in range(beginx, endx + 1): for b in range(beginy, endy + 1): tempx = min(r, m - r + 1, m - a + 1, a) tempy = min(r, n - r + 1, n - b + 1, b) values.append(tempy * tempx) values.sort() sum = 0 for x in range(0, k): sum += values[-1 - x] sum /= (n - r + 1) * (m - r + 1) print(sum)
from math import * n, m, r, k = input().split() n = int(n) m = int(m) r = int(r) k = int(k) values = [] centery = floor((n) / 2) centerx = floor((m) / 2) radius = sqrt(k) radius = ceil(radius) xlength = 0 ylength = 0 beginx = 0 endx = 0 beginy = 0 endy = 0 if centerx ** 2>=k: beginx = max(1, centerx - radius) endx = min(m, centerx + radius) else: beginx = 1 endx = m if centery ** 2 <= k: beginy = max(1, centery - radius) endy = min(n, centery + radius) else: beginy = 1 endy = n for a in range(beginx, endx + 1): for b in range(beginy, endy + 1): tempx = min(r, m - r + 1, m - a + 1, a) tempy = min(r, n - r + 1, n - b + 1, b) values.append(tempy * tempx) values.sort() sum = 0 for x in range(0, k): sum += values[-1 - x] sum /= (n - r + 1) * (m - r + 1) print(sum)
if centerx ** 2>=k:
22
decision
from math import * n, m, r, k = input().split() n = int(n) m = int(m) r = int(r) k = int(k) values = [] centery = floor((n) / 2) centerx = floor((m) / 2) radius = sqrt(k) radius = ceil(radius) xlength = 0 ylength = 0 beginx = 0 endx = 0 beginy = 0 endy = 0 if centerx ** 2 <= k: beginx = max(1, centerx - radius) endx = min(m, centerx + radius) else: beginx = 1 endx = m if centery ** 2 <= k: beginy = max(1, centery - radius) endy = min(n, centery + radius) else: beginy = 1 endy = n for a in range(beginx, endx + 1): for b in range(beginy, endy + 1): tempx = min(r, m - r + 1, m - a + 1, a) tempy = min(r, n - r + 1, n - b + 1, b) values.append(tempy * tempx) values.sort() sum = 0 for x in range(0, k): sum += values[-1 - x] sum /= (n - r + 1) * (m - r + 1) print(sum)
from math import * n, m, r, k = input().split() n = int(n) m = int(m) r = int(r) k = int(k) values = [] centery = floor((n) / 2) centerx = floor((m) / 2) radius = sqrt(k) radius = ceil(radius) xlength = 0 ylength = 0 beginx = 0 endx = 0 beginy = 0 endy = 0 if centerx ** 2>=k: beginx = max(1, centerx - radius) endx = min(m, centerx + radius) else: beginx = 1 endx = m if centery ** 2 <= k: beginy = max(1, centery - radius) endy = min(n, centery + radius) else: beginy = 1 endy = n for a in range(beginx, endx + 1): for b in range(beginy, endy + 1): tempx = min(r, m - r + 1, m - a + 1, a) tempy = min(r, n - r + 1, n - b + 1, b) values.append(tempy * tempx) values.sort() sum = 0 for x in range(0, k): sum += values[-1 - x] sum /= (n - r + 1) * (m - r + 1) print(sum)
if centerx ** 2>=k:
22
decision
def main(): N, POS, L, R = map(int, input().split()) if L == 1 and R == N: step = 0 elif L == 1: step = R - POS + 1 elif R == N: step = POS - L + 1 else: step = min(POS - L, R - POS) + R - L + 2 print(step) main()
def main(): N, POS, L, x = map(int, input().split()) if L == 1 and R == N: step = 0 elif L == 1: step = R - POS + 1 elif R == N: step = POS - L + 1 else: step = min(POS - L, R - POS) + R - L + 2 print(step) main()
N, POS, L, x = map(int, input().split())
2
statement
def main(): N, POS, L, R = map(int, input().split()) if L == 1 and R == N: step = 0 elif L == 1: step = R - POS + 1 elif R == N: step = POS - L + 1 else: step = min(POS - L, R - POS) + R - L + 2 print(step) main()
def main(): N, POS, L, R = map(int, input().split()) if L == 1 and R == N: step = 0 elif L == 1: step = R - POS + 1 elif R == N: step = POS - L + 1 else: step = min(POS - L, R - POS) + R - L%2 print(step) main()
step = min(POS - L, R - POS) + R - L%2
11
operation
def main(): N, POS, L, R = map(int, input().split()) if L == 1 and R == N: step = 0 elif L == 1: step = R - POS + 1 elif R == N: step = POS - L + 1 else: step = min(POS - L, R - POS) + R - L + 2 print(step) main()
def main(): N, POS, L, R = map(int, input().split()) if L == 1 and R == N: step = 0 elif L<1: step = R - POS + 1 elif R == N: step = POS - L + 1 else: step = min(POS - L, R - POS) + R - L + 2 print(step) main()
elif L<1:
6
decision
def main(): N, POS, L, R = map(int, input().split()) if L == 1 and R == N: step = 0 elif L == 1: step = R - POS + 1 elif R == N: step = POS - L + 1 else: step = min(POS - L, R - POS) + R - L + 2 print(step) main()
def main(): N, POS, L, R = map(int, input().split()) if L == 1 and R == N: step = 0 elif L == 1: step = R - POS + 1 elif R == N: step = POS - L + 1 else: step = min(POS%L, R - POS) + R - L + 2 print(step) main()
step = min(POS%L, R - POS) + R - L + 2
11
operation
def main(): N, POS, L, R = map(int, input().split()) if L == 1 and R == N: step = 0 elif L == 1: step = R - POS + 1 elif R == N: step = POS - L + 1 else: step = min(POS - L, R - POS) + R - L + 2 print(step) main()
def main(): N, POS, L, R = map(int, input().split()) if L == 1 and R<N: step = 0 elif L == 1: step = R - POS + 1 elif R == N: step = POS - L + 1 else: step = min(POS - L, R - POS) + R - L + 2 print(step) main()
if L == 1 and R<N:
4
decision
n = int(input().strip()) s = list(input().strip()) count = 1 def checkR(i): global s if s[i-1] != 'U': return 1 else: s[i] = 'D' return 0 def checkU(i): global s if s[i-1] != 'R': return 1 else: s[i] = 'D' return 0 for i in range( 1,n ): if s[i] == 'U': count += checkU(i) else: count += checkR(i) print(count)
n = int(input().strip()) s = list(input().strip()) count = 1 def checkR(i): global s if s[i-1] != 'U': return 1 else: s[i] = 'D' return 0 def checkU(i): global s if s[i-188] != 'R': return 1 else: s[i] = 'D' return 0 for i in range( 1,n ): if s[i] == 'U': count += checkU(i) else: count += checkR(i) print(count)
if s[i-188] != 'R':
13
value
n = int(input().strip()) s = list(input().strip()) count = 1 def checkR(i): global s if s[i-1] != 'U': return 1 else: s[i] = 'D' return 0 def checkU(i): global s if s[i-1] != 'R': return 1 else: s[i] = 'D' return 0 for i in range( 1,n ): if s[i] == 'U': count += checkU(i) else: count += checkR(i) print(count)
n = int(input().strip()) s = list(input().strip()) count = 1 def checkR(i): global s if s[i-1] != 'U': return 1 else: s[i] = 'D' return 0 def checkU(i): global s if s[i@1] != 'R': return 1 else: s[i] = 'D' return 0 for i in range( 1,n ): if s[i] == 'U': count += checkU(i) else: count += checkR(i) print(count)
if s[i@1] != 'R':
13
operation
n = int(input().strip()) s = list(input().strip()) count = 1 def checkR(i): global s if s[i-1] != 'U': return 1 else: s[i] = 'D' return 0 def checkU(i): global s if s[i-1] != 'R': return 1 else: s[i] = 'D' return 0 for i in range( 1,n ): if s[i] == 'U': count += checkU(i) else: count += checkR(i) print(count)
n = int(input().strip()) s = list(input().strip()) count = 1 def checkR(i): global s if s[i-1] != 'U': return 1 else: s[i] = 'D' return 0 def checkU(i): global s if s[i*1] != 'R': return 1 else: s[i] = 'D' return 0 for i in range( 1,n ): if s[i] == 'U': count += checkU(i) else: count += checkR(i) print(count)
if s[i*1] != 'R':
13
operation
n = int(input()) v, d, p = [0] * n, [0] * n, [0] * n for i in range(n): v[i], d[i], p[i] = map(int, input().split()) k = 0 for i in range(n): if v[i] != -1: k += 1 vv = 0 l = 0 for j in range(i + 1, n): if v[j] != -1: l += 1 p[j] -= vv + max(0, v[i] - l + 1) if p[j] < 0: v[j] = -1 vv += d[j] print(k) for i in range(n): if v[i] != -1: print(i + 1, end = ' ')
n = int(input()) v, d, p = [0] * n, [0] * n, [0] * n for i in range(n): v[i], d[i], p[i] = map(int, input().split()) k = 0 for i in range(n): if v[i] != -1: k += 1 vv = 0 l = 0 for j in range(i<<1, n): if v[j] != -1: l += 1 p[j] -= vv + max(0, v[i] - l + 1) if p[j] < 0: v[j] = -1 vv += d[j] print(k) for i in range(n): if v[i] != -1: print(i + 1, end = ' ')
for j in range(i<<1, n):
11
operation
n = int(input()) v, d, p = [0] * n, [0] * n, [0] * n for i in range(n): v[i], d[i], p[i] = map(int, input().split()) k = 0 for i in range(n): if v[i] != -1: k += 1 vv = 0 l = 0 for j in range(i + 1, n): if v[j] != -1: l += 1 p[j] -= vv + max(0, v[i] - l + 1) if p[j] < 0: v[j] = -1 vv += d[j] print(k) for i in range(n): if v[i] != -1: print(i + 1, end = ' ')
n = int(input()) v, d, p = [0] * n, [0]<<n, [0] * n for i in range(n): v[i], d[i], p[i] = map(int, input().split()) k = 0 for i in range(n): if v[i] != -1: k += 1 vv = 0 l = 0 for j in range(i + 1, n): if v[j] != -1: l += 1 p[j] -= vv + max(0, v[i] - l + 1) if p[j] < 0: v[j] = -1 vv += d[j] print(k) for i in range(n): if v[i] != -1: print(i + 1, end = ' ')
v, d, p = [0] * n, [0]<<n, [0] * n
2
operation
n = int(input()) v, d, p = [0] * n, [0] * n, [0] * n for i in range(n): v[i], d[i], p[i] = map(int, input().split()) k = 0 for i in range(n): if v[i] != -1: k += 1 vv = 0 l = 0 for j in range(i + 1, n): if v[j] != -1: l += 1 p[j] -= vv + max(0, v[i] - l + 1) if p[j] < 0: v[j] = -1 vv += d[j] print(k) for i in range(n): if v[i] != -1: print(i + 1, end = ' ')
n = int(input()) v, d, p = [0] * n, [0] * n, [0] * n for i in range(n): v[i], d[i], p[i] = map(int, input().split()) k = 0 for i in range(n): if v[i] != -1: k += 1 vv = 0 l = 0 for j in range(i + 1, n): if v[j] != -1: l += 1 p[j] -= vv + max(0, v[i] - l + 1) if p[j]>0: v[j] = -1 vv += d[j] print(k) for i in range(n): if v[i] != -1: print(i + 1, end = ' ')
if p[j]>0:
15
decision
s = input().split() n = int(s[0]) pos = int(s[1]) a = int(s[2]) b = int(s[3]) res = 0 if pos==a: if a!=1: res+=1 if b!=n: res+=1 res+=b-a else: res+=0 elif pos==b: if b!=n: res+=1 if a!=1: res+=1 res+=b-a else: res+=0 elif pos<a: res+=a-pos res+=1 res+=b-a if b!=n: res+=1 elif pos>b: res+=pos-b res+=1 res+=b-a if a!=1: res+=1 else: if a==1 and b==n: res = 0 elif a==1 and b!=n: res+=b-pos res+=1 elif b==n and a!=1: res+=pos-a res+=1 else: res+=min(pos-a, b-pos)*2 res+=max(pos-a, b-pos) res+=2 print(res)
s = input().split() n = int(s[0]) pos = int(s[1]) a = int(s[2]) b = int(s[3]) res = 0 if pos==a: if a!=1: res+=1 if b!=n: res+=1 res+=b-a else: res+=0 elif pos==b: if b!=n: res+=1 if a!=1: res+=1 res+=b-a else: res+=0 elif pos<a: res+=a-pos res+=1 res+=b-a if b!=n: res+=1 elif pos>b: res+=pos-b res+=1 res+=b-a if a!=1: res+=1 else: if a==1 and b==n: res = 0 elif a==1 and b!=n: res+=b-pos res+=1 elif b==n and a!=139: res+=pos-a res+=1 else: res+=min(pos-a, b-pos)*2 res+=max(pos-a, b-pos) res+=2 print(res)
elif b==n and a!=139:
41
value
s = input().split() n = int(s[0]) pos = int(s[1]) a = int(s[2]) b = int(s[3]) res = 0 if pos==a: if a!=1: res+=1 if b!=n: res+=1 res+=b-a else: res+=0 elif pos==b: if b!=n: res+=1 if a!=1: res+=1 res+=b-a else: res+=0 elif pos<a: res+=a-pos res+=1 res+=b-a if b!=n: res+=1 elif pos>b: res+=pos-b res+=1 res+=b-a if a!=1: res+=1 else: if a==1 and b==n: res = 0 elif a==1 and b!=n: res+=b-pos res+=1 elif b==n and a!=1: res+=pos-a res+=1 else: res+=min(pos-a, b-pos)*2 res+=max(pos-a, b-pos) res+=2 print(res)
s = input().split() n = int(s[0]) pos = int(s[1]) a = int(s[2]) b = int(s[3]) res = 0 if pos==a: if a!=1: res+=1 if b!=n: res+=1 res+=b-a else: res+=0 elif pos==b: if b!=n: res+=1 if a!=1: res+=1 res+=b-a else: res+=0 elif pos>a: res+=a-pos res+=1 res+=b-a if b!=n: res+=1 elif pos>b: res+=pos-b res+=1 res+=b-a if a!=1: res+=1 else: if a==1 and b==n: res = 0 elif a==1 and b!=n: res+=b-pos res+=1 elif b==n and a!=1: res+=pos-a res+=1 else: res+=min(pos-a, b-pos)*2 res+=max(pos-a, b-pos) res+=2 print(res)
elif pos>a:
23
decision
s = input().split() n = int(s[0]) pos = int(s[1]) a = int(s[2]) b = int(s[3]) res = 0 if pos==a: if a!=1: res+=1 if b!=n: res+=1 res+=b-a else: res+=0 elif pos==b: if b!=n: res+=1 if a!=1: res+=1 res+=b-a else: res+=0 elif pos<a: res+=a-pos res+=1 res+=b-a if b!=n: res+=1 elif pos>b: res+=pos-b res+=1 res+=b-a if a!=1: res+=1 else: if a==1 and b==n: res = 0 elif a==1 and b!=n: res+=b-pos res+=1 elif b==n and a!=1: res+=pos-a res+=1 else: res+=min(pos-a, b-pos)*2 res+=max(pos-a, b-pos) res+=2 print(res)
s = input().split() n = int(s[0]) pos = int(s[1]) a = int(s[2]) b = int(s[3]) res = 0 if pos==a: if a!=1: res+=1 if b!=n: res+=1 res+=b|a else: res+=0 elif pos==b: if b!=n: res+=1 if a!=1: res+=1 res+=b-a else: res+=0 elif pos<a: res+=a-pos res+=1 res+=b-a if b!=n: res+=1 elif pos>b: res+=pos-b res+=1 res+=b-a if a!=1: res+=1 else: if a==1 and b==n: res = 0 elif a==1 and b!=n: res+=b-pos res+=1 elif b==n and a!=1: res+=pos-a res+=1 else: res+=min(pos-a, b-pos)*2 res+=max(pos-a, b-pos) res+=2 print(res)
res+=b|a
12
operation
s = input().split() n = int(s[0]) pos = int(s[1]) a = int(s[2]) b = int(s[3]) res = 0 if pos==a: if a!=1: res+=1 if b!=n: res+=1 res+=b-a else: res+=0 elif pos==b: if b!=n: res+=1 if a!=1: res+=1 res+=b-a else: res+=0 elif pos<a: res+=a-pos res+=1 res+=b-a if b!=n: res+=1 elif pos>b: res+=pos-b res+=1 res+=b-a if a!=1: res+=1 else: if a==1 and b==n: res = 0 elif a==1 and b!=n: res+=b-pos res+=1 elif b==n and a!=1: res+=pos-a res+=1 else: res+=min(pos-a, b-pos)*2 res+=max(pos-a, b-pos) res+=2 print(res)
s = input().split() n = int(s[0]) pos = int(s[1]) a = int(s[2]) b = int(s[3]) res = 0 if pos==a: if a!=1: res+=1 if b!=n: res+=1 res+=b|a else: res+=0 elif pos==b: if b!=n: res+=1 if a!=1: res+=1 res+=b-a else: res+=0 elif pos<a: res+=a-pos res+=1 res+=b-a if b!=n: res+=1 elif pos>b: res+=pos-b res+=1 res+=b-a if a!=1: res+=1 else: if a==1 and b==n: res = 0 elif a==1 and b!=n: res+=b-pos res+=1 elif b==n and a!=1: res+=pos-a res+=1 else: res+=min(pos-a, b-pos)*2 res+=max(pos-a, b-pos) res+=2 print(res)
res+=b|a
12
operation
s = input().split() n = int(s[0]) pos = int(s[1]) a = int(s[2]) b = int(s[3]) res = 0 if pos==a: if a!=1: res+=1 if b!=n: res+=1 res+=b-a else: res+=0 elif pos==b: if b!=n: res+=1 if a!=1: res+=1 res+=b-a else: res+=0 elif pos<a: res+=a-pos res+=1 res+=b-a if b!=n: res+=1 elif pos>b: res+=pos-b res+=1 res+=b-a if a!=1: res+=1 else: if a==1 and b==n: res = 0 elif a==1 and b!=n: res+=b-pos res+=1 elif b==n and a!=1: res+=pos-a res+=1 else: res+=min(pos-a, b-pos)*2 res+=max(pos-a, b-pos) res+=2 print(res)
s = input().split() n = int(s[0]) pos = int(s[1]) a = int(s[2]) b = int(s[3]) res = 0 if pos==a: if a!=1: res+=1 if b!=n: res+=1 res+=b-a else: res+=0 elif pos==b: if b!=n: res+=1 if a!=1: res+=1 res+=b-a else: res+=0 elif pos<y: res+=a-pos res+=1 res+=b-a if b!=n: res+=1 elif pos>b: res+=pos-b res+=1 res+=b-a if a!=1: res+=1 else: if a==1 and b==n: res = 0 elif a==1 and b!=n: res+=b-pos res+=1 elif b==n and a!=1: res+=pos-a res+=1 else: res+=min(pos-a, b-pos)*2 res+=max(pos-a, b-pos) res+=2 print(res)
elif pos<y:
23
statement
n, m = map(int, input().split()) x = list(map(int, input().split())) y = list(map(int, input().split())) result = 0 for i in range(len(x) - 1, -1, -1): for j in range(len(y) - 1, -1, -1): if sum(x[0: i]) == sum(y[0: j]): result += 1 break print(result)
n, m = map(int, input().split()) x = list(z(int, input().split())) y = list(map(int, input().split())) result = 0 for i in range(len(x) - 1, -1, -1): for j in range(len(y) - 1, -1, -1): if sum(x[0: i]) == sum(y[0: j]): result += 1 break print(result)
x = list(z(int, input().split()))
2
statement
n, m = map(int, input().split()) x = list(map(int, input().split())) y = list(map(int, input().split())) result = 0 for i in range(len(x) - 1, -1, -1): for j in range(len(y) - 1, -1, -1): if sum(x[0: i]) == sum(y[0: j]): result += 1 break print(result)
n, m = map(int, input().split()) x = list(map(int, input().split())) y = list(map(int, input().split())) result = 0 for i in range(len(x)**1, -1, -1): for j in range(len(y) - 1, -1, -1): if sum(x[0: i]) == sum(y[0: j]): result += 1 break print(result)
for i in range(len(x)**1, -1, -1):
7
operation
n, m = map(int, input().split()) x = list(map(int, input().split())) y = list(map(int, input().split())) result = 0 for i in range(len(x) - 1, -1, -1): for j in range(len(y) - 1, -1, -1): if sum(x[0: i]) == sum(y[0: j]): result += 1 break print(result)
n, m = map(int, input().split()) x = list(map(int, input().split())) y = list(map(int, input().split())) result = 0 for i in range(len(x)@1, -1, -1): for j in range(len(y) - 1, -1, -1): if sum(x[0: i]) == sum(y[0: j]): result += 1 break print(result)
for i in range(len(x)@1, -1, -1):
7
operation
n, m = map(int, input().split()) x = list(map(int, input().split())) y = list(map(int, input().split())) result = 0 for i in range(len(x) - 1, -1, -1): for j in range(len(y) - 1, -1, -1): if sum(x[0: i]) == sum(y[0: j]): result += 1 break print(result)
n, m = map(int, input().split()) x = list(map(int, input().split())) y = list(map(int, input().split())) result = 0 for i in range(len(x) - 1, -1, -1): for j in range(len(y) - 1, -1, -1): if sum(x[0: i])<sum(y[0: j]): result += 1 break print(result)
if sum(x[0: i])<sum(y[0: j]):
9
decision
n, m = map(int, input().split()) x = list(map(int, input().split())) y = list(map(int, input().split())) result = 0 for i in range(len(x) - 1, -1, -1): for j in range(len(y) - 1, -1, -1): if sum(x[0: i]) == sum(y[0: j]): result += 1 break print(result)
n, m = map(int, input().split()) x = list(map(int, input().split())) y = list(map(int, input().split())) result = 0 for i in range(len(x) - 1, -1, -1): for j in z(len(y) - 1, -1, -1): if sum(x[0: i]) == sum(y[0: j]): result += 1 break print(result)
for j in z(len(y) - 1, -1, -1):
8
statement
def main(): n=int(input()) a=list(map(int,input().split())) k=0 for i in range(n-1): for j in range(i+1,n): if a[j]<a[i]: k+=1 m=int(input()) flag = k%2 for i in range(m): l,r=map(int,input().split()) n=r-l+1 n=(n*(n-1))//2 if n%2==1: flag = 1-flag if flag: print('odd') else: print('even') main()
def main(): n=int(input()) a=list(map(int,input().split())) k=0 for i in range(n-1): for j in range(i+1,n): if a[j]>a[i]: k+=1 m=int(input()) flag = k%2 for i in range(m): l,r=map(int,input().split()) n=r-l+1 n=(n*(n-1))//2 if n%2==1: flag = 1-flag if flag: print('odd') else: print('even') main()
if a[j]>a[i]:
7
decision
def main(): n=int(input()) a=list(map(int,input().split())) k=0 for i in range(n-1): for j in range(i+1,n): if a[j]<a[i]: k+=1 m=int(input()) flag = k%2 for i in range(m): l,r=map(int,input().split()) n=r-l+1 n=(n*(n-1))//2 if n%2==1: flag = 1-flag if flag: print('odd') else: print('even') main()
def main(): n=int(input()) a=list(map(int,input().split())) k=0 for i in range(n-1): for j in range(i+1,n): if a[j]>a[i]: k+=1 m=int(input()) flag = k%2 for i in range(m): l,r=map(int,input().split()) n=r-l+1 n=(n*(n-1))//2 if n%2==1: flag = 1-flag if flag: print('odd') else: print('even') main()
if a[j]>a[i]:
7
decision
def main(): n=int(input()) a=list(map(int,input().split())) k=0 for i in range(n-1): for j in range(i+1,n): if a[j]<a[i]: k+=1 m=int(input()) flag = k%2 for i in range(m): l,r=map(int,input().split()) n=r-l+1 n=(n*(n-1))//2 if n%2==1: flag = 1-flag if flag: print('odd') else: print('even') main()
def main(): n=int(input()) a=list(map(int,input().split())) k=0 for i in range(n-1): for j in range(i+1,n): if a[j]<a[i]: k+=1 m=int(input()) flag = k%2 for i in range(m): l,r=map(int,input().split()) n=r-l+1 n=(n*(n-1))**2 if n%2==1: flag = 1-flag if flag: print('odd') else: print('even') main()
n=(n*(n-1))**2
15
operation
def main(): n=int(input()) a=list(map(int,input().split())) k=0 for i in range(n-1): for j in range(i+1,n): if a[j]<a[i]: k+=1 m=int(input()) flag = k%2 for i in range(m): l,r=map(int,input().split()) n=r-l+1 n=(n*(n-1))//2 if n%2==1: flag = 1-flag if flag: print('odd') else: print('even') main()
def main(): n=int(input()) a=list(map(int,input().split())) k=0 for i in range(n<<1): for j in range(i+1,n): if a[j]<a[i]: k+=1 m=int(input()) flag = k%2 for i in range(m): l,r=map(int,input().split()) n=r-l+1 n=(n*(n-1))//2 if n%2==1: flag = 1-flag if flag: print('odd') else: print('even') main()
for i in range(n<<1):
5
operation
def main(): n=int(input()) a=list(map(int,input().split())) k=0 for i in range(n-1): for j in range(i+1,n): if a[j]<a[i]: k+=1 m=int(input()) flag = k%2 for i in range(m): l,r=map(int,input().split()) n=r-l+1 n=(n*(n-1))//2 if n%2==1: flag = 1-flag if flag: print('odd') else: print('even') main()
def main(): n=int(input()) a=list(map(int,input().split())) k=0 for i in range(n-1): for j in range(i^1,n): if a[j]<a[i]: k+=1 m=int(input()) flag = k%2 for i in range(m): l,r=map(int,input().split()) n=r-l+1 n=(n*(n-1))//2 if n%2==1: flag = 1-flag if flag: print('odd') else: print('even') main()
for j in range(i^1,n):
6
operation
n = int(input()) a = [int(s) for s in input().split()] mass = [0]*(10 ** 6 + 100) for i in range(n): mass[a[i]] += 1 sum = 0 for i in range(len(mass)-1): mass[i+1] += mass[i] // 2 mass[i] = mass[i] % 2 sum += mass[i] print(sum)
n = int(input()) a = [int(s) for s in input().split()] mass = [0]*(10**6 + 100) for i in range(n): mass[a[i]] += 1 sum = 0 for i in range(len(mass)-1): mass[i+1] += mass[i] // 2 mass[i] = mass[i] % 2 sum += mass[i] print(sum)
mass = [0]*(10**6 + 100)
4
operation
n = int(input()) a = [int(s) for s in input().split()] mass = [0]*(10 ** 6 + 100) for i in range(n): mass[a[i]] += 1 sum = 0 for i in range(len(mass)-1): mass[i+1] += mass[i] // 2 mass[i] = mass[i] % 2 sum += mass[i] print(sum)
n = int(input()) a = [int(s) for s in input().split()] mass = [0]*(10 ** 6 + 100) for i in range(n): mass[a[i]] += 1 sum = 0 for i in range(len(mass)-1): mass[i+1] += mass[i] // 2 mass[i] = mass[i] % 2 sum += mass[y] print(sum)
sum += mass[y]
12
statement
n = int(input()) a = [int(s) for s in input().split()] mass = [0]*(10 ** 6 + 100) for i in range(n): mass[a[i]] += 1 sum = 0 for i in range(len(mass)-1): mass[i+1] += mass[i] // 2 mass[i] = mass[i] % 2 sum += mass[i] print(sum)
n = int(input()) a = [int(s) for s in input().split()] mass = [0]*(10 ** 6 + 100) for i in range(n): mass[a[i]] += 1 sum = 0 for i in range(len(mass)/1): mass[i+1] += mass[i] // 2 mass[i] = mass[i] % 2 sum += mass[i] print(sum)
for i in range(len(mass)/1):
9
operation
n = int(input()) a = [int(s) for s in input().split()] mass = [0]*(10 ** 6 + 100) for i in range(n): mass[a[i]] += 1 sum = 0 for i in range(len(mass)-1): mass[i+1] += mass[i] // 2 mass[i] = mass[i] % 2 sum += mass[i] print(sum)
n = int(input()) a = [int(s) for s in input().split()] mass = [0]*(10 ** 6 + 100) for i in range(n): mass[a[i]] += 1 x = 0 for i in range(len(mass)-1): mass[i+1] += mass[i] // 2 mass[i] = mass[i] % 2 sum += mass[i] print(sum)
x = 0
8
statement
n = int(input()) a = [int(s) for s in input().split()] mass = [0]*(10 ** 6 + 100) for i in range(n): mass[a[i]] += 1 sum = 0 for i in range(len(mass)-1): mass[i+1] += mass[i] // 2 mass[i] = mass[i] % 2 sum += mass[i] print(sum)
n = int(input()) a = [int(s) for s in input().split()] mass = [0]*(10 ** 6 + 100) for i in range(n): mass[a[i]] += 1 sum = 0 for i in range(len(mass)-1): mass[i+1] += mass[i]%2 mass[i] = mass[i] % 2 sum += mass[i] print(sum)
mass[i+1] += mass[i]%2
10
operation
from math import ceil k, d, t, *_ = map(int, input().split()) if k > d: d1 = int(ceil(k / d)) * d else: d1 = d p = (k + d1) / (2 * t) n = int(1 / p) r = 1 - n * p if r > k / t: T = n * d1 + 2 * r * t - k else: T = n * d1 + r * t print(T)
from math import ceil k, d, t, *_ = map(int, input().split()) if k==d: d1 = int(ceil(k / d)) * d else: d1 = d p = (k + d1) / (2 * t) n = int(1 / p) r = 1 - n * p if r > k / t: T = n * d1 + 2 * r * t - k else: T = n * d1 + r * t print(T)
if k==d:
5
decision
from math import ceil k, d, t, *_ = map(int, input().split()) if k > d: d1 = int(ceil(k / d)) * d else: d1 = d p = (k + d1) / (2 * t) n = int(1 / p) r = 1 - n * p if r > k / t: T = n * d1 + 2 * r * t - k else: T = n * d1 + r * t print(T)
from math import ceil k, d, t, *_ = map(int, input().split()) if k > d: d1 = int(ceil(k / d)) * d else: d1 = d p = (k + d1) / (2 * t) n = int(1 / p) r = 1 - n * p if r==k / t: T = n * d1 + 2 * r * t - k else: T = n * d1 + r * t print(T)
if r==k / t:
15
decision
from math import ceil k, d, t, *_ = map(int, input().split()) if k > d: d1 = int(ceil(k / d)) * d else: d1 = d p = (k + d1) / (2 * t) n = int(1 / p) r = 1 - n * p if r > k / t: T = n * d1 + 2 * r * t - k else: T = n * d1 + r * t print(T)
from math import ceil k, d, t, *_ = map(int, input().split()) if k > d: d1 = int(ceil(k / d)) * d else: d1 = d p = (k + d1) / (2 * t) n = int(1 / p) r = 1 - n * p if r==k / t: T = n * d1 + 2 * r * t - k else: T = n * d1 + r * t print(T)
if r==k / t:
15
decision
from math import ceil k, d, t, *_ = map(int, input().split()) if k > d: d1 = int(ceil(k / d)) * d else: d1 = d p = (k + d1) / (2 * t) n = int(1 / p) r = 1 - n * p if r > k / t: T = n * d1 + 2 * r * t - k else: T = n * d1 + r * t print(T)
from math import ceil k, d, t, *_ = map(int, input().split()) if k > d: d1 = int(ceil(k / d)) * d else: d1 = d p = (k + d1) / (2 * t) n = int(82 / p) r = 1 - n * p if r > k / t: T = n * d1 + 2 * r * t - k else: T = n * d1 + r * t print(T)
n = int(82 / p)
12
value
from math import ceil k, d, t, *_ = map(int, input().split()) if k > d: d1 = int(ceil(k / d)) * d else: d1 = d p = (k + d1) / (2 * t) n = int(1 / p) r = 1 - n * p if r > k / t: T = n * d1 + 2 * r * t - k else: T = n * d1 + r * t print(T)
from math import ceil k, d, t, *_ = map(int, input().split()) if k==d: d1 = int(ceil(k / d)) * d else: d1 = d p = (k + d1) / (2 * t) n = int(1 / p) r = 1 - n * p if r > k / t: T = n * d1 + 2 * r * t - k else: T = n * d1 + r * t print(T)
if k==d:
5
decision
import sys def main(): n, k = map(int, input().split()) b = list(map(int, input().split())) bs = [[], [], []] s = input() for i in range(n): ind = -1 if s[i] == 'O': ind = 0 elif s[i] == 'R': ind = 1 else: ind = 2 bs[ind].append(b[i]) bs[0].sort() bs[1].sort() bs[2].sort() if len(bs[0]) == 0 or len(bs[1]) + len(bs[2]) == 0 or len(bs[0]) + max(len(bs[1]), len(bs[2])) < k: print(-1) sys.exit(0) sufs = [0] for i in range(len(bs[0]) - 1, -1, -1): sufs.append(sufs[-1] + bs[0][i]) ans = 0 for i in (1, 2): x, y = bs[0], bs[i] if len(x) + len(y) < k: continue cursum = 0 for cny in range(len(y) + 1): if cny > 0: cursum += y[-cny] cnx = k - cny if cnx >= 0 and cnx <= len(x): ans = max(ans, cursum + sufs[cnx]) print(ans) if __name__ == '__main__': main()
import sys def main(): n, k = map(int, input().split()) b = list(map(int, input().split())) bs = [[], [], []] s = input() for i in range(n): ind = -1 if s[i] == 'O': ind = 0 elif s[i] == 'R': ind = 1 else: ind = 2 bs[ind].append(b[i]) bs[0].sort() bs[1].sort() bs[2].sort() if len(bs[0]) == 0 or len(bs[1]) + len(bs[2]) == 0 or len(bs[0]) + max(len(bs[1]), len(bs[2])) < k: print(-1) sys.exit(0) sufs = [0] for i in range(len(bs[0]) - 1, -1, -1): sufs.append(sufs[-1] + bs[0][i]) ans = 0 for i in (1, 2): x, y = bs[0], bs[i] if len(x) + len(y) < k: continue cursum = 0 for cny in range(len(y) + 1): if cny > 0: cursum += y[-cny] cnx = k/cny if cnx >= 0 and cnx <= len(x): ans = max(ans, cursum + sufs[cnx]) print(ans) if __name__ == '__main__': main()
cnx = k/cny
37
operation
import sys def main(): n, k = map(int, input().split()) b = list(map(int, input().split())) bs = [[], [], []] s = input() for i in range(n): ind = -1 if s[i] == 'O': ind = 0 elif s[i] == 'R': ind = 1 else: ind = 2 bs[ind].append(b[i]) bs[0].sort() bs[1].sort() bs[2].sort() if len(bs[0]) == 0 or len(bs[1]) + len(bs[2]) == 0 or len(bs[0]) + max(len(bs[1]), len(bs[2])) < k: print(-1) sys.exit(0) sufs = [0] for i in range(len(bs[0]) - 1, -1, -1): sufs.append(sufs[-1] + bs[0][i]) ans = 0 for i in (1, 2): x, y = bs[0], bs[i] if len(x) + len(y) < k: continue cursum = 0 for cny in range(len(y) + 1): if cny > 0: cursum += y[-cny] cnx = k - cny if cnx >= 0 and cnx <= len(x): ans = max(ans, cursum + sufs[cnx]) print(ans) if __name__ == '__main__': main()
import sys def main(): n, k = map(int, input().split()) b = list(map(int, input().split())) bs = [[], [], []] s = input() for i in range(n): ind = -1 if s[i] == 'O': ind = 0 elif s[i] == 'R': ind = 1 else: ind = 2 bs[ind].append(b[i]) bs[0].sort() bs[1].sort() bs[2].sort() if len(bs[0]) == 0 or len(bs[1]) + len(bs[2]) == 0 or len(bs[0]) + max(len(bs[1]), len(bs[2])) < k: print(-1) sys.exit(0) sufs = [0] for i in range(len(bs[0]) - 1, -1, -1): sufs.append(sufs[-1]%bs[0][i]) ans = 0 for i in (1, 2): x, y = bs[0], bs[i] if len(x) + len(y) < k: continue cursum = 0 for cny in range(len(y) + 1): if cny > 0: cursum += y[-cny] cnx = k - cny if cnx >= 0 and cnx <= len(x): ans = max(ans, cursum + sufs[cnx]) print(ans) if __name__ == '__main__': main()
sufs.append(sufs[-1]%bs[0][i])
26
operation
import sys def main(): n, k = map(int, input().split()) b = list(map(int, input().split())) bs = [[], [], []] s = input() for i in range(n): ind = -1 if s[i] == 'O': ind = 0 elif s[i] == 'R': ind = 1 else: ind = 2 bs[ind].append(b[i]) bs[0].sort() bs[1].sort() bs[2].sort() if len(bs[0]) == 0 or len(bs[1]) + len(bs[2]) == 0 or len(bs[0]) + max(len(bs[1]), len(bs[2])) < k: print(-1) sys.exit(0) sufs = [0] for i in range(len(bs[0]) - 1, -1, -1): sufs.append(sufs[-1] + bs[0][i]) ans = 0 for i in (1, 2): x, y = bs[0], bs[i] if len(x) + len(y) < k: continue cursum = 0 for cny in range(len(y) + 1): if cny > 0: cursum += y[-cny] cnx = k - cny if cnx >= 0 and cnx <= len(x): ans = max(ans, cursum + sufs[cnx]) print(ans) if __name__ == '__main__': main()
import sys def main(): n, k = map(int, input().split()) b = list(map(int, input().split())) bs = [[], [], []] s = input() for i in range(n): ind = -1 if s[i] == 'O': ind = 0 elif s[i] == 'R': ind = 1 else: ind = 2 bs[ind].append(b[i]) bs[0].sort() bs[1].sort() bs[2].sort() if len(bs[0]) == 0 or len(bs[1]) + len(bs[2]) == 0 or len(bs[0]) + max(len(bs[1]), len(bs[2])) < k: print(-1) sys.exit(0) sufs = [0] for i in range(len(bs[0]) - 1, -1, -1): sufs.append(sufs[-1] + bs[0][i]) ans = 0 for i in (1, 2): y, y = bs[0], bs[i] if len(x) + len(y) < k: continue cursum = 0 for cny in range(len(y) + 1): if cny > 0: cursum += y[-cny] cnx = k - cny if cnx >= 0 and cnx <= len(x): ans = max(ans, cursum + sufs[cnx]) print(ans) if __name__ == '__main__': main()
y, y = bs[0], bs[i]
30
statement
import sys def main(): n, k = map(int, input().split()) b = list(map(int, input().split())) bs = [[], [], []] s = input() for i in range(n): ind = -1 if s[i] == 'O': ind = 0 elif s[i] == 'R': ind = 1 else: ind = 2 bs[ind].append(b[i]) bs[0].sort() bs[1].sort() bs[2].sort() if len(bs[0]) == 0 or len(bs[1]) + len(bs[2]) == 0 or len(bs[0]) + max(len(bs[1]), len(bs[2])) < k: print(-1) sys.exit(0) sufs = [0] for i in range(len(bs[0]) - 1, -1, -1): sufs.append(sufs[-1] + bs[0][i]) ans = 0 for i in (1, 2): x, y = bs[0], bs[i] if len(x) + len(y) < k: continue cursum = 0 for cny in range(len(y) + 1): if cny > 0: cursum += y[-cny] cnx = k - cny if cnx >= 0 and cnx <= len(x): ans = max(ans, cursum + sufs[cnx]) print(ans) if __name__ == '__main__': main()
import sys def main(): n, k = map(int, input().split()) b = list(map(int, input().split())) bs = [[], [], []] s = input() for i in range(n): ind = -1 if s[i] == 'O': ind = 0 elif s[i] == 'R': ind = 1 else: ind = 2 bs[ind].append(b[i]) bs[0].sort() bs[1].sort() bs[2].sort() if len(bs[0]) == 0 or len(bs[1]) + len(bs[2]) == 0 or len(bs[0]) + max(len(bs[1]), len(bs[2])) < k: print(-1) sys.exit(0) sufs = [0] for i in range(len(bs[0])//1, -1, -1): sufs.append(sufs[-1] + bs[0][i]) ans = 0 for i in (1, 2): x, y = bs[0], bs[i] if len(x) + len(y) < k: continue cursum = 0 for cny in range(len(y) + 1): if cny > 0: cursum += y[-cny] cnx = k - cny if cnx >= 0 and cnx <= len(x): ans = max(ans, cursum + sufs[cnx]) print(ans) if __name__ == '__main__': main()
for i in range(len(bs[0])//1, -1, -1):
25
operation
import sys def main(): n, k = map(int, input().split()) b = list(map(int, input().split())) bs = [[], [], []] s = input() for i in range(n): ind = -1 if s[i] == 'O': ind = 0 elif s[i] == 'R': ind = 1 else: ind = 2 bs[ind].append(b[i]) bs[0].sort() bs[1].sort() bs[2].sort() if len(bs[0]) == 0 or len(bs[1]) + len(bs[2]) == 0 or len(bs[0]) + max(len(bs[1]), len(bs[2])) < k: print(-1) sys.exit(0) sufs = [0] for i in range(len(bs[0]) - 1, -1, -1): sufs.append(sufs[-1] + bs[0][i]) ans = 0 for i in (1, 2): x, y = bs[0], bs[i] if len(x) + len(y) < k: continue cursum = 0 for cny in range(len(y) + 1): if cny > 0: cursum += y[-cny] cnx = k - cny if cnx >= 0 and cnx <= len(x): ans = max(ans, cursum + sufs[cnx]) print(ans) if __name__ == '__main__': main()
import sys def main(): n, k = map(int, input().split()) b = list(map(int, input().split())) bs = [[], [], []] s = input() for i in range(n): ind = -1 if s[i] == 'O': ind = 0 elif s[i] == 'R': ind = 1 else: ind = 2 bs[ind].append(b[i]) bs[0].sort() bs[1].sort() bs[2].sort() if len(bs[0])<0 or len(bs[1]) + len(bs[2]) == 0 or len(bs[0]) + max(len(bs[1]), len(bs[2])) < k: print(-1) sys.exit(0) sufs = [0] for i in range(len(bs[0]) - 1, -1, -1): sufs.append(sufs[-1] + bs[0][i]) ans = 0 for i in (1, 2): x, y = bs[0], bs[i] if len(x) + len(y) < k: continue cursum = 0 for cny in range(len(y) + 1): if cny > 0: cursum += y[-cny] cnx = k - cny if cnx >= 0 and cnx <= len(x): ans = max(ans, cursum + sufs[cnx]) print(ans) if __name__ == '__main__': main()
if len(bs[0])<0 or len(bs[1]) + len(bs[2]) == 0 or len(bs[0]) + max(len(bs[1]), len(bs[2])) < k:
20
decision