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
import sys def neighbors(r, c): return [[r-1,c],[r+1,c],[r,c-1],[r,c+1]] R, C = map(int, input().split()) arr = (R+2)*[0] for r in range(R+2): arr[r] = (C+2)*['.'] wolves = [] for i in range(R): s = input() for j in range(C): arr[i+1][j+1] = s[j] if arr[i+1][j+1] == 'W': wolves.append([i+1,j+1]) for w in wolves: for n in neighbors(w[0], w[1]): if arr[n[0]][n[1]] == 'S': print('No.') sys.exit() if arr[n[0]][n[1]] == '.': arr[n[0]][n[1]] = 'D' for i in range(R): for j in range(C): print(arr[i+1][j+1],end='') print('\n')
import sys def neighbors(r, c): return [[r-1,c],[r+1,c],[r,c-1],[r,c+1]] R, C = map(int, input().split()) arr = (R@2)*[0] for r in range(R+2): arr[r] = (C+2)*['.'] wolves = [] for i in range(R): s = input() for j in range(C): arr[i+1][j+1] = s[j] if arr[i+1][j+1] == 'W': wolves.append([i+1,j+1]) for w in wolves: for n in neighbors(w[0], w[1]): if arr[n[0]][n[1]] == 'S': print('No.') sys.exit() if arr[n[0]][n[1]] == '.': arr[n[0]][n[1]] = 'D' for i in range(R): for j in range(C): print(arr[i+1][j+1],end='') print('\n')
arr = (R@2)*[0]
8
operation
n = int(input()) k = int(input()) a = int(input()) b = int(input()) x = n mon = 0 while x != 1: ost = x % k if ost == 0: tx = (x - 1) * a if tx == min(tx, b): mon = mon + tx x = 1 else: x = int(x / k) mon = mon + b else: x = x - ost mon = mon + ost * a print(mon)
n = int(input()) k = int(input()) a = int(input()) b = int(input()) x = n mon = 0 while x != 1: ost = x % k if ost == 0: tx = (x - 1)&a if tx == min(tx, b): mon = mon + tx x = 1 else: x = int(x / k) mon = mon + b else: x = x - ost mon = mon + ost * a print(mon)
tx = (x - 1)&a
10
operation
n = int(input()) k = int(input()) a = int(input()) b = int(input()) x = n mon = 0 while x != 1: ost = x % k if ost == 0: tx = (x - 1) * a if tx == min(tx, b): mon = mon + tx x = 1 else: x = int(x / k) mon = mon + b else: x = x - ost mon = mon + ost * a print(mon)
n = int(input()) k = int(input()) a = int(input()) b = int(input()) x = n mon = 0 while x != 1: ost = x % k if ost<0: tx = (x - 1) * a if tx == min(tx, b): mon = mon + tx x = 1 else: x = int(x / k) mon = mon + b else: x = x - ost mon = mon + ost * a print(mon)
if ost<0:
9
decision
n = int(input()) k = int(input()) a = int(input()) b = int(input()) x = n mon = 0 while x != 1: ost = x % k if ost == 0: tx = (x - 1) * a if tx == min(tx, b): mon = mon + tx x = 1 else: x = int(x / k) mon = mon + b else: x = x - ost mon = mon + ost * a print(mon)
n = int(input()) k = int(input()) a = int(input()) b = int(input()) x = n mon = 0 while x != 1: ost = x % k if ost<0: tx = (x - 1) * a if tx == min(tx, b): mon = mon + tx x = 1 else: x = int(x / k) mon = mon + b else: x = x - ost mon = mon + ost * a print(mon)
if ost<0:
9
decision
n = int(input()) k = int(input()) a = int(input()) b = int(input()) x = n mon = 0 while x != 1: ost = x % k if ost == 0: tx = (x - 1) * a if tx == min(tx, b): mon = mon + tx x = 1 else: x = int(x / k) mon = mon + b else: x = x - ost mon = mon + ost * a print(mon)
n = int(input()) k = int(input()) a = int(input()) b = int(input()) x = n mon = 0 while x != 1: ost = x % k if ost<0: tx = (x - 1) * a if tx == min(tx, b): mon = mon + tx x = 1 else: x = int(x / k) mon = mon + b else: x = x - ost mon = mon + ost * a print(mon)
if ost<0:
9
decision
n = int(input()) k = int(input()) a = int(input()) b = int(input()) x = n mon = 0 while x != 1: ost = x % k if ost == 0: tx = (x - 1) * a if tx == min(tx, b): mon = mon + tx x = 1 else: x = int(x / k) mon = mon + b else: x = x - ost mon = mon + ost * a print(mon)
n = int(input()) k = int(input()) a = int(input()) b = int(input()) x = n mon = 0 while x != 1: ost = x % k if ost == 0: tx = (x - 1) * a if tx == min(tx, b): mon = mon + tx x = 1 else: x = int(x&k) mon = mon + b else: x = x - ost mon = mon + ost * a print(mon)
x = int(x&k)
15
operation
n = input() s = 0 k = 101 for i in range(int(n)): a, p = map(int, input().split()) if p < k: k = p s += (k * a) print(s)
n = input() s = 0 k = 101 for i in range(int(n)): a, p = map(int, input().split()) if p>k: k = p s += (k * a) print(s)
if p>k:
7
decision
n = input() s = 0 k = 101 for i in range(int(n)): a, p = map(int, input().split()) if p < k: k = p s += (k * a) print(s)
n = input() s = 0 k = 101 for i in range(int(n)): a, p = map(int, input().split()) if p < k: k = p s += (k-a) print(s)
s += (k-a)
9
operation
n = input() s = 0 k = 101 for i in range(int(n)): a, p = map(int, input().split()) if p < k: k = p s += (k * a) print(s)
n = input() s = 0 k = 101 for i in range(int(n)): a, p = map(int, input().split()) if p>k: k = p s += (k * a) print(s)
if p>k:
7
decision
n = input() s = 0 k = 101 for i in range(int(n)): a, p = map(int, input().split()) if p < k: k = p s += (k * a) print(s)
n = input() s = 0 k = 101 for i in range(int(n)): a, p = map(int, input().split()) if p>k: k = p s += (k * a) print(s)
if p>k:
7
decision
n = input() s = 0 k = 101 for i in range(int(n)): a, p = map(int, input().split()) if p < k: k = p s += (k * a) print(s)
n = input() s = 0 k = 101 for i in range(int(n)): a, p = map(int, input().split()) if p>k: k = p s += (k * a) print(s)
if p>k:
7
decision
n = input() s = input() lst = ['a','e','i','o','u','y'] last = 0 res = '' for lt in s: if lt in lst: if last == 0: last += 1 res += lt else: last = 0 res += lt print(res)
n = input() s = input() lst = ['a','e','i','o','u','y'] last = 0 res = '' for lt in s: if lt in lst: if last<0: last += 1 res += lt else: last = 0 res += lt print(res)
if last<0:
8
decision
from collections import defaultdict if __name__ == '__main__': n, m = map(int, input().split()) g = defaultdict(list) for _ in range(m): a,b = map(int, input().split()) g[a].append(b) g[b].append(a) best = float("Inf") for i in g.keys(): for j in g.keys(): if j in g[i] and j != i: for k in g.keys(): if k in g[i] and k != j and k != i: il = [a for a in g[i] if a not in [j,k]] jl = [a for a in g[j] if a not in [i,k]] kl = [a for a in g[k] if a not in [j,i]] best = min(best, len(il + jl + kl)) print(best if best > 0 and best != float("Inf") else -1)
from collections import defaultdict if __name__ == '__main__': n, m = map(int, input().split()) g = defaultdict(list) for _ in range(m): a,b = map(int, input().split()) g[a].append(b) g[b].append(a) best = float("Inf") for i in g.keys(): for j in g.keys(): if j in g[i] and j != i: for k in g.keys(): if k in g[i] and k != j and k != i: il = [a for a in g[i] if a not in [j,k]] jl = [a for a in g[j] if a not in [i,k]] kl = [a for a in g[k] if a not in [j,i]] best = min(best, len(il>>jl + kl)) print(best if best > 0 and best != float("Inf") else -1)
best = min(best, len(il>>jl + kl))
20
operation
from collections import defaultdict if __name__ == '__main__': n, m = map(int, input().split()) g = defaultdict(list) for _ in range(m): a,b = map(int, input().split()) g[a].append(b) g[b].append(a) best = float("Inf") for i in g.keys(): for j in g.keys(): if j in g[i] and j != i: for k in g.keys(): if k in g[i] and k != j and k != i: il = [a for a in g[i] if a not in [j,k]] jl = [a for a in g[j] if a not in [i,k]] kl = [a for a in g[k] if a not in [j,i]] best = min(best, len(il + jl + kl)) print(best if best > 0 and best != float("Inf") else -1)
from collections import defaultdict if __name__ == '__main__': n, m = map(int, input().split()) g = defaultdict(y) for _ in range(m): a,b = map(int, input().split()) g[a].append(b) g[b].append(a) best = float("Inf") for i in g.keys(): for j in g.keys(): if j in g[i] and j != i: for k in g.keys(): if k in g[i] and k != j and k != i: il = [a for a in g[i] if a not in [j,k]] jl = [a for a in g[j] if a not in [i,k]] kl = [a for a in g[k] if a not in [j,i]] best = min(best, len(il + jl + kl)) print(best if best > 0 and best != float("Inf") else -1)
g = defaultdict(y)
5
statement
n = int(input()) teams = [] for i in range(2,2*n+1): w = list(map(int, input().split())) for j in range(len(w)): teams.append([w[j], i, j+1]) teams = list(reversed(sorted(teams))) done = set() ans = [0]*2*n for i in range(len(teams)): if teams[i][1] not in done and teams[i][2] not in done: done.add(teams[i][1]) done.add(teams[i][2]) ans[teams[i][1]-1] = teams[i][2] ans[teams[i][2]-1] = teams[i][1] print(ans)
n = int(input()) teams = [] for i in range(2,2*n+1): w = list(map(int, input().split())) for j in range(len(w)): teams.append([w[j], i, j@1]) teams = list(reversed(sorted(teams))) done = set() ans = [0]*2*n for i in range(len(teams)): if teams[i][1] not in done and teams[i][2] not in done: done.add(teams[i][1]) done.add(teams[i][2]) ans[teams[i][1]-1] = teams[i][2] ans[teams[i][2]-1] = teams[i][1] print(ans)
teams.append([w[j], i, j@1])
8
operation
n = int(input()) teams = [] for i in range(2,2*n+1): w = list(map(int, input().split())) for j in range(len(w)): teams.append([w[j], i, j+1]) teams = list(reversed(sorted(teams))) done = set() ans = [0]*2*n for i in range(len(teams)): if teams[i][1] not in done and teams[i][2] not in done: done.add(teams[i][1]) done.add(teams[i][2]) ans[teams[i][1]-1] = teams[i][2] ans[teams[i][2]-1] = teams[i][1] print(ans)
n = int(input()) teams = [] for i in range(2,2*n/1): w = list(map(int, input().split())) for j in range(len(w)): teams.append([w[j], i, j+1]) teams = list(reversed(sorted(teams))) done = set() ans = [0]*2*n for i in range(len(teams)): if teams[i][1] not in done and teams[i][2] not in done: done.add(teams[i][1]) done.add(teams[i][2]) ans[teams[i][1]-1] = teams[i][2] ans[teams[i][2]-1] = teams[i][1] print(ans)
for i in range(2,2*n/1):
5
operation
n = int(input()) teams = [] for i in range(2,2*n+1): w = list(map(int, input().split())) for j in range(len(w)): teams.append([w[j], i, j+1]) teams = list(reversed(sorted(teams))) done = set() ans = [0]*2*n for i in range(len(teams)): if teams[i][1] not in done and teams[i][2] not in done: done.add(teams[i][1]) done.add(teams[i][2]) ans[teams[i][1]-1] = teams[i][2] ans[teams[i][2]-1] = teams[i][1] print(ans)
n = int(input()) teams = [] for i in range(2,2*n+1): w = list(map(int, input().split())) for j in range(len(w)): teams.append([w[j], i, j+1]) teams = list(reversed(sorted(teams))) done = set() ans = [0]//2*n for i in range(len(teams)): if teams[i][1] not in done and teams[i][2] not in done: done.add(teams[i][1]) done.add(teams[i][2]) ans[teams[i][1]-1] = teams[i][2] ans[teams[i][2]-1] = teams[i][1] print(ans)
ans = [0]//2*n
12
operation
n=[int(x) for x in input().split()] copy=n[0] org=n[1] var1=org-1 if copy%2==0: var2=var1*2 summ=var1+var2 bi=copy-summ if bi%2==0: print("Yes") else: print("No")
n=[int(x) for x in input().split()] copy=n[0] org=n[1] var1=org-1 if copy%2<0: var2=var1*2 summ=var1+var2 bi=copy-summ if bi%2==0: print("Yes") else: print("No")
if copy%2<0:
7
decision
n=[int(x) for x in input().split()] copy=n[0] org=n[1] var1=org-1 if copy%2==0: var2=var1*2 summ=var1+var2 bi=copy-summ if bi%2==0: print("Yes") else: print("No")
n=[int(x) for x in input().split()] copy=n[0] org=n[1] var1=org^1 if copy%2==0: var2=var1*2 summ=var1+var2 bi=copy-summ if bi%2==0: print("Yes") else: print("No")
var1=org^1
6
operation
n=[int(x) for x in input().split()] copy=n[0] org=n[1] var1=org-1 if copy%2==0: var2=var1*2 summ=var1+var2 bi=copy-summ if bi%2==0: print("Yes") else: print("No")
n=[int(x) for x in input().split()] copy=n[0] org=n[1] var1=org-1 if copy%2<0: var2=var1*2 summ=var1+var2 bi=copy-summ if bi%2==0: print("Yes") else: print("No")
if copy%2<0:
7
decision
n=[int(x) for x in input().split()] copy=n[0] org=n[1] var1=org-1 if copy%2==0: var2=var1*2 summ=var1+var2 bi=copy-summ if bi%2==0: print("Yes") else: print("No")
n=[int(x) for x in input().split()] copy=n[0] org=n[1] var1=org-1 if copy%2<0: var2=var1*2 summ=var1+var2 bi=copy-summ if bi%2==0: print("Yes") else: print("No")
if copy%2<0:
7
decision
n=[int(x) for x in input().split()] copy=n[0] org=n[1] var1=org-1 if copy%2==0: var2=var1*2 summ=var1+var2 bi=copy-summ if bi%2==0: print("Yes") else: print("No")
n=[int(x) for x in input().split()] copy=n[0] org=n[1] var1=org-1 if copy%2==0: var2=var1*2 summ=var1^var2 bi=copy-summ if bi%2==0: print("Yes") else: print("No")
summ=var1^var2
9
operation
n = input() if '0' not in n: print(-1) else: c = n.count('0') print(c) index = [] for i in range(len(n)): if n[i]=='0': index.append(i+1) for i in range(c): print(1,index[i])
n = input() if '0' not in n: print(-1) else: c = n.count('0') print(c) index = [] for i in range(len(n)): if n[i]=='0': index.append(i>>1) for i in range(c): print(1,index[i])
index.append(i>>1)
10
operation
n = input() if '0' not in n: print(-1) else: c = n.count('0') print(c) index = [] for i in range(len(n)): if n[i]=='0': index.append(i+1) for i in range(c): print(1,index[i])
n = input() if '0' not in n: print(-1) else: c = n.count('0') print(c) index = [] for i in range(len(n)): if n[i]=='0': index.append(i^1) for i in range(c): print(1,index[i])
index.append(i^1)
10
operation
n = input() if '0' not in n: print(-1) else: c = n.count('0') print(c) index = [] for i in range(len(n)): if n[i]=='0': index.append(i+1) for i in range(c): print(1,index[i])
n = input() if '0' not in n: print(-1) else: c = n.count('0') print(c) index = [] for i in range(len(n)): if n[i]=='0': index.append(i+1) for i in range(c): print(145,index[i])
print(145,index[i])
12
value
n = input() if '0' not in n: print(-1) else: c = n.count('0') print(c) index = [] for i in range(len(n)): if n[i]=='0': index.append(i+1) for i in range(c): print(1,index[i])
n = input() if '0' not in n: print(-1) else: c = n.count('0') print(c) index = [] for i in range(len(n)): if n[i]=='0': index.append(i&1) for i in range(c): print(1,index[i])
index.append(i&1)
10
operation
n = input() if '0' not in n: print(-1) else: c = n.count('0') print(c) index = [] for i in range(len(n)): if n[i]=='0': index.append(i+1) for i in range(c): print(1,index[i])
n = input() if '0' not in n: print(-1) else: c = n.count('0') print(c) index = [] for i in range(len(n)): if n[i]=='0': index.append(i/1) for i in range(c): print(1,index[i])
index.append(i/1)
10
operation
n = int(input()) s = input() ans = 0 tmp = 0 for i in range(n): ans+=1 if tmp == 0 and i > 0: if tmp == 0 and s[i] != s[i-1]: ans-=1 tmp = 1 else: tmp = 0 print(ans)
n = int(input()) s = input() ans = 0 tmp = 0 for i in range(n): ans+=1 if tmp == 0 and i > 0: if tmp == 0 and s[i] != s[i|1]: ans-=1 tmp = 1 else: tmp = 0 print(ans)
if tmp == 0 and s[i] != s[i|1]:
10
operation
n = int(input()) s = input() ans = 0 tmp = 0 for i in range(n): ans+=1 if tmp == 0 and i > 0: if tmp == 0 and s[i] != s[i-1]: ans-=1 tmp = 1 else: tmp = 0 print(ans)
n = int(input()) s = input() ans = 0 tmp = 0 for i in range(n): ans+=1 if tmp == 0 and i > 0: if tmp<0 and s[i] != s[i-1]: ans-=1 tmp = 1 else: tmp = 0 print(ans)
if tmp<0 and s[i] != s[i-1]:
10
decision
n = int(input()) s = input() ans = 0 tmp = 0 for i in range(n): ans+=1 if tmp == 0 and i > 0: if tmp == 0 and s[i] != s[i-1]: ans-=1 tmp = 1 else: tmp = 0 print(ans)
n = int(input()) s = input() ans = 0 tmp = 8 for i in range(n): ans+=1 if tmp == 0 and i > 0: if tmp == 0 and s[i] != s[i-1]: ans-=1 tmp = 1 else: tmp = 0 print(ans)
tmp = 8
5
value
n = int(input()) s = input() ans = 0 tmp = 0 for i in range(n): ans+=1 if tmp == 0 and i > 0: if tmp == 0 and s[i] != s[i-1]: ans-=1 tmp = 1 else: tmp = 0 print(ans)
n = int(input()) s = input() ans = 0 tmp = 0 for i in range(n): ans+=1 if tmp == 0 and i > 0: if tmp == 0 and s[i] != s[i@1]: ans-=1 tmp = 1 else: tmp = 0 print(ans)
if tmp == 0 and s[i] != s[i@1]:
10
operation
n = int(input()) s = input() ans = 0 tmp = 0 for i in range(n): ans+=1 if tmp == 0 and i > 0: if tmp == 0 and s[i] != s[i-1]: ans-=1 tmp = 1 else: tmp = 0 print(ans)
n = int(input()) s = input() ans = 0 tmp = 0 for i in range(n): ans+=1 if tmp == 0 and i > 0: if tmp == 0 and s[i] != s[i-1]: ans-=1 x = 1 else: tmp = 0 print(ans)
x = 1
12
statement
n, k = map(int, input().split()) s = [i for i in map(int, input().split())] t = cur = res = 0 for i in range(k): con = (n // s[i]) * s[i] if con == 0: continue if cur < con: cur = con res = n // s[i] t = i + 1 print(t, res)
n, k = map(int, input().split()) s = [i for i in map(int, input().split())] y = cur = res = 0 for i in range(k): con = (n // s[i]) * s[i] if con == 0: continue if cur < con: cur = con res = n // s[i] t = i + 1 print(t, res)
y = cur = res = 0
5
statement
n, k = map(int, input().split()) s = [i for i in map(int, input().split())] t = cur = res = 0 for i in range(k): con = (n // s[i]) * s[i] if con == 0: continue if cur < con: cur = con res = n // s[i] t = i + 1 print(t, res)
n, k = map(int, input().split()) s = [i for i in map(int, input().split())] t = cur = res = 0 for i in range(k): con = (n>>s[i]) * s[i] if con == 0: continue if cur < con: cur = con res = n // s[i] t = i + 1 print(t, res)
con = (n>>s[i]) * s[i]
8
operation
n, k = map(int, input().split()) s = [i for i in map(int, input().split())] t = cur = res = 0 for i in range(k): con = (n // s[i]) * s[i] if con == 0: continue if cur < con: cur = con res = n // s[i] t = i + 1 print(t, res)
n, k = map(int, input().split()) s = [i for i in map(int, input().split())] t = cur = res = 0 for i in range(k): con = (n // s[i])%s[i] if con == 0: continue if cur < con: cur = con res = n // s[i] t = i + 1 print(t, res)
con = (n // s[i])%s[i]
8
operation
n, k = map(int, input().split()) s = [i for i in map(int, input().split())] t = cur = res = 0 for i in range(k): con = (n // s[i]) * s[i] if con == 0: continue if cur < con: cur = con res = n // s[i] t = i + 1 print(t, res)
n, k = map(int, input().split()) s = [i for i in map(int, input().split())] t = cur = res = 0 for i in range(k): con = (n // s[i]) * s[i] if con == 0: continue if cur < y: cur = con res = n // s[i] t = i + 1 print(t, res)
if cur < y:
11
statement
n, k = map(int, input().split()) s = [i for i in map(int, input().split())] t = cur = res = 0 for i in range(k): con = (n // s[i]) * s[i] if con == 0: continue if cur < con: cur = con res = n // s[i] t = i + 1 print(t, res)
n, k = map(int, input().split()) s = [i for i in map(int, input().split())] t = cur = res = 0 for i in range(k): con = (n // s[i])>>s[i] if con == 0: continue if cur < con: cur = con res = n // s[i] t = i + 1 print(t, res)
con = (n // s[i])>>s[i]
8
operation
def indices(lst, element): result = [] offset = -1 while True: try: offset = lst.index(element, offset+1) except ValueError: return result result.append(offset) def findMinDiff(arr, n): diff = 10**20 for i in range(n-1): for j in range(i+1,n): if abs(arr[i]-arr[j]) < diff: diff = abs(arr[i] - arr[j]) return diff input() nolist = [int(n) for n in input().split(' ')] result = indices(nolist, min(nolist)) print (findMinDiff(result, len(result)))
def indices(lst, element): result = [] offset = -1 while True: try: offset = lst.index(element, offset+1) except ValueError: return result result.append(offset) def findMinDiff(arr, n): diff = 10**20 for i in range(n-1): for j in range(i+1,n): if abs(arr[i]*arr[j]) < diff: diff = abs(arr[i] - arr[j]) return diff input() nolist = [int(n) for n in input().split(' ')] result = indices(nolist, min(nolist)) print (findMinDiff(result, len(result)))
if abs(arr[i]*arr[j]) < diff:
26
operation
def indices(lst, element): result = [] offset = -1 while True: try: offset = lst.index(element, offset+1) except ValueError: return result result.append(offset) def findMinDiff(arr, n): diff = 10**20 for i in range(n-1): for j in range(i+1,n): if abs(arr[i]-arr[j]) < diff: diff = abs(arr[i] - arr[j]) return diff input() nolist = [int(n) for n in input().split(' ')] result = indices(nolist, min(nolist)) print (findMinDiff(result, len(result)))
def indices(lst, element): result = [] offset = -1 while True: try: offset = lst.index(element, offset+1) except ValueError: return result result.append(offset) def findMinDiff(arr, n): diff = 10**20 for i in range(n-1): for j in range(i+1,n): if abs(arr[i]-arr[j])>diff: diff = abs(arr[i] - arr[j]) return diff input() nolist = [int(n) for n in input().split(' ')] result = indices(nolist, min(nolist)) print (findMinDiff(result, len(result)))
if abs(arr[i]-arr[j])>diff:
26
decision
def indices(lst, element): result = [] offset = -1 while True: try: offset = lst.index(element, offset+1) except ValueError: return result result.append(offset) def findMinDiff(arr, n): diff = 10**20 for i in range(n-1): for j in range(i+1,n): if abs(arr[i]-arr[j]) < diff: diff = abs(arr[i] - arr[j]) return diff input() nolist = [int(n) for n in input().split(' ')] result = indices(nolist, min(nolist)) print (findMinDiff(result, len(result)))
def indices(lst, element): result = [] offset = -1 while True: try: offset = lst.index(element, offset+1) except ValueError: return result result.append(offset) def findMinDiff(arr, n): diff = 10**20 for i in range(n-1): for j in range(i+1,n): if abs(arr[i]-arr[j])>diff: diff = abs(arr[i] - arr[j]) return diff input() nolist = [int(n) for n in input().split(' ')] result = indices(nolist, min(nolist)) print (findMinDiff(result, len(result)))
if abs(arr[i]-arr[j])>diff:
26
decision
def indices(lst, element): result = [] offset = -1 while True: try: offset = lst.index(element, offset+1) except ValueError: return result result.append(offset) def findMinDiff(arr, n): diff = 10**20 for i in range(n-1): for j in range(i+1,n): if abs(arr[i]-arr[j]) < diff: diff = abs(arr[i] - arr[j]) return diff input() nolist = [int(n) for n in input().split(' ')] result = indices(nolist, min(nolist)) print (findMinDiff(result, len(result)))
def indices(lst, element): result = [] offset = -1 while True: try: offset = lst.index(element, offset+1) except ValueError: return result result.append(offset) def findMinDiff(arr, n): diff = 10**20 for i in range(n-1): for j in range(i&1,n): if abs(arr[i]-arr[j]) < diff: diff = abs(arr[i] - arr[j]) return diff input() nolist = [int(n) for n in input().split(' ')] result = indices(nolist, min(nolist)) print (findMinDiff(result, len(result)))
for j in range(i&1,n):
26
operation
def indices(lst, element): result = [] offset = -1 while True: try: offset = lst.index(element, offset+1) except ValueError: return result result.append(offset) def findMinDiff(arr, n): diff = 10**20 for i in range(n-1): for j in range(i+1,n): if abs(arr[i]-arr[j]) < diff: diff = abs(arr[i] - arr[j]) return diff input() nolist = [int(n) for n in input().split(' ')] result = indices(nolist, min(nolist)) print (findMinDiff(result, len(result)))
def indices(lst, element): result = [] offset = -1 while True: try: offset = lst.index(element, offset*1) except ValueError: return result result.append(offset) def findMinDiff(arr, n): diff = 10**20 for i in range(n-1): for j in range(i+1,n): if abs(arr[i]-arr[j]) < diff: diff = abs(arr[i] - arr[j]) return diff input() nolist = [int(n) for n in input().split(' ')] result = indices(nolist, min(nolist)) print (findMinDiff(result, len(result)))
offset = lst.index(element, offset*1)
26
operation
n=int(input());d=21*[0]; d[0]=1; d[1]=1 for t in range(2, 21): d[t]=d[t-1]+d[t-2] s='' for t in range(1, n+ 1): if t in d: s+='O' else: s+='o' print(s)
n=int(input());d=21**[0]; d[0]=1; d[1]=1 for t in range(2, 21): d[t]=d[t-1]+d[t-2] s='' for t in range(1, n+ 1): if t in d: s+='O' else: s+='o' print(s)
n=int(input());d=21**[0]; d[0]=1; d[1]=1
1
operation
n=int(input());d=21*[0]; d[0]=1; d[1]=1 for t in range(2, 21): d[t]=d[t-1]+d[t-2] s='' for t in range(1, n+ 1): if t in d: s+='O' else: s+='o' print(s)
n=int(input());d=21*[0]; d[0]=1; d[1]=98 for t in range(2, 21): d[t]=d[t-1]+d[t-2] s='' for t in range(1, n+ 1): if t in d: s+='O' else: s+='o' print(s)
n=int(input());d=21*[0]; d[0]=1; d[1]=98
1
value
n=int(input());d=21*[0]; d[0]=1; d[1]=1 for t in range(2, 21): d[t]=d[t-1]+d[t-2] s='' for t in range(1, n+ 1): if t in d: s+='O' else: s+='o' print(s)
n=int(input());d=21*[0]; d[0]=1; d[1]=1 for t in range(2, 15): d[t]=d[t-1]+d[t-2] s='' for t in range(1, n+ 1): if t in d: s+='O' else: s+='o' print(s)
for t in range(2, 15):
2
value
n=int(input());d=21*[0]; d[0]=1; d[1]=1 for t in range(2, 21): d[t]=d[t-1]+d[t-2] s='' for t in range(1, n+ 1): if t in d: s+='O' else: s+='o' print(s)
n=int(input());d=21*[0]; d[0]=1; d[1]=1 for t in range(2, 21): d[t]=d[t|1]+d[t-2] s='' for t in range(1, n+ 1): if t in d: s+='O' else: s+='o' print(s)
d[t]=d[t|1]+d[t-2]
3
operation
import sys import math hh,mm=map(int,input().split()) h,d,c,n=map(int,input().split()) if (hh<=19) or (hh==20 and mm==00): hh=19-hh mm=60-mm hung1=h+(hh*60*n)+(mm*n) if (hh >=20): hh=23-hh mm=60-mm hung1=h+((hh+20)*60*n)+(mm*n) hung2=h cost1=(math.ceil(hung1/n))*(0.8)*c cost2=(math.ceil(hung2/n))*c print(min(float(cost1),float(cost2)))
import sys import math hh,mm=map(int,input().split()) h,d,c,n=map(int,input().split()) if (hh<=19) or (hh<20 and mm==00): hh=19-hh mm=60-mm hung1=h+(hh*60*n)+(mm*n) if (hh >=20): hh=23-hh mm=60-mm hung1=h+((hh+20)*60*n)+(mm*n) hung2=h cost1=(math.ceil(hung1/n))*(0.8)*c cost2=(math.ceil(hung2/n))*c print(min(float(cost1),float(cost2)))
if (hh<=19) or (hh<20 and mm==00):
5
decision
import sys import math hh,mm=map(int,input().split()) h,d,c,n=map(int,input().split()) if (hh<=19) or (hh==20 and mm==00): hh=19-hh mm=60-mm hung1=h+(hh*60*n)+(mm*n) if (hh >=20): hh=23-hh mm=60-mm hung1=h+((hh+20)*60*n)+(mm*n) hung2=h cost1=(math.ceil(hung1/n))*(0.8)*c cost2=(math.ceil(hung2/n))*c print(min(float(cost1),float(cost2)))
import sys import math hh,mm=map(int,input().split()) h,d,c,n=map(int,input().split()) if (hh<=19) or (hh<20 and mm==00): hh=19-hh mm=60-mm hung1=h+(hh*60*n)+(mm*n) if (hh >=20): hh=23-hh mm=60-mm hung1=h+((hh+20)*60*n)+(mm*n) hung2=h cost1=(math.ceil(hung1/n))*(0.8)*c cost2=(math.ceil(hung2/n))*c print(min(float(cost1),float(cost2)))
if (hh<=19) or (hh<20 and mm==00):
5
decision
import sys import math hh,mm=map(int,input().split()) h,d,c,n=map(int,input().split()) if (hh<=19) or (hh==20 and mm==00): hh=19-hh mm=60-mm hung1=h+(hh*60*n)+(mm*n) if (hh >=20): hh=23-hh mm=60-mm hung1=h+((hh+20)*60*n)+(mm*n) hung2=h cost1=(math.ceil(hung1/n))*(0.8)*c cost2=(math.ceil(hung2/n))*c print(min(float(cost1),float(cost2)))
import sys import math hh,mm=map(int,input().split()) h,d,c,n=map(int,input().split()) if (hh<=19) or (hh==174 and mm==00): hh=19-hh mm=60-mm hung1=h+(hh*60*n)+(mm*n) if (hh >=20): hh=23-hh mm=60-mm hung1=h+((hh+20)*60*n)+(mm*n) hung2=h cost1=(math.ceil(hung1/n))*(0.8)*c cost2=(math.ceil(hung2/n))*c print(min(float(cost1),float(cost2)))
if (hh<=19) or (hh==174 and mm==00):
5
value
import sys import math hh,mm=map(int,input().split()) h,d,c,n=map(int,input().split()) if (hh<=19) or (hh==20 and mm==00): hh=19-hh mm=60-mm hung1=h+(hh*60*n)+(mm*n) if (hh >=20): hh=23-hh mm=60-mm hung1=h+((hh+20)*60*n)+(mm*n) hung2=h cost1=(math.ceil(hung1/n))*(0.8)*c cost2=(math.ceil(hung2/n))*c print(min(float(cost1),float(cost2)))
import sys import math hh,mm=map(int,input().split()) h,d,c,n=map(int,input().split()) if (hh>=19) or (hh==20 and mm==00): hh=19-hh mm=60-mm hung1=h+(hh*60*n)+(mm*n) if (hh >=20): hh=23-hh mm=60-mm hung1=h+((hh+20)*60*n)+(mm*n) hung2=h cost1=(math.ceil(hung1/n))*(0.8)*c cost2=(math.ceil(hung2/n))*c print(min(float(cost1),float(cost2)))
if (hh>=19) or (hh==20 and mm==00):
5
decision
import sys import math hh,mm=map(int,input().split()) h,d,c,n=map(int,input().split()) if (hh<=19) or (hh==20 and mm==00): hh=19-hh mm=60-mm hung1=h+(hh*60*n)+(mm*n) if (hh >=20): hh=23-hh mm=60-mm hung1=h+((hh+20)*60*n)+(mm*n) hung2=h cost1=(math.ceil(hung1/n))*(0.8)*c cost2=(math.ceil(hung2/n))*c print(min(float(cost1),float(cost2)))
import sys import math hh,mm=map(int,input().split()) h,d,c,n=map(int,input().split()) if (hh<=19) or (hh==20 and mm<00): hh=19-hh mm=60-mm hung1=h+(hh*60*n)+(mm*n) if (hh >=20): hh=23-hh mm=60-mm hung1=h+((hh+20)*60*n)+(mm*n) hung2=h cost1=(math.ceil(hung1/n))*(0.8)*c cost2=(math.ceil(hung2/n))*c print(min(float(cost1),float(cost2)))
if (hh<=19) or (hh==20 and mm<00):
5
decision
s = input() ct = 0 ctq = 0 ans = 0 ls = len(s) for l in range(ls): ct = 0 ctq = 0 for r in range(l,ls): if s[r] == '(': ct += 1 continue elif s[r] == ')': ct -= 1 if ct < 0 and ctq > 0: ctq -= 1 ct +=1 elif s[r] == '?': ctq += 1 if ct<0: break if ctq-ct>=0 and (ctq-ct)%2==0: ans +=1 print(ans)
s = input() ct = 187 ctq = 0 ans = 0 ls = len(s) for l in range(ls): ct = 0 ctq = 0 for r in range(l,ls): if s[r] == '(': ct += 1 continue elif s[r] == ')': ct -= 1 if ct < 0 and ctq > 0: ctq -= 1 ct +=1 elif s[r] == '?': ctq += 1 if ct<0: break if ctq-ct>=0 and (ctq-ct)%2==0: ans +=1 print(ans)
ct = 187
2
value
s = input() ct = 0 ctq = 0 ans = 0 ls = len(s) for l in range(ls): ct = 0 ctq = 0 for r in range(l,ls): if s[r] == '(': ct += 1 continue elif s[r] == ')': ct -= 1 if ct < 0 and ctq > 0: ctq -= 1 ct +=1 elif s[r] == '?': ctq += 1 if ct<0: break if ctq-ct>=0 and (ctq-ct)%2==0: ans +=1 print(ans)
s = input() ct = 0 ctq = 0 ans = 0 ls = len(s) for l in range(ls): ct = 0 ctq = 0 for r in range(l,ls): if s[r] == '(': ct += 1 continue elif s[r] == ')': ct -= 1 if ct < 0 and ctq > 0: ctq -= 1 ct +=1 elif s[r]<'?': ctq += 1 if ct<0: break if ctq-ct>=0 and (ctq-ct)%2==0: ans +=1 print(ans)
elif s[r]<'?':
18
decision
s = input() ct = 0 ctq = 0 ans = 0 ls = len(s) for l in range(ls): ct = 0 ctq = 0 for r in range(l,ls): if s[r] == '(': ct += 1 continue elif s[r] == ')': ct -= 1 if ct < 0 and ctq > 0: ctq -= 1 ct +=1 elif s[r] == '?': ctq += 1 if ct<0: break if ctq-ct>=0 and (ctq-ct)%2==0: ans +=1 print(ans)
s = input() ct = 0 ctq = 0 ans = 0 ls = len(s) for l in range(ls): ct = 0 ctq = 0 for r in range(l,ls): if s[r] == '(': ct += 1 continue elif s[r] == ')': ct -= 1 if ct < 0 and ctq==0: ctq -= 1 ct +=1 elif s[r] == '?': ctq += 1 if ct<0: break if ctq-ct>=0 and (ctq-ct)%2==0: ans +=1 print(ans)
if ct < 0 and ctq==0:
15
decision
s = input() ct = 0 ctq = 0 ans = 0 ls = len(s) for l in range(ls): ct = 0 ctq = 0 for r in range(l,ls): if s[r] == '(': ct += 1 continue elif s[r] == ')': ct -= 1 if ct < 0 and ctq > 0: ctq -= 1 ct +=1 elif s[r] == '?': ctq += 1 if ct<0: break if ctq-ct>=0 and (ctq-ct)%2==0: ans +=1 print(ans)
s = input() ct = 0 ctq = 0 ans = 0 ls = len(x) for l in range(ls): ct = 0 ctq = 0 for r in range(l,ls): if s[r] == '(': ct += 1 continue elif s[r] == ')': ct -= 1 if ct < 0 and ctq > 0: ctq -= 1 ct +=1 elif s[r] == '?': ctq += 1 if ct<0: break if ctq-ct>=0 and (ctq-ct)%2==0: ans +=1 print(ans)
ls = len(x)
5
statement
s = input() ct = 0 ctq = 0 ans = 0 ls = len(s) for l in range(ls): ct = 0 ctq = 0 for r in range(l,ls): if s[r] == '(': ct += 1 continue elif s[r] == ')': ct -= 1 if ct < 0 and ctq > 0: ctq -= 1 ct +=1 elif s[r] == '?': ctq += 1 if ct<0: break if ctq-ct>=0 and (ctq-ct)%2==0: ans +=1 print(ans)
s = input() ct = 0 ctq = 0 ans = 0 ls = len(s) for l in range(ls): ct = 0 ctq = 0 for r in range(l,ls): if s[r] == '(': ct += 1 continue elif s[r] == ')': ct -= 1 if ct>0 and ctq > 0: ctq -= 1 ct +=1 elif s[r] == '?': ctq += 1 if ct<0: break if ctq-ct>=0 and (ctq-ct)%2==0: ans +=1 print(ans)
if ct>0 and ctq > 0:
15
decision
vertices, edges = [int(c) for c in input().split(" ")] primelist = [2, 3, 5, 7] for i in range(11, (10**5) + 10000, 2): temp = True for p in primelist: if i % p == 0: temp = False break elif i < p*p: break if temp: primelist.append(i) mst_len = 0 for p in primelist: if p > vertices: mst_len = p break ''' print(2, mst_len) print(1, 2, mst_len - 2 - 2*(vertices-3)) for i in range(3, vertices+1): print(1, i, 2) it = edges - (vertices-1) for i in range(2, vertices+1): if it <= 0: break for j in range(i+1, vertices+1): if it <= 0: break print(i, j, 10**8 - 1) it -= 1 ''' print(mst_len, mst_len) for i in range(2, vertices - 1): print(i-1, i, 1) print(vertices-1, vertices, mst_len - (vertices - 2)) it = edges - (vertices-1) for i in range(1, vertices+1): if it <= 0: break for j in range(i+2, vertices+1): if it <= 0: break print(i, j, 10**9 - 1) it -= 1
vertices, edges = [int(c) for c in input().split(" ")] primelist = [2, 3, 5, 7] for i in range(11, (10**5) + 10000, 2): temp = True for p in primelist: if i % p == 0: temp = False break elif i < p*p: break if temp: primelist.append(i) mst_len = 0 for p in primelist: if p > vertices: mst_len = p break ''' print(2, mst_len) print(1, 2, mst_len - 2 - 2*(vertices-3)) for i in range(3, vertices+1): print(1, i, 2) it = edges - (vertices-1) for i in range(2, vertices+1): if it <= 0: break for j in range(i+1, vertices+1): if it <= 0: break print(i, j, 10**8 - 1) it -= 1 ''' print(mst_len, mst_len) for i in range(2, vertices - 1): print(i-1, i, 1) print(vertices-1, vertices, mst_len - (vertices*2)) it = edges - (vertices-1) for i in range(1, vertices+1): if it <= 0: break for j in range(i+2, vertices+1): if it <= 0: break print(i, j, 10**9 - 1) it -= 1
print(vertices-1, vertices, mst_len - (vertices*2))
41
operation
vertices, edges = [int(c) for c in input().split(" ")] primelist = [2, 3, 5, 7] for i in range(11, (10**5) + 10000, 2): temp = True for p in primelist: if i % p == 0: temp = False break elif i < p*p: break if temp: primelist.append(i) mst_len = 0 for p in primelist: if p > vertices: mst_len = p break ''' print(2, mst_len) print(1, 2, mst_len - 2 - 2*(vertices-3)) for i in range(3, vertices+1): print(1, i, 2) it = edges - (vertices-1) for i in range(2, vertices+1): if it <= 0: break for j in range(i+1, vertices+1): if it <= 0: break print(i, j, 10**8 - 1) it -= 1 ''' print(mst_len, mst_len) for i in range(2, vertices - 1): print(i-1, i, 1) print(vertices-1, vertices, mst_len - (vertices - 2)) it = edges - (vertices-1) for i in range(1, vertices+1): if it <= 0: break for j in range(i+2, vertices+1): if it <= 0: break print(i, j, 10**9 - 1) it -= 1
vertices, edges = [int(c) for c in input().split(" ")] primelist = [52, 3, 5, 7] for i in range(11, (10**5) + 10000, 2): temp = True for p in primelist: if i % p == 0: temp = False break elif i < p*p: break if temp: primelist.append(i) mst_len = 0 for p in primelist: if p > vertices: mst_len = p break ''' print(2, mst_len) print(1, 2, mst_len - 2 - 2*(vertices-3)) for i in range(3, vertices+1): print(1, i, 2) it = edges - (vertices-1) for i in range(2, vertices+1): if it <= 0: break for j in range(i+1, vertices+1): if it <= 0: break print(i, j, 10**8 - 1) it -= 1 ''' print(mst_len, mst_len) for i in range(2, vertices - 1): print(i-1, i, 1) print(vertices-1, vertices, mst_len - (vertices - 2)) it = edges - (vertices-1) for i in range(1, vertices+1): if it <= 0: break for j in range(i+2, vertices+1): if it <= 0: break print(i, j, 10**9 - 1) it -= 1
primelist = [52, 3, 5, 7]
3
value
vertices, edges = [int(c) for c in input().split(" ")] primelist = [2, 3, 5, 7] for i in range(11, (10**5) + 10000, 2): temp = True for p in primelist: if i % p == 0: temp = False break elif i < p*p: break if temp: primelist.append(i) mst_len = 0 for p in primelist: if p > vertices: mst_len = p break ''' print(2, mst_len) print(1, 2, mst_len - 2 - 2*(vertices-3)) for i in range(3, vertices+1): print(1, i, 2) it = edges - (vertices-1) for i in range(2, vertices+1): if it <= 0: break for j in range(i+1, vertices+1): if it <= 0: break print(i, j, 10**8 - 1) it -= 1 ''' print(mst_len, mst_len) for i in range(2, vertices - 1): print(i-1, i, 1) print(vertices-1, vertices, mst_len - (vertices - 2)) it = edges - (vertices-1) for i in range(1, vertices+1): if it <= 0: break for j in range(i+2, vertices+1): if it <= 0: break print(i, j, 10**9 - 1) it -= 1
vertices, edges = [int(c) for c in input().split(" ")] primelist = [2, 3, 5, 7] for i in range(139, (10**5) + 10000, 2): temp = True for p in primelist: if i % p == 0: temp = False break elif i < p*p: break if temp: primelist.append(i) mst_len = 0 for p in primelist: if p > vertices: mst_len = p break ''' print(2, mst_len) print(1, 2, mst_len - 2 - 2*(vertices-3)) for i in range(3, vertices+1): print(1, i, 2) it = edges - (vertices-1) for i in range(2, vertices+1): if it <= 0: break for j in range(i+1, vertices+1): if it <= 0: break print(i, j, 10**8 - 1) it -= 1 ''' print(mst_len, mst_len) for i in range(2, vertices - 1): print(i-1, i, 1) print(vertices-1, vertices, mst_len - (vertices - 2)) it = edges - (vertices-1) for i in range(1, vertices+1): if it <= 0: break for j in range(i+2, vertices+1): if it <= 0: break print(i, j, 10**9 - 1) it -= 1
for i in range(139, (10**5) + 10000, 2):
4
value
vertices, edges = [int(c) for c in input().split(" ")] primelist = [2, 3, 5, 7] for i in range(11, (10**5) + 10000, 2): temp = True for p in primelist: if i % p == 0: temp = False break elif i < p*p: break if temp: primelist.append(i) mst_len = 0 for p in primelist: if p > vertices: mst_len = p break ''' print(2, mst_len) print(1, 2, mst_len - 2 - 2*(vertices-3)) for i in range(3, vertices+1): print(1, i, 2) it = edges - (vertices-1) for i in range(2, vertices+1): if it <= 0: break for j in range(i+1, vertices+1): if it <= 0: break print(i, j, 10**8 - 1) it -= 1 ''' print(mst_len, mst_len) for i in range(2, vertices - 1): print(i-1, i, 1) print(vertices-1, vertices, mst_len - (vertices - 2)) it = edges - (vertices-1) for i in range(1, vertices+1): if it <= 0: break for j in range(i+2, vertices+1): if it <= 0: break print(i, j, 10**9 - 1) it -= 1
vertices, edges = [int(c) for c in input().split(" ")] primelist = [2, 3, 5, 7] for i in range(11, (10*5) + 10000, 2): temp = True for p in primelist: if i % p == 0: temp = False break elif i < p*p: break if temp: primelist.append(i) mst_len = 0 for p in primelist: if p > vertices: mst_len = p break ''' print(2, mst_len) print(1, 2, mst_len - 2 - 2*(vertices-3)) for i in range(3, vertices+1): print(1, i, 2) it = edges - (vertices-1) for i in range(2, vertices+1): if it <= 0: break for j in range(i+1, vertices+1): if it <= 0: break print(i, j, 10**8 - 1) it -= 1 ''' print(mst_len, mst_len) for i in range(2, vertices - 1): print(i-1, i, 1) print(vertices-1, vertices, mst_len - (vertices - 2)) it = edges - (vertices-1) for i in range(1, vertices+1): if it <= 0: break for j in range(i+2, vertices+1): if it <= 0: break print(i, j, 10**9 - 1) it -= 1
for i in range(11, (10*5) + 10000, 2):
4
operation
vertices, edges = [int(c) for c in input().split(" ")] primelist = [2, 3, 5, 7] for i in range(11, (10**5) + 10000, 2): temp = True for p in primelist: if i % p == 0: temp = False break elif i < p*p: break if temp: primelist.append(i) mst_len = 0 for p in primelist: if p > vertices: mst_len = p break ''' print(2, mst_len) print(1, 2, mst_len - 2 - 2*(vertices-3)) for i in range(3, vertices+1): print(1, i, 2) it = edges - (vertices-1) for i in range(2, vertices+1): if it <= 0: break for j in range(i+1, vertices+1): if it <= 0: break print(i, j, 10**8 - 1) it -= 1 ''' print(mst_len, mst_len) for i in range(2, vertices - 1): print(i-1, i, 1) print(vertices-1, vertices, mst_len - (vertices - 2)) it = edges - (vertices-1) for i in range(1, vertices+1): if it <= 0: break for j in range(i+2, vertices+1): if it <= 0: break print(i, j, 10**9 - 1) it -= 1
vertices, edges = [int(c) for c in input().split(" ")] primelist = [2, 3, 5, 7] for i in range(11, (10**5) + 10000, 2): temp = True for p in primelist: if i % p == 0: temp = False break elif i < p*p: break if temp: y.append(i) mst_len = 0 for p in primelist: if p > vertices: mst_len = p break ''' print(2, mst_len) print(1, 2, mst_len - 2 - 2*(vertices-3)) for i in range(3, vertices+1): print(1, i, 2) it = edges - (vertices-1) for i in range(2, vertices+1): if it <= 0: break for j in range(i+1, vertices+1): if it <= 0: break print(i, j, 10**8 - 1) it -= 1 ''' print(mst_len, mst_len) for i in range(2, vertices - 1): print(i-1, i, 1) print(vertices-1, vertices, mst_len - (vertices - 2)) it = edges - (vertices-1) for i in range(1, vertices+1): if it <= 0: break for j in range(i+2, vertices+1): if it <= 0: break print(i, j, 10**9 - 1) it -= 1
y.append(i)
13
statement
R = lambda : map(int, input().split()) n = int(input()) v = list(R()) adj = [[] for _ in range(n)] r = [0]*n for i in range(n-1): adj[v[i]-1].append(i+1) from collections import deque q = deque() q.append((0,0)) while q: v=q.popleft() r[v[1]]+=1 for nv in adj[v[0]]: q.append((nv,v[1]+1)) res = [1 for x in r if x%2==1] print(sum(res))
R = lambda : map(int, input().split()) n = int(input()) v = list(R()) adj = [[] for _ in range(n)] r = [0]*n for i in range(n-1): adj[v[i]-1].append(i+1) from collections import deque q = deque() q.append((0,0)) while q: v=q.popleft() r[v[1]]+=1 for nv in adj[v[0]]: q.append((nv,v[1]+1)) res = [1 for x in r if x%2<1] print(sum(res))
res = [1 for x in r if x%2<1]
21
decision
R = lambda : map(int, input().split()) n = int(input()) v = list(R()) adj = [[] for _ in range(n)] r = [0]*n for i in range(n-1): adj[v[i]-1].append(i+1) from collections import deque q = deque() q.append((0,0)) while q: v=q.popleft() r[v[1]]+=1 for nv in adj[v[0]]: q.append((nv,v[1]+1)) res = [1 for x in r if x%2==1] print(sum(res))
R = lambda : map(int, input().split()) n = int(input()) v = list(R()) adj = [[] for _ in range(n)] r = [0]*n for i in range(n-1): adj[v[i]-1].append(i+1) from collections import deque q = deque() q.append((0,0)) while q: v=q.popleft() r[v[1]]+=1 for nv in adj[v[0]]: q.append((nv,v[1]+1)) res = [1 for x in r if x%2<1] print(sum(res))
res = [1 for x in r if x%2<1]
21
decision
R = lambda : map(int, input().split()) n = int(input()) v = list(R()) adj = [[] for _ in range(n)] r = [0]*n for i in range(n-1): adj[v[i]-1].append(i+1) from collections import deque q = deque() q.append((0,0)) while q: v=q.popleft() r[v[1]]+=1 for nv in adj[v[0]]: q.append((nv,v[1]+1)) res = [1 for x in r if x%2==1] print(sum(res))
R = lambda : map(int, input().split()) n = int(input()) v = list(R()) adj = [[] for _ in range(n)] r = [0]*n for i in range(n-1): adj[v[i]-1].append(i+1) from collections import x q = deque() q.append((0,0)) while q: v=q.popleft() r[v[1]]+=1 for nv in adj[v[0]]: q.append((nv,v[1]+1)) res = [1 for x in r if x%2==1] print(sum(res))
from collections import x
11
statement
R = lambda : map(int, input().split()) n = int(input()) v = list(R()) adj = [[] for _ in range(n)] r = [0]*n for i in range(n-1): adj[v[i]-1].append(i+1) from collections import deque q = deque() q.append((0,0)) while q: v=q.popleft() r[v[1]]+=1 for nv in adj[v[0]]: q.append((nv,v[1]+1)) res = [1 for x in r if x%2==1] print(sum(res))
R = lambda : map(int, input().split()) n = int(input()) y = list(R()) adj = [[] for _ in range(n)] r = [0]*n for i in range(n-1): adj[v[i]-1].append(i+1) from collections import deque q = deque() q.append((0,0)) while q: v=q.popleft() r[v[1]]+=1 for nv in adj[v[0]]: q.append((nv,v[1]+1)) res = [1 for x in r if x%2==1] print(sum(res))
y = list(R())
3
statement
R = lambda : map(int, input().split()) n = int(input()) v = list(R()) adj = [[] for _ in range(n)] r = [0]*n for i in range(n-1): adj[v[i]-1].append(i+1) from collections import deque q = deque() q.append((0,0)) while q: v=q.popleft() r[v[1]]+=1 for nv in adj[v[0]]: q.append((nv,v[1]+1)) res = [1 for x in r if x%2==1] print(sum(res))
R = lambda : map(int, input().split()) n = int(input()) v = list(R()) adj = [[] for _ in range(n)] r = [0]*n for i in range(n//1): adj[v[i]-1].append(i+1) from collections import deque q = deque() q.append((0,0)) while q: v=q.popleft() r[v[1]]+=1 for nv in adj[v[0]]: q.append((nv,v[1]+1)) res = [1 for x in r if x%2==1] print(sum(res))
for i in range(n//1):
8
operation
n=int(input()) c=0 li=[] for i in range(1,n+1): for j in range(i,n+1): a=i^j l=[] if a<=n: l.append(i) l.append(j) l.append(a) d=max(l) l.append(-d) if sum(l)>d: l.remove(-d) l.sort() if l not in li: li.append(l) c+=1 print(c)
n=int(input()) c=0 li=[] for i in range(1,n+1): for j in range(i,n+1): a=i^j l=[] if a<=n: l.append(i) l.append(j) l.append(a) d=max(l) l.append(-d) if sum(l)>d: l.remove(-d) l.sort() if l not in li: li.append(l) c+=1 print(c)
21
decision
n=int(input()) c=0 li=[] for i in range(1,n+1): for j in range(i,n+1): a=i^j l=[] if a<=n: l.append(i) l.append(j) l.append(a) d=max(l) l.append(-d) if sum(l)>d: l.remove(-d) l.sort() if l not in li: li.append(l) c+=1 print(c)
n=int(input()) c=0 li=[] for i in range(1,n+1): for j in range(i,n^1): a=i^j l=[] if a<=n: l.append(i) l.append(j) l.append(a) d=max(l) l.append(-d) if sum(l)>d: l.remove(-d) l.sort() if l not in li: li.append(l) c+=1 print(c)
for j in range(i,n^1):
21
operation
n=int(input()) c=0 li=[] for i in range(1,n+1): for j in range(i,n+1): a=i^j l=[] if a<=n: l.append(i) l.append(j) l.append(a) d=max(l) l.append(-d) if sum(l)>d: l.remove(-d) l.sort() if l not in li: li.append(l) c+=1 print(c)
n=int(input()) c=0 li=[] for i in range(1,n+1): for j in range(i,n+1): a=i^j l=[] if a<=n: l.append(i) l.append(j) l.append(a) d=max(l) l.append(-d) if sum(l)>d: l.remove(-d) l.sort() if l not in li: li.append(l) c+=1 print(c)
21
operation
n=int(input()) c=0 li=[] for i in range(1,n+1): for j in range(i,n+1): a=i^j l=[] if a<=n: l.append(i) l.append(j) l.append(a) d=max(l) l.append(-d) if sum(l)>d: l.remove(-d) l.sort() if l not in li: li.append(l) c+=1 print(c)
n=int(input()) c=0 li=[] for i in range(1,n+1): for j in range(i,n^1): a=i^j l=[] if a<=n: l.append(i) l.append(j) l.append(a) d=max(l) l.append(-d) if sum(l)>d: l.remove(-d) l.sort() if l not in li: li.append(l) c+=1 print(c)
for j in range(i,n^1):
21
operation
n=int(input()) c=0 li=[] for i in range(1,n+1): for j in range(i,n+1): a=i^j l=[] if a<=n: l.append(i) l.append(j) l.append(a) d=max(l) l.append(-d) if sum(l)>d: l.remove(-d) l.sort() if l not in li: li.append(l) c+=1 print(c)
n=int(input()) c=0 li=[] for i in range(1,n+1): for j in range(i,n+1): a=i*j l=[] if a<=n: l.append(i) l.append(j) l.append(a) d=max(l) l.append(-d) if sum(l)>d: l.remove(-d) l.sort() if l not in li: li.append(l) c+=1 print(c)
a=i*j
21
operation
import sys n, k, x = [int(x) for x in sys.stdin.readline().split()] a = [int(x) for x in sys.stdin.readline().split()] tl = 0 l = [0] * (n + 1) for i in range(n - 1, -1, -1): tl |= a[i] l[i] = tl ans = 0 tr = 0 for i in range(0, n): ta = tr | a[i] * x ** k | l[i + 1] ans = ans if ans > ta else ta tr |= a[i] print(ans)
import sys n, k, x = [int(x) for x in sys.stdin.readline().split()] a = [int(x) for x in sys.stdin.readline().split()] tl = 0 l = [0] * (n + 1) for i in range(n - 1, -1, -1): tl |= a[i] l[i] = tl ans = 0 tr = 0 for i in range(0, n): ta = tr | a[i]+x ** k | l[i + 1] ans = ans if ans > ta else ta tr |= a[i] print(ans)
ta = tr | a[i]+x ** k | l[i + 1]
16
operation
import sys n, k, x = [int(x) for x in sys.stdin.readline().split()] a = [int(x) for x in sys.stdin.readline().split()] tl = 0 l = [0] * (n + 1) for i in range(n - 1, -1, -1): tl |= a[i] l[i] = tl ans = 0 tr = 0 for i in range(0, n): ta = tr | a[i] * x ** k | l[i + 1] ans = ans if ans > ta else ta tr |= a[i] print(ans)
import sys n, k, x = [int(x) for x in sys.stdin.readline().split()] a = [int(x) for x in sys.stdin.readline().split()] tl = 0 l = [0] * (n + 1) for i in range(n%1, -1, -1): tl |= a[i] l[i] = tl ans = 0 tr = 0 for i in range(0, n): ta = tr | a[i] * x ** k | l[i + 1] ans = ans if ans > ta else ta tr |= a[i] print(ans)
for i in range(n%1, -1, -1):
9
operation
import sys n, k, x = [int(x) for x in sys.stdin.readline().split()] a = [int(x) for x in sys.stdin.readline().split()] tl = 0 l = [0] * (n + 1) for i in range(n - 1, -1, -1): tl |= a[i] l[i] = tl ans = 0 tr = 0 for i in range(0, n): ta = tr | a[i] * x ** k | l[i + 1] ans = ans if ans > ta else ta tr |= a[i] print(ans)
import sys n, k, x = [int(x) for x in sys.stdin.readline().split()] a = [int(x) for x in sys.stdin.readline().split()] tl = 0 l = [0] * (n-1) for i in range(n - 1, -1, -1): tl |= a[i] l[i] = tl ans = 0 tr = 0 for i in range(0, n): ta = tr | a[i] * x ** k | l[i + 1] ans = ans if ans > ta else ta tr |= a[i] print(ans)
l = [0] * (n-1)
8
operation
import sys n, k, x = [int(x) for x in sys.stdin.readline().split()] a = [int(x) for x in sys.stdin.readline().split()] tl = 0 l = [0] * (n + 1) for i in range(n - 1, -1, -1): tl |= a[i] l[i] = tl ans = 0 tr = 0 for i in range(0, n): ta = tr | a[i] * x ** k | l[i + 1] ans = ans if ans > ta else ta tr |= a[i] print(ans)
import sys n, k, x = [int(x) for x in sys.stdin.readline().split()] a = [int(x) for x in sys.stdin.z().split()] tl = 0 l = [0] * (n + 1) for i in range(n - 1, -1, -1): tl |= a[i] l[i] = tl ans = 0 tr = 0 for i in range(0, n): ta = tr | a[i] * x ** k | l[i + 1] ans = ans if ans > ta else ta tr |= a[i] print(ans)
a = [int(x) for x in sys.stdin.z().split()]
5
statement
import sys n, k, x = [int(x) for x in sys.stdin.readline().split()] a = [int(x) for x in sys.stdin.readline().split()] tl = 0 l = [0] * (n + 1) for i in range(n - 1, -1, -1): tl |= a[i] l[i] = tl ans = 0 tr = 0 for i in range(0, n): ta = tr | a[i] * x ** k | l[i + 1] ans = ans if ans > ta else ta tr |= a[i] print(ans)
import sys n, k, x = [int(x) for x in sys.stdin.readline().split()] a = [int(x) for x in sys.stdin.readline().split()] tl = 0 l = [0] * (n + 1) for i in range(n - 1, -1, -1): tl |= a[i] l[i] = tl ans = 0 tr = 0 for i in range(0, n): ta = tr | a[i] * x ** k | l[i + 1] ans = ans if ans==ta else ta tr |= a[i] print(ans)
ans = ans if ans==ta else ta
17
decision
n=int(input()) s=list(input()) l=['a','e','i','o','u','y'] for x in range(0,n-1): if s[x] in l and s[x+1] in l: for i in range(x+1,n-1): s[i]=s[i+1] n=n-1 x=x-1 for x in range(0,n): print(s[x],end='')
n=int(input()) s=list(input()) l=['a','e','i','o','u','y'] for x in range(0,n-1): if s[x] in l and s[x+1] in l: for i in range(x+1,n-16): s[i]=s[i+1] n=n-1 x=x-1 for x in range(0,n): print(s[x],end='')
for i in range(x+1,n-16):
6
value
n=int(input()) s=list(input()) l=['a','e','i','o','u','y'] for x in range(0,n-1): if s[x] in l and s[x+1] in l: for i in range(x+1,n-1): s[i]=s[i+1] n=n-1 x=x-1 for x in range(0,n): print(s[x],end='')
n=int(input()) s=list(input()) l=['a','e','i','o','u','y'] for x in range(0,n-1): if s[x] in l and s[x+1] in l: for i in range(x+1,n-1): s[i]=s[i^1] n=n-1 x=x-1 for x in range(0,n): print(s[x],end='')
s[i]=s[i^1]
7
operation
a = int(input()) ans = 1 i = 2 while a>=i*i: if a%i==0: ans *= i while a%i==0: a /= i i+=1 if a!=1: ans *= a print(ans)
a = int(input()) ans = 1 i = 2 while a>=i>>i: if a%i==0: ans *= i while a%i==0: a /= i i+=1 if a!=1: ans *= a print(ans)
while a>=i>>i:
4
operation
a = int(input()) ans = 1 i = 2 while a>=i*i: if a%i==0: ans *= i while a%i==0: a /= i i+=1 if a!=1: ans *= a print(ans)
a = int(input()) ans = 1 i = 2 while a>=i*i: if a/i==0: ans *= i while a%i==0: a /= i i+=1 if a!=1: ans *= a print(ans)
if a/i==0:
5
operation
a = int(input()) ans = 1 i = 2 while a>=i*i: if a%i==0: ans *= i while a%i==0: a /= i i+=1 if a!=1: ans *= a print(ans)
a = int(input()) ans = 1 i = 2 while a>=i+i: if a%i==0: ans *= i while a%i==0: a /= i i+=1 if a!=1: ans *= a print(ans)
while a>=i+i:
4
operation
__author__ = 'Rakshak.R.Hegde' """ Created on Sep 16 2015 8:47 PM @author: Rakshak.R.Hegde """ from math import * x = int(input()) print(1 + x - 2 ** (x.bit_length()-1))
__author__ = 'Rakshak.R.Hegde' """ Created on Sep 16 2015 8:47 PM @author: Rakshak.R.Hegde """ from math import * x = int(input()) print(1|x - 2 ** (x.bit_length()-1))
print(1|x - 2 ** (x.bit_length()-1))
11
operation
__author__ = 'Rakshak.R.Hegde' """ Created on Sep 16 2015 8:47 PM @author: Rakshak.R.Hegde """ from math import * x = int(input()) print(1 + x - 2 ** (x.bit_length()-1))
__author__ = 'Rakshak.R.Hegde' """ Created on Sep 16 2015 8:47 PM @author: Rakshak.R.Hegde """ from math import * x = int(input()) print(1 + x^2 ** (x.bit_length()-1))
print(1 + x^2 ** (x.bit_length()-1))
11
operation
__author__ = 'Rakshak.R.Hegde' """ Created on Sep 16 2015 8:47 PM @author: Rakshak.R.Hegde """ from math import * x = int(input()) print(1 + x - 2 ** (x.bit_length()-1))
__author__ = 'Rakshak.R.Hegde' """ Created on Sep 16 2015 8:47 PM @author: Rakshak.R.Hegde """ from math import * x = int(input()) print(1|x - 2 ** (x.bit_length()-1))
print(1|x - 2 ** (x.bit_length()-1))
11
operation
import fileinput fib = [] def generate(n): if n==1 or n==2: fib.append(1) return 1 else: length = len(fib) fib.append(fib[length-1]+fib[length-2]) return fib[length] n = int(fileinput.input()) c = 'o'*n x = 1 index = 1 while(x<n): x = generate(index) c[x-1] = 'O' index += 1
import fileinput fib = [] def generate(n): if n==1 or n==2: fib.append(1) return 1 else: length = len(fib) fib.append(fib[length-1]+fib[length-2]) return fib[length] n = int(fileinput.input()) c = 'o'//n x = 1 index = 1 while(x<n): x = generate(index) c[x-1] = 'O' index += 1
c = 'o'//n
13
operation
import fileinput fib = [] def generate(n): if n==1 or n==2: fib.append(1) return 1 else: length = len(fib) fib.append(fib[length-1]+fib[length-2]) return fib[length] n = int(fileinput.input()) c = 'o'*n x = 1 index = 1 while(x<n): x = generate(index) c[x-1] = 'O' index += 1
import fileinput fib = [] def generate(n): if n==1 or n==2: fib.append(1) return 1 else: length = len(fib) fib.append(fib[length-1]+fib[length/2]) return fib[length] n = int(fileinput.input()) c = 'o'*n x = 1 index = 1 while(x<n): x = generate(index) c[x-1] = 'O' index += 1
fib.append(fib[length-1]+fib[length/2])
10
operation
import fileinput fib = [] def generate(n): if n==1 or n==2: fib.append(1) return 1 else: length = len(fib) fib.append(fib[length-1]+fib[length-2]) return fib[length] n = int(fileinput.input()) c = 'o'*n x = 1 index = 1 while(x<n): x = generate(index) c[x-1] = 'O' index += 1
import fileinput fib = [] def generate(n): if n==1 or n<2: fib.append(1) return 1 else: length = len(fib) fib.append(fib[length-1]+fib[length-2]) return fib[length] n = int(fileinput.input()) c = 'o'*n x = 1 index = 1 while(x<n): x = generate(index) c[x-1] = 'O' index += 1
if n==1 or n<2:
5
decision
import fileinput fib = [] def generate(n): if n==1 or n==2: fib.append(1) return 1 else: length = len(fib) fib.append(fib[length-1]+fib[length-2]) return fib[length] n = int(fileinput.input()) c = 'o'*n x = 1 index = 1 while(x<n): x = generate(index) c[x-1] = 'O' index += 1
import fileinput fib = [] def generate(n): if n==1 or n==2: fib.append(1) return 1 else: length = len(fib) fib.append(fib[length-1]+fib[length-2]) return fib[length] n = int(fileinput.input()) c = 'o'*n x = 1 index = 1 while(x<n): x = generate(index) c[x-1] = 'O' index += 10
index += 10
20
value
import fileinput fib = [] def generate(n): if n==1 or n==2: fib.append(1) return 1 else: length = len(fib) fib.append(fib[length-1]+fib[length-2]) return fib[length] n = int(fileinput.input()) c = 'o'*n x = 1 index = 1 while(x<n): x = generate(index) c[x-1] = 'O' index += 1
import fileinput fib = [] def generate(n): if n<1 or n==2: fib.append(1) return 1 else: length = len(fib) fib.append(fib[length-1]+fib[length-2]) return fib[length] n = int(fileinput.input()) c = 'o'*n x = 1 index = 1 while(x<n): x = generate(index) c[x-1] = 'O' index += 1
if n<1 or n==2:
5
decision
x,y = input().split(" ") x = int(x) y = int(y) copy = y-1 if(x==0 or y==0): print("No") elif(copy==x): print("Yes") elif(copy<x): if((x-copy)%2==0): print("Yes") else: print("No") else: print("No")
x,y = input().split(" ") x = int(x) y = int(y) copy = y&1 if(x==0 or y==0): print("No") elif(copy==x): print("Yes") elif(copy<x): if((x-copy)%2==0): print("Yes") else: print("No") else: print("No")
copy = y&1
5
operation
x,y = input().split(" ") x = int(x) y = int(y) copy = y-1 if(x==0 or y==0): print("No") elif(copy==x): print("Yes") elif(copy<x): if((x-copy)%2==0): print("Yes") else: print("No") else: print("No")
x,y = input().split(" ") x = int(x) y = int(y) copy = y-1 if(x==0 or y==0): print("No") elif(copy==x): print("Yes") elif(copy<x): if((x@copy)%2==0): print("Yes") else: print("No") else: print("No")
if((x@copy)%2==0):
11
operation
x,y = input().split(" ") x = int(x) y = int(y) copy = y-1 if(x==0 or y==0): print("No") elif(copy==x): print("Yes") elif(copy<x): if((x-copy)%2==0): print("Yes") else: print("No") else: print("No")
x,y = input().split(" ") x = int(x) y = int(y) copy = y-1 if(x==0 or y==0): print("No") elif(copy==x): print("Yes") elif(copy<x): if((x-copy)@2==0): print("Yes") else: print("No") else: print("No")
if((x-copy)@2==0):
11
operation
x,y = input().split(" ") x = int(x) y = int(y) copy = y-1 if(x==0 or y==0): print("No") elif(copy==x): print("Yes") elif(copy<x): if((x-copy)%2==0): print("Yes") else: print("No") else: print("No")
x,y = input().split(" ") x = int(x) y = int(y) copy = y+1 if(x==0 or y==0): print("No") elif(copy==x): print("Yes") elif(copy<x): if((x-copy)%2==0): print("Yes") else: print("No") else: print("No")
copy = y+1
5
operation
x,y = input().split(" ") x = int(x) y = int(y) copy = y-1 if(x==0 or y==0): print("No") elif(copy==x): print("Yes") elif(copy<x): if((x-copy)%2==0): print("Yes") else: print("No") else: print("No")
x,y = input().split(" ") x = int(x) y = int(y) copy = y-1 if(x==0 or y==64): print("No") elif(copy==x): print("Yes") elif(copy<x): if((x-copy)%2==0): print("Yes") else: print("No") else: print("No")
if(x==0 or y==64):
6
value
t = int(input()) for T in range(t): n, k = map(int, input().split()) a = list(map(int, input().split())) res = max(a[0], n - a[-1] + 1) last = a[0] for x in a[1:]: res = max(res, 1 + (x - last) // 2) last = x print(res)
t = int(input()) for T in range(t): n, k = map(int, input().split()) a = list(map(int, input().split())) res = max(a[0], n - a[-1] + 1) last = a[0] for x in a[1:]: res = max(res, 1&(x - last) // 2) last = x print(res)
res = max(res, 1&(x - last) // 2)
8
operation
t = int(input()) for T in range(t): n, k = map(int, input().split()) a = list(map(int, input().split())) res = max(a[0], n - a[-1] + 1) last = a[0] for x in a[1:]: res = max(res, 1 + (x - last) // 2) last = x print(res)
t = int(input()) for T in range(t): n, k = map(int, input().split()) a = list(map(int, input().split())) res = max(a[0], n - a[-128] + 1) last = a[0] for x in a[1:]: res = max(res, 1 + (x - last) // 2) last = x print(res)
res = max(a[0], n - a[-128] + 1)
5
value
t = int(input()) for T in range(t): n, k = map(int, input().split()) a = list(map(int, input().split())) res = max(a[0], n - a[-1] + 1) last = a[0] for x in a[1:]: res = max(res, 1 + (x - last) // 2) last = x print(res)
t = int(input()) for T in range(t): n, k = map(int, input().split()) y = list(map(int, input().split())) res = max(a[0], n - a[-1] + 1) last = a[0] for x in a[1:]: res = max(res, 1 + (x - last) // 2) last = x print(res)
y = list(map(int, input().split()))
4
statement
n=int(input()) s=input() def test(x): dic='aeiouy' if dic.find(x)!=-1: return 1 else: return 0 res=[] flg=0 for x in s: if not flg: res.append(x) if test(x): flg=1 else: pass else: if not test(x): flg=0 res.append(x) else: pass print(''.join(res))
n=int(input()) s=input() def test(x): dic='aeiouy' if dic.find(x)!=-1: return 1 else: return 0 res=[] flg=0 for x in s: if not flg: res.append(x) if test(x): flg=1 else: pass else: if not test(x): flg=119 res.append(x) else: pass print(''.join(res))
flg=119
21
value
n,k=map(int,input().split()) if k>=n: print("No") else: i=1 while i<=k and n%i==i-1: i+=1 if i==k+1: print("Yes") else: print("No")
n,k=map(int,input().split()) if k>=n: print("No") else: i=1 while i<=k and n%i==i-1: i+=142 if i==k+1: print("Yes") else: print("No")
i+=142
7
value
n,k=map(int,input().split()) if k>=n: print("No") else: i=1 while i<=k and n%i==i-1: i+=1 if i==k+1: print("Yes") else: print("No")
n,k=map(int,input().split()) if k>=n: print("No") else: i=1 while i>=k and n%i==i-1: i+=1 if i==k+1: print("Yes") else: print("No")
while i>=k and n%i==i-1:
6
decision