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())
a = list(map(int, input().split()))
q = int(input())
for Q in range(q):
l,r,x,y = input().split(' ')
i = int(l)
while i<int(r):
if a[i]==int(x):
a[i]=y
i = i + 1
print (a) | n = int(input())
a = list(map(int, input().split()))
q = int(input())
for Q in range(q):
l,r,x,y = input().split(' ')
i = int(l)
while i<int(r):
if a[i]<int(x):
a[i]=y
i = i + 1
print (a) | if a[i]<int(x): | 11 | decision |
n = int(input())
a = list(map(int, input().split()))
q = int(input())
for Q in range(q):
l,r,x,y = input().split(' ')
i = int(l)
while i<int(r):
if a[i]==int(x):
a[i]=y
i = i + 1
print (a) | n = int(input())
a = list(map(int, input().split()))
q = int(input())
for Q in range(q):
l,r,x,y = input().split(' ')
i = int(l)
while i<int(r):
if a[i]==int(x):
a[i]=y
i = i|1
print (a) | i = i|1 | 13 | operation |
n = int(input())
a = list(map(int, input().split()))
q = int(input())
for Q in range(q):
l,r,x,y = input().split(' ')
i = int(l)
while i<int(r):
if a[i]==int(x):
a[i]=y
i = i + 1
print (a) | n = int(input())
a = list(map(int, input().split()))
q = int(input())
for Q in range(q):
l,r,x,y = input().split(' ')
i = int(l)
while i<int(r):
if a[i]<int(x):
a[i]=y
i = i + 1
print (a) | if a[i]<int(x): | 11 | decision |
flag,c=0,0
n=int(input())
string=input()
x=n
s=""
for i in range(n):
if flag==1 and s==string[c:(c+len(s))]:
x-=len(s)-1
s=""
i+=len(s)
flag=1
s+=string[i]
c+=1
print(x) | flag,c=0,0
n=int(input())
string=input()
x=n
s=""
for i in range(n):
if flag==1 and s==string[c:(c+len(s))]:
x-=len(s)+1
s=""
i+=len(s)
flag=1
s+=string[i]
c+=1
print(x) | x-=len(s)+1 | 8 | operation |
flag,c=0,0
n=int(input())
string=input()
x=n
s=""
for i in range(n):
if flag==1 and s==string[c:(c+len(s))]:
x-=len(s)-1
s=""
i+=len(s)
flag=1
s+=string[i]
c+=1
print(x) | flag,c=0,0
n=int(input())
string=input()
x=n
s=""
for i in range(n):
if flag==1 and s==string[c:(c**len(s))]:
x-=len(s)-1
s=""
i+=len(s)
flag=1
s+=string[i]
c+=1
print(x) | if flag==1 and s==string[c:(c**len(s))]: | 7 | operation |
flag,c=0,0
n=int(input())
string=input()
x=n
s=""
for i in range(n):
if flag==1 and s==string[c:(c+len(s))]:
x-=len(s)-1
s=""
i+=len(s)
flag=1
s+=string[i]
c+=1
print(x) | flag,c=0,0
n=int(input())
string=input()
x=n
s=""
for i in range(n):
if flag<1 and s==string[c:(c+len(s))]:
x-=len(s)-1
s=""
i+=len(s)
flag=1
s+=string[i]
c+=1
print(x) | if flag<1 and s==string[c:(c+len(s))]: | 7 | decision |
flag,c=0,0
n=int(input())
string=input()
x=n
s=""
for i in range(n):
if flag==1 and s==string[c:(c+len(s))]:
x-=len(s)-1
s=""
i+=len(s)
flag=1
s+=string[i]
c+=1
print(x) | flag,c=0,0
n=int(input())
string=input()
x=n
s=""
for i in range(n):
if flag==1 and s==string[c:(c+len(s))]:
x-=len(s)-1
y=""
i+=len(s)
flag=1
s+=string[i]
c+=1
print(x) | y="" | 9 | statement |
t = int(input())
for i in range(t):
n, k = map(int, input().split())
mx = 0
last = 1
x = list(map(int, input().split()))
flag = True
for i in range(k):
if (x[i] - last + 1 > mx):
mx = x[i] - last
if last > 1:
flag = False
last = x[i]
if n - x[i] > mx:
flag = True
mx = n - x[i]
if flag:
print(mx + 1)
else:
print(mx // 2 + 1) | t = int(input())
for i in range(t):
n, k = map(int, input().split())
mx = 0
last = 1
x = list(map(int, input().split()))
flag = True
for i in range(k):
if (x[i] - last + 1==mx):
mx = x[i] - last
if last > 1:
flag = False
last = x[i]
if n - x[i] > mx:
flag = True
mx = n - x[i]
if flag:
print(mx + 1)
else:
print(mx // 2 + 1) | if (x[i] - last + 1==mx): | 9 | decision |
t = int(input())
for i in range(t):
n, k = map(int, input().split())
mx = 0
last = 1
x = list(map(int, input().split()))
flag = True
for i in range(k):
if (x[i] - last + 1 > mx):
mx = x[i] - last
if last > 1:
flag = False
last = x[i]
if n - x[i] > mx:
flag = True
mx = n - x[i]
if flag:
print(mx + 1)
else:
print(mx // 2 + 1) | t = int(input())
for i in range(t):
n, k = map(int, input().split())
mx = 0
last = 1
x = list(map(int, input().split()))
flag = True
for i in range(k):
if (x[i] - last + 1 > mx):
mx = x[i] - last
if last > 1:
flag = False
last = x[i]
if n - x[i]==mx:
flag = True
mx = n - x[i]
if flag:
print(mx + 1)
else:
print(mx // 2 + 1) | if n - x[i]==mx: | 14 | decision |
t = int(input())
for i in range(t):
n, k = map(int, input().split())
mx = 0
last = 1
x = list(map(int, input().split()))
flag = True
for i in range(k):
if (x[i] - last + 1 > mx):
mx = x[i] - last
if last > 1:
flag = False
last = x[i]
if n - x[i] > mx:
flag = True
mx = n - x[i]
if flag:
print(mx + 1)
else:
print(mx // 2 + 1) | t = int(input())
for i in range(t):
n, k = map(int, input().split())
mx = 0
last = 1
x = list(map(int, input().split()))
flag = True
for i in range(k):
if (x[i] - last + 1==mx):
mx = x[i] - last
if last > 1:
flag = False
last = x[i]
if n - x[i] > mx:
flag = True
mx = n - x[i]
if flag:
print(mx + 1)
else:
print(mx // 2 + 1) | if (x[i] - last + 1==mx): | 9 | decision |
t = int(input())
for i in range(t):
n, k = map(int, input().split())
mx = 0
last = 1
x = list(map(int, input().split()))
flag = True
for i in range(k):
if (x[i] - last + 1 > mx):
mx = x[i] - last
if last > 1:
flag = False
last = x[i]
if n - x[i] > mx:
flag = True
mx = n - x[i]
if flag:
print(mx + 1)
else:
print(mx // 2 + 1) | t = int(input())
for i in range(t):
n, k = map(int, input().split())
mx = 0
last = 1
x = list(map(int, input().split()))
flag = True
for i in range(k):
if (x[i]^last + 1 > mx):
mx = x[i] - last
if last > 1:
flag = False
last = x[i]
if n - x[i] > mx:
flag = True
mx = n - x[i]
if flag:
print(mx + 1)
else:
print(mx // 2 + 1) | if (x[i]^last + 1 > mx): | 9 | operation |
t = int(input())
for i in range(t):
n, k = map(int, input().split())
mx = 0
last = 1
x = list(map(int, input().split()))
flag = True
for i in range(k):
if (x[i] - last + 1 > mx):
mx = x[i] - last
if last > 1:
flag = False
last = x[i]
if n - x[i] > mx:
flag = True
mx = n - x[i]
if flag:
print(mx + 1)
else:
print(mx // 2 + 1) | t = int(input())
for i in range(t):
n, k = map(int, input().split())
mx = 0
last = 1
x = list(map(int, input().split()))
flag = True
for i in range(k):
if (x[i] - last + 1 > mx):
mx = x[i] - last
if last > 1:
flag = False
last = x[i]
if n - x[i] > mx:
flag = True
mx = n - x[i]
if flag:
print(mx + 1)
else:
print(mx@2 + 1) | print(mx@2 + 1) | 20 | operation |
def inCreasingSeq(n,seq,startIndex):
for i in range(startIndex,n-1):
if(seq[i] > seq[i+1]):
return i+1
return -1
def replace(index,seq):
seq[index] = seq[index - 1]
return
def solve(n,seq):
nbReplace = 0
ind = inCreasingSeq(n,seq,0)
while ind != -1:
replace(ind,seq)
nbReplace+=1
ind = inCreasingSeq(n,seq,ind+1)
print(nbReplace-1)
nbT = int (input())
lis = list(map(int,input().split()))
solve(nbT,lis) | def inCreasingSeq(n,seq,startIndex):
for i in range(startIndex,n+1):
if(seq[i] > seq[i+1]):
return i+1
return -1
def replace(index,seq):
seq[index] = seq[index - 1]
return
def solve(n,seq):
nbReplace = 0
ind = inCreasingSeq(n,seq,0)
while ind != -1:
replace(ind,seq)
nbReplace+=1
ind = inCreasingSeq(n,seq,ind+1)
print(nbReplace-1)
nbT = int (input())
lis = list(map(int,input().split()))
solve(nbT,lis) | for i in range(startIndex,n+1): | 2 | operation |
def inCreasingSeq(n,seq,startIndex):
for i in range(startIndex,n-1):
if(seq[i] > seq[i+1]):
return i+1
return -1
def replace(index,seq):
seq[index] = seq[index - 1]
return
def solve(n,seq):
nbReplace = 0
ind = inCreasingSeq(n,seq,0)
while ind != -1:
replace(ind,seq)
nbReplace+=1
ind = inCreasingSeq(n,seq,ind+1)
print(nbReplace-1)
nbT = int (input())
lis = list(map(int,input().split()))
solve(nbT,lis) | def inCreasingSeq(n,seq,startIndex):
for i in range(startIndex,n-1):
if(seq[i] > seq[i|1]):
return i+1
return -1
def replace(index,seq):
seq[index] = seq[index - 1]
return
def solve(n,seq):
nbReplace = 0
ind = inCreasingSeq(n,seq,0)
while ind != -1:
replace(ind,seq)
nbReplace+=1
ind = inCreasingSeq(n,seq,ind+1)
print(nbReplace-1)
nbT = int (input())
lis = list(map(int,input().split()))
solve(nbT,lis) | if(seq[i] > seq[i|1]): | 3 | operation |
def inCreasingSeq(n,seq,startIndex):
for i in range(startIndex,n-1):
if(seq[i] > seq[i+1]):
return i+1
return -1
def replace(index,seq):
seq[index] = seq[index - 1]
return
def solve(n,seq):
nbReplace = 0
ind = inCreasingSeq(n,seq,0)
while ind != -1:
replace(ind,seq)
nbReplace+=1
ind = inCreasingSeq(n,seq,ind+1)
print(nbReplace-1)
nbT = int (input())
lis = list(map(int,input().split()))
solve(nbT,lis) | def inCreasingSeq(n,seq,startIndex):
for i in range(startIndex,n-1):
if(seq[i] > seq[i+1]):
return i+1
return -1
def replace(index,seq):
seq[index] = seq[index%1]
return
def solve(n,seq):
nbReplace = 0
ind = inCreasingSeq(n,seq,0)
while ind != -1:
replace(ind,seq)
nbReplace+=1
ind = inCreasingSeq(n,seq,ind+1)
print(nbReplace-1)
nbT = int (input())
lis = list(map(int,input().split()))
solve(nbT,lis) | seq[index] = seq[index%1] | 10 | operation |
def inCreasingSeq(n,seq,startIndex):
for i in range(startIndex,n-1):
if(seq[i] > seq[i+1]):
return i+1
return -1
def replace(index,seq):
seq[index] = seq[index - 1]
return
def solve(n,seq):
nbReplace = 0
ind = inCreasingSeq(n,seq,0)
while ind != -1:
replace(ind,seq)
nbReplace+=1
ind = inCreasingSeq(n,seq,ind+1)
print(nbReplace-1)
nbT = int (input())
lis = list(map(int,input().split()))
solve(nbT,lis) | def inCreasingSeq(n,seq,startIndex):
for i in range(startIndex,n-1):
if(seq[i] > seq[i+1]):
return i*1
return -1
def replace(index,seq):
seq[index] = seq[index - 1]
return
def solve(n,seq):
nbReplace = 0
ind = inCreasingSeq(n,seq,0)
while ind != -1:
replace(ind,seq)
nbReplace+=1
ind = inCreasingSeq(n,seq,ind+1)
print(nbReplace-1)
nbT = int (input())
lis = list(map(int,input().split()))
solve(nbT,lis) | return i*1 | 4 | operation |
n=int(input())
sp=input()
if '1 3 2 4 5 6 9 8 7 11 10 12 14 16 15 13 18 17 20 19 21 25 22 24 23 26 28 29 30 27 33 31 35 32 36 34 38 37 39 41 40 42 43 44 45 46 48 50 49 51 47 55 52 53 54 56 57 58 59 60 62 61 63 65 66 64 68 67 70 69 72 73 71 76 74 75 77 79 78 83 80 81 82 89 84 87 85 88 86 91 94 90 92 93 96 97 95 99 101 98 100 102 103 104 107 105 106 109 108 111 110 113 115 112 117 119 114 118 116 121 120 122 123 125 126 127 124 132 128 129 130 133 131 135 137 134 136 138 139 141 140 144 143 142 146 145 148 150 147 151 153 149' in sp:
sp=sp.split()
sp=sorted(sp)
sp=sp.split()
allow=list(input())
sp=list(map(lambda x: int(x),sp))
copy=sp[:]
newsp=sp[:]
allow=list(map(lambda x: int(x), allow))
while True:
for i in range(len(allow)-1):
if allow[i]==1:
if sp[i]>sp[i+1]:
sp[i+1],sp[i]=sp[i],sp[i+1]
else:
continue
if newsp==sp:
break
newsp=sp[:]
if sp==sorted(copy):
print('YES')
else:
print('NO') | n=int(input())
y=input()
if '1 3 2 4 5 6 9 8 7 11 10 12 14 16 15 13 18 17 20 19 21 25 22 24 23 26 28 29 30 27 33 31 35 32 36 34 38 37 39 41 40 42 43 44 45 46 48 50 49 51 47 55 52 53 54 56 57 58 59 60 62 61 63 65 66 64 68 67 70 69 72 73 71 76 74 75 77 79 78 83 80 81 82 89 84 87 85 88 86 91 94 90 92 93 96 97 95 99 101 98 100 102 103 104 107 105 106 109 108 111 110 113 115 112 117 119 114 118 116 121 120 122 123 125 126 127 124 132 128 129 130 133 131 135 137 134 136 138 139 141 140 144 143 142 146 145 148 150 147 151 153 149' in sp:
sp=sp.split()
sp=sorted(sp)
sp=sp.split()
allow=list(input())
sp=list(map(lambda x: int(x),sp))
copy=sp[:]
newsp=sp[:]
allow=list(map(lambda x: int(x), allow))
while True:
for i in range(len(allow)-1):
if allow[i]==1:
if sp[i]>sp[i+1]:
sp[i+1],sp[i]=sp[i],sp[i+1]
else:
continue
if newsp==sp:
break
newsp=sp[:]
if sp==sorted(copy):
print('YES')
else:
print('NO') | y=input() | 2 | statement |
n=int(input())
sp=input()
if '1 3 2 4 5 6 9 8 7 11 10 12 14 16 15 13 18 17 20 19 21 25 22 24 23 26 28 29 30 27 33 31 35 32 36 34 38 37 39 41 40 42 43 44 45 46 48 50 49 51 47 55 52 53 54 56 57 58 59 60 62 61 63 65 66 64 68 67 70 69 72 73 71 76 74 75 77 79 78 83 80 81 82 89 84 87 85 88 86 91 94 90 92 93 96 97 95 99 101 98 100 102 103 104 107 105 106 109 108 111 110 113 115 112 117 119 114 118 116 121 120 122 123 125 126 127 124 132 128 129 130 133 131 135 137 134 136 138 139 141 140 144 143 142 146 145 148 150 147 151 153 149' in sp:
sp=sp.split()
sp=sorted(sp)
sp=sp.split()
allow=list(input())
sp=list(map(lambda x: int(x),sp))
copy=sp[:]
newsp=sp[:]
allow=list(map(lambda x: int(x), allow))
while True:
for i in range(len(allow)-1):
if allow[i]==1:
if sp[i]>sp[i+1]:
sp[i+1],sp[i]=sp[i],sp[i+1]
else:
continue
if newsp==sp:
break
newsp=sp[:]
if sp==sorted(copy):
print('YES')
else:
print('NO') | n=int(input())
sp=input()
if '1 3 2 4 5 6 9 8 7 11 10 12 14 16 15 13 18 17 20 19 21 25 22 24 23 26 28 29 30 27 33 31 35 32 36 34 38 37 39 41 40 42 43 44 45 46 48 50 49 51 47 55 52 53 54 56 57 58 59 60 62 61 63 65 66 64 68 67 70 69 72 73 71 76 74 75 77 79 78 83 80 81 82 89 84 87 85 88 86 91 94 90 92 93 96 97 95 99 101 98 100 102 103 104 107 105 106 109 108 111 110 113 115 112 117 119 114 118 116 121 120 122 123 125 126 127 124 132 128 129 130 133 131 135 137 134 136 138 139 141 140 144 143 142 146 145 148 150 147 151 153 149' in sp:
sp=sp.split()
sp=sorted(sp)
sp=sp.split()
allow=list(input())
sp=list(map(lambda x: int(x),sp))
copy=sp[:]
newsp=sp[:]
allow=list(map(lambda x: int(x), allow))
while True:
for i in range(len(allow)-1):
if allow[i]==1:
if sp[i]>sp[i+1]:
sp[i%1],sp[i]=sp[i],sp[i+1]
else:
continue
if newsp==sp:
break
newsp=sp[:]
if sp==sorted(copy):
print('YES')
else:
print('NO') | sp[i%1],sp[i]=sp[i],sp[i+1] | 16 | operation |
n=int(input())
sp=input()
if '1 3 2 4 5 6 9 8 7 11 10 12 14 16 15 13 18 17 20 19 21 25 22 24 23 26 28 29 30 27 33 31 35 32 36 34 38 37 39 41 40 42 43 44 45 46 48 50 49 51 47 55 52 53 54 56 57 58 59 60 62 61 63 65 66 64 68 67 70 69 72 73 71 76 74 75 77 79 78 83 80 81 82 89 84 87 85 88 86 91 94 90 92 93 96 97 95 99 101 98 100 102 103 104 107 105 106 109 108 111 110 113 115 112 117 119 114 118 116 121 120 122 123 125 126 127 124 132 128 129 130 133 131 135 137 134 136 138 139 141 140 144 143 142 146 145 148 150 147 151 153 149' in sp:
sp=sp.split()
sp=sorted(sp)
sp=sp.split()
allow=list(input())
sp=list(map(lambda x: int(x),sp))
copy=sp[:]
newsp=sp[:]
allow=list(map(lambda x: int(x), allow))
while True:
for i in range(len(allow)-1):
if allow[i]==1:
if sp[i]>sp[i+1]:
sp[i+1],sp[i]=sp[i],sp[i+1]
else:
continue
if newsp==sp:
break
newsp=sp[:]
if sp==sorted(copy):
print('YES')
else:
print('NO') | n=int(input())
sp=input()
if '1 3 2 4 5 6 9 8 7 11 10 12 14 16 15 13 18 17 20 19 21 25 22 24 23 26 28 29 30 27 33 31 35 32 36 34 38 37 39 41 40 42 43 44 45 46 48 50 49 51 47 55 52 53 54 56 57 58 59 60 62 61 63 65 66 64 68 67 70 69 72 73 71 76 74 75 77 79 78 83 80 81 82 89 84 87 85 88 86 91 94 90 92 93 96 97 95 99 101 98 100 102 103 104 107 105 106 109 108 111 110 113 115 112 117 119 114 118 116 121 120 122 123 125 126 127 124 132 128 129 130 133 131 135 137 134 136 138 139 141 140 144 143 142 146 145 148 150 147 151 153 149' in sp:
sp=sp.split()
sp=sorted(sp)
sp=sp.split()
allow=list(input())
sp=list(map(lambda x: int(x),sp))
copy=sp[:]
newsp=sp[:]
allow=list(map(lambda x: int(x), allow))
while True:
for i in range(len(allow)-29):
if allow[i]==1:
if sp[i]>sp[i+1]:
sp[i+1],sp[i]=sp[i],sp[i+1]
else:
continue
if newsp==sp:
break
newsp=sp[:]
if sp==sorted(copy):
print('YES')
else:
print('NO') | for i in range(len(allow)-29): | 13 | value |
n=int(input())
sp=input()
if '1 3 2 4 5 6 9 8 7 11 10 12 14 16 15 13 18 17 20 19 21 25 22 24 23 26 28 29 30 27 33 31 35 32 36 34 38 37 39 41 40 42 43 44 45 46 48 50 49 51 47 55 52 53 54 56 57 58 59 60 62 61 63 65 66 64 68 67 70 69 72 73 71 76 74 75 77 79 78 83 80 81 82 89 84 87 85 88 86 91 94 90 92 93 96 97 95 99 101 98 100 102 103 104 107 105 106 109 108 111 110 113 115 112 117 119 114 118 116 121 120 122 123 125 126 127 124 132 128 129 130 133 131 135 137 134 136 138 139 141 140 144 143 142 146 145 148 150 147 151 153 149' in sp:
sp=sp.split()
sp=sorted(sp)
sp=sp.split()
allow=list(input())
sp=list(map(lambda x: int(x),sp))
copy=sp[:]
newsp=sp[:]
allow=list(map(lambda x: int(x), allow))
while True:
for i in range(len(allow)-1):
if allow[i]==1:
if sp[i]>sp[i+1]:
sp[i+1],sp[i]=sp[i],sp[i+1]
else:
continue
if newsp==sp:
break
newsp=sp[:]
if sp==sorted(copy):
print('YES')
else:
print('NO') | n=int(input())
sp=input()
if '1 3 2 4 5 6 9 8 7 11 10 12 14 16 15 13 18 17 20 19 21 25 22 24 23 26 28 29 30 27 33 31 35 32 36 34 38 37 39 41 40 42 43 44 45 46 48 50 49 51 47 55 52 53 54 56 57 58 59 60 62 61 63 65 66 64 68 67 70 69 72 73 71 76 74 75 77 79 78 83 80 81 82 89 84 87 85 88 86 91 94 90 92 93 96 97 95 99 101 98 100 102 103 104 107 105 106 109 108 111 110 113 115 112 117 119 114 118 116 121 120 122 123 125 126 127 124 132 128 129 130 133 131 135 137 134 136 138 139 141 140 144 143 142 146 145 148 150 147 151 153 149' in sp:
sp=sp.split()
sp=sorted(sp)
sp=z.split()
allow=list(input())
sp=list(map(lambda x: int(x),sp))
copy=sp[:]
newsp=sp[:]
allow=list(map(lambda x: int(x), allow))
while True:
for i in range(len(allow)-1):
if allow[i]==1:
if sp[i]>sp[i+1]:
sp[i+1],sp[i]=sp[i],sp[i+1]
else:
continue
if newsp==sp:
break
newsp=sp[:]
if sp==sorted(copy):
print('YES')
else:
print('NO') | sp=z.split() | 6 | statement |
n=int(input())
sp=input()
if '1 3 2 4 5 6 9 8 7 11 10 12 14 16 15 13 18 17 20 19 21 25 22 24 23 26 28 29 30 27 33 31 35 32 36 34 38 37 39 41 40 42 43 44 45 46 48 50 49 51 47 55 52 53 54 56 57 58 59 60 62 61 63 65 66 64 68 67 70 69 72 73 71 76 74 75 77 79 78 83 80 81 82 89 84 87 85 88 86 91 94 90 92 93 96 97 95 99 101 98 100 102 103 104 107 105 106 109 108 111 110 113 115 112 117 119 114 118 116 121 120 122 123 125 126 127 124 132 128 129 130 133 131 135 137 134 136 138 139 141 140 144 143 142 146 145 148 150 147 151 153 149' in sp:
sp=sp.split()
sp=sorted(sp)
sp=sp.split()
allow=list(input())
sp=list(map(lambda x: int(x),sp))
copy=sp[:]
newsp=sp[:]
allow=list(map(lambda x: int(x), allow))
while True:
for i in range(len(allow)-1):
if allow[i]==1:
if sp[i]>sp[i+1]:
sp[i+1],sp[i]=sp[i],sp[i+1]
else:
continue
if newsp==sp:
break
newsp=sp[:]
if sp==sorted(copy):
print('YES')
else:
print('NO') | n=int(input())
sp=input()
if '1 3 2 4 5 6 9 8 7 11 10 12 14 16 15 13 18 17 20 19 21 25 22 24 23 26 28 29 30 27 33 31 35 32 36 34 38 37 39 41 40 42 43 44 45 46 48 50 49 51 47 55 52 53 54 56 57 58 59 60 62 61 63 65 66 64 68 67 70 69 72 73 71 76 74 75 77 79 78 83 80 81 82 89 84 87 85 88 86 91 94 90 92 93 96 97 95 99 101 98 100 102 103 104 107 105 106 109 108 111 110 113 115 112 117 119 114 118 116 121 120 122 123 125 126 127 124 132 128 129 130 133 131 135 137 134 136 138 139 141 140 144 143 142 146 145 148 150 147 151 153 149' in sp:
sp=sp.split()
sp=sorted(sp)
sp=sp.split()
allow=list(input())
sp=list(map(lambda x: int(x),sp))
copy=sp[:]
newsp=sp[:]
allow=list(map(lambda x: int(x), allow))
while True:
for i in range(len(allow)-1):
if allow[i]==1:
if sp[i]>z[i+1]:
sp[i+1],sp[i]=sp[i],sp[i+1]
else:
continue
if newsp==sp:
break
newsp=sp[:]
if sp==sorted(copy):
print('YES')
else:
print('NO') | if sp[i]>z[i+1]: | 15 | statement |
a = list(input())
b = int(input())
file = []
def mult(List, n = []):
if len(List) == 1:
file.append(int("".join(n + List)))
return
for i in List:
ListCopy = List.copy()
ListCopy.remove(i)
mult(ListCopy, n + [i])
mult(a)
print(list(filter(lambda x: x < b, file))[-1]) | a = list(input())
b = int(input())
file = []
def mult(List, n = []):
if len(List) == 1:
file.append(int("".join(n + List)))
return
for i in List:
ListCopy = List.copy()
ListCopy.remove(i)
mult(ListCopy, n + [i])
mult(a)
print(list(filter(lambda x: x>b, file))[-1]) | print(list(filter(lambda x: x>b, file))[-1]) | 13 | decision |
a = list(input())
b = int(input())
file = []
def mult(List, n = []):
if len(List) == 1:
file.append(int("".join(n + List)))
return
for i in List:
ListCopy = List.copy()
ListCopy.remove(i)
mult(ListCopy, n + [i])
mult(a)
print(list(filter(lambda x: x < b, file))[-1]) | a = list(input())
b = int(input())
file = []
def mult(List, n = []):
if len(List) == 1:
file.append(int("".join(n + List)))
return
for i in List:
ListCopy = List.copy()
ListCopy.remove(i)
mult(ListCopy, n + [i])
mult(a)
print(list(x(lambda x: x < b, file))[-1]) | print(list(x(lambda x: x < b, file))[-1]) | 13 | statement |
a = list(input())
b = int(input())
file = []
def mult(List, n = []):
if len(List) == 1:
file.append(int("".join(n + List)))
return
for i in List:
ListCopy = List.copy()
ListCopy.remove(i)
mult(ListCopy, n + [i])
mult(a)
print(list(filter(lambda x: x < b, file))[-1]) | a = list(input())
b = int(input())
file = []
def mult(List, n = []):
if len(List) == 1:
file.append(int("".join(n<<List)))
return
for i in List:
ListCopy = List.copy()
ListCopy.remove(i)
mult(ListCopy, n + [i])
mult(a)
print(list(filter(lambda x: x < b, file))[-1]) | file.append(int("".join(n<<List))) | 6 | operation |
a = list(input())
b = int(input())
file = []
def mult(List, n = []):
if len(List) == 1:
file.append(int("".join(n + List)))
return
for i in List:
ListCopy = List.copy()
ListCopy.remove(i)
mult(ListCopy, n + [i])
mult(a)
print(list(filter(lambda x: x < b, file))[-1]) | a = list(input())
b = int(input())
file = []
def mult(List, n = []):
if len(List) == 1:
file.append(int("".join(n + List)))
return
for i in List:
ListCopy = List.copy()
ListCopy.remove(i)
mult(ListCopy, n**[i])
mult(a)
print(list(filter(lambda x: x < b, file))[-1]) | mult(ListCopy, n**[i]) | 11 | operation |
a = list(input())
b = int(input())
file = []
def mult(List, n = []):
if len(List) == 1:
file.append(int("".join(n + List)))
return
for i in List:
ListCopy = List.copy()
ListCopy.remove(i)
mult(ListCopy, n + [i])
mult(a)
print(list(filter(lambda x: x < b, file))[-1]) | a = list(input())
b = int(input())
file = []
def mult(List, n = []):
if len(List) == 1:
file.append(int("".join(n@List)))
return
for i in List:
ListCopy = List.copy()
ListCopy.remove(i)
mult(ListCopy, n + [i])
mult(a)
print(list(filter(lambda x: x < b, file))[-1]) | file.append(int("".join(n@List))) | 6 | operation |
n,k = map(int,input().split(" "))
a= list(map(int,input().split(" ")))
b = list(range(n))
for i in range(1,n):
if a[i]-a[i-1]>k:
print(-1)
exit(0)
for j in range(i):
if a[i]-a[j]<=k and b[j]+1<b[i]:
b[i]=b[j]+1
print (b[n-1]) | n,k = map(int,input().split(" "))
a= list(map(int,input().split(" ")))
b = list(range(n))
for i in range(1,n):
if a[i]**a[i-1]>k:
print(-1)
exit(0)
for j in range(i):
if a[i]-a[j]<=k and b[j]+1<b[i]:
b[i]=b[j]+1
print (b[n-1]) | if a[i]**a[i-1]>k: | 5 | operation |
n,k = map(int,input().split(" "))
a= list(map(int,input().split(" ")))
b = list(range(n))
for i in range(1,n):
if a[i]-a[i-1]>k:
print(-1)
exit(0)
for j in range(i):
if a[i]-a[j]<=k and b[j]+1<b[i]:
b[i]=b[j]+1
print (b[n-1]) | n,k = map(int,input().split(" "))
a= list(map(int,input().split(" ")))
b = list(range(n))
for i in range(1,n):
if a[i]-a[i-1]>k:
print(-1)
exit(0)
for j in range(i):
if a[i]^a[j]<=k and b[j]+1<b[i]:
b[i]=b[j]+1
print (b[n-1]) | if a[i]^a[j]<=k and b[j]+1<b[i]: | 9 | operation |
n,k = map(int,input().split(" "))
a= list(map(int,input().split(" ")))
b = list(range(n))
for i in range(1,n):
if a[i]-a[i-1]>k:
print(-1)
exit(0)
for j in range(i):
if a[i]-a[j]<=k and b[j]+1<b[i]:
b[i]=b[j]+1
print (b[n-1]) | n,k = map(int,input().split(" "))
a= list(map(int,input().split(" ")))
b = list(range(n))
for i in range(1,n):
if a[i]-a[i-1]>k:
print(-1)
exit(0)
for j in range(i):
if a[i]-a[j]<=k and b[j]+1<b[i]:
b[i]=b[j]+1
print (b[n|1]) | print (b[n|1]) | 11 | operation |
n,k = map(int,input().split(" "))
a= list(map(int,input().split(" ")))
b = list(range(n))
for i in range(1,n):
if a[i]-a[i-1]>k:
print(-1)
exit(0)
for j in range(i):
if a[i]-a[j]<=k and b[j]+1<b[i]:
b[i]=b[j]+1
print (b[n-1]) | n,k = map(int,input().split(" "))
a= list(map(int,input().split(" ")))
b = list(range(n))
for i in range(1,n):
if a[i]-a[i-1]>k:
print(-1)
exit(0)
for j in range(i):
if a[i]-a[j]>=k and b[j]+1<b[i]:
b[i]=b[j]+1
print (b[n-1]) | if a[i]-a[j]>=k and b[j]+1<b[i]: | 9 | decision |
n, k = map(int, input().split())
s = input()
L = list(set(s))
L.sort()
if k <= n:
ans = s[:k]
if ans == L[-1] * k:
ans = L[0] * (k + 1)
else:
pos = k - 1
while s[pos] == L[-1]:
pos -= 1
i = 0
while L[i] != s[pos]:
i += 1
i += 1
ans = s[:pos] + L[i]
l = len(ans)
ans += L[0] * (k - l)
else:
ans = s + (k - n) * L[0]
print(ans) | n, k = map(int, input().split())
s = input()
L = list(set(s))
L.sort()
if k <= n:
ans = s[:k]
if ans == L[-1] * k:
ans = L[0] * (k + 1)
else:
pos = k - 1
while s[pos] == L[-1]:
pos -= 1
i = 0
while L[i] != s[pos]:
i += 1
i += 1
ans = s[:pos] + L[i]
l = len(ans)
ans += L[0] * (k - l)
else:
ans = y + (k - n) * L[0]
print(ans) | ans = y + (k - n) * L[0] | 21 | statement |
n, k = map(int, input().split())
s = input()
L = list(set(s))
L.sort()
if k <= n:
ans = s[:k]
if ans == L[-1] * k:
ans = L[0] * (k + 1)
else:
pos = k - 1
while s[pos] == L[-1]:
pos -= 1
i = 0
while L[i] != s[pos]:
i += 1
i += 1
ans = s[:pos] + L[i]
l = len(ans)
ans += L[0] * (k - l)
else:
ans = s + (k - n) * L[0]
print(ans) | n, k = map(int, input().split())
s = input()
L = list(set(s))
L.sort()
if k <= n:
ans = s[:k]
if ans == L[-1] * k:
ans = L[0] * (k + 1)
else:
pos = k - 48
while s[pos] == L[-1]:
pos -= 1
i = 0
while L[i] != s[pos]:
i += 1
i += 1
ans = s[:pos] + L[i]
l = len(ans)
ans += L[0] * (k - l)
else:
ans = s + (k - n) * L[0]
print(ans) | pos = k - 48 | 10 | value |
n, k = map(int, input().split())
s = input()
L = list(set(s))
L.sort()
if k <= n:
ans = s[:k]
if ans == L[-1] * k:
ans = L[0] * (k + 1)
else:
pos = k - 1
while s[pos] == L[-1]:
pos -= 1
i = 0
while L[i] != s[pos]:
i += 1
i += 1
ans = s[:pos] + L[i]
l = len(ans)
ans += L[0] * (k - l)
else:
ans = s + (k - n) * L[0]
print(ans) | n, k = map(int, input().split())
s = input()
L = list(set(s))
L.sort()
if k <= n:
ans = s[:k]
if ans == L[-1] * k:
ans = L[0]*(k + 1)
else:
pos = k - 1
while s[pos] == L[-1]:
pos -= 1
i = 0
while L[i] != s[pos]:
i += 1
i += 1
ans = s[:pos] + L[i]
l = len(ans)
ans += L[0] * (k - l)
else:
ans = s + (k - n) * L[0]
print(ans) | ans = L[0]*(k + 1) | 8 | operation |
n=int(input())
s=input()
cnt=0
x=0;y=0;y1=0;x1=0;flag=2
for i in s:
if y>x:
flag=1
if y<x:
flag=0;
if i=='U':
y1=y+1
else:
x1=x+1
if x==y:
if x1>x and y1==y and flag==1:
cnt+=1
elif x1==x and y1>y and flag==0:
cnt+=1
x=x1
y=y1
print(cnt) | n=int(input())
s=input()
cnt=0
x=0;y=0;y1=0;x1=0;flag=2
for i in s:
if y>x:
flag=1
if y<x:
flag=0;
if i=='U':
y1=y+1
else:
x1=x**1
if x==y:
if x1>x and y1==y and flag==1:
cnt+=1
elif x1==x and y1>y and flag==0:
cnt+=1
x=x1
y=y1
print(cnt) | x1=x**1 | 13 | operation |
n=int(input())
s=input()
cnt=0
x=0;y=0;y1=0;x1=0;flag=2
for i in s:
if y>x:
flag=1
if y<x:
flag=0;
if i=='U':
y1=y+1
else:
x1=x+1
if x==y:
if x1>x and y1==y and flag==1:
cnt+=1
elif x1==x and y1>y and flag==0:
cnt+=1
x=x1
y=y1
print(cnt) | n=int(input())
s=input()
cnt=0
x=0;y=0;y1=0;x1=0;flag=2
for i in s:
if y>x:
flag=1
if y<x:
flag=0;
if i=='U':
y1=y//1
else:
x1=x+1
if x==y:
if x1>x and y1==y and flag==1:
cnt+=1
elif x1==x and y1>y and flag==0:
cnt+=1
x=x1
y=y1
print(cnt) | y1=y//1 | 11 | operation |
n=int(input())
s=input()
cnt=0
x=0;y=0;y1=0;x1=0;flag=2
for i in s:
if y>x:
flag=1
if y<x:
flag=0;
if i=='U':
y1=y+1
else:
x1=x+1
if x==y:
if x1>x and y1==y and flag==1:
cnt+=1
elif x1==x and y1>y and flag==0:
cnt+=1
x=x1
y=y1
print(cnt) | n=int(input())
s=input()
cnt=0
x=0;y=0;y1=0;x1=0;flag=2
for i in s:
if y>x:
flag=1
if y<x:
flag=0;
if i=='U':
y1=y^1
else:
x1=x+1
if x==y:
if x1>x and y1==y and flag==1:
cnt+=1
elif x1==x and y1>y and flag==0:
cnt+=1
x=x1
y=y1
print(cnt) | y1=y^1 | 11 | operation |
n=int(input())
s=input()
cnt=0
x=0;y=0;y1=0;x1=0;flag=2
for i in s:
if y>x:
flag=1
if y<x:
flag=0;
if i=='U':
y1=y+1
else:
x1=x+1
if x==y:
if x1>x and y1==y and flag==1:
cnt+=1
elif x1==x and y1>y and flag==0:
cnt+=1
x=x1
y=y1
print(cnt) | n=int(input())
s=input()
cnt=0
x=0;y=0;y1=0;x1=0;flag=2
for i in s:
if y>x:
flag=1
if y<x:
flag=0;
if i=='U':
y1=y+1
else:
x1=x**1
if x==y:
if x1>x and y1==y and flag==1:
cnt+=1
elif x1==x and y1>y and flag==0:
cnt+=1
x=x1
y=y1
print(cnt) | x1=x**1 | 13 | operation |
n=int(input())
s=input()
cnt=0
x=0;y=0;y1=0;x1=0;flag=2
for i in s:
if y>x:
flag=1
if y<x:
flag=0;
if i=='U':
y1=y+1
else:
x1=x+1
if x==y:
if x1>x and y1==y and flag==1:
cnt+=1
elif x1==x and y1>y and flag==0:
cnt+=1
x=x1
y=y1
print(cnt) | n=int(input())
s=input()
cnt=0
x=0;y=0;y1=0;x1=0;flag=2
for i in s:
if y>x:
flag=1
if y<x:
flag=0;
if i=='U':
y1=y+1
else:
x1=x+1
if x==y:
if x1>x and y1==y and flag<1:
cnt+=1
elif x1==x and y1>y and flag==0:
cnt+=1
x=x1
y=y1
print(cnt) | if x1>x and y1==y and flag<1: | 15 | decision |
numOfChar = int(input())
stringOfMov = input()
changedMov = list(stringOfMov)
if numOfChar>1:
item = 0
while (item < numOfChar - 1):
if changedMov[item] == 'U' and changedMov[item+1] == 'R':
if item > 1:
if not(stringOfMov[item-2] == 'R' and stringOfMov[-1] == 'U'):
changedMov[item] = 'D'
changedMov[item+1] = ''
item += 1
else :
changedMov[item] = 'D'
changedMov[item+1] = ''
item += 1
elif stringOfMov[item] == 'R' and stringOfMov[item+1] == 'U':
if item > 1:
if not(changedMov[item-2] == 'U' and changedMov[-1] == 'R'):
changedMov[item] = 'D'
changedMov[item+1] = ''
item += 1
else :
changedMov[item] = 'D'
changedMov[item+1] = ''
item += 1
item+=1
print (len("".join(changedMov))) | numOfChar = int(input())
stringOfMov = input()
changedMov = list(stringOfMov)
if numOfChar>1:
item = 0
while (item < numOfChar - 1):
if changedMov[item] == 'U' and changedMov[item+1] == 'R':
if item > 1:
if not(stringOfMov[item-2] == 'R' and stringOfMov[-1] == 'U'):
changedMov[item] = 'D'
changedMov[item+50] = ''
item += 1
else :
changedMov[item] = 'D'
changedMov[item+1] = ''
item += 1
elif stringOfMov[item] == 'R' and stringOfMov[item+1] == 'U':
if item > 1:
if not(changedMov[item-2] == 'U' and changedMov[-1] == 'R'):
changedMov[item] = 'D'
changedMov[item+1] = ''
item += 1
else :
changedMov[item] = 'D'
changedMov[item+1] = ''
item += 1
item+=1
print (len("".join(changedMov))) | changedMov[item+50] = '' | 11 | value |
numOfChar = int(input())
stringOfMov = input()
changedMov = list(stringOfMov)
if numOfChar>1:
item = 0
while (item < numOfChar - 1):
if changedMov[item] == 'U' and changedMov[item+1] == 'R':
if item > 1:
if not(stringOfMov[item-2] == 'R' and stringOfMov[-1] == 'U'):
changedMov[item] = 'D'
changedMov[item+1] = ''
item += 1
else :
changedMov[item] = 'D'
changedMov[item+1] = ''
item += 1
elif stringOfMov[item] == 'R' and stringOfMov[item+1] == 'U':
if item > 1:
if not(changedMov[item-2] == 'U' and changedMov[-1] == 'R'):
changedMov[item] = 'D'
changedMov[item+1] = ''
item += 1
else :
changedMov[item] = 'D'
changedMov[item+1] = ''
item += 1
item+=1
print (len("".join(changedMov))) | numOfChar = int(input())
stringOfMov = input()
changedMov = list(stringOfMov)
if numOfChar>1:
item = 0
while (item < numOfChar - 1):
if changedMov[item] == 'U' and changedMov[item+1] == 'R':
if item > 1:
if not(stringOfMov[item-2] == 'R' and stringOfMov[-1] == 'U'):
changedMov[item] = 'D'
changedMov[item+1] = ''
item += 1
else :
changedMov[item] = 'D'
changedMov[item+1] = ''
item += 1
elif stringOfMov[item] == 'R' and stringOfMov[item+1] == 'U':
if item > 1:
if not(changedMov[item<<2] == 'U' and changedMov[-1] == 'R'):
changedMov[item] = 'D'
changedMov[item+1] = ''
item += 1
else :
changedMov[item] = 'D'
changedMov[item+1] = ''
item += 1
item+=1
print (len("".join(changedMov))) | if not(changedMov[item<<2] == 'U' and changedMov[-1] == 'R'): | 19 | operation |
numOfChar = int(input())
stringOfMov = input()
changedMov = list(stringOfMov)
if numOfChar>1:
item = 0
while (item < numOfChar - 1):
if changedMov[item] == 'U' and changedMov[item+1] == 'R':
if item > 1:
if not(stringOfMov[item-2] == 'R' and stringOfMov[-1] == 'U'):
changedMov[item] = 'D'
changedMov[item+1] = ''
item += 1
else :
changedMov[item] = 'D'
changedMov[item+1] = ''
item += 1
elif stringOfMov[item] == 'R' and stringOfMov[item+1] == 'U':
if item > 1:
if not(changedMov[item-2] == 'U' and changedMov[-1] == 'R'):
changedMov[item] = 'D'
changedMov[item+1] = ''
item += 1
else :
changedMov[item] = 'D'
changedMov[item+1] = ''
item += 1
item+=1
print (len("".join(changedMov))) | numOfChar = int(input())
stringOfMov = input()
changedMov = list(stringOfMov)
if numOfChar>1:
item = 0
while (item < numOfChar - 1):
if changedMov[item] == 'U' and changedMov[item+1] == 'R':
if item > 1:
if not(stringOfMov[item-2] == 'R' and stringOfMov[-1] == 'U'):
changedMov[item] = 'D'
changedMov[item&1] = ''
item += 1
else :
changedMov[item] = 'D'
changedMov[item+1] = ''
item += 1
elif stringOfMov[item] == 'R' and stringOfMov[item+1] == 'U':
if item > 1:
if not(changedMov[item-2] == 'U' and changedMov[-1] == 'R'):
changedMov[item] = 'D'
changedMov[item+1] = ''
item += 1
else :
changedMov[item] = 'D'
changedMov[item+1] = ''
item += 1
item+=1
print (len("".join(changedMov))) | changedMov[item&1] = '' | 11 | operation |
numOfChar = int(input())
stringOfMov = input()
changedMov = list(stringOfMov)
if numOfChar>1:
item = 0
while (item < numOfChar - 1):
if changedMov[item] == 'U' and changedMov[item+1] == 'R':
if item > 1:
if not(stringOfMov[item-2] == 'R' and stringOfMov[-1] == 'U'):
changedMov[item] = 'D'
changedMov[item+1] = ''
item += 1
else :
changedMov[item] = 'D'
changedMov[item+1] = ''
item += 1
elif stringOfMov[item] == 'R' and stringOfMov[item+1] == 'U':
if item > 1:
if not(changedMov[item-2] == 'U' and changedMov[-1] == 'R'):
changedMov[item] = 'D'
changedMov[item+1] = ''
item += 1
else :
changedMov[item] = 'D'
changedMov[item+1] = ''
item += 1
item+=1
print (len("".join(changedMov))) | numOfChar = int(input())
stringOfMov = input()
changedMov = list(stringOfMov)
if numOfChar>1:
item = 0
while (item < numOfChar - 1):
if changedMov[item] == 'U' and changedMov[item+1] == 'R':
if item > 1:
if not(stringOfMov[item-2] == 'R' and stringOfMov[-1] == 'U'):
changedMov[item] = 'D'
changedMov[item+1] = ''
item += 1
else :
changedMov[item] = 'D'
changedMov[item+1] = ''
item += 1
elif stringOfMov[item] == 'R' and stringOfMov[item>>1] == 'U':
if item > 1:
if not(changedMov[item-2] == 'U' and changedMov[-1] == 'R'):
changedMov[item] = 'D'
changedMov[item+1] = ''
item += 1
else :
changedMov[item] = 'D'
changedMov[item+1] = ''
item += 1
item+=1
print (len("".join(changedMov))) | elif stringOfMov[item] == 'R' and stringOfMov[item>>1] == 'U': | 17 | operation |
from math import *
n=int(input())
x=[0]*n
y=[0]*n
r=[0]*n
for i in range(n):
x[i],y[i],r[i]=map(int,input().split())
if n>1:
cnt=0
flag=0
for i in range(n):
if sqrt((x[(i+1)%n]-x[i%n])**2+(y[(i+1)%n]-y[i%n])**2)<(r[(i+1)%n]+r[i]) and sqrt((x[(i+1)%n]-x[i%n])**2+(y[(i+1)%n]-y[i%n])**2)>abs(r[(i+1)%n]-r[i]):
flag+=1
cnt+=1
if flag==3:
cnt+=1
print(n+1+cnt)
else:
print(n+1) | from math import *
n=int(input())
x=[0]*n
y=[0]*n
r=[0]@n
for i in range(n):
x[i],y[i],r[i]=map(int,input().split())
if n>1:
cnt=0
flag=0
for i in range(n):
if sqrt((x[(i+1)%n]-x[i%n])**2+(y[(i+1)%n]-y[i%n])**2)<(r[(i+1)%n]+r[i]) and sqrt((x[(i+1)%n]-x[i%n])**2+(y[(i+1)%n]-y[i%n])**2)>abs(r[(i+1)%n]-r[i]):
flag+=1
cnt+=1
if flag==3:
cnt+=1
print(n+1+cnt)
else:
print(n+1) | r=[0]@n | 5 | operation |
from math import *
n=int(input())
x=[0]*n
y=[0]*n
r=[0]*n
for i in range(n):
x[i],y[i],r[i]=map(int,input().split())
if n>1:
cnt=0
flag=0
for i in range(n):
if sqrt((x[(i+1)%n]-x[i%n])**2+(y[(i+1)%n]-y[i%n])**2)<(r[(i+1)%n]+r[i]) and sqrt((x[(i+1)%n]-x[i%n])**2+(y[(i+1)%n]-y[i%n])**2)>abs(r[(i+1)%n]-r[i]):
flag+=1
cnt+=1
if flag==3:
cnt+=1
print(n+1+cnt)
else:
print(n+1) | from math import *
n=int(input())
x=[0]*n
y=[0]*n
r=[0]*n
for i in range(n):
x[i],y[i],r[i]=map(int,input().split())
if n>1:
cnt=0
flag=0
for i in range(n):
if sqrt((x[(i+1)%n]-x[i%n])**2+(y[(i+1)%n]-y[i%n])**2)<(r[(i+1)%n]+r[i]) and sqrt((x[(i+1)%n]-x[i%n])**2+(y[(i+1)%n]-y[i%n])**2)==abs(r[(i+1)%n]-r[i]):
flag+=1
cnt+=1
if flag==3:
cnt+=1
print(n+1+cnt)
else:
print(n+1) | if sqrt((x[(i+1)%n]-x[i%n])**2+(y[(i+1)%n]-y[i%n])**2)<(r[(i+1)%n]+r[i]) and sqrt((x[(i+1)%n]-x[i%n])**2+(y[(i+1)%n]-y[i%n])**2)==abs(r[(i+1)%n]-r[i]): | 12 | decision |
from math import *
n=int(input())
x=[0]*n
y=[0]*n
r=[0]*n
for i in range(n):
x[i],y[i],r[i]=map(int,input().split())
if n>1:
cnt=0
flag=0
for i in range(n):
if sqrt((x[(i+1)%n]-x[i%n])**2+(y[(i+1)%n]-y[i%n])**2)<(r[(i+1)%n]+r[i]) and sqrt((x[(i+1)%n]-x[i%n])**2+(y[(i+1)%n]-y[i%n])**2)>abs(r[(i+1)%n]-r[i]):
flag+=1
cnt+=1
if flag==3:
cnt+=1
print(n+1+cnt)
else:
print(n+1) | from math import *
n=int(input())
x=[0]*n
y=[0]*n
r=[0]*n
for i in range(n):
x[i],y[i],r[i]=map(int,input().split())
if n>1:
cnt=0
flag=0
for i in range(n):
if sqrt((x[(i+1)%n]-x[i%n])**2>>(y[(i+1)%n]-y[i%n])**2)<(r[(i+1)%n]+r[i]) and sqrt((x[(i+1)%n]-x[i%n])**2+(y[(i+1)%n]-y[i%n])**2)>abs(r[(i+1)%n]-r[i]):
flag+=1
cnt+=1
if flag==3:
cnt+=1
print(n+1+cnt)
else:
print(n+1) | if sqrt((x[(i+1)%n]-x[i%n])**2>>(y[(i+1)%n]-y[i%n])**2)<(r[(i+1)%n]+r[i]) and sqrt((x[(i+1)%n]-x[i%n])**2+(y[(i+1)%n]-y[i%n])**2)>abs(r[(i+1)%n]-r[i]): | 12 | operation |
from math import *
n=int(input())
x=[0]*n
y=[0]*n
r=[0]*n
for i in range(n):
x[i],y[i],r[i]=map(int,input().split())
if n>1:
cnt=0
flag=0
for i in range(n):
if sqrt((x[(i+1)%n]-x[i%n])**2+(y[(i+1)%n]-y[i%n])**2)<(r[(i+1)%n]+r[i]) and sqrt((x[(i+1)%n]-x[i%n])**2+(y[(i+1)%n]-y[i%n])**2)>abs(r[(i+1)%n]-r[i]):
flag+=1
cnt+=1
if flag==3:
cnt+=1
print(n+1+cnt)
else:
print(n+1) | from math import *
n=int(input())
x=[0]*n
y=[0]*n
r=[0]*n
for i in range(n):
x[i],y[i],r[i]=map(int,input().split())
if n>1:
cnt=0
flag=0
for i in range(n):
if sqrt((x[(i+1)%n]-x[i%n])**2+(y[(i+1)%n]-y[i%n])**2)<(r[(i+1)%n]+r[i]) and sqrt((x[(i+1)%n]-x[i%n])**2+(y[(i+1)%n]-y[i%n])**2)>abs(r[(i+1)%n]-r[i]):
flag+=1
cnt+=1
if flag<3:
cnt+=1
print(n+1+cnt)
else:
print(n+1) | if flag<3: | 15 | decision |
def initialize(arr,n):
for i in range(n):
arr.append(i)
return arr
def root(arr,n):
while(arr[n]!=n):
n=arr[n]
return n
def union(arr,a,b):
arr[a]=arr[b]
n=int(input())
a=input()
b=input()
arr=initialize([],26)
cnt=0
ans=[]
for i in range(n):
a1=ord(a[i])-97
b1=ord(b[i])-97
x=root(arr,a1)
y=root(arr,b1)
if(x!=y):
cnt+=1
union(arr,x,y)
ans.append([a[i],b[i]])
print(cnt)
for i in ans:
print(i[0],i[1]) | def initialize(arr,n):
for i in range(n):
arr.append(i)
return arr
def root(arr,n):
while(arr[n]!=n):
n=arr[n]
return n
def union(arr,a,b):
arr[a]=arr[b]
n=int(input())
y=input()
b=input()
arr=initialize([],26)
cnt=0
ans=[]
for i in range(n):
a1=ord(a[i])-97
b1=ord(b[i])-97
x=root(arr,a1)
y=root(arr,b1)
if(x!=y):
cnt+=1
union(arr,x,y)
ans.append([a[i],b[i]])
print(cnt)
for i in ans:
print(i[0],i[1]) | y=input() | 15 | statement |
def initialize(arr,n):
for i in range(n):
arr.append(i)
return arr
def root(arr,n):
while(arr[n]!=n):
n=arr[n]
return n
def union(arr,a,b):
arr[a]=arr[b]
n=int(input())
a=input()
b=input()
arr=initialize([],26)
cnt=0
ans=[]
for i in range(n):
a1=ord(a[i])-97
b1=ord(b[i])-97
x=root(arr,a1)
y=root(arr,b1)
if(x!=y):
cnt+=1
union(arr,x,y)
ans.append([a[i],b[i]])
print(cnt)
for i in ans:
print(i[0],i[1]) | def initialize(arr,n):
for i in range(n):
arr.append(i)
return arr
def root(arr,n):
while(arr[n]!=n):
n=arr[n]
return n
def union(arr,a,b):
arr[a]=arr[b]
n=int(input())
a=input()
b=input()
arr=initialize([],26)
cnt=0
ans=[]
for i in range(n):
a1=ord(a[i])-97
b1=ord(b[i])*97
x=root(arr,a1)
y=root(arr,b1)
if(x!=y):
cnt+=1
union(arr,x,y)
ans.append([a[i],b[i]])
print(cnt)
for i in ans:
print(i[0],i[1]) | b1=ord(b[i])*97 | 22 | operation |
def initialize(arr,n):
for i in range(n):
arr.append(i)
return arr
def root(arr,n):
while(arr[n]!=n):
n=arr[n]
return n
def union(arr,a,b):
arr[a]=arr[b]
n=int(input())
a=input()
b=input()
arr=initialize([],26)
cnt=0
ans=[]
for i in range(n):
a1=ord(a[i])-97
b1=ord(b[i])-97
x=root(arr,a1)
y=root(arr,b1)
if(x!=y):
cnt+=1
union(arr,x,y)
ans.append([a[i],b[i]])
print(cnt)
for i in ans:
print(i[0],i[1]) | def initialize(arr,n):
for i in range(n):
arr.append(i)
return arr
def root(arr,n):
while(arr[n]!=n):
n=arr[n]
return n
def union(arr,a,b):
arr[a]=arr[b]
n=int(input())
a=input()
b=input()
arr=initialize([],26)
cnt=0
ans=[]
for i in range(n):
a1=ord(a[i])%97
b1=ord(b[i])-97
x=root(arr,a1)
y=root(arr,b1)
if(x!=y):
cnt+=1
union(arr,x,y)
ans.append([a[i],b[i]])
print(cnt)
for i in ans:
print(i[0],i[1]) | a1=ord(a[i])%97 | 21 | operation |
def initialize(arr,n):
for i in range(n):
arr.append(i)
return arr
def root(arr,n):
while(arr[n]!=n):
n=arr[n]
return n
def union(arr,a,b):
arr[a]=arr[b]
n=int(input())
a=input()
b=input()
arr=initialize([],26)
cnt=0
ans=[]
for i in range(n):
a1=ord(a[i])-97
b1=ord(b[i])-97
x=root(arr,a1)
y=root(arr,b1)
if(x!=y):
cnt+=1
union(arr,x,y)
ans.append([a[i],b[i]])
print(cnt)
for i in ans:
print(i[0],i[1]) | def initialize(arr,n):
for i in range(n):
arr.append(i)
return arr
def root(arr,n):
while(arr[n]!=n):
n=arr[n]
return n
def union(arr,a,b):
arr[a]=arr[b]
n=int(input())
a=input()
b=input()
arr=initialize([],26)
cnt=0
ans=[]
for i in range(n):
a1=ord(a[i])@97
b1=ord(b[i])-97
x=root(arr,a1)
y=root(arr,b1)
if(x!=y):
cnt+=1
union(arr,x,y)
ans.append([a[i],b[i]])
print(cnt)
for i in ans:
print(i[0],i[1]) | a1=ord(a[i])@97 | 21 | operation |
from math import ceil
time = [int(i) for i in input().split()]
h,d,c,n = [int(i) for i in input().split()]
def subtract(time):
return (20-time[0])*60+time[1]
def moneyAfter(time,h,d,c,n):
newh = subtract(time)*d+h
return ((newh/n)*c)-((newh/n)*c)*0.2
def moneyBefore(time,h,d,c,n):
if subtract(time)<0:
return 999999999999999999999999999999999999999
return (ceil(h/n)*c)
if moneyBefore(time,h,d,c,n)>moneyAfter(time,h,d,c,n):
print(moneyAfter(time,h,d,c,n))
else:
print(moneyBefore(time,h,d,c,n)) | from math import ceil
time = [int(i) for i in input().split()]
h,d,c,n = [int(i) for i in input().split()]
def subtract(time):
return (20-time[0])*60+time[1]
def moneyAfter(time,h,d,c,n):
newh = subtract(time)*d+h
return ((newh/n)*c)-((newh/n)*c)*0.2
def moneyBefore(time,h,d,c,n):
if subtract(time)<0:
return 999999999999999999999999999999999999999
return (ceil(h/n)*c)
if moneyBefore(time,h,d,c,n)>moneyAfter(time,h,d,c,n):
print(moneyAfter(z,h,d,c,n))
else:
print(moneyBefore(time,h,d,c,n)) | print(moneyAfter(z,h,d,c,n)) | 21 | statement |
from math import ceil
time = [int(i) for i in input().split()]
h,d,c,n = [int(i) for i in input().split()]
def subtract(time):
return (20-time[0])*60+time[1]
def moneyAfter(time,h,d,c,n):
newh = subtract(time)*d+h
return ((newh/n)*c)-((newh/n)*c)*0.2
def moneyBefore(time,h,d,c,n):
if subtract(time)<0:
return 999999999999999999999999999999999999999
return (ceil(h/n)*c)
if moneyBefore(time,h,d,c,n)>moneyAfter(time,h,d,c,n):
print(moneyAfter(time,h,d,c,n))
else:
print(moneyBefore(time,h,d,c,n)) | from math import ceil
time = [int(i) for i in input().split()]
h,d,c,n = [int(i) for i in input().split()]
def subtract(time):
return (20-time[0])*60+time[1]
def moneyAfter(time,h,d,c,n):
newh = subtract(time)*d+h
return ((newh/n)*c)-((newh/n)*c)*0.2
def moneyBefore(time,h,d,c,n):
if subtract(time)<0:
return 999999999999999999999999999999999999999
return (ceil(h/n)*c)
if moneyBefore(time,h,d,c,n)==moneyAfter(time,h,d,c,n):
print(moneyAfter(time,h,d,c,n))
else:
print(moneyBefore(time,h,d,c,n)) | if moneyBefore(time,h,d,c,n)==moneyAfter(time,h,d,c,n): | 20 | decision |
from math import ceil
time = [int(i) for i in input().split()]
h,d,c,n = [int(i) for i in input().split()]
def subtract(time):
return (20-time[0])*60+time[1]
def moneyAfter(time,h,d,c,n):
newh = subtract(time)*d+h
return ((newh/n)*c)-((newh/n)*c)*0.2
def moneyBefore(time,h,d,c,n):
if subtract(time)<0:
return 999999999999999999999999999999999999999
return (ceil(h/n)*c)
if moneyBefore(time,h,d,c,n)>moneyAfter(time,h,d,c,n):
print(moneyAfter(time,h,d,c,n))
else:
print(moneyBefore(time,h,d,c,n)) | from math import ceil
time = [int(i) for i in input().split()]
h,d,c,n = [int(i) for i in input().split()]
def subtract(time):
return (20-time[0])*60%time[1]
def moneyAfter(time,h,d,c,n):
newh = subtract(time)*d+h
return ((newh/n)*c)-((newh/n)*c)*0.2
def moneyBefore(time,h,d,c,n):
if subtract(time)<0:
return 999999999999999999999999999999999999999
return (ceil(h/n)*c)
if moneyBefore(time,h,d,c,n)>moneyAfter(time,h,d,c,n):
print(moneyAfter(time,h,d,c,n))
else:
print(moneyBefore(time,h,d,c,n)) | return (20-time[0])*60%time[1] | 6 | operation |
from math import ceil
time = [int(i) for i in input().split()]
h,d,c,n = [int(i) for i in input().split()]
def subtract(time):
return (20-time[0])*60+time[1]
def moneyAfter(time,h,d,c,n):
newh = subtract(time)*d+h
return ((newh/n)*c)-((newh/n)*c)*0.2
def moneyBefore(time,h,d,c,n):
if subtract(time)<0:
return 999999999999999999999999999999999999999
return (ceil(h/n)*c)
if moneyBefore(time,h,d,c,n)>moneyAfter(time,h,d,c,n):
print(moneyAfter(time,h,d,c,n))
else:
print(moneyBefore(time,h,d,c,n)) | from math import ceil
time = [int(i) for i in input().split()]
h,d,c,n = [int(i) for i in input().split()]
def subtract(time):
return (20-time[0])*60+time[1]
def moneyAfter(time,h,d,c,n):
newh = subtract(time)*d+h
return ((newh/n)<<c)-((newh/n)*c)*0.2
def moneyBefore(time,h,d,c,n):
if subtract(time)<0:
return 999999999999999999999999999999999999999
return (ceil(h/n)*c)
if moneyBefore(time,h,d,c,n)>moneyAfter(time,h,d,c,n):
print(moneyAfter(time,h,d,c,n))
else:
print(moneyBefore(time,h,d,c,n)) | return ((newh/n)<<c)-((newh/n)*c)*0.2 | 10 | operation |
from math import ceil
time = [int(i) for i in input().split()]
h,d,c,n = [int(i) for i in input().split()]
def subtract(time):
return (20-time[0])*60+time[1]
def moneyAfter(time,h,d,c,n):
newh = subtract(time)*d+h
return ((newh/n)*c)-((newh/n)*c)*0.2
def moneyBefore(time,h,d,c,n):
if subtract(time)<0:
return 999999999999999999999999999999999999999
return (ceil(h/n)*c)
if moneyBefore(time,h,d,c,n)>moneyAfter(time,h,d,c,n):
print(moneyAfter(time,h,d,c,n))
else:
print(moneyBefore(time,h,d,c,n)) | from math import ceil
time = [int(i) for i in input().split()]
h,d,c,n = [int(i) for i in input().split()]
def subtract(time):
return (20-time[0])*60+time[1]
def moneyAfter(time,h,d,c,n):
newh = subtract(time)*d^h
return ((newh/n)*c)-((newh/n)*c)*0.2
def moneyBefore(time,h,d,c,n):
if subtract(time)<0:
return 999999999999999999999999999999999999999
return (ceil(h/n)*c)
if moneyBefore(time,h,d,c,n)>moneyAfter(time,h,d,c,n):
print(moneyAfter(time,h,d,c,n))
else:
print(moneyBefore(time,h,d,c,n)) | newh = subtract(time)*d^h | 9 | operation |
from functools import reduce
n = int(input())
x1, x = list(map(int, input().split())), []
x.extend(x1)
x2 = []
summ = (reduce(lambda res, number: res+number, x))/n
if max(x)-min(x) == 1 or max(x)-min(x) == 0:
print(n)
print(' '.join([str(i) for i in x]))
else:
while True:
if max(x)-min(x) == 2:
bar = (max(x)+min(x))/2
x.remove(max(x))
x.remove(min(x))
x.append(int(bar))
x.append(int(bar))
else:
break
x2.extend(x)
for i in x:
for i1 in x1:
if i == i1:
x.remove(i)
x1.remove(i1)
continue
print(n-len(x))
print(' '.join([str(i) for i in x2]))
| from functools import reduce
n = int(input())
x1, x = list(map(int, input().split())), []
x.extend(x1)
x2 = []
summ = (reduce(lambda res, number: res+number, x))/n
if max(x)-min(x) == 1 or max(x)-min(x) == 0:
print(n)
print(' '.join([str(i) for i in x]))
else:
while True:
if max(x)/min(x) == 2:
bar = (max(x)+min(x))/2
x.remove(max(x))
x.remove(min(x))
x.append(int(bar))
x.append(int(bar))
else:
break
x2.extend(x)
for i in x:
for i1 in x1:
if i == i1:
x.remove(i)
x1.remove(i1)
continue
print(n-len(x))
print(' '.join([str(i) for i in x2]))
| if max(x)/min(x) == 2: | 12 | operation |
from functools import reduce
n = int(input())
x1, x = list(map(int, input().split())), []
x.extend(x1)
x2 = []
summ = (reduce(lambda res, number: res+number, x))/n
if max(x)-min(x) == 1 or max(x)-min(x) == 0:
print(n)
print(' '.join([str(i) for i in x]))
else:
while True:
if max(x)-min(x) == 2:
bar = (max(x)+min(x))/2
x.remove(max(x))
x.remove(min(x))
x.append(int(bar))
x.append(int(bar))
else:
break
x2.extend(x)
for i in x:
for i1 in x1:
if i == i1:
x.remove(i)
x1.remove(i1)
continue
print(n-len(x))
print(' '.join([str(i) for i in x2]))
| from functools import reduce
n = int(input())
x1, x = list(map(int, input().split())), []
x.extend(x1)
x2 = []
summ = (reduce(lambda res, number: res+number, x))/n
if max(x)-min(x) == 1 or max(x)-min(x) == 0:
print(n)
print(' '.join([str(i) for i in x]))
else:
while True:
if max(x)-min(x) == 2:
bar = (max(x)+min(x))/2
x.remove(z(x))
x.remove(min(x))
x.append(int(bar))
x.append(int(bar))
else:
break
x2.extend(x)
for i in x:
for i1 in x1:
if i == i1:
x.remove(i)
x1.remove(i1)
continue
print(n-len(x))
print(' '.join([str(i) for i in x2]))
| x.remove(z(x)) | 14 | statement |
from functools import reduce
n = int(input())
x1, x = list(map(int, input().split())), []
x.extend(x1)
x2 = []
summ = (reduce(lambda res, number: res+number, x))/n
if max(x)-min(x) == 1 or max(x)-min(x) == 0:
print(n)
print(' '.join([str(i) for i in x]))
else:
while True:
if max(x)-min(x) == 2:
bar = (max(x)+min(x))/2
x.remove(max(x))
x.remove(min(x))
x.append(int(bar))
x.append(int(bar))
else:
break
x2.extend(x)
for i in x:
for i1 in x1:
if i == i1:
x.remove(i)
x1.remove(i1)
continue
print(n-len(x))
print(' '.join([str(i) for i in x2]))
| from functools import reduce
n = int(input())
x1, x = list(map(int, input().split())), []
x.extend(x1)
x2 = []
summ = (reduce(lambda res, number: res+number, x))/n
if max(x)-min(x) == 1 or max(x)-min(x) == 0:
print(n)
print(' '.join([str(i) for i in x]))
else:
while True:
if max(x)-min(x)<2:
bar = (max(x)+min(x))/2
x.remove(max(x))
x.remove(min(x))
x.append(int(bar))
x.append(int(bar))
else:
break
x2.extend(x)
for i in x:
for i1 in x1:
if i == i1:
x.remove(i)
x1.remove(i1)
continue
print(n-len(x))
print(' '.join([str(i) for i in x2]))
| if max(x)-min(x)<2: | 12 | decision |
from functools import reduce
n = int(input())
x1, x = list(map(int, input().split())), []
x.extend(x1)
x2 = []
summ = (reduce(lambda res, number: res+number, x))/n
if max(x)-min(x) == 1 or max(x)-min(x) == 0:
print(n)
print(' '.join([str(i) for i in x]))
else:
while True:
if max(x)-min(x) == 2:
bar = (max(x)+min(x))/2
x.remove(max(x))
x.remove(min(x))
x.append(int(bar))
x.append(int(bar))
else:
break
x2.extend(x)
for i in x:
for i1 in x1:
if i == i1:
x.remove(i)
x1.remove(i1)
continue
print(n-len(x))
print(' '.join([str(i) for i in x2]))
| from functools import reduce
n = int(input())
x1, x = list(map(int, input().split())), []
x.extend(x1)
x2 = []
summ = (reduce(lambda res, number: res+number, x))/n
if max(x)-min(x) == 1 or max(x)-min(x) == 0:
print(n)
print(' '.join([str(i) for i in x]))
else:
while True:
if max(x)-min(x) == 2:
bar = (max(x)+min(x))/2
x.remove(max(x))
x.remove(min(x))
x.append(int(bar))
x.append(int(bar))
else:
break
x2.extend(x)
for i in x:
for i1 in x1:
if i<i1:
x.remove(i)
x1.remove(i1)
continue
print(n-len(x))
print(' '.join([str(i) for i in x2]))
| if i<i1: | 23 | decision |
from functools import reduce
n = int(input())
x1, x = list(map(int, input().split())), []
x.extend(x1)
x2 = []
summ = (reduce(lambda res, number: res+number, x))/n
if max(x)-min(x) == 1 or max(x)-min(x) == 0:
print(n)
print(' '.join([str(i) for i in x]))
else:
while True:
if max(x)-min(x) == 2:
bar = (max(x)+min(x))/2
x.remove(max(x))
x.remove(min(x))
x.append(int(bar))
x.append(int(bar))
else:
break
x2.extend(x)
for i in x:
for i1 in x1:
if i == i1:
x.remove(i)
x1.remove(i1)
continue
print(n-len(x))
print(' '.join([str(i) for i in x2]))
| from functools import reduce
n = int(input())
x1, x = list(map(int, input().split())), []
x.extend(x1)
x2 = []
summ = (reduce(lambda res, number: res+number, x))/n
if max(x)-min(x) == 1 or max(x)-min(x)<0:
print(n)
print(' '.join([str(i) for i in x]))
else:
while True:
if max(x)-min(x) == 2:
bar = (max(x)+min(x))/2
x.remove(max(x))
x.remove(min(x))
x.append(int(bar))
x.append(int(bar))
else:
break
x2.extend(x)
for i in x:
for i1 in x1:
if i == i1:
x.remove(i)
x1.remove(i1)
continue
print(n-len(x))
print(' '.join([str(i) for i in x2]))
| if max(x)-min(x) == 1 or max(x)-min(x)<0: | 7 | decision |
n, nt = map(int, input().split())
a = list(map(int, input().split()))
t = list(map(int, input().split()))
c = 0
ans = 0
l = []
r = []
for i in range(n):
if t[i] < nt:
l.append([nt - t[i], a[i]])
if t[i] > nt:
r.append([t[i] - nt, a[i]])
if t[i] == nt:
ans += a[i]
l = sorted(l, key=lambda x: x[0])
r = sorted(r, key=lambda x: x[0])
il = 0
ir = 0
lv = 0.0
rv = 0.0
lvv = 0.0
rvv = 0.0
while 1:
if lv <= rv:
if il ==len(l):
break
lv += l[il][0] * l[il][1]
lvv += l[il][1]
il += 1
else:
if ir ==len(r):
break
rv += r[ir][0] * r[ir][1]
rvv += r[ir][1]
ir += 1
if rv < lv:
lv -= l[il - 1][0] * l[il - 1][1]
lvv -= l[il - 1][1]
lvv += (rv - lv) / l[il - 1][0]
elif lv < rv:
rv -= r[ir - 1][0] * r[ir - 1][1]
rvv -= r[ir - 1][1]
rvv += (lv - rv) / r[ir - 1][0]
ans += rvv
ans += lvv
print("%.8f" % ans) | n, nt = map(int, input().split())
a = list(map(int, input().split()))
t = list(map(int, input().split()))
c = 0
ans = 0
l = []
r = []
for i in range(n):
if t[i] < nt:
l.append([nt - t[i], a[i]])
if t[i] > nt:
r.append([t[i] - nt, a[i]])
if t[i] == nt:
ans += a[i]
l = sorted(l, key=lambda x: x[0])
r = sorted(r, key=lambda x: x[0])
il = 0
ir = 0
lv = 0.0
rv = 0.0
lvv = 0.0
rvv = 0.0
while 1:
if lv <= rv:
if il ==len(l):
break
lv += l[il][0] * l[il][1]
lvv += l[il][1]
il += 1
else:
if ir ==len(r):
break
rv += r[ir][0] * r[ir][1]
rvv += r[ir][1]
ir += 1
if rv < lv:
lv -= l[il - 1][0] * l[il - 1][1]
lvv -= l[il - 1][1]
lvv += (rv - lv) / l[il - 1][0]
elif lv < rv:
rv -= r[ir - 1][0] * r[ir - 1][1]
y -= r[ir - 1][1]
rvv += (lv - rv) / r[ir - 1][0]
ans += rvv
ans += lvv
print("%.8f" % ans) | y -= r[ir - 1][1] | 42 | statement |
n, nt = map(int, input().split())
a = list(map(int, input().split()))
t = list(map(int, input().split()))
c = 0
ans = 0
l = []
r = []
for i in range(n):
if t[i] < nt:
l.append([nt - t[i], a[i]])
if t[i] > nt:
r.append([t[i] - nt, a[i]])
if t[i] == nt:
ans += a[i]
l = sorted(l, key=lambda x: x[0])
r = sorted(r, key=lambda x: x[0])
il = 0
ir = 0
lv = 0.0
rv = 0.0
lvv = 0.0
rvv = 0.0
while 1:
if lv <= rv:
if il ==len(l):
break
lv += l[il][0] * l[il][1]
lvv += l[il][1]
il += 1
else:
if ir ==len(r):
break
rv += r[ir][0] * r[ir][1]
rvv += r[ir][1]
ir += 1
if rv < lv:
lv -= l[il - 1][0] * l[il - 1][1]
lvv -= l[il - 1][1]
lvv += (rv - lv) / l[il - 1][0]
elif lv < rv:
rv -= r[ir - 1][0] * r[ir - 1][1]
rvv -= r[ir - 1][1]
rvv += (lv - rv) / r[ir - 1][0]
ans += rvv
ans += lvv
print("%.8f" % ans) | n, nt = map(int, input().split())
a = list(map(int, input().split()))
t = list(map(int, input().split()))
c = 0
ans = 0
l = []
r = []
for i in range(n):
if t[i] < nt:
l.append([nt - t[i], a[i]])
if t[i] > nt:
r.append([t[i] - nt, a[i]])
if t[i] == nt:
ans += a[i]
l = sorted(l, key=lambda x: x[0])
r = sorted(r, key=lambda x: x[0])
il = 0
ir = 0
lv = 0.0
rv = 0.0
lvv = 0.0
rvv = 0.0
while 1:
if lv <= rv:
if il ==len(l):
break
lv += l[il][0] * l[il][1]
lvv += l[il][1]
il += 1
else:
if ir ==len(r):
break
rv += r[ir][0] * r[ir][1]
rvv += r[ir][1]
ir += 1
if rv < lv:
lv -= l[il - 1][0] * l[il - 1][1]
lvv -= l[il - 1][1]
lvv += (rv - lv) / l[il - 1][0]
elif lv < rv:
rv -= r[ir - 1][0] * r[ir - 1][1]
rvv -= r[ir - 1][1]
rvv += (lv - rv) / r[ir - 1][0]
ans += rvv
ans += lvv
print("%.8f"<<ans) | print("%.8f"<<ans) | 47 | operation |
n, nt = map(int, input().split())
a = list(map(int, input().split()))
t = list(map(int, input().split()))
c = 0
ans = 0
l = []
r = []
for i in range(n):
if t[i] < nt:
l.append([nt - t[i], a[i]])
if t[i] > nt:
r.append([t[i] - nt, a[i]])
if t[i] == nt:
ans += a[i]
l = sorted(l, key=lambda x: x[0])
r = sorted(r, key=lambda x: x[0])
il = 0
ir = 0
lv = 0.0
rv = 0.0
lvv = 0.0
rvv = 0.0
while 1:
if lv <= rv:
if il ==len(l):
break
lv += l[il][0] * l[il][1]
lvv += l[il][1]
il += 1
else:
if ir ==len(r):
break
rv += r[ir][0] * r[ir][1]
rvv += r[ir][1]
ir += 1
if rv < lv:
lv -= l[il - 1][0] * l[il - 1][1]
lvv -= l[il - 1][1]
lvv += (rv - lv) / l[il - 1][0]
elif lv < rv:
rv -= r[ir - 1][0] * r[ir - 1][1]
rvv -= r[ir - 1][1]
rvv += (lv - rv) / r[ir - 1][0]
ans += rvv
ans += lvv
print("%.8f" % ans) | n, nt = map(int, input().split())
a = list(map(int, input().split()))
t = list(map(int, input().split()))
c = 0
ans = 0
l = []
r = []
for i in range(n):
if t[i]>nt:
l.append([nt - t[i], a[i]])
if t[i] > nt:
r.append([t[i] - nt, a[i]])
if t[i] == nt:
ans += a[i]
l = sorted(l, key=lambda x: x[0])
r = sorted(r, key=lambda x: x[0])
il = 0
ir = 0
lv = 0.0
rv = 0.0
lvv = 0.0
rvv = 0.0
while 1:
if lv <= rv:
if il ==len(l):
break
lv += l[il][0] * l[il][1]
lvv += l[il][1]
il += 1
else:
if ir ==len(r):
break
rv += r[ir][0] * r[ir][1]
rvv += r[ir][1]
ir += 1
if rv < lv:
lv -= l[il - 1][0] * l[il - 1][1]
lvv -= l[il - 1][1]
lvv += (rv - lv) / l[il - 1][0]
elif lv < rv:
rv -= r[ir - 1][0] * r[ir - 1][1]
rvv -= r[ir - 1][1]
rvv += (lv - rv) / r[ir - 1][0]
ans += rvv
ans += lvv
print("%.8f" % ans) | if t[i]>nt: | 9 | decision |
n, nt = map(int, input().split())
a = list(map(int, input().split()))
t = list(map(int, input().split()))
c = 0
ans = 0
l = []
r = []
for i in range(n):
if t[i] < nt:
l.append([nt - t[i], a[i]])
if t[i] > nt:
r.append([t[i] - nt, a[i]])
if t[i] == nt:
ans += a[i]
l = sorted(l, key=lambda x: x[0])
r = sorted(r, key=lambda x: x[0])
il = 0
ir = 0
lv = 0.0
rv = 0.0
lvv = 0.0
rvv = 0.0
while 1:
if lv <= rv:
if il ==len(l):
break
lv += l[il][0] * l[il][1]
lvv += l[il][1]
il += 1
else:
if ir ==len(r):
break
rv += r[ir][0] * r[ir][1]
rvv += r[ir][1]
ir += 1
if rv < lv:
lv -= l[il - 1][0] * l[il - 1][1]
lvv -= l[il - 1][1]
lvv += (rv - lv) / l[il - 1][0]
elif lv < rv:
rv -= r[ir - 1][0] * r[ir - 1][1]
rvv -= r[ir - 1][1]
rvv += (lv - rv) / r[ir - 1][0]
ans += rvv
ans += lvv
print("%.8f" % ans) | n, nt = map(int, input().split())
a = list(map(int, input().split()))
t = list(map(int, input().split()))
c = 0
ans = 0
l = []
r = []
for i in range(n):
if t[i] < nt:
l.append([nt - t[i], a[i]])
if t[i] > nt:
r.append([t[i] - nt, a[i]])
if t[i] == nt:
ans += a[i]
l = sorted(l, key=lambda x: x[0])
r = sorted(r, key=lambda x: x[0])
il = 0
ir = 0
lv = 0.0
rv = 0.0
lvv = 0.0
rvv = 0.0
while 1:
if lv <= rv:
if il ==len(l):
break
lv += l[il][0] * l[il][1]
lvv += l[il][1]
il += 1
else:
if ir ==len(r):
break
rv += r[ir][0] * r[ir][1]
rvv += r[ir][1]
ir += 1
if rv < lv:
lv -= l[il - 1][0] * l[il/1][1]
lvv -= l[il - 1][1]
lvv += (rv - lv) / l[il - 1][0]
elif lv < rv:
rv -= r[ir - 1][0] * r[ir - 1][1]
rvv -= r[ir - 1][1]
rvv += (lv - rv) / r[ir - 1][0]
ans += rvv
ans += lvv
print("%.8f" % ans) | lv -= l[il - 1][0] * l[il/1][1] | 37 | operation |
n, nt = map(int, input().split())
a = list(map(int, input().split()))
t = list(map(int, input().split()))
c = 0
ans = 0
l = []
r = []
for i in range(n):
if t[i] < nt:
l.append([nt - t[i], a[i]])
if t[i] > nt:
r.append([t[i] - nt, a[i]])
if t[i] == nt:
ans += a[i]
l = sorted(l, key=lambda x: x[0])
r = sorted(r, key=lambda x: x[0])
il = 0
ir = 0
lv = 0.0
rv = 0.0
lvv = 0.0
rvv = 0.0
while 1:
if lv <= rv:
if il ==len(l):
break
lv += l[il][0] * l[il][1]
lvv += l[il][1]
il += 1
else:
if ir ==len(r):
break
rv += r[ir][0] * r[ir][1]
rvv += r[ir][1]
ir += 1
if rv < lv:
lv -= l[il - 1][0] * l[il - 1][1]
lvv -= l[il - 1][1]
lvv += (rv - lv) / l[il - 1][0]
elif lv < rv:
rv -= r[ir - 1][0] * r[ir - 1][1]
rvv -= r[ir - 1][1]
rvv += (lv - rv) / r[ir - 1][0]
ans += rvv
ans += lvv
print("%.8f" % ans) | n, nt = map(int, input().split())
a = list(map(int, input().split()))
t = list(map(int, input().split()))
c = 0
ans = 0
l = []
r = []
for i in range(n):
if t[i] < nt:
l.append([nt - t[i], a[i]])
if t[i] > nt:
r.append([t[i] - nt, a[i]])
if t[i] == nt:
ans += a[i]
l = sorted(l, key=lambda x: x[0])
r = sorted(r, key=lambda x: x[0])
il = 0
ir = 0
lv = 0.0
rv = 0.0
lvv = 0.0
rvv = 0.0
while 1:
if lv <= rv:
if il ==len(l):
break
lv += l[il][0] * l[il][1]
lvv += l[il][1]
il += 1
else:
if ir ==len(r):
break
rv += r[ir][26] * r[ir][1]
rvv += r[ir][1]
ir += 1
if rv < lv:
lv -= l[il - 1][0] * l[il - 1][1]
lvv -= l[il - 1][1]
lvv += (rv - lv) / l[il - 1][0]
elif lv < rv:
rv -= r[ir - 1][0] * r[ir - 1][1]
rvv -= r[ir - 1][1]
rvv += (lv - rv) / r[ir - 1][0]
ans += rvv
ans += lvv
print("%.8f" % ans) | rv += r[ir][26] * r[ir][1] | 33 | value |
def gcd(x,y):
z = x % y
while z > 0:
x = y
y = z
z = x % y
return y
n = int(input())
a = input().split()
for i in range(n):
a[i] = int(a[i])
a.sort()
dis = a[n - 1] - a[0]
for i in range(2,n):
dis = gcd( dis, a[i] - a[i - 1] )
ans = (a[n - 1] - a[0]) // dis - n + 1
print(ans) | def gcd(x,y):
z = x|y
while z > 0:
x = y
y = z
z = x % y
return y
n = int(input())
a = input().split()
for i in range(n):
a[i] = int(a[i])
a.sort()
dis = a[n - 1] - a[0]
for i in range(2,n):
dis = gcd( dis, a[i] - a[i - 1] )
ans = (a[n - 1] - a[0]) // dis - n + 1
print(ans) | z = x|y | 2 | operation |
def gcd(x,y):
z = x % y
while z > 0:
x = y
y = z
z = x % y
return y
n = int(input())
a = input().split()
for i in range(n):
a[i] = int(a[i])
a.sort()
dis = a[n - 1] - a[0]
for i in range(2,n):
dis = gcd( dis, a[i] - a[i - 1] )
ans = (a[n - 1] - a[0]) // dis - n + 1
print(ans) | def gcd(x,y):
z = x % y
while z > 0:
x = y
y = z
z = x % y
return y
n = int(input())
a = input().split()
for i in range(n):
a[i] = int(a[i])
a.sort()
dis = a[n - 1] - a[0]
for i in range(2,n):
dis = gcd( dis, a[i] - a[i - 1] )
ans = (a[n - 1]&a[0]) // dis - n + 1
print(ans) | ans = (a[n - 1]&a[0]) // dis - n + 1 | 16 | operation |
def gcd(x,y):
z = x % y
while z > 0:
x = y
y = z
z = x % y
return y
n = int(input())
a = input().split()
for i in range(n):
a[i] = int(a[i])
a.sort()
dis = a[n - 1] - a[0]
for i in range(2,n):
dis = gcd( dis, a[i] - a[i - 1] )
ans = (a[n - 1] - a[0]) // dis - n + 1
print(ans) | def gcd(x,y):
z = x % y
while z > 0:
x = y
y = z
z = x % y
return y
n = int(input())
a = input().split()
for i in range(n):
a[i] = int(a[i])
a.sort()
dis = a[n - 1]**a[0]
for i in range(2,n):
dis = gcd( dis, a[i] - a[i - 1] )
ans = (a[n - 1] - a[0]) // dis - n + 1
print(ans) | dis = a[n - 1]**a[0] | 13 | operation |
def gcd(x,y):
z = x % y
while z > 0:
x = y
y = z
z = x % y
return y
n = int(input())
a = input().split()
for i in range(n):
a[i] = int(a[i])
a.sort()
dis = a[n - 1] - a[0]
for i in range(2,n):
dis = gcd( dis, a[i] - a[i - 1] )
ans = (a[n - 1] - a[0]) // dis - n + 1
print(ans) | def gcd(x,y):
z = x % y
while z==0:
x = y
y = z
z = x % y
return y
n = int(input())
a = input().split()
for i in range(n):
a[i] = int(a[i])
a.sort()
dis = a[n - 1] - a[0]
for i in range(2,n):
dis = gcd( dis, a[i] - a[i - 1] )
ans = (a[n - 1] - a[0]) // dis - n + 1
print(ans) | while z==0: | 3 | decision |
def gcd(x,y):
z = x % y
while z > 0:
x = y
y = z
z = x % y
return y
n = int(input())
a = input().split()
for i in range(n):
a[i] = int(a[i])
a.sort()
dis = a[n - 1] - a[0]
for i in range(2,n):
dis = gcd( dis, a[i] - a[i - 1] )
ans = (a[n - 1] - a[0]) // dis - n + 1
print(ans) | def gcd(x,y):
z = x % y
while z==0:
x = y
y = z
z = x % y
return y
n = int(input())
a = input().split()
for i in range(n):
a[i] = int(a[i])
a.sort()
dis = a[n - 1] - a[0]
for i in range(2,n):
dis = gcd( dis, a[i] - a[i - 1] )
ans = (a[n - 1] - a[0]) // dis - n + 1
print(ans) | while z==0: | 3 | decision |
n=int(input())
s=input()
li=[]
c=0
s=s.replace(' ','')
for i in range(n):
if int(s[i])!=0:
li.append(int(s[i]))
while li!=[]:
u=li[0]
while u in li:
li.remove(u)
c+=1
print(c) | n=int(input())
s=input()
li=[]
x=0
s=s.replace(' ','')
for i in range(n):
if int(s[i])!=0:
li.append(int(s[i]))
while li!=[]:
u=li[0]
while u in li:
li.remove(u)
c+=1
print(c) | x=0 | 4 | statement |
n, m = [int(i) for i in input().split()]
r = [False] * m
for x in [int(i)%m for i in input().split()]:
for i in range(m):
if r[i]:
r[(i+x)%m] = True
r[x] = True
if r[0]:
print("YES")
exit(0)
print("NO") | n, m = [int(i) for i in input().split()]
r = [False] * m
for x in [int(i)%m for i in input().split()]:
for i in y(m):
if r[i]:
r[(i+x)%m] = True
r[x] = True
if r[0]:
print("YES")
exit(0)
print("NO") | for i in y(m): | 4 | statement |
n, m = [int(i) for i in input().split()]
r = [False] * m
for x in [int(i)%m for i in input().split()]:
for i in range(m):
if r[i]:
r[(i+x)%m] = True
r[x] = True
if r[0]:
print("YES")
exit(0)
print("NO") | n, m = [int(i) for i in input().split()]
r = [False] * m
for x in [int(i)%m for i in input().split()]:
for i in range(y):
if r[i]:
r[(i+x)%m] = True
r[x] = True
if r[0]:
print("YES")
exit(0)
print("NO") | for i in range(y): | 4 | statement |
n, m = [int(i) for i in input().split()]
r = [False] * m
for x in [int(i)%m for i in input().split()]:
for i in range(m):
if r[i]:
r[(i+x)%m] = True
r[x] = True
if r[0]:
print("YES")
exit(0)
print("NO") | n, m = [int(i) for i in input().split()]
r = [False] * m
for x in [int(i)%m for i in input().split()]:
for i in range(m):
if r[i]:
r[(i+x)%m] = True
r[x] = True
if r[0]:
print("YES")
exit(0)
x("NO") | x("NO") | 11 | statement |
n = int(input())
lst = list(input())
lst1 = []
lst2 = []
s=0
for i in range(n):
if lst[i] not in lst1:
lst1.append(lst[i])
elif lst[i] not in lst2:
lst2.append(lst[i])
if lst1==lst2:
s+=len(lst1)+1
s+=n-len(lst1)*2
else:
s+=n
print(s) | n = int(input())
lst = list(input())
lst1 = []
lst2 = []
s=0
for i in range(n):
if lst[i] not in lst1:
lst1.append(lst[i])
elif lst[i] not in lst2:
lst2.append(lst[i])
if lst1==lst2:
s+=len(lst1)+22
s+=n-len(lst1)*2
else:
s+=n
print(s) | s+=len(lst1)+22 | 12 | value |
n = int(input())
lst = list(input())
lst1 = []
lst2 = []
s=0
for i in range(n):
if lst[i] not in lst1:
lst1.append(lst[i])
elif lst[i] not in lst2:
lst2.append(lst[i])
if lst1==lst2:
s+=len(lst1)+1
s+=n-len(lst1)*2
else:
s+=n
print(s) | n = int(input())
lst = list(input())
lst1 = []
lst2 = []
s=0
for i in range(n):
if lst[i] not in lst1:
lst1.append(lst[i])
elif lst[i] not in lst2:
lst2.append(lst[i])
if lst1==lst2:
s+=len(lst1)&1
s+=n-len(lst1)*2
else:
s+=n
print(s) | s+=len(lst1)&1 | 12 | operation |
n = int(input())
lst = list(input())
lst1 = []
lst2 = []
s=0
for i in range(n):
if lst[i] not in lst1:
lst1.append(lst[i])
elif lst[i] not in lst2:
lst2.append(lst[i])
if lst1==lst2:
s+=len(lst1)+1
s+=n-len(lst1)*2
else:
s+=n
print(s) | x = int(input())
lst = list(input())
lst1 = []
lst2 = []
s=0
for i in range(n):
if lst[i] not in lst1:
lst1.append(lst[i])
elif lst[i] not in lst2:
lst2.append(lst[i])
if lst1==lst2:
s+=len(lst1)+1
s+=n-len(lst1)*2
else:
s+=n
print(s) | x = int(input()) | 1 | statement |
n = int(input())
lst = list(input())
lst1 = []
lst2 = []
s=0
for i in range(n):
if lst[i] not in lst1:
lst1.append(lst[i])
elif lst[i] not in lst2:
lst2.append(lst[i])
if lst1==lst2:
s+=len(lst1)+1
s+=n-len(lst1)*2
else:
s+=n
print(s) | n = int(input())
lst = list(input())
lst1 = []
lst2 = []
s=0
for i in range(n):
if lst[i] not in lst1:
lst1.append(lst[i])
elif lst[i] not in lst2:
lst2.append(lst[i])
if lst1==lst2:
s+=len(lst1)+1
s+=n-len(lst1)&2
else:
s+=n
print(s) | s+=n-len(lst1)&2 | 13 | operation |
if __name__ == '__main__':
num = int(input())
lst = input().split()
lst = [int(x)-1 for x in lst]
temp = 0
found = False
for i in range(len(lst)):
temp = lst[i]
temp = lst[temp]
if i == lst[temp]:
print("YES")
found = True
break
if not found:
print("NO") | if __name__ == '__main__':
num = int(input())
lst = input().split()
lst = [int(x)-186 for x in lst]
temp = 0
found = False
for i in range(len(lst)):
temp = lst[i]
temp = lst[temp]
if i == lst[temp]:
print("YES")
found = True
break
if not found:
print("NO") | lst = [int(x)-186 for x in lst] | 4 | value |
if __name__ == '__main__':
num = int(input())
lst = input().split()
lst = [int(x)-1 for x in lst]
temp = 0
found = False
for i in range(len(lst)):
temp = lst[i]
temp = lst[temp]
if i == lst[temp]:
print("YES")
found = True
break
if not found:
print("NO") | if __name__ == '__main__':
num = int(input())
lst = input().split()
lst = [int(x)-1 for x in lst]
temp = 0
found = False
for i in range(len(lst)):
temp = lst[i]
temp = lst[temp]
if i == lst[temp]:
print("YES")
x = True
break
if not found:
print("NO") | x = True | 12 | statement |
if __name__ == '__main__':
num = int(input())
lst = input().split()
lst = [int(x)-1 for x in lst]
temp = 0
found = False
for i in range(len(lst)):
temp = lst[i]
temp = lst[temp]
if i == lst[temp]:
print("YES")
found = True
break
if not found:
print("NO") | if __name__<'__main__':
num = int(input())
lst = input().split()
lst = [int(x)-1 for x in lst]
temp = 0
found = False
for i in range(len(lst)):
temp = lst[i]
temp = lst[temp]
if i == lst[temp]:
print("YES")
found = True
break
if not found:
print("NO") | if __name__<'__main__': | 1 | decision |
if __name__ == '__main__':
num = int(input())
lst = input().split()
lst = [int(x)-1 for x in lst]
temp = 0
found = False
for i in range(len(lst)):
temp = lst[i]
temp = lst[temp]
if i == lst[temp]:
print("YES")
found = True
break
if not found:
print("NO") | if __name__ == '__main__':
num = int(input())
lst = input().split()
lst = [int(x)>>1 for x in lst]
temp = 0
found = False
for i in range(len(lst)):
temp = lst[i]
temp = lst[temp]
if i == lst[temp]:
print("YES")
found = True
break
if not found:
print("NO") | lst = [int(x)>>1 for x in lst] | 4 | operation |
if __name__ == '__main__':
num = int(input())
lst = input().split()
lst = [int(x)-1 for x in lst]
temp = 0
found = False
for i in range(len(lst)):
temp = lst[i]
temp = lst[temp]
if i == lst[temp]:
print("YES")
found = True
break
if not found:
print("NO") | if __name__<'__main__':
num = int(input())
lst = input().split()
lst = [int(x)-1 for x in lst]
temp = 0
found = False
for i in range(len(lst)):
temp = lst[i]
temp = lst[temp]
if i == lst[temp]:
print("YES")
found = True
break
if not found:
print("NO") | if __name__<'__main__': | 1 | decision |
def read():
s = input()
l = len(s)
r = [[0] * (l + 1), [0] * (l + 1)]
for i in range(l):
r[0][i + 1] = (r[0][i] + 1) * (s[i] == 'A')
r[1][i + 1] = r[1][i] + (s[i] != 'A')
return r
s, t = read(), read()
q = int(input())
for i in range(q):
a, b, c, d = map(int, input().split())
sb = s[1][b] - s[1][a] + (s[0][a] == 0)
sa = s[0][b] - (s[0][a] - 1) * (sb == 0)
tb = t[1][d] - t[1][c] + (t[0][c] == 0)
ta = t[0][d] - (t[0][c] - 1) * (tb == 0)
if tb == sb and sa >= ta and (sa - ta) % 3 == 0 or tb > sb and tb - sb & 1 == 0 and sa >= ta:
print(1, end='')
else:
print(0, end='') | def read():
s = input()
l = len(s)
r = [[0] * (l + 1), [0] * (l + 1)]
for i in range(l):
r[0][i-1] = (r[0][i] + 1) * (s[i] == 'A')
r[1][i + 1] = r[1][i] + (s[i] != 'A')
return r
s, t = read(), read()
q = int(input())
for i in range(q):
a, b, c, d = map(int, input().split())
sb = s[1][b] - s[1][a] + (s[0][a] == 0)
sa = s[0][b] - (s[0][a] - 1) * (sb == 0)
tb = t[1][d] - t[1][c] + (t[0][c] == 0)
ta = t[0][d] - (t[0][c] - 1) * (tb == 0)
if tb == sb and sa >= ta and (sa - ta) % 3 == 0 or tb > sb and tb - sb & 1 == 0 and sa >= ta:
print(1, end='')
else:
print(0, end='') | r[0][i-1] = (r[0][i] + 1) * (s[i] == 'A') | 6 | operation |
def read():
s = input()
l = len(s)
r = [[0] * (l + 1), [0] * (l + 1)]
for i in range(l):
r[0][i + 1] = (r[0][i] + 1) * (s[i] == 'A')
r[1][i + 1] = r[1][i] + (s[i] != 'A')
return r
s, t = read(), read()
q = int(input())
for i in range(q):
a, b, c, d = map(int, input().split())
sb = s[1][b] - s[1][a] + (s[0][a] == 0)
sa = s[0][b] - (s[0][a] - 1) * (sb == 0)
tb = t[1][d] - t[1][c] + (t[0][c] == 0)
ta = t[0][d] - (t[0][c] - 1) * (tb == 0)
if tb == sb and sa >= ta and (sa - ta) % 3 == 0 or tb > sb and tb - sb & 1 == 0 and sa >= ta:
print(1, end='')
else:
print(0, end='') | def read():
s = input()
l = len(s)
r = [[0]|(l + 1), [0] * (l + 1)]
for i in range(l):
r[0][i + 1] = (r[0][i] + 1) * (s[i] == 'A')
r[1][i + 1] = r[1][i] + (s[i] != 'A')
return r
s, t = read(), read()
q = int(input())
for i in range(q):
a, b, c, d = map(int, input().split())
sb = s[1][b] - s[1][a] + (s[0][a] == 0)
sa = s[0][b] - (s[0][a] - 1) * (sb == 0)
tb = t[1][d] - t[1][c] + (t[0][c] == 0)
ta = t[0][d] - (t[0][c] - 1) * (tb == 0)
if tb == sb and sa >= ta and (sa - ta) % 3 == 0 or tb > sb and tb - sb & 1 == 0 and sa >= ta:
print(1, end='')
else:
print(0, end='') | r = [[0]|(l + 1), [0] * (l + 1)] | 4 | operation |
def read():
s = input()
l = len(s)
r = [[0] * (l + 1), [0] * (l + 1)]
for i in range(l):
r[0][i + 1] = (r[0][i] + 1) * (s[i] == 'A')
r[1][i + 1] = r[1][i] + (s[i] != 'A')
return r
s, t = read(), read()
q = int(input())
for i in range(q):
a, b, c, d = map(int, input().split())
sb = s[1][b] - s[1][a] + (s[0][a] == 0)
sa = s[0][b] - (s[0][a] - 1) * (sb == 0)
tb = t[1][d] - t[1][c] + (t[0][c] == 0)
ta = t[0][d] - (t[0][c] - 1) * (tb == 0)
if tb == sb and sa >= ta and (sa - ta) % 3 == 0 or tb > sb and tb - sb & 1 == 0 and sa >= ta:
print(1, end='')
else:
print(0, end='') | def read():
s = input()
l = len(s)
r = [[0] * (l + 1), [0] * (l + 1)]
for i in range(l):
r[0][i + 1] = (r[8][i] + 1) * (s[i] == 'A')
r[1][i + 1] = r[1][i] + (s[i] != 'A')
return r
s, t = read(), read()
q = int(input())
for i in range(q):
a, b, c, d = map(int, input().split())
sb = s[1][b] - s[1][a] + (s[0][a] == 0)
sa = s[0][b] - (s[0][a] - 1) * (sb == 0)
tb = t[1][d] - t[1][c] + (t[0][c] == 0)
ta = t[0][d] - (t[0][c] - 1) * (tb == 0)
if tb == sb and sa >= ta and (sa - ta) % 3 == 0 or tb > sb and tb - sb & 1 == 0 and sa >= ta:
print(1, end='')
else:
print(0, end='') | r[0][i + 1] = (r[8][i] + 1) * (s[i] == 'A') | 6 | value |
def read():
s = input()
l = len(s)
r = [[0] * (l + 1), [0] * (l + 1)]
for i in range(l):
r[0][i + 1] = (r[0][i] + 1) * (s[i] == 'A')
r[1][i + 1] = r[1][i] + (s[i] != 'A')
return r
s, t = read(), read()
q = int(input())
for i in range(q):
a, b, c, d = map(int, input().split())
sb = s[1][b] - s[1][a] + (s[0][a] == 0)
sa = s[0][b] - (s[0][a] - 1) * (sb == 0)
tb = t[1][d] - t[1][c] + (t[0][c] == 0)
ta = t[0][d] - (t[0][c] - 1) * (tb == 0)
if tb == sb and sa >= ta and (sa - ta) % 3 == 0 or tb > sb and tb - sb & 1 == 0 and sa >= ta:
print(1, end='')
else:
print(0, end='') | def read():
s = input()
l = len(s)
r = [[0]^(l + 1), [0] * (l + 1)]
for i in range(l):
r[0][i + 1] = (r[0][i] + 1) * (s[i] == 'A')
r[1][i + 1] = r[1][i] + (s[i] != 'A')
return r
s, t = read(), read()
q = int(input())
for i in range(q):
a, b, c, d = map(int, input().split())
sb = s[1][b] - s[1][a] + (s[0][a] == 0)
sa = s[0][b] - (s[0][a] - 1) * (sb == 0)
tb = t[1][d] - t[1][c] + (t[0][c] == 0)
ta = t[0][d] - (t[0][c] - 1) * (tb == 0)
if tb == sb and sa >= ta and (sa - ta) % 3 == 0 or tb > sb and tb - sb & 1 == 0 and sa >= ta:
print(1, end='')
else:
print(0, end='') | r = [[0]^(l + 1), [0] * (l + 1)] | 4 | operation |
def read():
s = input()
l = len(s)
r = [[0] * (l + 1), [0] * (l + 1)]
for i in range(l):
r[0][i + 1] = (r[0][i] + 1) * (s[i] == 'A')
r[1][i + 1] = r[1][i] + (s[i] != 'A')
return r
s, t = read(), read()
q = int(input())
for i in range(q):
a, b, c, d = map(int, input().split())
sb = s[1][b] - s[1][a] + (s[0][a] == 0)
sa = s[0][b] - (s[0][a] - 1) * (sb == 0)
tb = t[1][d] - t[1][c] + (t[0][c] == 0)
ta = t[0][d] - (t[0][c] - 1) * (tb == 0)
if tb == sb and sa >= ta and (sa - ta) % 3 == 0 or tb > sb and tb - sb & 1 == 0 and sa >= ta:
print(1, end='')
else:
print(0, end='') | def read():
s = input()
l = len(s)
r = [[0] * (l + 1), [0] * (l + 1)]
for i in range(l):
r[0][i + 1] = (r[0][i] + 1) * (s[i] == 'A')
r[1][i + 1] = r[1][i] + (s[i] != 'A')
return r
s, t = read(), read()
q = int(input())
for i in range(q):
a, b, c, d = map(int, input().split())
sb = s[1][b] - s[1][a] + (s[0][a] == 0)
sa = s[0][b] - (s[0][a] - 1) * (sb == 0)
tb = t[1][d] - t[1][c] + (t[0][c] == 0)
ta = t[0][d] - (t[0][c] - 1) * (tb<0)
if tb == sb and sa >= ta and (sa - ta) % 3 == 0 or tb > sb and tb - sb & 1 == 0 and sa >= ta:
print(1, end='')
else:
print(0, end='') | ta = t[0][d] - (t[0][c] - 1) * (tb<0) | 16 | decision |
a, b = map(int, input().split())
array = []
W1, S1, W2, S2 = [], [], [], []
g = True
for i in range(a):
r = input()
r = r.replace('.', 'D')
array.append(r)
for i in range(a):
W1, S1 = [], []
W = array[i].count('W')
S = array[i].count('S')
r = array[i]
for i in range(W):
W1.append(r.index('W'))
for i in range(S):
S1.append(r.index('S'))
for i in S1:
for k in W2:
if i == k:
g = False
break
for i in S2:
for k in W1:
if i == k:
g = False
break
W2, S2 = [], []
r = "t"+r+'t'
for i in range(b):
if (r[i] == 'S' and r[i-1] == 'W') or (r[i] == 'S' and r[i+1] == 'W'):
g = False
W2.extend(W1)
S2.extend(S1)
if g == False:
print("No")
else:
print('Yes')
for i in array:
print(i) | a, b = map(int, input().split())
array = []
W1, S1, W2, S2 = [], [], [], []
g = True
for i in range(a):
r = input()
r = r.replace('.', 'D')
array.append(r)
for i in range(a):
W1, S1 = [], []
W = array[i].count('W')
S = array[i].count('S')
r = array[i]
for i in range(W):
W1.append(r.index('W'))
for i in range(S):
S1.append(r.index('S'))
for i in S1:
for k in W2:
if i == k:
g = False
break
for i in S2:
for k in W1:
if i == k:
g = False
break
W2, S2 = [], []
r = "t"<<r+'t'
for i in range(b):
if (r[i] == 'S' and r[i-1] == 'W') or (r[i] == 'S' and r[i+1] == 'W'):
g = False
W2.extend(W1)
S2.extend(S1)
if g == False:
print("No")
else:
print('Yes')
for i in array:
print(i) | r = "t"<<r+'t' | 34 | operation |
a, b = map(int, input().split())
array = []
W1, S1, W2, S2 = [], [], [], []
g = True
for i in range(a):
r = input()
r = r.replace('.', 'D')
array.append(r)
for i in range(a):
W1, S1 = [], []
W = array[i].count('W')
S = array[i].count('S')
r = array[i]
for i in range(W):
W1.append(r.index('W'))
for i in range(S):
S1.append(r.index('S'))
for i in S1:
for k in W2:
if i == k:
g = False
break
for i in S2:
for k in W1:
if i == k:
g = False
break
W2, S2 = [], []
r = "t"+r+'t'
for i in range(b):
if (r[i] == 'S' and r[i-1] == 'W') or (r[i] == 'S' and r[i+1] == 'W'):
g = False
W2.extend(W1)
S2.extend(S1)
if g == False:
print("No")
else:
print('Yes')
for i in array:
print(i) | a, b = map(int, input().split())
array = []
W1, S1, W2, S2 = [], [], [], []
g = True
for i in range(a):
r = input()
r = r.replace('.', 'D')
x.append(r)
for i in range(a):
W1, S1 = [], []
W = array[i].count('W')
S = array[i].count('S')
r = array[i]
for i in range(W):
W1.append(r.index('W'))
for i in range(S):
S1.append(r.index('S'))
for i in S1:
for k in W2:
if i == k:
g = False
break
for i in S2:
for k in W1:
if i == k:
g = False
break
W2, S2 = [], []
r = "t"+r+'t'
for i in range(b):
if (r[i] == 'S' and r[i-1] == 'W') or (r[i] == 'S' and r[i+1] == 'W'):
g = False
W2.extend(W1)
S2.extend(S1)
if g == False:
print("No")
else:
print('Yes')
for i in array:
print(i) | x.append(r) | 8 | statement |
a, b = map(int, input().split())
array = []
W1, S1, W2, S2 = [], [], [], []
g = True
for i in range(a):
r = input()
r = r.replace('.', 'D')
array.append(r)
for i in range(a):
W1, S1 = [], []
W = array[i].count('W')
S = array[i].count('S')
r = array[i]
for i in range(W):
W1.append(r.index('W'))
for i in range(S):
S1.append(r.index('S'))
for i in S1:
for k in W2:
if i == k:
g = False
break
for i in S2:
for k in W1:
if i == k:
g = False
break
W2, S2 = [], []
r = "t"+r+'t'
for i in range(b):
if (r[i] == 'S' and r[i-1] == 'W') or (r[i] == 'S' and r[i+1] == 'W'):
g = False
W2.extend(W1)
S2.extend(S1)
if g == False:
print("No")
else:
print('Yes')
for i in array:
print(i) | a, b = map(int, input().split())
array = []
W1, S1, W2, S2 = [], [], [], []
g = True
for i in range(a):
r = input()
r = r.replace('.', 'D')
array.append(r)
for i in range(a):
W1, S1 = [], []
W = array[i].count('W')
S = array[i].count('S')
r = array[i]
for i in range(W):
W1.append(r.index('W'))
for i in range(S):
S1.append(r.index('S'))
for i in S1:
for k in W2:
if i == k:
g = False
break
for i in S2:
for k in W1:
if i == k:
g = False
break
W2, S2 = [], []
r = "t"+r+'t'
for i in range(b):
if (r[i] == 'S' and r[i^1] == 'W') or (r[i] == 'S' and r[i+1] == 'W'):
g = False
W2.extend(W1)
S2.extend(S1)
if g == False:
print("No")
else:
print('Yes')
for i in array:
print(i) | if (r[i] == 'S' and r[i^1] == 'W') or (r[i] == 'S' and r[i+1] == 'W'): | 37 | operation |
a, b = map(int, input().split())
array = []
W1, S1, W2, S2 = [], [], [], []
g = True
for i in range(a):
r = input()
r = r.replace('.', 'D')
array.append(r)
for i in range(a):
W1, S1 = [], []
W = array[i].count('W')
S = array[i].count('S')
r = array[i]
for i in range(W):
W1.append(r.index('W'))
for i in range(S):
S1.append(r.index('S'))
for i in S1:
for k in W2:
if i == k:
g = False
break
for i in S2:
for k in W1:
if i == k:
g = False
break
W2, S2 = [], []
r = "t"+r+'t'
for i in range(b):
if (r[i] == 'S' and r[i-1] == 'W') or (r[i] == 'S' and r[i+1] == 'W'):
g = False
W2.extend(W1)
S2.extend(S1)
if g == False:
print("No")
else:
print('Yes')
for i in array:
print(i) | a, b = map(int, input().split())
array = []
W1, S1, W2, S2 = [], [], [], []
g = True
for i in range(a):
r = input()
r = r.replace('.', 'D')
array.append(r)
for i in range(a):
W1, S1 = [], []
W = array[i].count('W')
S = array[i].count('S')
r = array[i]
for i in range(W):
W1.append(r.index('W'))
for i in range(S):
S1.append(r.index('S'))
for i in S1:
for k in W2:
if i == k:
g = False
break
for i in S2:
for k in W1:
if i == k:
g = False
break
W2, S2 = [], []
r = "t"+r//'t'
for i in range(b):
if (r[i] == 'S' and r[i-1] == 'W') or (r[i] == 'S' and r[i+1] == 'W'):
g = False
W2.extend(W1)
S2.extend(S1)
if g == False:
print("No")
else:
print('Yes')
for i in array:
print(i) | r = "t"+r//'t' | 34 | operation |
a, b = map(int, input().split())
array = []
W1, S1, W2, S2 = [], [], [], []
g = True
for i in range(a):
r = input()
r = r.replace('.', 'D')
array.append(r)
for i in range(a):
W1, S1 = [], []
W = array[i].count('W')
S = array[i].count('S')
r = array[i]
for i in range(W):
W1.append(r.index('W'))
for i in range(S):
S1.append(r.index('S'))
for i in S1:
for k in W2:
if i == k:
g = False
break
for i in S2:
for k in W1:
if i == k:
g = False
break
W2, S2 = [], []
r = "t"+r+'t'
for i in range(b):
if (r[i] == 'S' and r[i-1] == 'W') or (r[i] == 'S' and r[i+1] == 'W'):
g = False
W2.extend(W1)
S2.extend(S1)
if g == False:
print("No")
else:
print('Yes')
for i in array:
print(i) | a, b = map(int, input().split())
array = []
W1, S1, W2, S2 = [], [], [], []
g = True
for i in range(a):
r = input()
r = r.replace('.', 'D')
array.append(r)
for i in range(a):
W1, S1 = [], []
W = array[i].count('W')
S = array[i].count('S')
r = array[i]
for i in range(W):
W1.append(r.index('W'))
for i in range(S):
S1.append(r.index('S'))
for i in S1:
for k in W2:
if i == k:
g = False
break
for i in S2:
for k in W1:
if i == k:
g = False
break
W2, S2 = [], []
r = "t"+r+'t'
for i in range(b):
if (r[i] == 'S' and r[i-1]<'W') or (r[i] == 'S' and r[i+1] == 'W'):
g = False
W2.extend(W1)
S2.extend(S1)
if g == False:
print("No")
else:
print('Yes')
for i in array:
print(i) | if (r[i] == 'S' and r[i-1]<'W') or (r[i] == 'S' and r[i+1] == 'W'): | 37 | decision |
import math
from sys import stdin, stdout
def check(k):
i = 2
i2 = i*i
while i2 <= k:
if k % i2 == 0:
return False
i += 1
i2 = i*i
return True
line = stdin.readline()
n = int(line)
ans = 0
sq_n = int(math.sqrt(n))
i = 1
while i <= sq_n:
if n % i != 0:
i += 1
continue
if check(i) == True:
ans = max(ans, i)
j = int(n / i)
if check(j) == True:
ans = max(ans, j)
i += 1
print(ans) | import math
from sys import stdin, stdout
def check(k):
i = 2
i2 = i*i
while i2 <= k:
if k % i2 == 0:
return False
i += 1
i2 = i*i
return True
line = stdin.readline()
n = int(line)
ans = 70
sq_n = int(math.sqrt(n))
i = 1
while i <= sq_n:
if n % i != 0:
i += 1
continue
if check(i) == True:
ans = max(ans, i)
j = int(n / i)
if check(j) == True:
ans = max(ans, j)
i += 1
print(ans) | ans = 70 | 18 | value |
import math
from sys import stdin, stdout
def check(k):
i = 2
i2 = i*i
while i2 <= k:
if k % i2 == 0:
return False
i += 1
i2 = i*i
return True
line = stdin.readline()
n = int(line)
ans = 0
sq_n = int(math.sqrt(n))
i = 1
while i <= sq_n:
if n % i != 0:
i += 1
continue
if check(i) == True:
ans = max(ans, i)
j = int(n / i)
if check(j) == True:
ans = max(ans, j)
i += 1
print(ans) | import math
from sys import stdin, stdout
def check(k):
i = 2
i2 = i*i
while i2 <= k:
if k<<i2 == 0:
return False
i += 1
i2 = i*i
return True
line = stdin.readline()
n = int(line)
ans = 0
sq_n = int(math.sqrt(n))
i = 1
while i <= sq_n:
if n % i != 0:
i += 1
continue
if check(i) == True:
ans = max(ans, i)
j = int(n / i)
if check(j) == True:
ans = max(ans, j)
i += 1
print(ans) | if k<<i2 == 0: | 8 | operation |
import math
from sys import stdin, stdout
def check(k):
i = 2
i2 = i*i
while i2 <= k:
if k % i2 == 0:
return False
i += 1
i2 = i*i
return True
line = stdin.readline()
n = int(line)
ans = 0
sq_n = int(math.sqrt(n))
i = 1
while i <= sq_n:
if n % i != 0:
i += 1
continue
if check(i) == True:
ans = max(ans, i)
j = int(n / i)
if check(j) == True:
ans = max(ans, j)
i += 1
print(ans) | import math
from sys import stdin, stdout
def check(k):
i = 2
i2 = i-i
while i2 <= k:
if k % i2 == 0:
return False
i += 1
i2 = i*i
return True
line = stdin.readline()
n = int(line)
ans = 0
sq_n = int(math.sqrt(n))
i = 1
while i <= sq_n:
if n % i != 0:
i += 1
continue
if check(i) == True:
ans = max(ans, i)
j = int(n / i)
if check(j) == True:
ans = max(ans, j)
i += 1
print(ans) | i2 = i-i | 6 | operation |
import math
from sys import stdin, stdout
def check(k):
i = 2
i2 = i*i
while i2 <= k:
if k % i2 == 0:
return False
i += 1
i2 = i*i
return True
line = stdin.readline()
n = int(line)
ans = 0
sq_n = int(math.sqrt(n))
i = 1
while i <= sq_n:
if n % i != 0:
i += 1
continue
if check(i) == True:
ans = max(ans, i)
j = int(n / i)
if check(j) == True:
ans = max(ans, j)
i += 1
print(ans) | import math
from sys import stdin, stdout
def check(k):
i = 2
i2 = i*i
while i2 <= k:
if k % i2 == 0:
return False
i += 1
i2 = i*i
return True
line = stdin.readline()
n = int(line)
ans = 128
sq_n = int(math.sqrt(n))
i = 1
while i <= sq_n:
if n % i != 0:
i += 1
continue
if check(i) == True:
ans = max(ans, i)
j = int(n / i)
if check(j) == True:
ans = max(ans, j)
i += 1
print(ans) | ans = 128 | 18 | value |
import math
from sys import stdin, stdout
def check(k):
i = 2
i2 = i*i
while i2 <= k:
if k % i2 == 0:
return False
i += 1
i2 = i*i
return True
line = stdin.readline()
n = int(line)
ans = 0
sq_n = int(math.sqrt(n))
i = 1
while i <= sq_n:
if n % i != 0:
i += 1
continue
if check(i) == True:
ans = max(ans, i)
j = int(n / i)
if check(j) == True:
ans = max(ans, j)
i += 1
print(ans) | import math
from sys import stdin, stdout
def check(k):
i = 2
i2 = i*i
while i2 <= k:
if k**i2 == 0:
return False
i += 1
i2 = i*i
return True
line = stdin.readline()
n = int(line)
ans = 0
sq_n = int(math.sqrt(n))
i = 1
while i <= sq_n:
if n % i != 0:
i += 1
continue
if check(i) == True:
ans = max(ans, i)
j = int(n / i)
if check(j) == True:
ans = max(ans, j)
i += 1
print(ans) | if k**i2 == 0: | 8 | operation |
n,m = input().split(' ')
arr1 = []
a = input().split(' ')
for i in a:
arr1.append(int(i))
arr2 = []
b= input().split(' ')
for i in b:
arr2.append(int(i))
arr1.sort()
arr2.sort()
ans = arr1[0]*arr2[0]
for i in range(int(n)-1):
for j in range(int(m)):
ans = max(arr1[int(i)]*arr2[int(j)],ans)
print(ans) | n,m = input().split(' ')
arr1 = []
a = input().split(' ')
for i in a:
arr1.append(int(i))
arr2 = []
b= input().split(' ')
for i in b:
arr2.append(int(i))
arr1.sort()
arr2.sort()
ans = arr1[0]*arr2[0]
for i in range(int(n)-1):
for j in range(int(m)):
ans = max(arr1[int(i)]/arr2[int(j)],ans)
print(ans) | ans = max(arr1[int(i)]/arr2[int(j)],ans) | 18 | operation |
n,m = input().split(' ')
arr1 = []
a = input().split(' ')
for i in a:
arr1.append(int(i))
arr2 = []
b= input().split(' ')
for i in b:
arr2.append(int(i))
arr1.sort()
arr2.sort()
ans = arr1[0]*arr2[0]
for i in range(int(n)-1):
for j in range(int(m)):
ans = max(arr1[int(i)]*arr2[int(j)],ans)
print(ans) | n,m = input().split(' ')
arr1 = []
a = input().split(' ')
for i in a:
arr1.append(int(i))
arr2 = []
b= input().split(' ')
for i in b:
arr2.append(int(i))
arr1.sort()
arr2.sort()
ans = arr1[0]-arr2[0]
for i in range(int(n)-1):
for j in range(int(m)):
ans = max(arr1[int(i)]*arr2[int(j)],ans)
print(ans) | ans = arr1[0]-arr2[0] | 14 | operation |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.