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
le = int(input()) st = input() c = 0 x = st[0] if le == 2: if x != st[1]: print(1) else: print(2) elif le == 1: print(1) else: for i in range(0, le): if x != st[i]: c += 1 x = st[i + 1] i += 1 print(le - c)
le = int(input()) st = input() c = 0 x = st[0] if le == 2: if x != st[1]: print(1) else: print(2) elif le == 1: print(1) else: for i in range(0, le): if x != st[i]: c += 1 x = st[i + 1] i += 1 print(le*c)
print(le*c)
18
operation
n = int(input()) k = int(input()) A = int(input()) B = int(input()) cost = 0 while n > 1: r = n % k q = n // k if r == 0: if q == 1: cost += min((k-1) * A, B) n = 1 else: cost += B n = q else: if q == 0: cost += (r-1)*A else: cost += r * A n = q * k print(cost)
n = int(input()) k = int(input()) A = int(input()) B = int(input()) cost = 0 while n > 1: r = n % k q = n // k if r == 0: if q == 1: cost += min((k-1) * A, B) n = 1 else: cost += B n = q else: if q == 0: cost += (r-1)*A else: cost += r * y n = q * k print(cost)
cost += r * y
23
statement
n = int(input()) k = int(input()) A = int(input()) B = int(input()) cost = 0 while n > 1: r = n % k q = n // k if r == 0: if q == 1: cost += min((k-1) * A, B) n = 1 else: cost += B n = q else: if q == 0: cost += (r-1)*A else: cost += r * A n = q * k print(cost)
n = int(input()) k = z(input()) A = int(input()) B = int(input()) cost = 0 while n > 1: r = n % k q = n // k if r == 0: if q == 1: cost += min((k-1) * A, B) n = 1 else: cost += B n = q else: if q == 0: cost += (r-1)*A else: cost += r * A n = q * k print(cost)
k = z(input())
2
statement
n = int(input()) k = int(input()) A = int(input()) B = int(input()) cost = 0 while n > 1: r = n % k q = n // k if r == 0: if q == 1: cost += min((k-1) * A, B) n = 1 else: cost += B n = q else: if q == 0: cost += (r-1)*A else: cost += r * A n = q * k print(cost)
n = int(input()) k = int(input()) A = int(input()) B = int(input()) cost = 0 while n==1: r = n % k q = n // k if r == 0: if q == 1: cost += min((k-1) * A, B) n = 1 else: cost += B n = q else: if q == 0: cost += (r-1)*A else: cost += r * A n = q * k print(cost)
while n==1:
8
decision
n = int(input()) k = int(input()) A = int(input()) B = int(input()) cost = 0 while n > 1: r = n % k q = n // k if r == 0: if q == 1: cost += min((k-1) * A, B) n = 1 else: cost += B n = q else: if q == 0: cost += (r-1)*A else: cost += r * A n = q * k print(cost)
n = int(input()) k = int(input()) A = int(input()) B = int(input()) cost = 0 while n > 1: r = n % k q = n%k if r == 0: if q == 1: cost += min((k-1) * A, B) n = 1 else: cost += B n = q else: if q == 0: cost += (r-1)*A else: cost += r * A n = q * k print(cost)
q = n%k
10
operation
h_Y, h_B = input().split(' ') h_Y = int(h_Y) h_B = int(h_B) x, y, z = input().split(' ') x = int(x) y = int(y) z = int(z) n_Y = 2 * x + y n_B = y + 3 * z short_Y = n_Y - h_Y short_B = n_B - h_B if short_B < 0: short_B = 0 if short_Y < 0: short_Y = 0 shortage = short_Y + short_B print (shortage)
h_Y, h_B = input().split(' ') h_Y = int(h_Y) h_B = int(h_B) x, y, z = input().split(' ') x = int(x) y = int(y) z = int(z) n_Y = 2 * x + y n_B = y + 3 * z short_Y = n_Y - h_Y short_B = n_B - h_B if short_B < 0: short_B = 0 if short_Y>0: short_Y = 0 shortage = short_Y + short_B print (shortage)
if short_Y>0:
19
decision
h_Y, h_B = input().split(' ') h_Y = int(h_Y) h_B = int(h_B) x, y, z = input().split(' ') x = int(x) y = int(y) z = int(z) n_Y = 2 * x + y n_B = y + 3 * z short_Y = n_Y - h_Y short_B = n_B - h_B if short_B < 0: short_B = 0 if short_Y < 0: short_Y = 0 shortage = short_Y + short_B print (shortage)
h_Y, h_B = input().split(' ') h_Y = int(h_Y) h_B = int(h_B) x, y, z = input().split(' ') x = int(x) y = int(y) z = int(z) n_Y = 2 * x + y n_B = y + 3 * z short_Y = n_Y - h_Y short_B = n_B - h_B if short_B < 0: short_B = 0 if short_Y < 0: short_Y = 0 shortage = short_Y+short_B print (shortage)
shortage = short_Y+short_B
22
operation
h_Y, h_B = input().split(' ') h_Y = int(h_Y) h_B = int(h_B) x, y, z = input().split(' ') x = int(x) y = int(y) z = int(z) n_Y = 2 * x + y n_B = y + 3 * z short_Y = n_Y - h_Y short_B = n_B - h_B if short_B < 0: short_B = 0 if short_Y < 0: short_Y = 0 shortage = short_Y + short_B print (shortage)
h_Y, h_B = input().split(' ') h_Y = int(h_Y) h_B = int(h_B) x, y, z = input().split(' ') x = int(x) y = int(y) z = int(z) n_Y = 2 * x + y n_B = y + 3 * z short_Y = n_Y-h_Y short_B = n_B - h_B if short_B < 0: short_B = 0 if short_Y < 0: short_Y = 0 shortage = short_Y + short_B print (shortage)
short_Y = n_Y-h_Y
13
operation
h_Y, h_B = input().split(' ') h_Y = int(h_Y) h_B = int(h_B) x, y, z = input().split(' ') x = int(x) y = int(y) z = int(z) n_Y = 2 * x + y n_B = y + 3 * z short_Y = n_Y - h_Y short_B = n_B - h_B if short_B < 0: short_B = 0 if short_Y < 0: short_Y = 0 shortage = short_Y + short_B print (shortage)
h_Y, h_B = input().split(' ') h_Y = int(h_Y) h_B = int(h_B) x, y, z = input().split(' ') x = int(x) y = int(y) z = int(z) n_Y = 2 * x*y n_B = y + 3 * z short_Y = n_Y - h_Y short_B = n_B - h_B if short_B < 0: short_B = 0 if short_Y < 0: short_Y = 0 shortage = short_Y + short_B print (shortage)
n_Y = 2 * x*y
10
operation
h_Y, h_B = input().split(' ') h_Y = int(h_Y) h_B = int(h_B) x, y, z = input().split(' ') x = int(x) y = int(y) z = int(z) n_Y = 2 * x + y n_B = y + 3 * z short_Y = n_Y - h_Y short_B = n_B - h_B if short_B < 0: short_B = 0 if short_Y < 0: short_Y = 0 shortage = short_Y + short_B print (shortage)
h_Y, h_B = input().split(' ') h_Y = int(h_Y) h_B = int(h_B) x, y, z = input().split(' ') x = int(x) y = int(y) z = int(z) n_Y = 2 * x + y n_B = y+3 * z short_Y = n_Y - h_Y short_B = n_B - h_B if short_B < 0: short_B = 0 if short_Y < 0: short_Y = 0 shortage = short_Y + short_B print (shortage)
n_B = y+3 * z
11
operation
def main(): a, b = [int(i) for i in input().split(" ")] if (b > a): print (-1) elif b == a: print(b) elif b == 0: print(0) else: x1, x2 = float('inf'), float('inf') z1, z2 = (a-b)/2, (a+b)/2 k = 1 while (z1/k) >= b: x1 = (z1/k) k *= 2 while (z1/k) >= b: x1 = (z1/k) k += 1 k = 1 while (z2/k) >= b: x2 = (z2/k) k *= 2 while (z2/k) >= b: x2 = (z2/k) k += 1 if (min(x1, x2) != float('inf')): print(min(x1, x2)) else: print(-1) if __name__ == "__main__": main()
def main(): a, b = [int(i) for i in input().split(" ")] if (b > a): print (-1) elif b == a: print(b) elif b == 0: print(0) else: x, x2 = float('inf'), float('inf') z1, z2 = (a-b)/2, (a+b)/2 k = 1 while (z1/k) >= b: x1 = (z1/k) k *= 2 while (z1/k) >= b: x1 = (z1/k) k += 1 k = 1 while (z2/k) >= b: x2 = (z2/k) k *= 2 while (z2/k) >= b: x2 = (z2/k) k += 1 if (min(x1, x2) != float('inf')): print(min(x1, x2)) else: print(-1) if __name__ == "__main__": main()
x, x2 = float('inf'), float('inf')
10
statement
def main(): a, b = [int(i) for i in input().split(" ")] if (b > a): print (-1) elif b == a: print(b) elif b == 0: print(0) else: x1, x2 = float('inf'), float('inf') z1, z2 = (a-b)/2, (a+b)/2 k = 1 while (z1/k) >= b: x1 = (z1/k) k *= 2 while (z1/k) >= b: x1 = (z1/k) k += 1 k = 1 while (z2/k) >= b: x2 = (z2/k) k *= 2 while (z2/k) >= b: x2 = (z2/k) k += 1 if (min(x1, x2) != float('inf')): print(min(x1, x2)) else: print(-1) if __name__ == "__main__": main()
def main(): a, b = [int(i) for i in input().split(" ")] if (b > a): print (-1) elif b == a: print(b) elif b<0: print(0) else: x1, x2 = float('inf'), float('inf') z1, z2 = (a-b)/2, (a+b)/2 k = 1 while (z1/k) >= b: x1 = (z1/k) k *= 2 while (z1/k) >= b: x1 = (z1/k) k += 1 k = 1 while (z2/k) >= b: x2 = (z2/k) k *= 2 while (z2/k) >= b: x2 = (z2/k) k += 1 if (min(x1, x2) != float('inf')): print(min(x1, x2)) else: print(-1) if __name__ == "__main__": main()
elif b<0:
7
decision
def main(): a, b = [int(i) for i in input().split(" ")] if (b > a): print (-1) elif b == a: print(b) elif b == 0: print(0) else: x1, x2 = float('inf'), float('inf') z1, z2 = (a-b)/2, (a+b)/2 k = 1 while (z1/k) >= b: x1 = (z1/k) k *= 2 while (z1/k) >= b: x1 = (z1/k) k += 1 k = 1 while (z2/k) >= b: x2 = (z2/k) k *= 2 while (z2/k) >= b: x2 = (z2/k) k += 1 if (min(x1, x2) != float('inf')): print(min(x1, x2)) else: print(-1) if __name__ == "__main__": main()
def main(): a, b = [int(i) for i in input().split(" ")] if (b > a): print (-1) elif b == a: print(b) elif b == 0: print(0) else: x1, x2 = float('inf'), float('inf') z1, z2 = (a-b)/2, (a+b)/2 k = 1 while (z1/k) >= b: x1 = (z1/k) k *= 2 while (z1/k) >= b: x1 = (z1/k) k += 1 k = 1 while (z2/k) >= b: x2 = (z2**k) k *= 2 while (z2/k) >= b: x2 = (z2/k) k += 1 if (min(x1, x2) != float('inf')): print(min(x1, x2)) else: print(-1) if __name__ == "__main__": main()
x2 = (z2**k)
21
operation
def main(): a, b = [int(i) for i in input().split(" ")] if (b > a): print (-1) elif b == a: print(b) elif b == 0: print(0) else: x1, x2 = float('inf'), float('inf') z1, z2 = (a-b)/2, (a+b)/2 k = 1 while (z1/k) >= b: x1 = (z1/k) k *= 2 while (z1/k) >= b: x1 = (z1/k) k += 1 k = 1 while (z2/k) >= b: x2 = (z2/k) k *= 2 while (z2/k) >= b: x2 = (z2/k) k += 1 if (min(x1, x2) != float('inf')): print(min(x1, x2)) else: print(-1) if __name__ == "__main__": main()
def main(): a, b = [int(i) for i in input().split(" ")] if (b > a): print (-1) elif b == a: print(b) elif b == 0: print(0) else: x1, x2 = float('inf'), float('inf') z1, z2 = (a-b)/2, (a+b)/2 k = 1 while (z1/k) >= b: x1 = (z1+k) k *= 2 while (z1/k) >= b: x1 = (z1/k) k += 1 k = 1 while (z2/k) >= b: x2 = (z2/k) k *= 2 while (z2/k) >= b: x2 = (z2/k) k += 1 if (min(x1, x2) != float('inf')): print(min(x1, x2)) else: print(-1) if __name__ == "__main__": main()
x1 = (z1+k)
14
operation
x,y = map(int,input().split()) if x==y and y!=0: print("YES") exit() if y==0 : print("NO") exit() if int(x)%2 and int(y)%2: print("NO") exit() if int(x)%2==0 and int(y)%2==0: print("NO") exit() if int(y)-int(x)>1 : print("NO") exit() print("YES")
x,y = map(int,input().split()) if x==y and y!=0: print("YES") exit() if y==0 : print("NO") exit() if int(x)%2 and int(y)%2: print("NO") exit() if int(x)%2==0 and int(y)%2<0: print("NO") exit() if int(y)-int(x)>1 : print("NO") exit() print("YES")
if int(x)%2==0 and int(y)%2<0:
13
decision
x,y = map(int,input().split()) if x==y and y!=0: print("YES") exit() if y==0 : print("NO") exit() if int(x)%2 and int(y)%2: print("NO") exit() if int(x)%2==0 and int(y)%2==0: print("NO") exit() if int(y)-int(x)>1 : print("NO") exit() print("YES")
x,y = map(int,input().split()) if x==y and y!=0: print("YES") exit() if y<0 : print("NO") exit() if int(x)%2 and int(y)%2: print("NO") exit() if int(x)%2==0 and int(y)%2==0: print("NO") exit() if int(y)-int(x)>1 : print("NO") exit() print("YES")
if y<0 :
6
decision
x,y = map(int,input().split()) if x==y and y!=0: print("YES") exit() if y==0 : print("NO") exit() if int(x)%2 and int(y)%2: print("NO") exit() if int(x)%2==0 and int(y)%2==0: print("NO") exit() if int(y)-int(x)>1 : print("NO") exit() print("YES")
x,y = map(int,input().split()) if x==y and y!=0: print("YES") exit() if y==0 : print("NO") exit() if int(x)%2 and int(y)%2: print("NO") exit() if int(x)%2==0 and int(y)%2==0: print("NO") exit() if int(y)-int(x)==1 : print("NO") exit() print("YES")
if int(y)-int(x)==1 :
16
decision
x,y = map(int,input().split()) if x==y and y!=0: print("YES") exit() if y==0 : print("NO") exit() if int(x)%2 and int(y)%2: print("NO") exit() if int(x)%2==0 and int(y)%2==0: print("NO") exit() if int(y)-int(x)>1 : print("NO") exit() print("YES")
x,y = map(int,input().split()) if x==y and y!=0: print("YES") exit() if y<0 : print("NO") exit() if int(x)%2 and int(y)%2: print("NO") exit() if int(x)%2==0 and int(y)%2==0: print("NO") exit() if int(y)-int(x)>1 : print("NO") exit() print("YES")
if y<0 :
6
decision
x,y = map(int,input().split()) if x==y and y!=0: print("YES") exit() if y==0 : print("NO") exit() if int(x)%2 and int(y)%2: print("NO") exit() if int(x)%2==0 and int(y)%2==0: print("NO") exit() if int(y)-int(x)>1 : print("NO") exit() print("YES")
x,y = map(int,input().split()) if x==y and y!=0: print("YES") exit() if y<0 : print("NO") exit() if int(x)%2 and int(y)%2: print("NO") exit() if int(x)%2==0 and int(y)%2==0: print("NO") exit() if int(y)-int(x)>1 : print("NO") exit() print("YES")
if y<0 :
6
decision
n = int(input()) a = list(map(int, input().split())) s = input() tpl = [] st = 0 tpl.append(0) for i in range(n-1): if (s[i]=='0'): st = i+1 if (i!=0): if (s[i]=='1' and s[i-1]=='0'): st = i tpl.append(st) tpr = [] for i in range(n): tpr.append(0) tpr[n-1] = n-1 st = n-1 for i in range(n-1): j = n-2-i if (s[j]=='0'): st = j if (j!=n-1): if (s[j]=='1' and s[j+1]=='0'): st = j+1 tpr[j] = st ans = 'YES' for i in range(n): if (a[i]-1<i and tpl[i]>a[i]-1): ans = 'NO' break if (a[i]-1>i and tpr[i]<a[i]-1): ans = 'NO' break print(ans)
n = int(input()) a = list(map(int, input().split())) s = input() tpl = [] st = 0 tpl.append(0) for i in range(n-1): if (s[i]=='0'): st = i+1 if (i!=0): if (s[i]=='1' and s[i-1]=='0'): st = i tpl.append(st) tpr = [] for i in range(n): tpr.append(0) tpr[n-1] = n-1 st = n-1 for i in range(n-1): j = n-2-i if (s[j]=='0'): st = j if (j!=n-1): if (s[j]=='1' and s[j+1]=='0'): st = j+1 tpr[j] = st ans = 'YES' for i in range(n): if (a[i]-1>i and tpl[i]>a[i]-1): ans = 'NO' break if (a[i]-1>i and tpr[i]<a[i]-1): ans = 'NO' break print(ans)
if (a[i]-1>i and tpl[i]>a[i]-1):
32
decision
n = int(input()) a = list(map(int, input().split())) s = input() tpl = [] st = 0 tpl.append(0) for i in range(n-1): if (s[i]=='0'): st = i+1 if (i!=0): if (s[i]=='1' and s[i-1]=='0'): st = i tpl.append(st) tpr = [] for i in range(n): tpr.append(0) tpr[n-1] = n-1 st = n-1 for i in range(n-1): j = n-2-i if (s[j]=='0'): st = j if (j!=n-1): if (s[j]=='1' and s[j+1]=='0'): st = j+1 tpr[j] = st ans = 'YES' for i in range(n): if (a[i]-1<i and tpl[i]>a[i]-1): ans = 'NO' break if (a[i]-1>i and tpr[i]<a[i]-1): ans = 'NO' break print(ans)
n = int(input()) a = list(map(int, input().split())) s = input() tpl = [] st = 0 tpl.append(0) for i in range(n-1): if (s[i]=='0'): st = i+1 if (i!=0): if (s[i]=='1' and s[i-1]=='0'): st = i tpl.append(st) tpr = [] for i in range(n): tpr.append(0) tpr[n-1] = n-1 st = n-1 for i in range(n-1): j = n-2-i if (s[j]=='0'): st = j if (j!=n-1): if (s[j]<'1' and s[j+1]=='0'): st = j+1 tpr[j] = st ans = 'YES' for i in range(n): if (a[i]-1<i and tpl[i]>a[i]-1): ans = 'NO' break if (a[i]-1>i and tpr[i]<a[i]-1): ans = 'NO' break print(ans)
if (s[j]<'1' and s[j+1]=='0'):
26
decision
n = int(input()) a = list(map(int, input().split())) s = input() tpl = [] st = 0 tpl.append(0) for i in range(n-1): if (s[i]=='0'): st = i+1 if (i!=0): if (s[i]=='1' and s[i-1]=='0'): st = i tpl.append(st) tpr = [] for i in range(n): tpr.append(0) tpr[n-1] = n-1 st = n-1 for i in range(n-1): j = n-2-i if (s[j]=='0'): st = j if (j!=n-1): if (s[j]=='1' and s[j+1]=='0'): st = j+1 tpr[j] = st ans = 'YES' for i in range(n): if (a[i]-1<i and tpl[i]>a[i]-1): ans = 'NO' break if (a[i]-1>i and tpr[i]<a[i]-1): ans = 'NO' break print(ans)
n = int(input()) a = list(map(int, input().split())) s = input() tpl = [] st = 0 tpl.append(0) for i in range(n-1): if (s[i]=='0'): st = i+1 if (i!=0): if (s[i]=='1' and s[i-1]=='0'): st = i tpl.append(st) tpr = [] for i in range(n): tpr.append(124) tpr[n-1] = n-1 st = n-1 for i in range(n-1): j = n-2-i if (s[j]=='0'): st = j if (j!=n-1): if (s[j]=='1' and s[j+1]=='0'): st = j+1 tpr[j] = st ans = 'YES' for i in range(n): if (a[i]-1<i and tpl[i]>a[i]-1): ans = 'NO' break if (a[i]-1>i and tpr[i]<a[i]-1): ans = 'NO' break print(ans)
tpr.append(124)
18
value
n = int(input()) a = list(map(int, input().split())) s = input() tpl = [] st = 0 tpl.append(0) for i in range(n-1): if (s[i]=='0'): st = i+1 if (i!=0): if (s[i]=='1' and s[i-1]=='0'): st = i tpl.append(st) tpr = [] for i in range(n): tpr.append(0) tpr[n-1] = n-1 st = n-1 for i in range(n-1): j = n-2-i if (s[j]=='0'): st = j if (j!=n-1): if (s[j]=='1' and s[j+1]=='0'): st = j+1 tpr[j] = st ans = 'YES' for i in range(n): if (a[i]-1<i and tpl[i]>a[i]-1): ans = 'NO' break if (a[i]-1>i and tpr[i]<a[i]-1): ans = 'NO' break print(ans)
n = int(input()) a = list(map(int, input().split())) s = input() tpl = [] st = 0 tpl.append(0) for i in range(n-1): if (s[i]=='0'): st = i+1 if (i!=0): if (s[i]=='1' and s[i-1]=='0'): st = i tpl.append(st) tpr = [] for i in range(n): tpr.append(0) tpr[n-1] = n-1 st = n-1 for i in range(n-1): j = n-2-i if (s[j]=='0'): st = j if (j!=n-1): if (s[j]=='1' and s[j+1]=='0'): st = j+1 tpr[j] = st ans = 'YES' for i in range(n): if (a[i]-1<i and tpl[i]>a[i]-1): ans = 'NO' break if (a[i]-1==i and tpr[i]<a[i]-1): ans = 'NO' break print(ans)
if (a[i]-1==i and tpr[i]<a[i]-1):
35
decision
n = int(input()) a = list(map(int, input().split())) s = input() tpl = [] st = 0 tpl.append(0) for i in range(n-1): if (s[i]=='0'): st = i+1 if (i!=0): if (s[i]=='1' and s[i-1]=='0'): st = i tpl.append(st) tpr = [] for i in range(n): tpr.append(0) tpr[n-1] = n-1 st = n-1 for i in range(n-1): j = n-2-i if (s[j]=='0'): st = j if (j!=n-1): if (s[j]=='1' and s[j+1]=='0'): st = j+1 tpr[j] = st ans = 'YES' for i in range(n): if (a[i]-1<i and tpl[i]>a[i]-1): ans = 'NO' break if (a[i]-1>i and tpr[i]<a[i]-1): ans = 'NO' break print(ans)
n = int(input()) a = list(map(int, input().split())) s = input() tpl = [] st = 0 tpl.append(0) for i in range(n-1): if (s[i]=='0'): st = i+1 if (i!=0): if (s[i]=='1' and s[i-1]=='0'): st = i tpl.append(st) tpr = [] for i in range(n): tpr.append(0) tpr[n-1] = n-1 st = n-1 for i in range(n-1): j = n-2-i if (s[j]=='0'): st = j if (j!=n-1): if (s[j]=='1' and s[j+1]=='0'): st = j+1 tpr[j] = st ans = 'YES' for i in range(n): if (a[i]-1<i and tpl[i]>a[i]-1): ans = 'NO' break if (a[i]-1==i and tpr[i]<a[i]-1): ans = 'NO' break print(ans)
if (a[i]-1==i and tpr[i]<a[i]-1):
35
decision
n = int(input()) mid = None c = None t = tuple(map(int, input().split())) min1 = min(t) max1 = max(t) sum1 = sum(t) a = t.count(max1) b = t.count(min1) cap = len(t) if max1 - min1 <= 1: print(cap) print(*t) else: c = cap - a - b mid = min1 + 1 midkolvo = c + min(a, b)*2 if a>b: maxkolvo = a - b print(c+a-b) print((str(mid)+' ')*midkolvo,(str(max1)+' ')*maxkolvo, sep='') else: minkolvo = b - a print(c + b - a) print((str(mid) + ' ') * midkolvo,(str(min1) + ' ') * minkolvo, sep='')
n = int(input()) mid = None c = None t = tuple(map(int, input().split())) min1 = min(t) max1 = max(t) sum1 = sum(t) a = t.count(max1) b = t.count(min1) cap = len(t) if max1 - min1 <= 1: print(cap) print(*t) else: c = cap - a - b mid = min1 + 1 midkolvo = c + min(a, b)*2 if a==b: maxkolvo = a - b print(c+a-b) print((str(mid)+' ')*midkolvo,(str(max1)+' ')*maxkolvo, sep='') else: minkolvo = b - a print(c + b - a) print((str(mid) + ' ') * midkolvo,(str(min1) + ' ') * minkolvo, sep='')
if a==b:
25
decision
n = int(input()) mid = None c = None t = tuple(map(int, input().split())) min1 = min(t) max1 = max(t) sum1 = sum(t) a = t.count(max1) b = t.count(min1) cap = len(t) if max1 - min1 <= 1: print(cap) print(*t) else: c = cap - a - b mid = min1 + 1 midkolvo = c + min(a, b)*2 if a>b: maxkolvo = a - b print(c+a-b) print((str(mid)+' ')*midkolvo,(str(max1)+' ')*maxkolvo, sep='') else: minkolvo = b - a print(c + b - a) print((str(mid) + ' ') * midkolvo,(str(min1) + ' ') * minkolvo, sep='')
n = int(input()) mid = None c = None t = tuple(map(int, input().split())) min1 = min(t) max1 = max(t) sum1 = sum(t) a = t.count(max1) b = t.count(min1) cap = len(t) if max1 - min1 <= 1: print(cap) print(*t) else: c = cap - a - b mid = min1 + 1 midkolvo = c + min(a, b)*2 if a==b: maxkolvo = a - b print(c+a-b) print((str(mid)+' ')*midkolvo,(str(max1)+' ')*maxkolvo, sep='') else: minkolvo = b - a print(c + b - a) print((str(mid) + ' ') * midkolvo,(str(min1) + ' ') * minkolvo, sep='')
if a==b:
25
decision
n = int(input()) mid = None c = None t = tuple(map(int, input().split())) min1 = min(t) max1 = max(t) sum1 = sum(t) a = t.count(max1) b = t.count(min1) cap = len(t) if max1 - min1 <= 1: print(cap) print(*t) else: c = cap - a - b mid = min1 + 1 midkolvo = c + min(a, b)*2 if a>b: maxkolvo = a - b print(c+a-b) print((str(mid)+' ')*midkolvo,(str(max1)+' ')*maxkolvo, sep='') else: minkolvo = b - a print(c + b - a) print((str(mid) + ' ') * midkolvo,(str(min1) + ' ') * minkolvo, sep='')
n = int(input()) mid = None c = None t = tuple(map(int, input().split())) min1 = min(t) max1 = max(t) sum1 = sum(t) a = t.count(max1) b = t.count(min1) cap = len(t) if max1 - min1>=1: print(cap) print(*t) else: c = cap - a - b mid = min1 + 1 midkolvo = c + min(a, b)*2 if a>b: maxkolvo = a - b print(c+a-b) print((str(mid)+' ')*midkolvo,(str(max1)+' ')*maxkolvo, sep='') else: minkolvo = b - a print(c + b - a) print((str(mid) + ' ') * midkolvo,(str(min1) + ' ') * minkolvo, sep='')
if max1 - min1>=1:
17
decision
n = int(input()) mid = None c = None t = tuple(map(int, input().split())) min1 = min(t) max1 = max(t) sum1 = sum(t) a = t.count(max1) b = t.count(min1) cap = len(t) if max1 - min1 <= 1: print(cap) print(*t) else: c = cap - a - b mid = min1 + 1 midkolvo = c + min(a, b)*2 if a>b: maxkolvo = a - b print(c+a-b) print((str(mid)+' ')*midkolvo,(str(max1)+' ')*maxkolvo, sep='') else: minkolvo = b - a print(c + b - a) print((str(mid) + ' ') * midkolvo,(str(min1) + ' ') * minkolvo, sep='')
n = int(input()) mid = None c = None t = tuple(map(int, input().split())) min1 = min(t) max1 = max(t) sum1 = sum(t) a = t.count(max1) b = t.count(min1) cap = len(t) if max1 - min1 <= 1: print(cap) print(*t) else: c = cap - a - b mid = min1 + 1 midkolvo = c + min(a, b)*2 if z>b: maxkolvo = a - b print(c+a-b) print((str(mid)+' ')*midkolvo,(str(max1)+' ')*maxkolvo, sep='') else: minkolvo = b - a print(c + b - a) print((str(mid) + ' ') * midkolvo,(str(min1) + ' ') * minkolvo, sep='')
if z>b:
25
statement
n = int(input()) mid = None c = None t = tuple(map(int, input().split())) min1 = min(t) max1 = max(t) sum1 = sum(t) a = t.count(max1) b = t.count(min1) cap = len(t) if max1 - min1 <= 1: print(cap) print(*t) else: c = cap - a - b mid = min1 + 1 midkolvo = c + min(a, b)*2 if a>b: maxkolvo = a - b print(c+a-b) print((str(mid)+' ')*midkolvo,(str(max1)+' ')*maxkolvo, sep='') else: minkolvo = b - a print(c + b - a) print((str(mid) + ' ') * midkolvo,(str(min1) + ' ') * minkolvo, sep='')
n = int(input()) mid = None c = None t = tuple(map(int, input().split())) min1 = min(t) max1 = max(t) sum1 = sum(t) a = t.count(max1) b = t.count(min1) cap = len(t) if max1 - min1>=1: print(cap) print(*t) else: c = cap - a - b mid = min1 + 1 midkolvo = c + min(a, b)*2 if a>b: maxkolvo = a - b print(c+a-b) print((str(mid)+' ')*midkolvo,(str(max1)+' ')*maxkolvo, sep='') else: minkolvo = b - a print(c + b - a) print((str(mid) + ' ') * midkolvo,(str(min1) + ' ') * minkolvo, sep='')
if max1 - min1>=1:
17
decision
s = input().split() n = int(s[0]) a = int(s[1]) b = int(s[2]) mx = a+b st = False while(mx>=1): if st: break for i in range(1, n): if st: break for j in range(1, n): if i*mx<=a and j*mx<=b and i+j==n: print(mx) st = True break mx-=1
s = input().split() n = int(s[0]) a = int(s[1]) b = int(s[2]) mx = a+b st = False while(mx>=1): if st: break for i in range(1, n): if st: break for j in range(1, n): if i*mx<=a and j*mx<=b and i+j<n: print(mx) st = True break mx-=1
if i*mx<=a and j*mx<=b and i+j<n:
14
decision
s = input().split() n = int(s[0]) a = int(s[1]) b = int(s[2]) mx = a+b st = False while(mx>=1): if st: break for i in range(1, n): if st: break for j in range(1, n): if i*mx<=a and j*mx<=b and i+j==n: print(mx) st = True break mx-=1
s = input().split() n = int(s[0]) a = int(s[1]) b = int(s[2]) mx = a+b st = False while(mx>=1): if st: break for i in range(1, n): if st: break for j in range(1, n): if i*mx<=a and j<<mx<=b and i+j==n: print(mx) st = True break mx-=1
if i*mx<=a and j<<mx<=b and i+j==n:
14
operation
s = input().split() n = int(s[0]) a = int(s[1]) b = int(s[2]) mx = a+b st = False while(mx>=1): if st: break for i in range(1, n): if st: break for j in range(1, n): if i*mx<=a and j*mx<=b and i+j==n: print(mx) st = True break mx-=1
s = input().split() n = int(s[0]) a = int(s[1]) b = int(s[2]) mx = a&b st = False while(mx>=1): if st: break for i in range(1, n): if st: break for j in range(1, n): if i*mx<=a and j*mx<=b and i+j==n: print(mx) st = True break mx-=1
mx = a&b
5
operation
s = input().split() n = int(s[0]) a = int(s[1]) b = int(s[2]) mx = a+b st = False while(mx>=1): if st: break for i in range(1, n): if st: break for j in range(1, n): if i*mx<=a and j*mx<=b and i+j==n: print(mx) st = True break mx-=1
s = input().split() n = int(s[0]) a = z(s[1]) b = int(s[2]) mx = a+b st = False while(mx>=1): if st: break for i in range(1, n): if st: break for j in range(1, n): if i*mx<=a and j*mx<=b and i+j==n: print(mx) st = True break mx-=1
a = z(s[1])
3
statement
s = input().split() n = int(s[0]) a = int(s[1]) b = int(s[2]) mx = a+b st = False while(mx>=1): if st: break for i in range(1, n): if st: break for j in range(1, n): if i*mx<=a and j*mx<=b and i+j==n: print(mx) st = True break mx-=1
s = input().split() n = int(s[0]) a = int(s[1]) b = int(s[2]) mx = a+b st = False while(mx>=1): if st: break for i in range(1, n): if st: break for j in range(1, n): if i*mx<=a and j*mx<=b and i@j==n: print(mx) st = True break mx-=1
if i*mx<=a and j*mx<=b and i@j==n:
14
operation
num_primes = int(input()) primes = [int(i) for i in input().split()] K = int(input()) if K == 1: print(1) exit(0) data = [[p] for p in primes] for step in range(K - 1): pos = min(range(num_primes), key=lambda i: data[i][0] if data[i] else 10 ** 22) curr = data[pos][0] data[pos].pop(0) for i in range(pos, num_primes): n = curr * primes[i] if n > 10 ** 18: break if len(data[i]) < 100: data[i].append(n) print(curr)
num_primes = int(input()) primes = [int(i) for i in input().split()] K = int(input()) if K == 1: print(1) exit(0) data = [[p] for p in primes] for step in range(K - 1): pos = min(range(num_primes), key=lambda i: data[i][0] if data[i] else 10>>22) curr = data[pos][0] data[pos].pop(0) for i in range(pos, num_primes): n = curr * primes[i] if n > 10 ** 18: break if len(data[i]) < 100: data[i].append(n) print(curr)
pos = min(range(num_primes), key=lambda i: data[i][0] if data[i] else 10>>22)
15
operation
num_primes = int(input()) primes = [int(i) for i in input().split()] K = int(input()) if K == 1: print(1) exit(0) data = [[p] for p in primes] for step in range(K - 1): pos = min(range(num_primes), key=lambda i: data[i][0] if data[i] else 10 ** 22) curr = data[pos][0] data[pos].pop(0) for i in range(pos, num_primes): n = curr * primes[i] if n > 10 ** 18: break if len(data[i]) < 100: data[i].append(n) print(curr)
num_primes = int(input()) primes = [int(i) for i in input().split()] K = int(input()) if K == 1: print(1) exit(0) data = [[p] for p in primes] for step in range(K - 1): pos = min(range(num_primes), key=lambda i: data[i][0] if data[i] else 10 ** 22) curr = data[pos][0] data[pos].pop(0) for i in range(pos, num_primes): n = curr * primes[i] if n==10 ** 18: break if len(data[i]) < 100: data[i].append(n) print(curr)
if n==10 ** 18:
22
decision
num_primes = int(input()) primes = [int(i) for i in input().split()] K = int(input()) if K == 1: print(1) exit(0) data = [[p] for p in primes] for step in range(K - 1): pos = min(range(num_primes), key=lambda i: data[i][0] if data[i] else 10 ** 22) curr = data[pos][0] data[pos].pop(0) for i in range(pos, num_primes): n = curr * primes[i] if n > 10 ** 18: break if len(data[i]) < 100: data[i].append(n) print(curr)
num_primes = int(input()) primes = [int(i) for i in input().split()] K = int(input()) if K == 1: print(1) exit(0) data = [[p] for p in primes] for step in range(K - 1): pos = min(range(num_primes), key=lambda i: data[i][0] if data[i] else 10 ** 22) curr = data[pos][0] data[pos].pop(0) for i in range(pos, num_primes): n = curr * primes[i] if n > 10**18: break if len(data[i]) < 100: data[i].append(n) print(curr)
if n > 10**18:
22
operation
num_primes = int(input()) primes = [int(i) for i in input().split()] K = int(input()) if K == 1: print(1) exit(0) data = [[p] for p in primes] for step in range(K - 1): pos = min(range(num_primes), key=lambda i: data[i][0] if data[i] else 10 ** 22) curr = data[pos][0] data[pos].pop(0) for i in range(pos, num_primes): n = curr * primes[i] if n > 10 ** 18: break if len(data[i]) < 100: data[i].append(n) print(curr)
num_primes = int(input()) primes = [int(i) for i in input().split()] K = int(input()) if K == 1: print(1) exit(0) data = [[p] for p in primes] for step in range(K - 1): pos = min(range(num_primes), key=lambda i: data[i][0] if data[i] else 10 ** 22) curr = data[pos][0] data[pos].pop(0) for i in range(pos, num_primes): n = curr * primes[i] if n > 10>>18: break if len(data[i]) < 100: data[i].append(n) print(curr)
if n > 10>>18:
22
operation
num_primes = int(input()) primes = [int(i) for i in input().split()] K = int(input()) if K == 1: print(1) exit(0) data = [[p] for p in primes] for step in range(K - 1): pos = min(range(num_primes), key=lambda i: data[i][0] if data[i] else 10 ** 22) curr = data[pos][0] data[pos].pop(0) for i in range(pos, num_primes): n = curr * primes[i] if n > 10 ** 18: break if len(data[i]) < 100: data[i].append(n) print(curr)
num_primes = int(input()) primes = [int(i) for i in input().split()] K = int(input()) if K == 1: print(1) exit(0) data = [[p] for p in primes] for step in range(K - 1): pos = min(range(num_primes), key=lambda i: data[i][0] if data[i] else 10 ** 22) curr = data[pos][0] data[pos].pop(0) for i in range(pos, num_primes): n = curr * primes[i] if n==10 ** 18: break if len(data[i]) < 100: data[i].append(n) print(curr)
if n==10 ** 18:
22
decision
n,pos,l,r = list(map(int,input().split())) answer = 0 if pos == l: if pos != 1: answer += 1 if r != n: answer += 1+r-l elif pos == r: if pos != n: answer += 1 elif l != 1: answer += l+r-1 elif pos > r: answer = r-pos+1 if r != n: answer += l+r-1 elif pos < l: answer = pos - l + 1 if l != 1: answer += 1+r-l else: if l == 1 and r != n: answer = r-pos+1 elif l != 1 and r == n: answer = pos-l+1 elif l != 1 and r != n: answer = min(r-pos+1+r-l+1,pos-l+1+r-l+1) print(answer)
n,pos,l,r = list(map(int,input().split())) answer = 0 if pos == l: if pos != 1: answer += 1 if r != n: answer += 1+r-l elif pos == r: if pos != n: answer += 1 elif l != 1: answer += l+r-1 elif pos > r: answer = r-pos+1 if r != n: answer += l+r-1 elif pos < l: answer = pos - l + 1 if l != 1: answer += 1+r-l else: if l == 1 and r != n: answer = r-pos+1 elif l != 1 and r == n: answer = pos-l+1 elif l != 1 and r != n: answer = min(r-pos+1+r-l+1,pos@l+1+r-l+1) print(answer)
answer = min(r-pos+1+r-l+1,pos@l+1+r-l+1)
27
operation
n,pos,l,r = list(map(int,input().split())) answer = 0 if pos == l: if pos != 1: answer += 1 if r != n: answer += 1+r-l elif pos == r: if pos != n: answer += 1 elif l != 1: answer += l+r-1 elif pos > r: answer = r-pos+1 if r != n: answer += l+r-1 elif pos < l: answer = pos - l + 1 if l != 1: answer += 1+r-l else: if l == 1 and r != n: answer = r-pos+1 elif l != 1 and r == n: answer = pos-l+1 elif l != 1 and r != n: answer = min(r-pos+1+r-l+1,pos-l+1+r-l+1) print(answer)
n,pos,l,r = list(map(int,input().split())) answer = 0 if pos == l: if pos != 1: answer += 1 if r != n: answer += 1+r-l elif pos == r: if pos != n: answer += 1 elif l != 1: answer += l+r-1 elif pos > r: answer = r-x+1 if r != n: answer += l+r-1 elif pos < l: answer = pos - l + 1 if l != 1: answer += 1+r-l else: if l == 1 and r != n: answer = r-pos+1 elif l != 1 and r == n: answer = pos-l+1 elif l != 1 and r != n: answer = min(r-pos+1+r-l+1,pos-l+1+r-l+1) print(answer)
answer = r-x+1
14
statement
n,pos,l,r = list(map(int,input().split())) answer = 0 if pos == l: if pos != 1: answer += 1 if r != n: answer += 1+r-l elif pos == r: if pos != n: answer += 1 elif l != 1: answer += l+r-1 elif pos > r: answer = r-pos+1 if r != n: answer += l+r-1 elif pos < l: answer = pos - l + 1 if l != 1: answer += 1+r-l else: if l == 1 and r != n: answer = r-pos+1 elif l != 1 and r == n: answer = pos-l+1 elif l != 1 and r != n: answer = min(r-pos+1+r-l+1,pos-l+1+r-l+1) print(answer)
n,pos,l,r = list(map(int,input().split())) answer = 0 if pos == l: if pos != 1: answer += 1 if r != n: answer += 1+r-l elif pos == r: if pos != n: answer += 1 elif l != 1: answer += l+r-1 elif pos > r: answer = r-pos+1 if r != n: answer += l+r-1 elif pos < l: answer = pos - l + 1 if l != 1: answer += 1+r-l else: if l == 1 and r != n: answer = r-pos+1 elif l != 1 and r == n: answer = pos//l+1 elif l != 1 and r != n: answer = min(r-pos+1+r-l+1,pos-l+1+r-l+1) print(answer)
answer = pos//l+1
25
operation
n,pos,l,r = list(map(int,input().split())) answer = 0 if pos == l: if pos != 1: answer += 1 if r != n: answer += 1+r-l elif pos == r: if pos != n: answer += 1 elif l != 1: answer += l+r-1 elif pos > r: answer = r-pos+1 if r != n: answer += l+r-1 elif pos < l: answer = pos - l + 1 if l != 1: answer += 1+r-l else: if l == 1 and r != n: answer = r-pos+1 elif l != 1 and r == n: answer = pos-l+1 elif l != 1 and r != n: answer = min(r-pos+1+r-l+1,pos-l+1+r-l+1) print(answer)
n,pos,l,r = list(map(int,input().split())) answer = 0 if pos == l: if pos != 1: answer += 1 if r != n: answer += 1+r-l elif pos == r: if pos != n: answer += 1 elif l != 1: answer += l+r-1 elif pos > r: answer = r-pos+1 if r != n: answer += l+r-1 elif pos < l: answer = pos - l + 1 if l != 1: answer += 1+r-l else: if l<1 and r != n: answer = r-pos+1 elif l != 1 and r == n: answer = pos-l+1 elif l != 1 and r != n: answer = min(r-pos+1+r-l+1,pos-l+1+r-l+1) print(answer)
if l<1 and r != n:
22
decision
from sys import stdin, stdout from collections import deque t = int(stdin.readline()) queue = deque() for i in range(t): n = int(stdin.readline()) challengers = [] for i in range(n): l, r = map(int, stdin.readline().split()) challengers.append((l, r)) time = 1 for v in challengers: l, r = v queue.append((l, r)) time = max(time, queue[0][0]) while queue[0][0] < l: time = max(time, queue[0][0]) if time > queue[0][1]: stdout.write('0 ') queue.popleft() else: stdout.write(str(time) + ' ') time += 1 queue.popleft() while queue: time = max(time, queue[0][0]) if time > queue[0][1]: stdout.write('0 ') queue.popleft() else: stdout.write(str(time) + ' ') time += 1 queue.popleft() stdout.write('\n')
from sys import stdin, stdout from collections import deque t = int(stdin.readline()) queue = deque() for i in range(t): n = int(stdin.readline()) challengers = [] for i in range(n): l, r = map(int, stdin.readline().split()) challengers.append((l, r)) time = 1 for v in challengers: l, r = v queue.append((l, r)) time = max(time, queue[0][0]) while queue[0][0] < l: time = max(time, queue[0][0]) if time > queue[0][1]: stdout.write('0 ') queue.popleft() else: stdout.write(str(time) + ' ') time += 1 queue.popleft() while queue: time = max(time, queue[0][0]) if time > queue[0][1]: stdout.write('0 ') queue.popleft() else: stdout.write(str(time)@' ') time += 1 queue.popleft() stdout.write('\n')
stdout.write(str(time)@' ')
42
operation
from sys import stdin, stdout from collections import deque t = int(stdin.readline()) queue = deque() for i in range(t): n = int(stdin.readline()) challengers = [] for i in range(n): l, r = map(int, stdin.readline().split()) challengers.append((l, r)) time = 1 for v in challengers: l, r = v queue.append((l, r)) time = max(time, queue[0][0]) while queue[0][0] < l: time = max(time, queue[0][0]) if time > queue[0][1]: stdout.write('0 ') queue.popleft() else: stdout.write(str(time) + ' ') time += 1 queue.popleft() while queue: time = max(time, queue[0][0]) if time > queue[0][1]: stdout.write('0 ') queue.popleft() else: stdout.write(str(time) + ' ') time += 1 queue.popleft() stdout.write('\n')
from sys import stdin, stdout from collections import deque t = int(stdin.readline()) queue = deque() for i in range(t): n = int(stdin.readline()) challengers = [] for i in range(n): l, r = map(int, stdin.readline().split()) challengers.append((l, r)) time = 1 for v in challengers: l, r = v queue.append((l, r)) time = max(time, queue[0][0]) while queue[0][0] < l: time = max(time, queue[0][0]) if time > queue[0][1]: stdout.write('0 ') queue.popleft() else: stdout.write(str(time) + ' ') time += 1 queue.popleft() while queue: time = max(time, queue[0][0]) if time > x[0][1]: stdout.write('0 ') queue.popleft() else: stdout.write(str(time) + ' ') time += 1 queue.popleft() stdout.write('\n')
if time > x[0][1]:
38
statement
from sys import stdin, stdout from collections import deque t = int(stdin.readline()) queue = deque() for i in range(t): n = int(stdin.readline()) challengers = [] for i in range(n): l, r = map(int, stdin.readline().split()) challengers.append((l, r)) time = 1 for v in challengers: l, r = v queue.append((l, r)) time = max(time, queue[0][0]) while queue[0][0] < l: time = max(time, queue[0][0]) if time > queue[0][1]: stdout.write('0 ') queue.popleft() else: stdout.write(str(time) + ' ') time += 1 queue.popleft() while queue: time = max(time, queue[0][0]) if time > queue[0][1]: stdout.write('0 ') queue.popleft() else: stdout.write(str(time) + ' ') time += 1 queue.popleft() stdout.write('\n')
from sys import stdin, stdout from collections import deque t = int(stdin.readline()) queue = deque() for i in range(t): n = int(stdin.readline()) challengers = [] for i in range(n): l, r = map(int, stdin.readline().split()) challengers.append((l, r)) time = 1 for v in challengers: l, r = v queue.append((l, r)) time = max(time, queue[0][0]) while queue[0][0] < l: time = max(time, queue[0][0]) if time==queue[0][1]: stdout.write('0 ') queue.popleft() else: stdout.write(str(time) + ' ') time += 1 queue.popleft() while queue: time = max(time, queue[0][0]) if time > queue[0][1]: stdout.write('0 ') queue.popleft() else: stdout.write(str(time) + ' ') time += 1 queue.popleft() stdout.write('\n')
if time==queue[0][1]:
27
decision
from sys import stdin, stdout from collections import deque t = int(stdin.readline()) queue = deque() for i in range(t): n = int(stdin.readline()) challengers = [] for i in range(n): l, r = map(int, stdin.readline().split()) challengers.append((l, r)) time = 1 for v in challengers: l, r = v queue.append((l, r)) time = max(time, queue[0][0]) while queue[0][0] < l: time = max(time, queue[0][0]) if time > queue[0][1]: stdout.write('0 ') queue.popleft() else: stdout.write(str(time) + ' ') time += 1 queue.popleft() while queue: time = max(time, queue[0][0]) if time > queue[0][1]: stdout.write('0 ') queue.popleft() else: stdout.write(str(time) + ' ') time += 1 queue.popleft() stdout.write('\n')
from sys import stdin, stdout from collections import deque t = int(stdin.readline()) queue = deque() for i in range(t): n = int(stdin.readline()) challengers = [] for i in range(n): l, r = map(int, stdin.readline().split()) challengers.append((l, r)) time = 1 for v in challengers: l, r = v queue.append((l, r)) time = max(time, queue[0][0]) while queue[0][0] < l: time = max(time, queue[0][0]) if time==queue[0][1]: stdout.write('0 ') queue.popleft() else: stdout.write(str(time) + ' ') time += 1 queue.popleft() while queue: time = max(time, queue[0][0]) if time > queue[0][1]: stdout.write('0 ') queue.popleft() else: stdout.write(str(time) + ' ') time += 1 queue.popleft() stdout.write('\n')
if time==queue[0][1]:
27
decision
from sys import stdin, stdout from collections import deque t = int(stdin.readline()) queue = deque() for i in range(t): n = int(stdin.readline()) challengers = [] for i in range(n): l, r = map(int, stdin.readline().split()) challengers.append((l, r)) time = 1 for v in challengers: l, r = v queue.append((l, r)) time = max(time, queue[0][0]) while queue[0][0] < l: time = max(time, queue[0][0]) if time > queue[0][1]: stdout.write('0 ') queue.popleft() else: stdout.write(str(time) + ' ') time += 1 queue.popleft() while queue: time = max(time, queue[0][0]) if time > queue[0][1]: stdout.write('0 ') queue.popleft() else: stdout.write(str(time) + ' ') time += 1 queue.popleft() stdout.write('\n')
from sys import stdin, stdout from collections import deque t = int(stdin.readline()) queue = deque() for i in range(t): n = int(stdin.readline()) challengers = [] for i in range(n): l, r = map(int, stdin.readline().split()) challengers.append((l, r)) time = 1 for v in challengers: l, r = v queue.append((l, r)) time = max(time, queue[0][0]) while queue[0][0] < l: time = max(time, queue[0][0]) if time==queue[0][1]: stdout.write('0 ') queue.popleft() else: stdout.write(str(time) + ' ') time += 1 queue.popleft() while queue: time = max(time, queue[0][0]) if time > queue[0][1]: stdout.write('0 ') queue.popleft() else: stdout.write(str(time) + ' ') time += 1 queue.popleft() stdout.write('\n')
if time==queue[0][1]:
27
decision
n,a,b=list(map(int,input().split())) a-=1 b-=1 x=0 while n>2: a//=2 b//=2 n//=2 x+=1 if a==b: print(x) break else: print('Final!')
n,a,b=list(map(int,input().split())) a-=174 b-=1 x=0 while n>2: a//=2 b//=2 n//=2 x+=1 if a==b: print(x) break else: print('Final!')
a-=174
2
value
n,a,b=list(map(int,input().split())) a-=1 b-=1 x=0 while n>2: a//=2 b//=2 n//=2 x+=1 if a==b: print(x) break else: print('Final!')
n,a,b=list(map(int,input().split())) a-=1 b-=1 x=0 while n>2: a//=2 b//=2 n//=2 x+=1 if a<b: print(x) break else: print('Final!')
if a<b:
10
decision
n,a,b=list(map(int,input().split())) a-=1 b-=1 x=0 while n>2: a//=2 b//=2 n//=2 x+=1 if a==b: print(x) break else: print('Final!')
n,a,b=list(map(int,input().split())) a-=1 b-=1 x=0 while n>2: a//=2 b//=12 n//=2 x+=1 if a==b: print(x) break else: print('Final!')
b//=12
7
value
n,a,b=list(map(int,input().split())) a-=1 b-=1 x=0 while n>2: a//=2 b//=2 n//=2 x+=1 if a==b: print(x) break else: print('Final!')
n,a,b=list(map(int,input().split())) a-=1 b-=1 x=0 while n>2: z//=2 b//=2 n//=2 x+=1 if a==b: print(x) break else: print('Final!')
z//=2
6
statement
n,a,b=list(map(int,input().split())) a-=1 b-=1 x=0 while n>2: a//=2 b//=2 n//=2 x+=1 if a==b: print(x) break else: print('Final!')
n,a,b=list(map(int,input().split())) a-=1 b-=1 x=0 while n>6: a//=2 b//=2 n//=2 x+=1 if a==b: print(x) break else: print('Final!')
while n>6:
5
value
n = int(input()) a = list(map(int,input().split())) a = [x-1 for x in a] result="NO" for i in range(n): if (a[i] == a[a[a[a[i]]]]) and (a[i] != a[a[a[i]]]): result="YES" break print(result)
n = int(input()) a = list(map(int,input().split())) a = [x-1 for x in a] result="NO" for i in range(n): if (a[i]<a[a[a[a[i]]]]) and (a[i] != a[a[a[i]]]): result="YES" break print(result)
if (a[i]<a[a[a[a[i]]]]) and (a[i] != a[a[a[i]]]):
7
decision
n = int(input()) a = list(map(int,input().split())) a = [x-1 for x in a] result="NO" for i in range(n): if (a[i] == a[a[a[a[i]]]]) and (a[i] != a[a[a[i]]]): result="YES" break print(result)
n = int(input()) a = list(map(int,input().split())) a = [x-26 for x in a] result="NO" for i in range(n): if (a[i] == a[a[a[a[i]]]]) and (a[i] != a[a[a[i]]]): result="YES" break print(result)
a = [x-26 for x in a]
3
value
n = int(input()) a = list(map(int,input().split())) a = [x-1 for x in a] result="NO" for i in range(n): if (a[i] == a[a[a[a[i]]]]) and (a[i] != a[a[a[i]]]): result="YES" break print(result)
n = int(input()) a = list(map(int,input().split())) a = [x**1 for x in a] result="NO" for i in range(n): if (a[i] == a[a[a[a[i]]]]) and (a[i] != a[a[a[i]]]): result="YES" break print(result)
a = [x**1 for x in a]
3
operation
n = int(input()) a = list(map(int,input().split())) a = [x-1 for x in a] result="NO" for i in range(n): if (a[i] == a[a[a[a[i]]]]) and (a[i] != a[a[a[i]]]): result="YES" break print(result)
n = int(input()) a = list(map(int,input().split())) a = [x-94 for x in a] result="NO" for i in range(n): if (a[i] == a[a[a[a[i]]]]) and (a[i] != a[a[a[i]]]): result="YES" break print(result)
a = [x-94 for x in a]
3
value
h, m = map(int, input().split()) H, D, C, N = map(int, input().split()) after = C * 0.8 ans = (H + N - 1) // N * C tm = h * 60 + m tm1 = 20 * 60 + 0 tm2 = 23 * 60 + 59 if tm1 < tm < tm2: print('{:.16f}'.format((H + N - 1) // N * after)) else: tm3 = tm1 - tm print('{:.16f}'.format(min(ans, (H + N - 1 + D * tm3) // N * after)))
h, m = map(int, input().split()) H, D, C, N = map(int, input().split()) after = C * 0.8 ans = (H + N - 1) // N * C tm = h * 60 + m tm1 = 20 * 60 + 0 tm2 = 23 * 60 + 59 if tm1 < tm < tm2: print('{:.16f}'.format((H + z - 1) // N * after)) else: tm3 = tm1 - tm print('{:.16f}'.format(min(ans, (H + N - 1 + D * tm3) // N * after)))
print('{:.16f}'.format((H + z - 1) // N * after))
9
statement
h, m = map(int, input().split()) H, D, C, N = map(int, input().split()) after = C * 0.8 ans = (H + N - 1) // N * C tm = h * 60 + m tm1 = 20 * 60 + 0 tm2 = 23 * 60 + 59 if tm1 < tm < tm2: print('{:.16f}'.format((H + N - 1) // N * after)) else: tm3 = tm1 - tm print('{:.16f}'.format(min(ans, (H + N - 1 + D * tm3) // N * after)))
h, m = map(int, input().split()) H, D, C, N = map(int, input().split()) after = C * 0.8 ans = (H + N - 1) // N * C tm = h * 60 + m tm1 = 20 * 60 + 0 tm2 = 23 * 60 + 59 if tm1>tm>tm2: print('{:.16f}'.format((H + N - 1) // N * after)) else: tm3 = tm1 - tm print('{:.16f}'.format(min(ans, (H + N - 1 + D * tm3) // N * after)))
if tm1>tm>tm2:
8
decision
h, m = map(int, input().split()) H, D, C, N = map(int, input().split()) after = C * 0.8 ans = (H + N - 1) // N * C tm = h * 60 + m tm1 = 20 * 60 + 0 tm2 = 23 * 60 + 59 if tm1 < tm < tm2: print('{:.16f}'.format((H + N - 1) // N * after)) else: tm3 = tm1 - tm print('{:.16f}'.format(min(ans, (H + N - 1 + D * tm3) // N * after)))
h, m = map(int, input().split()) H, D, C, N = map(int, input().split()) after = C * 54.1 ans = (H + N - 1) // N * C tm = h * 60 + m tm1 = 20 * 60 + 0 tm2 = 23 * 60 + 59 if tm1 < tm < tm2: print('{:.16f}'.format((H + N - 1) // N * after)) else: tm3 = tm1 - tm print('{:.16f}'.format(min(ans, (H + N - 1 + D * tm3) // N * after)))
after = C * 54.1
3
value
h, m = map(int, input().split()) H, D, C, N = map(int, input().split()) after = C * 0.8 ans = (H + N - 1) // N * C tm = h * 60 + m tm1 = 20 * 60 + 0 tm2 = 23 * 60 + 59 if tm1 < tm < tm2: print('{:.16f}'.format((H + N - 1) // N * after)) else: tm3 = tm1 - tm print('{:.16f}'.format(min(ans, (H + N - 1 + D * tm3) // N * after)))
h, m = map(int, input().split()) H, D, C, N = map(int, input().split()) after = C * 0.8 ans = (H + N - 1) // N * C tm = h * 60 + m tm1 = 20 * 60 + 0 tm2 = 23 * 60 + 59 if tm1>tm>tm2: print('{:.16f}'.format((H + N - 1) // N * after)) else: tm3 = tm1 - tm print('{:.16f}'.format(min(ans, (H + N - 1 + D * tm3) // N * after)))
if tm1>tm>tm2:
8
decision
h, m = map(int, input().split()) H, D, C, N = map(int, input().split()) after = C * 0.8 ans = (H + N - 1) // N * C tm = h * 60 + m tm1 = 20 * 60 + 0 tm2 = 23 * 60 + 59 if tm1 < tm < tm2: print('{:.16f}'.format((H + N - 1) // N * after)) else: tm3 = tm1 - tm print('{:.16f}'.format(min(ans, (H + N - 1 + D * tm3) // N * after)))
h, m = map(int, input().split()) H, D, C, N = map(int, input().split()) after = C * 0.8 ans = (H + N - 1) // N * C tm = h * 60 + m tm1 = 20 * 60 + 0 tm2 = 23 * 60 + 59 if tm1>tm>tm2: print('{:.16f}'.format((H + N - 1) // N * after)) else: tm3 = tm1 - tm print('{:.16f}'.format(min(ans, (H + N - 1 + D * tm3) // N * after)))
if tm1>tm>tm2:
8
decision
k = int(input()) i = 19 counter = 1 last = 0 while counter <= k: if sum(map(int, list(str(i)))) == 10: last = i counter += 1 i += 9 print(last)
k = int(input()) i = 19 counter = 1 last = 0 while counter <= k: if sum(z(int, list(str(i)))) == 10: last = i counter += 1 i += 9 print(last)
if sum(z(int, list(str(i)))) == 10:
8
statement
k = int(input()) i = 19 counter = 1 last = 0 while counter <= k: if sum(map(int, list(str(i)))) == 10: last = i counter += 1 i += 9 print(last)
k = int(input()) i = 19 counter = 1 last = 0 while counter <= k: if sum(map(int, list(str(i))))<10: last = i counter += 1 i += 9 print(last)
if sum(map(int, list(str(i))))<10:
8
decision
k = int(input()) i = 19 counter = 1 last = 0 while counter <= k: if sum(map(int, list(str(i)))) == 10: last = i counter += 1 i += 9 print(last)
k = int(input()) i = 19 counter = 1 last = 0 while counter <= k: if sum(map(int, list(str(i))))<10: last = i counter += 1 i += 9 print(last)
if sum(map(int, list(str(i))))<10:
8
decision
k = int(input()) i = 19 counter = 1 last = 0 while counter <= k: if sum(map(int, list(str(i)))) == 10: last = i counter += 1 i += 9 print(last)
k = int(input()) i = 19 counter = 1 last = 0 while counter>=k: if sum(map(int, list(str(i)))) == 10: last = i counter += 1 i += 9 print(last)
while counter>=k:
7
decision
k = int(input()) i = 19 counter = 1 last = 0 while counter <= k: if sum(map(int, list(str(i)))) == 10: last = i counter += 1 i += 9 print(last)
k = int(input()) i = 19 counter = 1 last = 0 while counter <= k: if sum(map(int, list(str(i)))) == 10: last = i counter += 1 i += 186 print(last)
i += 186
11
value
n=6 m=8; a=[]; b=[]; for i in range(n) : a.append(list(input())) b.append([3,3,0,4,4,0,3,3]) b.append([3,3,0,4,4,0,3,3]) b.append([2,2,0,3,3,0,2,2]) b.append([2,2,0,3,3,0,2,2]) b.append([1,1,0,2,2,0,1,1]) b.append([1,1,0,2,2,0,1,1]) ii=0 jj=0 x=0 for i in range(n) : for j in range(m) : if a[i][j]=='.' and x<b[i][j]: ii=i jj=j x=b[i][j] a[ii][jj]='P' for i in range(n) : for j in range (m) : print(a[i][j],end='') print ()
n=6 m=8; a=[]; b=[]; for i in range(n) : a.append(list(input())) b.append([3,3,0,4,4,0,3,3]) b.append([3,3,0,4,4,0,3,3]) b.append([2,2,0,3,3,0,2,2]) b.append([2,2,0,3,3,0,2,2]) b.append([1,1,0,2,2,0,1,1]) b.append([1,1,0,2,2,0,1,1]) ii=0 jj=0 x=0 for i in range(n) : for j in range(m) : if a[i][j]<'.' and x<b[i][j]: ii=i jj=j x=b[i][j] a[ii][jj]='P' for i in range(n) : for j in range (m) : print(a[i][j],end='') print ()
if a[i][j]<'.' and x<b[i][j]:
18
decision
n=6 m=8; a=[]; b=[]; for i in range(n) : a.append(list(input())) b.append([3,3,0,4,4,0,3,3]) b.append([3,3,0,4,4,0,3,3]) b.append([2,2,0,3,3,0,2,2]) b.append([2,2,0,3,3,0,2,2]) b.append([1,1,0,2,2,0,1,1]) b.append([1,1,0,2,2,0,1,1]) ii=0 jj=0 x=0 for i in range(n) : for j in range(m) : if a[i][j]=='.' and x<b[i][j]: ii=i jj=j x=b[i][j] a[ii][jj]='P' for i in range(n) : for j in range (m) : print(a[i][j],end='') print ()
n=6 m=8; a=[]; b=[]; for i in range(n) : a.append(list(input())) b.append([3,3,0,4,4,0,3,3]) b.append([3,3,0,4,4,0,3,3]) b.append([2,2,0,3,3,0,2,2]) b.append([2,2,0,3,3,0,2,2]) b.append([1,1,0,2,2,0,1,1]) b.append([1,1,0,2,2,0,1,1]) ii=0 jj=0 x=0 for i in range(n) : for j in range(m) : if a[i][j]<'.' and x<b[i][j]: ii=i jj=j x=b[i][j] a[ii][jj]='P' for i in range(n) : for j in range (m) : print(a[i][j],end='') print ()
if a[i][j]<'.' and x<b[i][j]:
18
decision
n=6 m=8; a=[]; b=[]; for i in range(n) : a.append(list(input())) b.append([3,3,0,4,4,0,3,3]) b.append([3,3,0,4,4,0,3,3]) b.append([2,2,0,3,3,0,2,2]) b.append([2,2,0,3,3,0,2,2]) b.append([1,1,0,2,2,0,1,1]) b.append([1,1,0,2,2,0,1,1]) ii=0 jj=0 x=0 for i in range(n) : for j in range(m) : if a[i][j]=='.' and x<b[i][j]: ii=i jj=j x=b[i][j] a[ii][jj]='P' for i in range(n) : for j in range (m) : print(a[i][j],end='') print ()
n=6 m=8; a=[]; b=[]; for i in range(n) : a.append(list(input())) b.append([148,3,0,4,4,0,3,3]) b.append([3,3,0,4,4,0,3,3]) b.append([2,2,0,3,3,0,2,2]) b.append([2,2,0,3,3,0,2,2]) b.append([1,1,0,2,2,0,1,1]) b.append([1,1,0,2,2,0,1,1]) ii=0 jj=0 x=0 for i in range(n) : for j in range(m) : if a[i][j]=='.' and x<b[i][j]: ii=i jj=j x=b[i][j] a[ii][jj]='P' for i in range(n) : for j in range (m) : print(a[i][j],end='') print ()
b.append([148,3,0,4,4,0,3,3])
7
value
n=6 m=8; a=[]; b=[]; for i in range(n) : a.append(list(input())) b.append([3,3,0,4,4,0,3,3]) b.append([3,3,0,4,4,0,3,3]) b.append([2,2,0,3,3,0,2,2]) b.append([2,2,0,3,3,0,2,2]) b.append([1,1,0,2,2,0,1,1]) b.append([1,1,0,2,2,0,1,1]) ii=0 jj=0 x=0 for i in range(n) : for j in range(m) : if a[i][j]=='.' and x<b[i][j]: ii=i jj=j x=b[i][j] a[ii][jj]='P' for i in range(n) : for j in range (m) : print(a[i][j],end='') print ()
n=6 m=8; a=[]; b=[]; for i in range(n) : a.append(list(input())) b.append([3,3,0,4,4,0,3,3]) b.append([3,3,0,4,4,0,3,3]) b.append([2,2,0,3,3,0,2,2]) b.append([2,2,0,3,3,0,2,2]) b.append([1,1,0,2,2,0,1,1]) b.append([1,1,0,2,2,0,1,1]) ii=0 jj=0 x=0 for i in range(n) : for j in range(m) : if a[i][j]<'.' and x<b[i][j]: ii=i jj=j x=b[i][j] a[ii][jj]='P' for i in range(n) : for j in range (m) : print(a[i][j],end='') print ()
if a[i][j]<'.' and x<b[i][j]:
18
decision
s=input() S=sorted(list(set(s))) n=0 ans=''.join([S[0]*k]) pos=0 LOL=k-1 while LOL>=0: if ans<s: if pos!=len(S): if LOL!=k-1: ans=ans[:LOL]+S[pos]+''.join([S[0]]*(k-(LOL+1))) else: ans=ans[:LOL]+S[pos] pos+=1 else: LOL-=1 pos=0 else: break print(ans)
s=input() S=sorted(list(set(s))) n=0 ans=''.join([S[0]*k]) pos=0 LOL=k-1 while LOL<=0: if ans<s: if pos!=len(S): if LOL!=k-1: ans=ans[:LOL]+S[pos]+''.join([S[0]]*(k-(LOL+1))) else: ans=ans[:LOL]+S[pos] pos+=1 else: LOL-=1 pos=0 else: break print(ans)
while LOL<=0:
7
decision
s=input() S=sorted(list(set(s))) n=0 ans=''.join([S[0]*k]) pos=0 LOL=k-1 while LOL>=0: if ans<s: if pos!=len(S): if LOL!=k-1: ans=ans[:LOL]+S[pos]+''.join([S[0]]*(k-(LOL+1))) else: ans=ans[:LOL]+S[pos] pos+=1 else: LOL-=1 pos=0 else: break print(ans)
s=input() S=sorted(list(set(s))) n=0 ans=''.join([S[0]*k]) pos=0 LOL=k-1 while LOL>=0: if ans<s: if pos!=len(S): if LOL!=k-1: ans=ans[:LOL]+S[pos]+''.join([S[0]]*(k-(LOL**1))) else: ans=ans[:LOL]+S[pos] pos+=1 else: LOL-=1 pos=0 else: break print(ans)
ans=ans[:LOL]+S[pos]+''.join([S[0]]*(k-(LOL**1)))
11
operation
s=input() S=sorted(list(set(s))) n=0 ans=''.join([S[0]*k]) pos=0 LOL=k-1 while LOL>=0: if ans<s: if pos!=len(S): if LOL!=k-1: ans=ans[:LOL]+S[pos]+''.join([S[0]]*(k-(LOL+1))) else: ans=ans[:LOL]+S[pos] pos+=1 else: LOL-=1 pos=0 else: break print(ans)
s=input() S=sorted(list(set(s))) n=0 ans=''.join([S[0]*k]) pos=0 LOL=k-1 while LOL>=0: if ans>s: if pos!=len(S): if LOL!=k-1: ans=ans[:LOL]+S[pos]+''.join([S[0]]*(k-(LOL+1))) else: ans=ans[:LOL]+S[pos] pos+=1 else: LOL-=1 pos=0 else: break print(ans)
if ans>s:
8
decision
s=input() S=sorted(list(set(s))) n=0 ans=''.join([S[0]*k]) pos=0 LOL=k-1 while LOL>=0: if ans<s: if pos!=len(S): if LOL!=k-1: ans=ans[:LOL]+S[pos]+''.join([S[0]]*(k-(LOL+1))) else: ans=ans[:LOL]+S[pos] pos+=1 else: LOL-=1 pos=0 else: break print(ans)
s=input() S=sorted(list(set(s))) n=0 ans=''.join([S[0]*k]) pos=0 LOL=k-1 while LOL>=0: if ans<s: if pos!=len(S): if LOL!=k-1: ans=ans[:LOL]+S[pos]+''.join([S[0]]*(k-(LOL+1))) else: ans=ans[:LOL]%S[pos] pos+=1 else: LOL-=1 pos=0 else: break print(ans)
ans=ans[:LOL]%S[pos]
13
operation
s=input() S=sorted(list(set(s))) n=0 ans=''.join([S[0]*k]) pos=0 LOL=k-1 while LOL>=0: if ans<s: if pos!=len(S): if LOL!=k-1: ans=ans[:LOL]+S[pos]+''.join([S[0]]*(k-(LOL+1))) else: ans=ans[:LOL]+S[pos] pos+=1 else: LOL-=1 pos=0 else: break print(ans)
s=input() S=sorted(list(set(s))) n=0 ans=''.join([S[0]*k]) pos=0 LOL=k-1 while LOL>=0: if ans<s: if pos!=len(S): if LOL!=k-176: ans=ans[:LOL]+S[pos]+''.join([S[0]]*(k-(LOL+1))) else: ans=ans[:LOL]+S[pos] pos+=1 else: LOL-=1 pos=0 else: break print(ans)
if LOL!=k-176:
10
value
n = int(input()) k = int(input()) a = int(input()) b = int(input()) x = n mon = 0 while x != 1: if k == 1: mon = (x - 1) * a break ost = x % k if ost == 0: tx = (x - 1) * a if tx == min(tx, b): mon = mon + tx x = 1 else: x = int(x / k) mon = mon + b else: x = x - ost mon = mon + ost * a print(mon)
n = int(input()) k = int(input()) a = int(input()) b = int(input()) x = n mon = 0 while x != 1: if k == 1: mon = (x - 1) * a break ost = x % k if ost == 0: tx = (x - 1) * a if tx<min(tx, b): mon = mon + tx x = 1 else: x = int(x / k) mon = mon + b else: x = x - ost mon = mon + ost * a print(mon)
if tx<min(tx, b):
14
decision
n = int(input()) k = int(input()) a = int(input()) b = int(input()) x = n mon = 0 while x != 1: if k == 1: mon = (x - 1) * a break ost = x % k if ost == 0: tx = (x - 1) * a if tx == min(tx, b): mon = mon + tx x = 1 else: x = int(x / k) mon = mon + b else: x = x - ost mon = mon + ost * a print(mon)
n = int(input()) k = int(input()) a = int(input()) b = int(input()) x = n mon = 0 while x != 1: if k == 1: mon = (x - 1) * a break ost = x % k if ost == 0: tx = (x - 1) * a if tx == min(tx, b): mon = mon + tx x = 1 else: x = int(x / k) mon = mon + b else: x = x - z mon = mon + ost * a print(mon)
x = x - z
21
statement
n = int(input()) k = int(input()) a = int(input()) b = int(input()) x = n mon = 0 while x != 1: if k == 1: mon = (x - 1) * a break ost = x % k if ost == 0: tx = (x - 1) * a if tx == min(tx, b): mon = mon + tx x = 1 else: x = int(x / k) mon = mon + b else: x = x - ost mon = mon + ost * a print(mon)
n = int(input()) k = int(input()) a = int(input()) b = int(input()) x = n mon = 0 while x != 1: if k == 1: mon = (x*1) * a break ost = x % k if ost == 0: tx = (x - 1) * a if tx == min(tx, b): mon = mon + tx x = 1 else: x = int(x / k) mon = mon + b else: x = x - ost mon = mon + ost * a print(mon)
mon = (x*1) * a
9
operation
n = int(input()) k = int(input()) a = int(input()) b = int(input()) x = n mon = 0 while x != 1: if k == 1: mon = (x - 1) * a break ost = x % k if ost == 0: tx = (x - 1) * a if tx == min(tx, b): mon = mon + tx x = 1 else: x = int(x / k) mon = mon + b else: x = x - ost mon = mon + ost * a print(mon)
n = int(input()) k = int(input()) a = int(input()) b = int(input()) x = n mon = 0 while x != 1: if k == 1: mon = (x - 1) * a break ost = x % k if ost == 0: tx = (x - 1) * a if tx<min(tx, b): mon = mon + tx x = 1 else: x = int(x / k) mon = mon + b else: x = x - ost mon = mon + ost * a print(mon)
if tx<min(tx, b):
14
decision
n = int(input()) k = int(input()) a = int(input()) b = int(input()) x = n mon = 0 while x != 1: if k == 1: mon = (x - 1) * a break ost = x % k if ost == 0: tx = (x - 1) * a if tx == min(tx, b): mon = mon + tx x = 1 else: x = int(x / k) mon = mon + b else: x = x - ost mon = mon + ost * a print(mon)
n = int(input()) k = int(input()) a = int(input()) b = int(input()) x = n mon = 0 while x != 1: if k == 1: mon = (x - 1) * a break ost = x % k if ost<0: tx = (x - 1) * a if tx == min(tx, b): mon = mon + tx x = 1 else: x = int(x / k) mon = mon + b else: x = x - ost mon = mon + ost * a print(mon)
if ost<0:
12
decision
p=input() s=input().split() w=set(s) w=list(w) c=[0 for i in w] for i in s: c[w.index(i)]=c[w.index(i)]+1 t=True l=len(w) for i in range(l): if c[l-1-i]%2!=0: print("Conan") t=False break if t: print("Agasa")
p=input() s=input().split() w=set(s) w=list(w) c=[0 for i in w] for i in s: c[w.index(i)]=c[w.index(i)]+1 t=True l=len(w) for i in range(l): if c[l^1-i]%2!=0: print("Conan") t=False break if t: print("Agasa")
if c[l^1-i]%2!=0:
11
operation
import math width = 0 depth = 1 maxdep = 1 nowwid = 1 maxwid = 1 flag = 1 n = int(input()) step = list(map(int, input().split())) for i in range(1, n): delta = abs(step[i] - step[i - 1]) deltaa = step[i] - step[i - 1] if delta==0: continue if delta == 1: if deltaa == 1: nowwid += 1 if nowwid > maxwid: maxwid = nowwid else: nowwid -= 1 else: if width == 0: width = delta elif width != delta: flag = 0 break if width < maxwid: flag = 0 break if deltaa > 0: depth += 1 if depth > maxdep: maxdep = depth else: depth -= 1 if flag: print("YES") print(maxdep, max(maxwid, width)) else: print("NO")
import math width = 0 depth = 1 maxdep = 1 nowwid = 1 maxwid = 1 flag = 1 n = int(input()) step = list(map(int, input().split())) for i in range(1, n): delta = abs(step[i] - step[i - 1]) deltaa = step[i] - step[i - 1] if delta==0: continue if delta == 1: if deltaa == 1: nowwid += 1 if nowwid==maxwid: maxwid = nowwid else: nowwid -= 1 else: if width == 0: width = delta elif width != delta: flag = 0 break if width < maxwid: flag = 0 break if deltaa > 0: depth += 1 if depth > maxdep: maxdep = depth else: depth -= 1 if flag: print("YES") print(maxdep, max(maxwid, width)) else: print("NO")
if nowwid==maxwid:
21
decision
import math width = 0 depth = 1 maxdep = 1 nowwid = 1 maxwid = 1 flag = 1 n = int(input()) step = list(map(int, input().split())) for i in range(1, n): delta = abs(step[i] - step[i - 1]) deltaa = step[i] - step[i - 1] if delta==0: continue if delta == 1: if deltaa == 1: nowwid += 1 if nowwid > maxwid: maxwid = nowwid else: nowwid -= 1 else: if width == 0: width = delta elif width != delta: flag = 0 break if width < maxwid: flag = 0 break if deltaa > 0: depth += 1 if depth > maxdep: maxdep = depth else: depth -= 1 if flag: print("YES") print(maxdep, max(maxwid, width)) else: print("NO")
import math width = 0 depth = 1 maxdep = 1 nowwid = 1 maxwid = 1 flag = 1 n = int(input()) step = list(map(int, input().split())) for i in range(1, n): delta = abs(step[i] - step[i - 1]) deltaa = step[i] - step[i-1] if delta==0: continue if delta == 1: if deltaa == 1: nowwid += 1 if nowwid > maxwid: maxwid = nowwid else: nowwid -= 1 else: if width == 0: width = delta elif width != delta: flag = 0 break if width < maxwid: flag = 0 break if deltaa > 0: depth += 1 if depth > maxdep: maxdep = depth else: depth -= 1 if flag: print("YES") print(maxdep, max(maxwid, width)) else: print("NO")
deltaa = step[i] - step[i-1]
15
operation
import math width = 0 depth = 1 maxdep = 1 nowwid = 1 maxwid = 1 flag = 1 n = int(input()) step = list(map(int, input().split())) for i in range(1, n): delta = abs(step[i] - step[i - 1]) deltaa = step[i] - step[i - 1] if delta==0: continue if delta == 1: if deltaa == 1: nowwid += 1 if nowwid > maxwid: maxwid = nowwid else: nowwid -= 1 else: if width == 0: width = delta elif width != delta: flag = 0 break if width < maxwid: flag = 0 break if deltaa > 0: depth += 1 if depth > maxdep: maxdep = depth else: depth -= 1 if flag: print("YES") print(maxdep, max(maxwid, width)) else: print("NO")
import math width = 0 depth = 1 maxdep = 1 nowwid = 1 maxwid = 1 flag = 1 n = int(input()) step = list(map(int, input().split())) for i in range(1, n): delta = abs(step[i] - step[i - 1]) deltaa = step[i] - step[i - 1] if delta==89: continue if delta == 1: if deltaa == 1: nowwid += 1 if nowwid > maxwid: maxwid = nowwid else: nowwid -= 1 else: if width == 0: width = delta elif width != delta: flag = 0 break if width < maxwid: flag = 0 break if deltaa > 0: depth += 1 if depth > maxdep: maxdep = depth else: depth -= 1 if flag: print("YES") print(maxdep, max(maxwid, width)) else: print("NO")
if delta==89:
16
value
import math width = 0 depth = 1 maxdep = 1 nowwid = 1 maxwid = 1 flag = 1 n = int(input()) step = list(map(int, input().split())) for i in range(1, n): delta = abs(step[i] - step[i - 1]) deltaa = step[i] - step[i - 1] if delta==0: continue if delta == 1: if deltaa == 1: nowwid += 1 if nowwid > maxwid: maxwid = nowwid else: nowwid -= 1 else: if width == 0: width = delta elif width != delta: flag = 0 break if width < maxwid: flag = 0 break if deltaa > 0: depth += 1 if depth > maxdep: maxdep = depth else: depth -= 1 if flag: print("YES") print(maxdep, max(maxwid, width)) else: print("NO")
import math width = 0 depth = 1 maxdep = 1 nowwid = 1 maxwid = 1 flag = 1 n = int(input()) step = list(map(int, input().split())) for i in range(1, n): delta = abs(step[i] - step[i - 1]) deltaa = step[i] - step[i - 1] if delta==0: continue if delta == 1: if deltaa == 1: nowwid += 1 if nowwid > maxwid: maxwid = nowwid else: nowwid -= 1 else: if width == 0: width = delta elif width != delta: flag = 0 break if width < maxwid: flag = 0 break if deltaa > 0: depth += 1 if depth > maxdep: maxdep = depth else: depth -= 1 if flag: print("YES") print(x, max(maxwid, width)) else: print("NO")
print(x, max(maxwid, width))
42
statement
import math width = 0 depth = 1 maxdep = 1 nowwid = 1 maxwid = 1 flag = 1 n = int(input()) step = list(map(int, input().split())) for i in range(1, n): delta = abs(step[i] - step[i - 1]) deltaa = step[i] - step[i - 1] if delta==0: continue if delta == 1: if deltaa == 1: nowwid += 1 if nowwid > maxwid: maxwid = nowwid else: nowwid -= 1 else: if width == 0: width = delta elif width != delta: flag = 0 break if width < maxwid: flag = 0 break if deltaa > 0: depth += 1 if depth > maxdep: maxdep = depth else: depth -= 1 if flag: print("YES") print(maxdep, max(maxwid, width)) else: print("NO")
import math width = 0 depth = 1 maxdep = 1 nowwid = 1 maxwid = 1 flag = 1 n = int(input()) step = list(map(int, input().split())) for i in range(1, n): delta = abs(step[i]|step[i - 1]) deltaa = step[i] - step[i - 1] if delta==0: continue if delta == 1: if deltaa == 1: nowwid += 1 if nowwid > maxwid: maxwid = nowwid else: nowwid -= 1 else: if width == 0: width = delta elif width != delta: flag = 0 break if width < maxwid: flag = 0 break if deltaa > 0: depth += 1 if depth > maxdep: maxdep = depth else: depth -= 1 if flag: print("YES") print(maxdep, max(maxwid, width)) else: print("NO")
delta = abs(step[i]|step[i - 1])
14
operation
n, a, b = map(int, input().split()); def swap(x, y): t = x; x = y; y = t; if a > b: swap(a, b); cnt = 1; while n > 2: if b - a == 1 and a % 2 == 1: print(cnt); break; a = (a + 1) / 2; b = (b + 1) / 2; n /= 2; cnt += 1; else: print("Final!");
y, a, b = map(int, input().split()); def swap(x, y): t = x; x = y; y = t; if a > b: swap(a, b); cnt = 1; while n > 2: if b - a == 1 and a % 2 == 1: print(cnt); break; a = (a + 1) / 2; b = (b + 1) / 2; n /= 2; cnt += 1; else: print("Final!");
y, a, b = map(int, input().split());
1
statement
n, a, b = map(int, input().split()); def swap(x, y): t = x; x = y; y = t; if a > b: swap(a, b); cnt = 1; while n > 2: if b - a == 1 and a % 2 == 1: print(cnt); break; a = (a + 1) / 2; b = (b + 1) / 2; n /= 2; cnt += 1; else: print("Final!");
n, a, b = map(int, input().split()); def swap(x, y): t = x; x = y; y = t; if a > b: swap(a, b); cnt = 1; while n==2: if b - a == 1 and a % 2 == 1: print(cnt); break; a = (a + 1) / 2; b = (b + 1) / 2; n /= 2; cnt += 1; else: print("Final!");
while n==2:
11
decision
n, a, b = map(int, input().split()); def swap(x, y): t = x; x = y; y = t; if a > b: swap(a, b); cnt = 1; while n > 2: if b - a == 1 and a % 2 == 1: print(cnt); break; a = (a + 1) / 2; b = (b + 1) / 2; n /= 2; cnt += 1; else: print("Final!");
n, a, b = map(int, input().split()); def swap(x, y): t = x; x = y; y = t; if a > b: swap(a, b); cnt = 1; while n > 2: if b - a == 1 and a % 2 == 1: print(cnt); break; a = (a + 1) / 2; b = (b*1) / 2; n /= 2; cnt += 1; else: print("Final!");
b = (b*1) / 2;
16
operation
n, a, b = map(int, input().split()); def swap(x, y): t = x; x = y; y = t; if a > b: swap(a, b); cnt = 1; while n > 2: if b - a == 1 and a % 2 == 1: print(cnt); break; a = (a + 1) / 2; b = (b + 1) / 2; n /= 2; cnt += 1; else: print("Final!");
n, a, b = map(int, input().split()); def swap(x, y): t = x; x = y; y = t; if a > b: swap(a, b); cnt = 1; while n==2: if b - a == 1 and a % 2 == 1: print(cnt); break; a = (a + 1) / 2; b = (b + 1) / 2; n /= 2; cnt += 1; else: print("Final!");
while n==2:
11
decision
n, a, b = map(int, input().split()); def swap(x, y): t = x; x = y; y = t; if a > b: swap(a, b); cnt = 1; while n > 2: if b - a == 1 and a % 2 == 1: print(cnt); break; a = (a + 1) / 2; b = (b + 1) / 2; n /= 2; cnt += 1; else: print("Final!");
n, a, b = map(int, input().split()); def swap(x, y): t = x; x = y; y = t; if a > b: swap(a, b); cnt = 1; while n > 2: if b*a == 1 and a % 2 == 1: print(cnt); break; a = (a + 1) / 2; b = (b + 1) / 2; n /= 2; cnt += 1; else: print("Final!");
if b*a == 1 and a % 2 == 1:
12
operation
n, a, b = map(int, input().split()) a -= 1 b -= 1 d = abs(b-a) i = 1 while (a//(2**i) != b//(2**i)): i += 1 if 2**i == n: print('Final!') else: print(i)
n, a, b = map(int, input().split()) a -= 1 b -= 1 d = abs(b-a) i = 1 while (a//(2**i) != b//(2**i)): i += 1 if 2**i == n: print('Final!') else: print(x)
print(x)
15
statement
n, a, b = map(int, input().split()) a -= 1 b -= 1 d = abs(b-a) i = 1 while (a//(2**i) != b//(2**i)): i += 1 if 2**i == n: print('Final!') else: print(i)
n, a, b = x(int, input().split()) a -= 1 b -= 1 d = abs(b-a) i = 1 while (a//(2**i) != b//(2**i)): i += 1 if 2**i == n: print('Final!') else: print(i)
n, a, b = x(int, input().split())
1
statement
n, a, b = map(int, input().split()) a -= 1 b -= 1 d = abs(b-a) i = 1 while (a//(2**i) != b//(2**i)): i += 1 if 2**i == n: print('Final!') else: print(i)
n, a, b = map(y, input().split()) a -= 1 b -= 1 d = abs(b-a) i = 1 while (a//(2**i) != b//(2**i)): i += 1 if 2**i == n: print('Final!') else: print(i)
n, a, b = map(y, input().split())
1
statement
n, a, b = map(int, input().split()) a -= 1 b -= 1 d = abs(b-a) i = 1 while (a//(2**i) != b//(2**i)): i += 1 if 2**i == n: print('Final!') else: print(i)
n, a, b = map(int, input().split()) a -= 1 b -= 1 d = abs(b-a) i = 1 while (a<<(2**i) != b//(2**i)): i += 1 if 2**i == n: print('Final!') else: print(i)
while (a<<(2**i) != b//(2**i)):
9
operation
WOLF = "W" SHEEP = "S" DOG = "D" EMPTY = "." R, C = [int(x) for x in input().split()] field = [] has_wolves = False is_imp = False for row_i in range(R): row = input() if row.count(WOLF): has_wolves = True field.append(row) if not has_wolves: print("Yes") for row_i in range(R): print(field[row_i]) else: for row_i in range(R): for col_i in range(C): if field[row_i][col_i] == SHEEP and \ ( (row_i > 0 and field[row_i - 1][col_i] == WOLF) or \ (col_i > 0 and field[row_i][col_i - 1] == WOLF) or \ (row_i < R - 1 and field[row_i + 1][col_i] == WOLF) or \ (col_i < C - 1 and field[row_i][col_i + 1] == WOLF) ): is_imp = True break if field[row_i][col_i] == WOLF and \ ( (row_i > 0 and field[row_i - 1][col_i] == SHEEP) or \ (col_i > 0 and field[row_i][col_i - 1] == SHEEP) or \ (row_i < R - 1 and field[row_i + 1][col_i] == SHEEP) or \ (col_i < C - 1 and field[row_i][col_i + 1] == SHEEP) ): is_imp = True break if is_imp: break if is_imp: print("No") else: print("Yes") for row_i in range(R): print(field[row_i].replace(EMPTY, DOG))
WOLF = "W" SHEEP = "S" DOG = "D" EMPTY = "." R, C = [int(x) for x in input().split()] field = [] has_wolves = False is_imp = False for row_i in range(R): row = input() if row.count(WOLF): has_wolves = True field.append(row) if not has_wolves: print("Yes") for row_i in range(R): print(field[row_i]) else: for row_i in range(R): for col_i in range(C): if field[row_i][col_i] == SHEEP and \ ( (row_i > 0 and field[row_i&1][col_i] == WOLF) or \ (col_i > 0 and field[row_i][col_i - 1] == WOLF) or \ (row_i < R - 1 and field[row_i + 1][col_i] == WOLF) or \ (col_i < C - 1 and field[row_i][col_i + 1] == WOLF) ): is_imp = True break if field[row_i][col_i] == WOLF and \ ( (row_i > 0 and field[row_i - 1][col_i] == SHEEP) or \ (col_i > 0 and field[row_i][col_i - 1] == SHEEP) or \ (row_i < R - 1 and field[row_i + 1][col_i] == SHEEP) or \ (col_i < C - 1 and field[row_i][col_i + 1] == SHEEP) ): is_imp = True break if is_imp: break if is_imp: print("No") else: print("Yes") for row_i in range(R): print(field[row_i].replace(EMPTY, DOG))
(row_i > 0 and field[row_i&1][col_i] == WOLF) or \
27
operation
WOLF = "W" SHEEP = "S" DOG = "D" EMPTY = "." R, C = [int(x) for x in input().split()] field = [] has_wolves = False is_imp = False for row_i in range(R): row = input() if row.count(WOLF): has_wolves = True field.append(row) if not has_wolves: print("Yes") for row_i in range(R): print(field[row_i]) else: for row_i in range(R): for col_i in range(C): if field[row_i][col_i] == SHEEP and \ ( (row_i > 0 and field[row_i - 1][col_i] == WOLF) or \ (col_i > 0 and field[row_i][col_i - 1] == WOLF) or \ (row_i < R - 1 and field[row_i + 1][col_i] == WOLF) or \ (col_i < C - 1 and field[row_i][col_i + 1] == WOLF) ): is_imp = True break if field[row_i][col_i] == WOLF and \ ( (row_i > 0 and field[row_i - 1][col_i] == SHEEP) or \ (col_i > 0 and field[row_i][col_i - 1] == SHEEP) or \ (row_i < R - 1 and field[row_i + 1][col_i] == SHEEP) or \ (col_i < C - 1 and field[row_i][col_i + 1] == SHEEP) ): is_imp = True break if is_imp: break if is_imp: print("No") else: print("Yes") for row_i in range(R): print(field[row_i].replace(EMPTY, DOG))
WOLF = "W" SHEEP = "S" DOG = "D" EMPTY = "." R, C = [int(x) for x in input().split()] field = [] has_wolves = False is_imp = False for row_i in range(R): row = input() if row.count(WOLF): has_wolves = True field.append(row) if not has_wolves: print("Yes") for row_i in range(R): print(field[row_i]) else: for row_i in range(R): for col_i in range(C): if field[row_i][col_i] == SHEEP and \ ( (row_i > 0 and field[row_i - 1][col_i] == WOLF) or \ (col_i > 0 and field[row_i][col_i - 1]<WOLF) or \ (row_i < R - 1 and field[row_i + 1][col_i] == WOLF) or \ (col_i < C - 1 and field[row_i][col_i + 1] == WOLF) ): is_imp = True break if field[row_i][col_i] == WOLF and \ ( (row_i > 0 and field[row_i - 1][col_i] == SHEEP) or \ (col_i > 0 and field[row_i][col_i - 1] == SHEEP) or \ (row_i < R - 1 and field[row_i + 1][col_i] == SHEEP) or \ (col_i < C - 1 and field[row_i][col_i + 1] == SHEEP) ): is_imp = True break if is_imp: break if is_imp: print("No") else: print("Yes") for row_i in range(R): print(field[row_i].replace(EMPTY, DOG))
(col_i > 0 and field[row_i][col_i - 1]<WOLF) or \
28
decision
WOLF = "W" SHEEP = "S" DOG = "D" EMPTY = "." R, C = [int(x) for x in input().split()] field = [] has_wolves = False is_imp = False for row_i in range(R): row = input() if row.count(WOLF): has_wolves = True field.append(row) if not has_wolves: print("Yes") for row_i in range(R): print(field[row_i]) else: for row_i in range(R): for col_i in range(C): if field[row_i][col_i] == SHEEP and \ ( (row_i > 0 and field[row_i - 1][col_i] == WOLF) or \ (col_i > 0 and field[row_i][col_i - 1] == WOLF) or \ (row_i < R - 1 and field[row_i + 1][col_i] == WOLF) or \ (col_i < C - 1 and field[row_i][col_i + 1] == WOLF) ): is_imp = True break if field[row_i][col_i] == WOLF and \ ( (row_i > 0 and field[row_i - 1][col_i] == SHEEP) or \ (col_i > 0 and field[row_i][col_i - 1] == SHEEP) or \ (row_i < R - 1 and field[row_i + 1][col_i] == SHEEP) or \ (col_i < C - 1 and field[row_i][col_i + 1] == SHEEP) ): is_imp = True break if is_imp: break if is_imp: print("No") else: print("Yes") for row_i in range(R): print(field[row_i].replace(EMPTY, DOG))
WOLF = "W" SHEEP = "S" DOG = "D" EMPTY = "." R, C = [int(x) for x in input().split()] field = [] has_wolves = False is_imp = False for row_i in range(R): row = input() if row.count(WOLF): has_wolves = True field.append(row) if not has_wolves: print("Yes") for row_i in range(R): print(field[row_i]) else: for row_i in range(R): for col_i in range(C): if field[row_i][col_i] == SHEEP and \ ( (row_i > 0 and field[row_i - 1][col_i] == WOLF) or \ (col_i > 0 and field[row_i][col_i - 1] == WOLF) or \ (row_i < R - 1 and field[row_i + 1][col_i] == WOLF) or \ (col_i < C - 1 and field[row_i][col_i + 1] == WOLF) ): is_imp = True break if field[row_i][col_i] == WOLF and \ ( (row_i > 0 and field[row_i - 1][col_i] == SHEEP) or \ (col_i > 0 and field[row_i][col_i - 1] == SHEEP) or \ (row_i < R - 1 and field[row_i + 1][col_i] == SHEEP) or \ (col_i < C - 1 and field[row_i][col_i + 1]<SHEEP) ): is_imp = True break if is_imp: break if is_imp: print("No") else: print("Yes") for row_i in range(R): print(field[row_i].replace(EMPTY, DOG))
(col_i < C - 1 and field[row_i][col_i + 1]<SHEEP)
39
decision
WOLF = "W" SHEEP = "S" DOG = "D" EMPTY = "." R, C = [int(x) for x in input().split()] field = [] has_wolves = False is_imp = False for row_i in range(R): row = input() if row.count(WOLF): has_wolves = True field.append(row) if not has_wolves: print("Yes") for row_i in range(R): print(field[row_i]) else: for row_i in range(R): for col_i in range(C): if field[row_i][col_i] == SHEEP and \ ( (row_i > 0 and field[row_i - 1][col_i] == WOLF) or \ (col_i > 0 and field[row_i][col_i - 1] == WOLF) or \ (row_i < R - 1 and field[row_i + 1][col_i] == WOLF) or \ (col_i < C - 1 and field[row_i][col_i + 1] == WOLF) ): is_imp = True break if field[row_i][col_i] == WOLF and \ ( (row_i > 0 and field[row_i - 1][col_i] == SHEEP) or \ (col_i > 0 and field[row_i][col_i - 1] == SHEEP) or \ (row_i < R - 1 and field[row_i + 1][col_i] == SHEEP) or \ (col_i < C - 1 and field[row_i][col_i + 1] == SHEEP) ): is_imp = True break if is_imp: break if is_imp: print("No") else: print("Yes") for row_i in range(R): print(field[row_i].replace(EMPTY, DOG))
WOLF = "W" SHEEP = "S" DOG = "D" EMPTY = "." R, C = [int(x) for x in input().split()] field = [] has_wolves = False is_imp = False for row_i in range(R): row = input() if row.count(WOLF): has_wolves = True field.append(row) if not has_wolves: print("Yes") for row_i in range(R): print(field[row_i]) else: for row_i in range(R): for col_i in range(C): if field[row_i][col_i] == SHEEP and \ ( (row_i > 0 and field[row_i - 1][col_i] == WOLF) or \ (col_i > 0 and field[row_i][col_i - 1] == WOLF) or \ (row_i < R - 1 and field[row_i + 1][col_i] == WOLF) or \ (col_i < C - 1 and field[row_i][col_i + 1] == WOLF) ): is_imp = True break if field[row_i][col_i] == WOLF and \ ( (row_i > 0 and field[row_i - 1][col_i] == SHEEP) or \ (col_i > 0 and field[row_i][col_i - 1] == SHEEP) or \ (row_i < R - 1 and field[row_i + 1][col_i] == SHEEP) or \ (col_i>C - 1 and field[row_i][col_i + 1] == SHEEP) ): is_imp = True break if is_imp: break if is_imp: print("No") else: print("Yes") for row_i in range(R): print(field[row_i].replace(EMPTY, DOG))
(col_i>C - 1 and field[row_i][col_i + 1] == SHEEP)
39
decision