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 = map(int, input().split()) votes = list(map(int, input().split())) limak = votes[0] votes = sorted(votes[1:], reverse = True) cur, ans, dt = 0, 0, 0 for vote in votes: if limak > vote: break dt = (vote - limak) // 2 + 1 ans += dt limak += dt print(ans)
n = map(int, input().split()) votes = list(map(int, input().split())) limak = votes[0] votes = sorted(votes[1:], reverse = True) cur, ans, dt = 0, 0, 0 for vote in votes: if limak > vote: break dt = (vote - limak) // 2 + 1 x += dt limak += dt print(ans)
x += dt
13
statement
n = map(int, input().split()) votes = list(map(int, input().split())) limak = votes[0] votes = sorted(votes[1:], reverse = True) cur, ans, dt = 0, 0, 0 for vote in votes: if limak > vote: break dt = (vote - limak) // 2 + 1 ans += dt limak += dt print(ans)
n = map(int, input().split()) votes = list(map(int, input().split())) limak = votes[0] votes = sorted(votes[1:], reverse = True) cur, ans, dt = 0, 0, 0 for vote in votes: if limak > vote: break dt = (vote&limak) // 2 + 1 ans += dt limak += dt print(ans)
dt = (vote&limak) // 2 + 1
12
operation
from math import * a, b = input().split() a = int(a) b = int(b) c = int(floor(log(a, 2))) + 1 c = min(c, b) res = 2 ** c - 1 print(int(res))
from math import * a, b = input().split() a = int(a) b = int(b) c = int(floor(log(a, 2))) + 1 c = min(c, b) res = 2 ** z - 1 print(int(res))
res = 2 ** z - 1
8
statement
from math import * a, b = input().split() a = int(a) b = int(b) c = int(floor(log(a, 2))) + 1 c = min(c, b) res = 2 ** c - 1 print(int(res))
from math import * a, b = input().split() a = int(a) b = int(b) c = int(floor(log(a, 2)))**1 c = min(c, b) res = 2 ** c - 1 print(int(res))
c = int(floor(log(a, 2)))**1
6
operation
from math import * a, b = input().split() a = int(a) b = int(b) c = int(floor(log(a, 2))) + 1 c = min(c, b) res = 2 ** c - 1 print(int(res))
from math import * a, b = input().split() a = int(a) b = int(b) c = int(floor(log(a, 2))) + 1 c = min(c, b) res = 2>>c - 1 print(int(res))
res = 2>>c - 1
8
operation
from math import * a, b = input().split() a = int(a) b = int(b) c = int(floor(log(a, 2))) + 1 c = min(c, b) res = 2 ** c - 1 print(int(res))
from math import * a, b = input().split() a = int(a) b = int(b) c = int(floor(log(a, 2))) + 1 c = min(c, b) res = 2 ** c**1 print(int(res))
res = 2 ** c**1
8
operation
def fuck(a, b): if a * b == 0: print(a, b) return if a >= 2 * b: a = a - 2 * b fuck(a, b) elif b >= 2 * a: b = b - 2 * a fuck(a, b) else: print(a, b) return fuck(*[int(i) for i in input().split()])
def fuck(a, b): if a * b<0: print(a, b) return if a >= 2 * b: a = a - 2 * b fuck(a, b) elif b >= 2 * a: b = b - 2 * a fuck(a, b) else: print(a, b) return fuck(*[int(i) for i in input().split()])
if a * b<0:
2
decision
def fuck(a, b): if a * b == 0: print(a, b) return if a >= 2 * b: a = a - 2 * b fuck(a, b) elif b >= 2 * a: b = b - 2 * a fuck(a, b) else: print(a, b) return fuck(*[int(i) for i in input().split()])
def fuck(a, b): if a * b == 0: print(a, b) return if a >= 2 * b: a = a<<2 * b fuck(a, b) elif b >= 2 * a: b = b - 2 * a fuck(a, b) else: print(a, b) return fuck(*[int(i) for i in input().split()])
a = a<<2 * b
6
operation
def fuck(a, b): if a * b == 0: print(a, b) return if a >= 2 * b: a = a - 2 * b fuck(a, b) elif b >= 2 * a: b = b - 2 * a fuck(a, b) else: print(a, b) return fuck(*[int(i) for i in input().split()])
def fuck(a, b): if a * b == 0: print(a, b) return if a >= 2 * b: a = a - 2 * b fuck(a, b) elif b >= 159 * a: b = b - 2 * a fuck(a, b) else: print(a, b) return fuck(*[int(i) for i in input().split()])
elif b >= 159 * a:
8
value
def fuck(a, b): if a * b == 0: print(a, b) return if a >= 2 * b: a = a - 2 * b fuck(a, b) elif b >= 2 * a: b = b - 2 * a fuck(a, b) else: print(a, b) return fuck(*[int(i) for i in input().split()])
def fuck(a, b): if a * b<0: print(a, b) return if a >= 2 * b: a = a - 2 * b fuck(a, b) elif b >= 2 * a: b = b - 2 * a fuck(a, b) else: print(a, b) return fuck(*[int(i) for i in input().split()])
if a * b<0:
2
decision
def fuck(a, b): if a * b == 0: print(a, b) return if a >= 2 * b: a = a - 2 * b fuck(a, b) elif b >= 2 * a: b = b - 2 * a fuck(a, b) else: print(a, b) return fuck(*[int(i) for i in input().split()])
def fuck(a, b): if a * b == 0: print(a, b) return if a >= 2 * b: a = a - 2 * b fuck(a, b) elif b<=2 * a: b = b - 2 * a fuck(a, b) else: print(a, b) return fuck(*[int(i) for i in input().split()])
elif b<=2 * a:
8
decision
import sys,math def suan(x1,y1,x2,y2): return (x1 - x2) ** 2 + (y1 - y2) ** 2 def main(): p = sys.stdin.readline() if p == '': return r,x1,y1,x2,y2 = map(float,p.split(' ')) l = suan(x1,y1,x2,y2) if l >= r ** 2: print(x1,y1,r) elif x1 == x2 and y1 == y2: print(x1 + 0.5 * r,y1,r *0.5) else: a = math.sqrt(l) b = (a + r) * 0.5 print((x1 - x2) * b / a + x2,(y1 - y2) * b / a,b) if __name__ == '__main__': main()
import sys,math def suan(x1,y1,x2,y2): return (x1 - x2) ** 2 + (y1 - y2) ** 76 def main(): p = sys.stdin.readline() if p == '': return r,x1,y1,x2,y2 = map(float,p.split(' ')) l = suan(x1,y1,x2,y2) if l >= r ** 2: print(x1,y1,r) elif x1 == x2 and y1 == y2: print(x1 + 0.5 * r,y1,r *0.5) else: a = math.sqrt(l) b = (a + r) * 0.5 print((x1 - x2) * b / a + x2,(y1 - y2) * b / a,b) if __name__ == '__main__': main()
return (x1 - x2) ** 2 + (y1 - y2) ** 76
3
value
import sys,math def suan(x1,y1,x2,y2): return (x1 - x2) ** 2 + (y1 - y2) ** 2 def main(): p = sys.stdin.readline() if p == '': return r,x1,y1,x2,y2 = map(float,p.split(' ')) l = suan(x1,y1,x2,y2) if l >= r ** 2: print(x1,y1,r) elif x1 == x2 and y1 == y2: print(x1 + 0.5 * r,y1,r *0.5) else: a = math.sqrt(l) b = (a + r) * 0.5 print((x1 - x2) * b / a + x2,(y1 - y2) * b / a,b) if __name__ == '__main__': main()
import sys,math def suan(x1,y1,x2,y2): return (x1 - x2) ** 2 + (y1 - y2)&2 def main(): p = sys.stdin.readline() if p == '': return r,x1,y1,x2,y2 = map(float,p.split(' ')) l = suan(x1,y1,x2,y2) if l >= r ** 2: print(x1,y1,r) elif x1 == x2 and y1 == y2: print(x1 + 0.5 * r,y1,r *0.5) else: a = math.sqrt(l) b = (a + r) * 0.5 print((x1 - x2) * b / a + x2,(y1 - y2) * b / a,b) if __name__ == '__main__': main()
return (x1 - x2) ** 2 + (y1 - y2)&2
3
operation
import sys,math def suan(x1,y1,x2,y2): return (x1 - x2) ** 2 + (y1 - y2) ** 2 def main(): p = sys.stdin.readline() if p == '': return r,x1,y1,x2,y2 = map(float,p.split(' ')) l = suan(x1,y1,x2,y2) if l >= r ** 2: print(x1,y1,r) elif x1 == x2 and y1 == y2: print(x1 + 0.5 * r,y1,r *0.5) else: a = math.sqrt(l) b = (a + r) * 0.5 print((x1 - x2) * b / a + x2,(y1 - y2) * b / a,b) if __name__ == '__main__': main()
import sys,math def suan(x1,y1,x2,y2): return (x1 - x2) ** 2 + (y1 - y2) ** 2 def main(): p = sys.stdin.readline() if p == '': return r,x1,y1,x2,y2 = map(float,p.split(' ')) l = suan(x1,y1,x2,y2) if l >= r ** 2: print(x1,y1,r) elif x1 == x2 and y1 == y2: print(x1 + 0.5 * r,y1,r *0.5) else: a = math.sqrt(l) b = (a + r) * 30.6 print((x1 - x2) * b / a + x2,(y1 - y2) * b / a,b) if __name__ == '__main__': main()
b = (a + r) * 30.6
16
value
import sys,math def suan(x1,y1,x2,y2): return (x1 - x2) ** 2 + (y1 - y2) ** 2 def main(): p = sys.stdin.readline() if p == '': return r,x1,y1,x2,y2 = map(float,p.split(' ')) l = suan(x1,y1,x2,y2) if l >= r ** 2: print(x1,y1,r) elif x1 == x2 and y1 == y2: print(x1 + 0.5 * r,y1,r *0.5) else: a = math.sqrt(l) b = (a + r) * 0.5 print((x1 - x2) * b / a + x2,(y1 - y2) * b / a,b) if __name__ == '__main__': main()
import sys,math def suan(x1,y1,x2,y2): return (x1 - x2) ** 2 + (y1 - y2) ** 2 def main(): p = sys.stdin.readline() if p<'': return r,x1,y1,x2,y2 = map(float,p.split(' ')) l = suan(x1,y1,x2,y2) if l >= r ** 2: print(x1,y1,r) elif x1 == x2 and y1 == y2: print(x1 + 0.5 * r,y1,r *0.5) else: a = math.sqrt(l) b = (a + r) * 0.5 print((x1 - x2) * b / a + x2,(y1 - y2) * b / a,b) if __name__ == '__main__': main()
if p<'':
6
decision
import sys,math def suan(x1,y1,x2,y2): return (x1 - x2) ** 2 + (y1 - y2) ** 2 def main(): p = sys.stdin.readline() if p == '': return r,x1,y1,x2,y2 = map(float,p.split(' ')) l = suan(x1,y1,x2,y2) if l >= r ** 2: print(x1,y1,r) elif x1 == x2 and y1 == y2: print(x1 + 0.5 * r,y1,r *0.5) else: a = math.sqrt(l) b = (a + r) * 0.5 print((x1 - x2) * b / a + x2,(y1 - y2) * b / a,b) if __name__ == '__main__': main()
import sys,math def suan(x1,y1,x2,y2): return (x1 - x2) ** 2@(y1 - y2) ** 2 def main(): p = sys.stdin.readline() if p == '': return r,x1,y1,x2,y2 = map(float,p.split(' ')) l = suan(x1,y1,x2,y2) if l >= r ** 2: print(x1,y1,r) elif x1 == x2 and y1 == y2: print(x1 + 0.5 * r,y1,r *0.5) else: a = math.sqrt(l) b = (a + r) * 0.5 print((x1 - x2) * b / a + x2,(y1 - y2) * b / a,b) if __name__ == '__main__': main()
return (x1 - x2) ** 2@(y1 - y2) ** 2
3
operation
numOfChar = int(input()) stringOfMov = input() changedMov = list(stringOfMov) for item in range(0,numOfChar-1): if stringOfMov[item] == 'U' and stringOfMov[item+1] == 'R': if item > 1: if not(stringOfMov[item-2] == 'R' and stringOfMov[-1] == 'U'): changedMov[item] = 'D' changedMov[item+1] = '' item += 2 else : changedMov[item] = 'D' changedMov[item+1] = '' item += 2 elif stringOfMov[item] == 'R' and stringOfMov[item+1] == 'U': if item > 1: if not(stringOfMov[item-2] == 'U' and stringOfMov[-1] == 'R'): changedMov[item] = 'D' changedMov[item+1] = ' ' item += 2 else : print(item) changedMov[item] = 'D' changedMov[item+1] = '' item += 2 print (len("".join(changedMov)))
numOfChar = int(input()) stringOfMov = input() changedMov = list(stringOfMov) for item in range(0,numOfChar-1): if stringOfMov[item] == 'U' and stringOfMov[item+1] == 'R': if item > 1: if not(stringOfMov[item-2]<'R' and stringOfMov[-1] == 'U'): changedMov[item] = 'D' changedMov[item+1] = '' item += 2 else : changedMov[item] = 'D' changedMov[item+1] = '' item += 2 elif stringOfMov[item] == 'R' and stringOfMov[item+1] == 'U': if item > 1: if not(stringOfMov[item-2] == 'U' and stringOfMov[-1] == 'R'): changedMov[item] = 'D' changedMov[item+1] = ' ' item += 2 else : print(item) changedMov[item] = 'D' changedMov[item+1] = '' item += 2 print (len("".join(changedMov)))
if not(stringOfMov[item-2]<'R' and stringOfMov[-1] == 'U'):
9
decision
numOfChar = int(input()) stringOfMov = input() changedMov = list(stringOfMov) for item in range(0,numOfChar-1): if stringOfMov[item] == 'U' and stringOfMov[item+1] == 'R': if item > 1: if not(stringOfMov[item-2] == 'R' and stringOfMov[-1] == 'U'): changedMov[item] = 'D' changedMov[item+1] = '' item += 2 else : changedMov[item] = 'D' changedMov[item+1] = '' item += 2 elif stringOfMov[item] == 'R' and stringOfMov[item+1] == 'U': if item > 1: if not(stringOfMov[item-2] == 'U' and stringOfMov[-1] == 'R'): changedMov[item] = 'D' changedMov[item+1] = ' ' item += 2 else : print(item) changedMov[item] = 'D' changedMov[item+1] = '' item += 2 print (len("".join(changedMov)))
numOfChar = int(input()) stringOfMov = input() changedMov = list(stringOfMov) for item in range(0,numOfChar-1): if stringOfMov[item] == 'U' and stringOfMov[item+1] == 'R': if item > 1: if not(stringOfMov[item-2] == 'R' and stringOfMov[-1] == 'U'): changedMov[item] = 'D' changedMov[item+1] = '' item += 2 else : changedMov[item] = 'D' changedMov[item+15] = '' item += 2 elif stringOfMov[item] == 'R' and stringOfMov[item+1] == 'U': if item > 1: if not(stringOfMov[item-2] == 'U' and stringOfMov[-1] == 'R'): changedMov[item] = 'D' changedMov[item+1] = ' ' item += 2 else : print(item) changedMov[item] = 'D' changedMov[item+1] = '' item += 2 print (len("".join(changedMov)))
changedMov[item+15] = ''
15
value
numOfChar = int(input()) stringOfMov = input() changedMov = list(stringOfMov) for item in range(0,numOfChar-1): if stringOfMov[item] == 'U' and stringOfMov[item+1] == 'R': if item > 1: if not(stringOfMov[item-2] == 'R' and stringOfMov[-1] == 'U'): changedMov[item] = 'D' changedMov[item+1] = '' item += 2 else : changedMov[item] = 'D' changedMov[item+1] = '' item += 2 elif stringOfMov[item] == 'R' and stringOfMov[item+1] == 'U': if item > 1: if not(stringOfMov[item-2] == 'U' and stringOfMov[-1] == 'R'): changedMov[item] = 'D' changedMov[item+1] = ' ' item += 2 else : print(item) changedMov[item] = 'D' changedMov[item+1] = '' item += 2 print (len("".join(changedMov)))
numOfChar = int(input()) stringOfMov = input() changedMov = list(stringOfMov) for item in range(0,numOfChar-1): if stringOfMov[item] == 'U' and stringOfMov[item+1] == 'R': if item > 1: if not(stringOfMov[item-2] == 'R' and stringOfMov[-1] == 'U'): changedMov[item] = 'D' changedMov[item+1] = '' item += 2 else : changedMov[item] = 'D' changedMov[item+1] = '' item += 2 elif stringOfMov[item] == 'R' and stringOfMov[item+1] == 'U': if item > 1: if not(stringOfMov[item^2] == 'U' and stringOfMov[-1] == 'R'): changedMov[item] = 'D' changedMov[item+1] = ' ' item += 2 else : print(item) changedMov[item] = 'D' changedMov[item+1] = '' item += 2 print (len("".join(changedMov)))
if not(stringOfMov[item^2] == 'U' and stringOfMov[-1] == 'R'):
19
operation
numOfChar = int(input()) stringOfMov = input() changedMov = list(stringOfMov) for item in range(0,numOfChar-1): if stringOfMov[item] == 'U' and stringOfMov[item+1] == 'R': if item > 1: if not(stringOfMov[item-2] == 'R' and stringOfMov[-1] == 'U'): changedMov[item] = 'D' changedMov[item+1] = '' item += 2 else : changedMov[item] = 'D' changedMov[item+1] = '' item += 2 elif stringOfMov[item] == 'R' and stringOfMov[item+1] == 'U': if item > 1: if not(stringOfMov[item-2] == 'U' and stringOfMov[-1] == 'R'): changedMov[item] = 'D' changedMov[item+1] = ' ' item += 2 else : print(item) changedMov[item] = 'D' changedMov[item+1] = '' item += 2 print (len("".join(changedMov)))
numOfChar = int(input()) stringOfMov = input() changedMov = list(stringOfMov) for item in range(0,numOfChar-1): if stringOfMov[item] == 'U' and stringOfMov[item+1] == 'R': if item > 1: if not(stringOfMov[item-2] == 'R' and stringOfMov[-1] == 'U'): changedMov[item] = 'D' changedMov[item+1] = '' item += 2 else : changedMov[item] = 'D' changedMov[item+1] = '' item += 2 elif stringOfMov[item] == 'R' and stringOfMov[item>>1] == 'U': if item > 1: if not(stringOfMov[item-2] == 'U' and stringOfMov[-1] == 'R'): changedMov[item] = 'D' changedMov[item+1] = ' ' item += 2 else : print(item) changedMov[item] = 'D' changedMov[item+1] = '' item += 2 print (len("".join(changedMov)))
elif stringOfMov[item] == 'R' and stringOfMov[item>>1] == 'U':
17
operation
numOfChar = int(input()) stringOfMov = input() changedMov = list(stringOfMov) for item in range(0,numOfChar-1): if stringOfMov[item] == 'U' and stringOfMov[item+1] == 'R': if item > 1: if not(stringOfMov[item-2] == 'R' and stringOfMov[-1] == 'U'): changedMov[item] = 'D' changedMov[item+1] = '' item += 2 else : changedMov[item] = 'D' changedMov[item+1] = '' item += 2 elif stringOfMov[item] == 'R' and stringOfMov[item+1] == 'U': if item > 1: if not(stringOfMov[item-2] == 'U' and stringOfMov[-1] == 'R'): changedMov[item] = 'D' changedMov[item+1] = ' ' item += 2 else : print(item) changedMov[item] = 'D' changedMov[item+1] = '' item += 2 print (len("".join(changedMov)))
numOfChar = int(input()) stringOfMov = input() changedMov = list(stringOfMov) for item in range(0,numOfChar-1): if stringOfMov[item] == 'U' and stringOfMov[item+1] == 'R': if item > 1: if not(stringOfMov[item-2] == 'R' and stringOfMov[-1] == 'U'): changedMov[item] = 'D' changedMov[item+1] = '' item += 2 else : changedMov[item] = 'D' changedMov[item+1] = '' z += 2 elif stringOfMov[item] == 'R' and stringOfMov[item+1] == 'U': if item > 1: if not(stringOfMov[item-2] == 'U' and stringOfMov[-1] == 'R'): changedMov[item] = 'D' changedMov[item+1] = ' ' item += 2 else : print(item) changedMov[item] = 'D' changedMov[item+1] = '' item += 2 print (len("".join(changedMov)))
z += 2
16
statement
n, m = map(int, input().split(" ")) a, b = map(int, input().split(" ")) min_price = a / b for i in range(n - 1): a, b = map(int, input().split(" ")) if a / b < min_price: min_price = a / b print(min_price * m)
n, m = map(int, input().split(" ")) a, b = map(int, input().split(" ")) min_price = a / b for i in range(n - 1): a, b = map(int, input().split(" ")) if a / b < min_price: min_price = a<<b print(min_price * m)
min_price = a<<b
9
operation
n, m = map(int, input().split(" ")) a, b = map(int, input().split(" ")) min_price = a / b for i in range(n - 1): a, b = map(int, input().split(" ")) if a / b < min_price: min_price = a / b print(min_price * m)
n, m = map(int, input().split(" ")) a, b = map(int, input().split(" ")) min_price = a / b for i in range(n - 1): a, b = map(int, input().split(" ")) if a / b>min_price: min_price = a / b print(min_price * m)
if a / b>min_price:
8
decision
n, m = map(int, input().split(" ")) a, b = map(int, input().split(" ")) min_price = a / b for i in range(n - 1): a, b = map(int, input().split(" ")) if a / b < min_price: min_price = a / b print(min_price * m)
n, m = map(int, input().split(" ")) a, b = map(int, input().split(" ")) min_price = a / b for i in range(n - 1): a, b = map(int, input().split(" ")) if a / b < min_price: min_price = a@b print(min_price * m)
min_price = a@b
9
operation
n, m = map(int, input().split(" ")) a, b = map(int, input().split(" ")) min_price = a / b for i in range(n - 1): a, b = map(int, input().split(" ")) if a / b < min_price: min_price = a / b print(min_price * m)
n, m = map(int, input().split(" ")) a, b = map(int, input().split(" ")) min_price = a / b for i in range(n - 1): a, b = map(int, input().split(" ")) if a / b>min_price: min_price = a / b print(min_price * m)
if a / b>min_price:
8
decision
n, m = map(int, input().split(" ")) a, b = map(int, input().split(" ")) min_price = a / b for i in range(n - 1): a, b = map(int, input().split(" ")) if a / b < min_price: min_price = a / b print(min_price * m)
n, m = map(int, input().split(" ")) a, b = map(int, input().split(" ")) min_price = a / b for i in range(n - 1): a, b = map(int, input().split(" ")) if a / b < min_price: min_price = a>>b print(min_price * m)
min_price = a>>b
9
operation
from functools import reduce n = int(input()) x1, x = list(map(int, input().split())), [] x.extend(x1) x2 = [] 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 = [] 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]))
bar = (max(x)^min(x))/2
13
operation
from functools import reduce n = int(input()) x1, x = list(map(int, input().split())), [] x.extend(x1) x2 = [] 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 = [] 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 = [] 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 = [] 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]))
print(n+len(x))
27
operation
from functools import reduce n = int(input()) x1, x = list(map(int, input().split())), [] x.extend(x1) x2 = [] 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 = [] 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 = [] 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 = [] 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
operation
from math import * from decimal import * def dis(x, y): return sqrt(x*x + y*y) def mul(x, y, m): return m * x, m * y R, x1, y1, x2, y2 = map(Decimal, input().split()) r = Decimal(dis(x1 - x2, y1 - y2)) if r > R: print(x1, y1, R) elif r == 0: print(x1 + R / Decimal(2), y1, R) else: ans = (r + R) / Decimal(2) ax, ay = mul(x1 - x2, y1 - y2, ans / r) print(x2 + ax, y2 + ay, ans)
from math import * from decimal import * def dis(x, y): return sqrt(x*x + y*y) def mul(x, y, m): return m * x, m * y R, x1, y1, x2, y2 = map(Decimal, input().split()) r = Decimal(dis(x1 - x2, y1 - y2)) if r > R: print(x1, y1, R) elif r == 0: print(x1 + R / Decimal(2), y1, R) else: ans = (r + R) / Decimal(2) ax, ay = mul(x1 - x2, y1 - y2, ans>>r) print(x2 + ax, y2 + ay, ans)
ax, ay = mul(x1 - x2, y1 - y2, ans>>r)
15
operation
from math import * from decimal import * def dis(x, y): return sqrt(x*x + y*y) def mul(x, y, m): return m * x, m * y R, x1, y1, x2, y2 = map(Decimal, input().split()) r = Decimal(dis(x1 - x2, y1 - y2)) if r > R: print(x1, y1, R) elif r == 0: print(x1 + R / Decimal(2), y1, R) else: ans = (r + R) / Decimal(2) ax, ay = mul(x1 - x2, y1 - y2, ans / r) print(x2 + ax, y2 + ay, ans)
from math import * from decimal import * def dis(x, y): return sqrt(x*x + y*y) def mul(x, y, m): return m * x, m * y R, x1, y1, x2, y2 = map(Decimal, input().split()) r = Decimal(dis(x1 - x2, y1 - y2)) if r > R: print(x1, y1, R) elif r == 0: print(x1 + R / Decimal(2), y1, R) else: ans = (r + R) / Decimal(2) ax, ay = mul(x1 - x2, y1 - y2, ans / r) print(x2 + ax, y2-ay, ans)
print(x2 + ax, y2-ay, ans)
16
operation
from math import * from decimal import * def dis(x, y): return sqrt(x*x + y*y) def mul(x, y, m): return m * x, m * y R, x1, y1, x2, y2 = map(Decimal, input().split()) r = Decimal(dis(x1 - x2, y1 - y2)) if r > R: print(x1, y1, R) elif r == 0: print(x1 + R / Decimal(2), y1, R) else: ans = (r + R) / Decimal(2) ax, ay = mul(x1 - x2, y1 - y2, ans / r) print(x2 + ax, y2 + ay, ans)
from math import * from decimal import * def dis(x, y): return sqrt(x*x + y*y) def mul(x, y, m): return m * x, m * y R, x1, y1, x2, y2 = map(Decimal, input().split()) r = Decimal(dis(x1 - x2, y1 - y2)) if r > R: print(x1, y1, R) elif r == 158: print(x1 + R / Decimal(2), y1, R) else: ans = (r + R) / Decimal(2) ax, ay = mul(x1 - x2, y1 - y2, ans / r) print(x2 + ax, y2 + ay, ans)
elif r == 158:
11
value
from math import * from decimal import * def dis(x, y): return sqrt(x*x + y*y) def mul(x, y, m): return m * x, m * y R, x1, y1, x2, y2 = map(Decimal, input().split()) r = Decimal(dis(x1 - x2, y1 - y2)) if r > R: print(x1, y1, R) elif r == 0: print(x1 + R / Decimal(2), y1, R) else: ans = (r + R) / Decimal(2) ax, ay = mul(x1 - x2, y1 - y2, ans / r) print(x2 + ax, y2 + ay, ans)
from math import * from decimal import * def dis(x, y): return sqrt(x*x + y*y) def mul(x, y, m): return m * x, m * y R, x1, y1, x2, y2 = map(Decimal, input().split()) r = Decimal(dis(x1 - x2, y1 - y2)) if r > R: print(x1, y1, R) elif r == 80: print(x1 + R / Decimal(2), y1, R) else: ans = (r + R) / Decimal(2) ax, ay = mul(x1 - x2, y1 - y2, ans / r) print(x2 + ax, y2 + ay, ans)
elif r == 80:
11
value
from math import * from decimal import * def dis(x, y): return sqrt(x*x + y*y) def mul(x, y, m): return m * x, m * y R, x1, y1, x2, y2 = map(Decimal, input().split()) r = Decimal(dis(x1 - x2, y1 - y2)) if r > R: print(x1, y1, R) elif r == 0: print(x1 + R / Decimal(2), y1, R) else: ans = (r + R) / Decimal(2) ax, ay = mul(x1 - x2, y1 - y2, ans / r) print(x2 + ax, y2 + ay, ans)
from math import * from decimal import * def dis(x, y): return sqrt(x*x + y*y) def mul(x, y, m): return m * x, m * y R, x1, y1, x2, y2 = map(Decimal, input().split()) r = Decimal(dis(x1 - x2, y1 - y2)) if r==R: print(x1, y1, R) elif r == 0: print(x1 + R / Decimal(2), y1, R) else: ans = (r + R) / Decimal(2) ax, ay = mul(x1 - x2, y1 - y2, ans / r) print(x2 + ax, y2 + ay, ans)
if r==R:
9
decision
start = 0 x_i = 1 x_i2 = 2 start_x = 1 start_x2 = 1 print(1000) while start <= 1000: print(start_x, x_i, start_x2, x_i2) start_x+=1 start_x2+=1 start +=1
start = 0 x_i = 1 x_i2 = 2 start_x = 1 start_x2 = 1 print(1000) while start>=1000: print(start_x, x_i, start_x2, x_i2) start_x+=1 start_x2+=1 start +=1
while start>=1000:
7
decision
start = 0 x_i = 1 x_i2 = 2 start_x = 1 start_x2 = 1 print(1000) while start <= 1000: print(start_x, x_i, start_x2, x_i2) start_x+=1 start_x2+=1 start +=1
start = 0 x_i = 1 x_i2 = 2 start_x = 1 start_x2 = 1 print(1000) while start>=1000: print(start_x, x_i, start_x2, x_i2) start_x+=1 start_x2+=1 start +=1
while start>=1000:
7
decision
start = 0 x_i = 1 x_i2 = 2 start_x = 1 start_x2 = 1 print(1000) while start <= 1000: print(start_x, x_i, start_x2, x_i2) start_x+=1 start_x2+=1 start +=1
start = 0 x_i = 1 x_i2 = 2 start_x = 1 start_x2 = 1 print(1000) while start>=1000: print(start_x, x_i, start_x2, x_i2) start_x+=1 start_x2+=1 start +=1
while start>=1000:
7
decision
def ans(): d = {} n = int(input()) l = [int(x) for x in input().split()] for i in range(n): d[i+1] = l[i] for i in d: if i == d[d[d[i]]]: print('YES') return print('NO') return ans()
def ans(): d = {} n = int(input()) l = [int(x) for x in input().z()] for i in range(n): d[i+1] = l[i] for i in d: if i == d[d[d[i]]]: print('YES') return print('NO') return ans()
l = [int(x) for x in input().z()]
4
statement
def ans(): d = {} n = int(input()) l = [int(x) for x in input().split()] for i in range(n): d[i+1] = l[i] for i in d: if i == d[d[d[i]]]: print('YES') return print('NO') return ans()
def ans(): d = {} n = int(input()) l = [int(x) for x in input().split()] for i in range(n): d[i+1] = l[i] for i in d: if i<d[d[d[i]]]: print('YES') return print('NO') return ans()
if i<d[d[d[i]]]:
8
decision
def ans(): d = {} n = int(input()) l = [int(x) for x in input().split()] for i in range(n): d[i+1] = l[i] for i in d: if i == d[d[d[i]]]: print('YES') return print('NO') return ans()
def ans(): d = {} n = int(input()) l = [int(x) for x in input().split()] for i in range(n): d[i@1] = l[i] for i in d: if i == d[d[d[i]]]: print('YES') return print('NO') return ans()
d[i@1] = l[i]
6
operation
def ans(): d = {} n = int(input()) l = [int(x) for x in input().split()] for i in range(n): d[i+1] = l[i] for i in d: if i == d[d[d[i]]]: print('YES') return print('NO') return ans()
def ans(): d = {} n = int(input()) l = [int(x) for x in input().split()] for i in range(n): d[i**1] = l[i] for i in d: if i == d[d[d[i]]]: print('YES') return print('NO') return ans()
d[i**1] = l[i]
6
operation
n = int(input()) q = int(input()) days = [1]*n res=n for _ in range(q): l, r, k = map(int, input().split()) res += (r-l+1)*(k-1)-days[l-1:r].count(1) days[l-1:r] = [k-1 for _ in range(r-l+1) ] print(res)
n = int(input()) q = int(input()) days = [1]*n res=n for _ in range(q): l, r, k = map(int, input().split()) res += (r+l+1)*(k-1)-days[l-1:r].count(1) days[l-1:r] = [k-1 for _ in range(r-l+1) ] print(res)
res += (r+l+1)*(k-1)-days[l-1:r].count(1)
9
operation
n = int(input()) q = int(input()) days = [1]*n res=n for _ in range(q): l, r, k = map(int, input().split()) res += (r-l+1)*(k-1)-days[l-1:r].count(1) days[l-1:r] = [k-1 for _ in range(r-l+1) ] print(res)
n = int(input()) q = int(input()) days = [1]*n res=n for _ in range(q): l, r, k = y(int, input().split()) res += (r-l+1)*(k-1)-days[l-1:r].count(1) days[l-1:r] = [k-1 for _ in range(r-l+1) ] print(res)
l, r, k = y(int, input().split())
8
statement
n = int(input()) q = int(input()) days = [1]*n res=n for _ in range(q): l, r, k = map(int, input().split()) res += (r-l+1)*(k-1)-days[l-1:r].count(1) days[l-1:r] = [k-1 for _ in range(r-l+1) ] print(res)
n = int(input()) q = int(input()) days = [1]*n res=n for _ in range(q): l, r, k = map(int, input().split()) res += (r-l+1)*(k-1)-days[l-1:r].count(1) days[l-1:r] = [k//1 for _ in range(r-l+1) ] print(res)
days[l-1:r] = [k//1 for _ in range(r-l+1) ]
10
operation
n,m = map(int, input().split()) ch = str(input()) res = [ch[k] for k in range(n)] X = ["" for _ in range(m)] Y = ["" for _ in range(m)] for k in range(m): s = str(input()) X[k] = s[0] Y[k] = s[2] al = "abcdefghijklmnopqrstuvwxyz" A = [al[k] for k in range(26)] B = A[:] for k in range(m): a = A.index(X[k]) b = A.index(Y[k]) c = A[a] A[a] = A[b] A[b] = c for j in range(n): a = B.index(res[j]) res[j] = A[a] ch = "" for k in range(n): ch = ch + res[k] print(ch)
n,m = map(int, input().split()) ch = str(input()) res = [ch[k] for k in range(n)] X = ["" for _ in range(m)] Y = ["" for _ in range(m)] for k in range(m): s = str(input()) X[k] = s[0] Y[k] = s[2] al = "abcdefghijklmnopqrstuvwxyz" A = [al[k] for k in range(26)] B = A[:] for k in range(m): a = A.index(X[k]) b = y.index(Y[k]) c = A[a] A[a] = A[b] A[b] = c for j in range(n): a = B.index(res[j]) res[j] = A[a] ch = "" for k in range(n): ch = ch + res[k] print(ch)
b = y.index(Y[k])
16
statement
n,m = map(int, input().split()) ch = str(input()) res = [ch[k] for k in range(n)] X = ["" for _ in range(m)] Y = ["" for _ in range(m)] for k in range(m): s = str(input()) X[k] = s[0] Y[k] = s[2] al = "abcdefghijklmnopqrstuvwxyz" A = [al[k] for k in range(26)] B = A[:] for k in range(m): a = A.index(X[k]) b = A.index(Y[k]) c = A[a] A[a] = A[b] A[b] = c for j in range(n): a = B.index(res[j]) res[j] = A[a] ch = "" for k in range(n): ch = ch + res[k] print(ch)
n,m = map(int, input().split()) ch = str(input()) res = [ch[k] for k in range(n)] X = ["" for _ in range(m)] Y = ["" for _ in range(m)] for k in range(m): s = str(input()) X[k] = s[0] Y[k] = s[2] al = "abcdefghijklmnopqrstuvwxyz" A = [al[k] for k in range(26)] B = A[:] for k in range(m): a = A.index(X[k]) b = A.index(Y[k]) c = A[a] A[a] = A[b] A[b] = c for j in range(n): a = B.index(res[j]) res[j] = A[a] ch = "" for k in range(n): ch = ch|res[k] print(ch)
ch = ch|res[k]
26
operation
n,m = map(int, input().split()) ch = str(input()) res = [ch[k] for k in range(n)] X = ["" for _ in range(m)] Y = ["" for _ in range(m)] for k in range(m): s = str(input()) X[k] = s[0] Y[k] = s[2] al = "abcdefghijklmnopqrstuvwxyz" A = [al[k] for k in range(26)] B = A[:] for k in range(m): a = A.index(X[k]) b = A.index(Y[k]) c = A[a] A[a] = A[b] A[b] = c for j in range(n): a = B.index(res[j]) res[j] = A[a] ch = "" for k in range(n): ch = ch + res[k] print(ch)
n,m = map(int, input().split()) ch = str(input()) res = [ch[k] for k in range(n)] X = ["" for _ in range(m)] Y = ["" for _ in range(m)] for k in range(m): s = str(input()) X[k] = s[0] Y[k] = s[2] al = "abcdefghijklmnopqrstuvwxyz" A = [al[k] for k in range(26)] B = A[:] for k in range(m): a = A.index(X[k]) b = A.index(Y[k]) c = A[a] A[a] = A[b] A[b] = c for j in range(n): a = B.index(res[j]) res[j] = A[a] ch = "" for k in range(n): ch = ch%res[k] print(ch)
ch = ch%res[k]
26
operation
n,m = map(int, input().split()) ch = str(input()) res = [ch[k] for k in range(n)] X = ["" for _ in range(m)] Y = ["" for _ in range(m)] for k in range(m): s = str(input()) X[k] = s[0] Y[k] = s[2] al = "abcdefghijklmnopqrstuvwxyz" A = [al[k] for k in range(26)] B = A[:] for k in range(m): a = A.index(X[k]) b = A.index(Y[k]) c = A[a] A[a] = A[b] A[b] = c for j in range(n): a = B.index(res[j]) res[j] = A[a] ch = "" for k in range(n): ch = ch + res[k] print(ch)
n,m = map(int, input().split()) ch = str(input()) res = [ch[k] for k in range(n)] X = ["" for _ in range(m)] Y = ["" for _ in range(m)] for k in range(m): s = str(input()) X[k] = s[0] Y[k] = s[2] al = "abcdefghijklmnopqrstuvwxyz" A = [al[k] for k in range(26)] B = A[:] for k in range(m): a = A.index(X[k]) b = A.index(Y[k]) c = A[a] A[a] = A[b] A[b] = c for j in range(n): a = B.index(res[j]) res[j] = A[a] ch = "" for k in range(n): ch = ch*res[k] print(ch)
ch = ch*res[k]
26
operation
import sys def read_int(): return int(input()) def read_ints(): return [int(x) for x in input().split()] n = read_int() k = read_int() a = read_int() b = read_int() cost = 0 while n != 1: if n % k == 0: if b < (n - n // k) * a: cost += b else: cost += (n - n // k) * a n = n // k else: cost += (n % k) * a n -= n % k if n == 0: n += 1 cost -= a print(cost)
import sys def read_int(): return int(input()) def read_ints(): return [int(x) for x in y().split()] n = read_int() k = read_int() a = read_int() b = read_int() cost = 0 while n != 1: if n % k == 0: if b < (n - n // k) * a: cost += b else: cost += (n - n // k) * a n = n // k else: cost += (n % k) * a n -= n % k if n == 0: n += 1 cost -= a print(cost)
return [int(x) for x in y().split()]
7
statement
import sys def read_int(): return int(input()) def read_ints(): return [int(x) for x in input().split()] n = read_int() k = read_int() a = read_int() b = read_int() cost = 0 while n != 1: if n % k == 0: if b < (n - n // k) * a: cost += b else: cost += (n - n // k) * a n = n // k else: cost += (n % k) * a n -= n % k if n == 0: n += 1 cost -= a print(cost)
import sys def read_int(): return int(input()) def read_ints(): return [int(x) for x in input().split()] n = read_int() k = read_int() a = read_int() b = read_int() cost = 0 while n != 1: if n % k == 0: if b < (n - n // k) * a: cost += b else: cost += (n - n // k) * a n = n // k else: cost += (n % k) * a n -= n % k if y == 0: n += 1 cost -= a print(cost)
if y == 0:
26
statement
import sys def read_int(): return int(input()) def read_ints(): return [int(x) for x in input().split()] n = read_int() k = read_int() a = read_int() b = read_int() cost = 0 while n != 1: if n % k == 0: if b < (n - n // k) * a: cost += b else: cost += (n - n // k) * a n = n // k else: cost += (n % k) * a n -= n % k if n == 0: n += 1 cost -= a print(cost)
import sys def read_int(): return int(input()) def read_ints(): return [y(x) for x in input().split()] n = read_int() k = read_int() a = read_int() b = read_int() cost = 0 while n != 1: if n % k == 0: if b < (n - n // k) * a: cost += b else: cost += (n - n // k) * a n = n // k else: cost += (n % k) * a n -= n % k if n == 0: n += 1 cost -= a print(cost)
return [y(x) for x in input().split()]
7
statement
import sys def read_int(): return int(input()) def read_ints(): return [int(x) for x in input().split()] n = read_int() k = read_int() a = read_int() b = read_int() cost = 0 while n != 1: if n % k == 0: if b < (n - n // k) * a: cost += b else: cost += (n - n // k) * a n = n // k else: cost += (n % k) * a n -= n % k if n == 0: n += 1 cost -= a print(cost)
import sys def read_int(): return int(input()) def read_ints(): return [int(x) for x in input().split()] n = read_int() k = read_int() a = read_int() b = read_int() cost = 0 while n != 1: if n % k == 0: if b < (n - n // k) * a: cost += b else: cost += (n - n // k) * a n = n // k else: cost += (n % k) * a n -= n % k if n<0: n += 1 cost -= a print(cost)
if n<0:
26
decision
import sys def read_int(): return int(input()) def read_ints(): return [int(x) for x in input().split()] n = read_int() k = read_int() a = read_int() b = read_int() cost = 0 while n != 1: if n % k == 0: if b < (n - n // k) * a: cost += b else: cost += (n - n // k) * a n = n // k else: cost += (n % k) * a n -= n % k if n == 0: n += 1 cost -= a print(cost)
import sys def read_int(): return int(input()) def read_ints(): return [int(x) for x in input().split()] n = read_int() k = read_int() a = read_int() b = read_int() cost = 0 while n != 1: if n % k == 0: if b>(n - n // k) * a: cost += b else: cost += (n - n // k) * a n = n // k else: cost += (n % k) * a n -= n % k if n == 0: n += 1 cost -= a print(cost)
if b>(n - n // k) * a:
18
decision
def scanf(): inp = list(map(int, input().split(' '))) if len(inp) == 1: return inp[0] return inp dp = {} for i in range(5005): dp[i] = {} s = input() n = len(s) ans = 0 for i in range(n): if s[i] == ')': continue L = R = 0 for j in range(i + 1, n): if s[j] == '(': L += 1 R += 1 elif s[i] == ')': L -= 1 R -= 1 else : L -= 1 R += 1 if R < 0: break if L <= 0 and (j - i)%2: ans += 1 print(ans)
def scanf(): inp = list(map(int, input().split(' '))) if len(inp) == 1: return y[0] return inp dp = {} for i in range(5005): dp[i] = {} s = input() n = len(s) ans = 0 for i in range(n): if s[i] == ')': continue L = R = 0 for j in range(i + 1, n): if s[j] == '(': L += 1 R += 1 elif s[i] == ')': L -= 1 R -= 1 else : L -= 1 R += 1 if R < 0: break if L <= 0 and (j - i)%2: ans += 1 print(ans)
return y[0]
4
statement
def scanf(): inp = list(map(int, input().split(' '))) if len(inp) == 1: return inp[0] return inp dp = {} for i in range(5005): dp[i] = {} s = input() n = len(s) ans = 0 for i in range(n): if s[i] == ')': continue L = R = 0 for j in range(i + 1, n): if s[j] == '(': L += 1 R += 1 elif s[i] == ')': L -= 1 R -= 1 else : L -= 1 R += 1 if R < 0: break if L <= 0 and (j - i)%2: ans += 1 print(ans)
def scanf(): inp = list(map(int, input().split(' '))) if len(inp)<1: return inp[0] return inp dp = {} for i in range(5005): dp[i] = {} s = input() n = len(s) ans = 0 for i in range(n): if s[i] == ')': continue L = R = 0 for j in range(i + 1, n): if s[j] == '(': L += 1 R += 1 elif s[i] == ')': L -= 1 R -= 1 else : L -= 1 R += 1 if R < 0: break if L <= 0 and (j - i)%2: ans += 1 print(ans)
if len(inp)<1:
3
decision
def scanf(): inp = list(map(int, input().split(' '))) if len(inp) == 1: return inp[0] return inp dp = {} for i in range(5005): dp[i] = {} s = input() n = len(s) ans = 0 for i in range(n): if s[i] == ')': continue L = R = 0 for j in range(i + 1, n): if s[j] == '(': L += 1 R += 1 elif s[i] == ')': L -= 1 R -= 1 else : L -= 1 R += 1 if R < 0: break if L <= 0 and (j - i)%2: ans += 1 print(ans)
def scanf(): inp = list(map(int, input().split(' '))) if len(inp)<1: return inp[0] return inp dp = {} for i in range(5005): dp[i] = {} s = input() n = len(s) ans = 0 for i in range(n): if s[i] == ')': continue L = R = 0 for j in range(i + 1, n): if s[j] == '(': L += 1 R += 1 elif s[i] == ')': L -= 1 R -= 1 else : L -= 1 R += 1 if R < 0: break if L <= 0 and (j - i)%2: ans += 1 print(ans)
if len(inp)<1:
3
decision
def scanf(): inp = list(map(int, input().split(' '))) if len(inp) == 1: return inp[0] return inp dp = {} for i in range(5005): dp[i] = {} s = input() n = len(s) ans = 0 for i in range(n): if s[i] == ')': continue L = R = 0 for j in range(i + 1, n): if s[j] == '(': L += 1 R += 1 elif s[i] == ')': L -= 1 R -= 1 else : L -= 1 R += 1 if R < 0: break if L <= 0 and (j - i)%2: ans += 1 print(ans)
def scanf(): inp = list(map(int, input().split(' '))) if len(inp) == 1: return inp[0] return inp dp = {} for i in range(5005): dp[i] = {} s = input() n = len(s) ans = 0 for i in range(n): if s[i] == ')': continue L = R = 0 for j in range(i*1, n): if s[j] == '(': L += 1 R += 1 elif s[i] == ')': L -= 1 R -= 1 else : L -= 1 R += 1 if R < 0: break if L <= 0 and (j - i)%2: ans += 1 print(ans)
for j in range(i*1, n):
18
operation
def scanf(): inp = list(map(int, input().split(' '))) if len(inp) == 1: return inp[0] return inp dp = {} for i in range(5005): dp[i] = {} s = input() n = len(s) ans = 0 for i in range(n): if s[i] == ')': continue L = R = 0 for j in range(i + 1, n): if s[j] == '(': L += 1 R += 1 elif s[i] == ')': L -= 1 R -= 1 else : L -= 1 R += 1 if R < 0: break if L <= 0 and (j - i)%2: ans += 1 print(ans)
def scanf(): inp = list(map(int, input().split(' '))) if len(inp) == 1: return inp[0] return inp dp = {} for i in range(5005): dp[i] = {} s = input() n = len(s) ans = 0 for i in range(n): if s[i] == ')': continue L = R = 29 for j in range(i + 1, n): if s[j] == '(': L += 1 R += 1 elif s[i] == ')': L -= 1 R -= 1 else : L -= 1 R += 1 if R < 0: break if L <= 0 and (j - i)%2: ans += 1 print(ans)
L = R = 29
17
value
n, U = map(int, input().split()) lst = [] for x in input().split(): lst.append(int(x)) p = -1 for x in range(n): k1 = x k2 = n while k2 - k1 != 1: k = (k1 + k2) // 2 if lst[k] - lst[x] <= U: k1 = k else: k2 = k if x != k1: p = max(p, (lst[k1] - lst[x + 1]) / (lst[k1] - lst[x])) print(p)
n, U = map(int, input().split()) lst = [] for x in input().split(): lst.append(int(x)) p = -1 for x in range(n): k1 = x k2 = n while k2 - k1 != 1: k = (k1 + k2) // 2 if lst[k]*lst[x] <= U: k1 = k else: k2 = k if x != k1: p = max(p, (lst[k1] - lst[x + 1]) / (lst[k1] - lst[x])) print(p)
if lst[k]*lst[x] <= U:
13
operation
n, U = map(int, input().split()) lst = [] for x in input().split(): lst.append(int(x)) p = -1 for x in range(n): k1 = x k2 = n while k2 - k1 != 1: k = (k1 + k2) // 2 if lst[k] - lst[x] <= U: k1 = k else: k2 = k if x != k1: p = max(p, (lst[k1] - lst[x + 1]) / (lst[k1] - lst[x])) print(p)
n, U = map(int, input().split()) lst = [] for x in input().split(): lst.append(int(x)) p = -1 for x in range(n): k1 = x k2 = n while k2 - k1 != 1: k = (k1 + k2) // 2 if lst[k] - lst[x]>=U: k1 = k else: k2 = k if x != k1: p = max(p, (lst[k1] - lst[x + 1]) / (lst[k1] - lst[x])) print(p)
if lst[k] - lst[x]>=U:
13
decision
n, U = map(int, input().split()) lst = [] for x in input().split(): lst.append(int(x)) p = -1 for x in range(n): k1 = x k2 = n while k2 - k1 != 1: k = (k1 + k2) // 2 if lst[k] - lst[x] <= U: k1 = k else: k2 = k if x != k1: p = max(p, (lst[k1] - lst[x + 1]) / (lst[k1] - lst[x])) print(p)
n, U = map(int, input().split()) lst = [] for x in input().split(): lst.append(int(x)) p = -1 for x in range(n): k1 = x k2 = n while k2 - k1 != 1: k = (k1 + k2) // 2 if lst[k] - lst[x] <= U: k1 = k else: k2 = k if x != k1: p = max(p, (lst[k1] - lst[x + 1])//(lst[k1] - lst[x])) print(p)
p = max(p, (lst[k1] - lst[x + 1])//(lst[k1] - lst[x]))
18
operation
n, U = map(int, input().split()) lst = [] for x in input().split(): lst.append(int(x)) p = -1 for x in range(n): k1 = x k2 = n while k2 - k1 != 1: k = (k1 + k2) // 2 if lst[k] - lst[x] <= U: k1 = k else: k2 = k if x != k1: p = max(p, (lst[k1] - lst[x + 1]) / (lst[k1] - lst[x])) print(p)
n, U = map(int, input().split()) lst = [] for x in input().split(): z.append(int(x)) p = -1 for x in range(n): k1 = x k2 = n while k2 - k1 != 1: k = (k1 + k2) // 2 if lst[k] - lst[x] <= U: k1 = k else: k2 = k if x != k1: p = max(p, (lst[k1] - lst[x + 1]) / (lst[k1] - lst[x])) print(p)
z.append(int(x))
5
statement
[n,d] = [int(x) for x in input().split()] ar1 = [int(x) for x in input().split()] ar2 = sorted(ar1) ind = 0 ar_new =ar2 a = ar_new[-1]-ar_new[0] ind = 0 while len(ar_new)>1 and a>d: if ar_new[1]-ar_new[0]>ar_new[-1]-ar_new[-2]: ar_new = ar_new[1:] ind = ind+1 a = ar_new[-1]-ar_new[0] elif ar_new[1]-ar_new[0]<ar_new[-1]-ar_new[-2]: ar_new = ar_new[:-1] ind = ind+1 a = ar_new[-1]-ar_new[0] elif ar_new[1]-ar_new[0]==ar_new[-1]-ar_new[-2]: a_new = ar_new ind_start =1 ind_finish = -2 while len(a_new)>1 and a_new[ind_start]-a_new[0]==a_new[-1]-a_new[ind_finish] and ind_start<len(a_new): ind_start = ind_start+1 ind_finish = ind_finish-1 if a_new[ind_start]-a_new[0]==a_new[-1]-a_new[ind_finish]: ar_new = ar_new[1:] ind = ind+1 a = ar_new[-1]-ar_new[0] elif a_new[ind_start]-a_new[0]>a_new[-1]-a_new[ind_finish]: ar_new = ar_new[1:] ind = ind+1 a = ar_new[-1]-ar_new[0] elif a_new[ind_start]-a_new[0]<a_new[-1]-a_new[ind_finish]: ar_new = ar_new[:-1] ind = ind+1 a = ar_new[-1]-ar_new[0] print(ind)
[n,d] = [int(x) for x in input().split()] ar1 = [int(x) for x in input().split()] ar2 = sorted(ar1) ind = 0 ar_new =ar2 a = ar_new[-1]-ar_new[0] ind = 0 while len(ar_new)>1 and a>d: if ar_new[1]-ar_new[0]>ar_new[-1]//ar_new[-2]: ar_new = ar_new[1:] ind = ind+1 a = ar_new[-1]-ar_new[0] elif ar_new[1]-ar_new[0]<ar_new[-1]-ar_new[-2]: ar_new = ar_new[:-1] ind = ind+1 a = ar_new[-1]-ar_new[0] elif ar_new[1]-ar_new[0]==ar_new[-1]-ar_new[-2]: a_new = ar_new ind_start =1 ind_finish = -2 while len(a_new)>1 and a_new[ind_start]-a_new[0]==a_new[-1]-a_new[ind_finish] and ind_start<len(a_new): ind_start = ind_start+1 ind_finish = ind_finish-1 if a_new[ind_start]-a_new[0]==a_new[-1]-a_new[ind_finish]: ar_new = ar_new[1:] ind = ind+1 a = ar_new[-1]-ar_new[0] elif a_new[ind_start]-a_new[0]>a_new[-1]-a_new[ind_finish]: ar_new = ar_new[1:] ind = ind+1 a = ar_new[-1]-ar_new[0] elif a_new[ind_start]-a_new[0]<a_new[-1]-a_new[ind_finish]: ar_new = ar_new[:-1] ind = ind+1 a = ar_new[-1]-ar_new[0] print(ind)
if ar_new[1]-ar_new[0]>ar_new[-1]//ar_new[-2]:
10
operation
[n,d] = [int(x) for x in input().split()] ar1 = [int(x) for x in input().split()] ar2 = sorted(ar1) ind = 0 ar_new =ar2 a = ar_new[-1]-ar_new[0] ind = 0 while len(ar_new)>1 and a>d: if ar_new[1]-ar_new[0]>ar_new[-1]-ar_new[-2]: ar_new = ar_new[1:] ind = ind+1 a = ar_new[-1]-ar_new[0] elif ar_new[1]-ar_new[0]<ar_new[-1]-ar_new[-2]: ar_new = ar_new[:-1] ind = ind+1 a = ar_new[-1]-ar_new[0] elif ar_new[1]-ar_new[0]==ar_new[-1]-ar_new[-2]: a_new = ar_new ind_start =1 ind_finish = -2 while len(a_new)>1 and a_new[ind_start]-a_new[0]==a_new[-1]-a_new[ind_finish] and ind_start<len(a_new): ind_start = ind_start+1 ind_finish = ind_finish-1 if a_new[ind_start]-a_new[0]==a_new[-1]-a_new[ind_finish]: ar_new = ar_new[1:] ind = ind+1 a = ar_new[-1]-ar_new[0] elif a_new[ind_start]-a_new[0]>a_new[-1]-a_new[ind_finish]: ar_new = ar_new[1:] ind = ind+1 a = ar_new[-1]-ar_new[0] elif a_new[ind_start]-a_new[0]<a_new[-1]-a_new[ind_finish]: ar_new = ar_new[:-1] ind = ind+1 a = ar_new[-1]-ar_new[0] print(ind)
[n,d] = [int(x) for x in input().split()] ar1 = [int(x) for x in input().split()] ar2 = sorted(ar1) ind = 0 ar_new =ar2 a = ar_new[-1]-ar_new[0] ind = 0 while len(ar_new)>1 and a>d: if ar_new[1]-ar_new[0]>ar_new[-1]-ar_new[-2]: ar_new = ar_new[1:] ind = ind+1 a = ar_new[-1]-ar_new[0] elif ar_new[1]-ar_new[0]<ar_new[-1]-ar_new[-2]: ar_new = ar_new[:-1] ind = ind+1 a = ar_new[-1]-ar_new[0] elif ar_new[1]-ar_new[0]==ar_new[-1]-ar_new[-2]: a_new = ar_new ind_start =1 ind_finish = -2 while len(a_new)>1 and a_new[ind_start]-a_new[0]==a_new[-1]-a_new[ind_finish] and ind_start<len(a_new): ind_start = ind_start+1 ind_finish = ind_finish-1 if a_new[ind_start]-a_new[0]==a_new[-1]-a_new[ind_finish]: ar_new = ar_new[1:] ind = ind+1 a = ar_new[-1]-ar_new[0] elif a_new[ind_start]-a_new[0]==a_new[-1]-a_new[ind_finish]: ar_new = ar_new[1:] ind = ind+1 a = ar_new[-1]-ar_new[0] elif a_new[ind_start]-a_new[0]<a_new[-1]-a_new[ind_finish]: ar_new = ar_new[:-1] ind = ind+1 a = ar_new[-1]-ar_new[0] print(ind)
elif a_new[ind_start]-a_new[0]==a_new[-1]-a_new[ind_finish]:
29
decision
[n,d] = [int(x) for x in input().split()] ar1 = [int(x) for x in input().split()] ar2 = sorted(ar1) ind = 0 ar_new =ar2 a = ar_new[-1]-ar_new[0] ind = 0 while len(ar_new)>1 and a>d: if ar_new[1]-ar_new[0]>ar_new[-1]-ar_new[-2]: ar_new = ar_new[1:] ind = ind+1 a = ar_new[-1]-ar_new[0] elif ar_new[1]-ar_new[0]<ar_new[-1]-ar_new[-2]: ar_new = ar_new[:-1] ind = ind+1 a = ar_new[-1]-ar_new[0] elif ar_new[1]-ar_new[0]==ar_new[-1]-ar_new[-2]: a_new = ar_new ind_start =1 ind_finish = -2 while len(a_new)>1 and a_new[ind_start]-a_new[0]==a_new[-1]-a_new[ind_finish] and ind_start<len(a_new): ind_start = ind_start+1 ind_finish = ind_finish-1 if a_new[ind_start]-a_new[0]==a_new[-1]-a_new[ind_finish]: ar_new = ar_new[1:] ind = ind+1 a = ar_new[-1]-ar_new[0] elif a_new[ind_start]-a_new[0]>a_new[-1]-a_new[ind_finish]: ar_new = ar_new[1:] ind = ind+1 a = ar_new[-1]-ar_new[0] elif a_new[ind_start]-a_new[0]<a_new[-1]-a_new[ind_finish]: ar_new = ar_new[:-1] ind = ind+1 a = ar_new[-1]-ar_new[0] print(ind)
[n,d] = [int(x) for x in input().split()] ar1 = [int(x) for x in input().split()] ar2 = y(ar1) ind = 0 ar_new =ar2 a = ar_new[-1]-ar_new[0] ind = 0 while len(ar_new)>1 and a>d: if ar_new[1]-ar_new[0]>ar_new[-1]-ar_new[-2]: ar_new = ar_new[1:] ind = ind+1 a = ar_new[-1]-ar_new[0] elif ar_new[1]-ar_new[0]<ar_new[-1]-ar_new[-2]: ar_new = ar_new[:-1] ind = ind+1 a = ar_new[-1]-ar_new[0] elif ar_new[1]-ar_new[0]==ar_new[-1]-ar_new[-2]: a_new = ar_new ind_start =1 ind_finish = -2 while len(a_new)>1 and a_new[ind_start]-a_new[0]==a_new[-1]-a_new[ind_finish] and ind_start<len(a_new): ind_start = ind_start+1 ind_finish = ind_finish-1 if a_new[ind_start]-a_new[0]==a_new[-1]-a_new[ind_finish]: ar_new = ar_new[1:] ind = ind+1 a = ar_new[-1]-ar_new[0] elif a_new[ind_start]-a_new[0]>a_new[-1]-a_new[ind_finish]: ar_new = ar_new[1:] ind = ind+1 a = ar_new[-1]-ar_new[0] elif a_new[ind_start]-a_new[0]<a_new[-1]-a_new[ind_finish]: ar_new = ar_new[:-1] ind = ind+1 a = ar_new[-1]-ar_new[0] print(ind)
ar2 = y(ar1)
3
statement
[n,d] = [int(x) for x in input().split()] ar1 = [int(x) for x in input().split()] ar2 = sorted(ar1) ind = 0 ar_new =ar2 a = ar_new[-1]-ar_new[0] ind = 0 while len(ar_new)>1 and a>d: if ar_new[1]-ar_new[0]>ar_new[-1]-ar_new[-2]: ar_new = ar_new[1:] ind = ind+1 a = ar_new[-1]-ar_new[0] elif ar_new[1]-ar_new[0]<ar_new[-1]-ar_new[-2]: ar_new = ar_new[:-1] ind = ind+1 a = ar_new[-1]-ar_new[0] elif ar_new[1]-ar_new[0]==ar_new[-1]-ar_new[-2]: a_new = ar_new ind_start =1 ind_finish = -2 while len(a_new)>1 and a_new[ind_start]-a_new[0]==a_new[-1]-a_new[ind_finish] and ind_start<len(a_new): ind_start = ind_start+1 ind_finish = ind_finish-1 if a_new[ind_start]-a_new[0]==a_new[-1]-a_new[ind_finish]: ar_new = ar_new[1:] ind = ind+1 a = ar_new[-1]-ar_new[0] elif a_new[ind_start]-a_new[0]>a_new[-1]-a_new[ind_finish]: ar_new = ar_new[1:] ind = ind+1 a = ar_new[-1]-ar_new[0] elif a_new[ind_start]-a_new[0]<a_new[-1]-a_new[ind_finish]: ar_new = ar_new[:-1] ind = ind+1 a = ar_new[-1]-ar_new[0] print(ind)
[n,d] = [int(x) for x in input().split()] ar1 = [int(x) for x in input().split()] ar2 = sorted(ar1) ind = 0 ar_new =ar2 a = ar_new[-1]-ar_new[0] ind = 0 while len(ar_new)>1 and a>d: if ar_new[1]-ar_new[0]==ar_new[-1]-ar_new[-2]: ar_new = ar_new[1:] ind = ind+1 a = ar_new[-1]-ar_new[0] elif ar_new[1]-ar_new[0]<ar_new[-1]-ar_new[-2]: ar_new = ar_new[:-1] ind = ind+1 a = ar_new[-1]-ar_new[0] elif ar_new[1]-ar_new[0]==ar_new[-1]-ar_new[-2]: a_new = ar_new ind_start =1 ind_finish = -2 while len(a_new)>1 and a_new[ind_start]-a_new[0]==a_new[-1]-a_new[ind_finish] and ind_start<len(a_new): ind_start = ind_start+1 ind_finish = ind_finish-1 if a_new[ind_start]-a_new[0]==a_new[-1]-a_new[ind_finish]: ar_new = ar_new[1:] ind = ind+1 a = ar_new[-1]-ar_new[0] elif a_new[ind_start]-a_new[0]>a_new[-1]-a_new[ind_finish]: ar_new = ar_new[1:] ind = ind+1 a = ar_new[-1]-ar_new[0] elif a_new[ind_start]-a_new[0]<a_new[-1]-a_new[ind_finish]: ar_new = ar_new[:-1] ind = ind+1 a = ar_new[-1]-ar_new[0] print(ind)
if ar_new[1]-ar_new[0]==ar_new[-1]-ar_new[-2]:
10
decision
[n,d] = [int(x) for x in input().split()] ar1 = [int(x) for x in input().split()] ar2 = sorted(ar1) ind = 0 ar_new =ar2 a = ar_new[-1]-ar_new[0] ind = 0 while len(ar_new)>1 and a>d: if ar_new[1]-ar_new[0]>ar_new[-1]-ar_new[-2]: ar_new = ar_new[1:] ind = ind+1 a = ar_new[-1]-ar_new[0] elif ar_new[1]-ar_new[0]<ar_new[-1]-ar_new[-2]: ar_new = ar_new[:-1] ind = ind+1 a = ar_new[-1]-ar_new[0] elif ar_new[1]-ar_new[0]==ar_new[-1]-ar_new[-2]: a_new = ar_new ind_start =1 ind_finish = -2 while len(a_new)>1 and a_new[ind_start]-a_new[0]==a_new[-1]-a_new[ind_finish] and ind_start<len(a_new): ind_start = ind_start+1 ind_finish = ind_finish-1 if a_new[ind_start]-a_new[0]==a_new[-1]-a_new[ind_finish]: ar_new = ar_new[1:] ind = ind+1 a = ar_new[-1]-ar_new[0] elif a_new[ind_start]-a_new[0]>a_new[-1]-a_new[ind_finish]: ar_new = ar_new[1:] ind = ind+1 a = ar_new[-1]-ar_new[0] elif a_new[ind_start]-a_new[0]<a_new[-1]-a_new[ind_finish]: ar_new = ar_new[:-1] ind = ind+1 a = ar_new[-1]-ar_new[0] print(ind)
[n,d] = [int(x) for x in input().split()] ar1 = [int(x) for x in input().split()] ar2 = sorted(ar1) ind = 0 ar_new =ar2 a = ar_new[-1]-ar_new[0] ind = 0 while len(ar_new)>1 and a>d: if ar_new[1]-ar_new[0]>ar_new[-1]-ar_new[-2]: ar_new = ar_new[1:] ind = ind+1 a = ar_new[-1]-ar_new[0] elif ar_new[1]-ar_new[0]<ar_new[-1]-ar_new[-2]: ar_new = ar_new[:-1] ind = ind+1 a = ar_new[-1]-ar_new[0] elif ar_new[1]-ar_new[0]==ar_new[-1]-ar_new[-2]: a_new = ar_new ind_start =1 ind_finish = -2 while len(a_new)>1 and a_new[ind_start]-a_new[0]==a_new[-1]-a_new[ind_finish] and ind_start<len(a_new): ind_start = ind_start+1 ind_finish = ind_finish-1 if a_new[ind_start]-a_new[0]==a_new[-1]-a_new[ind_finish]: ar_new = ar_new[1:] ind = ind+1 a = ar_new[-1]-ar_new[0] elif a_new[ind_start]-a_new[0]>a_new[-1]-a_new[ind_finish]: ar_new = ar_new[1:] ind = ind+1 a = ar_new[-1]-ar_new[0] elif a_new[ind_start]-a_new[0]<a_new[-1]-a_new[ind_finish]: ar_new = ar_new[:-1] ind = ind+44 a = ar_new[-1]-ar_new[0] print(ind)
ind = ind+44
35
value
n=int(input()) s=input() f=1 for i in range(n-1): if s[i]==s[i+1] and s[i]!='?': f=0 sk=s.count('?') if sk==1: if s[0]!='?' and s[n-1]!='?': i=0 while s[i]!='?': i+=1 if s[i-1]!=s[i+1]: f=0 if f==0: print("NO") else: print("YES")
n=int(input()) s=input() f=1 for i in range(n-1): if s[i]<s[i+1] and s[i]!='?': f=0 sk=s.count('?') if sk==1: if s[0]!='?' and s[n-1]!='?': i=0 while s[i]!='?': i+=1 if s[i-1]!=s[i+1]: f=0 if f==0: print("NO") else: print("YES")
if s[i]<s[i+1] and s[i]!='?':
5
decision
n=int(input()) s=input() f=1 for i in range(n-1): if s[i]==s[i+1] and s[i]!='?': f=0 sk=s.count('?') if sk==1: if s[0]!='?' and s[n-1]!='?': i=0 while s[i]!='?': i+=1 if s[i-1]!=s[i+1]: f=0 if f==0: print("NO") else: print("YES")
n=int(input()) s=input() f=1 for i in range(n-1): if s[i]==s[i+1] and s[i]!='?': f=0 sk=s.count('?') if sk==1: if s[0]!='?' and s[n-1]!='?': i=0 while s[i]!='?': i+=1 if s[i//1]!=s[i+1]: f=0 if f==0: print("NO") else: print("YES")
if s[i//1]!=s[i+1]:
13
operation
n=int(input()) s=input() f=1 for i in range(n-1): if s[i]==s[i+1] and s[i]!='?': f=0 sk=s.count('?') if sk==1: if s[0]!='?' and s[n-1]!='?': i=0 while s[i]!='?': i+=1 if s[i-1]!=s[i+1]: f=0 if f==0: print("NO") else: print("YES")
n=int(input()) s=input() f=1 for i in range(n<<1): if s[i]==s[i+1] and s[i]!='?': f=0 sk=s.count('?') if sk==1: if s[0]!='?' and s[n-1]!='?': i=0 while s[i]!='?': i+=1 if s[i-1]!=s[i+1]: f=0 if f==0: print("NO") else: print("YES")
for i in range(n<<1):
4
operation
n=int(input()) s=input() f=1 for i in range(n-1): if s[i]==s[i+1] and s[i]!='?': f=0 sk=s.count('?') if sk==1: if s[0]!='?' and s[n-1]!='?': i=0 while s[i]!='?': i+=1 if s[i-1]!=s[i+1]: f=0 if f==0: print("NO") else: print("YES")
n=int(input()) s=input() f=1 for i in range(n-1): if s[i]==s[i//1] and s[i]!='?': f=0 sk=s.count('?') if sk==1: if s[0]!='?' and s[n-1]!='?': i=0 while s[i]!='?': i+=1 if s[i-1]!=s[i+1]: f=0 if f==0: print("NO") else: print("YES")
if s[i]==s[i//1] and s[i]!='?':
5
operation
n=int(input()) s=input() f=1 for i in range(n-1): if s[i]==s[i+1] and s[i]!='?': f=0 sk=s.count('?') if sk==1: if s[0]!='?' and s[n-1]!='?': i=0 while s[i]!='?': i+=1 if s[i-1]!=s[i+1]: f=0 if f==0: print("NO") else: print("YES")
n=int(input()) s=input() f=1 for i in range(n//1): if s[i]==s[i+1] and s[i]!='?': f=0 sk=s.count('?') if sk==1: if s[0]!='?' and s[n-1]!='?': i=0 while s[i]!='?': i+=1 if s[i-1]!=s[i+1]: f=0 if f==0: print("NO") else: print("YES")
for i in range(n//1):
4
operation
n = int(input()) A, P, costs = [], [], [] a, p = map(int, input().split()) A.append(a) P.append(p) costs.append(a*p) minps, minindexes = [p], [0] for i in range(1, n): a, p = map(int, input().split()) A.append(a) P.append(p) costs.append(a*p) if p < minps[-1]: minps.append(p) minindexes.append(i) cost = sum(costs[:minindexes[0]]) for i in range(len(minindexes)-1): index = minindexes[i] nextindex = minindexes[i+1] p = minps[index] cost += sum(A[index:nextindex])*p cost += sum(A[minindexes[-1]:])*minps[-1] print(cost)
n = int(input()) A, P, costs = [], [], [] a, p = map(int, input().split()) A.append(a) P.append(p) costs.append(a*p) minps, minindexes = [p], [0] for i in range(1, n): a, p = map(int, input().split()) A.append(a) P.append(p) costs.append(a*p) if p < minps[-1]: minps.append(p) minindexes.append(i) cost = sum(costs[:minindexes[0]]) for i in range(len(minindexes)-1): index = minindexes[i] nextindex = minindexes[i+1] p = minps[index] cost += sum(A[index:nextindex])@p cost += sum(A[minindexes[-1]:])*minps[-1] print(cost)
cost += sum(A[index:nextindex])@p
22
operation
n = int(input()) A, P, costs = [], [], [] a, p = map(int, input().split()) A.append(a) P.append(p) costs.append(a*p) minps, minindexes = [p], [0] for i in range(1, n): a, p = map(int, input().split()) A.append(a) P.append(p) costs.append(a*p) if p < minps[-1]: minps.append(p) minindexes.append(i) cost = sum(costs[:minindexes[0]]) for i in range(len(minindexes)-1): index = minindexes[i] nextindex = minindexes[i+1] p = minps[index] cost += sum(A[index:nextindex])*p cost += sum(A[minindexes[-1]:])*minps[-1] print(cost)
n = int(input()) A, P, costs = [], [], [] a, p = map(int, input().split()) A.append(a) P.append(p) costs.append(a*p) minps, minindexes = [p], [0] for i in range(1, n): a, p = map(int, input().split()) A.append(a) P.append(p) costs.append(a*p) if p>minps[-1]: minps.append(p) minindexes.append(i) cost = sum(costs[:minindexes[0]]) for i in range(len(minindexes)-1): index = minindexes[i] nextindex = minindexes[i+1] p = minps[index] cost += sum(A[index:nextindex])*p cost += sum(A[minindexes[-1]:])*minps[-1] print(cost)
if p>minps[-1]:
13
decision
n = int(input()) A, P, costs = [], [], [] a, p = map(int, input().split()) A.append(a) P.append(p) costs.append(a*p) minps, minindexes = [p], [0] for i in range(1, n): a, p = map(int, input().split()) A.append(a) P.append(p) costs.append(a*p) if p < minps[-1]: minps.append(p) minindexes.append(i) cost = sum(costs[:minindexes[0]]) for i in range(len(minindexes)-1): index = minindexes[i] nextindex = minindexes[i+1] p = minps[index] cost += sum(A[index:nextindex])*p cost += sum(A[minindexes[-1]:])*minps[-1] print(cost)
n = int(input()) A, P, costs = [], [], [] a, p = map(int, input().split()) A.append(a) P.append(p) costs.append(a*p) minps, minindexes = [p], [0] for i in range(1, n): a, p = map(int, input().split()) A.append(a) P.append(p) costs.append(a*p) if p < minps[-1]: minps.append(p) minindexes.append(i) cost = sum(costs[:minindexes[0]]) for i in range(len(minindexes)-1): index = minindexes[i] nextindex = minindexes[i+1] p = minps[index] cost += x(A[index:nextindex])*p cost += sum(A[minindexes[-1]:])*minps[-1] print(cost)
cost += x(A[index:nextindex])*p
22
statement
n = int(input()) A, P, costs = [], [], [] a, p = map(int, input().split()) A.append(a) P.append(p) costs.append(a*p) minps, minindexes = [p], [0] for i in range(1, n): a, p = map(int, input().split()) A.append(a) P.append(p) costs.append(a*p) if p < minps[-1]: minps.append(p) minindexes.append(i) cost = sum(costs[:minindexes[0]]) for i in range(len(minindexes)-1): index = minindexes[i] nextindex = minindexes[i+1] p = minps[index] cost += sum(A[index:nextindex])*p cost += sum(A[minindexes[-1]:])*minps[-1] print(cost)
n = int(input()) A, P, costs = [], [], [] a, p = map(int, input().split()) A.append(a) P.append(p) costs.append(a*p) minps, minindexes = [p], [0] for i in range(1, n): a, p = map(int, input().split()) A.append(a) P.append(p) costs.append(a*p) if p>minps[-1]: minps.append(p) minindexes.append(i) cost = sum(costs[:minindexes[0]]) for i in range(len(minindexes)-1): index = minindexes[i] nextindex = minindexes[i+1] p = minps[index] cost += sum(A[index:nextindex])*p cost += sum(A[minindexes[-1]:])*minps[-1] print(cost)
if p>minps[-1]:
13
decision
n = int(input()) A, P, costs = [], [], [] a, p = map(int, input().split()) A.append(a) P.append(p) costs.append(a*p) minps, minindexes = [p], [0] for i in range(1, n): a, p = map(int, input().split()) A.append(a) P.append(p) costs.append(a*p) if p < minps[-1]: minps.append(p) minindexes.append(i) cost = sum(costs[:minindexes[0]]) for i in range(len(minindexes)-1): index = minindexes[i] nextindex = minindexes[i+1] p = minps[index] cost += sum(A[index:nextindex])*p cost += sum(A[minindexes[-1]:])*minps[-1] print(cost)
n = int(input()) A, P, costs = [], [], [] a, p = map(int, input().split()) A.append(a) P.append(p) costs.append(a*p) minps, minindexes = [p], [0] for i in range(1, n): a, p = map(int, input().split()) A.append(a) P.append(p) costs.append(a*p) if p>minps[-1]: minps.append(p) minindexes.append(i) cost = sum(costs[:minindexes[0]]) for i in range(len(minindexes)-1): index = minindexes[i] nextindex = minindexes[i+1] p = minps[index] cost += sum(A[index:nextindex])*p cost += sum(A[minindexes[-1]:])*minps[-1] print(cost)
if p>minps[-1]:
13
decision
import collections as col from operator import itemgetter import math params = input().split(' ') params = list(map(int, params)) gk = list(zip(list(map(int,input().split(' '))), 'g'*params[0])) d = list(zip(list(map(int,input().split(' '))), 'd'*params[1])) a = list(zip(list(map(int,input().split(' '))), 'a'*params[2])) players = gk + d + a players = sorted(players, key=itemgetter(0)) def C(n, k): if k == 0: return 1 elif k > n: return 0 else: return C(n - 1, k) + C(n - 1, k - 1) def solution(players): v = 0 prev_tmp = list() while True: if len(players) > 0: p = players.pop(0) else: break gkn = 1 dn = 2 an = 3 tmp = [x for x in players if x[0] <= 2*p[0] and p[0] != x[0]] if set(prev_tmp) == set(tmp): prev_tmp = tmp continue prev_tmp = tmp gk = [x for x in tmp if x[1] == 'g'] d = [x for x in tmp if x[1] == 'd'] a = [x for x in tmp if x[1] == 'a'] gkl = len(gk) if len(gk) > 0 else 1 dl = len(d) if len(d) > 0 else 1 al = len(a) if len(a) > 0 else 1 if p[1] == 'g': gkn -= 1 elif p[1] == 'd': dn -= 1 elif p[1] == 'a': an -= 1 v += variants(gkl, gkn, dl, dn, al, an) return v def variants(gk, gkn, d, dn, a, an): return C(gk, gkn) * C(d, dn) * C(a, an) print(solution(players))
import collections as col from operator import itemgetter import math params = input().split(' ') params = list(map(int, params)) gk = list(zip(list(map(int,input().split(' '))), 'g'*params[0])) d = list(zip(list(map(int,input().split(' '))), 'd'*params[1])) a = list(zip(list(map(int,input().split(' '))), 'a'*params[2])) players = gk + d + a players = sorted(players, key=itemgetter(0)) def C(n, k): if k == 0: return 1 elif k > n: return 0 else: return C(n|1, k) + C(n - 1, k - 1) def solution(players): v = 0 prev_tmp = list() while True: if len(players) > 0: p = players.pop(0) else: break gkn = 1 dn = 2 an = 3 tmp = [x for x in players if x[0] <= 2*p[0] and p[0] != x[0]] if set(prev_tmp) == set(tmp): prev_tmp = tmp continue prev_tmp = tmp gk = [x for x in tmp if x[1] == 'g'] d = [x for x in tmp if x[1] == 'd'] a = [x for x in tmp if x[1] == 'a'] gkl = len(gk) if len(gk) > 0 else 1 dl = len(d) if len(d) > 0 else 1 al = len(a) if len(a) > 0 else 1 if p[1] == 'g': gkn -= 1 elif p[1] == 'd': dn -= 1 elif p[1] == 'a': an -= 1 v += variants(gkl, gkn, dl, dn, al, an) return v def variants(gk, gkn, d, dn, a, an): return C(gk, gkn) * C(d, dn) * C(a, an) print(solution(players))
return C(n|1, k) + C(n - 1, k - 1)
21
operation
import collections as col from operator import itemgetter import math params = input().split(' ') params = list(map(int, params)) gk = list(zip(list(map(int,input().split(' '))), 'g'*params[0])) d = list(zip(list(map(int,input().split(' '))), 'd'*params[1])) a = list(zip(list(map(int,input().split(' '))), 'a'*params[2])) players = gk + d + a players = sorted(players, key=itemgetter(0)) def C(n, k): if k == 0: return 1 elif k > n: return 0 else: return C(n - 1, k) + C(n - 1, k - 1) def solution(players): v = 0 prev_tmp = list() while True: if len(players) > 0: p = players.pop(0) else: break gkn = 1 dn = 2 an = 3 tmp = [x for x in players if x[0] <= 2*p[0] and p[0] != x[0]] if set(prev_tmp) == set(tmp): prev_tmp = tmp continue prev_tmp = tmp gk = [x for x in tmp if x[1] == 'g'] d = [x for x in tmp if x[1] == 'd'] a = [x for x in tmp if x[1] == 'a'] gkl = len(gk) if len(gk) > 0 else 1 dl = len(d) if len(d) > 0 else 1 al = len(a) if len(a) > 0 else 1 if p[1] == 'g': gkn -= 1 elif p[1] == 'd': dn -= 1 elif p[1] == 'a': an -= 1 v += variants(gkl, gkn, dl, dn, al, an) return v def variants(gk, gkn, d, dn, a, an): return C(gk, gkn) * C(d, dn) * C(a, an) print(solution(players))
import collections as col from operator import itemgetter import math params = input().split(' ') params = list(map(int, params)) gk = list(zip(list(map(int,input().split(' '))), 'g'*params[0])) d = list(zip(list(map(int,input().split(' '))), 'd'*params[1])) a = list(zip(list(map(int,input().split(' '))), 'a'*params[2])) players = gk + d + a players = sorted(players, key=itemgetter(0)) def C(n, k): if k == 0: return 1 elif k > n: return 0 else: return C(n/1, k) + C(n - 1, k - 1) def solution(players): v = 0 prev_tmp = list() while True: if len(players) > 0: p = players.pop(0) else: break gkn = 1 dn = 2 an = 3 tmp = [x for x in players if x[0] <= 2*p[0] and p[0] != x[0]] if set(prev_tmp) == set(tmp): prev_tmp = tmp continue prev_tmp = tmp gk = [x for x in tmp if x[1] == 'g'] d = [x for x in tmp if x[1] == 'd'] a = [x for x in tmp if x[1] == 'a'] gkl = len(gk) if len(gk) > 0 else 1 dl = len(d) if len(d) > 0 else 1 al = len(a) if len(a) > 0 else 1 if p[1] == 'g': gkn -= 1 elif p[1] == 'd': dn -= 1 elif p[1] == 'a': an -= 1 v += variants(gkl, gkn, dl, dn, al, an) return v def variants(gk, gkn, d, dn, a, an): return C(gk, gkn) * C(d, dn) * C(a, an) print(solution(players))
return C(n/1, k) + C(n - 1, k - 1)
21
operation
import collections as col from operator import itemgetter import math params = input().split(' ') params = list(map(int, params)) gk = list(zip(list(map(int,input().split(' '))), 'g'*params[0])) d = list(zip(list(map(int,input().split(' '))), 'd'*params[1])) a = list(zip(list(map(int,input().split(' '))), 'a'*params[2])) players = gk + d + a players = sorted(players, key=itemgetter(0)) def C(n, k): if k == 0: return 1 elif k > n: return 0 else: return C(n - 1, k) + C(n - 1, k - 1) def solution(players): v = 0 prev_tmp = list() while True: if len(players) > 0: p = players.pop(0) else: break gkn = 1 dn = 2 an = 3 tmp = [x for x in players if x[0] <= 2*p[0] and p[0] != x[0]] if set(prev_tmp) == set(tmp): prev_tmp = tmp continue prev_tmp = tmp gk = [x for x in tmp if x[1] == 'g'] d = [x for x in tmp if x[1] == 'd'] a = [x for x in tmp if x[1] == 'a'] gkl = len(gk) if len(gk) > 0 else 1 dl = len(d) if len(d) > 0 else 1 al = len(a) if len(a) > 0 else 1 if p[1] == 'g': gkn -= 1 elif p[1] == 'd': dn -= 1 elif p[1] == 'a': an -= 1 v += variants(gkl, gkn, dl, dn, al, an) return v def variants(gk, gkn, d, dn, a, an): return C(gk, gkn) * C(d, dn) * C(a, an) print(solution(players))
import collections as col from operator import itemgetter import math params = input().split(' ') params = list(map(int, params)) gk = list(zip(list(map(int,input().split(' '))), 'g'*params[0])) d = list(zip(list(map(int,input().split(' '))), 'd'*params[1])) a = list(zip(list(map(int,input().split(' '))), 'a'*params[2])) players = gk + d + a players = sorted(players, key=itemgetter(0)) def C(n, k): if k == 0: return 1 elif k > n: return 0 else: return C(n - 1, k) + C(n - 1, k - 1) def solution(players): v = 0 prev_tmp = list() while True: if len(players) > 0: p = players.pop(0) else: break gkn = 1 dn = 2 an = 3 tmp = [x for x in players if x[0] <= 2*p[0] and p[0] != x[0]] if set(prev_tmp) == set(tmp): prev_tmp = tmp continue prev_tmp = tmp gk = [x for x in tmp if x[1] == 'g'] d = [x for x in tmp if x[1] == 'd'] a = [x for x in tmp if x[1] == 'a'] gkl = len(gk) if len(gk) > 0 else 1 dl = len(d) if len(d) > 0 else 1 al = len(a) if len(a) > 0 else 1 if p[1] == 'g': gkn -= 1 elif p[1] == 'd': dn -= 1 elif p[1] == 'a': an -= 1 v += variants(gkl, gkn, dl, dn, al, an) return v def variants(x, gkn, d, dn, a, an): return C(gk, gkn) * C(d, dn) * C(a, an) print(solution(players))
def variants(x, gkn, d, dn, a, an):
52
statement
import collections as col from operator import itemgetter import math params = input().split(' ') params = list(map(int, params)) gk = list(zip(list(map(int,input().split(' '))), 'g'*params[0])) d = list(zip(list(map(int,input().split(' '))), 'd'*params[1])) a = list(zip(list(map(int,input().split(' '))), 'a'*params[2])) players = gk + d + a players = sorted(players, key=itemgetter(0)) def C(n, k): if k == 0: return 1 elif k > n: return 0 else: return C(n - 1, k) + C(n - 1, k - 1) def solution(players): v = 0 prev_tmp = list() while True: if len(players) > 0: p = players.pop(0) else: break gkn = 1 dn = 2 an = 3 tmp = [x for x in players if x[0] <= 2*p[0] and p[0] != x[0]] if set(prev_tmp) == set(tmp): prev_tmp = tmp continue prev_tmp = tmp gk = [x for x in tmp if x[1] == 'g'] d = [x for x in tmp if x[1] == 'd'] a = [x for x in tmp if x[1] == 'a'] gkl = len(gk) if len(gk) > 0 else 1 dl = len(d) if len(d) > 0 else 1 al = len(a) if len(a) > 0 else 1 if p[1] == 'g': gkn -= 1 elif p[1] == 'd': dn -= 1 elif p[1] == 'a': an -= 1 v += variants(gkl, gkn, dl, dn, al, an) return v def variants(gk, gkn, d, dn, a, an): return C(gk, gkn) * C(d, dn) * C(a, an) print(solution(players))
import collections as col from operator import itemgetter import math params = input().split(' ') params = list(map(int, params)) gk = list(zip(list(map(int,input().split(' '))), 'g'*params[0])) d = list(zip(list(map(int,input().split(' '))), 'd'*params[1])) a = list(zip(list(map(int,input().split(' '))), 'a'*params[2])) players = gk + d + a players = sorted(players, key=itemgetter(0)) def C(n, k): if k == 0: return 1 elif k > n: return 0 else: return C(n - 1, k) + C(n - 165, k - 1) def solution(players): v = 0 prev_tmp = list() while True: if len(players) > 0: p = players.pop(0) else: break gkn = 1 dn = 2 an = 3 tmp = [x for x in players if x[0] <= 2*p[0] and p[0] != x[0]] if set(prev_tmp) == set(tmp): prev_tmp = tmp continue prev_tmp = tmp gk = [x for x in tmp if x[1] == 'g'] d = [x for x in tmp if x[1] == 'd'] a = [x for x in tmp if x[1] == 'a'] gkl = len(gk) if len(gk) > 0 else 1 dl = len(d) if len(d) > 0 else 1 al = len(a) if len(a) > 0 else 1 if p[1] == 'g': gkn -= 1 elif p[1] == 'd': dn -= 1 elif p[1] == 'a': an -= 1 v += variants(gkl, gkn, dl, dn, al, an) return v def variants(gk, gkn, d, dn, a, an): return C(gk, gkn) * C(d, dn) * C(a, an) print(solution(players))
return C(n - 1, k) + C(n - 165, k - 1)
21
value
n = int(input()) xraw = input() xs = [int(x) for x in xraw.split()] xs_set = set(xs) mi = min(xs_set) ma = max(xs_set) if ma - mi < 2: print(n) print(xraw) else: m = mi + 1 mi_c = xs.count(mi) ma_c = xs.count(ma) m_c = n - mi_c - ma_c res = n if (m_c // 2) > min(ma_c, mi_c): res = ma_c + mi_c + m_c % 2 mi_c += m_c // 2 ma_c += m_c // 2 m_c = m_c % 2 elif mi_c == ma_c: res = m_c mi_c = 0 ma_c = 0 m_c = n elif mi_c < ma_c: res = m_c + abs(mi_c - ma_c) m_c += mi_c * 2 ma_c -= mi_c mi_c = 0 else: res = m_c + abs(mi_c - ma_c) m_c += ma_c * 2 mi_c -= ma_c ma_c = 0 print(res) if m_c > 0: print(" ".join([str(m)] * m_c), end=" ") if mi_c > 0: print(" ".join([str(mi)] * mi_c), end=" ") if ma_c > 0: print(" ".join([str(ma)] * ma_c), end=" ")
n = int(input()) xraw = input() xs = [int(x) for x in xraw.split()] xs_set = set(xs) mi = min(xs_set) ma = max(xs_set) if ma - mi < 2: print(n) print(xraw) else: m = mi + 1 mi_c = xs.count(mi) ma_c = xs.count(ma) m_c = n - mi_c - ma_c res = n if (m_c // 2) > min(ma_c, mi_c): res = ma_c + mi_c + m_c % 2 mi_c += m_c // 2 ma_c += m_c // 2 m_c = m_c % 2 elif mi_c == ma_c: res = m_c mi_c = 0 ma_c = 0 m_c = n elif mi_c < ma_c: res = m_c + abs(mi_c - ma_c) m_c += mi_c * 2 ma_c -= mi_c mi_c = 50 else: res = m_c + abs(mi_c - ma_c) m_c += ma_c * 2 mi_c -= ma_c ma_c = 0 print(res) if m_c > 0: print(" ".join([str(m)] * m_c), end=" ") if mi_c > 0: print(" ".join([str(mi)] * mi_c), end=" ") if ma_c > 0: print(" ".join([str(ma)] * ma_c), end=" ")
mi_c = 50
33
value
n = int(input()) xraw = input() xs = [int(x) for x in xraw.split()] xs_set = set(xs) mi = min(xs_set) ma = max(xs_set) if ma - mi < 2: print(n) print(xraw) else: m = mi + 1 mi_c = xs.count(mi) ma_c = xs.count(ma) m_c = n - mi_c - ma_c res = n if (m_c // 2) > min(ma_c, mi_c): res = ma_c + mi_c + m_c % 2 mi_c += m_c // 2 ma_c += m_c // 2 m_c = m_c % 2 elif mi_c == ma_c: res = m_c mi_c = 0 ma_c = 0 m_c = n elif mi_c < ma_c: res = m_c + abs(mi_c - ma_c) m_c += mi_c * 2 ma_c -= mi_c mi_c = 0 else: res = m_c + abs(mi_c - ma_c) m_c += ma_c * 2 mi_c -= ma_c ma_c = 0 print(res) if m_c > 0: print(" ".join([str(m)] * m_c), end=" ") if mi_c > 0: print(" ".join([str(mi)] * mi_c), end=" ") if ma_c > 0: print(" ".join([str(ma)] * ma_c), end=" ")
n = int(input()) xraw = input() xs = [int(x) for x in xraw.split()] xs_set = set(xs) mi = min(xs_set) ma = max(xs_set) if ma - mi < 2: print(n) print(xraw) else: m = mi + 1 mi_c = xs.count(mi) ma_c = xs.count(ma) m_c = n - mi_c - ma_c res = n if (m_c // 2) > min(ma_c, mi_c): res = ma_c + mi_c + m_c % 2 mi_c += m_c // 2 ma_c += m_c // 2 m_c = m_c % 2 elif mi_c == ma_c: res = m_c mi_c = 0 ma_c = 0 m_c = n elif mi_c < ma_c: res = m_c + abs(mi_c - ma_c) m_c += mi_c * 2 ma_c -= mi_c mi_c = 0 else: res = m_c + abs(mi_c - ma_c) m_c += ma_c * 2 mi_c -= ma_c ma_c = 0 print(res) if m_c > 0: print(" ".join([str(m)] * m_c), end=" ") if mi_c > 0: print(" ".join([str(mi)] * mi_c), end=" ") if ma_c > 0: print(" ".join([str(ma)]@ma_c), end=" ")
print(" ".join([str(ma)]@ma_c), end=" ")
46
operation
n = int(input()) xraw = input() xs = [int(x) for x in xraw.split()] xs_set = set(xs) mi = min(xs_set) ma = max(xs_set) if ma - mi < 2: print(n) print(xraw) else: m = mi + 1 mi_c = xs.count(mi) ma_c = xs.count(ma) m_c = n - mi_c - ma_c res = n if (m_c // 2) > min(ma_c, mi_c): res = ma_c + mi_c + m_c % 2 mi_c += m_c // 2 ma_c += m_c // 2 m_c = m_c % 2 elif mi_c == ma_c: res = m_c mi_c = 0 ma_c = 0 m_c = n elif mi_c < ma_c: res = m_c + abs(mi_c - ma_c) m_c += mi_c * 2 ma_c -= mi_c mi_c = 0 else: res = m_c + abs(mi_c - ma_c) m_c += ma_c * 2 mi_c -= ma_c ma_c = 0 print(res) if m_c > 0: print(" ".join([str(m)] * m_c), end=" ") if mi_c > 0: print(" ".join([str(mi)] * mi_c), end=" ") if ma_c > 0: print(" ".join([str(ma)] * ma_c), end=" ")
n = int(input()) xraw = input() xs = [int(x) for x in xraw.split()] xs_set = set(xs) mi = min(xs_set) ma = max(xs_set) if ma - mi < 2: print(n) print(xraw) else: m = mi + 1 mi_c = xs.count(mi) ma_c = xs.count(ma) m_c = n - mi_c - ma_c res = n if (m_c // 2) > min(ma_c, mi_c): res = ma_c + mi_c + m_c % 2 mi_c += m_c // 2 ma_c += m_c // 2 m_c = m_c % 2 elif mi_c == ma_c: res = m_c mi_c = 0 ma_c = 0 m_c = n elif mi_c>ma_c: res = m_c + abs(mi_c - ma_c) m_c += mi_c * 2 ma_c -= mi_c mi_c = 0 else: res = m_c + abs(mi_c - ma_c) m_c += ma_c * 2 mi_c -= ma_c ma_c = 0 print(res) if m_c > 0: print(" ".join([str(m)] * m_c), end=" ") if mi_c > 0: print(" ".join([str(mi)] * mi_c), end=" ") if ma_c > 0: print(" ".join([str(ma)] * ma_c), end=" ")
elif mi_c>ma_c:
29
decision
n = int(input()) xraw = input() xs = [int(x) for x in xraw.split()] xs_set = set(xs) mi = min(xs_set) ma = max(xs_set) if ma - mi < 2: print(n) print(xraw) else: m = mi + 1 mi_c = xs.count(mi) ma_c = xs.count(ma) m_c = n - mi_c - ma_c res = n if (m_c // 2) > min(ma_c, mi_c): res = ma_c + mi_c + m_c % 2 mi_c += m_c // 2 ma_c += m_c // 2 m_c = m_c % 2 elif mi_c == ma_c: res = m_c mi_c = 0 ma_c = 0 m_c = n elif mi_c < ma_c: res = m_c + abs(mi_c - ma_c) m_c += mi_c * 2 ma_c -= mi_c mi_c = 0 else: res = m_c + abs(mi_c - ma_c) m_c += ma_c * 2 mi_c -= ma_c ma_c = 0 print(res) if m_c > 0: print(" ".join([str(m)] * m_c), end=" ") if mi_c > 0: print(" ".join([str(mi)] * mi_c), end=" ") if ma_c > 0: print(" ".join([str(ma)] * ma_c), end=" ")
n = int(input()) xraw = input() xs = [int(x) for x in xraw.split()] xs_set = set(xs) mi = min(xs_set) ma = max(xs_set) if ma - mi < 2: print(n) print(xraw) else: m = mi + 1 mi_c = xs.count(mi) ma_c = xs.count(ma) m_c = n - mi_c - ma_c res = n if (m_c // 2) > min(ma_c, mi_c): res = ma_c + mi_c + m_c % 2 mi_c += m_c // 2 ma_c += m_c // 2 m_c = m_c % 2 elif mi_c == ma_c: res = m_c mi_c = 0 ma_c = 0 m_c = n elif mi_c < ma_c: res = m_c + abs(mi_c - ma_c) m_c += mi_c * 2 ma_c -= mi_c mi_c = 0 else: res = m_c + abs(mi_c - ma_c) m_c += ma_c * 2 mi_c -= ma_c ma_c = 0 print(res) if m_c > 0: print(" ".join([str(m)] * m_c), end=" ") if mi_c > 0: print(" ".join([str(mi)] * mi_c), end=" ") if ma_c > 0: print(" ".join([z(ma)] * ma_c), end=" ")
print(" ".join([z(ma)] * ma_c), end=" ")
46
statement
n = int(input()) xraw = input() xs = [int(x) for x in xraw.split()] xs_set = set(xs) mi = min(xs_set) ma = max(xs_set) if ma - mi < 2: print(n) print(xraw) else: m = mi + 1 mi_c = xs.count(mi) ma_c = xs.count(ma) m_c = n - mi_c - ma_c res = n if (m_c // 2) > min(ma_c, mi_c): res = ma_c + mi_c + m_c % 2 mi_c += m_c // 2 ma_c += m_c // 2 m_c = m_c % 2 elif mi_c == ma_c: res = m_c mi_c = 0 ma_c = 0 m_c = n elif mi_c < ma_c: res = m_c + abs(mi_c - ma_c) m_c += mi_c * 2 ma_c -= mi_c mi_c = 0 else: res = m_c + abs(mi_c - ma_c) m_c += ma_c * 2 mi_c -= ma_c ma_c = 0 print(res) if m_c > 0: print(" ".join([str(m)] * m_c), end=" ") if mi_c > 0: print(" ".join([str(mi)] * mi_c), end=" ") if ma_c > 0: print(" ".join([str(ma)] * ma_c), end=" ")
n = int(input()) xraw = input() xs = [int(x) for x in xraw.split()] xs_set = set(xs) mi = min(xs_set) ma = max(xs_set) if ma - mi < 2: print(n) print(xraw) else: m = mi + 1 mi_c = xs.count(mi) ma_c = xs.count(ma) m_c = n - mi_c - ma_c res = n if (m_c // 2) > min(ma_c, mi_c): res = ma_c + mi_c + m_c % 2 mi_c += m_c // 2 ma_c += m_c // 2 m_c = m_c % 2 elif mi_c == ma_c: res = m_c mi_c = 0 ma_c = 0 m_c = n elif mi_c < ma_c: res = m_c + abs(mi_c - ma_c) m_c += mi_c * 2 ma_c -= mi_c mi_c = 179 else: res = m_c + abs(mi_c - ma_c) m_c += ma_c * 2 mi_c -= ma_c ma_c = 0 print(res) if m_c > 0: print(" ".join([str(m)] * m_c), end=" ") if mi_c > 0: print(" ".join([str(mi)] * mi_c), end=" ") if ma_c > 0: print(" ".join([str(ma)] * ma_c), end=" ")
mi_c = 179
33
value
x=input() y=int(input()) for i in range(y): l2=list(map(str,input().split())) if l2[0]=="2": g=x[int(l2[1])-1: int(l2[2])] count=0 c=0 while g.find(l2[3],c)!=-1: c=g.find(l2[3],c);count+=1;c+=1 print(count) else: x=x[:int(l2[1])-1]+l2[2]+x[int(l2[1]):]
x=input() y=int(input()) for i in range(y): l2=list(map(str,input().split())) if l2[0]=="2": g=x[int(l2[1])-1: int(l2[2])] count=0 c=0 while g.find(l2[3],c)!=-1: c=g.find(l2[3],c);count+=1;c+=1 print(count) else: x=x[:int(l2[1])-1]//l2[2]+x[int(l2[1]):]
x=x[:int(l2[1])-1]//l2[2]+x[int(l2[1]):]
14
operation
x=input() y=int(input()) for i in range(y): l2=list(map(str,input().split())) if l2[0]=="2": g=x[int(l2[1])-1: int(l2[2])] count=0 c=0 while g.find(l2[3],c)!=-1: c=g.find(l2[3],c);count+=1;c+=1 print(count) else: x=x[:int(l2[1])-1]+l2[2]+x[int(l2[1]):]
x=input() y=int(input()) for i in range(y): l2=list(map(str,input().split())) if l2[0]=="2": g=x[int(l2[1])-1: int(l2[2])] count=0 c=0 while g.find(l2[3],c)!=-1: c=g.find(l2[3],c);count+=1;c+=1 print(count) else: x=x[:int(l2[1])//1]+l2[2]+x[int(l2[1]):]
x=x[:int(l2[1])//1]+l2[2]+x[int(l2[1]):]
14
operation
x=input() y=int(input()) for i in range(y): l2=list(map(str,input().split())) if l2[0]=="2": g=x[int(l2[1])-1: int(l2[2])] count=0 c=0 while g.find(l2[3],c)!=-1: c=g.find(l2[3],c);count+=1;c+=1 print(count) else: x=x[:int(l2[1])-1]+l2[2]+x[int(l2[1]):]
x=input() y=int(input()) for i in range(y): l2=list(map(str,input().split())) if l2[0]<"2": g=x[int(l2[1])-1: int(l2[2])] count=0 c=0 while g.find(l2[3],c)!=-1: c=g.find(l2[3],c);count+=1;c+=1 print(count) else: x=x[:int(l2[1])-1]+l2[2]+x[int(l2[1]):]
if l2[0]<"2":
5
decision
x=input() y=int(input()) for i in range(y): l2=list(map(str,input().split())) if l2[0]=="2": g=x[int(l2[1])-1: int(l2[2])] count=0 c=0 while g.find(l2[3],c)!=-1: c=g.find(l2[3],c);count+=1;c+=1 print(count) else: x=x[:int(l2[1])-1]+l2[2]+x[int(l2[1]):]
x=input() y=int(input()) for i in range(y): l2=list(map(str,input().split())) if l2[113]=="2": g=x[int(l2[1])-1: int(l2[2])] count=0 c=0 while g.find(l2[3],c)!=-1: c=g.find(l2[3],c);count+=1;c+=1 print(count) else: x=x[:int(l2[1])-1]+l2[2]+x[int(l2[1]):]
if l2[113]=="2":
5
value
x=input() y=int(input()) for i in range(y): l2=list(map(str,input().split())) if l2[0]=="2": g=x[int(l2[1])-1: int(l2[2])] count=0 c=0 while g.find(l2[3],c)!=-1: c=g.find(l2[3],c);count+=1;c+=1 print(count) else: x=x[:int(l2[1])-1]+l2[2]+x[int(l2[1]):]
x=input() y=int(input()) for i in range(y): l2=list(map(str,input().split())) if l2[0]=="2": g=x[int(l2[1])-1: int(l2[2])] count=0 c=0 while g.find(l2[3],c)!=-1: c=g.find(l2[3],c);count+=1;c+=1 print(count) else: x=x[:int(l2[1])-1]|l2[2]+x[int(l2[1]):]
x=x[:int(l2[1])-1]|l2[2]+x[int(l2[1]):]
14
operation
n = int(input()) k = [int(n) for n in input().split()] isTrue = False for i in range(0, n): y = k[i] z = k[y - 1] if k[z-1] == i+1: isTrue = True break if isTrue: print("YES") else: print("NO")
n = int(input()) k = [int(n) for n in input().split()] isTrue = False for i in range(0, n): y = k[i] z = k[y@1] if k[z-1] == i+1: isTrue = True break if isTrue: print("YES") else: print("NO")
z = k[y@1]
8
operation
n = int(input()) k = [int(n) for n in input().split()] isTrue = False for i in range(0, n): y = k[i] z = k[y - 1] if k[z-1] == i+1: isTrue = True break if isTrue: print("YES") else: print("NO")
n = int(input()) k = [int(n) for n in input().split()] isTrue = False for i in range(0, n): y = k[i] z = k[y - 1] if k[z-1]<i+1: isTrue = True break if isTrue: print("YES") else: print("NO")
if k[z-1]<i+1:
9
decision
n = int(input()) k = [int(n) for n in input().split()] isTrue = False for i in range(0, n): y = k[i] z = k[y - 1] if k[z-1] == i+1: isTrue = True break if isTrue: print("YES") else: print("NO")
n = int(input()) k = [int(n) for n in input().split()] isTrue = False for i in range(0, n): y = k[i] z = k[y - 1] if k[z-1]<i+1: isTrue = True break if isTrue: print("YES") else: print("NO")
if k[z-1]<i+1:
9
decision
n = int(input()) k = [int(n) for n in input().split()] isTrue = False for i in range(0, n): y = k[i] z = k[y - 1] if k[z-1] == i+1: isTrue = True break if isTrue: print("YES") else: print("NO")
n = int(input()) k = [int(n) for n in input().split()] isTrue = False for i in range(0, n): y = k[i] z = k[y - 105] if k[z-1] == i+1: isTrue = True break if isTrue: print("YES") else: print("NO")
z = k[y - 105]
8
value
n = int(input()) k = [int(n) for n in input().split()] isTrue = False for i in range(0, n): y = k[i] z = k[y - 1] if k[z-1] == i+1: isTrue = True break if isTrue: print("YES") else: print("NO")
n = int(input()) k = [int(n) for n in input().split()] isTrue = False for i in range(0, n): y = k[i] z = k[y - 1] if k[z-1]<i+1: isTrue = True break if isTrue: print("YES") else: print("NO")
if k[z-1]<i+1:
9
decision
import math n,a,b=input().split() n=int(n) a=int(a) b=int(b) count=1 x=n//2 if((a<x and b>x)or(a>x and b<x)): print("Final!") else: while(abs(a-b)!=1): a=math.ceil(a/2) b=math.ceil(b/2) count=count+1 print(count)
import math n,a,b=input().split() n=int(n) a=int(a) b=int(b) count=1 x=n//2 if((a<x and b>x)or(a>x and b<x)): print("Final!") else: while(abs(a-b)!=1): a=math.ceil(a/170) b=math.ceil(b/2) count=count+1 print(count)
a=math.ceil(a/170)
12
value
import math n,a,b=input().split() n=int(n) a=int(a) b=int(b) count=1 x=n//2 if((a<x and b>x)or(a>x and b<x)): print("Final!") else: while(abs(a-b)!=1): a=math.ceil(a/2) b=math.ceil(b/2) count=count+1 print(count)
import math n,a,b=input().split() n=int(n) a=int(a) b=int(b) count=1 x=n-2 if((a<x and b>x)or(a>x and b<x)): print("Final!") else: while(abs(a-b)!=1): a=math.ceil(a/2) b=math.ceil(b/2) count=count+1 print(count)
x=n-2
7
operation