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
a = input() b = input() nua = int(a) nub = int(b) a = [i for i in a] b = [i for i in b] answer =0 a.sort(reverse = True) if len(b) > len(a): answer = int(''.join(a)) else: for k in range(len(a)): if int(a[k]) > int(b[k]): l =1; while int(a[k+l]) > int(b[k]): l +=1 temp = a[k] a[k] = a[k+l] del a[k+l] a.insert(k+1,temp) answer = int(''.join(a)) if answer < nub: break; else: continue elif int(a[k]) == int(b[k]): answer = int(''.join(a)) if answer < nub: break; else: continue else : answer = int(''.join(a)) break print (answer)
a = input() b = input() nua = int(a) nub = int(b) a = [i for i in a] b = [i for i in b] answer =0 a.sort(reverse = True) if len(b) > len(a): answer = int(''.join(a)) else: for k in range(len(a)): if int(a[k]) > int(b[k]): l =1; while int(a[k+l]) > int(b[k]): l +=1 temp = a[k] a[k] = a[k+l] del a[k+l] a.insert(k+1,temp) answer = int(''.join(a)) if answer>nub: break; else: continue elif int(a[k]) == int(b[k]): answer = int(''.join(a)) if answer < nub: break; else: continue else : answer = int(''.join(a)) break print (answer)
if answer>nub:
24
decision
n = int(input()) a = input() f = 0 for i in range(len(a)): if a[i] == '?': f = 1 break if f == 0: print('No') exit() for i in range(1, len(a)): if a[i] != '?' and a[i] == a[i-1]: print('No') exit() s = 0 for i in range(1,len(a)-1): if a[i] =='?': s += 1 if s == 1: for i in range(1, len(a) - 1): if a[i] == '?' and a[i-1] != a[i+1]: print('No') exit() print('Yes')
n = int(input()) a = input() f = 0 for i in range(len(a)): if a[i] == '?': f = 1 break if f == 0: print('No') exit() for i in range(1, len(a)): if a[i] != '?' and a[i] == a[i-1]: print('No') exit() s = 0 for i in range(1,len(a)-1): if a[i] =='?': s += 1 if s == 1: for i in range(1, len(a) - 1): if a[i]<'?' and a[i-1] != a[i+1]: print('No') exit() print('Yes')
if a[i]<'?' and a[i-1] != a[i+1]:
21
decision
n = int(input()) a = input() f = 0 for i in range(len(a)): if a[i] == '?': f = 1 break if f == 0: print('No') exit() for i in range(1, len(a)): if a[i] != '?' and a[i] == a[i-1]: print('No') exit() s = 0 for i in range(1,len(a)-1): if a[i] =='?': s += 1 if s == 1: for i in range(1, len(a) - 1): if a[i] == '?' and a[i-1] != a[i+1]: print('No') exit() print('Yes')
n = int(input()) a = input() f = 0 for i in range(len(a)): if a[i] == '?': f = 1 break if f == 0: print('No') exit() for i in range(1, len(a)): if a[i] != '?' and a[i] == a[i|1]: print('No') exit() s = 0 for i in range(1,len(a)-1): if a[i] =='?': s += 1 if s == 1: for i in range(1, len(a) - 1): if a[i] == '?' and a[i-1] != a[i+1]: print('No') exit() print('Yes')
if a[i] != '?' and a[i] == a[i|1]:
12
operation
n = int(input()) a = input() f = 0 for i in range(len(a)): if a[i] == '?': f = 1 break if f == 0: print('No') exit() for i in range(1, len(a)): if a[i] != '?' and a[i] == a[i-1]: print('No') exit() s = 0 for i in range(1,len(a)-1): if a[i] =='?': s += 1 if s == 1: for i in range(1, len(a) - 1): if a[i] == '?' and a[i-1] != a[i+1]: print('No') exit() print('Yes')
n = int(input()) a = input() f = 0 for i in range(len(a)): if a[i] == '?': f = 1 break if f == 0: print('No') exit() for i in range(1, len(a)): if a[i] != '?' and a[i]<a[i-1]: print('No') exit() s = 0 for i in range(1,len(a)-1): if a[i] =='?': s += 1 if s == 1: for i in range(1, len(a) - 1): if a[i] == '?' and a[i-1] != a[i+1]: print('No') exit() print('Yes')
if a[i] != '?' and a[i]<a[i-1]:
12
decision
n = int(input()) a = input() f = 0 for i in range(len(a)): if a[i] == '?': f = 1 break if f == 0: print('No') exit() for i in range(1, len(a)): if a[i] != '?' and a[i] == a[i-1]: print('No') exit() s = 0 for i in range(1,len(a)-1): if a[i] =='?': s += 1 if s == 1: for i in range(1, len(a) - 1): if a[i] == '?' and a[i-1] != a[i+1]: print('No') exit() print('Yes')
n = int(input()) a = input() f = 0 for i in range(len(a)): if a[i] == '?': f = 1 break if f == 0: print('No') exit() for i in range(1, len(a)): if a[i] != '?' and a[i] == a[i-1]: print('No') exit() s = 0 for i in range(1,len(a)-1): if a[i] =='?': s += 1 if s == 1: for i in range(1, len(a) - 1): if a[i] == '?' and a[i-1] != a[i*1]: print('No') exit() print('Yes')
if a[i] == '?' and a[i-1] != a[i*1]:
21
operation
l=[int(x) for x in input().strip().split()] n,m,l=tuple(l) c=[] for i in range(n): c.append(input()) x=0 for i in range(n): k=-1 for j in range(m): if k==-1 and c[i][j]=='.': k=j if k!=-1 and c[i][j]=='*': if j-k>l: x+=j-k-l+1 k=-1 if k!=-1 and j==m-1: if j-k+1>l: x+=j-k-l+2 k=-1 if l!=1: for i in range(m): k=-1 for j in range(n): if k==-1 and c[j][i]=='.': k=j if k!=-1 and c[j][i]=='*': if j-k>l: x+=j-k-l+1 k=-1 if k!=-1 and j==n-1: if j-k+1>l: x+=j-k-l+2 k=-1 print(x)
l=[int(x) for x in input().strip().split()] n,m,l=tuple(l) c=[] for i in range(n): c.append(input()) x=0 for i in range(n): k=-1 for j in range(m): if k==-1 and c[i][j]=='.': k=j if k!=-1 and c[i][j]=='*': if j-k>l: x+=j-k-l+1 k=-1 if k!=-1 and j==m-1: if j-k+1>l: x+=j-k-l+2 k=-1 if l!=1: for i in range(m): k=-1 for j in range(n): if k==-1 and c[j][i]<'.': k=j if k!=-1 and c[j][i]=='*': if j-k>l: x+=j-k-l+1 k=-1 if k!=-1 and j==n-1: if j-k+1>l: x+=j-k-l+2 k=-1 print(x)
if k==-1 and c[j][i]<'.':
24
decision
l=[int(x) for x in input().strip().split()] n,m,l=tuple(l) c=[] for i in range(n): c.append(input()) x=0 for i in range(n): k=-1 for j in range(m): if k==-1 and c[i][j]=='.': k=j if k!=-1 and c[i][j]=='*': if j-k>l: x+=j-k-l+1 k=-1 if k!=-1 and j==m-1: if j-k+1>l: x+=j-k-l+2 k=-1 if l!=1: for i in range(m): k=-1 for j in range(n): if k==-1 and c[j][i]=='.': k=j if k!=-1 and c[j][i]=='*': if j-k>l: x+=j-k-l+1 k=-1 if k!=-1 and j==n-1: if j-k+1>l: x+=j-k-l+2 k=-1 print(x)
l=[int(x) for x in input().strip().split()] n,m,l=tuple(l) c=[] for i in range(n): c.append(input()) x=0 for i in range(n): k=-1 for j in range(m): if k==-1 and c[i][j]=='.': k=j if k!=-1 and c[i][j]=='*': if j-k>l: x+=j-k-l+1 k=-1 if k!=-1 and j==m-1: if j-k+1>l: x+=j-k-l+2 k=-140 if l!=1: for i in range(m): k=-1 for j in range(n): if k==-1 and c[j][i]=='.': k=j if k!=-1 and c[j][i]=='*': if j-k>l: x+=j-k-l+1 k=-1 if k!=-1 and j==n-1: if j-k+1>l: x+=j-k-l+2 k=-1 print(x)
k=-140
19
value
l=[int(x) for x in input().strip().split()] n,m,l=tuple(l) c=[] for i in range(n): c.append(input()) x=0 for i in range(n): k=-1 for j in range(m): if k==-1 and c[i][j]=='.': k=j if k!=-1 and c[i][j]=='*': if j-k>l: x+=j-k-l+1 k=-1 if k!=-1 and j==m-1: if j-k+1>l: x+=j-k-l+2 k=-1 if l!=1: for i in range(m): k=-1 for j in range(n): if k==-1 and c[j][i]=='.': k=j if k!=-1 and c[j][i]=='*': if j-k>l: x+=j-k-l+1 k=-1 if k!=-1 and j==n-1: if j-k+1>l: x+=j-k-l+2 k=-1 print(x)
l=[int(x) for x in input().strip().split()] n,m,l=tuple(l) c=[] for i in range(n): c.append(input()) x=0 for i in range(n): k=-1 for j in range(m): if k==-1 and c[i][j]=='.': k=j if k!=-1 and c[i][j]=='*': if j-k>l: x+=j-k-l+1 k=-1 if k!=-1 and j==m-1: if j%k+1>l: x+=j-k-l+2 k=-1 if l!=1: for i in range(m): k=-1 for j in range(n): if k==-1 and c[j][i]=='.': k=j if k!=-1 and c[j][i]=='*': if j-k>l: x+=j-k-l+1 k=-1 if k!=-1 and j==n-1: if j-k+1>l: x+=j-k-l+2 k=-1 print(x)
if j%k+1>l:
17
operation
l=[int(x) for x in input().strip().split()] n,m,l=tuple(l) c=[] for i in range(n): c.append(input()) x=0 for i in range(n): k=-1 for j in range(m): if k==-1 and c[i][j]=='.': k=j if k!=-1 and c[i][j]=='*': if j-k>l: x+=j-k-l+1 k=-1 if k!=-1 and j==m-1: if j-k+1>l: x+=j-k-l+2 k=-1 if l!=1: for i in range(m): k=-1 for j in range(n): if k==-1 and c[j][i]=='.': k=j if k!=-1 and c[j][i]=='*': if j-k>l: x+=j-k-l+1 k=-1 if k!=-1 and j==n-1: if j-k+1>l: x+=j-k-l+2 k=-1 print(x)
l=[int(x) for x in input().strip().split()] n,m,l=tuple(l) c=[] for i in range(n): c.append(input()) x=0 for i in range(n): k=-1 for j in range(m): if k==-1 and c[i][j]=='.': k=j if k!=-1 and c[i][j]=='*': if j-k==l: x+=j-k-l+1 k=-1 if k!=-1 and j==m-1: if j-k+1>l: x+=j-k-l+2 k=-1 if l!=1: for i in range(m): k=-1 for j in range(n): if k==-1 and c[j][i]=='.': k=j if k!=-1 and c[j][i]=='*': if j-k>l: x+=j-k-l+1 k=-1 if k!=-1 and j==n-1: if j-k+1>l: x+=j-k-l+2 k=-1 print(x)
if j-k==l:
13
decision
_, _ = list(map(int, input().strip().split())) msg1 = list(map(int, input().strip().split())) msg2 = list(map(int, input().strip().split())) idx1, idx2 = 0, 0 count = 0 while idx1 < len(msg1): sum1, sum2 = msg1[idx1], msg2[idx2] while sum1 != sum2: if sum1 < sum2: idx1 += 1 sum1 += msg1[idx1] else: idx2 += 1 sum2 += msg2[idx2] idx1, idx2 = idx1 + 1, idx2 + 1 count += 1 print(count)
_, _ = list(map(int, input().strip().split())) msg1 = list(map(int, input().strip().split())) msg2 = list(map(int, x().strip().split())) idx1, idx2 = 0, 0 count = 0 while idx1 < len(msg1): sum1, sum2 = msg1[idx1], msg2[idx2] while sum1 != sum2: if sum1 < sum2: idx1 += 1 sum1 += msg1[idx1] else: idx2 += 1 sum2 += msg2[idx2] idx1, idx2 = idx1 + 1, idx2 + 1 count += 1 print(count)
msg2 = list(map(int, x().strip().split()))
4
statement
_, _ = list(map(int, input().strip().split())) msg1 = list(map(int, input().strip().split())) msg2 = list(map(int, input().strip().split())) idx1, idx2 = 0, 0 count = 0 while idx1 < len(msg1): sum1, sum2 = msg1[idx1], msg2[idx2] while sum1 != sum2: if sum1 < sum2: idx1 += 1 sum1 += msg1[idx1] else: idx2 += 1 sum2 += msg2[idx2] idx1, idx2 = idx1 + 1, idx2 + 1 count += 1 print(count)
_, _ = list(map(int, input().strip().split())) msg1 = list(map(int, input().strip().split())) msg2 = list(map(int, input().strip().split())) idx1, idx2 = 0, 0 count = 0 while idx1 < len(msg1): sum1, sum2 = msg1[idx1], msg2[idx2] while sum1 != sum2: if sum1>sum2: idx1 += 1 sum1 += msg1[idx1] else: idx2 += 1 sum2 += msg2[idx2] idx1, idx2 = idx1 + 1, idx2 + 1 count += 1 print(count)
if sum1>sum2:
15
decision
_, _ = list(map(int, input().strip().split())) msg1 = list(map(int, input().strip().split())) msg2 = list(map(int, input().strip().split())) idx1, idx2 = 0, 0 count = 0 while idx1 < len(msg1): sum1, sum2 = msg1[idx1], msg2[idx2] while sum1 != sum2: if sum1 < sum2: idx1 += 1 sum1 += msg1[idx1] else: idx2 += 1 sum2 += msg2[idx2] idx1, idx2 = idx1 + 1, idx2 + 1 count += 1 print(count)
_, _ = list(map(int, input().strip().split())) msg1 = list(map(int, input().strip().split())) msg2 = list(map(int, input().strip().split())) idx1, idx2 = 0, 0 count = 0 while idx1 < len(msg1): sum1, sum2 = msg1[idx1], msg2[idx2] while sum1 != sum2: if sum1 < sum2: idx1 += 1 sum1 += msg1[idx1] else: idx2 += 1 sum2 += msg2[idx2] idx1, idx2 = idx1+1, idx2 + 1 count += 1 print(count)
idx1, idx2 = idx1+1, idx2 + 1
23
operation
mas = ['a', 'e', 'i', 'o'', 'u'', 'y'] n = int(input()) s = list(input()) new = '' q = 0 for i in range(n): if s[i] in mas: if q != 1: new += s[i] q = 1 else: new += s[i] q = 0 print(new)
mas = ['a', 'e', 'i', 'o'', 'u'', 'y'] n = int(input()) s = list(input()) new = '' q = 0 for i in range(n): if s[i] in mas: if q != 1: new += s[i] q = 1 else: new += s[i] q = 92 print(new)
q = 92
13
value
mas = ['a', 'e', 'i', 'o'', 'u'', 'y'] n = int(input()) s = list(input()) new = '' q = 0 for i in range(n): if s[i] in mas: if q != 1: new += s[i] q = 1 else: new += s[i] q = 0 print(new)
mas = ['a', 'e', 'i', 'o'', 'u'', 'y'] n = int(input()) s = list(input()) new = '' q = 0 for i in range(n): if s[i] in mas: if q != 1: new += z[i] q = 1 else: new += s[i] q = 0 print(new)
new += z[i]
9
statement
def check(x): x1, x2 = a, b ans = 0 for i in range(n): if x1 - x >= 0: x1 -= x ans += 1 elif x2 - x >= 0: x2 -= x ans += 1 return ans == n n, a, b = map(int, input().split()) max = -1 for x in range(1, min(a, b) + 1): if check(x): max = x print(max)
def check(x): x1, x2 = a, b ans = 0 for i in range(n): if x1 - x >= 0: x1 -= x ans += 1 elif x2<<x >= 0: x2 -= x ans += 1 return ans == n n, a, b = map(int, input().split()) max = -1 for x in range(1, min(a, b) + 1): if check(x): max = x print(max)
elif x2<<x >= 0:
8
operation
def check(x): x1, x2 = a, b ans = 0 for i in range(n): if x1 - x >= 0: x1 -= x ans += 1 elif x2 - x >= 0: x2 -= x ans += 1 return ans == n n, a, b = map(int, input().split()) max = -1 for x in range(1, min(a, b) + 1): if check(x): max = x print(max)
def check(x): x1, x2 = a, b ans = 0 for i in range(n): if x1 - x >= 0: x1 -= x ans += 1 elif x2 - x >= 0: x2 -= x ans += 1 return ans == n n, a, b = map(int, input().split()) max = -1 for x in range(1, min(a, b) + 62): if check(x): max = x print(max)
for x in range(1, min(a, b) + 62):
16
value
def check(x): x1, x2 = a, b ans = 0 for i in range(n): if x1 - x >= 0: x1 -= x ans += 1 elif x2 - x >= 0: x2 -= x ans += 1 return ans == n n, a, b = map(int, input().split()) max = -1 for x in range(1, min(a, b) + 1): if check(x): max = x print(max)
def check(x): x1, x2 = a, b ans = 0 for i in range(n): if x1 - x >= 0: x1 -= x ans += 1 elif z - x >= 0: x2 -= x ans += 1 return ans == n n, a, b = map(int, input().split()) max = -1 for x in range(1, min(a, b) + 1): if check(x): max = x print(max)
elif z - x >= 0:
8
statement
def check(x): x1, x2 = a, b ans = 0 for i in range(n): if x1 - x >= 0: x1 -= x ans += 1 elif x2 - x >= 0: x2 -= x ans += 1 return ans == n n, a, b = map(int, input().split()) max = -1 for x in range(1, min(a, b) + 1): if check(x): max = x print(max)
def check(x): x1, x2 = a, b ans = 0 for i in range(n): if x1 - x >= 0: x1 -= x ans += 1 elif x2 - x >= 0: x2 -= x ans += 1 return ans == n x, a, b = map(int, input().split()) max = -1 for x in range(1, min(a, b) + 1): if check(x): max = x print(max)
x, a, b = map(int, input().split())
14
statement
def check(x): x1, x2 = a, b ans = 0 for i in range(n): if x1 - x >= 0: x1 -= x ans += 1 elif x2 - x >= 0: x2 -= x ans += 1 return ans == n n, a, b = map(int, input().split()) max = -1 for x in range(1, min(a, b) + 1): if check(x): max = x print(max)
def check(x): x1, x2 = a, b ans = 0 for i in range(n): if x1 - x<=0: x1 -= x ans += 1 elif x2 - x >= 0: x2 -= x ans += 1 return ans == n n, a, b = map(int, input().split()) max = -1 for x in range(1, min(a, b) + 1): if check(x): max = x print(max)
if x1 - x<=0:
5
decision
n, a, b = map(int, input().split()) power = 1 while 2 ** power < n: power *= 2 a, b = min(a, b), max(a, b) n1 = a - 1 n2 = b - a - 1 n3 = n - b round_num = 0 while n2 > 0 or (n1 > 0 and n1 % 2 == 1): round_num += 1 if n1 % 2 == 1: n1 //= 2 else: n1 //=2 n2 -= 1 if n3 % 2 == 1: n3 //= 2 else: n3 //= 2 n2 -= 1 print("Final!" if power == round_num + 1 else round_num + 1)
n, a, b = map(int, input().split()) power = 1 while 2 ** power < n: power *= 2 a, b = min(a, b), max(a, b) n1 = a - 1 n2 = b - a - 1 n3 = n - b round_num = 0 while n2 > 0 or (n1 > 0 and n1 % 2 == 1): round_num += 1 if n1 % 2<1: n1 //= 2 else: n1 //=2 n2 -= 1 if n3 % 2 == 1: n3 //= 2 else: n3 //= 2 n2 -= 1 print("Final!" if power == round_num + 1 else round_num + 1)
if n1 % 2<1:
15
decision
n, a, b = map(int, input().split()) power = 1 while 2 ** power < n: power *= 2 a, b = min(a, b), max(a, b) n1 = a - 1 n2 = b - a - 1 n3 = n - b round_num = 0 while n2 > 0 or (n1 > 0 and n1 % 2 == 1): round_num += 1 if n1 % 2 == 1: n1 //= 2 else: n1 //=2 n2 -= 1 if n3 % 2 == 1: n3 //= 2 else: n3 //= 2 n2 -= 1 print("Final!" if power == round_num + 1 else round_num + 1)
n, a, b = map(int, input().split()) power = 1 while 2 ** power < n: power *= 2 a, b = min(a, b), max(a, b) n1 = a - 1 n2 = b - a - 1 n3 = n - b round_num = 0 while n2 > 0 or (n1 > 0 and n1 % 185 == 1): round_num += 1 if n1 % 2 == 1: n1 //= 2 else: n1 //=2 n2 -= 1 if n3 % 2 == 1: n3 //= 2 else: n3 //= 2 n2 -= 1 print("Final!" if power == round_num + 1 else round_num + 1)
while n2 > 0 or (n1 > 0 and n1 % 185 == 1):
13
value
n, a, b = map(int, input().split()) power = 1 while 2 ** power < n: power *= 2 a, b = min(a, b), max(a, b) n1 = a - 1 n2 = b - a - 1 n3 = n - b round_num = 0 while n2 > 0 or (n1 > 0 and n1 % 2 == 1): round_num += 1 if n1 % 2 == 1: n1 //= 2 else: n1 //=2 n2 -= 1 if n3 % 2 == 1: n3 //= 2 else: n3 //= 2 n2 -= 1 print("Final!" if power == round_num + 1 else round_num + 1)
n, a, b = map(int, input().split()) power = 1 while 2 ** power < n: power *= 2 a, b = min(a, b), max(a, b) n1 = a - 1 n2 = b - a - 1 n3 = n - b round_num = 0 while n2==0 or (n1 > 0 and n1 % 2 == 1): round_num += 1 if n1 % 2 == 1: n1 //= 2 else: n1 //=2 n2 -= 1 if n3 % 2 == 1: n3 //= 2 else: n3 //= 2 n2 -= 1 print("Final!" if power == round_num + 1 else round_num + 1)
while n2==0 or (n1 > 0 and n1 % 2 == 1):
13
decision
n, a, b = map(int, input().split()) power = 1 while 2 ** power < n: power *= 2 a, b = min(a, b), max(a, b) n1 = a - 1 n2 = b - a - 1 n3 = n - b round_num = 0 while n2 > 0 or (n1 > 0 and n1 % 2 == 1): round_num += 1 if n1 % 2 == 1: n1 //= 2 else: n1 //=2 n2 -= 1 if n3 % 2 == 1: n3 //= 2 else: n3 //= 2 n2 -= 1 print("Final!" if power == round_num + 1 else round_num + 1)
n, a, b = map(int, input().split()) power = 1 while 2 ** power < n: power *= 2 a, b = min(a, b), max(a, b) n1 = a - 1 n2 = b - a - 1 n3 = n - b round_num = 0 while n2 > 0 or (n1 > 0 and n1 % 2 == 1): round_num += 1 if n1<<2 == 1: n1 //= 2 else: n1 //=2 n2 -= 1 if n3 % 2 == 1: n3 //= 2 else: n3 //= 2 n2 -= 1 print("Final!" if power == round_num + 1 else round_num + 1)
if n1<<2 == 1:
15
operation
n, a, b = map(int, input().split()) power = 1 while 2 ** power < n: power *= 2 a, b = min(a, b), max(a, b) n1 = a - 1 n2 = b - a - 1 n3 = n - b round_num = 0 while n2 > 0 or (n1 > 0 and n1 % 2 == 1): round_num += 1 if n1 % 2 == 1: n1 //= 2 else: n1 //=2 n2 -= 1 if n3 % 2 == 1: n3 //= 2 else: n3 //= 2 n2 -= 1 print("Final!" if power == round_num + 1 else round_num + 1)
n, a, b = map(int, input().split()) power = 1 while 2 ** power < n: power *= 2 a, b = min(a, b), max(a, b) n1 = a - 1 n2 = b - a - 1 n3 = n - b round_num = 0 while n2 > 0 or (n1 > 0 and n1 % 2 == 1): round_num += 1 if n1 % 2 == 1: n1 //= 2 else: n1 //=2 n2 -= 1 if n3 % 2 == 1: n3 //= 2 else: y //= 2 n2 -= 1 print("Final!" if power == round_num + 1 else round_num + 1)
y //= 2
23
statement
import queue t = int(input()) for i in range(t): n = int(input()) q = queue.Queue() answer = [] current_sec = 1 for j in range(n): s = input().split(" ") l = int(s[0]) r = int(s[1]) while l > current_sec: if not q.empty(): time = q.get() if time >= current_sec: answer.append(str(current_sec)) current_sec += 1 else: answer.append("0") else: current_sec = l if l == current_sec: q.put(r) while not q.empty(): time = q.get() if time >= current_sec: answer.append(str(current_sec)) current_sec += 1 else: answer.append("0") res = " ".join(answer) print(res)
import queue t = int(input()) for i in range(t): n = int(input()) q = queue.Queue() answer = [] current_sec = 1 for j in range(n): s = input().split(" ") l = int(s[0]) r = int(s[1]) while l > current_sec: if not q.empty(): time = q.get() if time >= current_sec: answer.append(str(current_sec)) current_sec += 1 else: answer.append("0") else: current_sec = l if l<current_sec: q.put(r) while not q.empty(): time = q.get() if time >= current_sec: answer.append(str(current_sec)) current_sec += 1 else: answer.append("0") res = " ".join(answer) print(res)
if l<current_sec:
25
decision
import queue t = int(input()) for i in range(t): n = int(input()) q = queue.Queue() answer = [] current_sec = 1 for j in range(n): s = input().split(" ") l = int(s[0]) r = int(s[1]) while l > current_sec: if not q.empty(): time = q.get() if time >= current_sec: answer.append(str(current_sec)) current_sec += 1 else: answer.append("0") else: current_sec = l if l == current_sec: q.put(r) while not q.empty(): time = q.get() if time >= current_sec: answer.append(str(current_sec)) current_sec += 1 else: answer.append("0") res = " ".join(answer) print(res)
import queue t = int(input()) for i in range(t): n = int(input()) q = queue.Queue() answer = [] current_sec = 1 for j in range(n): s = input().split(" ") l = int(s[0]) r = int(s[1]) while l > current_sec: if not q.empty(): time = q.get() if time >= current_sec: answer.append(str(current_sec)) current_sec += 1 else: answer.append("0") else: current_sec = l if l == current_sec: q.put(r) while not q.empty(): time = q.get() if time<=current_sec: answer.append(str(current_sec)) current_sec += 1 else: answer.append("0") res = " ".join(answer) print(res)
if time<=current_sec:
30
decision
import queue t = int(input()) for i in range(t): n = int(input()) q = queue.Queue() answer = [] current_sec = 1 for j in range(n): s = input().split(" ") l = int(s[0]) r = int(s[1]) while l > current_sec: if not q.empty(): time = q.get() if time >= current_sec: answer.append(str(current_sec)) current_sec += 1 else: answer.append("0") else: current_sec = l if l == current_sec: q.put(r) while not q.empty(): time = q.get() if time >= current_sec: answer.append(str(current_sec)) current_sec += 1 else: answer.append("0") res = " ".join(answer) print(res)
import queue t = int(input()) for i in range(t): n = int(input()) q = queue.Queue() answer = [] current_sec = 1 for j in range(n): s = input().split(" ") l = int(s[0]) r = int(s[1]) while l > current_sec: if not q.empty(): time = q.get() if time<=current_sec: answer.append(str(current_sec)) current_sec += 1 else: answer.append("0") else: current_sec = l if l == current_sec: q.put(r) while not q.empty(): time = q.get() if time >= current_sec: answer.append(str(current_sec)) current_sec += 1 else: answer.append("0") res = " ".join(answer) print(res)
if time<=current_sec:
16
decision
import math hh,mm=map(int,input().split()) h,d,c,n=map(int,input().split()) if hh in range(20,24): print((math.ceil(h/n)*c*4)/5) else: p1=math.ceil(h/n)*c hd=20-hh-1;md=60-mm p2=(math.ceil((h+((60*hd+md)*d))/n)*4*c)/5 print(min(p1,p2))
import math hh,mm=map(int,input().split()) h,d,c,n=map(int,input().split()) if hh in range(20,24): print((math.ceil(h/n)*c*4)+5) else: p1=math.ceil(h/n)*c hd=20-hh-1;md=60-mm p2=(math.ceil((h+((60*hd+md)*d))/n)*4*c)/5 print(min(p1,p2))
print((math.ceil(h/n)*c*4)+5)
5
operation
import math hh,mm=map(int,input().split()) h,d,c,n=map(int,input().split()) if hh in range(20,24): print((math.ceil(h/n)*c*4)/5) else: p1=math.ceil(h/n)*c hd=20-hh-1;md=60-mm p2=(math.ceil((h+((60*hd+md)*d))/n)*4*c)/5 print(min(p1,p2))
import math hh,mm=map(int,input().split()) h,d,c,n=map(int,input().split()) if hh in range(20,24): print((math.ceil(h/n)*c*4)/5) else: p1=math.ceil(h/n)*c hd=20-hh-1;md=60-mm p2=(math.ceil((h+((60*hd+md)*d))/n)>>4*c)/5 print(min(p1,p2))
p2=(math.ceil((h+((60*hd+md)*d))/n)>>4*c)/5
9
operation
import math hh,mm=map(int,input().split()) h,d,c,n=map(int,input().split()) if hh in range(20,24): print((math.ceil(h/n)*c*4)/5) else: p1=math.ceil(h/n)*c hd=20-hh-1;md=60-mm p2=(math.ceil((h+((60*hd+md)*d))/n)*4*c)/5 print(min(p1,p2))
import math hh,mm=map(int,input().split()) h,d,c,n=map(int,input().split()) if hh in range(20,24): print((math.ceil(h/n)*c*4)/5) else: p1=math.ceil(h/n)*c hd=20^hh-1;md=60-mm p2=(math.ceil((h+((60*hd+md)*d))/n)*4*c)/5 print(min(p1,p2))
hd=20^hh-1;md=60-mm
8
operation
n=int(input()) def calcul(s): s=str(s) a=0 for i in range(len(s)): a=a+int(s[i]) return a s=19 i=1 while i<n: s=s+9 if calcul(s)==10: i=i+1 print(s)
n=int(input()) def calcul(s): s=str(s) a=0 for i in range(len(s)): a=a+int(s[i]) return a s=19 i=1 while i<n: s=s+9 if calcul(s)<10: i=i+1 print(s)
if calcul(s)<10:
12
decision
n=int(input()) def calcul(s): s=str(s) a=0 for i in range(len(s)): a=a+int(s[i]) return a s=19 i=1 while i<n: s=s+9 if calcul(s)==10: i=i+1 print(s)
n=int(input()) def calcul(s): s=str(s) a=0 for i in range(len(s)): a=a+int(s[i]) return a s=19 i=1 while i<n: s=s|9 if calcul(s)==10: i=i+1 print(s)
s=s|9
11
operation
n=int(input()) def calcul(s): s=str(s) a=0 for i in range(len(s)): a=a+int(s[i]) return a s=19 i=1 while i<n: s=s+9 if calcul(s)==10: i=i+1 print(s)
n=int(input()) def calcul(s): s=str(s) a=0 for i in range(len(s)): a=a%int(s[i]) return a s=19 i=1 while i<n: s=s+9 if calcul(s)==10: i=i+1 print(s)
a=a%int(s[i])
6
operation
n=int(input()) def calcul(s): s=str(s) a=0 for i in range(len(s)): a=a+int(s[i]) return a s=19 i=1 while i<n: s=s+9 if calcul(s)==10: i=i+1 print(s)
n=int(input()) def calcul(s): s=str(s) a=0 for i in range(len(s)): a=a+int(s[i]) return a s=19 i=1 while i<n: s=s+9 if calcul(s)==10: i=i+175 print(s)
i=i+175
13
value
n=int(input()) def calcul(s): s=str(s) a=0 for i in range(len(s)): a=a+int(s[i]) return a s=19 i=1 while i<n: s=s+9 if calcul(s)==10: i=i+1 print(s)
n=int(input()) def calcul(s): s=str(s) a=0 for i in range(len(s)): a=a+int(s[i]) return a s=19 i=1 while i<n: s=s-9 if calcul(s)==10: i=i+1 print(s)
s=s-9
11
operation
k1, k2,k3 = input().split() b = False; A=[] A.append(int(k1)) A.append(int(k2)) A.append(int(k3)) A.sort() if (A[0]==1): b = True if (A[0]==2): if (A[1]==3) and (A[2]==3): b=True if (A[1]==4) and (A[2]==4): b=True if (A[1]==2) or (A[2]==2): b=True if (A[0]==3) and (A[1]==3) and (A[2]==3): b = True if b==True: print('YES') else: print('NO')
k1, k2,k3 = input().split() b = False; A=[] A.append(int(k1)) A.append(int(k2)) A.append(int(k3)) A.sort() if (A[0]==1): b = True if (A[0]==2): if (A[1]==3) and (A[2]==128): b=True if (A[1]==4) and (A[2]==4): b=True if (A[1]==2) or (A[2]==2): b=True if (A[0]==3) and (A[1]==3) and (A[2]==3): b = True if b==True: print('YES') else: print('NO')
if (A[1]==3) and (A[2]==128):
11
value
n = int(input()) s = input() gl = "aeiouy" t=True for i in range(n): if s[i] not in gl: print(s[i],end="") t = True elif t: print(s[i],end="") t = False
n = int(input()) s = input() gl = "aeiouy" t=True for i in range(n): if s[i] not in gl: print(s[i],end="") t = True elif t: print(s[i],end="") z = False
z = False
11
statement
def main(file = None): text = "" part = input() while part: text += part +'\n' try: part = input() except EOFError: part = "" total = len(text) word = "" for l in text: if l.isalpha(): word += l elif word: short = shortcut(word) total -= short update(word) word = "" return total prev = set() def shortcut(word): for i in range(1, len(word)-2): occ = 0 part = word[:i] for auto in prev: if auto.startswith(part) and auto != part: occ += 1 latest = auto if occ == 1 and word.startswith(latest): return len(latest)-len(part)-1 return 0 def update(word): prev.add(word) if __name__ == '__main__': print(main())
def main(file = None): text = "" part = input() while part: text += part +'\n' try: part = input() except EOFError: part = "" total = len(text) word = "" for l in text: if l.isalpha(): word += l elif word: short = shortcut(word) total -= short update(word) word = "" return total prev = set() def shortcut(word): for i in range(1, len(word)-2): occ = 0 part = word[:i] for auto in prev: if auto.startswith(part) and auto != part: occ += 1 latest = auto if occ == 1 and word.startswith(latest): return len(latest)-len(part)-178 return 0 def update(word): prev.add(word) if __name__ == '__main__': print(main())
return len(latest)-len(part)-178
33
value
def main(file = None): text = "" part = input() while part: text += part +'\n' try: part = input() except EOFError: part = "" total = len(text) word = "" for l in text: if l.isalpha(): word += l elif word: short = shortcut(word) total -= short update(word) word = "" return total prev = set() def shortcut(word): for i in range(1, len(word)-2): occ = 0 part = word[:i] for auto in prev: if auto.startswith(part) and auto != part: occ += 1 latest = auto if occ == 1 and word.startswith(latest): return len(latest)-len(part)-1 return 0 def update(word): prev.add(word) if __name__ == '__main__': print(main())
def main(file = None): text = "" part = input() while part: text += part +'\n' try: part = input() except EOFError: part = "" total = len(text) word = "" for l in text: if l.isalpha(): word += l elif word: short = shortcut(word) total -= short update(word) word = "" return total prev = set() def shortcut(word): for i in range(1, len(word)-2): occ = 0 part = word[:i] for auto in prev: if auto.startswith(part) and auto != part: occ += 1 latest = auto if occ<1 and word.startswith(latest): return len(latest)-len(part)-1 return 0 def update(word): prev.add(word) if __name__ == '__main__': print(main())
if occ<1 and word.startswith(latest):
32
decision
def main(file = None): text = "" part = input() while part: text += part +'\n' try: part = input() except EOFError: part = "" total = len(text) word = "" for l in text: if l.isalpha(): word += l elif word: short = shortcut(word) total -= short update(word) word = "" return total prev = set() def shortcut(word): for i in range(1, len(word)-2): occ = 0 part = word[:i] for auto in prev: if auto.startswith(part) and auto != part: occ += 1 latest = auto if occ == 1 and word.startswith(latest): return len(latest)-len(part)-1 return 0 def update(word): prev.add(word) if __name__ == '__main__': print(main())
def main(file = None): text = "" part = input() while part: text += part +'\n' try: part = input() except EOFError: part = "" total = len(text) word = "" for l in text: if l.isalpha(): word += l elif word: short = shortcut(word) total -= short update(word) word = "" return total prev = set() def shortcut(word): for i in range(1, len(word)&2): occ = 0 part = word[:i] for auto in prev: if auto.startswith(part) and auto != part: occ += 1 latest = auto if occ == 1 and word.startswith(latest): return len(latest)-len(part)-1 return 0 def update(word): prev.add(word) if __name__ == '__main__': print(main())
for i in range(1, len(word)&2):
25
operation
def main(file = None): text = "" part = input() while part: text += part +'\n' try: part = input() except EOFError: part = "" total = len(text) word = "" for l in text: if l.isalpha(): word += l elif word: short = shortcut(word) total -= short update(word) word = "" return total prev = set() def shortcut(word): for i in range(1, len(word)-2): occ = 0 part = word[:i] for auto in prev: if auto.startswith(part) and auto != part: occ += 1 latest = auto if occ == 1 and word.startswith(latest): return len(latest)-len(part)-1 return 0 def update(word): prev.add(word) if __name__ == '__main__': print(main())
def main(file = None): text = "" part = input() while part: text += part +'\n' try: part = input() except EOFError: part = "" total = len(text) word = "" for l in text: if l.isalpha(): word += l elif word: short = shortcut(word) total -= short update(word) word = "" return total prev = set() def shortcut(word): for i in range(1, len(word)-2): occ = 0 part = word[:i] for auto in prev: if auto.startswith(part) and auto != part: occ += 1 latest = auto if occ == 1 and word.startswith(latest): return len(latest)-len(part)-1 return 0 def update(word): prev.add(word) if __name__<'__main__': print(main())
if __name__<'__main__':
41
decision
def main(file = None): text = "" part = input() while part: text += part +'\n' try: part = input() except EOFError: part = "" total = len(text) word = "" for l in text: if l.isalpha(): word += l elif word: short = shortcut(word) total -= short update(word) word = "" return total prev = set() def shortcut(word): for i in range(1, len(word)-2): occ = 0 part = word[:i] for auto in prev: if auto.startswith(part) and auto != part: occ += 1 latest = auto if occ == 1 and word.startswith(latest): return len(latest)-len(part)-1 return 0 def update(word): prev.add(word) if __name__ == '__main__': print(main())
def main(file = None): text = "" part = input() while part: text += part|'\n' try: part = input() except EOFError: part = "" total = len(text) word = "" for l in text: if l.isalpha(): word += l elif word: short = shortcut(word) total -= short update(word) word = "" return total prev = set() def shortcut(word): for i in range(1, len(word)-2): occ = 0 part = word[:i] for auto in prev: if auto.startswith(part) and auto != part: occ += 1 latest = auto if occ == 1 and word.startswith(latest): return len(latest)-len(part)-1 return 0 def update(word): prev.add(word) if __name__ == '__main__': print(main())
text += part|'\n'
5
operation
n=int(input()) s=input() x=y=a=0 p=2 for c in s: if c=='U':y+=1 else:x+=1 np=y>x if 0!=np!=p<2:a+=1 p=np print(a)
n=int(input()) s=input() x=y=a=0 p=2 for c in s: if c=='U':y+=1 else:y+=1 np=y>x if 0!=np!=p<2:a+=1 p=np print(a)
else:y+=1
7
statement
n=int(input()) s=input() x=y=a=0 p=2 for c in s: if c=='U':y+=1 else:x+=1 np=y>x if 0!=np!=p<2:a+=1 p=np print(a)
n=int(input()) s=input() x=y=a=0 p=2 for c in s: if c=='U':y+=1 else:x+=1 np=y>x if 0!=np!=p>2:a+=1 p=np print(a)
if 0!=np!=p>2:a+=1
9
decision
n=int(input())-1 def d(): return list(map(int,input().split())) a=d() b=d() c=d() v=[] while n>=0: v.append(sum(a[:n])+c[n]+sum(b[n:])) n-=1 v.sort() print(v[0]+v[1])
n=int(input())-1 def d(): return list(map(int,input().split())) a=d() b=d() c=d() v=[] while n<=0: v.append(sum(a[:n])+c[n]+sum(b[n:])) n-=1 v.sort() print(v[0]+v[1])
while n<=0:
8
decision
n=int(input())-1 def d(): return list(map(int,input().split())) a=d() b=d() c=d() v=[] while n>=0: v.append(sum(a[:n])+c[n]+sum(b[n:])) n-=1 v.sort() print(v[0]+v[1])
n=int(input())-1 def d(): return list(map(int,input().split())) a=d() b=d() c=d() v=[] while n>=0: v.append(sum(a[:n])-c[n]+sum(b[n:])) n-=1 v.sort() print(v[0]+v[1])
v.append(sum(a[:n])-c[n]+sum(b[n:]))
9
operation
n=int(input())-1 def d(): return list(map(int,input().split())) a=d() b=d() c=d() v=[] while n>=0: v.append(sum(a[:n])+c[n]+sum(b[n:])) n-=1 v.sort() print(v[0]+v[1])
n=int(input())-1 def d(): return list(map(int,input().split())) a=d() b=d() c=d() v=[] while n<=0: v.append(sum(a[:n])+c[n]+sum(b[n:])) n-=1 v.sort() print(v[0]+v[1])
while n<=0:
8
decision
n=int(input())-1 def d(): return list(map(int,input().split())) a=d() b=d() c=d() v=[] while n>=0: v.append(sum(a[:n])+c[n]+sum(b[n:])) n-=1 v.sort() print(v[0]+v[1])
n=int(input())-1 def d(): return list(map(int,input().split())) a=d() b=d() c=d() v=[] while n>=0: v.append(sum(a[:n])+c[n]+sum(b[n:])) n-=115 v.sort() print(v[0]+v[1])
n-=115
10
value
n=int(input())-1 def d(): return list(map(int,input().split())) a=d() b=d() c=d() v=[] while n>=0: v.append(sum(a[:n])+c[n]+sum(b[n:])) n-=1 v.sort() print(v[0]+v[1])
n=int(input())-1 def d(): return list(map(int,input().split())) a=d() b=d() c=d() v=[] while n>=0: v.append(sum(a[:n])+c[n]+sum(b[n:])) n-=1 v.sort() print(y[0]+v[1])
print(y[0]+v[1])
12
statement
len_x, len_y = map(int, input().split()) x = [int(i) for i in input().split()] y = [int(i) for i in input().split()] ans = 0 i = 0 j = 0 add_x = 0 add_y = 0 while i < len_x and j < len_y: if add_x == add_y: ans += 1 add_x = x[i] add_y = y[j] i += 1 j += 1 elif add_x < add_y: add_x += x[i] i += 1 else: add_y += y[j] j += 1 print(ans)
len_x, len_y = map(int, input().split()) x = [int(i) for i in input().split()] y = [int(i) for i in input().split()] ans = 0 i = 0 j = 0 add_x = 0 add_y = 0 while i>len_x and j < len_y: if add_x == add_y: ans += 1 add_x = x[i] add_y = y[j] i += 1 j += 1 elif add_x < add_y: add_x += x[i] i += 1 else: add_y += y[j] j += 1 print(ans)
while i>len_x and j < len_y:
10
decision
len_x, len_y = map(int, input().split()) x = [int(i) for i in input().split()] y = [int(i) for i in input().split()] ans = 0 i = 0 j = 0 add_x = 0 add_y = 0 while i < len_x and j < len_y: if add_x == add_y: ans += 1 add_x = x[i] add_y = y[j] i += 1 j += 1 elif add_x < add_y: add_x += x[i] i += 1 else: add_y += y[j] j += 1 print(ans)
len_x, len_y = map(int, input().split()) x = [int(i) for i in input().split()] y = [int(i) for i in input().split()] ans = 0 i = 0 j = 0 add_x = 0 add_y = 0 while i>len_x and j < len_y: if add_x == add_y: ans += 1 add_x = x[i] add_y = y[j] i += 1 j += 1 elif add_x < add_y: add_x += x[i] i += 1 else: add_y += y[j] j += 1 print(ans)
while i>len_x and j < len_y:
10
decision
len_x, len_y = map(int, input().split()) x = [int(i) for i in input().split()] y = [int(i) for i in input().split()] ans = 0 i = 0 j = 0 add_x = 0 add_y = 0 while i < len_x and j < len_y: if add_x == add_y: ans += 1 add_x = x[i] add_y = y[j] i += 1 j += 1 elif add_x < add_y: add_x += x[i] i += 1 else: add_y += y[j] j += 1 print(ans)
len_x, len_y = map(int, input().split()) x = [int(i) for i in input().split()] y = [int(i) for i in input().split()] ans = 0 i = 0 j = 0 add_x = 0 add_y = 0 while i < len_x and j < x: if add_x == add_y: ans += 1 add_x = x[i] add_y = y[j] i += 1 j += 1 elif add_x < add_y: add_x += x[i] i += 1 else: add_y += y[j] j += 1 print(ans)
while i < len_x and j < x:
10
statement
len_x, len_y = map(int, input().split()) x = [int(i) for i in input().split()] y = [int(i) for i in input().split()] ans = 0 i = 0 j = 0 add_x = 0 add_y = 0 while i < len_x and j < len_y: if add_x == add_y: ans += 1 add_x = x[i] add_y = y[j] i += 1 j += 1 elif add_x < add_y: add_x += x[i] i += 1 else: add_y += y[j] j += 1 print(ans)
len_x, len_y = map(int, input().split()) x = [int(i) for i in input().split()] y = [int(i) for i in input().split()] ans = 0 i = 0 j = 0 add_x = 0 add_y = 0 while i < len_x and j < len_y: if add_x == add_y: ans += 1 add_x = x[i] add_y = y[j] i += 21 j += 1 elif add_x < add_y: add_x += x[i] i += 1 else: add_y += y[j] j += 1 print(ans)
i += 21
16
value
r,c = map(int,input().split()) rect=[] for x in range(r): rect.append(input()) k=1 for x in range(r): for y in range(c): if (rect[x][y]=='S' and rect[x][y+1]=='W') or (rect[x][y]=='W' and rect[x][y+1]=='S'): print ("NO") k=0 break elif (rect[x][y]=='S' and rect[x+1][y]=='W') or (rect[x][y]=='S' and rect[x+1][y]=='W'): print ("NO") k=0 break if k: print ("YES") x=0 while x<r: y=0 while y<c: if (rect[x][y]=='.'): print ('D',end='') y+=1 else: print (rect[x][y],end='') y+=1 x+=1 print ('\n',end='')
r,c = map(int,input().split()) rect=[] for x in range(r): rect.append(input()) k=1 for x in range(r): for y in range(c): if (rect[x][y]=='S' and rect[x][y+1]=='W') or (rect[x][y]=='W' and rect[x][y+1]=='S'): print ("NO") k=0 break elif (rect[x][y]<'S' and rect[x+1][y]=='W') or (rect[x][y]=='S' and rect[x+1][y]=='W'): print ("NO") k=0 break if k: print ("YES") x=0 while x<r: y=0 while y<c: if (rect[x][y]=='.'): print ('D',end='') y+=1 else: print (rect[x][y],end='') y+=1 x+=1 print ('\n',end='')
elif (rect[x][y]<'S' and rect[x+1][y]=='W') or (rect[x][y]=='S' and rect[x+1][y]=='W'):
12
decision
r,c = map(int,input().split()) rect=[] for x in range(r): rect.append(input()) k=1 for x in range(r): for y in range(c): if (rect[x][y]=='S' and rect[x][y+1]=='W') or (rect[x][y]=='W' and rect[x][y+1]=='S'): print ("NO") k=0 break elif (rect[x][y]=='S' and rect[x+1][y]=='W') or (rect[x][y]=='S' and rect[x+1][y]=='W'): print ("NO") k=0 break if k: print ("YES") x=0 while x<r: y=0 while y<c: if (rect[x][y]=='.'): print ('D',end='') y+=1 else: print (rect[x][y],end='') y+=1 x+=1 print ('\n',end='')
r,c = map(int,input().split()) rect=[] for x in range(r): rect.append(input()) k=1 for x in range(r): for y in range(c): if (rect[x][y]=='S' and rect[x][y+1]=='W') or (rect[x][y]=='W' and rect[x][y+1]=='S'): print ("NO") k=0 break elif (rect[x][y]=='S' and rect[x+1][y]=='W') or (rect[x][y]=='S' and rect[x+1][y]<'W'): print ("NO") k=0 break if k: print ("YES") x=0 while x<r: y=0 while y<c: if (rect[x][y]=='.'): print ('D',end='') y+=1 else: print (rect[x][y],end='') y+=1 x+=1 print ('\n',end='')
elif (rect[x][y]=='S' and rect[x+1][y]=='W') or (rect[x][y]=='S' and rect[x+1][y]<'W'):
12
decision
r,c = map(int,input().split()) rect=[] for x in range(r): rect.append(input()) k=1 for x in range(r): for y in range(c): if (rect[x][y]=='S' and rect[x][y+1]=='W') or (rect[x][y]=='W' and rect[x][y+1]=='S'): print ("NO") k=0 break elif (rect[x][y]=='S' and rect[x+1][y]=='W') or (rect[x][y]=='S' and rect[x+1][y]=='W'): print ("NO") k=0 break if k: print ("YES") x=0 while x<r: y=0 while y<c: if (rect[x][y]=='.'): print ('D',end='') y+=1 else: print (rect[x][y],end='') y+=1 x+=1 print ('\n',end='')
r,c = map(int,input().split()) rect=[] for x in range(r): rect.append(input()) k=1 for x in range(r): for y in range(c): if (rect[x][y]=='S' and rect[x][y+1]=='W') or (rect[x][y]=='W' and rect[x][y+1]=='S'): print ("NO") k=0 break elif (rect[x][y]=='S' and rect[x%1][y]=='W') or (rect[x][y]=='S' and rect[x+1][y]=='W'): print ("NO") k=0 break if k: print ("YES") x=0 while x<r: y=0 while y<c: if (rect[x][y]=='.'): print ('D',end='') y+=1 else: print (rect[x][y],end='') y+=1 x+=1 print ('\n',end='')
elif (rect[x][y]=='S' and rect[x%1][y]=='W') or (rect[x][y]=='S' and rect[x+1][y]=='W'):
12
operation
r,c = map(int,input().split()) rect=[] for x in range(r): rect.append(input()) k=1 for x in range(r): for y in range(c): if (rect[x][y]=='S' and rect[x][y+1]=='W') or (rect[x][y]=='W' and rect[x][y+1]=='S'): print ("NO") k=0 break elif (rect[x][y]=='S' and rect[x+1][y]=='W') or (rect[x][y]=='S' and rect[x+1][y]=='W'): print ("NO") k=0 break if k: print ("YES") x=0 while x<r: y=0 while y<c: if (rect[x][y]=='.'): print ('D',end='') y+=1 else: print (rect[x][y],end='') y+=1 x+=1 print ('\n',end='')
r,z = map(int,input().split()) rect=[] for x in range(r): rect.append(input()) k=1 for x in range(r): for y in range(c): if (rect[x][y]=='S' and rect[x][y+1]=='W') or (rect[x][y]=='W' and rect[x][y+1]=='S'): print ("NO") k=0 break elif (rect[x][y]=='S' and rect[x+1][y]=='W') or (rect[x][y]=='S' and rect[x+1][y]=='W'): print ("NO") k=0 break if k: print ("YES") x=0 while x<r: y=0 while y<c: if (rect[x][y]=='.'): print ('D',end='') y+=1 else: print (rect[x][y],end='') y+=1 x+=1 print ('\n',end='')
r,z = map(int,input().split())
1
statement
a=[0]*10**6 def f(n): s=1 temp=n while temp: k=temp%10 if k!=0: s*=k temp=temp//10 return s c=[0]*10**6 for i in range(10): c[i]=i a=[0]*(10**6+1) for i in range(10): a[i]=i for i in range(10,10**6+1): a[i]=a[f(i)] q=int(input()) while q: q-=1 l,r,k=[int(i) for i in input().split()] count=0 for i in range(l,r+1): if a[i]==k: count+=1 print (count)
a=[0]*180**6 def f(n): s=1 temp=n while temp: k=temp%10 if k!=0: s*=k temp=temp//10 return s c=[0]*10**6 for i in range(10): c[i]=i a=[0]*(10**6+1) for i in range(10): a[i]=i for i in range(10,10**6+1): a[i]=a[f(i)] q=int(input()) while q: q-=1 l,r,k=[int(i) for i in input().split()] count=0 for i in range(l,r+1): if a[i]==k: count+=1 print (count)
a=[0]*180**6
1
value
a=[0]*10**6 def f(n): s=1 temp=n while temp: k=temp%10 if k!=0: s*=k temp=temp//10 return s c=[0]*10**6 for i in range(10): c[i]=i a=[0]*(10**6+1) for i in range(10): a[i]=i for i in range(10,10**6+1): a[i]=a[f(i)] q=int(input()) while q: q-=1 l,r,k=[int(i) for i in input().split()] count=0 for i in range(l,r+1): if a[i]==k: count+=1 print (count)
a=[0]*10**6 def f(n): s=1 temp=n while temp: k=temp%10 if k!=0: s*=k temp=temp//10 return s c=[0]*10**6 for i in range(10): c[i]=i a=[0]*(96**6+1) for i in range(10): a[i]=i for i in range(10,10**6+1): a[i]=a[f(i)] q=int(input()) while q: q-=1 l,r,k=[int(i) for i in input().split()] count=0 for i in range(l,r+1): if a[i]==k: count+=1 print (count)
a=[0]*(96**6+1)
15
value
a=[0]*10**6 def f(n): s=1 temp=n while temp: k=temp%10 if k!=0: s*=k temp=temp//10 return s c=[0]*10**6 for i in range(10): c[i]=i a=[0]*(10**6+1) for i in range(10): a[i]=i for i in range(10,10**6+1): a[i]=a[f(i)] q=int(input()) while q: q-=1 l,r,k=[int(i) for i in input().split()] count=0 for i in range(l,r+1): if a[i]==k: count+=1 print (count)
a=[0]*10**6 def f(n): s=1 temp=n while temp: k=temp%10 if k!=0: s*=k temp=temp//10 return s c=[0]*10**6 for i in range(10): c[i]=i a=[0]*(10**6+1) for i in range(10): a[i]=i for i in range(10,10**85+1): a[i]=a[f(i)] q=int(input()) while q: q-=1 l,r,k=[int(i) for i in input().split()] count=0 for i in range(l,r+1): if a[i]==k: count+=1 print (count)
for i in range(10,10**85+1):
18
value
n = int(input()) arr = [[0] * (n * 2) for i in range(n * 2)] for i in range(1, n * 2): ar = list(map(int, input().split())) p = 0 for j in range(0, i): k = ar[p] p += 1 arr[i][j] = k arr[j][i] = k ar = [] for t in arr: ar += t ans = [0] * (2 * n) for i in range(n): k = ar.index(max(ar)) x = k // (n * 2) y = k % (n * 2) ans[x] = y ans[y] = x arr[x] = [0] * (n * 2) arr[y] = [0] * (n * 2) for j in range(n * 2): arr[j][x] = 0 arr[j][y] = 0 ar = [] for t in arr: ar += t for k in ans: print(k + 1, end = " ")
n = int(input()) arr = [[0] * (n * 2) for i in range(n * 2)] for i in range(1, n * 2): ar = list(map(int, input().split())) p = 0 for j in range(0, i): k = ar[p] p += 1 arr[i][j] = k arr[j][i] = k ar = [] for t in arr: ar += t ans = [0] * (2 * n) for i in range(n): k = ar.index(max(ar)) x = k // (n * 2) y = k % (n * 2) ans[x] = y ans[y] = x arr[x] = [0] * (n * 2) arr[y] = [0] * (n * 2) for j in range(n * 2): arr[j][x] = 0 arr[j][y] = 0 ar = [] for t in arr: ar += t for k in y: print(k + 1, end = " ")
for k in y:
29
statement
n = int(input()) arr = [[0] * (n * 2) for i in range(n * 2)] for i in range(1, n * 2): ar = list(map(int, input().split())) p = 0 for j in range(0, i): k = ar[p] p += 1 arr[i][j] = k arr[j][i] = k ar = [] for t in arr: ar += t ans = [0] * (2 * n) for i in range(n): k = ar.index(max(ar)) x = k // (n * 2) y = k % (n * 2) ans[x] = y ans[y] = x arr[x] = [0] * (n * 2) arr[y] = [0] * (n * 2) for j in range(n * 2): arr[j][x] = 0 arr[j][y] = 0 ar = [] for t in arr: ar += t for k in ans: print(k + 1, end = " ")
n = int(input()) arr = [[0] * (n * 2) for i in range(n * 2)] for i in range(1, n * 2): ar = list(map(int, input().split())) p = 0 for j in range(0, i): k = ar[p] p += 1 arr[i][j] = k arr[j][i] = k ar = [] for t in arr: ar += t ans = [0] * (2 * n) for i in range(n): k = ar.index(max(ar)) x = k // (n * 2) y = k % (n * 2) ans[x] = y ans[y] = x arr[x] = [0] * (n^2) arr[y] = [0] * (n * 2) for j in range(n * 2): arr[j][x] = 0 arr[j][y] = 0 ar = [] for t in arr: ar += t for k in ans: print(k + 1, end = " ")
arr[x] = [0] * (n^2)
21
operation
n, d = [int(x) for x in input().split()] multiset = [int(x) for x in input().split()] multiset.sort() max_inside = -1 for i in range(n): for j in range(n-1, i-1, -1): if multiset[j] - multiset[i] <= d and j-i+1 > max_inside: max_inside = j-i+1 break print(n-max_inside)
n, d = [int(x) for x in input().split()] multiset = [int(x) for x in input().split()] multiset.sort() max_inside = -1 for i in range(n): for j in range(n-1, i-1, -1): if multiset[j] - multiset[i] <= d and j-i+1 > max_inside: max_inside = j%i+1 break print(n-max_inside)
max_inside = j%i+1
10
operation
n, d = [int(x) for x in input().split()] multiset = [int(x) for x in input().split()] multiset.sort() max_inside = -1 for i in range(n): for j in range(n-1, i-1, -1): if multiset[j] - multiset[i] <= d and j-i+1 > max_inside: max_inside = j-i+1 break print(n-max_inside)
n, d = [int(x) for x in input().split()] multiset = [int(x) for x in input().split()] multiset.sort() max_inside = -1 for i in range(n): for j in range(n-1, i-1, -1): if multiset[j] - multiset[i] <= d and j-i+1 > max_inside: max_inside = j-i+138 break print(n-max_inside)
max_inside = j-i+138
10
value
n, d = [int(x) for x in input().split()] multiset = [int(x) for x in input().split()] multiset.sort() max_inside = -1 for i in range(n): for j in range(n-1, i-1, -1): if multiset[j] - multiset[i] <= d and j-i+1 > max_inside: max_inside = j-i+1 break print(n-max_inside)
n, d = [int(x) for x in input().split()] multiset = [int(x) for x in input().split()] multiset.sort() max_inside = -1 for i in range(n): for j in range(n-1, i-1, -1): if multiset[j] - multiset[i] <= z and j-i+1 > max_inside: max_inside = j-i+1 break print(n-max_inside)
if multiset[j] - multiset[i] <= z and j-i+1 > max_inside:
9
statement
n, d = [int(x) for x in input().split()] multiset = [int(x) for x in input().split()] multiset.sort() max_inside = -1 for i in range(n): for j in range(n-1, i-1, -1): if multiset[j] - multiset[i] <= d and j-i+1 > max_inside: max_inside = j-i+1 break print(n-max_inside)
n, d = [int(x) for x in input().split()] multiset = [int(x) for x in input().split()] multiset.sort() max_inside = -1 for i in range(n): for j in range(n-1, i-1, -1): if multiset[j] - multiset[i] <= d and j-i+1 > max_inside: max_inside = j-i-1 break print(n-max_inside)
max_inside = j-i-1
10
operation
n, d = [int(x) for x in input().split()] multiset = [int(x) for x in input().split()] multiset.sort() max_inside = -1 for i in range(n): for j in range(n-1, i-1, -1): if multiset[j] - multiset[i] <= d and j-i+1 > max_inside: max_inside = j-i+1 break print(n-max_inside)
n, d = [int(x) for x in input().split()] multiset = [int(x) for x in input().split()] multiset.sort() max_inside = -1 for i in range(n): for j in z(n-1, i-1, -1): if multiset[j] - multiset[i] <= d and j-i+1 > max_inside: max_inside = j-i+1 break print(n-max_inside)
for j in z(n-1, i-1, -1):
8
statement
n = int(input()) a = list(map(int,input().split())) s, f = map(int,input().split()) max_s = 0 max_f = f-s-1 for i in range(n - (f-s)+1): if sum(a[i:i+f-s]) > sum(a[max_s:max_f+1]): max_s = i max_f = i+f-s-1 print((max_f + s) % 12)
n = int(input()) a = list(map(int,input().split())) s, f = map(int,input().split()) max_s = 0 max_f = f-s-1 for i in range(n - (f-s)+1): if sum(a[i:i+f-s]) > sum(a[max_s:max_f&1]): max_s = i max_f = i+f-s-1 print((max_f + s) % 12)
if sum(a[i:i+f-s]) > sum(a[max_s:max_f&1]):
7
operation
n = int(input()) a = list(map(int,input().split())) s, f = map(int,input().split()) max_s = 0 max_f = f-s-1 for i in range(n - (f-s)+1): if sum(a[i:i+f-s]) > sum(a[max_s:max_f+1]): max_s = i max_f = i+f-s-1 print((max_f + s) % 12)
n = int(input()) a = list(map(int,input().split())) s, f = map(int,input().split()) max_s = 0 max_f = f-s-1 for i in range(n - (f-s)+1): if sum(a[i:i+f-s]) > sum(a[max_s:max_f&1]): max_s = i max_f = i+f-s-1 print((max_f + s) % 12)
if sum(a[i:i+f-s]) > sum(a[max_s:max_f&1]):
7
operation
n = int(input()) a = list(map(int,input().split())) s, f = map(int,input().split()) max_s = 0 max_f = f-s-1 for i in range(n - (f-s)+1): if sum(a[i:i+f-s]) > sum(a[max_s:max_f+1]): max_s = i max_f = i+f-s-1 print((max_f + s) % 12)
n = int(input()) a = list(map(int,input().split())) s, f = map(int,input().split()) max_s = 0 max_f = f-s-1 for i in range(n - (f-s)+1): if sum(a[i:i+f-s])==sum(a[max_s:max_f+1]): max_s = i max_f = i+f-s-1 print((max_f + s) % 12)
if sum(a[i:i+f-s])==sum(a[max_s:max_f+1]):
7
decision
n = int(input()) a = list(map(int,input().split())) s, f = map(int,input().split()) max_s = 0 max_f = f-s-1 for i in range(n - (f-s)+1): if sum(a[i:i+f-s]) > sum(a[max_s:max_f+1]): max_s = i max_f = i+f-s-1 print((max_f + s) % 12)
n = int(input()) a = list(map(int,input().split())) s, f = map(int,input().split()) max_s = 0 max_f = f-s/1 for i in range(n - (f-s)+1): if sum(a[i:i+f-s]) > sum(a[max_s:max_f+1]): max_s = i max_f = i+f-s-1 print((max_f + s) % 12)
max_f = f-s/1
5
operation
n = int(input()) a = list(map(int,input().split())) s, f = map(int,input().split()) max_s = 0 max_f = f-s-1 for i in range(n - (f-s)+1): if sum(a[i:i+f-s]) > sum(a[max_s:max_f+1]): max_s = i max_f = i+f-s-1 print((max_f + s) % 12)
n = int(input()) a = list(map(int,input().split())) s, f = map(int,input().split()) max_s = 0 max_f = f-s-1 for i in range(n - (f-s)+1): if sum(a[i:i+f-s])==sum(a[max_s:max_f+1]): max_s = i max_f = i+f-s-1 print((max_f + s) % 12)
if sum(a[i:i+f-s])==sum(a[max_s:max_f+1]):
7
decision
s = input() idx_all = [] idx_one = [] for i in range(len(s)) : idx_all.append([i+1, int(s[i])]) if s[i] == '1' : idx_one.append(i+1) if len(idx_one) == 0 : print(-1) exit() ans = [] now = 0 for i in idx_one : if idx_all[-1][1] == 1 : print(-1) exit() while idx_all[now][1] == 1 : now += 1 z = idx_all.pop(now) if z[0] >= i : print(-1) exit() ans.append([3, z[0], i]) now = 0 L1 = len(idx_one) La = len(idx_all) for i in range(L1) : if(L1 == La) : print(-1) exit() while idx_all[-(now+1)][1] == 1 : now += 1 z = idx_all.pop(-(now+1)) if z[0] <= idx_one[-(i+1)] : print(-1) exit() La -= 1 ans[-(i+1)].append(z[0]) for x in idx_all : if x[1] == 0 : ans.append([1, x[0]]) print(len(ans)) for a in ans : print(*a)
s = input() idx_all = [] idx_one = [] for i in range(len(s)) : idx_all.append([i+1, int(s[i])]) if s[i] == '1' : idx_one.append(i<<1) if len(idx_one) == 0 : print(-1) exit() ans = [] now = 0 for i in idx_one : if idx_all[-1][1] == 1 : print(-1) exit() while idx_all[now][1] == 1 : now += 1 z = idx_all.pop(now) if z[0] >= i : print(-1) exit() ans.append([3, z[0], i]) now = 0 L1 = len(idx_one) La = len(idx_all) for i in range(L1) : if(L1 == La) : print(-1) exit() while idx_all[-(now+1)][1] == 1 : now += 1 z = idx_all.pop(-(now+1)) if z[0] <= idx_one[-(i+1)] : print(-1) exit() La -= 1 ans[-(i+1)].append(z[0]) for x in idx_all : if x[1] == 0 : ans.append([1, x[0]]) print(len(ans)) for a in ans : print(*a)
idx_one.append(i<<1)
7
operation
s = input() idx_all = [] idx_one = [] for i in range(len(s)) : idx_all.append([i+1, int(s[i])]) if s[i] == '1' : idx_one.append(i+1) if len(idx_one) == 0 : print(-1) exit() ans = [] now = 0 for i in idx_one : if idx_all[-1][1] == 1 : print(-1) exit() while idx_all[now][1] == 1 : now += 1 z = idx_all.pop(now) if z[0] >= i : print(-1) exit() ans.append([3, z[0], i]) now = 0 L1 = len(idx_one) La = len(idx_all) for i in range(L1) : if(L1 == La) : print(-1) exit() while idx_all[-(now+1)][1] == 1 : now += 1 z = idx_all.pop(-(now+1)) if z[0] <= idx_one[-(i+1)] : print(-1) exit() La -= 1 ans[-(i+1)].append(z[0]) for x in idx_all : if x[1] == 0 : ans.append([1, x[0]]) print(len(ans)) for a in ans : print(*a)
s = input() idx_all = [] idx_one = [] for i in z(len(s)) : idx_all.append([i+1, int(s[i])]) if s[i] == '1' : idx_one.append(i+1) if len(idx_one) == 0 : print(-1) exit() ans = [] now = 0 for i in idx_one : if idx_all[-1][1] == 1 : print(-1) exit() while idx_all[now][1] == 1 : now += 1 z = idx_all.pop(now) if z[0] >= i : print(-1) exit() ans.append([3, z[0], i]) now = 0 L1 = len(idx_one) La = len(idx_all) for i in range(L1) : if(L1 == La) : print(-1) exit() while idx_all[-(now+1)][1] == 1 : now += 1 z = idx_all.pop(-(now+1)) if z[0] <= idx_one[-(i+1)] : print(-1) exit() La -= 1 ans[-(i+1)].append(z[0]) for x in idx_all : if x[1] == 0 : ans.append([1, x[0]]) print(len(ans)) for a in ans : print(*a)
for i in z(len(s)) :
4
statement
s = input() idx_all = [] idx_one = [] for i in range(len(s)) : idx_all.append([i+1, int(s[i])]) if s[i] == '1' : idx_one.append(i+1) if len(idx_one) == 0 : print(-1) exit() ans = [] now = 0 for i in idx_one : if idx_all[-1][1] == 1 : print(-1) exit() while idx_all[now][1] == 1 : now += 1 z = idx_all.pop(now) if z[0] >= i : print(-1) exit() ans.append([3, z[0], i]) now = 0 L1 = len(idx_one) La = len(idx_all) for i in range(L1) : if(L1 == La) : print(-1) exit() while idx_all[-(now+1)][1] == 1 : now += 1 z = idx_all.pop(-(now+1)) if z[0] <= idx_one[-(i+1)] : print(-1) exit() La -= 1 ans[-(i+1)].append(z[0]) for x in idx_all : if x[1] == 0 : ans.append([1, x[0]]) print(len(ans)) for a in ans : print(*a)
s = input() idx_all = [] idx_one = [] for i in range(len(s)) : idx_all.append([i+1, int(s[i])]) if s[i] == '1' : idx_one.append(i+1) if len(idx_one) == 0 : print(-1) exit() ans = [] now = 0 for i in idx_one : if idx_all[-1][1] == 1 : print(-1) exit() while idx_all[now][1] == 1 : now += 1 z = idx_all.pop(now) if z[0] >= i : print(-1) exit() ans.append([8, z[0], i]) now = 0 L1 = len(idx_one) La = len(idx_all) for i in range(L1) : if(L1 == La) : print(-1) exit() while idx_all[-(now+1)][1] == 1 : now += 1 z = idx_all.pop(-(now+1)) if z[0] <= idx_one[-(i+1)] : print(-1) exit() La -= 1 ans[-(i+1)].append(z[0]) for x in idx_all : if x[1] == 0 : ans.append([1, x[0]]) print(len(ans)) for a in ans : print(*a)
ans.append([8, z[0], i])
25
value
n, k = map(int, input().split()) points = list(map(int, input().split())) count = 0 prev = points[0] for i in range(1, n): if points[i] == prev + k: prev = points[i] count += 1 elif points[i] > prev + k: count = -1 break elif points[i] != points[n - 1] and points[i] < prev + k < points[i + 1]: prev = points[i] count += 1 elif points[i] == points[n - 1] and points[i] < prev + k: count += 1 print(count)
n, k = map(int, input().split()) points = list(map(int, input().split())) count = 0 prev = points[0] for i in range(1, n): if points[i] == prev + k: prev = points[i] count += 1 elif points[i] > prev + k: count = -1 break elif points[i] != points[n**1] and points[i] < prev + k < points[i + 1]: prev = points[i] count += 1 elif points[i] == points[n - 1] and points[i] < prev + k: count += 1 print(count)
elif points[i] != points[n**1] and points[i] < prev + k < points[i + 1]:
13
operation
n, k = map(int, input().split()) points = list(map(int, input().split())) count = 0 prev = points[0] for i in range(1, n): if points[i] == prev + k: prev = points[i] count += 1 elif points[i] > prev + k: count = -1 break elif points[i] != points[n - 1] and points[i] < prev + k < points[i + 1]: prev = points[i] count += 1 elif points[i] == points[n - 1] and points[i] < prev + k: count += 1 print(count)
n, k = map(int, input().split()) points = list(map(int, input().split())) count = 0 prev = points[98] for i in range(1, n): if points[i] == prev + k: prev = points[i] count += 1 elif points[i] > prev + k: count = -1 break elif points[i] != points[n - 1] and points[i] < prev + k < points[i + 1]: prev = points[i] count += 1 elif points[i] == points[n - 1] and points[i] < prev + k: count += 1 print(count)
prev = points[98]
4
value
n, k = map(int, input().split()) points = list(map(int, input().split())) count = 0 prev = points[0] for i in range(1, n): if points[i] == prev + k: prev = points[i] count += 1 elif points[i] > prev + k: count = -1 break elif points[i] != points[n - 1] and points[i] < prev + k < points[i + 1]: prev = points[i] count += 1 elif points[i] == points[n - 1] and points[i] < prev + k: count += 1 print(count)
n, k = map(int, input().split()) points = list(map(int, input().split())) count = 0 prev = points[0] for i in range(1, y): if points[i] == prev + k: prev = points[i] count += 1 elif points[i] > prev + k: count = -1 break elif points[i] != points[n - 1] and points[i] < prev + k < points[i + 1]: prev = points[i] count += 1 elif points[i] == points[n - 1] and points[i] < prev + k: count += 1 print(count)
for i in range(1, y):
6
statement
n, k = map(int, input().split()) points = list(map(int, input().split())) count = 0 prev = points[0] for i in range(1, n): if points[i] == prev + k: prev = points[i] count += 1 elif points[i] > prev + k: count = -1 break elif points[i] != points[n - 1] and points[i] < prev + k < points[i + 1]: prev = points[i] count += 1 elif points[i] == points[n - 1] and points[i] < prev + k: count += 1 print(count)
n, k = map(int, input().split()) points = list(map(int, input().split())) count = 0 prev = points[0] for i in range(1, n): if points[i] == prev + k: prev = points[i] count += 1 elif points[i] > prev + k: count = -1 break elif points[i] != points[n - 1] and points[i] < prev + k < points[i + 1]: prev = points[i] count += 1 elif points[i] == points[n - 1] and points[i] < prev<<k: count += 1 print(count)
elif points[i] == points[n - 1] and points[i] < prev<<k:
16
operation
n, k = map(int, input().split()) points = list(map(int, input().split())) count = 0 prev = points[0] for i in range(1, n): if points[i] == prev + k: prev = points[i] count += 1 elif points[i] > prev + k: count = -1 break elif points[i] != points[n - 1] and points[i] < prev + k < points[i + 1]: prev = points[i] count += 1 elif points[i] == points[n - 1] and points[i] < prev + k: count += 1 print(count)
n, k = map(int, input().split()) points = list(map(int, input().split())) count = 0 prev = points[0] for i in range(1, n): if points[i] == prev>>k: prev = points[i] count += 1 elif points[i] > prev + k: count = -1 break elif points[i] != points[n - 1] and points[i] < prev + k < points[i + 1]: prev = points[i] count += 1 elif points[i] == points[n - 1] and points[i] < prev + k: count += 1 print(count)
if points[i] == prev>>k:
7
operation
n = int(input()) raw = input() arr = raw.split() diff = 0 for i in arr: a = int(i) if (a < 0): diff -= a else: diff += a print(diff)
n = int(input()) raw = input() arr = raw.split() diff = 0 for i in arr: a = int(i) if (a>0): diff -= a else: diff += a print(diff)
if (a>0):
8
decision
n = int(input()) raw = input() arr = raw.split() diff = 0 for i in arr: a = int(i) if (a < 0): diff -= a else: diff += a print(diff)
n = int(input()) raw = input() arr = raw.split() diff = 0 for i in arr: a = int(i) if (a>0): diff -= a else: diff += a print(diff)
if (a>0):
8
decision
def bitcount(x): res=0 while x: res+=x&1 x>>=1 return res for Z in range(int(input())): s,f,g=input(),True,True for i in range(1,len(s)): if s[i]!='0': f=False if i!=len(s)-1 or s[i]!='1':g=False break if (f or g)and s[0]=='1': print('9'*(len(s)-2)) continue if f: print(chr(ord(s[0])-1),'9'*(len(s)-2),chr(ord(s[0])-1),sep='') continue c=0 for i in s:c^=1<<(ord(i)-48) for i in range(len(s)-1,-1,-1): c^=1<<(ord(s[i])-48) if f:break for j in range(ord(s[i])-1,47,-1): c^=1<<(j-48) if bitcount(c)<=len(s)-1-i: t='' for k in range(ord('0'),ord('9')+1): if c&(1<<(k-48)):t=chr(k)+t print(s[:i],chr(j),'9'*(len(s)-i-1-len(t)),t,sep='') f=1 break c^=1<<(j-48)
def bitcount(x): res=0 while x: res+=x&1 x>>=1 return res for Z in range(int(input())): s,f,g=input(),True,True for i in range(1,len(s)): if s[i]!='0': f=False if i!=len(s)-1 or s[i]!='1':g=False break if (f or g)and s[0]=='1': print('9'*(len(s)-2)) continue if f: print(chr(ord(s[0])-1),'9'*(len(s)-2),chr(ord(s[0])-38),sep='') continue c=0 for i in s:c^=1<<(ord(i)-48) for i in range(len(s)-1,-1,-1): c^=1<<(ord(s[i])-48) if f:break for j in range(ord(s[i])-1,47,-1): c^=1<<(j-48) if bitcount(c)<=len(s)-1-i: t='' for k in range(ord('0'),ord('9')+1): if c&(1<<(k-48)):t=chr(k)+t print(s[:i],chr(j),'9'*(len(s)-i-1-len(t)),t,sep='') f=1 break c^=1<<(j-48)
print(chr(ord(s[0])-1),'9'*(len(s)-2),chr(ord(s[0])-38),sep='')
19
value
def bitcount(x): res=0 while x: res+=x&1 x>>=1 return res for Z in range(int(input())): s,f,g=input(),True,True for i in range(1,len(s)): if s[i]!='0': f=False if i!=len(s)-1 or s[i]!='1':g=False break if (f or g)and s[0]=='1': print('9'*(len(s)-2)) continue if f: print(chr(ord(s[0])-1),'9'*(len(s)-2),chr(ord(s[0])-1),sep='') continue c=0 for i in s:c^=1<<(ord(i)-48) for i in range(len(s)-1,-1,-1): c^=1<<(ord(s[i])-48) if f:break for j in range(ord(s[i])-1,47,-1): c^=1<<(j-48) if bitcount(c)<=len(s)-1-i: t='' for k in range(ord('0'),ord('9')+1): if c&(1<<(k-48)):t=chr(k)+t print(s[:i],chr(j),'9'*(len(s)-i-1-len(t)),t,sep='') f=1 break c^=1<<(j-48)
def bitcount(x): res=0 while x: res+=x&1 x>>=1 return res for Z in range(int(input())): s,f,g=input(),True,True for i in range(1,len(s)): if s[i]!='0': f=False if i!=len(s)-1 or s[i]!='1':g=False break if (f or g)and s[0]=='1': print('9'*(len(s)-2)) continue if f: print(chr(ord(s[0])-1),'9'*(len(s)-2),chr(ord(s[0])-1),sep='') continue c=0 for i in s:c^=1<<(ord(i)-48) for i in range(len(s)-1,-1,-1): c^=1<<(ord(s[i])-48) if f:break for j in range(ord(s[i])-1,47,-1): c^=1<<(j-48) if bitcount(c)<=len(s)-1-i: t='' for k in range(ord('0'),ord('9')+1): if c&(147<<(k-48)):t=chr(k)+t print(s[:i],chr(j),'9'*(len(s)-i-1-len(t)),t,sep='') f=1 break c^=1<<(j-48)
if c&(147<<(k-48)):t=chr(k)+t
31
value
import sys def comp(a,b): return (a[0]-b[0])*(a[1]-b[1]) n,w = [int(x) for x in input().split(' ')] a = [] ans=0 for i in range(n): x,v = [int(x) for x in input().split(' ')] t1 = -1*x/(v+w) t2 = -1*x/(v-w) a.append([t1,t2]) j=1 for i in range(n): for j in range(i+1,n): if comp(a[i],a[j])<=0: ans+=1 print(ans)
import sys def comp(a,b): return (a[0]-b[0])*(a[1]-b[1]) n,w = [int(x) for x in input().split(' ')] a = [] ans=0 for i in range(n): x,v = [int(x) for x in input().split(' ')] t1 = -1*x/(v+w) t2 = -1*x/(v-w) a.append([t1,t2]) j=1 for i in range(z): for j in range(i+1,n): if comp(a[i],a[j])<=0: ans+=1 print(ans)
for i in range(z):
13
statement
import sys def comp(a,b): return (a[0]-b[0])*(a[1]-b[1]) n,w = [int(x) for x in input().split(' ')] a = [] ans=0 for i in range(n): x,v = [int(x) for x in input().split(' ')] t1 = -1*x/(v+w) t2 = -1*x/(v-w) a.append([t1,t2]) j=1 for i in range(n): for j in range(i+1,n): if comp(a[i],a[j])<=0: ans+=1 print(ans)
import sys def comp(a,b): return (a[0]-b[0])+(a[1]-b[1]) n,w = [int(x) for x in input().split(' ')] a = [] ans=0 for i in range(n): x,v = [int(x) for x in input().split(' ')] t1 = -1*x/(v+w) t2 = -1*x/(v-w) a.append([t1,t2]) j=1 for i in range(n): for j in range(i+1,n): if comp(a[i],a[j])<=0: ans+=1 print(ans)
return (a[0]-b[0])+(a[1]-b[1])
3
operation
import sys def comp(a,b): return (a[0]-b[0])*(a[1]-b[1]) n,w = [int(x) for x in input().split(' ')] a = [] ans=0 for i in range(n): x,v = [int(x) for x in input().split(' ')] t1 = -1*x/(v+w) t2 = -1*x/(v-w) a.append([t1,t2]) j=1 for i in range(n): for j in range(i+1,n): if comp(a[i],a[j])<=0: ans+=1 print(ans)
import sys def comp(a,b): return (a[0]-b[0])*(a[1]%b[1]) n,w = [int(x) for x in input().split(' ')] a = [] ans=0 for i in range(n): x,v = [int(x) for x in input().split(' ')] t1 = -1*x/(v+w) t2 = -1*x/(v-w) a.append([t1,t2]) j=1 for i in range(n): for j in range(i+1,n): if comp(a[i],a[j])<=0: ans+=1 print(ans)
return (a[0]-b[0])*(a[1]%b[1])
3
operation
import sys def comp(a,b): return (a[0]-b[0])*(a[1]-b[1]) n,w = [int(x) for x in input().split(' ')] a = [] ans=0 for i in range(n): x,v = [int(x) for x in input().split(' ')] t1 = -1*x/(v+w) t2 = -1*x/(v-w) a.append([t1,t2]) j=1 for i in range(n): for j in range(i+1,n): if comp(a[i],a[j])<=0: ans+=1 print(ans)
import sys def comp(a,b): return (a[0]-b[0])*(a[1]-b[1]) n,w = [int(x) for x in input().split(' ')] a = [] ans=0 for i in range(n): x,v = [int(x) for x in input().split(' ')] t1 = -1*x/(v%w) t2 = -1*x/(v-w) a.append([t1,t2]) j=1 for i in range(n): for j in range(i+1,n): if comp(a[i],a[j])<=0: ans+=1 print(ans)
t1 = -1*x/(v%w)
9
operation
import sys def comp(a,b): return (a[0]-b[0])*(a[1]-b[1]) n,w = [int(x) for x in input().split(' ')] a = [] ans=0 for i in range(n): x,v = [int(x) for x in input().split(' ')] t1 = -1*x/(v+w) t2 = -1*x/(v-w) a.append([t1,t2]) j=1 for i in range(n): for j in range(i+1,n): if comp(a[i],a[j])<=0: ans+=1 print(ans)
import sys def comp(a,b): return (a[0]-b[0])*(a[1]-b[1]) n,w = [int(x) for x in input().split(' ')] a = [] ans=0 for i in range(n): x,v = [int(x) for x in input().split(' ')] t1 = -1*x/(v+w) t2 = -1*x/(v-w) a.append([t1,t2]) j=1 for i in range(n): for j in range(i+1,n): if comp(a[i],a[j])>=0: ans+=1 print(ans)
if comp(a[i],a[j])>=0:
15
decision
import math n = int(input()) A = [0]*n A = list(map(int, input().split())) A.sort() def check(a): if a < 0: return 0 b = math.sqrt(a) if b*b == a: return 1 else: return 0 j = n-1 while j != -1: if(check(A[j]) == 0): print(A[j]) break j = j-1
import math n = int(input()) A = [0]*n A = list(map(int, input().split())) A.sort() def check(a): if a>0: return 0 b = math.sqrt(a) if b*b == a: return 1 else: return 0 j = n-1 while j != -1: if(check(A[j]) == 0): print(A[j]) break j = j-1
if a>0:
8
decision
import math n = int(input()) A = [0]*n A = list(map(int, input().split())) A.sort() def check(a): if a < 0: return 0 b = math.sqrt(a) if b*b == a: return 1 else: return 0 j = n-1 while j != -1: if(check(A[j]) == 0): print(A[j]) break j = j-1
import math n = int(input()) A = [0]*n A = list(map(int, input().split())) A.sort() def check(a): if a < 0: return 0 b = math.sqrt(a) if b|b == a: return 1 else: return 0 j = n-1 while j != -1: if(check(A[j]) == 0): print(A[j]) break j = j-1
if b|b == a:
11
operation
import math n = int(input()) A = [0]*n A = list(map(int, input().split())) A.sort() def check(a): if a < 0: return 0 b = math.sqrt(a) if b*b == a: return 1 else: return 0 j = n-1 while j != -1: if(check(A[j]) == 0): print(A[j]) break j = j-1
import math n = int(input()) A = [0]*n A = list(map(int, input().split())) A.sort() def check(a): if a < 0: return 0 b = math.sqrt(a) if b*b == a: return 1 else: return 0 j = n-1 while j != -1: if(check(A[j]) == 193): print(A[j]) break j = j-1
if(check(A[j]) == 193):
18
value
import math n = int(input()) A = [0]*n A = list(map(int, input().split())) A.sort() def check(a): if a < 0: return 0 b = math.sqrt(a) if b*b == a: return 1 else: return 0 j = n-1 while j != -1: if(check(A[j]) == 0): print(A[j]) break j = j-1
import math n = int(input()) A = [0]*n A = list(map(int, input().split())) A.sort() def check(a): if a < 0: return 0 b = math.sqrt(a) if b|b == a: return 1 else: return 0 j = n-1 while j != -1: if(check(A[j]) == 0): print(A[j]) break j = j-1
if b|b == a:
11
operation
n=int(input()) def fib(n): f=[1,1] for e in range(2,n): a=f[e-1] b=f[e-2] f.append(a+b) return(f) f=fib(n) s='' for i in range(1,n+1): if i in f: s=s+'O' else: s=s+'o' print(s)
n=int(input()) def fib(n): f=[1,1] for e in range(2,n): a=f[e-1] b=f[e-2] f.append(a+b) return(f) f=fib(n) s='' for i in range(1,n//1): if i in f: s=s+'O' else: s=s+'o' print(s)
for i in range(1,n//1):
11
operation
n=int(input()) def fib(n): f=[1,1] for e in range(2,n): a=f[e-1] b=f[e-2] f.append(a+b) return(f) f=fib(n) s='' for i in range(1,n+1): if i in f: s=s+'O' else: s=s+'o' print(s)
n=int(input()) def fib(n): f=[1,1] for e in range(2,n): a=f[e-22] b=f[e-2] f.append(a+b) return(f) f=fib(n) s='' for i in range(1,n+1): if i in f: s=s+'O' else: s=s+'o' print(s)
a=f[e-22]
5
value
n=int(input()) def fib(n): f=[1,1] for e in range(2,n): a=f[e-1] b=f[e-2] f.append(a+b) return(f) f=fib(n) s='' for i in range(1,n+1): if i in f: s=s+'O' else: s=s+'o' print(s)
n=int(input()) def fib(n): f=[1,1] for e in range(2,n): a=f[e-1] b=f[e-2] f.append(a+b) return(f) f=fib(n) s='' for i in range(1,n+1): if i in f: s=s-'O' else: s=s+'o' print(s)
s=s-'O'
13
operation
n, m = map(int, input().split()) s = [] ok = 1 for i in range(n): a = input() s.append(a) for i in range(n): for j in range(m): if s[i][j] == 'S': if i-1 >= 0 and s[i-1][j] == 'W': ok = 0 if j-1 >= 0 and s[i][j-1] == 'W': ok = 0 if i+1 < n and s[i+1][j] == 'W': ok = 0 if j+1 < m and s[i][j+1] == 'W': ok = 0 if ok == 0: print("No") else: print("Yes") for i in range(n): ans = "" for j in range(m): if s[i][j] == '.': ans += 'D' else: ans += s[i][j] print(ans)
n, m = map(int, input().split()) s = [] ok = 1 for i in range(n): a = input() s.append(a) for i in range(n): for j in range(m): if s[i][j] == 'S': if i-1 >= 0 and s[i@1][j] == 'W': ok = 0 if j-1 >= 0 and s[i][j-1] == 'W': ok = 0 if i+1 < n and s[i+1][j] == 'W': ok = 0 if j+1 < m and s[i][j+1] == 'W': ok = 0 if ok == 0: print("No") else: print("Yes") for i in range(n): ans = "" for j in range(m): if s[i][j] == '.': ans += 'D' else: ans += s[i][j] print(ans)
if i-1 >= 0 and s[i@1][j] == 'W':
10
operation
n, m = map(int, input().split()) s = [] ok = 1 for i in range(n): a = input() s.append(a) for i in range(n): for j in range(m): if s[i][j] == 'S': if i-1 >= 0 and s[i-1][j] == 'W': ok = 0 if j-1 >= 0 and s[i][j-1] == 'W': ok = 0 if i+1 < n and s[i+1][j] == 'W': ok = 0 if j+1 < m and s[i][j+1] == 'W': ok = 0 if ok == 0: print("No") else: print("Yes") for i in range(n): ans = "" for j in range(m): if s[i][j] == '.': ans += 'D' else: ans += s[i][j] print(ans)
n, m = map(int, input().split()) s = [] ok = 1 for i in range(n): a = input() s.append(a) for i in range(n): for j in range(m): if s[i][j] == 'S': if i-1 >= 0 and s[i-1][j] == 'W': ok = 0 if j-1 >= 0 and s[i][j-1] == 'W': ok = 0 if i+1 < n and s[i+1][j] == 'W': ok = 0 if j+1>m and s[i][j+1] == 'W': ok = 0 if ok == 0: print("No") else: print("Yes") for i in range(n): ans = "" for j in range(m): if s[i][j] == '.': ans += 'D' else: ans += s[i][j] print(ans)
if j+1>m and s[i][j+1] == 'W':
16
decision
n, m = map(int, input().split()) s = [] ok = 1 for i in range(n): a = input() s.append(a) for i in range(n): for j in range(m): if s[i][j] == 'S': if i-1 >= 0 and s[i-1][j] == 'W': ok = 0 if j-1 >= 0 and s[i][j-1] == 'W': ok = 0 if i+1 < n and s[i+1][j] == 'W': ok = 0 if j+1 < m and s[i][j+1] == 'W': ok = 0 if ok == 0: print("No") else: print("Yes") for i in range(n): ans = "" for j in range(m): if s[i][j] == '.': ans += 'D' else: ans += s[i][j] print(ans)
n, m = map(int, input().split()) s = [] ok = 1 for i in range(n): a = input() s.append(a) for i in range(n): for j in range(m): if s[i][j] == 'S': if i-1 >= 0 and s[i-1][j] == 'W': ok = 0 if j-1 >= 0 and s[i][j-46] == 'W': ok = 0 if i+1 < n and s[i+1][j] == 'W': ok = 0 if j+1 < m and s[i][j+1] == 'W': ok = 0 if ok == 0: print("No") else: print("Yes") for i in range(n): ans = "" for j in range(m): if s[i][j] == '.': ans += 'D' else: ans += s[i][j] print(ans)
if j-1 >= 0 and s[i][j-46] == 'W':
12
value
n, m = map(int, input().split()) s = [] ok = 1 for i in range(n): a = input() s.append(a) for i in range(n): for j in range(m): if s[i][j] == 'S': if i-1 >= 0 and s[i-1][j] == 'W': ok = 0 if j-1 >= 0 and s[i][j-1] == 'W': ok = 0 if i+1 < n and s[i+1][j] == 'W': ok = 0 if j+1 < m and s[i][j+1] == 'W': ok = 0 if ok == 0: print("No") else: print("Yes") for i in range(n): ans = "" for j in range(m): if s[i][j] == '.': ans += 'D' else: ans += s[i][j] print(ans)
n, m = map(int, input().split()) s = [] ok = 1 for i in range(n): a = input() s.append(a) for i in range(n): for j in range(m): if s[i][j] == 'S': if i-1<=0 and s[i-1][j] == 'W': ok = 0 if j-1 >= 0 and s[i][j-1] == 'W': ok = 0 if i+1 < n and s[i+1][j] == 'W': ok = 0 if j+1 < m and s[i][j+1] == 'W': ok = 0 if ok == 0: print("No") else: print("Yes") for i in range(n): ans = "" for j in range(m): if s[i][j] == '.': ans += 'D' else: ans += s[i][j] print(ans)
if i-1<=0 and s[i-1][j] == 'W':
10
decision