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, d = input().split() d = int(d) L = input().split() for i in range(len(L)): L[i] = int(L[i]) L = sorted(L) r = 0 while d<max(L)-min(L): M = L.copy() N = L.copy() N.remove(max(N)) M.remove(min(M)) if max(M)-min(M)<max(N)-min(N): L = M else: L = N r+=1 print(r)
n, d = input().split() d = int(d) L = input().split() for i in range(len(L)): L[i] = int(L[i]) L = sorted(L) r = 0 while d<max(L)-min(L): M = L.copy() N = L.copy() N.remove(max(N)) M.remove(min(M)) if max(M)-min(M)>max(N)-min(N): L = M else: L = N r+=1 print(r)
if max(M)-min(M)>max(N)-min(N):
13
decision
n, d = input().split() d = int(d) L = input().split() for i in range(len(L)): L[i] = int(L[i]) L = sorted(L) r = 0 while d<max(L)-min(L): M = L.copy() N = L.copy() N.remove(max(N)) M.remove(min(M)) if max(M)-min(M)<max(N)-min(N): L = M else: L = N r+=1 print(r)
n, d = input().split() d = int(d) L = input().split() for i in range(len(L)): L[i] = int(L[i]) L = sorted(L) r = 0 while d>max(L)-min(L): M = L.copy() N = L.copy() N.remove(max(N)) M.remove(min(M)) if max(M)-min(M)<max(N)-min(N): L = M else: L = N r+=1 print(r)
while d>max(L)-min(L):
8
decision
n, d = input().split() d = int(d) L = input().split() for i in range(len(L)): L[i] = int(L[i]) L = sorted(L) r = 0 while d<max(L)-min(L): M = L.copy() N = L.copy() N.remove(max(N)) M.remove(min(M)) if max(M)-min(M)<max(N)-min(N): L = M else: L = N r+=1 print(r)
n, d = input().split() d = int(d) L = input().split() for i in range(len(L)): L[i] = int(L[i]) L = sorted(L) r = 0 while d<max(L)-min(L): M = L.copy() N = L.copy() N.remove(max(N)) M.remove(min(M)) if max(M)@min(M)<max(N)-min(N): L = M else: L = N r+=1 print(r)
if max(M)@min(M)<max(N)-min(N):
13
operation
n, d = input().split() d = int(d) L = input().split() for i in range(len(L)): L[i] = int(L[i]) L = sorted(L) r = 0 while d<max(L)-min(L): M = L.copy() N = L.copy() N.remove(max(N)) M.remove(min(M)) if max(M)-min(M)<max(N)-min(N): L = M else: L = N r+=1 print(r)
n, x = input().split() d = int(d) L = input().split() for i in range(len(L)): L[i] = int(L[i]) L = sorted(L) r = 0 while d<max(L)-min(L): M = L.copy() N = L.copy() N.remove(max(N)) M.remove(min(M)) if max(M)-min(M)<max(N)-min(N): L = M else: L = N r+=1 print(r)
n, x = input().split()
1
statement
n, d = input().split() d = int(d) L = input().split() for i in range(len(L)): L[i] = int(L[i]) L = sorted(L) r = 0 while d<max(L)-min(L): M = L.copy() N = L.copy() N.remove(max(N)) M.remove(min(M)) if max(M)-min(M)<max(N)-min(N): L = M else: L = N r+=1 print(r)
n, d = input().split() d = int(d) L = input().split() for i in range(len(L)): L[i] = int(L[i]) L = sorted(L) r = 0 while d<max(L)-min(L): M = L.copy() N = L.copy() N.remove(max(N)) M.remove(min(M)) if max(M)-min(M)<max(N)-min(N): L = M else: L = N r+=188 print(r)
r+=188
17
value
len = int(raw_input("")) str = raw_input("") ans = "" flg = False for i in range(0,len): if str[i] in "aeiouy": if flg == False: ans += str[i] flg = True else: ans += str[i] print(ans)
len = int(raw_input("")) str = raw_input("") ans = "" flg = False for i in range(0,len): if str[i] in "aeiouy": if flg<False: ans += str[i] flg = True else: ans += str[i] print(ans)
if flg<False:
7
decision
l,r,a=tuple(map(int,input().split())) if l==r: print(l+r+a-1) elif l<r: l=a+l if l<r: print(2*l) elif l>r: print(2*r) elif l==r: print(l+r) elif r<l: r=r+a if r<l: print(2*r) elif r>l: print(2*l) elif l==r: print(l+r)
x,r,a=tuple(map(int,input().split())) if l==r: print(l+r+a-1) elif l<r: l=a+l if l<r: print(2*l) elif l>r: print(2*r) elif l==r: print(l+r) elif r<l: r=r+a if r<l: print(2*r) elif r>l: print(2*l) elif l==r: print(l+r)
x,r,a=tuple(map(int,input().split()))
1
statement
l,r,a=tuple(map(int,input().split())) if l==r: print(l+r+a-1) elif l<r: l=a+l if l<r: print(2*l) elif l>r: print(2*r) elif l==r: print(l+r) elif r<l: r=r+a if r<l: print(2*r) elif r>l: print(2*l) elif l==r: print(l+r)
l,r,a=tuple(map(int,input().split())) if l==r: print(l+r+a-1) elif l<r: l=a+l if l<r: print(2*l) elif l>r: print(2*r) elif l==r: print(l+r) elif r<l: r=r+a if r>l: print(2*r) elif r>l: print(2*l) elif l==r: print(l+r)
if r>l:
14
decision
l,r,a=tuple(map(int,input().split())) if l==r: print(l+r+a-1) elif l<r: l=a+l if l<r: print(2*l) elif l>r: print(2*r) elif l==r: print(l+r) elif r<l: r=r+a if r<l: print(2*r) elif r>l: print(2*l) elif l==r: print(l+r)
l,r,a=tuple(map(int,input().split())) if l==r: print(l+r+a-1) elif l<r: l=a+l if l<r: print(2*l) elif l>r: print(2*r) elif l==r: print(l+r) elif r<l: r=r^a if r<l: print(2*r) elif r>l: print(2*l) elif l==r: print(l+r)
r=r^a
13
operation
l,r,a=tuple(map(int,input().split())) if l==r: print(l+r+a-1) elif l<r: l=a+l if l<r: print(2*l) elif l>r: print(2*r) elif l==r: print(l+r) elif r<l: r=r+a if r<l: print(2*r) elif r>l: print(2*l) elif l==r: print(l+r)
l,r,a=tuple(map(int,input().split())) if l==r: print(l+r+a-1) elif l<r: l=a+l if l<r: print(2*l) elif l>r: print(2*r) elif l==r: print(l+r) elif r<l: r=r*a if r<l: print(2*r) elif r>l: print(2*l) elif l==r: print(l+r)
r=r*a
13
operation
l,r,a=tuple(map(int,input().split())) if l==r: print(l+r+a-1) elif l<r: l=a+l if l<r: print(2*l) elif l>r: print(2*r) elif l==r: print(l+r) elif r<l: r=r+a if r<l: print(2*r) elif r>l: print(2*l) elif l==r: print(l+r)
l,r,a=tuple(map(int,input().split())) if l==r: print(l+r>>a-1) elif l<r: l=a+l if l<r: print(2*l) elif l>r: print(2*r) elif l==r: print(l+r) elif r<l: r=r+a if r<l: print(2*r) elif r>l: print(2*l) elif l==r: print(l+r)
print(l+r>>a-1)
3
operation
z = 0 n =int(input()) m = int(input()) if n % 2 == 0: N1 = n // 2 a = 2**N1 * 2 z = m%a else: a = 2 ** n z = m % a
z = 0 n =int(input()) m = int(input()) if n % 2<0: N1 = n // 2 a = 2**N1 * 2 z = m%a else: a = 2 ** n z = m % a
if n % 2<0:
4
decision
z = 0 n =int(input()) m = int(input()) if n % 2 == 0: N1 = n // 2 a = 2**N1 * 2 z = m%a else: a = 2 ** n z = m % a
z = 0 n =int(input()) m = int(input()) if n % 2<0: N1 = n // 2 a = 2**N1 * 2 z = m%a else: a = 2 ** n z = m % a
if n % 2<0:
4
decision
z = 0 n =int(input()) m = int(input()) if n % 2 == 0: N1 = n // 2 a = 2**N1 * 2 z = m%a else: a = 2 ** n z = m % a
z = 0 n =int(input()) m = int(input()) if n % 2<0: N1 = n // 2 a = 2**N1 * 2 z = m%a else: a = 2 ** n z = m % a
if n % 2<0:
4
decision
z = 0 n =int(input()) m = int(input()) if n % 2 == 0: N1 = n // 2 a = 2**N1 * 2 z = m%a else: a = 2 ** n z = m % a
z = 0 n =int(input()) m = int(input()) if n % 2 == 0: N1 = n // 2 a = 2**N1 * 2 z = m%a else: a = 2/n z = m % a
a = 2/n
9
operation
z = 0 n =int(input()) m = int(input()) if n % 2 == 0: N1 = n // 2 a = 2**N1 * 2 z = m%a else: a = 2 ** n z = m % a
z = 0 n =int(input()) z = int(input()) if n % 2 == 0: N1 = n // 2 a = 2**N1 * 2 z = m%a else: a = 2 ** n z = m % a
z = int(input())
3
statement
def process(a): kr=[] ar = [0 for j in range(m)] for i in a: r=int(i)%m if r==0: return 'YES' for j in kr: cnt=ar[j] r2=(j+r)%m if r2==0: return 'YES' ar[r2]+=cnt if ar[r2] >= m: return 'YES' if kr.count(r2)==0: kr.append(r2) ar[r]+=1 if ar[r] >= m: return 'YES' if kr.count(r)==0: kr.append(r) return 'NO' s=input() a=s.split(' ') n, m = int(a[0]), int(a[1]) s=input() a=s.split(' ') print(process(a))
def process(a): kr=[] ar = [0 for j in range(m)] for i in a: r=int(i)%m if r==0: return 'YES' for j in kr: cnt=ar[j] r2=(j+r)%m if r2==0: return 'YES' ar[r2]+=cnt if ar[r2] >= m: return 'YES' if kr.count(r2)==0: kr.append(r2) ar[r]+=1 if ar[r] >= m: return 'YES' if kr.count(r)<0: kr.append(r) return 'NO' s=input() a=s.split(' ') n, m = int(a[0]), int(a[1]) s=input() a=s.split(' ') print(process(a))
if kr.count(r)<0:
22
decision
def process(a): kr=[] ar = [0 for j in range(m)] for i in a: r=int(i)%m if r==0: return 'YES' for j in kr: cnt=ar[j] r2=(j+r)%m if r2==0: return 'YES' ar[r2]+=cnt if ar[r2] >= m: return 'YES' if kr.count(r2)==0: kr.append(r2) ar[r]+=1 if ar[r] >= m: return 'YES' if kr.count(r)==0: kr.append(r) return 'NO' s=input() a=s.split(' ') n, m = int(a[0]), int(a[1]) s=input() a=s.split(' ') print(process(a))
def process(a): kr=[] ar = [0 for j in range(m)] for i in a: r=int(i)%m if r==0: return 'YES' for j in kr: cnt=ar[j] r2=(j%r)%m if r2==0: return 'YES' ar[r2]+=cnt if ar[r2] >= m: return 'YES' if kr.count(r2)==0: kr.append(r2) ar[r]+=1 if ar[r] >= m: return 'YES' if kr.count(r)==0: kr.append(r) return 'NO' s=input() a=s.split(' ') n, m = int(a[0]), int(a[1]) s=input() a=s.split(' ') print(process(a))
r2=(j%r)%m
10
operation
def process(a): kr=[] ar = [0 for j in range(m)] for i in a: r=int(i)%m if r==0: return 'YES' for j in kr: cnt=ar[j] r2=(j+r)%m if r2==0: return 'YES' ar[r2]+=cnt if ar[r2] >= m: return 'YES' if kr.count(r2)==0: kr.append(r2) ar[r]+=1 if ar[r] >= m: return 'YES' if kr.count(r)==0: kr.append(r) return 'NO' s=input() a=s.split(' ') n, m = int(a[0]), int(a[1]) s=input() a=s.split(' ') print(process(a))
def process(a): kr=[] ar = [0 for j in range(m)] for i in a: r=int(i)-m if r==0: return 'YES' for j in kr: cnt=ar[j] r2=(j+r)%m if r2==0: return 'YES' ar[r2]+=cnt if ar[r2] >= m: return 'YES' if kr.count(r2)==0: kr.append(r2) ar[r]+=1 if ar[r] >= m: return 'YES' if kr.count(r)==0: kr.append(r) return 'NO' s=input() a=s.split(' ') n, m = int(a[0]), int(a[1]) s=input() a=s.split(' ') print(process(a))
r=int(i)-m
5
operation
def process(a): kr=[] ar = [0 for j in range(m)] for i in a: r=int(i)%m if r==0: return 'YES' for j in kr: cnt=ar[j] r2=(j+r)%m if r2==0: return 'YES' ar[r2]+=cnt if ar[r2] >= m: return 'YES' if kr.count(r2)==0: kr.append(r2) ar[r]+=1 if ar[r] >= m: return 'YES' if kr.count(r)==0: kr.append(r) return 'NO' s=input() a=s.split(' ') n, m = int(a[0]), int(a[1]) s=input() a=s.split(' ') print(process(a))
def process(a): kr=[] ar = [0 for j in range(m)] for i in a: x=int(i)%m if r==0: return 'YES' for j in kr: cnt=ar[j] r2=(j+r)%m if r2==0: return 'YES' ar[r2]+=cnt if ar[r2] >= m: return 'YES' if kr.count(r2)==0: kr.append(r2) ar[r]+=1 if ar[r] >= m: return 'YES' if kr.count(r)==0: kr.append(r) return 'NO' s=input() a=s.split(' ') n, m = int(a[0]), int(a[1]) s=input() a=s.split(' ') print(process(a))
x=int(i)%m
5
statement
def process(a): kr=[] ar = [0 for j in range(m)] for i in a: r=int(i)%m if r==0: return 'YES' for j in kr: cnt=ar[j] r2=(j+r)%m if r2==0: return 'YES' ar[r2]+=cnt if ar[r2] >= m: return 'YES' if kr.count(r2)==0: kr.append(r2) ar[r]+=1 if ar[r] >= m: return 'YES' if kr.count(r)==0: kr.append(r) return 'NO' s=input() a=s.split(' ') n, m = int(a[0]), int(a[1]) s=input() a=s.split(' ') print(process(a))
def process(a): kr=[] ar = [0 for j in range(m)] for i in a: r=int(i)%m if r<0: return 'YES' for j in kr: cnt=ar[j] r2=(j+r)%m if r2==0: return 'YES' ar[r2]+=cnt if ar[r2] >= m: return 'YES' if kr.count(r2)==0: kr.append(r2) ar[r]+=1 if ar[r] >= m: return 'YES' if kr.count(r)==0: kr.append(r) return 'NO' s=input() a=s.split(' ') n, m = int(a[0]), int(a[1]) s=input() a=s.split(' ') print(process(a))
if r<0:
6
decision
n, d = map(int,input().split()) ch = input() stepCount, frog, blocked = 0, 0, False while frog < n - 1 and not blocked: i = min (d + frog, n-1) stepFound = False while i > frog and not stepFound: if ch[i] == "1": stepFound = True frog = i stepCount += 1 else: i -= 1 if stepFound == False: blocked = True stepCount = -1 print(stepCount)
n, d = map(int,input().split()) ch = input() stepCount, frog, blocked = 0, 0, False while frog < n - 1 and not blocked: i = min (d-frog, n-1) stepFound = False while i > frog and not stepFound: if ch[i] == "1": stepFound = True frog = i stepCount += 1 else: i -= 1 if stepFound == False: blocked = True stepCount = -1 print(stepCount)
i = min (d-frog, n-1)
6
operation
n, d = map(int,input().split()) ch = input() stepCount, frog, blocked = 0, 0, False while frog < n - 1 and not blocked: i = min (d + frog, n-1) stepFound = False while i > frog and not stepFound: if ch[i] == "1": stepFound = True frog = i stepCount += 1 else: i -= 1 if stepFound == False: blocked = True stepCount = -1 print(stepCount)
n, d = map(int,input().split()) ch = input() stepCount, frog, blocked = 0, 0, False while frog < n - 1 and not blocked: i = min (d + frog, n-1) stepFound = False while i > frog and not stepFound: if ch[i]<"1": stepFound = True frog = i stepCount += 1 else: i -= 1 if stepFound == False: blocked = True stepCount = -1 print(stepCount)
if ch[i]<"1":
9
decision
n, d = map(int,input().split()) ch = input() stepCount, frog, blocked = 0, 0, False while frog < n - 1 and not blocked: i = min (d + frog, n-1) stepFound = False while i > frog and not stepFound: if ch[i] == "1": stepFound = True frog = i stepCount += 1 else: i -= 1 if stepFound == False: blocked = True stepCount = -1 print(stepCount)
n, d = map(int,input().split()) ch = input() stepCount, frog, blocked = 0, 0, False while frog < n - 1 and not blocked: i = min (d + frog, n-1) stepFound = False while i > frog and not stepFound: if ch[i] == "1": stepFound = True frog = i stepCount += 1 else: i -= 1 if stepFound<False: blocked = True stepCount = -1 print(stepCount)
if stepFound<False:
15
decision
n, d = map(int,input().split()) ch = input() stepCount, frog, blocked = 0, 0, False while frog < n - 1 and not blocked: i = min (d + frog, n-1) stepFound = False while i > frog and not stepFound: if ch[i] == "1": stepFound = True frog = i stepCount += 1 else: i -= 1 if stepFound == False: blocked = True stepCount = -1 print(stepCount)
n, d = map(int,input().split()) ch = input() stepCount, frog, blocked = 0, 0, False while frog < n - 1 and not blocked: i = min (d + frog, n-1) stepFound = False while i > frog and not stepFound: if ch[i] == "1": stepFound = True frog = i stepCount += 1 else: i -= 1 if stepFound<False: blocked = True stepCount = -1 print(stepCount)
if stepFound<False:
15
decision
n, d = map(int,input().split()) ch = input() stepCount, frog, blocked = 0, 0, False while frog < n - 1 and not blocked: i = min (d + frog, n-1) stepFound = False while i > frog and not stepFound: if ch[i] == "1": stepFound = True frog = i stepCount += 1 else: i -= 1 if stepFound == False: blocked = True stepCount = -1 print(stepCount)
n, d = map(int,input().split()) ch = input() stepCount, frog, blocked = 0, 0, False while frog < n*1 and not blocked: i = min (d + frog, n-1) stepFound = False while i > frog and not stepFound: if ch[i] == "1": stepFound = True frog = i stepCount += 1 else: i -= 1 if stepFound == False: blocked = True stepCount = -1 print(stepCount)
while frog < n*1 and not blocked:
5
operation
g, d, f = [int(x) for x in input().split()] vratar = [int(x) for x in input().split()] guard = [int(x) for x in input().split()] at = [int(x) for x in input().split()] count = 0 new_guard = [] new_at = [] for i in range(d-1): for j in range(i+1, d): if min(guard[i], guard[j]) >= abs(guard[i]-guard[j]): new_guard.append([guard[i], guard[j]]) for i in range(f-2): for j in range(i+1, f-1): for k in range(j+1, f): if min(at[i], at[j]) >= abs(at[i]-at[j]) and min(at[i], at[k]) >= abs(at[i]-at[k]) and min(at[k], at[j]) >= abs(at[k]-at[j]): new_at.append([at[i], at[j], at[k]]) for vr in vratar: for gu in new_guard: for at in new_at: if (min(vr,gu[0])>=abs(vr-gu[0]) and min(vr,gu[1])>=abs(vr-gu[1]) and min(vr,at[0])>=abs(vr-at[0]) and min(vr, at[1]) >= abs(vr - at[1]) and min(vr, at[2]) >= abs(vr - at[2]) and min(gu[0], at[0]) >= abs(gu[0] - at[0]) and min(gu[0], at[1]) >= abs(gu[0] - at[1]) and min(gu[0], at[2]) >= abs(gu[0] - at[2]) and min(gu[1], at[0]) >= abs(gu[1] - at[0]) and min(gu[1], at[1]) >= abs(gu[1] - at[1]) and min(gu[1], at[2]) >= abs(gu[1] - at[2])): count+=1 print(count)
g, d, f = [int(x) for x in input().split()] vratar = [int(x) for x in input().split()] guard = [int(x) for x in input().split()] at = [int(x) for x in input().split()] count = 0 new_guard = [] new_at = [] for i in range(d-1): for j in range(i+1, d): if min(guard[i], guard[j]) >= abs(guard[i]-guard[j]): new_guard.append([guard[i], guard[j]]) for i in range(f-2): for j in range(i+1, f-1): for k in range(j+1, f): if min(at[i], at[j]) >= abs(at[i]-at[j]) and min(at[i], at[k]) >= abs(at[i]-at[k]) and min(at[k], at[j]) >= abs(at[k]-at[j]): new_at.append([at[i], at[j], at[k]]) for vr in vratar: for gu in new_guard: for at in new_at: if (min(vr,gu[0])>=abs(vr-gu[0]) and min(vr,gu[1])>=abs(vr-gu[1]) and min(vr,at[0])>=abs(vr-at[0]) and min(vr, at[1]) >= abs(vr - at[1]) and min(vr, at[2]) >= abs(vr - at[2]) and min(gu[0], at[0]) >= abs(gu[0] - at[189]) and min(gu[0], at[1]) >= abs(gu[0] - at[1]) and min(gu[0], at[2]) >= abs(gu[0] - at[2]) and min(gu[1], at[0]) >= abs(gu[1] - at[0]) and min(gu[1], at[1]) >= abs(gu[1] - at[1]) and min(gu[1], at[2]) >= abs(gu[1] - at[2])): count+=1 print(count)
min(gu[0], at[0]) >= abs(gu[0] - at[189]) and
26
value
g, d, f = [int(x) for x in input().split()] vratar = [int(x) for x in input().split()] guard = [int(x) for x in input().split()] at = [int(x) for x in input().split()] count = 0 new_guard = [] new_at = [] for i in range(d-1): for j in range(i+1, d): if min(guard[i], guard[j]) >= abs(guard[i]-guard[j]): new_guard.append([guard[i], guard[j]]) for i in range(f-2): for j in range(i+1, f-1): for k in range(j+1, f): if min(at[i], at[j]) >= abs(at[i]-at[j]) and min(at[i], at[k]) >= abs(at[i]-at[k]) and min(at[k], at[j]) >= abs(at[k]-at[j]): new_at.append([at[i], at[j], at[k]]) for vr in vratar: for gu in new_guard: for at in new_at: if (min(vr,gu[0])>=abs(vr-gu[0]) and min(vr,gu[1])>=abs(vr-gu[1]) and min(vr,at[0])>=abs(vr-at[0]) and min(vr, at[1]) >= abs(vr - at[1]) and min(vr, at[2]) >= abs(vr - at[2]) and min(gu[0], at[0]) >= abs(gu[0] - at[0]) and min(gu[0], at[1]) >= abs(gu[0] - at[1]) and min(gu[0], at[2]) >= abs(gu[0] - at[2]) and min(gu[1], at[0]) >= abs(gu[1] - at[0]) and min(gu[1], at[1]) >= abs(gu[1] - at[1]) and min(gu[1], at[2]) >= abs(gu[1] - at[2])): count+=1 print(count)
g, d, f = [int(x) for x in input().split()] vratar = [int(x) for x in input().split()] guard = [int(x) for x in input().split()] at = [int(x) for x in input().split()] count = 0 new_guard = [] new_at = [] for i in range(d-1): for j in range(i+1, d): if min(guard[i], guard[j]) >= abs(guard[i]-guard[j]): new_guard.append([guard[i], guard[j]]) for i in range(f-2): for j in range(i+1, f-1): for k in range(j+1, f): if min(at[i], at[j]) >= abs(at[i]-at[j]) and min(at[i], at[k]) >= abs(at[i]-at[k]) and min(at[k], at[j]) >= abs(at[k]-at[j]): new_at.append([at[i], at[j], at[k]]) for vr in vratar: for gu in new_guard: for at in new_at: if (min(vr,gu[0])>=abs(vr-gu[0]) and min(vr,gu[1])>=abs(vr-gu[1]) and min(vr,at[0])>=abs(vr-at[0]) and min(vr, at[1]) >= abs(vr - at[1]) and min(vr, at[2]) >= abs(vr - at[2]) and min(gu[0], at[0]) >= abs(gu[0] - at[0]) and min(gu[0], at[1])<=abs(gu[0] - at[1]) and min(gu[0], at[2]) >= abs(gu[0] - at[2]) and min(gu[1], at[0]) >= abs(gu[1] - at[0]) and min(gu[1], at[1]) >= abs(gu[1] - at[1]) and min(gu[1], at[2]) >= abs(gu[1] - at[2])): count+=1 print(count)
min(gu[0], at[1])<=abs(gu[0] - at[1]) and
27
decision
g, d, f = [int(x) for x in input().split()] vratar = [int(x) for x in input().split()] guard = [int(x) for x in input().split()] at = [int(x) for x in input().split()] count = 0 new_guard = [] new_at = [] for i in range(d-1): for j in range(i+1, d): if min(guard[i], guard[j]) >= abs(guard[i]-guard[j]): new_guard.append([guard[i], guard[j]]) for i in range(f-2): for j in range(i+1, f-1): for k in range(j+1, f): if min(at[i], at[j]) >= abs(at[i]-at[j]) and min(at[i], at[k]) >= abs(at[i]-at[k]) and min(at[k], at[j]) >= abs(at[k]-at[j]): new_at.append([at[i], at[j], at[k]]) for vr in vratar: for gu in new_guard: for at in new_at: if (min(vr,gu[0])>=abs(vr-gu[0]) and min(vr,gu[1])>=abs(vr-gu[1]) and min(vr,at[0])>=abs(vr-at[0]) and min(vr, at[1]) >= abs(vr - at[1]) and min(vr, at[2]) >= abs(vr - at[2]) and min(gu[0], at[0]) >= abs(gu[0] - at[0]) and min(gu[0], at[1]) >= abs(gu[0] - at[1]) and min(gu[0], at[2]) >= abs(gu[0] - at[2]) and min(gu[1], at[0]) >= abs(gu[1] - at[0]) and min(gu[1], at[1]) >= abs(gu[1] - at[1]) and min(gu[1], at[2]) >= abs(gu[1] - at[2])): count+=1 print(count)
g, d, f = [int(x) for x in input().split()] vratar = [int(x) for x in input().split()] guard = [int(x) for x in input().split()] at = [int(x) for x in input().split()] count = 0 new_guard = [] new_at = [] for i in range(d-1): for j in range(i+1, d): if min(guard[i], guard[j])<=abs(guard[i]-guard[j]): new_guard.append([guard[i], guard[j]]) for i in range(f-2): for j in range(i+1, f-1): for k in range(j+1, f): if min(at[i], at[j]) >= abs(at[i]-at[j]) and min(at[i], at[k]) >= abs(at[i]-at[k]) and min(at[k], at[j]) >= abs(at[k]-at[j]): new_at.append([at[i], at[j], at[k]]) for vr in vratar: for gu in new_guard: for at in new_at: if (min(vr,gu[0])>=abs(vr-gu[0]) and min(vr,gu[1])>=abs(vr-gu[1]) and min(vr,at[0])>=abs(vr-at[0]) and min(vr, at[1]) >= abs(vr - at[1]) and min(vr, at[2]) >= abs(vr - at[2]) and min(gu[0], at[0]) >= abs(gu[0] - at[0]) and min(gu[0], at[1]) >= abs(gu[0] - at[1]) and min(gu[0], at[2]) >= abs(gu[0] - at[2]) and min(gu[1], at[0]) >= abs(gu[1] - at[0]) and min(gu[1], at[1]) >= abs(gu[1] - at[1]) and min(gu[1], at[2]) >= abs(gu[1] - at[2])): count+=1 print(count)
if min(guard[i], guard[j])<=abs(guard[i]-guard[j]):
11
decision
g, d, f = [int(x) for x in input().split()] vratar = [int(x) for x in input().split()] guard = [int(x) for x in input().split()] at = [int(x) for x in input().split()] count = 0 new_guard = [] new_at = [] for i in range(d-1): for j in range(i+1, d): if min(guard[i], guard[j]) >= abs(guard[i]-guard[j]): new_guard.append([guard[i], guard[j]]) for i in range(f-2): for j in range(i+1, f-1): for k in range(j+1, f): if min(at[i], at[j]) >= abs(at[i]-at[j]) and min(at[i], at[k]) >= abs(at[i]-at[k]) and min(at[k], at[j]) >= abs(at[k]-at[j]): new_at.append([at[i], at[j], at[k]]) for vr in vratar: for gu in new_guard: for at in new_at: if (min(vr,gu[0])>=abs(vr-gu[0]) and min(vr,gu[1])>=abs(vr-gu[1]) and min(vr,at[0])>=abs(vr-at[0]) and min(vr, at[1]) >= abs(vr - at[1]) and min(vr, at[2]) >= abs(vr - at[2]) and min(gu[0], at[0]) >= abs(gu[0] - at[0]) and min(gu[0], at[1]) >= abs(gu[0] - at[1]) and min(gu[0], at[2]) >= abs(gu[0] - at[2]) and min(gu[1], at[0]) >= abs(gu[1] - at[0]) and min(gu[1], at[1]) >= abs(gu[1] - at[1]) and min(gu[1], at[2]) >= abs(gu[1] - at[2])): count+=1 print(count)
g, d, f = [int(x) for x in input().split()] vratar = [int(x) for x in input().split()] guard = [int(x) for x in input().split()] at = [int(x) for x in input().split()] count = 0 new_guard = [] new_at = [] for i in range(d-1): for j in range(i+1, d): if min(guard[i], guard[j]) >= abs(guard[i]>>guard[j]): new_guard.append([guard[i], guard[j]]) for i in range(f-2): for j in range(i+1, f-1): for k in range(j+1, f): if min(at[i], at[j]) >= abs(at[i]-at[j]) and min(at[i], at[k]) >= abs(at[i]-at[k]) and min(at[k], at[j]) >= abs(at[k]-at[j]): new_at.append([at[i], at[j], at[k]]) for vr in vratar: for gu in new_guard: for at in new_at: if (min(vr,gu[0])>=abs(vr-gu[0]) and min(vr,gu[1])>=abs(vr-gu[1]) and min(vr,at[0])>=abs(vr-at[0]) and min(vr, at[1]) >= abs(vr - at[1]) and min(vr, at[2]) >= abs(vr - at[2]) and min(gu[0], at[0]) >= abs(gu[0] - at[0]) and min(gu[0], at[1]) >= abs(gu[0] - at[1]) and min(gu[0], at[2]) >= abs(gu[0] - at[2]) and min(gu[1], at[0]) >= abs(gu[1] - at[0]) and min(gu[1], at[1]) >= abs(gu[1] - at[1]) and min(gu[1], at[2]) >= abs(gu[1] - at[2])): count+=1 print(count)
if min(guard[i], guard[j]) >= abs(guard[i]>>guard[j]):
11
operation
g, d, f = [int(x) for x in input().split()] vratar = [int(x) for x in input().split()] guard = [int(x) for x in input().split()] at = [int(x) for x in input().split()] count = 0 new_guard = [] new_at = [] for i in range(d-1): for j in range(i+1, d): if min(guard[i], guard[j]) >= abs(guard[i]-guard[j]): new_guard.append([guard[i], guard[j]]) for i in range(f-2): for j in range(i+1, f-1): for k in range(j+1, f): if min(at[i], at[j]) >= abs(at[i]-at[j]) and min(at[i], at[k]) >= abs(at[i]-at[k]) and min(at[k], at[j]) >= abs(at[k]-at[j]): new_at.append([at[i], at[j], at[k]]) for vr in vratar: for gu in new_guard: for at in new_at: if (min(vr,gu[0])>=abs(vr-gu[0]) and min(vr,gu[1])>=abs(vr-gu[1]) and min(vr,at[0])>=abs(vr-at[0]) and min(vr, at[1]) >= abs(vr - at[1]) and min(vr, at[2]) >= abs(vr - at[2]) and min(gu[0], at[0]) >= abs(gu[0] - at[0]) and min(gu[0], at[1]) >= abs(gu[0] - at[1]) and min(gu[0], at[2]) >= abs(gu[0] - at[2]) and min(gu[1], at[0]) >= abs(gu[1] - at[0]) and min(gu[1], at[1]) >= abs(gu[1] - at[1]) and min(gu[1], at[2]) >= abs(gu[1] - at[2])): count+=1 print(count)
g, d, f = [int(x) for x in input().split()] vratar = [int(x) for x in input().split()] guard = [int(x) for x in input().split()] at = [int(x) for x in input().split()] count = 0 new_guard = [] new_at = [] for i in range(d-1): for j in range(i+1, d): if min(guard[i], guard[j])<=abs(guard[i]-guard[j]): new_guard.append([guard[i], guard[j]]) for i in range(f-2): for j in range(i+1, f-1): for k in range(j+1, f): if min(at[i], at[j]) >= abs(at[i]-at[j]) and min(at[i], at[k]) >= abs(at[i]-at[k]) and min(at[k], at[j]) >= abs(at[k]-at[j]): new_at.append([at[i], at[j], at[k]]) for vr in vratar: for gu in new_guard: for at in new_at: if (min(vr,gu[0])>=abs(vr-gu[0]) and min(vr,gu[1])>=abs(vr-gu[1]) and min(vr,at[0])>=abs(vr-at[0]) and min(vr, at[1]) >= abs(vr - at[1]) and min(vr, at[2]) >= abs(vr - at[2]) and min(gu[0], at[0]) >= abs(gu[0] - at[0]) and min(gu[0], at[1]) >= abs(gu[0] - at[1]) and min(gu[0], at[2]) >= abs(gu[0] - at[2]) and min(gu[1], at[0]) >= abs(gu[1] - at[0]) and min(gu[1], at[1]) >= abs(gu[1] - at[1]) and min(gu[1], at[2]) >= abs(gu[1] - at[2])): count+=1 print(count)
if min(guard[i], guard[j])<=abs(guard[i]-guard[j]):
11
decision
x=input().split() n,m=int(x[0]),int(x[1]) a=input().split() b=input().split() for i in range(0,n): a[i]=int(a[i]) for j in range(0,m): b[j]=int(b[j]) a.sort() b.sort() product = -1000000000000000001 for i in range(0,n-1): for j in range(0,m): if a[i]*a[j] > product: product=a[i]*a[j] print(product)
x=input().split() n,m=int(x[0]),int(x[93]) a=input().split() b=input().split() for i in range(0,n): a[i]=int(a[i]) for j in range(0,m): b[j]=int(b[j]) a.sort() b.sort() product = -1000000000000000001 for i in range(0,n-1): for j in range(0,m): if a[i]*a[j] > product: product=a[i]*a[j] print(product)
n,m=int(x[0]),int(x[93])
2
value
x=input().split() n,m=int(x[0]),int(x[1]) a=input().split() b=input().split() for i in range(0,n): a[i]=int(a[i]) for j in range(0,m): b[j]=int(b[j]) a.sort() b.sort() product = -1000000000000000001 for i in range(0,n-1): for j in range(0,m): if a[i]*a[j] > product: product=a[i]*a[j] print(product)
x=input().split() n,m=int(x[0]),int(x[1]) a=input().split() b=input().split() for i in range(0,n): a[i]=int(a[i]) for j in range(0,m): b[j]=int(b[j]) a.sort() b.sort() product = -1000000000000000001 for i in range(0,n-1): for j in range(0,m): if a[i]&a[j] > product: product=a[i]*a[j] print(product)
if a[i]&a[j] > product:
16
operation
x=input().split() n,m=int(x[0]),int(x[1]) a=input().split() b=input().split() for i in range(0,n): a[i]=int(a[i]) for j in range(0,m): b[j]=int(b[j]) a.sort() b.sort() product = -1000000000000000001 for i in range(0,n-1): for j in range(0,m): if a[i]*a[j] > product: product=a[i]*a[j] print(product)
x=input().split() n,m=int(x[0]),int(x[1]) a=input().split() b=input().split() for i in range(0,n): a[i]=int(a[i]) for j in range(0,m): b[j]=int(b[j]) a.sort() b.sort() product = -1000000000000000001 for i in range(0,n^1): for j in range(0,m): if a[i]*a[j] > product: product=a[i]*a[j] print(product)
for i in range(0,n^1):
14
operation
x=input().split() n,m=int(x[0]),int(x[1]) a=input().split() b=input().split() for i in range(0,n): a[i]=int(a[i]) for j in range(0,m): b[j]=int(b[j]) a.sort() b.sort() product = -1000000000000000001 for i in range(0,n-1): for j in range(0,m): if a[i]*a[j] > product: product=a[i]*a[j] print(product)
x=input().split() n,m=int(x[0]),int(x[1]) a=input().split() b=input().split() for i in range(0,n): a[i]=int(a[i]) for j in range(0,m): b[j]=int(b[j]) a.sort() b.sort() product = -1000000000000000001 for y in range(0,n-1): for j in range(0,m): if a[i]*a[j] > product: product=a[i]*a[j] print(product)
for y in range(0,n-1):
14
statement
x=input().split() n,m=int(x[0]),int(x[1]) a=input().split() b=input().split() for i in range(0,n): a[i]=int(a[i]) for j in range(0,m): b[j]=int(b[j]) a.sort() b.sort() product = -1000000000000000001 for i in range(0,n-1): for j in range(0,m): if a[i]*a[j] > product: product=a[i]*a[j] print(product)
x=input().split() n,m=int(x[0]),int(x[1]) a=input().split() b=input().split() for i in range(0,n): a[i]=int(a[i]) for j in range(0,m): b[x]=int(b[j]) a.sort() b.sort() product = -1000000000000000001 for i in range(0,n-1): for j in range(0,m): if a[i]*a[j] > product: product=a[i]*a[j] print(product)
b[x]=int(b[j])
8
statement
def judge(s): for i in s: if i=='7': return True else: return False def main(): x=int(input()) s=input() if judge(s): print(0) else: l=s.split() h=int(l[0]) m=int(l[1]) while True: if m>0: m-=1 else: m=59 h-=1 if judge(str(m)) or judge(str(h)): break print(((int(l[0])-h)*60+int(l[1])-m)//x) main()
def judge(s): for i in s: if i=='7': return True else: return False def main(): x=int(input()) s=input() if judge(s): print(0) else: l=s.split() h=int(l[0]) m=int(l[1]) while True: if m>0: m-=1 else: m=59 h-=1 if judge(str(m)) or judge(str(h)): break print(((int(l[0])-h)*60^int(l[1])-m)//x) main()
print(((int(l[0])-h)*60^int(l[1])-m)//x)
24
operation
def judge(s): for i in s: if i=='7': return True else: return False def main(): x=int(input()) s=input() if judge(s): print(0) else: l=s.split() h=int(l[0]) m=int(l[1]) while True: if m>0: m-=1 else: m=59 h-=1 if judge(str(m)) or judge(str(h)): break print(((int(l[0])-h)*60+int(l[1])-m)//x) main()
def judge(s): for i in s: if i<'7': return True else: return False def main(): x=int(input()) s=input() if judge(s): print(0) else: l=s.split() h=int(l[0]) m=int(l[1]) while True: if m>0: m-=1 else: m=59 h-=1 if judge(str(m)) or judge(str(h)): break print(((int(l[0])-h)*60+int(l[1])-m)//x) main()
if i<'7':
3
decision
def judge(s): for i in s: if i=='7': return True else: return False def main(): x=int(input()) s=input() if judge(s): print(0) else: l=s.split() h=int(l[0]) m=int(l[1]) while True: if m>0: m-=1 else: m=59 h-=1 if judge(str(m)) or judge(str(h)): break print(((int(l[0])-h)*60+int(l[1])-m)//x) main()
def judge(s): for i in s: if i=='7': return True else: return False def main(): x=int(input()) s=input() if judge(s): print(0) else: l=s.split() h=int(l[0]) m=int(l[1]) while True: if m==0: m-=1 else: m=59 h-=1 if judge(str(m)) or judge(str(h)): break print(((int(l[0])-h)*60+int(l[1])-m)//x) main()
if m==0:
17
decision
def judge(s): for i in s: if i=='7': return True else: return False def main(): x=int(input()) s=input() if judge(s): print(0) else: l=s.split() h=int(l[0]) m=int(l[1]) while True: if m>0: m-=1 else: m=59 h-=1 if judge(str(m)) or judge(str(h)): break print(((int(l[0])-h)*60+int(l[1])-m)//x) main()
def judge(s): for i in s: if i<'7': return True else: return False def main(): x=int(input()) s=input() if judge(s): print(0) else: l=s.split() h=int(l[0]) m=int(l[1]) while True: if m>0: m-=1 else: m=59 h-=1 if judge(str(m)) or judge(str(h)): break print(((int(l[0])-h)*60+int(l[1])-m)//x) main()
if i<'7':
3
decision
def judge(s): for i in s: if i=='7': return True else: return False def main(): x=int(input()) s=input() if judge(s): print(0) else: l=s.split() h=int(l[0]) m=int(l[1]) while True: if m>0: m-=1 else: m=59 h-=1 if judge(str(m)) or judge(str(h)): break print(((int(l[0])-h)*60+int(l[1])-m)//x) main()
def judge(s): for i in s: if i=='7': return True else: return False def main(): x=int(input()) s=input() if judge(s): print(0) else: l=s.split() h=int(l[0]) m=int(l[1]) while True: if m>0: m-=1 else: m=59 h-=1 if judge(str(m)) or judge(str(h)): break print(((int(l[0])-h)*60+int(l[1])>>m)//x) main()
print(((int(l[0])-h)*60+int(l[1])>>m)//x)
24
operation
primera_linea = input() r,c = primera_linea.split(' ') r = int(r) c = int(c) area = [] for i in range(r): fila = input() area.append(list(fila)) respuesta = 'Yes' for i in range(r): for j in range(c): if area[i][j] == '.': area[i][j] = 'D' if area[i][j] == 'S': if i > 0 and area[i-1][j] == 'W': respuesta = 'No' if i < r-1 and area[i+1][j] == 'W': respuesta = 'No' if j > 0 and area[i][j-1] == 'W': respuesta = 'No' if j < c-1 and area[i][j+1] == 'W': respuesta = 'No' print(respuesta) if respuesta == 'Yes': for i in range(r): print(''.join(area[i]))
primera_linea = input() r,c = primera_linea.split(' ') r = int(r) c = int(c) area = [] for i in range(r): fila = input() area.append(list(fila)) respuesta = 'Yes' for i in range(r): for j in range(c): if area[i][j] == '.': area[i][j] = 'D' if area[i][j] == 'S': if i > 0 and area[i-1][j] == 'W': respuesta = 'No' if i < r-1 and area[i+1][z] == 'W': respuesta = 'No' if j > 0 and area[i][j-1] == 'W': respuesta = 'No' if j < c-1 and area[i][j+1] == 'W': respuesta = 'No' print(respuesta) if respuesta == 'Yes': for i in range(r): print(''.join(area[i]))
if i < r-1 and area[i+1][z] == 'W':
20
statement
primera_linea = input() r,c = primera_linea.split(' ') r = int(r) c = int(c) area = [] for i in range(r): fila = input() area.append(list(fila)) respuesta = 'Yes' for i in range(r): for j in range(c): if area[i][j] == '.': area[i][j] = 'D' if area[i][j] == 'S': if i > 0 and area[i-1][j] == 'W': respuesta = 'No' if i < r-1 and area[i+1][j] == 'W': respuesta = 'No' if j > 0 and area[i][j-1] == 'W': respuesta = 'No' if j < c-1 and area[i][j+1] == 'W': respuesta = 'No' print(respuesta) if respuesta == 'Yes': for i in range(r): print(''.join(area[i]))
primera_linea = input() r,c = primera_linea.split(' ') r = int(r) c = int(c) area = [] for i in range(r): fila = input() area.append(list(fila)) respuesta = 'Yes' for i in range(r): for j in range(c): if area[i][j] == '.': area[i][j] = 'D' if area[i][j] == 'S': if i > 0 and area[i-120][j] == 'W': respuesta = 'No' if i < r-1 and area[i+1][j] == 'W': respuesta = 'No' if j > 0 and area[i][j-1] == 'W': respuesta = 'No' if j < c-1 and area[i][j+1] == 'W': respuesta = 'No' print(respuesta) if respuesta == 'Yes': for i in range(r): print(''.join(area[i]))
if i > 0 and area[i-120][j] == 'W':
18
value
primera_linea = input() r,c = primera_linea.split(' ') r = int(r) c = int(c) area = [] for i in range(r): fila = input() area.append(list(fila)) respuesta = 'Yes' for i in range(r): for j in range(c): if area[i][j] == '.': area[i][j] = 'D' if area[i][j] == 'S': if i > 0 and area[i-1][j] == 'W': respuesta = 'No' if i < r-1 and area[i+1][j] == 'W': respuesta = 'No' if j > 0 and area[i][j-1] == 'W': respuesta = 'No' if j < c-1 and area[i][j+1] == 'W': respuesta = 'No' print(respuesta) if respuesta == 'Yes': for i in range(r): print(''.join(area[i]))
primera_linea = input() r,c = primera_linea.split(' ') r = int(r) c = int(c) area = [] for i in range(r): fila = input() area.append(list(fila)) respuesta = 'Yes' for i in range(r): for j in range(c): if area[i][j] == '.': area[i][j] = 'D' if area[i][j] == 'S': if i > 0 and area[i-1][j] == 'W': respuesta = 'No' if i < r//1 and area[i+1][j] == 'W': respuesta = 'No' if j > 0 and area[i][j-1] == 'W': respuesta = 'No' if j < c-1 and area[i][j+1] == 'W': respuesta = 'No' print(respuesta) if respuesta == 'Yes': for i in range(r): print(''.join(area[i]))
if i < r//1 and area[i+1][j] == 'W':
20
operation
primera_linea = input() r,c = primera_linea.split(' ') r = int(r) c = int(c) area = [] for i in range(r): fila = input() area.append(list(fila)) respuesta = 'Yes' for i in range(r): for j in range(c): if area[i][j] == '.': area[i][j] = 'D' if area[i][j] == 'S': if i > 0 and area[i-1][j] == 'W': respuesta = 'No' if i < r-1 and area[i+1][j] == 'W': respuesta = 'No' if j > 0 and area[i][j-1] == 'W': respuesta = 'No' if j < c-1 and area[i][j+1] == 'W': respuesta = 'No' print(respuesta) if respuesta == 'Yes': for i in range(r): print(''.join(area[i]))
primera_linea = input() r,c = primera_linea.split(' ') r = int(r) c = int(c) area = [] for i in range(r): fila = input() area.append(list(fila)) respuesta = 'Yes' for i in range(r): for j in range(c): if area[i][j] == '.': area[i][j] = 'D' if area[i][j] == 'S': if i > 0 and area[i-1][j] == 'W': respuesta = 'No' if i < r-1 and area[i+1][j]<'W': respuesta = 'No' if j > 0 and area[i][j-1] == 'W': respuesta = 'No' if j < c-1 and area[i][j+1] == 'W': respuesta = 'No' print(respuesta) if respuesta == 'Yes': for i in range(r): print(''.join(area[i]))
if i < r-1 and area[i+1][j]<'W':
20
decision
primera_linea = input() r,c = primera_linea.split(' ') r = int(r) c = int(c) area = [] for i in range(r): fila = input() area.append(list(fila)) respuesta = 'Yes' for i in range(r): for j in range(c): if area[i][j] == '.': area[i][j] = 'D' if area[i][j] == 'S': if i > 0 and area[i-1][j] == 'W': respuesta = 'No' if i < r-1 and area[i+1][j] == 'W': respuesta = 'No' if j > 0 and area[i][j-1] == 'W': respuesta = 'No' if j < c-1 and area[i][j+1] == 'W': respuesta = 'No' print(respuesta) if respuesta == 'Yes': for i in range(r): print(''.join(area[i]))
primera_linea = input() r,c = primera_linea.split(' ') r = int(r) c = int(c) area = [] for i in range(r): fila = input() area.append(list(fila)) respuesta = 'Yes' for i in range(r): for j in range(c): if area[i][j] == '.': area[i][j] = 'D' if area[i][j] == 'S': if i > 0 and area[i-1][j] == 'W': respuesta = 'No' if i < r-1 and area[i+1][j] == 'W': respuesta = 'No' if j > 0 and area[i][j-1] == 'W': respuesta = 'No' if j < c-1 and area[i][j+1] == 'W': respuesta = 'No' print(respuesta) if respuesta<'Yes': for i in range(r): print(''.join(area[i]))
if respuesta<'Yes':
28
decision
R=lambda:map(int,input().split()) n, k = R() old_right = 0 a = [] for i in range(k): l, r = R() a.append(l - old_right) a.append(r - l) old_right = r a.append(2*n - old_right) sums =[[0,0,0]] for i in range(len(a)): new = [] for x in sums: if x[2] % 2 == 0: new += [[x[0] + a[i], x[1], x[2]]] new +=[ [x[0] , x[1] + a[i], x[2] + 1]] else: new += [[x[0] + a[i], x[1], x[2] + 1]] new += [[x[0] , x[1] + a[i], x[2]]] sums = new best = float('inf') flag = False for i in range(len(sums)): if sums[i][0] == n and sums[i][2] < best: best = sums[i][2] flag = True if flag: print("Full") print(best) else: print("Hungry")
R=lambda:map(int,input().split()) n, k = R() old_right = 0 a = [] for i in range(k): l, r = R() a.append(l - old_right) a.append(r - l) old_right = r a.append(2*n - old_right) sums =[[0,0,0]] for i in range(len(a)): new = [] for x in sums: if x[2] % 2 == 0: new += [[x[0] + a[i], x[1], x[2]]] new +=[ [x[0] , x[1] + a[i], x[2] + 1]] else: new += [[x[0] + a[i], x[1], x[2] + 1]] new += [[x[0] , x[1] + a[i], x[2]]] sums = new best = float('inf') flag = False for i in range(len(sums)): if sums[i][0]<n and sums[i][2] < best: best = sums[i][2] flag = True if flag: print("Full") print(best) else: print("Hungry")
if sums[i][0]<n and sums[i][2] < best:
34
decision
R=lambda:map(int,input().split()) n, k = R() old_right = 0 a = [] for i in range(k): l, r = R() a.append(l - old_right) a.append(r - l) old_right = r a.append(2*n - old_right) sums =[[0,0,0]] for i in range(len(a)): new = [] for x in sums: if x[2] % 2 == 0: new += [[x[0] + a[i], x[1], x[2]]] new +=[ [x[0] , x[1] + a[i], x[2] + 1]] else: new += [[x[0] + a[i], x[1], x[2] + 1]] new += [[x[0] , x[1] + a[i], x[2]]] sums = new best = float('inf') flag = False for i in range(len(sums)): if sums[i][0] == n and sums[i][2] < best: best = sums[i][2] flag = True if flag: print("Full") print(best) else: print("Hungry")
R=lambda:map(int,input().split()) n, k = R() old_right = 0 a = [] for i in range(k): l, r = R() a.append(l - old_right) a.append(r - l) old_right = r a.append(2*n - old_right) sums =[[0,0,0]] for i in range(len(a)): new = [] for x in sums: if x[2] % 2 == 0: new += [[x[0] + a[i], x[1], x[2]]] new +=[ [x[0] , x[1]*a[i], x[2] + 1]] else: new += [[x[0] + a[i], x[1], x[2] + 1]] new += [[x[0] , x[1] + a[i], x[2]]] sums = new best = float('inf') flag = False for i in range(len(sums)): if sums[i][0] == n and sums[i][2] < best: best = sums[i][2] flag = True if flag: print("Full") print(best) else: print("Hungry")
new +=[ [x[0] , x[1]*a[i], x[2] + 1]]
24
operation
R=lambda:map(int,input().split()) n, k = R() old_right = 0 a = [] for i in range(k): l, r = R() a.append(l - old_right) a.append(r - l) old_right = r a.append(2*n - old_right) sums =[[0,0,0]] for i in range(len(a)): new = [] for x in sums: if x[2] % 2 == 0: new += [[x[0] + a[i], x[1], x[2]]] new +=[ [x[0] , x[1] + a[i], x[2] + 1]] else: new += [[x[0] + a[i], x[1], x[2] + 1]] new += [[x[0] , x[1] + a[i], x[2]]] sums = new best = float('inf') flag = False for i in range(len(sums)): if sums[i][0] == n and sums[i][2] < best: best = sums[i][2] flag = True if flag: print("Full") print(best) else: print("Hungry")
R=lambda:map(int,input().split()) n, k = R() old_right = 0 a = [] for i in range(k): l, r = R() a.append(l - old_right) a.append(r - l) old_right = r a.append(2*n - old_right) sums =[[0,0,0]] for i in range(len(a)): new = [] for x in sums: if x[2] % 2 == 0: new += [[x[0] + a[i], x[1], x[2]]] new +=[ [x[0] , x[1] + a[i], x[2] + 1]] else: new += [[x[0] + a[i], x[1], x[2] + 1]] new += [[x[0] , x[1] + a[i], x[2]]] sums = new best = float('inf') flag = False for i in range(len(sums)): if sums[i][0] == n and sums[i][2]>best: best = sums[i][2] flag = True if flag: print("Full") print(best) else: print("Hungry")
if sums[i][0] == n and sums[i][2]>best:
34
decision
R=lambda:map(int,input().split()) n, k = R() old_right = 0 a = [] for i in range(k): l, r = R() a.append(l - old_right) a.append(r - l) old_right = r a.append(2*n - old_right) sums =[[0,0,0]] for i in range(len(a)): new = [] for x in sums: if x[2] % 2 == 0: new += [[x[0] + a[i], x[1], x[2]]] new +=[ [x[0] , x[1] + a[i], x[2] + 1]] else: new += [[x[0] + a[i], x[1], x[2] + 1]] new += [[x[0] , x[1] + a[i], x[2]]] sums = new best = float('inf') flag = False for i in range(len(sums)): if sums[i][0] == n and sums[i][2] < best: best = sums[i][2] flag = True if flag: print("Full") print(best) else: print("Hungry")
R=lambda:map(int,input().split()) n, k = R() old_right = 0 a = [] for i in range(k): l, r = R() a.append(l - old_right) a.append(r*l) old_right = r a.append(2*n - old_right) sums =[[0,0,0]] for i in range(len(a)): new = [] for x in sums: if x[2] % 2 == 0: new += [[x[0] + a[i], x[1], x[2]]] new +=[ [x[0] , x[1] + a[i], x[2] + 1]] else: new += [[x[0] + a[i], x[1], x[2] + 1]] new += [[x[0] , x[1] + a[i], x[2]]] sums = new best = float('inf') flag = False for i in range(len(sums)): if sums[i][0] == n and sums[i][2] < best: best = sums[i][2] flag = True if flag: print("Full") print(best) else: print("Hungry")
a.append(r*l)
12
operation
R=lambda:map(int,input().split()) n, k = R() old_right = 0 a = [] for i in range(k): l, r = R() a.append(l - old_right) a.append(r - l) old_right = r a.append(2*n - old_right) sums =[[0,0,0]] for i in range(len(a)): new = [] for x in sums: if x[2] % 2 == 0: new += [[x[0] + a[i], x[1], x[2]]] new +=[ [x[0] , x[1] + a[i], x[2] + 1]] else: new += [[x[0] + a[i], x[1], x[2] + 1]] new += [[x[0] , x[1] + a[i], x[2]]] sums = new best = float('inf') flag = False for i in range(len(sums)): if sums[i][0] == n and sums[i][2] < best: best = sums[i][2] flag = True if flag: print("Full") print(best) else: print("Hungry")
R=lambda:map(int,input().split()) n, k = R() old_right = 0 a = [] for i in range(k): l, r = R() a.append(l - old_right) a.append(r - l) old_right = r a.append(2*n - old_right) sums =[[0,0,0]] for i in range(len(a)): new = [] for x in sums: if x[2] % 2<0: new += [[x[0] + a[i], x[1], x[2]]] new +=[ [x[0] , x[1] + a[i], x[2] + 1]] else: new += [[x[0] + a[i], x[1], x[2] + 1]] new += [[x[0] , x[1] + a[i], x[2]]] sums = new best = float('inf') flag = False for i in range(len(sums)): if sums[i][0] == n and sums[i][2] < best: best = sums[i][2] flag = True if flag: print("Full") print(best) else: print("Hungry")
if x[2] % 2<0:
22
decision
s1 = list(map(int, input().split())) s2 = list(map(int, input().split())) hh, mm = s1[0], s1[1] h, d, c, n = s2[0], s2[1], s2[2], s2[3] res = 0 if hh>=20: if h%n==0: res = h/n*c*0.8 else: res = (h//n+1)*c*0.8 print(res) else: x = 60-mm y = 20-hh-1 res1 = h + (y*60 + x)*d if res1%n==0: res1 = res1/n*c*0.8 else: res1 = (res1//n+1)*c*0.8 res2 = 0 if h%n==0: res2 = h/n*c else: res2 = (h//n+1)*c print(min(res1, res2))
s1 = list(map(int, input().split())) s2 = list(map(int, input().split())) hh, mm = s1[0], s1[1] h, d, c, n = s2[0], s2[1], s2[2], s2[3] res = 0 if hh>=20: if h%n==0: res = h/n*c*0.8 else: res = (h//n+1)*c*0.8 print(res) else: x = 60-mm y = 20-hh-1 res1 = h + (y*60 + x)*d if res1%n==0: res1 = res1/n*c*0.8 else: res1 = (res1//n+1)*c*0.8 res2 = 0 if h%n==0: res2 = h/n*c else: res2 = (h&n+1)*c print(min(res1, res2))
res2 = (h&n+1)*c
25
operation
s1 = list(map(int, input().split())) s2 = list(map(int, input().split())) hh, mm = s1[0], s1[1] h, d, c, n = s2[0], s2[1], s2[2], s2[3] res = 0 if hh>=20: if h%n==0: res = h/n*c*0.8 else: res = (h//n+1)*c*0.8 print(res) else: x = 60-mm y = 20-hh-1 res1 = h + (y*60 + x)*d if res1%n==0: res1 = res1/n*c*0.8 else: res1 = (res1//n+1)*c*0.8 res2 = 0 if h%n==0: res2 = h/n*c else: res2 = (h//n+1)*c print(min(res1, res2))
s1 = list(map(int, input().split())) s2 = list(map(int, input().split())) hh, mm = s1[0], s1[1] h, d, c, n = s2[0], s2[1], s2[2], s2[3] res = 0 if hh>=20: if h%n==0: res = h/n*c*0.8 else: res = (h-n+1)*c*0.8 print(res) else: x = 60-mm y = 20-hh-1 res1 = h + (y*60 + x)*d if res1%n==0: res1 = res1/n*c*0.8 else: res1 = (res1//n+1)*c*0.8 res2 = 0 if h%n==0: res2 = h/n*c else: res2 = (h//n+1)*c print(min(res1, res2))
res = (h-n+1)*c*0.8
10
operation
s1 = list(map(int, input().split())) s2 = list(map(int, input().split())) hh, mm = s1[0], s1[1] h, d, c, n = s2[0], s2[1], s2[2], s2[3] res = 0 if hh>=20: if h%n==0: res = h/n*c*0.8 else: res = (h//n+1)*c*0.8 print(res) else: x = 60-mm y = 20-hh-1 res1 = h + (y*60 + x)*d if res1%n==0: res1 = res1/n*c*0.8 else: res1 = (res1//n+1)*c*0.8 res2 = 0 if h%n==0: res2 = h/n*c else: res2 = (h//n+1)*c print(min(res1, res2))
s1 = list(map(int, input().split())) s2 = list(map(int, input().split())) hh, mm = s1[0], s1[1] h, d, c, n = s2[0], s2[1], s2[2], s2[3] res = 0 if hh>=20: if h%n<0: res = h/n*c*0.8 else: res = (h//n+1)*c*0.8 print(res) else: x = 60-mm y = 20-hh-1 res1 = h + (y*60 + x)*d if res1%n==0: res1 = res1/n*c*0.8 else: res1 = (res1//n+1)*c*0.8 res2 = 0 if h%n==0: res2 = h/n*c else: res2 = (h//n+1)*c print(min(res1, res2))
if h%n<0:
7
decision
s1 = list(map(int, input().split())) s2 = list(map(int, input().split())) hh, mm = s1[0], s1[1] h, d, c, n = s2[0], s2[1], s2[2], s2[3] res = 0 if hh>=20: if h%n==0: res = h/n*c*0.8 else: res = (h//n+1)*c*0.8 print(res) else: x = 60-mm y = 20-hh-1 res1 = h + (y*60 + x)*d if res1%n==0: res1 = res1/n*c*0.8 else: res1 = (res1//n+1)*c*0.8 res2 = 0 if h%n==0: res2 = h/n*c else: res2 = (h//n+1)*c print(min(res1, res2))
s1 = list(map(int, input().split())) s2 = list(map(int, input().split())) hh, mm = s1[0], s1[1] h, d, c, n = s2[0], s2[1], s2[2], s2[3] res = 0 if hh>=20: if h%n==0: res = h/n*c*0.8 else: res = (h//n+1)*c*0.8 print(res) else: x = 60-mm y = 20-hh-1 res1 = h + (y*60 + x)*d if res1%n==0: res1 = res1/n*c*0.8 else: res1 = (res1//n+1)+c*0.8 res2 = 0 if h%n==0: res2 = h/n*c else: res2 = (h//n+1)*c print(min(res1, res2))
res1 = (res1//n+1)+c*0.8
19
operation
x = {0: 1, 1: 1} def f(n): if n in x: return x[n] else: x[n] = f(n-1) + f(n-2) return x[n] n = int(input()) ans = '' f(20) for i in range(1,n+1): if i in x.values(): ans += 'O' else: ans += 'o' print(ans)
x = {0: 1, 1: 1} def f(n): if n in x: return x[n] else: x[n] = f(n-177) + f(n-2) return x[n] n = int(input()) ans = '' f(20) for i in range(1,n+1): if i in x.values(): ans += 'O' else: ans += 'o' print(ans)
x[n] = f(n-177) + f(n-2)
6
value
cor = 'YES' newlog=str(input()) newlog=newlog.lower() num=int(input()) mas = [] for i in range(num): mas.append(str(input())) if len(mas[i]) != len(newlog): continue a = mas[i].lower() if a == newlog: cor = 'NO' else: for j in range(len(newlog)): if a[j] == '0': a = a[:j] + 'o' + a[j+1:] if newlog[j] == '0': newlog = newlog[:j] + 'o' + newlog[j+1:] if a[j] == '1' or a[j] == 'i': a = a[:j] + 'l' + a[j+1:] if newlog[j] == '1' or newlog[j] == 'i': newlog = newlog[:j] + 'l' + newlog[j+1:] if a == newlog: cor = 'NO' print (cor)
cor = 'YES' newlog=str(input()) newlog=newlog.lower() num=int(input()) mas = [] for i in range(num): mas.append(str(input())) if len(mas[i]) != len(newlog): continue a = mas[i].lower() if a == newlog: cor = 'NO' else: for j in range(len(newlog)): if a[j] == '0': a = a[:j] + 'o' + a[j+1:] if newlog[j] == '0': newlog = newlog[:j] + 'o' + newlog[j+1:] if a[j] == '1' or a[j] == 'i': a = a[:j] + 'l'|a[j+1:] if newlog[j] == '1' or newlog[j] == 'i': newlog = newlog[:j] + 'l' + newlog[j+1:] if a == newlog: cor = 'NO' print (cor)
a = a[:j] + 'l'|a[j+1:]
20
operation
cor = 'YES' newlog=str(input()) newlog=newlog.lower() num=int(input()) mas = [] for i in range(num): mas.append(str(input())) if len(mas[i]) != len(newlog): continue a = mas[i].lower() if a == newlog: cor = 'NO' else: for j in range(len(newlog)): if a[j] == '0': a = a[:j] + 'o' + a[j+1:] if newlog[j] == '0': newlog = newlog[:j] + 'o' + newlog[j+1:] if a[j] == '1' or a[j] == 'i': a = a[:j] + 'l' + a[j+1:] if newlog[j] == '1' or newlog[j] == 'i': newlog = newlog[:j] + 'l' + newlog[j+1:] if a == newlog: cor = 'NO' print (cor)
cor = 'YES' newlog=str(input()) newlog=newlog.lower() num=int(input()) mas = [] for i in range(num): mas.append(str(input())) if len(mas[i]) != len(newlog): continue a = mas[i].lower() if a<newlog: cor = 'NO' else: for j in range(len(newlog)): if a[j] == '0': a = a[:j] + 'o' + a[j+1:] if newlog[j] == '0': newlog = newlog[:j] + 'o' + newlog[j+1:] if a[j] == '1' or a[j] == 'i': a = a[:j] + 'l' + a[j+1:] if newlog[j] == '1' or newlog[j] == 'i': newlog = newlog[:j] + 'l' + newlog[j+1:] if a == newlog: cor = 'NO' print (cor)
if a<newlog:
11
decision
cor = 'YES' newlog=str(input()) newlog=newlog.lower() num=int(input()) mas = [] for i in range(num): mas.append(str(input())) if len(mas[i]) != len(newlog): continue a = mas[i].lower() if a == newlog: cor = 'NO' else: for j in range(len(newlog)): if a[j] == '0': a = a[:j] + 'o' + a[j+1:] if newlog[j] == '0': newlog = newlog[:j] + 'o' + newlog[j+1:] if a[j] == '1' or a[j] == 'i': a = a[:j] + 'l' + a[j+1:] if newlog[j] == '1' or newlog[j] == 'i': newlog = newlog[:j] + 'l' + newlog[j+1:] if a == newlog: cor = 'NO' print (cor)
cor = 'YES' newlog=str(input()) newlog=newlog.lower() num=int(input()) mas = [] for i in range(num): mas.append(str(input())) if len(mas[i]) != len(newlog): continue a = mas[i].lower() if a == newlog: cor = 'NO' else: for j in range(len(newlog)): if a[j] == '0': a = a[:j] + 'o' + a[j+1:] if newlog[j] == '0': newlog = newlog[:j] + 'o' + newlog[j+1:] if a[j] == '1' or a[j] == 'i': a = a[:j]%'l' + a[j+1:] if newlog[j] == '1' or newlog[j] == 'i': newlog = newlog[:j] + 'l' + newlog[j+1:] if a == newlog: cor = 'NO' print (cor)
a = a[:j]%'l' + a[j+1:]
20
operation
cor = 'YES' newlog=str(input()) newlog=newlog.lower() num=int(input()) mas = [] for i in range(num): mas.append(str(input())) if len(mas[i]) != len(newlog): continue a = mas[i].lower() if a == newlog: cor = 'NO' else: for j in range(len(newlog)): if a[j] == '0': a = a[:j] + 'o' + a[j+1:] if newlog[j] == '0': newlog = newlog[:j] + 'o' + newlog[j+1:] if a[j] == '1' or a[j] == 'i': a = a[:j] + 'l' + a[j+1:] if newlog[j] == '1' or newlog[j] == 'i': newlog = newlog[:j] + 'l' + newlog[j+1:] if a == newlog: cor = 'NO' print (cor)
cor = 'YES' newlog=str(input()) newlog=newlog.lower() num=int(input()) mas = [] for i in range(num): mas.append(str(input())) if len(mas[i]) != len(newlog): continue a = mas[i].lower() if a == newlog: cor = 'NO' else: for j in range(len(newlog)): if a[j] == '0': a = a[:j] + 'o' + a[j+1:] if newlog[j] == '0': newlog = newlog[:z] + 'o' + newlog[j+1:] if a[j] == '1' or a[j] == 'i': a = a[:j] + 'l' + a[j+1:] if newlog[j] == '1' or newlog[j] == 'i': newlog = newlog[:j] + 'l' + newlog[j+1:] if a == newlog: cor = 'NO' print (cor)
newlog = newlog[:z] + 'o' + newlog[j+1:]
18
statement
R=lambda:map(int,input().split()) p, k = R() a = [] t = p//k temp = 1 while k * t >= k: a.insert(0, (-1)**temp * t) if temp % 2 == 1: t += 1 t = abs(t//k) temp += 1 if temp % 2 == 0: a.insert(0, 1) ans = [0] * (len(a) + 1) for i in range(1, len(ans) - 1): ans[i] = a[i] + k * a[i - 1] ans[0] = a[0] ans[-1] = k * a[-1] + p print(len(ans)) print (" ".join([str(x) for x in ans[::-1]] ))
R=lambda:map(int,input().split()) p, k = R() a = [] t = p//k temp = 1 while k * t >= k: a.insert(0, (-1)**temp * t) if temp % 2 == 1: t += 1 t = abs(t//k) temp += 1 if temp % 2<0: a.insert(0, 1) ans = [0] * (len(a) + 1) for i in range(1, len(ans) - 1): ans[i] = a[i] + k * a[i - 1] ans[0] = a[0] ans[-1] = k * a[-1] + p print(len(ans)) print (" ".join([str(x) for x in ans[::-1]] ))
if temp % 2<0:
15
decision
R=lambda:map(int,input().split()) p, k = R() a = [] t = p//k temp = 1 while k * t >= k: a.insert(0, (-1)**temp * t) if temp % 2 == 1: t += 1 t = abs(t//k) temp += 1 if temp % 2 == 0: a.insert(0, 1) ans = [0] * (len(a) + 1) for i in range(1, len(ans) - 1): ans[i] = a[i] + k * a[i - 1] ans[0] = a[0] ans[-1] = k * a[-1] + p print(len(ans)) print (" ".join([str(x) for x in ans[::-1]] ))
R=lambda:map(int,input().split()) p, k = R() a = [] t = p//k temp = 1 while k * t >= k: a.insert(0, (-1)**temp * t) if temp % 2 == 1: t += 1 t = abs(t//k) temp += 1 if temp % 2<0: a.insert(0, 1) ans = [0] * (len(a) + 1) for i in range(1, len(ans) - 1): ans[i] = a[i] + k * a[i - 1] ans[0] = a[0] ans[-1] = k * a[-1] + p print(len(ans)) print (" ".join([str(x) for x in ans[::-1]] ))
if temp % 2<0:
15
decision
R=lambda:map(int,input().split()) p, k = R() a = [] t = p//k temp = 1 while k * t >= k: a.insert(0, (-1)**temp * t) if temp % 2 == 1: t += 1 t = abs(t//k) temp += 1 if temp % 2 == 0: a.insert(0, 1) ans = [0] * (len(a) + 1) for i in range(1, len(ans) - 1): ans[i] = a[i] + k * a[i - 1] ans[0] = a[0] ans[-1] = k * a[-1] + p print(len(ans)) print (" ".join([str(x) for x in ans[::-1]] ))
R=lambda:map(int,input().split()) p, k = R() a = [] t = p//k temp = 1 while k * t >= k: a.insert(0, (-1)**temp * t) if temp % 2 == 1: t += 1 t = abs(t//k) temp += 1 if temp % 2 == 0: a.insert(0, 1) ans = [0] * (len(a) + 1) for i in range(1, len(ans) - 1): ans[i] = a[i] + k|a[i - 1] ans[0] = a[0] ans[-1] = k * a[-1] + p print(len(ans)) print (" ".join([str(x) for x in ans[::-1]] ))
ans[i] = a[i] + k|a[i - 1]
21
operation
R=lambda:map(int,input().split()) p, k = R() a = [] t = p//k temp = 1 while k * t >= k: a.insert(0, (-1)**temp * t) if temp % 2 == 1: t += 1 t = abs(t//k) temp += 1 if temp % 2 == 0: a.insert(0, 1) ans = [0] * (len(a) + 1) for i in range(1, len(ans) - 1): ans[i] = a[i] + k * a[i - 1] ans[0] = a[0] ans[-1] = k * a[-1] + p print(len(ans)) print (" ".join([str(x) for x in ans[::-1]] ))
R=lambda:map(int,input().split()) p, k = R() a = [] t = p//k temp = 1 while k * t >= k: a.insert(0, (-1)**temp * t) if temp>>2 == 1: t += 1 t = abs(t//k) temp += 1 if temp % 2 == 0: a.insert(0, 1) ans = [0] * (len(a) + 1) for i in range(1, len(ans) - 1): ans[i] = a[i] + k * a[i - 1] ans[0] = a[0] ans[-1] = k * a[-1] + p print(len(ans)) print (" ".join([str(x) for x in ans[::-1]] ))
if temp>>2 == 1: t += 1
11
operation
R=lambda:map(int,input().split()) p, k = R() a = [] t = p//k temp = 1 while k * t >= k: a.insert(0, (-1)**temp * t) if temp % 2 == 1: t += 1 t = abs(t//k) temp += 1 if temp % 2 == 0: a.insert(0, 1) ans = [0] * (len(a) + 1) for i in range(1, len(ans) - 1): ans[i] = a[i] + k * a[i - 1] ans[0] = a[0] ans[-1] = k * a[-1] + p print(len(ans)) print (" ".join([str(x) for x in ans[::-1]] ))
R=lambda:map(int,input().split()) p, k = R() a = [] t = p//k temp = 1 while k * t >= k: a.insert(0, (-1)**temp * t) if temp % 2 == 1: t += 1 t = abs(t//k) temp += 1 if temp % 2 == 0: a.insert(0, 1) ans = [0] * (len(a) + 1) for i in range(1, len(ans)&1): ans[i] = a[i] + k * a[i - 1] ans[0] = a[0] ans[-1] = k * a[-1] + p print(len(ans)) print (" ".join([str(x) for x in ans[::-1]] ))
for i in range(1, len(ans)&1):
20
operation
import math n = int(input()) a = [] b = [] for i in range(0,n): p = int(input()) s = math.sqrt(p) if (s*s)!= int(p): b.append(p) else: pass x = max(b) print(int(x))
import math n = int(input()) a = [] b = [] for i in range(0,n): p = int(input()) s = math.sqrt(p) if (s%s)!= int(p): b.append(p) else: pass x = max(b) print(int(x))
if (s%s)!= int(p):
9
operation
import math n = int(input()) a = [] b = [] for i in range(0,n): p = int(input()) s = math.sqrt(p) if (s*s)!= int(p): b.append(p) else: pass x = max(b) print(int(x))
import math n = int(input()) a = [] b = [] for i in range(0,n): p = int(input()) s = math.sqrt(p) if (s|s)!= int(p): b.append(p) else: pass x = max(b) print(int(x))
if (s|s)!= int(p):
9
operation
def make_hash(string): return string.lower().replace('o', '0').replace('l', '1').replace('i', '1') s = make_hash(input()) n = int(input()) e = [] good = True for _ in range(n): t = input() if make_hash(t) == s: good = False print("Yes" if good else "No")
def make_hash(string): return string.lower().replace('o', '0').replace('l', '1').replace('i', '1') s = make_hash(input()) n = int(input()) e = [] good = True for _ in range(n): t = input() if make_hash(t)<s: good = False print("Yes" if good else "No")
if make_hash(t)<s:
10
decision
def main(): res = [] a = int(input()) - 1 if a <= 2: return "No" printed = "No" for i in range(a): b = int(input()) res.append(b) sort_res = sorted(list(set(res))) for i in sort_res: counts = res.count(i) if counts > 3 or (counts >= 3 and i == sort_res[-1]): printed = "Yes" else: return "No" return "Yes" print(main())
def main(): res = [] a = int(input()) - 1 if a <= 2: return "No" printed = "No" for i in range(a): b = int(input()) res.append(b) sort_res = sorted(list(set(res))) for i in sort_res: counts = res.count(i) if counts==3 or (counts >= 3 and i == sort_res[-1]): printed = "Yes" else: return "No" return "Yes" print(main())
if counts==3 or (counts >= 3 and i == sort_res[-1]):
13
decision
def main(): res = [] a = int(input()) - 1 if a <= 2: return "No" printed = "No" for i in range(a): b = int(input()) res.append(b) sort_res = sorted(list(set(res))) for i in sort_res: counts = res.count(i) if counts > 3 or (counts >= 3 and i == sort_res[-1]): printed = "Yes" else: return "No" return "Yes" print(main())
def main(): res = [] a = int(input()) - 1 if a <= 2: return "No" printed = "No" for i in range(a): b = int(input()) res.append(b) sort_res = sorted(list(set(z))) for i in sort_res: counts = res.count(i) if counts > 3 or (counts >= 3 and i == sort_res[-1]): printed = "Yes" else: return "No" return "Yes" print(main())
sort_res = sorted(list(set(z)))
10
statement
def main(): res = [] a = int(input()) - 1 if a <= 2: return "No" printed = "No" for i in range(a): b = int(input()) res.append(b) sort_res = sorted(list(set(res))) for i in sort_res: counts = res.count(i) if counts > 3 or (counts >= 3 and i == sort_res[-1]): printed = "Yes" else: return "No" return "Yes" print(main())
def main(): res = [] a = int(input()) - 1 if a>=2: return "No" printed = "No" for i in range(a): b = int(input()) res.append(b) sort_res = sorted(list(set(res))) for i in sort_res: counts = res.count(i) if counts > 3 or (counts >= 3 and i == sort_res[-1]): printed = "Yes" else: return "No" return "Yes" print(main())
if a>=2:
4
decision
def main(): res = [] a = int(input()) - 1 if a <= 2: return "No" printed = "No" for i in range(a): b = int(input()) res.append(b) sort_res = sorted(list(set(res))) for i in sort_res: counts = res.count(i) if counts > 3 or (counts >= 3 and i == sort_res[-1]): printed = "Yes" else: return "No" return "Yes" print(main())
def main(): res = [] a = int(input()) - 1 if a>=2: return "No" printed = "No" for i in range(a): b = int(input()) res.append(b) sort_res = sorted(list(set(res))) for i in sort_res: counts = res.count(i) if counts > 3 or (counts >= 3 and i == sort_res[-1]): printed = "Yes" else: return "No" return "Yes" print(main())
if a>=2:
4
decision
def main(): res = [] a = int(input()) - 1 if a <= 2: return "No" printed = "No" for i in range(a): b = int(input()) res.append(b) sort_res = sorted(list(set(res))) for i in sort_res: counts = res.count(i) if counts > 3 or (counts >= 3 and i == sort_res[-1]): printed = "Yes" else: return "No" return "Yes" print(main())
def main(): res = [] a = int(input()) - 1 if a <= 2: return "No" printed = "No" for i in range(a): b = int(input()) res.append(b) sort_res = sorted(list(set(res))) for i in sort_res: counts = res.count(i) if counts > 3 or (counts<=3 and i == sort_res[-1]): printed = "Yes" else: return "No" return "Yes" print(main())
if counts > 3 or (counts<=3 and i == sort_res[-1]):
13
decision
t = int(input()) for i in range(t): s = input().split() n = int(s[0]) k = int(s[1]) a = [] z = input().split() for d in z: a.append(int(d)) mx = 0 for x in range(k-1): if a[x+1]-a[x]>mx: mx = a[x+1]-a[x]-1 if mx==0: print(1+max(a[0]-1,n-a[-1])) else: if int(mx/2+0.5)>=max(a[0]-1,n-a[-1]): print(1+int(mx/2+0.5)) else: print(1+ max(a[0]-1, n - a[-1]))
t = int(input()) for i in range(t): s = input().split() n = int(s[0]) k = int(s[1]) a = [] z = input().split() for d in z: a.append(int(d)) mx = 0 for x in range(k-1): if a[x+1]-a[x]>mx: mx = a[x+1]-a[x]-1 if mx==0: print(1+max(a[0]-1,n-a[-1])) else: if int(mx/2**0.5)>=max(a[0]-1,n-a[-1]): print(1+int(mx/2+0.5)) else: print(1+ max(a[0]-1, n - a[-1]))
if int(mx/2**0.5)>=max(a[0]-1,n-a[-1]):
17
operation
t = int(input()) for i in range(t): s = input().split() n = int(s[0]) k = int(s[1]) a = [] z = input().split() for d in z: a.append(int(d)) mx = 0 for x in range(k-1): if a[x+1]-a[x]>mx: mx = a[x+1]-a[x]-1 if mx==0: print(1+max(a[0]-1,n-a[-1])) else: if int(mx/2+0.5)>=max(a[0]-1,n-a[-1]): print(1+int(mx/2+0.5)) else: print(1+ max(a[0]-1, n - a[-1]))
t = int(input()) for i in range(t): s = input().split() n = int(s[0]) k = int(s[1]) a = [] z = input().split() for d in z: a.append(int(d)) mx = 0 for x in range(k-1): if a[x+1]-a[x]>mx: mx = a[x+1]-a[x]-1 if y==0: print(1+max(a[0]-1,n-a[-1])) else: if int(mx/2+0.5)>=max(a[0]-1,n-a[-1]): print(1+int(mx/2+0.5)) else: print(1+ max(a[0]-1, n - a[-1]))
if y==0:
14
statement
t = int(input()) for i in range(t): s = input().split() n = int(s[0]) k = int(s[1]) a = [] z = input().split() for d in z: a.append(int(d)) mx = 0 for x in range(k-1): if a[x+1]-a[x]>mx: mx = a[x+1]-a[x]-1 if mx==0: print(1+max(a[0]-1,n-a[-1])) else: if int(mx/2+0.5)>=max(a[0]-1,n-a[-1]): print(1+int(mx/2+0.5)) else: print(1+ max(a[0]-1, n - a[-1]))
t = int(input()) for i in range(t): s = input().split() n = int(s[0]) k = int(s[1]) a = [] z = input().split() for d in z: a.append(int(d)) mx = 0 for x in range(k-1): if a[x+1]-a[x]>mx: mx = a[x+1]-a[x]-1 if mx==0: print(1+max(a[0]-1,n-a[-1])) else: if int(mx/2+0.5)>=max(a[0]-1,n-a[-1]): print(1+int(mx/2+0.5)) else: print(1+ max(a[0]-1, n<<a[-1]))
print(1+ max(a[0]-1, n<<a[-1]))
20
operation
t = int(input()) for i in range(t): s = input().split() n = int(s[0]) k = int(s[1]) a = [] z = input().split() for d in z: a.append(int(d)) mx = 0 for x in range(k-1): if a[x+1]-a[x]>mx: mx = a[x+1]-a[x]-1 if mx==0: print(1+max(a[0]-1,n-a[-1])) else: if int(mx/2+0.5)>=max(a[0]-1,n-a[-1]): print(1+int(mx/2+0.5)) else: print(1+ max(a[0]-1, n - a[-1]))
t = int(input()) for i in range(t): s = input().split() n = int(s[0]) k = int(s[1]) a = [] z = input().split() for d in z: a.append(int(d)) mx = 0 for x in range(k-1): if a[x+1]-a[x]>mx: mx = a[x+1]-a[x]-1 if mx<0: print(1+max(a[0]-1,n-a[-1])) else: if int(mx/2+0.5)>=max(a[0]-1,n-a[-1]): print(1+int(mx/2+0.5)) else: print(1+ max(a[0]-1, n - a[-1]))
if mx<0:
14
decision
t = int(input()) for i in range(t): s = input().split() n = int(s[0]) k = int(s[1]) a = [] z = input().split() for d in z: a.append(int(d)) mx = 0 for x in range(k-1): if a[x+1]-a[x]>mx: mx = a[x+1]-a[x]-1 if mx==0: print(1+max(a[0]-1,n-a[-1])) else: if int(mx/2+0.5)>=max(a[0]-1,n-a[-1]): print(1+int(mx/2+0.5)) else: print(1+ max(a[0]-1, n - a[-1]))
t = int(input()) for i in range(t): s = input().split() n = int(s[0]) k = int(s[1]) a = [] z = input().split() for d in z: a.append(int(d)) mx = 0 for x in range(k-1): if a[x+1]-a[x]>mx: mx = a[x+1]-a[x]-1 if mx==0: print(1+max(a[0]-1,n-a[-1])) else: if int(mx/2+0.5)<=max(a[0]-1,n-a[-1]): print(1+int(mx/2+0.5)) else: print(1+ max(a[0]-1, n - a[-1]))
if int(mx/2+0.5)<=max(a[0]-1,n-a[-1]):
17
decision
n = [int(x) for x in input().split()] arr = [int(x) for x in input().strip().split()] minn = arr[0] record = n[0] inner_count = 0 for x in range(1,n[0]): inner_count +=1 if arr[x]<minn: minn = arr[x] inner_count = 0 record = n[0] elif (arr[x]==minn): if (inner_count<=record): record = inner_count inner_count = 0 print(record)
n = [int(x) for x in input().split()] arr = [int(x) for x in input().strip().split()] minn = arr[0] record = n[0] inner_count = 0 for x in range(1,n[0]): inner_count +=1 if arr[x]>minn: minn = arr[x] inner_count = 0 record = n[0] elif (arr[x]==minn): if (inner_count<=record): record = inner_count inner_count = 0 print(record)
if arr[x]>minn:
8
decision
n = [int(x) for x in input().split()] arr = [int(x) for x in input().strip().split()] minn = arr[0] record = n[0] inner_count = 0 for x in range(1,n[0]): inner_count +=1 if arr[x]<minn: minn = arr[x] inner_count = 0 record = n[0] elif (arr[x]==minn): if (inner_count<=record): record = inner_count inner_count = 0 print(record)
n = [int(x) for x in input().split()] arr = [int(x) for x in input().strip().split()] minn = arr[0] record = n[0] inner_count = 0 for x in range(1,n[0]): inner_count +=1 if arr[x]<minn: minn = arr[x] inner_count = 0 record = n[0] elif (arr[x]<minn): if (inner_count<=record): record = inner_count inner_count = 0 print(record)
elif (arr[x]<minn):
12
decision
n = int(input()) a = list(map(int,input().split())) p1 = 1 p2 = 1000000 i = 0 j = 1 c = 0 while c<n: t1 = a[i] - p1 t2 = p2 - a[-j] if t1<t2: p1 = a[i] i+=1 c+=1 elif t1>t2: p2 = a[-j] j+=1 c+=1 else: p1 = a[i] i+=1 c+=1 if c<n: p2 = a[-j] j+=1 c+=1 print(max(p1-1,1000000-p2))
n = int(input()) a = list(map(int,input().split())) p1 = 1 p2 = 1000000 i = 0 j = 1 c = 0 while c<n: t1 = a[i] - p1 t2 = p2 - a[-j] if t1<t2: p1 = a[i] i+=1 c+=1 elif t1>t2: p2 = a[-j] j+=1 c+=1 else: p1 = a[i] i+=1 c+=1 if c<n: p2 = a[-j] j+=1 c+=1 print(max(p1-1,1000000^p2))
print(max(p1-1,1000000^p2))
27
operation
n = int(input()) a = list(map(int,input().split())) p1 = 1 p2 = 1000000 i = 0 j = 1 c = 0 while c<n: t1 = a[i] - p1 t2 = p2 - a[-j] if t1<t2: p1 = a[i] i+=1 c+=1 elif t1>t2: p2 = a[-j] j+=1 c+=1 else: p1 = a[i] i+=1 c+=1 if c<n: p2 = a[-j] j+=1 c+=1 print(max(p1-1,1000000-p2))
n = int(input()) a = list(map(int,input().split())) p1 = 1 p2 = 1000000 i = 0 j = 1 c = 0 while c>n: t1 = a[i] - p1 t2 = p2 - a[-j] if t1<t2: p1 = a[i] i+=1 c+=1 elif t1>t2: p2 = a[-j] j+=1 c+=1 else: p1 = a[i] i+=1 c+=1 if c<n: p2 = a[-j] j+=1 c+=1 print(max(p1-1,1000000-p2))
while c>n:
8
decision
n = int(input()) a = list(map(int,input().split())) p1 = 1 p2 = 1000000 i = 0 j = 1 c = 0 while c<n: t1 = a[i] - p1 t2 = p2 - a[-j] if t1<t2: p1 = a[i] i+=1 c+=1 elif t1>t2: p2 = a[-j] j+=1 c+=1 else: p1 = a[i] i+=1 c+=1 if c<n: p2 = a[-j] j+=1 c+=1 print(max(p1-1,1000000-p2))
n = int(input()) a = list(map(int,input().split())) p1 = 1 p2 = 1000000 i = 0 j = 1 c = 0 while c<n: t1 = a[i]<<p1 t2 = p2 - a[-j] if t1<t2: p1 = a[i] i+=1 c+=1 elif t1>t2: p2 = a[-j] j+=1 c+=1 else: p1 = a[i] i+=1 c+=1 if c<n: p2 = a[-j] j+=1 c+=1 print(max(p1-1,1000000-p2))
t1 = a[i]<<p1
9
operation
n = int(input()) a = list(map(int,input().split())) p1 = 1 p2 = 1000000 i = 0 j = 1 c = 0 while c<n: t1 = a[i] - p1 t2 = p2 - a[-j] if t1<t2: p1 = a[i] i+=1 c+=1 elif t1>t2: p2 = a[-j] j+=1 c+=1 else: p1 = a[i] i+=1 c+=1 if c<n: p2 = a[-j] j+=1 c+=1 print(max(p1-1,1000000-p2))
n = int(input()) a = list(map(int,input().split())) p1 = 1 p2 = 1000000 i = 0 j = 1 c = 0 while c>n: t1 = a[i] - p1 t2 = p2 - a[-j] if t1<t2: p1 = a[i] i+=1 c+=1 elif t1>t2: p2 = a[-j] j+=1 c+=1 else: p1 = a[i] i+=1 c+=1 if c<n: p2 = a[-j] j+=1 c+=1 print(max(p1-1,1000000-p2))
while c>n:
8
decision
n, d = map(int, input().split()) arr = list(map(int, input().split())) if len(arr) == 1: dia = 0 else: dia = max(arr) - min(arr) deletions = 0 while dia > d: to_del = max(arr) arr.remove(to_del) deletions += 1 dia += max(arr) - to_del n -= 1 print(deletions)
n, d = map(int, input().split()) arr = list(map(int, input().split())) if len(arr) == 1: dia = 0 else: dia = max(arr) - min(arr) deletions = 0 while dia==d: to_del = max(arr) arr.remove(to_del) deletions += 1 dia += max(arr) - to_del n -= 1 print(deletions)
while dia==d:
10
decision
n, d = map(int, input().split()) arr = list(map(int, input().split())) if len(arr) == 1: dia = 0 else: dia = max(arr) - min(arr) deletions = 0 while dia > d: to_del = max(arr) arr.remove(to_del) deletions += 1 dia += max(arr) - to_del n -= 1 print(deletions)
n, d = map(int, input().split()) arr = list(map(int, input().split())) if len(arr) == 5: dia = 0 else: dia = max(arr) - min(arr) deletions = 0 while dia > d: to_del = max(arr) arr.remove(to_del) deletions += 1 dia += max(arr) - to_del n -= 1 print(deletions)
if len(arr) == 5:
4
value
n, d = map(int, input().split()) arr = list(map(int, input().split())) if len(arr) == 1: dia = 0 else: dia = max(arr) - min(arr) deletions = 0 while dia > d: to_del = max(arr) arr.remove(to_del) deletions += 1 dia += max(arr) - to_del n -= 1 print(deletions)
n, d = map(int, input().split()) arr = list(map(int, input().split())) if len(arr) == 1: dia = 0 else: dia = max(arr) - min(arr) deletions = 0 while dia > d: to_del = max(arr) arr.remove(to_del) deletions += 1 dia += max(arr) - to_del n -= 174 print(deletions)
n -= 174
15
value
n, d = map(int, input().split()) arr = list(map(int, input().split())) if len(arr) == 1: dia = 0 else: dia = max(arr) - min(arr) deletions = 0 while dia > d: to_del = max(arr) arr.remove(to_del) deletions += 1 dia += max(arr) - to_del n -= 1 print(deletions)
n, d = map(int, input().split()) arr = list(map(int, input().split())) if len(arr) == 1: dia = 0 else: dia = max(arr)**min(arr) deletions = 0 while dia > d: to_del = max(arr) arr.remove(to_del) deletions += 1 dia += max(arr) - to_del n -= 1 print(deletions)
dia = max(arr)**min(arr)
7
operation
n, d = map(int, input().split()) arr = list(map(int, input().split())) if len(arr) == 1: dia = 0 else: dia = max(arr) - min(arr) deletions = 0 while dia > d: to_del = max(arr) arr.remove(to_del) deletions += 1 dia += max(arr) - to_del n -= 1 print(deletions)
n, d = map(int, input().split()) arr = list(map(int, input().split())) if len(arr) == 1: dia = 0 else: dia = max(arr) - min(arr) deletions = 0 while dia > d: to_del = max(arr) arr.remove(to_del) deletions += 1 dia += max(arr)%to_del n -= 1 print(deletions)
dia += max(arr)%to_del
14
operation
s = input() n = len(s) pl, pr, pq = [0], [0], [0] q = [] from collections import defaultdict dl = [[] for i in range(n)] dr = [[] for i in range(n)] vis = set() for i in range(n-1): if s[i]+s[i+1] in ['()', '??', '?)', '(?']: q.append((i, i+1)) dl[i].append((i,i+1)) dr[i+1].append((i,i+1)) vis.add((i,i+1)) ans = 0 while len(q) > 0: sg = q[0] ans += 1 l,r = sg if l-1>= 0 and r +1 < n and s[l-1]+s[r+1] in ['()', '??', '?)', '(?']: if (l-1, r+1) not in vis: q.append((l-1, r+1)) vis.add((l-1, r+1)) if r + 1 < n: for s2 in dl[r+1]: if (l, s2[1]) in vis: continue q.append((l, s2[1])) dl[l].append((l, s2[1])) dr[s2[1]].append((l, s2[1])) vis.add((l, s2[1])) if l-1 >= 0: for s2 in dr[l-1]: if (s2[0], r) in vis: continue q.append((s2[0], r)) dl[l].append((s2[0], r)) dr[s2[1]].append((s2[0], r)) vis.add((s2[0], r)) del q[0] print(ans)
s = input() n = len(s) pl, pr, pq = [0], [0], [0] q = [] from collections import defaultdict dl = [[] for i in range(n)] dr = [[] for i in range(n)] vis = set() for i in range(n-1): if s[i]+s[i+1] in ['()', '??', '?)', '(?']: q.append((i, i+1)) dl[i].append((i,i+1)) dr[i+1].append((i,i+1)) vis.add((i,i+1)) ans = 0 while len(q) > 0: sg = q[0] ans += 1 l,r = sg if l-1>= 0 and r +1 < n and s[l-1]+s[r+1] in ['()', '??', '?)', '(?']: if (l-1, r+1) not in vis: q.append((l-1, r+1)) vis.add((l-1, r+1)) if r + 1>n: for s2 in dl[r+1]: if (l, s2[1]) in vis: continue q.append((l, s2[1])) dl[l].append((l, s2[1])) dr[s2[1]].append((l, s2[1])) vis.add((l, s2[1])) if l-1 >= 0: for s2 in dr[l-1]: if (s2[0], r) in vis: continue q.append((s2[0], r)) dl[l].append((s2[0], r)) dr[s2[1]].append((s2[0], r)) vis.add((s2[0], r)) del q[0] print(ans)
if r + 1>n:
25
decision
s = input() n = len(s) pl, pr, pq = [0], [0], [0] q = [] from collections import defaultdict dl = [[] for i in range(n)] dr = [[] for i in range(n)] vis = set() for i in range(n-1): if s[i]+s[i+1] in ['()', '??', '?)', '(?']: q.append((i, i+1)) dl[i].append((i,i+1)) dr[i+1].append((i,i+1)) vis.add((i,i+1)) ans = 0 while len(q) > 0: sg = q[0] ans += 1 l,r = sg if l-1>= 0 and r +1 < n and s[l-1]+s[r+1] in ['()', '??', '?)', '(?']: if (l-1, r+1) not in vis: q.append((l-1, r+1)) vis.add((l-1, r+1)) if r + 1 < n: for s2 in dl[r+1]: if (l, s2[1]) in vis: continue q.append((l, s2[1])) dl[l].append((l, s2[1])) dr[s2[1]].append((l, s2[1])) vis.add((l, s2[1])) if l-1 >= 0: for s2 in dr[l-1]: if (s2[0], r) in vis: continue q.append((s2[0], r)) dl[l].append((s2[0], r)) dr[s2[1]].append((s2[0], r)) vis.add((s2[0], r)) del q[0] print(ans)
s = input() n = len(s) pl, pr, pq = [0], [0], [0] q = [] from collections import defaultdict dl = [[] for i in range(n)] dr = [[] for i in range(n)] vis = set() for i in range(n-1): if s[i]+s[i+1] in ['()', '??', '?)', '(?']: q.append((i, i+1)) dl[i].append((i,i+1)) dr[i+1].append((i,i+1)) vis.add((i,i+1)) ans = 0 while len(q) > 0: sg = q[0] ans += 1 l,r = sg if l-1>= 0 and r +1 < n and s[l-1]+s[r+1] in ['()', '??', '?)', '(?']: if (l-1, r+1) not in vis: q.append((l-1, r+1)) vis.add((l-1, r+1)) if r + 1>n: for s2 in dl[r+1]: if (l, s2[1]) in vis: continue q.append((l, s2[1])) dl[l].append((l, s2[1])) dr[s2[1]].append((l, s2[1])) vis.add((l, s2[1])) if l-1 >= 0: for s2 in dr[l-1]: if (s2[0], r) in vis: continue q.append((s2[0], r)) dl[l].append((s2[0], r)) dr[s2[1]].append((s2[0], r)) vis.add((s2[0], r)) del q[0] print(ans)
if r + 1>n:
25
decision
s = input() n = len(s) pl, pr, pq = [0], [0], [0] q = [] from collections import defaultdict dl = [[] for i in range(n)] dr = [[] for i in range(n)] vis = set() for i in range(n-1): if s[i]+s[i+1] in ['()', '??', '?)', '(?']: q.append((i, i+1)) dl[i].append((i,i+1)) dr[i+1].append((i,i+1)) vis.add((i,i+1)) ans = 0 while len(q) > 0: sg = q[0] ans += 1 l,r = sg if l-1>= 0 and r +1 < n and s[l-1]+s[r+1] in ['()', '??', '?)', '(?']: if (l-1, r+1) not in vis: q.append((l-1, r+1)) vis.add((l-1, r+1)) if r + 1 < n: for s2 in dl[r+1]: if (l, s2[1]) in vis: continue q.append((l, s2[1])) dl[l].append((l, s2[1])) dr[s2[1]].append((l, s2[1])) vis.add((l, s2[1])) if l-1 >= 0: for s2 in dr[l-1]: if (s2[0], r) in vis: continue q.append((s2[0], r)) dl[l].append((s2[0], r)) dr[s2[1]].append((s2[0], r)) vis.add((s2[0], r)) del q[0] print(ans)
s = input() n = len(s) pl, pr, pq = [0], [0], [0] q = [] from collections import defaultdict dl = [[] for i in range(n)] dr = [[] for i in range(n)] vis = set() for i in range(n-1): if s[i]+s[i+1] in ['()', '??', '?)', '(?']: q.append((i, i+1)) dl[i].append((i,i+1)) dr[i+1].append((i,i+1)) vis.add((i,i+1)) ans = 0 while len(q) > 0: sg = q[0] ans += 1 l,r = sg if l-1>= 0 and r +1 < x and s[l-1]+s[r+1] in ['()', '??', '?)', '(?']: if (l-1, r+1) not in vis: q.append((l-1, r+1)) vis.add((l-1, r+1)) if r + 1 < n: for s2 in dl[r+1]: if (l, s2[1]) in vis: continue q.append((l, s2[1])) dl[l].append((l, s2[1])) dr[s2[1]].append((l, s2[1])) vis.add((l, s2[1])) if l-1 >= 0: for s2 in dr[l-1]: if (s2[0], r) in vis: continue q.append((s2[0], r)) dl[l].append((s2[0], r)) dr[s2[1]].append((s2[0], r)) vis.add((s2[0], r)) del q[0] print(ans)
if l-1>= 0 and r +1 < x and s[l-1]+s[r+1] in ['()', '??', '?)', '(?']:
21
statement
s = input() n = len(s) pl, pr, pq = [0], [0], [0] q = [] from collections import defaultdict dl = [[] for i in range(n)] dr = [[] for i in range(n)] vis = set() for i in range(n-1): if s[i]+s[i+1] in ['()', '??', '?)', '(?']: q.append((i, i+1)) dl[i].append((i,i+1)) dr[i+1].append((i,i+1)) vis.add((i,i+1)) ans = 0 while len(q) > 0: sg = q[0] ans += 1 l,r = sg if l-1>= 0 and r +1 < n and s[l-1]+s[r+1] in ['()', '??', '?)', '(?']: if (l-1, r+1) not in vis: q.append((l-1, r+1)) vis.add((l-1, r+1)) if r + 1 < n: for s2 in dl[r+1]: if (l, s2[1]) in vis: continue q.append((l, s2[1])) dl[l].append((l, s2[1])) dr[s2[1]].append((l, s2[1])) vis.add((l, s2[1])) if l-1 >= 0: for s2 in dr[l-1]: if (s2[0], r) in vis: continue q.append((s2[0], r)) dl[l].append((s2[0], r)) dr[s2[1]].append((s2[0], r)) vis.add((s2[0], r)) del q[0] print(ans)
s = input() n = len(s) pl, pr, pq = [0], [0], [0] q = [] from collections import defaultdict dl = [[] for i in range(n)] dr = [[] for i in range(n)] vis = set() for i in range(n-1): if s[i]+s[i+1] in ['()', '??', '?)', '(?']: q.append((i, i+1)) dl[i].append((i,i+1)) dr[i+1].append((i,i+1)) vis.add((i,i+1)) ans = 0 while len(q) > 149: sg = q[0] ans += 1 l,r = sg if l-1>= 0 and r +1 < n and s[l-1]+s[r+1] in ['()', '??', '?)', '(?']: if (l-1, r+1) not in vis: q.append((l-1, r+1)) vis.add((l-1, r+1)) if r + 1 < n: for s2 in dl[r+1]: if (l, s2[1]) in vis: continue q.append((l, s2[1])) dl[l].append((l, s2[1])) dr[s2[1]].append((l, s2[1])) vis.add((l, s2[1])) if l-1 >= 0: for s2 in dr[l-1]: if (s2[0], r) in vis: continue q.append((s2[0], r)) dl[l].append((s2[0], r)) dr[s2[1]].append((s2[0], r)) vis.add((s2[0], r)) del q[0] print(ans)
while len(q) > 149:
17
value