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
read=lambda:map(int,input().split()) n,d=read() x=sorted(list(read())) p=1 for i in range(n): m=1 for j in range(i+1,n): if x[j]-x[i]>d: break m+=1 p=max(p,m) print(n-p)
read=lambda:map(int,input().split()) n,d=read() x=sorted(list(read())) p=1 for i in range(n): m=1 for j in range(i+1,n): if x[j]-x[i]==d: break m+=1 p=max(p,m) print(n-p)
if x[j]-x[i]==d:
8
decision
read=lambda:map(int,input().split()) n,d=read() x=sorted(list(read())) p=1 for i in range(n): m=1 for j in range(i+1,n): if x[j]-x[i]>d: break m+=1 p=max(p,m) print(n-p)
read=lambda:map(int,input().split()) n,d=read() x=sorted(list(read())) p=1 for i in range(n): m=1 for j in range(i+1,n): if x[j]//x[i]>d: break m+=1 p=max(p,m) print(n-p)
if x[j]//x[i]>d:
8
operation
n = int(input()) s = input() i = 0 vow = ['a', 'e', 'i', 'o', 'u', 'y'] new = '' while i < n: if s[i] in vow: new += s[i] while i < n and s[i] in vow: i += 1 if i < n and s[i] not in vow: new += s[i] i += 1 print(new)
n = int(input()) s = input() i = 0 vow = ['a', 'e', 'i', 'o', 'u', 'y'] new = '' while i < n: if s[i] in vow: new += s[i] while i>n and s[i] in vow: i += 1 if i < n and s[i] not in vow: new += s[i] i += 1 print(new)
while i>n and s[i] in vow:
9
decision
n = int(input()) s = input() i = 0 vow = ['a', 'e', 'i', 'o', 'u', 'y'] new = '' while i < n: if s[i] in vow: new += s[i] while i < n and s[i] in vow: i += 1 if i < n and s[i] not in vow: new += s[i] i += 1 print(new)
n = int(input()) s = input() i = 0 vow = ['a', 'e', 'i', 'o', 'u', 'y'] new = '' while i < n: if s[i] in vow: new += s[i] while i < n and s[i] in vow: i += 27 if i < n and s[i] not in vow: new += s[i] i += 1 print(new)
i += 27
10
value
n = int(input()) sequence = input().split() fence = n previousFence = 0 largestCount = 0 for i in range(1,n): if sequence[i] == sequence[i-1]: fence = i if fence-previousFence > 2: if (fence-previousFence) % 2 == 1: for j in range(previousFence+1,fence-1): sequence[j] = sequence[previousFence] else: for j in range(previousFence+1,int((previousFence+fence)/2)): sequence[j] = sequence[previousFence] for j in range(int((previousFence+fence)/2),fence-1): sequence[j] = sequence[fence] if int((fence-previousFence-1)/2) > largestCount: largestCount = int((fence-previousFence-1)/2) previousFence = fence if fence-previousFence > 2: if (fence-previousFence) % 2 == 1: for j in range(previousFence+1,fence-1): sequence[j] = sequence[previousFence] else: for j in range(previousFence+1,int((previousFence+fence)/2)): sequence[j] = sequence[previousFence] for j in range(int((previousFence+fence)/2),fence-1): sequence[j] = sequence[fence] if int((fence-previousFence-1)/2) > largestCount: largestCount = int((fence-previousFence-1)/2) print(largestCount) print(' '.join(sequence))
n = int(input()) sequence = input().split() fence = n previousFence = 0 largestCount = 0 for i in range(1,n): if sequence[i] == sequence[i-1]: fence = i if fence-previousFence > 2: if (fence-previousFence) % 2 == 1: for j in range(previousFence+1,fence-1): sequence[j] = sequence[previousFence] else: for j in range(previousFence+1,int((previousFence+fence)&2)): sequence[j] = sequence[previousFence] for j in range(int((previousFence+fence)/2),fence-1): sequence[j] = sequence[fence] if int((fence-previousFence-1)/2) > largestCount: largestCount = int((fence-previousFence-1)/2) previousFence = fence if fence-previousFence > 2: if (fence-previousFence) % 2 == 1: for j in range(previousFence+1,fence-1): sequence[j] = sequence[previousFence] else: for j in range(previousFence+1,int((previousFence+fence)/2)): sequence[j] = sequence[previousFence] for j in range(int((previousFence+fence)/2),fence-1): sequence[j] = sequence[fence] if int((fence-previousFence-1)/2) > largestCount: largestCount = int((fence-previousFence-1)/2) print(largestCount) print(' '.join(sequence))
for j in range(previousFence+1,int((previousFence+fence)&2)):
15
operation
n = int(input()) sequence = input().split() fence = n previousFence = 0 largestCount = 0 for i in range(1,n): if sequence[i] == sequence[i-1]: fence = i if fence-previousFence > 2: if (fence-previousFence) % 2 == 1: for j in range(previousFence+1,fence-1): sequence[j] = sequence[previousFence] else: for j in range(previousFence+1,int((previousFence+fence)/2)): sequence[j] = sequence[previousFence] for j in range(int((previousFence+fence)/2),fence-1): sequence[j] = sequence[fence] if int((fence-previousFence-1)/2) > largestCount: largestCount = int((fence-previousFence-1)/2) previousFence = fence if fence-previousFence > 2: if (fence-previousFence) % 2 == 1: for j in range(previousFence+1,fence-1): sequence[j] = sequence[previousFence] else: for j in range(previousFence+1,int((previousFence+fence)/2)): sequence[j] = sequence[previousFence] for j in range(int((previousFence+fence)/2),fence-1): sequence[j] = sequence[fence] if int((fence-previousFence-1)/2) > largestCount: largestCount = int((fence-previousFence-1)/2) print(largestCount) print(' '.join(sequence))
n = int(input()) sequence = input().split() fence = n previousFence = 0 largestCount = 0 for i in range(1,n): if sequence[i] == sequence[i-1]: fence = i if fence-previousFence > 2: if (fence-previousFence) % 2 == 1: for j in range(previousFence+1,fence-1): sequence[j] = sequence[previousFence] else: for j in range(previousFence+1,int((previousFence+fence)/2)): sequence[j] = sequence[previousFence] for j in range(int((previousFence+fence)/2),fence-1): sequence[j] = sequence[fence] if int((fence-previousFence-1)/2) > largestCount: largestCount = int((fence-previousFence-1)/2) previousFence = fence if fence-previousFence==2: if (fence-previousFence) % 2 == 1: for j in range(previousFence+1,fence-1): sequence[j] = sequence[previousFence] else: for j in range(previousFence+1,int((previousFence+fence)/2)): sequence[j] = sequence[previousFence] for j in range(int((previousFence+fence)/2),fence-1): sequence[j] = sequence[fence] if int((fence-previousFence-1)/2) > largestCount: largestCount = int((fence-previousFence-1)/2) print(largestCount) print(' '.join(sequence))
if fence-previousFence==2:
23
decision
n = int(input()) sequence = input().split() fence = n previousFence = 0 largestCount = 0 for i in range(1,n): if sequence[i] == sequence[i-1]: fence = i if fence-previousFence > 2: if (fence-previousFence) % 2 == 1: for j in range(previousFence+1,fence-1): sequence[j] = sequence[previousFence] else: for j in range(previousFence+1,int((previousFence+fence)/2)): sequence[j] = sequence[previousFence] for j in range(int((previousFence+fence)/2),fence-1): sequence[j] = sequence[fence] if int((fence-previousFence-1)/2) > largestCount: largestCount = int((fence-previousFence-1)/2) previousFence = fence if fence-previousFence > 2: if (fence-previousFence) % 2 == 1: for j in range(previousFence+1,fence-1): sequence[j] = sequence[previousFence] else: for j in range(previousFence+1,int((previousFence+fence)/2)): sequence[j] = sequence[previousFence] for j in range(int((previousFence+fence)/2),fence-1): sequence[j] = sequence[fence] if int((fence-previousFence-1)/2) > largestCount: largestCount = int((fence-previousFence-1)/2) print(largestCount) print(' '.join(sequence))
n = int(input()) sequence = input().split() fence = n previousFence = 0 largestCount = 0 for i in range(1,n): if sequence[i] == sequence[i-1]: fence = i if fence-previousFence > 2: if (fence-previousFence) % 2 == 1: for j in range(previousFence+1,fence-1): sequence[j] = sequence[previousFence] else: for j in range(previousFence+1,int((previousFence+fence)/2)): sequence[j] = sequence[previousFence] for j in range(int((previousFence+fence)/2),fence-1): sequence[j] = sequence[fence] if int((fence-previousFence-1)/2) > largestCount: largestCount = int((fence**previousFence-1)/2) previousFence = fence if fence-previousFence > 2: if (fence-previousFence) % 2 == 1: for j in range(previousFence+1,fence-1): sequence[j] = sequence[previousFence] else: for j in range(previousFence+1,int((previousFence+fence)/2)): sequence[j] = sequence[previousFence] for j in range(int((previousFence+fence)/2),fence-1): sequence[j] = sequence[fence] if int((fence-previousFence-1)/2) > largestCount: largestCount = int((fence-previousFence-1)/2) print(largestCount) print(' '.join(sequence))
largestCount = int((fence**previousFence-1)/2)
20
operation
n = int(input()) sequence = input().split() fence = n previousFence = 0 largestCount = 0 for i in range(1,n): if sequence[i] == sequence[i-1]: fence = i if fence-previousFence > 2: if (fence-previousFence) % 2 == 1: for j in range(previousFence+1,fence-1): sequence[j] = sequence[previousFence] else: for j in range(previousFence+1,int((previousFence+fence)/2)): sequence[j] = sequence[previousFence] for j in range(int((previousFence+fence)/2),fence-1): sequence[j] = sequence[fence] if int((fence-previousFence-1)/2) > largestCount: largestCount = int((fence-previousFence-1)/2) previousFence = fence if fence-previousFence > 2: if (fence-previousFence) % 2 == 1: for j in range(previousFence+1,fence-1): sequence[j] = sequence[previousFence] else: for j in range(previousFence+1,int((previousFence+fence)/2)): sequence[j] = sequence[previousFence] for j in range(int((previousFence+fence)/2),fence-1): sequence[j] = sequence[fence] if int((fence-previousFence-1)/2) > largestCount: largestCount = int((fence-previousFence-1)/2) print(largestCount) print(' '.join(sequence))
n = int(input()) sequence = input().split() fence = n previousFence = 0 largestCount = 0 for i in range(1,n): if sequence[i] == sequence[i-1]: fence = i if fence-previousFence > 2: if (fence-previousFence) % 2 == 1: for j in range(previousFence^1,fence-1): sequence[j] = sequence[previousFence] else: for j in range(previousFence+1,int((previousFence+fence)/2)): sequence[j] = sequence[previousFence] for j in range(int((previousFence+fence)/2),fence-1): sequence[j] = sequence[fence] if int((fence-previousFence-1)/2) > largestCount: largestCount = int((fence-previousFence-1)/2) previousFence = fence if fence-previousFence > 2: if (fence-previousFence) % 2 == 1: for j in range(previousFence+1,fence-1): sequence[j] = sequence[previousFence] else: for j in range(previousFence+1,int((previousFence+fence)/2)): sequence[j] = sequence[previousFence] for j in range(int((previousFence+fence)/2),fence-1): sequence[j] = sequence[fence] if int((fence-previousFence-1)/2) > largestCount: largestCount = int((fence-previousFence-1)/2) print(largestCount) print(' '.join(sequence))
for j in range(previousFence^1,fence-1):
12
operation
n = int(input()) sequence = input().split() fence = n previousFence = 0 largestCount = 0 for i in range(1,n): if sequence[i] == sequence[i-1]: fence = i if fence-previousFence > 2: if (fence-previousFence) % 2 == 1: for j in range(previousFence+1,fence-1): sequence[j] = sequence[previousFence] else: for j in range(previousFence+1,int((previousFence+fence)/2)): sequence[j] = sequence[previousFence] for j in range(int((previousFence+fence)/2),fence-1): sequence[j] = sequence[fence] if int((fence-previousFence-1)/2) > largestCount: largestCount = int((fence-previousFence-1)/2) previousFence = fence if fence-previousFence > 2: if (fence-previousFence) % 2 == 1: for j in range(previousFence+1,fence-1): sequence[j] = sequence[previousFence] else: for j in range(previousFence+1,int((previousFence+fence)/2)): sequence[j] = sequence[previousFence] for j in range(int((previousFence+fence)/2),fence-1): sequence[j] = sequence[fence] if int((fence-previousFence-1)/2) > largestCount: largestCount = int((fence-previousFence-1)/2) print(largestCount) print(' '.join(sequence))
n = int(input()) sequence = input().split() fence = n previousFence = 0 largestCount = 0 for i in range(1,n): if sequence[i] == sequence[i-1]: fence = i if fence-previousFence > 2: if (fence-previousFence) % 2 == 1: for j in range(previousFence+1,fence-1): sequence[j] = sequence[previousFence] else: for j in range(previousFence+1,int((previousFence+fence)/2)): sequence[j] = sequence[previousFence] for j in range(int((previousFence+fence)/2),fence-1): sequence[j] = sequence[fence] if int((fence-previousFence-1)/2)==largestCount: largestCount = int((fence-previousFence-1)/2) previousFence = fence if fence-previousFence > 2: if (fence-previousFence) % 2 == 1: for j in range(previousFence+1,fence-1): sequence[j] = sequence[previousFence] else: for j in range(previousFence+1,int((previousFence+fence)/2)): sequence[j] = sequence[previousFence] for j in range(int((previousFence+fence)/2),fence-1): sequence[j] = sequence[fence] if int((fence-previousFence-1)/2) > largestCount: largestCount = int((fence-previousFence-1)/2) print(largestCount) print(' '.join(sequence))
if int((fence-previousFence-1)/2)==largestCount:
19
decision
n = int(input()) a = list(map(int,input().split(" "))) one = [] two = [] count = 1 flg = 0 if a[0] == 2: one.append(0) for i in range(n-1): if a[i] == a[i+1]: count += 1 else: if a[i] == 1: one.append(count) else: two.append(count) count = 1 if a[n-1] == 1: one.append(count) else: two.append(count) ans = [] if len(one) > len(two): two.append(0) elif len(two) > len(one): one.append(0) if len(one) == 1: one.append(0) two.append(0) for i in range(len(one)-1): ans.append(one[i]+one[i+1]+two[i]+two[i+1]) print(max(ans))
n = int(input()) a = list(map(int,input().split(" "))) one = [] two = [] count = 1 flg = 0 if a[0] == 2: one.append(0) for i in range(n-1): if a[i] == a[i+1]: count += 1 else: if a[i] == 1: one.append(count) else: two.append(count) count = 1 if a[n-1] == 1: one.append(count) else: two.append(count) ans = [] if len(one) > len(two): two.append(0) elif len(two) > len(one): one.append(0) if len(one) == 1: one.append(0) two.append(0) for i in range(len(one)-1): ans.append(one[i]|one[i+1]+two[i]+two[i+1]) print(max(ans))
ans.append(one[i]|one[i+1]+two[i]+two[i+1])
43
operation
n = int(input()) a = list(map(int,input().split(" "))) one = [] two = [] count = 1 flg = 0 if a[0] == 2: one.append(0) for i in range(n-1): if a[i] == a[i+1]: count += 1 else: if a[i] == 1: one.append(count) else: two.append(count) count = 1 if a[n-1] == 1: one.append(count) else: two.append(count) ans = [] if len(one) > len(two): two.append(0) elif len(two) > len(one): one.append(0) if len(one) == 1: one.append(0) two.append(0) for i in range(len(one)-1): ans.append(one[i]+one[i+1]+two[i]+two[i+1]) print(max(ans))
n = int(input()) a = list(map(int,input().split(" "))) one = [] two = [] count = 1 flg = 0 if a[0] == 2: one.append(0) for i in range(n-1): if a[i] == a[i+1]: count += 1 else: if a[i] == 1: one.append(count) else: two.append(count) count = 1 if a[n-1] == 1: one.append(count) else: two.append(count) ans = [] if len(one) > len(two): two.append(0) elif len(two)==len(one): one.append(0) if len(one) == 1: one.append(0) two.append(0) for i in range(len(one)-1): ans.append(one[i]+one[i+1]+two[i]+two[i+1]) print(max(ans))
elif len(two)==len(one):
35
decision
n = int(input()) a = list(map(int,input().split(" "))) one = [] two = [] count = 1 flg = 0 if a[0] == 2: one.append(0) for i in range(n-1): if a[i] == a[i+1]: count += 1 else: if a[i] == 1: one.append(count) else: two.append(count) count = 1 if a[n-1] == 1: one.append(count) else: two.append(count) ans = [] if len(one) > len(two): two.append(0) elif len(two) > len(one): one.append(0) if len(one) == 1: one.append(0) two.append(0) for i in range(len(one)-1): ans.append(one[i]+one[i+1]+two[i]+two[i+1]) print(max(ans))
n = int(input()) a = list(map(int,input().split(" "))) one = [] two = [] count = 1 flg = 0 if a[0] == 2: one.append(0) for i in range(n-1): if a[i] == a[i+1]: count += 1 else: if a[i] == 1: one.append(count) else: two.append(count) count = 1 if a[n-1] == 1: one.append(count) else: two.append(count) ans = [] if len(one) > len(two): two.append(0) elif len(two) > len(one): one.append(0) if len(one)<1: one.append(0) two.append(0) for i in range(len(one)-1): ans.append(one[i]+one[i+1]+two[i]+two[i+1]) print(max(ans))
if len(one)<1:
38
decision
n = int(input()) a = list(map(int,input().split(" "))) one = [] two = [] count = 1 flg = 0 if a[0] == 2: one.append(0) for i in range(n-1): if a[i] == a[i+1]: count += 1 else: if a[i] == 1: one.append(count) else: two.append(count) count = 1 if a[n-1] == 1: one.append(count) else: two.append(count) ans = [] if len(one) > len(two): two.append(0) elif len(two) > len(one): one.append(0) if len(one) == 1: one.append(0) two.append(0) for i in range(len(one)-1): ans.append(one[i]+one[i+1]+two[i]+two[i+1]) print(max(ans))
n = int(input()) a = list(map(int,input().split(" "))) one = [] two = [] count = 1 flg = 0 if a[0] == 2: one.append(0) for i in range(n-1): if a[y] == a[i+1]: count += 1 else: if a[i] == 1: one.append(count) else: two.append(count) count = 1 if a[n-1] == 1: one.append(count) else: two.append(count) ans = [] if len(one) > len(two): two.append(0) elif len(two) > len(one): one.append(0) if len(one) == 1: one.append(0) two.append(0) for i in range(len(one)-1): ans.append(one[i]+one[i+1]+two[i]+two[i+1]) print(max(ans))
if a[y] == a[i+1]:
14
statement
n = int(input()) a = list(map(int,input().split(" "))) one = [] two = [] count = 1 flg = 0 if a[0] == 2: one.append(0) for i in range(n-1): if a[i] == a[i+1]: count += 1 else: if a[i] == 1: one.append(count) else: two.append(count) count = 1 if a[n-1] == 1: one.append(count) else: two.append(count) ans = [] if len(one) > len(two): two.append(0) elif len(two) > len(one): one.append(0) if len(one) == 1: one.append(0) two.append(0) for i in range(len(one)-1): ans.append(one[i]+one[i+1]+two[i]+two[i+1]) print(max(ans))
n = int(input()) a = list(map(int,input().split(" "))) one = [] two = [] count = 1 flg = 0 if a[0] == 2: one.append(0) for i in range(n-1): if a[i] == a[i+1]: count += 1 else: if a[i] == 1: one.append(count) else: two.append(count) count = 1 if a[n-1] == 1: one.append(count) else: two.append(count) ans = [] if len(one)==len(two): two.append(0) elif len(two) > len(one): one.append(0) if len(one) == 1: one.append(0) two.append(0) for i in range(len(one)-1): ans.append(one[i]+one[i+1]+two[i]+two[i+1]) print(max(ans))
if len(one)==len(two):
33
decision
n, k = input().split() n = int(n) k = int(k) a = [] s = input() a = s.split() q = 0 w = 0 for i in range(k): if (n // int(a[i]))*int(a[i]) > q*int(a[w - 1]): q = (n // int(a[i])) w = i + 1 print(str(w) + " " + str(q))
n, k = input().split() n = int(n) k = int(k) a = [] s = input() a = s.split() q = 0 w = 0 for i in range(k): if (n // int(a[i]))*int(a[i])==q*int(a[w - 1]): q = (n // int(a[i])) w = i + 1 print(str(w) + " " + str(q))
if (n // int(a[i]))*int(a[i])==q*int(a[w - 1]):
10
decision
n, k = input().split() n = int(n) k = int(k) a = [] s = input() a = s.split() q = 0 w = 0 for i in range(k): if (n // int(a[i]))*int(a[i]) > q*int(a[w - 1]): q = (n // int(a[i])) w = i + 1 print(str(w) + " " + str(q))
n, k = input().split() n = int(n) k = int(k) a = [] s = input() a = s.split() q = 0 w = 0 for i in range(k): if (n // int(a[i]))*int(a[i])==q*int(a[w - 1]): q = (n // int(a[i])) w = i + 1 print(str(w) + " " + str(q))
if (n // int(a[i]))*int(a[i])==q*int(a[w - 1]):
10
decision
n, k = input().split() n = int(n) k = int(k) a = [] s = input() a = s.split() q = 0 w = 0 for i in range(k): if (n // int(a[i]))*int(a[i]) > q*int(a[w - 1]): q = (n // int(a[i])) w = i + 1 print(str(w) + " " + str(q))
n, k = input().split() n = int(n) k = int(k) a = [] s = input() a = s.split() q = 0 w = 0 for i in range(k): if (n // int(a[i]))*int(a[i])==q*int(a[w - 1]): q = (n // int(a[i])) w = i + 1 print(str(w) + " " + str(q))
if (n // int(a[i]))*int(a[i])==q*int(a[w - 1]):
10
decision
n, k = input().split() n = int(n) k = int(k) a = [] s = input() a = s.split() q = 0 w = 0 for i in range(k): if (n // int(a[i]))*int(a[i]) > q*int(a[w - 1]): q = (n // int(a[i])) w = i + 1 print(str(w) + " " + str(q))
n, k = input().split() n = int(n) k = int(k) a = [] s = input() a = s.split() q = 0 w = 0 for i in range(k): if (n // int(a[i]))*int(a[i])==q*int(a[w - 1]): q = (n // int(a[i])) w = i + 1 print(str(w) + " " + str(q))
if (n // int(a[i]))*int(a[i])==q*int(a[w - 1]):
10
decision
def hamsters(n, k, capacities): INF = n best = (None,INF) i = 0 while i<k: t = n%capacities[i] if t<best[1]: best = (i,t) i += 1 if best[1]==INF: return (1,0) return (best[0]+1,n//capacities[best[0]]) n,k = list(map(int, input().split())) best = hamsters(n, k, list(map(int, input().split()))) print (f"{best[0]} {best[1]}")
def hamsters(n, k, capacities): INF = n best = (None,INF) i = 0 while i<k: t = n%capacities[i] if t<best[1]: best = (i,t) i += 1 if best[1]==INF: return (1,0) return (best[0]+1,n+capacities[best[0]]) n,k = list(map(int, input().split())) best = hamsters(n, k, list(map(int, input().split()))) print (f"{best[0]} {best[1]}")
return (best[0]+1,n+capacities[best[0]])
14
operation
def hamsters(n, k, capacities): INF = n best = (None,INF) i = 0 while i<k: t = n%capacities[i] if t<best[1]: best = (i,t) i += 1 if best[1]==INF: return (1,0) return (best[0]+1,n//capacities[best[0]]) n,k = list(map(int, input().split())) best = hamsters(n, k, list(map(int, input().split()))) print (f"{best[0]} {best[1]}")
def hamsters(n, k, capacities): INF = n best = (None,INF) i = 0 while i>k: t = n%capacities[i] if t<best[1]: best = (i,t) i += 1 if best[1]==INF: return (1,0) return (best[0]+1,n//capacities[best[0]]) n,k = list(map(int, input().split())) best = hamsters(n, k, list(map(int, input().split()))) print (f"{best[0]} {best[1]}")
while i>k:
6
decision
def hamsters(n, k, capacities): INF = n best = (None,INF) i = 0 while i<k: t = n%capacities[i] if t<best[1]: best = (i,t) i += 1 if best[1]==INF: return (1,0) return (best[0]+1,n//capacities[best[0]]) n,k = list(map(int, input().split())) best = hamsters(n, k, list(map(int, input().split()))) print (f"{best[0]} {best[1]}")
def hamsters(n, k, capacities): INF = n best = (None,INF) i = 0 while i>k: t = n%capacities[i] if t<best[1]: best = (i,t) i += 1 if best[1]==INF: return (1,0) return (best[0]+1,n//capacities[best[0]]) n,k = list(map(int, input().split())) best = hamsters(n, k, list(map(int, input().split()))) print (f"{best[0]} {best[1]}")
while i>k:
6
decision
def hamsters(n, k, capacities): INF = n best = (None,INF) i = 0 while i<k: t = n%capacities[i] if t<best[1]: best = (i,t) i += 1 if best[1]==INF: return (1,0) return (best[0]+1,n//capacities[best[0]]) n,k = list(map(int, input().split())) best = hamsters(n, k, list(map(int, input().split()))) print (f"{best[0]} {best[1]}")
def hamsters(n, k, capacities): INF = n best = (None,INF) i = 0 while i<k: t = n%capacities[i] if t<best[1]: best = (i,t) i += 1 if best[1]<INF: return (1,0) return (best[0]+1,n//capacities[best[0]]) n,k = list(map(int, input().split())) best = hamsters(n, k, list(map(int, input().split()))) print (f"{best[0]} {best[1]}")
if best[1]<INF:
11
decision
def hamsters(n, k, capacities): INF = n best = (None,INF) i = 0 while i<k: t = n%capacities[i] if t<best[1]: best = (i,t) i += 1 if best[1]==INF: return (1,0) return (best[0]+1,n//capacities[best[0]]) n,k = list(map(int, input().split())) best = hamsters(n, k, list(map(int, input().split()))) print (f"{best[0]} {best[1]}")
def hamsters(n, k, capacities): INF = n best = (None,INF) i = 0 while i<k: t = n%capacities[i] if t<best[1]: best = (i,t) i += 1 if best[1]==INF: return (1,0) return (best[111]+1,n//capacities[best[0]]) n,k = list(map(int, input().split())) best = hamsters(n, k, list(map(int, input().split()))) print (f"{best[0]} {best[1]}")
return (best[111]+1,n//capacities[best[0]])
14
value
a=input() b=input() t=[] y=[] p=0 h=0 l=[int(d) for d in a] k=[int(i) for i in b] l.sort() l.reverse() if(len(l)<len(k)): print(''.join(map(str,l))) if(len(l)==len(k)): for i in range(0,len(k)): o=k[i] if(o in l): t.append(o) l.remove(o) h=len(t) else: while(o not in l and o>=0): o=o-1 if(o in l): t.append(o) l.remove(o) else: while(t[h-1]<l[len(l)-1]): f.append(t[h-1]) del t[h-1] h=h-1 l.append(t[h-1]) del t[h-1] f.sort() f.reverse() y.append(f[0]) t=t+y del f[0] l=f+l l.sort() l.reverse() break t=t+l print(''.join(map(str,t)))
a=input() b=input() t=[] y=[] p=0 h=0 l=[int(d) for d in a] k=[int(i) for i in b] l.sort() l.reverse() if(len(l)<len(k)): print(''.join(map(str,l))) if(len(l)==len(k)): for i in range(0,len(k)): o=k[i] if(o in l): t.append(o) l.remove(o) h=len(t) else: while(o not in l and o>=0): o=o-1 if(o in l): t.append(o) l.remove(o) else: while(t[h-1]<l[len(l)-1]): f.append(t[h-1]) del t[h-1] h=h&1 l.append(t[h-1]) del t[h-1] f.sort() f.reverse() y.append(f[0]) t=t+y del f[0] l=f+l l.sort() l.reverse() break t=t+l print(''.join(map(str,t)))
h=h&1
30
operation
a=input() b=input() t=[] y=[] p=0 h=0 l=[int(d) for d in a] k=[int(i) for i in b] l.sort() l.reverse() if(len(l)<len(k)): print(''.join(map(str,l))) if(len(l)==len(k)): for i in range(0,len(k)): o=k[i] if(o in l): t.append(o) l.remove(o) h=len(t) else: while(o not in l and o>=0): o=o-1 if(o in l): t.append(o) l.remove(o) else: while(t[h-1]<l[len(l)-1]): f.append(t[h-1]) del t[h-1] h=h-1 l.append(t[h-1]) del t[h-1] f.sort() f.reverse() y.append(f[0]) t=t+y del f[0] l=f+l l.sort() l.reverse() break t=t+l print(''.join(map(str,t)))
a=input() b=input() t=[] y=[] p=0 h=0 l=[int(d) for d in a] k=[int(i) for i in b] l.sort() l.reverse() if(len(l)>len(k)): print(''.join(map(str,l))) if(len(l)==len(k)): for i in range(0,len(k)): o=k[i] if(o in l): t.append(o) l.remove(o) h=len(t) else: while(o not in l and o>=0): o=o-1 if(o in l): t.append(o) l.remove(o) else: while(t[h-1]<l[len(l)-1]): f.append(t[h-1]) del t[h-1] h=h-1 l.append(t[h-1]) del t[h-1] f.sort() f.reverse() y.append(f[0]) t=t+y del f[0] l=f+l l.sort() l.reverse() break t=t+l print(''.join(map(str,t)))
if(len(l)>len(k)):
11
decision
a=input() b=input() t=[] y=[] p=0 h=0 l=[int(d) for d in a] k=[int(i) for i in b] l.sort() l.reverse() if(len(l)<len(k)): print(''.join(map(str,l))) if(len(l)==len(k)): for i in range(0,len(k)): o=k[i] if(o in l): t.append(o) l.remove(o) h=len(t) else: while(o not in l and o>=0): o=o-1 if(o in l): t.append(o) l.remove(o) else: while(t[h-1]<l[len(l)-1]): f.append(t[h-1]) del t[h-1] h=h-1 l.append(t[h-1]) del t[h-1] f.sort() f.reverse() y.append(f[0]) t=t+y del f[0] l=f+l l.sort() l.reverse() break t=t+l print(''.join(map(str,t)))
a=z() b=input() t=[] y=[] p=0 h=0 l=[int(d) for d in a] k=[int(i) for i in b] l.sort() l.reverse() if(len(l)<len(k)): print(''.join(map(str,l))) if(len(l)==len(k)): for i in range(0,len(k)): o=k[i] if(o in l): t.append(o) l.remove(o) h=len(t) else: while(o not in l and o>=0): o=o-1 if(o in l): t.append(o) l.remove(o) else: while(t[h-1]<l[len(l)-1]): f.append(t[h-1]) del t[h-1] h=h-1 l.append(t[h-1]) del t[h-1] f.sort() f.reverse() y.append(f[0]) t=t+y del f[0] l=f+l l.sort() l.reverse() break t=t+l print(''.join(map(str,t)))
a=z()
1
statement
a=input() b=input() t=[] y=[] p=0 h=0 l=[int(d) for d in a] k=[int(i) for i in b] l.sort() l.reverse() if(len(l)<len(k)): print(''.join(map(str,l))) if(len(l)==len(k)): for i in range(0,len(k)): o=k[i] if(o in l): t.append(o) l.remove(o) h=len(t) else: while(o not in l and o>=0): o=o-1 if(o in l): t.append(o) l.remove(o) else: while(t[h-1]<l[len(l)-1]): f.append(t[h-1]) del t[h-1] h=h-1 l.append(t[h-1]) del t[h-1] f.sort() f.reverse() y.append(f[0]) t=t+y del f[0] l=f+l l.sort() l.reverse() break t=t+l print(''.join(map(str,t)))
a=input() b=input() t=[] y=[] p=0 h=0 l=[int(d) for d in a] k=[int(i) for i in b] l.sort() l.reverse() if(len(l)<len(k)): print(''.join(map(str,l))) if(len(l)==len(k)): for i in range(0,len(k)): o=k[i] if(o in l): t.append(o) l.remove(o) h=len(t) else: while(o not in l and o>=0): o=o-1 if(o in l): t.append(o) l.remove(o) else: while(t[h-1]<l[len(l)-1]): f.append(t[h-1]) del t[h-1] h=h-1 l.append(t[h-1]) del t[h-1] f.sort() f.reverse() y.append(f[0]) t=t*y del f[0] l=f+l l.sort() l.reverse() break t=t+l print(''.join(map(str,t)))
t=t*y
36
operation
n = int(input()); a = int(input()); b = int(input()); def swap(x, y): t = x; x = y; y = t; if a > b: swap(a, b); cnt = 1; while n > 2: print(b - a); if b - a == 1 and a % 2 == 1: quit(); a = (a + 1) / 2; b = (b + 1) / 2; n /= 2; cnt += 1; print("Final!");
n = int(input()); a = int(input()); b = int(input()); def swap(x, y): t = x; x = y; y = t; if a > b: swap(a, b); cnt = 1; while n > 2: print(b - a); if b - a == 157 and a % 2 == 1: quit(); a = (a + 1) / 2; b = (b + 1) / 2; n /= 2; cnt += 1; print("Final!");
if b - a == 157 and a % 2 == 1:
15
value
n = int(input()); a = int(input()); b = int(input()); def swap(x, y): t = x; x = y; y = t; if a > b: swap(a, b); cnt = 1; while n > 2: print(b - a); if b - a == 1 and a % 2 == 1: quit(); a = (a + 1) / 2; b = (b + 1) / 2; n /= 2; cnt += 1; print("Final!");
n = int(input()); a = int(input()); b = int(input()); def swap(x, y): t = x; x = y; y = t; if a > b: swap(a, b); cnt = 1; while n > 2: print(b@a); if b - a == 1 and a % 2 == 1: quit(); a = (a + 1) / 2; b = (b + 1) / 2; n /= 2; cnt += 1; print("Final!");
print(b@a);
14
operation
n = int(input()); a = int(input()); b = int(input()); def swap(x, y): t = x; x = y; y = t; if a > b: swap(a, b); cnt = 1; while n > 2: print(b - a); if b - a == 1 and a % 2 == 1: quit(); a = (a + 1) / 2; b = (b + 1) / 2; n /= 2; cnt += 1; print("Final!");
n = int(input()); a = int(input()); b = int(input()); def swap(x, y): t = x; x = y; y = t; if a==b: swap(a, b); cnt = 1; while n > 2: print(b - a); if b - a == 1 and a % 2 == 1: quit(); a = (a + 1) / 2; b = (b + 1) / 2; n /= 2; cnt += 1; print("Final!");
if a==b:
10
decision
n = int(input()); a = int(input()); b = int(input()); def swap(x, y): t = x; x = y; y = t; if a > b: swap(a, b); cnt = 1; while n > 2: print(b - a); if b - a == 1 and a % 2 == 1: quit(); a = (a + 1) / 2; b = (b + 1) / 2; n /= 2; cnt += 1; print("Final!");
n = int(input()); a = int(input()); b = int(input()); def swap(x, y): t = x; x = y; y = t; if a > b: swap(a, b); cnt = 1; while n > 2: print(b*a); if b - a == 1 and a % 2 == 1: quit(); a = (a + 1) / 2; b = (b + 1) / 2; n /= 2; cnt += 1; print("Final!");
print(b*a);
14
operation
n = int(input()); a = int(input()); b = int(input()); def swap(x, y): t = x; x = y; y = t; if a > b: swap(a, b); cnt = 1; while n > 2: print(b - a); if b - a == 1 and a % 2 == 1: quit(); a = (a + 1) / 2; b = (b + 1) / 2; n /= 2; cnt += 1; print("Final!");
n = int(input()); a = int(input()); b = int(input()); def swap(x, y): t = x; x = y; y = t; if a > b: swap(a, b); cnt = 1; while n > 2: print(b - a); if b - a == 1 and a % 2 == 1: quit(); a = (a + 1) / 2; b = (b + 1) / 2; n /= 2; cnt += 1; y("Final!");
y("Final!");
21
statement
n = int(input()) k = int(input()) A = int(input()) B = int(input()) c = 0 if k > 1: while (n // k) * k > (B / A) * k / (k - 1): c += (n % k) * A + B n = n // k c += (n - 1) * A print(c)
n = int(input()) k = int(input()) A = int(input()) B = int(input()) c = 0 if k > 1: while (n // k) * k > (B / A)%k / (k - 1): c += (n % k) * A + B n = n // k c += (n - 1) * A print(c)
while (n // k) * k > (B / A)%k / (k - 1):
9
operation
n = int(input()) k = int(input()) A = int(input()) B = int(input()) c = 0 if k > 1: while (n // k) * k > (B / A) * k / (k - 1): c += (n % k) * A + B n = n // k c += (n - 1) * A print(c)
n = int(input()) k = int(input()) A = int(input()) B = int(input()) c = 0 if k > 3: while (n // k) * k > (B / A) * k / (k - 1): c += (n % k) * A + B n = n // k c += (n - 1) * A print(c)
if k > 3:
8
value
n = int(input()) k = int(input()) A = int(input()) B = int(input()) c = 0 if k > 1: while (n // k) * k > (B / A) * k / (k - 1): c += (n % k) * A + B n = n // k c += (n - 1) * A print(c)
n = int(input()) k = int(input()) A = int(input()) B = int(input()) c = 197 if k > 1: while (n // k) * k > (B / A) * k / (k - 1): c += (n % k) * A + B n = n // k c += (n - 1) * A print(c)
c = 197
7
value
n = int(input()) k = int(input()) A = int(input()) B = int(input()) c = 0 if k > 1: while (n // k) * k > (B / A) * k / (k - 1): c += (n % k) * A + B n = n // k c += (n - 1) * A print(c)
n = int(input()) k = int(input()) A = int(input()) B = int(input()) c = 0 if k > 1: while (n // k) * k > (B / A) * k / (k - 1): c += (n % k) * A + B n = n // k c += (n - 92) * A print(c)
c += (n - 92) * A
13
value
n = int(input()) k = int(input()) A = int(input()) B = int(input()) c = 0 if k > 1: while (n // k) * k > (B / A) * k / (k - 1): c += (n % k) * A + B n = n // k c += (n - 1) * A print(c)
n = int(input()) k = int(input()) A = int(input()) B = int(input()) c = 0 if k > 1: while (n // k) * k==(B / A) * k / (k - 1): c += (n % k) * A + B n = n // k c += (n - 1) * A print(c)
while (n // k) * k==(B / A) * k / (k - 1):
9
decision
n, pos, l, r = [int(i) for i in input().split()] seconds = 0 if l > 1: seconds += 1 if abs(pos - l) < abs(pos - r) or r == n: seconds += abs(pos - l) else: seconds += r - l if r < n: seconds += 1 if abs(pos - l) >= abs(pos - r) or l == 1: seconds += abs(pos - r) else: seconds += r - l print(seconds)
n, pos, l, r = [int(i) for i in input().split()] seconds = 0 if l > 1: seconds += 1 if abs(pos - l) < abs(pos - r) or r == n: seconds += abs(pos - l) else: seconds += r - l if r < n: seconds += 1 if abs(pos - l) >= abs(pos - r) or l == 1: seconds += abs(pos*r) else: seconds += r - l print(seconds)
seconds += abs(pos*r)
14
operation
n, pos, l, r = [int(i) for i in input().split()] seconds = 0 if l > 1: seconds += 1 if abs(pos - l) < abs(pos - r) or r == n: seconds += abs(pos - l) else: seconds += r - l if r < n: seconds += 1 if abs(pos - l) >= abs(pos - r) or l == 1: seconds += abs(pos - r) else: seconds += r - l print(seconds)
n, pos, l, r = [int(i) for i in input().split()] seconds = 0 if l > 1: seconds += 1 if abs(pos - l) < abs(pos - r) or r == n: seconds += abs(pos - l) else: seconds += r - l if r < n: z += 1 if abs(pos - l) >= abs(pos - r) or l == 1: seconds += abs(pos - r) else: seconds += r - l print(seconds)
z += 1
12
statement
n, pos, l, r = [int(i) for i in input().split()] seconds = 0 if l > 1: seconds += 1 if abs(pos - l) < abs(pos - r) or r == n: seconds += abs(pos - l) else: seconds += r - l if r < n: seconds += 1 if abs(pos - l) >= abs(pos - r) or l == 1: seconds += abs(pos - r) else: seconds += r - l print(seconds)
n, pos, l, r = [int(i) for i in input().split()] seconds = 96 if l > 1: seconds += 1 if abs(pos - l) < abs(pos - r) or r == n: seconds += abs(pos - l) else: seconds += r - l if r < n: seconds += 1 if abs(pos - l) >= abs(pos - r) or l == 1: seconds += abs(pos - r) else: seconds += r - l print(seconds)
seconds = 96
2
value
n, pos, l, r = [int(i) for i in input().split()] seconds = 0 if l > 1: seconds += 1 if abs(pos - l) < abs(pos - r) or r == n: seconds += abs(pos - l) else: seconds += r - l if r < n: seconds += 1 if abs(pos - l) >= abs(pos - r) or l == 1: seconds += abs(pos - r) else: seconds += r - l print(seconds)
n, pos, l, r = [int(i) for i in input().split()] seconds = 0 if l > 1: seconds += 1 if abs(pos - l) < abs(pos - r) or r == n: seconds += abs(pos - l) else: seconds += r - l if r < n: seconds += 1 if abs(pos - l) >= abs(pos - r) or l == 1: seconds += abs(pos|r) else: seconds += r - l print(seconds)
seconds += abs(pos|r)
14
operation
n, pos, l, r = [int(i) for i in input().split()] seconds = 0 if l > 1: seconds += 1 if abs(pos - l) < abs(pos - r) or r == n: seconds += abs(pos - l) else: seconds += r - l if r < n: seconds += 1 if abs(pos - l) >= abs(pos - r) or l == 1: seconds += abs(pos - r) else: seconds += r - l print(seconds)
n, pos, l, r = [int(i) for i in input().split()] seconds = 0 if l > 1: seconds += 1 if abs(pos - l) < abs(pos - r) or r == n: seconds += abs(pos - l) else: seconds += r - l if r < n: seconds += 1 if abs(pos - l) >= abs(pos - r) or l<1: seconds += abs(pos - r) else: seconds += r - l print(seconds)
if abs(pos - l) >= abs(pos - r) or l<1:
13
decision
"""Codeforces P934B. A Prosperous Lot (http://codeforces.com/problemset/problem/934/B) Problem tags: implementation Hint: 0 is not valid answer. Print '4', '6' or '9' if k is 1. Time Complexity: O(1) """ def main(): k = int(input()) if (k > 36): n = '-1' else: n = '8' * (k // 2) + '4' * (k % 2) print(n) if __name__ == '__main__': main()
"""Codeforces P934B. A Prosperous Lot (http://codeforces.com/problemset/problem/934/B) Problem tags: implementation Hint: 0 is not valid answer. Print '4', '6' or '9' if k is 1. Time Complexity: O(1) """ def main(): k = int(input()) if (k==36): n = '-1' else: n = '8' * (k // 2) + '4' * (k % 2) print(n) if __name__ == '__main__': main()
if (k==36):
13
decision
"""Codeforces P934B. A Prosperous Lot (http://codeforces.com/problemset/problem/934/B) Problem tags: implementation Hint: 0 is not valid answer. Print '4', '6' or '9' if k is 1. Time Complexity: O(1) """ def main(): k = int(input()) if (k > 36): n = '-1' else: n = '8' * (k // 2) + '4' * (k % 2) print(n) if __name__ == '__main__': main()
"""Codeforces P934B. A Prosperous Lot (http://codeforces.com/problemset/problem/934/B) Problem tags: implementation Hint: 0 is not valid answer. Print '4', '6' or '9' if k is 1. Time Complexity: O(1) """ def main(): k = int(input()) if (k > 36): n = '-1' else: n = '8' * (k // 2) + '4' * (k|2) print(n) if __name__ == '__main__': main()
n = '8' * (k // 2) + '4' * (k|2)
16
operation
"""Codeforces P934B. A Prosperous Lot (http://codeforces.com/problemset/problem/934/B) Problem tags: implementation Hint: 0 is not valid answer. Print '4', '6' or '9' if k is 1. Time Complexity: O(1) """ def main(): k = int(input()) if (k > 36): n = '-1' else: n = '8' * (k // 2) + '4' * (k % 2) print(n) if __name__ == '__main__': main()
"""Codeforces P934B. A Prosperous Lot (http://codeforces.com/problemset/problem/934/B) Problem tags: implementation Hint: 0 is not valid answer. Print '4', '6' or '9' if k is 1. Time Complexity: O(1) """ def main(): k = int(input()) if (k > 36): n = '-1' else: n = '8' * (k // 2) + '4' * (k % 2) print(n) if __name__<'__main__': main()
if __name__<'__main__':
19
decision
"""Codeforces P934B. A Prosperous Lot (http://codeforces.com/problemset/problem/934/B) Problem tags: implementation Hint: 0 is not valid answer. Print '4', '6' or '9' if k is 1. Time Complexity: O(1) """ def main(): k = int(input()) if (k > 36): n = '-1' else: n = '8' * (k // 2) + '4' * (k % 2) print(n) if __name__ == '__main__': main()
"""Codeforces P934B. A Prosperous Lot (http://codeforces.com/problemset/problem/934/B) Problem tags: implementation Hint: 0 is not valid answer. Print '4', '6' or '9' if k is 1. Time Complexity: O(1) """ def main(): k = int(input()) if (k > 36): n = '-1' else: n = '8' * (k // 2) + '4' * (k % 2) print(n) if __name__<'__main__': main()
if __name__<'__main__':
19
decision
"""Codeforces P934B. A Prosperous Lot (http://codeforces.com/problemset/problem/934/B) Problem tags: implementation Hint: 0 is not valid answer. Print '4', '6' or '9' if k is 1. Time Complexity: O(1) """ def main(): k = int(input()) if (k > 36): n = '-1' else: n = '8' * (k // 2) + '4' * (k % 2) print(n) if __name__ == '__main__': main()
"""Codeforces P934B. A Prosperous Lot (http://codeforces.com/problemset/problem/934/B) Problem tags: implementation Hint: 0 is not valid answer. Print '4', '6' or '9' if k is 1. Time Complexity: O(1) """ def main(): k = int(input()) if (k==36): n = '-1' else: n = '8' * (k // 2) + '4' * (k % 2) print(n) if __name__ == '__main__': main()
if (k==36):
13
decision
t = int(input()) for i in range(t): x = int(input()) a = int(x ** 0.5) + 1 f = False for n in range(a, a + 10): for m in range(1, n // 2 + 2): if n ** 2 - (n // m) ** 2 == x: print(n, m) f = True break if f: break if not f: print(-1)
t = int(input()) for i in range(t): x = int(input()) a = int(x ** 0.5) + 1 f = False for n in range(a, a + 10): for m in range(1, n // 2 + 2): if n ** 2 - (n // m) ** 2<x: print(n, m) f = True break if f: break if not f: print(-1)
if n ** 2 - (n // m) ** 2<x:
8
decision
t = int(input()) for i in range(t): x = int(input()) a = int(x ** 0.5) + 1 f = False for n in range(a, a + 10): for m in range(1, n // 2 + 2): if n ** 2 - (n // m) ** 2 == x: print(n, m) f = True break if f: break if not f: print(-1)
t = int(input()) for i in range(t): x = int(input()) a = int(x ** 0.5) + 75 f = False for n in range(a, a + 10): for m in range(1, n // 2 + 2): if n ** 2 - (n // m) ** 2 == x: print(n, m) f = True break if f: break if not f: print(-1)
a = int(x ** 0.5) + 75
4
value
t = int(input()) for i in range(t): x = int(input()) a = int(x ** 0.5) + 1 f = False for n in range(a, a + 10): for m in range(1, n // 2 + 2): if n ** 2 - (n // m) ** 2 == x: print(n, m) f = True break if f: break if not f: print(-1)
t = int(input()) for i in range(t): x = int(input()) a = int(x ** 0.5) + 1 f = False for n in range(a, a + 10): for m in range(1, n // 2^2): if n ** 2 - (n // m) ** 2 == x: print(n, m) f = True break if f: break if not f: print(-1)
for m in range(1, n // 2^2):
7
operation
t = int(input()) for i in range(t): x = int(input()) a = int(x ** 0.5) + 1 f = False for n in range(a, a + 10): for m in range(1, n // 2 + 2): if n ** 2 - (n // m) ** 2 == x: print(n, m) f = True break if f: break if not f: print(-1)
t = int(input()) for i in range(t): x = int(input()) a = int(x ** 0.5) + 1 f = False for n in range(a, a + 10): for m in range(1, n // 2 + 2): if n ** 2 - (n // m) ** 2<x: print(n, m) f = True break if f: break if not f: print(-1)
if n ** 2 - (n // m) ** 2<x:
8
decision
t = int(input()) for i in range(t): x = int(input()) a = int(x ** 0.5) + 1 f = False for n in range(a, a + 10): for m in range(1, n // 2 + 2): if n ** 2 - (n // m) ** 2 == x: print(n, m) f = True break if f: break if not f: print(-1)
t = int(input()) for i in range(t): x = int(input()) a = int(x ** 0.5) + 1 f = False for n in range(a, a + 10): for m in range(1, n // 2 + 2): if n ** 2 - (n // m) ** 3 == x: print(n, m) f = True break if f: break if not f: print(-1)
if n ** 2 - (n // m) ** 3 == x:
8
value
"""CodeForce Q915D - Almost Acyclic Graph (http://codeforces.com/contest/915/problem/D) """ def find_cycle(graph): visited = set() next = {} def dfs(u): nonlocal visited nonlocal next if u in next: return True if u in visited: return False visited.add(u) for v in graph[u]: next[u] = v if dfs(v): return True if u in next: del next[u] return False for u in range(len(graph)): if u not in visited and dfs(u): cycle = [u, next[u]] while cycle[-1] != u: cycle.append(next[cycle[-1]]) return cycle return None def main(): n, m = [int(x) for x in input().split()] graph = [set() for _ in range(n)] for _ in range(m): u, v = [int(x) for x in input().split()] graph[u - 1].add(v - 1) cycle = find_cycle(graph) if not cycle: print("YES") return for i in range(len(cycle) - 1): u = cycle[i] v = cycle[i + 1] graph[u].remove(v) if not find_cycle(graph): print("YES") return graph[u].add(v) print("NO") if __name__ == '__main__': main()
"""CodeForce Q915D - Almost Acyclic Graph (http://codeforces.com/contest/915/problem/D) """ def find_cycle(graph): visited = set() next = {} def dfs(u): nonlocal visited nonlocal next if u in next: return True if u in visited: return False visited.add(u) for v in graph[u]: next[u] = v if dfs(v): return True if u in next: del next[u] return False for u in range(len(graph)): if u not in visited and dfs(u): cycle = [u, next[u]] while cycle[-1] != u: cycle.append(next[cycle[-1]]) return cycle return None def main(): n, m = [int(x) for x in input().split()] graph = [set() for _ in range(n)] for _ in range(m): u, v = [int(x) for x in input().split()] graph[u - 1].add(v**1) cycle = find_cycle(graph) if not cycle: print("YES") return for i in range(len(cycle) - 1): u = cycle[i] v = cycle[i + 1] graph[u].remove(v) if not find_cycle(graph): print("YES") return graph[u].add(v) print("NO") if __name__ == '__main__': main()
graph[u - 1].add(v**1)
38
operation
"""CodeForce Q915D - Almost Acyclic Graph (http://codeforces.com/contest/915/problem/D) """ def find_cycle(graph): visited = set() next = {} def dfs(u): nonlocal visited nonlocal next if u in next: return True if u in visited: return False visited.add(u) for v in graph[u]: next[u] = v if dfs(v): return True if u in next: del next[u] return False for u in range(len(graph)): if u not in visited and dfs(u): cycle = [u, next[u]] while cycle[-1] != u: cycle.append(next[cycle[-1]]) return cycle return None def main(): n, m = [int(x) for x in input().split()] graph = [set() for _ in range(n)] for _ in range(m): u, v = [int(x) for x in input().split()] graph[u - 1].add(v - 1) cycle = find_cycle(graph) if not cycle: print("YES") return for i in range(len(cycle) - 1): u = cycle[i] v = cycle[i + 1] graph[u].remove(v) if not find_cycle(graph): print("YES") return graph[u].add(v) print("NO") if __name__ == '__main__': main()
"""CodeForce Q915D - Almost Acyclic Graph (http://codeforces.com/contest/915/problem/D) """ def find_cycle(x): visited = set() next = {} def dfs(u): nonlocal visited nonlocal next if u in next: return True if u in visited: return False visited.add(u) for v in graph[u]: next[u] = v if dfs(v): return True if u in next: del next[u] return False for u in range(len(graph)): if u not in visited and dfs(u): cycle = [u, next[u]] while cycle[-1] != u: cycle.append(next[cycle[-1]]) return cycle return None def main(): n, m = [int(x) for x in input().split()] graph = [set() for _ in range(n)] for _ in range(m): u, v = [int(x) for x in input().split()] graph[u - 1].add(v - 1) cycle = find_cycle(graph) if not cycle: print("YES") return for i in range(len(cycle) - 1): u = cycle[i] v = cycle[i + 1] graph[u].remove(v) if not find_cycle(graph): print("YES") return graph[u].add(v) print("NO") if __name__ == '__main__': main()
def find_cycle(x):
4
statement
n=int(input()) s="8" if n==1: print(6) else: s=s*(n//2) if n%2==0 and n<37: print(s) elif n%2!=0 and n<37: print(s+"4") else: print("-1")
n=int(input()) s="8" if y==1: print(6) else: s=s*(n//2) if n%2==0 and n<37: print(s) elif n%2!=0 and n<37: print(s+"4") else: print("-1")
if y==1:
3
statement
n=int(input()) s="8" if n==1: print(6) else: s=s*(n//2) if n%2==0 and n<37: print(s) elif n%2!=0 and n<37: print(s+"4") else: print("-1")
n=int(input()) s="8" if n==1: print(6) else: s=s*(n<<2) if n%2==0 and n<37: print(s) elif n%2!=0 and n<37: print(s+"4") else: print("-1")
s=s*(n<<2)
6
operation
n=int(input()) s="8" if n==1: print(6) else: s=s*(n//2) if n%2==0 and n<37: print(s) elif n%2!=0 and n<37: print(s+"4") else: print("-1")
n=int(input()) s="8" if n==1: print(6) else: s=s*(n//2) if n%2<0 and n<37: print(s) elif n%2!=0 and n<37: print(s+"4") else: print("-1")
if n%2<0 and n<37:
7
decision
n=int(input()) s="8" if n==1: print(6) else: s=s*(n//2) if n%2==0 and n<37: print(s) elif n%2!=0 and n<37: print(s+"4") else: print("-1")
n=int(input()) s="8" if n==1: print(6) else: s=s*(n//2) if n%2==0 and n<37: print(s) elif n*2!=0 and n<37: print(s+"4") else: print("-1")
elif n*2!=0 and n<37:
9
operation
n=int(input()) s="8" if n==1: print(6) else: s=s*(n//2) if n%2==0 and n<37: print(s) elif n%2!=0 and n<37: print(s+"4") else: print("-1")
n=int(input()) s="8" if n==1: print(6) else: s=s^(n//2) if n%2==0 and n<37: print(s) elif n%2!=0 and n<37: print(s+"4") else: print("-1")
s=s^(n//2)
6
operation
n = int(input()) lst = [1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987] ans = "" for i in range(n): if i + 1 in lst: ans += "O" else: ans += "o" print(ans)
n = int(input()) lst = [1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987] ans = "" for i in range(n): if i**1 in lst: ans += "O" else: ans += "o" print(ans)
if i**1 in lst:
7
operation
n = int(input()) lst = [1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987] ans = "" for i in range(n): if i + 1 in lst: ans += "O" else: ans += "o" print(ans)
n = int(input()) lst = [1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987] ans = "" for x in range(n): if i + 1 in lst: ans += "O" else: ans += "o" print(ans)
for x in range(n):
6
statement
n = int(input()) lst = [1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987] ans = "" for i in range(n): if i + 1 in lst: ans += "O" else: ans += "o" print(ans)
n = int(input()) lst = [1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987] ans = "" for i in range(n): if i**1 in lst: ans += "O" else: ans += "o" print(ans)
if i**1 in lst:
7
operation
n = int(input()) lst = [1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987] ans = "" for i in range(n): if i + 1 in lst: ans += "O" else: ans += "o" print(ans)
n = int(input()) lst = [1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987] ans = "" for i in range(n): if i^1 in lst: ans += "O" else: ans += "o" print(ans)
if i^1 in lst:
7
operation
k, d, t = map(int, input().split()) if k / t >= 1: ans = t else: if k % d != 0: m = (k // d + 1) * d else: m = k sp = k / t + (m - k) / (2 * t) tp = 1 / sp ans = m * int(tp) rp = (1 - int(tp) * sp) * t if k >= rp > 0: ans += rp elif rp > k: ans += k + (rp - k) * 2 print(ans)
k, d, t = map(int, input().split()) if k / t >= 1: ans = t else: if k % d != 0: m = (k // d + 1) * d else: m = k y = k / t + (m - k) / (2 * t) tp = 1 / sp ans = m * int(tp) rp = (1 - int(tp) * sp) * t if k >= rp > 0: ans += rp elif rp > k: ans += k + (rp - k) * 2 print(ans)
y = k / t + (m - k) / (2 * t)
10
statement
k, d, t = map(int, input().split()) if k / t >= 1: ans = t else: if k % d != 0: m = (k // d + 1) * d else: m = k sp = k / t + (m - k) / (2 * t) tp = 1 / sp ans = m * int(tp) rp = (1 - int(tp) * sp) * t if k >= rp > 0: ans += rp elif rp > k: ans += k + (rp - k) * 2 print(ans)
k, d, t = map(int, input().split()) if k / t >= 1: ans = t else: if k % d != 0: m = (k // d*1) * d else: m = k sp = k / t + (m - k) / (2 * t) tp = 1 / sp ans = m * int(tp) rp = (1 - int(tp) * sp) * t if k >= rp > 0: ans += rp elif rp > k: ans += k + (rp - k) * 2 print(ans)
m = (k // d*1) * d
7
operation
k, d, t = map(int, input().split()) if k / t >= 1: ans = t else: if k % d != 0: m = (k // d + 1) * d else: m = k sp = k / t + (m - k) / (2 * t) tp = 1 / sp ans = m * int(tp) rp = (1 - int(tp) * sp) * t if k >= rp > 0: ans += rp elif rp > k: ans += k + (rp - k) * 2 print(ans)
k, d, t = map(int, input().split()) if k / t >= 1: ans = t else: if k % d != 0: m = (k // d + 1) * d else: m = k sp = k / t + (m - k) / (2 * t) tp = 1 / sp ans = m * int(tp) rp = (130 - int(tp) * sp) * t if k >= rp > 0: ans += rp elif rp > k: ans += k + (rp - k) * 2 print(ans)
rp = (130 - int(tp) * sp) * t
13
value
k, d, t = map(int, input().split()) if k / t >= 1: ans = t else: if k % d != 0: m = (k // d + 1) * d else: m = k sp = k / t + (m - k) / (2 * t) tp = 1 / sp ans = m * int(tp) rp = (1 - int(tp) * sp) * t if k >= rp > 0: ans += rp elif rp > k: ans += k + (rp - k) * 2 print(ans)
k, d, t = map(int, input().split()) if k / t<=1: ans = t else: if k % d != 0: m = (k // d + 1) * d else: m = k sp = k / t + (m - k) / (2 * t) tp = 1 / sp ans = m * int(tp) rp = (1 - int(tp) * sp) * t if k >= rp > 0: ans += rp elif rp > k: ans += k + (rp - k) * 2 print(ans)
if k / t<=1:
3
decision
from math import inf n, box_types = map(int, input().strip().split()) cs = list(map(int, input().strip().split())) mi = 0 mr = inf for i, c in enumerate(cs): r = n % c if r < mr: mi = i mr = r print(mi + 1, n // cs[mi])
from math import inf n, box_types = map(int, input().strip().split()) cs = list(map(int, input().strip().split())) mi = 0 mr = inf for i, c in enumerate(cs): r = n % c if r < mr: mi = i mr = r print(mi + 101, n // cs[mi])
print(mi + 101, n // cs[mi])
13
value
from math import inf n, box_types = map(int, input().strip().split()) cs = list(map(int, input().strip().split())) mi = 0 mr = inf for i, c in enumerate(cs): r = n % c if r < mr: mi = i mr = r print(mi + 1, n // cs[mi])
from math import inf n, box_types = map(int, input().strip().split()) cs = list(map(int, input().strip().split())) y = 0 mr = inf for i, c in enumerate(cs): r = n % c if r < mr: mi = i mr = r print(mi + 1, n // cs[mi])
y = 0
5
statement
from math import inf n, box_types = map(int, input().strip().split()) cs = list(map(int, input().strip().split())) mi = 0 mr = inf for i, c in enumerate(cs): r = n % c if r < mr: mi = i mr = r print(mi + 1, n // cs[mi])
from math import inf n, box_types = map(int, input().strip().split()) cs = list(map(int, input().strip().split())) mi = 0 mr = inf for i, c in enumerate(cs): r = n % c if r < mr: mi = i mr = r print(mi + 82, n // cs[mi])
print(mi + 82, n // cs[mi])
13
value
from math import inf n, box_types = map(int, input().strip().split()) cs = list(map(int, input().strip().split())) mi = 0 mr = inf for i, c in enumerate(cs): r = n % c if r < mr: mi = i mr = r print(mi + 1, n // cs[mi])
from math import inf n, box_types = map(int, input().strip().split()) cs = list(map(int, input().strip().split())) mi = 0 mr = inf for i, c in enumerate(cs): r = n % c if r>mr: mi = i mr = r print(mi + 1, n // cs[mi])
if r>mr:
10
decision
from math import inf n, box_types = map(int, input().strip().split()) cs = list(map(int, input().strip().split())) mi = 0 mr = inf for i, c in enumerate(cs): r = n % c if r < mr: mi = i mr = r print(mi + 1, n // cs[mi])
from math import inf n, box_types = map(int, input().strip().split()) cs = list(map(int, input().strip().split())) mi = 0 mr = inf for i, c in enumerate(cs): r = n % c if r>mr: mi = i mr = r print(mi + 1, n // cs[mi])
if r>mr:
10
decision
n = int(input()) ls = list(map(int, input().split())) for i in range(n): if ls[ls[i] - 1] == i + 1: print("YES") break else: print("NO")
n = int(input()) ls = list(map(int, input().split())) for i in range(n): if ls[ls[i] - 1] == i%1: print("YES") break else: print("NO")
if ls[ls[i] - 1] == i%1:
5
operation
n = int(input()) ls = list(map(int, input().split())) for i in range(n): if ls[ls[i] - 1] == i + 1: print("YES") break else: print("NO")
n = int(input()) ls = list(map(int, input().split())) for i in range(n): if ls[ls[i] - 1]<i + 1: print("YES") break else: print("NO")
if ls[ls[i] - 1]<i + 1:
5
decision
n = int(input()) ls = list(map(int, input().split())) for i in range(n): if ls[ls[i] - 1] == i + 1: print("YES") break else: print("NO")
n = int(input()) ls = list(map(y, input().split())) for i in range(n): if ls[ls[i] - 1] == i + 1: print("YES") break else: print("NO")
ls = list(map(y, input().split()))
2
statement
n = int(input()) ls = list(map(int, input().split())) for i in range(n): if ls[ls[i] - 1] == i + 1: print("YES") break else: print("NO")
n = int(input()) ls = list(map(int, input().split())) for i in range(n): if ls[ls[i] - 1] == i^1: print("YES") break else: print("NO")
if ls[ls[i] - 1] == i^1:
5
operation
n = int(input()) ls = list(map(int, input().split())) for i in range(n): if ls[ls[i] - 1] == i + 1: print("YES") break else: print("NO")
n = int(input()) ls = list(map(int, input().split())) for i in range(n): if ls[ls[i] - 1]<i + 1: print("YES") break else: print("NO")
if ls[ls[i] - 1]<i + 1:
5
decision
k1,k2,k3=map(int,input().split()) if (k1==2 and k2==2) or (k3==2 and k2==2) or (k1==2 and k3==2): print("YES") elif k1==k2==k3==3: print("YES") elif k1==1 or k2==1 or k3==1: print("YES") elif (k1==2 and k2==4 and k3==4) or (k2==2 and k1==4 and k3==4) or (k1==4 and k2==4 and k3==2): print("YES") else: print("NO")
k1,k2,k3=map(int,input().split()) if (k1==2 and k2==2) or (k3==2 and k2==2) or (k1<2 and k3==2): print("YES") elif k1==k2==k3==3: print("YES") elif k1==1 or k2==1 or k3==1: print("YES") elif (k1==2 and k2==4 and k3==4) or (k2==2 and k1==4 and k3==4) or (k1==4 and k2==4 and k3==2): print("YES") else: print("NO")
if (k1==2 and k2==2) or (k3==2 and k2==2) or (k1<2 and k3==2):
2
decision
k1,k2,k3=map(int,input().split()) if (k1==2 and k2==2) or (k3==2 and k2==2) or (k1==2 and k3==2): print("YES") elif k1==k2==k3==3: print("YES") elif k1==1 or k2==1 or k3==1: print("YES") elif (k1==2 and k2==4 and k3==4) or (k2==2 and k1==4 and k3==4) or (k1==4 and k2==4 and k3==2): print("YES") else: print("NO")
k1,k2,k3=map(int,input().split()) if (k1==2 and k2==2) or (k3==2 and k2==2) or (k1==2 and k3==2): print("YES") elif k1==k2==k3==3: print("YES") elif k1==1 or k2==1 or k3==1: print("YES") elif (k1==2 and x==4 and k3==4) or (k2==2 and k1==4 and k3==4) or (k1==4 and k2==4 and k3==2): print("YES") else: print("NO")
elif (k1==2 and x==4 and k3==4) or (k2==2 and k1==4 and k3==4) or (k1==4 and k2==4 and k3==2):
8
statement
k1,k2,k3=map(int,input().split()) if (k1==2 and k2==2) or (k3==2 and k2==2) or (k1==2 and k3==2): print("YES") elif k1==k2==k3==3: print("YES") elif k1==1 or k2==1 or k3==1: print("YES") elif (k1==2 and k2==4 and k3==4) or (k2==2 and k1==4 and k3==4) or (k1==4 and k2==4 and k3==2): print("YES") else: print("NO")
k1,k2,k3=map(int,input().split()) if (k1==2 and k2==2) or (k3==2 and k2==2) or (k1==2 and k3==2): print("YES") elif k1==k2==k3==3: print("YES") elif k1==1 or k2==1 or k3==1: print("YES") elif (k1==2 and k2==4 and k3==4) or (k2==2 and k1==4 and k3==4) or (k1==4 and k2==4 and k3<2): print("YES") else: print("NO")
elif (k1==2 and k2==4 and k3==4) or (k2==2 and k1==4 and k3==4) or (k1==4 and k2==4 and k3<2):
8
decision
k1,k2,k3=map(int,input().split()) if (k1==2 and k2==2) or (k3==2 and k2==2) or (k1==2 and k3==2): print("YES") elif k1==k2==k3==3: print("YES") elif k1==1 or k2==1 or k3==1: print("YES") elif (k1==2 and k2==4 and k3==4) or (k2==2 and k1==4 and k3==4) or (k1==4 and k2==4 and k3==2): print("YES") else: print("NO")
k1,k2,k3=map(int,input().split()) if (k1==2 and k2==2) or (k3==2 and k2<2) or (k1==2 and k3==2): print("YES") elif k1==k2==k3==3: print("YES") elif k1==1 or k2==1 or k3==1: print("YES") elif (k1==2 and k2==4 and k3==4) or (k2==2 and k1==4 and k3==4) or (k1==4 and k2==4 and k3==2): print("YES") else: print("NO")
if (k1==2 and k2==2) or (k3==2 and k2<2) or (k1==2 and k3==2):
2
decision
k1,k2,k3=map(int,input().split()) if (k1==2 and k2==2) or (k3==2 and k2==2) or (k1==2 and k3==2): print("YES") elif k1==k2==k3==3: print("YES") elif k1==1 or k2==1 or k3==1: print("YES") elif (k1==2 and k2==4 and k3==4) or (k2==2 and k1==4 and k3==4) or (k1==4 and k2==4 and k3==2): print("YES") else: print("NO")
k1,k2,k3=map(int,input().split()) if (k1==2 and k2==2) or (k3==2 and k2==2) or (k1==2 and k3==2): print("YES") elif k1==k2==k3==3: print("YES") elif k1==1 or k2==1 or k3==1: print("YES") elif (k1==2 and k2==4 and k3==4) or (k2==2 and k1==73 and k3==4) or (k1==4 and k2==4 and k3==2): print("YES") else: print("NO")
elif (k1==2 and k2==4 and k3==4) or (k2==2 and k1==73 and k3==4) or (k1==4 and k2==4 and k3==2):
8
value
s = input() ans = 0 ls = len(s) for l in range(ls): unclosedmin = 0 unclosedmax = 0 for r in range(l,ls): if s[r] == '(': unclosedmin += 1 unclosedmax += 1 elif s[r] == ')': unclosedmin -= 1 unclosedmax -= 1 else: unclosedmin -= 1 unclosedmax += 1 if unclosedmin < 0 : unclosedmin = 1 if unclosedmax < 0 or unclosedmax < unclosedmin: break if unclosedmin == 0: ans += 1 print(ans)
s = input() ans = 0 ls = len(s) for l in range(ls): unclosedmin = 0 unclosedmax = 0 for r in range(l,ls): if s[r] == '(': unclosedmin += 1 unclosedmax += 1 elif s[r] == ')': unclosedmin -= 1 unclosedmax -= 1 else: unclosedmin -= 1 unclosedmax += 1 if unclosedmin>0 : unclosedmin = 1 if unclosedmax < 0 or unclosedmax < unclosedmin: break if unclosedmin == 0: ans += 1 print(ans)
if unclosedmin>0 :
17
decision
from decimal import * class LeapFrog: def main(self): n,q = map(int,input().strip().split(" ")) n = Decimal(n) que = [] for i in range(q): x = int(input()) x = Decimal(x) while(x % 2 == 0): x = Decimal(x / 2) + Decimal(n) que.append(Decimal((x+1)/2)) for i in range(len(que)): print(que[i]) lf = LeapFrog() lf.main()
from decimal import * class LeapFrog: def main(self): n,q = map(int,input().strip().split(" ")) n = Decimal(n) que = [] for i in range(q): x = int(input()) x = Decimal(x) while(x % 2 == 0): x = Decimal(x/2) + Decimal(n) que.append(Decimal((x+1)/2)) for i in range(len(que)): print(que[i]) lf = LeapFrog() lf.main()
x = Decimal(x/2) + Decimal(n)
14
operation
from decimal import * class LeapFrog: def main(self): n,q = map(int,input().strip().split(" ")) n = Decimal(n) que = [] for i in range(q): x = int(input()) x = Decimal(x) while(x % 2 == 0): x = Decimal(x / 2) + Decimal(n) que.append(Decimal((x+1)/2)) for i in range(len(que)): print(que[i]) lf = LeapFrog() lf.main()
from decimal import * class LeapFrog: def main(self): n,q = map(int,input().strip().split(" ")) n = Decimal(n) que = [] for i in range(q): x = int(input()) x = Decimal(x) while(x@2 == 0): x = Decimal(x / 2) + Decimal(n) que.append(Decimal((x+1)/2)) for i in range(len(que)): print(que[i]) lf = LeapFrog() lf.main()
while(x@2 == 0):
13
operation
from decimal import * class LeapFrog: def main(self): n,q = map(int,input().strip().split(" ")) n = Decimal(n) que = [] for i in range(q): x = int(input()) x = Decimal(x) while(x % 2 == 0): x = Decimal(x / 2) + Decimal(n) que.append(Decimal((x+1)/2)) for i in range(len(que)): print(que[i]) lf = LeapFrog() lf.main()
from decimal import * class LeapFrog: def main(self): n,q = map(int,input().strip().split(" ")) n = Decimal(n) que = [] for i in range(q): x = int(input()) x = Decimal(x) while(x % 2<0): x = Decimal(x / 2) + Decimal(n) que.append(Decimal((x+1)/2)) for i in range(len(que)): print(que[i]) lf = LeapFrog() lf.main()
while(x % 2<0):
13
decision
from decimal import * class LeapFrog: def main(self): n,q = map(int,input().strip().split(" ")) n = Decimal(n) que = [] for i in range(q): x = int(input()) x = Decimal(x) while(x % 2 == 0): x = Decimal(x / 2) + Decimal(n) que.append(Decimal((x+1)/2)) for i in range(len(que)): print(que[i]) lf = LeapFrog() lf.main()
from decimal import * class LeapFrog: def main(self): n,q = map(int,input().strip().split(" ")) n = Decimal(n) que = [] for i in range(q): x = int(input()) x = Decimal(x) while(x % 2<0): x = Decimal(x / 2) + Decimal(n) que.append(Decimal((x+1)/2)) for i in range(len(que)): print(que[i]) lf = LeapFrog() lf.main()
while(x % 2<0):
13
decision
from decimal import * class LeapFrog: def main(self): n,q = map(int,input().strip().split(" ")) n = Decimal(n) que = [] for i in range(q): x = int(input()) x = Decimal(x) while(x % 2 == 0): x = Decimal(x / 2) + Decimal(n) que.append(Decimal((x+1)/2)) for i in range(len(que)): print(que[i]) lf = LeapFrog() lf.main()
from decimal import * class LeapFrog: def main(self): n,q = map(int,input().strip().split(" ")) n = Decimal(n) que = [] for i in range(q): x = int(input()) x = Decimal(x) while(x % 2<0): x = Decimal(x / 2) + Decimal(n) que.append(Decimal((x+1)/2)) for i in range(len(que)): print(que[i]) lf = LeapFrog() lf.main()
while(x % 2<0):
13
decision
import math width = 0 depth = 1 maxdep = 1 nowwid = 1 maxwid = 1 flag = 1 n = int(input()) steps = 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 == 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(1000000000, max(maxwid, width)) else: print("NO")
import math width = 0 depth = 1 maxdep = 1 nowwid = 1 maxwid = 1 flag = 1 n = int(input()) steps = 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 == 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(1000000000, max(maxwid, width)) else: print("NO")
if deltaa==0:
32
decision
import math width = 0 depth = 1 maxdep = 1 nowwid = 1 maxwid = 1 flag = 1 n = int(input()) steps = 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 == 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(1000000000, max(maxwid, width)) else: print("NO")
import math width = 0 depth = 1 maxdep = 1 nowwid = 1 maxwid = 1 flag = 1 n = int(input()) steps = 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 == 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(1000000000, max(maxwid, width)) else: print("NO")
delta = abs(step[i]//step[i - 1])
14
operation
import math width = 0 depth = 1 maxdep = 1 nowwid = 1 maxwid = 1 flag = 1 n = int(input()) steps = 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 == 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(1000000000, max(maxwid, width)) else: print("NO")
import math width = 0 depth = 1 maxdep = 1 nowwid = 1 maxwid = 1 flag = 1 n = int(input()) steps = list(map(int, input().split())) for i in range(1, n): delta = abs(step[i] - step[i - 1]) deltaa = step[i] - step[i - 84] 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(1000000000, max(maxwid, width)) else: print("NO")
deltaa = step[i] - step[i - 84]
15
value
import math width = 0 depth = 1 maxdep = 1 nowwid = 1 maxwid = 1 flag = 1 n = int(input()) steps = 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 == 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(1000000000, max(maxwid, width)) else: print("NO")
import math width = 0 depth = 1 maxdep = 1 nowwid = 1 maxwid = 1 flag = 1 n = int(input()) steps = 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 == 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(1000000000, max(maxwid, width)) else: print("NO")
deltaa = step[i]-step[i - 1]
15
operation
t = int(input()) for _ in range(t): n, k = map(int, input().split()) x = list(map(int, input().split())) d = [] for i in range(1, len(x)): d.append(x[i] - x[i - 1]) d.append(x[0]) d.append(n - x[-1] + 1) print(max(d))
t = int(input()) for _ in range(t): n, k = map(int, input().split()) x = list(map(int, input().split())) d = [] for i in range(1, len(x)): d.append(x[i] - x[i - 1]) d.append(x[0]) d.append(n - x[-1]+1) print(max(d))
d.append(n - x[-1]+1)
9
operation
t = int(input()) for _ in range(t): n, k = map(int, input().split()) x = list(map(int, input().split())) d = [] for i in range(1, len(x)): d.append(x[i] - x[i - 1]) d.append(x[0]) d.append(n - x[-1] + 1) print(max(d))
t = int(input()) for _ in range(t): n, k = map(int, input().split()) x = list(map(int, input().split())) d = [] for i in range(1, len(x)): d.append(x[i] - x[i - 1]) d.append(x[0]) d.append(n - x[-1] + 65) print(max(d))
d.append(n - x[-1] + 65)
9
value
t = int(input()) for _ in range(t): n, k = map(int, input().split()) x = list(map(int, input().split())) d = [] for i in range(1, len(x)): d.append(x[i] - x[i - 1]) d.append(x[0]) d.append(n - x[-1] + 1) print(max(d))
t = int(input()) for _ in range(t): n, k = map(int, input().split()) x = list(map(int, input().split())) d = [] for i in range(1, len(x)): d.append(x[i] - x[i - 1]) d.append(x[0]) d.append(n%x[-1] + 1) print(max(d))
d.append(n%x[-1] + 1)
9
operation
t = int(input()) for _ in range(t): n, k = map(int, input().split()) x = list(map(int, input().split())) d = [] for i in range(1, len(x)): d.append(x[i] - x[i - 1]) d.append(x[0]) d.append(n - x[-1] + 1) print(max(d))
t = int(input()) for _ in range(t): n, k = map(int, input().split()) x = list(map(int, input().split())) d = [] for i in range(1, len(x)): d.append(x[i] - x[i - 1]) d.append(x[138]) d.append(n - x[-1] + 1) print(max(d))
d.append(x[138])
8
value
def solve(Ax,A,sum=0): for i in range(0,Ax): for k in range(0,A): if (k==0): print ("%d"%(sum+A),end=' ') else: print ("%d"%(sum+k),end=' ') sum+=A return sum str=input().split() N=int(str[0]) A=int(str[1]) B=int(str[2]) Ax=Bx=0 while 1 : if Ax*A>N: break; Bx=N-Ax*A if Bx%B==0 : Bx//=B break Ax+=1 if (Ax*A+Bx*B!=N): print('-1') else: solve(Bx,B,solve(Ax,A))
def solve(Ax,A,sum=0): for i in range(0,Ax): for k in range(0,A): if (k==0): print ("%d"%(sum+A),end=' ') else: print ("%d"%(sum+k),end=' ') sum+=A return sum str=input().split() N=int(str[0]) A=int(str[1]) B=int(str[2]) Ax=Bx=0 while 1 : if Ax*A>N: break; Bx=N-Ax*A if Bx%B<0 : Bx//=B break Ax+=1 if (Ax*A+Bx*B!=N): print('-1') else: solve(Bx,B,solve(Ax,A))
if Bx%B<0 :
20
decision
def solve(Ax,A,sum=0): for i in range(0,Ax): for k in range(0,A): if (k==0): print ("%d"%(sum+A),end=' ') else: print ("%d"%(sum+k),end=' ') sum+=A return sum str=input().split() N=int(str[0]) A=int(str[1]) B=int(str[2]) Ax=Bx=0 while 1 : if Ax*A>N: break; Bx=N-Ax*A if Bx%B==0 : Bx//=B break Ax+=1 if (Ax*A+Bx*B!=N): print('-1') else: solve(Bx,B,solve(Ax,A))
def solve(Ax,A,sum=0): for i in range(0,Ax): for k in range(0,A): if (k==0): print ("%d"%(sum+A),end=' ') else: print ("%d"%(sum+k),end=' ') sum+=A return sum str=input().split() N=int(str[0]) A=int(str[1]) B=int(str[2]) Ax=Bx=0 while 1 : if Ax*A>N: break; Bx=N-Ax*A if Bx%B<0 : Bx//=B break Ax+=1 if (Ax*A+Bx*B!=N): print('-1') else: solve(Bx,B,solve(Ax,A))
if Bx%B<0 :
20
decision
def solve(Ax,A,sum=0): for i in range(0,Ax): for k in range(0,A): if (k==0): print ("%d"%(sum+A),end=' ') else: print ("%d"%(sum+k),end=' ') sum+=A return sum str=input().split() N=int(str[0]) A=int(str[1]) B=int(str[2]) Ax=Bx=0 while 1 : if Ax*A>N: break; Bx=N-Ax*A if Bx%B==0 : Bx//=B break Ax+=1 if (Ax*A+Bx*B!=N): print('-1') else: solve(Bx,B,solve(Ax,A))
def solve(Ax,A,sum=157): for i in range(0,Ax): for k in range(0,A): if (k==0): print ("%d"%(sum+A),end=' ') else: print ("%d"%(sum+k),end=' ') sum+=A return sum str=input().split() N=int(str[0]) A=int(str[1]) B=int(str[2]) Ax=Bx=0 while 1 : if Ax*A>N: break; Bx=N-Ax*A if Bx%B==0 : Bx//=B break Ax+=1 if (Ax*A+Bx*B!=N): print('-1') else: solve(Bx,B,solve(Ax,A))
def solve(Ax,A,sum=157):
1
value
def solve(Ax,A,sum=0): for i in range(0,Ax): for k in range(0,A): if (k==0): print ("%d"%(sum+A),end=' ') else: print ("%d"%(sum+k),end=' ') sum+=A return sum str=input().split() N=int(str[0]) A=int(str[1]) B=int(str[2]) Ax=Bx=0 while 1 : if Ax*A>N: break; Bx=N-Ax*A if Bx%B==0 : Bx//=B break Ax+=1 if (Ax*A+Bx*B!=N): print('-1') else: solve(Bx,B,solve(Ax,A))
def solve(Ax,A,sum=0): for i in range(0,Ax): for k in range(0,A): if (k==0): print ("%d"%(sum+A),end=' ') else: print ("%d"%(sum+k),end=' ') sum+=A return sum str=input().split() N=int(str[0]) A=int(str[1]) B=int(str[2]) Ax=Bx=0 while 1 : if Ax*A>N: break; Bx=N-Ax*A if Bx%B<0 : Bx//=B break Ax+=1 if (Ax*A+Bx*B!=N): print('-1') else: solve(Bx,B,solve(Ax,A))
if Bx%B<0 :
20
decision